superdoc 2.18.0-next.5 → 2.18.0-next.6
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-cdn/superdoc.min.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var SuperDoc=(function(){var VE=Object.create,Fh=Object.defineProperty,UE=Object.getOwnPropertyDescriptor,HE=Object.getOwnPropertyNames,$E=Object.getPrototypeOf,GE=Object.prototype.hasOwnProperty,xr=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}},z2=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Ld=(e,t)=>{let n={};for(var r in e)Fh(n,r,{get:e[r],enumerable:!0});return t||Fh(n,Symbol.toStringTag,{value:"Module"}),n},WE=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=HE(t),i=0,s=o.length,a;i<s;i++)a=o[i],!GE.call(e,a)&&a!==n&&Fh(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=UE(t,a))||r.enumerable});return e},j2=(e,t,n)=>(n=e!=null?VE($E(e)):{},WE(t||!e||!e.__esModule?Fh(n,"default",{value:e,enumerable:!0}):n,e)),Dd=new WeakMap,KE=0,V2=["documentId","generation","actionId","commandId","operation","source","origin","outcome","phase","success","changed","dryRun","revision","txId","direction","inputType","inputKind","editableCommandKind","dataLength","isComposing","hasRangeSelection","durationMs","elapsedMs","code","reason","failureSource","diagnosticCode","diagnosticStage","internalCode","severity","status","state","beforeHello","remoteGeneration","changedStoryIds","changedPartUris","reviewChanged","saveId","byteLength","targetCommitSequence","paintedCommitSequence","paintedRenderInputEpoch","health","commitSequence","documentEpoch","renderInputEpoch","layoutEpoch","renderEpoch","hasCommitEvent","input","receipt","result","failure","selection","target","selectionTarget","start","end","from","to","offset","blockId","nodeId","kind","story","storyType","id","empty","activeMarks","affectedStories","inserted","updated","removed","invalidatedRefs","remappedRefs","textRangeShifts","insertedLength","deletedLength","renderCommit","snapshot","lifecycle","workerFailure","timing","selectionBefore","selectionAfter"],qE=["text","data","message","errorMessage","quotedText","value"];function rl(e,t){if(!(!e||typeof e!="object"))return Object.getOwnPropertyDescriptor(e,t)?.value}function U2(e,t,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=n?e:t}var YE=class{constructor(e,t){this.version=t,this.sessionId=`interaction-${++KE}`,this.slots=[],this.head=0,this.count=0,this.sequence=0,this.actions=0,this.bytes=0,this.evicted=0,this.truncated=0,this.failures=0,this.closed=!1,this.cleanups=[];const n=rl(rl(e,"diagnostics"),"history");this.enabled=rl(n,"enabled")!==!1,this.captureContent=rl(n,"captureContent")===!0,this.maxEvents=U2(rl(n,"maxEvents"),500,1e4),this.maxBytes=U2(rl(n,"maxBytes"),1048576,16777216)}record(e,t){if(!(!this.enabled||this.closed))try{let n=!1,r=128;const o=(l,u=0)=>{if(--r<0||u>5){n=!0;return}if(l===null||typeof l=="boolean")return l;if(typeof l=="number")return Number.isFinite(l)?l:void 0;if(typeof l=="string")return l.length>512&&(n=!0),l.slice(0,512);if(!l||typeof l!="object")return;if(Array.isArray(l)){const f=Math.min(l.length,16);l.length>f&&(n=!0);const p=[];for(let g=0;g<f&&r>0;g++)p.push(o(rl(l,String(g)),u+1)??null);return p}const d={};for(const f of this.captureContent?[...V2,...qE]:V2){if(r<=0){n=!0;break}const p=rl(l,f);if(p===void 0)continue;const g=o(p,u+1);g!==void 0&&(d[f]=g)}return d},i=o(t())??{};if(e==="selection:changed"){const l=JSON.stringify(i);if(l===this.lastSelection)return;this.lastSelection=l}else this.lastSelection=void 0;const s={sequence:++this.sequence,observedAt:Date.now(),type:e,data:i,truncated:n};let a=JSON.stringify(s);if(a.length*2>Math.min(8192,this.maxBytes)&&(s.data={},s.truncated=!0,a=JSON.stringify(s)),s.truncated&&this.truncated++,a.length*2>this.maxBytes){this.evicted++;return}for(;this.count&&(this.count>=this.maxEvents||this.bytes+a.length*2>this.maxBytes);){const l=this.slots[this.head];this.bytes-=l.length*2,this.slots[this.head]=void 0,this.head=(this.head+1)%this.maxEvents,this.count--,this.evicted++}this.slots[(this.head+this.count)%this.maxEvents]=a,this.count++,this.bytes+=a.length*2}catch{this.failures++}}action(){return this.enabled&&!this.closed?`${this.sessionId}:${++this.actions}`:void 0}snapshot(){const e=[];try{for(let n=0;n<this.count;n++)e.push(JSON.parse(this.slots[(this.head+n)%this.maxEvents]))}catch{this.failures++}let t="unknown";try{t=this.version()}catch{this.failures++}return{schemaVersion:1,sessionId:this.sessionId,version:t,enabled:this.enabled,events:e,retainedBytes:this.bytes,evictedEvents:this.evicted,truncatedEvents:this.truncated,captureFailures:this.failures}}clear(){this.slots=[],this.head=0,this.count=0,this.bytes=0,this.evicted=0,this.truncated=0,this.failures=0,this.lastSelection=void 0}attach(e){if(this.enabled)for(const t of["keydown","beforeinput","compositionstart","compositionend","paste","cut","drop"]){const n=r=>this.record(`input:${t}`,()=>{const o=r;if(r.type==="keydown"){const i=r;return{inputKind:["Backspace","Delete","Enter","Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(i.key)?i.key:"key",dataLength:i.key.length===1?1:void 0,isComposing:i.isComposing}}return{inputType:o.inputType,dataLength:o.data?.length,isComposing:o.isComposing,...this.captureContent?{data:o.data}:{}}});try{e.addEventListener(t,n,!0),this.cleanups.push(()=>e.removeEventListener(t,n,!0))}catch{this.failures++}}}close(){this.closed=!0;for(const e of this.cleanups)try{e()}catch{this.failures++}this.cleanups=[]}},H2=()=>({schemaVersion:1,sessionId:"unavailable",version:"unknown",enabled:!1,events:[],retainedBytes:0,evictedEvents:0,truncatedEvents:0,captureFailures:1}),XE=Object.freeze({getSnapshot:H2,clear(){}});function ZE(e,t,n,r){try{const o=new YE(t,n);Dd.set(e,o),o.attach(r);const i=Object.freeze({getSnapshot:()=>{try{return o.snapshot()}catch{return H2()}},clear:()=>{try{o.clear()}catch{}}});return o.record("instance:created",()=>({})),i}catch{return XE}}function Od(e,t,n){try{e&&Dd.get(e)?.record(t,n)}catch{}}function QE(e,t,n){try{const r=Dd.get(e),o=r?.action();return o&&r?.record(t,()=>({...n(),actionId:o})),o}catch{return}}function JE(e){try{Dd.get(e)?.close(),Dd.delete(e)}catch{}}var eT=z2(((e,t)=>{var n=Object.prototype.hasOwnProperty,r="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(r=!1));function i(u,d,f){this.fn=u,this.context=d,this.once=f||!1}function s(u,d,f,p,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var m=new i(f,p||u,g),v=r?r+d:d;return u._events[v]?u._events[v].fn?u._events[v]=[u._events[v],m]:u._events[v].push(m):(u._events[v]=m,u._eventsCount++),u}function a(u,d){--u._eventsCount===0?u._events=new o:delete u._events[d]}function l(){this._events=new o,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],f,p;if(this._eventsCount===0)return d;for(p in f=this._events)n.call(f,p)&&d.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},l.prototype.listeners=function(d){var f=r?r+d:d,p=this._events[f];if(!p)return[];if(p.fn)return[p.fn];for(var g=0,m=p.length,v=new Array(m);g<m;g++)v[g]=p[g].fn;return v},l.prototype.listenerCount=function(d){var f=r?r+d:d,p=this._events[f];return p?p.fn?1:p.length:0},l.prototype.emit=function(d,f,p,g,m,v){var k=r?r+d:d;if(!this._events[k])return!1;var b=this._events[k],S=arguments.length,C,w;if(b.fn){switch(b.once&&this.removeListener(d,b.fn,void 0,!0),S){case 1:return b.fn.call(b.context),!0;case 2:return b.fn.call(b.context,f),!0;case 3:return b.fn.call(b.context,f,p),!0;case 4:return b.fn.call(b.context,f,p,g),!0;case 5:return b.fn.call(b.context,f,p,g,m),!0;case 6:return b.fn.call(b.context,f,p,g,m,v),!0}for(w=1,C=new Array(S-1);w<S;w++)C[w-1]=arguments[w];b.fn.apply(b.context,C)}else{var T=b.length,L;for(w=0;w<T;w++)switch(b[w].once&&this.removeListener(d,b[w].fn,void 0,!0),S){case 1:b[w].fn.call(b[w].context);break;case 2:b[w].fn.call(b[w].context,f);break;case 3:b[w].fn.call(b[w].context,f,p);break;case 4:b[w].fn.call(b[w].context,f,p,g);break;default:if(!C)for(L=1,C=new Array(S-1);L<S;L++)C[L-1]=arguments[L];b[w].fn.apply(b[w].context,C)}}return!0},l.prototype.on=function(d,f,p){return s(this,d,f,p,!1)},l.prototype.once=function(d,f,p){return s(this,d,f,p,!0)},l.prototype.removeListener=function(d,f,p,g){var m=r?r+d:d;if(!this._events[m])return this;if(!f)return a(this,m),this;var v=this._events[m];if(v.fn)v.fn===f&&(!g||v.once)&&(!p||v.context===p)&&a(this,m);else{for(var k=0,b=[],S=v.length;k<S;k++)(v[k].fn!==f||g&&!v[k].once||p&&v[k].context!==p)&&b.push(v[k]);b.length?this._events[m]=b.length===1?b[0]:b:a(this,m)}return this},l.prototype.removeAllListeners=function(d){var f;return d?(f=r?r+d:d,this._events[f]&&a(this,f)):(this._events=new o,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,typeof t<"u"&&(t.exports=l)})),jg=j2(eT(),1),Co=[];for(let e=0;e<256;++e)Co.push((e+256).toString(16).slice(1));function tT(e,t=0){return(Co[e[t+0]]+Co[e[t+1]]+Co[e[t+2]]+Co[e[t+3]]+"-"+Co[e[t+4]]+Co[e[t+5]]+"-"+Co[e[t+6]]+Co[e[t+7]]+"-"+Co[e[t+8]]+Co[e[t+9]]+"-"+Co[e[t+10]]+Co[e[t+11]]+Co[e[t+12]]+Co[e[t+13]]+Co[e[t+14]]+Co[e[t+15]]).toLowerCase()}var Vg,nT=new Uint8Array(16);function rT(){if(!Vg){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Vg=crypto.getRandomValues.bind(crypto)}return Vg(nT)}var oT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),$2={randomUUID:oT};function ol(e,t,n){if($2.randomUUID&&!t&&!e)return $2.randomUUID();e=e||{};const r=e.random??e.rng?.()??rT();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return tT(r)}function Pd(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}function bn(e){if(zt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Xn(r)?iT(r):bn(r);if(o)for(const i in o)t[i]=o[i]}return t}else if(Xn(e)||Fn(e))return e}function iT(e){const t={};return e.replace(t1,"").split(J2).forEach(n=>{if(n){const r=n.split(e1);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function en(e){let t="";if(Xn(e))t=e;else if(zt(e))for(let n=0;n<e.length;n++){const r=en(e[n]);r&&(t+=r+" ")}else if(Fn(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function Ug(e){if(!e)return null;let{class:t,style:n}=e;return t&&!Xn(t)&&(e.class=en(t)),n&&(e.style=bn(n)),e}function G2(e){return!!e||e===""}function sT(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=da(e[r],t[r]);return n}function da(e,t){if(e===t)return!0;let n=$g(e),r=$g(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=ti(e),r=ti(t),n||r)return e===t;if(n=zt(e),r=zt(t),n||r)return n&&r?sT(e,t):!1;if(n=Fn(e),r=Fn(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(const o in e){const i=e.hasOwnProperty(o),s=t.hasOwnProperty(o);if(i&&!s||!i&&s||!da(e[o],t[o]))return!1}}return String(e)===String(t)}function Nh(e,t){return e.findIndex(n=>da(n,t))}function aT(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:(typeof e!="number"||Number.isFinite(e),String(e))}var Dn,oc,gi,Hg,ou,Fd,Gn,Bh,W2,jn,zt,ic,il,$g,K2,Zt,Xn,ti,Fn,zh,Gg,sc,q2,Nd,Bd,sl,zd,Y2,Nr,X2,Vo,iu,su,so,ac,Wg,jd,Vd,Z2,Ud,Q2,J2,e1,t1,Kg,n1,lT,qg,Ut,Yg,jh,Xg=xr((()=>{Dn={},oc=[],gi=()=>{},Hg=()=>!1,ou=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Fd=e=>e.startsWith("onUpdate:"),Gn=Object.assign,Bh=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},W2=Object.prototype.hasOwnProperty,jn=(e,t)=>W2.call(e,t),zt=Array.isArray,ic=e=>sc(e)==="[object Map]",il=e=>sc(e)==="[object Set]",$g=e=>sc(e)==="[object Date]",K2=e=>sc(e)==="[object RegExp]",Zt=e=>typeof e=="function",Xn=e=>typeof e=="string",ti=e=>typeof e=="symbol",Fn=e=>e!==null&&typeof e=="object",zh=e=>(Fn(e)||Zt(e))&&Zt(e.then)&&Zt(e.catch),Gg=Object.prototype.toString,sc=e=>Gg.call(e),q2=e=>sc(e).slice(8,-1),Nd=e=>sc(e)==="[object Object]",Bd=e=>Xn(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,sl=Pd(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),zd=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Y2=/-\w/g,Nr=zd(e=>e.replace(Y2,t=>t.slice(1).toUpperCase())),X2=/\B([A-Z])/g,Vo=zd(e=>e.replace(X2,"-$1").toLowerCase()),iu=zd(e=>e.charAt(0).toUpperCase()+e.slice(1)),su=zd(e=>e?`on${iu(e)}`:""),so=(e,t)=>!Object.is(e,t),ac=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Wg=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},jd=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Vd=e=>{const t=Xn(e)?Number(e):NaN;return isNaN(t)?e:t},Ud=()=>Z2||(Z2=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Q2=Pd("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"),J2=/;(?![^(]*\))/g,e1=/:([^]+)/,t1=/\/\*[^]*?\*\//g,Kg="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",n1=Pd(Kg),lT=Pd(Kg+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),qg=e=>!!(e&&e.__v_isRef===!0),Ut=e=>Xn(e)?e:e==null?"":zt(e)||Fn(e)&&(e.toString===Gg||!Zt(e.toString))?qg(e)?Ut(e.value):JSON.stringify(e,Yg,2):String(e),Yg=(e,t)=>qg(t)?Yg(e,t.value):ic(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],i)=>(n[jh(r,i)+" =>"]=o,n),{})}:il(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>jh(n))}:ti(t)?jh(t):Fn(t)&&!zt(t)&&!Nd(t)?String(t):t,jh=(e,t="")=>{var n;return ti(e)?`Symbol(${(n=e.description)!=null?n:t})`:e}}));function Zg(e){return new Wh(e)}function Qg(){return Mo}function r1(e,t=!1){Mo&&Mo.cleanups.push(e)}function o1(e,t=!1){if(e.flags|=8,t){e.next=Wd,Wd=e;return}e.next=Gd,Gd=e}function Jg(){av++}function ev(){if(--av>0)return;if(Wd){let t=Wd;for(Wd=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Gd;){let t=Gd;for(Gd=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function i1(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function s1(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),nv(r),cT(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function tv(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(a1(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function a1(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===cu)||(e.globalVersion=cu,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!tv(e))))return;e.flags|=2;const t=e.dep,n=or,r=Ni;or=e,Ni=!0;try{i1(e);const o=e.fn(e._value);(t.version===0||so(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{or=n,Ni=r,s1(e),e.flags&=-3}}function nv(e,t=!1){const{dep:n,prevSub:r,nextSub:o}=e;if(r&&(r.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)nv(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function cT(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function uT(e,t){e.effect instanceof lu&&(e=e.effect.fn);const n=new lu(e);t&&Gn(n,t);try{n.run()}catch(o){throw n.stop(),o}const r=n.run.bind(n);return r.effect=n,r}function dT(e){e.effect.stop()}function fa(){lv.push(Ni),Ni=!1}function ha(){const e=lv.pop();Ni=e===void 0?!0:e}function l1(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=or;or=void 0;try{t()}finally{or=n}}}function c1(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)c1(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}function Ro(e,t,n){if(Ni&&or){let r=qd.get(e);r||qd.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new Kd),o.map=r,o.key=n),o.track()}}function pa(e,t,n,r,o,i){const s=qd.get(e);if(!s){cu++;return}const a=l=>{l&&l.trigger()};if(Jg(),t==="clear")s.forEach(a);else{const l=zt(e),u=l&&Bd(n);if(l&&n==="length"){const d=Number(r);s.forEach((f,p)=>{(p==="length"||p===uu||!ti(p)&&p>=d)&&a(f)})}else switch((n!==void 0||s.has(void 0))&&a(s.get(n)),u&&a(s.get(uu)),t){case"add":l?u&&a(s.get("length")):(a(s.get(al)),ic(e)&&a(s.get(qh)));break;case"delete":l||(a(s.get(al)),ic(e)&&a(s.get(qh)));break;case"set":ic(e)&&a(s.get(al));break}}ev()}function fT(e,t){const n=qd.get(e);return n&&n.get(t)}function au(e){const t=pn(e);return t===e?t:(Ro(t,"iterate",uu),ni(e)?t:t.map(Bi))}function Vh(e){return Ro(e=pn(e),"iterate",uu),e}function Ts(e,t){return xs(e)?lc(Fi(e)?Bi(t):t):Bi(t)}function rv(e,t,n){const r=Vh(e),o=r[t]();return r!==e&&!ni(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}function ma(e,t,n,r,o,i){const s=Vh(e),a=s!==e&&!ni(e),l=s[t];if(l!==b1[t]){const f=l.apply(e,i);return a?Bi(f):f}let u=n;s!==e&&(a?u=function(f,p){return n.call(this,Ts(e,f),p,e)}:n.length>2&&(u=function(f,p){return n.call(this,f,p,e)}));const d=l.call(s,u,r);return a&&o?o(d):d}function u1(e,t,n,r){const o=Vh(e),i=o!==e&&!ni(e);let s=n,a=!1;o!==e&&(i?(a=r.length===0,s=function(u,d,f){return a&&(a=!1,u=Ts(e,u)),n.call(this,u,Ts(e,d),f,e)}):n.length>3&&(s=function(u,d,f){return n.call(this,u,d,f,e)}));const l=o[t](s,...r);return a?Ts(e,l):l}function ov(e,t,n){const r=pn(e);Ro(r,"iterate",uu);const o=r[t](...n);return(o===-1||o===!1)&&$d(n[0])?(n[0]=pn(n[0]),r[t](...n)):o}function Hd(e,t,n=[]){fa(),Jg();const r=pn(e)[t].apply(e,n);return ev(),ha(),r}function hT(e){ti(e)||(e=String(e));const t=pn(this);return Ro(t,"has",e),t.hasOwnProperty(e)}function pT(e,t,n){return function(...r){const o=this.__v_raw,i=pn(o),s=ic(i),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,u=o[e](...r),d=n?Yh:t?lc:Bi;return!t&&Ro(i,"iterate",l?qh:al),Gn(Object.create(u),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:a?[d(f[0]),d(f[1])]:d(f),done:p}}})}}function Uh(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function mT(e,t){const n={get(r){const o=this.__v_raw,i=pn(o),s=pn(r);e||(so(r,s)&&Ro(i,"get",r),Ro(i,"get",s));const{has:a}=Yd(i),l=t?Yh:e?lc:Bi;if(a.call(i,r))return l(o.get(r));if(a.call(i,s))return l(o.get(s));o!==i&&o.get(r)},get size(){const r=this.__v_raw;return!e&&Ro(pn(r),"iterate",al),r.size},has(r){const o=this.__v_raw,i=pn(o),s=pn(r);return e||(so(r,s)&&Ro(i,"has",r),Ro(i,"has",s)),r===s?o.has(r):o.has(r)||o.has(s)},forEach(r,o){const i=this,s=i.__v_raw,a=pn(s),l=t?Yh:e?lc:Bi;return!e&&Ro(a,"iterate",al),s.forEach((u,d)=>r.call(o,l(u),l(d),i))}};return Gn(n,e?{add:Uh("add"),set:Uh("set"),delete:Uh("delete"),clear:Uh("clear")}:{add(r){const o=pn(this),i=Yd(o),s=pn(r),a=!t&&!ni(r)&&!xs(r)?s:r;return i.has.call(o,a)||so(r,a)&&i.has.call(o,r)||so(s,a)&&i.has.call(o,s)||(o.add(a),pa(o,"add",a,a)),this},set(r,o){!t&&!ni(o)&&!xs(o)&&(o=pn(o));const i=pn(this),{has:s,get:a}=Yd(i);let l=s.call(i,r);l||(r=pn(r),l=s.call(i,r));const u=a.call(i,r);return i.set(r,o),l?so(o,u)&&pa(i,"set",r,o,u):pa(i,"add",r,o),this},delete(r){const o=pn(this),{has:i,get:s}=Yd(o);let a=i.call(o,r);a||(r=pn(r),a=i.call(o,r));const l=s?s.call(o,r):void 0,u=o.delete(r);return a&&pa(o,"delete",r,void 0,l),u},clear(){const r=pn(this),o=r.size!==0,i=void 0,s=r.clear();return o&&pa(r,"clear",void 0,void 0,i),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=pT(r,e,t)}),n}function Hh(e,t){const n=mT(e,t);return(r,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(jn(n,o)&&o in r?n:r,o,i)}function gT(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function vT(e){return e.__v_skip||!Object.isExtensible(e)?0:gT(q2(e))}function no(e){return xs(e)?e:Gh(e,!1,C1,A1,hv)}function d1(e){return Gh(e,!1,S1,I1,pv)}function $h(e){return Gh(e,!0,k1,E1,mv)}function yT(e){return Gh(e,!0,_1,T1,gv)}function Gh(e,t,n,r,o){if(!Fn(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=vT(e);if(i===0)return e;const s=o.get(e);if(s)return s;const a=new Proxy(e,i===2?r:n);return o.set(e,a),a}function Fi(e){return xs(e)?Fi(e.__v_raw):!!(e&&e.__v_isReactive)}function xs(e){return!!(e&&e.__v_isReadonly)}function ni(e){return!!(e&&e.__v_isShallow)}function $d(e){return e?!!e.__v_raw:!1}function pn(e){const t=e&&e.__v_raw;return t?pn(t):e}function Wr(e){return!jn(e,"__v_skip")&&Object.isExtensible(e)&&Wg(e,"__v_skip",!0),e}function lr(e){return e?e.__v_isRef===!0:!1}function re(e){return f1(e,!1)}function Br(e){return f1(e,!0)}function f1(e,t){return lr(e)?e:new x1(e,t)}function bT(e){e.dep&&e.dep.trigger()}function Qe(e){return lr(e)?e.value:e}function wT(e){return Zt(e)?e():Qe(e)}function iv(e){return Fi(e)?e:new Proxy(e,R1)}function h1(e){return new M1(e)}function p1(e){const t=zt(e)?new Array(e.length):{};for(const n in e)t[n]=m1(e,n);return t}function sv(e,t,n){return lr(e)?e:Zt(e)?new D1(e):Fn(e)&&arguments.length>1?m1(e,t,n):re(e)}function m1(e,t,n){return new L1(e,t,n)}function CT(e,t,n=!1){let r,o;return Zt(e)?r=e:(r=e.get,o=e.set),new O1(r,o,n)}function kT(){return va}function g1(e,t=!1,n=va){if(n){let r=Zd.get(n);r||Zd.set(n,r=[]),r.push(e)}}function ST(e,t,n=Dn){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,u=w=>o?w:ni(w)||o===!1||o===0?ga(w,1):ga(w);let d,f,p,g,m=!1,v=!1;if(lr(e)?(f=()=>e.value,m=ni(e)):Fi(e)?(f=()=>u(e),m=!0):zt(e)?(v=!0,m=e.some(w=>Fi(w)||ni(w)),f=()=>e.map(w=>{if(lr(w))return w.value;if(Fi(w))return u(w);if(Zt(w))return l?l(w,2):w()})):Zt(e)?t?f=l?()=>l(e,2):e:f=()=>{if(p){fa();try{p()}finally{ha()}}const w=va;va=d;try{return l?l(e,3,[g]):e(g)}finally{va=w}}:f=gi,t&&o){const w=f,T=o===!0?1/0:o;f=()=>ga(w(),T)}const k=Qg(),b=()=>{d.stop(),k&&k.active&&Bh(k.effects,d)};if(i&&t){const w=t;t=(...T)=>{w(...T),b()}}let S=v?new Array(e.length).fill(Xd):Xd;const C=w=>{if(!(!(d.flags&1)||!d.dirty&&!w))if(t){const T=d.run();if(o||m||(v?T.some((L,z)=>so(L,S[z])):so(T,S))){p&&p();const L=va;va=d;try{const z=[T,S===Xd?void 0:v&&S[0]===Xd?[]:S,g];S=T,l?l(t,3,z):t(...z)}finally{va=L}}}else d.run()};return a&&a(C),d=new lu(f),d.scheduler=s?()=>s(C,!1):C,g=w=>g1(w,!1,d),p=d.onStop=()=>{const w=Zd.get(d);if(w){if(l)l(w,4);else for(const T of w)T();Zd.delete(d)}},t?r?C(!0):S=d.run():s?s(C.bind(null,!0),!0):d.run(),b.pause=d.pause.bind(d),b.resume=d.resume.bind(d),b.stop=b,b}function ga(e,t=1/0,n){if(t<=0||!Fn(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,lr(e))ga(e.value,t,n);else if(zt(e))for(let r=0;r<e.length;r++)ga(e[r],t,n);else if(il(e)||ic(e))e.forEach(r=>{ga(r,t,n)});else if(Nd(e)){for(const r in e)ga(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&ga(e[r],t,n)}return e}var Mo,Wh,or,Kh,lu,av,Gd,Wd,Ni,lv,cu,v1,Kd,qd,al,qh,uu,y1,b1,w1,cv,uv,dv,fv,C1,k1,S1,_1,Yh,Yd,A1,I1,E1,T1,hv,pv,mv,gv,Bi,lc,x1,R1,M1,L1,D1,O1,P1,F1,Xd,Zd,va,_T=xr((()=>{Xg(),Wh=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=Mo,!e&&Mo&&(this.index=(Mo.scopes||(Mo.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=Mo;try{return Mo=this,e()}finally{Mo=t}}}on(){++this._on===1&&(this.prevScope=Mo,Mo=this)}off(){this._on>0&&--this._on===0&&(Mo=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}},Kh=new WeakSet,lu=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Mo&&Mo.active&&Mo.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Kh.has(this)&&(Kh.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||o1(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,l1(this),i1(this);const e=or,t=Ni;or=this,Ni=!0;try{return this.fn()}finally{s1(this),or=e,Ni=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)nv(e);this.deps=this.depsTail=void 0,l1(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Kh.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){tv(this)&&this.run()}get dirty(){return tv(this)}},av=0,Ni=!0,lv=[],cu=0,v1=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},Kd=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!or||!Ni||or===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==or)t=this.activeLink=new v1(or,this),or.deps?(t.prevDep=or.depsTail,or.depsTail.nextDep=t,or.depsTail=t):or.deps=or.depsTail=t,c1(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const n=t.nextDep;n.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=n),t.prevDep=or.depsTail,t.nextDep=void 0,or.depsTail.nextDep=t,or.depsTail=t,or.deps===t&&(or.deps=n)}return t}trigger(e){this.version++,cu++,this.notify(e)}notify(e){Jg();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{ev()}}},qd=new WeakMap,al=Symbol(""),qh=Symbol(""),uu=Symbol(""),y1={__proto__:null,[Symbol.iterator](){return rv(this,Symbol.iterator,e=>Ts(this,e))},concat(...e){return au(this).concat(...e.map(t=>zt(t)?au(t):t))},entries(){return rv(this,"entries",e=>(e[1]=Ts(this,e[1]),e))},every(e,t){return ma(this,"every",e,t,void 0,arguments)},filter(e,t){return ma(this,"filter",e,t,n=>n.map(r=>Ts(this,r)),arguments)},find(e,t){return ma(this,"find",e,t,n=>Ts(this,n),arguments)},findIndex(e,t){return ma(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ma(this,"findLast",e,t,n=>Ts(this,n),arguments)},findLastIndex(e,t){return ma(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ma(this,"forEach",e,t,void 0,arguments)},includes(...e){return ov(this,"includes",e)},indexOf(...e){return ov(this,"indexOf",e)},join(e){return au(this).join(e)},lastIndexOf(...e){return ov(this,"lastIndexOf",e)},map(e,t){return ma(this,"map",e,t,void 0,arguments)},pop(){return Hd(this,"pop")},push(...e){return Hd(this,"push",e)},reduce(e,...t){return u1(this,"reduce",e,t)},reduceRight(e,...t){return u1(this,"reduceRight",e,t)},shift(){return Hd(this,"shift")},some(e,t){return ma(this,"some",e,t,void 0,arguments)},splice(...e){return Hd(this,"splice",e)},toReversed(){return au(this).toReversed()},toSorted(e){return au(this).toSorted(e)},toSpliced(...e){return au(this).toSpliced(...e)},unshift(...e){return Hd(this,"unshift",e)},values(){return rv(this,"values",e=>Ts(this,e))}},b1=Array.prototype,w1=Pd("__proto__,__v_isRef,__isVue"),cv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(ti)),uv=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t==="__v_skip")return e.__v_skip;const r=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!r;if(t==="__v_isReadonly")return r;if(t==="__v_isShallow")return o;if(t==="__v_raw")return n===(r?o?gv:mv:o?pv:hv).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=zt(e);if(!r){let a;if(i&&(a=y1[t]))return a;if(t==="hasOwnProperty")return hT}const s=Reflect.get(e,t,lr(e)?e:n);if((ti(t)?cv.has(t):w1(t))||(r||Ro(e,"get",t),o))return s;if(lr(s)){const a=i&&Bd(t)?s:s.value;return r&&Fn(a)?$h(a):a}return Fn(s)?r?$h(s):no(s):s}},dv=class extends uv{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t];const i=zt(e)&&Bd(t);if(!this._isShallow){const l=xs(o);if(!ni(n)&&!xs(n)&&(o=pn(o),n=pn(n)),!i&&lr(o)&&!lr(n))return l||(o.value=n),!0}const s=i?Number(t)<e.length:jn(e,t),a=Reflect.set(e,t,n,lr(e)?e:r);return e===pn(r)&&(s?so(n,o)&&pa(e,"set",t,n,o):pa(e,"add",t,n)),a}deleteProperty(e,t){const n=jn(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&pa(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return(!ti(t)||!cv.has(t))&&Ro(e,"has",t),n}ownKeys(e){return Ro(e,"iterate",zt(e)?"length":al),Reflect.ownKeys(e)}},fv=class extends uv{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},C1=new dv,k1=new fv,S1=new dv(!0),_1=new fv(!0),Yh=e=>e,Yd=e=>Reflect.getPrototypeOf(e),A1={get:Hh(!1,!1)},I1={get:Hh(!1,!0)},E1={get:Hh(!0,!1)},T1={get:Hh(!0,!0)},hv=new WeakMap,pv=new WeakMap,mv=new WeakMap,gv=new WeakMap,Bi=e=>Fn(e)?no(e):e,lc=e=>Fn(e)?$h(e):e,x1=class{constructor(e,t){this.dep=new Kd,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:pn(e),this._value=t?e:Bi(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||ni(e)||xs(e);e=n?e:pn(e),so(e,t)&&(this._rawValue=e,this._value=n?e:Bi(e),this.dep.trigger())}},R1={get:(e,t,n)=>t==="__v_raw"?e:Qe(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return lr(o)&&!lr(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}},M1=class{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new Kd,{get:n,set:r}=e(t.track.bind(t),t.trigger.bind(t));this._get=n,this._set=r}get value(){return this._value=this._get()}set value(e){this._set(e)}},L1=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=ti(t)?t:String(t),this._raw=pn(e);let r=!0,o=e;if(!zt(e)||ti(this._key)||!Bd(this._key))do r=!$d(o)||ni(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=Qe(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&lr(this._raw[this._key])){const t=this._object[this._key];if(lr(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return fT(this._raw,this._key)}},D1=class{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}},O1=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Kd(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=cu-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&or!==this)return o1(this,!0),!0}get value(){const e=this.dep.track();return a1(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},P1={GET:"get",HAS:"has",ITERATE:"iterate"},F1={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},Xd={},Zd=new WeakMap,va=void 0}));function AT(e){Fv.push(e)}function IT(){Fv.pop()}function ET(e,t){}function du(e,t,n,r){try{return r?e(...r):e()}catch(o){cc(o,t,n)}}function zi(e,t,n,r){if(Zt(e)){const o=du(e,t,n,r);return o&&zh(o)&&o.catch(i=>{cc(i,t,n)}),o}if(zt(e)){const o=[];for(let i=0;i<e.length;i++)o.push(zi(e[i],t,n,r));return o}}function cc(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Dn;if(t){let a=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const d=a.ec;if(d){for(let f=0;f<d.length;f++)if(d[f](e,l,u)===!1)return}a=a.parent}if(i){fa(),du(i,null,10,[e,l,u]),ha();return}}TT(e,n,o,r,s)}function TT(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}function St(e){const t=cf||Nv;return e?t.then(this?e.bind(this):e):t}function xT(e){let t=ls+1,n=Lo.length;for(;t<n;){const r=t+n>>>1,o=Lo[r],i=gu(o);i<e||i===e&&o.flags&2?t=r+1:n=r}return t}function vv(e){if(!(e.flags&1)){const t=gu(e),n=Lo[Lo.length-1];!n||!(e.flags&2)&&t>=gu(n)?Lo.push(e):Lo.splice(xT(t),0,e),e.flags|=1,N1()}}function N1(){cf||(cf=Nv.then(z1))}function Qd(e){zt(e)?fc.push(...e):ka&&e.id===-1?ka.splice(hc+1,0,e):e.flags&1||(fc.push(e),e.flags|=1),N1()}function B1(e,t,n=ls+1){for(;n<Lo.length;n++){const r=Lo[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Lo.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Xh(e){if(fc.length){const t=[...new Set(fc)].sort((n,r)=>gu(n)-gu(r));if(fc.length=0,ka){ka.push(...t);return}for(ka=t,hc=0;hc<ka.length;hc++){const n=ka[hc];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}ka=null,hc=0}}function z1(e){try{for(ls=0;ls<Lo.length;ls++){const t=Lo[ls];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),du(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ls<Lo.length;ls++){const t=Lo[ls];t&&(t.flags&=-2)}ls=-1,Lo.length=0,Xh(e),cf=null,(Lo.length||fc.length)&&z1(e)}}function j1(e,t){var n,r;vu=e,vu?(vu.enabled=!0,uf.forEach(({event:o,args:i})=>vu.emit(o,...i)),uf=[]):typeof window<"u"&&window.HTMLElement&&!((r=(n=window.navigator)==null?void 0:n.userAgent)!=null&&r.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{j1(o,t)}),setTimeout(()=>{vu||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,uf=[])},3e3)):uf=[]}function Jd(e){const t=lo;return lo=e,df=e&&e.type.__scopeId||null,t}function RT(e){df=e}function MT(){df=null}function ao(e,t=lo,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&af(-1);const i=Jd(t);let s;try{s=e(...o)}finally{Jd(i),r._d&&af(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function ya(e,t){if(lo===null)return e;const n=lf(lo),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,s,a,l=Dn]=t[o];i&&(Zt(i)&&(i={mounted:i,updated:i}),i.deep&&ga(s),r.push({dir:i,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function Rs(e,t,n,r){const o=e.dirs,i=t&&t.dirs;for(let s=0;s<o.length;s++){const a=o[s];i&&(a.oldValue=i[s].value);let l=a.dir[r];l&&(fa(),zi(l,n,8,[e.el,a,e,t]),ha())}}function V1(e,t){if(co){let n=co.provides;const r=co.parent&&co.parent.provides;r===n&&(n=co.provides=Object.create(r)),n[e]=t}}function ll(e,t,n=!1){const r=pr();if(r||fl){let o=fl?fl._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&Zt(t)?t.call(r&&r.proxy):t}}function U1(){return!!(pr()||fl)}function LT(e,t){return ef(e,null,t)}function DT(e,t){return ef(e,null,{flush:"post"})}function H1(e,t){return ef(e,null,{flush:"sync"})}function jt(e,t,n){return ef(e,t,n)}function ef(e,t,n=Dn){const{immediate:r,deep:o,flush:i,once:s}=n,a=Gn({},n),l=t&&r||!t&&i!=="post";let u;if(ml){if(i==="sync"){const g=zv();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!l){const g=()=>{};return g.stop=gi,g.resume=gi,g.pause=gi,g}}const d=co;a.call=(g,m,v)=>zi(g,d,m,v);let f=!1;i==="post"?a.scheduler=g=>{jr(g,d&&d.suspense)}:i!=="sync"&&(f=!0,a.scheduler=(g,m)=>{m?g():vv(g)}),a.augmentJob=g=>{t&&(g.flags|=4),f&&(g.flags|=2,d&&(g.id=d.uid,g.i=d))};const p=ST(e,t,a);return ml&&(u?u.push(p):l&&p()),p}function OT(e,t,n){const r=this.proxy,o=Xn(e)?e.includes(".")?$1(r,e):()=>r[e]:e.bind(r,r);let i;Zt(t)?i=t:(i=t.handler,n=t);const s=gc(this),a=ef(o,i.bind(r),n);return s(),a}function $1(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;o<n.length&&r;o++)r=r[n[o]];return r}}function Zh(e,t,n,{o:{insert:r},m:o},i=2){i===0&&r(e.targetAnchor,t,n);const{el:s,anchor:a,shapeFlag:l,children:u,props:d}=e,f=i===2;if(f&&r(s,t,n),(!f||ul(d))&&l&16)for(let p=0;p<u.length;p++)o(u[p],t,n,2);f&&r(a,t,n)}function PT(e,t,n,r,o,i,{o:{nextSibling:s,parentNode:a,querySelector:l,insert:u,createText:d}},f){function p(k,b){let S=b;for(;S;){if(S&&S.nodeType===8){if(S.data==="teleport start anchor")t.targetStart=S;else if(S.data==="teleport anchor"){t.targetAnchor=S,k._lpa=t.targetAnchor&&s(t.targetAnchor);break}}S=s(S)}}function g(k,b){b.anchor=f(s(k),b,a(k),n,r,o,i)}const m=t.target=lp(t.props,l),v=ul(t.props);if(m){const k=m._lpa||m.firstChild;t.shapeFlag&16&&(v?(g(e,t),p(m,k),t.targetAnchor||yv(m,t,d,u,a(e)===m?e:null)):(t.anchor=s(e),p(m,k),t.targetAnchor||yv(m,t,d,u),f(k&&s(k),t,m,n,r,o,i))),tf(t,v)}else v&&t.shapeFlag&16&&(g(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}function tf(e,t){const n=e.ctx;if(n&&n.ut){let r,o;for(t?(r=e.el,o=e.anchor):(r=e.targetStart,o=e.targetAnchor);r&&r!==o;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function yv(e,t,n,r,o=null){const i=t.targetStart=n(""),s=t.targetAnchor=n("");return i[jv]=s,e&&(r(i,e,o),r(s,e,o)),s}function bv(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Nn(()=>{e.isMounted=!0}),cr(()=>{e.isUnmounting=!0}),e}function G1(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Rr){t=n;break}}return t}function W1(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function fu(e,t,n,r,o){const{appear:i,mode:s,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:d,onEnterCancelled:f,onBeforeLeave:p,onLeave:g,onAfterLeave:m,onLeaveCancelled:v,onBeforeAppear:k,onAppear:b,onAfterAppear:S,onAppearCancelled:C}=t,w=String(e.key),T=W1(n,e),L=(V,j)=>{V&&zi(V,r,9,j)},z=(V,j)=>{const Z=j[1];L(V,j),zt(V)?V.every(R=>R.length<=1)&&Z():V.length<=1&&Z()},W={mode:s,persisted:a,beforeEnter(V){let j=l;if(!n.isMounted)if(i)j=k||l;else return;V[cs]&&V[cs](!0);const Z=T[w];Z&&ss(e,Z)&&Z.el[cs]&&Z.el[cs](),L(j,[V])},enter(V){if(T[w]===e)return;let j=u,Z=d,R=f;if(!n.isMounted)if(i)j=b||u,Z=S||d,R=C||f;else return;let K=!1;V[yu]=$=>{K||(K=!0,$?L(R,[V]):L(Z,[V]),W.delayedLeave&&W.delayedLeave(),V[yu]=void 0)};const x=V[yu].bind(null,!1);j?z(j,[V,x]):x()},leave(V,j){const Z=String(e.key);if(V[yu]&&V[yu](!0),n.isUnmounting)return j();L(p,[V]);let R=!1;V[cs]=x=>{R||(R=!0,j(),x?L(v,[V]):L(m,[V]),V[cs]=void 0,T[Z]===e&&delete T[Z])};const K=V[cs].bind(null,!1);T[Z]=e,g?z(g,[V,K]):K()},clone(V){const j=fu(V,t,n,r,o);return o&&o(j),j}};return W}function wv(e){if(bu(e))return e=Ms(e),e.children=null,e}function K1(e){if(!bu(e))return Vv(e.type)&&e.children?G1(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&Zt(n.default))return n.default()}}function ba(e,t){e.shapeFlag&6&&e.component?(e.transition=t,ba(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Qh(e,t=!1,n){let r=[],o=0;for(let i=0;i<e.length;i++){let s=e[i];const a=n==null?s.key:String(n)+String(s.key!=null?s.key:i);s.type===Kt?(s.patchFlag&128&&o++,r=r.concat(Qh(s.children,t,a))):(t||s.type!==Rr)&&r.push(a!=null?Ms(s,{key:a}):s)}if(o>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function uc(e,t){return Zt(e)?Gn({name:e.name},t,{setup:e}):e}function FT(){const e=pr();return e?(e.appContext.config.idPrefix||"v")+"-"+e.ids[0]+e.ids[1]++:""}function Cv(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function NT(e){const t=pr(),n=Br(null);if(t){const r=t.refs===Dn?t.refs={}:t.refs;Object.defineProperty(r,e,{enumerable:!0,get:()=>n.value,set:o=>n.value=o})}return n}function q1(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}function hu(e,t,n,r,o=!1){if(zt(e)){e.forEach((v,k)=>hu(v,t&&(zt(t)?t[k]:t),n,r,o));return}if(Ds(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&hu(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?lf(r.component):r.el,s=o?null:i,{i:a,r:l}=e,u=t&&t.r,d=a.refs===Dn?a.refs={}:a.refs,f=a.setupState,p=pn(f),g=f===Dn?Hg:v=>q1(d,v)?!1:jn(p,v),m=(v,k)=>!(k&&q1(d,k));if(u!=null&&u!==l){if(Y1(t),Xn(u))d[u]=null,g(u)&&(f[u]=null);else if(lr(u)){const v=t;m(u,v.k)&&(u.value=null),v.k&&(d[v.k]=null)}}if(Zt(l))du(l,a,12,[s,d]);else{const v=Xn(l),k=lr(l);if(v||k){const b=()=>{if(e.f){const S=v?g(l)?f[l]:d[l]:m(l)||!e.k?l.value:d[e.k];if(o)zt(S)&&Bh(S,i);else if(zt(S))S.includes(i)||S.push(i);else if(v)d[l]=[i],g(l)&&(f[l]=d[l]);else{const C=[i];m(l,e.k)&&(l.value=C),e.k&&(d[e.k]=C)}}else v?(d[l]=s,g(l)&&(f[l]=s)):k&&(m(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const S=()=>{b(),ff.delete(e)};S.id=-1,ff.set(e,S),jr(S,n)}else Y1(e),b()}}}function Y1(e){const t=ff.get(e);t&&(t.flags|=8,ff.delete(e))}function BT(e){const{mt:t,p:n,o:{patchProp:r,createText:o,nextSibling:i,parentNode:s,remove:a,insert:l,createComment:u}}=e,d=(C,w)=>{if(!w.hasChildNodes()){n(null,C,w),Xh(),w._vnode=C;return}f(w.firstChild,C,null,null,null),Xh(),w._vnode=C},f=(C,w,T,L,z,W=!1)=>{W=W||!!w.dynamicChildren;const V=mc(C)&&C.data==="[",j=()=>v(C,w,T,L,z,V),{type:Z,ref:R,shapeFlag:K,patchFlag:x}=w;let $=C.nodeType;w.el=C,x===-2&&(W=!1,w.dynamicChildren=null);let H=null;switch(Z){case Sa:$!==3?w.children===""?(l(w.el=o(""),s(C),C),H=C):H=j():(C.data!==w.children&&(pc(),C.data=w.children),H=i(C));break;case Rr:S(C)?(H=i(C),b(w.el=C.content.firstChild,C,T)):$!==8||V?H=j():H=i(C);break;case hl:if(V&&(C=i(C),$=C.nodeType),$===1||$===3){H=C;const J=!w.children.length;for(let Q=0;Q<w.staticCount;Q++)J&&(w.children+=H.nodeType===1?H.outerHTML:H.data),Q===w.staticCount-1&&(w.anchor=H),H=i(H);return V?i(H):H}else j();break;case Kt:V?H=m(C,w,T,L,z,W):H=j();break;default:if(K&1)($!==1||w.type.toLowerCase()!==C.tagName.toLowerCase())&&!S(C)?H=j():H=p(C,w,T,L,z,W);else if(K&6){w.slotScopeIds=z;const J=s(C);if(V?H=k(C):mc(C)&&C.data==="teleport start"?H=k(C,C.data,"teleport end"):H=i(C),t(w,J,null,T,L,hf(J),W),Ds(w)&&!w.type.__asyncResolved){let Q;V?(Q=Xt(Kt),Q.anchor=H?H.previousSibling:J.lastChild):Q=C.nodeType===3?as(""):Xt("div"),Q.el=C,w.component.subTree=Q}}else K&64?$!==8?H=j():H=w.type.hydrate(C,w,T,L,z,W,e,g):K&128&&(H=w.type.hydrate(C,w,T,L,hf(s(C)),z,W,e,f))}return R!=null&&hu(R,null,L,w),H},p=(C,w,T,L,z,W)=>{W=W||!!w.dynamicChildren;const{type:V,props:j,patchFlag:Z,shapeFlag:R,dirs:K,transition:x}=w,$=V==="input"||V==="option";if($||Z!==-1){K&&Rs(w,null,T,"created");let H=!1;if(S(C)){H=yw(null,x)&&T&&T.vnode.props&&T.vnode.props.appear;const Q=C.content.firstChild;if(H){const Y=Q.getAttribute("class");Y&&(Q.$cls=Y),x.beforeEnter(Q)}b(Q,C,T),w.el=C=Q}if(R&16&&!(j&&(j.innerHTML||j.textContent))){let Q=g(C.firstChild,w,C,T,L,z,W);for(;Q;){Jh(C,1)||pc();const Y=Q;Q=Q.nextSibling,a(Y)}}else if(R&8){let Q=w.children;Q[0]===`
|
|
2
2
|
`&&(C.tagName==="PRE"||C.tagName==="TEXTAREA")&&(Q=Q.slice(1));const{textContent:Y}=C;Y!==Q&&Y!==Q.replace(/\r\n|\r/g,`
|
|
3
|
-
`)&&(Jh(C,0)||pc(),C.textContent=w.children)}if(j){if($||!W||Z&48){const Q=C.tagName.includes("-");for(const Y in j)($&&(Y.endsWith("value")||Y==="indeterminate")||ou(Y)&&!sl(Y)||Y[0]==="."||Q&&!sl(Y))&&r(C,Y,null,j[Y],void 0,T)}else if(j.onClick)r(C,"onClick",null,j.onClick,void 0,T);else if(Z&4&&Fi(j.style))for(const Q in j.style)j.style[Q]}let J;(J=j&&j.onVnodeBeforeMount)&&oi(J,T,w),K&&Rs(w,null,T,"beforeMount"),((J=j&&j.onVnodeMounted)||K||H)&&Sw(()=>{J&&oi(J,T,w),H&&x.enter(C),K&&Rs(w,null,T,"mounted")},L)}return C.nextSibling},g=(C,w,T,L,z,W,V)=>{V=V||!!w.dynamicChildren;const j=w.children,Z=j.length;for(let R=0;R<Z;R++){const K=V?j[R]:j[R]=ri(j[R]),x=K.type===Sa;C?(x&&!V&&R+1<Z&&ri(j[R+1]).type===Sa&&(l(o(C.data.slice(K.children.length)),T,i(C)),C.data=K.children),C=f(C,K,L,z,W,V)):x&&!K.children?l(K.el=o(""),T):(Jh(T,1)||pc(),n(null,K,T,null,L,z,hf(T),W))}return C},m=(C,w,T,L,z,W)=>{const{slotScopeIds:V}=w;V&&(z=z?z.concat(V):V);const j=s(C),Z=g(i(C),w,j,T,L,z,W);return Z&&mc(Z)&&Z.data==="]"?i(w.anchor=Z):(pc(),l(w.anchor=u("]"),j,Z),Z)},v=(C,w,T,L,z,W)=>{if(Jh(C.parentElement,1)||pc(),w.el=null,W){const Z=k(C);for(;;){const R=i(C);if(R&&R!==Z)a(R);else break}}const V=i(C),j=s(C);return a(C),n(null,w,j,V,T,L,hf(j),z),T&&(T.vnode.el=w.el,sp(T,w.el)),V},k=(C,w="[",T="]")=>{let L=0;for(;C;)if(C=i(C),C&&mc(C)&&(C.data===w&&L++,C.data===T)){if(L===0)return i(C);L--}return C},b=(C,w,T)=>{const L=w.parentNode;L&&L.replaceChild(C,w);let z=T;for(;z;)z.vnode.el===w&&(z.vnode.el=z.subTree.el=C),z=z.parent},S=C=>C.nodeType===1&&C.tagName==="TEMPLATE";return[d,f]}function Jh(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(Kv);)e=e.parentElement;const n=e&&e.getAttribute(Kv);if(n==null)return!1;if(n==="")return!0;{const r=n.split(",");return t===0&&r.includes("children")?!0:r.includes(Vw[t])}}function zT(e){const{top:t,left:n,bottom:r,right:o}=e.getBoundingClientRect(),{innerHeight:i,innerWidth:s}=window;return(t>0&&t<i||r>0&&r<i)&&(n>0&&n<s||o>0&&o<s)}function jT(e,t){if(mc(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(mc(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function X1(e){Zt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:i,timeout:s,suspensible:a=!0,onError:l}=e;let u=null,d,f=0;const p=()=>(f++,u=null,g()),g=()=>{let m;return u||(m=u=t().catch(v=>{if(v=v instanceof Error?v:new Error(String(v)),l)return new Promise((k,b)=>{l(v,()=>k(p()),()=>b(v),f+1)});throw v}).then(v=>m!==u&&u?u:(v&&(v.__esModule||v[Symbol.toStringTag]==="Module")&&(v=v.default),d=v,v)))};return uc({name:"AsyncComponentWrapper",__asyncLoader:g,__asyncHydrate(m,v,k){let b=!1;(v.bu||(v.bu=[])).push(()=>b=!0);const S=()=>{b||k()},C=i?()=>{const w=i(S,T=>jT(m,T));w&&(v.bum||(v.bum=[])).push(w)}:S;d?C():g().then(()=>!v.isUnmounted&&C())},get __asyncResolved(){return d},setup(){const m=co;if(Cv(m),d)return()=>ep(d,m);const v=C=>{u=null,cc(C,m,13,!r)};if(a&&m.suspense||ml)return g().then(C=>()=>ep(C,m)).catch(C=>(v(C),()=>r?Xt(r,{error:C}):null));const k=re(!1),b=re(),S=re(!!o);return o&&setTimeout(()=>{S.value=!1},o),s!=null&&setTimeout(()=>{if(!k.value&&!b.value){const C=new Error(`Async component timed out after ${s}ms.`);v(C),b.value=C}},s),g().then(()=>{k.value=!0,m.parent&&bu(m.parent.vnode)&&m.parent.update()}).catch(C=>{v(C),b.value=C}),()=>{if(k.value&&d)return ep(d,m);if(b.value&&r)return Xt(r,{error:b.value});if(n&&!S.value)return ep(n,m)}}})}function ep(e,t){const{ref:n,props:r,children:o,ce:i}=t.vnode,s=Xt(e,r,o);return s.ref=n,s.ce=i,delete t.vnode.ce,s}function nf(e,t){return zt(e)?e.some(n=>nf(n,t)):Xn(e)?e.split(",").includes(t):K2(e)?(e.lastIndex=0,e.test(t)):!1}function kv(e,t){Z1(e,"a",t)}function Sv(e,t){Z1(e,"da",t)}function Z1(e,t,n=co){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(np(t,r,n),n){let o=n.parent;for(;o&&o.parent;)bu(o.parent.vnode)&&VT(r,t,n,o),o=o.parent}}function VT(e,t,n,r){const o=np(t,e,r,!0);mf(()=>{Bh(r[t],o)},n)}function _v(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function tp(e){return e.shapeFlag&128?e.ssContent:e}function np(e,t,n=co,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{fa();const a=gc(n),l=zi(t,n,e,s);return a(),ha(),l});return r?o.unshift(i):o.push(i),i}}function Q1(e,t=co){np("ec",e,t)}function UT(e,t){return Iv(dp,e,!0,t)||e}function Av(e){return Xn(e)?Iv(dp,e,!1)||e:e||Qv}function J1(e){return Iv(Yw,e)}function Iv(e,t,n=!0,r=!1){const o=lo||co;if(o){const i=o.type;if(e===dp){const a=Pv(i,!1);if(a&&(a===t||a===Nr(t)||a===iu(Nr(t))))return i}const s=ew(o[e]||i[e],t)||ew(o.appContext[e],t);return!s&&r?i:s}}function ew(e,t){return e&&(e[t]||e[Nr(t)]||e[iu(Nr(t))])}function ir(e,t,n,r){let o;const i=n&&n[r],s=zt(e);if(s||Xn(e)){const a=s&&Fi(e);let l=!1,u=!1;a&&(l=!ni(e),u=xs(e),e=Vh(e)),o=new Array(e.length);for(let d=0,f=e.length;d<f;d++)o[d]=t(l?u?lc(Bi(e[d])):Bi(e[d]):e[d],d,void 0,i&&i[d])}else if(typeof e=="number"){o=new Array(e);for(let a=0;a<e;a++)o[a]=t(a+1,a,void 0,i&&i[a])}else if(Fn(e))if(e[Symbol.iterator])o=Array.from(e,(a,l)=>t(a,l,void 0,i&&i[l]));else{const a=Object.keys(e);o=new Array(a.length);for(let l=0,u=a.length;l<u;l++){const d=a[l];o[l]=t(e[d],d,l,i&&i[l])}}else o=[];return n&&(n[r]=o),o}function HT(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(zt(r))for(let o=0;o<r.length;o++)e[r[o].name]=r[o].fn;else r&&(e[r.name]=r.key?(...o)=>{const i=r.fn(...o);return i&&(i.key=r.key),i}:r.fn)}return e}function pu(e,t,n={},r,o){if(lo.ce||lo.parent&&Ds(lo.parent)&&lo.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),ye(),an(Kt,null,[Xt("slot",n,r&&r())],u?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),ye();const s=i&&Ev(i(n)),a=n.key||s&&s.key,l=an(Kt,{key:(a&&!ti(a)?a:`_${t}`)+(!s&&r?"_fb":"")},s||(r?r():[]),s&&e._===1?64:-2);return!o&&l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),i&&i._c&&(i._d=!0),l}function Ev(e){return e.some(t=>wa(t)?!(t.type===Rr||t.type===Kt&&!Ev(t.children)):!0)?e:null}function $T(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:su(r)]=e[r];return n}function GT(){return null}function WT(){return null}function KT(e){}function qT(e){}function YT(){return null}function XT(){}function ZT(e,t){return null}function tw(){return rw("useSlots").slots}function nw(){return rw("useAttrs").attrs}function rw(e){const t=pr();return t.setupContext||(t.setupContext=Mw(t))}function rf(e){return zt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function QT(e,t){const n=rf(e);for(const r in t){if(r.startsWith("__skip"))continue;let o=n[r];o?zt(o)||Zt(o)?o=n[r]={type:o,default:t[r]}:o.default=t[r]:o===null&&(o=n[r]={default:t[r]}),o&&t[`__skip_${r}`]&&(o.skipFactory=!0)}return n}function JT(e,t){return!e||!t?e||t:zt(e)&&zt(t)?e.concat(t):Gn({},rf(e),rf(t))}function e5(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function t5(e){const t=pr(),n=ml;let r=e();Su(),n&&ku(!1);const o=()=>{gc(t),n&&ku(!0)},i=()=>{pr()!==t&&t.scope.off(),Su(),n&&ku(!1)};return zh(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function n5(e){const t=Tv(e),n=e.proxy,r=e.ctx;mp=!1,t.beforeCreate&&ow(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:u,created:d,beforeMount:f,mounted:p,beforeUpdate:g,updated:m,activated:v,deactivated:k,beforeDestroy:b,beforeUnmount:S,destroyed:C,unmounted:w,render:T,renderTracked:L,renderTriggered:z,errorCaptured:W,serverPrefetch:V,expose:j,inheritAttrs:Z,components:R,directives:K,filters:x}=t;if(u&&r5(u,r,null),s)for(const J in s){const Q=s[J];Zt(Q)&&(r[J]=Q.bind(n))}if(o){const J=o.call(n,n);Fn(J)&&(e.data=no(J))}if(mp=!0,i)for(const J in i){const Q=i[J],Y=Zt(Q)?Q.bind(n,n):Zt(Q.get)?Q.get.bind(n,n):gi,_e=!Zt(Q)&&Zt(Q.set)?Q.set.bind(n):gi,ue=ke({get:Y,set:_e});Object.defineProperty(r,J,{enumerable:!0,configurable:!0,get:()=>ue.value,set:ve=>ue.value=ve})}if(a)for(const J in a)iw(a[J],r,n,J);if(l){const J=Zt(l)?l.call(n):l;Reflect.ownKeys(J).forEach(Q=>{V1(Q,J[Q])})}d&&ow(d,e,"c");function H(J,Q){zt(Q)?Q.forEach(Y=>J(Y.bind(n))):Q&&J(Q.bind(n))}if(H(qv,f),H(Nn,p),H(up,g),H(pf,m),H(kv,v),H(Sv,k),H(Q1,W),H(Zv,L),H(Xv,z),H(cr,S),H(mf,w),H(Yv,V),zt(j))if(j.length){const J=e.exposed||(e.exposed={});j.forEach(Q=>{Object.defineProperty(J,Q,{get:()=>n[Q],set:Y=>n[Q]=Y,enumerable:!0})})}else e.exposed||(e.exposed={});T&&e.render===gi&&(e.render=T),Z!=null&&(e.inheritAttrs=Z),R&&(e.components=R),K&&(e.directives=K),V&&Cv(e)}function r5(e,t,n=gi){zt(e)&&(e=xv(e));for(const r in e){const o=e[r];let i;Fn(o)?"default"in o?i=ll(o.from||r,o.default,!0):i=ll(o.from||r):i=ll(o),lr(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function ow(e,t,n){zi(zt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function iw(e,t,n,r){let o=r.includes(".")?$1(n,r):()=>n[r];if(Xn(e)){const i=t[e];Zt(i)&&jt(o,i)}else if(Zt(e))jt(o,e.bind(n));else if(Fn(e))if(zt(e))e.forEach(i=>iw(i,t,n,r));else{const i=Zt(e.handler)?e.handler.bind(n):t[e.handler];Zt(i)&&jt(o,i,e)}}function Tv(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:i,config:{optionMergeStrategies:s}}=e.appContext,a=i.get(t);let l;return a?l=a:!o.length&&!n&&!r?l=t:(l={},o.length&&o.forEach(u=>rp(l,u,s,!0)),rp(l,t,s)),Fn(t)&&i.set(t,l),l}function rp(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&rp(e,i,n,!0),o&&o.forEach(s=>rp(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=Zw[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function sw(e,t){return t?e?function(){return Gn(Zt(e)?e.call(this,this):e,Zt(t)?t.call(this,this):t)}:t:e}function o5(e,t){return of(xv(e),xv(t))}function xv(e){if(zt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Uo(e,t){return e?[...new Set([].concat(e,t))]:t}function of(e,t){return e?Gn(Object.create(null),e,t):t}function aw(e,t){return e?zt(e)&&zt(t)?[...new Set([...e,...t])]:Gn(Object.create(null),rf(e),rf(t??{})):t}function i5(e,t){if(!e)return t;if(!t)return e;const n=Gn(Object.create(null),e);for(const r in t)n[r]=Uo(e[r],t[r]);return n}function lw(){return{app:null,config:{isNativeTag:Hg,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}function s5(e,t){return function(r,o=null){Zt(r)||(r=Gn({},r)),o!=null&&!Fn(o)&&(o=null);const i=lw(),s=new WeakSet,a=[];let l=!1;const u=i.app={_uid:Qw++,_component:r,_props:o,_container:null,_context:i,_instance:null,version:ly,get config(){return i.config},set config(d){},use(d,...f){return s.has(d)||(d&&Zt(d.install)?(s.add(d),d.install(u,...f)):Zt(d)&&(s.add(d),d(u,...f))),u},mixin(d){return i.mixins.includes(d)||i.mixins.push(d),u},component(d,f){return f?(i.components[d]=f,u):i.components[d]},directive(d,f){return f?(i.directives[d]=f,u):i.directives[d]},mount(d,f,p){if(!l){const g=u._ceVNode||Xt(r,o);return g.appContext=i,p===!0?p="svg":p===!1&&(p=void 0),f&&t?t(g,d):e(g,d,p),l=!0,u._container=d,d.__vue_app__=u,lf(g.component)}},onUnmount(d){a.push(d)},unmount(){l&&(zi(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(d,f){return i.provides[d]=f,u},runWithContext(d){const f=fl;fl=u;try{return d()}finally{fl=f}}};return u}}function a5(e,t,n=Dn){const r=pr(),o=Nr(t),i=Vo(t),s=Jv(e,o),a=h1((l,u)=>{let d,f=Dn,p;return H1(()=>{const g=e[o];so(d,g)&&(d=g,u())}),{get(){return l(),n.get?n.get(d):d},set(g){const m=n.set?n.set(g):g;if(!so(m,d)&&!(f!==Dn&&so(g,f)))return;const v=r.vnode.props;v&&(t in v||o in v||i in v)&&(`onUpdate:${t}`in v||`onUpdate:${o}`in v||`onUpdate:${i}`in v)||(d=g,u()),r.emit(`update:${t}`,m),so(g,m)&&so(g,f)&&!so(m,p)&&u(),f=g,p=m}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||Dn:a,done:!1}:{done:!0}}}},a}function l5(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Dn;let o=n;const i=t.startsWith("update:"),s=i&&Jv(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>Xn(d)?d.trim():d)),s.number&&(o=n.map(jd)));let a,l=r[a=su(t)]||r[a=su(Nr(t))];!l&&i&&(l=r[a=su(Vo(t))]),l&&zi(l,e,6,o);const u=r[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,zi(u,e,6,o)}}function cw(e,t,n=!1){const r=n?Jw:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const i=e.emits;let s={},a=!1;if(!Zt(e)){const l=u=>{const d=cw(u,t,!0);d&&(a=!0,Gn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(Fn(e)&&r.set(e,null),null):(zt(i)?i.forEach(l=>s[l]=null):Gn(s,i),Fn(e)&&r.set(e,s),s)}function op(e,t){return!e||!ou(t)?!1:(t=t.slice(2).replace(/Once$/,""),jn(e,t[0].toLowerCase()+t.slice(1))||jn(e,Vo(t))||jn(e,t))}function ip(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:u,renderCache:d,props:f,data:p,setupState:g,ctx:m,inheritAttrs:v}=e,k=Jd(e);let b,S;try{if(n.shapeFlag&4){const w=o||r,T=w;b=ri(u.call(T,w,d,f,g,p,m)),S=a}else{const w=t;b=ri(w.length>1?w(f,{attrs:a,slots:s,emit:l}):w(f,null)),S=t.props?a:eC(a)}}catch(w){Cu.length=0,cc(w,e,1),b=Xt(Rr)}let C=b;if(S&&v!==!1){const w=Object.keys(S),{shapeFlag:T}=C;w.length&&T&7&&(i&&w.some(Fd)&&(S=tC(S,i)),C=Ms(C,S,!1,!0))}return n.dirs&&(C=Ms(C,null,!1,!0),C.dirs=C.dirs?C.dirs.concat(n.dirs):n.dirs),n.transition&&ba(C,n.transition),b=C,Jd(k),b}function c5(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(wa(o)){if(o.type!==Rr||o.children==="v-if"){if(n)return;n=o}}else return}return n}function u5(e,t,n){const{props:r,children:o,component:i}=e,{props:s,children:a,patchFlag:l}=t,u=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?uw(r,s,u):!!s;if(l&8){const d=t.dynamicProps;for(let f=0;f<d.length;f++){const p=d[f];if(dw(s,r,p)&&!op(u,p))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?uw(r,s,u):!0:!!s;return!1}function uw(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const i=r[o];if(dw(t,e,i)&&!op(n,i))return!0}return!1}function dw(e,t,n){const r=e[n],o=t[n];return n==="style"&&Fn(r)&&Fn(o)?!da(r,o):r!==o}function sp({vnode:e,parent:t,suspense:n},r){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=r,e=o),o===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}function d5(e,t,n,r=!1){const o={},i=ty();e.propsDefaults=Object.create(null),fw(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:d1(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function f5(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=pn(o),[l]=e.propsOptions;let u=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let f=0;f<d.length;f++){let p=d[f];if(op(e.emitsOptions,p))continue;const g=t[p];if(l)if(jn(i,p))g!==i[p]&&(i[p]=g,u=!0);else{const m=Nr(p);o[m]=Rv(l,a,m,g,e,!1)}else g!==i[p]&&(i[p]=g,u=!0)}}}else{fw(e,t,o,i)&&(u=!0);let d;for(const f in a)(!t||!jn(t,f)&&((d=Vo(f))===f||!jn(t,d)))&&(l?n&&(n[f]!==void 0||n[d]!==void 0)&&(o[f]=Rv(l,a,f,void 0,e,!0)):delete o[f]);if(i!==a)for(const f in i)(!t||!jn(t,f))&&(delete i[f],u=!0)}u&&pa(e.attrs,"set","")}function fw(e,t,n,r){const[o,i]=e.propsOptions;let s=!1,a;if(t)for(let l in t){if(sl(l))continue;const u=t[l];let d;o&&jn(o,d=Nr(l))?!i||!i.includes(d)?n[d]=u:(a||(a={}))[d]=u:op(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(i){const l=pn(n),u=a||Dn;for(let d=0;d<i.length;d++){const f=i[d];n[f]=Rv(o,l,f,u[f],e,!jn(u,f))}}return s}function Rv(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=jn(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&Zt(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const d=gc(o);r=u[n]=l.call(null,t),d()}}else r=l;o.ce&&o.ce._setProp(n,r)}s[0]&&(i&&!a?r=!1:s[1]&&(r===""||r===Vo(n))&&(r=!0))}return r}function hw(e,t,n=!1){const r=n?nC:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(!Zt(e)){const d=f=>{l=!0;const[p,g]=hw(f,t,!0);Gn(s,p),g&&a.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!i&&!l)return Fn(e)&&r.set(e,oc),oc;if(zt(i))for(let d=0;d<i.length;d++){const f=Nr(i[d]);pw(f)&&(s[f]=Dn)}else if(i)for(const d in i){const f=Nr(d);if(pw(f)){const p=i[d],g=s[f]=zt(p)||Zt(p)?{type:p}:Gn({},p),m=g.type;let v=!1,k=!0;if(zt(m))for(let b=0;b<m.length;++b){const S=m[b],C=Zt(S)&&S.name;if(C==="Boolean"){v=!0;break}else C==="String"&&(k=!1)}else v=Zt(m)&&m.name==="Boolean";g[0]=v,g[1]=k,(v||jn(g,"default"))&&a.push(f)}}const u=[s,a];return Fn(e)&&r.set(e,u),u}function pw(e){return e[0]!=="$"&&!sl(e)}function mw(e){return vw(e)}function gw(e){return vw(e,BT)}function vw(e,t){const n=Ud();n.__VUE__=!0;const{insert:r,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:u,setElementText:d,parentNode:f,nextSibling:p,setScopeId:g=gi,insertStaticContent:m}=e,v=(ie,I,se,F=null,q=null,P=null,ee=void 0,be=null,N=!!I.dynamicChildren)=>{if(ie===I)return;ie&&!ss(ie,I)&&(F=ct(ie),ve(ie,q,P,!0),ie=null),I.patchFlag===-2&&(N=!1,I.dynamicChildren=null);const{type:B,ref:de,shapeFlag:Se}=I;switch(B){case Sa:k(ie,I,se,F);break;case Rr:b(ie,I,se,F);break;case hl:ie==null&&S(I,se,F,ee);break;case Kt:R(ie,I,se,F,q,P,ee,be,N);break;default:Se&1?T(ie,I,se,F,q,P,ee,be,N):Se&6?K(ie,I,se,F,q,P,ee,be,N):(Se&64||Se&128)&&B.process(ie,I,se,F,q,P,ee,be,N,ae)}de!=null&&q?hu(de,ie&&ie.ref,P,I||ie,!I):de==null&&ie&&ie.ref!=null&&hu(ie.ref,null,P,ie,!0)},k=(ie,I,se,F)=>{if(ie==null)r(I.el=a(I.children),se,F);else{const q=I.el=ie.el;I.children!==ie.children&&u(q,I.children)}},b=(ie,I,se,F)=>{ie==null?r(I.el=l(I.children||""),se,F):I.el=ie.el},S=(ie,I,se,F)=>{[ie.el,ie.anchor]=m(ie.children,I,se,F,ie.el,ie.anchor)},C=({el:ie,anchor:I},se,F)=>{let q;for(;ie&&ie!==I;)q=p(ie),r(ie,se,F),ie=q;r(I,se,F)},w=({el:ie,anchor:I})=>{let se;for(;ie&&ie!==I;)se=p(ie),o(ie),ie=se;o(I)},T=(ie,I,se,F,q,P,ee,be,N)=>{if(I.type==="svg"?ee="svg":I.type==="math"&&(ee="mathml"),ie==null)L(I,se,F,q,P,ee,be,N);else{const B=ie.el&&ie.el._isVueCE?ie.el:null;try{B&&B._beginPatch(),V(ie,I,q,P,ee,be,N)}finally{B&&B._endPatch()}}},L=(ie,I,se,F,q,P,ee,be)=>{let N,B;const{props:de,shapeFlag:Se,transition:Ae,dirs:Le}=ie;if(N=ie.el=s(ie.type,P,de&&de.is,de),Se&8?d(N,ie.children):Se&16&&W(ie.children,N,null,F,q,Mv(ie,P),ee,be),Le&&Rs(ie,null,F,"created"),z(N,ie,ie.scopeId,ee,F),de){for(const it in de)it!=="value"&&!sl(it)&&i(N,it,null,de[it],P,F);"value"in de&&i(N,"value",null,de.value,P),(B=de.onVnodeBeforeMount)&&oi(B,F,ie)}Le&&Rs(ie,null,F,"beforeMount");const Xe=yw(q,Ae);Xe&&Ae.beforeEnter(N),r(N,I,se),((B=de&&de.onVnodeMounted)||Xe||Le)&&jr(()=>{B&&oi(B,F,ie),Xe&&Ae.enter(N),Le&&Rs(ie,null,F,"mounted")},q)},z=(ie,I,se,F,q)=>{if(se&&g(ie,se),F)for(let P=0;P<F.length;P++)g(ie,F[P]);if(q){let P=q.subTree;if(I===P||gf(P.type)&&(P.ssContent===I||P.ssFallback===I)){const ee=q.vnode;z(ie,ee,ee.scopeId,ee.slotScopeIds,q.parent)}}},W=(ie,I,se,F,q,P,ee,be,N=0)=>{for(let B=N;B<ie.length;B++){const de=ie[B]=be?Ca(ie[B]):ri(ie[B]);v(null,de,I,se,F,q,P,ee,be)}},V=(ie,I,se,F,q,P,ee)=>{const be=I.el=ie.el;let{patchFlag:N,dynamicChildren:B,dirs:de}=I;N|=ie.patchFlag&16;const Se=ie.props||Dn,Ae=I.props||Dn;let Le;if(se&&dc(se,!1),(Le=Ae.onVnodeBeforeUpdate)&&oi(Le,se,I,ie),de&&Rs(I,ie,se,"beforeUpdate"),se&&dc(se,!0),(Se.innerHTML&&Ae.innerHTML==null||Se.textContent&&Ae.textContent==null)&&d(be,""),B?j(ie.dynamicChildren,B,be,se,F,Mv(I,q),P):ee||Q(ie,I,be,null,se,F,Mv(I,q),P,!1),N>0){if(N&16)Z(be,Se,Ae,se,q);else if(N&2&&Se.class!==Ae.class&&i(be,"class",null,Ae.class,q),N&4&&i(be,"style",Se.style,Ae.style,q),N&8){const Xe=I.dynamicProps;for(let it=0;it<Xe.length;it++){const yt=Xe[it],Mt=Se[yt],Lt=Ae[yt];(Lt!==Mt||yt==="value")&&i(be,yt,Mt,Lt,q,se)}}N&1&&ie.children!==I.children&&d(be,I.children)}else!ee&&B==null&&Z(be,Se,Ae,se,q);((Le=Ae.onVnodeUpdated)||de)&&jr(()=>{Le&&oi(Le,se,I,ie),de&&Rs(I,ie,se,"updated")},F)},j=(ie,I,se,F,q,P,ee)=>{for(let be=0;be<I.length;be++){const N=ie[be],B=I[be],de=N.el&&(N.type===Kt||!ss(N,B)||N.shapeFlag&198)?f(N.el):se;v(N,B,de,null,F,q,P,ee,!0)}},Z=(ie,I,se,F,q)=>{if(I!==se){if(I!==Dn)for(const P in I)!sl(P)&&!(P in se)&&i(ie,P,I[P],null,q,F);for(const P in se){if(sl(P))continue;const ee=se[P],be=I[P];ee!==be&&P!=="value"&&i(ie,P,be,ee,q,F)}"value"in se&&i(ie,"value",I.value,se.value,q)}},R=(ie,I,se,F,q,P,ee,be,N)=>{const B=I.el=ie?ie.el:a(""),de=I.anchor=ie?ie.anchor:a("");let{patchFlag:Se,dynamicChildren:Ae,slotScopeIds:Le}=I;Le&&(be=be?be.concat(Le):Le),ie==null?(r(B,se,F),r(de,se,F),W(I.children||[],se,de,q,P,ee,be,N)):Se>0&&Se&64&&Ae&&ie.dynamicChildren&&ie.dynamicChildren.length===Ae.length?(j(ie.dynamicChildren,Ae,se,q,P,ee,be),(I.key!=null||q&&I===q.subTree)&&Lv(ie,I,!0)):Q(ie,I,se,de,q,P,ee,be,N)},K=(ie,I,se,F,q,P,ee,be,N)=>{I.slotScopeIds=be,ie==null?I.shapeFlag&512?q.ctx.activate(I,se,F,ee,N):x(I,se,F,q,P,ee,N):$(ie,I,N)},x=(ie,I,se,F,q,P,ee)=>{const be=ie.component=Ew(ie,F,q);if(bu(ie)&&(be.ctx.renderer=ae),xw(be,!1,ee),be.asyncDep){if(q&&q.registerDep(be,H,ee),!ie.el){const N=be.subTree=Xt(Rr);b(null,N,I,se),ie.placeholder=N.el}}else H(be,ie,I,se,q,P,ee)},$=(ie,I,se)=>{const F=I.component=ie.component;if(u5(ie,I,se))if(F.asyncDep&&!F.asyncResolved){J(F,I,se);return}else F.next=I,F.update();else I.el=ie.el,F.vnode=I},H=(ie,I,se,F,q,P,ee)=>{const be=()=>{if(ie.isMounted){let{next:Se,bu:Ae,u:Le,parent:Xe,vnode:it}=ie;{const Be=bw(ie);if(Be){Se&&(Se.el=it.el,J(ie,Se,ee)),Be.asyncDep.then(()=>{jr(()=>{ie.isUnmounted||B()},q)});return}}let yt=Se,Mt;dc(ie,!1),Se?(Se.el=it.el,J(ie,Se,ee)):Se=it,Ae&&ac(Ae),(Mt=Se.props&&Se.props.onVnodeBeforeUpdate)&&oi(Mt,Xe,Se,it),dc(ie,!0);const Lt=ip(ie),Wt=ie.subTree;ie.subTree=Lt,v(Wt,Lt,f(Wt.el),ct(Wt),ie,q,P),Se.el=Lt.el,yt===null&&sp(ie,Lt.el),Le&&jr(Le,q),(Mt=Se.props&&Se.props.onVnodeUpdated)&&jr(()=>oi(Mt,Xe,Se,it),q)}else{let Se;const{el:Ae,props:Le}=I,{bm:Xe,m:it,parent:yt,root:Mt,type:Lt}=ie,Wt=Ds(I);if(dc(ie,!1),Xe&&ac(Xe),!Wt&&(Se=Le&&Le.onVnodeBeforeMount)&&oi(Se,yt,I),dc(ie,!0),Ae&&Ue){const Be=()=>{ie.subTree=ip(ie),Ue(Ae,ie.subTree,ie,q,null)};Wt&&Lt.__asyncHydrate?Lt.__asyncHydrate(Ae,ie,Be):Be()}else{Mt.ce&&Mt.ce._hasShadowRoot()&&Mt.ce._injectChildStyle(Lt,ie.parent?ie.parent.type:void 0);const Be=ie.subTree=ip(ie);v(null,Be,se,F,ie,q,P),I.el=Be.el}if(it&&jr(it,q),!Wt&&(Se=Le&&Le.onVnodeMounted)){const Be=I;jr(()=>oi(Se,yt,Be),q)}(I.shapeFlag&256||yt&&Ds(yt.vnode)&&yt.vnode.shapeFlag&256)&&ie.a&&jr(ie.a,q),ie.isMounted=!0,I=se=F=null}};ie.scope.on();const N=ie.effect=new lu(be);ie.scope.off();const B=ie.update=N.run.bind(N),de=ie.job=N.runIfDirty.bind(N);de.i=ie,de.id=ie.uid,N.scheduler=()=>vv(de),dc(ie,!0),B()},J=(ie,I,se)=>{I.component=ie;const F=ie.vnode.props;ie.vnode=I,ie.next=null,f5(ie,I.props,F,se),iC(ie,I.children,se),fa(),B1(ie),ha()},Q=(ie,I,se,F,q,P,ee,be,N=!1)=>{const B=ie&&ie.children,de=ie?ie.shapeFlag:0,Se=I.children,{patchFlag:Ae,shapeFlag:Le}=I;if(Ae>0){if(Ae&128){_e(B,Se,se,F,q,P,ee,be,N);return}else if(Ae&256){Y(B,Se,se,F,q,P,ee,be,N);return}}Le&8?(de&16&&Je(B,q,P),Se!==B&&d(se,Se)):de&16?Le&16?_e(B,Se,se,F,q,P,ee,be,N):Je(B,q,P,!0):(de&8&&d(se,""),Le&16&&W(Se,se,F,q,P,ee,be,N))},Y=(ie,I,se,F,q,P,ee,be,N)=>{ie=ie||oc,I=I||oc;const B=ie.length,de=I.length,Se=Math.min(B,de);let Ae;for(Ae=0;Ae<Se;Ae++){const Le=I[Ae]=N?Ca(I[Ae]):ri(I[Ae]);v(ie[Ae],Le,se,null,q,P,ee,be,N)}B>de?Je(ie,q,P,!0,!1,Se):W(I,se,F,q,P,ee,be,N,Se)},_e=(ie,I,se,F,q,P,ee,be,N)=>{let B=0;const de=I.length;let Se=ie.length-1,Ae=de-1;for(;B<=Se&&B<=Ae;){const Le=ie[B],Xe=I[B]=N?Ca(I[B]):ri(I[B]);if(ss(Le,Xe))v(Le,Xe,se,null,q,P,ee,be,N);else break;B++}for(;B<=Se&&B<=Ae;){const Le=ie[Se],Xe=I[Ae]=N?Ca(I[Ae]):ri(I[Ae]);if(ss(Le,Xe))v(Le,Xe,se,null,q,P,ee,be,N);else break;Se--,Ae--}if(B>Se){if(B<=Ae){const Le=Ae+1,Xe=Le<de?I[Le].el:F;for(;B<=Ae;)v(null,I[B]=N?Ca(I[B]):ri(I[B]),se,Xe,q,P,ee,be,N),B++}}else if(B>Ae)for(;B<=Se;)ve(ie[B],q,P,!0),B++;else{const Le=B,Xe=B,it=new Map;for(B=Xe;B<=Ae;B++){const Ht=I[B]=N?Ca(I[B]):ri(I[B]);Ht.key!=null&&it.set(Ht.key,B)}let yt,Mt=0;const Lt=Ae-Xe+1;let Wt=!1,Be=0;const rn=new Array(Lt);for(B=0;B<Lt;B++)rn[B]=0;for(B=Le;B<=Se;B++){const Ht=ie[B];if(Mt>=Lt){ve(Ht,q,P,!0);continue}let xn;if(Ht.key!=null)xn=it.get(Ht.key);else for(yt=Xe;yt<=Ae;yt++)if(rn[yt-Xe]===0&&ss(Ht,I[yt])){xn=yt;break}xn===void 0?ve(Ht,q,P,!0):(rn[xn-Xe]=B+1,xn>=Be?Be=xn:Wt=!0,v(Ht,I[xn],se,null,q,P,ee,be,N),Mt++)}const zn=Wt?h5(rn):oc;for(yt=zn.length-1,B=Lt-1;B>=0;B--){const Ht=Xe+B,xn=I[Ht],Ur=I[Ht+1],yr=Ht+1<de?Ur.el||ww(Ur):F;rn[B]===0?v(null,xn,se,yr,q,P,ee,be,N):Wt&&(yt<0||B!==zn[yt]?ue(xn,se,yr,2):yt--)}}},ue=(ie,I,se,F,q=null)=>{const{el:P,type:ee,transition:be,children:N,shapeFlag:B}=ie;if(B&6){ue(ie.component.subTree,I,se,F);return}if(B&128){ie.suspense.move(I,se,F);return}if(B&64){ee.move(ie,I,se,ae);return}if(ee===Kt){r(P,I,se);for(let de=0;de<N.length;de++)ue(N[de],I,se,F);r(ie.anchor,I,se);return}if(ee===hl){C(ie,I,se);return}if(F!==2&&B&1&&be)if(F===0)be.beforeEnter(P),r(P,I,se),jr(()=>be.enter(P),q);else{const{leave:de,delayLeave:Se,afterLeave:Ae}=be,Le=()=>{ie.ctx.isUnmounted?o(P):r(P,I,se)},Xe=()=>{P._isLeaving&&P[cs](!0),de(P,()=>{Le(),Ae&&Ae()})};Se?Se(P,Le,Xe):Xe()}else r(P,I,se)},ve=(ie,I,se,F=!1,q=!1)=>{const{type:P,props:ee,ref:be,children:N,dynamicChildren:B,shapeFlag:de,patchFlag:Se,dirs:Ae,cacheIndex:Le,memo:Xe}=ie;if(Se===-2&&(q=!1),be!=null&&(fa(),hu(be,null,se,ie,!0),ha()),Le!=null&&(I.renderCache[Le]=void 0),de&256){I.ctx.deactivate(ie);return}const it=de&1&&Ae,yt=!Ds(ie);let Mt;if(yt&&(Mt=ee&&ee.onVnodeBeforeUnmount)&&oi(Mt,I,ie),de&6)Ne(ie.component,se,F);else{if(de&128){ie.suspense.unmount(se,F);return}it&&Rs(ie,null,I,"beforeUnmount"),de&64?ie.type.remove(ie,I,se,ae,F):B&&!B.hasOnce&&(P!==Kt||Se>0&&Se&64)?Je(B,I,se,!1,!0):(P===Kt&&Se&384||!q&&de&16)&&Je(N,I,se),F&&ge(ie)}const Lt=Xe!=null&&Le==null;(yt&&(Mt=ee&&ee.onVnodeUnmounted)||it||Lt)&&jr(()=>{Mt&&oi(Mt,I,ie),it&&Rs(ie,null,I,"unmounted"),Lt&&(ie.el=null)},se)},ge=ie=>{const{type:I,el:se,anchor:F,transition:q}=ie;if(I===Kt){Te(se,F);return}if(I===hl){w(ie);return}const P=()=>{o(se),q&&!q.persisted&&q.afterLeave&&q.afterLeave()};if(ie.shapeFlag&1&&q&&!q.persisted){const{leave:ee,delayLeave:be}=q,N=()=>ee(se,P);be?be(ie.el,P,N):N()}else P()},Te=(ie,I)=>{let se;for(;ie!==I;)se=p(ie),o(ie),ie=se;o(I)},Ne=(ie,I,se)=>{const{bum:F,scope:q,job:P,subTree:ee,um:be,m:N,a:B}=ie;ap(N),ap(B),F&&ac(F),q.stop(),P&&(P.flags|=8,ve(ee,ie,I,se)),be&&jr(be,I),jr(()=>{ie.isUnmounted=!0},I)},Je=(ie,I,se,F=!1,q=!1,P=0)=>{for(let ee=P;ee<ie.length;ee++)ve(ie[ee],I,se,F,q)},ct=ie=>{if(ie.shapeFlag&6)return ct(ie.component.subTree);if(ie.shapeFlag&128)return ie.suspense.next();const I=p(ie.anchor||ie.el),se=I&&I[jv];return se?p(se):I};let tt=!1;const Tt=(ie,I,se)=>{let F;ie==null?I._vnode&&(ve(I._vnode,null,null,!0),F=I._vnode.component):v(I._vnode||null,ie,I,null,null,null,se),I._vnode=ie,tt||(tt=!0,B1(F),Xh(),tt=!1)},ae={p:v,um:ve,m:ue,r:ge,mt:x,mc:W,pc:Q,pbc:j,n:ct,o:e};let Ee,Ue;return t&&([Ee,Ue]=t(ae)),{render:Tt,hydrate:Ee,createApp:s5(Tt,Ee)}}function Mv({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function dc({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function yw(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Lv(e,t,n=!1){const r=e.children,o=t.children;if(zt(r)&&zt(o))for(let i=0;i<r.length;i++){const s=r[i];let a=o[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=o[i]=Ca(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&Lv(s,a)),a.type===Sa&&(a.patchFlag===-1&&(a=o[i]=Ca(a)),a.el=s.el),a.type===Rr&&!a.el&&(a.el=s.el)}}function h5(e){const t=e.slice(),n=[0];let r,o,i,s,a;const l=e.length;for(r=0;r<l;r++){const u=e[r];if(u!==0){if(o=n[n.length-1],e[o]<u){t[r]=o,n.push(r);continue}for(i=0,s=n.length-1;i<s;)a=i+s>>1,e[n[a]]<u?i=a+1:s=a;u<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r)}}for(i=n.length,s=n[i-1];i-- >0;)n[i]=s,s=t[s];return n}function bw(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:bw(t)}function ap(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function ww(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?ww(t.subTree):null}function sf(e,t){const n=e.props&&e.props[t];Zt(n)&&n()}function p5(e,t,n,r,o,i,s,a,l){const{p:u,o:{createElement:d}}=l,f=d("div"),p=e.suspense=Cw(e,o,r,t,f,n,i,s,a,l);u(null,p.pendingBranch=e.ssContent,f,null,r,p,i,s),p.deps>0?(sf(e,"onPending"),sf(e,"onFallback"),u(null,e.ssFallback,t,n,r,null,i,s),mu(p,e.ssFallback)):p.resolve(!1,!0)}function m5(e,t,n,r,o,i,s,a,{p:l,um:u,o:{createElement:d}}){const f=t.suspense=e.suspense;f.vnode=t,t.el=e.el;const p=t.ssContent,g=t.ssFallback,{activeBranch:m,pendingBranch:v,isInFallback:k,isHydrating:b}=f;if(v)f.pendingBranch=p,ss(v,p)?(l(v,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():k&&(b||(l(m,g,n,r,o,null,i,s,a),mu(f,g)))):(f.pendingId=yp++,b?(f.isHydrating=!1,f.activeBranch=v):u(v,o,f),f.deps=0,f.effects.length=0,f.hiddenContainer=d("div"),k?(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():(l(m,g,n,r,o,null,i,s,a),mu(f,g))):m&&ss(m,p)?(l(m,p,n,r,o,f,i,s,a),f.resolve(!0)):(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0&&f.resolve()));else if(m&&ss(m,p))l(m,p,n,r,o,f,i,s,a),mu(f,p);else if(sf(t,"onPending"),f.pendingBranch=p,p.shapeFlag&512?f.pendingId=p.component.suspenseId:f.pendingId=yp++,l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0)f.resolve();else{const{timeout:S,pendingId:C}=f;S>0?setTimeout(()=>{f.pendingId===C&&f.fallback(g)},S):S===0&&f.fallback(g)}}function Cw(e,t,n,r,o,i,s,a,l,u,d=!1){const{p:f,m:p,um:g,n:m,o:{parentNode:v,remove:k}}=u;let b;const S=y5(e);S&&t&&t.pendingBranch&&(b=t.pendingId,t.deps++);const C=e.props?Vd(e.props.timeout):void 0,w=i,T={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:yp++,timeout:typeof C=="number"?C:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!d,isHydrating:d,isUnmounted:!1,effects:[],resolve(L=!1,z=!1){const{vnode:W,activeBranch:V,pendingBranch:j,pendingId:Z,effects:R,parentComponent:K,container:x,isInFallback:$}=T;let H=!1;T.isHydrating?T.isHydrating=!1:L||(H=V&&j.transition&&j.transition.mode==="out-in",H&&(V.transition.afterLeave=()=>{Z===T.pendingId&&(p(j,x,i===w?m(V):i,0),Qd(R),$&&W.ssFallback&&(W.ssFallback.el=null))}),V&&!T.isFallbackMountPending&&(v(V.el)===x&&(i=m(V)),g(V,K,T,!0),!H&&$&&W.ssFallback&&jr(()=>W.ssFallback.el=null,T)),H||p(j,x,i,0)),T.isFallbackMountPending=!1,mu(T,j),T.pendingBranch=null,T.isInFallback=!1;let J=T.parent,Q=!1;for(;J;){if(J.pendingBranch){J.effects.push(...R),Q=!0;break}J=J.parent}!Q&&!H&&Qd(R),T.effects=[],S&&t&&t.pendingBranch&&b===t.pendingId&&(t.deps--,t.deps===0&&!z&&t.resolve()),sf(W,"onResolve")},fallback(L){if(!T.pendingBranch)return;const{vnode:z,activeBranch:W,parentComponent:V,container:j,namespace:Z}=T;sf(z,"onFallback");const R=m(W),K=()=>{T.isFallbackMountPending=!1,T.isInFallback&&(f(null,L,j,R,V,null,Z,a,l),mu(T,L))},x=L.transition&&L.transition.mode==="out-in";x&&(T.isFallbackMountPending=!0,W.transition.afterLeave=K),T.isInFallback=!0,g(W,V,null,!0),x||K()},move(L,z,W){T.activeBranch&&p(T.activeBranch,L,z,W),T.container=L},next(){return T.activeBranch&&m(T.activeBranch)},registerDep(L,z,W){const V=!!T.pendingBranch;V&&T.deps++;const j=L.vnode.el;L.asyncDep.catch(Z=>{cc(Z,L,0)}).then(Z=>{if(L.isUnmounted||T.isUnmounted||T.pendingId!==L.suspenseId)return;Su(),L.asyncResolved=!0;const{vnode:R}=L;Ov(L,Z,!1),j&&(R.el=j);const K=!j&&L.subTree.el;z(L,R,v(j||L.subTree.el),j?null:m(L.subTree),T,s,W),K&&(R.placeholder=null,k(K)),sp(L,R.el),V&&--T.deps===0&&T.resolve()})},unmount(L,z){T.isUnmounted=!0,T.activeBranch&&g(T.activeBranch,n,L,z),T.pendingBranch&&g(T.pendingBranch,n,L,z)}};return T}function g5(e,t,n,r,o,i,s,a,l){const u=t.suspense=Cw(t,r,n,e.parentNode,document.createElement("div"),null,o,i,s,a,!0),d=l(e,u.pendingBranch=t.ssContent,n,u,i,s);return u.deps===0&&u.resolve(!1,!0),d}function v5(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=kw(r?n.default:n),e.ssFallback=r?kw(n.fallback):Xt(Rr)}function kw(e){let t;if(Zt(e)){const n=pl&&e._c;n&&(e._d=!1,ye()),e=e(),n&&(e._d=!0,t=ko,_w())}return zt(e)&&(e=c5(e)),e=ri(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function Sw(e,t){t&&t.pendingBranch?zt(e)?t.effects.push(...e):t.effects.push(e):Qd(e)}function mu(e,t){e.activeBranch=t;const{vnode:n,parentComponent:r}=e;let o=t.el;for(;!o&&t.component;)t=t.component.subTree,o=t.el;n.el=o,r&&r.subTree===n&&(r.vnode.el=o,sp(r,o))}function y5(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function ye(e=!1){Cu.push(ko=e?null:[])}function _w(){Cu.pop(),ko=Cu[Cu.length-1]||null}function af(e,t=!1){pl+=e,e<0&&ko&&t&&(ko.hasOnce=!0)}function Aw(e){return e.dynamicChildren=pl>0?ko||oc:null,_w(),pl>0&&ko&&ko.push(e),e}function De(e,t,n,r,o,i){return Aw(He(e,t,n,r,o,i,!0))}function an(e,t,n,r,o){return Aw(Xt(e,t,n,r,o,!0))}function wa(e){return e?e.__v_isVNode===!0:!1}function ss(e,t){return e.type===t.type&&e.key===t.key}function b5(e){}function He(e,t=null,n=null,r=0,o=null,i=e===Kt?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&sy(t),ref:t&&vf(t),scopeId:df,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:lo};return a?(Dv(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Xn(n)?8:16),pl>0&&!s&&ko&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&ko.push(l),l}function w5(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===Qv)&&(e=Rr),wa(e)){const a=Ms(e,t,!0);return n&&Dv(a,n),pl>0&&!i&&ko&&(a.shapeFlag&6?ko[ko.indexOf(e)]=a:ko.push(a)),a.patchFlag=-2,a}if(_5(e)&&(e=e.__vccOpts),t){t=Iw(t);let{class:a,style:l}=t;a&&!Xn(a)&&(t.class=en(a)),Fn(l)&&($d(l)&&!zt(l)&&(l=Gn({},l)),t.style=bn(l))}const s=Xn(e)?1:gf(e)?128:Vv(e)?64:Fn(e)?4:Zt(e)?2:0;return He(e,t,n,r,o,s,i,!0)}function Iw(e){return e?$d(e)||ny(e)?Gn({},e):e:null}function Ms(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,u=t?Ls(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&sy(u),ref:t&&t.ref?n&&i?zt(i)?i.concat(vf(t)):[i,vf(t)]:vf(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Kt?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Ms(e.ssContent),ssFallback:e.ssFallback&&Ms(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&ba(d,l.clone(d)),d}function as(e=" ",t=0){return Xt(Sa,null,e,t)}function C5(e,t){const n=Xt(hl,null,e);return n.staticCount=t,n}function vt(e="",t=!1){return t?(ye(),an(Rr,null,e)):Xt(Rr,null,e)}function ri(e){return e==null||typeof e=="boolean"?Xt(Rr):zt(e)?Xt(Kt,null,e.slice()):wa(e)?Ca(e):Xt(Sa,null,String(e))}function Ca(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ms(e)}function Dv(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(zt(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),Dv(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!ny(t)?t._ctx=lo:o===3&&lo&&(lo.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Zt(t)?(t={default:t,_ctx:lo},n=32):(t=String(t),r&64?(n=16,t=[as(t)]):n=8);e.children=t,e.shapeFlag|=n}function Ls(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const o in r)if(o==="class")t.class!==r.class&&(t.class=en([t.class,r.class]));else if(o==="style")t.style=bn([t.style,r.style]);else if(ou(o)){const i=t[o],s=r[o];s&&i!==s&&!(zt(i)&&i.includes(s))?t[o]=i?[].concat(i,s):s:s==null&&i==null&&!Fd(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function oi(e,t,n,r=null){zi(e,t,7,[n,r])}function Ew(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||aC,i={uid:lC++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Wh(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:hw(r,o),emitsOptions:cw(r,o),emit:null,emitted:null,propsDefaults:Dn,inheritAttrs:r.inheritAttrs,ctx:Dn,data:Dn,props:Dn,attrs:Dn,slots:Dn,refs:Dn,setupState:Dn,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=t?t.root:i,i.emit=l5.bind(null,i),e.ce&&e.ce(i),i}function Tw(e){return e.vnode.shapeFlag&4}function xw(e,t=!1,n=!1){t&&ku(t);const{props:r,children:o}=e.vnode,i=Tw(e);d5(e,r,i,t),oC(e,o,n||t);const s=i?k5(e,t):void 0;return t&&ku(!1),s}function k5(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,pp);const{setup:r}=n;if(r){fa();const o=e.setupContext=r.length>1?Mw(e):null,i=gc(e),s=du(r,e,0,[e.props,o]),a=zh(s);if(ha(),i(),(a||e.sp)&&!Ds(e)&&Cv(e),a){if(s.then(Su,Su),t)return s.then(l=>{Ov(e,l,t)}).catch(l=>{cc(l,e,0)});e.asyncDep=s}else Ov(e,s,t)}else Rw(e,t)}function Ov(e,t,n){Zt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Fn(t)&&(e.setupState=iv(t)),Rw(e,n)}function S5(e){wp=e,ay=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,Xw))}}function Rw(e,t,n){const r=e.type;if(!e.render){if(!t&&wp&&!r.render){const o=r.template||Tv(e).template;if(o){const{isCustomElement:i,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:l}=r,u=Gn(Gn({isCustomElement:i,delimiters:a},s),l);r.render=wp(o,u)}}e.render=r.render||gi,ay&&ay(e)}{const o=gc(e);fa();try{n5(e)}finally{ha(),o()}}}function Mw(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,uC),slots:e.slots,emit:e.emit,expose:t}}function lf(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(iv(Wr(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in wu)return wu[n](e)},has(t,n){return n in t||n in wu}})):e.proxy}function Pv(e,t=!0){return Zt(e)?e.displayName||e.name:e.name||t&&e.__name}function _5(e){return Zt(e)&&"__vccOpts"in e}function zr(e,t,n){try{af(-1);const r=arguments.length;return r===2?Fn(t)&&!zt(t)?wa(t)?Xt(e,null,[t]):Xt(e,t):Xt(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&wa(n)&&(n=[n]),Xt(e,t,n))}finally{af(1)}}function A5(){return;function e(t,n,r){const o=t[r];if(zt(o)&&o.includes(n)||Fn(o)&&n in o||t.extends&&e(t.extends,n,r)||t.mixins&&t.mixins.some(i=>e(i,n,r)))return!0}}function I5(e,t,n,r){const o=n[r];if(o&&Lw(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function Lw(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(so(n[r],t[r]))return!1;return pl>0&&ko&&ko.push(e),!0}var Fv,Dw,Ow,Lo,ls,fc,ka,hc,Nv,cf,gu,vu,uf,lo,df,Pw,Bv,zv,cl,jv,Vv,ul,Fw,Uv,Hv,lp,Nw,dl,cs,yu,vi,cp,$v,Bw,Gv,ff,Wv,pc,zw,jw,hf,mc,Kv,Vw,Uw,Hw,$w,Gw,Ww,Kw,Ds,bu,qw,Os,qv,Nn,up,pf,cr,mf,Yv,Xv,Zv,dp,Yw,Qv,fp,wu,hp,pp,Xw,mp,Zw,Qw,fl,Jv,Jw,eC,tC,ey,ty,ny,nC,gp,vp,rC,ry,oy,iy,oC,iC,jr,gf,yp,sC,Kt,Sa,Rr,hl,Cu,ko,pl,sy,vf,Xt,aC,lC,co,pr,bp,ku,gc,Su,ml,wp,ay,cC,uC,ke,ly,dC,fC,hC,pC,mC,E5,T5,x5,gC=xr((()=>{_T(),Xg(),Fv=[],Dw={SETUP_FUNCTION:0,0:"SETUP_FUNCTION",RENDER_FUNCTION:1,1:"RENDER_FUNCTION",NATIVE_EVENT_HANDLER:5,5:"NATIVE_EVENT_HANDLER",COMPONENT_EVENT_HANDLER:6,6:"COMPONENT_EVENT_HANDLER",VNODE_HOOK:7,7:"VNODE_HOOK",DIRECTIVE_HOOK:8,8:"DIRECTIVE_HOOK",TRANSITION_HOOK:9,9:"TRANSITION_HOOK",APP_ERROR_HANDLER:10,10:"APP_ERROR_HANDLER",APP_WARN_HANDLER:11,11:"APP_WARN_HANDLER",FUNCTION_REF:12,12:"FUNCTION_REF",ASYNC_COMPONENT_LOADER:13,13:"ASYNC_COMPONENT_LOADER",SCHEDULER:14,14:"SCHEDULER",COMPONENT_UPDATE:15,15:"COMPONENT_UPDATE",APP_UNMOUNT_CLEANUP:16,16:"APP_UNMOUNT_CLEANUP"},Ow={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"},Lo=[],ls=-1,fc=[],ka=null,hc=0,Nv=Promise.resolve(),cf=null,gu=e=>e.id==null?e.flags&2?-1:1/0:e.id,uf=[],lo=null,df=null,Pw=e=>ao,Bv=Symbol.for("v-scx"),zv=()=>{{const e=ll(Bv);return e}},cl=new WeakMap,jv=Symbol("_vte"),Vv=e=>e.__isTeleport,ul=e=>e&&(e.disabled||e.disabled===""),Fw=e=>e&&(e.defer||e.defer===""),Uv=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Hv=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,lp=(e,t)=>{const n=e&&e.to;return Xn(n)?t?t(n):null:n},Nw={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,u){const{mc:d,pc:f,pbc:p,o:{insert:g,querySelector:m,createText:v,createComment:k}}=u,b=ul(t.props);let{dynamicChildren:S}=t;const C=(L,z,W)=>{L.shapeFlag&16&&d(L.children,z,W,o,i,s,a,l)},w=(L=t)=>{const z=ul(L.props),W=L.target=lp(L.props,m),V=yv(W,L,v,g);W&&(s!=="svg"&&Uv(W)?s="svg":s!=="mathml"&&Hv(W)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(W),z||(C(L,W,V),tf(L,!1)))},T=L=>{const z=()=>{cl.get(L)===z&&(cl.delete(L),ul(L.props)&&(C(L,n,L.anchor),tf(L,!0)),w(L))};cl.set(L,z),jr(z,i)};if(e==null){const L=t.el=v(""),z=t.anchor=v("");if(g(L,n,r),g(z,n,r),Fw(t.props)||i&&i.pendingBranch){T(t);return}b&&(C(t,n,z),tf(t,!0)),w()}else{t.el=e.el;const L=t.anchor=e.anchor,z=cl.get(e);if(z){z.flags|=8,cl.delete(e),T(t);return}t.targetStart=e.targetStart;const W=t.target=e.target,V=t.targetAnchor=e.targetAnchor,j=ul(e.props),Z=j?n:W,R=j?L:V;if(s==="svg"||Uv(W)?s="svg":(s==="mathml"||Hv(W))&&(s="mathml"),S?(p(e.dynamicChildren,S,Z,o,i,s,a),Lv(e,t,!0)):l||f(e,t,Z,R,o,i,s,a,!1),b)j?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Zh(t,n,L,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const K=t.target=lp(t.props,m);K&&Zh(t,K,null,u,0)}else j&&Zh(t,W,V,u,1);tf(t,b)}},remove(e,t,n,{um:r,o:{remove:o}},i){const{shapeFlag:s,children:a,anchor:l,targetStart:u,targetAnchor:d,target:f,props:p}=e;let g=i||!ul(p);const m=cl.get(e);if(m&&(m.flags|=8,cl.delete(e),g=!1),f&&(o(u),o(d)),i&&o(l),s&16)for(let v=0;v<a.length;v++){const k=a[v];r(k,t,n,g,!!k.dynamicChildren)}},move:Zh,hydrate:PT},dl=Nw,cs=Symbol("_leaveCb"),yu=Symbol("_enterCb"),vi=[Function,Array],cp={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:vi,onEnter:vi,onAfterEnter:vi,onEnterCancelled:vi,onBeforeLeave:vi,onLeave:vi,onAfterLeave:vi,onLeaveCancelled:vi,onBeforeAppear:vi,onAppear:vi,onAfterAppear:vi,onAppearCancelled:vi},$v=e=>{const t=e.subTree;return t.component?$v(t.component):t},Bw={name:"BaseTransition",props:cp,setup(e,{slots:t}){const n=pr(),r=bv();return()=>{const o=t.default&&Qh(t.default(),!0);if(!o||!o.length)return;const i=G1(o),s=pn(e),{mode:a}=s;if(r.isLeaving)return wv(i);const l=K1(i);if(!l)return wv(i);let u=fu(l,s,r,n,f=>u=f);l.type!==Rr&&ba(l,u);let d=n.subTree&&K1(n.subTree);if(d&&d.type!==Rr&&!ss(d,l)&&$v(n).type!==Rr){let f=fu(d,s,r,n);if(ba(d,f),a==="out-in"&&l.type!==Rr)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,d=void 0},wv(i);a==="in-out"&&l.type!==Rr?f.delayLeave=(p,g,m)=>{const v=W1(r,d);v[String(d.key)]=d,p[cs]=()=>{g(),p[cs]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{m(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return i}}},Gv=Bw,ff=new WeakMap,Wv=!1,pc=()=>{Wv||(console.error("Hydration completed but contains mismatches."),Wv=!0)},zw=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",jw=e=>e.namespaceURI.includes("MathML"),hf=e=>{if(e.nodeType===1){if(zw(e))return"svg";if(jw(e))return"mathml"}},mc=e=>e.nodeType===8,Kv="data-allow-mismatch",Vw={0:"text",1:"children",2:"class",3:"style",4:"attribute"},Uw=Ud().requestIdleCallback||(e=>setTimeout(e,1)),Hw=Ud().cancelIdleCallback||(e=>clearTimeout(e)),$w=(e=1e4)=>t=>{const n=Uw(t,{timeout:e});return()=>Hw(n)},Gw=e=>(t,n)=>{const r=new IntersectionObserver(o=>{for(const i of o)if(i.isIntersecting){r.disconnect(),t();break}},e);return n(o=>{if(o instanceof Element){if(zT(o))return t(),r.disconnect(),!1;r.observe(o)}}),()=>r.disconnect()},Ww=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},Kw=(e=[])=>(t,n)=>{Xn(e)&&(e=[e]);let r=!1;const o=s=>{r||(r=!0,i(),t(),s.target.dispatchEvent(new s.constructor(s.type,s)))},i=()=>{n(s=>{for(const a of e)s.removeEventListener(a,o)})};return n(s=>{for(const a of e)s.addEventListener(a,o,{once:!0})}),i},Ds=e=>!!e.type.__asyncLoader,bu=e=>e.type.__isKeepAlive,qw={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=pr(),r=n.ctx;if(!r.renderer)return()=>{const S=t.default&&t.default();return S&&S.length===1?S[0]:S};const o=new Map,i=new Set;let s=null;const a=n.suspense,{renderer:{p:l,m:u,um:d,o:{createElement:f}}}=r,p=f("div");r.activate=(S,C,w,T,L)=>{const z=S.component;u(S,C,w,0,a),l(z.vnode,S,C,w,z,a,T,S.slotScopeIds,L),jr(()=>{z.isDeactivated=!1,z.a&&ac(z.a);const W=S.props&&S.props.onVnodeMounted;W&&oi(W,z.parent,S)},a)},r.deactivate=S=>{const C=S.component;ap(C.m),ap(C.a),u(S,p,null,1,a),jr(()=>{C.da&&ac(C.da);const w=S.props&&S.props.onVnodeUnmounted;w&&oi(w,C.parent,S),C.isDeactivated=!0},a)};function g(S){_v(S),d(S,n,a,!0)}function m(S){o.forEach((C,w)=>{const T=Pv(Ds(C)?C.type.__asyncResolved||{}:C.type);T&&!S(T)&&v(w)})}function v(S){const C=o.get(S);C&&(!s||!ss(C,s))?g(C):s&&_v(s),o.delete(S),i.delete(S)}jt(()=>[e.include,e.exclude],([S,C])=>{S&&m(w=>nf(S,w)),C&&m(w=>!nf(C,w))},{flush:"post",deep:!0});let k=null;const b=()=>{k!=null&&(gf(n.subTree.type)?jr(()=>{o.set(k,tp(n.subTree))},n.subTree.suspense):o.set(k,tp(n.subTree)))};return Nn(b),pf(b),cr(()=>{o.forEach(S=>{const{subTree:C,suspense:w}=n,T=tp(C);if(S.type===T.type&&S.key===T.key){_v(T);const L=T.component.da;L&&jr(L,w);return}g(S)})}),()=>{if(k=null,!t.default)return s=null;const S=t.default(),C=S[0];if(S.length>1)return s=null,S;if(!wa(C)||!(C.shapeFlag&4)&&!(C.shapeFlag&128))return s=null,C;let w=tp(C);if(w.type===Rr)return s=null,w;const T=w.type,L=Pv(Ds(w)?w.type.__asyncResolved||{}:T),{include:z,exclude:W,max:V}=e;if(z&&(!L||!nf(z,L))||W&&L&&nf(W,L))return w.shapeFlag&=-257,s=w,C;const j=w.key==null?T:w.key,Z=o.get(j);return w.el&&(w=Ms(w),C.shapeFlag&128&&(C.ssContent=w)),k=j,Z?(w.el=Z.el,w.component=Z.component,w.transition&&ba(w,w.transition),w.shapeFlag|=512,i.delete(j),i.add(j)):(i.add(j),V&&i.size>parseInt(V,10)&&v(i.values().next().value)),w.shapeFlag|=256,s=w,gf(C.type)?C:w}}},Os=e=>(t,n=co)=>{(!ml||e==="sp")&&np(e,(...r)=>t(...r),n)},qv=Os("bm"),Nn=Os("m"),up=Os("bu"),pf=Os("u"),cr=Os("bum"),mf=Os("um"),Yv=Os("sp"),Xv=Os("rtg"),Zv=Os("rtc"),dp="components",Yw="directives",Qv=Symbol.for("v-ndc"),fp=e=>e?Tw(e)?lf(e):fp(e.parent):null,wu=Gn(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>fp(e.parent),$root:e=>fp(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Tv(e),$forceUpdate:e=>e.f||(e.f=()=>{vv(e.update)}),$nextTick:e=>e.n||(e.n=St.bind(e.proxy)),$watch:e=>OT.bind(e)}),hp=(e,t)=>e!==Dn&&!e.__isScriptSetup&&jn(e,t),pp={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:i,accessCache:s,type:a,appContext:l}=e;if(t[0]!=="$"){const p=s[t];if(p!==void 0)switch(p){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return i[t]}else{if(hp(r,t))return s[t]=1,r[t];if(o!==Dn&&jn(o,t))return s[t]=2,o[t];if(jn(i,t))return s[t]=3,i[t];if(n!==Dn&&jn(n,t))return s[t]=4,n[t];mp&&(s[t]=0)}}const u=wu[t];let d,f;if(u)return t==="$attrs"&&Ro(e.attrs,"get",""),u(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==Dn&&jn(n,t))return s[t]=4,n[t];if(f=l.config.globalProperties,jn(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return hp(o,t)?(o[t]=n,!0):r!==Dn&&jn(r,t)?(r[t]=n,!0):jn(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:i,type:s}},a){let l;return!!(n[a]||e!==Dn&&a[0]!=="$"&&jn(e,a)||hp(t,a)||jn(i,a)||jn(r,a)||jn(wu,a)||jn(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:jn(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},Xw=Gn({},pp,{get(e,t){if(t!==Symbol.unscopables)return pp.get(e,t,e)},has(e,t){return t[0]!=="_"&&!Q2(t)}}),mp=!0,Zw={data:sw,props:aw,emits:aw,methods:of,computed:of,beforeCreate:Uo,created:Uo,beforeMount:Uo,mounted:Uo,beforeUpdate:Uo,updated:Uo,beforeDestroy:Uo,beforeUnmount:Uo,destroyed:Uo,unmounted:Uo,activated:Uo,deactivated:Uo,errorCaptured:Uo,serverPrefetch:Uo,components:of,directives:of,watch:i5,provide:sw,inject:o5},Qw=0,fl=null,Jv=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Nr(t)}Modifiers`]||e[`${Vo(t)}Modifiers`],Jw=new WeakMap,eC=e=>{let t;for(const n in e)(n==="class"||n==="style"||ou(n))&&((t||(t={}))[n]=e[n]);return t},tC=(e,t)=>{const n={};for(const r in e)(!Fd(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},ey={},ty=()=>Object.create(ey),ny=e=>Object.getPrototypeOf(e)===ey,nC=new WeakMap,gp=e=>e==="_"||e==="_ctx"||e==="$stable",vp=e=>zt(e)?e.map(ri):[ri(e)],rC=(e,t,n)=>{if(t._n)return t;const r=ao((...o)=>vp(t(...o)),n);return r._c=!1,r},ry=(e,t,n)=>{const r=e._ctx;for(const o in e){if(gp(o))continue;const i=e[o];if(Zt(i))t[o]=rC(o,i,r);else if(i!=null){const s=vp(i);t[o]=()=>s}}},oy=(e,t)=>{const n=vp(t);e.slots.default=()=>n},iy=(e,t,n)=>{for(const r in t)(n||!gp(r))&&(e[r]=t[r])},oC=(e,t,n)=>{const r=e.slots=ty();if(e.vnode.shapeFlag&32){const o=t._;o?(iy(r,t,n),n&&Wg(r,"_",o,!0)):ry(t,r)}else t&&oy(e,t)},iC=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=Dn;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:iy(o,t,n):(i=!t.$stable,ry(t,o)),s=t}else t&&(oy(e,t),s={default:1});if(i)for(const a in o)!gp(a)&&s[a]==null&&delete o[a]},jr=Sw,gf=e=>e.__isSuspense,yp=0,sC={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,u){if(e==null)p5(t,n,r,o,i,s,a,l,u);else{if(i&&i.deps>0&&!e.suspense.isInFallback){t.suspense=e.suspense,t.suspense.vnode=t,t.el=e.el;return}m5(e,t,n,r,o,s,a,l,u)}},hydrate:g5,normalize:v5},Kt=Symbol.for("v-fgt"),Sa=Symbol.for("v-txt"),Rr=Symbol.for("v-cmt"),hl=Symbol.for("v-stc"),Cu=[],ko=null,pl=1,sy=({key:e})=>e??null,vf=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Xn(e)||lr(e)||Zt(e)?{i:lo,r:e,k:t,f:!!n}:e:null),Xt=w5,aC=lw(),lC=0,co=null,pr=()=>co||lo;{const e=Ud(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),i=>{o.length>1?o.forEach(s=>s(i)):o[0](i)}};bp=t("__VUE_INSTANCE_SETTERS__",n=>co=n),ku=t("__VUE_SSR_SETTERS__",n=>ml=n)}gc=e=>{const t=co;return bp(e),e.scope.on(),()=>{e.scope.off(),bp(t)}},Su=()=>{co&&co.scope.off(),bp(null)},ml=!1,cC=()=>!wp,uC={get(e,t){return Ro(e,"get",""),e[t]}},ke=(e,t)=>CT(e,t,ml),ly="3.5.32",dC=gi,fC=Ow,hC=vu,pC=j1,mC={createComponentInstance:Ew,setupComponent:xw,renderComponentRoot:ip,setCurrentRenderingInstance:Jd,isVNode:wa,normalizeVNode:ri,getComponentPublicInstance:lf,ensureValidVNode:Ev,pushWarningContext:AT,popWarningContext:IT},E5=null,T5=null,x5=null}));function vC(e){const t={};for(const R in e)R in gy||(t[R]=e[R]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:i=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:u=s,appearToClass:d=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,m=R5(o),v=m&&m[0],k=m&&m[1],{onBeforeEnter:b,onEnter:S,onEnterCancelled:C,onLeave:w,onLeaveCancelled:T,onBeforeAppear:L=b,onAppear:z=S,onAppearCancelled:W=C}=t,V=(R,K,x,$)=>{R._enterCancelled=$,gl(R,K?d:a),gl(R,K?u:s),x&&x()},j=(R,K)=>{R._isLeaving=!1,gl(R,f),gl(R,g),gl(R,p),K&&K()},Z=R=>(K,x)=>{const $=R?z:S,H=()=>V(K,R,x);vl($,[K,H]),yC(()=>{gl(K,R?l:i),Ps(K,R?d:a),yy($)||bC(K,r,v,H)})};return Gn(t,{onBeforeEnter(R){vl(b,[R]),Ps(R,i),Ps(R,s)},onBeforeAppear(R){vl(L,[R]),Ps(R,l),Ps(R,u)},onEnter:Z(!1),onAppear:Z(!0),onLeave(R,K){R._isLeaving=!0;const x=()=>j(R,K);Ps(R,f),R._enterCancelled?(Ps(R,p),uy(R)):(uy(R),Ps(R,p)),yC(()=>{R._isLeaving&&(gl(R,f),Ps(R,g),yy(w)||bC(R,r,k,x))}),vl(w,[R,x])},onEnterCancelled(R){V(R,!1,void 0,!0),vl(C,[R])},onAppearCancelled(R){V(R,!0,void 0,!0),vl(W,[R])},onLeaveCancelled(R){j(R),vl(T,[R])}})}function R5(e){if(e==null)return null;if(Fn(e))return[cy(e.enter),cy(e.leave)];{const t=cy(e);return[t,t]}}function cy(e){return Vd(e)}function Ps(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[vc]||(e[vc]=new Set)).add(t)}function gl(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[vc];n&&(n.delete(t),n.size||(e[vc]=void 0))}function yC(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function bC(e,t,n,r){const o=e._endId=++VC,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=wC(e,t);if(!s)return r();const u=s+"end";let d=0;const f=()=>{e.removeEventListener(u,p),i()},p=g=>{g.target===e&&++d>=l&&f()};setTimeout(()=>{d<l&&f()},a+1),e.addEventListener(u,p)}function wC(e,t){const n=window.getComputedStyle(e),r=m=>(n[m]||"").split(", "),o=r(`${Aa}Delay`),i=r(`${Aa}Duration`),s=CC(o,i),a=r(`${Au}Delay`),l=r(`${Au}Duration`),u=CC(a,l);let d=null,f=0,p=0;t===Aa?s>0&&(d=Aa,f=s,p=i.length):t===Au?u>0&&(d=Au,f=u,p=l.length):(f=Math.max(s,u),d=f>0?s>u?Aa:Au:null,p=d?d===Aa?i.length:l.length:0);const g=d===Aa&&/\b(?:transform|all)(?:,|$)/.test(r(`${Aa}Property`).toString());return{type:d,timeout:f,propCount:p,hasTransform:g}}function CC(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>kC(n)+kC(e[r])))}function kC(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function uy(e){return(e?e.ownerDocument:document).body.offsetHeight}function M5(e,t,n){const r=e[vc];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function yf(e,t){e.style.display=t?e[bf]:"none",e[by]=!t}function L5(){wy.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function D5(e){const t=pr();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>Cp(i,o))},r=()=>{const o=e(t.proxy);t.ce?Cp(t.ce,o):dy(t.subTree,o),n(o)};up(()=>{Qd(r)}),Nn(()=>{jt(r,gi,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),mf(()=>o.disconnect())})}function dy(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{dy(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)Cp(e.el,t);else if(e.type===Kt)e.children.forEach(n=>dy(n,t));else if(e.type===hl){let{el:n,anchor:r}=e;for(;n&&(Cp(n,t),n!==r);)n=n.nextSibling}}function Cp(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=aT(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[Cy]=r}}function O5(e,t,n){const r=e.style,o=Xn(n);let i=!1;if(n&&!o){if(t)if(Xn(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&kp(r,a,"")}else for(const s in t)n[s]==null&&kp(r,s,"");for(const s in n)s==="display"&&(i=!0),kp(r,s,n[s])}else if(o){if(t!==n){const s=r[Cy];s&&(n+=";"+s),r.cssText=n,i=UC.test(n)}}else t&&e.removeAttribute("style");bf in e&&(e[bf]=i?r.display:"",e[by]&&(r.display="none"))}function kp(e,t,n){if(zt(n))n.forEach(r=>kp(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=P5(e,t);ky.test(n)?e.setProperty(Vo(r),n.replace(ky,""),"important"):e[r]=n}}function P5(e,t){const n=Ip[t];if(n)return n;let r=Nr(t);if(r!=="filter"&&r in e)return Ip[t]=r;r=iu(r);for(let o=0;o<Sy.length;o++){const i=Sy[o]+r;if(i in e)return Ip[t]=i}return t}function SC(e,t,n,r,o,i=n1(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(_y,t.slice(6,t.length)):e.setAttributeNS(_y,t,n):n==null||i&&!G2(n)?e.removeAttribute(t):e.setAttribute(t,i?"":ti(n)?String(n):n)}function _C(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?hy(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=G2(n):n==null&&a==="string"?(n="",s=!0):a==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function _a(e,t,n,r){e.addEventListener(t,n,r)}function F5(e,t,n,r){e.removeEventListener(t,n,r)}function N5(e,t,n,r,o=null){const i=e[Ay]||(e[Ay]={}),s=i[t];if(r&&s)s.value=r;else{const[a,l]=B5(t);r?_a(e,a,i[t]=z5(r,o),l):s&&(F5(e,a,s,l),i[t]=void 0)}}function B5(e){let t;if(Iy.test(e)){t={};let n;for(;n=e.match(Iy);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Vo(e.slice(2)),t]}function z5(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;zi(j5(r,n.value),t,5,[r])};return n.value=e,n.attached=$C(),n}function j5(e,t){if(zt(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>o=>!o._stopped&&r&&r(o))}else return t}function V5(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ey(t)&&Zt(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Ey(t)&&Xn(n)?!1:t in e}function U5(e,t){const n=e._def.props;if(!n)return!1;const r=Nr(t);return Array.isArray(n)?n.some(o=>Nr(o)===r):Object.keys(n).some(o=>Nr(o)===r)}function AC(e,t,n){let r=uc(e,t);Nd(r)&&(r=Gn({},r,t));class o extends Ry{constructor(s){super(r,s,n)}}return o.def=r,o}function IC(e){const t=pr(),n=t&&t.ce;return n||null}function H5(){const e=IC();return e&&e.shadowRoot}function $5(e="$style"){{const t=pr();if(!t)return Dn;const n=t.type.__cssModules;if(!n)return Dn;const r=n[e];return r||Dn}}function G5(e){const t=e.el;t[wf]&&t[wf](),t[Dy]&&t[Dy]()}function W5(e){Ly.set(e,EC(e.el))}function K5(e){const t=My.get(e),n=Ly.get(e),r=t.left-n.left,o=t.top-n.top;if(r||o){const i=e.el,s=i.style,a=i.getBoundingClientRect();let l=1,u=1;return i.offsetWidth&&(l=a.width/i.offsetWidth),i.offsetHeight&&(u=a.height/i.offsetHeight),(!Number.isFinite(l)||l===0)&&(l=1),(!Number.isFinite(u)||u===0)&&(u=1),Math.abs(l-1)<.01&&(l=1),Math.abs(u-1)<.01&&(u=1),s.transform=s.webkitTransform=`translate(${r/l}px,${o/u}px)`,s.transitionDuration="0s",e}}function EC(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function q5(e,t,n){const r=e.cloneNode(),o=e[vc];o&&o.forEach(a=>{a.split(/\s+/).forEach(l=>l&&r.classList.remove(l))}),n.split(/\s+/).forEach(a=>a&&r.classList.add(a)),r.style.display="none";const i=t.nodeType===1?t:t.parentNode;i.appendChild(r);const{hasTransform:s}=wC(r);return i.removeChild(r),s}function Y5(e){e.target.composing=!0}function TC(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function xC(e,t,n){return t&&(e=e.trim()),n&&(e=jd(e)),e}function RC(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(zt(t))o=Nh(t,r.props.value)>-1;else if(il(t))o=t.has(r.props.value);else{if(t===n)return;o=da(t,LC(e,!0))}e.checked!==o&&(e.checked=o)}function MC(e,t){const n=e.multiple,r=zt(t);if(!(n&&!r&&!il(t))){for(let o=0,i=e.options.length;o<i;o++){const s=e.options[o],a=_u(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(u=>String(u)===String(a)):s.selected=Nh(t,a)>-1}else s.selected=t.has(a);else if(da(_u(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function _u(e){return"_value"in e?e._value:e.value}function LC(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function DC(e,t){switch(e){case"SELECT":return Oy;case"TEXTAREA":return ji;default:switch(t){case"checkbox":return Tp;case"radio":return xp;default:return ji}}}function Sp(e,t,n,r,o){const i=DC(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function X5(){ji.getSSRProps=({value:e})=>({value:e}),xp.getSSRProps=({value:e},t)=>{if(t.props&&da(t.props.value,e))return{checked:!0}},Tp.getSSRProps=({value:e},t)=>{if(zt(e)){if(t.props&&Nh(e,t.props.value)>-1)return{checked:!0}}else if(il(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Py.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=DC(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function OC(){return Cf||(Cf=mw(Fy))}function PC(){return Cf=Ny?Cf:gw(Fy),Ny=!0,Cf}function FC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function NC(e){return Xn(e)?document.querySelector(e):e}var _p,fy,hy,BC,zC,Fs,py,my,Aa,Au,vc,gy,vy,jC,Ap,vl,yy,VC,bf,by,wy,Cy,UC,ky,Sy,Ip,_y,Ay,Iy,Ep,HC,$C,Ey,Ty,xy,GC,WC,Ry,My,Ly,wf,Dy,KC,qC,Ia,yi,ji,Tp,xp,Oy,Py,YC,XC,Jt,ZC,ii,Fy,Cf,Ny,By,QC,yc,zy,jy,JC,Z5=xr((()=>{if(gC(),gC(),Xg(),_p=void 0,fy=typeof window<"u"&&window.trustedTypes,fy)try{_p=fy.createPolicy("vue",{createHTML:e=>e})}catch{}hy=_p?e=>_p.createHTML(e):e=>e,BC="http://www.w3.org/2000/svg",zC="http://www.w3.org/1998/Math/MathML",Fs=typeof document<"u"?document:null,py=Fs&&Fs.createElement("template"),my={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o=t==="svg"?Fs.createElementNS(BC,e):t==="mathml"?Fs.createElementNS(zC,e):n?Fs.createElement(e,{is:n}):Fs.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Fs.createTextNode(e),createComment:e=>Fs.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Fs.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,i){const s=n?n.previousSibling:t.lastChild;if(o&&(o===i||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===i||!(o=o.nextSibling)););else{py.innerHTML=hy(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=py.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Aa="transition",Au="animation",vc=Symbol("_vtc"),gy={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},vy=Gn({},cp,gy),jC=e=>(e.displayName="Transition",e.props=vy,e),Ap=jC((e,{slots:t})=>zr(Gv,vC(e),t)),vl=(e,t=[])=>{zt(e)?e.forEach(n=>n(...t)):e&&e(...t)},yy=e=>e?zt(e)?e.some(t=>t.length>1):e.length>1:!1,VC=0,bf=Symbol("_vod"),by=Symbol("_vsh"),wy={name:"show",beforeMount(e,{value:t},{transition:n}){e[bf]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):yf(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),yf(e,!0),r.enter(e)):r.leave(e,()=>{yf(e,!1)}):yf(e,t))},beforeUnmount(e,{value:t}){yf(e,t)}},Cy=Symbol(""),UC=/(?:^|;)\s*display\s*:/,ky=/\s*!important$/,Sy=["Webkit","Moz","ms"],Ip={},_y="http://www.w3.org/1999/xlink",Ay=Symbol("_vei"),Iy=/(?:Once|Passive|Capture)$/,Ep=0,HC=Promise.resolve(),$C=()=>Ep||(HC.then(()=>Ep=0),Ep=Date.now()),Ey=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Ty=(e,t,n,r,o,i)=>{const s=o==="svg";t==="class"?M5(e,r,s):t==="style"?O5(e,n,r):ou(t)?Fd(t)||N5(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):V5(e,t,r,s))?(_C(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&SC(e,t,r,s,i,t!=="value")):e._isVueCE&&(U5(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Xn(r)))?_C(e,Nr(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),SC(e,t,r,s))},xy={},GC=((e,t)=>AC(e,t,zy)),WC=typeof HTMLElement<"u"?HTMLElement:class{},Ry=class RE extends WC{constructor(t,n={},r=yc){super(),this._def=t,this._props=n,this._createApp=r,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._styleAnchors=new WeakMap,this._ob=null,this.shadowRoot&&r!==yc?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(Gn({},t.shadowRootOptions,{mode:"open"})),this._root=this.shadowRoot):this._root=this}connectedCallback(){if(!this.isConnected)return;!this.shadowRoot&&!this._resolved&&this._parseSlots(),this._connected=!0;let t=this;for(;t=t&&(t.assignedSlot||t.parentNode||t.host);)if(t instanceof RE){this._parent=t;break}this._instance||(this._resolved?this._mount(this._def):t&&t._pendingResolve?this._pendingResolve=t._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(t=this._parent){t&&(this._instance.parent=t._instance,this._inheritParentContext(t))}_inheritParentContext(t=this._parent){t&&this._app&&Object.setPrototypeOf(this._app._context.provides,t._instance.provides)}disconnectedCallback(){this._connected=!1,St(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&(this._teleportTargets.clear(),this._teleportTargets=void 0))})}_processMutations(t){for(const n of t)this._setAttr(n.attributeName)}_resolveDef(){if(this._pendingResolve)return;for(let r=0;r<this.attributes.length;r++)this._setAttr(this.attributes[r].name);this._ob=new MutationObserver(this._processMutations.bind(this)),this._ob.observe(this,{attributes:!0});const t=(r,o=!1)=>{this._resolved=!0,this._pendingResolve=void 0;const{props:i,styles:s}=r;let a;if(i&&!zt(i))for(const l in i){const u=i[l];(u===Number||u&&u.type===Number)&&(l in this._props&&(this._props[l]=Vd(this._props[l])),(a||(a=Object.create(null)))[Nr(l)]=!0)}this._numberProps=a,this._resolveProps(r),this.shadowRoot&&this._applyStyles(s),this._mount(r)},n=this._def.__asyncLoader;n?this._pendingResolve=n().then(r=>{r.configureApp=this._def.configureApp,t(this._def=r,!0)}):t(this._def)}_mount(t){this._app=this._createApp(t),this._inheritParentContext(),t.configureApp&&t.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);const n=this._instance&&this._instance.exposed;if(n)for(const r in n)jn(this,r)||Object.defineProperty(this,r,{get:()=>Qe(n[r])})}_resolveProps(t){const{props:n}=t,r=zt(n)?n:Object.keys(n||{});for(const o of Object.keys(this))o[0]!=="_"&&r.includes(o)&&this._setProp(o,this[o]);for(const o of r.map(Nr))Object.defineProperty(this,o,{get(){return this._getProp(o)},set(i){this._setProp(o,i,!0,!this._patching)}})}_setAttr(t){if(t.startsWith("data-v-"))return;const n=this.hasAttribute(t);let r=n?this.getAttribute(t):xy;const o=Nr(t);n&&this._numberProps&&this._numberProps[o]&&(r=Vd(r)),this._setProp(o,r,!1,!0)}_getProp(t){return this._props[t]}_setProp(t,n,r=!0,o=!1){if(n!==this._props[t]&&(this._dirty=!0,n===xy?delete this._props[t]:(this._props[t]=n,t==="key"&&this._app&&(this._app._ceVNode.key=n)),o&&this._instance&&this._update(),r)){const i=this._ob;i&&(this._processMutations(i.takeRecords()),i.disconnect()),n===!0?this.setAttribute(Vo(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(Vo(t),n+""):n||this.removeAttribute(Vo(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),By(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=Xt(this._def,Gn(t,this._props));return this._instance||(n.ce=r=>{this._instance=r,r.ce=this,r.isCE=!0;const o=(i,s)=>{this.dispatchEvent(new CustomEvent(i,Nd(s[0])?Gn({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),Vo(i)!==i&&o(Vo(i),s)},this._setParent()}),n}_applyStyles(t,n,r){if(!t)return;if(n){if(n===this._def||this._styleChildren.has(n))return;this._styleChildren.add(n)}const o=this._nonce,i=this.shadowRoot,s=r?this._getStyleAnchor(r)||this._getStyleAnchor(this._def):this._getRootStyleInsertionAnchor(i);let a=null;for(let l=t.length-1;l>=0;l--){const u=document.createElement("style");o&&u.setAttribute("nonce",o),u.textContent=t[l],i.insertBefore(u,a||s),a=u,l===0&&(r||this._styleAnchors.set(this._def,u),n&&this._styleAnchors.set(n,u))}}_getStyleAnchor(t){if(!t)return null;const n=this._styleAnchors.get(t);return n&&n.parentNode===this.shadowRoot?n:(n&&this._styleAnchors.delete(t),null)}_getRootStyleInsertionAnchor(t){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(!(r instanceof HTMLStyleElement))return r}return null}_parseSlots(){const t=this._slots={};let n;for(;n=this.firstChild;){const r=n.nodeType===1&&n.getAttribute("slot")||"default";(t[r]||(t[r]=[])).push(n),this.removeChild(n)}}_renderSlots(){const t=this._getSlots(),n=this._instance.type.__scopeId;for(let r=0;r<t.length;r++){const o=t[r],i=o.getAttribute("name")||"default",s=this._slots[i],a=o.parentNode;if(s)for(const l of s){if(n&&l.nodeType===1){const u=n+"-s",d=document.createTreeWalker(l,1);l.setAttribute(u,"");let f;for(;f=d.nextNode();)f.setAttribute(u,"")}a.insertBefore(l,o)}else for(;o.firstChild;)a.insertBefore(o.firstChild,o);a.removeChild(o)}}_getSlots(){const t=[this];this._teleportTargets&&t.push(...this._teleportTargets);const n=new Set;for(const r of t){const o=r.querySelectorAll("slot");for(let i=0;i<o.length;i++)n.add(o[i])}return Array.from(n)}_injectChildStyle(t,n){this._applyStyles(t.styles,t,n)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return this._def.shadowRoot!==!1}_removeChildStyle(t){}},My=new WeakMap,Ly=new WeakMap,wf=Symbol("_moveCb"),Dy=Symbol("_enterCb"),KC=e=>(delete e.props.mode,e),qC=KC({name:"TransitionGroup",props:Gn({},vy,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=pr(),r=bv();let o,i;return pf(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!q5(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(G5),o.forEach(W5);const a=o.filter(K5);uy(n.vnode.el),a.forEach(l=>{const u=l.el,d=u.style;Ps(u,s),d.transform=d.webkitTransform=d.transitionDuration="";const f=u[wf]=p=>{p&&p.target!==u||(!p||p.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",f),u[wf]=null,gl(u,s))};u.addEventListener("transitionend",f)}),o=[]}),()=>{const s=pn(e),a=vC(s);let l=s.tag||Kt;if(o=[],i)for(let u=0;u<i.length;u++){const d=i[u];d.el&&d.el instanceof Element&&(o.push(d),ba(d,fu(d,a,r,n)),My.set(d,EC(d.el)))}i=t.default?Qh(t.default()):[];for(let u=0;u<i.length;u++){const d=i[u];d.key!=null&&ba(d,fu(d,a,r,n))}return Xt(l,null,i)}}}),Ia=e=>{const t=e.props["onUpdate:modelValue"]||!1;return zt(t)?n=>ac(t,n):t},yi=Symbol("_assign"),ji={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[yi]=Ia(o);const i=r||o.props&&o.props.type==="number";_a(e,t?"change":"input",s=>{s.target.composing||e[yi](xC(e.value,n,i))}),(n||i)&&_a(e,"change",()=>{e.value=xC(e.value,n,i)}),t||(_a(e,"compositionstart",Y5),_a(e,"compositionend",TC),_a(e,"change",TC))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[yi]=Ia(s),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?jd(e.value):e.value,l=t??"";if(a===l)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},Tp={deep:!0,created(e,t,n){e[yi]=Ia(n),_a(e,"change",()=>{const r=e._modelValue,o=_u(e),i=e.checked,s=e[yi];if(zt(r)){const a=Nh(r,o),l=a!==-1;if(i&&!l)s(r.concat(o));else if(!i&&l){const u=[...r];u.splice(a,1),s(u)}}else if(il(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(LC(e,i))})},mounted:RC,beforeUpdate(e,t,n){e[yi]=Ia(n),RC(e,t,n)}},xp={created(e,{value:t},n){e.checked=da(t,n.props.value),e[yi]=Ia(n),_a(e,"change",()=>{e[yi](_u(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[yi]=Ia(r),t!==n&&(e.checked=da(t,r.props.value))}},Oy={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=il(t);_a(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?jd(_u(s)):_u(s));e[yi](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,St(()=>{e._assigning=!1})}),e[yi]=Ia(r)},mounted(e,{value:t}){MC(e,t)},beforeUpdate(e,t,n){e[yi]=Ia(n)},updated(e,{value:t}){e._assigning||MC(e,t)}},Py={created(e,t,n){Sp(e,t,n,null,"created")},mounted(e,t,n){Sp(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){Sp(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){Sp(e,t,n,r,"updated")}},YC=["ctrl","shift","alt","meta"],XC={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>YC.some(n=>e[`${n}Key`]&&!t.includes(n))},Jt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((o,...i)=>{for(let s=0;s<t.length;s++){const a=XC[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},ZC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},ii=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=Vo(o.key);if(t.some(s=>s===i||ZC[s]===i))return e(o)}))},Fy=Gn({patchProp:Ty},my),Ny=!1,By=((...e)=>{OC().render(...e)}),QC=((...e)=>{PC().hydrate(...e)}),yc=((...e)=>{const t=OC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=NC(r);if(!o)return;const i=t._component;!Zt(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,FC(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),zy=((...e)=>{const t=PC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=NC(r);if(o)return n(o,!0,FC(o))},t}),jy=!1,JC=()=>{jy||(jy=!0,X5(),L5())}})),Q5=Ld({BaseTransition:()=>Gv,BaseTransitionPropsValidators:()=>cp,Comment:()=>Rr,DeprecationTypes:()=>null,EffectScope:()=>Wh,ErrorCodes:()=>Dw,ErrorTypeStrings:()=>fC,Fragment:()=>Kt,KeepAlive:()=>qw,ReactiveEffect:()=>lu,Static:()=>hl,Suspense:()=>sC,Teleport:()=>dl,Text:()=>Sa,TrackOpTypes:()=>P1,Transition:()=>Ap,TransitionGroup:()=>qC,TriggerOpTypes:()=>F1,VueElement:()=>Ry,assertNumber:()=>ET,callWithAsyncErrorHandling:()=>zi,callWithErrorHandling:()=>du,camelize:()=>Nr,capitalize:()=>iu,cloneVNode:()=>Ms,compatUtils:()=>null,compile:()=>ek,computed:()=>ke,createApp:()=>yc,createBlock:()=>an,createCommentVNode:()=>vt,createElementBlock:()=>De,createElementVNode:()=>He,createHydrationRenderer:()=>gw,createPropsRestProxy:()=>e5,createRenderer:()=>mw,createSSRApp:()=>zy,createSlots:()=>HT,createStaticVNode:()=>C5,createTextVNode:()=>as,createVNode:()=>Xt,customRef:()=>h1,defineAsyncComponent:()=>X1,defineComponent:()=>uc,defineCustomElement:()=>AC,defineEmits:()=>WT,defineExpose:()=>KT,defineModel:()=>XT,defineOptions:()=>qT,defineProps:()=>GT,defineSSRCustomElement:()=>GC,defineSlots:()=>YT,devtools:()=>hC,effect:()=>uT,effectScope:()=>Zg,getCurrentInstance:()=>pr,getCurrentScope:()=>Qg,getCurrentWatcher:()=>kT,getTransitionRawChildren:()=>Qh,guardReactiveProps:()=>Iw,h:()=>zr,handleError:()=>cc,hasInjectionContext:()=>U1,hydrate:()=>QC,hydrateOnIdle:()=>$w,hydrateOnInteraction:()=>Kw,hydrateOnMediaQuery:()=>Ww,hydrateOnVisible:()=>Gw,initCustomFormatter:()=>A5,initDirectivesForSSR:()=>JC,inject:()=>ll,isMemoSame:()=>Lw,isProxy:()=>$d,isReactive:()=>Fi,isReadonly:()=>xs,isRef:()=>lr,isRuntimeOnly:()=>cC,isShallow:()=>ni,isVNode:()=>wa,markRaw:()=>Wr,mergeDefaults:()=>QT,mergeModels:()=>JT,mergeProps:()=>Ls,nextTick:()=>St,nodeOps:()=>my,normalizeClass:()=>en,normalizeProps:()=>Ug,normalizeStyle:()=>bn,onActivated:()=>kv,onBeforeMount:()=>qv,onBeforeUnmount:()=>cr,onBeforeUpdate:()=>up,onDeactivated:()=>Sv,onErrorCaptured:()=>Q1,onMounted:()=>Nn,onRenderTracked:()=>Zv,onRenderTriggered:()=>Xv,onScopeDispose:()=>r1,onServerPrefetch:()=>Yv,onUnmounted:()=>mf,onUpdated:()=>pf,onWatcherCleanup:()=>g1,openBlock:()=>ye,patchProp:()=>Ty,popScopeId:()=>MT,provide:()=>V1,proxyRefs:()=>iv,pushScopeId:()=>RT,queuePostFlushCb:()=>Qd,reactive:()=>no,readonly:()=>$h,ref:()=>re,registerRuntimeCompiler:()=>S5,render:()=>By,renderList:()=>ir,renderSlot:()=>pu,resolveComponent:()=>UT,resolveDirective:()=>J1,resolveDynamicComponent:()=>Av,resolveFilter:()=>null,resolveTransitionHooks:()=>fu,setBlockTracking:()=>af,setDevtoolsHook:()=>pC,setTransitionHooks:()=>ba,shallowReactive:()=>d1,shallowReadonly:()=>yT,shallowRef:()=>Br,ssrContextKey:()=>Bv,ssrUtils:()=>mC,stop:()=>dT,toDisplayString:()=>Ut,toHandlerKey:()=>su,toHandlers:()=>$T,toRaw:()=>pn,toRef:()=>sv,toRefs:()=>p1,toValue:()=>wT,transformVNodeArgs:()=>b5,triggerRef:()=>bT,unref:()=>Qe,useAttrs:()=>nw,useCssModule:()=>$5,useCssVars:()=>D5,useHost:()=>IC,useId:()=>FT,useModel:()=>a5,useSSRContext:()=>zv,useShadowRoot:()=>H5,useSlots:()=>tw,useTemplateRef:()=>NT,useTransitionState:()=>bv,vModelCheckbox:()=>Tp,vModelDynamic:()=>Py,vModelRadio:()=>xp,vModelSelect:()=>Oy,vModelText:()=>ji,vShow:()=>wy,version:()=>ly,warn:()=>dC,watch:()=>jt,watchEffect:()=>LT,watchPostEffect:()=>DT,watchSyncEffect:()=>H1,withAsyncContext:()=>t5,withCtx:()=>ao,withDefaults:()=>ZT,withDirectives:()=>ya,withKeys:()=>ii,withMemo:()=>I5,withModifiers:()=>Jt,withScopeId:()=>Pw}),ek,Ft=xr((()=>{Z5(),ek=()=>{}})),J5=z2(((e,t)=>{(function(n){typeof e=="object"&&typeof t<"u"?t.exports=n():typeof define=="function"&&define.amd?define([],n):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=n()})(function(){return(function n(r,o,i){function s(u,d){if(!o[u]){if(!r[u]){var f=typeof require=="function"&&require;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var g=o[u]={exports:{}};r[u][0].call(g.exports,function(m){var v=r[u][1][m];return s(v||m)},g,g.exports,n,r,o,i)}return o[u].exports}for(var a=typeof require=="function"&&require,l=0;l<i.length;l++)s(i[l]);return s})({1:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var u,d,f,p,g,m,v,k=[],b=0,S=l.length,C=S,w=i.getTypeOf(l)!=="string";b<l.length;)C=S-b,f=w?(u=l[b++],d=b<S?l[b++]:0,b<S?l[b++]:0):(u=l.charCodeAt(b++),d=b<S?l.charCodeAt(b++):0,b<S?l.charCodeAt(b++):0),p=u>>2,g=(3&u)<<4|d>>4,m=1<C?(15&d)<<2|f>>6:64,v=2<C?63&f:64,k.push(a.charAt(p)+a.charAt(g)+a.charAt(m)+a.charAt(v));return k.join("")},o.decode=function(l){var u,d,f,p,g,m,v=0,k=0,b="data:";if(l.substr(0,b.length)===b)throw new Error("Invalid base64 input, it looks like a data url.");var S,C=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&C--,l.charAt(l.length-2)===a.charAt(64)&&C--,C%1!=0)throw new Error("Invalid base64 input, bad content length.");for(S=s.uint8array?new Uint8Array(0|C):new Array(0|C);v<l.length;)u=a.indexOf(l.charAt(v++))<<2|(p=a.indexOf(l.charAt(v++)))>>4,d=(15&p)<<4|(g=a.indexOf(l.charAt(v++)))>>2,f=(3&g)<<6|(m=a.indexOf(l.charAt(v++))),S[k++]=u,g!==64&&(S[k++]=d),m!==64&&(S[k++]=f);return S}},{"./support":30,"./utils":32}],2:[function(n,r,o){"use strict";var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(d,f,p,g,m){this.compressedSize=d,this.uncompressedSize=f,this.crc32=p,this.compression=g,this.compressedContent=m}u.prototype={getContentWorker:function(){var d=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,p){return d.pipe(new a).pipe(new l("uncompressedSize")).pipe(f.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",f)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){"use strict";var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){"use strict";var i=n("./utils"),s=(function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l})();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?(function(u,d,f,p){var g=s,m=p+f;u^=-1;for(var v=p;v<m;v++)u=u>>>8^g[255&(u^d[v])];return-1^u})(0|l,a,a.length,0):(function(u,d,f,p){var g=s,m=p+f;u^=-1;for(var v=p;v<m;v++)u=u>>>8^g[255&(u^d.charCodeAt(v))];return-1^u})(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){"use strict";o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){"use strict";var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=i?"uint8array":"array";function d(f,p){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(d,l),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},d.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(p){f.push({data:p,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){"use strict";function i(g,m){var v,k="";for(v=0;v<m;v++)k+=String.fromCharCode(255&g),g>>>=8;return k}function s(g,m,v,k,b,S){var C,w,T=g.file,L=g.compression,z=S!==u.utf8encode,W=a.transformTo("string",S(T.name)),V=a.transformTo("string",u.utf8encode(T.name)),j=T.comment,Z=a.transformTo("string",S(j)),R=a.transformTo("string",u.utf8encode(j)),K=V.length!==T.name.length,x=R.length!==j.length,$="",H="",J="",Q=T.dir,Y=T.date,_e={crc32:0,compressedSize:0,uncompressedSize:0};m&&!v||(_e.crc32=g.crc32,_e.compressedSize=g.compressedSize,_e.uncompressedSize=g.uncompressedSize);var ue=0;m&&(ue|=8),z||!K&&!x||(ue|=2048);var ve=0,ge=0;Q&&(ve|=16),b==="UNIX"?(ge=798,ve|=(function(Ne,Je){var ct=Ne;return Ne||(ct=Je?16893:33204),(65535&ct)<<16})(T.unixPermissions,Q)):(ge=20,ve|=(function(Ne){return 63&(Ne||0)})(T.dosPermissions)),C=Y.getUTCHours(),C<<=6,C|=Y.getUTCMinutes(),C<<=5,C|=Y.getUTCSeconds()/2,w=Y.getUTCFullYear()-1980,w<<=4,w|=Y.getUTCMonth()+1,w<<=5,w|=Y.getUTCDate(),K&&(H=i(1,1)+i(d(W),4)+V,$+="up"+i(H.length,2)+H),x&&(J=i(1,1)+i(d(Z),4)+R,$+="uc"+i(J.length,2)+J);var Te="";return Te+=`
|
|
4
|
-
\0`,Te+=i(ue,2),Te+=L.magic,Te+=i(C,2),Te+=i(w,2),Te+=i(_e.crc32,4),Te+=i(_e.compressedSize,4),Te+=i(_e.uncompressedSize,4),Te+=i(W.length,2),Te+=i($.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Te+W+$,dirRecord:f.CENTRAL_FILE_HEADER+i(ge,2)+Te+i(Z.length,2)+"\0\0\0\0"+i(ve,4)+i(k,4)+W+$+Z}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(g,m,v,k){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=v,this.encodeFileName=k,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(g){var m=g.meta.percent||0,v=this.entriesCount,k=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:v?(m+100*(v-k-1))/v:100}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(k){return f.DATA_DESCRIPTOR+i(k.crc32,4)+i(k.compressedSize,4)+i(k.uncompressedSize,4)})(g),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,k=(function(b,S,C,w,T){var L=a.transformTo("string",T(w));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(b,2)+i(b,2)+i(S,4)+i(C,4)+i(L.length,2)+L})(this.dirRecords.length,v,g,this.zipComment,this.encodeFileName);this.push({data:k,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var d=new s(l.streamFiles,u,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var m=(function(S,C){var w=S||C,T=i[w];if(!T)throw new Error(w+" is not a valid compression method !");return T})(g.options.compression,l.compression),v=g.options.compressionOptions||l.compressionOptions||{},k=g.dir,b=g.date;g._compressWorker(m,v).withStreamInfo("file",{name:p,dir:k,date:b,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,m){var v=p.decompressed.getContentWorker().pipe(new u);v.on("error",function(k){m(k)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(v){var k=new l(g);return k.load(v),k}).then(function(v){var k=[s.Promise.resolve(v)],b=v.files;if(g.checkCRC32)for(var S=0;S<b.length;S++)k.push(f(b[S]));return s.Promise.all(k)}).then(function(v){for(var k=v.shift(),b=k.files,S=0;S<b.length;S++){var C=b[S],w=C.fileNameStr,T=i.resolve(C.fileNameStr);m.file(T,C.decompressed,{binary:!0,optimizedBinaryString:!0,date:C.date,dir:C.dir,comment:C.fileCommentStr.length?C.fileCommentStr:null,unixPermissions:C.unixPermissions,dosPermissions:C.dosPermissions,createFolders:g.createFolders}),C.dir||(m.file(T).unsafeOriginalName=w)}return k.zipComment.length&&(m.comment=k.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,p){d.push(f)||d._helper.pause(),u&&u(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(w,T,L){var z,W=a.getTypeOf(T),V=a.extend(L||{},d);V.date=V.date||new Date,V.compression!==null&&(V.compression=V.compression.toUpperCase()),typeof V.unixPermissions=="string"&&(V.unixPermissions=parseInt(V.unixPermissions,8)),V.unixPermissions&&16384&V.unixPermissions&&(V.dir=!0),V.dosPermissions&&16&V.dosPermissions&&(V.dir=!0),V.dir&&(w=b(w)),V.createFolders&&(z=k(w))&&S.call(this,z,!0);var j=W==="string"&&V.binary===!1&&V.base64===!1;L&&L.binary!==void 0||(V.binary=!j),(T instanceof f&&T.uncompressedSize===0||V.dir||!T||T.length===0)&&(V.base64=!1,V.binary=!0,T="",V.compression="STORE",W="string");var Z=null;Z=T instanceof f||T instanceof l?T:m.isNode&&m.isStream(T)?new v(w,T):a.prepareContent(w,T,V.binary,V.optimizedBinaryString,V.base64);var R=new p(w,Z,V);this.files[w]=R}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),k=function(w){w.slice(-1)==="/"&&(w=w.substring(0,w.length-1));var T=w.lastIndexOf("/");return 0<T?w.substring(0,T):""},b=function(w){return w.slice(-1)!=="/"&&(w+="/"),w},S=function(w,T){return T=T!==void 0?T:d.createFolders,w=b(w),this.files[w]||i.call(this,w,null,{dir:!0,createFolders:T}),this.files[w]};function C(w){return Object.prototype.toString.call(w)==="[object RegExp]"}r.exports={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(w){var T,L,z;for(T in this.files)z=this.files[T],(L=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&w(L,z)},filter:function(w){var T=[];return this.forEach(function(L,z){w(L,z)&&T.push(z)}),T},file:function(w,T,L){if(arguments.length!==1)return w=this.root+w,i.call(this,w,T,L),this;if(C(w)){var z=w;return this.filter(function(V,j){return!j.dir&&z.test(V)})}var W=this.files[this.root+w];return W&&!W.dir?W:null},folder:function(w){if(!w)return this;if(C(w))return this.filter(function(W,V){return V.dir&&w.test(W)});var T=this.root+w,L=S.call(this,T),z=this.clone();return z.root=L.name,z},remove:function(w){w=this.root+w;var T=this.files[w];if(T||(w.slice(-1)!=="/"&&(w+="/"),T=this.files[w]),T&&!T.dir)delete this.files[w];else for(var L=this.filter(function(W,V){return V.name.slice(0,w.length)===w}),z=0;z<L.length;z++)delete this.files[L[z].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(w){var T,L={};try{if((L=a.extend(w||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=L.type.toLowerCase(),L.compression=L.compression.toUpperCase(),L.type==="binarystring"&&(L.type="string"),!L.type)throw new Error("No output type specified.");a.checkSupport(L.type),L.platform!=="darwin"&&L.platform!=="freebsd"&&L.platform!=="linux"&&L.platform!=="sunos"||(L.platform="UNIX"),L.platform==="win32"&&(L.platform="DOS");var z=L.comment||this.comment||"";T=g.generateWorker(this,L,z)}catch(W){(T=new l("error")).error(W)}return new u(T,L.type||"string",L.mimeType)},generateAsync:function(w,T){return this.generateInternalStream(w).accumulate(T)},generateNodeStream:function(w,T){return(w=w||{}).type||(w.type="nodebuffer"),this.generateInternalStream(w).toNodejsStream(T)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){"use strict";r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(f):s.uint8array?new d(i.transformTo("uint8array",f)):new a(i.transformTo("array",f)):new l(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(m,v){return new d.Promise(function(k,b){var S=[],C=m._internalType,w=m._outputType,T=m._mimeType;m.on("data",function(L,z){S.push(L),v&&v(z)}).on("error",function(L){S=[],b(L)}).on("end",function(){try{k((function(L,z,W){switch(L){case"blob":return i.newBlob(i.transformTo("arraybuffer",z),W);case"base64":return l.encode(z);default:return i.transformTo(L,z)}})(w,(function(L,z){var W,V=0,j=null,Z=0;for(W=0;W<z.length;W++)Z+=z[W].length;switch(L){case"string":return z.join("");case"array":return Array.prototype.concat.apply([],z);case"uint8array":for(j=new Uint8Array(Z),W=0;W<z.length;W++)j.set(z[W],V),V+=z[W].length;return j;case"nodebuffer":return Buffer.concat(z);default:throw new Error("concat : unsupported type '"+L+"'")}})(C,S),T))}catch(L){b(L)}S=[]}).resume()})}function g(m,v,k){var b=v;switch(v){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=v,this._mimeType=k,i.checkSupport(b),this._worker=m.pipe(new s(b)),m.lock()}catch(S){this._worker=new a("error"),this._worker.error(S)}}g.prototype={accumulate:function(m){return p(this,m)},on:function(m,v){var k=this;return m==="data"?this._worker.on(m,function(b){v.call(k,b.data,b.meta)}):this._worker.on(m,function(){i.delay(v,arguments,k)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},m)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,k,b,S,C,w=m.length,T=0;for(S=0;S<w;S++)(64512&(k=m.charCodeAt(S)))==55296&&S+1<w&&(64512&(b=m.charCodeAt(S+1)))==56320&&(k=65536+(k-55296<<10)+(b-56320),S++),T+=k<128?1:k<2048?2:k<65536?3:4;for(v=s.uint8array?new Uint8Array(T):new Array(T),S=C=0;C<T;S++)(64512&(k=m.charCodeAt(S)))==55296&&S+1<w&&(64512&(b=m.charCodeAt(S+1)))==56320&&(k=65536+(k-55296<<10)+(b-56320),S++),k<128?v[C++]=k:(k<2048?v[C++]=192|k>>>6:(k<65536?v[C++]=224|k>>>12:(v[C++]=240|k>>>18,v[C++]=128|k>>>12&63),v[C++]=128|k>>>6&63),v[C++]=128|63&k);return v})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(m){var v,k,b,S,C=m.length,w=new Array(2*C);for(v=k=0;v<C;)if((b=m[v++])<128)w[k++]=b;else if(4<(S=u[b]))w[k++]=65533,v+=S-1;else{for(b&=S===2?31:S===3?15:7;1<S&&v<C;)b=b<<6|63&m[v++],S--;1<S?w[k++]=65533:b<65536?w[k++]=b:(b-=65536,w[k++]=55296|b>>10&1023,w[k++]=56320|1023&b)}return w.length!==k&&(w.subarray?w=w.subarray(0,k):w.length=k),i.applyFromCharCode(w)})(g=i.transformTo(s.uint8array?"uint8array":"array",g))},i.inherits(f,l),f.prototype.processChunk=function(g){var m=i.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=m;(m=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),m.set(v,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var k=(function(S,C){var w;for((C=C||S.length)>S.length&&(C=S.length),w=C-1;0<=w&&(192&S[w])==128;)w--;return w<0||w===0?C:w+u[S[w]]>C?w:C})(m),b=m;k!==m.length&&(s.uint8array?(b=m.subarray(0,k),this.leftOver=m.subarray(k,m.length)):(b=m.slice(0,k),this.leftOver=m.slice(k,m.length))),this.push({data:o.utf8decode(b),meta:g.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(v){return v}function d(v,k){for(var b=0;b<v.length;++b)k[b]=255&v.charCodeAt(b);return k}n("setimmediate"),o.newBlob=function(v,k){o.checkSupport("blob");try{return new Blob([v],{type:k})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(v),b.getBlob(k)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(v,k,b){var S=[],C=0,w=v.length;if(w<=b)return String.fromCharCode.apply(null,v);for(;C<w;)k==="array"||k==="nodebuffer"?S.push(String.fromCharCode.apply(null,v.slice(C,Math.min(C+b,w)))):S.push(String.fromCharCode.apply(null,v.subarray(C,Math.min(C+b,w)))),C+=b;return S.join("")},stringifyByChar:function(v){for(var k="",b=0;b<v.length;b++)k+=String.fromCharCode(v[b]);return k},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}})()}};function p(v){var k=65536,b=o.getTypeOf(v),S=!0;if(b==="uint8array"?S=f.applyCanBeUsed.uint8array:b==="nodebuffer"&&(S=f.applyCanBeUsed.nodebuffer),S)for(;1<k;)try{return f.stringifyByChunk(v,b,k)}catch{k=Math.floor(k/2)}return f.stringifyByChar(v)}function g(v,k){for(var b=0;b<v.length;b++)k[b]=v[b];return k}o.applyFromCharCode=p;var m={};m.string={string:u,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return m.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},m.array={string:p,array:u,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(v)}},m.arraybuffer={string:function(v){return p(new Uint8Array(v))},array:function(v){return g(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:u,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(new Uint8Array(v))}},m.uint8array={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return a.newBufferFrom(v)}},m.nodebuffer={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer:u},o.transformTo=function(v,k){return k=k||"",v?(o.checkSupport(v),m[o.getTypeOf(k)][v](k)):k},o.resolve=function(v){for(var k=v.split("/"),b=[],S=0;S<k.length;S++){var C=k[S];C==="."||C===""&&S!==0&&S!==k.length-1||(C===".."?b.pop():b.push(C))}return b.join("/")},o.getTypeOf=function(v){return typeof v=="string"?"string":Object.prototype.toString.call(v)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(v)?"nodebuffer":i.uint8array&&v instanceof Uint8Array?"uint8array":i.arraybuffer&&v instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(v){if(!i[v.toLowerCase()])throw new Error(v+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(v){var k,b,S="";for(b=0;b<(v||"").length;b++)S+="\\x"+((k=v.charCodeAt(b))<16?"0":"")+k.toString(16).toUpperCase();return S},o.delay=function(v,k,b){setImmediate(function(){v.apply(b||null,k||[])})},o.inherits=function(v,k){function b(){}b.prototype=k.prototype,v.prototype=new b},o.extend=function(){var v,k,b={};for(v=0;v<arguments.length;v++)for(k in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],k)&&b[k]===void 0&&(b[k]=arguments[v][k]);return b},o.prepareContent=function(v,k,b,S,C){return l.Promise.resolve(k).then(function(w){return i.blob&&(w instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(w))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,L){var z=new FileReader;z.onload=function(W){T(W.target.result)},z.onerror=function(W){L(W.target.error)},z.readAsArrayBuffer(w)}):w}).then(function(w){var T=o.getTypeOf(w);return T?(T==="arraybuffer"?w=o.transformTo("uint8array",w):T==="string"&&(C?w=s.decode(w):b&&S!==!0&&(w=(function(L){return d(L,i.uint8array?new Uint8Array(L.length):new Array(L.length))})(w))),w):l.Promise.reject(new Error("Can't read the data of '"+v+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===p;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=p-g;if(0<m)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,m){this.options=g,this.loadOptions=m}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(k){for(var b in d)if(Object.prototype.hasOwnProperty.call(d,b)&&d[b].magic===k)return d[b];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,m,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var m=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(m),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var m,v,k,b=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<b;)m=g.readInt(2),v=g.readInt(2),k=g.readData(v),this.extraFields[m]={id:m,length:v,value:k};g.setIndex(b)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var v=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var k=this.findExtraFieldUnicodeComment();if(k!==null)this.fileCommentStr=k;else{var b=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,k){this.name=m,this.dir=k.dir,this.date=k.date,this.comment=k.comment,this.unixPermissions=k.unixPermissions,this.dosPermissions=k.dosPermissions,this._data=v,this._dataBinary=k.binary,this.options={compression:k.compression,compressionOptions:k.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(m){var v=null,k="string";try{if(!m)throw new Error("No output type specified.");var b=(k=m.toLowerCase())==="string"||k==="text";k!=="binarystring"&&k!=="text"||(k="string"),v=this._decompressWorker();var S=!this._dataBinary;S&&!b&&(v=v.pipe(new l.Utf8EncodeWorker)),!S&&b&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(C){(v=new d("error")).error(C)}return new s(v,k,"")},async:function(m,v){return this.internalStream(m).accumulate(v)},nodeStream:function(m,v){return this.internalStream(m||"nodebuffer").toNodejsStream(v)},_compressWorker:function(m,v){if(this._data instanceof u&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var k=this._decompressWorker();return this._dataBinary||(k=k.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(k,m,v)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,d=new l(m),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(m,0)};else{var p=new i.MessageChannel;p.port1.onmessage=m,s=function(){p.port2.postMessage(0)}}var g=[];function m(){var v,k;a=!0;for(var b=g.length;b;){for(k=g,g=[],v=-1;++v<b;)k[v]();b=g.length}a=!1}r.exports=function(v){g.push(v)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(b){if(typeof b!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,b!==s&&v(this,b)}function p(b,S,C){this.promise=b,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof C=="function"&&(this.onRejected=C,this.callRejected=this.otherCallRejected)}function g(b,S,C){i(function(){var w;try{w=S(C)}catch(T){return a.reject(b,T)}w===b?a.reject(b,new TypeError("Cannot resolve promise with itself")):a.resolve(b,w)})}function m(b){var S=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof S=="function")return function(){S.apply(b,arguments)}}function v(b,S){var C=!1;function w(z){C||(C=!0,a.reject(b,z))}function T(z){C||(C=!0,a.resolve(b,z))}var L=k(function(){S(T,w)});L.status==="error"&&w(L.value)}function k(b,S){var C={};try{C.value=b(S),C.status="success"}catch(w){C.status="error",C.value=w}return C}(r.exports=f).prototype.finally=function(b){if(typeof b!="function")return this;var S=this.constructor;return this.then(function(C){return S.resolve(b()).then(function(){return C})},function(C){return S.resolve(b()).then(function(){throw C})})},f.prototype.catch=function(b){return this.then(null,b)},f.prototype.then=function(b,S){if(typeof b!="function"&&this.state===u||typeof S!="function"&&this.state===l)return this;var C=new this.constructor(s);return this.state!==d?g(C,this.state===u?b:S,this.outcome):this.queue.push(new p(C,b,S)),C},p.prototype.callFulfilled=function(b){a.resolve(this.promise,b)},p.prototype.otherCallFulfilled=function(b){g(this.promise,this.onFulfilled,b)},p.prototype.callRejected=function(b){a.reject(this.promise,b)},p.prototype.otherCallRejected=function(b){g(this.promise,this.onRejected,b)},a.resolve=function(b,S){var C=k(m,S);if(C.status==="error")return a.reject(b,C.value);var w=C.value;if(w)v(b,w);else{b.state=u,b.outcome=S;for(var T=-1,L=b.queue.length;++T<L;)b.queue[T].callFulfilled(S)}return b},a.reject=function(b,S){b.state=l,b.outcome=S;for(var C=-1,w=b.queue.length;++C<w;)b.queue[C].callRejected(S);return b},f.resolve=function(b){return b instanceof this?b:a.resolve(new this(s),b)},f.reject=function(b){var S=new this(s);return a.reject(S,b)},f.all=function(b){var S=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=b.length,w=!1;if(!C)return this.resolve([]);for(var T=new Array(C),L=0,z=-1,W=new this(s);++z<C;)V(b[z],z);return W;function V(j,Z){S.resolve(j).then(function(R){T[Z]=R,++L!==C||w||(w=!0,a.resolve(W,T))},function(R){w||(w=!0,a.reject(W,R))})}},f.race=function(b){var S=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=b.length,w=!1;if(!C)return this.resolve([]);for(var T=-1,L=new this(s);++T<C;)z=b[T],S.resolve(z).then(function(W){w||(w=!0,a.resolve(L,W))},function(W){w||(w=!0,a.reject(L,W))});var z;return L}},{immediate:36}],38:[function(n,r,o){"use strict";var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){"use strict";var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,p=-1,g=0,m=8;function v(b){if(!(this instanceof v))return new v(b);this.options=s.assign({level:p,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},b||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var C=i.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(C!==f)throw new Error(l[C]);if(S.header&&i.deflateSetHeader(this.strm,S.header),S.dictionary){var w;if(w=typeof S.dictionary=="string"?a.string2buf(S.dictionary):d.call(S.dictionary)==="[object ArrayBuffer]"?new Uint8Array(S.dictionary):S.dictionary,(C=i.deflateSetDictionary(this.strm,w))!==f)throw new Error(l[C]);this._dict_set=!0}}function k(b,S){var C=new v(S);if(C.push(b,!0),C.err)throw C.msg||l[C.err];return C.result}v.prototype.push=function(b,S){var C,w,T=this.strm,L=this.options.chunkSize;if(this.ended)return!1;w=S===~~S?S:S===!0?4:0,typeof b=="string"?T.input=a.string2buf(b):d.call(b)==="[object ArrayBuffer]"?T.input=new Uint8Array(b):T.input=b,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new s.Buf8(L),T.next_out=0,T.avail_out=L),(C=i.deflate(T,w))!==1&&C!==f)return this.onEnd(C),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||w!==4&&w!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(T.output,T.next_out))):this.onData(s.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&C!==1);return w===4?(C=i.deflateEnd(this.strm),this.onEnd(C),this.ended=!0,C===f):w!==2||(this.onEnd(f),!(T.avail_out=0))},v.prototype.onData=function(b){this.chunks.push(b)},v.prototype.onEnd=function(b){b===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},o.Deflate=v,o.deflate=k,o.deflateRaw=function(b,S){return(S=S||{}).raw=!0,k(b,S)},o.gzip=function(b,S){return(S=S||{}).gzip=!0,k(b,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),p=Object.prototype.toString;function g(v){if(!(this instanceof g))return new g(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var k=this.options;k.raw&&0<=k.windowBits&&k.windowBits<16&&(k.windowBits=-k.windowBits,k.windowBits===0&&(k.windowBits=-15)),!(0<=k.windowBits&&k.windowBits<16)||v&&v.windowBits||(k.windowBits+=32),15<k.windowBits&&k.windowBits<48&&(15&k.windowBits)==0&&(k.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var b=i.inflateInit2(this.strm,k.windowBits);if(b!==l.Z_OK)throw new Error(u[b]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function m(v,k){var b=new g(k);if(b.push(v,!0),b.err)throw b.msg||u[b.err];return b.result}g.prototype.push=function(v,k){var b,S,C,w,T,L,z=this.strm,W=this.options.chunkSize,V=this.options.dictionary,j=!1;if(this.ended)return!1;S=k===~~k?k:k===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?z.input=a.binstring2buf(v):p.call(v)==="[object ArrayBuffer]"?z.input=new Uint8Array(v):z.input=v,z.next_in=0,z.avail_in=z.input.length;do{if(z.avail_out===0&&(z.output=new s.Buf8(W),z.next_out=0,z.avail_out=W),(b=i.inflate(z,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&V&&(L=typeof V=="string"?a.string2buf(V):p.call(V)==="[object ArrayBuffer]"?new Uint8Array(V):V,b=i.inflateSetDictionary(this.strm,L)),b===l.Z_BUF_ERROR&&j===!0&&(b=l.Z_OK,j=!1),b!==l.Z_STREAM_END&&b!==l.Z_OK)return this.onEnd(b),!(this.ended=!0);z.next_out&&(z.avail_out!==0&&b!==l.Z_STREAM_END&&(z.avail_in!==0||S!==l.Z_FINISH&&S!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(C=a.utf8border(z.output,z.next_out),w=z.next_out-C,T=a.buf2string(z.output,C),z.next_out=w,z.avail_out=W-w,w&&s.arraySet(z.output,z.output,C,w,0),this.onData(T)):this.onData(s.shrinkBuf(z.output,z.next_out)))),z.avail_in===0&&z.avail_out===0&&(j=!0)}while((0<z.avail_in||z.avail_out===0)&&b!==l.Z_STREAM_END);return b===l.Z_STREAM_END&&(S=l.Z_FINISH),S===l.Z_FINISH?(b=i.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===l.Z_OK):S!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(z.avail_out=0))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Inflate=g,o.inflate=m,o.inflateRaw=function(v,k){return(k=k||{}).raw=!0,m(v,k)},o.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(l[f]=d[f])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,d,f,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){var u,d,f,p,g,m;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(m=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)g=l[u],m.set(g,p),p+=g.length;return m}},a={arraySet:function(l,u,d,f,p){for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",m=0;m<p;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,m,v,k,b=f.length,S=0;for(v=0;v<b;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<b&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),S+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(S),v=k=0;k<S;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<b&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),g<128?p[k++]=g:(g<2048?p[k++]=192|g>>>6:(g<65536?p[k++]=224|g>>>12:(p[k++]=240|g>>>18,p[k++]=128|g>>>12&63),p[k++]=128|g>>>6&63),p[k++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,m=p.length;g<m;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,m,v,k,b=p||f.length,S=new Array(2*b);for(g=m=0;g<b;)if((v=f[g++])<128)S[m++]=v;else if(4<(k=l[v]))S[m++]=65533,g+=k-1;else{for(v&=k===2?31:k===3?15:7;1<k&&g<b;)v=v<<6|63&f[g++],k--;1<k?S[m++]=65533:v<65536?S[m++]=v:(v-=65536,S[m++]=55296|v>>10&1023,S[m++]=56320|1023&v)}return d(S,m)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var d=i,f=u+l;s^=-1;for(var p=u;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,m=-2,v=-1,k=4,b=2,S=8,C=9,w=286,T=30,L=19,z=2*w+1,W=15,V=3,j=258,Z=j+V+1,R=42,K=113,x=1,$=2,H=3,J=4;function Q(I,se){return I.msg=d[se],se}function Y(I){return(I<<1)-(4<I?9:0)}function _e(I){for(var se=I.length;0<=--se;)I[se]=0}function ue(I){var se=I.state,F=se.pending;F>I.avail_out&&(F=I.avail_out),F!==0&&(s.arraySet(I.output,se.pending_buf,se.pending_out,F,I.next_out),I.next_out+=F,se.pending_out+=F,I.total_out+=F,I.avail_out-=F,se.pending-=F,se.pending===0&&(se.pending_out=0))}function ve(I,se){a._tr_flush_block(I,0<=I.block_start?I.block_start:-1,I.strstart-I.block_start,se),I.block_start=I.strstart,ue(I.strm)}function ge(I,se){I.pending_buf[I.pending++]=se}function Te(I,se){I.pending_buf[I.pending++]=se>>>8&255,I.pending_buf[I.pending++]=255&se}function Ne(I,se){var F,q,P=I.max_chain_length,ee=I.strstart,be=I.prev_length,N=I.nice_match,B=I.strstart>I.w_size-Z?I.strstart-(I.w_size-Z):0,de=I.window,Se=I.w_mask,Ae=I.prev,Le=I.strstart+j,Xe=de[ee+be-1],it=de[ee+be];I.prev_length>=I.good_match&&(P>>=2),N>I.lookahead&&(N=I.lookahead);do if(de[(F=se)+be]===it&&de[F+be-1]===Xe&&de[F]===de[ee]&&de[++F]===de[ee+1]){ee+=2,F++;do;while(de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&ee<Le);if(q=j-(Le-ee),ee=Le-j,be<q){if(I.match_start=se,N<=(be=q))break;Xe=de[ee+be-1],it=de[ee+be]}}while((se=Ae[se&Se])>B&&--P!=0);return be<=I.lookahead?be:I.lookahead}function Je(I){var se,F,q,P,ee,be,N,B,de,Se,Ae=I.w_size;do{if(P=I.window_size-I.lookahead-I.strstart,I.strstart>=Ae+(Ae-Z)){for(s.arraySet(I.window,I.window,Ae,Ae,0),I.match_start-=Ae,I.strstart-=Ae,I.block_start-=Ae,se=F=I.hash_size;q=I.head[--se],I.head[se]=Ae<=q?q-Ae:0,--F;);for(se=F=Ae;q=I.prev[--se],I.prev[se]=Ae<=q?q-Ae:0,--F;);P+=Ae}if(I.strm.avail_in===0)break;if(be=I.strm,N=I.window,B=I.strstart+I.lookahead,de=P,Se=void 0,Se=be.avail_in,de<Se&&(Se=de),F=Se===0?0:(be.avail_in-=Se,s.arraySet(N,be.input,be.next_in,Se,B),be.state.wrap===1?be.adler=l(be.adler,N,Se,B):be.state.wrap===2&&(be.adler=u(be.adler,N,Se,B)),be.next_in+=Se,be.total_in+=Se,Se),I.lookahead+=F,I.lookahead+I.insert>=V)for(ee=I.strstart-I.insert,I.ins_h=I.window[ee],I.ins_h=(I.ins_h<<I.hash_shift^I.window[ee+1])&I.hash_mask;I.insert&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[ee+V-1])&I.hash_mask,I.prev[ee&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=ee,ee++,I.insert--,!(I.lookahead+I.insert<V)););}while(I.lookahead<Z&&I.strm.avail_in!==0)}function ct(I,se){for(var F,q;;){if(I.lookahead<Z){if(Je(I),I.lookahead<Z&&se===f)return x;if(I.lookahead===0)break}if(F=0,I.lookahead>=V&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+V-1])&I.hash_mask,F=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),F!==0&&I.strstart-F<=I.w_size-Z&&(I.match_length=Ne(I,F)),I.match_length>=V)if(q=a._tr_tally(I,I.strstart-I.match_start,I.match_length-V),I.lookahead-=I.match_length,I.match_length<=I.max_lazy_match&&I.lookahead>=V){for(I.match_length--;I.strstart++,I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+V-1])&I.hash_mask,F=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart,--I.match_length!=0;);I.strstart++}else I.strstart+=I.match_length,I.match_length=0,I.ins_h=I.window[I.strstart],I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+1])&I.hash_mask;else q=a._tr_tally(I,0,I.window[I.strstart]),I.lookahead--,I.strstart++;if(q&&(ve(I,!1),I.strm.avail_out===0))return x}return I.insert=I.strstart<V-1?I.strstart:V-1,se===p?(ve(I,!0),I.strm.avail_out===0?H:J):I.last_lit&&(ve(I,!1),I.strm.avail_out===0)?x:$}function tt(I,se){for(var F,q,P;;){if(I.lookahead<Z){if(Je(I),I.lookahead<Z&&se===f)return x;if(I.lookahead===0)break}if(F=0,I.lookahead>=V&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+V-1])&I.hash_mask,F=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),I.prev_length=I.match_length,I.prev_match=I.match_start,I.match_length=V-1,F!==0&&I.prev_length<I.max_lazy_match&&I.strstart-F<=I.w_size-Z&&(I.match_length=Ne(I,F),I.match_length<=5&&(I.strategy===1||I.match_length===V&&4096<I.strstart-I.match_start)&&(I.match_length=V-1)),I.prev_length>=V&&I.match_length<=I.prev_length){for(P=I.strstart+I.lookahead-V,q=a._tr_tally(I,I.strstart-1-I.prev_match,I.prev_length-V),I.lookahead-=I.prev_length-1,I.prev_length-=2;++I.strstart<=P&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+V-1])&I.hash_mask,F=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),--I.prev_length!=0;);if(I.match_available=0,I.match_length=V-1,I.strstart++,q&&(ve(I,!1),I.strm.avail_out===0))return x}else if(I.match_available){if((q=a._tr_tally(I,0,I.window[I.strstart-1]))&&ve(I,!1),I.strstart++,I.lookahead--,I.strm.avail_out===0)return x}else I.match_available=1,I.strstart++,I.lookahead--}return I.match_available&&(q=a._tr_tally(I,0,I.window[I.strstart-1]),I.match_available=0),I.insert=I.strstart<V-1?I.strstart:V-1,se===p?(ve(I,!0),I.strm.avail_out===0?H:J):I.last_lit&&(ve(I,!1),I.strm.avail_out===0)?x:$}function Tt(I,se,F,q,P){this.good_length=I,this.max_lazy=se,this.nice_length=F,this.max_chain=q,this.func=P}function ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*z),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*L+1)),_e(this.dyn_ltree),_e(this.dyn_dtree),_e(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(W+1),this.heap=new s.Buf16(2*w+1),_e(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*w+1),_e(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ee(I){var se;return I&&I.state?(I.total_in=I.total_out=0,I.data_type=b,(se=I.state).pending=0,se.pending_out=0,se.wrap<0&&(se.wrap=-se.wrap),se.status=se.wrap?R:K,I.adler=se.wrap===2?0:1,se.last_flush=f,a._tr_init(se),g):Q(I,m)}function Ue(I){var se=Ee(I);return se===g&&(function(F){F.window_size=2*F.w_size,_e(F.head),F.max_lazy_match=i[F.level].max_lazy,F.good_match=i[F.level].good_length,F.nice_match=i[F.level].nice_length,F.max_chain_length=i[F.level].max_chain,F.strstart=0,F.block_start=0,F.lookahead=0,F.insert=0,F.match_length=F.prev_length=V-1,F.match_available=0,F.ins_h=0})(I.state),se}function ie(I,se,F,q,P,ee){if(!I)return m;var be=1;if(se===v&&(se=6),q<0?(be=0,q=-q):15<q&&(be=2,q-=16),P<1||C<P||F!==S||q<8||15<q||se<0||9<se||ee<0||k<ee)return Q(I,m);q===8&&(q=9);var N=new ae;return(I.state=N).strm=I,N.wrap=be,N.gzhead=null,N.w_bits=q,N.w_size=1<<N.w_bits,N.w_mask=N.w_size-1,N.hash_bits=P+7,N.hash_size=1<<N.hash_bits,N.hash_mask=N.hash_size-1,N.hash_shift=~~((N.hash_bits+V-1)/V),N.window=new s.Buf8(2*N.w_size),N.head=new s.Buf16(N.hash_size),N.prev=new s.Buf16(N.w_size),N.lit_bufsize=1<<P+6,N.pending_buf_size=4*N.lit_bufsize,N.pending_buf=new s.Buf8(N.pending_buf_size),N.d_buf=1*N.lit_bufsize,N.l_buf=3*N.lit_bufsize,N.level=se,N.strategy=ee,N.method=F,Ue(I)}i=[new Tt(0,0,0,0,function(I,se){var F=65535;for(F>I.pending_buf_size-5&&(F=I.pending_buf_size-5);;){if(I.lookahead<=1){if(Je(I),I.lookahead===0&&se===f)return x;if(I.lookahead===0)break}I.strstart+=I.lookahead,I.lookahead=0;var q=I.block_start+F;if((I.strstart===0||I.strstart>=q)&&(I.lookahead=I.strstart-q,I.strstart=q,ve(I,!1),I.strm.avail_out===0)||I.strstart-I.block_start>=I.w_size-Z&&(ve(I,!1),I.strm.avail_out===0))return x}return I.insert=0,se===p?(ve(I,!0),I.strm.avail_out===0?H:J):(I.strstart>I.block_start&&(ve(I,!1),I.strm.avail_out),x)}),new Tt(4,4,8,4,ct),new Tt(4,5,16,8,ct),new Tt(4,6,32,32,ct),new Tt(4,4,16,16,tt),new Tt(8,16,32,32,tt),new Tt(8,16,128,128,tt),new Tt(8,32,128,256,tt),new Tt(32,128,258,1024,tt),new Tt(32,258,258,4096,tt)],o.deflateInit=function(I,se){return ie(I,se,S,15,8,0)},o.deflateInit2=ie,o.deflateReset=Ue,o.deflateResetKeep=Ee,o.deflateSetHeader=function(I,se){return I&&I.state?I.state.wrap!==2?m:(I.state.gzhead=se,g):m},o.deflate=function(I,se){var F,q,P,ee;if(!I||!I.state||5<se||se<0)return I?Q(I,m):m;if(q=I.state,!I.output||!I.input&&I.avail_in!==0||q.status===666&&se!==p)return Q(I,I.avail_out===0?-5:m);if(q.strm=I,F=q.last_flush,q.last_flush=se,q.status===R)if(q.wrap===2)I.adler=0,ge(q,31),ge(q,139),ge(q,8),q.gzhead?(ge(q,(q.gzhead.text?1:0)+(q.gzhead.hcrc?2:0)+(q.gzhead.extra?4:0)+(q.gzhead.name?8:0)+(q.gzhead.comment?16:0)),ge(q,255&q.gzhead.time),ge(q,q.gzhead.time>>8&255),ge(q,q.gzhead.time>>16&255),ge(q,q.gzhead.time>>24&255),ge(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),ge(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(ge(q,255&q.gzhead.extra.length),ge(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(I.adler=u(I.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(ge(q,0),ge(q,0),ge(q,0),ge(q,0),ge(q,0),ge(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),ge(q,3),q.status=K);else{var be=S+(q.w_bits-8<<4)<<8;be|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(be|=32),be+=31-be%31,q.status=K,Te(q,be),q.strstart!==0&&(Te(q,I.adler>>>16),Te(q,65535&I.adler)),I.adler=1}if(q.status===69)if(q.gzhead.extra){for(P=q.pending;q.gzindex<(65535&q.gzhead.extra.length)&&(q.pending!==q.pending_buf_size||(q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),ue(I),P=q.pending,q.pending!==q.pending_buf_size));)ge(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),q.gzindex===q.gzhead.extra.length&&(q.gzindex=0,q.status=73)}else q.status=73;if(q.status===73)if(q.gzhead.name){P=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),ue(I),P=q.pending,q.pending===q.pending_buf_size)){ee=1;break}ee=q.gzindex<q.gzhead.name.length?255&q.gzhead.name.charCodeAt(q.gzindex++):0,ge(q,ee)}while(ee!==0);q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),ee===0&&(q.gzindex=0,q.status=91)}else q.status=91;if(q.status===91)if(q.gzhead.comment){P=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),ue(I),P=q.pending,q.pending===q.pending_buf_size)){ee=1;break}ee=q.gzindex<q.gzhead.comment.length?255&q.gzhead.comment.charCodeAt(q.gzindex++):0,ge(q,ee)}while(ee!==0);q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),ee===0&&(q.status=103)}else q.status=103;if(q.status===103&&(q.gzhead.hcrc?(q.pending+2>q.pending_buf_size&&ue(I),q.pending+2<=q.pending_buf_size&&(ge(q,255&I.adler),ge(q,I.adler>>8&255),I.adler=0,q.status=K)):q.status=K),q.pending!==0){if(ue(I),I.avail_out===0)return q.last_flush=-1,g}else if(I.avail_in===0&&Y(se)<=Y(F)&&se!==p)return Q(I,-5);if(q.status===666&&I.avail_in!==0)return Q(I,-5);if(I.avail_in!==0||q.lookahead!==0||se!==f&&q.status!==666){var N=q.strategy===2?(function(B,de){for(var Se;;){if(B.lookahead===0&&(Je(B),B.lookahead===0)){if(de===f)return x;break}if(B.match_length=0,Se=a._tr_tally(B,0,B.window[B.strstart]),B.lookahead--,B.strstart++,Se&&(ve(B,!1),B.strm.avail_out===0))return x}return B.insert=0,de===p?(ve(B,!0),B.strm.avail_out===0?H:J):B.last_lit&&(ve(B,!1),B.strm.avail_out===0)?x:$})(q,se):q.strategy===3?(function(B,de){for(var Se,Ae,Le,Xe,it=B.window;;){if(B.lookahead<=j){if(Je(B),B.lookahead<=j&&de===f)return x;if(B.lookahead===0)break}if(B.match_length=0,B.lookahead>=V&&0<B.strstart&&(Ae=it[Le=B.strstart-1])===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]){Xe=B.strstart+j;do;while(Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Le<Xe);B.match_length=j-(Xe-Le),B.match_length>B.lookahead&&(B.match_length=B.lookahead)}if(B.match_length>=V?(Se=a._tr_tally(B,1,B.match_length-V),B.lookahead-=B.match_length,B.strstart+=B.match_length,B.match_length=0):(Se=a._tr_tally(B,0,B.window[B.strstart]),B.lookahead--,B.strstart++),Se&&(ve(B,!1),B.strm.avail_out===0))return x}return B.insert=0,de===p?(ve(B,!0),B.strm.avail_out===0?H:J):B.last_lit&&(ve(B,!1),B.strm.avail_out===0)?x:$})(q,se):i[q.level].func(q,se);if(N!==H&&N!==J||(q.status=666),N===x||N===H)return I.avail_out===0&&(q.last_flush=-1),g;if(N===$&&(se===1?a._tr_align(q):se!==5&&(a._tr_stored_block(q,0,0,!1),se===3&&(_e(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),ue(I),I.avail_out===0))return q.last_flush=-1,g}return se!==p?g:q.wrap<=0?1:(q.wrap===2?(ge(q,255&I.adler),ge(q,I.adler>>8&255),ge(q,I.adler>>16&255),ge(q,I.adler>>24&255),ge(q,255&I.total_in),ge(q,I.total_in>>8&255),ge(q,I.total_in>>16&255),ge(q,I.total_in>>24&255)):(Te(q,I.adler>>>16),Te(q,65535&I.adler)),ue(I),0<q.wrap&&(q.wrap=-q.wrap),q.pending!==0?g:1)},o.deflateEnd=function(I){var se;return I&&I.state?(se=I.state.status)!==R&&se!==69&&se!==73&&se!==91&&se!==103&&se!==K&&se!==666?Q(I,m):(I.state=null,se===K?Q(I,-3):g):m},o.deflateSetDictionary=function(I,se){var F,q,P,ee,be,N,B,de,Se=se.length;if(!I||!I.state||(ee=(F=I.state).wrap)===2||ee===1&&F.status!==R||F.lookahead)return m;for(ee===1&&(I.adler=l(I.adler,se,Se,0)),F.wrap=0,Se>=F.w_size&&(ee===0&&(_e(F.head),F.strstart=0,F.block_start=0,F.insert=0),de=new s.Buf8(F.w_size),s.arraySet(de,se,Se-F.w_size,F.w_size,0),se=de,Se=F.w_size),be=I.avail_in,N=I.next_in,B=I.input,I.avail_in=Se,I.next_in=0,I.input=se,Je(F);F.lookahead>=V;){for(q=F.strstart,P=F.lookahead-(V-1);F.ins_h=(F.ins_h<<F.hash_shift^F.window[q+V-1])&F.hash_mask,F.prev[q&F.w_mask]=F.head[F.ins_h],F.head[F.ins_h]=q,q++,--P;);F.strstart=q,F.lookahead=V-1,Je(F)}return F.strstart+=F.lookahead,F.block_start=F.strstart,F.insert=F.lookahead,F.lookahead=0,F.match_length=F.prev_length=V-1,F.match_available=0,I.next_in=N,I.input=B,I.avail_in=be,F.wrap=ee,g},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,d,f,p,g,m,v,k,b,S,C,w,T,L,z,W,V,j,Z,R,K,x=i.input,$;u=l+(i.avail_in-5),d=i.next_out,$=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),g=a.dmax,m=a.wsize,v=a.whave,k=a.wnext,b=a.window,S=a.hold,C=a.bits,w=a.lencode,T=a.distcode,L=(1<<a.lenbits)-1,z=(1<<a.distbits)-1;e:do{C<15&&(S+=x[l++]<<C,C+=8,S+=x[l++]<<C,C+=8),W=w[S&L];t:for(;;){if(S>>>=V=W>>>24,C-=V,(V=W>>>16&255)===0)$[d++]=65535&W;else{if(!(16&V)){if((64&V)==0){W=w[(65535&W)+(S&(1<<V)-1)];continue t}if(32&V){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}j=65535&W,(V&=15)&&(C<V&&(S+=x[l++]<<C,C+=8),j+=S&(1<<V)-1,S>>>=V,C-=V),C<15&&(S+=x[l++]<<C,C+=8,S+=x[l++]<<C,C+=8),W=T[S&z];n:for(;;){if(S>>>=V=W>>>24,C-=V,!(16&(V=W>>>16&255))){if((64&V)==0){W=T[(65535&W)+(S&(1<<V)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(Z=65535&W,C<(V&=15)&&(S+=x[l++]<<C,(C+=8)<V&&(S+=x[l++]<<C,C+=8)),g<(Z+=S&(1<<V)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(S>>>=V,C-=V,(V=d-f)<Z){if(v<(V=Z-V)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(K=b,(R=0)===k){if(R+=m-V,V<j){for(j-=V;$[d++]=b[R++],--V;);R=d-Z,K=$}}else if(k<V){if(R+=m+k-V,(V-=k)<j){for(j-=V;$[d++]=b[R++],--V;);if(R=0,k<j){for(j-=V=k;$[d++]=b[R++],--V;);R=d-Z,K=$}}}else if(R+=k-V,V<j){for(j-=V;$[d++]=b[R++],--V;);R=d-Z,K=$}for(;2<j;)$[d++]=K[R++],$[d++]=K[R++],$[d++]=K[R++],j-=3;j&&($[d++]=K[R++],1<j&&($[d++]=K[R++]))}else{for(R=d-Z;$[d++]=$[R++],$[d++]=$[R++],$[d++]=$[R++],2<(j-=3););j&&($[d++]=$[R++],1<j&&($[d++]=$[R++]))}break}}break}}while(l<u&&d<p);l-=j=C>>3,S&=(1<<(C-=j<<3))-1,i.next_in=l,i.next_out=d,i.avail_in=l<u?u-l+5:5-(l-u),i.avail_out=d<p?p-d+257:257-(d-p),a.hold=S,a.bits=C}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),u=n("./inftrees"),d=1,f=2,p=0,g=-2,m=1,v=852,k=592;function b(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function S(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function C(R){var K;return R&&R.state?(K=R.state,R.total_in=R.total_out=K.total=0,R.msg="",K.wrap&&(R.adler=1&K.wrap),K.mode=m,K.last=0,K.havedict=0,K.dmax=32768,K.head=null,K.hold=0,K.bits=0,K.lencode=K.lendyn=new i.Buf32(v),K.distcode=K.distdyn=new i.Buf32(k),K.sane=1,K.back=-1,p):g}function w(R){var K;return R&&R.state?((K=R.state).wsize=0,K.whave=0,K.wnext=0,C(R)):g}function T(R,K){var x,$;return R&&R.state?($=R.state,K<0?(x=0,K=-K):(x=1+(K>>4),K<48&&(K&=15)),K&&(K<8||15<K)?g:($.window!==null&&$.wbits!==K&&($.window=null),$.wrap=x,$.wbits=K,w(R))):g}function L(R,K){var x,$;return R?($=new S,(R.state=$).window=null,(x=T(R,K))!==p&&(R.state=null),x):g}var z,W,V=!0;function j(R){if(V){var K;for(z=new i.Buf32(512),W=new i.Buf32(32),K=0;K<144;)R.lens[K++]=8;for(;K<256;)R.lens[K++]=9;for(;K<280;)R.lens[K++]=7;for(;K<288;)R.lens[K++]=8;for(u(d,R.lens,0,288,z,0,R.work,{bits:9}),K=0;K<32;)R.lens[K++]=5;u(f,R.lens,0,32,W,0,R.work,{bits:5}),V=!1}R.lencode=z,R.lenbits=9,R.distcode=W,R.distbits=5}function Z(R,K,x,$){var H,J=R.state;return J.window===null&&(J.wsize=1<<J.wbits,J.wnext=0,J.whave=0,J.window=new i.Buf8(J.wsize)),$>=J.wsize?(i.arraySet(J.window,K,x-J.wsize,J.wsize,0),J.wnext=0,J.whave=J.wsize):($<(H=J.wsize-J.wnext)&&(H=$),i.arraySet(J.window,K,x-$,H,J.wnext),($-=H)?(i.arraySet(J.window,K,x-$,$,0),J.wnext=$,J.whave=J.wsize):(J.wnext+=H,J.wnext===J.wsize&&(J.wnext=0),J.whave<J.wsize&&(J.whave+=H))),0}o.inflateReset=w,o.inflateReset2=T,o.inflateResetKeep=C,o.inflateInit=function(R){return L(R,15)},o.inflateInit2=L,o.inflate=function(R,K){var x,$,H,J,Q,Y,_e,ue,ve,ge,Te,Ne,Je,ct,tt,Tt,ae,Ee,Ue,ie,I,se,F,q,P=0,ee=new i.Buf8(4),be=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!R||!R.state||!R.output||!R.input&&R.avail_in!==0)return g;(x=R.state).mode===12&&(x.mode=13),Q=R.next_out,H=R.output,_e=R.avail_out,J=R.next_in,$=R.input,Y=R.avail_in,ue=x.hold,ve=x.bits,ge=Y,Te=_e,se=p;e:for(;;)switch(x.mode){case m:if(x.wrap===0){x.mode=13;break}for(;ve<16;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(2&x.wrap&&ue===35615){ee[x.check=0]=255&ue,ee[1]=ue>>>8&255,x.check=a(x.check,ee,2,0),ve=ue=0,x.mode=2;break}if(x.flags=0,x.head&&(x.head.done=!1),!(1&x.wrap)||(((255&ue)<<8)+(ue>>8))%31){R.msg="incorrect header check",x.mode=30;break}if((15&ue)!=8){R.msg="unknown compression method",x.mode=30;break}if(ve-=4,I=8+(15&(ue>>>=4)),x.wbits===0)x.wbits=I;else if(I>x.wbits){R.msg="invalid window size",x.mode=30;break}x.dmax=1<<I,R.adler=x.check=1,x.mode=512&ue?10:12,ve=ue=0;break;case 2:for(;ve<16;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(x.flags=ue,(255&x.flags)!=8){R.msg="unknown compression method",x.mode=30;break}if(57344&x.flags){R.msg="unknown header flags set",x.mode=30;break}x.head&&(x.head.text=ue>>8&1),512&x.flags&&(ee[0]=255&ue,ee[1]=ue>>>8&255,x.check=a(x.check,ee,2,0)),ve=ue=0,x.mode=3;case 3:for(;ve<32;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.head&&(x.head.time=ue),512&x.flags&&(ee[0]=255&ue,ee[1]=ue>>>8&255,ee[2]=ue>>>16&255,ee[3]=ue>>>24&255,x.check=a(x.check,ee,4,0)),ve=ue=0,x.mode=4;case 4:for(;ve<16;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.head&&(x.head.xflags=255&ue,x.head.os=ue>>8),512&x.flags&&(ee[0]=255&ue,ee[1]=ue>>>8&255,x.check=a(x.check,ee,2,0)),ve=ue=0,x.mode=5;case 5:if(1024&x.flags){for(;ve<16;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.length=ue,x.head&&(x.head.extra_len=ue),512&x.flags&&(ee[0]=255&ue,ee[1]=ue>>>8&255,x.check=a(x.check,ee,2,0)),ve=ue=0}else x.head&&(x.head.extra=null);x.mode=6;case 6:if(1024&x.flags&&(Y<(Ne=x.length)&&(Ne=Y),Ne&&(x.head&&(I=x.head.extra_len-x.length,x.head.extra||(x.head.extra=new Array(x.head.extra_len)),i.arraySet(x.head.extra,$,J,Ne,I)),512&x.flags&&(x.check=a(x.check,$,Ne,J)),Y-=Ne,J+=Ne,x.length-=Ne),x.length))break e;x.length=0,x.mode=7;case 7:if(2048&x.flags){if(Y===0)break e;for(Ne=0;I=$[J+Ne++],x.head&&I&&x.length<65536&&(x.head.name+=String.fromCharCode(I)),I&&Ne<Y;);if(512&x.flags&&(x.check=a(x.check,$,Ne,J)),Y-=Ne,J+=Ne,I)break e}else x.head&&(x.head.name=null);x.length=0,x.mode=8;case 8:if(4096&x.flags){if(Y===0)break e;for(Ne=0;I=$[J+Ne++],x.head&&I&&x.length<65536&&(x.head.comment+=String.fromCharCode(I)),I&&Ne<Y;);if(512&x.flags&&(x.check=a(x.check,$,Ne,J)),Y-=Ne,J+=Ne,I)break e}else x.head&&(x.head.comment=null);x.mode=9;case 9:if(512&x.flags){for(;ve<16;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(ue!==(65535&x.check)){R.msg="header crc mismatch",x.mode=30;break}ve=ue=0}x.head&&(x.head.hcrc=x.flags>>9&1,x.head.done=!0),R.adler=x.check=0,x.mode=12;break;case 10:for(;ve<32;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}R.adler=x.check=b(ue),ve=ue=0,x.mode=11;case 11:if(x.havedict===0)return R.next_out=Q,R.avail_out=_e,R.next_in=J,R.avail_in=Y,x.hold=ue,x.bits=ve,2;R.adler=x.check=1,x.mode=12;case 12:if(K===5||K===6)break e;case 13:if(x.last){ue>>>=7&ve,ve-=7&ve,x.mode=27;break}for(;ve<3;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}switch(x.last=1&ue,ve-=1,3&(ue>>>=1)){case 0:x.mode=14;break;case 1:if(j(x),x.mode=20,K!==6)break;ue>>>=2,ve-=2;break e;case 2:x.mode=17;break;case 3:R.msg="invalid block type",x.mode=30}ue>>>=2,ve-=2;break;case 14:for(ue>>>=7&ve,ve-=7&ve;ve<32;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if((65535&ue)!=(ue>>>16^65535)){R.msg="invalid stored block lengths",x.mode=30;break}if(x.length=65535&ue,ve=ue=0,x.mode=15,K===6)break e;case 15:x.mode=16;case 16:if(Ne=x.length){if(Y<Ne&&(Ne=Y),_e<Ne&&(Ne=_e),Ne===0)break e;i.arraySet(H,$,J,Ne,Q),Y-=Ne,J+=Ne,_e-=Ne,Q+=Ne,x.length-=Ne;break}x.mode=12;break;case 17:for(;ve<14;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(x.nlen=257+(31&ue),ue>>>=5,ve-=5,x.ndist=1+(31&ue),ue>>>=5,ve-=5,x.ncode=4+(15&ue),ue>>>=4,ve-=4,286<x.nlen||30<x.ndist){R.msg="too many length or distance symbols",x.mode=30;break}x.have=0,x.mode=18;case 18:for(;x.have<x.ncode;){for(;ve<3;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.lens[be[x.have++]]=7&ue,ue>>>=3,ve-=3}for(;x.have<19;)x.lens[be[x.have++]]=0;if(x.lencode=x.lendyn,x.lenbits=7,F={bits:x.lenbits},se=u(0,x.lens,0,19,x.lencode,0,x.work,F),x.lenbits=F.bits,se){R.msg="invalid code lengths set",x.mode=30;break}x.have=0,x.mode=19;case 19:for(;x.have<x.nlen+x.ndist;){for(;Tt=(P=x.lencode[ue&(1<<x.lenbits)-1])>>>16&255,ae=65535&P,!((tt=P>>>24)<=ve);){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(ae<16)ue>>>=tt,ve-=tt,x.lens[x.have++]=ae;else{if(ae===16){for(q=tt+2;ve<q;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(ue>>>=tt,ve-=tt,x.have===0){R.msg="invalid bit length repeat",x.mode=30;break}I=x.lens[x.have-1],Ne=3+(3&ue),ue>>>=2,ve-=2}else if(ae===17){for(q=tt+3;ve<q;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}ve-=tt,I=0,Ne=3+(7&(ue>>>=tt)),ue>>>=3,ve-=3}else{for(q=tt+7;ve<q;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}ve-=tt,I=0,Ne=11+(127&(ue>>>=tt)),ue>>>=7,ve-=7}if(x.have+Ne>x.nlen+x.ndist){R.msg="invalid bit length repeat",x.mode=30;break}for(;Ne--;)x.lens[x.have++]=I}}if(x.mode===30)break;if(x.lens[256]===0){R.msg="invalid code -- missing end-of-block",x.mode=30;break}if(x.lenbits=9,F={bits:x.lenbits},se=u(d,x.lens,0,x.nlen,x.lencode,0,x.work,F),x.lenbits=F.bits,se){R.msg="invalid literal/lengths set",x.mode=30;break}if(x.distbits=6,x.distcode=x.distdyn,F={bits:x.distbits},se=u(f,x.lens,x.nlen,x.ndist,x.distcode,0,x.work,F),x.distbits=F.bits,se){R.msg="invalid distances set",x.mode=30;break}if(x.mode=20,K===6)break e;case 20:x.mode=21;case 21:if(6<=Y&&258<=_e){R.next_out=Q,R.avail_out=_e,R.next_in=J,R.avail_in=Y,x.hold=ue,x.bits=ve,l(R,Te),Q=R.next_out,H=R.output,_e=R.avail_out,J=R.next_in,$=R.input,Y=R.avail_in,ue=x.hold,ve=x.bits,x.mode===12&&(x.back=-1);break}for(x.back=0;Tt=(P=x.lencode[ue&(1<<x.lenbits)-1])>>>16&255,ae=65535&P,!((tt=P>>>24)<=ve);){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(Tt&&(240&Tt)==0){for(Ee=tt,Ue=Tt,ie=ae;Tt=(P=x.lencode[ie+((ue&(1<<Ee+Ue)-1)>>Ee)])>>>16&255,ae=65535&P,!(Ee+(tt=P>>>24)<=ve);){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}ue>>>=Ee,ve-=Ee,x.back+=Ee}if(ue>>>=tt,ve-=tt,x.back+=tt,x.length=ae,Tt===0){x.mode=26;break}if(32&Tt){x.back=-1,x.mode=12;break}if(64&Tt){R.msg="invalid literal/length code",x.mode=30;break}x.extra=15&Tt,x.mode=22;case 22:if(x.extra){for(q=x.extra;ve<q;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.length+=ue&(1<<x.extra)-1,ue>>>=x.extra,ve-=x.extra,x.back+=x.extra}x.was=x.length,x.mode=23;case 23:for(;Tt=(P=x.distcode[ue&(1<<x.distbits)-1])>>>16&255,ae=65535&P,!((tt=P>>>24)<=ve);){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if((240&Tt)==0){for(Ee=tt,Ue=Tt,ie=ae;Tt=(P=x.distcode[ie+((ue&(1<<Ee+Ue)-1)>>Ee)])>>>16&255,ae=65535&P,!(Ee+(tt=P>>>24)<=ve);){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}ue>>>=Ee,ve-=Ee,x.back+=Ee}if(ue>>>=tt,ve-=tt,x.back+=tt,64&Tt){R.msg="invalid distance code",x.mode=30;break}x.offset=ae,x.extra=15&Tt,x.mode=24;case 24:if(x.extra){for(q=x.extra;ve<q;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.offset+=ue&(1<<x.extra)-1,ue>>>=x.extra,ve-=x.extra,x.back+=x.extra}if(x.offset>x.dmax){R.msg="invalid distance too far back",x.mode=30;break}x.mode=25;case 25:if(_e===0)break e;if(Ne=Te-_e,x.offset>Ne){if((Ne=x.offset-Ne)>x.whave&&x.sane){R.msg="invalid distance too far back",x.mode=30;break}Je=Ne>x.wnext?(Ne-=x.wnext,x.wsize-Ne):x.wnext-Ne,Ne>x.length&&(Ne=x.length),ct=x.window}else ct=H,Je=Q-x.offset,Ne=x.length;for(_e<Ne&&(Ne=_e),_e-=Ne,x.length-=Ne;H[Q++]=ct[Je++],--Ne;);x.length===0&&(x.mode=21);break;case 26:if(_e===0)break e;H[Q++]=x.length,_e--,x.mode=21;break;case 27:if(x.wrap){for(;ve<32;){if(Y===0)break e;Y--,ue|=$[J++]<<ve,ve+=8}if(Te-=_e,R.total_out+=Te,x.total+=Te,Te&&(R.adler=x.check=x.flags?a(x.check,H,Te,Q-Te):s(x.check,H,Te,Q-Te)),Te=_e,(x.flags?ue:b(ue))!==x.check){R.msg="incorrect data check",x.mode=30;break}ve=ue=0}x.mode=28;case 28:if(x.wrap&&x.flags){for(;ve<32;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(ue!==(4294967295&x.total)){R.msg="incorrect length check",x.mode=30;break}ve=ue=0}x.mode=29;case 29:se=1;break e;case 30:se=-3;break e;case 31:return-4;default:return g}return R.next_out=Q,R.avail_out=_e,R.next_in=J,R.avail_in=Y,x.hold=ue,x.bits=ve,(x.wsize||Te!==R.avail_out&&x.mode<30&&(x.mode<27||K!==4))&&Z(R,R.output,R.next_out,Te-R.avail_out)?(x.mode=31,-4):(ge-=R.avail_in,Te-=R.avail_out,R.total_in+=ge,R.total_out+=Te,x.total+=Te,x.wrap&&Te&&(R.adler=x.check=x.flags?a(x.check,H,Te,R.next_out-Te):s(x.check,H,Te,R.next_out-Te)),R.data_type=x.bits+(x.last?64:0)+(x.mode===12?128:0)+(x.mode===20||x.mode===15?256:0),(ge==0&&Te===0||K===4)&&se===p&&(se=-5),se)},o.inflateEnd=function(R){if(!R||!R.state)return g;var K=R.state;return K.window&&(K.window=null),R.state=null,p},o.inflateGetHeader=function(R,K){var x;return R&&R.state?(2&(x=R.state).wrap)==0?g:((x.head=K).done=!1,p):g},o.inflateSetDictionary=function(R,K){var x,$=K.length;return R&&R.state?(x=R.state).wrap!==0&&x.mode!==11?g:x.mode===11&&s(1,K,$,0)!==x.check?-3:Z(R,K,$,$)?(x.mode=31,-4):(x.havedict=1,p):g},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,p,g,m,v,k,b){var S,C,w,T,L,z,W,V,j,Z=b.bits,R=0,K=0,x=0,$=0,H=0,J=0,Q=0,Y=0,_e=0,ue=0,ve=null,ge=0,Te=new i.Buf16(16),Ne=new i.Buf16(16),Je=null,ct=0;for(R=0;R<=15;R++)Te[R]=0;for(K=0;K<g;K++)Te[f[p+K]]++;for(H=Z,$=15;1<=$&&Te[$]===0;$--);if($<H&&(H=$),$===0)return m[v++]=20971520,m[v++]=20971520,b.bits=1,0;for(x=1;x<$&&Te[x]===0;x++);for(H<x&&(H=x),R=Y=1;R<=15;R++)if(Y<<=1,(Y-=Te[R])<0)return-1;if(0<Y&&(d===0||$!==1))return-1;for(Ne[1]=0,R=1;R<15;R++)Ne[R+1]=Ne[R]+Te[R];for(K=0;K<g;K++)f[p+K]!==0&&(k[Ne[f[p+K]]++]=K);if(z=d===0?(ve=Je=k,19):d===1?(ve=s,ge-=257,Je=a,ct-=257,256):(ve=l,Je=u,-1),R=x,L=v,Q=K=ue=0,w=-1,T=(_e=1<<(J=H))-1,d===1&&852<_e||d===2&&592<_e)return 1;for(;;){for(W=R-Q,j=k[K]<z?(V=0,k[K]):k[K]>z?(V=Je[ct+k[K]],ve[ge+k[K]]):(V=96,0),S=1<<R-Q,x=C=1<<J;m[L+(ue>>Q)+(C-=S)]=W<<24|V<<16|j|0,C!==0;);for(S=1<<R-1;ue&S;)S>>=1;if(S!==0?(ue&=S-1,ue+=S):ue=0,K++,--Te[R]==0){if(R===$)break;R=f[p+k[K]]}if(H<R&&(ue&T)!==w){for(Q===0&&(Q=H),L+=x,Y=1<<(J=R-Q);J+Q<$&&!((Y-=Te[J+Q])<=0);)J++,Y<<=1;if(_e+=1<<J,d===1&&852<_e||d===2&&592<_e)return 1;m[w=ue&T]=H<<24|J<<16|L-v|0}}return ue!==0&&(m[L+ue]=R-Q<<24|4194304),b.bits=H,0}},{"../utils/common":41}],51:[function(n,r,o){"use strict";r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){"use strict";var i=n("../utils/common"),s=0,a=1;function l(P){for(var ee=P.length;0<=--ee;)P[ee]=0}var u=0,d=29,f=256,p=f+1+d,g=30,m=19,v=2*p+1,k=15,b=16,S=7,C=256,w=16,T=17,L=18,z=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],W=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],V=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Z=new Array(2*(p+2));l(Z);var R=new Array(2*g);l(R);var K=new Array(512);l(K);var x=new Array(256);l(x);var $=new Array(d);l($);var H,J,Q,Y=new Array(g);function _e(P,ee,be,N,B){this.static_tree=P,this.extra_bits=ee,this.extra_base=be,this.elems=N,this.max_length=B,this.has_stree=P&&P.length}function ue(P,ee){this.dyn_tree=P,this.max_code=0,this.stat_desc=ee}function ve(P){return P<256?K[P]:K[256+(P>>>7)]}function ge(P,ee){P.pending_buf[P.pending++]=255&ee,P.pending_buf[P.pending++]=ee>>>8&255}function Te(P,ee,be){P.bi_valid>b-be?(P.bi_buf|=ee<<P.bi_valid&65535,ge(P,P.bi_buf),P.bi_buf=ee>>b-P.bi_valid,P.bi_valid+=be-b):(P.bi_buf|=ee<<P.bi_valid&65535,P.bi_valid+=be)}function Ne(P,ee,be){Te(P,be[2*ee],be[2*ee+1])}function Je(P,ee){for(var be=0;be|=1&P,P>>>=1,be<<=1,0<--ee;);return be>>>1}function ct(P,ee,be){var N,B,de=new Array(k+1),Se=0;for(N=1;N<=k;N++)de[N]=Se=Se+be[N-1]<<1;for(B=0;B<=ee;B++){var Ae=P[2*B+1];Ae!==0&&(P[2*B]=Je(de[Ae]++,Ae))}}function tt(P){var ee;for(ee=0;ee<p;ee++)P.dyn_ltree[2*ee]=0;for(ee=0;ee<g;ee++)P.dyn_dtree[2*ee]=0;for(ee=0;ee<m;ee++)P.bl_tree[2*ee]=0;P.dyn_ltree[2*C]=1,P.opt_len=P.static_len=0,P.last_lit=P.matches=0}function Tt(P){8<P.bi_valid?ge(P,P.bi_buf):0<P.bi_valid&&(P.pending_buf[P.pending++]=P.bi_buf),P.bi_buf=0,P.bi_valid=0}function ae(P,ee,be,N){var B=2*ee,de=2*be;return P[B]<P[de]||P[B]===P[de]&&N[ee]<=N[be]}function Ee(P,ee,be){for(var N=P.heap[be],B=be<<1;B<=P.heap_len&&(B<P.heap_len&&ae(ee,P.heap[B+1],P.heap[B],P.depth)&&B++,!ae(ee,N,P.heap[B],P.depth));)P.heap[be]=P.heap[B],be=B,B<<=1;P.heap[be]=N}function Ue(P,ee,be){var N,B,de,Se,Ae=0;if(P.last_lit!==0)for(;N=P.pending_buf[P.d_buf+2*Ae]<<8|P.pending_buf[P.d_buf+2*Ae+1],B=P.pending_buf[P.l_buf+Ae],Ae++,N===0?Ne(P,B,ee):(Ne(P,(de=x[B])+f+1,ee),(Se=z[de])!==0&&Te(P,B-=$[de],Se),Ne(P,de=ve(--N),be),(Se=W[de])!==0&&Te(P,N-=Y[de],Se)),Ae<P.last_lit;);Ne(P,C,ee)}function ie(P,ee){var be,N,B,de=ee.dyn_tree,Se=ee.stat_desc.static_tree,Ae=ee.stat_desc.has_stree,Le=ee.stat_desc.elems,Xe=-1;for(P.heap_len=0,P.heap_max=v,be=0;be<Le;be++)de[2*be]!==0?(P.heap[++P.heap_len]=Xe=be,P.depth[be]=0):de[2*be+1]=0;for(;P.heap_len<2;)de[2*(B=P.heap[++P.heap_len]=Xe<2?++Xe:0)]=1,P.depth[B]=0,P.opt_len--,Ae&&(P.static_len-=Se[2*B+1]);for(ee.max_code=Xe,be=P.heap_len>>1;1<=be;be--)Ee(P,de,be);for(B=Le;be=P.heap[1],P.heap[1]=P.heap[P.heap_len--],Ee(P,de,1),N=P.heap[1],P.heap[--P.heap_max]=be,P.heap[--P.heap_max]=N,de[2*B]=de[2*be]+de[2*N],P.depth[B]=(P.depth[be]>=P.depth[N]?P.depth[be]:P.depth[N])+1,de[2*be+1]=de[2*N+1]=B,P.heap[1]=B++,Ee(P,de,1),2<=P.heap_len;);P.heap[--P.heap_max]=P.heap[1],(function(it,yt){var Mt,Lt,Wt,Be,rn,zn,Ht=yt.dyn_tree,xn=yt.max_code,Ur=yt.stat_desc.static_tree,yr=yt.stat_desc.has_stree,Ar=yt.stat_desc.extra_bits,et=yt.stat_desc.extra_base,kt=yt.stat_desc.max_length,Bt=0;for(Be=0;Be<=k;Be++)it.bl_count[Be]=0;for(Ht[2*it.heap[it.heap_max]+1]=0,Mt=it.heap_max+1;Mt<v;Mt++)kt<(Be=Ht[2*Ht[2*(Lt=it.heap[Mt])+1]+1]+1)&&(Be=kt,Bt++),Ht[2*Lt+1]=Be,xn<Lt||(it.bl_count[Be]++,rn=0,et<=Lt&&(rn=Ar[Lt-et]),zn=Ht[2*Lt],it.opt_len+=zn*(Be+rn),yr&&(it.static_len+=zn*(Ur[2*Lt+1]+rn)));if(Bt!==0){do{for(Be=kt-1;it.bl_count[Be]===0;)Be--;it.bl_count[Be]--,it.bl_count[Be+1]+=2,it.bl_count[kt]--,Bt-=2}while(0<Bt);for(Be=kt;Be!==0;Be--)for(Lt=it.bl_count[Be];Lt!==0;)xn<(Wt=it.heap[--Mt])||(Ht[2*Wt+1]!==Be&&(it.opt_len+=(Be-Ht[2*Wt+1])*Ht[2*Wt],Ht[2*Wt+1]=Be),Lt--)}})(P,ee),ct(de,Xe,P.bl_count)}function I(P,ee,be){var N,B,de=-1,Se=ee[1],Ae=0,Le=7,Xe=4;for(Se===0&&(Le=138,Xe=3),ee[2*(be+1)+1]=65535,N=0;N<=be;N++)B=Se,Se=ee[2*(N+1)+1],++Ae<Le&&B===Se||(Ae<Xe?P.bl_tree[2*B]+=Ae:B!==0?(B!==de&&P.bl_tree[2*B]++,P.bl_tree[2*w]++):Ae<=10?P.bl_tree[2*T]++:P.bl_tree[2*L]++,de=B,Xe=(Ae=0)===Se?(Le=138,3):B===Se?(Le=6,3):(Le=7,4))}function se(P,ee,be){var N,B,de=-1,Se=ee[1],Ae=0,Le=7,Xe=4;for(Se===0&&(Le=138,Xe=3),N=0;N<=be;N++)if(B=Se,Se=ee[2*(N+1)+1],!(++Ae<Le&&B===Se)){if(Ae<Xe)for(;Ne(P,B,P.bl_tree),--Ae!=0;);else B!==0?(B!==de&&(Ne(P,B,P.bl_tree),Ae--),Ne(P,w,P.bl_tree),Te(P,Ae-3,2)):Ae<=10?(Ne(P,T,P.bl_tree),Te(P,Ae-3,3)):(Ne(P,L,P.bl_tree),Te(P,Ae-11,7));de=B,Xe=(Ae=0)===Se?(Le=138,3):B===Se?(Le=6,3):(Le=7,4)}}l(Y);var F=!1;function q(P,ee,be,N){Te(P,(u<<1)+(N?1:0),3),(function(B,de,Se,Ae){Tt(B),Ae&&(ge(B,Se),ge(B,~Se)),i.arraySet(B.pending_buf,B.window,de,Se,B.pending),B.pending+=Se})(P,ee,be,!0)}o._tr_init=function(P){F||((function(){var ee,be,N,B,de,Se=new Array(k+1);for(B=N=0;B<d-1;B++)for($[B]=N,ee=0;ee<1<<z[B];ee++)x[N++]=B;for(x[N-1]=B,B=de=0;B<16;B++)for(Y[B]=de,ee=0;ee<1<<W[B];ee++)K[de++]=B;for(de>>=7;B<g;B++)for(Y[B]=de<<7,ee=0;ee<1<<W[B]-7;ee++)K[256+de++]=B;for(be=0;be<=k;be++)Se[be]=0;for(ee=0;ee<=143;)Z[2*ee+1]=8,ee++,Se[8]++;for(;ee<=255;)Z[2*ee+1]=9,ee++,Se[9]++;for(;ee<=279;)Z[2*ee+1]=7,ee++,Se[7]++;for(;ee<=287;)Z[2*ee+1]=8,ee++,Se[8]++;for(ct(Z,p+1,Se),ee=0;ee<g;ee++)R[2*ee+1]=5,R[2*ee]=Je(ee,5);H=new _e(Z,z,f+1,p,k),J=new _e(R,W,0,g,k),Q=new _e(new Array(0),V,0,m,S)})(),F=!0),P.l_desc=new ue(P.dyn_ltree,H),P.d_desc=new ue(P.dyn_dtree,J),P.bl_desc=new ue(P.bl_tree,Q),P.bi_buf=0,P.bi_valid=0,tt(P)},o._tr_stored_block=q,o._tr_flush_block=function(P,ee,be,N){var B,de,Se=0;0<P.level?(P.strm.data_type===2&&(P.strm.data_type=(function(Ae){var Le,Xe=4093624447;for(Le=0;Le<=31;Le++,Xe>>>=1)if(1&Xe&&Ae.dyn_ltree[2*Le]!==0)return s;if(Ae.dyn_ltree[18]!==0||Ae.dyn_ltree[20]!==0||Ae.dyn_ltree[26]!==0)return a;for(Le=32;Le<f;Le++)if(Ae.dyn_ltree[2*Le]!==0)return a;return s})(P)),ie(P,P.l_desc),ie(P,P.d_desc),Se=(function(Ae){var Le;for(I(Ae,Ae.dyn_ltree,Ae.l_desc.max_code),I(Ae,Ae.dyn_dtree,Ae.d_desc.max_code),ie(Ae,Ae.bl_desc),Le=m-1;3<=Le&&Ae.bl_tree[2*j[Le]+1]===0;Le--);return Ae.opt_len+=3*(Le+1)+5+5+4,Le})(P),B=P.opt_len+3+7>>>3,(de=P.static_len+3+7>>>3)<=B&&(B=de)):B=de=be+5,be+4<=B&&ee!==-1?q(P,ee,be,N):P.strategy===4||de===B?(Te(P,2+(N?1:0),3),Ue(P,Z,R)):(Te(P,4+(N?1:0),3),(function(Ae,Le,Xe,it){var yt;for(Te(Ae,Le-257,5),Te(Ae,Xe-1,5),Te(Ae,it-4,4),yt=0;yt<it;yt++)Te(Ae,Ae.bl_tree[2*j[yt]+1],3);se(Ae,Ae.dyn_ltree,Le-1),se(Ae,Ae.dyn_dtree,Xe-1)})(P,P.l_desc.max_code+1,P.d_desc.max_code+1,Se+1),Ue(P,P.dyn_ltree,P.dyn_dtree)),tt(P),N&&Tt(P)},o._tr_tally=function(P,ee,be){return P.pending_buf[P.d_buf+2*P.last_lit]=ee>>>8&255,P.pending_buf[P.d_buf+2*P.last_lit+1]=255&ee,P.pending_buf[P.l_buf+P.last_lit]=255&be,P.last_lit++,ee===0?P.dyn_ltree[2*be]++:(P.matches++,ee--,P.dyn_ltree[2*(x[be]+f+1)]++,P.dyn_dtree[2*ve(ee)]++),P.last_lit===P.lit_bufsize-1},o._tr_align=function(P){Te(P,2,3),Ne(P,C,Z),(function(ee){ee.bi_valid===16?(ge(ee,ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0):8<=ee.bi_valid&&(ee.pending_buf[ee.pending++]=255&ee.bi_buf,ee.bi_buf>>=8,ee.bi_valid-=8)})(P)}},{"../utils/common":41}],53:[function(n,r,o){"use strict";r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){"use strict";if(!s.setImmediate){var l,u,d,f,p=1,g={},m=!1,v=s.document,k=Object.getPrototypeOf&&Object.getPrototypeOf(s);k=k&&k.setTimeout?k:s,l={}.toString.call(s.process)==="[object process]"?function(w){process.nextTick(function(){S(w)})}:(function(){if(s.postMessage&&!s.importScripts){var w=!0,T=s.onmessage;return s.onmessage=function(){w=!1},s.postMessage("","*"),s.onmessage=T,w}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",C,!1):s.attachEvent("onmessage",C),function(w){s.postMessage(f+w,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(w){S(w.data)},function(w){d.port2.postMessage(w)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(w){var T=v.createElement("script");T.onreadystatechange=function(){S(w),T.onreadystatechange=null,u.removeChild(T),T=null},u.appendChild(T)}):function(w){setTimeout(S,0,w)},k.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var T=new Array(arguments.length-1),L=0;L<T.length;L++)T[L]=arguments[L+1];return g[p]={callback:w,args:T},l(p),p++},k.clearImmediate=b}function b(w){delete g[w]}function S(w){if(m)setTimeout(S,0,w);else{var T=g[w];if(T){m=!0;try{(function(L){var z=L.callback,W=L.args;switch(W.length){case 0:z();break;case 1:z(W[0]);break;case 2:z(W[0],W[1]);break;case 3:z(W[0],W[1],W[2]);break;default:z.apply(a,W)}})(T)}finally{b(w),m=!1}}}}function C(w){w.source===s&&typeof w.data=="string"&&w.data.indexOf(f)===0&&S(+w.data.slice(f.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})),Sr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Ea="application/pdf",Iu="text/html",ex={docx:Sr,pdf:Ea,html:Iu},Rp={RESOLVED:"resolved",NEW:"new",ADD:"add",UPDATE:"update",DELETED:"deleted",PENDING:"pending",SELECTED:"selected",COMMENTS_LIST:"comments-list",CHANGE_ACCEPTED:"change-accepted",CHANGE_REJECTED:"change-rejected"};Ft();var tx=j2(J5(),1),nx=e=>typeof e!="string"?"":e.trim(),Vy=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Mp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},bc=e=>{const t=e??{},n=nx(t.id),r=Vy(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},tk=({current:e,other:t})=>{const n=bc(e),r=bc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Eu=({actor:e,fallbackKey:t=""})=>{const n=bc(e);if(n.hasId)return`id:${n.id}`;if(n.hasEmail)return`email:${n.email}`;const r=typeof t=="number"?String(t):typeof t=="string"?t.trim():"";return r?`fallback:${r}`:""};function rx(e){return typeof e.captureStackTrace=="function"}var Lp=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",rx(Error)&&Error.captureStackTrace(this,this.constructor)}},ox=class extends Lp{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},ix=class extends Lp{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Uy=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new ox(e);const s=atob(i[1]),a=Uint8Array.from(s,l=>l.charCodeAt(0));return new File([a],t,{type:n})}const r=await fetch(e);if(!r.ok)throw new ix(e,new Error(`HTTP ${r.status}: ${r.statusText}`));const o=await r.blob();return new File([o],t,{type:n})}catch(r){throw r instanceof Lp?r:new Lp("Failed to create file object",r)}};function sx(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const i=n[o]||0,s=r[o]||0;if(i>s)return 1;if(i<s)return-1}return 0}var Dp=new WeakMap;function nk(e){return e.ownerDocument??document}function rk(e,t){const n=Dp.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Dp.delete(t))}function ok(e,t){const n=nk(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&rk(e,e.__clickOutsideDocument);let r=Dp.get(n);if(!r){const o=new Map,i=s=>{const a=typeof s.composedPath=="function"?s.composedPath():null;for(const[l,u]of o)(a?.includes(l)??l.contains(s.target))||u.value?.(s)};r={bindings:o,listener:i},Dp.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var Hy={mounted(e,t){ok(e,t)},updated(e,t){ok(e,t)},unmounted(e){rk(e,e.__clickOutsideDocument??nk(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function ax(e){return e[1].user!==void 0}var lx=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(ax).filter(([r,o])=>{const i=Eu({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Eu({actor:o.user,fallbackKey:r});let s=e.userColorMap.get(i);return s||(s=o.user.color||(e.config.colors.length>0?e.config.colors[e.colorIndex%e.config.colors.length]:void 0),e.userColorMap.set(i,s),e.colorIndex++),{clientId:r,...o.user,color:s}})},cx=e=>{for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e},ux="https://ingest.superdoc.dev/v1/collect",zG="community-and-eval-agplv3";function dx(){try{return"2.18.0-next.5"}catch{return"unknown"}}var fx=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||ux,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=dx()}getBrowserInfo(){return typeof window>"u"?{userAgent:"",currentUrl:"",hostname:"",screenSize:{width:0,height:0}}:{userAgent:window.navigator.userAgent,currentUrl:window.location.origin,hostname:window.location.hostname,screenSize:{width:window.screen.width,height:window.screen.height}}}trackDocumentOpen(e,t=null){if(!this.enabled)return;const n={timestamp:new Date().toISOString(),documentId:e,documentCreatedAt:t};this.sendEvent(n)}async sendEvent(e){const t={superdocVersion:this.superdocVersion,browserInfo:this.getBrowserInfo(),...this.metadata&&{metadata:this.metadata},events:[e]};try{await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-License-Key":this.licenseKey},body:JSON.stringify(t),credentials:"omit"})}catch{}}},Op={PAGE:"superdoc-page",FRAGMENT:"superdoc-fragment",FLOATING_FRAGMENT:"superdoc-floating-fragment",LINE:"superdoc-line",INLINE_SDT_WRAPPER:"superdoc-structured-content-inline",INLINE_SDT_LABEL:"superdoc-structured-content-inline__label",BLOCK_SDT:"superdoc-structured-content-block",BLOCK_SDT_LABEL:"superdoc-structured-content__label",TABLE_FRAGMENT:"superdoc-table-fragment",DOCUMENT_SECTION:"superdoc-document-section",SDT_GROUP_HOVER:"sdt-group-hover",TOC_ENTRY:"superdoc-toc-entry",TOC_GROUP_HOVER:"toc-group-hover",IMAGE_FRAGMENT:"superdoc-image-fragment",INLINE_IMAGE:"superdoc-inline-image",LIST_MARKER:"superdoc-list-marker",INLINE_IMAGE_CLIP_WRAPPER:"superdoc-inline-image-clip-wrapper",ANNOTATION:"annotation",ANNOTATION_CONTENT:"annotation-content",ANNOTATION_CARET_ANCHOR:"annotation-caret-anchor"},jG=[Op.INLINE_SDT_LABEL,Op.BLOCK_SDT_LABEL],ik={PM_START:"data-pm-start",PM_END:"data-pm-end",LAYOUT_EPOCH:"data-layout-epoch",TABLE_BOUNDARIES:"data-table-boundaries",SDT_ID:"data-sdt-id",SDT_TYPE:"data-sdt-type",FIELD_ID:"data-field-id",FIELD_TYPE:"data-field-type",DRAGGABLE:"data-draggable",DISPLAY_LABEL:"data-display-label",VARIANT:"data-variant",TYPE:"data-type",LAYOUT_BOUNDARY_SCHEMA:"data-layout-boundary-schema",LAYOUT_FRAGMENT_ID:"data-layout-fragment-id",LAYOUT_STORY:"data-layout-story",LAYOUT_BLOCK_REF:"data-layout-block-ref",LAYOUT_COLUMN_INDEX:"data-layout-column-index"},hx=e=>{if(!e)return{kind:"unknown"};if(e==="body")return{kind:"body"};const t=e.indexOf(":"),n=t===-1?e:e.slice(0,t),r=t===-1?void 0:e.slice(t+1);switch(n){case"body":case"header":case"footer":case"footnote":case"endnote":case"textbox":return r?{kind:n,id:r}:{kind:n};default:return{kind:"unknown"}}},VG=`.${Op.BLOCK_SDT}[${ik.SDT_ID}]`,UG=`[${ik.DRAGGABLE}="true"]`,px=typeof window<"u",sk,kf=e=>sk=e,ak=Symbol();function $y(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Sf;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Sf||(Sf={}));var lk=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:typeof globalThis=="object"?globalThis:{HTMLElement:null};function mx(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function Gy(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){gx(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function ck(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Pp(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{const n=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(n)}}var Fp=typeof navigator=="object"?navigator:{userAgent:""},uk=/Macintosh/.test(Fp.userAgent)&&/AppleWebKit/.test(Fp.userAgent)&&!/Safari/.test(Fp.userAgent),gx=px?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!uk?vx:"msSaveOrOpenBlob"in Fp?yx:bx:()=>{};function vx(e,t="download",n){const r=document.createElement("a");r.download=t,r.rel="noopener",typeof e=="string"?(r.href=e,r.origin!==location.origin?ck(r.href)?Gy(e,t,n):(r.target="_blank",Pp(r)):Pp(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Pp(r)},0))}function yx(e,t="download",n){if(typeof e=="string")if(ck(e))Gy(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Pp(r)})}else navigator.msSaveOrOpenBlob(mx(e,n),t)}function bx(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Gy(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(lk.HTMLElement))||"safari"in lk,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||uk)&&typeof FileReader<"u"){const a=new FileReader;a.onloadend=function(){let l=a.result;if(typeof l!="string")throw r=null,new Error("Wrong reader.result type");l=s?l:l.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=l:location.assign(l),r=null},a.readAsDataURL(e)}else{const a=URL.createObjectURL(e);r?r.location.assign(a):location.href=a,r=null,setTimeout(function(){URL.revokeObjectURL(a)},4e4)}}var{assign:HG}=Object;function wx(){const e=Zg(!0),t=e.run(()=>re({}));let n=[],r=[];const o=Wr({install(i){kf(o),o._a=i,i.provide(ak,o),i.config.globalProperties.$pinia=o,r.forEach(s=>n.push(s)),r=[]},use(i){return this._a?n.push(i):r.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o}var dk=()=>{};function fk(e,t,n,r=dk){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&Qg()&&r1(o),o}function Tu(e,...t){e.forEach(n=>{n(...t)})}var Cx=e=>e(),hk=Symbol(),Wy=Symbol();function Ky(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,r)=>e.set(r,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],o=e[n];$y(o)&&$y(r)&&e.hasOwnProperty(n)&&!lr(r)&&!Fi(r)?e[n]=Ky(o,r):e[n]=r}return e}var kx=Symbol();function Sx(e){return!$y(e)||!Object.prototype.hasOwnProperty.call(e,kx)}var{assign:yl}=Object;function _x(e){return!!(lr(e)&&e.effect)}function Ax(e,t,n,r){const{state:o,actions:i,getters:s}=t,a=n.state.value[e];let l;function u(){a||(n.state.value[e]=o?o():{});const d=p1(n.state.value[e]);return yl(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=Wr(ke(()=>{kf(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=pk(e,u,t,n,r,!0),l}function pk(e,t,n={},r,o,i){let s;const a=yl({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function k(L){let z;u=d=!1,typeof L=="function"?(L(r.state.value[e]),z={type:Sf.patchFunction,storeId:e,events:g}):(Ky(r.state.value[e],L),z={type:Sf.patchObject,payload:L,storeId:e,events:g});const W=v=Symbol();St().then(()=>{v===W&&(u=!0)}),d=!0,Tu(f,z,r.state.value[e])}const b=i?function(){const{state:z}=n,W=z?z():{};this.$patch(V=>{yl(V,W)})}:dk;function S(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const C=(L,z="")=>{if(hk in L)return L[Wy]=z,L;const W=function(){kf(r);const V=Array.from(arguments),j=new Set,Z=new Set;function R($){j.add($)}function K($){Z.add($)}Tu(p,{args:V,name:W[Wy],store:w,after:R,onError:K});let x;try{x=L.apply(this&&this.$id===e?this:w,V)}catch($){throw Tu(Z,$),$}return x instanceof Promise?x.then($=>(Tu(j,$),$)).catch($=>(Tu(Z,$),Promise.reject($))):(Tu(j,x),x)};return W[hk]=!0,W[Wy]=z,W},w=no({_p:r,$id:e,$onAction:fk.bind(null,p),$patch:k,$reset:b,$subscribe(L,z={}){const W=fk(f,L,z.detached,()=>V()),V=s.run(()=>jt(()=>r.state.value[e],j=>{(z.flush==="sync"?d:u)&&L({storeId:e,type:Sf.direct,events:g},j)},yl({},l,z)));return W},$dispose:S});r._s.set(e,w);const T=(r._a&&r._a.runWithContext||Cx)(()=>r._e.run(()=>(s=Zg()).run(()=>t({action:C}))));for(const L in T){const z=T[L];lr(z)&&!_x(z)||Fi(z)?i||(m&&Sx(z)&&(lr(z)?z.value=m[L]:Ky(z,m[L])),r.state.value[e][L]=z):typeof z=="function"&&(T[L]=C(z,L),a.actions[L]=z)}return yl(w,T),yl(pn(w),T),Object.defineProperty(w,"$state",{get:()=>r.state.value[e],set:L=>{k(z=>{yl(z,L)})}}),r._p.forEach(L=>{yl(w,s.run(()=>L({store:w,app:r._a,pinia:r,options:a})))}),m&&i&&n.hydrate&&n.hydrate(w.$state,m),u=!0,d=!0,w}function mk(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=U1();return s=s||(l?ll(ak,null):null),s&&kf(s),s=sk,s._s.has(e)||(o?pk(e,t,r,s):Ax(e,r,s)),s._s.get(e)}return i.$id=e,i}function Ns(e){const t=pn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=ke({get:()=>e[r],set(i){e[r]=i}}):(lr(o)||Fi(o))&&(n[r]=sv(e,r))}return n}function gk(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function vk(e){if(typeof e!="string"||e.length===0)return"<none>";try{const t=new URL(e);t.search="",t.hash="",t.username="",t.password="";const n=e.includes("?")?"?<redacted>":"";return`${t.toString().replace(/\?$/,"")}${n}`}catch{const t=e.replace(/\/\/[^/@]+@/,"//"),n=t.search(/[?#]/);return n===-1?t:`${t.slice(0,n)}?<redacted>`}}function wc(e){return typeof e=="string"&&e.length>0?e:null}function Ix(e){if(typeof e!="string"||e.length===0)return null;try{const t=new URL(e);return t.protocol==="ws:"||t.protocol==="wss:"?e:null}catch{return null}}function Ex(e,t){if(typeof e!="string")return null;const n=e.trim();if(n.length===0)return null;try{const r=new URL(n);return r.protocol==="http:"||r.protocol==="https:"?n:null}catch{if(typeof t!="string"||t.trim().length===0)return null;try{const r=new URL(n,t);return r.protocol==="http:"||r.protocol==="https:"?r.href:null}catch{return null}}}function Tx(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return Object.keys(t).length>0?t:void 0}function qy(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function xx(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function Np(e,t){return!e.ok||t===void 0?e:{ok:!0,target:{...e.target,syncTimeoutMs:t}}}function Yy(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function Rx(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function Mx(e){if(!e||typeof e!="object")return null;const t=typeof e.providerType=="string"?e.providerType.toLowerCase():"";return t==="hocuspocus"?"hocuspocus":t==="liveblocks"?"liveblocks":t==="superdoc"?"superdoc":e.ydoc!=null||e.provider!=null?"external-ydoc-provider":null}function yk(e,t){const n=wc(t.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:`SuperDoc v2 collaboration requires a non-empty collaboration.documentId for the "${e}" provider.`};const r=t.url??t.serverUrl,o=Ix(r);if(!o)return{ok:!1,reason:"invalid-server-url",message:`SuperDoc v2 collaboration requires a valid ws:// or wss:// URL for the "${e}" provider (received: ${vk(r)}).`};const i=Tx(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?wc(t.token):null,a=qy(t.roomMode);return a?{ok:!0,target:{providerFamily:e,documentId:n,roomMode:a,serverUrl:o,...i?{params:i}:{},...s?{token:s}:{}}}:Yy()}function Lx(e){const t=wc(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty v2Collaboration.adapterId."};const n=wc(e.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:"SuperDoc v2 provider extensions require a non-empty v2Collaboration.documentId."};const r=qy(e.roomMode);if(!r)return Yy();if(Object.prototype.hasOwnProperty.call(e,"providerOptions"))try{structuredClone(e.providerOptions)}catch{return{ok:!1,reason:"invalid-provider-options",message:"SuperDoc v2 provider extension options must be structured-clone-safe."}}const o=typeof e.token=="function"?e.token:wc(e.token);return{ok:!0,target:{providerFamily:"extension",adapterId:t,documentId:n,roomMode:r,...Object.prototype.hasOwnProperty.call(e,"providerOptions")?{providerOptions:e.providerOptions}:{},...o?{token:o}:{}}}}function Dx(e,t){const n=wc(e.documentId??e.roomId);if(!n)return{ok:!1,reason:"invalid-document-id",message:'SuperDoc v2 collaboration requires a non-empty collaboration.documentId (or roomId) for the "liveblocks" provider.'};const r=wc(e.publicApiKey),o=qy(e.roomMode);if(!o)return Yy();const i=e.authEndpoint,s=typeof i=="string"&&i.length>0;if(!r&&!s)return{ok:!1,reason:"missing-auth",message:"SuperDoc v2 Liveblocks collaboration requires exactly one auth mode: a publicApiKey or an authEndpoint. None was provided."};if(r&&s)return{ok:!1,reason:"mixed-auth",message:"SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."};if(r)return{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,publicApiKey:r}};const a=Ex(i,t);return a?{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,authEndpoint:a}}:{ok:!1,reason:"invalid-auth-endpoint",message:"SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."}}function bk(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=gk(e);if(typeof r=="number"&&r>1)return{ok:!1,reason:"unsupported-multi-document",message:`SuperDoc v2 collaboration supports exactly one document per room; received ${r}.`};if(n!=null&&n!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return{ok:!1,reason:"unsupported-document-type",message:"SuperDoc v2 collaboration supports DOCX documents only."};if(!(i!=null&&typeof i=="object")){const u=Mx(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",f=vk(t?.url);return{ok:!1,reason:d,message:u==="external-ydoc-provider"?"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. Provide a collaboration target (e.g. { providerType, documentId, url }) instead.":`SuperDoc v2 collaboration does not accept "${u}" through the legacy modules.collaboration block (server: ${f}). Configure it as a document.collaboration target ({ providerType: "${u}", documentId, ... }) instead.`}}return{ok:!1,reason:"missing-target",message:"SuperDoc v2 collaboration requires a collaboration target ({ documentId, serverUrl } or { providerType, ... }). None was provided."}}const s=i;if(Object.prototype.hasOwnProperty.call(s,"createIfMissing"))return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration createIfMissing has been removed. Use roomMode: "create" for creation or roomMode: "join" for normal opens.'};if(s.ydoc!=null||s.provider!=null)return{ok:!1,reason:"unsupported-legacy-provider",message:"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a collaboration target ({ providerType, documentId, serverUrl | publicApiKey | authEndpoint }) instead."};const a=xx(s.syncTimeoutMs);if(a===null)return{ok:!1,reason:"invalid-sync-timeout",message:"SuperDoc v2 collaboration syncTimeoutMs must be a finite positive number within the JavaScript timer range."};const l=Rx(s);return l===null||l==="y-websocket"?Np(yk("y-websocket",s),a):l==="hocuspocus"?Np(yk("hocuspocus",s),a):l==="liveblocks"?Np(Dx(s,o),a):l==="extension"?Np(Lx(s),a):{ok:!1,reason:"unsupported-provider-family",message:`SuperDoc v2 collaboration does not support the "${l}" provider family. Supported families are y-websocket, hocuspocus, liveblocks, and extension.`}}var _f=(e,t="document")=>{if(!e)return null;if(typeof File=="function"&&e instanceof File)return e;if(typeof Blob=="function"&&e instanceof Blob){if(typeof File=="function"){const n=e.name||t;return new File([e],n,{type:e.type})}return e}return e.originFileObj?_f(e.originFileObj,e.name||t):e.file?_f(e.file,e.name||t):e.raw?_f(e.raw,e.name||t):null},wk=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,Ox=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,bl=e=>{if(ArrayBuffer.isView(e))return Ox?.call(e)==="Uint8Array";if(!wk)return!1;try{return wk.call(e),!0}catch{return!1}},Xy=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},Zy=(e,t)=>new Blob([Xy(e)],{type:t}),Qy=e=>{switch(e.toLowerCase()){case"docx":case Sr:return Sr;case"pdf":case Ea:return Ea;case"html":case Iu:return Iu;default:return e}},Bp=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?Sr:t.endsWith(".pdf")?Ea:t.endsWith(".html")||t.endsWith(".htm")?Iu:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},Px=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",Fx="application/octet-stream",Jy=e=>{if(e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"collaboration")){const n={...e};delete n.collaboration,e={...n,v2Collaboration:gk(e)}}if(bl(e))return{type:Sr,data:Xy(e),name:"document.docx"};const t=_f(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=Bp(n),i=o||Bp(r),s=t.type.toLowerCase()===Fx,a=s&&o?n:r||n||"document",l=s&&i?i:t.type||i||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";let u=t;return s&&i&&typeof File=="function"&&t instanceof File?u=new File([t],a,{type:l,lastModified:t.lastModified}):s&&i&&typeof Blob=="function"&&t instanceof Blob&&(u=new Blob([t],{type:l})),{...e.v2Collaboration!==void 0?{v2Collaboration:e.v2Collaboration}:{},type:l,data:u,name:a}}if(e&&typeof e=="object"&&"data"in e){if(bl(e.data)){const r=Qy(e.type||Bp(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?Xy(e.data):Zy(e.data,r),name:e.name||Px(r)}}const n=_f(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?Qy(e.type):"",o=r||n.type||Bp(n.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document",i=!n.type||!!(r&&n.type!==r);let s=n;return i&&typeof File=="function"&&n instanceof File?s=new File([n],n.name,{type:o,lastModified:n.lastModified}):i&&typeof Blob=="function"&&n instanceof Blob&&(s=new Blob([n],{type:o})),{...e,type:o,data:s,name:e.name||n.name||"document"}}}if(e&&typeof e=="object"&&"url"in e&&typeof e.type=="string"){const n=Qy(e.type);if(n!==e.type)return{...e,type:n}}return e};Ft();function Nx(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?no({...t}):re(t),i=re(null);return jt(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function Bx(e){const t=re(e.itemid),n=re(e.itemicon),r=re(e.itemiconpack),o=re(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=Nx(e,i,re([])),l=re(e.itemtype),u=re(e.itemfieldtype),d=e,f=no({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=re(e.logicrules),g=re(!1),m=no({}),v={SELECT:jx,IMAGEINPUT:zx,CHECKBOXINPUT:Vx};return l.value in v&&Object.assign(m,v[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:re(e.itemformat),logicRules:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function zx(e){return{fontfamily:re(e.fontfamily),iteminputtype:re(e.iteminputtype)}}function jx(e){return{options:re(e.itemoptions)}}function Vx(e){const t=re(e.itemoptions);return t.value&&(t.value=t.value.map(n=>({label:n.itemdisplaylabel,value:n.itemlinkvalue,checked:n.ischecked,id:n.itemid,annotationId:n.annotationId}))),{options:t}}var Bs=()=>new Map,e0=e=>{const t=Bs();return e.forEach((n,r)=>{t.set(r,n)}),t},xu=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},Ux=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},Hx=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Ru=()=>new Set,t0=e=>e[e.length-1],Mu=Array.from,n0=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},Ck=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},$x=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},zp=Array.isArray,Gx=class{constructor(){this._observers=Bs()}on(e,t){return xu(this._observers,e,Ru).add(t),t}once(e,t){const n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){const n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return Mu((this._observers.get(e)||Bs()).values()).forEach(n=>n(...t))}destroy(){this._observers=Bs()}},Ta=Math.floor,jp=Math.abs,kk=(e,t)=>e<t?e:t,Lu=(e,t)=>e>t?e:t,$G=Number.isNaN,Wx=e=>e!==0?e<0:1/e<0,GG=1,WG=2,KG=4,qG=8,YG=32,XG=64,ZG=128,Kx=1<<17,qx=1<<18,Yx=1<<19,Xx=1<<20,Zx=1<<21,Qx=1<<22,Jx=1<<23,e6=1<<24,t6=1<<25,n6=1<<26,r6=1<<27,o6=1<<28,i6=1<<29,s6=1<<30,QG=31,JG=63,eW=127,tW=Kx-1,nW=qx-1,rW=Yx-1,oW=Xx-1,iW=Zx-1,sW=Qx-1,aW=Jx-1,lW=e6-1,cW=t6-1,uW=n6-1,dW=r6-1,fW=o6-1,hW=i6-1,pW=s6-1,mW=2147483647,Sk=Number.MAX_SAFE_INTEGER,_k=Number.MIN_SAFE_INTEGER,a6=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Ta(e)===e),gW=Number.isNaN,vW=Number.parseInt,Ak=String.fromCharCode,yW=String.fromCodePoint,bW=Ak(65535),l6=e=>e.toLowerCase(),c6=/^\s*/g,u6=e=>e.replace(c6,""),d6=/([A-Z])/g,Ik=(e,t)=>u6(e.replace(d6,n=>`${t}${l6(n)}`)),f6=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},Af=typeof TextEncoder<"u"?new TextEncoder:null,h6=e=>Af.encode(e),p6=Af?h6:f6,r0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});r0&&r0.decode(new Uint8Array).length===1&&(r0=null);var m6=(e,t)=>$x(t,()=>e).join(""),If=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},o0=()=>new If,g6=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},xa=e=>{const t=new Uint8Array(g6(e));let n=0;for(let r=0;r<e.bufs.length;r++){const o=e.bufs[r];t.set(o,n),n+=o.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},v6=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Lu(n,t)*2),e.cpos=0)},uo=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},i0=uo,Zn=(e,t)=>{for(;t>127;)uo(e,128|127&t),t=Ta(t/128);uo(e,127&t)},s0=(e,t)=>{const n=Wx(t);for(n&&(t=-t),uo(e,(t>63?128:0)|(n?64:0)|63&t),t=Ta(t/64);t>0;)uo(e,(t>127?128:0)|127&t),t=Ta(t/128)},a0=new Uint8Array(3e4),y6=a0.length/3,b6=(e,t)=>{if(t.length<y6){const n=Af.encodeInto(t,a0).written||0;Zn(e,n);for(let r=0;r<n;r++)uo(e,a0[r])}else bi(e,p6(t))},w6=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Zn(e,r);for(let o=0;o<r;o++)uo(e,n.codePointAt(o))},Du=Af&&Af.encodeInto?b6:w6,l0=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=kk(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Lu(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},bi=(e,t)=>{Zn(e,t.byteLength),l0(e,t)},c0=(e,t)=>{v6(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},C6=(e,t)=>c0(e,4).setFloat32(0,t,!1),k6=(e,t)=>c0(e,8).setFloat64(0,t,!1),S6=(e,t)=>c0(e,8).setBigInt64(0,t,!1),Ek=new DataView(new ArrayBuffer(4)),_6=e=>(Ek.setFloat32(0,e),Ek.getFloat32(0)===e),Ef=(e,t)=>{switch(typeof t){case"string":uo(e,119),Du(e,t);break;case"number":a6(t)&&jp(t)<=2147483647?(uo(e,125),s0(e,t)):_6(t)?(uo(e,124),C6(e,t)):(uo(e,123),k6(e,t));break;case"bigint":uo(e,122),S6(e,t);break;case"object":if(t===null)uo(e,126);else if(zp(t)){uo(e,117),Zn(e,t.length);for(let n=0;n<t.length;n++)Ef(e,t[n])}else if(t instanceof Uint8Array)uo(e,116),bi(e,t);else{uo(e,118);const n=Object.keys(t);Zn(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];Du(e,o),Ef(e,t[o])}}break;case"boolean":uo(e,t?120:121);break;default:uo(e,127)}},Tk=class extends If{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Zn(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},xk=e=>{e.count>0&&(s0(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Zn(e.encoder,e.count-2))},Vp=class{constructor(){this.encoder=new If,this.s=0,this.count=0}write(e){this.s===e?this.count++:(xk(this),this.count=1,this.s=e)}toUint8Array(){return xk(this),xa(this.encoder)}},Rk=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);s0(e.encoder,t),e.count>1&&Zn(e.encoder,e.count-2)}},u0=class{constructor(){this.encoder=new If,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Rk(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Rk(this),xa(this.encoder)}},A6=class{constructor(){this.sarr=[],this.s="",this.lensE=new Vp}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new If;return this.sarr.push(this.s),this.s="",Du(e,this.sarr.join("")),l0(e,this.lensE.toUint8Array()),xa(e)}},wl=e=>new Error(e),us=()=>{throw wl("Method unimplemented")},Ra=()=>{throw wl("Unexpected case")},wW=crypto.subtle,I6=crypto.getRandomValues.bind(crypto),Mk=()=>I6(new Uint32Array(1))[0],E6="10000000-1000-4000-8000-100000000000",T6=()=>E6.replace(/[018]/g,e=>(e^Mk()&15>>e/4).toString(16)),x6=Date.now,Lk=e=>new Promise(e),CW=Promise.all.bind(Promise),Dk=e=>e===void 0?null:e,R6=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},Ok=new R6,M6=!0;try{typeof localStorage<"u"&&localStorage&&(Ok=localStorage,M6=!1)}catch{}var L6=Ok,Tf=Symbol("Equality"),Pk=(e,t)=>e===t||!!e?.[Tf]?.(t)||!1,D6=e=>typeof e=="object",O6=Object.assign,P6=Object.keys,F6=(e,t)=>{for(const n in e)t(e[n],n)},Up=e=>P6(e).length,N6=e=>{for(const t in e)return!1;return!0},xf=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},d0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),B6=(e,t)=>e===t||Up(e)===Up(t)&&xf(e,(n,r)=>(n!==void 0||d0(t,r))&&Pk(t[r],n)),z6=Object.freeze,Fk=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&Fk(e[t])}return z6(e)},f0=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&f0(e,t,n+1)}},Hp=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[Tf]!=null)return e[Tf](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(const n of e.keys())if(!t.has(n)||!Hp(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Up(e)!==Up(t))return!1;for(const n in e)if(!d0(e,n)||!Hp(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Hp(e[n],t[n]))return!1;break;default:return!1}return!0},j6=(e,t)=>t.includes(e),Rf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",kW=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,zs,V6=[],U6=()=>{if(zs===void 0)if(Rf){zs=Bs();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&zs.set(t,""),t=r):t!==null?(zs.set(t,r),t=null):V6.push(r)}t!==null&&zs.set(t,"")}else typeof location=="object"?(zs=Bs(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");zs.set(`--${Ik(t,"-")}`,n),zs.set(`-${Ik(t,"-")}`,n)}})):zs=Bs();return zs},h0=e=>U6().has(e),$p=e=>Dk(Rf?process.env[e.toUpperCase().replaceAll("-","_")]:L6.getItem(e)),Nk=e=>h0("--"+e)||$p(e)!==null,H6=Nk("production"),$6=Rf&&j6(process.env.FORCE_COLOR,["true","1","2"]),G6=$6||!h0("--no-colors")&&!Nk("no-color")&&(!Rf||process.stdout.isTTY)&&(!Rf||h0("--color")||$p("COLORTERM")!==null||($p("TERM")||"").includes("color")),W6=class{constructor(e,t){this.left=e,this.right=t}},Ma=(e,t)=>new W6(e,t),Bk=e=>e.next()>=.5,p0=(e,t,n)=>Ta(e.next()*(n+1-t)+t),zk=(e,t,n)=>Ta(e.next()*(n+1-t)+t),m0=(e,t,n)=>zk(e,t,n),K6=e=>Ak(m0(e,97,122)),q6=(e,t=0,n=20)=>{const r=m0(e,t,n);let o="";for(let i=0;i<r;i++)o+=K6(e);return o},g0=(e,t)=>t[m0(e,0,t.length-1)],Y6=Symbol("0schema"),X6=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const n=this._rerrs[t];e.push(m6(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
3
|
+
`)&&(Jh(C,0)||pc(),C.textContent=w.children)}if(j){if($||!W||Z&48){const Q=C.tagName.includes("-");for(const Y in j)($&&(Y.endsWith("value")||Y==="indeterminate")||ou(Y)&&!sl(Y)||Y[0]==="."||Q&&!sl(Y))&&r(C,Y,null,j[Y],void 0,T)}else if(j.onClick)r(C,"onClick",null,j.onClick,void 0,T);else if(Z&4&&Fi(j.style))for(const Q in j.style)j.style[Q]}let J;(J=j&&j.onVnodeBeforeMount)&&oi(J,T,w),K&&Rs(w,null,T,"beforeMount"),((J=j&&j.onVnodeMounted)||K||H)&&Sw(()=>{J&&oi(J,T,w),H&&x.enter(C),K&&Rs(w,null,T,"mounted")},L)}return C.nextSibling},g=(C,w,T,L,z,W,V)=>{V=V||!!w.dynamicChildren;const j=w.children,Z=j.length;for(let R=0;R<Z;R++){const K=V?j[R]:j[R]=ri(j[R]),x=K.type===Sa;C?(x&&!V&&R+1<Z&&ri(j[R+1]).type===Sa&&(l(o(C.data.slice(K.children.length)),T,i(C)),C.data=K.children),C=f(C,K,L,z,W,V)):x&&!K.children?l(K.el=o(""),T):(Jh(T,1)||pc(),n(null,K,T,null,L,z,hf(T),W))}return C},m=(C,w,T,L,z,W)=>{const{slotScopeIds:V}=w;V&&(z=z?z.concat(V):V);const j=s(C),Z=g(i(C),w,j,T,L,z,W);return Z&&mc(Z)&&Z.data==="]"?i(w.anchor=Z):(pc(),l(w.anchor=u("]"),j,Z),Z)},v=(C,w,T,L,z,W)=>{if(Jh(C.parentElement,1)||pc(),w.el=null,W){const Z=k(C);for(;;){const R=i(C);if(R&&R!==Z)a(R);else break}}const V=i(C),j=s(C);return a(C),n(null,w,j,V,T,L,hf(j),z),T&&(T.vnode.el=w.el,sp(T,w.el)),V},k=(C,w="[",T="]")=>{let L=0;for(;C;)if(C=i(C),C&&mc(C)&&(C.data===w&&L++,C.data===T)){if(L===0)return i(C);L--}return C},b=(C,w,T)=>{const L=w.parentNode;L&&L.replaceChild(C,w);let z=T;for(;z;)z.vnode.el===w&&(z.vnode.el=z.subTree.el=C),z=z.parent},S=C=>C.nodeType===1&&C.tagName==="TEMPLATE";return[d,f]}function Jh(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(Kv);)e=e.parentElement;const n=e&&e.getAttribute(Kv);if(n==null)return!1;if(n==="")return!0;{const r=n.split(",");return t===0&&r.includes("children")?!0:r.includes(Vw[t])}}function zT(e){const{top:t,left:n,bottom:r,right:o}=e.getBoundingClientRect(),{innerHeight:i,innerWidth:s}=window;return(t>0&&t<i||r>0&&r<i)&&(n>0&&n<s||o>0&&o<s)}function jT(e,t){if(mc(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(mc(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function X1(e){Zt(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:i,timeout:s,suspensible:a=!0,onError:l}=e;let u=null,d,f=0;const p=()=>(f++,u=null,g()),g=()=>{let m;return u||(m=u=t().catch(v=>{if(v=v instanceof Error?v:new Error(String(v)),l)return new Promise((k,b)=>{l(v,()=>k(p()),()=>b(v),f+1)});throw v}).then(v=>m!==u&&u?u:(v&&(v.__esModule||v[Symbol.toStringTag]==="Module")&&(v=v.default),d=v,v)))};return uc({name:"AsyncComponentWrapper",__asyncLoader:g,__asyncHydrate(m,v,k){let b=!1;(v.bu||(v.bu=[])).push(()=>b=!0);const S=()=>{b||k()},C=i?()=>{const w=i(S,T=>jT(m,T));w&&(v.bum||(v.bum=[])).push(w)}:S;d?C():g().then(()=>!v.isUnmounted&&C())},get __asyncResolved(){return d},setup(){const m=co;if(Cv(m),d)return()=>ep(d,m);const v=C=>{u=null,cc(C,m,13,!r)};if(a&&m.suspense||ml)return g().then(C=>()=>ep(C,m)).catch(C=>(v(C),()=>r?Xt(r,{error:C}):null));const k=re(!1),b=re(),S=re(!!o);return o&&setTimeout(()=>{S.value=!1},o),s!=null&&setTimeout(()=>{if(!k.value&&!b.value){const C=new Error(`Async component timed out after ${s}ms.`);v(C),b.value=C}},s),g().then(()=>{k.value=!0,m.parent&&bu(m.parent.vnode)&&m.parent.update()}).catch(C=>{v(C),b.value=C}),()=>{if(k.value&&d)return ep(d,m);if(b.value&&r)return Xt(r,{error:b.value});if(n&&!S.value)return ep(n,m)}}})}function ep(e,t){const{ref:n,props:r,children:o,ce:i}=t.vnode,s=Xt(e,r,o);return s.ref=n,s.ce=i,delete t.vnode.ce,s}function nf(e,t){return zt(e)?e.some(n=>nf(n,t)):Xn(e)?e.split(",").includes(t):K2(e)?(e.lastIndex=0,e.test(t)):!1}function kv(e,t){Z1(e,"a",t)}function Sv(e,t){Z1(e,"da",t)}function Z1(e,t,n=co){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(np(t,r,n),n){let o=n.parent;for(;o&&o.parent;)bu(o.parent.vnode)&&VT(r,t,n,o),o=o.parent}}function VT(e,t,n,r){const o=np(t,e,r,!0);mf(()=>{Bh(r[t],o)},n)}function _v(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function tp(e){return e.shapeFlag&128?e.ssContent:e}function np(e,t,n=co,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{fa();const a=gc(n),l=zi(t,n,e,s);return a(),ha(),l});return r?o.unshift(i):o.push(i),i}}function Q1(e,t=co){np("ec",e,t)}function UT(e,t){return Iv(dp,e,!0,t)||e}function Av(e){return Xn(e)?Iv(dp,e,!1)||e:e||Qv}function J1(e){return Iv(Yw,e)}function Iv(e,t,n=!0,r=!1){const o=lo||co;if(o){const i=o.type;if(e===dp){const a=Pv(i,!1);if(a&&(a===t||a===Nr(t)||a===iu(Nr(t))))return i}const s=ew(o[e]||i[e],t)||ew(o.appContext[e],t);return!s&&r?i:s}}function ew(e,t){return e&&(e[t]||e[Nr(t)]||e[iu(Nr(t))])}function ir(e,t,n,r){let o;const i=n&&n[r],s=zt(e);if(s||Xn(e)){const a=s&&Fi(e);let l=!1,u=!1;a&&(l=!ni(e),u=xs(e),e=Vh(e)),o=new Array(e.length);for(let d=0,f=e.length;d<f;d++)o[d]=t(l?u?lc(Bi(e[d])):Bi(e[d]):e[d],d,void 0,i&&i[d])}else if(typeof e=="number"){o=new Array(e);for(let a=0;a<e;a++)o[a]=t(a+1,a,void 0,i&&i[a])}else if(Fn(e))if(e[Symbol.iterator])o=Array.from(e,(a,l)=>t(a,l,void 0,i&&i[l]));else{const a=Object.keys(e);o=new Array(a.length);for(let l=0,u=a.length;l<u;l++){const d=a[l];o[l]=t(e[d],d,l,i&&i[l])}}else o=[];return n&&(n[r]=o),o}function HT(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(zt(r))for(let o=0;o<r.length;o++)e[r[o].name]=r[o].fn;else r&&(e[r.name]=r.key?(...o)=>{const i=r.fn(...o);return i&&(i.key=r.key),i}:r.fn)}return e}function pu(e,t,n={},r,o){if(lo.ce||lo.parent&&Ds(lo.parent)&&lo.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),ye(),an(Kt,null,[Xt("slot",n,r&&r())],u?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),ye();const s=i&&Ev(i(n)),a=n.key||s&&s.key,l=an(Kt,{key:(a&&!ti(a)?a:`_${t}`)+(!s&&r?"_fb":"")},s||(r?r():[]),s&&e._===1?64:-2);return!o&&l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),i&&i._c&&(i._d=!0),l}function Ev(e){return e.some(t=>wa(t)?!(t.type===Rr||t.type===Kt&&!Ev(t.children)):!0)?e:null}function $T(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:su(r)]=e[r];return n}function GT(){return null}function WT(){return null}function KT(e){}function qT(e){}function YT(){return null}function XT(){}function ZT(e,t){return null}function tw(){return rw("useSlots").slots}function nw(){return rw("useAttrs").attrs}function rw(e){const t=pr();return t.setupContext||(t.setupContext=Mw(t))}function rf(e){return zt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function QT(e,t){const n=rf(e);for(const r in t){if(r.startsWith("__skip"))continue;let o=n[r];o?zt(o)||Zt(o)?o=n[r]={type:o,default:t[r]}:o.default=t[r]:o===null&&(o=n[r]={default:t[r]}),o&&t[`__skip_${r}`]&&(o.skipFactory=!0)}return n}function JT(e,t){return!e||!t?e||t:zt(e)&&zt(t)?e.concat(t):Gn({},rf(e),rf(t))}function ex(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function tx(e){const t=pr(),n=ml;let r=e();Su(),n&&ku(!1);const o=()=>{gc(t),n&&ku(!0)},i=()=>{pr()!==t&&t.scope.off(),Su(),n&&ku(!1)};return zh(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function nx(e){const t=Tv(e),n=e.proxy,r=e.ctx;mp=!1,t.beforeCreate&&ow(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:u,created:d,beforeMount:f,mounted:p,beforeUpdate:g,updated:m,activated:v,deactivated:k,beforeDestroy:b,beforeUnmount:S,destroyed:C,unmounted:w,render:T,renderTracked:L,renderTriggered:z,errorCaptured:W,serverPrefetch:V,expose:j,inheritAttrs:Z,components:R,directives:K,filters:x}=t;if(u&&rx(u,r,null),s)for(const J in s){const Q=s[J];Zt(Q)&&(r[J]=Q.bind(n))}if(o){const J=o.call(n,n);Fn(J)&&(e.data=no(J))}if(mp=!0,i)for(const J in i){const Q=i[J],Y=Zt(Q)?Q.bind(n,n):Zt(Q.get)?Q.get.bind(n,n):gi,_e=!Zt(Q)&&Zt(Q.set)?Q.set.bind(n):gi,ue=ke({get:Y,set:_e});Object.defineProperty(r,J,{enumerable:!0,configurable:!0,get:()=>ue.value,set:ve=>ue.value=ve})}if(a)for(const J in a)iw(a[J],r,n,J);if(l){const J=Zt(l)?l.call(n):l;Reflect.ownKeys(J).forEach(Q=>{V1(Q,J[Q])})}d&&ow(d,e,"c");function H(J,Q){zt(Q)?Q.forEach(Y=>J(Y.bind(n))):Q&&J(Q.bind(n))}if(H(qv,f),H(Nn,p),H(up,g),H(pf,m),H(kv,v),H(Sv,k),H(Q1,W),H(Zv,L),H(Xv,z),H(cr,S),H(mf,w),H(Yv,V),zt(j))if(j.length){const J=e.exposed||(e.exposed={});j.forEach(Q=>{Object.defineProperty(J,Q,{get:()=>n[Q],set:Y=>n[Q]=Y,enumerable:!0})})}else e.exposed||(e.exposed={});T&&e.render===gi&&(e.render=T),Z!=null&&(e.inheritAttrs=Z),R&&(e.components=R),K&&(e.directives=K),V&&Cv(e)}function rx(e,t,n=gi){zt(e)&&(e=xv(e));for(const r in e){const o=e[r];let i;Fn(o)?"default"in o?i=ll(o.from||r,o.default,!0):i=ll(o.from||r):i=ll(o),lr(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function ow(e,t,n){zi(zt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function iw(e,t,n,r){let o=r.includes(".")?$1(n,r):()=>n[r];if(Xn(e)){const i=t[e];Zt(i)&&jt(o,i)}else if(Zt(e))jt(o,e.bind(n));else if(Fn(e))if(zt(e))e.forEach(i=>iw(i,t,n,r));else{const i=Zt(e.handler)?e.handler.bind(n):t[e.handler];Zt(i)&&jt(o,i,e)}}function Tv(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:i,config:{optionMergeStrategies:s}}=e.appContext,a=i.get(t);let l;return a?l=a:!o.length&&!n&&!r?l=t:(l={},o.length&&o.forEach(u=>rp(l,u,s,!0)),rp(l,t,s)),Fn(t)&&i.set(t,l),l}function rp(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&rp(e,i,n,!0),o&&o.forEach(s=>rp(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=Zw[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function sw(e,t){return t?e?function(){return Gn(Zt(e)?e.call(this,this):e,Zt(t)?t.call(this,this):t)}:t:e}function ox(e,t){return of(xv(e),xv(t))}function xv(e){if(zt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Uo(e,t){return e?[...new Set([].concat(e,t))]:t}function of(e,t){return e?Gn(Object.create(null),e,t):t}function aw(e,t){return e?zt(e)&&zt(t)?[...new Set([...e,...t])]:Gn(Object.create(null),rf(e),rf(t??{})):t}function ix(e,t){if(!e)return t;if(!t)return e;const n=Gn(Object.create(null),e);for(const r in t)n[r]=Uo(e[r],t[r]);return n}function lw(){return{app:null,config:{isNativeTag:Hg,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}function sx(e,t){return function(r,o=null){Zt(r)||(r=Gn({},r)),o!=null&&!Fn(o)&&(o=null);const i=lw(),s=new WeakSet,a=[];let l=!1;const u=i.app={_uid:Qw++,_component:r,_props:o,_container:null,_context:i,_instance:null,version:ly,get config(){return i.config},set config(d){},use(d,...f){return s.has(d)||(d&&Zt(d.install)?(s.add(d),d.install(u,...f)):Zt(d)&&(s.add(d),d(u,...f))),u},mixin(d){return i.mixins.includes(d)||i.mixins.push(d),u},component(d,f){return f?(i.components[d]=f,u):i.components[d]},directive(d,f){return f?(i.directives[d]=f,u):i.directives[d]},mount(d,f,p){if(!l){const g=u._ceVNode||Xt(r,o);return g.appContext=i,p===!0?p="svg":p===!1&&(p=void 0),f&&t?t(g,d):e(g,d,p),l=!0,u._container=d,d.__vue_app__=u,lf(g.component)}},onUnmount(d){a.push(d)},unmount(){l&&(zi(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(d,f){return i.provides[d]=f,u},runWithContext(d){const f=fl;fl=u;try{return d()}finally{fl=f}}};return u}}function ax(e,t,n=Dn){const r=pr(),o=Nr(t),i=Vo(t),s=Jv(e,o),a=h1((l,u)=>{let d,f=Dn,p;return H1(()=>{const g=e[o];so(d,g)&&(d=g,u())}),{get(){return l(),n.get?n.get(d):d},set(g){const m=n.set?n.set(g):g;if(!so(m,d)&&!(f!==Dn&&so(g,f)))return;const v=r.vnode.props;v&&(t in v||o in v||i in v)&&(`onUpdate:${t}`in v||`onUpdate:${o}`in v||`onUpdate:${i}`in v)||(d=g,u()),r.emit(`update:${t}`,m),so(g,m)&&so(g,f)&&!so(m,p)&&u(),f=g,p=m}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||Dn:a,done:!1}:{done:!0}}}},a}function lx(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Dn;let o=n;const i=t.startsWith("update:"),s=i&&Jv(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>Xn(d)?d.trim():d)),s.number&&(o=n.map(jd)));let a,l=r[a=su(t)]||r[a=su(Nr(t))];!l&&i&&(l=r[a=su(Vo(t))]),l&&zi(l,e,6,o);const u=r[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,zi(u,e,6,o)}}function cw(e,t,n=!1){const r=n?Jw:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const i=e.emits;let s={},a=!1;if(!Zt(e)){const l=u=>{const d=cw(u,t,!0);d&&(a=!0,Gn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(Fn(e)&&r.set(e,null),null):(zt(i)?i.forEach(l=>s[l]=null):Gn(s,i),Fn(e)&&r.set(e,s),s)}function op(e,t){return!e||!ou(t)?!1:(t=t.slice(2).replace(/Once$/,""),jn(e,t[0].toLowerCase()+t.slice(1))||jn(e,Vo(t))||jn(e,t))}function ip(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:u,renderCache:d,props:f,data:p,setupState:g,ctx:m,inheritAttrs:v}=e,k=Jd(e);let b,S;try{if(n.shapeFlag&4){const w=o||r,T=w;b=ri(u.call(T,w,d,f,g,p,m)),S=a}else{const w=t;b=ri(w.length>1?w(f,{attrs:a,slots:s,emit:l}):w(f,null)),S=t.props?a:eC(a)}}catch(w){Cu.length=0,cc(w,e,1),b=Xt(Rr)}let C=b;if(S&&v!==!1){const w=Object.keys(S),{shapeFlag:T}=C;w.length&&T&7&&(i&&w.some(Fd)&&(S=tC(S,i)),C=Ms(C,S,!1,!0))}return n.dirs&&(C=Ms(C,null,!1,!0),C.dirs=C.dirs?C.dirs.concat(n.dirs):n.dirs),n.transition&&ba(C,n.transition),b=C,Jd(k),b}function cx(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(wa(o)){if(o.type!==Rr||o.children==="v-if"){if(n)return;n=o}}else return}return n}function ux(e,t,n){const{props:r,children:o,component:i}=e,{props:s,children:a,patchFlag:l}=t,u=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?uw(r,s,u):!!s;if(l&8){const d=t.dynamicProps;for(let f=0;f<d.length;f++){const p=d[f];if(dw(s,r,p)&&!op(u,p))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?uw(r,s,u):!0:!!s;return!1}function uw(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const i=r[o];if(dw(t,e,i)&&!op(n,i))return!0}return!1}function dw(e,t,n){const r=e[n],o=t[n];return n==="style"&&Fn(r)&&Fn(o)?!da(r,o):r!==o}function sp({vnode:e,parent:t,suspense:n},r){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=r,e=o),o===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}function dx(e,t,n,r=!1){const o={},i=ty();e.propsDefaults=Object.create(null),fw(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:d1(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function fx(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=pn(o),[l]=e.propsOptions;let u=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let f=0;f<d.length;f++){let p=d[f];if(op(e.emitsOptions,p))continue;const g=t[p];if(l)if(jn(i,p))g!==i[p]&&(i[p]=g,u=!0);else{const m=Nr(p);o[m]=Rv(l,a,m,g,e,!1)}else g!==i[p]&&(i[p]=g,u=!0)}}}else{fw(e,t,o,i)&&(u=!0);let d;for(const f in a)(!t||!jn(t,f)&&((d=Vo(f))===f||!jn(t,d)))&&(l?n&&(n[f]!==void 0||n[d]!==void 0)&&(o[f]=Rv(l,a,f,void 0,e,!0)):delete o[f]);if(i!==a)for(const f in i)(!t||!jn(t,f))&&(delete i[f],u=!0)}u&&pa(e.attrs,"set","")}function fw(e,t,n,r){const[o,i]=e.propsOptions;let s=!1,a;if(t)for(let l in t){if(sl(l))continue;const u=t[l];let d;o&&jn(o,d=Nr(l))?!i||!i.includes(d)?n[d]=u:(a||(a={}))[d]=u:op(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(i){const l=pn(n),u=a||Dn;for(let d=0;d<i.length;d++){const f=i[d];n[f]=Rv(o,l,f,u[f],e,!jn(u,f))}}return s}function Rv(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=jn(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&Zt(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const d=gc(o);r=u[n]=l.call(null,t),d()}}else r=l;o.ce&&o.ce._setProp(n,r)}s[0]&&(i&&!a?r=!1:s[1]&&(r===""||r===Vo(n))&&(r=!0))}return r}function hw(e,t,n=!1){const r=n?nC:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(!Zt(e)){const d=f=>{l=!0;const[p,g]=hw(f,t,!0);Gn(s,p),g&&a.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!i&&!l)return Fn(e)&&r.set(e,oc),oc;if(zt(i))for(let d=0;d<i.length;d++){const f=Nr(i[d]);pw(f)&&(s[f]=Dn)}else if(i)for(const d in i){const f=Nr(d);if(pw(f)){const p=i[d],g=s[f]=zt(p)||Zt(p)?{type:p}:Gn({},p),m=g.type;let v=!1,k=!0;if(zt(m))for(let b=0;b<m.length;++b){const S=m[b],C=Zt(S)&&S.name;if(C==="Boolean"){v=!0;break}else C==="String"&&(k=!1)}else v=Zt(m)&&m.name==="Boolean";g[0]=v,g[1]=k,(v||jn(g,"default"))&&a.push(f)}}const u=[s,a];return Fn(e)&&r.set(e,u),u}function pw(e){return e[0]!=="$"&&!sl(e)}function mw(e){return vw(e)}function gw(e){return vw(e,BT)}function vw(e,t){const n=Ud();n.__VUE__=!0;const{insert:r,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:u,setElementText:d,parentNode:f,nextSibling:p,setScopeId:g=gi,insertStaticContent:m}=e,v=(ie,I,se,F=null,q=null,P=null,ee=void 0,be=null,N=!!I.dynamicChildren)=>{if(ie===I)return;ie&&!ss(ie,I)&&(F=ct(ie),ve(ie,q,P,!0),ie=null),I.patchFlag===-2&&(N=!1,I.dynamicChildren=null);const{type:B,ref:de,shapeFlag:Se}=I;switch(B){case Sa:k(ie,I,se,F);break;case Rr:b(ie,I,se,F);break;case hl:ie==null&&S(I,se,F,ee);break;case Kt:R(ie,I,se,F,q,P,ee,be,N);break;default:Se&1?T(ie,I,se,F,q,P,ee,be,N):Se&6?K(ie,I,se,F,q,P,ee,be,N):(Se&64||Se&128)&&B.process(ie,I,se,F,q,P,ee,be,N,ae)}de!=null&&q?hu(de,ie&&ie.ref,P,I||ie,!I):de==null&&ie&&ie.ref!=null&&hu(ie.ref,null,P,ie,!0)},k=(ie,I,se,F)=>{if(ie==null)r(I.el=a(I.children),se,F);else{const q=I.el=ie.el;I.children!==ie.children&&u(q,I.children)}},b=(ie,I,se,F)=>{ie==null?r(I.el=l(I.children||""),se,F):I.el=ie.el},S=(ie,I,se,F)=>{[ie.el,ie.anchor]=m(ie.children,I,se,F,ie.el,ie.anchor)},C=({el:ie,anchor:I},se,F)=>{let q;for(;ie&&ie!==I;)q=p(ie),r(ie,se,F),ie=q;r(I,se,F)},w=({el:ie,anchor:I})=>{let se;for(;ie&&ie!==I;)se=p(ie),o(ie),ie=se;o(I)},T=(ie,I,se,F,q,P,ee,be,N)=>{if(I.type==="svg"?ee="svg":I.type==="math"&&(ee="mathml"),ie==null)L(I,se,F,q,P,ee,be,N);else{const B=ie.el&&ie.el._isVueCE?ie.el:null;try{B&&B._beginPatch(),V(ie,I,q,P,ee,be,N)}finally{B&&B._endPatch()}}},L=(ie,I,se,F,q,P,ee,be)=>{let N,B;const{props:de,shapeFlag:Se,transition:Ae,dirs:Le}=ie;if(N=ie.el=s(ie.type,P,de&&de.is,de),Se&8?d(N,ie.children):Se&16&&W(ie.children,N,null,F,q,Mv(ie,P),ee,be),Le&&Rs(ie,null,F,"created"),z(N,ie,ie.scopeId,ee,F),de){for(const it in de)it!=="value"&&!sl(it)&&i(N,it,null,de[it],P,F);"value"in de&&i(N,"value",null,de.value,P),(B=de.onVnodeBeforeMount)&&oi(B,F,ie)}Le&&Rs(ie,null,F,"beforeMount");const Xe=yw(q,Ae);Xe&&Ae.beforeEnter(N),r(N,I,se),((B=de&&de.onVnodeMounted)||Xe||Le)&&jr(()=>{B&&oi(B,F,ie),Xe&&Ae.enter(N),Le&&Rs(ie,null,F,"mounted")},q)},z=(ie,I,se,F,q)=>{if(se&&g(ie,se),F)for(let P=0;P<F.length;P++)g(ie,F[P]);if(q){let P=q.subTree;if(I===P||gf(P.type)&&(P.ssContent===I||P.ssFallback===I)){const ee=q.vnode;z(ie,ee,ee.scopeId,ee.slotScopeIds,q.parent)}}},W=(ie,I,se,F,q,P,ee,be,N=0)=>{for(let B=N;B<ie.length;B++){const de=ie[B]=be?Ca(ie[B]):ri(ie[B]);v(null,de,I,se,F,q,P,ee,be)}},V=(ie,I,se,F,q,P,ee)=>{const be=I.el=ie.el;let{patchFlag:N,dynamicChildren:B,dirs:de}=I;N|=ie.patchFlag&16;const Se=ie.props||Dn,Ae=I.props||Dn;let Le;if(se&&dc(se,!1),(Le=Ae.onVnodeBeforeUpdate)&&oi(Le,se,I,ie),de&&Rs(I,ie,se,"beforeUpdate"),se&&dc(se,!0),(Se.innerHTML&&Ae.innerHTML==null||Se.textContent&&Ae.textContent==null)&&d(be,""),B?j(ie.dynamicChildren,B,be,se,F,Mv(I,q),P):ee||Q(ie,I,be,null,se,F,Mv(I,q),P,!1),N>0){if(N&16)Z(be,Se,Ae,se,q);else if(N&2&&Se.class!==Ae.class&&i(be,"class",null,Ae.class,q),N&4&&i(be,"style",Se.style,Ae.style,q),N&8){const Xe=I.dynamicProps;for(let it=0;it<Xe.length;it++){const yt=Xe[it],Mt=Se[yt],Lt=Ae[yt];(Lt!==Mt||yt==="value")&&i(be,yt,Mt,Lt,q,se)}}N&1&&ie.children!==I.children&&d(be,I.children)}else!ee&&B==null&&Z(be,Se,Ae,se,q);((Le=Ae.onVnodeUpdated)||de)&&jr(()=>{Le&&oi(Le,se,I,ie),de&&Rs(I,ie,se,"updated")},F)},j=(ie,I,se,F,q,P,ee)=>{for(let be=0;be<I.length;be++){const N=ie[be],B=I[be],de=N.el&&(N.type===Kt||!ss(N,B)||N.shapeFlag&198)?f(N.el):se;v(N,B,de,null,F,q,P,ee,!0)}},Z=(ie,I,se,F,q)=>{if(I!==se){if(I!==Dn)for(const P in I)!sl(P)&&!(P in se)&&i(ie,P,I[P],null,q,F);for(const P in se){if(sl(P))continue;const ee=se[P],be=I[P];ee!==be&&P!=="value"&&i(ie,P,be,ee,q,F)}"value"in se&&i(ie,"value",I.value,se.value,q)}},R=(ie,I,se,F,q,P,ee,be,N)=>{const B=I.el=ie?ie.el:a(""),de=I.anchor=ie?ie.anchor:a("");let{patchFlag:Se,dynamicChildren:Ae,slotScopeIds:Le}=I;Le&&(be=be?be.concat(Le):Le),ie==null?(r(B,se,F),r(de,se,F),W(I.children||[],se,de,q,P,ee,be,N)):Se>0&&Se&64&&Ae&&ie.dynamicChildren&&ie.dynamicChildren.length===Ae.length?(j(ie.dynamicChildren,Ae,se,q,P,ee,be),(I.key!=null||q&&I===q.subTree)&&Lv(ie,I,!0)):Q(ie,I,se,de,q,P,ee,be,N)},K=(ie,I,se,F,q,P,ee,be,N)=>{I.slotScopeIds=be,ie==null?I.shapeFlag&512?q.ctx.activate(I,se,F,ee,N):x(I,se,F,q,P,ee,N):$(ie,I,N)},x=(ie,I,se,F,q,P,ee)=>{const be=ie.component=Ew(ie,F,q);if(bu(ie)&&(be.ctx.renderer=ae),xw(be,!1,ee),be.asyncDep){if(q&&q.registerDep(be,H,ee),!ie.el){const N=be.subTree=Xt(Rr);b(null,N,I,se),ie.placeholder=N.el}}else H(be,ie,I,se,q,P,ee)},$=(ie,I,se)=>{const F=I.component=ie.component;if(ux(ie,I,se))if(F.asyncDep&&!F.asyncResolved){J(F,I,se);return}else F.next=I,F.update();else I.el=ie.el,F.vnode=I},H=(ie,I,se,F,q,P,ee)=>{const be=()=>{if(ie.isMounted){let{next:Se,bu:Ae,u:Le,parent:Xe,vnode:it}=ie;{const Be=bw(ie);if(Be){Se&&(Se.el=it.el,J(ie,Se,ee)),Be.asyncDep.then(()=>{jr(()=>{ie.isUnmounted||B()},q)});return}}let yt=Se,Mt;dc(ie,!1),Se?(Se.el=it.el,J(ie,Se,ee)):Se=it,Ae&&ac(Ae),(Mt=Se.props&&Se.props.onVnodeBeforeUpdate)&&oi(Mt,Xe,Se,it),dc(ie,!0);const Lt=ip(ie),Wt=ie.subTree;ie.subTree=Lt,v(Wt,Lt,f(Wt.el),ct(Wt),ie,q,P),Se.el=Lt.el,yt===null&&sp(ie,Lt.el),Le&&jr(Le,q),(Mt=Se.props&&Se.props.onVnodeUpdated)&&jr(()=>oi(Mt,Xe,Se,it),q)}else{let Se;const{el:Ae,props:Le}=I,{bm:Xe,m:it,parent:yt,root:Mt,type:Lt}=ie,Wt=Ds(I);if(dc(ie,!1),Xe&&ac(Xe),!Wt&&(Se=Le&&Le.onVnodeBeforeMount)&&oi(Se,yt,I),dc(ie,!0),Ae&&Ue){const Be=()=>{ie.subTree=ip(ie),Ue(Ae,ie.subTree,ie,q,null)};Wt&&Lt.__asyncHydrate?Lt.__asyncHydrate(Ae,ie,Be):Be()}else{Mt.ce&&Mt.ce._hasShadowRoot()&&Mt.ce._injectChildStyle(Lt,ie.parent?ie.parent.type:void 0);const Be=ie.subTree=ip(ie);v(null,Be,se,F,ie,q,P),I.el=Be.el}if(it&&jr(it,q),!Wt&&(Se=Le&&Le.onVnodeMounted)){const Be=I;jr(()=>oi(Se,yt,Be),q)}(I.shapeFlag&256||yt&&Ds(yt.vnode)&&yt.vnode.shapeFlag&256)&&ie.a&&jr(ie.a,q),ie.isMounted=!0,I=se=F=null}};ie.scope.on();const N=ie.effect=new lu(be);ie.scope.off();const B=ie.update=N.run.bind(N),de=ie.job=N.runIfDirty.bind(N);de.i=ie,de.id=ie.uid,N.scheduler=()=>vv(de),dc(ie,!0),B()},J=(ie,I,se)=>{I.component=ie;const F=ie.vnode.props;ie.vnode=I,ie.next=null,fx(ie,I.props,F,se),iC(ie,I.children,se),fa(),B1(ie),ha()},Q=(ie,I,se,F,q,P,ee,be,N=!1)=>{const B=ie&&ie.children,de=ie?ie.shapeFlag:0,Se=I.children,{patchFlag:Ae,shapeFlag:Le}=I;if(Ae>0){if(Ae&128){_e(B,Se,se,F,q,P,ee,be,N);return}else if(Ae&256){Y(B,Se,se,F,q,P,ee,be,N);return}}Le&8?(de&16&&Je(B,q,P),Se!==B&&d(se,Se)):de&16?Le&16?_e(B,Se,se,F,q,P,ee,be,N):Je(B,q,P,!0):(de&8&&d(se,""),Le&16&&W(Se,se,F,q,P,ee,be,N))},Y=(ie,I,se,F,q,P,ee,be,N)=>{ie=ie||oc,I=I||oc;const B=ie.length,de=I.length,Se=Math.min(B,de);let Ae;for(Ae=0;Ae<Se;Ae++){const Le=I[Ae]=N?Ca(I[Ae]):ri(I[Ae]);v(ie[Ae],Le,se,null,q,P,ee,be,N)}B>de?Je(ie,q,P,!0,!1,Se):W(I,se,F,q,P,ee,be,N,Se)},_e=(ie,I,se,F,q,P,ee,be,N)=>{let B=0;const de=I.length;let Se=ie.length-1,Ae=de-1;for(;B<=Se&&B<=Ae;){const Le=ie[B],Xe=I[B]=N?Ca(I[B]):ri(I[B]);if(ss(Le,Xe))v(Le,Xe,se,null,q,P,ee,be,N);else break;B++}for(;B<=Se&&B<=Ae;){const Le=ie[Se],Xe=I[Ae]=N?Ca(I[Ae]):ri(I[Ae]);if(ss(Le,Xe))v(Le,Xe,se,null,q,P,ee,be,N);else break;Se--,Ae--}if(B>Se){if(B<=Ae){const Le=Ae+1,Xe=Le<de?I[Le].el:F;for(;B<=Ae;)v(null,I[B]=N?Ca(I[B]):ri(I[B]),se,Xe,q,P,ee,be,N),B++}}else if(B>Ae)for(;B<=Se;)ve(ie[B],q,P,!0),B++;else{const Le=B,Xe=B,it=new Map;for(B=Xe;B<=Ae;B++){const Ht=I[B]=N?Ca(I[B]):ri(I[B]);Ht.key!=null&&it.set(Ht.key,B)}let yt,Mt=0;const Lt=Ae-Xe+1;let Wt=!1,Be=0;const rn=new Array(Lt);for(B=0;B<Lt;B++)rn[B]=0;for(B=Le;B<=Se;B++){const Ht=ie[B];if(Mt>=Lt){ve(Ht,q,P,!0);continue}let xn;if(Ht.key!=null)xn=it.get(Ht.key);else for(yt=Xe;yt<=Ae;yt++)if(rn[yt-Xe]===0&&ss(Ht,I[yt])){xn=yt;break}xn===void 0?ve(Ht,q,P,!0):(rn[xn-Xe]=B+1,xn>=Be?Be=xn:Wt=!0,v(Ht,I[xn],se,null,q,P,ee,be,N),Mt++)}const zn=Wt?hx(rn):oc;for(yt=zn.length-1,B=Lt-1;B>=0;B--){const Ht=Xe+B,xn=I[Ht],Ur=I[Ht+1],yr=Ht+1<de?Ur.el||ww(Ur):F;rn[B]===0?v(null,xn,se,yr,q,P,ee,be,N):Wt&&(yt<0||B!==zn[yt]?ue(xn,se,yr,2):yt--)}}},ue=(ie,I,se,F,q=null)=>{const{el:P,type:ee,transition:be,children:N,shapeFlag:B}=ie;if(B&6){ue(ie.component.subTree,I,se,F);return}if(B&128){ie.suspense.move(I,se,F);return}if(B&64){ee.move(ie,I,se,ae);return}if(ee===Kt){r(P,I,se);for(let de=0;de<N.length;de++)ue(N[de],I,se,F);r(ie.anchor,I,se);return}if(ee===hl){C(ie,I,se);return}if(F!==2&&B&1&&be)if(F===0)be.beforeEnter(P),r(P,I,se),jr(()=>be.enter(P),q);else{const{leave:de,delayLeave:Se,afterLeave:Ae}=be,Le=()=>{ie.ctx.isUnmounted?o(P):r(P,I,se)},Xe=()=>{P._isLeaving&&P[cs](!0),de(P,()=>{Le(),Ae&&Ae()})};Se?Se(P,Le,Xe):Xe()}else r(P,I,se)},ve=(ie,I,se,F=!1,q=!1)=>{const{type:P,props:ee,ref:be,children:N,dynamicChildren:B,shapeFlag:de,patchFlag:Se,dirs:Ae,cacheIndex:Le,memo:Xe}=ie;if(Se===-2&&(q=!1),be!=null&&(fa(),hu(be,null,se,ie,!0),ha()),Le!=null&&(I.renderCache[Le]=void 0),de&256){I.ctx.deactivate(ie);return}const it=de&1&&Ae,yt=!Ds(ie);let Mt;if(yt&&(Mt=ee&&ee.onVnodeBeforeUnmount)&&oi(Mt,I,ie),de&6)Ne(ie.component,se,F);else{if(de&128){ie.suspense.unmount(se,F);return}it&&Rs(ie,null,I,"beforeUnmount"),de&64?ie.type.remove(ie,I,se,ae,F):B&&!B.hasOnce&&(P!==Kt||Se>0&&Se&64)?Je(B,I,se,!1,!0):(P===Kt&&Se&384||!q&&de&16)&&Je(N,I,se),F&&ge(ie)}const Lt=Xe!=null&&Le==null;(yt&&(Mt=ee&&ee.onVnodeUnmounted)||it||Lt)&&jr(()=>{Mt&&oi(Mt,I,ie),it&&Rs(ie,null,I,"unmounted"),Lt&&(ie.el=null)},se)},ge=ie=>{const{type:I,el:se,anchor:F,transition:q}=ie;if(I===Kt){Te(se,F);return}if(I===hl){w(ie);return}const P=()=>{o(se),q&&!q.persisted&&q.afterLeave&&q.afterLeave()};if(ie.shapeFlag&1&&q&&!q.persisted){const{leave:ee,delayLeave:be}=q,N=()=>ee(se,P);be?be(ie.el,P,N):N()}else P()},Te=(ie,I)=>{let se;for(;ie!==I;)se=p(ie),o(ie),ie=se;o(I)},Ne=(ie,I,se)=>{const{bum:F,scope:q,job:P,subTree:ee,um:be,m:N,a:B}=ie;ap(N),ap(B),F&&ac(F),q.stop(),P&&(P.flags|=8,ve(ee,ie,I,se)),be&&jr(be,I),jr(()=>{ie.isUnmounted=!0},I)},Je=(ie,I,se,F=!1,q=!1,P=0)=>{for(let ee=P;ee<ie.length;ee++)ve(ie[ee],I,se,F,q)},ct=ie=>{if(ie.shapeFlag&6)return ct(ie.component.subTree);if(ie.shapeFlag&128)return ie.suspense.next();const I=p(ie.anchor||ie.el),se=I&&I[jv];return se?p(se):I};let tt=!1;const Tt=(ie,I,se)=>{let F;ie==null?I._vnode&&(ve(I._vnode,null,null,!0),F=I._vnode.component):v(I._vnode||null,ie,I,null,null,null,se),I._vnode=ie,tt||(tt=!0,B1(F),Xh(),tt=!1)},ae={p:v,um:ve,m:ue,r:ge,mt:x,mc:W,pc:Q,pbc:j,n:ct,o:e};let Ee,Ue;return t&&([Ee,Ue]=t(ae)),{render:Tt,hydrate:Ee,createApp:sx(Tt,Ee)}}function Mv({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function dc({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function yw(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Lv(e,t,n=!1){const r=e.children,o=t.children;if(zt(r)&&zt(o))for(let i=0;i<r.length;i++){const s=r[i];let a=o[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=o[i]=Ca(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&Lv(s,a)),a.type===Sa&&(a.patchFlag===-1&&(a=o[i]=Ca(a)),a.el=s.el),a.type===Rr&&!a.el&&(a.el=s.el)}}function hx(e){const t=e.slice(),n=[0];let r,o,i,s,a;const l=e.length;for(r=0;r<l;r++){const u=e[r];if(u!==0){if(o=n[n.length-1],e[o]<u){t[r]=o,n.push(r);continue}for(i=0,s=n.length-1;i<s;)a=i+s>>1,e[n[a]]<u?i=a+1:s=a;u<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r)}}for(i=n.length,s=n[i-1];i-- >0;)n[i]=s,s=t[s];return n}function bw(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:bw(t)}function ap(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function ww(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?ww(t.subTree):null}function sf(e,t){const n=e.props&&e.props[t];Zt(n)&&n()}function px(e,t,n,r,o,i,s,a,l){const{p:u,o:{createElement:d}}=l,f=d("div"),p=e.suspense=Cw(e,o,r,t,f,n,i,s,a,l);u(null,p.pendingBranch=e.ssContent,f,null,r,p,i,s),p.deps>0?(sf(e,"onPending"),sf(e,"onFallback"),u(null,e.ssFallback,t,n,r,null,i,s),mu(p,e.ssFallback)):p.resolve(!1,!0)}function mx(e,t,n,r,o,i,s,a,{p:l,um:u,o:{createElement:d}}){const f=t.suspense=e.suspense;f.vnode=t,t.el=e.el;const p=t.ssContent,g=t.ssFallback,{activeBranch:m,pendingBranch:v,isInFallback:k,isHydrating:b}=f;if(v)f.pendingBranch=p,ss(v,p)?(l(v,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():k&&(b||(l(m,g,n,r,o,null,i,s,a),mu(f,g)))):(f.pendingId=yp++,b?(f.isHydrating=!1,f.activeBranch=v):u(v,o,f),f.deps=0,f.effects.length=0,f.hiddenContainer=d("div"),k?(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():(l(m,g,n,r,o,null,i,s,a),mu(f,g))):m&&ss(m,p)?(l(m,p,n,r,o,f,i,s,a),f.resolve(!0)):(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0&&f.resolve()));else if(m&&ss(m,p))l(m,p,n,r,o,f,i,s,a),mu(f,p);else if(sf(t,"onPending"),f.pendingBranch=p,p.shapeFlag&512?f.pendingId=p.component.suspenseId:f.pendingId=yp++,l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0)f.resolve();else{const{timeout:S,pendingId:C}=f;S>0?setTimeout(()=>{f.pendingId===C&&f.fallback(g)},S):S===0&&f.fallback(g)}}function Cw(e,t,n,r,o,i,s,a,l,u,d=!1){const{p:f,m:p,um:g,n:m,o:{parentNode:v,remove:k}}=u;let b;const S=yx(e);S&&t&&t.pendingBranch&&(b=t.pendingId,t.deps++);const C=e.props?Vd(e.props.timeout):void 0,w=i,T={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:yp++,timeout:typeof C=="number"?C:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!d,isHydrating:d,isUnmounted:!1,effects:[],resolve(L=!1,z=!1){const{vnode:W,activeBranch:V,pendingBranch:j,pendingId:Z,effects:R,parentComponent:K,container:x,isInFallback:$}=T;let H=!1;T.isHydrating?T.isHydrating=!1:L||(H=V&&j.transition&&j.transition.mode==="out-in",H&&(V.transition.afterLeave=()=>{Z===T.pendingId&&(p(j,x,i===w?m(V):i,0),Qd(R),$&&W.ssFallback&&(W.ssFallback.el=null))}),V&&!T.isFallbackMountPending&&(v(V.el)===x&&(i=m(V)),g(V,K,T,!0),!H&&$&&W.ssFallback&&jr(()=>W.ssFallback.el=null,T)),H||p(j,x,i,0)),T.isFallbackMountPending=!1,mu(T,j),T.pendingBranch=null,T.isInFallback=!1;let J=T.parent,Q=!1;for(;J;){if(J.pendingBranch){J.effects.push(...R),Q=!0;break}J=J.parent}!Q&&!H&&Qd(R),T.effects=[],S&&t&&t.pendingBranch&&b===t.pendingId&&(t.deps--,t.deps===0&&!z&&t.resolve()),sf(W,"onResolve")},fallback(L){if(!T.pendingBranch)return;const{vnode:z,activeBranch:W,parentComponent:V,container:j,namespace:Z}=T;sf(z,"onFallback");const R=m(W),K=()=>{T.isFallbackMountPending=!1,T.isInFallback&&(f(null,L,j,R,V,null,Z,a,l),mu(T,L))},x=L.transition&&L.transition.mode==="out-in";x&&(T.isFallbackMountPending=!0,W.transition.afterLeave=K),T.isInFallback=!0,g(W,V,null,!0),x||K()},move(L,z,W){T.activeBranch&&p(T.activeBranch,L,z,W),T.container=L},next(){return T.activeBranch&&m(T.activeBranch)},registerDep(L,z,W){const V=!!T.pendingBranch;V&&T.deps++;const j=L.vnode.el;L.asyncDep.catch(Z=>{cc(Z,L,0)}).then(Z=>{if(L.isUnmounted||T.isUnmounted||T.pendingId!==L.suspenseId)return;Su(),L.asyncResolved=!0;const{vnode:R}=L;Ov(L,Z,!1),j&&(R.el=j);const K=!j&&L.subTree.el;z(L,R,v(j||L.subTree.el),j?null:m(L.subTree),T,s,W),K&&(R.placeholder=null,k(K)),sp(L,R.el),V&&--T.deps===0&&T.resolve()})},unmount(L,z){T.isUnmounted=!0,T.activeBranch&&g(T.activeBranch,n,L,z),T.pendingBranch&&g(T.pendingBranch,n,L,z)}};return T}function gx(e,t,n,r,o,i,s,a,l){const u=t.suspense=Cw(t,r,n,e.parentNode,document.createElement("div"),null,o,i,s,a,!0),d=l(e,u.pendingBranch=t.ssContent,n,u,i,s);return u.deps===0&&u.resolve(!1,!0),d}function vx(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=kw(r?n.default:n),e.ssFallback=r?kw(n.fallback):Xt(Rr)}function kw(e){let t;if(Zt(e)){const n=pl&&e._c;n&&(e._d=!1,ye()),e=e(),n&&(e._d=!0,t=ko,_w())}return zt(e)&&(e=cx(e)),e=ri(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function Sw(e,t){t&&t.pendingBranch?zt(e)?t.effects.push(...e):t.effects.push(e):Qd(e)}function mu(e,t){e.activeBranch=t;const{vnode:n,parentComponent:r}=e;let o=t.el;for(;!o&&t.component;)t=t.component.subTree,o=t.el;n.el=o,r&&r.subTree===n&&(r.vnode.el=o,sp(r,o))}function yx(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function ye(e=!1){Cu.push(ko=e?null:[])}function _w(){Cu.pop(),ko=Cu[Cu.length-1]||null}function af(e,t=!1){pl+=e,e<0&&ko&&t&&(ko.hasOnce=!0)}function Aw(e){return e.dynamicChildren=pl>0?ko||oc:null,_w(),pl>0&&ko&&ko.push(e),e}function De(e,t,n,r,o,i){return Aw(He(e,t,n,r,o,i,!0))}function an(e,t,n,r,o){return Aw(Xt(e,t,n,r,o,!0))}function wa(e){return e?e.__v_isVNode===!0:!1}function ss(e,t){return e.type===t.type&&e.key===t.key}function bx(e){}function He(e,t=null,n=null,r=0,o=null,i=e===Kt?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&sy(t),ref:t&&vf(t),scopeId:df,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:lo};return a?(Dv(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Xn(n)?8:16),pl>0&&!s&&ko&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&ko.push(l),l}function wx(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===Qv)&&(e=Rr),wa(e)){const a=Ms(e,t,!0);return n&&Dv(a,n),pl>0&&!i&&ko&&(a.shapeFlag&6?ko[ko.indexOf(e)]=a:ko.push(a)),a.patchFlag=-2,a}if(_x(e)&&(e=e.__vccOpts),t){t=Iw(t);let{class:a,style:l}=t;a&&!Xn(a)&&(t.class=en(a)),Fn(l)&&($d(l)&&!zt(l)&&(l=Gn({},l)),t.style=bn(l))}const s=Xn(e)?1:gf(e)?128:Vv(e)?64:Fn(e)?4:Zt(e)?2:0;return He(e,t,n,r,o,s,i,!0)}function Iw(e){return e?$d(e)||ny(e)?Gn({},e):e:null}function Ms(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,u=t?Ls(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&sy(u),ref:t&&t.ref?n&&i?zt(i)?i.concat(vf(t)):[i,vf(t)]:vf(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Kt?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Ms(e.ssContent),ssFallback:e.ssFallback&&Ms(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&ba(d,l.clone(d)),d}function as(e=" ",t=0){return Xt(Sa,null,e,t)}function Cx(e,t){const n=Xt(hl,null,e);return n.staticCount=t,n}function vt(e="",t=!1){return t?(ye(),an(Rr,null,e)):Xt(Rr,null,e)}function ri(e){return e==null||typeof e=="boolean"?Xt(Rr):zt(e)?Xt(Kt,null,e.slice()):wa(e)?Ca(e):Xt(Sa,null,String(e))}function Ca(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ms(e)}function Dv(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(zt(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),Dv(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!ny(t)?t._ctx=lo:o===3&&lo&&(lo.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Zt(t)?(t={default:t,_ctx:lo},n=32):(t=String(t),r&64?(n=16,t=[as(t)]):n=8);e.children=t,e.shapeFlag|=n}function Ls(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const o in r)if(o==="class")t.class!==r.class&&(t.class=en([t.class,r.class]));else if(o==="style")t.style=bn([t.style,r.style]);else if(ou(o)){const i=t[o],s=r[o];s&&i!==s&&!(zt(i)&&i.includes(s))?t[o]=i?[].concat(i,s):s:s==null&&i==null&&!Fd(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function oi(e,t,n,r=null){zi(e,t,7,[n,r])}function Ew(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||aC,i={uid:lC++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Wh(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:hw(r,o),emitsOptions:cw(r,o),emit:null,emitted:null,propsDefaults:Dn,inheritAttrs:r.inheritAttrs,ctx:Dn,data:Dn,props:Dn,attrs:Dn,slots:Dn,refs:Dn,setupState:Dn,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=t?t.root:i,i.emit=lx.bind(null,i),e.ce&&e.ce(i),i}function Tw(e){return e.vnode.shapeFlag&4}function xw(e,t=!1,n=!1){t&&ku(t);const{props:r,children:o}=e.vnode,i=Tw(e);dx(e,r,i,t),oC(e,o,n||t);const s=i?kx(e,t):void 0;return t&&ku(!1),s}function kx(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,pp);const{setup:r}=n;if(r){fa();const o=e.setupContext=r.length>1?Mw(e):null,i=gc(e),s=du(r,e,0,[e.props,o]),a=zh(s);if(ha(),i(),(a||e.sp)&&!Ds(e)&&Cv(e),a){if(s.then(Su,Su),t)return s.then(l=>{Ov(e,l,t)}).catch(l=>{cc(l,e,0)});e.asyncDep=s}else Ov(e,s,t)}else Rw(e,t)}function Ov(e,t,n){Zt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Fn(t)&&(e.setupState=iv(t)),Rw(e,n)}function Sx(e){wp=e,ay=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,Xw))}}function Rw(e,t,n){const r=e.type;if(!e.render){if(!t&&wp&&!r.render){const o=r.template||Tv(e).template;if(o){const{isCustomElement:i,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:l}=r,u=Gn(Gn({isCustomElement:i,delimiters:a},s),l);r.render=wp(o,u)}}e.render=r.render||gi,ay&&ay(e)}{const o=gc(e);fa();try{nx(e)}finally{ha(),o()}}}function Mw(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,uC),slots:e.slots,emit:e.emit,expose:t}}function lf(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(iv(Wr(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in wu)return wu[n](e)},has(t,n){return n in t||n in wu}})):e.proxy}function Pv(e,t=!0){return Zt(e)?e.displayName||e.name:e.name||t&&e.__name}function _x(e){return Zt(e)&&"__vccOpts"in e}function zr(e,t,n){try{af(-1);const r=arguments.length;return r===2?Fn(t)&&!zt(t)?wa(t)?Xt(e,null,[t]):Xt(e,t):Xt(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&wa(n)&&(n=[n]),Xt(e,t,n))}finally{af(1)}}function Ax(){return;function e(t,n,r){const o=t[r];if(zt(o)&&o.includes(n)||Fn(o)&&n in o||t.extends&&e(t.extends,n,r)||t.mixins&&t.mixins.some(i=>e(i,n,r)))return!0}}function Ix(e,t,n,r){const o=n[r];if(o&&Lw(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function Lw(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(so(n[r],t[r]))return!1;return pl>0&&ko&&ko.push(e),!0}var Fv,Dw,Ow,Lo,ls,fc,ka,hc,Nv,cf,gu,vu,uf,lo,df,Pw,Bv,zv,cl,jv,Vv,ul,Fw,Uv,Hv,lp,Nw,dl,cs,yu,vi,cp,$v,Bw,Gv,ff,Wv,pc,zw,jw,hf,mc,Kv,Vw,Uw,Hw,$w,Gw,Ww,Kw,Ds,bu,qw,Os,qv,Nn,up,pf,cr,mf,Yv,Xv,Zv,dp,Yw,Qv,fp,wu,hp,pp,Xw,mp,Zw,Qw,fl,Jv,Jw,eC,tC,ey,ty,ny,nC,gp,vp,rC,ry,oy,iy,oC,iC,jr,gf,yp,sC,Kt,Sa,Rr,hl,Cu,ko,pl,sy,vf,Xt,aC,lC,co,pr,bp,ku,gc,Su,ml,wp,ay,cC,uC,ke,ly,dC,fC,hC,pC,mC,Ex,Tx,xx,gC=xr((()=>{_T(),Xg(),Fv=[],Dw={SETUP_FUNCTION:0,0:"SETUP_FUNCTION",RENDER_FUNCTION:1,1:"RENDER_FUNCTION",NATIVE_EVENT_HANDLER:5,5:"NATIVE_EVENT_HANDLER",COMPONENT_EVENT_HANDLER:6,6:"COMPONENT_EVENT_HANDLER",VNODE_HOOK:7,7:"VNODE_HOOK",DIRECTIVE_HOOK:8,8:"DIRECTIVE_HOOK",TRANSITION_HOOK:9,9:"TRANSITION_HOOK",APP_ERROR_HANDLER:10,10:"APP_ERROR_HANDLER",APP_WARN_HANDLER:11,11:"APP_WARN_HANDLER",FUNCTION_REF:12,12:"FUNCTION_REF",ASYNC_COMPONENT_LOADER:13,13:"ASYNC_COMPONENT_LOADER",SCHEDULER:14,14:"SCHEDULER",COMPONENT_UPDATE:15,15:"COMPONENT_UPDATE",APP_UNMOUNT_CLEANUP:16,16:"APP_UNMOUNT_CLEANUP"},Ow={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"},Lo=[],ls=-1,fc=[],ka=null,hc=0,Nv=Promise.resolve(),cf=null,gu=e=>e.id==null?e.flags&2?-1:1/0:e.id,uf=[],lo=null,df=null,Pw=e=>ao,Bv=Symbol.for("v-scx"),zv=()=>{{const e=ll(Bv);return e}},cl=new WeakMap,jv=Symbol("_vte"),Vv=e=>e.__isTeleport,ul=e=>e&&(e.disabled||e.disabled===""),Fw=e=>e&&(e.defer||e.defer===""),Uv=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Hv=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,lp=(e,t)=>{const n=e&&e.to;return Xn(n)?t?t(n):null:n},Nw={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,u){const{mc:d,pc:f,pbc:p,o:{insert:g,querySelector:m,createText:v,createComment:k}}=u,b=ul(t.props);let{dynamicChildren:S}=t;const C=(L,z,W)=>{L.shapeFlag&16&&d(L.children,z,W,o,i,s,a,l)},w=(L=t)=>{const z=ul(L.props),W=L.target=lp(L.props,m),V=yv(W,L,v,g);W&&(s!=="svg"&&Uv(W)?s="svg":s!=="mathml"&&Hv(W)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(W),z||(C(L,W,V),tf(L,!1)))},T=L=>{const z=()=>{cl.get(L)===z&&(cl.delete(L),ul(L.props)&&(C(L,n,L.anchor),tf(L,!0)),w(L))};cl.set(L,z),jr(z,i)};if(e==null){const L=t.el=v(""),z=t.anchor=v("");if(g(L,n,r),g(z,n,r),Fw(t.props)||i&&i.pendingBranch){T(t);return}b&&(C(t,n,z),tf(t,!0)),w()}else{t.el=e.el;const L=t.anchor=e.anchor,z=cl.get(e);if(z){z.flags|=8,cl.delete(e),T(t);return}t.targetStart=e.targetStart;const W=t.target=e.target,V=t.targetAnchor=e.targetAnchor,j=ul(e.props),Z=j?n:W,R=j?L:V;if(s==="svg"||Uv(W)?s="svg":(s==="mathml"||Hv(W))&&(s="mathml"),S?(p(e.dynamicChildren,S,Z,o,i,s,a),Lv(e,t,!0)):l||f(e,t,Z,R,o,i,s,a,!1),b)j?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Zh(t,n,L,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const K=t.target=lp(t.props,m);K&&Zh(t,K,null,u,0)}else j&&Zh(t,W,V,u,1);tf(t,b)}},remove(e,t,n,{um:r,o:{remove:o}},i){const{shapeFlag:s,children:a,anchor:l,targetStart:u,targetAnchor:d,target:f,props:p}=e;let g=i||!ul(p);const m=cl.get(e);if(m&&(m.flags|=8,cl.delete(e),g=!1),f&&(o(u),o(d)),i&&o(l),s&16)for(let v=0;v<a.length;v++){const k=a[v];r(k,t,n,g,!!k.dynamicChildren)}},move:Zh,hydrate:PT},dl=Nw,cs=Symbol("_leaveCb"),yu=Symbol("_enterCb"),vi=[Function,Array],cp={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:vi,onEnter:vi,onAfterEnter:vi,onEnterCancelled:vi,onBeforeLeave:vi,onLeave:vi,onAfterLeave:vi,onLeaveCancelled:vi,onBeforeAppear:vi,onAppear:vi,onAfterAppear:vi,onAppearCancelled:vi},$v=e=>{const t=e.subTree;return t.component?$v(t.component):t},Bw={name:"BaseTransition",props:cp,setup(e,{slots:t}){const n=pr(),r=bv();return()=>{const o=t.default&&Qh(t.default(),!0);if(!o||!o.length)return;const i=G1(o),s=pn(e),{mode:a}=s;if(r.isLeaving)return wv(i);const l=K1(i);if(!l)return wv(i);let u=fu(l,s,r,n,f=>u=f);l.type!==Rr&&ba(l,u);let d=n.subTree&&K1(n.subTree);if(d&&d.type!==Rr&&!ss(d,l)&&$v(n).type!==Rr){let f=fu(d,s,r,n);if(ba(d,f),a==="out-in"&&l.type!==Rr)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,d=void 0},wv(i);a==="in-out"&&l.type!==Rr?f.delayLeave=(p,g,m)=>{const v=W1(r,d);v[String(d.key)]=d,p[cs]=()=>{g(),p[cs]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{m(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return i}}},Gv=Bw,ff=new WeakMap,Wv=!1,pc=()=>{Wv||(console.error("Hydration completed but contains mismatches."),Wv=!0)},zw=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",jw=e=>e.namespaceURI.includes("MathML"),hf=e=>{if(e.nodeType===1){if(zw(e))return"svg";if(jw(e))return"mathml"}},mc=e=>e.nodeType===8,Kv="data-allow-mismatch",Vw={0:"text",1:"children",2:"class",3:"style",4:"attribute"},Uw=Ud().requestIdleCallback||(e=>setTimeout(e,1)),Hw=Ud().cancelIdleCallback||(e=>clearTimeout(e)),$w=(e=1e4)=>t=>{const n=Uw(t,{timeout:e});return()=>Hw(n)},Gw=e=>(t,n)=>{const r=new IntersectionObserver(o=>{for(const i of o)if(i.isIntersecting){r.disconnect(),t();break}},e);return n(o=>{if(o instanceof Element){if(zT(o))return t(),r.disconnect(),!1;r.observe(o)}}),()=>r.disconnect()},Ww=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},Kw=(e=[])=>(t,n)=>{Xn(e)&&(e=[e]);let r=!1;const o=s=>{r||(r=!0,i(),t(),s.target.dispatchEvent(new s.constructor(s.type,s)))},i=()=>{n(s=>{for(const a of e)s.removeEventListener(a,o)})};return n(s=>{for(const a of e)s.addEventListener(a,o,{once:!0})}),i},Ds=e=>!!e.type.__asyncLoader,bu=e=>e.type.__isKeepAlive,qw={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=pr(),r=n.ctx;if(!r.renderer)return()=>{const S=t.default&&t.default();return S&&S.length===1?S[0]:S};const o=new Map,i=new Set;let s=null;const a=n.suspense,{renderer:{p:l,m:u,um:d,o:{createElement:f}}}=r,p=f("div");r.activate=(S,C,w,T,L)=>{const z=S.component;u(S,C,w,0,a),l(z.vnode,S,C,w,z,a,T,S.slotScopeIds,L),jr(()=>{z.isDeactivated=!1,z.a&&ac(z.a);const W=S.props&&S.props.onVnodeMounted;W&&oi(W,z.parent,S)},a)},r.deactivate=S=>{const C=S.component;ap(C.m),ap(C.a),u(S,p,null,1,a),jr(()=>{C.da&&ac(C.da);const w=S.props&&S.props.onVnodeUnmounted;w&&oi(w,C.parent,S),C.isDeactivated=!0},a)};function g(S){_v(S),d(S,n,a,!0)}function m(S){o.forEach((C,w)=>{const T=Pv(Ds(C)?C.type.__asyncResolved||{}:C.type);T&&!S(T)&&v(w)})}function v(S){const C=o.get(S);C&&(!s||!ss(C,s))?g(C):s&&_v(s),o.delete(S),i.delete(S)}jt(()=>[e.include,e.exclude],([S,C])=>{S&&m(w=>nf(S,w)),C&&m(w=>!nf(C,w))},{flush:"post",deep:!0});let k=null;const b=()=>{k!=null&&(gf(n.subTree.type)?jr(()=>{o.set(k,tp(n.subTree))},n.subTree.suspense):o.set(k,tp(n.subTree)))};return Nn(b),pf(b),cr(()=>{o.forEach(S=>{const{subTree:C,suspense:w}=n,T=tp(C);if(S.type===T.type&&S.key===T.key){_v(T);const L=T.component.da;L&&jr(L,w);return}g(S)})}),()=>{if(k=null,!t.default)return s=null;const S=t.default(),C=S[0];if(S.length>1)return s=null,S;if(!wa(C)||!(C.shapeFlag&4)&&!(C.shapeFlag&128))return s=null,C;let w=tp(C);if(w.type===Rr)return s=null,w;const T=w.type,L=Pv(Ds(w)?w.type.__asyncResolved||{}:T),{include:z,exclude:W,max:V}=e;if(z&&(!L||!nf(z,L))||W&&L&&nf(W,L))return w.shapeFlag&=-257,s=w,C;const j=w.key==null?T:w.key,Z=o.get(j);return w.el&&(w=Ms(w),C.shapeFlag&128&&(C.ssContent=w)),k=j,Z?(w.el=Z.el,w.component=Z.component,w.transition&&ba(w,w.transition),w.shapeFlag|=512,i.delete(j),i.add(j)):(i.add(j),V&&i.size>parseInt(V,10)&&v(i.values().next().value)),w.shapeFlag|=256,s=w,gf(C.type)?C:w}}},Os=e=>(t,n=co)=>{(!ml||e==="sp")&&np(e,(...r)=>t(...r),n)},qv=Os("bm"),Nn=Os("m"),up=Os("bu"),pf=Os("u"),cr=Os("bum"),mf=Os("um"),Yv=Os("sp"),Xv=Os("rtg"),Zv=Os("rtc"),dp="components",Yw="directives",Qv=Symbol.for("v-ndc"),fp=e=>e?Tw(e)?lf(e):fp(e.parent):null,wu=Gn(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>fp(e.parent),$root:e=>fp(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Tv(e),$forceUpdate:e=>e.f||(e.f=()=>{vv(e.update)}),$nextTick:e=>e.n||(e.n=St.bind(e.proxy)),$watch:e=>OT.bind(e)}),hp=(e,t)=>e!==Dn&&!e.__isScriptSetup&&jn(e,t),pp={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:i,accessCache:s,type:a,appContext:l}=e;if(t[0]!=="$"){const p=s[t];if(p!==void 0)switch(p){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return i[t]}else{if(hp(r,t))return s[t]=1,r[t];if(o!==Dn&&jn(o,t))return s[t]=2,o[t];if(jn(i,t))return s[t]=3,i[t];if(n!==Dn&&jn(n,t))return s[t]=4,n[t];mp&&(s[t]=0)}}const u=wu[t];let d,f;if(u)return t==="$attrs"&&Ro(e.attrs,"get",""),u(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==Dn&&jn(n,t))return s[t]=4,n[t];if(f=l.config.globalProperties,jn(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return hp(o,t)?(o[t]=n,!0):r!==Dn&&jn(r,t)?(r[t]=n,!0):jn(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:i,type:s}},a){let l;return!!(n[a]||e!==Dn&&a[0]!=="$"&&jn(e,a)||hp(t,a)||jn(i,a)||jn(r,a)||jn(wu,a)||jn(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:jn(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},Xw=Gn({},pp,{get(e,t){if(t!==Symbol.unscopables)return pp.get(e,t,e)},has(e,t){return t[0]!=="_"&&!Q2(t)}}),mp=!0,Zw={data:sw,props:aw,emits:aw,methods:of,computed:of,beforeCreate:Uo,created:Uo,beforeMount:Uo,mounted:Uo,beforeUpdate:Uo,updated:Uo,beforeDestroy:Uo,beforeUnmount:Uo,destroyed:Uo,unmounted:Uo,activated:Uo,deactivated:Uo,errorCaptured:Uo,serverPrefetch:Uo,components:of,directives:of,watch:ix,provide:sw,inject:ox},Qw=0,fl=null,Jv=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Nr(t)}Modifiers`]||e[`${Vo(t)}Modifiers`],Jw=new WeakMap,eC=e=>{let t;for(const n in e)(n==="class"||n==="style"||ou(n))&&((t||(t={}))[n]=e[n]);return t},tC=(e,t)=>{const n={};for(const r in e)(!Fd(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},ey={},ty=()=>Object.create(ey),ny=e=>Object.getPrototypeOf(e)===ey,nC=new WeakMap,gp=e=>e==="_"||e==="_ctx"||e==="$stable",vp=e=>zt(e)?e.map(ri):[ri(e)],rC=(e,t,n)=>{if(t._n)return t;const r=ao((...o)=>vp(t(...o)),n);return r._c=!1,r},ry=(e,t,n)=>{const r=e._ctx;for(const o in e){if(gp(o))continue;const i=e[o];if(Zt(i))t[o]=rC(o,i,r);else if(i!=null){const s=vp(i);t[o]=()=>s}}},oy=(e,t)=>{const n=vp(t);e.slots.default=()=>n},iy=(e,t,n)=>{for(const r in t)(n||!gp(r))&&(e[r]=t[r])},oC=(e,t,n)=>{const r=e.slots=ty();if(e.vnode.shapeFlag&32){const o=t._;o?(iy(r,t,n),n&&Wg(r,"_",o,!0)):ry(t,r)}else t&&oy(e,t)},iC=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=Dn;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:iy(o,t,n):(i=!t.$stable,ry(t,o)),s=t}else t&&(oy(e,t),s={default:1});if(i)for(const a in o)!gp(a)&&s[a]==null&&delete o[a]},jr=Sw,gf=e=>e.__isSuspense,yp=0,sC={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,u){if(e==null)px(t,n,r,o,i,s,a,l,u);else{if(i&&i.deps>0&&!e.suspense.isInFallback){t.suspense=e.suspense,t.suspense.vnode=t,t.el=e.el;return}mx(e,t,n,r,o,s,a,l,u)}},hydrate:gx,normalize:vx},Kt=Symbol.for("v-fgt"),Sa=Symbol.for("v-txt"),Rr=Symbol.for("v-cmt"),hl=Symbol.for("v-stc"),Cu=[],ko=null,pl=1,sy=({key:e})=>e??null,vf=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Xn(e)||lr(e)||Zt(e)?{i:lo,r:e,k:t,f:!!n}:e:null),Xt=wx,aC=lw(),lC=0,co=null,pr=()=>co||lo;{const e=Ud(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),i=>{o.length>1?o.forEach(s=>s(i)):o[0](i)}};bp=t("__VUE_INSTANCE_SETTERS__",n=>co=n),ku=t("__VUE_SSR_SETTERS__",n=>ml=n)}gc=e=>{const t=co;return bp(e),e.scope.on(),()=>{e.scope.off(),bp(t)}},Su=()=>{co&&co.scope.off(),bp(null)},ml=!1,cC=()=>!wp,uC={get(e,t){return Ro(e,"get",""),e[t]}},ke=(e,t)=>CT(e,t,ml),ly="3.5.32",dC=gi,fC=Ow,hC=vu,pC=j1,mC={createComponentInstance:Ew,setupComponent:xw,renderComponentRoot:ip,setCurrentRenderingInstance:Jd,isVNode:wa,normalizeVNode:ri,getComponentPublicInstance:lf,ensureValidVNode:Ev,pushWarningContext:AT,popWarningContext:IT},Ex=null,Tx=null,xx=null}));function vC(e){const t={};for(const R in e)R in gy||(t[R]=e[R]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:i=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:u=s,appearToClass:d=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,m=Rx(o),v=m&&m[0],k=m&&m[1],{onBeforeEnter:b,onEnter:S,onEnterCancelled:C,onLeave:w,onLeaveCancelled:T,onBeforeAppear:L=b,onAppear:z=S,onAppearCancelled:W=C}=t,V=(R,K,x,$)=>{R._enterCancelled=$,gl(R,K?d:a),gl(R,K?u:s),x&&x()},j=(R,K)=>{R._isLeaving=!1,gl(R,f),gl(R,g),gl(R,p),K&&K()},Z=R=>(K,x)=>{const $=R?z:S,H=()=>V(K,R,x);vl($,[K,H]),yC(()=>{gl(K,R?l:i),Ps(K,R?d:a),yy($)||bC(K,r,v,H)})};return Gn(t,{onBeforeEnter(R){vl(b,[R]),Ps(R,i),Ps(R,s)},onBeforeAppear(R){vl(L,[R]),Ps(R,l),Ps(R,u)},onEnter:Z(!1),onAppear:Z(!0),onLeave(R,K){R._isLeaving=!0;const x=()=>j(R,K);Ps(R,f),R._enterCancelled?(Ps(R,p),uy(R)):(uy(R),Ps(R,p)),yC(()=>{R._isLeaving&&(gl(R,f),Ps(R,g),yy(w)||bC(R,r,k,x))}),vl(w,[R,x])},onEnterCancelled(R){V(R,!1,void 0,!0),vl(C,[R])},onAppearCancelled(R){V(R,!0,void 0,!0),vl(W,[R])},onLeaveCancelled(R){j(R),vl(T,[R])}})}function Rx(e){if(e==null)return null;if(Fn(e))return[cy(e.enter),cy(e.leave)];{const t=cy(e);return[t,t]}}function cy(e){return Vd(e)}function Ps(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[vc]||(e[vc]=new Set)).add(t)}function gl(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[vc];n&&(n.delete(t),n.size||(e[vc]=void 0))}function yC(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function bC(e,t,n,r){const o=e._endId=++VC,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=wC(e,t);if(!s)return r();const u=s+"end";let d=0;const f=()=>{e.removeEventListener(u,p),i()},p=g=>{g.target===e&&++d>=l&&f()};setTimeout(()=>{d<l&&f()},a+1),e.addEventListener(u,p)}function wC(e,t){const n=window.getComputedStyle(e),r=m=>(n[m]||"").split(", "),o=r(`${Aa}Delay`),i=r(`${Aa}Duration`),s=CC(o,i),a=r(`${Au}Delay`),l=r(`${Au}Duration`),u=CC(a,l);let d=null,f=0,p=0;t===Aa?s>0&&(d=Aa,f=s,p=i.length):t===Au?u>0&&(d=Au,f=u,p=l.length):(f=Math.max(s,u),d=f>0?s>u?Aa:Au:null,p=d?d===Aa?i.length:l.length:0);const g=d===Aa&&/\b(?:transform|all)(?:,|$)/.test(r(`${Aa}Property`).toString());return{type:d,timeout:f,propCount:p,hasTransform:g}}function CC(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>kC(n)+kC(e[r])))}function kC(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function uy(e){return(e?e.ownerDocument:document).body.offsetHeight}function Mx(e,t,n){const r=e[vc];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function yf(e,t){e.style.display=t?e[bf]:"none",e[by]=!t}function Lx(){wy.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function Dx(e){const t=pr();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>Cp(i,o))},r=()=>{const o=e(t.proxy);t.ce?Cp(t.ce,o):dy(t.subTree,o),n(o)};up(()=>{Qd(r)}),Nn(()=>{jt(r,gi,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),mf(()=>o.disconnect())})}function dy(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{dy(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)Cp(e.el,t);else if(e.type===Kt)e.children.forEach(n=>dy(n,t));else if(e.type===hl){let{el:n,anchor:r}=e;for(;n&&(Cp(n,t),n!==r);)n=n.nextSibling}}function Cp(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=aT(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[Cy]=r}}function Ox(e,t,n){const r=e.style,o=Xn(n);let i=!1;if(n&&!o){if(t)if(Xn(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&kp(r,a,"")}else for(const s in t)n[s]==null&&kp(r,s,"");for(const s in n)s==="display"&&(i=!0),kp(r,s,n[s])}else if(o){if(t!==n){const s=r[Cy];s&&(n+=";"+s),r.cssText=n,i=UC.test(n)}}else t&&e.removeAttribute("style");bf in e&&(e[bf]=i?r.display:"",e[by]&&(r.display="none"))}function kp(e,t,n){if(zt(n))n.forEach(r=>kp(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=Px(e,t);ky.test(n)?e.setProperty(Vo(r),n.replace(ky,""),"important"):e[r]=n}}function Px(e,t){const n=Ip[t];if(n)return n;let r=Nr(t);if(r!=="filter"&&r in e)return Ip[t]=r;r=iu(r);for(let o=0;o<Sy.length;o++){const i=Sy[o]+r;if(i in e)return Ip[t]=i}return t}function SC(e,t,n,r,o,i=n1(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(_y,t.slice(6,t.length)):e.setAttributeNS(_y,t,n):n==null||i&&!G2(n)?e.removeAttribute(t):e.setAttribute(t,i?"":ti(n)?String(n):n)}function _C(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?hy(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=G2(n):n==null&&a==="string"?(n="",s=!0):a==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function _a(e,t,n,r){e.addEventListener(t,n,r)}function Fx(e,t,n,r){e.removeEventListener(t,n,r)}function Nx(e,t,n,r,o=null){const i=e[Ay]||(e[Ay]={}),s=i[t];if(r&&s)s.value=r;else{const[a,l]=Bx(t);r?_a(e,a,i[t]=zx(r,o),l):s&&(Fx(e,a,s,l),i[t]=void 0)}}function Bx(e){let t;if(Iy.test(e)){t={};let n;for(;n=e.match(Iy);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Vo(e.slice(2)),t]}function zx(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;zi(jx(r,n.value),t,5,[r])};return n.value=e,n.attached=$C(),n}function jx(e,t){if(zt(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>o=>!o._stopped&&r&&r(o))}else return t}function Vx(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ey(t)&&Zt(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Ey(t)&&Xn(n)?!1:t in e}function Ux(e,t){const n=e._def.props;if(!n)return!1;const r=Nr(t);return Array.isArray(n)?n.some(o=>Nr(o)===r):Object.keys(n).some(o=>Nr(o)===r)}function AC(e,t,n){let r=uc(e,t);Nd(r)&&(r=Gn({},r,t));class o extends Ry{constructor(s){super(r,s,n)}}return o.def=r,o}function IC(e){const t=pr(),n=t&&t.ce;return n||null}function Hx(){const e=IC();return e&&e.shadowRoot}function $x(e="$style"){{const t=pr();if(!t)return Dn;const n=t.type.__cssModules;if(!n)return Dn;const r=n[e];return r||Dn}}function Gx(e){const t=e.el;t[wf]&&t[wf](),t[Dy]&&t[Dy]()}function Wx(e){Ly.set(e,EC(e.el))}function Kx(e){const t=My.get(e),n=Ly.get(e),r=t.left-n.left,o=t.top-n.top;if(r||o){const i=e.el,s=i.style,a=i.getBoundingClientRect();let l=1,u=1;return i.offsetWidth&&(l=a.width/i.offsetWidth),i.offsetHeight&&(u=a.height/i.offsetHeight),(!Number.isFinite(l)||l===0)&&(l=1),(!Number.isFinite(u)||u===0)&&(u=1),Math.abs(l-1)<.01&&(l=1),Math.abs(u-1)<.01&&(u=1),s.transform=s.webkitTransform=`translate(${r/l}px,${o/u}px)`,s.transitionDuration="0s",e}}function EC(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function qx(e,t,n){const r=e.cloneNode(),o=e[vc];o&&o.forEach(a=>{a.split(/\s+/).forEach(l=>l&&r.classList.remove(l))}),n.split(/\s+/).forEach(a=>a&&r.classList.add(a)),r.style.display="none";const i=t.nodeType===1?t:t.parentNode;i.appendChild(r);const{hasTransform:s}=wC(r);return i.removeChild(r),s}function Yx(e){e.target.composing=!0}function TC(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function xC(e,t,n){return t&&(e=e.trim()),n&&(e=jd(e)),e}function RC(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(zt(t))o=Nh(t,r.props.value)>-1;else if(il(t))o=t.has(r.props.value);else{if(t===n)return;o=da(t,LC(e,!0))}e.checked!==o&&(e.checked=o)}function MC(e,t){const n=e.multiple,r=zt(t);if(!(n&&!r&&!il(t))){for(let o=0,i=e.options.length;o<i;o++){const s=e.options[o],a=_u(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(u=>String(u)===String(a)):s.selected=Nh(t,a)>-1}else s.selected=t.has(a);else if(da(_u(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function _u(e){return"_value"in e?e._value:e.value}function LC(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function DC(e,t){switch(e){case"SELECT":return Oy;case"TEXTAREA":return ji;default:switch(t){case"checkbox":return Tp;case"radio":return xp;default:return ji}}}function Sp(e,t,n,r,o){const i=DC(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function Xx(){ji.getSSRProps=({value:e})=>({value:e}),xp.getSSRProps=({value:e},t)=>{if(t.props&&da(t.props.value,e))return{checked:!0}},Tp.getSSRProps=({value:e},t)=>{if(zt(e)){if(t.props&&Nh(e,t.props.value)>-1)return{checked:!0}}else if(il(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Py.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=DC(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function OC(){return Cf||(Cf=mw(Fy))}function PC(){return Cf=Ny?Cf:gw(Fy),Ny=!0,Cf}function FC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function NC(e){return Xn(e)?document.querySelector(e):e}var _p,fy,hy,BC,zC,Fs,py,my,Aa,Au,vc,gy,vy,jC,Ap,vl,yy,VC,bf,by,wy,Cy,UC,ky,Sy,Ip,_y,Ay,Iy,Ep,HC,$C,Ey,Ty,xy,GC,WC,Ry,My,Ly,wf,Dy,KC,qC,Ia,yi,ji,Tp,xp,Oy,Py,YC,XC,Jt,ZC,ii,Fy,Cf,Ny,By,QC,yc,zy,jy,JC,Zx=xr((()=>{if(gC(),gC(),Xg(),_p=void 0,fy=typeof window<"u"&&window.trustedTypes,fy)try{_p=fy.createPolicy("vue",{createHTML:e=>e})}catch{}hy=_p?e=>_p.createHTML(e):e=>e,BC="http://www.w3.org/2000/svg",zC="http://www.w3.org/1998/Math/MathML",Fs=typeof document<"u"?document:null,py=Fs&&Fs.createElement("template"),my={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o=t==="svg"?Fs.createElementNS(BC,e):t==="mathml"?Fs.createElementNS(zC,e):n?Fs.createElement(e,{is:n}):Fs.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Fs.createTextNode(e),createComment:e=>Fs.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Fs.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,i){const s=n?n.previousSibling:t.lastChild;if(o&&(o===i||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===i||!(o=o.nextSibling)););else{py.innerHTML=hy(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=py.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Aa="transition",Au="animation",vc=Symbol("_vtc"),gy={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},vy=Gn({},cp,gy),jC=e=>(e.displayName="Transition",e.props=vy,e),Ap=jC((e,{slots:t})=>zr(Gv,vC(e),t)),vl=(e,t=[])=>{zt(e)?e.forEach(n=>n(...t)):e&&e(...t)},yy=e=>e?zt(e)?e.some(t=>t.length>1):e.length>1:!1,VC=0,bf=Symbol("_vod"),by=Symbol("_vsh"),wy={name:"show",beforeMount(e,{value:t},{transition:n}){e[bf]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):yf(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),yf(e,!0),r.enter(e)):r.leave(e,()=>{yf(e,!1)}):yf(e,t))},beforeUnmount(e,{value:t}){yf(e,t)}},Cy=Symbol(""),UC=/(?:^|;)\s*display\s*:/,ky=/\s*!important$/,Sy=["Webkit","Moz","ms"],Ip={},_y="http://www.w3.org/1999/xlink",Ay=Symbol("_vei"),Iy=/(?:Once|Passive|Capture)$/,Ep=0,HC=Promise.resolve(),$C=()=>Ep||(HC.then(()=>Ep=0),Ep=Date.now()),Ey=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Ty=(e,t,n,r,o,i)=>{const s=o==="svg";t==="class"?Mx(e,r,s):t==="style"?Ox(e,n,r):ou(t)?Fd(t)||Nx(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Vx(e,t,r,s))?(_C(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&SC(e,t,r,s,i,t!=="value")):e._isVueCE&&(Ux(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Xn(r)))?_C(e,Nr(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),SC(e,t,r,s))},xy={},GC=((e,t)=>AC(e,t,zy)),WC=typeof HTMLElement<"u"?HTMLElement:class{},Ry=class RE extends WC{constructor(t,n={},r=yc){super(),this._def=t,this._props=n,this._createApp=r,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._styleAnchors=new WeakMap,this._ob=null,this.shadowRoot&&r!==yc?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(Gn({},t.shadowRootOptions,{mode:"open"})),this._root=this.shadowRoot):this._root=this}connectedCallback(){if(!this.isConnected)return;!this.shadowRoot&&!this._resolved&&this._parseSlots(),this._connected=!0;let t=this;for(;t=t&&(t.assignedSlot||t.parentNode||t.host);)if(t instanceof RE){this._parent=t;break}this._instance||(this._resolved?this._mount(this._def):t&&t._pendingResolve?this._pendingResolve=t._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(t=this._parent){t&&(this._instance.parent=t._instance,this._inheritParentContext(t))}_inheritParentContext(t=this._parent){t&&this._app&&Object.setPrototypeOf(this._app._context.provides,t._instance.provides)}disconnectedCallback(){this._connected=!1,St(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&(this._teleportTargets.clear(),this._teleportTargets=void 0))})}_processMutations(t){for(const n of t)this._setAttr(n.attributeName)}_resolveDef(){if(this._pendingResolve)return;for(let r=0;r<this.attributes.length;r++)this._setAttr(this.attributes[r].name);this._ob=new MutationObserver(this._processMutations.bind(this)),this._ob.observe(this,{attributes:!0});const t=(r,o=!1)=>{this._resolved=!0,this._pendingResolve=void 0;const{props:i,styles:s}=r;let a;if(i&&!zt(i))for(const l in i){const u=i[l];(u===Number||u&&u.type===Number)&&(l in this._props&&(this._props[l]=Vd(this._props[l])),(a||(a=Object.create(null)))[Nr(l)]=!0)}this._numberProps=a,this._resolveProps(r),this.shadowRoot&&this._applyStyles(s),this._mount(r)},n=this._def.__asyncLoader;n?this._pendingResolve=n().then(r=>{r.configureApp=this._def.configureApp,t(this._def=r,!0)}):t(this._def)}_mount(t){this._app=this._createApp(t),this._inheritParentContext(),t.configureApp&&t.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);const n=this._instance&&this._instance.exposed;if(n)for(const r in n)jn(this,r)||Object.defineProperty(this,r,{get:()=>Qe(n[r])})}_resolveProps(t){const{props:n}=t,r=zt(n)?n:Object.keys(n||{});for(const o of Object.keys(this))o[0]!=="_"&&r.includes(o)&&this._setProp(o,this[o]);for(const o of r.map(Nr))Object.defineProperty(this,o,{get(){return this._getProp(o)},set(i){this._setProp(o,i,!0,!this._patching)}})}_setAttr(t){if(t.startsWith("data-v-"))return;const n=this.hasAttribute(t);let r=n?this.getAttribute(t):xy;const o=Nr(t);n&&this._numberProps&&this._numberProps[o]&&(r=Vd(r)),this._setProp(o,r,!1,!0)}_getProp(t){return this._props[t]}_setProp(t,n,r=!0,o=!1){if(n!==this._props[t]&&(this._dirty=!0,n===xy?delete this._props[t]:(this._props[t]=n,t==="key"&&this._app&&(this._app._ceVNode.key=n)),o&&this._instance&&this._update(),r)){const i=this._ob;i&&(this._processMutations(i.takeRecords()),i.disconnect()),n===!0?this.setAttribute(Vo(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(Vo(t),n+""):n||this.removeAttribute(Vo(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),By(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=Xt(this._def,Gn(t,this._props));return this._instance||(n.ce=r=>{this._instance=r,r.ce=this,r.isCE=!0;const o=(i,s)=>{this.dispatchEvent(new CustomEvent(i,Nd(s[0])?Gn({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),Vo(i)!==i&&o(Vo(i),s)},this._setParent()}),n}_applyStyles(t,n,r){if(!t)return;if(n){if(n===this._def||this._styleChildren.has(n))return;this._styleChildren.add(n)}const o=this._nonce,i=this.shadowRoot,s=r?this._getStyleAnchor(r)||this._getStyleAnchor(this._def):this._getRootStyleInsertionAnchor(i);let a=null;for(let l=t.length-1;l>=0;l--){const u=document.createElement("style");o&&u.setAttribute("nonce",o),u.textContent=t[l],i.insertBefore(u,a||s),a=u,l===0&&(r||this._styleAnchors.set(this._def,u),n&&this._styleAnchors.set(n,u))}}_getStyleAnchor(t){if(!t)return null;const n=this._styleAnchors.get(t);return n&&n.parentNode===this.shadowRoot?n:(n&&this._styleAnchors.delete(t),null)}_getRootStyleInsertionAnchor(t){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(!(r instanceof HTMLStyleElement))return r}return null}_parseSlots(){const t=this._slots={};let n;for(;n=this.firstChild;){const r=n.nodeType===1&&n.getAttribute("slot")||"default";(t[r]||(t[r]=[])).push(n),this.removeChild(n)}}_renderSlots(){const t=this._getSlots(),n=this._instance.type.__scopeId;for(let r=0;r<t.length;r++){const o=t[r],i=o.getAttribute("name")||"default",s=this._slots[i],a=o.parentNode;if(s)for(const l of s){if(n&&l.nodeType===1){const u=n+"-s",d=document.createTreeWalker(l,1);l.setAttribute(u,"");let f;for(;f=d.nextNode();)f.setAttribute(u,"")}a.insertBefore(l,o)}else for(;o.firstChild;)a.insertBefore(o.firstChild,o);a.removeChild(o)}}_getSlots(){const t=[this];this._teleportTargets&&t.push(...this._teleportTargets);const n=new Set;for(const r of t){const o=r.querySelectorAll("slot");for(let i=0;i<o.length;i++)n.add(o[i])}return Array.from(n)}_injectChildStyle(t,n){this._applyStyles(t.styles,t,n)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return this._def.shadowRoot!==!1}_removeChildStyle(t){}},My=new WeakMap,Ly=new WeakMap,wf=Symbol("_moveCb"),Dy=Symbol("_enterCb"),KC=e=>(delete e.props.mode,e),qC=KC({name:"TransitionGroup",props:Gn({},vy,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=pr(),r=bv();let o,i;return pf(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!qx(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(Gx),o.forEach(Wx);const a=o.filter(Kx);uy(n.vnode.el),a.forEach(l=>{const u=l.el,d=u.style;Ps(u,s),d.transform=d.webkitTransform=d.transitionDuration="";const f=u[wf]=p=>{p&&p.target!==u||(!p||p.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",f),u[wf]=null,gl(u,s))};u.addEventListener("transitionend",f)}),o=[]}),()=>{const s=pn(e),a=vC(s);let l=s.tag||Kt;if(o=[],i)for(let u=0;u<i.length;u++){const d=i[u];d.el&&d.el instanceof Element&&(o.push(d),ba(d,fu(d,a,r,n)),My.set(d,EC(d.el)))}i=t.default?Qh(t.default()):[];for(let u=0;u<i.length;u++){const d=i[u];d.key!=null&&ba(d,fu(d,a,r,n))}return Xt(l,null,i)}}}),Ia=e=>{const t=e.props["onUpdate:modelValue"]||!1;return zt(t)?n=>ac(t,n):t},yi=Symbol("_assign"),ji={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[yi]=Ia(o);const i=r||o.props&&o.props.type==="number";_a(e,t?"change":"input",s=>{s.target.composing||e[yi](xC(e.value,n,i))}),(n||i)&&_a(e,"change",()=>{e.value=xC(e.value,n,i)}),t||(_a(e,"compositionstart",Yx),_a(e,"compositionend",TC),_a(e,"change",TC))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[yi]=Ia(s),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?jd(e.value):e.value,l=t??"";if(a===l)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},Tp={deep:!0,created(e,t,n){e[yi]=Ia(n),_a(e,"change",()=>{const r=e._modelValue,o=_u(e),i=e.checked,s=e[yi];if(zt(r)){const a=Nh(r,o),l=a!==-1;if(i&&!l)s(r.concat(o));else if(!i&&l){const u=[...r];u.splice(a,1),s(u)}}else if(il(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(LC(e,i))})},mounted:RC,beforeUpdate(e,t,n){e[yi]=Ia(n),RC(e,t,n)}},xp={created(e,{value:t},n){e.checked=da(t,n.props.value),e[yi]=Ia(n),_a(e,"change",()=>{e[yi](_u(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[yi]=Ia(r),t!==n&&(e.checked=da(t,r.props.value))}},Oy={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=il(t);_a(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?jd(_u(s)):_u(s));e[yi](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,St(()=>{e._assigning=!1})}),e[yi]=Ia(r)},mounted(e,{value:t}){MC(e,t)},beforeUpdate(e,t,n){e[yi]=Ia(n)},updated(e,{value:t}){e._assigning||MC(e,t)}},Py={created(e,t,n){Sp(e,t,n,null,"created")},mounted(e,t,n){Sp(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){Sp(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){Sp(e,t,n,r,"updated")}},YC=["ctrl","shift","alt","meta"],XC={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>YC.some(n=>e[`${n}Key`]&&!t.includes(n))},Jt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((o,...i)=>{for(let s=0;s<t.length;s++){const a=XC[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},ZC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},ii=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=Vo(o.key);if(t.some(s=>s===i||ZC[s]===i))return e(o)}))},Fy=Gn({patchProp:Ty},my),Ny=!1,By=((...e)=>{OC().render(...e)}),QC=((...e)=>{PC().hydrate(...e)}),yc=((...e)=>{const t=OC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=NC(r);if(!o)return;const i=t._component;!Zt(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,FC(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),zy=((...e)=>{const t=PC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=NC(r);if(o)return n(o,!0,FC(o))},t}),jy=!1,JC=()=>{jy||(jy=!0,Xx(),Lx())}})),Qx=Ld({BaseTransition:()=>Gv,BaseTransitionPropsValidators:()=>cp,Comment:()=>Rr,DeprecationTypes:()=>null,EffectScope:()=>Wh,ErrorCodes:()=>Dw,ErrorTypeStrings:()=>fC,Fragment:()=>Kt,KeepAlive:()=>qw,ReactiveEffect:()=>lu,Static:()=>hl,Suspense:()=>sC,Teleport:()=>dl,Text:()=>Sa,TrackOpTypes:()=>P1,Transition:()=>Ap,TransitionGroup:()=>qC,TriggerOpTypes:()=>F1,VueElement:()=>Ry,assertNumber:()=>ET,callWithAsyncErrorHandling:()=>zi,callWithErrorHandling:()=>du,camelize:()=>Nr,capitalize:()=>iu,cloneVNode:()=>Ms,compatUtils:()=>null,compile:()=>ek,computed:()=>ke,createApp:()=>yc,createBlock:()=>an,createCommentVNode:()=>vt,createElementBlock:()=>De,createElementVNode:()=>He,createHydrationRenderer:()=>gw,createPropsRestProxy:()=>ex,createRenderer:()=>mw,createSSRApp:()=>zy,createSlots:()=>HT,createStaticVNode:()=>Cx,createTextVNode:()=>as,createVNode:()=>Xt,customRef:()=>h1,defineAsyncComponent:()=>X1,defineComponent:()=>uc,defineCustomElement:()=>AC,defineEmits:()=>WT,defineExpose:()=>KT,defineModel:()=>XT,defineOptions:()=>qT,defineProps:()=>GT,defineSSRCustomElement:()=>GC,defineSlots:()=>YT,devtools:()=>hC,effect:()=>uT,effectScope:()=>Zg,getCurrentInstance:()=>pr,getCurrentScope:()=>Qg,getCurrentWatcher:()=>kT,getTransitionRawChildren:()=>Qh,guardReactiveProps:()=>Iw,h:()=>zr,handleError:()=>cc,hasInjectionContext:()=>U1,hydrate:()=>QC,hydrateOnIdle:()=>$w,hydrateOnInteraction:()=>Kw,hydrateOnMediaQuery:()=>Ww,hydrateOnVisible:()=>Gw,initCustomFormatter:()=>Ax,initDirectivesForSSR:()=>JC,inject:()=>ll,isMemoSame:()=>Lw,isProxy:()=>$d,isReactive:()=>Fi,isReadonly:()=>xs,isRef:()=>lr,isRuntimeOnly:()=>cC,isShallow:()=>ni,isVNode:()=>wa,markRaw:()=>Wr,mergeDefaults:()=>QT,mergeModels:()=>JT,mergeProps:()=>Ls,nextTick:()=>St,nodeOps:()=>my,normalizeClass:()=>en,normalizeProps:()=>Ug,normalizeStyle:()=>bn,onActivated:()=>kv,onBeforeMount:()=>qv,onBeforeUnmount:()=>cr,onBeforeUpdate:()=>up,onDeactivated:()=>Sv,onErrorCaptured:()=>Q1,onMounted:()=>Nn,onRenderTracked:()=>Zv,onRenderTriggered:()=>Xv,onScopeDispose:()=>r1,onServerPrefetch:()=>Yv,onUnmounted:()=>mf,onUpdated:()=>pf,onWatcherCleanup:()=>g1,openBlock:()=>ye,patchProp:()=>Ty,popScopeId:()=>MT,provide:()=>V1,proxyRefs:()=>iv,pushScopeId:()=>RT,queuePostFlushCb:()=>Qd,reactive:()=>no,readonly:()=>$h,ref:()=>re,registerRuntimeCompiler:()=>Sx,render:()=>By,renderList:()=>ir,renderSlot:()=>pu,resolveComponent:()=>UT,resolveDirective:()=>J1,resolveDynamicComponent:()=>Av,resolveFilter:()=>null,resolveTransitionHooks:()=>fu,setBlockTracking:()=>af,setDevtoolsHook:()=>pC,setTransitionHooks:()=>ba,shallowReactive:()=>d1,shallowReadonly:()=>yT,shallowRef:()=>Br,ssrContextKey:()=>Bv,ssrUtils:()=>mC,stop:()=>dT,toDisplayString:()=>Ut,toHandlerKey:()=>su,toHandlers:()=>$T,toRaw:()=>pn,toRef:()=>sv,toRefs:()=>p1,toValue:()=>wT,transformVNodeArgs:()=>bx,triggerRef:()=>bT,unref:()=>Qe,useAttrs:()=>nw,useCssModule:()=>$x,useCssVars:()=>Dx,useHost:()=>IC,useId:()=>FT,useModel:()=>ax,useSSRContext:()=>zv,useShadowRoot:()=>Hx,useSlots:()=>tw,useTemplateRef:()=>NT,useTransitionState:()=>bv,vModelCheckbox:()=>Tp,vModelDynamic:()=>Py,vModelRadio:()=>xp,vModelSelect:()=>Oy,vModelText:()=>ji,vShow:()=>wy,version:()=>ly,warn:()=>dC,watch:()=>jt,watchEffect:()=>LT,watchPostEffect:()=>DT,watchSyncEffect:()=>H1,withAsyncContext:()=>tx,withCtx:()=>ao,withDefaults:()=>ZT,withDirectives:()=>ya,withKeys:()=>ii,withMemo:()=>Ix,withModifiers:()=>Jt,withScopeId:()=>Pw}),ek,Ft=xr((()=>{Zx(),ek=()=>{}})),Jx=z2(((e,t)=>{(function(n){typeof e=="object"&&typeof t<"u"?t.exports=n():typeof define=="function"&&define.amd?define([],n):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=n()})(function(){return(function n(r,o,i){function s(u,d){if(!o[u]){if(!r[u]){var f=typeof require=="function"&&require;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var g=o[u]={exports:{}};r[u][0].call(g.exports,function(m){var v=r[u][1][m];return s(v||m)},g,g.exports,n,r,o,i)}return o[u].exports}for(var a=typeof require=="function"&&require,l=0;l<i.length;l++)s(i[l]);return s})({1:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var u,d,f,p,g,m,v,k=[],b=0,S=l.length,C=S,w=i.getTypeOf(l)!=="string";b<l.length;)C=S-b,f=w?(u=l[b++],d=b<S?l[b++]:0,b<S?l[b++]:0):(u=l.charCodeAt(b++),d=b<S?l.charCodeAt(b++):0,b<S?l.charCodeAt(b++):0),p=u>>2,g=(3&u)<<4|d>>4,m=1<C?(15&d)<<2|f>>6:64,v=2<C?63&f:64,k.push(a.charAt(p)+a.charAt(g)+a.charAt(m)+a.charAt(v));return k.join("")},o.decode=function(l){var u,d,f,p,g,m,v=0,k=0,b="data:";if(l.substr(0,b.length)===b)throw new Error("Invalid base64 input, it looks like a data url.");var S,C=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&C--,l.charAt(l.length-2)===a.charAt(64)&&C--,C%1!=0)throw new Error("Invalid base64 input, bad content length.");for(S=s.uint8array?new Uint8Array(0|C):new Array(0|C);v<l.length;)u=a.indexOf(l.charAt(v++))<<2|(p=a.indexOf(l.charAt(v++)))>>4,d=(15&p)<<4|(g=a.indexOf(l.charAt(v++)))>>2,f=(3&g)<<6|(m=a.indexOf(l.charAt(v++))),S[k++]=u,g!==64&&(S[k++]=d),m!==64&&(S[k++]=f);return S}},{"./support":30,"./utils":32}],2:[function(n,r,o){"use strict";var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(d,f,p,g,m){this.compressedSize=d,this.uncompressedSize=f,this.crc32=p,this.compression=g,this.compressedContent=m}u.prototype={getContentWorker:function(){var d=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,p){return d.pipe(new a).pipe(new l("uncompressedSize")).pipe(f.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",f)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){"use strict";var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){"use strict";var i=n("./utils"),s=(function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l})();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?(function(u,d,f,p){var g=s,m=p+f;u^=-1;for(var v=p;v<m;v++)u=u>>>8^g[255&(u^d[v])];return-1^u})(0|l,a,a.length,0):(function(u,d,f,p){var g=s,m=p+f;u^=-1;for(var v=p;v<m;v++)u=u>>>8^g[255&(u^d.charCodeAt(v))];return-1^u})(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){"use strict";o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){"use strict";var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=i?"uint8array":"array";function d(f,p){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(d,l),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},d.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(p){f.push({data:p,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){"use strict";function i(g,m){var v,k="";for(v=0;v<m;v++)k+=String.fromCharCode(255&g),g>>>=8;return k}function s(g,m,v,k,b,S){var C,w,T=g.file,L=g.compression,z=S!==u.utf8encode,W=a.transformTo("string",S(T.name)),V=a.transformTo("string",u.utf8encode(T.name)),j=T.comment,Z=a.transformTo("string",S(j)),R=a.transformTo("string",u.utf8encode(j)),K=V.length!==T.name.length,x=R.length!==j.length,$="",H="",J="",Q=T.dir,Y=T.date,_e={crc32:0,compressedSize:0,uncompressedSize:0};m&&!v||(_e.crc32=g.crc32,_e.compressedSize=g.compressedSize,_e.uncompressedSize=g.uncompressedSize);var ue=0;m&&(ue|=8),z||!K&&!x||(ue|=2048);var ve=0,ge=0;Q&&(ve|=16),b==="UNIX"?(ge=798,ve|=(function(Ne,Je){var ct=Ne;return Ne||(ct=Je?16893:33204),(65535&ct)<<16})(T.unixPermissions,Q)):(ge=20,ve|=(function(Ne){return 63&(Ne||0)})(T.dosPermissions)),C=Y.getUTCHours(),C<<=6,C|=Y.getUTCMinutes(),C<<=5,C|=Y.getUTCSeconds()/2,w=Y.getUTCFullYear()-1980,w<<=4,w|=Y.getUTCMonth()+1,w<<=5,w|=Y.getUTCDate(),K&&(H=i(1,1)+i(d(W),4)+V,$+="up"+i(H.length,2)+H),x&&(J=i(1,1)+i(d(Z),4)+R,$+="uc"+i(J.length,2)+J);var Te="";return Te+=`
|
|
4
|
+
\0`,Te+=i(ue,2),Te+=L.magic,Te+=i(C,2),Te+=i(w,2),Te+=i(_e.crc32,4),Te+=i(_e.compressedSize,4),Te+=i(_e.uncompressedSize,4),Te+=i(W.length,2),Te+=i($.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Te+W+$,dirRecord:f.CENTRAL_FILE_HEADER+i(ge,2)+Te+i(Z.length,2)+"\0\0\0\0"+i(ve,4)+i(k,4)+W+$+Z}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(g,m,v,k){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=v,this.encodeFileName=k,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(g){var m=g.meta.percent||0,v=this.entriesCount,k=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:v?(m+100*(v-k-1))/v:100}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(k){return f.DATA_DESCRIPTOR+i(k.crc32,4)+i(k.compressedSize,4)+i(k.uncompressedSize,4)})(g),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,k=(function(b,S,C,w,T){var L=a.transformTo("string",T(w));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(b,2)+i(b,2)+i(S,4)+i(C,4)+i(L.length,2)+L})(this.dirRecords.length,v,g,this.zipComment,this.encodeFileName);this.push({data:k,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var d=new s(l.streamFiles,u,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var m=(function(S,C){var w=S||C,T=i[w];if(!T)throw new Error(w+" is not a valid compression method !");return T})(g.options.compression,l.compression),v=g.options.compressionOptions||l.compressionOptions||{},k=g.dir,b=g.date;g._compressWorker(m,v).withStreamInfo("file",{name:p,dir:k,date:b,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,m){var v=p.decompressed.getContentWorker().pipe(new u);v.on("error",function(k){m(k)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(v){var k=new l(g);return k.load(v),k}).then(function(v){var k=[s.Promise.resolve(v)],b=v.files;if(g.checkCRC32)for(var S=0;S<b.length;S++)k.push(f(b[S]));return s.Promise.all(k)}).then(function(v){for(var k=v.shift(),b=k.files,S=0;S<b.length;S++){var C=b[S],w=C.fileNameStr,T=i.resolve(C.fileNameStr);m.file(T,C.decompressed,{binary:!0,optimizedBinaryString:!0,date:C.date,dir:C.dir,comment:C.fileCommentStr.length?C.fileCommentStr:null,unixPermissions:C.unixPermissions,dosPermissions:C.dosPermissions,createFolders:g.createFolders}),C.dir||(m.file(T).unsafeOriginalName=w)}return k.zipComment.length&&(m.comment=k.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,p){d.push(f)||d._helper.pause(),u&&u(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(w,T,L){var z,W=a.getTypeOf(T),V=a.extend(L||{},d);V.date=V.date||new Date,V.compression!==null&&(V.compression=V.compression.toUpperCase()),typeof V.unixPermissions=="string"&&(V.unixPermissions=parseInt(V.unixPermissions,8)),V.unixPermissions&&16384&V.unixPermissions&&(V.dir=!0),V.dosPermissions&&16&V.dosPermissions&&(V.dir=!0),V.dir&&(w=b(w)),V.createFolders&&(z=k(w))&&S.call(this,z,!0);var j=W==="string"&&V.binary===!1&&V.base64===!1;L&&L.binary!==void 0||(V.binary=!j),(T instanceof f&&T.uncompressedSize===0||V.dir||!T||T.length===0)&&(V.base64=!1,V.binary=!0,T="",V.compression="STORE",W="string");var Z=null;Z=T instanceof f||T instanceof l?T:m.isNode&&m.isStream(T)?new v(w,T):a.prepareContent(w,T,V.binary,V.optimizedBinaryString,V.base64);var R=new p(w,Z,V);this.files[w]=R}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),k=function(w){w.slice(-1)==="/"&&(w=w.substring(0,w.length-1));var T=w.lastIndexOf("/");return 0<T?w.substring(0,T):""},b=function(w){return w.slice(-1)!=="/"&&(w+="/"),w},S=function(w,T){return T=T!==void 0?T:d.createFolders,w=b(w),this.files[w]||i.call(this,w,null,{dir:!0,createFolders:T}),this.files[w]};function C(w){return Object.prototype.toString.call(w)==="[object RegExp]"}r.exports={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(w){var T,L,z;for(T in this.files)z=this.files[T],(L=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&w(L,z)},filter:function(w){var T=[];return this.forEach(function(L,z){w(L,z)&&T.push(z)}),T},file:function(w,T,L){if(arguments.length!==1)return w=this.root+w,i.call(this,w,T,L),this;if(C(w)){var z=w;return this.filter(function(V,j){return!j.dir&&z.test(V)})}var W=this.files[this.root+w];return W&&!W.dir?W:null},folder:function(w){if(!w)return this;if(C(w))return this.filter(function(W,V){return V.dir&&w.test(W)});var T=this.root+w,L=S.call(this,T),z=this.clone();return z.root=L.name,z},remove:function(w){w=this.root+w;var T=this.files[w];if(T||(w.slice(-1)!=="/"&&(w+="/"),T=this.files[w]),T&&!T.dir)delete this.files[w];else for(var L=this.filter(function(W,V){return V.name.slice(0,w.length)===w}),z=0;z<L.length;z++)delete this.files[L[z].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(w){var T,L={};try{if((L=a.extend(w||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=L.type.toLowerCase(),L.compression=L.compression.toUpperCase(),L.type==="binarystring"&&(L.type="string"),!L.type)throw new Error("No output type specified.");a.checkSupport(L.type),L.platform!=="darwin"&&L.platform!=="freebsd"&&L.platform!=="linux"&&L.platform!=="sunos"||(L.platform="UNIX"),L.platform==="win32"&&(L.platform="DOS");var z=L.comment||this.comment||"";T=g.generateWorker(this,L,z)}catch(W){(T=new l("error")).error(W)}return new u(T,L.type||"string",L.mimeType)},generateAsync:function(w,T){return this.generateInternalStream(w).accumulate(T)},generateNodeStream:function(w,T){return(w=w||{}).type||(w.type="nodebuffer"),this.generateInternalStream(w).toNodejsStream(T)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){"use strict";r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(f):s.uint8array?new d(i.transformTo("uint8array",f)):new a(i.transformTo("array",f)):new l(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(m,v){return new d.Promise(function(k,b){var S=[],C=m._internalType,w=m._outputType,T=m._mimeType;m.on("data",function(L,z){S.push(L),v&&v(z)}).on("error",function(L){S=[],b(L)}).on("end",function(){try{k((function(L,z,W){switch(L){case"blob":return i.newBlob(i.transformTo("arraybuffer",z),W);case"base64":return l.encode(z);default:return i.transformTo(L,z)}})(w,(function(L,z){var W,V=0,j=null,Z=0;for(W=0;W<z.length;W++)Z+=z[W].length;switch(L){case"string":return z.join("");case"array":return Array.prototype.concat.apply([],z);case"uint8array":for(j=new Uint8Array(Z),W=0;W<z.length;W++)j.set(z[W],V),V+=z[W].length;return j;case"nodebuffer":return Buffer.concat(z);default:throw new Error("concat : unsupported type '"+L+"'")}})(C,S),T))}catch(L){b(L)}S=[]}).resume()})}function g(m,v,k){var b=v;switch(v){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=v,this._mimeType=k,i.checkSupport(b),this._worker=m.pipe(new s(b)),m.lock()}catch(S){this._worker=new a("error"),this._worker.error(S)}}g.prototype={accumulate:function(m){return p(this,m)},on:function(m,v){var k=this;return m==="data"?this._worker.on(m,function(b){v.call(k,b.data,b.meta)}):this._worker.on(m,function(){i.delay(v,arguments,k)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},m)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,k,b,S,C,w=m.length,T=0;for(S=0;S<w;S++)(64512&(k=m.charCodeAt(S)))==55296&&S+1<w&&(64512&(b=m.charCodeAt(S+1)))==56320&&(k=65536+(k-55296<<10)+(b-56320),S++),T+=k<128?1:k<2048?2:k<65536?3:4;for(v=s.uint8array?new Uint8Array(T):new Array(T),S=C=0;C<T;S++)(64512&(k=m.charCodeAt(S)))==55296&&S+1<w&&(64512&(b=m.charCodeAt(S+1)))==56320&&(k=65536+(k-55296<<10)+(b-56320),S++),k<128?v[C++]=k:(k<2048?v[C++]=192|k>>>6:(k<65536?v[C++]=224|k>>>12:(v[C++]=240|k>>>18,v[C++]=128|k>>>12&63),v[C++]=128|k>>>6&63),v[C++]=128|63&k);return v})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(m){var v,k,b,S,C=m.length,w=new Array(2*C);for(v=k=0;v<C;)if((b=m[v++])<128)w[k++]=b;else if(4<(S=u[b]))w[k++]=65533,v+=S-1;else{for(b&=S===2?31:S===3?15:7;1<S&&v<C;)b=b<<6|63&m[v++],S--;1<S?w[k++]=65533:b<65536?w[k++]=b:(b-=65536,w[k++]=55296|b>>10&1023,w[k++]=56320|1023&b)}return w.length!==k&&(w.subarray?w=w.subarray(0,k):w.length=k),i.applyFromCharCode(w)})(g=i.transformTo(s.uint8array?"uint8array":"array",g))},i.inherits(f,l),f.prototype.processChunk=function(g){var m=i.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=m;(m=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),m.set(v,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var k=(function(S,C){var w;for((C=C||S.length)>S.length&&(C=S.length),w=C-1;0<=w&&(192&S[w])==128;)w--;return w<0||w===0?C:w+u[S[w]]>C?w:C})(m),b=m;k!==m.length&&(s.uint8array?(b=m.subarray(0,k),this.leftOver=m.subarray(k,m.length)):(b=m.slice(0,k),this.leftOver=m.slice(k,m.length))),this.push({data:o.utf8decode(b),meta:g.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(v){return v}function d(v,k){for(var b=0;b<v.length;++b)k[b]=255&v.charCodeAt(b);return k}n("setimmediate"),o.newBlob=function(v,k){o.checkSupport("blob");try{return new Blob([v],{type:k})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(v),b.getBlob(k)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(v,k,b){var S=[],C=0,w=v.length;if(w<=b)return String.fromCharCode.apply(null,v);for(;C<w;)k==="array"||k==="nodebuffer"?S.push(String.fromCharCode.apply(null,v.slice(C,Math.min(C+b,w)))):S.push(String.fromCharCode.apply(null,v.subarray(C,Math.min(C+b,w)))),C+=b;return S.join("")},stringifyByChar:function(v){for(var k="",b=0;b<v.length;b++)k+=String.fromCharCode(v[b]);return k},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}})()}};function p(v){var k=65536,b=o.getTypeOf(v),S=!0;if(b==="uint8array"?S=f.applyCanBeUsed.uint8array:b==="nodebuffer"&&(S=f.applyCanBeUsed.nodebuffer),S)for(;1<k;)try{return f.stringifyByChunk(v,b,k)}catch{k=Math.floor(k/2)}return f.stringifyByChar(v)}function g(v,k){for(var b=0;b<v.length;b++)k[b]=v[b];return k}o.applyFromCharCode=p;var m={};m.string={string:u,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return m.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},m.array={string:p,array:u,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(v)}},m.arraybuffer={string:function(v){return p(new Uint8Array(v))},array:function(v){return g(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:u,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(new Uint8Array(v))}},m.uint8array={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return a.newBufferFrom(v)}},m.nodebuffer={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer:u},o.transformTo=function(v,k){return k=k||"",v?(o.checkSupport(v),m[o.getTypeOf(k)][v](k)):k},o.resolve=function(v){for(var k=v.split("/"),b=[],S=0;S<k.length;S++){var C=k[S];C==="."||C===""&&S!==0&&S!==k.length-1||(C===".."?b.pop():b.push(C))}return b.join("/")},o.getTypeOf=function(v){return typeof v=="string"?"string":Object.prototype.toString.call(v)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(v)?"nodebuffer":i.uint8array&&v instanceof Uint8Array?"uint8array":i.arraybuffer&&v instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(v){if(!i[v.toLowerCase()])throw new Error(v+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(v){var k,b,S="";for(b=0;b<(v||"").length;b++)S+="\\x"+((k=v.charCodeAt(b))<16?"0":"")+k.toString(16).toUpperCase();return S},o.delay=function(v,k,b){setImmediate(function(){v.apply(b||null,k||[])})},o.inherits=function(v,k){function b(){}b.prototype=k.prototype,v.prototype=new b},o.extend=function(){var v,k,b={};for(v=0;v<arguments.length;v++)for(k in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],k)&&b[k]===void 0&&(b[k]=arguments[v][k]);return b},o.prepareContent=function(v,k,b,S,C){return l.Promise.resolve(k).then(function(w){return i.blob&&(w instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(w))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,L){var z=new FileReader;z.onload=function(W){T(W.target.result)},z.onerror=function(W){L(W.target.error)},z.readAsArrayBuffer(w)}):w}).then(function(w){var T=o.getTypeOf(w);return T?(T==="arraybuffer"?w=o.transformTo("uint8array",w):T==="string"&&(C?w=s.decode(w):b&&S!==!0&&(w=(function(L){return d(L,i.uint8array?new Uint8Array(L.length):new Array(L.length))})(w))),w):l.Promise.reject(new Error("Can't read the data of '"+v+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===p;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=p-g;if(0<m)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,m){this.options=g,this.loadOptions=m}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(k){for(var b in d)if(Object.prototype.hasOwnProperty.call(d,b)&&d[b].magic===k)return d[b];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,m,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var m=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(m),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var m,v,k,b=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<b;)m=g.readInt(2),v=g.readInt(2),k=g.readData(v),this.extraFields[m]={id:m,length:v,value:k};g.setIndex(b)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var v=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var k=this.findExtraFieldUnicodeComment();if(k!==null)this.fileCommentStr=k;else{var b=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,k){this.name=m,this.dir=k.dir,this.date=k.date,this.comment=k.comment,this.unixPermissions=k.unixPermissions,this.dosPermissions=k.dosPermissions,this._data=v,this._dataBinary=k.binary,this.options={compression:k.compression,compressionOptions:k.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(m){var v=null,k="string";try{if(!m)throw new Error("No output type specified.");var b=(k=m.toLowerCase())==="string"||k==="text";k!=="binarystring"&&k!=="text"||(k="string"),v=this._decompressWorker();var S=!this._dataBinary;S&&!b&&(v=v.pipe(new l.Utf8EncodeWorker)),!S&&b&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(C){(v=new d("error")).error(C)}return new s(v,k,"")},async:function(m,v){return this.internalStream(m).accumulate(v)},nodeStream:function(m,v){return this.internalStream(m||"nodebuffer").toNodejsStream(v)},_compressWorker:function(m,v){if(this._data instanceof u&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var k=this._decompressWorker();return this._dataBinary||(k=k.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(k,m,v)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,d=new l(m),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(m,0)};else{var p=new i.MessageChannel;p.port1.onmessage=m,s=function(){p.port2.postMessage(0)}}var g=[];function m(){var v,k;a=!0;for(var b=g.length;b;){for(k=g,g=[],v=-1;++v<b;)k[v]();b=g.length}a=!1}r.exports=function(v){g.push(v)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(b){if(typeof b!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,b!==s&&v(this,b)}function p(b,S,C){this.promise=b,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof C=="function"&&(this.onRejected=C,this.callRejected=this.otherCallRejected)}function g(b,S,C){i(function(){var w;try{w=S(C)}catch(T){return a.reject(b,T)}w===b?a.reject(b,new TypeError("Cannot resolve promise with itself")):a.resolve(b,w)})}function m(b){var S=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof S=="function")return function(){S.apply(b,arguments)}}function v(b,S){var C=!1;function w(z){C||(C=!0,a.reject(b,z))}function T(z){C||(C=!0,a.resolve(b,z))}var L=k(function(){S(T,w)});L.status==="error"&&w(L.value)}function k(b,S){var C={};try{C.value=b(S),C.status="success"}catch(w){C.status="error",C.value=w}return C}(r.exports=f).prototype.finally=function(b){if(typeof b!="function")return this;var S=this.constructor;return this.then(function(C){return S.resolve(b()).then(function(){return C})},function(C){return S.resolve(b()).then(function(){throw C})})},f.prototype.catch=function(b){return this.then(null,b)},f.prototype.then=function(b,S){if(typeof b!="function"&&this.state===u||typeof S!="function"&&this.state===l)return this;var C=new this.constructor(s);return this.state!==d?g(C,this.state===u?b:S,this.outcome):this.queue.push(new p(C,b,S)),C},p.prototype.callFulfilled=function(b){a.resolve(this.promise,b)},p.prototype.otherCallFulfilled=function(b){g(this.promise,this.onFulfilled,b)},p.prototype.callRejected=function(b){a.reject(this.promise,b)},p.prototype.otherCallRejected=function(b){g(this.promise,this.onRejected,b)},a.resolve=function(b,S){var C=k(m,S);if(C.status==="error")return a.reject(b,C.value);var w=C.value;if(w)v(b,w);else{b.state=u,b.outcome=S;for(var T=-1,L=b.queue.length;++T<L;)b.queue[T].callFulfilled(S)}return b},a.reject=function(b,S){b.state=l,b.outcome=S;for(var C=-1,w=b.queue.length;++C<w;)b.queue[C].callRejected(S);return b},f.resolve=function(b){return b instanceof this?b:a.resolve(new this(s),b)},f.reject=function(b){var S=new this(s);return a.reject(S,b)},f.all=function(b){var S=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=b.length,w=!1;if(!C)return this.resolve([]);for(var T=new Array(C),L=0,z=-1,W=new this(s);++z<C;)V(b[z],z);return W;function V(j,Z){S.resolve(j).then(function(R){T[Z]=R,++L!==C||w||(w=!0,a.resolve(W,T))},function(R){w||(w=!0,a.reject(W,R))})}},f.race=function(b){var S=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=b.length,w=!1;if(!C)return this.resolve([]);for(var T=-1,L=new this(s);++T<C;)z=b[T],S.resolve(z).then(function(W){w||(w=!0,a.resolve(L,W))},function(W){w||(w=!0,a.reject(L,W))});var z;return L}},{immediate:36}],38:[function(n,r,o){"use strict";var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){"use strict";var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,p=-1,g=0,m=8;function v(b){if(!(this instanceof v))return new v(b);this.options=s.assign({level:p,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},b||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var C=i.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(C!==f)throw new Error(l[C]);if(S.header&&i.deflateSetHeader(this.strm,S.header),S.dictionary){var w;if(w=typeof S.dictionary=="string"?a.string2buf(S.dictionary):d.call(S.dictionary)==="[object ArrayBuffer]"?new Uint8Array(S.dictionary):S.dictionary,(C=i.deflateSetDictionary(this.strm,w))!==f)throw new Error(l[C]);this._dict_set=!0}}function k(b,S){var C=new v(S);if(C.push(b,!0),C.err)throw C.msg||l[C.err];return C.result}v.prototype.push=function(b,S){var C,w,T=this.strm,L=this.options.chunkSize;if(this.ended)return!1;w=S===~~S?S:S===!0?4:0,typeof b=="string"?T.input=a.string2buf(b):d.call(b)==="[object ArrayBuffer]"?T.input=new Uint8Array(b):T.input=b,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new s.Buf8(L),T.next_out=0,T.avail_out=L),(C=i.deflate(T,w))!==1&&C!==f)return this.onEnd(C),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||w!==4&&w!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(T.output,T.next_out))):this.onData(s.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&C!==1);return w===4?(C=i.deflateEnd(this.strm),this.onEnd(C),this.ended=!0,C===f):w!==2||(this.onEnd(f),!(T.avail_out=0))},v.prototype.onData=function(b){this.chunks.push(b)},v.prototype.onEnd=function(b){b===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},o.Deflate=v,o.deflate=k,o.deflateRaw=function(b,S){return(S=S||{}).raw=!0,k(b,S)},o.gzip=function(b,S){return(S=S||{}).gzip=!0,k(b,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),p=Object.prototype.toString;function g(v){if(!(this instanceof g))return new g(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var k=this.options;k.raw&&0<=k.windowBits&&k.windowBits<16&&(k.windowBits=-k.windowBits,k.windowBits===0&&(k.windowBits=-15)),!(0<=k.windowBits&&k.windowBits<16)||v&&v.windowBits||(k.windowBits+=32),15<k.windowBits&&k.windowBits<48&&(15&k.windowBits)==0&&(k.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var b=i.inflateInit2(this.strm,k.windowBits);if(b!==l.Z_OK)throw new Error(u[b]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function m(v,k){var b=new g(k);if(b.push(v,!0),b.err)throw b.msg||u[b.err];return b.result}g.prototype.push=function(v,k){var b,S,C,w,T,L,z=this.strm,W=this.options.chunkSize,V=this.options.dictionary,j=!1;if(this.ended)return!1;S=k===~~k?k:k===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?z.input=a.binstring2buf(v):p.call(v)==="[object ArrayBuffer]"?z.input=new Uint8Array(v):z.input=v,z.next_in=0,z.avail_in=z.input.length;do{if(z.avail_out===0&&(z.output=new s.Buf8(W),z.next_out=0,z.avail_out=W),(b=i.inflate(z,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&V&&(L=typeof V=="string"?a.string2buf(V):p.call(V)==="[object ArrayBuffer]"?new Uint8Array(V):V,b=i.inflateSetDictionary(this.strm,L)),b===l.Z_BUF_ERROR&&j===!0&&(b=l.Z_OK,j=!1),b!==l.Z_STREAM_END&&b!==l.Z_OK)return this.onEnd(b),!(this.ended=!0);z.next_out&&(z.avail_out!==0&&b!==l.Z_STREAM_END&&(z.avail_in!==0||S!==l.Z_FINISH&&S!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(C=a.utf8border(z.output,z.next_out),w=z.next_out-C,T=a.buf2string(z.output,C),z.next_out=w,z.avail_out=W-w,w&&s.arraySet(z.output,z.output,C,w,0),this.onData(T)):this.onData(s.shrinkBuf(z.output,z.next_out)))),z.avail_in===0&&z.avail_out===0&&(j=!0)}while((0<z.avail_in||z.avail_out===0)&&b!==l.Z_STREAM_END);return b===l.Z_STREAM_END&&(S=l.Z_FINISH),S===l.Z_FINISH?(b=i.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===l.Z_OK):S!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(z.avail_out=0))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Inflate=g,o.inflate=m,o.inflateRaw=function(v,k){return(k=k||{}).raw=!0,m(v,k)},o.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(l[f]=d[f])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,d,f,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){var u,d,f,p,g,m;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(m=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)g=l[u],m.set(g,p),p+=g.length;return m}},a={arraySet:function(l,u,d,f,p){for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",m=0;m<p;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,m,v,k,b=f.length,S=0;for(v=0;v<b;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<b&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),S+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(S),v=k=0;k<S;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<b&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),g<128?p[k++]=g:(g<2048?p[k++]=192|g>>>6:(g<65536?p[k++]=224|g>>>12:(p[k++]=240|g>>>18,p[k++]=128|g>>>12&63),p[k++]=128|g>>>6&63),p[k++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,m=p.length;g<m;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,m,v,k,b=p||f.length,S=new Array(2*b);for(g=m=0;g<b;)if((v=f[g++])<128)S[m++]=v;else if(4<(k=l[v]))S[m++]=65533,g+=k-1;else{for(v&=k===2?31:k===3?15:7;1<k&&g<b;)v=v<<6|63&f[g++],k--;1<k?S[m++]=65533:v<65536?S[m++]=v:(v-=65536,S[m++]=55296|v>>10&1023,S[m++]=56320|1023&v)}return d(S,m)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var d=i,f=u+l;s^=-1;for(var p=u;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,m=-2,v=-1,k=4,b=2,S=8,C=9,w=286,T=30,L=19,z=2*w+1,W=15,V=3,j=258,Z=j+V+1,R=42,K=113,x=1,$=2,H=3,J=4;function Q(I,se){return I.msg=d[se],se}function Y(I){return(I<<1)-(4<I?9:0)}function _e(I){for(var se=I.length;0<=--se;)I[se]=0}function ue(I){var se=I.state,F=se.pending;F>I.avail_out&&(F=I.avail_out),F!==0&&(s.arraySet(I.output,se.pending_buf,se.pending_out,F,I.next_out),I.next_out+=F,se.pending_out+=F,I.total_out+=F,I.avail_out-=F,se.pending-=F,se.pending===0&&(se.pending_out=0))}function ve(I,se){a._tr_flush_block(I,0<=I.block_start?I.block_start:-1,I.strstart-I.block_start,se),I.block_start=I.strstart,ue(I.strm)}function ge(I,se){I.pending_buf[I.pending++]=se}function Te(I,se){I.pending_buf[I.pending++]=se>>>8&255,I.pending_buf[I.pending++]=255&se}function Ne(I,se){var F,q,P=I.max_chain_length,ee=I.strstart,be=I.prev_length,N=I.nice_match,B=I.strstart>I.w_size-Z?I.strstart-(I.w_size-Z):0,de=I.window,Se=I.w_mask,Ae=I.prev,Le=I.strstart+j,Xe=de[ee+be-1],it=de[ee+be];I.prev_length>=I.good_match&&(P>>=2),N>I.lookahead&&(N=I.lookahead);do if(de[(F=se)+be]===it&&de[F+be-1]===Xe&&de[F]===de[ee]&&de[++F]===de[ee+1]){ee+=2,F++;do;while(de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&de[++ee]===de[++F]&&ee<Le);if(q=j-(Le-ee),ee=Le-j,be<q){if(I.match_start=se,N<=(be=q))break;Xe=de[ee+be-1],it=de[ee+be]}}while((se=Ae[se&Se])>B&&--P!=0);return be<=I.lookahead?be:I.lookahead}function Je(I){var se,F,q,P,ee,be,N,B,de,Se,Ae=I.w_size;do{if(P=I.window_size-I.lookahead-I.strstart,I.strstart>=Ae+(Ae-Z)){for(s.arraySet(I.window,I.window,Ae,Ae,0),I.match_start-=Ae,I.strstart-=Ae,I.block_start-=Ae,se=F=I.hash_size;q=I.head[--se],I.head[se]=Ae<=q?q-Ae:0,--F;);for(se=F=Ae;q=I.prev[--se],I.prev[se]=Ae<=q?q-Ae:0,--F;);P+=Ae}if(I.strm.avail_in===0)break;if(be=I.strm,N=I.window,B=I.strstart+I.lookahead,de=P,Se=void 0,Se=be.avail_in,de<Se&&(Se=de),F=Se===0?0:(be.avail_in-=Se,s.arraySet(N,be.input,be.next_in,Se,B),be.state.wrap===1?be.adler=l(be.adler,N,Se,B):be.state.wrap===2&&(be.adler=u(be.adler,N,Se,B)),be.next_in+=Se,be.total_in+=Se,Se),I.lookahead+=F,I.lookahead+I.insert>=V)for(ee=I.strstart-I.insert,I.ins_h=I.window[ee],I.ins_h=(I.ins_h<<I.hash_shift^I.window[ee+1])&I.hash_mask;I.insert&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[ee+V-1])&I.hash_mask,I.prev[ee&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=ee,ee++,I.insert--,!(I.lookahead+I.insert<V)););}while(I.lookahead<Z&&I.strm.avail_in!==0)}function ct(I,se){for(var F,q;;){if(I.lookahead<Z){if(Je(I),I.lookahead<Z&&se===f)return x;if(I.lookahead===0)break}if(F=0,I.lookahead>=V&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+V-1])&I.hash_mask,F=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),F!==0&&I.strstart-F<=I.w_size-Z&&(I.match_length=Ne(I,F)),I.match_length>=V)if(q=a._tr_tally(I,I.strstart-I.match_start,I.match_length-V),I.lookahead-=I.match_length,I.match_length<=I.max_lazy_match&&I.lookahead>=V){for(I.match_length--;I.strstart++,I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+V-1])&I.hash_mask,F=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart,--I.match_length!=0;);I.strstart++}else I.strstart+=I.match_length,I.match_length=0,I.ins_h=I.window[I.strstart],I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+1])&I.hash_mask;else q=a._tr_tally(I,0,I.window[I.strstart]),I.lookahead--,I.strstart++;if(q&&(ve(I,!1),I.strm.avail_out===0))return x}return I.insert=I.strstart<V-1?I.strstart:V-1,se===p?(ve(I,!0),I.strm.avail_out===0?H:J):I.last_lit&&(ve(I,!1),I.strm.avail_out===0)?x:$}function tt(I,se){for(var F,q,P;;){if(I.lookahead<Z){if(Je(I),I.lookahead<Z&&se===f)return x;if(I.lookahead===0)break}if(F=0,I.lookahead>=V&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+V-1])&I.hash_mask,F=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),I.prev_length=I.match_length,I.prev_match=I.match_start,I.match_length=V-1,F!==0&&I.prev_length<I.max_lazy_match&&I.strstart-F<=I.w_size-Z&&(I.match_length=Ne(I,F),I.match_length<=5&&(I.strategy===1||I.match_length===V&&4096<I.strstart-I.match_start)&&(I.match_length=V-1)),I.prev_length>=V&&I.match_length<=I.prev_length){for(P=I.strstart+I.lookahead-V,q=a._tr_tally(I,I.strstart-1-I.prev_match,I.prev_length-V),I.lookahead-=I.prev_length-1,I.prev_length-=2;++I.strstart<=P&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+V-1])&I.hash_mask,F=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),--I.prev_length!=0;);if(I.match_available=0,I.match_length=V-1,I.strstart++,q&&(ve(I,!1),I.strm.avail_out===0))return x}else if(I.match_available){if((q=a._tr_tally(I,0,I.window[I.strstart-1]))&&ve(I,!1),I.strstart++,I.lookahead--,I.strm.avail_out===0)return x}else I.match_available=1,I.strstart++,I.lookahead--}return I.match_available&&(q=a._tr_tally(I,0,I.window[I.strstart-1]),I.match_available=0),I.insert=I.strstart<V-1?I.strstart:V-1,se===p?(ve(I,!0),I.strm.avail_out===0?H:J):I.last_lit&&(ve(I,!1),I.strm.avail_out===0)?x:$}function Tt(I,se,F,q,P){this.good_length=I,this.max_lazy=se,this.nice_length=F,this.max_chain=q,this.func=P}function ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*z),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*L+1)),_e(this.dyn_ltree),_e(this.dyn_dtree),_e(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(W+1),this.heap=new s.Buf16(2*w+1),_e(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*w+1),_e(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ee(I){var se;return I&&I.state?(I.total_in=I.total_out=0,I.data_type=b,(se=I.state).pending=0,se.pending_out=0,se.wrap<0&&(se.wrap=-se.wrap),se.status=se.wrap?R:K,I.adler=se.wrap===2?0:1,se.last_flush=f,a._tr_init(se),g):Q(I,m)}function Ue(I){var se=Ee(I);return se===g&&(function(F){F.window_size=2*F.w_size,_e(F.head),F.max_lazy_match=i[F.level].max_lazy,F.good_match=i[F.level].good_length,F.nice_match=i[F.level].nice_length,F.max_chain_length=i[F.level].max_chain,F.strstart=0,F.block_start=0,F.lookahead=0,F.insert=0,F.match_length=F.prev_length=V-1,F.match_available=0,F.ins_h=0})(I.state),se}function ie(I,se,F,q,P,ee){if(!I)return m;var be=1;if(se===v&&(se=6),q<0?(be=0,q=-q):15<q&&(be=2,q-=16),P<1||C<P||F!==S||q<8||15<q||se<0||9<se||ee<0||k<ee)return Q(I,m);q===8&&(q=9);var N=new ae;return(I.state=N).strm=I,N.wrap=be,N.gzhead=null,N.w_bits=q,N.w_size=1<<N.w_bits,N.w_mask=N.w_size-1,N.hash_bits=P+7,N.hash_size=1<<N.hash_bits,N.hash_mask=N.hash_size-1,N.hash_shift=~~((N.hash_bits+V-1)/V),N.window=new s.Buf8(2*N.w_size),N.head=new s.Buf16(N.hash_size),N.prev=new s.Buf16(N.w_size),N.lit_bufsize=1<<P+6,N.pending_buf_size=4*N.lit_bufsize,N.pending_buf=new s.Buf8(N.pending_buf_size),N.d_buf=1*N.lit_bufsize,N.l_buf=3*N.lit_bufsize,N.level=se,N.strategy=ee,N.method=F,Ue(I)}i=[new Tt(0,0,0,0,function(I,se){var F=65535;for(F>I.pending_buf_size-5&&(F=I.pending_buf_size-5);;){if(I.lookahead<=1){if(Je(I),I.lookahead===0&&se===f)return x;if(I.lookahead===0)break}I.strstart+=I.lookahead,I.lookahead=0;var q=I.block_start+F;if((I.strstart===0||I.strstart>=q)&&(I.lookahead=I.strstart-q,I.strstart=q,ve(I,!1),I.strm.avail_out===0)||I.strstart-I.block_start>=I.w_size-Z&&(ve(I,!1),I.strm.avail_out===0))return x}return I.insert=0,se===p?(ve(I,!0),I.strm.avail_out===0?H:J):(I.strstart>I.block_start&&(ve(I,!1),I.strm.avail_out),x)}),new Tt(4,4,8,4,ct),new Tt(4,5,16,8,ct),new Tt(4,6,32,32,ct),new Tt(4,4,16,16,tt),new Tt(8,16,32,32,tt),new Tt(8,16,128,128,tt),new Tt(8,32,128,256,tt),new Tt(32,128,258,1024,tt),new Tt(32,258,258,4096,tt)],o.deflateInit=function(I,se){return ie(I,se,S,15,8,0)},o.deflateInit2=ie,o.deflateReset=Ue,o.deflateResetKeep=Ee,o.deflateSetHeader=function(I,se){return I&&I.state?I.state.wrap!==2?m:(I.state.gzhead=se,g):m},o.deflate=function(I,se){var F,q,P,ee;if(!I||!I.state||5<se||se<0)return I?Q(I,m):m;if(q=I.state,!I.output||!I.input&&I.avail_in!==0||q.status===666&&se!==p)return Q(I,I.avail_out===0?-5:m);if(q.strm=I,F=q.last_flush,q.last_flush=se,q.status===R)if(q.wrap===2)I.adler=0,ge(q,31),ge(q,139),ge(q,8),q.gzhead?(ge(q,(q.gzhead.text?1:0)+(q.gzhead.hcrc?2:0)+(q.gzhead.extra?4:0)+(q.gzhead.name?8:0)+(q.gzhead.comment?16:0)),ge(q,255&q.gzhead.time),ge(q,q.gzhead.time>>8&255),ge(q,q.gzhead.time>>16&255),ge(q,q.gzhead.time>>24&255),ge(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),ge(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(ge(q,255&q.gzhead.extra.length),ge(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(I.adler=u(I.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(ge(q,0),ge(q,0),ge(q,0),ge(q,0),ge(q,0),ge(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),ge(q,3),q.status=K);else{var be=S+(q.w_bits-8<<4)<<8;be|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(be|=32),be+=31-be%31,q.status=K,Te(q,be),q.strstart!==0&&(Te(q,I.adler>>>16),Te(q,65535&I.adler)),I.adler=1}if(q.status===69)if(q.gzhead.extra){for(P=q.pending;q.gzindex<(65535&q.gzhead.extra.length)&&(q.pending!==q.pending_buf_size||(q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),ue(I),P=q.pending,q.pending!==q.pending_buf_size));)ge(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),q.gzindex===q.gzhead.extra.length&&(q.gzindex=0,q.status=73)}else q.status=73;if(q.status===73)if(q.gzhead.name){P=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),ue(I),P=q.pending,q.pending===q.pending_buf_size)){ee=1;break}ee=q.gzindex<q.gzhead.name.length?255&q.gzhead.name.charCodeAt(q.gzindex++):0,ge(q,ee)}while(ee!==0);q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),ee===0&&(q.gzindex=0,q.status=91)}else q.status=91;if(q.status===91)if(q.gzhead.comment){P=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),ue(I),P=q.pending,q.pending===q.pending_buf_size)){ee=1;break}ee=q.gzindex<q.gzhead.comment.length?255&q.gzhead.comment.charCodeAt(q.gzindex++):0,ge(q,ee)}while(ee!==0);q.gzhead.hcrc&&q.pending>P&&(I.adler=u(I.adler,q.pending_buf,q.pending-P,P)),ee===0&&(q.status=103)}else q.status=103;if(q.status===103&&(q.gzhead.hcrc?(q.pending+2>q.pending_buf_size&&ue(I),q.pending+2<=q.pending_buf_size&&(ge(q,255&I.adler),ge(q,I.adler>>8&255),I.adler=0,q.status=K)):q.status=K),q.pending!==0){if(ue(I),I.avail_out===0)return q.last_flush=-1,g}else if(I.avail_in===0&&Y(se)<=Y(F)&&se!==p)return Q(I,-5);if(q.status===666&&I.avail_in!==0)return Q(I,-5);if(I.avail_in!==0||q.lookahead!==0||se!==f&&q.status!==666){var N=q.strategy===2?(function(B,de){for(var Se;;){if(B.lookahead===0&&(Je(B),B.lookahead===0)){if(de===f)return x;break}if(B.match_length=0,Se=a._tr_tally(B,0,B.window[B.strstart]),B.lookahead--,B.strstart++,Se&&(ve(B,!1),B.strm.avail_out===0))return x}return B.insert=0,de===p?(ve(B,!0),B.strm.avail_out===0?H:J):B.last_lit&&(ve(B,!1),B.strm.avail_out===0)?x:$})(q,se):q.strategy===3?(function(B,de){for(var Se,Ae,Le,Xe,it=B.window;;){if(B.lookahead<=j){if(Je(B),B.lookahead<=j&&de===f)return x;if(B.lookahead===0)break}if(B.match_length=0,B.lookahead>=V&&0<B.strstart&&(Ae=it[Le=B.strstart-1])===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]){Xe=B.strstart+j;do;while(Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Ae===it[++Le]&&Le<Xe);B.match_length=j-(Xe-Le),B.match_length>B.lookahead&&(B.match_length=B.lookahead)}if(B.match_length>=V?(Se=a._tr_tally(B,1,B.match_length-V),B.lookahead-=B.match_length,B.strstart+=B.match_length,B.match_length=0):(Se=a._tr_tally(B,0,B.window[B.strstart]),B.lookahead--,B.strstart++),Se&&(ve(B,!1),B.strm.avail_out===0))return x}return B.insert=0,de===p?(ve(B,!0),B.strm.avail_out===0?H:J):B.last_lit&&(ve(B,!1),B.strm.avail_out===0)?x:$})(q,se):i[q.level].func(q,se);if(N!==H&&N!==J||(q.status=666),N===x||N===H)return I.avail_out===0&&(q.last_flush=-1),g;if(N===$&&(se===1?a._tr_align(q):se!==5&&(a._tr_stored_block(q,0,0,!1),se===3&&(_e(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),ue(I),I.avail_out===0))return q.last_flush=-1,g}return se!==p?g:q.wrap<=0?1:(q.wrap===2?(ge(q,255&I.adler),ge(q,I.adler>>8&255),ge(q,I.adler>>16&255),ge(q,I.adler>>24&255),ge(q,255&I.total_in),ge(q,I.total_in>>8&255),ge(q,I.total_in>>16&255),ge(q,I.total_in>>24&255)):(Te(q,I.adler>>>16),Te(q,65535&I.adler)),ue(I),0<q.wrap&&(q.wrap=-q.wrap),q.pending!==0?g:1)},o.deflateEnd=function(I){var se;return I&&I.state?(se=I.state.status)!==R&&se!==69&&se!==73&&se!==91&&se!==103&&se!==K&&se!==666?Q(I,m):(I.state=null,se===K?Q(I,-3):g):m},o.deflateSetDictionary=function(I,se){var F,q,P,ee,be,N,B,de,Se=se.length;if(!I||!I.state||(ee=(F=I.state).wrap)===2||ee===1&&F.status!==R||F.lookahead)return m;for(ee===1&&(I.adler=l(I.adler,se,Se,0)),F.wrap=0,Se>=F.w_size&&(ee===0&&(_e(F.head),F.strstart=0,F.block_start=0,F.insert=0),de=new s.Buf8(F.w_size),s.arraySet(de,se,Se-F.w_size,F.w_size,0),se=de,Se=F.w_size),be=I.avail_in,N=I.next_in,B=I.input,I.avail_in=Se,I.next_in=0,I.input=se,Je(F);F.lookahead>=V;){for(q=F.strstart,P=F.lookahead-(V-1);F.ins_h=(F.ins_h<<F.hash_shift^F.window[q+V-1])&F.hash_mask,F.prev[q&F.w_mask]=F.head[F.ins_h],F.head[F.ins_h]=q,q++,--P;);F.strstart=q,F.lookahead=V-1,Je(F)}return F.strstart+=F.lookahead,F.block_start=F.strstart,F.insert=F.lookahead,F.lookahead=0,F.match_length=F.prev_length=V-1,F.match_available=0,I.next_in=N,I.input=B,I.avail_in=be,F.wrap=ee,g},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,d,f,p,g,m,v,k,b,S,C,w,T,L,z,W,V,j,Z,R,K,x=i.input,$;u=l+(i.avail_in-5),d=i.next_out,$=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),g=a.dmax,m=a.wsize,v=a.whave,k=a.wnext,b=a.window,S=a.hold,C=a.bits,w=a.lencode,T=a.distcode,L=(1<<a.lenbits)-1,z=(1<<a.distbits)-1;e:do{C<15&&(S+=x[l++]<<C,C+=8,S+=x[l++]<<C,C+=8),W=w[S&L];t:for(;;){if(S>>>=V=W>>>24,C-=V,(V=W>>>16&255)===0)$[d++]=65535&W;else{if(!(16&V)){if((64&V)==0){W=w[(65535&W)+(S&(1<<V)-1)];continue t}if(32&V){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}j=65535&W,(V&=15)&&(C<V&&(S+=x[l++]<<C,C+=8),j+=S&(1<<V)-1,S>>>=V,C-=V),C<15&&(S+=x[l++]<<C,C+=8,S+=x[l++]<<C,C+=8),W=T[S&z];n:for(;;){if(S>>>=V=W>>>24,C-=V,!(16&(V=W>>>16&255))){if((64&V)==0){W=T[(65535&W)+(S&(1<<V)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(Z=65535&W,C<(V&=15)&&(S+=x[l++]<<C,(C+=8)<V&&(S+=x[l++]<<C,C+=8)),g<(Z+=S&(1<<V)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(S>>>=V,C-=V,(V=d-f)<Z){if(v<(V=Z-V)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(K=b,(R=0)===k){if(R+=m-V,V<j){for(j-=V;$[d++]=b[R++],--V;);R=d-Z,K=$}}else if(k<V){if(R+=m+k-V,(V-=k)<j){for(j-=V;$[d++]=b[R++],--V;);if(R=0,k<j){for(j-=V=k;$[d++]=b[R++],--V;);R=d-Z,K=$}}}else if(R+=k-V,V<j){for(j-=V;$[d++]=b[R++],--V;);R=d-Z,K=$}for(;2<j;)$[d++]=K[R++],$[d++]=K[R++],$[d++]=K[R++],j-=3;j&&($[d++]=K[R++],1<j&&($[d++]=K[R++]))}else{for(R=d-Z;$[d++]=$[R++],$[d++]=$[R++],$[d++]=$[R++],2<(j-=3););j&&($[d++]=$[R++],1<j&&($[d++]=$[R++]))}break}}break}}while(l<u&&d<p);l-=j=C>>3,S&=(1<<(C-=j<<3))-1,i.next_in=l,i.next_out=d,i.avail_in=l<u?u-l+5:5-(l-u),i.avail_out=d<p?p-d+257:257-(d-p),a.hold=S,a.bits=C}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),u=n("./inftrees"),d=1,f=2,p=0,g=-2,m=1,v=852,k=592;function b(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function S(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function C(R){var K;return R&&R.state?(K=R.state,R.total_in=R.total_out=K.total=0,R.msg="",K.wrap&&(R.adler=1&K.wrap),K.mode=m,K.last=0,K.havedict=0,K.dmax=32768,K.head=null,K.hold=0,K.bits=0,K.lencode=K.lendyn=new i.Buf32(v),K.distcode=K.distdyn=new i.Buf32(k),K.sane=1,K.back=-1,p):g}function w(R){var K;return R&&R.state?((K=R.state).wsize=0,K.whave=0,K.wnext=0,C(R)):g}function T(R,K){var x,$;return R&&R.state?($=R.state,K<0?(x=0,K=-K):(x=1+(K>>4),K<48&&(K&=15)),K&&(K<8||15<K)?g:($.window!==null&&$.wbits!==K&&($.window=null),$.wrap=x,$.wbits=K,w(R))):g}function L(R,K){var x,$;return R?($=new S,(R.state=$).window=null,(x=T(R,K))!==p&&(R.state=null),x):g}var z,W,V=!0;function j(R){if(V){var K;for(z=new i.Buf32(512),W=new i.Buf32(32),K=0;K<144;)R.lens[K++]=8;for(;K<256;)R.lens[K++]=9;for(;K<280;)R.lens[K++]=7;for(;K<288;)R.lens[K++]=8;for(u(d,R.lens,0,288,z,0,R.work,{bits:9}),K=0;K<32;)R.lens[K++]=5;u(f,R.lens,0,32,W,0,R.work,{bits:5}),V=!1}R.lencode=z,R.lenbits=9,R.distcode=W,R.distbits=5}function Z(R,K,x,$){var H,J=R.state;return J.window===null&&(J.wsize=1<<J.wbits,J.wnext=0,J.whave=0,J.window=new i.Buf8(J.wsize)),$>=J.wsize?(i.arraySet(J.window,K,x-J.wsize,J.wsize,0),J.wnext=0,J.whave=J.wsize):($<(H=J.wsize-J.wnext)&&(H=$),i.arraySet(J.window,K,x-$,H,J.wnext),($-=H)?(i.arraySet(J.window,K,x-$,$,0),J.wnext=$,J.whave=J.wsize):(J.wnext+=H,J.wnext===J.wsize&&(J.wnext=0),J.whave<J.wsize&&(J.whave+=H))),0}o.inflateReset=w,o.inflateReset2=T,o.inflateResetKeep=C,o.inflateInit=function(R){return L(R,15)},o.inflateInit2=L,o.inflate=function(R,K){var x,$,H,J,Q,Y,_e,ue,ve,ge,Te,Ne,Je,ct,tt,Tt,ae,Ee,Ue,ie,I,se,F,q,P=0,ee=new i.Buf8(4),be=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!R||!R.state||!R.output||!R.input&&R.avail_in!==0)return g;(x=R.state).mode===12&&(x.mode=13),Q=R.next_out,H=R.output,_e=R.avail_out,J=R.next_in,$=R.input,Y=R.avail_in,ue=x.hold,ve=x.bits,ge=Y,Te=_e,se=p;e:for(;;)switch(x.mode){case m:if(x.wrap===0){x.mode=13;break}for(;ve<16;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(2&x.wrap&&ue===35615){ee[x.check=0]=255&ue,ee[1]=ue>>>8&255,x.check=a(x.check,ee,2,0),ve=ue=0,x.mode=2;break}if(x.flags=0,x.head&&(x.head.done=!1),!(1&x.wrap)||(((255&ue)<<8)+(ue>>8))%31){R.msg="incorrect header check",x.mode=30;break}if((15&ue)!=8){R.msg="unknown compression method",x.mode=30;break}if(ve-=4,I=8+(15&(ue>>>=4)),x.wbits===0)x.wbits=I;else if(I>x.wbits){R.msg="invalid window size",x.mode=30;break}x.dmax=1<<I,R.adler=x.check=1,x.mode=512&ue?10:12,ve=ue=0;break;case 2:for(;ve<16;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(x.flags=ue,(255&x.flags)!=8){R.msg="unknown compression method",x.mode=30;break}if(57344&x.flags){R.msg="unknown header flags set",x.mode=30;break}x.head&&(x.head.text=ue>>8&1),512&x.flags&&(ee[0]=255&ue,ee[1]=ue>>>8&255,x.check=a(x.check,ee,2,0)),ve=ue=0,x.mode=3;case 3:for(;ve<32;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.head&&(x.head.time=ue),512&x.flags&&(ee[0]=255&ue,ee[1]=ue>>>8&255,ee[2]=ue>>>16&255,ee[3]=ue>>>24&255,x.check=a(x.check,ee,4,0)),ve=ue=0,x.mode=4;case 4:for(;ve<16;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.head&&(x.head.xflags=255&ue,x.head.os=ue>>8),512&x.flags&&(ee[0]=255&ue,ee[1]=ue>>>8&255,x.check=a(x.check,ee,2,0)),ve=ue=0,x.mode=5;case 5:if(1024&x.flags){for(;ve<16;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.length=ue,x.head&&(x.head.extra_len=ue),512&x.flags&&(ee[0]=255&ue,ee[1]=ue>>>8&255,x.check=a(x.check,ee,2,0)),ve=ue=0}else x.head&&(x.head.extra=null);x.mode=6;case 6:if(1024&x.flags&&(Y<(Ne=x.length)&&(Ne=Y),Ne&&(x.head&&(I=x.head.extra_len-x.length,x.head.extra||(x.head.extra=new Array(x.head.extra_len)),i.arraySet(x.head.extra,$,J,Ne,I)),512&x.flags&&(x.check=a(x.check,$,Ne,J)),Y-=Ne,J+=Ne,x.length-=Ne),x.length))break e;x.length=0,x.mode=7;case 7:if(2048&x.flags){if(Y===0)break e;for(Ne=0;I=$[J+Ne++],x.head&&I&&x.length<65536&&(x.head.name+=String.fromCharCode(I)),I&&Ne<Y;);if(512&x.flags&&(x.check=a(x.check,$,Ne,J)),Y-=Ne,J+=Ne,I)break e}else x.head&&(x.head.name=null);x.length=0,x.mode=8;case 8:if(4096&x.flags){if(Y===0)break e;for(Ne=0;I=$[J+Ne++],x.head&&I&&x.length<65536&&(x.head.comment+=String.fromCharCode(I)),I&&Ne<Y;);if(512&x.flags&&(x.check=a(x.check,$,Ne,J)),Y-=Ne,J+=Ne,I)break e}else x.head&&(x.head.comment=null);x.mode=9;case 9:if(512&x.flags){for(;ve<16;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(ue!==(65535&x.check)){R.msg="header crc mismatch",x.mode=30;break}ve=ue=0}x.head&&(x.head.hcrc=x.flags>>9&1,x.head.done=!0),R.adler=x.check=0,x.mode=12;break;case 10:for(;ve<32;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}R.adler=x.check=b(ue),ve=ue=0,x.mode=11;case 11:if(x.havedict===0)return R.next_out=Q,R.avail_out=_e,R.next_in=J,R.avail_in=Y,x.hold=ue,x.bits=ve,2;R.adler=x.check=1,x.mode=12;case 12:if(K===5||K===6)break e;case 13:if(x.last){ue>>>=7&ve,ve-=7&ve,x.mode=27;break}for(;ve<3;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}switch(x.last=1&ue,ve-=1,3&(ue>>>=1)){case 0:x.mode=14;break;case 1:if(j(x),x.mode=20,K!==6)break;ue>>>=2,ve-=2;break e;case 2:x.mode=17;break;case 3:R.msg="invalid block type",x.mode=30}ue>>>=2,ve-=2;break;case 14:for(ue>>>=7&ve,ve-=7&ve;ve<32;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if((65535&ue)!=(ue>>>16^65535)){R.msg="invalid stored block lengths",x.mode=30;break}if(x.length=65535&ue,ve=ue=0,x.mode=15,K===6)break e;case 15:x.mode=16;case 16:if(Ne=x.length){if(Y<Ne&&(Ne=Y),_e<Ne&&(Ne=_e),Ne===0)break e;i.arraySet(H,$,J,Ne,Q),Y-=Ne,J+=Ne,_e-=Ne,Q+=Ne,x.length-=Ne;break}x.mode=12;break;case 17:for(;ve<14;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(x.nlen=257+(31&ue),ue>>>=5,ve-=5,x.ndist=1+(31&ue),ue>>>=5,ve-=5,x.ncode=4+(15&ue),ue>>>=4,ve-=4,286<x.nlen||30<x.ndist){R.msg="too many length or distance symbols",x.mode=30;break}x.have=0,x.mode=18;case 18:for(;x.have<x.ncode;){for(;ve<3;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.lens[be[x.have++]]=7&ue,ue>>>=3,ve-=3}for(;x.have<19;)x.lens[be[x.have++]]=0;if(x.lencode=x.lendyn,x.lenbits=7,F={bits:x.lenbits},se=u(0,x.lens,0,19,x.lencode,0,x.work,F),x.lenbits=F.bits,se){R.msg="invalid code lengths set",x.mode=30;break}x.have=0,x.mode=19;case 19:for(;x.have<x.nlen+x.ndist;){for(;Tt=(P=x.lencode[ue&(1<<x.lenbits)-1])>>>16&255,ae=65535&P,!((tt=P>>>24)<=ve);){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(ae<16)ue>>>=tt,ve-=tt,x.lens[x.have++]=ae;else{if(ae===16){for(q=tt+2;ve<q;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(ue>>>=tt,ve-=tt,x.have===0){R.msg="invalid bit length repeat",x.mode=30;break}I=x.lens[x.have-1],Ne=3+(3&ue),ue>>>=2,ve-=2}else if(ae===17){for(q=tt+3;ve<q;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}ve-=tt,I=0,Ne=3+(7&(ue>>>=tt)),ue>>>=3,ve-=3}else{for(q=tt+7;ve<q;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}ve-=tt,I=0,Ne=11+(127&(ue>>>=tt)),ue>>>=7,ve-=7}if(x.have+Ne>x.nlen+x.ndist){R.msg="invalid bit length repeat",x.mode=30;break}for(;Ne--;)x.lens[x.have++]=I}}if(x.mode===30)break;if(x.lens[256]===0){R.msg="invalid code -- missing end-of-block",x.mode=30;break}if(x.lenbits=9,F={bits:x.lenbits},se=u(d,x.lens,0,x.nlen,x.lencode,0,x.work,F),x.lenbits=F.bits,se){R.msg="invalid literal/lengths set",x.mode=30;break}if(x.distbits=6,x.distcode=x.distdyn,F={bits:x.distbits},se=u(f,x.lens,x.nlen,x.ndist,x.distcode,0,x.work,F),x.distbits=F.bits,se){R.msg="invalid distances set",x.mode=30;break}if(x.mode=20,K===6)break e;case 20:x.mode=21;case 21:if(6<=Y&&258<=_e){R.next_out=Q,R.avail_out=_e,R.next_in=J,R.avail_in=Y,x.hold=ue,x.bits=ve,l(R,Te),Q=R.next_out,H=R.output,_e=R.avail_out,J=R.next_in,$=R.input,Y=R.avail_in,ue=x.hold,ve=x.bits,x.mode===12&&(x.back=-1);break}for(x.back=0;Tt=(P=x.lencode[ue&(1<<x.lenbits)-1])>>>16&255,ae=65535&P,!((tt=P>>>24)<=ve);){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(Tt&&(240&Tt)==0){for(Ee=tt,Ue=Tt,ie=ae;Tt=(P=x.lencode[ie+((ue&(1<<Ee+Ue)-1)>>Ee)])>>>16&255,ae=65535&P,!(Ee+(tt=P>>>24)<=ve);){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}ue>>>=Ee,ve-=Ee,x.back+=Ee}if(ue>>>=tt,ve-=tt,x.back+=tt,x.length=ae,Tt===0){x.mode=26;break}if(32&Tt){x.back=-1,x.mode=12;break}if(64&Tt){R.msg="invalid literal/length code",x.mode=30;break}x.extra=15&Tt,x.mode=22;case 22:if(x.extra){for(q=x.extra;ve<q;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.length+=ue&(1<<x.extra)-1,ue>>>=x.extra,ve-=x.extra,x.back+=x.extra}x.was=x.length,x.mode=23;case 23:for(;Tt=(P=x.distcode[ue&(1<<x.distbits)-1])>>>16&255,ae=65535&P,!((tt=P>>>24)<=ve);){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if((240&Tt)==0){for(Ee=tt,Ue=Tt,ie=ae;Tt=(P=x.distcode[ie+((ue&(1<<Ee+Ue)-1)>>Ee)])>>>16&255,ae=65535&P,!(Ee+(tt=P>>>24)<=ve);){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}ue>>>=Ee,ve-=Ee,x.back+=Ee}if(ue>>>=tt,ve-=tt,x.back+=tt,64&Tt){R.msg="invalid distance code",x.mode=30;break}x.offset=ae,x.extra=15&Tt,x.mode=24;case 24:if(x.extra){for(q=x.extra;ve<q;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}x.offset+=ue&(1<<x.extra)-1,ue>>>=x.extra,ve-=x.extra,x.back+=x.extra}if(x.offset>x.dmax){R.msg="invalid distance too far back",x.mode=30;break}x.mode=25;case 25:if(_e===0)break e;if(Ne=Te-_e,x.offset>Ne){if((Ne=x.offset-Ne)>x.whave&&x.sane){R.msg="invalid distance too far back",x.mode=30;break}Je=Ne>x.wnext?(Ne-=x.wnext,x.wsize-Ne):x.wnext-Ne,Ne>x.length&&(Ne=x.length),ct=x.window}else ct=H,Je=Q-x.offset,Ne=x.length;for(_e<Ne&&(Ne=_e),_e-=Ne,x.length-=Ne;H[Q++]=ct[Je++],--Ne;);x.length===0&&(x.mode=21);break;case 26:if(_e===0)break e;H[Q++]=x.length,_e--,x.mode=21;break;case 27:if(x.wrap){for(;ve<32;){if(Y===0)break e;Y--,ue|=$[J++]<<ve,ve+=8}if(Te-=_e,R.total_out+=Te,x.total+=Te,Te&&(R.adler=x.check=x.flags?a(x.check,H,Te,Q-Te):s(x.check,H,Te,Q-Te)),Te=_e,(x.flags?ue:b(ue))!==x.check){R.msg="incorrect data check",x.mode=30;break}ve=ue=0}x.mode=28;case 28:if(x.wrap&&x.flags){for(;ve<32;){if(Y===0)break e;Y--,ue+=$[J++]<<ve,ve+=8}if(ue!==(4294967295&x.total)){R.msg="incorrect length check",x.mode=30;break}ve=ue=0}x.mode=29;case 29:se=1;break e;case 30:se=-3;break e;case 31:return-4;default:return g}return R.next_out=Q,R.avail_out=_e,R.next_in=J,R.avail_in=Y,x.hold=ue,x.bits=ve,(x.wsize||Te!==R.avail_out&&x.mode<30&&(x.mode<27||K!==4))&&Z(R,R.output,R.next_out,Te-R.avail_out)?(x.mode=31,-4):(ge-=R.avail_in,Te-=R.avail_out,R.total_in+=ge,R.total_out+=Te,x.total+=Te,x.wrap&&Te&&(R.adler=x.check=x.flags?a(x.check,H,Te,R.next_out-Te):s(x.check,H,Te,R.next_out-Te)),R.data_type=x.bits+(x.last?64:0)+(x.mode===12?128:0)+(x.mode===20||x.mode===15?256:0),(ge==0&&Te===0||K===4)&&se===p&&(se=-5),se)},o.inflateEnd=function(R){if(!R||!R.state)return g;var K=R.state;return K.window&&(K.window=null),R.state=null,p},o.inflateGetHeader=function(R,K){var x;return R&&R.state?(2&(x=R.state).wrap)==0?g:((x.head=K).done=!1,p):g},o.inflateSetDictionary=function(R,K){var x,$=K.length;return R&&R.state?(x=R.state).wrap!==0&&x.mode!==11?g:x.mode===11&&s(1,K,$,0)!==x.check?-3:Z(R,K,$,$)?(x.mode=31,-4):(x.havedict=1,p):g},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,p,g,m,v,k,b){var S,C,w,T,L,z,W,V,j,Z=b.bits,R=0,K=0,x=0,$=0,H=0,J=0,Q=0,Y=0,_e=0,ue=0,ve=null,ge=0,Te=new i.Buf16(16),Ne=new i.Buf16(16),Je=null,ct=0;for(R=0;R<=15;R++)Te[R]=0;for(K=0;K<g;K++)Te[f[p+K]]++;for(H=Z,$=15;1<=$&&Te[$]===0;$--);if($<H&&(H=$),$===0)return m[v++]=20971520,m[v++]=20971520,b.bits=1,0;for(x=1;x<$&&Te[x]===0;x++);for(H<x&&(H=x),R=Y=1;R<=15;R++)if(Y<<=1,(Y-=Te[R])<0)return-1;if(0<Y&&(d===0||$!==1))return-1;for(Ne[1]=0,R=1;R<15;R++)Ne[R+1]=Ne[R]+Te[R];for(K=0;K<g;K++)f[p+K]!==0&&(k[Ne[f[p+K]]++]=K);if(z=d===0?(ve=Je=k,19):d===1?(ve=s,ge-=257,Je=a,ct-=257,256):(ve=l,Je=u,-1),R=x,L=v,Q=K=ue=0,w=-1,T=(_e=1<<(J=H))-1,d===1&&852<_e||d===2&&592<_e)return 1;for(;;){for(W=R-Q,j=k[K]<z?(V=0,k[K]):k[K]>z?(V=Je[ct+k[K]],ve[ge+k[K]]):(V=96,0),S=1<<R-Q,x=C=1<<J;m[L+(ue>>Q)+(C-=S)]=W<<24|V<<16|j|0,C!==0;);for(S=1<<R-1;ue&S;)S>>=1;if(S!==0?(ue&=S-1,ue+=S):ue=0,K++,--Te[R]==0){if(R===$)break;R=f[p+k[K]]}if(H<R&&(ue&T)!==w){for(Q===0&&(Q=H),L+=x,Y=1<<(J=R-Q);J+Q<$&&!((Y-=Te[J+Q])<=0);)J++,Y<<=1;if(_e+=1<<J,d===1&&852<_e||d===2&&592<_e)return 1;m[w=ue&T]=H<<24|J<<16|L-v|0}}return ue!==0&&(m[L+ue]=R-Q<<24|4194304),b.bits=H,0}},{"../utils/common":41}],51:[function(n,r,o){"use strict";r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){"use strict";var i=n("../utils/common"),s=0,a=1;function l(P){for(var ee=P.length;0<=--ee;)P[ee]=0}var u=0,d=29,f=256,p=f+1+d,g=30,m=19,v=2*p+1,k=15,b=16,S=7,C=256,w=16,T=17,L=18,z=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],W=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],V=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Z=new Array(2*(p+2));l(Z);var R=new Array(2*g);l(R);var K=new Array(512);l(K);var x=new Array(256);l(x);var $=new Array(d);l($);var H,J,Q,Y=new Array(g);function _e(P,ee,be,N,B){this.static_tree=P,this.extra_bits=ee,this.extra_base=be,this.elems=N,this.max_length=B,this.has_stree=P&&P.length}function ue(P,ee){this.dyn_tree=P,this.max_code=0,this.stat_desc=ee}function ve(P){return P<256?K[P]:K[256+(P>>>7)]}function ge(P,ee){P.pending_buf[P.pending++]=255&ee,P.pending_buf[P.pending++]=ee>>>8&255}function Te(P,ee,be){P.bi_valid>b-be?(P.bi_buf|=ee<<P.bi_valid&65535,ge(P,P.bi_buf),P.bi_buf=ee>>b-P.bi_valid,P.bi_valid+=be-b):(P.bi_buf|=ee<<P.bi_valid&65535,P.bi_valid+=be)}function Ne(P,ee,be){Te(P,be[2*ee],be[2*ee+1])}function Je(P,ee){for(var be=0;be|=1&P,P>>>=1,be<<=1,0<--ee;);return be>>>1}function ct(P,ee,be){var N,B,de=new Array(k+1),Se=0;for(N=1;N<=k;N++)de[N]=Se=Se+be[N-1]<<1;for(B=0;B<=ee;B++){var Ae=P[2*B+1];Ae!==0&&(P[2*B]=Je(de[Ae]++,Ae))}}function tt(P){var ee;for(ee=0;ee<p;ee++)P.dyn_ltree[2*ee]=0;for(ee=0;ee<g;ee++)P.dyn_dtree[2*ee]=0;for(ee=0;ee<m;ee++)P.bl_tree[2*ee]=0;P.dyn_ltree[2*C]=1,P.opt_len=P.static_len=0,P.last_lit=P.matches=0}function Tt(P){8<P.bi_valid?ge(P,P.bi_buf):0<P.bi_valid&&(P.pending_buf[P.pending++]=P.bi_buf),P.bi_buf=0,P.bi_valid=0}function ae(P,ee,be,N){var B=2*ee,de=2*be;return P[B]<P[de]||P[B]===P[de]&&N[ee]<=N[be]}function Ee(P,ee,be){for(var N=P.heap[be],B=be<<1;B<=P.heap_len&&(B<P.heap_len&&ae(ee,P.heap[B+1],P.heap[B],P.depth)&&B++,!ae(ee,N,P.heap[B],P.depth));)P.heap[be]=P.heap[B],be=B,B<<=1;P.heap[be]=N}function Ue(P,ee,be){var N,B,de,Se,Ae=0;if(P.last_lit!==0)for(;N=P.pending_buf[P.d_buf+2*Ae]<<8|P.pending_buf[P.d_buf+2*Ae+1],B=P.pending_buf[P.l_buf+Ae],Ae++,N===0?Ne(P,B,ee):(Ne(P,(de=x[B])+f+1,ee),(Se=z[de])!==0&&Te(P,B-=$[de],Se),Ne(P,de=ve(--N),be),(Se=W[de])!==0&&Te(P,N-=Y[de],Se)),Ae<P.last_lit;);Ne(P,C,ee)}function ie(P,ee){var be,N,B,de=ee.dyn_tree,Se=ee.stat_desc.static_tree,Ae=ee.stat_desc.has_stree,Le=ee.stat_desc.elems,Xe=-1;for(P.heap_len=0,P.heap_max=v,be=0;be<Le;be++)de[2*be]!==0?(P.heap[++P.heap_len]=Xe=be,P.depth[be]=0):de[2*be+1]=0;for(;P.heap_len<2;)de[2*(B=P.heap[++P.heap_len]=Xe<2?++Xe:0)]=1,P.depth[B]=0,P.opt_len--,Ae&&(P.static_len-=Se[2*B+1]);for(ee.max_code=Xe,be=P.heap_len>>1;1<=be;be--)Ee(P,de,be);for(B=Le;be=P.heap[1],P.heap[1]=P.heap[P.heap_len--],Ee(P,de,1),N=P.heap[1],P.heap[--P.heap_max]=be,P.heap[--P.heap_max]=N,de[2*B]=de[2*be]+de[2*N],P.depth[B]=(P.depth[be]>=P.depth[N]?P.depth[be]:P.depth[N])+1,de[2*be+1]=de[2*N+1]=B,P.heap[1]=B++,Ee(P,de,1),2<=P.heap_len;);P.heap[--P.heap_max]=P.heap[1],(function(it,yt){var Mt,Lt,Wt,Be,rn,zn,Ht=yt.dyn_tree,xn=yt.max_code,Ur=yt.stat_desc.static_tree,yr=yt.stat_desc.has_stree,Ar=yt.stat_desc.extra_bits,et=yt.stat_desc.extra_base,kt=yt.stat_desc.max_length,Bt=0;for(Be=0;Be<=k;Be++)it.bl_count[Be]=0;for(Ht[2*it.heap[it.heap_max]+1]=0,Mt=it.heap_max+1;Mt<v;Mt++)kt<(Be=Ht[2*Ht[2*(Lt=it.heap[Mt])+1]+1]+1)&&(Be=kt,Bt++),Ht[2*Lt+1]=Be,xn<Lt||(it.bl_count[Be]++,rn=0,et<=Lt&&(rn=Ar[Lt-et]),zn=Ht[2*Lt],it.opt_len+=zn*(Be+rn),yr&&(it.static_len+=zn*(Ur[2*Lt+1]+rn)));if(Bt!==0){do{for(Be=kt-1;it.bl_count[Be]===0;)Be--;it.bl_count[Be]--,it.bl_count[Be+1]+=2,it.bl_count[kt]--,Bt-=2}while(0<Bt);for(Be=kt;Be!==0;Be--)for(Lt=it.bl_count[Be];Lt!==0;)xn<(Wt=it.heap[--Mt])||(Ht[2*Wt+1]!==Be&&(it.opt_len+=(Be-Ht[2*Wt+1])*Ht[2*Wt],Ht[2*Wt+1]=Be),Lt--)}})(P,ee),ct(de,Xe,P.bl_count)}function I(P,ee,be){var N,B,de=-1,Se=ee[1],Ae=0,Le=7,Xe=4;for(Se===0&&(Le=138,Xe=3),ee[2*(be+1)+1]=65535,N=0;N<=be;N++)B=Se,Se=ee[2*(N+1)+1],++Ae<Le&&B===Se||(Ae<Xe?P.bl_tree[2*B]+=Ae:B!==0?(B!==de&&P.bl_tree[2*B]++,P.bl_tree[2*w]++):Ae<=10?P.bl_tree[2*T]++:P.bl_tree[2*L]++,de=B,Xe=(Ae=0)===Se?(Le=138,3):B===Se?(Le=6,3):(Le=7,4))}function se(P,ee,be){var N,B,de=-1,Se=ee[1],Ae=0,Le=7,Xe=4;for(Se===0&&(Le=138,Xe=3),N=0;N<=be;N++)if(B=Se,Se=ee[2*(N+1)+1],!(++Ae<Le&&B===Se)){if(Ae<Xe)for(;Ne(P,B,P.bl_tree),--Ae!=0;);else B!==0?(B!==de&&(Ne(P,B,P.bl_tree),Ae--),Ne(P,w,P.bl_tree),Te(P,Ae-3,2)):Ae<=10?(Ne(P,T,P.bl_tree),Te(P,Ae-3,3)):(Ne(P,L,P.bl_tree),Te(P,Ae-11,7));de=B,Xe=(Ae=0)===Se?(Le=138,3):B===Se?(Le=6,3):(Le=7,4)}}l(Y);var F=!1;function q(P,ee,be,N){Te(P,(u<<1)+(N?1:0),3),(function(B,de,Se,Ae){Tt(B),Ae&&(ge(B,Se),ge(B,~Se)),i.arraySet(B.pending_buf,B.window,de,Se,B.pending),B.pending+=Se})(P,ee,be,!0)}o._tr_init=function(P){F||((function(){var ee,be,N,B,de,Se=new Array(k+1);for(B=N=0;B<d-1;B++)for($[B]=N,ee=0;ee<1<<z[B];ee++)x[N++]=B;for(x[N-1]=B,B=de=0;B<16;B++)for(Y[B]=de,ee=0;ee<1<<W[B];ee++)K[de++]=B;for(de>>=7;B<g;B++)for(Y[B]=de<<7,ee=0;ee<1<<W[B]-7;ee++)K[256+de++]=B;for(be=0;be<=k;be++)Se[be]=0;for(ee=0;ee<=143;)Z[2*ee+1]=8,ee++,Se[8]++;for(;ee<=255;)Z[2*ee+1]=9,ee++,Se[9]++;for(;ee<=279;)Z[2*ee+1]=7,ee++,Se[7]++;for(;ee<=287;)Z[2*ee+1]=8,ee++,Se[8]++;for(ct(Z,p+1,Se),ee=0;ee<g;ee++)R[2*ee+1]=5,R[2*ee]=Je(ee,5);H=new _e(Z,z,f+1,p,k),J=new _e(R,W,0,g,k),Q=new _e(new Array(0),V,0,m,S)})(),F=!0),P.l_desc=new ue(P.dyn_ltree,H),P.d_desc=new ue(P.dyn_dtree,J),P.bl_desc=new ue(P.bl_tree,Q),P.bi_buf=0,P.bi_valid=0,tt(P)},o._tr_stored_block=q,o._tr_flush_block=function(P,ee,be,N){var B,de,Se=0;0<P.level?(P.strm.data_type===2&&(P.strm.data_type=(function(Ae){var Le,Xe=4093624447;for(Le=0;Le<=31;Le++,Xe>>>=1)if(1&Xe&&Ae.dyn_ltree[2*Le]!==0)return s;if(Ae.dyn_ltree[18]!==0||Ae.dyn_ltree[20]!==0||Ae.dyn_ltree[26]!==0)return a;for(Le=32;Le<f;Le++)if(Ae.dyn_ltree[2*Le]!==0)return a;return s})(P)),ie(P,P.l_desc),ie(P,P.d_desc),Se=(function(Ae){var Le;for(I(Ae,Ae.dyn_ltree,Ae.l_desc.max_code),I(Ae,Ae.dyn_dtree,Ae.d_desc.max_code),ie(Ae,Ae.bl_desc),Le=m-1;3<=Le&&Ae.bl_tree[2*j[Le]+1]===0;Le--);return Ae.opt_len+=3*(Le+1)+5+5+4,Le})(P),B=P.opt_len+3+7>>>3,(de=P.static_len+3+7>>>3)<=B&&(B=de)):B=de=be+5,be+4<=B&&ee!==-1?q(P,ee,be,N):P.strategy===4||de===B?(Te(P,2+(N?1:0),3),Ue(P,Z,R)):(Te(P,4+(N?1:0),3),(function(Ae,Le,Xe,it){var yt;for(Te(Ae,Le-257,5),Te(Ae,Xe-1,5),Te(Ae,it-4,4),yt=0;yt<it;yt++)Te(Ae,Ae.bl_tree[2*j[yt]+1],3);se(Ae,Ae.dyn_ltree,Le-1),se(Ae,Ae.dyn_dtree,Xe-1)})(P,P.l_desc.max_code+1,P.d_desc.max_code+1,Se+1),Ue(P,P.dyn_ltree,P.dyn_dtree)),tt(P),N&&Tt(P)},o._tr_tally=function(P,ee,be){return P.pending_buf[P.d_buf+2*P.last_lit]=ee>>>8&255,P.pending_buf[P.d_buf+2*P.last_lit+1]=255&ee,P.pending_buf[P.l_buf+P.last_lit]=255&be,P.last_lit++,ee===0?P.dyn_ltree[2*be]++:(P.matches++,ee--,P.dyn_ltree[2*(x[be]+f+1)]++,P.dyn_dtree[2*ve(ee)]++),P.last_lit===P.lit_bufsize-1},o._tr_align=function(P){Te(P,2,3),Ne(P,C,Z),(function(ee){ee.bi_valid===16?(ge(ee,ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0):8<=ee.bi_valid&&(ee.pending_buf[ee.pending++]=255&ee.bi_buf,ee.bi_buf>>=8,ee.bi_valid-=8)})(P)}},{"../utils/common":41}],53:[function(n,r,o){"use strict";r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){"use strict";if(!s.setImmediate){var l,u,d,f,p=1,g={},m=!1,v=s.document,k=Object.getPrototypeOf&&Object.getPrototypeOf(s);k=k&&k.setTimeout?k:s,l={}.toString.call(s.process)==="[object process]"?function(w){process.nextTick(function(){S(w)})}:(function(){if(s.postMessage&&!s.importScripts){var w=!0,T=s.onmessage;return s.onmessage=function(){w=!1},s.postMessage("","*"),s.onmessage=T,w}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",C,!1):s.attachEvent("onmessage",C),function(w){s.postMessage(f+w,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(w){S(w.data)},function(w){d.port2.postMessage(w)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(w){var T=v.createElement("script");T.onreadystatechange=function(){S(w),T.onreadystatechange=null,u.removeChild(T),T=null},u.appendChild(T)}):function(w){setTimeout(S,0,w)},k.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var T=new Array(arguments.length-1),L=0;L<T.length;L++)T[L]=arguments[L+1];return g[p]={callback:w,args:T},l(p),p++},k.clearImmediate=b}function b(w){delete g[w]}function S(w){if(m)setTimeout(S,0,w);else{var T=g[w];if(T){m=!0;try{(function(L){var z=L.callback,W=L.args;switch(W.length){case 0:z();break;case 1:z(W[0]);break;case 2:z(W[0],W[1]);break;case 3:z(W[0],W[1],W[2]);break;default:z.apply(a,W)}})(T)}finally{b(w),m=!1}}}}function C(w){w.source===s&&typeof w.data=="string"&&w.data.indexOf(f)===0&&S(+w.data.slice(f.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})),Sr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Ea="application/pdf",Iu="text/html",e5={docx:Sr,pdf:Ea,html:Iu},Rp={RESOLVED:"resolved",NEW:"new",ADD:"add",UPDATE:"update",DELETED:"deleted",PENDING:"pending",SELECTED:"selected",COMMENTS_LIST:"comments-list",CHANGE_ACCEPTED:"change-accepted",CHANGE_REJECTED:"change-rejected"};Ft();var t5=j2(Jx(),1),n5=e=>typeof e!="string"?"":e.trim(),Vy=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Mp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},bc=e=>{const t=e??{},n=n5(t.id),r=Vy(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},tk=({current:e,other:t})=>{const n=bc(e),r=bc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Eu=({actor:e,fallbackKey:t=""})=>{const n=bc(e);if(n.hasId)return`id:${n.id}`;if(n.hasEmail)return`email:${n.email}`;const r=typeof t=="number"?String(t):typeof t=="string"?t.trim():"";return r?`fallback:${r}`:""};function r5(e){return typeof e.captureStackTrace=="function"}var Lp=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",r5(Error)&&Error.captureStackTrace(this,this.constructor)}},o5=class extends Lp{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},i5=class extends Lp{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Uy=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new o5(e);const s=atob(i[1]),a=Uint8Array.from(s,l=>l.charCodeAt(0));return new File([a],t,{type:n})}const r=await fetch(e);if(!r.ok)throw new i5(e,new Error(`HTTP ${r.status}: ${r.statusText}`));const o=await r.blob();return new File([o],t,{type:n})}catch(r){throw r instanceof Lp?r:new Lp("Failed to create file object",r)}};function s5(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const i=n[o]||0,s=r[o]||0;if(i>s)return 1;if(i<s)return-1}return 0}var Dp=new WeakMap;function nk(e){return e.ownerDocument??document}function rk(e,t){const n=Dp.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Dp.delete(t))}function ok(e,t){const n=nk(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&rk(e,e.__clickOutsideDocument);let r=Dp.get(n);if(!r){const o=new Map,i=s=>{const a=typeof s.composedPath=="function"?s.composedPath():null;for(const[l,u]of o)(a?.includes(l)??l.contains(s.target))||u.value?.(s)};r={bindings:o,listener:i},Dp.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var Hy={mounted(e,t){ok(e,t)},updated(e,t){ok(e,t)},unmounted(e){rk(e,e.__clickOutsideDocument??nk(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function a5(e){return e[1].user!==void 0}var l5=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(a5).filter(([r,o])=>{const i=Eu({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Eu({actor:o.user,fallbackKey:r});let s=e.userColorMap.get(i);return s||(s=o.user.color||(e.config.colors.length>0?e.config.colors[e.colorIndex%e.config.colors.length]:void 0),e.userColorMap.set(i,s),e.colorIndex++),{clientId:r,...o.user,color:s}})},c5=e=>{for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e},u5="https://ingest.superdoc.dev/v1/collect",zG="community-and-eval-agplv3";function d5(){try{return"2.18.0-next.6"}catch{return"unknown"}}var f5=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||u5,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=d5()}getBrowserInfo(){return typeof window>"u"?{userAgent:"",currentUrl:"",hostname:"",screenSize:{width:0,height:0}}:{userAgent:window.navigator.userAgent,currentUrl:window.location.origin,hostname:window.location.hostname,screenSize:{width:window.screen.width,height:window.screen.height}}}trackDocumentOpen(e,t=null){if(!this.enabled)return;const n={timestamp:new Date().toISOString(),documentId:e,documentCreatedAt:t};this.sendEvent(n)}async sendEvent(e){const t={superdocVersion:this.superdocVersion,browserInfo:this.getBrowserInfo(),...this.metadata&&{metadata:this.metadata},events:[e]};try{await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-License-Key":this.licenseKey},body:JSON.stringify(t),credentials:"omit"})}catch{}}},Op={PAGE:"superdoc-page",FRAGMENT:"superdoc-fragment",FLOATING_FRAGMENT:"superdoc-floating-fragment",LINE:"superdoc-line",INLINE_SDT_WRAPPER:"superdoc-structured-content-inline",INLINE_SDT_LABEL:"superdoc-structured-content-inline__label",BLOCK_SDT:"superdoc-structured-content-block",BLOCK_SDT_LABEL:"superdoc-structured-content__label",TABLE_FRAGMENT:"superdoc-table-fragment",DOCUMENT_SECTION:"superdoc-document-section",SDT_GROUP_HOVER:"sdt-group-hover",TOC_ENTRY:"superdoc-toc-entry",TOC_GROUP_HOVER:"toc-group-hover",IMAGE_FRAGMENT:"superdoc-image-fragment",INLINE_IMAGE:"superdoc-inline-image",LIST_MARKER:"superdoc-list-marker",INLINE_IMAGE_CLIP_WRAPPER:"superdoc-inline-image-clip-wrapper",ANNOTATION:"annotation",ANNOTATION_CONTENT:"annotation-content",ANNOTATION_CARET_ANCHOR:"annotation-caret-anchor"},jG=[Op.INLINE_SDT_LABEL,Op.BLOCK_SDT_LABEL],ik={PM_START:"data-pm-start",PM_END:"data-pm-end",LAYOUT_EPOCH:"data-layout-epoch",TABLE_BOUNDARIES:"data-table-boundaries",SDT_ID:"data-sdt-id",SDT_TYPE:"data-sdt-type",FIELD_ID:"data-field-id",FIELD_TYPE:"data-field-type",DRAGGABLE:"data-draggable",DISPLAY_LABEL:"data-display-label",VARIANT:"data-variant",TYPE:"data-type",LAYOUT_BOUNDARY_SCHEMA:"data-layout-boundary-schema",LAYOUT_FRAGMENT_ID:"data-layout-fragment-id",LAYOUT_STORY:"data-layout-story",LAYOUT_BLOCK_REF:"data-layout-block-ref",LAYOUT_COLUMN_INDEX:"data-layout-column-index"},h5=e=>{if(!e)return{kind:"unknown"};if(e==="body")return{kind:"body"};const t=e.indexOf(":"),n=t===-1?e:e.slice(0,t),r=t===-1?void 0:e.slice(t+1);switch(n){case"body":case"header":case"footer":case"footnote":case"endnote":case"textbox":return r?{kind:n,id:r}:{kind:n};default:return{kind:"unknown"}}},VG=`.${Op.BLOCK_SDT}[${ik.SDT_ID}]`,UG=`[${ik.DRAGGABLE}="true"]`,p5=typeof window<"u",sk,kf=e=>sk=e,ak=Symbol();function $y(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Sf;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Sf||(Sf={}));var lk=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:typeof globalThis=="object"?globalThis:{HTMLElement:null};function m5(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function Gy(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){g5(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function ck(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Pp(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{const n=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(n)}}var Fp=typeof navigator=="object"?navigator:{userAgent:""},uk=/Macintosh/.test(Fp.userAgent)&&/AppleWebKit/.test(Fp.userAgent)&&!/Safari/.test(Fp.userAgent),g5=p5?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!uk?v5:"msSaveOrOpenBlob"in Fp?y5:b5:()=>{};function v5(e,t="download",n){const r=document.createElement("a");r.download=t,r.rel="noopener",typeof e=="string"?(r.href=e,r.origin!==location.origin?ck(r.href)?Gy(e,t,n):(r.target="_blank",Pp(r)):Pp(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Pp(r)},0))}function y5(e,t="download",n){if(typeof e=="string")if(ck(e))Gy(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Pp(r)})}else navigator.msSaveOrOpenBlob(m5(e,n),t)}function b5(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Gy(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(lk.HTMLElement))||"safari"in lk,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||uk)&&typeof FileReader<"u"){const a=new FileReader;a.onloadend=function(){let l=a.result;if(typeof l!="string")throw r=null,new Error("Wrong reader.result type");l=s?l:l.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=l:location.assign(l),r=null},a.readAsDataURL(e)}else{const a=URL.createObjectURL(e);r?r.location.assign(a):location.href=a,r=null,setTimeout(function(){URL.revokeObjectURL(a)},4e4)}}var{assign:HG}=Object;function w5(){const e=Zg(!0),t=e.run(()=>re({}));let n=[],r=[];const o=Wr({install(i){kf(o),o._a=i,i.provide(ak,o),i.config.globalProperties.$pinia=o,r.forEach(s=>n.push(s)),r=[]},use(i){return this._a?n.push(i):r.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o}var dk=()=>{};function fk(e,t,n,r=dk){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&Qg()&&r1(o),o}function Tu(e,...t){e.forEach(n=>{n(...t)})}var C5=e=>e(),hk=Symbol(),Wy=Symbol();function Ky(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,r)=>e.set(r,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],o=e[n];$y(o)&&$y(r)&&e.hasOwnProperty(n)&&!lr(r)&&!Fi(r)?e[n]=Ky(o,r):e[n]=r}return e}var k5=Symbol();function S5(e){return!$y(e)||!Object.prototype.hasOwnProperty.call(e,k5)}var{assign:yl}=Object;function _5(e){return!!(lr(e)&&e.effect)}function A5(e,t,n,r){const{state:o,actions:i,getters:s}=t,a=n.state.value[e];let l;function u(){a||(n.state.value[e]=o?o():{});const d=p1(n.state.value[e]);return yl(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=Wr(ke(()=>{kf(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=pk(e,u,t,n,r,!0),l}function pk(e,t,n={},r,o,i){let s;const a=yl({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function k(L){let z;u=d=!1,typeof L=="function"?(L(r.state.value[e]),z={type:Sf.patchFunction,storeId:e,events:g}):(Ky(r.state.value[e],L),z={type:Sf.patchObject,payload:L,storeId:e,events:g});const W=v=Symbol();St().then(()=>{v===W&&(u=!0)}),d=!0,Tu(f,z,r.state.value[e])}const b=i?function(){const{state:z}=n,W=z?z():{};this.$patch(V=>{yl(V,W)})}:dk;function S(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const C=(L,z="")=>{if(hk in L)return L[Wy]=z,L;const W=function(){kf(r);const V=Array.from(arguments),j=new Set,Z=new Set;function R($){j.add($)}function K($){Z.add($)}Tu(p,{args:V,name:W[Wy],store:w,after:R,onError:K});let x;try{x=L.apply(this&&this.$id===e?this:w,V)}catch($){throw Tu(Z,$),$}return x instanceof Promise?x.then($=>(Tu(j,$),$)).catch($=>(Tu(Z,$),Promise.reject($))):(Tu(j,x),x)};return W[hk]=!0,W[Wy]=z,W},w=no({_p:r,$id:e,$onAction:fk.bind(null,p),$patch:k,$reset:b,$subscribe(L,z={}){const W=fk(f,L,z.detached,()=>V()),V=s.run(()=>jt(()=>r.state.value[e],j=>{(z.flush==="sync"?d:u)&&L({storeId:e,type:Sf.direct,events:g},j)},yl({},l,z)));return W},$dispose:S});r._s.set(e,w);const T=(r._a&&r._a.runWithContext||C5)(()=>r._e.run(()=>(s=Zg()).run(()=>t({action:C}))));for(const L in T){const z=T[L];lr(z)&&!_5(z)||Fi(z)?i||(m&&S5(z)&&(lr(z)?z.value=m[L]:Ky(z,m[L])),r.state.value[e][L]=z):typeof z=="function"&&(T[L]=C(z,L),a.actions[L]=z)}return yl(w,T),yl(pn(w),T),Object.defineProperty(w,"$state",{get:()=>r.state.value[e],set:L=>{k(z=>{yl(z,L)})}}),r._p.forEach(L=>{yl(w,s.run(()=>L({store:w,app:r._a,pinia:r,options:a})))}),m&&i&&n.hydrate&&n.hydrate(w.$state,m),u=!0,d=!0,w}function mk(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=U1();return s=s||(l?ll(ak,null):null),s&&kf(s),s=sk,s._s.has(e)||(o?pk(e,t,r,s):A5(e,r,s)),s._s.get(e)}return i.$id=e,i}function Ns(e){const t=pn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=ke({get:()=>e[r],set(i){e[r]=i}}):(lr(o)||Fi(o))&&(n[r]=sv(e,r))}return n}function gk(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function vk(e){if(typeof e!="string"||e.length===0)return"<none>";try{const t=new URL(e);t.search="",t.hash="",t.username="",t.password="";const n=e.includes("?")?"?<redacted>":"";return`${t.toString().replace(/\?$/,"")}${n}`}catch{const t=e.replace(/\/\/[^/@]+@/,"//"),n=t.search(/[?#]/);return n===-1?t:`${t.slice(0,n)}?<redacted>`}}function wc(e){return typeof e=="string"&&e.length>0?e:null}function I5(e){if(typeof e!="string"||e.length===0)return null;try{const t=new URL(e);return t.protocol==="ws:"||t.protocol==="wss:"?e:null}catch{return null}}function E5(e,t){if(typeof e!="string")return null;const n=e.trim();if(n.length===0)return null;try{const r=new URL(n);return r.protocol==="http:"||r.protocol==="https:"?n:null}catch{if(typeof t!="string"||t.trim().length===0)return null;try{const r=new URL(n,t);return r.protocol==="http:"||r.protocol==="https:"?r.href:null}catch{return null}}}function T5(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return Object.keys(t).length>0?t:void 0}function qy(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function x5(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function Np(e,t){return!e.ok||t===void 0?e:{ok:!0,target:{...e.target,syncTimeoutMs:t}}}function Yy(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function R5(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function M5(e){if(!e||typeof e!="object")return null;const t=typeof e.providerType=="string"?e.providerType.toLowerCase():"";return t==="hocuspocus"?"hocuspocus":t==="liveblocks"?"liveblocks":t==="superdoc"?"superdoc":e.ydoc!=null||e.provider!=null?"external-ydoc-provider":null}function yk(e,t){const n=wc(t.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:`SuperDoc v2 collaboration requires a non-empty collaboration.documentId for the "${e}" provider.`};const r=t.url??t.serverUrl,o=I5(r);if(!o)return{ok:!1,reason:"invalid-server-url",message:`SuperDoc v2 collaboration requires a valid ws:// or wss:// URL for the "${e}" provider (received: ${vk(r)}).`};const i=T5(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?wc(t.token):null,a=qy(t.roomMode);return a?{ok:!0,target:{providerFamily:e,documentId:n,roomMode:a,serverUrl:o,...i?{params:i}:{},...s?{token:s}:{}}}:Yy()}function L5(e){const t=wc(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty v2Collaboration.adapterId."};const n=wc(e.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:"SuperDoc v2 provider extensions require a non-empty v2Collaboration.documentId."};const r=qy(e.roomMode);if(!r)return Yy();if(Object.prototype.hasOwnProperty.call(e,"providerOptions"))try{structuredClone(e.providerOptions)}catch{return{ok:!1,reason:"invalid-provider-options",message:"SuperDoc v2 provider extension options must be structured-clone-safe."}}const o=typeof e.token=="function"?e.token:wc(e.token);return{ok:!0,target:{providerFamily:"extension",adapterId:t,documentId:n,roomMode:r,...Object.prototype.hasOwnProperty.call(e,"providerOptions")?{providerOptions:e.providerOptions}:{},...o?{token:o}:{}}}}function D5(e,t){const n=wc(e.documentId??e.roomId);if(!n)return{ok:!1,reason:"invalid-document-id",message:'SuperDoc v2 collaboration requires a non-empty collaboration.documentId (or roomId) for the "liveblocks" provider.'};const r=wc(e.publicApiKey),o=qy(e.roomMode);if(!o)return Yy();const i=e.authEndpoint,s=typeof i=="string"&&i.length>0;if(!r&&!s)return{ok:!1,reason:"missing-auth",message:"SuperDoc v2 Liveblocks collaboration requires exactly one auth mode: a publicApiKey or an authEndpoint. None was provided."};if(r&&s)return{ok:!1,reason:"mixed-auth",message:"SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."};if(r)return{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,publicApiKey:r}};const a=E5(i,t);return a?{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,authEndpoint:a}}:{ok:!1,reason:"invalid-auth-endpoint",message:"SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."}}function bk(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=gk(e);if(typeof r=="number"&&r>1)return{ok:!1,reason:"unsupported-multi-document",message:`SuperDoc v2 collaboration supports exactly one document per room; received ${r}.`};if(n!=null&&n!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return{ok:!1,reason:"unsupported-document-type",message:"SuperDoc v2 collaboration supports DOCX documents only."};if(!(i!=null&&typeof i=="object")){const u=M5(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",f=vk(t?.url);return{ok:!1,reason:d,message:u==="external-ydoc-provider"?"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. Provide a collaboration target (e.g. { providerType, documentId, url }) instead.":`SuperDoc v2 collaboration does not accept "${u}" through the legacy modules.collaboration block (server: ${f}). Configure it as a document.collaboration target ({ providerType: "${u}", documentId, ... }) instead.`}}return{ok:!1,reason:"missing-target",message:"SuperDoc v2 collaboration requires a collaboration target ({ documentId, serverUrl } or { providerType, ... }). None was provided."}}const s=i;if(Object.prototype.hasOwnProperty.call(s,"createIfMissing"))return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration createIfMissing has been removed. Use roomMode: "create" for creation or roomMode: "join" for normal opens.'};if(s.ydoc!=null||s.provider!=null)return{ok:!1,reason:"unsupported-legacy-provider",message:"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a collaboration target ({ providerType, documentId, serverUrl | publicApiKey | authEndpoint }) instead."};const a=x5(s.syncTimeoutMs);if(a===null)return{ok:!1,reason:"invalid-sync-timeout",message:"SuperDoc v2 collaboration syncTimeoutMs must be a finite positive number within the JavaScript timer range."};const l=R5(s);return l===null||l==="y-websocket"?Np(yk("y-websocket",s),a):l==="hocuspocus"?Np(yk("hocuspocus",s),a):l==="liveblocks"?Np(D5(s,o),a):l==="extension"?Np(L5(s),a):{ok:!1,reason:"unsupported-provider-family",message:`SuperDoc v2 collaboration does not support the "${l}" provider family. Supported families are y-websocket, hocuspocus, liveblocks, and extension.`}}var _f=(e,t="document")=>{if(!e)return null;if(typeof File=="function"&&e instanceof File)return e;if(typeof Blob=="function"&&e instanceof Blob){if(typeof File=="function"){const n=e.name||t;return new File([e],n,{type:e.type})}return e}return e.originFileObj?_f(e.originFileObj,e.name||t):e.file?_f(e.file,e.name||t):e.raw?_f(e.raw,e.name||t):null},wk=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,O5=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,bl=e=>{if(ArrayBuffer.isView(e))return O5?.call(e)==="Uint8Array";if(!wk)return!1;try{return wk.call(e),!0}catch{return!1}},Xy=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},Zy=(e,t)=>new Blob([Xy(e)],{type:t}),Qy=e=>{switch(e.toLowerCase()){case"docx":case Sr:return Sr;case"pdf":case Ea:return Ea;case"html":case Iu:return Iu;default:return e}},Bp=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?Sr:t.endsWith(".pdf")?Ea:t.endsWith(".html")||t.endsWith(".htm")?Iu:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},P5=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",F5="application/octet-stream",Jy=e=>{if(e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"collaboration")){const n={...e};delete n.collaboration,e={...n,v2Collaboration:gk(e)}}if(bl(e))return{type:Sr,data:Xy(e),name:"document.docx"};const t=_f(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=Bp(n),i=o||Bp(r),s=t.type.toLowerCase()===F5,a=s&&o?n:r||n||"document",l=s&&i?i:t.type||i||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";let u=t;return s&&i&&typeof File=="function"&&t instanceof File?u=new File([t],a,{type:l,lastModified:t.lastModified}):s&&i&&typeof Blob=="function"&&t instanceof Blob&&(u=new Blob([t],{type:l})),{...e.v2Collaboration!==void 0?{v2Collaboration:e.v2Collaboration}:{},type:l,data:u,name:a}}if(e&&typeof e=="object"&&"data"in e){if(bl(e.data)){const r=Qy(e.type||Bp(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?Xy(e.data):Zy(e.data,r),name:e.name||P5(r)}}const n=_f(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?Qy(e.type):"",o=r||n.type||Bp(n.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document",i=!n.type||!!(r&&n.type!==r);let s=n;return i&&typeof File=="function"&&n instanceof File?s=new File([n],n.name,{type:o,lastModified:n.lastModified}):i&&typeof Blob=="function"&&n instanceof Blob&&(s=new Blob([n],{type:o})),{...e,type:o,data:s,name:e.name||n.name||"document"}}}if(e&&typeof e=="object"&&"url"in e&&typeof e.type=="string"){const n=Qy(e.type);if(n!==e.type)return{...e,type:n}}return e};Ft();function N5(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?no({...t}):re(t),i=re(null);return jt(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function B5(e){const t=re(e.itemid),n=re(e.itemicon),r=re(e.itemiconpack),o=re(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=N5(e,i,re([])),l=re(e.itemtype),u=re(e.itemfieldtype),d=e,f=no({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=re(e.logicrules),g=re(!1),m=no({}),v={SELECT:j5,IMAGEINPUT:z5,CHECKBOXINPUT:V5};return l.value in v&&Object.assign(m,v[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:re(e.itemformat),logicRules:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function z5(e){return{fontfamily:re(e.fontfamily),iteminputtype:re(e.iteminputtype)}}function j5(e){return{options:re(e.itemoptions)}}function V5(e){const t=re(e.itemoptions);return t.value&&(t.value=t.value.map(n=>({label:n.itemdisplaylabel,value:n.itemlinkvalue,checked:n.ischecked,id:n.itemid,annotationId:n.annotationId}))),{options:t}}var Bs=()=>new Map,e0=e=>{const t=Bs();return e.forEach((n,r)=>{t.set(r,n)}),t},xu=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},U5=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},H5=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Ru=()=>new Set,t0=e=>e[e.length-1],Mu=Array.from,n0=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},Ck=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},$5=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},zp=Array.isArray,G5=class{constructor(){this._observers=Bs()}on(e,t){return xu(this._observers,e,Ru).add(t),t}once(e,t){const n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){const n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return Mu((this._observers.get(e)||Bs()).values()).forEach(n=>n(...t))}destroy(){this._observers=Bs()}},Ta=Math.floor,jp=Math.abs,kk=(e,t)=>e<t?e:t,Lu=(e,t)=>e>t?e:t,$G=Number.isNaN,W5=e=>e!==0?e<0:1/e<0,GG=1,WG=2,KG=4,qG=8,YG=32,XG=64,ZG=128,K5=1<<17,q5=1<<18,Y5=1<<19,X5=1<<20,Z5=1<<21,Q5=1<<22,J5=1<<23,e6=1<<24,t6=1<<25,n6=1<<26,r6=1<<27,o6=1<<28,i6=1<<29,s6=1<<30,QG=31,JG=63,eW=127,tW=K5-1,nW=q5-1,rW=Y5-1,oW=X5-1,iW=Z5-1,sW=Q5-1,aW=J5-1,lW=e6-1,cW=t6-1,uW=n6-1,dW=r6-1,fW=o6-1,hW=i6-1,pW=s6-1,mW=2147483647,Sk=Number.MAX_SAFE_INTEGER,_k=Number.MIN_SAFE_INTEGER,a6=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Ta(e)===e),gW=Number.isNaN,vW=Number.parseInt,Ak=String.fromCharCode,yW=String.fromCodePoint,bW=Ak(65535),l6=e=>e.toLowerCase(),c6=/^\s*/g,u6=e=>e.replace(c6,""),d6=/([A-Z])/g,Ik=(e,t)=>u6(e.replace(d6,n=>`${t}${l6(n)}`)),f6=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},Af=typeof TextEncoder<"u"?new TextEncoder:null,h6=e=>Af.encode(e),p6=Af?h6:f6,r0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});r0&&r0.decode(new Uint8Array).length===1&&(r0=null);var m6=(e,t)=>$5(t,()=>e).join(""),If=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},o0=()=>new If,g6=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},xa=e=>{const t=new Uint8Array(g6(e));let n=0;for(let r=0;r<e.bufs.length;r++){const o=e.bufs[r];t.set(o,n),n+=o.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},v6=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Lu(n,t)*2),e.cpos=0)},uo=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},i0=uo,Zn=(e,t)=>{for(;t>127;)uo(e,128|127&t),t=Ta(t/128);uo(e,127&t)},s0=(e,t)=>{const n=W5(t);for(n&&(t=-t),uo(e,(t>63?128:0)|(n?64:0)|63&t),t=Ta(t/64);t>0;)uo(e,(t>127?128:0)|127&t),t=Ta(t/128)},a0=new Uint8Array(3e4),y6=a0.length/3,b6=(e,t)=>{if(t.length<y6){const n=Af.encodeInto(t,a0).written||0;Zn(e,n);for(let r=0;r<n;r++)uo(e,a0[r])}else bi(e,p6(t))},w6=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Zn(e,r);for(let o=0;o<r;o++)uo(e,n.codePointAt(o))},Du=Af&&Af.encodeInto?b6:w6,l0=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=kk(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Lu(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},bi=(e,t)=>{Zn(e,t.byteLength),l0(e,t)},c0=(e,t)=>{v6(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},C6=(e,t)=>c0(e,4).setFloat32(0,t,!1),k6=(e,t)=>c0(e,8).setFloat64(0,t,!1),S6=(e,t)=>c0(e,8).setBigInt64(0,t,!1),Ek=new DataView(new ArrayBuffer(4)),_6=e=>(Ek.setFloat32(0,e),Ek.getFloat32(0)===e),Ef=(e,t)=>{switch(typeof t){case"string":uo(e,119),Du(e,t);break;case"number":a6(t)&&jp(t)<=2147483647?(uo(e,125),s0(e,t)):_6(t)?(uo(e,124),C6(e,t)):(uo(e,123),k6(e,t));break;case"bigint":uo(e,122),S6(e,t);break;case"object":if(t===null)uo(e,126);else if(zp(t)){uo(e,117),Zn(e,t.length);for(let n=0;n<t.length;n++)Ef(e,t[n])}else if(t instanceof Uint8Array)uo(e,116),bi(e,t);else{uo(e,118);const n=Object.keys(t);Zn(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];Du(e,o),Ef(e,t[o])}}break;case"boolean":uo(e,t?120:121);break;default:uo(e,127)}},Tk=class extends If{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Zn(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},xk=e=>{e.count>0&&(s0(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Zn(e.encoder,e.count-2))},Vp=class{constructor(){this.encoder=new If,this.s=0,this.count=0}write(e){this.s===e?this.count++:(xk(this),this.count=1,this.s=e)}toUint8Array(){return xk(this),xa(this.encoder)}},Rk=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);s0(e.encoder,t),e.count>1&&Zn(e.encoder,e.count-2)}},u0=class{constructor(){this.encoder=new If,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(Rk(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return Rk(this),xa(this.encoder)}},A6=class{constructor(){this.sarr=[],this.s="",this.lensE=new Vp}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new If;return this.sarr.push(this.s),this.s="",Du(e,this.sarr.join("")),l0(e,this.lensE.toUint8Array()),xa(e)}},wl=e=>new Error(e),us=()=>{throw wl("Method unimplemented")},Ra=()=>{throw wl("Unexpected case")},wW=crypto.subtle,I6=crypto.getRandomValues.bind(crypto),Mk=()=>I6(new Uint32Array(1))[0],E6="10000000-1000-4000-8000-100000000000",T6=()=>E6.replace(/[018]/g,e=>(e^Mk()&15>>e/4).toString(16)),x6=Date.now,Lk=e=>new Promise(e),CW=Promise.all.bind(Promise),Dk=e=>e===void 0?null:e,R6=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},Ok=new R6,M6=!0;try{typeof localStorage<"u"&&localStorage&&(Ok=localStorage,M6=!1)}catch{}var L6=Ok,Tf=Symbol("Equality"),Pk=(e,t)=>e===t||!!e?.[Tf]?.(t)||!1,D6=e=>typeof e=="object",O6=Object.assign,P6=Object.keys,F6=(e,t)=>{for(const n in e)t(e[n],n)},Up=e=>P6(e).length,N6=e=>{for(const t in e)return!1;return!0},xf=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},d0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),B6=(e,t)=>e===t||Up(e)===Up(t)&&xf(e,(n,r)=>(n!==void 0||d0(t,r))&&Pk(t[r],n)),z6=Object.freeze,Fk=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&Fk(e[t])}return z6(e)},f0=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&f0(e,t,n+1)}},Hp=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[Tf]!=null)return e[Tf](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(const n of e.keys())if(!t.has(n)||!Hp(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Up(e)!==Up(t))return!1;for(const n in e)if(!d0(e,n)||!Hp(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Hp(e[n],t[n]))return!1;break;default:return!1}return!0},j6=(e,t)=>t.includes(e),Rf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",kW=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,zs,V6=[],U6=()=>{if(zs===void 0)if(Rf){zs=Bs();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&zs.set(t,""),t=r):t!==null?(zs.set(t,r),t=null):V6.push(r)}t!==null&&zs.set(t,"")}else typeof location=="object"?(zs=Bs(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");zs.set(`--${Ik(t,"-")}`,n),zs.set(`-${Ik(t,"-")}`,n)}})):zs=Bs();return zs},h0=e=>U6().has(e),$p=e=>Dk(Rf?process.env[e.toUpperCase().replaceAll("-","_")]:L6.getItem(e)),Nk=e=>h0("--"+e)||$p(e)!==null,H6=Nk("production"),$6=Rf&&j6(process.env.FORCE_COLOR,["true","1","2"]),G6=$6||!h0("--no-colors")&&!Nk("no-color")&&(!Rf||process.stdout.isTTY)&&(!Rf||h0("--color")||$p("COLORTERM")!==null||($p("TERM")||"").includes("color")),W6=class{constructor(e,t){this.left=e,this.right=t}},Ma=(e,t)=>new W6(e,t),Bk=e=>e.next()>=.5,p0=(e,t,n)=>Ta(e.next()*(n+1-t)+t),zk=(e,t,n)=>Ta(e.next()*(n+1-t)+t),m0=(e,t,n)=>zk(e,t,n),K6=e=>Ak(m0(e,97,122)),q6=(e,t=0,n=20)=>{const r=m0(e,t,n);let o="";for(let i=0;i<r;i++)o+=K6(e);return o},g0=(e,t)=>t[m0(e,0,t.length-1)],Y6=Symbol("0schema"),X6=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const n=this._rerrs[t];e.push(m6(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
5
5
|
`)}},v0=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[Tf]?Pk(e,t):zp(e)?n0(e,n=>Ck(t,r=>v0(n,r))):D6(e)?xf(e,(n,r)=>v0(n,t[r])):!1,Ho=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),v0(t,n)}equals(e){return this.constructor===e.constructor&&Hp(this.shape,e.shape)}[Y6](){return!0}[Tf](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){us()}get nullable(){return Ou(this,Xp)}get optional(){return new Uk(this)}cast(e){return n3(e,this),e}expect(e){return n3(e,this),e}},y0=class extends Ho{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){const n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),n}},Kr=(e,t=null)=>new y0(e,t),SW=Kr(y0),b0=class extends Ho{constructor(e){super(),this.shape=e}check(e,t){const n=this.shape(e);return!n&&t?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),n}},fo=e=>new b0(e),_W=Kr(b0),Gp=class extends Ho{constructor(e){super(),this.shape=e}check(e,t){const n=this.shape.some(r=>r===e);return!n&&t?.extend(null,this.shape.join(" | "),e.toString()),n}},Wp=(...e)=>new Gp(e),jk=Kr(Gp),Z6=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),Vk=e=>{if(Fu.check(e))return[Z6(e)];if(jk.check(e))return e.shape.map(t=>t+"");if(Jk.check(e))return["[+-]?\\d+.?\\d*"];if(e3.check(e))return[".*"];if(Kp.check(e))return e.shape.map(Vk).flat(1);Ra()},Q6=class extends Ho{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(Vk).map(t=>`(${t.join("|")})`).join("")+"$")}check(e,t){const n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),n}},AW=Kr(Q6),J6=Symbol("optional"),Uk=class extends Ho{constructor(e){super(),this.shape=e}check(e,t){const n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,"undefined (optional)","()"),n}get[J6](){return!0}},e8=Kr(Uk),Hk=class extends Ho{check(e,t){return t?.extend(null,"never",typeof e),!1}},IW=new Hk,EW=Kr(Hk),$k=class ME extends Ho{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new ME(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):xf(this.shape,(r,o)=>{const i=this._isPartial&&!d0(t,o)||r.check(t[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof t[o],"Object property does not match"),i})}},t8=e=>new $k(e),n8=Kr($k),r8=fo(e=>e!=null&&(e.constructor===Object||e.constructor==null)),Gk=class extends Ho{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&xf(e,(n,r)=>{const o=this.shape.keys.check(r,t);return!o&&t?.extend(r+"","Record",typeof e,o?"Key doesn't match schema":"Value doesn't match value"),o&&this.shape.values.check(n,t)})}},Wk=(e,t)=>new Gk(e,t),o8=Kr(Gk),Kk=class extends Ho{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&xf(this.shape,(n,r)=>{const o=n.check(e[r],t);return!o&&t?.extend(r.toString(),"Tuple",typeof n),o})}},i8=(...e)=>new Kk(e),TW=Kr(Kk),qk=class extends Ho{constructor(e){super(),this.shape=e.length===1?e[0]:new w0(e)}check(e,t){const n=zp(e)&&n0(e,r=>this.shape.check(r));return!n&&t?.extend(null,"Array",""),n}},Yk=(...e)=>new qk(e),s8=Kr(qk),a8=fo(e=>zp(e)),Xk=class extends Ho{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){const n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}},l8=(e,t=null)=>new Xk(e,t),xW=Kr(Xk),c8=l8(Ho),u8=class extends Ho{constructor(e){super(),this.len=e.length-1,this.args=i8(...e.slice(-1)),this.res=e[this.len]}check(e,t){const n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,"function",typeof e),n}},d8=Kr(u8),f8=fo(e=>typeof e=="function"),h8=class extends Ho{constructor(e){super(),this.shape=e}check(e,t){const n=n0(this.shape,r=>r.check(e,t));return!n&&t?.extend(null,"Intersectinon",typeof e),n}},RW=Kr(h8,e=>e.shape.length>0),w0=class extends Ho{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const n=Ck(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),n}},Ou=(...e)=>e.findIndex(t=>Kp.check(t))>=0?Ou(...e.map(t=>Mf(t)).map(t=>Kp.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new w0(e),Kp=Kr(w0),Zk=()=>!0,qp=fo(Zk),p8=Kr(b0,e=>e.shape===Zk),C0=fo(e=>typeof e=="bigint"),m8=fo(e=>e===C0),Qk=fo(e=>typeof e=="symbol"),MW=fo(e=>e===Qk),Pu=fo(e=>typeof e=="number"),Jk=fo(e=>e===Pu),Fu=fo(e=>typeof e=="string"),e3=fo(e=>e===Fu),Yp=fo(e=>typeof e=="boolean"),g8=fo(e=>e===Yp),t3=Wp(void 0),LW=Kr(Gp,e=>e.shape.length===1&&e.shape[0]===void 0),DW=Wp(void 0),Xp=Wp(null),v8=Kr(Gp,e=>e.shape.length===1&&e.shape[0]===null),OW=Kr(Uint8Array),PW=Kr(y0,e=>e.shape===Uint8Array),y8=Ou(Pu,Fu,Xp,t3,C0,Yp,Qk),FW=(()=>{const e=Yk(qp),t=Wk(Fu,qp),n=Ou(Pu,Fu,Xp,Yp,e,t);return e.shape=n,t.shape.values=n,n})(),Mf=e=>{if(c8.check(e))return e;if(r8.check(e)){const t={};for(const n in e)t[n]=Mf(e[n]);return t8(t)}else{if(a8.check(e))return Ou(...e.map(Mf));if(y8.check(e))return Wp(e);if(f8.check(e))return Kr(e)}Ra()},n3=H6?()=>{}:(e,t)=>{const n=new X6;if(!t.check(e,n))throw wl(`Expected value to be of type ${t.constructor.name}.
|
|
6
|
-
${n.toString()}`)},b8=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Mf(e),h:t}),this}else(e){return this.if(qp,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){const r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw wl("Unhandled pattern")}}},w8=e=>new b8(e),r3=w8(qp).if(Jk,(e,t)=>p0(t,_k,Sk)).if(e3,(e,t)=>q6(t)).if(g8,(e,t)=>Bk(t)).if(m8,(e,t)=>BigInt(p0(t,_k,Sk))).if(Kp,(e,t)=>Nu(t,g0(t,e.shape))).if(n8,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(e8.check(o)){if(Bk(t))continue;o=o.shape}n[r]=r3(o,t)}return n}).if(s8,(e,t)=>{const n=[],r=zk(t,0,42);for(let o=0;o<r;o++)n.push(Nu(t,e.shape));return n}).if(jk,(e,t)=>g0(t,e.shape)).if(v8,(e,t)=>null).if(d8,(e,t)=>{const n=Nu(t,e.res);return()=>n}).if(p8,(e,t)=>Nu(t,g0(t,[Pu,Fu,Xp,t3,C0,Yp,Yk(Pu),Wk(Ou("a","b","c"),Pu)]))).if(o8,(e,t)=>{const n={},r=p0(t,0,3);for(let o=0;o<r;o++){const i=Nu(t,e.shape.keys);n[i]=Nu(t,e.shape.values)}return n}).done(),Nu=(e,t)=>r3(Mf(t),e),Cc=typeof document<"u"?document:{},NW=fo(e=>e.nodeType===A8),BW=typeof DOMParser<"u"?new DOMParser:null,zW=fo(e=>e.nodeType===k8),jW=fo(e=>e.nodeType===S8),C8=e=>Ux(e,(t,n)=>`${n}:${t};`).join(""),k8=Cc.ELEMENT_NODE,S8=Cc.TEXT_NODE,VW=Cc.CDATA_SECTION_NODE,UW=Cc.COMMENT_NODE,_8=Cc.DOCUMENT_NODE,HW=Cc.DOCUMENT_TYPE_NODE,A8=Cc.DOCUMENT_FRAGMENT_NODE,$W=fo(e=>e.nodeType===_8),La=Symbol,o3=La(),i3=La(),I8=La(),E8=La(),T8=La(),s3=La(),x8=La(),k0=La(),R8=La(),M8=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[];let r=0;for(;r<e.length;r++){const o=e[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)t.push(o);else if(o.constructor===Object)break}for(r>0&&n.push(t.join(""));r<e.length;r++){const o=e[r];o instanceof Symbol||n.push(o)}return n},GW=x6(),L8={[o3]:Ma("font-weight","bold"),[i3]:Ma("font-weight","normal"),[I8]:Ma("color","blue"),[T8]:Ma("color","green"),[E8]:Ma("color","grey"),[s3]:Ma("color","red"),[x8]:Ma("color","purple"),[k0]:Ma("color","orange"),[R8]:Ma("color","black")},D8=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=Bs();let o=[],i=0;for(;i<e.length;i++){const s=e[i],a=L8[s];if(a!==void 0)r.set(a.left,a.right);else{if(s===void 0)break;if(s.constructor===String||s.constructor===Number){const l=C8(r);i>0||l.length>0?(t.push("%c"+s),n.push(l)):t.push(s)}else break}}for(i>0&&(o=n,o.unshift(t.join("")));i<e.length;i++){const s=e[i];s instanceof Symbol||o.push(s)}return o},a3=G6?D8:M8,O8=(...e)=>{console.log(...a3(e)),l3.forEach(t=>t.print(e))},P8=(...e)=>{console.warn(...a3(e)),e.unshift(k0),l3.forEach(t=>t.print(e))},l3=Ru(),c3=e=>({[Symbol.iterator](){return this},next:e}),F8=(e,t)=>c3(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),S0=(e,t)=>c3(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),u3=class{constructor(e,t){this.clock=e,this.len=t}},d3=class{constructor(){this.clients=new Map}},f3=(e,t,n)=>t.clients.forEach((r,o)=>{const i=e.doc.store.clients.get(o);if(i!=null){const s=i[i.length-1],a=s.id.clock+s.length;for(let l=0,u=r[l];l<r.length&&u.clock<a;u=r[++l])S3(e,i,u.clock,u.len,n)}}),N8=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=Ta((n+r)/2),i=e[o],s=i.clock;if(s<=t){if(t<s+i.len)return o;n=o+1}else r=o-1}return null},h3=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&N8(n,t.clock)!==null},p3=e=>{e.clients.forEach(t=>{t.sort((o,i)=>o.clock-i.clock);let n,r;for(n=1,r=1;n<t.length;n++){const o=t[r-1],i=t[n];o.clock+o.len>=i.clock?t[r-1]=new u3(o.clock,Lu(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},m3=(e,t,n,r)=>{xu(e.clients,t,()=>[]).push(new u3(n,r))},B8=()=>new d3,z8=(e,t)=>{Zn(e.restEncoder,t.clients.size),Mu(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),Zn(e.restEncoder,n);const o=r.length;Zn(e.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},g3=Mk,_0=class LE extends Gx{constructor({guid:t=T6(),collectionid:n=null,gc:r=!0,gcFilter:o=()=>!0,meta:i=null,autoLoad:s=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=o,this.clientID=g3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new Z8,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=s,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Lk(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>Lk(u=>{const d=f=>{(f===void 0||f===!0)&&(this.off("sync",d),u())};this.on("sync",d)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;t!==null&&!this.shouldLoad&&ur(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Mu(this.subdocs).map(t=>t.guid))}transact(t,n=null){return ur(this,t,n)}get(t,n=So){const r=xu(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==So&&o!==n)if(o===So){const i=new n;i._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=i}),i._start=r._start;for(let s=i._start;s!==null;s=s.right)s.parent=i;return i._length=r._length,this.share.set(t,i),i._integrate(this,null),i}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,dR)}getText(t=""){return this.get(t,vR)}getMap(t=""){return this.get(t,L0)}getXmlElement(t=""){return this.get(t,W3)}getXmlFragment(t=""){return this.get(t,F0)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,Mu(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new LE({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,ur(t.parent.doc,r=>{const o=n.doc;t.deleted||r.subdocsAdded.add(o),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}},j8=class{constructor(){this.restEncoder=o0()}toUint8Array(){return xa(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Zn(this.restEncoder,e)}writeDsLen(e){Zn(this.restEncoder,e)}},V8=class extends j8{writeLeftID(e){Zn(this.restEncoder,e.client),Zn(this.restEncoder,e.clock)}writeRightID(e){Zn(this.restEncoder,e.client),Zn(this.restEncoder,e.clock)}writeClient(e){Zn(this.restEncoder,e)}writeInfo(e){i0(this.restEncoder,e)}writeString(e){Du(this.restEncoder,e)}writeParentInfo(e){Zn(this.restEncoder,e?1:0)}writeTypeRef(e){Zn(this.restEncoder,e)}writeLen(e){Zn(this.restEncoder,e)}writeAny(e){Ef(this.restEncoder,e)}writeBuf(e){bi(this.restEncoder,e)}writeJSON(e){Du(this.restEncoder,JSON.stringify(e))}writeKey(e){Du(this.restEncoder,e)}},U8=class{constructor(){this.restEncoder=o0(),this.dsCurrVal=0}toUint8Array(){return xa(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,Zn(this.restEncoder,t)}writeDsLen(e){e===0&&Ra(),Zn(this.restEncoder,e-1),this.dsCurrVal+=e}},H8=class extends U8{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new u0,this.clientEncoder=new Vp,this.leftClockEncoder=new u0,this.rightClockEncoder=new u0,this.infoEncoder=new Tk(i0),this.stringEncoder=new A6,this.parentInfoEncoder=new Tk(i0),this.typeRefEncoder=new Vp,this.lenEncoder=new Vp}toUint8Array(){const e=o0();return Zn(e,0),bi(e,this.keyClockEncoder.toUint8Array()),bi(e,this.clientEncoder.toUint8Array()),bi(e,this.leftClockEncoder.toUint8Array()),bi(e,this.rightClockEncoder.toUint8Array()),bi(e,xa(this.infoEncoder)),bi(e,this.stringEncoder.toUint8Array()),bi(e,xa(this.parentInfoEncoder)),bi(e,this.typeRefEncoder.toUint8Array()),bi(e,this.lenEncoder.toUint8Array()),l0(e,xa(this.restEncoder)),xa(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Ef(this.restEncoder,e)}writeBuf(e){bi(this.restEncoder,e)}writeJSON(e){Ef(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},$8=(e,t,n,r)=>{r=Lu(r,t[0].id.clock);const o=Da(t,r);Zn(e.restEncoder,t.length-o),e.writeClient(n),Zn(e.restEncoder,r);const i=t[o];i.write(e,r-i.id.clock);for(let s=o+1;s<t.length;s++)t[s].write(e,0)},G8=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{si(t,i)>o&&r.set(i,o)}),I0(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),Zn(e.restEncoder,r.size),Mu(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{$8(e,t.clients.get(o),o,i)})},W8=(e,t)=>G8(e,t.doc.store,t.beforeState),K8=class{constructor(){this.l=[]}},v3=()=>new K8,y3=(e,t)=>e.l.push(t),b3=(e,t)=>{const n=e.l,r=n.length;e.l=n.filter(o=>t!==o),r===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},w3=(e,t,n)=>f0(e.l,[t,n]),Zp=class{constructor(e,t){this.client=e,this.clock=t}},Qp=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,Mr=(e,t)=>new Zp(e,t),q8=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw Ra()},Y8=class{constructor(e,t){this.ds=e,this.sv=t}},X8=(e,t)=>new Y8(e,t),WW=X8(B8(),new Map),Bu=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!h3(t.ds,e.id),A0=(e,t)=>{const n=xu(e.meta,A0,Ru),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<si(r,i)&&Cl(e,Mr(i,o))}),f3(e,t.ds,o=>{}),n.add(t))},Z8=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},I0=e=>{const t=new Map;return e.clients.forEach((n,r)=>{const o=n[n.length-1];t.set(r,o.id.clock+o.length)}),t},si=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},C3=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==t.id.clock)throw Ra()}n.push(t)},Da=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=Ta(t/(i+o.length-1)*r);for(;n<=r;){if(o=e[s],i=o.id.clock,i<=t){if(t<i+o.length)return s;n=s+1}else r=s-1;s=Ta((n+r)/2)}throw Ra()},Q8=(e,t)=>{const n=e.clients.get(t.client);return n[Da(n,t.clock)]},E0=Q8,T0=(e,t,n)=>{const r=Da(t,n),o=t[r];return o.id.clock<n&&o instanceof wi?(t.splice(r+1,0,X3(e,o,n-o.id.clock)),r+1):r},Cl=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[T0(e,n,t.clock)]},k3=(e,t,n)=>{const r=t.clients.get(n.client),o=Da(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Sl&&r.splice(o+1,0,X3(e,i,n.clock-i.id.clock+1)),i},J8=(e,t,n)=>{const r=e.clients.get(t.id.client);r[Da(r,t.id.clock)]=n},S3=(e,t,n,r,o)=>{if(r===0)return;const i=n+r;let s=T0(e,t,n),a;do a=t[s++],i<a.id.clock+a.length&&T0(e,t,i),o(a);while(s<t.length&&t[s].id.clock<i)},eR=class{constructor(e,t,n){this.doc=e,this.deleteSet=new d3,this.beforeState=I0(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},_3=(e,t)=>t.deleteSet.clients.size===0&&!Hx(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(p3(t.deleteSet),W8(e,t),z8(e,t.deleteSet),!0),A3=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&xu(e.changed,t,Ru).add(n)},Jp=(e,t)=>{let n=e[t],r=e[t-1],o=t;for(;o>0;n=r,r=e[--o-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof wi&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const i=t-o;return i&&e.splice(t+1-i,i),i},tR=(e,t,n)=>{for(const[r,o]of e.clients.entries()){const i=t.clients.get(r);for(let s=o.length-1;s>=0;s--){const a=o[s],l=a.clock+a.len;for(let u=Da(i,a.clock),d=i[u];u<i.length&&d.id.clock<l;d=i[++u]){const f=i[u];if(a.clock+a.len<=f.id.clock)break;f instanceof wi&&f.deleted&&!f.keep&&n(f)&&f.gc(t,!1)}}}},nR=(e,t)=>{e.clients.forEach((n,r)=>{const o=t.clients.get(r);for(let i=n.length-1;i>=0;i--){const s=n[i],a=kk(o.length-1,1+Da(o,s.clock+s.len-1));for(let l=a,u=o[l];l>0&&u.id.clock>=s.clock;u=o[l])l-=1+Jp(o,l)}})},I3=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{p3(i),n.afterState=I0(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(d=>d.target._item===null||!d.target._item.deleted),l.forEach(d=>{d.currentTarget=u,d._path=null}),l.sort((d,f)=>d.path.length-f.path.length),a.push(()=>{w3(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&mR(n)})}),f0(a,[])}finally{r.gc&&tR(i,o,r.gcFilter),nR(i,o),n.afterState.forEach((d,f)=>{const p=n.beforeState.get(f)||0;if(p!==d){const g=o.clients.get(f),m=Lu(Da(g,p),1);for(let v=g.length-1;v>=m;)v-=1+Jp(g,v)}});for(let d=s.length-1;d>=0;d--){const{client:f,clock:p}=s[d].id,g=o.clients.get(f),m=Da(g,p);m+1<g.length&&Jp(g,m+1)>1||m>0&&Jp(g,m)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(O8(k0,o3,"[yjs] ",i3,s3,"Changed the client-id because another client seems to be using it."),r.clientID=g3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new V8;_3(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new H8;_3(d,n)&&r.emit("updateV2",[d.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=n;(a.size>0||u.size>0||l.size>0)&&(a.forEach(d=>{d.clientID=r.clientID,d.collectionid==null&&(d.collectionid=r.collectionid),r.subdocs.add(d)}),u.forEach(d=>r.subdocs.delete(d)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,n]),u.forEach(d=>d.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):I3(e,t+1)}}},ur=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new eR(e,n,r),o.push(e._transaction),o.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{s=t(e._transaction)}finally{if(i){const a=e._transaction===o[0];e._transaction=null,a&&I3(o,0)}}return s},E3="You must not compute changes after the event-handler fired.",em=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=rR(this.currentTarget,this.target))}deletes(e){return h3(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw wl(E3);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){const r=t._map.get(n);let o,i;if(this.adds(r)){let s=r.left;for(;s!==null&&this.adds(s);)s=s.left;if(this.deletes(r))if(s!==null&&this.deletes(s))o="delete",i=t0(s.content.getContent());else return;else s!==null&&this.deletes(s)?(o="update",i=t0(s.content.getContent())):(o="add",i=void 0)}else if(this.deletes(r))o="delete",i=t0(r.content.getContent());else return;e.set(n,{action:o,oldValue:i})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw wl(E3);const t=this.target,n=Ru(),r=Ru(),o=[];if(e={added:n,deleted:r,delta:o,keys:this.keys},this.transaction.changed.get(t).has(null)){let i=null;const s=()=>{i&&o.push(i)};for(let a=t._start;a!==null;a=a.right)a.deleted?this.deletes(a)&&!this.adds(a)&&((i===null||i.delete===void 0)&&(s(),i={delete:0}),i.delete+=a.length,r.add(a)):this.adds(a)?((i===null||i.insert===void 0)&&(s(),i={insert:[]}),i.insert=i.insert.concat(a.content.getContent()),n.add(a)):((i===null||i.retain===void 0)&&(s(),i={retain:0}),i.retain+=a.length);i!==null&&i.retain===void 0&&s()}this._changes=e}return e}},rR=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let r=0,o=t._item.parent._start;for(;o!==t._item&&o!==null;)!o.deleted&&o.countable&&(r+=o.length),o=o.right;n.unshift(r)}t=t._item.parent}return n},Do=()=>{P8("Invalid access: Add Yjs type to a document before reading data.")},T3=80,x0=0,oR=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=x0++}},iR=e=>{e.timestamp=x0++},x3=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=x0++},sR=(e,t,n)=>{if(e.length>=T3){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return x3(r,t,n),r}else{const r=new oR(t,n);return e.push(r),r}},tm=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce((i,s)=>jp(t-i.index)<jp(t-s.index)?i:s);let r=e._start,o=0;for(n!==null&&(r=n.p,o=n.index,iR(n));r.right!==null&&o<t;){if(!r.deleted&&r.countable){if(t<o+r.length)break;o+=r.length}r=r.right}for(;r.left!==null&&o>t;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);return n!==null&&jp(n.index-o)<r.parent.length/T3?(x3(n,r,o),n):sR(e._searchMarker,r,o)},Lf=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){const o=e[r];if(n>0){let i=o.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(o.index-=i.length);if(i===null||i.marker===!0){e.splice(r,1);continue}o.p=i,i.marker=!0}(t<o.index||n>0&&t===o.index)&&(o.index=Lu(t,o.index+n))}},nm=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;xu(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;w3(r._eH,n,t)},So=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=v3(),this._dEH=v3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw us()}clone(){throw us()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){y3(this._eH,e)}observeDeep(e){y3(this._dEH,e)}unobserve(e){b3(this._eH,e)}unobserveDeep(e){b3(this._dEH,e)}toJSON(){}},R3=(e,t,n)=>{e.doc??Do(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t;const o=[];let i=e._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){const s=i.content.getContent();if(s.length<=t)t-=s.length;else{for(let a=t;a<s.length&&r>0;a++)o.push(s[a]),r--;t=0}}i=i.right}return o},M3=e=>{e.doc??Do();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let o=0;o<r.length;o++)t.push(r[o])}n=n.right}return t},Df=(e,t)=>{let n=0,r=e._start;for(e.doc??Do();r!==null;){if(r.countable&&!r.deleted){const o=r.content.getContent();for(let i=0;i<o.length;i++)t(o[i],n++,e)}r=r.right}},L3=(e,t)=>{const n=[];return Df(e,(r,o)=>{n.push(t(r,o,e))}),n},aR=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}const o=n[r++];return n.length<=r&&(n=null),{done:!1,value:o}}}},D3=(e,t)=>{e.doc??Do();const n=tm(e,t);let r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},rm=(e,t,n,r)=>{let o=n;const i=e.doc,s=i.clientID,a=i.store,l=n===null?t._start:n.right;let u=[];const d=()=>{u.length>0&&(o=new wi(Mr(s,si(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new N0(u)),o.integrate(e,0),u=[])};r.forEach(f=>{if(f===null)u.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(f);break;default:switch(d(),f.constructor){case Uint8Array:case ArrayBuffer:o=new wi(Mr(s,si(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new q3(new Uint8Array(f))),o.integrate(e,0);break;case _0:o=new wi(Mr(s,si(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Y3(f)),o.integrate(e,0);break;default:if(f instanceof So)o=new wi(Mr(s,si(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Vu(f)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},O3=()=>wl("Length exceeded!"),P3=(e,t,n,r)=>{if(n>t._length)throw O3();if(n===0)return t._searchMarker&&Lf(t._searchMarker,n,r.length),rm(e,t,null,r);const o=n,i=tm(t,n);let s=t._start;for(i!==null&&(s=i.p,n-=i.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&Cl(e,Mr(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&Lf(t._searchMarker,o,r.length),rm(e,t,s,r)},lR=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((o,i)=>i.index>o.index?i:o,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return rm(e,t,r,n)},F3=(e,t,n,r)=>{if(r===0)return;const o=n,i=r,s=tm(t,n);let a=t._start;for(s!==null&&(a=s.p,n-=s.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&Cl(e,Mr(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Cl(e,Mr(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw O3();t._searchMarker&&Lf(t._searchMarker,o,-i+r)},om=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},R0=(e,t,n,r)=>{const o=t._map.get(n)||null,i=e.doc,s=i.clientID;let a;if(r==null)a=new N0([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new N0([r]);break;case Uint8Array:a=new q3(r);break;case _0:a=new Y3(r);break;default:if(r instanceof So)a=new Vu(r);else throw new Error("Unexpected content type")}new wi(Mr(s,si(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},M0=(e,t)=>{e.doc??Do();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},N3=e=>{const t={};return e.doc??Do(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},B3=(e,t)=>{e.doc??Do();const n=e._map.get(t);return n!==void 0&&!n.deleted},cR=(e,t)=>{const n={};return e._map.forEach((r,o)=>{let i=r;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&Bu(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},im=e=>(e.doc??Do(),F8(e._map.entries(),t=>!t[1].deleted)),uR=class extends em{},dR=class zg extends So{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new zg;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new zg}clone(){const t=new zg;return t.insert(0,this.toArray().map(n=>n instanceof So?n.clone():n)),t}get length(){return this.doc??Do(),this._length}_callObserver(t,n){super._callObserver(t,n),nm(this,t,new uR(this,t))}insert(t,n){this.doc!==null?ur(this.doc,r=>{P3(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?ur(this.doc,n=>{lR(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?ur(this.doc,r=>{F3(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return D3(this,t)}toArray(){return M3(this)}slice(t=0,n=this.length){return R3(this,t,n)}toJSON(){return this.map(t=>t instanceof So?t.toJSON():t)}map(t){return L3(this,t)}forEach(t){Df(this,t)}[Symbol.iterator](){return aR(this)}_write(t){t.writeTypeRef(SR)}},fR=class extends em{constructor(e,t,n){super(e,t),this.keysChanged=n}},L0=class M2 extends So{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((r,o)=>{this.set(o,r)}),this._prelimContent=null}_copy(){return new M2}clone(){const t=new M2;return this.forEach((n,r)=>{t.set(r,n instanceof So?n.clone():n)}),t}_callObserver(t,n){nm(this,t,new fR(this,t,n))}toJSON(){this.doc??Do();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof So?o.toJSON():o}}),t}get size(){return[...im(this)].length}keys(){return S0(im(this),t=>t[0])}values(){return S0(im(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return S0(im(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??Do(),this._map.forEach((n,r)=>{n.deleted||t(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?ur(this.doc,n=>{om(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?ur(this.doc,r=>{R0(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return M0(this,t)}has(t){return B3(this,t)}clear(){this.doc!==null?ur(this.doc,t=>{this.forEach(function(n,r,o){om(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(_R)}},kl=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&B6(e,t),D0=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){this.right===null&&Ra(),this.right.content.constructor===Oo?this.right.deleted||zu(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},z3=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===Oo?t.right.deleted||zu(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&Cl(e,Mr(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length),t.left=t.right,t.right=t.right.right;return t},sm=(e,t,n,r)=>{const o=new Map,i=r?tm(t,n):null;if(i){const s=new D0(i.p.left,i.p,i.index,o);return z3(e,s,n-i.index)}else{const s=new D0(null,t._start,0,o);return z3(e,s,n)}},j3=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Oo&&kl(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const o=e.doc,i=o.clientID;r.forEach((s,a)=>{const l=n.left,u=n.right,d=new wi(Mr(i,si(o.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,new Oo(a,s));d.integrate(e,0),n.right=d,n.forward()})},zu=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},V3=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===Oo&&kl(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},U3=(e,t,n,r)=>{const o=e.doc,i=o.clientID,s=new Map;for(const a in r){const l=r[a],u=n.currentAttributes.get(a)??null;if(!kl(u,l)){s.set(a,u);const{left:d,right:f}=n;n.right=new wi(Mr(i,si(o.store,i)),d,d&&d.lastId,f,f&&f.id,t,null,new Oo(a,l)),n.right.integrate(e,0),n.forward()}}return s},O0=(e,t,n,r,o)=>{n.currentAttributes.forEach((p,g)=>{o[g]===void 0&&(o[g]=null)});const i=e.doc,s=i.clientID;V3(n,o);const a=U3(e,t,n,o),l=r.constructor===String?new ju(r):r instanceof So?new Vu(r):new am(r);let{left:u,right:d,index:f}=n;t._searchMarker&&Lf(t._searchMarker,n.index,l.getLength()),d=new wi(Mr(s,si(i.store,s)),u,u&&u.lastId,d,d&&d.id,t,null,l),d.integrate(e,0),n.right=d,n.index=f,n.forward(),j3(e,t,n,a)},H3=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;V3(n,o);const a=U3(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Oo));){if(!n.right.deleted)switch(n.right.content.constructor){case Oo:{const{key:l,value:u}=n.right.content,d=o[l];if(d!==void 0){if(kl(d,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}n.right.delete(e)}else n.currentAttributes.set(l,u);break}default:r<n.right.length&&Cl(e,Mr(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
|
|
6
|
+
${n.toString()}`)},b8=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Mf(e),h:t}),this}else(e){return this.if(qp,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){const r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw wl("Unhandled pattern")}}},w8=e=>new b8(e),r3=w8(qp).if(Jk,(e,t)=>p0(t,_k,Sk)).if(e3,(e,t)=>q6(t)).if(g8,(e,t)=>Bk(t)).if(m8,(e,t)=>BigInt(p0(t,_k,Sk))).if(Kp,(e,t)=>Nu(t,g0(t,e.shape))).if(n8,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(e8.check(o)){if(Bk(t))continue;o=o.shape}n[r]=r3(o,t)}return n}).if(s8,(e,t)=>{const n=[],r=zk(t,0,42);for(let o=0;o<r;o++)n.push(Nu(t,e.shape));return n}).if(jk,(e,t)=>g0(t,e.shape)).if(v8,(e,t)=>null).if(d8,(e,t)=>{const n=Nu(t,e.res);return()=>n}).if(p8,(e,t)=>Nu(t,g0(t,[Pu,Fu,Xp,t3,C0,Yp,Yk(Pu),Wk(Ou("a","b","c"),Pu)]))).if(o8,(e,t)=>{const n={},r=p0(t,0,3);for(let o=0;o<r;o++){const i=Nu(t,e.shape.keys);n[i]=Nu(t,e.shape.values)}return n}).done(),Nu=(e,t)=>r3(Mf(t),e),Cc=typeof document<"u"?document:{},NW=fo(e=>e.nodeType===A8),BW=typeof DOMParser<"u"?new DOMParser:null,zW=fo(e=>e.nodeType===k8),jW=fo(e=>e.nodeType===S8),C8=e=>U5(e,(t,n)=>`${n}:${t};`).join(""),k8=Cc.ELEMENT_NODE,S8=Cc.TEXT_NODE,VW=Cc.CDATA_SECTION_NODE,UW=Cc.COMMENT_NODE,_8=Cc.DOCUMENT_NODE,HW=Cc.DOCUMENT_TYPE_NODE,A8=Cc.DOCUMENT_FRAGMENT_NODE,$W=fo(e=>e.nodeType===_8),La=Symbol,o3=La(),i3=La(),I8=La(),E8=La(),T8=La(),s3=La(),x8=La(),k0=La(),R8=La(),M8=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[];let r=0;for(;r<e.length;r++){const o=e[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)t.push(o);else if(o.constructor===Object)break}for(r>0&&n.push(t.join(""));r<e.length;r++){const o=e[r];o instanceof Symbol||n.push(o)}return n},GW=x6(),L8={[o3]:Ma("font-weight","bold"),[i3]:Ma("font-weight","normal"),[I8]:Ma("color","blue"),[T8]:Ma("color","green"),[E8]:Ma("color","grey"),[s3]:Ma("color","red"),[x8]:Ma("color","purple"),[k0]:Ma("color","orange"),[R8]:Ma("color","black")},D8=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=Bs();let o=[],i=0;for(;i<e.length;i++){const s=e[i],a=L8[s];if(a!==void 0)r.set(a.left,a.right);else{if(s===void 0)break;if(s.constructor===String||s.constructor===Number){const l=C8(r);i>0||l.length>0?(t.push("%c"+s),n.push(l)):t.push(s)}else break}}for(i>0&&(o=n,o.unshift(t.join("")));i<e.length;i++){const s=e[i];s instanceof Symbol||o.push(s)}return o},a3=G6?D8:M8,O8=(...e)=>{console.log(...a3(e)),l3.forEach(t=>t.print(e))},P8=(...e)=>{console.warn(...a3(e)),e.unshift(k0),l3.forEach(t=>t.print(e))},l3=Ru(),c3=e=>({[Symbol.iterator](){return this},next:e}),F8=(e,t)=>c3(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),S0=(e,t)=>c3(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),u3=class{constructor(e,t){this.clock=e,this.len=t}},d3=class{constructor(){this.clients=new Map}},f3=(e,t,n)=>t.clients.forEach((r,o)=>{const i=e.doc.store.clients.get(o);if(i!=null){const s=i[i.length-1],a=s.id.clock+s.length;for(let l=0,u=r[l];l<r.length&&u.clock<a;u=r[++l])S3(e,i,u.clock,u.len,n)}}),N8=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=Ta((n+r)/2),i=e[o],s=i.clock;if(s<=t){if(t<s+i.len)return o;n=o+1}else r=o-1}return null},h3=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&N8(n,t.clock)!==null},p3=e=>{e.clients.forEach(t=>{t.sort((o,i)=>o.clock-i.clock);let n,r;for(n=1,r=1;n<t.length;n++){const o=t[r-1],i=t[n];o.clock+o.len>=i.clock?t[r-1]=new u3(o.clock,Lu(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},m3=(e,t,n,r)=>{xu(e.clients,t,()=>[]).push(new u3(n,r))},B8=()=>new d3,z8=(e,t)=>{Zn(e.restEncoder,t.clients.size),Mu(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),Zn(e.restEncoder,n);const o=r.length;Zn(e.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},g3=Mk,_0=class LE extends G5{constructor({guid:t=T6(),collectionid:n=null,gc:r=!0,gcFilter:o=()=>!0,meta:i=null,autoLoad:s=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=o,this.clientID=g3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new Z8,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=s,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=Lk(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>Lk(u=>{const d=f=>{(f===void 0||f===!0)&&(this.off("sync",d),u())};this.on("sync",d)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;t!==null&&!this.shouldLoad&&ur(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Mu(this.subdocs).map(t=>t.guid))}transact(t,n=null){return ur(this,t,n)}get(t,n=So){const r=xu(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==So&&o!==n)if(o===So){const i=new n;i._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=i}),i._start=r._start;for(let s=i._start;s!==null;s=s.right)s.parent=i;return i._length=r._length,this.share.set(t,i),i._integrate(this,null),i}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,dR)}getText(t=""){return this.get(t,vR)}getMap(t=""){return this.get(t,L0)}getXmlElement(t=""){return this.get(t,W3)}getXmlFragment(t=""){return this.get(t,F0)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,Mu(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new LE({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,ur(t.parent.doc,r=>{const o=n.doc;t.deleted||r.subdocsAdded.add(o),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}},j8=class{constructor(){this.restEncoder=o0()}toUint8Array(){return xa(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Zn(this.restEncoder,e)}writeDsLen(e){Zn(this.restEncoder,e)}},V8=class extends j8{writeLeftID(e){Zn(this.restEncoder,e.client),Zn(this.restEncoder,e.clock)}writeRightID(e){Zn(this.restEncoder,e.client),Zn(this.restEncoder,e.clock)}writeClient(e){Zn(this.restEncoder,e)}writeInfo(e){i0(this.restEncoder,e)}writeString(e){Du(this.restEncoder,e)}writeParentInfo(e){Zn(this.restEncoder,e?1:0)}writeTypeRef(e){Zn(this.restEncoder,e)}writeLen(e){Zn(this.restEncoder,e)}writeAny(e){Ef(this.restEncoder,e)}writeBuf(e){bi(this.restEncoder,e)}writeJSON(e){Du(this.restEncoder,JSON.stringify(e))}writeKey(e){Du(this.restEncoder,e)}},U8=class{constructor(){this.restEncoder=o0(),this.dsCurrVal=0}toUint8Array(){return xa(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,Zn(this.restEncoder,t)}writeDsLen(e){e===0&&Ra(),Zn(this.restEncoder,e-1),this.dsCurrVal+=e}},H8=class extends U8{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new u0,this.clientEncoder=new Vp,this.leftClockEncoder=new u0,this.rightClockEncoder=new u0,this.infoEncoder=new Tk(i0),this.stringEncoder=new A6,this.parentInfoEncoder=new Tk(i0),this.typeRefEncoder=new Vp,this.lenEncoder=new Vp}toUint8Array(){const e=o0();return Zn(e,0),bi(e,this.keyClockEncoder.toUint8Array()),bi(e,this.clientEncoder.toUint8Array()),bi(e,this.leftClockEncoder.toUint8Array()),bi(e,this.rightClockEncoder.toUint8Array()),bi(e,xa(this.infoEncoder)),bi(e,this.stringEncoder.toUint8Array()),bi(e,xa(this.parentInfoEncoder)),bi(e,this.typeRefEncoder.toUint8Array()),bi(e,this.lenEncoder.toUint8Array()),l0(e,xa(this.restEncoder)),xa(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Ef(this.restEncoder,e)}writeBuf(e){bi(this.restEncoder,e)}writeJSON(e){Ef(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},$8=(e,t,n,r)=>{r=Lu(r,t[0].id.clock);const o=Da(t,r);Zn(e.restEncoder,t.length-o),e.writeClient(n),Zn(e.restEncoder,r);const i=t[o];i.write(e,r-i.id.clock);for(let s=o+1;s<t.length;s++)t[s].write(e,0)},G8=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{si(t,i)>o&&r.set(i,o)}),I0(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),Zn(e.restEncoder,r.size),Mu(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{$8(e,t.clients.get(o),o,i)})},W8=(e,t)=>G8(e,t.doc.store,t.beforeState),K8=class{constructor(){this.l=[]}},v3=()=>new K8,y3=(e,t)=>e.l.push(t),b3=(e,t)=>{const n=e.l,r=n.length;e.l=n.filter(o=>t!==o),r===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},w3=(e,t,n)=>f0(e.l,[t,n]),Zp=class{constructor(e,t){this.client=e,this.clock=t}},Qp=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,Mr=(e,t)=>new Zp(e,t),q8=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw Ra()},Y8=class{constructor(e,t){this.ds=e,this.sv=t}},X8=(e,t)=>new Y8(e,t),WW=X8(B8(),new Map),Bu=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!h3(t.ds,e.id),A0=(e,t)=>{const n=xu(e.meta,A0,Ru),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<si(r,i)&&Cl(e,Mr(i,o))}),f3(e,t.ds,o=>{}),n.add(t))},Z8=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},I0=e=>{const t=new Map;return e.clients.forEach((n,r)=>{const o=n[n.length-1];t.set(r,o.id.clock+o.length)}),t},si=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},C3=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==t.id.clock)throw Ra()}n.push(t)},Da=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=Ta(t/(i+o.length-1)*r);for(;n<=r;){if(o=e[s],i=o.id.clock,i<=t){if(t<i+o.length)return s;n=s+1}else r=s-1;s=Ta((n+r)/2)}throw Ra()},Q8=(e,t)=>{const n=e.clients.get(t.client);return n[Da(n,t.clock)]},E0=Q8,T0=(e,t,n)=>{const r=Da(t,n),o=t[r];return o.id.clock<n&&o instanceof wi?(t.splice(r+1,0,X3(e,o,n-o.id.clock)),r+1):r},Cl=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[T0(e,n,t.clock)]},k3=(e,t,n)=>{const r=t.clients.get(n.client),o=Da(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Sl&&r.splice(o+1,0,X3(e,i,n.clock-i.id.clock+1)),i},J8=(e,t,n)=>{const r=e.clients.get(t.id.client);r[Da(r,t.id.clock)]=n},S3=(e,t,n,r,o)=>{if(r===0)return;const i=n+r;let s=T0(e,t,n),a;do a=t[s++],i<a.id.clock+a.length&&T0(e,t,i),o(a);while(s<t.length&&t[s].id.clock<i)},eR=class{constructor(e,t,n){this.doc=e,this.deleteSet=new d3,this.beforeState=I0(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},_3=(e,t)=>t.deleteSet.clients.size===0&&!H5(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(p3(t.deleteSet),W8(e,t),z8(e,t.deleteSet),!0),A3=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&xu(e.changed,t,Ru).add(n)},Jp=(e,t)=>{let n=e[t],r=e[t-1],o=t;for(;o>0;n=r,r=e[--o-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof wi&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const i=t-o;return i&&e.splice(t+1-i,i),i},tR=(e,t,n)=>{for(const[r,o]of e.clients.entries()){const i=t.clients.get(r);for(let s=o.length-1;s>=0;s--){const a=o[s],l=a.clock+a.len;for(let u=Da(i,a.clock),d=i[u];u<i.length&&d.id.clock<l;d=i[++u]){const f=i[u];if(a.clock+a.len<=f.id.clock)break;f instanceof wi&&f.deleted&&!f.keep&&n(f)&&f.gc(t,!1)}}}},nR=(e,t)=>{e.clients.forEach((n,r)=>{const o=t.clients.get(r);for(let i=n.length-1;i>=0;i--){const s=n[i],a=kk(o.length-1,1+Da(o,s.clock+s.len-1));for(let l=a,u=o[l];l>0&&u.id.clock>=s.clock;u=o[l])l-=1+Jp(o,l)}})},I3=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{p3(i),n.afterState=I0(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(d=>d.target._item===null||!d.target._item.deleted),l.forEach(d=>{d.currentTarget=u,d._path=null}),l.sort((d,f)=>d.path.length-f.path.length),a.push(()=>{w3(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&mR(n)})}),f0(a,[])}finally{r.gc&&tR(i,o,r.gcFilter),nR(i,o),n.afterState.forEach((d,f)=>{const p=n.beforeState.get(f)||0;if(p!==d){const g=o.clients.get(f),m=Lu(Da(g,p),1);for(let v=g.length-1;v>=m;)v-=1+Jp(g,v)}});for(let d=s.length-1;d>=0;d--){const{client:f,clock:p}=s[d].id,g=o.clients.get(f),m=Da(g,p);m+1<g.length&&Jp(g,m+1)>1||m>0&&Jp(g,m)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(O8(k0,o3,"[yjs] ",i3,s3,"Changed the client-id because another client seems to be using it."),r.clientID=g3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new V8;_3(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new H8;_3(d,n)&&r.emit("updateV2",[d.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=n;(a.size>0||u.size>0||l.size>0)&&(a.forEach(d=>{d.clientID=r.clientID,d.collectionid==null&&(d.collectionid=r.collectionid),r.subdocs.add(d)}),u.forEach(d=>r.subdocs.delete(d)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,n]),u.forEach(d=>d.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):I3(e,t+1)}}},ur=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new eR(e,n,r),o.push(e._transaction),o.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{s=t(e._transaction)}finally{if(i){const a=e._transaction===o[0];e._transaction=null,a&&I3(o,0)}}return s},E3="You must not compute changes after the event-handler fired.",em=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=rR(this.currentTarget,this.target))}deletes(e){return h3(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw wl(E3);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){const r=t._map.get(n);let o,i;if(this.adds(r)){let s=r.left;for(;s!==null&&this.adds(s);)s=s.left;if(this.deletes(r))if(s!==null&&this.deletes(s))o="delete",i=t0(s.content.getContent());else return;else s!==null&&this.deletes(s)?(o="update",i=t0(s.content.getContent())):(o="add",i=void 0)}else if(this.deletes(r))o="delete",i=t0(r.content.getContent());else return;e.set(n,{action:o,oldValue:i})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw wl(E3);const t=this.target,n=Ru(),r=Ru(),o=[];if(e={added:n,deleted:r,delta:o,keys:this.keys},this.transaction.changed.get(t).has(null)){let i=null;const s=()=>{i&&o.push(i)};for(let a=t._start;a!==null;a=a.right)a.deleted?this.deletes(a)&&!this.adds(a)&&((i===null||i.delete===void 0)&&(s(),i={delete:0}),i.delete+=a.length,r.add(a)):this.adds(a)?((i===null||i.insert===void 0)&&(s(),i={insert:[]}),i.insert=i.insert.concat(a.content.getContent()),n.add(a)):((i===null||i.retain===void 0)&&(s(),i={retain:0}),i.retain+=a.length);i!==null&&i.retain===void 0&&s()}this._changes=e}return e}},rR=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let r=0,o=t._item.parent._start;for(;o!==t._item&&o!==null;)!o.deleted&&o.countable&&(r+=o.length),o=o.right;n.unshift(r)}t=t._item.parent}return n},Do=()=>{P8("Invalid access: Add Yjs type to a document before reading data.")},T3=80,x0=0,oR=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=x0++}},iR=e=>{e.timestamp=x0++},x3=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=x0++},sR=(e,t,n)=>{if(e.length>=T3){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return x3(r,t,n),r}else{const r=new oR(t,n);return e.push(r),r}},tm=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce((i,s)=>jp(t-i.index)<jp(t-s.index)?i:s);let r=e._start,o=0;for(n!==null&&(r=n.p,o=n.index,iR(n));r.right!==null&&o<t;){if(!r.deleted&&r.countable){if(t<o+r.length)break;o+=r.length}r=r.right}for(;r.left!==null&&o>t;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);return n!==null&&jp(n.index-o)<r.parent.length/T3?(x3(n,r,o),n):sR(e._searchMarker,r,o)},Lf=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){const o=e[r];if(n>0){let i=o.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(o.index-=i.length);if(i===null||i.marker===!0){e.splice(r,1);continue}o.p=i,i.marker=!0}(t<o.index||n>0&&t===o.index)&&(o.index=Lu(t,o.index+n))}},nm=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;xu(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;w3(r._eH,n,t)},So=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=v3(),this._dEH=v3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw us()}clone(){throw us()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){y3(this._eH,e)}observeDeep(e){y3(this._dEH,e)}unobserve(e){b3(this._eH,e)}unobserveDeep(e){b3(this._dEH,e)}toJSON(){}},R3=(e,t,n)=>{e.doc??Do(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t;const o=[];let i=e._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){const s=i.content.getContent();if(s.length<=t)t-=s.length;else{for(let a=t;a<s.length&&r>0;a++)o.push(s[a]),r--;t=0}}i=i.right}return o},M3=e=>{e.doc??Do();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let o=0;o<r.length;o++)t.push(r[o])}n=n.right}return t},Df=(e,t)=>{let n=0,r=e._start;for(e.doc??Do();r!==null;){if(r.countable&&!r.deleted){const o=r.content.getContent();for(let i=0;i<o.length;i++)t(o[i],n++,e)}r=r.right}},L3=(e,t)=>{const n=[];return Df(e,(r,o)=>{n.push(t(r,o,e))}),n},aR=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}const o=n[r++];return n.length<=r&&(n=null),{done:!1,value:o}}}},D3=(e,t)=>{e.doc??Do();const n=tm(e,t);let r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},rm=(e,t,n,r)=>{let o=n;const i=e.doc,s=i.clientID,a=i.store,l=n===null?t._start:n.right;let u=[];const d=()=>{u.length>0&&(o=new wi(Mr(s,si(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new N0(u)),o.integrate(e,0),u=[])};r.forEach(f=>{if(f===null)u.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(f);break;default:switch(d(),f.constructor){case Uint8Array:case ArrayBuffer:o=new wi(Mr(s,si(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new q3(new Uint8Array(f))),o.integrate(e,0);break;case _0:o=new wi(Mr(s,si(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Y3(f)),o.integrate(e,0);break;default:if(f instanceof So)o=new wi(Mr(s,si(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Vu(f)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},O3=()=>wl("Length exceeded!"),P3=(e,t,n,r)=>{if(n>t._length)throw O3();if(n===0)return t._searchMarker&&Lf(t._searchMarker,n,r.length),rm(e,t,null,r);const o=n,i=tm(t,n);let s=t._start;for(i!==null&&(s=i.p,n-=i.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&Cl(e,Mr(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&Lf(t._searchMarker,o,r.length),rm(e,t,s,r)},lR=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((o,i)=>i.index>o.index?i:o,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return rm(e,t,r,n)},F3=(e,t,n,r)=>{if(r===0)return;const o=n,i=r,s=tm(t,n);let a=t._start;for(s!==null&&(a=s.p,n-=s.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&Cl(e,Mr(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Cl(e,Mr(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw O3();t._searchMarker&&Lf(t._searchMarker,o,-i+r)},om=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},R0=(e,t,n,r)=>{const o=t._map.get(n)||null,i=e.doc,s=i.clientID;let a;if(r==null)a=new N0([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new N0([r]);break;case Uint8Array:a=new q3(r);break;case _0:a=new Y3(r);break;default:if(r instanceof So)a=new Vu(r);else throw new Error("Unexpected content type")}new wi(Mr(s,si(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},M0=(e,t)=>{e.doc??Do();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},N3=e=>{const t={};return e.doc??Do(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},B3=(e,t)=>{e.doc??Do();const n=e._map.get(t);return n!==void 0&&!n.deleted},cR=(e,t)=>{const n={};return e._map.forEach((r,o)=>{let i=r;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&Bu(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},im=e=>(e.doc??Do(),F8(e._map.entries(),t=>!t[1].deleted)),uR=class extends em{},dR=class zg extends So{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new zg;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new zg}clone(){const t=new zg;return t.insert(0,this.toArray().map(n=>n instanceof So?n.clone():n)),t}get length(){return this.doc??Do(),this._length}_callObserver(t,n){super._callObserver(t,n),nm(this,t,new uR(this,t))}insert(t,n){this.doc!==null?ur(this.doc,r=>{P3(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?ur(this.doc,n=>{lR(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?ur(this.doc,r=>{F3(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return D3(this,t)}toArray(){return M3(this)}slice(t=0,n=this.length){return R3(this,t,n)}toJSON(){return this.map(t=>t instanceof So?t.toJSON():t)}map(t){return L3(this,t)}forEach(t){Df(this,t)}[Symbol.iterator](){return aR(this)}_write(t){t.writeTypeRef(SR)}},fR=class extends em{constructor(e,t,n){super(e,t),this.keysChanged=n}},L0=class M2 extends So{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((r,o)=>{this.set(o,r)}),this._prelimContent=null}_copy(){return new M2}clone(){const t=new M2;return this.forEach((n,r)=>{t.set(r,n instanceof So?n.clone():n)}),t}_callObserver(t,n){nm(this,t,new fR(this,t,n))}toJSON(){this.doc??Do();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof So?o.toJSON():o}}),t}get size(){return[...im(this)].length}keys(){return S0(im(this),t=>t[0])}values(){return S0(im(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return S0(im(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??Do(),this._map.forEach((n,r)=>{n.deleted||t(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?ur(this.doc,n=>{om(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?ur(this.doc,r=>{R0(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return M0(this,t)}has(t){return B3(this,t)}clear(){this.doc!==null?ur(this.doc,t=>{this.forEach(function(n,r,o){om(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(_R)}},kl=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&B6(e,t),D0=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){this.right===null&&Ra(),this.right.content.constructor===Oo?this.right.deleted||zu(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},z3=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===Oo?t.right.deleted||zu(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&Cl(e,Mr(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length),t.left=t.right,t.right=t.right.right;return t},sm=(e,t,n,r)=>{const o=new Map,i=r?tm(t,n):null;if(i){const s=new D0(i.p.left,i.p,i.index,o);return z3(e,s,n-i.index)}else{const s=new D0(null,t._start,0,o);return z3(e,s,n)}},j3=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Oo&&kl(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const o=e.doc,i=o.clientID;r.forEach((s,a)=>{const l=n.left,u=n.right,d=new wi(Mr(i,si(o.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,new Oo(a,s));d.integrate(e,0),n.right=d,n.forward()})},zu=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},V3=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===Oo&&kl(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},U3=(e,t,n,r)=>{const o=e.doc,i=o.clientID,s=new Map;for(const a in r){const l=r[a],u=n.currentAttributes.get(a)??null;if(!kl(u,l)){s.set(a,u);const{left:d,right:f}=n;n.right=new wi(Mr(i,si(o.store,i)),d,d&&d.lastId,f,f&&f.id,t,null,new Oo(a,l)),n.right.integrate(e,0),n.forward()}}return s},O0=(e,t,n,r,o)=>{n.currentAttributes.forEach((p,g)=>{o[g]===void 0&&(o[g]=null)});const i=e.doc,s=i.clientID;V3(n,o);const a=U3(e,t,n,o),l=r.constructor===String?new ju(r):r instanceof So?new Vu(r):new am(r);let{left:u,right:d,index:f}=n;t._searchMarker&&Lf(t._searchMarker,n.index,l.getLength()),d=new wi(Mr(s,si(i.store,s)),u,u&&u.lastId,d,d&&d.id,t,null,l),d.integrate(e,0),n.right=d,n.index=f,n.forward(),j3(e,t,n,a)},H3=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;V3(n,o);const a=U3(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Oo));){if(!n.right.deleted)switch(n.right.content.constructor){case Oo:{const{key:l,value:u}=n.right.content,d=o[l];if(d!==void 0){if(kl(d,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}n.right.delete(e)}else n.currentAttributes.set(l,u);break}default:r<n.right.length&&Cl(e,Mr(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
|
|
7
7
|
`;n.right=new wi(Mr(s,si(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new ju(l)),n.right.integrate(e,0),n.forward()}j3(e,t,n,a)},$3=(e,t,n,r,o)=>{let i=t;const s=Bs();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===Oo){const u=i.content;s.set(u.key,u)}i=i.right}let a=0,l=!1;for(;t!==i;){if(n===t&&(l=!0),!t.deleted){const u=t.content;if(u.constructor===Oo){const{key:d,value:f}=u,p=r.get(d)??null;(s.get(d)!==u||p===f)&&(t.delete(e),a++,!l&&(o.get(d)??null)===f&&p!==f&&(p===null?o.delete(d):o.set(d,p))),!l&&!t.deleted&&zu(o,u)}}t=t.right}return a},hR=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===Oo){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},pR=e=>{let t=0;return ur(e.doc,n=>{let r=e._start,o=e._start,i=Bs();const s=e0(i);for(;o;)o.deleted===!1&&(o.content.constructor===Oo?zu(s,o.content):(t+=$3(n,r,o,i,s),i=e0(s),r=o)),o=o.right}),t},mR=e=>{const t=new Set,n=e.doc;for(const[r,o]of e.afterState.entries()){const i=e.beforeState.get(r)||0;o!==i&&S3(e,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===Oo&&s.constructor!==Sl&&t.add(s.parent)})}ur(n,r=>{f3(e,e.deleteSet,o=>{if(o instanceof Sl||!o.parent._hasFormatting||t.has(o.parent))return;const i=o.parent;o.content.constructor===Oo?t.add(i):hR(r,o)});for(const o of t)pR(o)})},G3=(e,t,n)=>{const r=n,o=e0(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case Vu:case am:case ju:n<t.right.length&&Cl(e,Mr(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&$3(e,i,t.right,o,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&Lf(s._searchMarker,t.index,-r+n),t},gR=class extends em{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(r=>{r===null?this.childListChanged=!0:this.keysChanged.add(r)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];ur(e,n=>{const r=new Map,o=new Map;let i=this.target._start,s=null;const a={};let l="",u=0,d=0;const f=()=>{if(s!==null){let p=null;switch(s){case"delete":d>0&&(p={delete:d}),d=0;break;case"insert":(typeof l=="object"||l.length>0)&&(p={insert:l},r.size>0&&(p.attributes={},r.forEach((g,m)=>{g!==null&&(p.attributes[m]=g)}))),l="";break;case"retain":u>0&&(p={retain:u},N6(a)||(p.attributes=O6({},a))),u=0;break}p&&t.push(p),s=null}};for(;i!==null;){switch(i.content.constructor){case Vu:case am:this.adds(i)?this.deletes(i)||(f(),s="insert",l=i.content.getContent()[0],f()):this.deletes(i)?(s!=="delete"&&(f(),s="delete"),d+=1):i.deleted||(s!=="retain"&&(f(),s="retain"),u+=1);break;case ju:this.adds(i)?this.deletes(i)||(s!=="insert"&&(f(),s="insert"),l+=i.content.str):this.deletes(i)?(s!=="delete"&&(f(),s="delete"),d+=i.length):i.deleted||(s!=="retain"&&(f(),s="retain"),u+=i.length);break;case Oo:{const{key:p,value:g}=i.content;if(this.adds(i)){if(!this.deletes(i)){const m=r.get(p)??null;kl(m,g)?g!==null&&i.delete(n):(s==="retain"&&f(),kl(g,o.get(p)??null)?delete a[p]:a[p]=g)}}else if(this.deletes(i)){o.set(p,g);const m=r.get(p)??null;kl(m,g)||(s==="retain"&&f(),a[p]=m)}else if(!i.deleted){o.set(p,g);const m=a[p];m!==void 0&&(kl(m,g)?m!==null&&i.delete(n):(s==="retain"&&f(),g===null?delete a[p]:a[p]=g))}i.deleted||(s==="insert"&&f(),zu(r,i.content));break}}i=i.right}for(f();t.length>0;){const p=t[t.length-1];if(p.retain!==void 0&&p.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},vR=class L2 extends So{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Do(),this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new L2}clone(){const t=new L2;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new gR(this,t,n);nm(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??Do();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===ju&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?ur(this.doc,r=>{const o=new D0(null,this._start,0,new Map);for(let i=0;i<t.length;i++){const s=t[i];if(s.insert!==void 0){const a=!n&&typeof s.insert=="string"&&i===t.length-1&&o.right===null&&s.insert.slice(-1)===`
|
|
8
|
-
`?s.insert.slice(0,-1):s.insert;(typeof a!="string"||a.length>0)&&O0(r,this,o,a,s.attributes||{})}else s.retain!==void 0?H3(r,this,o,s.retain,s.attributes||{}):s.delete!==void 0&&G3(r,o,s.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,n,r){this.doc??Do();const o=[],i=new Map,s=this.doc;let a="",l=this._start;function u(){if(a.length>0){const f={};let p=!1;i.forEach((m,v)=>{p=!0,f[v]=m});const g={insert:a};p&&(g.attributes=f),o.push(g),a=""}}const d=()=>{for(;l!==null;){if(Bu(l,t)||n!==void 0&&Bu(l,n))switch(l.content.constructor){case ju:{const f=i.get("ychange");t!==void 0&&!Bu(l,t)?(f===void 0||f.user!==l.id.client||f.type!=="removed")&&(u(),i.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!Bu(l,n)?(f===void 0||f.user!==l.id.client||f.type!=="added")&&(u(),i.set("ychange",r?r("added",l.id):{type:"added"})):f!==void 0&&(u(),i.delete("ychange")),a+=l.content.str;break}case Vu:case am:{u();const f={insert:l.content.getContent()[0]};if(i.size>0){const p={};f.attributes=p,i.forEach((g,m)=>{p[m]=g})}o.push(f);break}case Oo:Bu(l,t)&&(u(),zu(i,l.content));break}l=l.right}u()};return t||n?ur(s,f=>{t&&A0(f,t),n&&A0(f,n),d()},"cleanup"):d(),o}insert(t,n,r){if(n.length<=0)return;const o=this.doc;o!==null?ur(o,i=>{const s=sm(i,this,t,!r);r||(r={},s.currentAttributes.forEach((a,l)=>{r[l]=a})),O0(i,this,s,n,r)}):this._pending.push(()=>this.insert(t,n,r))}insertEmbed(t,n,r){const o=this.doc;o!==null?ur(o,i=>{const s=sm(i,this,t,!r);O0(i,this,s,n,r||{})}):this._pending.push(()=>this.insertEmbed(t,n,r||{}))}delete(t,n){if(n===0)return;const r=this.doc;r!==null?ur(r,o=>{G3(o,sm(o,this,t,!0),n)}):this._pending.push(()=>this.delete(t,n))}format(t,n,r){if(n===0)return;const o=this.doc;o!==null?ur(o,i=>{const s=sm(i,this,t,!1);s.right!==null&&H3(i,this,s,n,r)}):this._pending.push(()=>this.format(t,n,r))}removeAttribute(t){this.doc!==null?ur(this.doc,n=>{om(n,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,n){this.doc!==null?ur(this.doc,r=>{R0(r,this,t,n)}):this._pending.push(()=>this.setAttribute(t,n))}getAttribute(t){return M0(this,t)}getAttributes(){return N3(this)}_write(t){t.writeTypeRef(AR)}},P0=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Do()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===W3||t.constructor===F0)&&t._start!==null)e=t._start;else for(;e!==null;){const n=e.next;if(n!==null){e=n;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},F0=class D2 extends So{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new D2}clone(){const t=new D2;return t.insert(0,this.toArray().map(n=>n instanceof So?n.clone():n)),t}get length(){return this.doc??Do(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new P0(this,t)}querySelector(t){t=t.toUpperCase();const n=new P0(this,r=>r.nodeName&&r.nodeName.toUpperCase()===t).next();return n.done?null:n.value}querySelectorAll(t){return t=t.toUpperCase(),Mu(new P0(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t))}_callObserver(t,n){nm(this,t,new yR(this,n,t))}toString(){return L3(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,n={},r){const o=t.createDocumentFragment();return r!==void 0&&r._createAssociation(o,this),Df(this,i=>{o.insertBefore(i.toDOM(t,n,r),null)}),o}insert(t,n){this.doc!==null?ur(this.doc,r=>{P3(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}insertAfter(t,n){if(this.doc!==null)ur(this.doc,r=>{const o=t&&t instanceof So?t._item:t;rm(r,this,o,n)});else{const r=this._prelimContent,o=t===null?0:r.findIndex(i=>i===t)+1;if(o===0&&t!==null)throw wl("Reference item not found");r.splice(o,0,...n)}}delete(t,n=1){this.doc!==null?ur(this.doc,r=>{F3(r,this,t,n)}):this._prelimContent.splice(t,n)}toArray(){return M3(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return D3(this,t)}slice(t=0,n=this.length){return R3(this,t,n)}forEach(t){Df(this,t)}_write(t){t.writeTypeRef(ER)}},W3=class O2 extends F0{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,n){super._integrate(t,n),this._prelimAttrs.forEach((r,o)=>{this.setAttribute(o,r)}),this._prelimAttrs=null}_copy(){return new O2(this.nodeName)}clone(){const t=new O2(this.nodeName),n=this.getAttributes();return F6(n,(r,o)=>{t.setAttribute(o,r)}),t.insert(0,this.toArray().map(r=>r instanceof So?r.clone():r)),t}toString(){const t=this.getAttributes(),n=[],r=[];for(const s in t)r.push(s);r.sort();const o=r.length;for(let s=0;s<o;s++){const a=r[s];n.push(a+'="'+t[a]+'"')}const i=this.nodeName.toLocaleLowerCase();return`<${i}${n.length>0?" "+n.join(" "):""}>${super.toString()}</${i}>`}removeAttribute(t){this.doc!==null?ur(this.doc,n=>{om(n,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,n){this.doc!==null?ur(this.doc,r=>{R0(r,this,t,n)}):this._prelimAttrs.set(t,n)}getAttribute(t){return M0(this,t)}hasAttribute(t){return B3(this,t)}getAttributes(t){return t?cR(this,t):N3(this)}toDOM(t=document,n={},r){const o=t.createElement(this.nodeName),i=this.getAttributes();for(const s in i){const a=i[s];typeof a=="string"&&o.setAttribute(s,a)}return Df(this,s=>{o.appendChild(s.toDOM(t,n,r))}),r!==void 0&&r._createAssociation(o,this),o}_write(t){t.writeTypeRef(IR),t.writeKey(this.nodeName)}},yR=class extends em{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(r=>{r===null?this.childListChanged=!0:this.attributesChanged.add(r)})}},K3=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw us()}mergeWith(e){return!1}write(e,t,n){throw us()}integrate(e,t){throw us()}},bR=0,Sl=class extends K3{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),C3(e.doc.store,this)}write(e,t){e.writeInfo(bR),e.writeLen(this.length-t)}getMissing(e,t){return null}},q3=class DE{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new DE(this.content)}splice(t){throw us()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeBuf(this.content)}getRef(){return 3}},wR=class P2{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new P2(this.len)}splice(t){const n=new P2(this.len-t);return this.len=t,n}mergeWith(t){return this.len+=t.len,!0}integrate(t,n){m3(t.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(t){}gc(t){}write(t,n){t.writeLen(this.len-n)}getRef(){return 1}},CR=(e,t)=>new _0({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),Y3=class OE{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const n={};this.opts=n,t.gc||(n.gc=!1),t.autoLoad&&(n.autoLoad=!0),t.meta!==null&&(n.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new OE(CR(this.doc.guid,this.opts))}splice(t){throw us()}mergeWith(t){return!1}integrate(t,n){this.doc._item=n,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,n){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}},am=class PE{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new PE(this.embed)}splice(t){throw us()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeJSON(this.embed)}getRef(){return 5}},Oo=class FE{constructor(t,n){this.key=t,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new FE(this.key,this.value)}splice(t){throw us()}mergeWith(t){return!1}integrate(t,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(t){}gc(t){}write(t,n){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}},kR=$p("node_env")==="development",N0=class F2{constructor(t){this.arr=t,kR&&Fk(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new F2(this.arr)}splice(t){const n=new F2(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const r=this.arr.length;t.writeLen(r-n);for(let o=n;o<r;o++){const i=this.arr[o];t.writeAny(i)}}getRef(){return 8}},ju=class N2{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new N2(this.str)}splice(t){const n=new N2(this.str.slice(t));this.str=this.str.slice(0,t);const r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(t){return this.str+=t.str,!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}},SR=0,_R=1,AR=2,IR=3,ER=4,Vu=class NE{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new NE(this.type._copy())}splice(t){throw us()}mergeWith(t){return!1}integrate(t,n){this.type._integrate(t.doc,n)}delete(t){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(t.beforeState.get(n.id.client)||0)&&t._mergeStructs.push(n):n.delete(t),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(t.beforeState.get(r.id.client)||0)&&t._mergeStructs.push(r):r.delete(t)}),t.changed.delete(this.type)}gc(t){let n=this.type._start;for(;n!==null;)n.gc(t,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(t,!0),r=r.left}),this.type._map=new Map}write(t,n){this.type._write(t)}getRef(){return 7}},X3=(e,t,n)=>{const{client:r,clock:o}=t.id,i=new wi(Mr(r,o+n),t,Mr(r,o+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&i.markDeleted(),t.keep&&(i.keep=!0),t.redone!==null&&(i.redone=Mr(t.redone.client,t.redone.clock+n)),t.right=i,i.right!==null&&(i.right.left=i),e._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),t.length=n,i},wi=class B2 extends K3{constructor(t,n,r,o,i,s,a,l){super(t,l.getLength()),this.origin=r,this.left=n,this.right=o,this.rightOrigin=i,this.parent=s,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?2:0}set marker(t){(this.info&8)>0!==t&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(t){this.keep!==t&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(t){this.deleted!==t&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=si(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=si(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Zp&&this.id.client!==this.parent.client&&this.parent.clock>=si(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=k3(t,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Cl(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Sl||this.right&&this.right.constructor===Sl)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===B2?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===B2&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Zp){const r=E0(n,this.parent);r.constructor===Sl?this.parent=null:this.parent=r.content.type}return null}integrate(t,n){if(n>0&&(this.id.clock+=n,this.left=k3(t,t.doc.store,Mr(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,o;if(r!==null)o=r.right;else if(this.parentSub!==null)for(o=this.parent._map.get(this.parentSub)||null;o!==null&&o.left!==null;)o=o.left;else o=this.parent._start;const i=new Set,s=new Set;for(;o!==null&&o!==this.right;){if(s.add(o),i.add(o),Qp(this.origin,o.origin)){if(o.id.client<this.id.client)r=o,i.clear();else if(Qp(this.rightOrigin,o.rightOrigin))break}else if(o.origin!==null&&s.has(E0(t.doc.store,o.origin)))i.has(E0(t.doc.store,o.origin))||(r=o,i.clear());else break;o=o.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(t)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),C3(t.doc.store,this),this.content.integrate(t,this),A3(t,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(t)}else new Sl(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;t!==null&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;t!==null&&t.deleted;)t=t.left;return t}get lastId(){return this.length===1?this.id:Mr(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&Qp(t.origin,this.lastId)&&this.right===t&&Qp(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&this.redone===null&&t.redone===null&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===t&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),m3(t.deleteSet,this.id.client,this.id.clock,this.length),A3(t,n,this.parentSub),this.content.delete(t)}}gc(t,n){if(!this.deleted)throw Ra();this.content.gc(t),n?J8(t,this,new Sl(this.id,this.length)):this.content=new wR(this.length)}write(t,n){const r=n>0?Mr(this.id.client,this.id.clock+n-1):this.origin,o=this.rightOrigin,i=this.parentSub,s=this.content.getRef()&31|(r===null?0:128)|(o===null?0:64)|(i===null?0:32);if(t.writeInfo(s),r!==null&&t.writeLeftID(r),o!==null&&t.writeRightID(o),r===null&&o===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const u=q8(a);t.writeParentInfo(!0),t.writeString(u)}else t.writeParentInfo(!1),t.writeLeftID(l.id)}else a.constructor===String?(t.writeParentInfo(!0),t.writeString(a)):a.constructor===Zp?(t.writeParentInfo(!1),t.writeLeftID(a)):Ra();i!==null&&t.writeString(i)}this.content.write(t,n)}},Z3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},Q3="__ $YJS$ __";Z3[Q3]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),Z3[Q3]=!0;var TR=Math.floor,xR=(e,t)=>e<t?e:t,RR=(e,t)=>e>t?e:t,MR=128,B0=127,KW=Number.MAX_SAFE_INTEGER,LR=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},Of=typeof TextEncoder<"u"?new TextEncoder:null,DR=e=>Of.encode(e),OR=Of?DR:LR,z0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});z0&&z0.decode(new Uint8Array).length===1&&(z0=null);var lm=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},j0=(e,t)=>{for(;t>B0;)lm(e,MR|B0&t),t=TR(t/128);lm(e,B0&t)},V0=new Uint8Array(3e4),PR=V0.length/3,FR=(e,t)=>{if(t.length<PR){const n=Of.encodeInto(t,V0).written||0;j0(e,n);for(let r=0;r<n;r++)lm(e,V0[r])}else zR(e,OR(t))},NR=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;j0(e,r);for(let o=0;o<r;o++)lm(e,n.codePointAt(o))},qW=Of&&Of.encodeInto?FR:NR,BR=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=xR(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(RR(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},zR=(e,t)=>{j0(e,t.byteLength),BR(e,t)},J3=e=>new Error(e),YW=J3("Unexpected end of array"),XW=J3("Integer out of Range"),eS;(function(e){e[e.Token=0]="Token",e[e.PermissionDenied=1]="PermissionDenied",e[e.Authenticated=2]="Authenticated"})(eS||(eS={}));var tS;(function(e){e[e.Connecting=0]="Connecting",e[e.Open=1]="Open",e[e.Closing=2]="Closing",e[e.Closed=3]="Closed"})(tS||(tS={}));var U0=()=>new Map,ZW=Array.from,QW=String.fromCharCode,jR=e=>e.toLowerCase(),VR=/^\s*/g,UR=e=>e.replace(VR,""),HR=/([A-Z])/g,nS=(e,t)=>UR(e.replace(HR,n=>`${t}${jR(n)}`)),$R=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},Pf=typeof TextEncoder<"u"?new TextEncoder:null,GR=e=>Pf.encode(e),WR=Pf?GR:$R,H0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});H0&&H0.decode(new Uint8Array).length===1&&(H0=null);var rS=e=>e===void 0?null:e,KR=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},oS=new KR,qR=!0;try{typeof localStorage<"u"&&localStorage&&(oS=localStorage,qR=!1)}catch{}var YR=oS,XR=(e,t)=>t.includes(e),Ff=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";typeof navigator<"u"&&/Mac/.test(navigator.platform);var js,ZR=()=>{if(js===void 0)if(Ff){js=U0();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&js.set(t,""),t=r):t!==null&&(js.set(t,r),t=null)}t!==null&&js.set(t,"")}else typeof location=="object"?(js=U0(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");js.set(`--${nS(t,"-")}`,n),js.set(`-${nS(t,"-")}`,n)}})):js=U0();return js},$0=e=>ZR().has(e),G0=e=>rS(Ff?process.env[e.toUpperCase()]:YR.getItem(e)),QR=e=>$0("--"+e)||G0(e)!==null;QR("production");var iS=Ff&&XR(process.env.FORCE_COLOR,["true","1","2"]);!$0("no-colors")&&(!Ff||process.stdout.isTTY||iS)&&(!Ff||$0("color")||iS||G0("COLORTERM")!==null||(G0("TERM")||"").includes("color"));var JR=Math.floor,e7=(e,t)=>e<t?e:t,t7=(e,t)=>e>t?e:t,n7=128,W0=127,JW=Number.MAX_SAFE_INTEGER,cm=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},K0=(e,t)=>{for(;t>W0;)cm(e,n7|W0&t),t=JR(t/128);cm(e,W0&t)},q0=new Uint8Array(3e4),r7=q0.length/3,o7=(e,t)=>{if(t.length<r7){const n=Pf.encodeInto(t,q0).written||0;K0(e,n);for(let r=0;r<n;r++)cm(e,q0[r])}else a7(e,WR(t))},i7=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;K0(e,r);for(let o=0;o<r;o++)cm(e,n.codePointAt(o))},eK=Pf&&Pf.encodeInto?o7:i7,s7=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=e7(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(t7(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},a7=(e,t)=>{K0(e,t.byteLength),s7(e,t)},sS=e=>new Error(e),tK=sS("Unexpected end of array"),nK=sS("Integer out of Range"),rK=Date.now,aS;(function(e){e[e.Sync=0]="Sync",e[e.Awareness=1]="Awareness",e[e.Auth=2]="Auth",e[e.QueryAwareness=3]="QueryAwareness",e[e.Stateless=5]="Stateless",e[e.CLOSE=7]="CLOSE",e[e.SyncStatus=8]="SyncStatus"})(aS||(aS={}));var lS;(function(e){e.Connecting="connecting",e.Connected="connected",e.Disconnected="disconnected"})(lS||(lS={}));var oK=crypto.getRandomValues.bind(crypto);function l7(e,{changes:t={},states:n}){const{added:r=[],removed:o=[]}=t,i={states:lx(e,n),added:r,removed:o,superdoc:e};e.emit("awareness-update",i)}function c7(e,t,n){const r=e.awareness;if(!r)return console.warn("[superdoc] External provider missing awareness property"),()=>{};n&&r.setLocalStateField&&r.setLocalStateField("user",n);const o=(i={})=>{l7(t,{changes:i,states:r.getStates()})};return r.on("change",o),()=>{typeof r.off=="function"&&r.off("change",o)}}var u7=(e,t,n,r)=>{const{comment:o}=n,i=new L0(Object.entries(o));t.transact(()=>{e.push([i])},{user:r})},cS=(e,t,n,r)=>{const{comment:o}=n,i=new L0(Object.entries(o)),s=uS(e,o);s!==-1&&t.transact(()=>{e.delete(s,1),e.insert(s,[i])},{user:r})},d7=(e,t,n,r)=>{const{comment:o}=n,i=uS(e,o);i!==-1&&t.transact(()=>{e.delete(i,1)},{user:r})},uS=(e,t)=>e.toJSON().findIndex(n=>n.commentId===t.commentId),f7=e=>e?.activeEditor?.editorVersion===2||e?.editorVersion===2,dS=e=>{const t=e?.commentId??e?.importedId;return t==null?null:String(t)},h7=(e,t)=>{if(!f7(e))return[];const n=e?.commentsStore?.commentsList;if(!Array.isArray(n)||!n.length)return[];const r=new Set(t.map(dS).filter(Boolean));return n.filter(o=>{if(o?.trackedChange!==!0)return!1;const i=dS(o);return!i||!r.has(i)})},fS=e=>{if(!e?.ydoc||!e?.commentsStore)return!1;const t=e.ydoc.getArray("comments").toJSON(),n=new Map,r=[];return t.forEach(o=>{const i=o?.importedId??o?.commentId;if(i){if(n.has(i)){const s=n.get(i),a=o?.commentId;s&&a&&s!==a&&console.warn(`[SuperDoc] Duplicate collaboration comment key "${i}" detected with conflicting commentId values. Keeping first entry and dropping duplicate.`,{key:i,keptCommentId:s,droppedCommentId:a});return}if(n.set(i,o?.commentId),!o?.commentId){r.push({...o,commentId:i});return}r.push(o)}}),e.commentsStore.commentsList=[...r.map(o=>Vs(o)),...h7(e,r)],e.provider?.synced&&(e.commentsStore.hasSyncedCollaborationComments=!0),!0},p7=e=>{if(!e.config.modules.comments||!e.provider)return;if(e._commentsCollabInitialized){fS(e);return}e._commentsCollabInitialized=!0;const t=e.ydoc.getArray("comments"),n=()=>fS(e),r=()=>{if(n()||setTimeout(n,0),e.commentsStore){const o=e.commentsStore.commentsParentElement,i=e.commentsStore.editorCommentIds;e.commentsStore.handleEditorLocationsUpdate(o,i),e.commentsStore.hasSyncedCollaborationComments=!0}e.provider.off("synced",r)};e.provider.on("synced",r),n()||setTimeout(n,0),t.observe(o=>{if(!e.commentsStore)return;const i=e.config.user,{user:s={}}=o?.transaction?.origin||{};tk({current:i,other:s})||n()})},kc=(e,t)=>{if(!e.isCollaborative||!e.config.modules.comments)return;const n=e.ydoc.getArray("comments"),r=e.config.user;switch(t.type){case"add":u7(n,e.ydoc,t,r);break;case"update":cS(n,e.ydoc,t,r);break;case"resolved":cS(n,e.ydoc,t,r);break;case"deleted":d7(n,e.ydoc,t,r);break}};Ft();function Nf(e){const t=re(e.documentId),n=re(e.page),r=no(e.selectionBounds||{}),o=re(e.source),i=()=>`${t.value}-page-${n.value}`;return{documentId:t,page:n,selectionBounds:r,source:o,getValues:()=>({documentId:t.value,page:n.value,selectionBounds:pn(r),source:o.value}),getContainerId:i,getContainerLocation:l=>{if(!l)return{top:0,left:0};const u=l.getBoundingClientRect(),d=document.getElementById(i());let f={top:0,left:0};return d&&(f=d.getBoundingClientRect()),{top:Number((f.top-u.top).toFixed(3)),left:Number((f.left-u.left).toFixed(3))}}}}var Sc="document-editor";Ft();var Bf=Symbol("comment-reconciliation"),hS=e=>[e?.commentId,e?.importedId].filter(t=>t!=null).map(t=>String(t)),Y0=()=>({ok:!1,reason:"read-only-document"}),X0=e=>e?.commentsStore?.getConfig?.readOnly===!0||e?.config?.modules?.comments?.readOnly===!0;function m7(e,t){const n=e?.commentsStore;if(!n)return[];const r=n.commentsList,o=Array.isArray(r)?r:r?.value??[],i=new Set(hS(t)),s=[];let a=!0;for(;a;){a=!1;for(const l of o){if(!l)continue;const u=hS(l);u.some(d=>i.has(d))||[l.parentCommentId,l.threadingParentCommentId].filter(d=>d!=null).map(d=>String(d)).some(d=>i.has(d))&&(s.push(l),u.forEach(d=>i.add(d)),a=!0)}}return s}function Vs(e){const t=re(e.uid);let n=e.commentId||ol(),r=e.importedId,o=e.parentCommentId,i=e.trackedChangeParentId;const s=re(e.trackedChangeThreadParentId),a=re(e.trackedChangeSide),l=e.fileId,u=e.fileType,d=e.createdAtVersionNumber,f=re(e.isInternal!==void 0?e.isInternal:!0),p=re(Array.isArray(e.mentions)?e.mentions:[]),g=re(null),m=re(e.isFocused||!1),v=re(e.creatorId??null),k=re(e.creatorEmail??null),b=re(e.creatorName??null),S=re(e.creatorImage??null),C=re(e.createdTime||Date.now()),w=re(e.importedAuthor||null),T=re(e.docxCommentJSON||null),L=e.origin,z=e.threadingMethod,W=e.threadingStyleOverride;let V=e.threadingParentCommentId;const j=e.originalXmlStructure,Z=re(e.commentText||""),R=e.selection?Nf(e.selection):Nf({documentId:l,page:1,selectionBounds:{}}),K=e.selection?.selectionBounds?{...e.selection.selectionBounds}:{top:0,left:0,right:0,bottom:0},x=re(e.trackedChange),$=re(e.trackedChangeType||null),H=re(e.trackedChangeText||null),J=re(e.trackedChangeDisplayType||null),Q=re(e.semanticColorKey||null),Y=re(e.semanticColor||null),_e=re(e.trackedChangeStory||null),ue=re(e.trackedChangeStoryKind||null),ve=re(e.trackedChangeStoryLabel||""),ge=re(e.trackedChangeAnchorKey||null),Te=re(e.trackedChangeCanonicalId||null),Ne=re(e.trackedChangePositionAliases||[]),Je=re(e.deletedText||null),ct=re(e.trackedChangeLabel||null),tt=re(e.trackedChangeDetailLines||null),Tt=re(e.trackedChangeImagePreview||null),ae=re(e.customAttributes??null),Ee=re(e.resolvedTime||null),Ue=re(e.resolvedById||null),ie=re(e.resolvedByEmail||null),I=re(e.resolvedByName||null),se=re(e.trackedChangeDecision||null),F=({id:Le,email:Xe,name:it,superdoc:yt,decision:Mt,reconciliationToken:Lt})=>{const Wt=Lt===Bf;if(X0(yt)&&!Wt)return Y0();if(Ee.value)return;Ee.value=Date.now(),Ue.value=Le??null,ie.value=Xe,I.value=it,(Mt==="accept"||Mt==="reject")&&(se.value=Mt);const Be={type:Rp.RESOLVED,comment:Ae()};de(yt,Be);const rn=yt.activeEditor?.commands;if(x.value){rn?.resolveComment({commentId:n,importedId:r});return}const zn=m7(yt,{commentId:n,importedId:r});zn.length&&typeof rn?.resolveCommentThread=="function"?rn.resolveCommentThread({comments:[{commentId:n,importedId:r,preserveAnchor:!0},...zn.map(Ht=>({commentId:Ht.commentId,importedId:Ht.importedId,preserveAnchor:!1}))]}):rn?.resolveComment({commentId:n,importedId:r})},q=({isInternal:Le,superdoc:Xe})=>{if(X0(Xe))return Y0();const it=f.value;if(it===Le)return;f.value=Le;const yt={type:Rp.UPDATE,changes:[{key:"isInternal",value:Le,previousValue:it}],comment:Ae()};de(Xe,yt);const Mt=Xe.activeEditor;Mt&&Mt.commands.setCommentInternal({commentId:n,importedId:r,isInternal:Le})},P=Le=>{const{activeEditor:Xe}=Le;Xe?.commands.setActiveComment({commentId:n,importedId:r})},ee=({text:Le,superdoc:Xe,suppressUpdate:it})=>{if(!it&&X0(Xe))return Y0();if(Z.value=Le,p.value=be(Le),it)return;const yt={type:Rp.UPDATE,changes:[{key:"text",value:Le}],comment:Ae()};de(Xe,yt)},be=Le=>{const Xe=[...new DOMParser().parseFromString(Le,"text/html").querySelectorAll('span[data-type="mention"]')],it=[];return Xe.forEach(yt=>{it.some(Mt=>{const Lt=Mt.email===yt.getAttribute("email"),Wt=Mt.name===yt.getAttribute("name");return Lt&&Wt})||it.push({name:yt.getAttribute("name"),email:yt.getAttribute("email")})}),it},N=(Le,Xe)=>{R.source=Sc;const it=Xe?.getBoundingClientRect()?.top,yt={top:Le.top-it,left:Le.left,right:Le.right,bottom:Le.bottom-it};R.selectionBounds=yt},B=()=>w.value?{name:w.value.name||"(Imported)",email:w.value.email}:{id:v.value,name:b.value,email:k.value,image:S.value},de=(Le,Xe)=>{Le.emit("comments-update",Xe),kc(Le,Xe)},Se=(Le={})=>{Object.prototype.hasOwnProperty.call(Le,"commentId")&&(n=Le.commentId),Object.prototype.hasOwnProperty.call(Le,"importedId")&&(r=Le.importedId),Object.prototype.hasOwnProperty.call(Le,"parentCommentId")&&(o=Le.parentCommentId),Object.prototype.hasOwnProperty.call(Le,"trackedChangeParentId")&&(i=Le.trackedChangeParentId),Object.prototype.hasOwnProperty.call(Le,"trackedChangeThreadParentId")&&(s.value=Le.trackedChangeThreadParentId),Object.prototype.hasOwnProperty.call(Le,"threadingParentCommentId")&&(V=Le.threadingParentCommentId)},Ae=()=>({uid:t.value,commentId:n,importedId:r,parentCommentId:o,trackedChangeParentId:i,trackedChangeThreadParentId:s.value,trackedChangeSide:a.value,fileId:l,fileType:u,mentions:p.value.map(Le=>({...Le,name:Le.name?Le.name:Le.email})),createdAtVersionNumber:d,creatorId:v.value,creatorEmail:k.value,creatorName:b.value,creatorImage:S.value,createdTime:C.value,importedAuthor:w.value,docxCommentJSON:T.value,isInternal:f.value,commentText:Z.value,selection:R?R.getValues():null,trackedChange:x.value,trackedChangeText:H.value,trackedChangeType:$.value,trackedChangeDisplayType:J.value,semanticColorKey:Q.value,semanticColor:Y.value,trackedChangeStory:_e.value,trackedChangeStoryKind:ue.value,trackedChangeStoryLabel:ve.value,trackedChangeAnchorKey:ge.value,trackedChangeCanonicalId:Te.value,trackedChangePositionAliases:Ne.value,trackedChangeDecision:se.value,trackedChangeLabel:ct.value,trackedChangeDetailLines:tt.value,trackedChangeImagePreview:Tt.value,customAttributes:ae.value,deletedText:Je.value,resolvedTime:Ee.value,resolvedById:Ue.value,resolvedByEmail:ie.value,resolvedByName:I.value,origin:L,threadingMethod:z,threadingStyleOverride:W,threadingParentCommentId:V,originalXmlStructure:j});return no({uid:t,commentId:n,importedId:r,parentCommentId:o,trackedChangeParentId:i,trackedChangeThreadParentId:s,trackedChangeSide:a,fileId:l,fileType:u,mentions:p,commentElement:g,isFocused:m,creatorId:v,creatorEmail:k,creatorName:b,creatorImage:S,createdTime:C,isInternal:f,commentText:Z,selection:R,floatingPosition:K,trackedChange:x,deletedText:Je,trackedChangeType:$,trackedChangeText:H,trackedChangeDisplayType:J,semanticColorKey:Q,semanticColor:Y,trackedChangeStory:_e,trackedChangeStoryKind:ue,trackedChangeStoryLabel:ve,trackedChangeAnchorKey:ge,trackedChangeCanonicalId:Te,trackedChangePositionAliases:Ne,trackedChangeDecision:se,trackedChangeLabel:ct,trackedChangeDetailLines:tt,trackedChangeImagePreview:Tt,customAttributes:ae,resolvedTime:Ee,resolvedById:Ue,resolvedByEmail:ie,resolvedByName:I,importedAuthor:w,docxCommentJSON:T,origin:L,threadingMethod:z,threadingStyleOverride:W,threadingParentCommentId:V,originalXmlStructure:j,setText:ee,getValues:Ae,resolveComment:F,setIsInternal:q,setActive:P,updatePosition:N,getCommentUser:B,updateIdentityValues:Se})}Ft();function g7(e,t){const n=e.id,r=Z(e),o=e.data,i=t,s=e.state,a=e.role,l=e.html,u=e.markdown,d=e.password,f=re(0),p=re(null),g=re([]),m=re(!1),v=re(t.rulers),k=Br(e.ydoc),b=Br(e.provider),S=Br(e.socket),C=re(e.isNewFile),w=Br(e.v2Collaboration||null),T=Br(null),L=ge=>T.value=ge,z=()=>T.value,W=Br(null),V=ge=>W.value=ge,j=()=>W.value;function Z({type:ge,data:Te}){if(Te?.type)return Te.type;if(ge)return ex[ge]||ge;throw new Error("Document type not specified")}const R=()=>{Q.value=J.value,J.value=[]},K=()=>{J.value=Q.value,console.debug("[superdoc] Restored comments:",J.value)},x=re(e.fields||[]),$=re(e.fields?.map(ge=>Bx(ge))||[]),H=re(e.annotations||[]),J=re(_e()),Q=re(J.value),Y=re(e.commentThreadingProfile||null);function _e(){return i.modules.comments?e.conversations?.map(ge=>Vs(ge))||[]:[]}const ue=re(null),ve=ge=>{const Te=J.value.findIndex(Ne=>Ne.conversationId===ge);Te>-1&&J.value.splice(Te,1)};return{id:n,data:o,html:l,markdown:u,password:d,fieldContext:e.fieldContext,type:r,config:i,state:s,role:a,core:ue,editorMountNonce:f,ydoc:k,provider:b,socket:S,isNewFile:C,v2Collaboration:w,container:p,pageContainers:g,isReady:m,rulers:v,rawFields:x,fields:$,annotations:H,conversations:J,commentThreadingProfile:Y,setEditor:L,getEditor:z,setDocumentRuntime:V,getDocumentRuntime:j,removeComments:R,restoreComments:K,removeConversation:ve}}var pS="data:application/octet-stream;base64,UEsDBBQAAAAIAAAAIQAykW9XXwEAAKUFAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbLWUTWsCMRBA74X+hyVXcaM9lFJcPfTj2BZqf0BMZndDk5mQjLr++7Jql1KsC1Uve0nmvRdYZjJrvMtWEJMlLMQ4H4kMUJOxWBXiY/48vBNZYoVGOUIoxAaSmE2vrybzTYCUNd5hKkTNHO6lTLoGr1JOAbDxrqToFaecYiWD0p+qAnkzGt1KTciAPOSWIaaTRyjV0nH21DDgriSCSyJ72F1sXYVQITirFVtCuULzyzLcG/IIbnsn1TakQeOdkAcN7cnfgv3c6wpitAayNxX5RXkohFxTNNKQXnpAzo9jDnRSWVoN3XxLC5E0pGSx8i7vTryyOOjrwKVfQLRYnT+kQ/dGJN44SOcv2HH79cBssbpEwJ7cm7CGxfvFKn7Ae0NKQp6rhYPzZ3To3giuwcPuOz65Y4s5pjSk3yKFJDXFfzz7e2+008MQKUBke/yv64wqhJPfB+1KMmAOuOV2yU6/AFBLAwQUAAAACAAAACEAAAAAAAIAAAAAAAAACQAAAGRvY1Byb3BzLwMAUEsDBBQAAAAIAAAAIQCGoakSbgEAAM0CAAAQAAAAZG9jUHJvcHMvYXBwLnhtbJ2STWvcMBCG74X+B+N7LG8PoYRZhbIm9NCPBTvJeZDGtoikEZI2rP99sd3dddtbb/M+mnnnA8Hj2dninWIy7PflrqrLgrxibfywL5+7p7vPZZEyeo2WPe3LiVL5KD9+gGPkQDEbSsXZWZ/25ZhzeBAiqZEcpooD+bOzPUeHOVUcB8F9bxQ1rE6OfBaf6vpe0DmT16TvwtWwXB0f3vP/mmpW83zppZsCpVJCRy5YzCR/zJW20pwdiCuFjjPazjiSNYibgCMOlOQOxBrAK0ed5pw1gMOIEVWmuMCNgi8hWKMwG/byu1GRE/e5+LkMW8zVILYp0LBqSZ2iydNstZXwzXhaGqwBHDHiEDGMC9woaBVaOkQOskebCMQNwIFdQD/J9hQoNqxAXMjc4C09h46b+Rq/S/+Em1VfTR7bgIr+WnrDoR0xkm5YXQe5Avg6BYp2dj+M6AfSl5x/H+Yzvqy/U+7uq7qu6+VuFwbi9g/lL1BLAwQUAAAACAAAACEAhRXCKnABAAD7AgAAEQAAAGRvY1Byb3BzL2NvcmUueG1snZJNT+MwEIbvSPsfIt8TO2EXIStNJRZxWqSVKFrEzYyHYhp/yOOS9N+vkrQpFT1x88w888741dTL3rbZB0Yy3i1YWQiWoQOvjVsv2OPqLr9mGSXltGq9wwXbIbFl8+OihiDBR/wbfcCYDFLW29aRhLBgbykFyTnBG1pFhQ/oetu++mhVosLHNQ8KNmqNvBLiiltMSquk+CCYh1mR7SU1zJJhG9tRQAPHFi26RLwsSn5kE0ZLZxvGyifSmrQLeBY9FGe6JzODXdcV3eWIVkKU/On+z8P41dy4wStA1tQaZDKpxabmx6cGSduXd4Q0pedAg4SIKvnYPGwDxlsP2QopZY+EcUQP5cH4De46HzU1NT+JNEiNBNGEZLybRpwkIMhWUbr32rwa1De7s9O+UkNjxA8zXElTjcQc1nvLpw1RZz0ZORl7qPy7/H27umNNJaqfeVnl5dWqqqT4JYV4HpY86T8K2v0C31Y8CEw+nZ5r8x9QSwMEFAAAAAgAAAAhAAAAAAACAAAAAAAAAAYAAABfcmVscy8DAFBLAwQUAAAACAAAACEAHpEat+kAAABOAgAACwAAAF9yZWxzLy5yZWxzrZLBSgMxEIbvgu8Q5t6dbQURabYXEXoTWR9gSGZ3Q5NMSKJu314ERRdq6cHr8PPNN8O/3c3BqzfOxUnUsG5aUByNWBdHDS/94+oOVKkULXmJrOHIBXbd9dX2mT1VJ7FMLhU1Bx+LhqnWdI9YzMSBSiOJ4xz8IDlQLY3kEROZA42Mm7a9xfybAd2CqfZWQ97bG1D9MfElbBkGZ/hBzGvgWE+sQJ4rR8t2lbIkztVxAdVTHrlqsGKesqSClFIzBw942mhzudHf12LgSpYqoZHM530+E+eE1v/5omXix+ZdskX7Nf62wUULug9QSwMEFAAAAAgAAAAhAAAAAAACAAAAAAAAAAUAAAB3b3JkLwMAUEsDBBQAAAAIAAAAIQDscNBiEwIAALQHAAASAAAAd29yZC9mb250VGFibGUueG1svZPNbqMwEIDvlfoOlu8Nw0/SFIVUbbeR9rKHVfcBHGOCtf5BthPI268wECmkuy3tqnCwGWY+jz/D6r6RAh2YsVyrDIczwIgpqnOudhn+9bK5WWJkHVE5EVqxDB+Zxffr66tVnRZaOYsaKZRNJc1w6VyVBoGlJZPEznTFVCNFoY0kzs602QWSmN/76oZqWRHHt1xwdwwigAW+vkII9SzzHpQuCk7ZN033kinnIYFhgjiulS15Zc+Q9XuQtTZ5ZTRl1nK1k6KDSsLVOStMLmiSU6OtLtyMatn35nlBBCH4mRQjynwaJXqdsqCsmQZa9qCAsuYCxvNpsMUJxvMx7GNtjSn5fhInioeO2qEtHwNt7vJyGnM4waCtJY6UxJYXWDZtv/MT8yhZg5Gk6fed0oZsBctwHSaoDufIg1F3Mu2AuhNHwz6QN4TXXTP9T4nqVBHJMvzCJbPoB6vRTy2JGtL61IoobVmI6vRARIah3egCYphDAnOIIIYEB+cltCTGMncqgXFCQSQXx+G98auOUiruaDlkHIjh7Y7HSZbvUJ3u7RYy/AwA0fNmg7tImOEnALhdzh/7SNR24q+7PhKfItBGqOf4x7DjUM855Qyrr4LO4F98Pum94cy0Rt90eQsx3Hmnrcvk0y6lzpn5t8yCNyz/iMkk/mqTD4YT8abDR1hA4h1292cd2ppb+3++x4evtjhM7foPUEsDBBQAAAAIAAAAIQCWFrgr0gIAAIgLAAARAAAAd29yZC9kb2N1bWVudC54bWyllt1u2yAUx+8n7R0s7huM7TiJVbfSmq3qxaRq3R6AALFRDVhA4mRPP2HHH5unKnaugONzfvw5B458/3gShXdk2nAlU4AWPvCYJIpymaXg189vd2vgGYslxYWSLAVnZsDjw+dP91VCFTkIJq13EoU0SVWSFOTWlgmEhuRMYLMQnGhl1N4uiBJQ7fecMFgpTWHgI7+elVoRZgyX2ROWR2zABUdO19GoxhWXmQNGkORYW3bqGWgyZAk3cD0GBTNAyIcBGqPCyagYOlUjUDQLhPwxaTmP9J/DxfNIwZi0mkcKx6T1PNLoOonxBVclkydR7JUW2JqF0hkUWL8fyjuiRIkt3/GC2zMMfD9uMZjL9xmKuHzvCCKkkwkrKBRlRUhbikrBQcvkEn/XxTvpSRN/GboIVly3beCjDWQnWxjbxuprcteEby+Npc4a1KzAlitpcl523UHMpQls8xZy/CgBR1GArrOh6LbWtm3K0AOvkX+pnSga5R8TkX9FNR2ii7hGwt97tkoE5rLfeFZqBslFy2mAYASICTtNY6wvDEj61+04nE7jxB2H0wFnnpgBgB4mIYKw1eEGFz5gGWppPg3X1gi6WGxxjk0+JLJpB1x2uLMY5LvMbntUz1odyp7Gb6O99O21ktMO6Mf/VrA0t4l5y3HJgCdI8pJJpfGuYCmoUORVaOnVFfCa6+oGr3kBXltrr75Anuta4OG+SnaKnt1YehWKkhJr/EJTEKFNHMUrBGqrZSfrrH603KxXmyXwqkQbTn+kwPeDMNyuvnSmV+2MIfKjp6+dccv2+FDYsfvrwBk6GYYR+6qv5dfCs7ffXuU6FgqCyHeOeQrQch35DbLMvmNHtKpMAYoaF82z3PbLnbJWiX5dsP3ga84wZToFq6Be7pWyg2V2sPXysh1RhfGqxJSYsManNlNFnrUrSVJwyV65JXkKwrj+Cttz19OmIrD/hX74A1BLAwQUAAAACAAAACEAyudliigEAAC+DAAAEQAAAHdvcmQvc2V0dGluZ3MueG1stVfbbttGEH0v0H8g+FxZXF4kmTAd6No4sJoictDnFTmUFt4LMbs0rRT994KXldSaCKQEfuLynJkzs5eZJe8+vAruvABqpmTikhvPdUCmKmNyl7hfn1aDietoQ2VGuZKQuAfQ7of7X3+5q2INxjC5086r4FLHIk3cvTFFPBzqdA+C6htVgHwVPFcoqNE3CndDQfG5LAapEgU1bMs4M4eh73kjt5NRiVuijDuJgWApKq1yU7vEKs9ZCt3DeuAlcVuXhUpLAdI0EYcInBqmpN6zQls18aNqgpq9FXn53iReBLd2FfEumG6lMDt6XJJe7VCgSkFrJneC2wSZPAUO3wgdY9+kSnRTbKSGvke8ZnSeeXSdgP9GYJTC63Uak05jmMLruQ7LrtMZHXVYdqbzY8mcCWTlVRJ+YPOoH7X7mZbOTLa/Ts7u0bD2pYbuqd6fK8J1E4yOcgdxWm/NLzmBLfXItkjxcH78RBo/7KRCuuWQuBUJnYpETpOd025l/XDa0+HYdXCaxXXv76r4m1LCqeICMAVpEpf4njusiQKVyjeGGnCqWBfAedPDUg5Uuk4V75AKQdEijU8GOS25eaLbjVGFU8UvlCfu2Eqme4o0NYCbgqZM7uZKGlTc2mXqD2XmShQIWnceTV87jTZtj3SqWFIBifufvrdWGdSZlcgu3xnXRifRecj/B1IvgMgyeKoXemMOHFZKmg37BlOZfSq1YTlLm+73Exl8LwGQdeTPBcinQwEroKZE0O8UrNmJFWfFmiEqfJAZSPNuwVieA4I0jBpYl9wwVFWzzh+BZoDvFbfU8JfCzPdI8IQ0fZ4pY5T4eCj2IH9yJ5vzPjw/vqhZpu3gi1LmaOr5QbAYz9pMa/YSJiBeOF/2MiNvRfp9pmHgBb3MnCxI2M9Ek9m8jwlvwxGZ9jGjyF+GUR8znfmTYNLHzGZkHPUy83kwD1a9zNJb9M9nOffH497cVre+d7vsdqfbExHXnxp/oh3Vhe2I1mNOxRYZddb1x8iwttji84xJy28hVwjnzKbcWnIwaAktKOcrpKklvBbPmC4WkDdjvqa4O+l2FtiLZpB/OmrVXRvwd1Rl0bIV0qItWGtCwrDzZNI8MmFxXW431ktSPJxRpcw+v2CzTqflqWKzB9E0vkfaFFJjC3LwddMVGsdNXSSwpkXR1tp2RxKXs93ekLo8DEncjOJz87Ld+R3nN5zfcs0LTeuZkcTtBifMt9iZXWCx4ISFFgtPWGSx6ISNLDaqsf2hAORMPifucVjjueJcVZB9PPFvIHsJpkxQvjmI7eluu2k5zrTZQEGRGoWW+63hSBhnKn2o7+uwxYPpNFpMvXFLR831aZpWxeTuC+QzqiHrOOsata5/j0beiJD5ZBBOlreD5TgMBxMyux2Mx96YBCviBxPvn64O7I/H/b9QSwMEFAAAAAgAAAAhANuFbMNjBAAAlx0AABIAAAB3b3JkL251bWJlcmluZy54bWzNmctu4zYUhvcF+g6CgC5jkbrbiDJIMkmRwXRQdFJ0TUu0RYQXgaR82c7L9BH6WPMKBWVLdiJPKslO45USkufT4c9zpD/K5YcVo9YCS0UET2w4AraFeSoywueJ/efj/UVsW0ojniEqOE7sNVb2h6uff7pcTnjJplgSPrdWjHI1WRZpYudaFxPHUWmOGVIjRlIplJjpUSqYI2YzkmJnKWTmuACC6qdCihQrRfj8FvEFUvYWl6660TKJloTPDdB30hxJjVc7BuwNCZyxE7dB7gAQBI4L2yivNyp0TFYtkD8IBEGbFAwjHdhcOIzktknRMJLXJsXDSK1yYu0CFwXmK0ZnQjKk1UjIucOQfCqLi1SwAmkyJZToteMCENYYRPjTgIwIf2oIzMt6EyKHiQxTL6spIrFLySfb+Ism3qQ+2cRvL00Ept1u6wI4dvBKU6XrWNlFu034R5GWDHNdqeZITJEmgqucFM3TgQ2lMaTzGrJ4TYAFo3bzZIP+cY+2j5tj2AG7pL89O0Y3mb9OhKDDaRpEE9Elhef3rDNhiPDdjQdJsycuDPoB3BYgTPGqHyPeMpx0192GQ7J+nLDhkGyPMyyZPUBW9kK4Xp2HuZjwPZbKdJb3w9Vn5JhYpFGOVL5PxP02GDS4NdvTu5gf11S/SlEWOxo5jvawe7wueb8NgvDlCRbquGS+5qjAtsXSycOcC4mmFCf2EvrWEgZWdQLWplzNxdp0gFWftVUVkGWeWvbV5XKCpkpLlOovJbOe/faQJTawDXMisdJImsGNp7ueaSxvJEZPZomhcGXuNlkgmtgwhG54AyLbMTOspJp8xgtMH9cFrtfk66kk2W9mjpq5zVrNClqvCODdrX8H4s0MXZgJQhd0k9REFzRNbOCDMQAAVjlUOTZJbOJ4ye5ZMzgtKcW6IT7iVTP1/ds/zfintB6leLZdXvwuzYVws00znNiRW2WSIz6vDLEXArPWaRbL7eVecK2MuColJLG/rtlU0Cr0mqvnA4TrxM7wDJVUb2EVxakSe6kEbCnhVSOYa6TJApsVRysj+uoCfX+YMLeilARL6wte7qnzYjRV7YX9VHNbqgWnV+37t7/76ubCcJhufxE+N3+TqT3Vno/1E8g70GBvIFDvhnPj+L07zj/LjvNCcNYdF5xpx/meex4dF55pxwXAf++Oi86y44IoPOuOi8+040I/fq+Oc5652/+0vnCI9Q3iCEDv5vo463t3F/owuvW7WN/7jseY4ZQwRA+e4y9wdGLv29GuwvHAoqRiieVnrDWWh3fkjk7tWjt6SXhzzJb+EAzxwzvyDu1Iknnew1DCuMOWvAM1NmxLr9acPzq1/evo2N6u6ILRqY1bRzv1ZkUX9i+6lqfqVHTh/1N00ejUDqijaXm7ootHp/YuHR3FmxXduH/RtWzFD4qu7QF49e7ne+988+FskpXVZ7VqEADoR+PQffm57KF57df34geY7iGmHwcBjHwIf8yE+0xn7x+qV/8CUEsDBBQAAAAIAAAAIQC+fnZiWAEAANADAAAUAAAAd29yZC93ZWJTZXR0aW5ncy54bWyd019LwzAQAPB3we8Q8r6lnduQsm4gMvFFBPUDZOmtDeZyJclM56eXdn+s7GX16ULgftwfbrFq0LAvcF6TzXk6TjgDq6jQtsz5x/t6dM+ZD9IW0pCFnO/B89Xy9mYRswibNwhB29KzBo31GaqcVyHUmRBeVYDSj6kG26DZkkMZ/JhcKVC6z109UoS1DHqjjQ57MUmSOT8y7hqFtlut4JHUDsGGLl84MDJosr7StT9p8RotkitqRwq817ZEc/BQantm0ukFhFo58rQNY0V4rKijxCRJk+6F5heYDQMmF8BcQTPMuD8aQkHTd3QxzJmfHV30nP8V0wOK3SBicneqow1tes/yRSiqYdxpR6LNlUFW0ld9EYY1ODtze2znjSp7Li05uTGQ85hOWUxnrIPZYQttYIfFslMLrJsLXy5iRnXQqL9hTe7BUfTgRPstjaH4+vIklgvx5w6XP1BLAwQUAAAACAAAACEAP6/hZjkOAAANpgAADwAAAHdvcmQvc3R5bGVzLnhtbO1dXXPiOBZ936r9Dy6eZh66AUk2kBp6Kkl3b7o2/TFDeudZ2AI0sSXWFk0yv35L/gCDLbDRhUl3baUqCcb3SNa551q6sqVffn2KQucbixMuxbjTf93rOEz4MuBiPu58fXj/athxEkVFQEMp2LjzzJLOr2/++Y9f1leJeg5Z4jxFoUiuIn/cWSi1vOp2E3/BIpq8lksmnqJwJuOIquS1jOfdiMaPq+UrX0ZLqviUh1w9d1Gv53VymLgJipzNuM/eSn8VMaFS+27MQqq4FMmCL5MCbd0EbS3jYBlLnyUJF/MozPAiysUGpk8qQBH3Y5nImXrtyyivUQrVRb1+L/0vCrcAbjsAVAHwfPbUDmOYY3R99lTG4UE7HG+Dw4MSzmmVKQEEq1YQCBf10H+0eQkrCVSwaAdXcNTVtlTRBU0WZUTW7gLdDdxzpNs78q8+zIWM6TRk4866T5x133VSYCdjQf9xMmKd4hKctF06b35ZXwXSf8tmdBWqRH+Mv8T5x/xT+ue9FCpx1lc08Tkfd65jTsOOs75iNFHXCacPCxaxcSfiQsZ31yLh+suF/qd0sp+MOw88Yonzia2d32VEhfPTjQyendvJz52uLuiRxcJZX32j4biDskPJX5sDpDhym+wfC6mYF8eYePV1Uq5d6dCUB3zcofGryXVq2CdXIZ9TtYpZ4uhPKUIWiOLgVgrFntSKhvrkbt4e3f1WWm4+ZWftNWlIFRNqkkWx9VXAZvfSf2TBRFHFxp1eJzv49cOXmMuYq+dxZzTKD05YxO94EDBROlEseMD+WDDxNWHB9vhv79Nokx/w5UqocQcPvJTmMAnePflsqWOXs74SVPP1SRuk3Kz4tvDU/L8FWD9v4Dr7BaM6gDv9fYhRawikLZLS1dZjrvauvd+6IHypgsilCnIvVZB3qYIGlypoeKmCRucuiIuAPWVCrBZTQT2Gg4BwMBAOAcJxgXA8IJwBEM4QCGdkjaOkb/LCkrPj0Sm46Ey4+Ey45Ey47plwvTPhDs6EOzwT7ugMuFlXy/kgAiaUtcpmUiohFXN099QajQohVTqqhcHTNz0Wg1wkAEwW2fIbsTWaT9PPxz3EtbufKz2gc+TMmfG5HpxYV5yJbyyUS+bQIIhZAggYM7WKBZxPx2zGYiZ8BunYcKAhF8wRq2gK4JtLOgfDYiIAbr4CESQobByartRCi4QDOHVE/VgC9FkoWHy454kCAXFuVmHIgLA+wbhYioVgYDAMDIGBcSE5g2qiHA2DohFQNBfSP6HaLUfDoGgEFM2+3R64Ctl+r6PfPHd3G8oEIuBN+Fyk+VNrpDxn6nyhMZ3HdLlwdNr5aE+rdTlpyvkB4p62QYLq16cuorPOXKwYLBqUuDZ4GBiPAOPZS+wjSxLdQbuDGc9MVlNVK9rmo4IJDVdZh9ZebVQxQAG853ECJoN6WAAP/qS7s3dAXb1tLREgFgaPSqDVyyEBahlK/xEmDN89L1kccvFojfRehqFcswAOcaJimflaWfIINZb8u2i5oAlPKhDNb/XFEwzOR7q0vqAvIeUChrd3ryLKQweuB3H38PHeeZBLPczUDQMDeCOVkhEYZp4J/OkPNv0ZpoLXfizFM9DVXgOlh1KwW66AWL2VARDSWzbjgoPcQ1O8f7PnqaRxAIP2JWbZQ0OKASFOaLQMobT1vGTrmEOkZVO8/9CY67wQlKgeQMBKacNkNf2T+Qqgfg5IZujzSqX5x7Sr24eFQ7Bw9l2ElE1nwrX/AlzsDhyChYO62NuQJgn3wa62wEPAeNDXS6DwZCjj2SqEa8ACEEEDYjjAVSQSyCtO8RAwHvT1EmA8FwjvXzEPwMhIwRAkGIYEI5BgoAR4kGADSLAhEBhQF6AEhiDBMCQYgQRzIcE8SLABJBiUn+G3DpvNmK/gbjElSAQPCXejEYpFSxnT+BkI8l3I5hQgQZqhfYnlTL9NIkX2EDdEd3Y1VZCd7QwOiuQ/2BSsahoLsl4AGVEahlIC5da2N5yaZ9eOmaWvc0BkCn22kGHAYsM1HRwvT5bU59XUafPJkns+Xyhnsthk+8swXu+oZTFg3zE7XmBdm3vo4DRTwFdRUdHqyxQebm6MKsbkuPG2J7Fj6Ta0rJbpHbfc9pJ3LAcNLatlDhta4orl6OAsWfxY6wiDQ/6zGeMZnG/Qb2JcWyxqYlnnggPcVCrOte/r2YL+iZox2zcTj9m+jYrMKG3kZEZprCszxCGB/c6+8aQ2R31k/nvz9EQl7pPGkfO3lVSVaWrU/KWuD0IxkTCnFgc3n7jaiTLmdmwcbswQjeOOGaJxADJDNIpERvNWIcmM0jg2mSEaBykzROtohSyjFbKMVggkWiGQaIXsoxU6vTtghmgtVGQvVGQvVGQnVAQiVGQvVGQvVGQvVGwpVGwpVAwiVAwiVGwvVGwvVGwvVGwvVGwvVGwnVAwiVGwvVGwvVGwvVGIpVGIpVAIiVAIiVGIvVGIvVGIvVGIvVGIvVGInVAIiVGIvVGIvVGIvVNdSqK6lUF0QobogQnXtheraC9W1F6prL1TXXqiunVBdEKG69kJ17YXq2gvVsxSqZylUD0SoHohQPXuhevZC9eyF6tkL1bMXqmcnVA9EqJ69UD17oXqthJpPUZoes++3z3oan9hv8Z5PVqnfy69y7+RQ+61rZcZq/i7CjZSPTu2Lhxg3B+HTkMs0Rf18fBmFQeuJz8+3h9/wabCMR9NLyd+FSOdMK+CkqWUlp0JQQ8vKII/ghpaVXichDS0rt0FyKOimuiweSpkvKvNZpNfMuG8w95qZV5t40Myw2sLDZobVBh41M3QdHZz3rd2G7eRtni+tIPSbIQzMCKgVV8bcfmPSzAhN2TMjNKXRjNCKTyNMe2LNUK0ZNkOdRjWyphpZU42sqUYwVCM4qhEc1QiIamxNNbamGltTjWGoxnBUYziqMRDVxJpqYk01saaawFBN4KgmcFQTIKpda6pda6pda6pdGKpdOKpdOKpdIKo9a6o9a6o9a6o9GKo9OKo9OKq9VlSnWZTTR0sl83adsJJhuxtyybBdcC4ZnjBaKlmfOFoqIZw4WqpyddpoqUzaaaOlMnunjZbKNJ42WqrwedpoqZbY00ZLtQyfNloyU42sqUbWVCNrqhEM1QiOagRHNQKiGltTja2pxtZUYxiqMRzVGI5qDEQ1saaaWFNNrKkmMFQTOKoJHNUEiGrXmmrXmmrXmmoXhmoXjmoXjmoXiGrPmmrPmmrPmmoPhmoPjmoPjup2o6WPTIAsATWJaKwcuPXi7miyUNR+ccKvImaJDL+xwIG91PtWV9nd3f7qTbGdn7O+Us/LdAX00utKQbYCbA6Ynvgh2GxTpY11TYp9vvLDaYXz6dqsxNTwSFEb8HyuuF+B325ulZYwpQkLPou6woVeGLHmuHaI4nhRzO2Cxtm3W1ctzhntX8v6Kk70Bm7Z170ewvjt4CY7a5ltzfbI2PITe1Ld4sM9FyzJ9knLXqDVu57pNcXYuIO99N0rOlMsHneGuWpltmrT/bdwU1JOXV5G7S5wxZZv9M/Slm/7+8HpL9/lxzZbwtVa+okqHb7hAc8q52uVb+r1ngy81DfSk9MIMO7QVP/bw/qhFP2cwfv9DeSKyebyBnKkt7e12ynOg4zOgyCdBzVwnq0ss/N2RHlm9+o3dK/+j+leGFXdKztm6V7Y6F4Y0r3wD+Je6LB7HXOiS7gKGtZsZTkEcBVidBUC6SrkhbvKsOwpxOgp+DyewrPftwmI31h6hGv0CBfSI9wfwyPIy4wdlj7gGX3Ag/QB74X7gJl29+KBwB3pn30n0DstbV3ggesdfK89AA8YGD1gAOkBg+/WA7wLCP/CnA+NnA8hOR++KM6rzA4urm000D9NeH4L0ecbGXkeQfI8euE8Dy+gYHhm/QWNqZ8vqG7If+UbI21W9km3Rdrn3LB7koGvfjO+zPVWxUrrhjqnWdqDibt8sXaTQzX2KDUNM6rVNPwgtEOt8z3ss5oGT7RTnHjLwvAjzc6WS/OpIZup7Nt+b1jz/TTbEsJoH6dzB0aA7m5lupuLMLd3tklk/lKLMU+aLhlWbe5sKTHLlm7ow/4qUTJK07379dvJge7X8q5ItzrbOLMXuGp1YMy0HglV5uDz/3Rna0rRQUoREKWo3d3nx2fYJuPYkmF8kGEMxDA+F8Pfe9KvJVvkIFsEiC3y0ti6dOKtJSvuQVZcIFbcH01D4Dx4B3nwgHjwviN1wGcmWlIyOEjJAIiSwYuWxt9OwvAgCUMgEobfkS7OPN4/TsnoICUjIEpGL1oXl0qnZQtb7Ld1dhQij5YiHUqi9XsnPAC0TXLvTYz7evuKJ7WiYb6S/ot56GJb5fSyXhXX/chiUe0sb8KjV+0+u8CBcEtRrRvYyq3kS2b2X+aw9fKc1Yt0s4n2PkGbLyCkWoAdVGv/BLWKVZT9w8Pq81CbLyua7nu9Fzg/VfGKvvt3jHl3yDK5ha10d93L7A0vvM94ZsrqNZttA7DPTHYUQq0p0iGpopHVjbX+AbR+sXjfn36BowexLK5V6oFOJunpnyYcQo+Htw1XS46tZkoMmzk5KpiLtly9A+vpk+2+GvtttbftxjGPrjYFJie4J0+nuvRElV4jr0Gfr6G7bC46Xzhus5rd/mVXlrtr5yg1HtHqhnrcOy74nFXeFvWBbnc3FIiAVy7uUNzDpwwoljdBaYI0PS/hYp7vq/2XfkbOyaIjSzutTt7sJ+bHN1OpZy6pu72yYy9G4CKylzU29NLapDO72SeQ4P+35kMrfnTQdW1vBzsiOeKxL073B2Pkdm1NUwNuz7CNksWcX6soOc1KzVsriWgY3tJlAjXFtduldOtbtPgvefM/UEsDBBQAAAAIAAAAIQAAAAAAAgAAAAAAAAALAAAAd29yZC90aGVtZS8DAFBLAwQUAAAACAAAACEAZ4D8tJEGAADNIAAAFQAAAHdvcmQvdGhlbWUvdGhlbWUxLnhtbO1Zz4/bNha+L9D/gdDd0Q9LsjSIpvDPpslMEmQmWfT4RqIlxhQpkPTMGEWAIj3tZYEFukUvBXrroVhsgS3Qopf+MQEa7Hb/iIVkjy3adJO0k90AO/bBJvV9j5/eeyQfyNvvX5YUnWMhCWeJ5d5yLIRZyjPC8sR6fDrpRBaSClgGlDOcWAssrfcP3/vDbThQBS4xuiwpkweQWIVS1YFty7TAJchbvMLssqRTLkpQ8hYXuZ0JuCAsL6ntOU5ol0CYhRiUOLEeTKckxei0NmkdXhkfU1xipmTdkVJxkjYjthkNNpu59Y9cyCEV6BxoYl0QlvGLU3ypLERBqiEVieU0H8s+vG2vSVTt4bZ4k+az4q0I2cxreCI/WxOdsRf57tq+t7S/ixtH9XdtrwFAmmK20tLGukHoRN4K2wIt/xpsxz23q+Nb9ru79uNw4PkavrvB+7vvOInHo0DD+xt8sIPvO94g7mr4YIMPd/D+uN/zxhq+ARWUsNkuOuxFUbhCryFTTu8Y4XEYOr3RCr5B2a3sWvKZ2pdrJTzlYsKZaoILijCkFhWeQooTq18pLtGIyIrCwkIVMC5xYjme6zqO4zve+tt4HA4wtNjLrlTudNV6kEwFqVRi3a2AWS3Izz/88OL5dy+ef//i009fPP87OiJ5oQy8O8DyNu+Xr//y7y8/Qf/6x1e/fPZXM1628S//9qeXP/70a+aVJuvzb19+9+3PX/z5n998ZoD3BZy14aekxBLdxxfoES+BmQbAZ+LNGKcFkDajz3IJDGqOAT1WhYa+vwAKBtwA6358IgjLTMAP5k81wSeFmCtiAN4rSg14zDkdcGF8p3v1WG0vzFluHlzM27hHAOemsYdbUR7PqwKXxGRyWGBN5kMKTEGOGVaofsZnGBtoHxGi+fWYpIJLPlXoI4IGQIwuOSVnyky6Q0qgsABzvDXfHD9BA05N5kf4XEcCy4GaTGKqufEDmCsojYqhpG3kEajCJPJkIVLN4VIJYDmmHI0zLKWJ80AsNLn3gBJz2I/potSRQpGZCXkEnLeRIz4bFlBWRs2EFW3sh3LGOQX0kCujCK7PkLrNKQG2N9xPCFZvNrcfk7wwJ0j9ZC5MUwJzfT4u6BQwMy5OpbbE9gUxZsdgnmupfYQxhQvIMEaPPzThecXNou8WmOV3sMk3d0HP1brNsMSoKW4MgSVSS9kTnPM9eo4XWwvPAlgJYp/l+zM9ZcZngpTGfKXpTFtKiagnrVnEA1nCa1l9WICWVnVbVnvmGHvTOXayEE9/Awe/MYcLeG3fnALF5oQ5BYKOsJkyN1Pq6dTQ5kbeVJ+0mzDYW0VPSdgrKqD/TeXz1mqe66929i0o2zXOPtx2ZTPkIiPvfmEzgjl7iFlxU9fc1DX/l3XNvvl8U83cVDM31cx/rZrZFDB2+7CnsVLuPfmZEkpP1ILiI9mUPpJTkk0IpU2jIa0PmqpiSMVqOA2XC2j+I8HVH4kqTgqocGK5zQi5XJnOJaq4TCzH2mu7Kb7m5THPVud47tXZJhxIUJt+J1j3K8LUsjfsbQ5C1+abVi7bAoLG6OuLaA2mi+gaRPS6ryfCda5LRWxQEbm/psJuRYUShqA+Fg/8pSIkU6A4q+O05F9F99ojvc+Z+mt7hteL/WuLtCailW66iFYaFpDh7e5rjnUcm0PtGWX0orcRa3t3baBMb6GLxAq7gWOhFKrEmlJQFkrLKkssWa9UQHOWWKlaOfq3rCyVkGoEsljCmkfL9y+JwgJRUiZW1A4DZRttrtdz3l1xsfPuec7eDjKeTnGq9vRsmkdSLY0Yn/5OcN3gc4XFSZFdoDM6F48gS6yg59YOzIhUa29mRLSSe+PFreVqNRW1G6DNFAVaFbDaUdqL+RLe/F/Lab1Ho3T7rWyTC8/yyXXsuq8mbS2aezaQ3t5V7O1t8i1VXbOqwLjWxdErdonfvyG0pEVmaV2ztH17xzUWBK3hwu4r9ojr3g22s9Zu1ZVNa+dym589xaka4SnMqZLLA7JLJWB4dS25XAma3qvV5VKhuSCJ9bET9P2hFww7ThSMO37XdzpR0O92+kHQdceB64wG3jPr8LYqSjdYjj2BktDF6u6+6d+5vy+vSu1bKS9t3tTBdkNu7u9db//9PSJZYn0cepO4Gw/CTtztTzr+aBB14mE46IzCYW80GQ2DKJ48s9B5A/b73aEfjqNO6A6HHT90avlR3On5ntf3e/1o7PefrXyNL9XV75V7G12H/wFQSwMEFAAAAAgAAAAhAAAAAAACAAAAAAAAAAsAAAB3b3JkL19yZWxzLwMAUEsDBBQAAAAIAAAAIQCzvosd/gAAALYDAAAcAAAAd29yZC9fcmVscy9kb2N1bWVudC54bWwucmVsc63TsU7DMBAG4B2Jd7BuJ04KVAg16YKQukJ4ACe5OBb2ObKvkLw9UlHbVFQRQ8b7h///BnuzHZwVXxii8ZRDlqQgkGrfGNI5fJSvd08gIitqlPWEOYwYYVvc3mze0Co2nmJn+igGZynm0DH3z1LGukOnYuJ7pMHZ1genOCY+aNmr+lNplKs0Xcsw7YDiolPsmhzCrrkHUY49/qfbt62p8cXXe4fEVyZkRGZDOoIoVdDIORyTZHAW5HXCalECjxangMM9N58tOU97V2EwpM+CUzSHWC+J4A4dngGH8zfM5gyPSxpaT1yqyk4cp2gO8bAk4hur9z9PchIeIfLitxU/UEsBAhQAFAAAAAgAAAAhADKRb1dfAQAApQUAABMAAAAAAAAAAAAAAAAAAAAAAFtDb250ZW50X1R5cGVzXS54bWxQSwECFAAUAAAACAAAACEAAAAAAAIAAAAAAAAACQAAAAAAAAAAAAAAAACQAQAAZG9jUHJvcHMvUEsBAhQAFAAAAAgAAAAhAIahqRJuAQAAzQIAABAAAAAAAAAAAAAAAAAAuQEAAGRvY1Byb3BzL2FwcC54bWxQSwECFAAUAAAACAAAACEAhRXCKnABAAD7AgAAEQAAAAAAAAAAAAAAAABVAwAAZG9jUHJvcHMvY29yZS54bWxQSwECFAAUAAAACAAAACEAAAAAAAIAAAAAAAAABgAAAAAAAAAAAAAAAAD0BAAAX3JlbHMvUEsBAhQAFAAAAAgAAAAhAB6RGrfpAAAATgIAAAsAAAAAAAAAAAAAAAAAGgUAAF9yZWxzLy5yZWxzUEsBAhQAFAAAAAgAAAAhAAAAAAACAAAAAAAAAAUAAAAAAAAAAAAAAAAALAYAAHdvcmQvUEsBAhQAFAAAAAgAAAAhAOxw0GITAgAAtAcAABIAAAAAAAAAAAAAAAAAUQYAAHdvcmQvZm9udFRhYmxlLnhtbFBLAQIUABQAAAAIAAAAIQCWFrgr0gIAAIgLAAARAAAAAAAAAAAAAAAAAJQIAAB3b3JkL2RvY3VtZW50LnhtbFBLAQIUABQAAAAIAAAAIQDK52WKKAQAAL4MAAARAAAAAAAAAAAAAAAAAJULAAB3b3JkL3NldHRpbmdzLnhtbFBLAQIUABQAAAAIAAAAIQDbhWzDYwQAAJcdAAASAAAAAAAAAAAAAAAAAOwPAAB3b3JkL251bWJlcmluZy54bWxQSwECFAAUAAAACAAAACEAvn52YlgBAADQAwAAFAAAAAAAAAAAAAAAAAB/FAAAd29yZC93ZWJTZXR0aW5ncy54bWxQSwECFAAUAAAACAAAACEAP6/hZjkOAAANpgAADwAAAAAAAAAAAAAAAAAJFgAAd29yZC9zdHlsZXMueG1sUEsBAhQAFAAAAAgAAAAhAAAAAAACAAAAAAAAAAsAAAAAAAAAAAAAAAAAbyQAAHdvcmQvdGhlbWUvUEsBAhQAFAAAAAgAAAAhAGeA/LSRBgAAzSAAABUAAAAAAAAAAAAAAAAAmiQAAHdvcmQvdGhlbWUvdGhlbWUxLnhtbFBLAQIUABQAAAAIAAAAIQAAAAAAAgAAAAAAAAALAAAAAAAAAAAAAAAAAF4rAAB3b3JkL19yZWxzL1BLAQIUABQAAAAIAAAAIQCzvosd/gAAALYDAAAcAAAAAAAAAAAAAAAAAIkrAAB3b3JkL19yZWxzL2RvY3VtZW50LnhtbC5yZWxzUEsFBgAAAAARABEAEQQAAMEsAAAAAA==";Ft();var mS="in",Uu=mk("superdoc",()=>{const e=re(null);let t=null;const n=Us(),r=re([]),o=re([]),i=no({}),s=re([]),a=re(100),l=re("manual"),u=re(mS),d=re(null),f=re(!1),p=re(!1),g=re([]),m=no({name:null,email:null}),v=no({}),k=re(null),b=re({left:0,top:0,width:0,height:0,source:null}),S=()=>{r.value=[],o.value=[],Object.assign(i,{}),s.value=[],f.value=!1,m.name=null,m.email=null,Object.assign(v,{}),k.value=null,u.value=mS},C=no({scrollTop:0,scrollLeft:0}),w=$=>{t=typeof $=="function"?$:null},T=$=>{const H=t||e.value?.onException;typeof H=="function"&&H($)},L=async $=>{if(S(),e.value=$,$.zoom?.initial!==void 0){const ue=$.zoom.initial;typeof ue=="number"&&Number.isFinite(ue)&&ue>0?a.value=ue:console.warn("[SuperDoc] zoom.initial expects a positive number representing percentage")}if($.zoom?.mode!==void 0){const ue=$.zoom.mode;ue==="manual"||ue==="fit-width"?l.value=ue:console.warn("[SuperDoc] zoom.mode expects 'manual' or 'fit-width'")}if($.measurementUnit!==void 0){const ue=$.measurementUnit;ue==="in"||ue==="cm"?u.value=ue:console.warn("[SuperDoc] measurementUnit expects 'in' or 'cm'")}const{documents:H,modules:J,user:Q,users:Y}=$;if(s.value=Y||[],Object.assign(m,Q),Object.assign(v,J),Object.prototype.hasOwnProperty.call(v,"comments")||(v.comments={}),!H?.length&&!$.modules.collaboration){const ue=await Uy(pS,"blank.docx",Sr),ve={id:ol(),type:Sr,data:ue,name:"blank.docx",isNewFile:!0};$.html&&(ve.html=$.html),$.markdown&&(ve.markdown=$.markdown),H.push(ve)}const _e=H?.length===1&&H[0]&&H[0].fieldContext===void 0?[{...H[0],fieldContext:$.fieldContext}]:H;await z(_e),f.value=!0},z=async($=[])=>{if(!$)return[];for(let H of $){if(!H){T({error:new Error("Received empty document entry during initialization."),stage:"document-init",document:H}),console.warn("[superdoc] Skipping empty document entry.");continue}try{let J=await V(H);if(!J){T({error:new Error("Document could not be initialized with the provided configuration."),stage:"document-init",document:H}),console.warn("[superdoc] Skipping document due to invalid configuration:",H);continue}const Q=g7(J,e.value);r.value.push(Q)}catch(J){T({error:J,stage:"document-init",document:H}),console.warn("[superdoc] Error initializing document:",H,"with error:",J,"Skipping document.")}}},W=($,H,J)=>new File([$],H,{type:J}),V=async $=>{if($=Jy($),e.value?.html&&($.html=e.value.html),!$.data&&$.url&&!$.type&&($.type=Sr),e.value?.modules.collaboration&&!$.isNewFile)return{...$,data:null,url:null};if($.data instanceof File){let H=$.name;const J=$.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?".docx":$.type==="application/pdf"?".pdf":".bin";if(H?H.includes(".")||(H=`${H}${J}`):H=`document${J}`,$.data.name!==H){const Q=W($.data,H,$.data.type||$.type);return{...$,name:H,data:Q}}return $.name?$:{...$,name:H}}else if($.data instanceof Blob){let H=$.name;H||(H=`document${$.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?".docx":$.type==="application/pdf"?".pdf":".bin"}`);const J=W($.data,H,$.data.type||$.type);return{...$,data:J}}else{if($.data)return $;if($.url&&$.type){$.type.toLowerCase()==="docx"?$.type=Sr:$.type.toLowerCase()==="pdf"&&($.type=Ea);try{const H=await Uy($.url,$.name||"document",$.type);return{...$,data:H}}catch(H){const J=H instanceof Error?H.message:String(H);throw console.debug("[SuperDoc] Failed to fetch document from URL:",J),H}}}return null},j=ke(()=>{for(let $ of r.value.filter(H=>H.type==="pdf"))if(!$.isReady)return!1;return!0}),Z=$=>r.value.find(H=>H.id===$);return{commentsStore:n,documents:r,documentBounds:o,pages:i,documentUsers:s,users:g,activeZoom:a,zoomMode:l,measurementUnit:u,viewportMetrics:d,documentScroll:C,isInternal:p,selectionPosition:b,activeSelection:k,isReady:f,user:m,modules:v,areDocumentsReady:j,init:L,setExceptionHandler:w,reset:S,handlePageReady:($,H,J)=>{i[$]||(i[$]=[]),i[$].push({page:H,containerBounds:J});const Q=Z($);Q&&Q.pageContainers.push({page:H,containerBounds:J})},getDocument:Z,removeDocument:$=>{const H=$!=null?String($):null;if(!H)return null;const J=r.value.findIndex(_e=>String(_e?.id??"")===H);if(J===-1)return null;n.removeCommentsForDocument?.(H),k.value?.documentId!=null&&String(k.value.documentId)===H&&(k.value=null,b.value={left:0,top:0,width:0,height:0,source:null}),delete i[H];const[Q]=r.value.splice(J,1),Y=e.value?.documents;if(Array.isArray(Y)){const _e=Y.findIndex(ue=>String(ue?.id??"")===H);_e!==-1&&Y.splice(_e,1)}return Q??null},getPageBounds:($,H)=>{const J=i[$];if(!J)return;const Q=J.find(_e=>_e.page==H);if(!Q||!Q.container)return;const{height:Y}=Q.container.getBoundingClientRect();return{top:Y*(H-1)}}}}),v7=e=>{const t={trackInsert:"insertedMark",trackDelete:"deletionMark",trackFormat:"formatMark"},n=new Map;for(const o of e){const i=o.mark.attrs.id;n.has(i)||n.set(i,[]),n.get(i).push(o)}const r=[];for(const[,o]of n){if(o.length===1){const s=o[0],a=t[s.mark.type.name];r.push({from:s.from,to:s.to,[a]:s});continue}const i=new Set;for(let s=0;s<o.length;s++){if(i.has(s))continue;const a=o[s],l=t[a.mark.type.name],u=o[s+1];if(u&&!i.has(s+1)&&a.to===u.from&&a.mark.type.name!==u.mark.type.name){const f=t[u.mark.type.name];r.push({from:a.from,to:u.to,[l]:a,[f]:u}),i.add(s),i.add(s+1);continue}let d=!1;for(let f=s+1;f<o.length;f++){if(i.has(f))continue;const p=o[f];if(a.mark.type.name!==p.mark.type.name){const g=t[p.mark.type.name];r.push({from:Math.min(a.from,p.from),to:Math.max(a.to,p.to),[l]:a,[g]:p}),i.add(s),i.add(f),d=!0;break}}d||(r.push({from:a.from,to:a.to,[l]:a}),i.add(s))}}return r},y7="headerFooterPart",Z0=e=>Number.isFinite(e)?Number(e):null,b7=(e,t)=>`${e}::page:${t}`,w7=(e,t)=>{const n=String(e),r=String(t);return n===r||n.startsWith("tc::")&&n.endsWith(`::${r}`)},C7=e=>{if(!Array.isArray(e)||e.length===0)return null;let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;return e.forEach(i=>{[i?.left,i?.top,i?.right,i?.bottom].every(Number.isFinite)&&(t=Math.min(t,i.left),n=Math.min(n,i.top),r=Math.max(r,i.right),o=Math.max(o,i.bottom))}),[t,n,r,o].every(Number.isFinite)?{left:t,top:n,right:r,bottom:o,width:r-t,height:o-n}:null},gS=e=>{const t=new Map;return(Array.isArray(e)?e:[]).forEach(n=>{const r=Z0(n?.pageIndex);if(r==null)return;const o=t.get(r);if(o){o.push(n);return}t.set(r,[n])}),[...t.entries()].sort((n,r)=>n[0]-r[0]).map(([n,r])=>({pageIndex:n,rects:r}))},k7=(e,t)=>!e?.trackedChange||e?.trackedChangeStory?.storyType!==y7?!1:gS(t?.rects).length>1,S7=e=>{const t=Number(e?.selection?.page);return!Number.isInteger(t)||t<1?null:t-1},_7=({id:e,threadId:t,comment:n,positionKey:r,positionEntry:o})=>{const i=Z0(o?.pageIndex),s=n?.trackedChange?null:S7(n);return{id:e,threadId:t,comment:n,positionKey:r,positionEntry:o??null,pageIndex:i??s,isPrimary:!0}},A7=({comment:e,positionKey:t,positionEntry:n,primaryInstanceId:r})=>{const o=gS(n?.rects);if(o.length<2)return[];const i=o.map(({pageIndex:l,rects:u})=>{const d=C7(u);return d?{pageIndex:l,rects:u,bounds:d}:null}).filter(Boolean);if(i.length<2)return[];const s=Z0(n?.pageIndex),a=i.some(({pageIndex:l})=>l===s)?s:i[0]?.pageIndex??null;return i.map(({pageIndex:l,rects:u,bounds:d})=>{const f=l===a;return{id:f?r:b7(r,l),threadId:e?.commentId??t,comment:e,positionKey:t,pageIndex:l,isPrimary:f,positionEntry:{...n,pageIndex:l,rects:u,bounds:d}}})},I7=({comment:e,positionKey:t,positionEntry:n,fallbackId:r})=>{const o=e?.trackedChange&&t&&r&&Array.isArray(e?.trackedChangePositionAliases)&&e.trackedChangePositionAliases.some(a=>w7(t,a)),i=e?.trackedChange&&e?.trackedChangeCanonicalId&&t&&r&&String(t)!==String(r),s=o||i?r:t??r;if(!s)return[];if(k7(e,n)&&t){const a=A7({comment:e,positionKey:t,positionEntry:n,primaryInstanceId:s});if(a.length>0)return a}return[_7({id:s,threadId:e?.commentId??r,comment:e,positionKey:t,positionEntry:n})]};Ft();var vS=()=>import("@superdoc/docx-engine"),Hu=null,um=null;function E7(e){if(typeof e!="function")throw new TypeError("SuperDoc: the DOCX Engine loader must be a function");if(Hu)throw new Error("SuperDoc: the DOCX Engine loader cannot change after loading has started");vS=e}async function T7(){if(!Hu){const e=Promise.resolve().then(()=>vS()).then(t=>{const n=t&&typeof t=="object"&&"createSuperDocV2Integration"in t?t.createSuperDocV2Integration:null;if(typeof n!="function")throw new TypeError("SuperDoc: the DOCX Engine module does not export createSuperDocV2Integration");um=n});Hu=e,e.catch(()=>{Hu===e&&(Hu=null,um=null)})}await Hu}async function x7(){try{await T7()}catch(e){console.error("[SuperDoc] DOCX Engine failed to load; using the stub.",e)}}var iK=1,R7="tc-comment:",M7="tc::body::";function dm(e){if(!e||typeof e!="object")return!1;const t=e.id??e.commentId;return typeof t!="string"?!1:t.startsWith(R7)}function $u(e){if(!e||e.trackedChange!==!0)return!1;const t=e.trackedChangeAnchorKey;return typeof t=="string"&&t.startsWith(M7)}function L7(){return{publish(){},recollect(){},reset(){},getLastEpoch(){return null},getLastPayload(){return null}}}function D7(){return{setContext(){},onCommittedPagePaint(){},refreshCommittedWindow(){},invalidate(){},beginMutation(){},settleMutation(){},reset(){},getSnapshot(){return null},subscribe(){return()=>{}},getDiagnostics(){return null}}}var O7=uc({name:"SuperDocV2IntegrationMissing",emits:["v2-editor-failed"],setup(e,{emit:t}){return Nn(()=>{t("v2-editor-failed",{reason:"v2-integration-unavailable",detail:"SuperDoc: the DOCX Engine runtime could not be constructed in this environment."})}),()=>zr("div",{class:"superdoc-v2-integration-missing"})}});function Q0(){return{version:1,capabilities:null,EditorComponent:O7,RulerComponent:null,createGeometryPublisher:L7,createReviewWindowController:D7,isSyntheticTrackedChangeCommentLaneItem:dm,isV2SyntheticTrackedChangeRow:$u}}function P7(){if(!um)return Q0();try{const e=Q0(),t=um();return!t||typeof t!="object"||!t.EditorComponent?e:{version:typeof t.version=="number"?t.version:e.version,capabilities:t.capabilities??e.capabilities,EditorComponent:t.EditorComponent,RulerComponent:t.RulerComponent??e.RulerComponent,createGeometryPublisher:t.createGeometryPublisher??e.createGeometryPublisher,createReviewWindowController:t.createReviewWindowController??e.createReviewWindowController,isSyntheticTrackedChangeCommentLaneItem:t.isSyntheticTrackedChangeCommentLaneItem??e.isSyntheticTrackedChangeCommentLaneItem,isV2SyntheticTrackedChangeRow:t.isV2SyntheticTrackedChangeRow??e.isV2SyntheticTrackedChangeRow}}catch(e){return console.error("[SuperDoc] DOCX Engine integration failed to construct; using the stub.",e),Q0()}}function F7(){return P7()}function yS(){try{const e=globalThis.__superdocInteractionTrace;return e&&typeof e=="object"?e:null}catch{return null}}function J0(e,t,n=void 0){try{const r=yS();return!r||typeof r.startSpan!="function"?null:r.startSpan(e,t,n)}catch{return null}}function Gu(e,t=void 0){if(e)try{const n=yS();if(!n||typeof n.endSpan!="function")return;n.endSpan(e,t)}catch{}}function Wu(e,t,n,r){const o=J0(e,t,n);if(!o)return r();try{const i=r();return i&&typeof i.then=="function"?i.then(s=>(Gu(o),s)).catch(s=>{throw Gu(o,{error:s instanceof Error?s.message:String(s)}),s}):(Gu(o),i)}catch(i){throw Gu(o,{error:i instanceof Error?i.message:String(i)}),i}}var N7=e=>!!e?.trackedChangeLink||!!e?.trackedChangeType||!!e?.trackedChangeDisplayType||!!e?.trackedChangeText||!!e?.deletedText||e?.trackedChange===!0,fm=e=>e?.trackedChangeThreadParentId!=null?e.trackedChangeThreadParentId:e?.trackedChangeParentId!=null&&N7(e)?e.trackedChangeParentId:null,B7=e=>e==="source"||e==="deleted"?"source":e==="destination"||e==="inserted"?"destination":null,z7=e=>e?.semanticColorKey==="move-from"?"source":e?.semanticColorKey==="move-to"?"destination":null,bS=e=>{const t=new Map,n=new Map,r=(i,s,a)=>{const l=i.get(s);l?l.push(a):i.set(s,[a])};for(const i of e)i?.trackedChange===!0&&(typeof i.commentId=="string"&&r(t,i.commentId,i),i.trackedChangeCanonicalId!=null&&r(n,String(i.trackedChangeCanonicalId),i));const o=new Map;for(const i of e){if(i?.trackedChange===!0)continue;const s=new Set([i.threadingParentCommentId,fm(i)].filter(f=>f!=null).map(f=>String(f)));if(s.size===0)continue;const a=new Set([...s].flatMap(f=>t.get(f)??[]));if(a.size===1){o.set(i,[...a][0]);continue}if(a.size>1)continue;const l=new Set([...s].flatMap(f=>n.get(f)??[]));if(l.size===1){o.set(i,[...l][0]);continue}const u=B7(i.trackedChangeSide);if(!u)continue;const d=[...l].filter(f=>z7(f)===u);d.length===1&&o.set(i,d[0])}return o},j7=(e,t=new Map)=>{const n=new Map,r=new Map,o=new Map,i=new Map,s=bS(e),a=(u,d,f)=>{const p=u.get(d);p?p.push(f):u.set(d,[f])};e.forEach((u,d)=>{i.set(u,d),a(o,u.commentId,u),new Set([u.parentCommentId,u.threadingParentCommentId].filter(p=>p!=null).map(p=>String(p))).forEach(p=>a(n,p,u));const f=s.get(u);f?.commentId!=null&&a(r,String(f.commentId),u)});const l=new Map;for(const u of e){if(!u?.trackedChange||u.commentId==null)continue;const d=u.commentId,f=new Set([d]),p=[],g=[];typeof d=="string"&&g.push(d);const m=g.flatMap(S=>[...n.get(S)??[],...r.get(S)??[]]);for(const S of m){const C=S.commentId;C===d||f.has(C)||(f.add(C),p.push(C))}for(let S=0;S<p.length;S+=1){const C=p[S];for(const w of typeof C=="string"?n.get(C)??[]:[]){const T=w.commentId;f.has(T)||(f.add(T),p.push(T))}}const v=[...f].flatMap(S=>o.get(S)??[]).sort((S,C)=>(i.get(S)??0)-(i.get(C)??0));v.sort((S,C)=>S===u?-1:C===u?1:Number(S.createdTime)-Number(C.createdTime));const k=t.get(d),b=k?.length===v.length&&v.every((S,C)=>k[C]===S)?k:v;l.set(d,b)}return l},V7=(e,t=new Map)=>{const n=new Map;for(const o of e){const i=new Set([o.parentCommentId,o.threadingParentCommentId,o.trackedChangeParentId,o.trackedChangeThreadParentId].filter(s=>s!=null).map(s=>String(s)));for(const s of i){const a=n.get(s);a?a.push(o):n.set(s,[o])}}const r=new Map;for(const[o,i]of n){const s=t.get(o);r.set(o,s?.length===i.length&&i.every((a,l)=>s[l]===a)?s:i)}return r};Ft();var wS=class{constructor(){throw new Error("SuperDoc v2 beta: v1 editor-backed comment import paths are not available.")}},Oa={getTrackChanges:()=>[],enumerateStructuralRowChanges:()=>[]},U7=Symbol("comments-plugin-disabled"),CS=()=>[],eb=()=>null,Ku=()=>null,kS=()=>null,tb=({storyKey:e,rawId:t})=>`tc::${e}::${t}`,H7=/<br(?:\s[^>]*)?\s*\/?>/gi,$7=/<(?:p|div|li|blockquote|pre|h[1-6])(?:\s[^>]*)?\s*\/?>/gi,G7=/<\/(?:p|div|li|blockquote|pre|h[1-6])\s*>/gi,W7=/<\/?[A-Za-z][A-Za-z0-9:-]*(?:\s[^>]*)?\s*\/?>/g,K7=/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z][a-zA-Z0-9]+);/g,q7={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:'"'},nb=(e,t)=>{if(Object.is(e,t))return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Object.is(e[o],t[o]))},SS=e=>{if(!Array.isArray(e))return null;const t=e.filter(n=>n&&typeof n=="object").map(n=>({excerpt:typeof n.excerpt=="string"?n.excerpt:"",label:typeof n.label=="string"?n.label:""}));return t.length>0?t:null},Y7=(e,t)=>e===t?!0:!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,r)=>nb(n,t[r])),_S=e=>Array.isArray(e)?e.filter(t=>t&&typeof t=="object").map(t=>({name:typeof t.name=="string"?t.name:"",namespaceUri:typeof t.namespaceUri=="string"?t.namespaceUri:"",localName:typeof t.localName=="string"?t.localName:"",value:typeof t.value=="string"?t.value:""})).filter(t=>t.name&&t.namespaceUri&&t.localName):null,X7=(e,t)=>e===t?!0:!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,r)=>nb(n,t[r])),AS=e=>{if(!e||typeof e!="object")return null;const t=typeof e.src=="string"?e.src:null;if(!t||!t.startsWith("data:image/"))return null;const n=typeof e.contentType=="string"&&e.contentType.startsWith("image/")?e.contentType:null,r=typeof e.role=="string"?e.role:null,o=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:null,i=typeof e.height=="number"&&Number.isFinite(e.height)&&e.height>0?e.height:null,s=typeof e.alt=="string"&&e.alt.length>0?e.alt:"Tracked image preview";return{src:t,...n?{contentType:n}:{},...r?{role:r}:{},...o?{width:o}:{},...i?{height:i}:{},alt:s}},Z7=e=>{const t=String(e).toLowerCase(),n=q7[t];if(n!==void 0)return n;const r=t.startsWith("#x")?16:t.startsWith("#")?10:null;if(!r)return null;const o=t.startsWith("#x")?t.slice(2):t.slice(1),i=Number.parseInt(o,r);if(!Number.isFinite(i))return null;try{return String.fromCodePoint(i)}catch{return null}},Q7=e=>e.replace(K7,(t,n)=>Z7(n)??t),rb=e=>{const t=String(e??"");return!t||t==="<p></p>"?"":Q7(t.replace(H7,`
|
|
8
|
+
`?s.insert.slice(0,-1):s.insert;(typeof a!="string"||a.length>0)&&O0(r,this,o,a,s.attributes||{})}else s.retain!==void 0?H3(r,this,o,s.retain,s.attributes||{}):s.delete!==void 0&&G3(r,o,s.delete)}}):this._pending.push(()=>this.applyDelta(t))}toDelta(t,n,r){this.doc??Do();const o=[],i=new Map,s=this.doc;let a="",l=this._start;function u(){if(a.length>0){const f={};let p=!1;i.forEach((m,v)=>{p=!0,f[v]=m});const g={insert:a};p&&(g.attributes=f),o.push(g),a=""}}const d=()=>{for(;l!==null;){if(Bu(l,t)||n!==void 0&&Bu(l,n))switch(l.content.constructor){case ju:{const f=i.get("ychange");t!==void 0&&!Bu(l,t)?(f===void 0||f.user!==l.id.client||f.type!=="removed")&&(u(),i.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!Bu(l,n)?(f===void 0||f.user!==l.id.client||f.type!=="added")&&(u(),i.set("ychange",r?r("added",l.id):{type:"added"})):f!==void 0&&(u(),i.delete("ychange")),a+=l.content.str;break}case Vu:case am:{u();const f={insert:l.content.getContent()[0]};if(i.size>0){const p={};f.attributes=p,i.forEach((g,m)=>{p[m]=g})}o.push(f);break}case Oo:Bu(l,t)&&(u(),zu(i,l.content));break}l=l.right}u()};return t||n?ur(s,f=>{t&&A0(f,t),n&&A0(f,n),d()},"cleanup"):d(),o}insert(t,n,r){if(n.length<=0)return;const o=this.doc;o!==null?ur(o,i=>{const s=sm(i,this,t,!r);r||(r={},s.currentAttributes.forEach((a,l)=>{r[l]=a})),O0(i,this,s,n,r)}):this._pending.push(()=>this.insert(t,n,r))}insertEmbed(t,n,r){const o=this.doc;o!==null?ur(o,i=>{const s=sm(i,this,t,!r);O0(i,this,s,n,r||{})}):this._pending.push(()=>this.insertEmbed(t,n,r||{}))}delete(t,n){if(n===0)return;const r=this.doc;r!==null?ur(r,o=>{G3(o,sm(o,this,t,!0),n)}):this._pending.push(()=>this.delete(t,n))}format(t,n,r){if(n===0)return;const o=this.doc;o!==null?ur(o,i=>{const s=sm(i,this,t,!1);s.right!==null&&H3(i,this,s,n,r)}):this._pending.push(()=>this.format(t,n,r))}removeAttribute(t){this.doc!==null?ur(this.doc,n=>{om(n,this,t)}):this._pending.push(()=>this.removeAttribute(t))}setAttribute(t,n){this.doc!==null?ur(this.doc,r=>{R0(r,this,t,n)}):this._pending.push(()=>this.setAttribute(t,n))}getAttribute(t){return M0(this,t)}getAttributes(){return N3(this)}_write(t){t.writeTypeRef(AR)}},P0=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Do()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===W3||t.constructor===F0)&&t._start!==null)e=t._start;else for(;e!==null;){const n=e.next;if(n!==null){e=n;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},F0=class D2 extends So{constructor(){super(),this._prelimContent=[]}get firstChild(){const t=this._first;return t?t.content.getContent()[0]:null}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new D2}clone(){const t=new D2;return t.insert(0,this.toArray().map(n=>n instanceof So?n.clone():n)),t}get length(){return this.doc??Do(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(t){return new P0(this,t)}querySelector(t){t=t.toUpperCase();const n=new P0(this,r=>r.nodeName&&r.nodeName.toUpperCase()===t).next();return n.done?null:n.value}querySelectorAll(t){return t=t.toUpperCase(),Mu(new P0(this,n=>n.nodeName&&n.nodeName.toUpperCase()===t))}_callObserver(t,n){nm(this,t,new yR(this,n,t))}toString(){return L3(this,t=>t.toString()).join("")}toJSON(){return this.toString()}toDOM(t=document,n={},r){const o=t.createDocumentFragment();return r!==void 0&&r._createAssociation(o,this),Df(this,i=>{o.insertBefore(i.toDOM(t,n,r),null)}),o}insert(t,n){this.doc!==null?ur(this.doc,r=>{P3(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}insertAfter(t,n){if(this.doc!==null)ur(this.doc,r=>{const o=t&&t instanceof So?t._item:t;rm(r,this,o,n)});else{const r=this._prelimContent,o=t===null?0:r.findIndex(i=>i===t)+1;if(o===0&&t!==null)throw wl("Reference item not found");r.splice(o,0,...n)}}delete(t,n=1){this.doc!==null?ur(this.doc,r=>{F3(r,this,t,n)}):this._prelimContent.splice(t,n)}toArray(){return M3(this)}push(t){this.insert(this.length,t)}unshift(t){this.insert(0,t)}get(t){return D3(this,t)}slice(t=0,n=this.length){return R3(this,t,n)}forEach(t){Df(this,t)}_write(t){t.writeTypeRef(ER)}},W3=class O2 extends F0{constructor(t="UNDEFINED"){super(),this.nodeName=t,this._prelimAttrs=new Map}get nextSibling(){const t=this._item?this._item.next:null;return t?t.content.type:null}get prevSibling(){const t=this._item?this._item.prev:null;return t?t.content.type:null}_integrate(t,n){super._integrate(t,n),this._prelimAttrs.forEach((r,o)=>{this.setAttribute(o,r)}),this._prelimAttrs=null}_copy(){return new O2(this.nodeName)}clone(){const t=new O2(this.nodeName),n=this.getAttributes();return F6(n,(r,o)=>{t.setAttribute(o,r)}),t.insert(0,this.toArray().map(r=>r instanceof So?r.clone():r)),t}toString(){const t=this.getAttributes(),n=[],r=[];for(const s in t)r.push(s);r.sort();const o=r.length;for(let s=0;s<o;s++){const a=r[s];n.push(a+'="'+t[a]+'"')}const i=this.nodeName.toLocaleLowerCase();return`<${i}${n.length>0?" "+n.join(" "):""}>${super.toString()}</${i}>`}removeAttribute(t){this.doc!==null?ur(this.doc,n=>{om(n,this,t)}):this._prelimAttrs.delete(t)}setAttribute(t,n){this.doc!==null?ur(this.doc,r=>{R0(r,this,t,n)}):this._prelimAttrs.set(t,n)}getAttribute(t){return M0(this,t)}hasAttribute(t){return B3(this,t)}getAttributes(t){return t?cR(this,t):N3(this)}toDOM(t=document,n={},r){const o=t.createElement(this.nodeName),i=this.getAttributes();for(const s in i){const a=i[s];typeof a=="string"&&o.setAttribute(s,a)}return Df(this,s=>{o.appendChild(s.toDOM(t,n,r))}),r!==void 0&&r._createAssociation(o,this),o}_write(t){t.writeTypeRef(IR),t.writeKey(this.nodeName)}},yR=class extends em{constructor(e,t,n){super(e,n),this.childListChanged=!1,this.attributesChanged=new Set,t.forEach(r=>{r===null?this.childListChanged=!0:this.attributesChanged.add(r)})}},K3=class{constructor(e,t){this.id=e,this.length=t}get deleted(){throw us()}mergeWith(e){return!1}write(e,t,n){throw us()}integrate(e,t){throw us()}},bR=0,Sl=class extends K3{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,t){t>0&&(this.id.clock+=t,this.length-=t),C3(e.doc.store,this)}write(e,t){e.writeInfo(bR),e.writeLen(this.length-t)}getMissing(e,t){return null}},q3=class DE{constructor(t){this.content=t}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new DE(this.content)}splice(t){throw us()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeBuf(this.content)}getRef(){return 3}},wR=class P2{constructor(t){this.len=t}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new P2(this.len)}splice(t){const n=new P2(this.len-t);return this.len=t,n}mergeWith(t){return this.len+=t.len,!0}integrate(t,n){m3(t.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(t){}gc(t){}write(t,n){t.writeLen(this.len-n)}getRef(){return 1}},CR=(e,t)=>new _0({guid:e,...t,shouldLoad:t.shouldLoad||t.autoLoad||!1}),Y3=class OE{constructor(t){t._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=t;const n={};this.opts=n,t.gc||(n.gc=!1),t.autoLoad&&(n.autoLoad=!0),t.meta!==null&&(n.meta=t.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new OE(CR(this.doc.guid,this.opts))}splice(t){throw us()}mergeWith(t){return!1}integrate(t,n){this.doc._item=n,t.subdocsAdded.add(this.doc),this.doc.shouldLoad&&t.subdocsLoaded.add(this.doc)}delete(t){t.subdocsAdded.has(this.doc)?t.subdocsAdded.delete(this.doc):t.subdocsRemoved.add(this.doc)}gc(t){}write(t,n){t.writeString(this.doc.guid),t.writeAny(this.opts)}getRef(){return 9}},am=class PE{constructor(t){this.embed=t}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new PE(this.embed)}splice(t){throw us()}mergeWith(t){return!1}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeJSON(this.embed)}getRef(){return 5}},Oo=class FE{constructor(t,n){this.key=t,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new FE(this.key,this.value)}splice(t){throw us()}mergeWith(t){return!1}integrate(t,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(t){}gc(t){}write(t,n){t.writeKey(this.key),t.writeJSON(this.value)}getRef(){return 6}},kR=$p("node_env")==="development",N0=class F2{constructor(t){this.arr=t,kR&&Fk(t)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new F2(this.arr)}splice(t){const n=new F2(this.arr.slice(t));return this.arr=this.arr.slice(0,t),n}mergeWith(t){return this.arr=this.arr.concat(t.arr),!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){const r=this.arr.length;t.writeLen(r-n);for(let o=n;o<r;o++){const i=this.arr[o];t.writeAny(i)}}getRef(){return 8}},ju=class N2{constructor(t){this.str=t}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new N2(this.str)}splice(t){const n=new N2(this.str.slice(t));this.str=this.str.slice(0,t);const r=this.str.charCodeAt(t-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,t-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(t){return this.str+=t.str,!0}integrate(t,n){}delete(t){}gc(t){}write(t,n){t.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}},SR=0,_R=1,AR=2,IR=3,ER=4,Vu=class NE{constructor(t){this.type=t}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new NE(this.type._copy())}splice(t){throw us()}mergeWith(t){return!1}integrate(t,n){this.type._integrate(t.doc,n)}delete(t){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(t.beforeState.get(n.id.client)||0)&&t._mergeStructs.push(n):n.delete(t),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(t.beforeState.get(r.id.client)||0)&&t._mergeStructs.push(r):r.delete(t)}),t.changed.delete(this.type)}gc(t){let n=this.type._start;for(;n!==null;)n.gc(t,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(t,!0),r=r.left}),this.type._map=new Map}write(t,n){this.type._write(t)}getRef(){return 7}},X3=(e,t,n)=>{const{client:r,clock:o}=t.id,i=new wi(Mr(r,o+n),t,Mr(r,o+n-1),t.right,t.rightOrigin,t.parent,t.parentSub,t.content.splice(n));return t.deleted&&i.markDeleted(),t.keep&&(i.keep=!0),t.redone!==null&&(i.redone=Mr(t.redone.client,t.redone.clock+n)),t.right=i,i.right!==null&&(i.right.left=i),e._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),t.length=n,i},wi=class B2 extends K3{constructor(t,n,r,o,i,s,a,l){super(t,l.getLength()),this.origin=r,this.left=n,this.right=o,this.rightOrigin=i,this.parent=s,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?2:0}set marker(t){(this.info&8)>0!==t&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(t){this.keep!==t&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(t){this.deleted!==t&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(t,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=si(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=si(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Zp&&this.id.client!==this.parent.client&&this.parent.clock>=si(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=k3(t,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Cl(t,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Sl||this.right&&this.right.constructor===Sl)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===B2?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===B2&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Zp){const r=E0(n,this.parent);r.constructor===Sl?this.parent=null:this.parent=r.content.type}return null}integrate(t,n){if(n>0&&(this.id.clock+=n,this.left=k3(t,t.doc.store,Mr(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,o;if(r!==null)o=r.right;else if(this.parentSub!==null)for(o=this.parent._map.get(this.parentSub)||null;o!==null&&o.left!==null;)o=o.left;else o=this.parent._start;const i=new Set,s=new Set;for(;o!==null&&o!==this.right;){if(s.add(o),i.add(o),Qp(this.origin,o.origin)){if(o.id.client<this.id.client)r=o,i.clear();else if(Qp(this.rightOrigin,o.rightOrigin))break}else if(o.origin!==null&&s.has(E0(t.doc.store,o.origin)))i.has(E0(t.doc.store,o.origin))||(r=o,i.clear());else break;o=o.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(t)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),C3(t.doc.store,this),this.content.integrate(t,this),A3(t,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(t)}else new Sl(this.id,this.length).integrate(t,0)}get next(){let t=this.right;for(;t!==null&&t.deleted;)t=t.right;return t}get prev(){let t=this.left;for(;t!==null&&t.deleted;)t=t.left;return t}get lastId(){return this.length===1?this.id:Mr(this.id.client,this.id.clock+this.length-1)}mergeWith(t){if(this.constructor===t.constructor&&Qp(t.origin,this.lastId)&&this.right===t&&Qp(this.rightOrigin,t.rightOrigin)&&this.id.client===t.id.client&&this.id.clock+this.length===t.id.clock&&this.deleted===t.deleted&&this.redone===null&&t.redone===null&&this.content.constructor===t.content.constructor&&this.content.mergeWith(t.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===t&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),t.keep&&(this.keep=!0),this.right=t.right,this.right!==null&&(this.right.left=this),this.length+=t.length,!0}return!1}delete(t){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),m3(t.deleteSet,this.id.client,this.id.clock,this.length),A3(t,n,this.parentSub),this.content.delete(t)}}gc(t,n){if(!this.deleted)throw Ra();this.content.gc(t),n?J8(t,this,new Sl(this.id,this.length)):this.content=new wR(this.length)}write(t,n){const r=n>0?Mr(this.id.client,this.id.clock+n-1):this.origin,o=this.rightOrigin,i=this.parentSub,s=this.content.getRef()&31|(r===null?0:128)|(o===null?0:64)|(i===null?0:32);if(t.writeInfo(s),r!==null&&t.writeLeftID(r),o!==null&&t.writeRightID(o),r===null&&o===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const u=q8(a);t.writeParentInfo(!0),t.writeString(u)}else t.writeParentInfo(!1),t.writeLeftID(l.id)}else a.constructor===String?(t.writeParentInfo(!0),t.writeString(a)):a.constructor===Zp?(t.writeParentInfo(!1),t.writeLeftID(a)):Ra();i!==null&&t.writeString(i)}this.content.write(t,n)}},Z3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},Q3="__ $YJS$ __";Z3[Q3]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438"),Z3[Q3]=!0;var TR=Math.floor,xR=(e,t)=>e<t?e:t,RR=(e,t)=>e>t?e:t,MR=128,B0=127,KW=Number.MAX_SAFE_INTEGER,LR=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},Of=typeof TextEncoder<"u"?new TextEncoder:null,DR=e=>Of.encode(e),OR=Of?DR:LR,z0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});z0&&z0.decode(new Uint8Array).length===1&&(z0=null);var lm=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},j0=(e,t)=>{for(;t>B0;)lm(e,MR|B0&t),t=TR(t/128);lm(e,B0&t)},V0=new Uint8Array(3e4),PR=V0.length/3,FR=(e,t)=>{if(t.length<PR){const n=Of.encodeInto(t,V0).written||0;j0(e,n);for(let r=0;r<n;r++)lm(e,V0[r])}else zR(e,OR(t))},NR=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;j0(e,r);for(let o=0;o<r;o++)lm(e,n.codePointAt(o))},qW=Of&&Of.encodeInto?FR:NR,BR=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=xR(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(RR(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},zR=(e,t)=>{j0(e,t.byteLength),BR(e,t)},J3=e=>new Error(e),YW=J3("Unexpected end of array"),XW=J3("Integer out of Range"),eS;(function(e){e[e.Token=0]="Token",e[e.PermissionDenied=1]="PermissionDenied",e[e.Authenticated=2]="Authenticated"})(eS||(eS={}));var tS;(function(e){e[e.Connecting=0]="Connecting",e[e.Open=1]="Open",e[e.Closing=2]="Closing",e[e.Closed=3]="Closed"})(tS||(tS={}));var U0=()=>new Map,ZW=Array.from,QW=String.fromCharCode,jR=e=>e.toLowerCase(),VR=/^\s*/g,UR=e=>e.replace(VR,""),HR=/([A-Z])/g,nS=(e,t)=>UR(e.replace(HR,n=>`${t}${jR(n)}`)),$R=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},Pf=typeof TextEncoder<"u"?new TextEncoder:null,GR=e=>Pf.encode(e),WR=Pf?GR:$R,H0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});H0&&H0.decode(new Uint8Array).length===1&&(H0=null);var rS=e=>e===void 0?null:e,KR=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},oS=new KR,qR=!0;try{typeof localStorage<"u"&&localStorage&&(oS=localStorage,qR=!1)}catch{}var YR=oS,XR=(e,t)=>t.includes(e),Ff=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";typeof navigator<"u"&&/Mac/.test(navigator.platform);var js,ZR=()=>{if(js===void 0)if(Ff){js=U0();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&js.set(t,""),t=r):t!==null&&(js.set(t,r),t=null)}t!==null&&js.set(t,"")}else typeof location=="object"?(js=U0(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");js.set(`--${nS(t,"-")}`,n),js.set(`-${nS(t,"-")}`,n)}})):js=U0();return js},$0=e=>ZR().has(e),G0=e=>rS(Ff?process.env[e.toUpperCase()]:YR.getItem(e)),QR=e=>$0("--"+e)||G0(e)!==null;QR("production");var iS=Ff&&XR(process.env.FORCE_COLOR,["true","1","2"]);!$0("no-colors")&&(!Ff||process.stdout.isTTY||iS)&&(!Ff||$0("color")||iS||G0("COLORTERM")!==null||(G0("TERM")||"").includes("color"));var JR=Math.floor,e7=(e,t)=>e<t?e:t,t7=(e,t)=>e>t?e:t,n7=128,W0=127,JW=Number.MAX_SAFE_INTEGER,cm=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},K0=(e,t)=>{for(;t>W0;)cm(e,n7|W0&t),t=JR(t/128);cm(e,W0&t)},q0=new Uint8Array(3e4),r7=q0.length/3,o7=(e,t)=>{if(t.length<r7){const n=Pf.encodeInto(t,q0).written||0;K0(e,n);for(let r=0;r<n;r++)cm(e,q0[r])}else a7(e,WR(t))},i7=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;K0(e,r);for(let o=0;o<r;o++)cm(e,n.codePointAt(o))},eK=Pf&&Pf.encodeInto?o7:i7,s7=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=e7(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(t7(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},a7=(e,t)=>{K0(e,t.byteLength),s7(e,t)},sS=e=>new Error(e),tK=sS("Unexpected end of array"),nK=sS("Integer out of Range"),rK=Date.now,aS;(function(e){e[e.Sync=0]="Sync",e[e.Awareness=1]="Awareness",e[e.Auth=2]="Auth",e[e.QueryAwareness=3]="QueryAwareness",e[e.Stateless=5]="Stateless",e[e.CLOSE=7]="CLOSE",e[e.SyncStatus=8]="SyncStatus"})(aS||(aS={}));var lS;(function(e){e.Connecting="connecting",e.Connected="connected",e.Disconnected="disconnected"})(lS||(lS={}));var oK=crypto.getRandomValues.bind(crypto);function l7(e,{changes:t={},states:n}){const{added:r=[],removed:o=[]}=t,i={states:l5(e,n),added:r,removed:o,superdoc:e};e.emit("awareness-update",i)}function c7(e,t,n){const r=e.awareness;if(!r)return console.warn("[superdoc] External provider missing awareness property"),()=>{};n&&r.setLocalStateField&&r.setLocalStateField("user",n);const o=(i={})=>{l7(t,{changes:i,states:r.getStates()})};return r.on("change",o),()=>{typeof r.off=="function"&&r.off("change",o)}}var u7=(e,t,n,r)=>{const{comment:o}=n,i=new L0(Object.entries(o));t.transact(()=>{e.push([i])},{user:r})},cS=(e,t,n,r)=>{const{comment:o}=n,i=new L0(Object.entries(o)),s=uS(e,o);s!==-1&&t.transact(()=>{e.delete(s,1),e.insert(s,[i])},{user:r})},d7=(e,t,n,r)=>{const{comment:o}=n,i=uS(e,o);i!==-1&&t.transact(()=>{e.delete(i,1)},{user:r})},uS=(e,t)=>e.toJSON().findIndex(n=>n.commentId===t.commentId),f7=e=>e?.activeEditor?.editorVersion===2||e?.editorVersion===2,dS=e=>{const t=e?.commentId??e?.importedId;return t==null?null:String(t)},h7=(e,t)=>{if(!f7(e))return[];const n=e?.commentsStore?.commentsList;if(!Array.isArray(n)||!n.length)return[];const r=new Set(t.map(dS).filter(Boolean));return n.filter(o=>{if(o?.trackedChange!==!0)return!1;const i=dS(o);return!i||!r.has(i)})},fS=e=>{if(!e?.ydoc||!e?.commentsStore)return!1;const t=e.ydoc.getArray("comments").toJSON(),n=new Map,r=[];return t.forEach(o=>{const i=o?.importedId??o?.commentId;if(i){if(n.has(i)){const s=n.get(i),a=o?.commentId;s&&a&&s!==a&&console.warn(`[SuperDoc] Duplicate collaboration comment key "${i}" detected with conflicting commentId values. Keeping first entry and dropping duplicate.`,{key:i,keptCommentId:s,droppedCommentId:a});return}if(n.set(i,o?.commentId),!o?.commentId){r.push({...o,commentId:i});return}r.push(o)}}),e.commentsStore.commentsList=[...r.map(o=>Vs(o)),...h7(e,r)],e.provider?.synced&&(e.commentsStore.hasSyncedCollaborationComments=!0),!0},p7=e=>{if(!e.config.modules.comments||!e.provider)return;if(e._commentsCollabInitialized){fS(e);return}e._commentsCollabInitialized=!0;const t=e.ydoc.getArray("comments"),n=()=>fS(e),r=()=>{if(n()||setTimeout(n,0),e.commentsStore){const o=e.commentsStore.commentsParentElement,i=e.commentsStore.editorCommentIds;e.commentsStore.handleEditorLocationsUpdate(o,i),e.commentsStore.hasSyncedCollaborationComments=!0}e.provider.off("synced",r)};e.provider.on("synced",r),n()||setTimeout(n,0),t.observe(o=>{if(!e.commentsStore)return;const i=e.config.user,{user:s={}}=o?.transaction?.origin||{};tk({current:i,other:s})||n()})},kc=(e,t)=>{if(!e.isCollaborative||!e.config.modules.comments)return;const n=e.ydoc.getArray("comments"),r=e.config.user;switch(t.type){case"add":u7(n,e.ydoc,t,r);break;case"update":cS(n,e.ydoc,t,r);break;case"resolved":cS(n,e.ydoc,t,r);break;case"deleted":d7(n,e.ydoc,t,r);break}};Ft();function Nf(e){const t=re(e.documentId),n=re(e.page),r=no(e.selectionBounds||{}),o=re(e.source),i=()=>`${t.value}-page-${n.value}`;return{documentId:t,page:n,selectionBounds:r,source:o,getValues:()=>({documentId:t.value,page:n.value,selectionBounds:pn(r),source:o.value}),getContainerId:i,getContainerLocation:l=>{if(!l)return{top:0,left:0};const u=l.getBoundingClientRect(),d=document.getElementById(i());let f={top:0,left:0};return d&&(f=d.getBoundingClientRect()),{top:Number((f.top-u.top).toFixed(3)),left:Number((f.left-u.left).toFixed(3))}}}}var Sc="document-editor";Ft();var Bf=Symbol("comment-reconciliation"),hS=e=>[e?.commentId,e?.importedId].filter(t=>t!=null).map(t=>String(t)),Y0=()=>({ok:!1,reason:"read-only-document"}),X0=e=>e?.commentsStore?.getConfig?.readOnly===!0||e?.config?.modules?.comments?.readOnly===!0;function m7(e,t){const n=e?.commentsStore;if(!n)return[];const r=n.commentsList,o=Array.isArray(r)?r:r?.value??[],i=new Set(hS(t)),s=[];let a=!0;for(;a;){a=!1;for(const l of o){if(!l)continue;const u=hS(l);u.some(d=>i.has(d))||[l.parentCommentId,l.threadingParentCommentId].filter(d=>d!=null).map(d=>String(d)).some(d=>i.has(d))&&(s.push(l),u.forEach(d=>i.add(d)),a=!0)}}return s}function Vs(e){const t=re(e.uid);let n=e.commentId||ol(),r=e.importedId,o=e.parentCommentId,i=e.trackedChangeParentId;const s=re(e.trackedChangeThreadParentId),a=re(e.trackedChangeSide),l=e.fileId,u=e.fileType,d=e.createdAtVersionNumber,f=re(e.isInternal!==void 0?e.isInternal:!0),p=re(Array.isArray(e.mentions)?e.mentions:[]),g=re(null),m=re(e.isFocused||!1),v=re(e.creatorId??null),k=re(e.creatorEmail??null),b=re(e.creatorName??null),S=re(e.creatorImage??null),C=re(e.createdTime||Date.now()),w=re(e.importedAuthor||null),T=re(e.docxCommentJSON||null),L=e.origin,z=e.threadingMethod,W=e.threadingStyleOverride;let V=e.threadingParentCommentId;const j=e.originalXmlStructure,Z=re(e.commentText||""),R=e.selection?Nf(e.selection):Nf({documentId:l,page:1,selectionBounds:{}}),K=e.selection?.selectionBounds?{...e.selection.selectionBounds}:{top:0,left:0,right:0,bottom:0},x=re(e.trackedChange),$=re(e.trackedChangeType||null),H=re(e.trackedChangeText||null),J=re(e.trackedChangeDisplayType||null),Q=re(e.semanticColorKey||null),Y=re(e.semanticColor||null),_e=re(e.trackedChangeStory||null),ue=re(e.trackedChangeStoryKind||null),ve=re(e.trackedChangeStoryLabel||""),ge=re(e.trackedChangeAnchorKey||null),Te=re(e.trackedChangeCanonicalId||null),Ne=re(e.trackedChangePositionAliases||[]),Je=re(e.deletedText||null),ct=re(e.trackedChangeLabel||null),tt=re(e.trackedChangeDetailLines||null),Tt=re(e.trackedChangeImagePreview||null),ae=re(e.customAttributes??null),Ee=re(e.resolvedTime||null),Ue=re(e.resolvedById||null),ie=re(e.resolvedByEmail||null),I=re(e.resolvedByName||null),se=re(e.trackedChangeDecision||null),F=({id:Le,email:Xe,name:it,superdoc:yt,decision:Mt,reconciliationToken:Lt})=>{const Wt=Lt===Bf;if(X0(yt)&&!Wt)return Y0();if(Ee.value)return;Ee.value=Date.now(),Ue.value=Le??null,ie.value=Xe,I.value=it,(Mt==="accept"||Mt==="reject")&&(se.value=Mt);const Be={type:Rp.RESOLVED,comment:Ae()};de(yt,Be);const rn=yt.activeEditor?.commands;if(x.value){rn?.resolveComment({commentId:n,importedId:r});return}const zn=m7(yt,{commentId:n,importedId:r});zn.length&&typeof rn?.resolveCommentThread=="function"?rn.resolveCommentThread({comments:[{commentId:n,importedId:r,preserveAnchor:!0},...zn.map(Ht=>({commentId:Ht.commentId,importedId:Ht.importedId,preserveAnchor:!1}))]}):rn?.resolveComment({commentId:n,importedId:r})},q=({isInternal:Le,superdoc:Xe})=>{if(X0(Xe))return Y0();const it=f.value;if(it===Le)return;f.value=Le;const yt={type:Rp.UPDATE,changes:[{key:"isInternal",value:Le,previousValue:it}],comment:Ae()};de(Xe,yt);const Mt=Xe.activeEditor;Mt&&Mt.commands.setCommentInternal({commentId:n,importedId:r,isInternal:Le})},P=Le=>{const{activeEditor:Xe}=Le;Xe?.commands.setActiveComment({commentId:n,importedId:r})},ee=({text:Le,superdoc:Xe,suppressUpdate:it})=>{if(!it&&X0(Xe))return Y0();if(Z.value=Le,p.value=be(Le),it)return;const yt={type:Rp.UPDATE,changes:[{key:"text",value:Le}],comment:Ae()};de(Xe,yt)},be=Le=>{const Xe=[...new DOMParser().parseFromString(Le,"text/html").querySelectorAll('span[data-type="mention"]')],it=[];return Xe.forEach(yt=>{it.some(Mt=>{const Lt=Mt.email===yt.getAttribute("email"),Wt=Mt.name===yt.getAttribute("name");return Lt&&Wt})||it.push({name:yt.getAttribute("name"),email:yt.getAttribute("email")})}),it},N=(Le,Xe)=>{R.source=Sc;const it=Xe?.getBoundingClientRect()?.top,yt={top:Le.top-it,left:Le.left,right:Le.right,bottom:Le.bottom-it};R.selectionBounds=yt},B=()=>w.value?{name:w.value.name||"(Imported)",email:w.value.email}:{id:v.value,name:b.value,email:k.value,image:S.value},de=(Le,Xe)=>{Le.emit("comments-update",Xe),kc(Le,Xe)},Se=(Le={})=>{Object.prototype.hasOwnProperty.call(Le,"commentId")&&(n=Le.commentId),Object.prototype.hasOwnProperty.call(Le,"importedId")&&(r=Le.importedId),Object.prototype.hasOwnProperty.call(Le,"parentCommentId")&&(o=Le.parentCommentId),Object.prototype.hasOwnProperty.call(Le,"trackedChangeParentId")&&(i=Le.trackedChangeParentId),Object.prototype.hasOwnProperty.call(Le,"trackedChangeThreadParentId")&&(s.value=Le.trackedChangeThreadParentId),Object.prototype.hasOwnProperty.call(Le,"threadingParentCommentId")&&(V=Le.threadingParentCommentId)},Ae=()=>({uid:t.value,commentId:n,importedId:r,parentCommentId:o,trackedChangeParentId:i,trackedChangeThreadParentId:s.value,trackedChangeSide:a.value,fileId:l,fileType:u,mentions:p.value.map(Le=>({...Le,name:Le.name?Le.name:Le.email})),createdAtVersionNumber:d,creatorId:v.value,creatorEmail:k.value,creatorName:b.value,creatorImage:S.value,createdTime:C.value,importedAuthor:w.value,docxCommentJSON:T.value,isInternal:f.value,commentText:Z.value,selection:R?R.getValues():null,trackedChange:x.value,trackedChangeText:H.value,trackedChangeType:$.value,trackedChangeDisplayType:J.value,semanticColorKey:Q.value,semanticColor:Y.value,trackedChangeStory:_e.value,trackedChangeStoryKind:ue.value,trackedChangeStoryLabel:ve.value,trackedChangeAnchorKey:ge.value,trackedChangeCanonicalId:Te.value,trackedChangePositionAliases:Ne.value,trackedChangeDecision:se.value,trackedChangeLabel:ct.value,trackedChangeDetailLines:tt.value,trackedChangeImagePreview:Tt.value,customAttributes:ae.value,deletedText:Je.value,resolvedTime:Ee.value,resolvedById:Ue.value,resolvedByEmail:ie.value,resolvedByName:I.value,origin:L,threadingMethod:z,threadingStyleOverride:W,threadingParentCommentId:V,originalXmlStructure:j});return no({uid:t,commentId:n,importedId:r,parentCommentId:o,trackedChangeParentId:i,trackedChangeThreadParentId:s,trackedChangeSide:a,fileId:l,fileType:u,mentions:p,commentElement:g,isFocused:m,creatorId:v,creatorEmail:k,creatorName:b,creatorImage:S,createdTime:C,isInternal:f,commentText:Z,selection:R,floatingPosition:K,trackedChange:x,deletedText:Je,trackedChangeType:$,trackedChangeText:H,trackedChangeDisplayType:J,semanticColorKey:Q,semanticColor:Y,trackedChangeStory:_e,trackedChangeStoryKind:ue,trackedChangeStoryLabel:ve,trackedChangeAnchorKey:ge,trackedChangeCanonicalId:Te,trackedChangePositionAliases:Ne,trackedChangeDecision:se,trackedChangeLabel:ct,trackedChangeDetailLines:tt,trackedChangeImagePreview:Tt,customAttributes:ae,resolvedTime:Ee,resolvedById:Ue,resolvedByEmail:ie,resolvedByName:I,importedAuthor:w,docxCommentJSON:T,origin:L,threadingMethod:z,threadingStyleOverride:W,threadingParentCommentId:V,originalXmlStructure:j,setText:ee,getValues:Ae,resolveComment:F,setIsInternal:q,setActive:P,updatePosition:N,getCommentUser:B,updateIdentityValues:Se})}Ft();function g7(e,t){const n=e.id,r=Z(e),o=e.data,i=t,s=e.state,a=e.role,l=e.html,u=e.markdown,d=e.password,f=re(0),p=re(null),g=re([]),m=re(!1),v=re(t.rulers),k=Br(e.ydoc),b=Br(e.provider),S=Br(e.socket),C=re(e.isNewFile),w=Br(e.v2Collaboration||null),T=Br(null),L=ge=>T.value=ge,z=()=>T.value,W=Br(null),V=ge=>W.value=ge,j=()=>W.value;function Z({type:ge,data:Te}){if(Te?.type)return Te.type;if(ge)return e5[ge]||ge;throw new Error("Document type not specified")}const R=()=>{Q.value=J.value,J.value=[]},K=()=>{J.value=Q.value,console.debug("[superdoc] Restored comments:",J.value)},x=re(e.fields||[]),$=re(e.fields?.map(ge=>B5(ge))||[]),H=re(e.annotations||[]),J=re(_e()),Q=re(J.value),Y=re(e.commentThreadingProfile||null);function _e(){return i.modules.comments?e.conversations?.map(ge=>Vs(ge))||[]:[]}const ue=re(null),ve=ge=>{const Te=J.value.findIndex(Ne=>Ne.conversationId===ge);Te>-1&&J.value.splice(Te,1)};return{id:n,data:o,html:l,markdown:u,password:d,fieldContext:e.fieldContext,type:r,config:i,state:s,role:a,core:ue,editorMountNonce:f,ydoc:k,provider:b,socket:S,isNewFile:C,v2Collaboration:w,container:p,pageContainers:g,isReady:m,rulers:v,rawFields:x,fields:$,annotations:H,conversations:J,commentThreadingProfile:Y,setEditor:L,getEditor:z,setDocumentRuntime:V,getDocumentRuntime:j,removeComments:R,restoreComments:K,removeConversation:ve}}var pS="data:application/octet-stream;base64,UEsDBBQAAAAIAAAAIQAykW9XXwEAAKUFAAATAAAAW0NvbnRlbnRfVHlwZXNdLnhtbLWUTWsCMRBA74X+hyVXcaM9lFJcPfTj2BZqf0BMZndDk5mQjLr++7Jql1KsC1Uve0nmvRdYZjJrvMtWEJMlLMQ4H4kMUJOxWBXiY/48vBNZYoVGOUIoxAaSmE2vrybzTYCUNd5hKkTNHO6lTLoGr1JOAbDxrqToFaecYiWD0p+qAnkzGt1KTciAPOSWIaaTRyjV0nH21DDgriSCSyJ72F1sXYVQITirFVtCuULzyzLcG/IIbnsn1TakQeOdkAcN7cnfgv3c6wpitAayNxX5RXkohFxTNNKQXnpAzo9jDnRSWVoN3XxLC5E0pGSx8i7vTryyOOjrwKVfQLRYnT+kQ/dGJN44SOcv2HH79cBssbpEwJ7cm7CGxfvFKn7Ae0NKQp6rhYPzZ3To3giuwcPuOz65Y4s5pjSk3yKFJDXFfzz7e2+008MQKUBke/yv64wqhJPfB+1KMmAOuOV2yU6/AFBLAwQUAAAACAAAACEAAAAAAAIAAAAAAAAACQAAAGRvY1Byb3BzLwMAUEsDBBQAAAAIAAAAIQCGoakSbgEAAM0CAAAQAAAAZG9jUHJvcHMvYXBwLnhtbJ2STWvcMBCG74X+B+N7LG8PoYRZhbIm9NCPBTvJeZDGtoikEZI2rP99sd3dddtbb/M+mnnnA8Hj2dninWIy7PflrqrLgrxibfywL5+7p7vPZZEyeo2WPe3LiVL5KD9+gGPkQDEbSsXZWZ/25ZhzeBAiqZEcpooD+bOzPUeHOVUcB8F9bxQ1rE6OfBaf6vpe0DmT16TvwtWwXB0f3vP/mmpW83zppZsCpVJCRy5YzCR/zJW20pwdiCuFjjPazjiSNYibgCMOlOQOxBrAK0ed5pw1gMOIEVWmuMCNgi8hWKMwG/byu1GRE/e5+LkMW8zVILYp0LBqSZ2iydNstZXwzXhaGqwBHDHiEDGMC9woaBVaOkQOskebCMQNwIFdQD/J9hQoNqxAXMjc4C09h46b+Rq/S/+Em1VfTR7bgIr+WnrDoR0xkm5YXQe5Avg6BYp2dj+M6AfSl5x/H+Yzvqy/U+7uq7qu6+VuFwbi9g/lL1BLAwQUAAAACAAAACEAhRXCKnABAAD7AgAAEQAAAGRvY1Byb3BzL2NvcmUueG1snZJNT+MwEIbvSPsfIt8TO2EXIStNJRZxWqSVKFrEzYyHYhp/yOOS9N+vkrQpFT1x88w888741dTL3rbZB0Yy3i1YWQiWoQOvjVsv2OPqLr9mGSXltGq9wwXbIbFl8+OihiDBR/wbfcCYDFLW29aRhLBgbykFyTnBG1pFhQ/oetu++mhVosLHNQ8KNmqNvBLiiltMSquk+CCYh1mR7SU1zJJhG9tRQAPHFi26RLwsSn5kE0ZLZxvGyifSmrQLeBY9FGe6JzODXdcV3eWIVkKU/On+z8P41dy4wStA1tQaZDKpxabmx6cGSduXd4Q0pedAg4SIKvnYPGwDxlsP2QopZY+EcUQP5cH4De46HzU1NT+JNEiNBNGEZLybRpwkIMhWUbr32rwa1De7s9O+UkNjxA8zXElTjcQc1nvLpw1RZz0ZORl7qPy7/H27umNNJaqfeVnl5dWqqqT4JYV4HpY86T8K2v0C31Y8CEw+nZ5r8x9QSwMEFAAAAAgAAAAhAAAAAAACAAAAAAAAAAYAAABfcmVscy8DAFBLAwQUAAAACAAAACEAHpEat+kAAABOAgAACwAAAF9yZWxzLy5yZWxzrZLBSgMxEIbvgu8Q5t6dbQURabYXEXoTWR9gSGZ3Q5NMSKJu314ERRdq6cHr8PPNN8O/3c3BqzfOxUnUsG5aUByNWBdHDS/94+oOVKkULXmJrOHIBXbd9dX2mT1VJ7FMLhU1Bx+LhqnWdI9YzMSBSiOJ4xz8IDlQLY3kEROZA42Mm7a9xfybAd2CqfZWQ97bG1D9MfElbBkGZ/hBzGvgWE+sQJ4rR8t2lbIkztVxAdVTHrlqsGKesqSClFIzBw942mhzudHf12LgSpYqoZHM530+E+eE1v/5omXix+ZdskX7Nf62wUULug9QSwMEFAAAAAgAAAAhAAAAAAACAAAAAAAAAAUAAAB3b3JkLwMAUEsDBBQAAAAIAAAAIQDscNBiEwIAALQHAAASAAAAd29yZC9mb250VGFibGUueG1svZPNbqMwEIDvlfoOlu8Nw0/SFIVUbbeR9rKHVfcBHGOCtf5BthPI268wECmkuy3tqnCwGWY+jz/D6r6RAh2YsVyrDIczwIgpqnOudhn+9bK5WWJkHVE5EVqxDB+Zxffr66tVnRZaOYsaKZRNJc1w6VyVBoGlJZPEznTFVCNFoY0kzs602QWSmN/76oZqWRHHt1xwdwwigAW+vkII9SzzHpQuCk7ZN033kinnIYFhgjiulS15Zc+Q9XuQtTZ5ZTRl1nK1k6KDSsLVOStMLmiSU6OtLtyMatn35nlBBCH4mRQjynwaJXqdsqCsmQZa9qCAsuYCxvNpsMUJxvMx7GNtjSn5fhInioeO2qEtHwNt7vJyGnM4waCtJY6UxJYXWDZtv/MT8yhZg5Gk6fed0oZsBctwHSaoDufIg1F3Mu2AuhNHwz6QN4TXXTP9T4nqVBHJMvzCJbPoB6vRTy2JGtL61IoobVmI6vRARIah3egCYphDAnOIIIYEB+cltCTGMncqgXFCQSQXx+G98auOUiruaDlkHIjh7Y7HSZbvUJ3u7RYy/AwA0fNmg7tImOEnALhdzh/7SNR24q+7PhKfItBGqOf4x7DjUM855Qyrr4LO4F98Pum94cy0Rt90eQsx3Hmnrcvk0y6lzpn5t8yCNyz/iMkk/mqTD4YT8abDR1hA4h1292cd2ppb+3++x4evtjhM7foPUEsDBBQAAAAIAAAAIQCWFrgr0gIAAIgLAAARAAAAd29yZC9kb2N1bWVudC54bWyllt1u2yAUx+8n7R0s7huM7TiJVbfSmq3qxaRq3R6AALFRDVhA4mRPP2HHH5unKnaugONzfvw5B458/3gShXdk2nAlU4AWPvCYJIpymaXg189vd2vgGYslxYWSLAVnZsDjw+dP91VCFTkIJq13EoU0SVWSFOTWlgmEhuRMYLMQnGhl1N4uiBJQ7fecMFgpTWHgI7+elVoRZgyX2ROWR2zABUdO19GoxhWXmQNGkORYW3bqGWgyZAk3cD0GBTNAyIcBGqPCyagYOlUjUDQLhPwxaTmP9J/DxfNIwZi0mkcKx6T1PNLoOonxBVclkydR7JUW2JqF0hkUWL8fyjuiRIkt3/GC2zMMfD9uMZjL9xmKuHzvCCKkkwkrKBRlRUhbikrBQcvkEn/XxTvpSRN/GboIVly3beCjDWQnWxjbxuprcteEby+Npc4a1KzAlitpcl523UHMpQls8xZy/CgBR1GArrOh6LbWtm3K0AOvkX+pnSga5R8TkX9FNR2ii7hGwt97tkoE5rLfeFZqBslFy2mAYASICTtNY6wvDEj61+04nE7jxB2H0wFnnpgBgB4mIYKw1eEGFz5gGWppPg3X1gi6WGxxjk0+JLJpB1x2uLMY5LvMbntUz1odyp7Gb6O99O21ktMO6Mf/VrA0t4l5y3HJgCdI8pJJpfGuYCmoUORVaOnVFfCa6+oGr3kBXltrr75Anuta4OG+SnaKnt1YehWKkhJr/EJTEKFNHMUrBGqrZSfrrH603KxXmyXwqkQbTn+kwPeDMNyuvnSmV+2MIfKjp6+dccv2+FDYsfvrwBk6GYYR+6qv5dfCs7ffXuU6FgqCyHeOeQrQch35DbLMvmNHtKpMAYoaF82z3PbLnbJWiX5dsP3ga84wZToFq6Be7pWyg2V2sPXysh1RhfGqxJSYsManNlNFnrUrSVJwyV65JXkKwrj+Cttz19OmIrD/hX74A1BLAwQUAAAACAAAACEAyudliigEAAC+DAAAEQAAAHdvcmQvc2V0dGluZ3MueG1stVfbbttGEH0v0H8g+FxZXF4kmTAd6No4sJoictDnFTmUFt4LMbs0rRT994KXldSaCKQEfuLynJkzs5eZJe8+vAruvABqpmTikhvPdUCmKmNyl7hfn1aDietoQ2VGuZKQuAfQ7of7X3+5q2INxjC5086r4FLHIk3cvTFFPBzqdA+C6htVgHwVPFcoqNE3CndDQfG5LAapEgU1bMs4M4eh73kjt5NRiVuijDuJgWApKq1yU7vEKs9ZCt3DeuAlcVuXhUpLAdI0EYcInBqmpN6zQls18aNqgpq9FXn53iReBLd2FfEumG6lMDt6XJJe7VCgSkFrJneC2wSZPAUO3wgdY9+kSnRTbKSGvke8ZnSeeXSdgP9GYJTC63Uak05jmMLruQ7LrtMZHXVYdqbzY8mcCWTlVRJ+YPOoH7X7mZbOTLa/Ts7u0bD2pYbuqd6fK8J1E4yOcgdxWm/NLzmBLfXItkjxcH78RBo/7KRCuuWQuBUJnYpETpOd025l/XDa0+HYdXCaxXXv76r4m1LCqeICMAVpEpf4njusiQKVyjeGGnCqWBfAedPDUg5Uuk4V75AKQdEijU8GOS25eaLbjVGFU8UvlCfu2Eqme4o0NYCbgqZM7uZKGlTc2mXqD2XmShQIWnceTV87jTZtj3SqWFIBifufvrdWGdSZlcgu3xnXRifRecj/B1IvgMgyeKoXemMOHFZKmg37BlOZfSq1YTlLm+73Exl8LwGQdeTPBcinQwEroKZE0O8UrNmJFWfFmiEqfJAZSPNuwVieA4I0jBpYl9wwVFWzzh+BZoDvFbfU8JfCzPdI8IQ0fZ4pY5T4eCj2IH9yJ5vzPjw/vqhZpu3gi1LmaOr5QbAYz9pMa/YSJiBeOF/2MiNvRfp9pmHgBb3MnCxI2M9Ek9m8jwlvwxGZ9jGjyF+GUR8znfmTYNLHzGZkHPUy83kwD1a9zNJb9M9nOffH497cVre+d7vsdqfbExHXnxp/oh3Vhe2I1mNOxRYZddb1x8iwttji84xJy28hVwjnzKbcWnIwaAktKOcrpKklvBbPmC4WkDdjvqa4O+l2FtiLZpB/OmrVXRvwd1Rl0bIV0qItWGtCwrDzZNI8MmFxXW431ktSPJxRpcw+v2CzTqflqWKzB9E0vkfaFFJjC3LwddMVGsdNXSSwpkXR1tp2RxKXs93ekLo8DEncjOJz87Ld+R3nN5zfcs0LTeuZkcTtBifMt9iZXWCx4ISFFgtPWGSx6ISNLDaqsf2hAORMPifucVjjueJcVZB9PPFvIHsJpkxQvjmI7eluu2k5zrTZQEGRGoWW+63hSBhnKn2o7+uwxYPpNFpMvXFLR831aZpWxeTuC+QzqiHrOOsata5/j0beiJD5ZBBOlreD5TgMBxMyux2Mx96YBCviBxPvn64O7I/H/b9QSwMEFAAAAAgAAAAhANuFbMNjBAAAlx0AABIAAAB3b3JkL251bWJlcmluZy54bWzNmctu4zYUhvcF+g6CgC5jkbrbiDJIMkmRwXRQdFJ0TUu0RYQXgaR82c7L9BH6WPMKBWVLdiJPKslO45USkufT4c9zpD/K5YcVo9YCS0UET2w4AraFeSoywueJ/efj/UVsW0ojniEqOE7sNVb2h6uff7pcTnjJplgSPrdWjHI1WRZpYudaFxPHUWmOGVIjRlIplJjpUSqYI2YzkmJnKWTmuACC6qdCihQrRfj8FvEFUvYWl6660TKJloTPDdB30hxJjVc7BuwNCZyxE7dB7gAQBI4L2yivNyp0TFYtkD8IBEGbFAwjHdhcOIzktknRMJLXJsXDSK1yYu0CFwXmK0ZnQjKk1UjIucOQfCqLi1SwAmkyJZToteMCENYYRPjTgIwIf2oIzMt6EyKHiQxTL6spIrFLySfb+Ism3qQ+2cRvL00Ept1u6wI4dvBKU6XrWNlFu034R5GWDHNdqeZITJEmgqucFM3TgQ2lMaTzGrJ4TYAFo3bzZIP+cY+2j5tj2AG7pL89O0Y3mb9OhKDDaRpEE9Elhef3rDNhiPDdjQdJsycuDPoB3BYgTPGqHyPeMpx0192GQ7J+nLDhkGyPMyyZPUBW9kK4Xp2HuZjwPZbKdJb3w9Vn5JhYpFGOVL5PxP02GDS4NdvTu5gf11S/SlEWOxo5jvawe7wueb8NgvDlCRbquGS+5qjAtsXSycOcC4mmFCf2EvrWEgZWdQLWplzNxdp0gFWftVUVkGWeWvbV5XKCpkpLlOovJbOe/faQJTawDXMisdJImsGNp7ueaSxvJEZPZomhcGXuNlkgmtgwhG54AyLbMTOspJp8xgtMH9cFrtfk66kk2W9mjpq5zVrNClqvCODdrX8H4s0MXZgJQhd0k9REFzRNbOCDMQAAVjlUOTZJbOJ4ye5ZMzgtKcW6IT7iVTP1/ds/zfintB6leLZdXvwuzYVws00znNiRW2WSIz6vDLEXArPWaRbL7eVecK2MuColJLG/rtlU0Cr0mqvnA4TrxM7wDJVUb2EVxakSe6kEbCnhVSOYa6TJApsVRysj+uoCfX+YMLeilARL6wte7qnzYjRV7YX9VHNbqgWnV+37t7/76ubCcJhufxE+N3+TqT3Vno/1E8g70GBvIFDvhnPj+L07zj/LjvNCcNYdF5xpx/meex4dF55pxwXAf++Oi86y44IoPOuOi8+040I/fq+Oc5652/+0vnCI9Q3iCEDv5vo463t3F/owuvW7WN/7jseY4ZQwRA+e4y9wdGLv29GuwvHAoqRiieVnrDWWh3fkjk7tWjt6SXhzzJb+EAzxwzvyDu1Iknnew1DCuMOWvAM1NmxLr9acPzq1/evo2N6u6ILRqY1bRzv1ZkUX9i+6lqfqVHTh/1N00ejUDqijaXm7ootHp/YuHR3FmxXduH/RtWzFD4qu7QF49e7ne+988+FskpXVZ7VqEADoR+PQffm57KF57df34geY7iGmHwcBjHwIf8yE+0xn7x+qV/8CUEsDBBQAAAAIAAAAIQC+fnZiWAEAANADAAAUAAAAd29yZC93ZWJTZXR0aW5ncy54bWyd019LwzAQAPB3we8Q8r6lnduQsm4gMvFFBPUDZOmtDeZyJclM56eXdn+s7GX16ULgftwfbrFq0LAvcF6TzXk6TjgDq6jQtsz5x/t6dM+ZD9IW0pCFnO/B89Xy9mYRswibNwhB29KzBo31GaqcVyHUmRBeVYDSj6kG26DZkkMZ/JhcKVC6z109UoS1DHqjjQ57MUmSOT8y7hqFtlut4JHUDsGGLl84MDJosr7StT9p8RotkitqRwq817ZEc/BQantm0ukFhFo58rQNY0V4rKijxCRJk+6F5heYDQMmF8BcQTPMuD8aQkHTd3QxzJmfHV30nP8V0wOK3SBicneqow1tes/yRSiqYdxpR6LNlUFW0ld9EYY1ODtze2znjSp7Li05uTGQ85hOWUxnrIPZYQttYIfFslMLrJsLXy5iRnXQqL9hTe7BUfTgRPstjaH4+vIklgvx5w6XP1BLAwQUAAAACAAAACEAP6/hZjkOAAANpgAADwAAAHdvcmQvc3R5bGVzLnhtbO1dXXPiOBZ936r9Dy6eZh66AUk2kBp6Kkl3b7o2/TFDeudZ2AI0sSXWFk0yv35L/gCDLbDRhUl3baUqCcb3SNa551q6sqVffn2KQucbixMuxbjTf93rOEz4MuBiPu58fXj/athxEkVFQEMp2LjzzJLOr2/++Y9f1leJeg5Z4jxFoUiuIn/cWSi1vOp2E3/BIpq8lksmnqJwJuOIquS1jOfdiMaPq+UrX0ZLqviUh1w9d1Gv53VymLgJipzNuM/eSn8VMaFS+27MQqq4FMmCL5MCbd0EbS3jYBlLnyUJF/MozPAiysUGpk8qQBH3Y5nImXrtyyivUQrVRb1+L/0vCrcAbjsAVAHwfPbUDmOYY3R99lTG4UE7HG+Dw4MSzmmVKQEEq1YQCBf10H+0eQkrCVSwaAdXcNTVtlTRBU0WZUTW7gLdDdxzpNs78q8+zIWM6TRk4866T5x133VSYCdjQf9xMmKd4hKctF06b35ZXwXSf8tmdBWqRH+Mv8T5x/xT+ue9FCpx1lc08Tkfd65jTsOOs75iNFHXCacPCxaxcSfiQsZ31yLh+suF/qd0sp+MOw88Yonzia2d32VEhfPTjQyendvJz52uLuiRxcJZX32j4biDskPJX5sDpDhym+wfC6mYF8eYePV1Uq5d6dCUB3zcofGryXVq2CdXIZ9TtYpZ4uhPKUIWiOLgVgrFntSKhvrkbt4e3f1WWm4+ZWftNWlIFRNqkkWx9VXAZvfSf2TBRFHFxp1eJzv49cOXmMuYq+dxZzTKD05YxO94EDBROlEseMD+WDDxNWHB9vhv79Nokx/w5UqocQcPvJTmMAnePflsqWOXs74SVPP1SRuk3Kz4tvDU/L8FWD9v4Dr7BaM6gDv9fYhRawikLZLS1dZjrvauvd+6IHypgsilCnIvVZB3qYIGlypoeKmCRucuiIuAPWVCrBZTQT2Gg4BwMBAOAcJxgXA8IJwBEM4QCGdkjaOkb/LCkrPj0Sm46Ey4+Ey45Ey47plwvTPhDs6EOzwT7ugMuFlXy/kgAiaUtcpmUiohFXN099QajQohVTqqhcHTNz0Wg1wkAEwW2fIbsTWaT9PPxz3EtbufKz2gc+TMmfG5HpxYV5yJbyyUS+bQIIhZAggYM7WKBZxPx2zGYiZ8BunYcKAhF8wRq2gK4JtLOgfDYiIAbr4CESQobByartRCi4QDOHVE/VgC9FkoWHy454kCAXFuVmHIgLA+wbhYioVgYDAMDIGBcSE5g2qiHA2DohFQNBfSP6HaLUfDoGgEFM2+3R64Ctl+r6PfPHd3G8oEIuBN+Fyk+VNrpDxn6nyhMZ3HdLlwdNr5aE+rdTlpyvkB4p62QYLq16cuorPOXKwYLBqUuDZ4GBiPAOPZS+wjSxLdQbuDGc9MVlNVK9rmo4IJDVdZh9ZebVQxQAG853ECJoN6WAAP/qS7s3dAXb1tLREgFgaPSqDVyyEBahlK/xEmDN89L1kccvFojfRehqFcswAOcaJimflaWfIINZb8u2i5oAlPKhDNb/XFEwzOR7q0vqAvIeUChrd3ryLKQweuB3H38PHeeZBLPczUDQMDeCOVkhEYZp4J/OkPNv0ZpoLXfizFM9DVXgOlh1KwW66AWL2VARDSWzbjgoPcQ1O8f7PnqaRxAIP2JWbZQ0OKASFOaLQMobT1vGTrmEOkZVO8/9CY67wQlKgeQMBKacNkNf2T+Qqgfg5IZujzSqX5x7Sr24eFQ7Bw9l2ElE1nwrX/AlzsDhyChYO62NuQJgn3wa62wEPAeNDXS6DwZCjj2SqEa8ACEEEDYjjAVSQSyCtO8RAwHvT1EmA8FwjvXzEPwMhIwRAkGIYEI5BgoAR4kGADSLAhEBhQF6AEhiDBMCQYgQRzIcE8SLABJBiUn+G3DpvNmK/gbjElSAQPCXejEYpFSxnT+BkI8l3I5hQgQZqhfYnlTL9NIkX2EDdEd3Y1VZCd7QwOiuQ/2BSsahoLsl4AGVEahlIC5da2N5yaZ9eOmaWvc0BkCn22kGHAYsM1HRwvT5bU59XUafPJkns+Xyhnsthk+8swXu+oZTFg3zE7XmBdm3vo4DRTwFdRUdHqyxQebm6MKsbkuPG2J7Fj6Ta0rJbpHbfc9pJ3LAcNLatlDhta4orl6OAsWfxY6wiDQ/6zGeMZnG/Qb2JcWyxqYlnnggPcVCrOte/r2YL+iZox2zcTj9m+jYrMKG3kZEZprCszxCGB/c6+8aQ2R31k/nvz9EQl7pPGkfO3lVSVaWrU/KWuD0IxkTCnFgc3n7jaiTLmdmwcbswQjeOOGaJxADJDNIpERvNWIcmM0jg2mSEaBykzROtohSyjFbKMVggkWiGQaIXsoxU6vTtghmgtVGQvVGQvVGQnVAQiVGQvVGQvVGQvVGwpVGwpVAwiVAwiVGwvVGwvVGwvVGwvVGwvVGwnVAwiVGwvVGwvVGwvVGIpVGIpVAIiVAIiVGIvVGIvVGIvVGIvVGIvVGInVAIiVGIvVGIvVGIvVNdSqK6lUF0QobogQnXtheraC9W1F6prL1TXXqiunVBdEKG69kJ17YXq2gvVsxSqZylUD0SoHohQPXuhevZC9eyF6tkL1bMXqmcnVA9EqJ69UD17oXqthJpPUZoes++3z3oan9hv8Z5PVqnfy69y7+RQ+61rZcZq/i7CjZSPTu2Lhxg3B+HTkMs0Rf18fBmFQeuJz8+3h9/wabCMR9NLyd+FSOdMK+CkqWUlp0JQQ8vKII/ghpaVXichDS0rt0FyKOimuiweSpkvKvNZpNfMuG8w95qZV5t40Myw2sLDZobVBh41M3QdHZz3rd2G7eRtni+tIPSbIQzMCKgVV8bcfmPSzAhN2TMjNKXRjNCKTyNMe2LNUK0ZNkOdRjWyphpZU42sqUYwVCM4qhEc1QiIamxNNbamGltTjWGoxnBUYziqMRDVxJpqYk01saaawFBN4KgmcFQTIKpda6pda6pda6pdGKpdOKpdOKpdIKo9a6o9a6o9a6o9GKo9OKo9OKq9VlSnWZTTR0sl83adsJJhuxtyybBdcC4ZnjBaKlmfOFoqIZw4WqpyddpoqUzaaaOlMnunjZbKNJ42WqrwedpoqZbY00ZLtQyfNloyU42sqUbWVCNrqhEM1QiOagRHNQKiGltTja2pxtZUYxiqMRzVGI5qDEQ1saaaWFNNrKkmMFQTOKoJHNUEiGrXmmrXmmrXmmoXhmoXjmoXjmoXiGrPmmrPmmrPmmoPhmoPjmoPjup2o6WPTIAsATWJaKwcuPXi7miyUNR+ccKvImaJDL+xwIG91PtWV9nd3f7qTbGdn7O+Us/LdAX00utKQbYCbA6Ynvgh2GxTpY11TYp9vvLDaYXz6dqsxNTwSFEb8HyuuF+B325ulZYwpQkLPou6woVeGLHmuHaI4nhRzO2Cxtm3W1ctzhntX8v6Kk70Bm7Z170ewvjt4CY7a5ltzfbI2PITe1Ld4sM9FyzJ9knLXqDVu57pNcXYuIO99N0rOlMsHneGuWpltmrT/bdwU1JOXV5G7S5wxZZv9M/Slm/7+8HpL9/lxzZbwtVa+okqHb7hAc8q52uVb+r1ngy81DfSk9MIMO7QVP/bw/qhFP2cwfv9DeSKyebyBnKkt7e12ynOg4zOgyCdBzVwnq0ss/N2RHlm9+o3dK/+j+leGFXdKztm6V7Y6F4Y0r3wD+Je6LB7HXOiS7gKGtZsZTkEcBVidBUC6SrkhbvKsOwpxOgp+DyewrPftwmI31h6hGv0CBfSI9wfwyPIy4wdlj7gGX3Ag/QB74X7gJl29+KBwB3pn30n0DstbV3ggesdfK89AA8YGD1gAOkBg+/WA7wLCP/CnA+NnA8hOR++KM6rzA4urm000D9NeH4L0ecbGXkeQfI8euE8Dy+gYHhm/QWNqZ8vqG7If+UbI21W9km3Rdrn3LB7koGvfjO+zPVWxUrrhjqnWdqDibt8sXaTQzX2KDUNM6rVNPwgtEOt8z3ss5oGT7RTnHjLwvAjzc6WS/OpIZup7Nt+b1jz/TTbEsJoH6dzB0aA7m5lupuLMLd3tklk/lKLMU+aLhlWbe5sKTHLlm7ow/4qUTJK07379dvJge7X8q5ItzrbOLMXuGp1YMy0HglV5uDz/3Rna0rRQUoREKWo3d3nx2fYJuPYkmF8kGEMxDA+F8Pfe9KvJVvkIFsEiC3y0ti6dOKtJSvuQVZcIFbcH01D4Dx4B3nwgHjwviN1wGcmWlIyOEjJAIiSwYuWxt9OwvAgCUMgEobfkS7OPN4/TsnoICUjIEpGL1oXl0qnZQtb7Ld1dhQij5YiHUqi9XsnPAC0TXLvTYz7evuKJ7WiYb6S/ot56GJb5fSyXhXX/chiUe0sb8KjV+0+u8CBcEtRrRvYyq3kS2b2X+aw9fKc1Yt0s4n2PkGbLyCkWoAdVGv/BLWKVZT9w8Pq81CbLyua7nu9Fzg/VfGKvvt3jHl3yDK5ha10d93L7A0vvM94ZsrqNZttA7DPTHYUQq0p0iGpopHVjbX+AbR+sXjfn36BowexLK5V6oFOJunpnyYcQo+Htw1XS46tZkoMmzk5KpiLtly9A+vpk+2+GvtttbftxjGPrjYFJie4J0+nuvRElV4jr0Gfr6G7bC46Xzhus5rd/mVXlrtr5yg1HtHqhnrcOy74nFXeFvWBbnc3FIiAVy7uUNzDpwwoljdBaYI0PS/hYp7vq/2XfkbOyaIjSzutTt7sJ+bHN1OpZy6pu72yYy9G4CKylzU29NLapDO72SeQ4P+35kMrfnTQdW1vBzsiOeKxL073B2Pkdm1NUwNuz7CNksWcX6soOc1KzVsriWgY3tJlAjXFtduldOtbtPgvefM/UEsDBBQAAAAIAAAAIQAAAAAAAgAAAAAAAAALAAAAd29yZC90aGVtZS8DAFBLAwQUAAAACAAAACEAZ4D8tJEGAADNIAAAFQAAAHdvcmQvdGhlbWUvdGhlbWUxLnhtbO1Zz4/bNha+L9D/gdDd0Q9LsjSIpvDPpslMEmQmWfT4RqIlxhQpkPTMGEWAIj3tZYEFukUvBXrroVhsgS3Qopf+MQEa7Hb/iIVkjy3adJO0k90AO/bBJvV9j5/eeyQfyNvvX5YUnWMhCWeJ5d5yLIRZyjPC8sR6fDrpRBaSClgGlDOcWAssrfcP3/vDbThQBS4xuiwpkweQWIVS1YFty7TAJchbvMLssqRTLkpQ8hYXuZ0JuCAsL6ntOU5ol0CYhRiUOLEeTKckxei0NmkdXhkfU1xipmTdkVJxkjYjthkNNpu59Y9cyCEV6BxoYl0QlvGLU3ypLERBqiEVieU0H8s+vG2vSVTt4bZ4k+az4q0I2cxreCI/WxOdsRf57tq+t7S/ixtH9XdtrwFAmmK20tLGukHoRN4K2wIt/xpsxz23q+Nb9ru79uNw4PkavrvB+7vvOInHo0DD+xt8sIPvO94g7mr4YIMPd/D+uN/zxhq+ARWUsNkuOuxFUbhCryFTTu8Y4XEYOr3RCr5B2a3sWvKZ2pdrJTzlYsKZaoILijCkFhWeQooTq18pLtGIyIrCwkIVMC5xYjme6zqO4zve+tt4HA4wtNjLrlTudNV6kEwFqVRi3a2AWS3Izz/88OL5dy+ef//i009fPP87OiJ5oQy8O8DyNu+Xr//y7y8/Qf/6x1e/fPZXM1628S//9qeXP/70a+aVJuvzb19+9+3PX/z5n998ZoD3BZy14aekxBLdxxfoES+BmQbAZ+LNGKcFkDajz3IJDGqOAT1WhYa+vwAKBtwA6358IgjLTMAP5k81wSeFmCtiAN4rSg14zDkdcGF8p3v1WG0vzFluHlzM27hHAOemsYdbUR7PqwKXxGRyWGBN5kMKTEGOGVaofsZnGBtoHxGi+fWYpIJLPlXoI4IGQIwuOSVnyky6Q0qgsABzvDXfHD9BA05N5kf4XEcCy4GaTGKqufEDmCsojYqhpG3kEajCJPJkIVLN4VIJYDmmHI0zLKWJ80AsNLn3gBJz2I/potSRQpGZCXkEnLeRIz4bFlBWRs2EFW3sh3LGOQX0kCujCK7PkLrNKQG2N9xPCFZvNrcfk7wwJ0j9ZC5MUwJzfT4u6BQwMy5OpbbE9gUxZsdgnmupfYQxhQvIMEaPPzThecXNou8WmOV3sMk3d0HP1brNsMSoKW4MgSVSS9kTnPM9eo4XWwvPAlgJYp/l+zM9ZcZngpTGfKXpTFtKiagnrVnEA1nCa1l9WICWVnVbVnvmGHvTOXayEE9/Awe/MYcLeG3fnALF5oQ5BYKOsJkyN1Pq6dTQ5kbeVJ+0mzDYW0VPSdgrKqD/TeXz1mqe66929i0o2zXOPtx2ZTPkIiPvfmEzgjl7iFlxU9fc1DX/l3XNvvl8U83cVDM31cx/rZrZFDB2+7CnsVLuPfmZEkpP1ILiI9mUPpJTkk0IpU2jIa0PmqpiSMVqOA2XC2j+I8HVH4kqTgqocGK5zQi5XJnOJaq4TCzH2mu7Kb7m5THPVud47tXZJhxIUJt+J1j3K8LUsjfsbQ5C1+abVi7bAoLG6OuLaA2mi+gaRPS6ryfCda5LRWxQEbm/psJuRYUShqA+Fg/8pSIkU6A4q+O05F9F99ojvc+Z+mt7hteL/WuLtCailW66iFYaFpDh7e5rjnUcm0PtGWX0orcRa3t3baBMb6GLxAq7gWOhFKrEmlJQFkrLKkssWa9UQHOWWKlaOfq3rCyVkGoEsljCmkfL9y+JwgJRUiZW1A4DZRttrtdz3l1xsfPuec7eDjKeTnGq9vRsmkdSLY0Yn/5OcN3gc4XFSZFdoDM6F48gS6yg59YOzIhUa29mRLSSe+PFreVqNRW1G6DNFAVaFbDaUdqL+RLe/F/Lab1Ho3T7rWyTC8/yyXXsuq8mbS2aezaQ3t5V7O1t8i1VXbOqwLjWxdErdonfvyG0pEVmaV2ztH17xzUWBK3hwu4r9ojr3g22s9Zu1ZVNa+dym589xaka4SnMqZLLA7JLJWB4dS25XAma3qvV5VKhuSCJ9bET9P2hFww7ThSMO37XdzpR0O92+kHQdceB64wG3jPr8LYqSjdYjj2BktDF6u6+6d+5vy+vSu1bKS9t3tTBdkNu7u9db//9PSJZYn0cepO4Gw/CTtztTzr+aBB14mE46IzCYW80GQ2DKJ48s9B5A/b73aEfjqNO6A6HHT90avlR3On5ntf3e/1o7PefrXyNL9XV75V7G12H/wFQSwMEFAAAAAgAAAAhAAAAAAACAAAAAAAAAAsAAAB3b3JkL19yZWxzLwMAUEsDBBQAAAAIAAAAIQCzvosd/gAAALYDAAAcAAAAd29yZC9fcmVscy9kb2N1bWVudC54bWwucmVsc63TsU7DMBAG4B2Jd7BuJ04KVAg16YKQukJ4ACe5OBb2ObKvkLw9UlHbVFQRQ8b7h///BnuzHZwVXxii8ZRDlqQgkGrfGNI5fJSvd08gIitqlPWEOYwYYVvc3mze0Co2nmJn+igGZynm0DH3z1LGukOnYuJ7pMHZ1genOCY+aNmr+lNplKs0Xcsw7YDiolPsmhzCrrkHUY49/qfbt62p8cXXe4fEVyZkRGZDOoIoVdDIORyTZHAW5HXCalECjxangMM9N58tOU97V2EwpM+CUzSHWC+J4A4dngGH8zfM5gyPSxpaT1yqyk4cp2gO8bAk4hur9z9PchIeIfLitxU/UEsBAhQAFAAAAAgAAAAhADKRb1dfAQAApQUAABMAAAAAAAAAAAAAAAAAAAAAAFtDb250ZW50X1R5cGVzXS54bWxQSwECFAAUAAAACAAAACEAAAAAAAIAAAAAAAAACQAAAAAAAAAAAAAAAACQAQAAZG9jUHJvcHMvUEsBAhQAFAAAAAgAAAAhAIahqRJuAQAAzQIAABAAAAAAAAAAAAAAAAAAuQEAAGRvY1Byb3BzL2FwcC54bWxQSwECFAAUAAAACAAAACEAhRXCKnABAAD7AgAAEQAAAAAAAAAAAAAAAABVAwAAZG9jUHJvcHMvY29yZS54bWxQSwECFAAUAAAACAAAACEAAAAAAAIAAAAAAAAABgAAAAAAAAAAAAAAAAD0BAAAX3JlbHMvUEsBAhQAFAAAAAgAAAAhAB6RGrfpAAAATgIAAAsAAAAAAAAAAAAAAAAAGgUAAF9yZWxzLy5yZWxzUEsBAhQAFAAAAAgAAAAhAAAAAAACAAAAAAAAAAUAAAAAAAAAAAAAAAAALAYAAHdvcmQvUEsBAhQAFAAAAAgAAAAhAOxw0GITAgAAtAcAABIAAAAAAAAAAAAAAAAAUQYAAHdvcmQvZm9udFRhYmxlLnhtbFBLAQIUABQAAAAIAAAAIQCWFrgr0gIAAIgLAAARAAAAAAAAAAAAAAAAAJQIAAB3b3JkL2RvY3VtZW50LnhtbFBLAQIUABQAAAAIAAAAIQDK52WKKAQAAL4MAAARAAAAAAAAAAAAAAAAAJULAAB3b3JkL3NldHRpbmdzLnhtbFBLAQIUABQAAAAIAAAAIQDbhWzDYwQAAJcdAAASAAAAAAAAAAAAAAAAAOwPAAB3b3JkL251bWJlcmluZy54bWxQSwECFAAUAAAACAAAACEAvn52YlgBAADQAwAAFAAAAAAAAAAAAAAAAAB/FAAAd29yZC93ZWJTZXR0aW5ncy54bWxQSwECFAAUAAAACAAAACEAP6/hZjkOAAANpgAADwAAAAAAAAAAAAAAAAAJFgAAd29yZC9zdHlsZXMueG1sUEsBAhQAFAAAAAgAAAAhAAAAAAACAAAAAAAAAAsAAAAAAAAAAAAAAAAAbyQAAHdvcmQvdGhlbWUvUEsBAhQAFAAAAAgAAAAhAGeA/LSRBgAAzSAAABUAAAAAAAAAAAAAAAAAmiQAAHdvcmQvdGhlbWUvdGhlbWUxLnhtbFBLAQIUABQAAAAIAAAAIQAAAAAAAgAAAAAAAAALAAAAAAAAAAAAAAAAAF4rAAB3b3JkL19yZWxzL1BLAQIUABQAAAAIAAAAIQCzvosd/gAAALYDAAAcAAAAAAAAAAAAAAAAAIkrAAB3b3JkL19yZWxzL2RvY3VtZW50LnhtbC5yZWxzUEsFBgAAAAARABEAEQQAAMEsAAAAAA==";Ft();var mS="in",Uu=mk("superdoc",()=>{const e=re(null);let t=null;const n=Us(),r=re([]),o=re([]),i=no({}),s=re([]),a=re(100),l=re("manual"),u=re(mS),d=re(null),f=re(!1),p=re(!1),g=re([]),m=no({name:null,email:null}),v=no({}),k=re(null),b=re({left:0,top:0,width:0,height:0,source:null}),S=()=>{r.value=[],o.value=[],Object.assign(i,{}),s.value=[],f.value=!1,m.name=null,m.email=null,Object.assign(v,{}),k.value=null,u.value=mS},C=no({scrollTop:0,scrollLeft:0}),w=$=>{t=typeof $=="function"?$:null},T=$=>{const H=t||e.value?.onException;typeof H=="function"&&H($)},L=async $=>{if(S(),e.value=$,$.zoom?.initial!==void 0){const ue=$.zoom.initial;typeof ue=="number"&&Number.isFinite(ue)&&ue>0?a.value=ue:console.warn("[SuperDoc] zoom.initial expects a positive number representing percentage")}if($.zoom?.mode!==void 0){const ue=$.zoom.mode;ue==="manual"||ue==="fit-width"?l.value=ue:console.warn("[SuperDoc] zoom.mode expects 'manual' or 'fit-width'")}if($.measurementUnit!==void 0){const ue=$.measurementUnit;ue==="in"||ue==="cm"?u.value=ue:console.warn("[SuperDoc] measurementUnit expects 'in' or 'cm'")}const{documents:H,modules:J,user:Q,users:Y}=$;if(s.value=Y||[],Object.assign(m,Q),Object.assign(v,J),Object.prototype.hasOwnProperty.call(v,"comments")||(v.comments={}),!H?.length&&!$.modules.collaboration){const ue=await Uy(pS,"blank.docx",Sr),ve={id:ol(),type:Sr,data:ue,name:"blank.docx",isNewFile:!0};$.html&&(ve.html=$.html),$.markdown&&(ve.markdown=$.markdown),H.push(ve)}const _e=H?.length===1&&H[0]&&H[0].fieldContext===void 0?[{...H[0],fieldContext:$.fieldContext}]:H;await z(_e),f.value=!0},z=async($=[])=>{if(!$)return[];for(let H of $){if(!H){T({error:new Error("Received empty document entry during initialization."),stage:"document-init",document:H}),console.warn("[superdoc] Skipping empty document entry.");continue}try{let J=await V(H);if(!J){T({error:new Error("Document could not be initialized with the provided configuration."),stage:"document-init",document:H}),console.warn("[superdoc] Skipping document due to invalid configuration:",H);continue}const Q=g7(J,e.value);r.value.push(Q)}catch(J){T({error:J,stage:"document-init",document:H}),console.warn("[superdoc] Error initializing document:",H,"with error:",J,"Skipping document.")}}},W=($,H,J)=>new File([$],H,{type:J}),V=async $=>{if($=Jy($),e.value?.html&&($.html=e.value.html),!$.data&&$.url&&!$.type&&($.type=Sr),e.value?.modules.collaboration&&!$.isNewFile)return{...$,data:null,url:null};if($.data instanceof File){let H=$.name;const J=$.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?".docx":$.type==="application/pdf"?".pdf":".bin";if(H?H.includes(".")||(H=`${H}${J}`):H=`document${J}`,$.data.name!==H){const Q=W($.data,H,$.data.type||$.type);return{...$,name:H,data:Q}}return $.name?$:{...$,name:H}}else if($.data instanceof Blob){let H=$.name;H||(H=`document${$.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?".docx":$.type==="application/pdf"?".pdf":".bin"}`);const J=W($.data,H,$.data.type||$.type);return{...$,data:J}}else{if($.data)return $;if($.url&&$.type){$.type.toLowerCase()==="docx"?$.type=Sr:$.type.toLowerCase()==="pdf"&&($.type=Ea);try{const H=await Uy($.url,$.name||"document",$.type);return{...$,data:H}}catch(H){const J=H instanceof Error?H.message:String(H);throw console.debug("[SuperDoc] Failed to fetch document from URL:",J),H}}}return null},j=ke(()=>{for(let $ of r.value.filter(H=>H.type==="pdf"))if(!$.isReady)return!1;return!0}),Z=$=>r.value.find(H=>H.id===$);return{commentsStore:n,documents:r,documentBounds:o,pages:i,documentUsers:s,users:g,activeZoom:a,zoomMode:l,measurementUnit:u,viewportMetrics:d,documentScroll:C,isInternal:p,selectionPosition:b,activeSelection:k,isReady:f,user:m,modules:v,areDocumentsReady:j,init:L,setExceptionHandler:w,reset:S,handlePageReady:($,H,J)=>{i[$]||(i[$]=[]),i[$].push({page:H,containerBounds:J});const Q=Z($);Q&&Q.pageContainers.push({page:H,containerBounds:J})},getDocument:Z,removeDocument:$=>{const H=$!=null?String($):null;if(!H)return null;const J=r.value.findIndex(_e=>String(_e?.id??"")===H);if(J===-1)return null;n.removeCommentsForDocument?.(H),k.value?.documentId!=null&&String(k.value.documentId)===H&&(k.value=null,b.value={left:0,top:0,width:0,height:0,source:null}),delete i[H];const[Q]=r.value.splice(J,1),Y=e.value?.documents;if(Array.isArray(Y)){const _e=Y.findIndex(ue=>String(ue?.id??"")===H);_e!==-1&&Y.splice(_e,1)}return Q??null},getPageBounds:($,H)=>{const J=i[$];if(!J)return;const Q=J.find(_e=>_e.page==H);if(!Q||!Q.container)return;const{height:Y}=Q.container.getBoundingClientRect();return{top:Y*(H-1)}}}}),v7=e=>{const t={trackInsert:"insertedMark",trackDelete:"deletionMark",trackFormat:"formatMark"},n=new Map;for(const o of e){const i=o.mark.attrs.id;n.has(i)||n.set(i,[]),n.get(i).push(o)}const r=[];for(const[,o]of n){if(o.length===1){const s=o[0],a=t[s.mark.type.name];r.push({from:s.from,to:s.to,[a]:s});continue}const i=new Set;for(let s=0;s<o.length;s++){if(i.has(s))continue;const a=o[s],l=t[a.mark.type.name],u=o[s+1];if(u&&!i.has(s+1)&&a.to===u.from&&a.mark.type.name!==u.mark.type.name){const f=t[u.mark.type.name];r.push({from:a.from,to:u.to,[l]:a,[f]:u}),i.add(s),i.add(s+1);continue}let d=!1;for(let f=s+1;f<o.length;f++){if(i.has(f))continue;const p=o[f];if(a.mark.type.name!==p.mark.type.name){const g=t[p.mark.type.name];r.push({from:Math.min(a.from,p.from),to:Math.max(a.to,p.to),[l]:a,[g]:p}),i.add(s),i.add(f),d=!0;break}}d||(r.push({from:a.from,to:a.to,[l]:a}),i.add(s))}}return r},y7="headerFooterPart",Z0=e=>Number.isFinite(e)?Number(e):null,b7=(e,t)=>`${e}::page:${t}`,w7=(e,t)=>{const n=String(e),r=String(t);return n===r||n.startsWith("tc::")&&n.endsWith(`::${r}`)},C7=e=>{if(!Array.isArray(e)||e.length===0)return null;let t=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,o=Number.NEGATIVE_INFINITY;return e.forEach(i=>{[i?.left,i?.top,i?.right,i?.bottom].every(Number.isFinite)&&(t=Math.min(t,i.left),n=Math.min(n,i.top),r=Math.max(r,i.right),o=Math.max(o,i.bottom))}),[t,n,r,o].every(Number.isFinite)?{left:t,top:n,right:r,bottom:o,width:r-t,height:o-n}:null},gS=e=>{const t=new Map;return(Array.isArray(e)?e:[]).forEach(n=>{const r=Z0(n?.pageIndex);if(r==null)return;const o=t.get(r);if(o){o.push(n);return}t.set(r,[n])}),[...t.entries()].sort((n,r)=>n[0]-r[0]).map(([n,r])=>({pageIndex:n,rects:r}))},k7=(e,t)=>!e?.trackedChange||e?.trackedChangeStory?.storyType!==y7?!1:gS(t?.rects).length>1,S7=e=>{const t=Number(e?.selection?.page);return!Number.isInteger(t)||t<1?null:t-1},_7=({id:e,threadId:t,comment:n,positionKey:r,positionEntry:o})=>{const i=Z0(o?.pageIndex),s=n?.trackedChange?null:S7(n);return{id:e,threadId:t,comment:n,positionKey:r,positionEntry:o??null,pageIndex:i??s,isPrimary:!0}},A7=({comment:e,positionKey:t,positionEntry:n,primaryInstanceId:r})=>{const o=gS(n?.rects);if(o.length<2)return[];const i=o.map(({pageIndex:l,rects:u})=>{const d=C7(u);return d?{pageIndex:l,rects:u,bounds:d}:null}).filter(Boolean);if(i.length<2)return[];const s=Z0(n?.pageIndex),a=i.some(({pageIndex:l})=>l===s)?s:i[0]?.pageIndex??null;return i.map(({pageIndex:l,rects:u,bounds:d})=>{const f=l===a;return{id:f?r:b7(r,l),threadId:e?.commentId??t,comment:e,positionKey:t,pageIndex:l,isPrimary:f,positionEntry:{...n,pageIndex:l,rects:u,bounds:d}}})},I7=({comment:e,positionKey:t,positionEntry:n,fallbackId:r})=>{const o=e?.trackedChange&&t&&r&&Array.isArray(e?.trackedChangePositionAliases)&&e.trackedChangePositionAliases.some(a=>w7(t,a)),i=e?.trackedChange&&e?.trackedChangeCanonicalId&&t&&r&&String(t)!==String(r),s=o||i?r:t??r;if(!s)return[];if(k7(e,n)&&t){const a=A7({comment:e,positionKey:t,positionEntry:n,primaryInstanceId:s});if(a.length>0)return a}return[_7({id:s,threadId:e?.commentId??r,comment:e,positionKey:t,positionEntry:n})]};Ft();var vS=()=>import("@superdoc/docx-engine"),Hu=null,um=null;function E7(e){if(typeof e!="function")throw new TypeError("SuperDoc: the DOCX Engine loader must be a function");if(Hu)throw new Error("SuperDoc: the DOCX Engine loader cannot change after loading has started");vS=e}async function T7(){if(!Hu){const e=Promise.resolve().then(()=>vS()).then(t=>{const n=t&&typeof t=="object"&&"createSuperDocV2Integration"in t?t.createSuperDocV2Integration:null;if(typeof n!="function")throw new TypeError("SuperDoc: the DOCX Engine module does not export createSuperDocV2Integration");um=n});Hu=e,e.catch(()=>{Hu===e&&(Hu=null,um=null)})}await Hu}async function x7(){try{await T7()}catch(e){console.error("[SuperDoc] DOCX Engine failed to load; using the stub.",e)}}var iK=1,R7="tc-comment:",M7="tc::body::";function dm(e){if(!e||typeof e!="object")return!1;const t=e.id??e.commentId;return typeof t!="string"?!1:t.startsWith(R7)}function $u(e){if(!e||e.trackedChange!==!0)return!1;const t=e.trackedChangeAnchorKey;return typeof t=="string"&&t.startsWith(M7)}function L7(){return{publish(){},recollect(){},reset(){},getLastEpoch(){return null},getLastPayload(){return null}}}function D7(){return{setContext(){},onCommittedPagePaint(){},refreshCommittedWindow(){},invalidate(){},beginMutation(){},settleMutation(){},reset(){},getSnapshot(){return null},subscribe(){return()=>{}},getDiagnostics(){return null}}}var O7=uc({name:"SuperDocV2IntegrationMissing",emits:["v2-editor-failed"],setup(e,{emit:t}){return Nn(()=>{t("v2-editor-failed",{reason:"v2-integration-unavailable",detail:"SuperDoc: the DOCX Engine runtime could not be constructed in this environment."})}),()=>zr("div",{class:"superdoc-v2-integration-missing"})}});function Q0(){return{version:1,capabilities:null,EditorComponent:O7,RulerComponent:null,createGeometryPublisher:L7,createReviewWindowController:D7,isSyntheticTrackedChangeCommentLaneItem:dm,isV2SyntheticTrackedChangeRow:$u}}function P7(){if(!um)return Q0();try{const e=Q0(),t=um();return!t||typeof t!="object"||!t.EditorComponent?e:{version:typeof t.version=="number"?t.version:e.version,capabilities:t.capabilities??e.capabilities,EditorComponent:t.EditorComponent,RulerComponent:t.RulerComponent??e.RulerComponent,createGeometryPublisher:t.createGeometryPublisher??e.createGeometryPublisher,createReviewWindowController:t.createReviewWindowController??e.createReviewWindowController,isSyntheticTrackedChangeCommentLaneItem:t.isSyntheticTrackedChangeCommentLaneItem??e.isSyntheticTrackedChangeCommentLaneItem,isV2SyntheticTrackedChangeRow:t.isV2SyntheticTrackedChangeRow??e.isV2SyntheticTrackedChangeRow}}catch(e){return console.error("[SuperDoc] DOCX Engine integration failed to construct; using the stub.",e),Q0()}}function F7(){return P7()}function yS(){try{const e=globalThis.__superdocInteractionTrace;return e&&typeof e=="object"?e:null}catch{return null}}function J0(e,t,n=void 0){try{const r=yS();return!r||typeof r.startSpan!="function"?null:r.startSpan(e,t,n)}catch{return null}}function Gu(e,t=void 0){if(e)try{const n=yS();if(!n||typeof n.endSpan!="function")return;n.endSpan(e,t)}catch{}}function Wu(e,t,n,r){const o=J0(e,t,n);if(!o)return r();try{const i=r();return i&&typeof i.then=="function"?i.then(s=>(Gu(o),s)).catch(s=>{throw Gu(o,{error:s instanceof Error?s.message:String(s)}),s}):(Gu(o),i)}catch(i){throw Gu(o,{error:i instanceof Error?i.message:String(i)}),i}}var N7=e=>!!e?.trackedChangeLink||!!e?.trackedChangeType||!!e?.trackedChangeDisplayType||!!e?.trackedChangeText||!!e?.deletedText||e?.trackedChange===!0,fm=e=>e?.trackedChangeThreadParentId!=null?e.trackedChangeThreadParentId:e?.trackedChangeParentId!=null&&N7(e)?e.trackedChangeParentId:null,B7=e=>e==="source"||e==="deleted"?"source":e==="destination"||e==="inserted"?"destination":null,z7=e=>e?.semanticColorKey==="move-from"?"source":e?.semanticColorKey==="move-to"?"destination":null,bS=e=>{const t=new Map,n=new Map,r=(i,s,a)=>{const l=i.get(s);l?l.push(a):i.set(s,[a])};for(const i of e)i?.trackedChange===!0&&(typeof i.commentId=="string"&&r(t,i.commentId,i),i.trackedChangeCanonicalId!=null&&r(n,String(i.trackedChangeCanonicalId),i));const o=new Map;for(const i of e){if(i?.trackedChange===!0)continue;const s=new Set([i.threadingParentCommentId,fm(i)].filter(f=>f!=null).map(f=>String(f)));if(s.size===0)continue;const a=new Set([...s].flatMap(f=>t.get(f)??[]));if(a.size===1){o.set(i,[...a][0]);continue}if(a.size>1)continue;const l=new Set([...s].flatMap(f=>n.get(f)??[]));if(l.size===1){o.set(i,[...l][0]);continue}const u=B7(i.trackedChangeSide);if(!u)continue;const d=[...l].filter(f=>z7(f)===u);d.length===1&&o.set(i,d[0])}return o},j7=(e,t=new Map)=>{const n=new Map,r=new Map,o=new Map,i=new Map,s=bS(e),a=(u,d,f)=>{const p=u.get(d);p?p.push(f):u.set(d,[f])};e.forEach((u,d)=>{i.set(u,d),a(o,u.commentId,u),new Set([u.parentCommentId,u.threadingParentCommentId].filter(p=>p!=null).map(p=>String(p))).forEach(p=>a(n,p,u));const f=s.get(u);f?.commentId!=null&&a(r,String(f.commentId),u)});const l=new Map;for(const u of e){if(!u?.trackedChange||u.commentId==null)continue;const d=u.commentId,f=new Set([d]),p=[],g=[];typeof d=="string"&&g.push(d);const m=g.flatMap(S=>[...n.get(S)??[],...r.get(S)??[]]);for(const S of m){const C=S.commentId;C===d||f.has(C)||(f.add(C),p.push(C))}for(let S=0;S<p.length;S+=1){const C=p[S];for(const w of typeof C=="string"?n.get(C)??[]:[]){const T=w.commentId;f.has(T)||(f.add(T),p.push(T))}}const v=[...f].flatMap(S=>o.get(S)??[]).sort((S,C)=>(i.get(S)??0)-(i.get(C)??0));v.sort((S,C)=>S===u?-1:C===u?1:Number(S.createdTime)-Number(C.createdTime));const k=t.get(d),b=k?.length===v.length&&v.every((S,C)=>k[C]===S)?k:v;l.set(d,b)}return l},V7=(e,t=new Map)=>{const n=new Map;for(const o of e){const i=new Set([o.parentCommentId,o.threadingParentCommentId,o.trackedChangeParentId,o.trackedChangeThreadParentId].filter(s=>s!=null).map(s=>String(s)));for(const s of i){const a=n.get(s);a?a.push(o):n.set(s,[o])}}const r=new Map;for(const[o,i]of n){const s=t.get(o);r.set(o,s?.length===i.length&&i.every((a,l)=>s[l]===a)?s:i)}return r};Ft();var wS=class{constructor(){throw new Error("SuperDoc v2 beta: v1 editor-backed comment import paths are not available.")}},Oa={getTrackChanges:()=>[],enumerateStructuralRowChanges:()=>[]},U7=Symbol("comments-plugin-disabled"),CS=()=>[],eb=()=>null,Ku=()=>null,kS=()=>null,tb=({storyKey:e,rawId:t})=>`tc::${e}::${t}`,H7=/<br(?:\s[^>]*)?\s*\/?>/gi,$7=/<(?:p|div|li|blockquote|pre|h[1-6])(?:\s[^>]*)?\s*\/?>/gi,G7=/<\/(?:p|div|li|blockquote|pre|h[1-6])\s*>/gi,W7=/<\/?[A-Za-z][A-Za-z0-9:-]*(?:\s[^>]*)?\s*\/?>/g,K7=/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z][a-zA-Z0-9]+);/g,q7={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:'"'},nb=(e,t)=>{if(Object.is(e,t))return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Object.is(e[o],t[o]))},SS=e=>{if(!Array.isArray(e))return null;const t=e.filter(n=>n&&typeof n=="object").map(n=>({excerpt:typeof n.excerpt=="string"?n.excerpt:"",label:typeof n.label=="string"?n.label:""}));return t.length>0?t:null},Y7=(e,t)=>e===t?!0:!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,r)=>nb(n,t[r])),_S=e=>Array.isArray(e)?e.filter(t=>t&&typeof t=="object").map(t=>({name:typeof t.name=="string"?t.name:"",namespaceUri:typeof t.namespaceUri=="string"?t.namespaceUri:"",localName:typeof t.localName=="string"?t.localName:"",value:typeof t.value=="string"?t.value:""})).filter(t=>t.name&&t.namespaceUri&&t.localName):null,X7=(e,t)=>e===t?!0:!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,r)=>nb(n,t[r])),AS=e=>{if(!e||typeof e!="object")return null;const t=typeof e.src=="string"?e.src:null;if(!t||!t.startsWith("data:image/"))return null;const n=typeof e.contentType=="string"&&e.contentType.startsWith("image/")?e.contentType:null,r=typeof e.role=="string"?e.role:null,o=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:null,i=typeof e.height=="number"&&Number.isFinite(e.height)&&e.height>0?e.height:null,s=typeof e.alt=="string"&&e.alt.length>0?e.alt:"Tracked image preview";return{src:t,...n?{contentType:n}:{},...r?{role:r}:{},...o?{width:o}:{},...i?{height:i}:{},alt:s}},Z7=e=>{const t=String(e).toLowerCase(),n=q7[t];if(n!==void 0)return n;const r=t.startsWith("#x")?16:t.startsWith("#")?10:null;if(!r)return null;const o=t.startsWith("#x")?t.slice(2):t.slice(1),i=Number.parseInt(o,r);if(!Number.isFinite(i))return null;try{return String.fromCodePoint(i)}catch{return null}},Q7=e=>e.replace(K7,(t,n)=>Z7(n)??t),rb=e=>{const t=String(e??"");return!t||t==="<p></p>"?"":Q7(t.replace(H7,`
|
|
9
9
|
`).replace(G7,`
|
|
10
10
|
`).replace($7,"").replace(W7,"")).replace(/\n{3,}/g,`
|
|
11
11
|
|
|
@@ -83,7 +83,7 @@ ${n.toString()}`)},b8=class{constructor(e){this.patterns=[],this.$state=e}if(e,t
|
|
|
83
83
|
`,KO=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="96 96 448 448"><!--!Font Awesome Free v7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path d="M96 160C96 124.7 124.7 96 160 96L480 96C515.3 96 544 124.7 544 160L544 480C544 515.3 515.3 544 480 544L160 544C124.7 544 96 515.3 96 480L96 160zM160 160L160 224L224 224L224 160L160 160zM480 160L288 160L288 224L480 224L480 160zM160 288L160 352L224 352L224 288L160 288zM480 288L288 288L288 352L480 352L480 288zM160 416L160 480L224 480L224 416L160 416zM480 416L288 416L288 480L480 480L480 416z"></path></svg>
|
|
84
84
|
`,qO=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M9 10v5h2V4h2v11h2V4h2V2H9C6.79 2 5 3.79 5 6s1.79 4 4 4zm12 8l-4-4v3H5v2h12v3l4-4z"/></svg>
|
|
85
85
|
`,YO=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M10 10v5h2V4h2v11h2V4h2V2h-8C7.79 2 6 3.79 6 6s1.79 4 4 4zm-2 7v-3l-4 4 4 4v-3h12v-2H8z"/></svg>
|
|
86
|
-
`,sr={undo:RS,redo:wO,bold:ZD,italic:QD,underline:JD,color:AO,link:z_,image:dO,tableOfContents:KO,alignLeft:fO,alignRight:pO,alignCenter:hO,alignJustify:mO,bulletList:B_,bulletListDisc:B_,bulletListCircle:eO,bulletListSquare:tO,numberedList:nO,numberedListDecimal:rO,numberedListDecimalParen:oO,numberedListUpperRoman:iO,numberedListLowerRoman:sO,numberedListUpperAlpha:aO,numberedListUpperAlphaParen:lO,numberedListLowerAlpha:cO,numberedListLowerAlphaParen:uO,indentLeft:vO,indentRight:gO,directionLtr:qO,directionRtl:YO,pageBreak:IO,copyFormat:yO,clearFormatting:bO,trackChanges:SO,trackChangesFinal:_O,trackChangesOriginal:V_,trackChangesAccept:CO,trackChangesReject:kO,documentMode:j_,documentEditingMode:j_,documentSuggestingMode:IS,documentViewingMode:V_,colorOption:EO,colorOptionCheck:ob,linkInput:z_,removeLink:TS,openLink:TO,overflow:xS,dropdownCaretUp:xO,dropdownCaretDown:ES,ruler:RO,paintbrush:MO,highlight:LO,ai:DO,table:OO,tableActions:PO,splitCell:FO,mergeCells:NO,addRowBefore:pm,addRowAfter:pm,addColumnBefore:pm,addColumnAfter:pm,deleteRow:yb,deleteColumn:yb,deleteTable:yb,deleteBorders:zO,fixTables:BO,lineHeight:jO,search:VO,cut:UO,copy:HO,paste:$O,strikethrough:GO,formattingMarks:WO};Ft(),mn();var XO={key:0,class:"link-title"},ZO={key:1,class:"link-title"},QO={key:2,class:"link-title"},JO={key:3,class:"link-title"},eP={key:4,class:"link-input-wrapper"},tP={class:"input-row text-input-row"},nP=["readonly","onKeydown"],rP={class:"input-row url-input-row"},oP=["innerHTML"],iP=["readonly","onKeydown"],sP=["innerHTML"],aP={key:0,class:"input-row link-buttons"},lP=["innerHTML"],cP={key:5,class:"input-row go-to-anchor clickable"},uP={__name:"LinkInput",props:{showInput:{type:Boolean,default:!0},showLink:{type:Boolean,default:!0},goToAnchor:{type:Function,default:()=>{}},ui:{type:Object,default:null},linkItem:{type:Object,default:null},closePopover:{type:Function,default:()=>{}},href:{type:String,default:null},target:{type:String,default:null},rel:{type:String,default:null},tooltip:{type:String,default:null},clickedElement:{type:Object,default:null},hyperlinkTarget:{type:Object,default:null},hyperlinkText:{type:String,default:null},textTarget:{type:Object,default:null},restoreSelection:{type:Function,default:()=>{}},documentMode:{type:String,default:null}},setup(e){const t=e,{isHighContrastMode:n}=ds(),r=re(!1),o=()=>{if(typeof t.hyperlinkText=="string"&&t.hyperlinkText)return t.hyperlinkText;const W=t.ui?.selection?.getSnapshot?.();if(typeof W?.quotedText=="string"&&W.quotedText)return W.quotedText;const V=t.clickedElement?.innerText??t.clickedElement?.textContent;return typeof V=="string"?V:""},i=()=>{if(typeof t.href=="string"&&t.href)return t.href;const W=t.ui?.toolbar?.getSnapshot?.()?.commands?.link?.value;if(typeof W=="string"&&W)return W;const V=t.linkItem?.attributes?.value?.href;return typeof V=="string"?V:""},s=()=>t.documentMode??t.ui?.document?.getSnapshot?.()?.mode??null,a=re(""),l=re(""),u=re(!1),d=/^[a-z][a-z0-9+.-]*:/i,f=ke(()=>{const W=l.value.trim();return W?W.startsWith("#")||d.test(W)?W:"https://"+W:""}),p=ke(()=>f.value?XD(f.value):null),g=ke(()=>p.value!==null),m=re(!1),v=ke(()=>!u.value&&m.value),k=ke(()=>!g.value),b=ke(()=>s()==="viewing"),S=()=>{const W=p.value?.href;W&&window.open(W,"_blank","noopener")},C=()=>{const W=document.querySelector(".link-input-ctn input");W&&W.focus()};Nn(()=>{a.value=o(),l.value=i(),m.value=!!l.value,u.value=l.value.startsWith("#"),t.showInput&&!b.value&&C()});const w=W=>{const V=t.ui;return V?.commands?.execute?(t.restoreSelection?.(),V.commands.execute("link",W)):!1},T=()=>{if(b.value)return;if(!l.value){w({href:null,hyperlinkTarget:t.hyperlinkTarget}),t.closePopover();return}if(!g.value){r.value=!0;return}const W=p.value?.href;if(!W){r.value=!0;return}const V={href:W,currentText:o(),hyperlinkTarget:t.hyperlinkTarget,textTarget:t.textTarget};a.value?V.text=a.value:v.value||(V.text=W),w(V),t.closePopover()},L=()=>{w({href:null,hyperlinkTarget:t.hyperlinkTarget}),t.closePopover()},z=W=>{t.goToAnchor&&t.goToAnchor(W)};return(W,V)=>(ye(),De("div",{class:en(["link-input-ctn",{"high-contrast":Qe(n)}])},[u.value?(ye(),De("div",XO,"Page anchor")):b.value?(ye(),De("div",ZO,"Link details")):v.value?(ye(),De("div",QO,"Edit link")):(ye(),De("div",JO,"Add link")),e.showInput&&!u.value?(ye(),De("div",eP,[He("div",tP,[V[4]||(V[4]=He("div",{class:"input-icon text-input-icon"},"T",-1)),ya(He("input",{type:"text",name:"text",placeholder:"Text","onUpdate:modelValue":V[0]||(V[0]=j=>a.value=j),readonly:b.value,onKeydown:ii(Jt(T,["stop","prevent"]),["enter"])},null,40,nP),[[ji,a.value]])]),He("div",rP,[He("div",{class:"input-icon",innerHTML:Qe(sr).linkInput},null,8,oP),ya(He("input",{type:"text",name:"link",placeholder:"Type or paste a link",class:en({"sd-error":r.value}),"onUpdate:modelValue":V[1]||(V[1]=j=>l.value=j),readonly:b.value,onKeydown:[ii(Jt(T,["stop","prevent"]),["enter"]),V[2]||(V[2]=j=>r.value=!1)]},null,42,iP),[[ji,l.value]]),He("div",{class:en(["open-link-icon",{"sd-disabled":!g.value}]),innerHTML:Qe(sr).openLink,onClick:S,"data-item":"btn-link-open"},null,10,sP)]),b.value?vt("",!0):(ye(),De("div",aP,[v.value?(ye(),De("button",{key:0,class:"remove-btn",onClick:L,"data-item":"btn-link-remove"},[He("div",{class:"remove-btn__icon",innerHTML:Qe(sr).removeLink},null,8,lP),V[5]||(V[5]=as(" Remove ",-1))])):vt("",!0),He("button",{class:en(["sd-submit-btn",{"disable-btn":k.value}]),onClick:T,"data-item":"btn-link-apply"}," Apply ",2)]))])):u.value?(ye(),De("div",cP,[He("a",{onClick:V[3]||(V[3]=Jt(j=>z(l.value),["stop","prevent"]))},"Go to "+Ut(l.value.startsWith("#_")?l.value.substring(2):l.value),1)])):vt("",!0)],2))}},U_=un(uP,[["__scopeId","data-v-3e4bd44e"]]);function dP(e){let t=e;for(;t;){const n=window.getComputedStyle(t).overflowY;if(/(auto|scroll)/.test(n)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return document.scrollingElement||document.documentElement}function H_(e,t={behavior:"smooth",block:"start"}){if(!e)return;const n=dP(e),r=n.getBoundingClientRect(),o=e.getBoundingClientRect(),i=n===(document.scrollingElement||document.documentElement)?0:r.top,s=o.top-i+n.scrollTop,a=window.getComputedStyle(n).scrollPaddingTop?.trim(),l=a?.endsWith("px")?Number(a.slice(0,-2)):0,u=Number.isFinite(l)&&l>=0?l:0;n.scrollTo({top:t.block==="start"?s-u:s-n.clientHeight+e.offsetHeight,behavior:t.behavior})}Ft();var fP="link-popover",hP=500,pP=4,mP=e=>!!(e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"),qu=e=>!!(e&&typeof e=="object"&&!Array.isArray(e));function gP(e){if(!qu(e)||e.kind!=="inline"||e.nodeType!=="hyperlink")return!1;const t=qu(e.anchor)?e.anchor:null,n=t&&qu(t.start)?t.start:null,r=t&&qu(t.end)?t.end:null;return typeof n?.blockId=="string"&&typeof n.offset=="number"&&typeof r?.blockId=="string"&&typeof r.offset=="number"}function vP(e){return qu(e)?e.type==="default"||e.type==="suppress"||e.type==="none"?!0:e.type==="custom"?e.component!=null:e.type==="external"||e.type==="render"?typeof e.render=="function":!1:!1}function $_(e){return e instanceof Error?e:new Error(String(e))}function yP(e){return typeof e!="string"?"":e.split(/\s+/).map(t=>t.trim().toLowerCase()).filter(t=>t==="noopener"||t==="noreferrer").filter((t,n,r)=>r.indexOf(t)===n).join(",")}function bP(e,t){const n=yP(e);if(t!=="_blank")return n;const r=n?n.split(","):[];return r.includes("noopener")||r.unshift("noopener"),r.join(",")}function wP(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):String(e).replace(/['"\\]/g,"\\$&")}function CP(e){try{return decodeURIComponent(e)}catch{return e}}function G_(e){const t=e?.dataset?.sourceAnchor;if(!t)return null;try{const n=JSON.parse(t)?.sourceRef;if(!qu(n))return null;const r=typeof n.partUri=="string"?n.partUri:void 0,o=typeof n.xpathLikePath=="string"?n.xpathLikePath:void 0;return r||o?{partUri:r,xpathLikePath:o}:null}catch{return null}}function kP(e){const t=G_(e)?.xpathLikePath?.match(/w:p\[ordinal=(\d+)\]/);return t?Number(t[1]):null}function SP(e,t){const n=kP(e),r=t?.blocks?.list?.()?.blocks,o=Array.isArray(r)?r.find(i=>i.ordinal===n):null;return typeof o?.nodeId=="string"?o.nodeId:e?.dataset?.blockId}function W_(e,t){const n=e?.closest?.("[data-block-id][data-pm-start]"),r=SP(n,t);if(!r||!n||!e?.ownerDocument)return null;const o=Number(e?.dataset?.pmStart),i=Number(e?.dataset?.pmEnd);if(Number.isFinite(o)&&Number.isFinite(i)&&i>o){const g=Number(n?.dataset?.pmStart),m=Number.isFinite(g)&&o>=g,v=m?o-g:o,k=m?i-g:i;return v<0||k<=v?null:{kind:"selection",start:{kind:"text",blockId:r,offset:v},end:{kind:"text",blockId:r,offset:k}}}const s=e.ownerDocument.defaultView,a=s?.NodeFilter,l=s?.Node;if(!a||!l)return null;let u=0;const d=e.ownerDocument.createTreeWalker(n,a.SHOW_ELEMENT|a.SHOW_TEXT);let f=d.nextNode();for(;f&&f!==e;)f.nodeType===l.TEXT_NODE&&!e.contains(f)&&(u+=f.textContent?.length??0),f=d.nextNode();if(f!==e)return null;const p=u+(e.textContent?.length??0);return p<=u?null:{kind:"selection",start:{kind:"text",blockId:r,offset:u},end:{kind:"text",blockId:r,offset:p}}}function _P(e){const t=e?.closest?.("[data-source-anchor]");return G_(t)?.partUri??null}function K_(e){return e.startsWith("/")?e:`/${e}`}function bb(e){if(typeof e!="string")return"";try{return new URL(e,window.location.href).href}catch{return e}}function wb(e){return typeof e?.externalTarget=="string"&&e.externalTarget?e.externalTarget:typeof e?.anchor=="string"&&e.anchor?`#${e.anchor}`:""}function q_(e){const t=e?.anchor?.start,n=e?.anchor?.end;return typeof t?.blockId!="string"||typeof t?.offset!="number"||typeof n?.blockId!="string"||typeof n?.offset!="number"||t.blockId!==n.blockId?null:{kind:"selection",start:{kind:"text",blockId:t.blockId,offset:t.offset},end:{kind:"text",blockId:n.blockId,offset:n.offset}}}function AP(e,t){const n=q_(t);return n?n.start.blockId===e?.start?.blockId&&n.start.offset===e?.start?.offset&&n.end.blockId===e?.end?.blockId&&n.end.offset===e?.end?.offset:!1}function IP(e,t,n){if(typeof t!="string"||!t)return null;const r=e?.query?.match?.({select:{type:"text",pattern:t,caseSensitive:!0},require:"any"}),o=(Array.isArray(r?.items)?r.items:[]).map(s=>s?.target).filter(s=>s?.kind==="selection"&&!!s?.start?.blockId&&!!s?.end?.blockId),i=typeof n=="string"?o.filter(s=>s.start.blockId===n&&s.end.blockId===n):o;return i.length===1?i[0]:typeof n=="string"?null:o.length===1?o[0]:null}function Y_(e){return!!(e&&typeof e.closest=="function"&&e.closest(".superdoc-toc-entry"))}function EP({getSurfaceManager:e,getActiveEditor:t,getUi:n,getActivationHandler:r,getActivationHandlerSource:o=()=>null,getBuiltInEditorDisabled:i=()=>!1,shouldInterceptNavigationOnlyHyperlinks:s=()=>!1,getLayerElement:a,emitException:l}){let u=null,d=null,f=0;const p=new WeakMap;function g(){f+=1}function m(H,J){if(!H||!u||u.handle!==H)return;const Q=u;Q.unbindPointerDown?.();const Y=Q.element.ownerDocument?.defaultView?.Node,_e=Y!=null&&Q.pointerDownTarget instanceof Y&&Q.element.contains(Q.pointerDownTarget);J?.status==="closed"&&J.reason===void 0&&_e&&(d={href:Q.href,element:Q.element,closedAt:Date.now()}),u=null}function v(H="closed"){g();const J=u;u=null,d=null,J?.unbindPointerDown?.(),J?.handle?.close?.(H)}function k(H){return{id:fP,mode:"floating",closeOnEscape:!0,floating:{top:H.position.top,left:H.position.left,autoFocus:!0,closeOnOutsidePointerDown:!0,width:"auto"}}}function b(H,J){const Q={href:H.href,element:H.element,handle:J,pointerDownTarget:null,unbindPointerDown:null},Y=H.element.ownerDocument,_e=ue=>{Q.pointerDownTarget=ue.target??null};Y.addEventListener("pointerdown",_e,!0),Q.unbindPointerDown=()=>Y.removeEventListener("pointerdown",_e,!0),u=Q,d=null,J.result?.then?.(ue=>m(J,ue),()=>m(J))}function S(H,J){return H?.querySelector?.(`a[name='${J}'], [data-bookmark-marker='start'][data-bookmark-name='${J}']`)??null}async function C(H){const J=t()?.authoring?.setSelectionTarget;if(typeof J!="function")return;const Q={kind:"story",storyType:"body"},Y={kind:"text",blockId:H,offset:0,story:Q},_e={kind:"selection",start:Y,end:Y,story:Q};try{await Promise.resolve(J({target:_e,collapse:"start",focus:!0}))}catch{}}async function w(H,{placeCaret:J=!1}={}){if(typeof H!="string"||!H.startsWith("#"))return;const Q=CP(H.slice(1)),Y=t()?.doc,_e=Y?.bookmarks?.get;if(typeof _e!="function"){const ct=S(n()?.viewport?.getHost?.()??null,wP(Q));ct&&H_(ct,{block:"start",behavior:"instant"});return}let ue=null;try{ue=await Promise.resolve(_e.call(Y.bookmarks,{target:{kind:"entity",entityType:"bookmark",name:Q}})),ue??=null}catch{return}const ve=ue?.address?.story;if(ve&&ve.storyType!=="body")return;const ge=ue?.range?.from?.blockId;if(typeof ge!="string")return;J&&await C(ge);const Te=n()?.viewport,Ne=Te?.scrollIntoView;if(typeof Ne!="function")return;const Je={kind:"text",blockId:ge,range:{start:0,end:0}};for(let ct=0;ct<pP;ct+=1)try{if((await Promise.resolve(Ne.call(Te,{target:Je,block:"start",behavior:"instant"})))?.success!==!1)return}catch{return}}async function T(H){const J=H.editor?.doc;let Q;try{Q=await Promise.resolve(J?.hyperlinks?.list?.())}catch{return null}const Y=Array.isArray(Q?.stories)?Q.stories:[],_e=H.element?.dataset?.linkRid,ue=H.element?.textContent??"",ve=bb(H.href),ge=W_(H.element,J),Te=_P(H.element),Ne=Y.filter(ct=>typeof ct?.partUri=="string"),Je=Te&&Ne.length>0?Ne.filter(ct=>K_(ct.partUri)===K_(Te)):Y;for(const ct of Je){const tt=Array.isArray(ct?.hyperlinks)?ct.hyperlinks:[],Tt=async B=>{if(!B?.hyperlinkNodeId||!ct?.storyId||B.address)return B;try{const de=await Promise.resolve(J?.hyperlinks?.get?.({storyId:ct.storyId,hyperlinkNodeId:B.hyperlinkNodeId}));return de?.success&&de.hyperlink?de.hyperlink:B}catch{return B}},ae=async B=>{if(!ge)return null;const de=(await Promise.all(B.map(Tt))).filter(Se=>AP(ge,Se.address));return de.length===1?de[0]:null},Ee=_e?tt.filter(B=>B.rId===_e):[],Ue=Ee.filter(B=>B.text===ue),ie=tt.filter(B=>bb(wb(B))===ve&&B.text===ue),I=tt.filter(B=>B.text===ue),se=tt.filter(B=>{const de=bb(wb(B));return ue&&de===ve&&B.text?.includes?.(ue)}),F=Ue.length===1?Ue[0]:null,q=ie.length===1?ie[0]:null,P=I.length===1?I[0]:null,ee=se.length===1?se[0]:null,be=Ee.length===1?Ee[0]:null,N=F??await ae(Ue)??q??await ae(ie)??P??await ae(I)??ee??await ae(se)??be??await ae(Ee);if(N?.hyperlinkNodeId&&ct?.storyId){const B=await Tt(N),de=q_(B.address);return{storyId:ct.storyId,hyperlinkNodeId:B.hyperlinkNodeId,href:wb(B),text:B.text,targetKind:B.targetKind,address:gP(B.address)?B.address:void 0,textTarget:de??IP(J,B.text,ge?.start?.blockId)}}}return null}function L(H){const J=p.get(H);if(J)return J;const Q=T(H);return p.set(H,Q),Q}function z(H){if(!d)return!1;const J=d.element===H.element&&d.href===H.href,Q=Date.now()-d.closedAt<=hP;return!J||!Q?!1:(d=null,!0)}function W(H,J){const Q=e();if(!Q?.open)return;const Y=f;queueMicrotask(()=>{Y===f&&b(H,Q.open(J))})}function V(H){if(v("replace"),H.isAnchorLink&&Y_(H.element)){w(H.href,{placeCaret:H.documentMode!=="viewing"});return}if(H.defaultAction==="navigate"){if(H.isAnchorLink)w(H.href);else if(H.href){const ue=H.target||"_self",ve=bP(H.rel,ue);ve?window.open(H.href,ue,ve):window.open(H.href,ue)}return}if(i())return;const J=()=>v("closed"),Q=ue=>{J(),w(ue,{placeCaret:!0})},Y=f,_e=ue=>{Y===f&&W(H,{...k(H),component:Wr(U_),props:{href:ue?.href||H.href,target:H.target,rel:H.rel,tooltip:H.tooltip,clickedElement:H.element,hyperlinkTarget:ue,hyperlinkText:ue?.text,textTarget:ue?.textTarget??W_(H.element,H.editor?.doc),documentMode:H.documentMode,ui:n(),closePopover:J,goToAnchor:Q}})};L(H).then(_e,()=>_e(null))}function j(H,J){v("replace");const Q=()=>v("closed");W(H,{...k(H),component:Wr(J.component),props:{...J.props,editor:H.editor,href:H.href,closePopover:Q}})}function Z(H,J){v("replace");const Q=J.render;W(H,{...k(H),render:Y=>{try{const _e={container:Y.container,editor:H.editor,href:H.href};return J.type==="render"?Q({..._e,close:()=>Y.close("closed")}):Q({..._e,closePopover:()=>Y.close("closed")})}catch(_e){const ue=J.type==="render";if(l({error:$_(_e),source:ue?"hyperlinks.onActivate.render":"linkPopoverExternalRender"}),Y.close("external-error"),!ue){const ve=f;queueMicrotask(()=>{ve===f&&V(H)})}return}}})}function R(H){const J=a()?.getBoundingClientRect?.(),Q=typeof J?.left=="number"?J.left:0,Y=typeof J?.top=="number"?J.top:0,_e={editor:t(),href:H.href,target:H.target,rel:H.rel,tooltip:H.tooltip,element:H.element,clientX:H.clientX,clientY:H.clientY,isAnchorLink:H.href.startsWith("#"),documentMode:H.documentMode,defaultAction:H.documentMode==="viewing"||H.editableText===!1||H.href.startsWith("#")&&Y_(H.element)?"navigate":"edit",position:{left:`${Math.max(0,H.clientX-Q)}px`,top:`${Math.max(0,H.clientY-Y)}px`},getDocumentTarget:async()=>(await L(_e))?.address??null,closePopover:()=>v("closed")};return _e}function K(H){const J=r();if(typeof J!="function")return{type:"default"};const Q=o()==="hyperlinks.onActivate",Y=Q?"hyperlinks.onActivate":"linkPopoverResolver",_e=()=>Q?{type:"suppress"}:{type:"default"};try{const ue=J(H);return mP(ue)?(Promise.resolve(ue).catch(()=>{}),l({error:new Error(Q?"hyperlinks.onActivate must return synchronously; Promises are not supported.":"The hyperlink activation handler must return synchronously."),source:Y}),_e()):ue==null?{type:"default"}:vP(ue)?ue:(l({error:new Error(Q?"hyperlinks.onActivate returned an invalid result.":"The hyperlink activation handler returned an invalid result."),source:Y}),_e())}catch(ue){return l({error:$_(ue),source:Y}),_e()}}function x(H){if(!H?.element||typeof H.href!="string")return;if(g(),u&&u.element===H.element&&u.href===H.href){v("toggle");return}if(z(H))return;const J=R(H);if(H.editableText===!1&&!s()){V(J);return}const Q=K(J);if(Q.type==="suppress"||Q.type==="none"){v("none");return}if(Q.type==="custom"){j(J,Q);return}if(Q.type==="external"||Q.type==="render"){Z(J,Q);return}V(J)}function $(){v("destroyed")}return{handleLinkClick:x,closeCurrentPopover:v,destroy:$}}var TP=Object.freeze({editorVersion:2,commands:null,state:null,view:null}),xP=["text.insert","text.replace","text.deleteBackward","text.deleteForward","text.paste","history.undo","history.redo","structural.splitBlock","structural.indent","structural.outdent"],X_=["comments.create","comments.resolve","comments.reopen","comments.delete","comments.reply","comments.edit","trackedChanges.accept","trackedChanges.reject","trackedChanges.acceptAll","trackedChanges.rejectAll"],RP=["trackedChanges.setAuthoringMode"];function Vf(e){return e.state!=="ready"?e.state:e.documentMode==="viewing"?"review-ready":"editing-ready"}function mm(e){return e==="review-ready"||e==="editing-ready"}function Z_(e){switch(e){case"text.insert":return"text.insert";case"text.replace":return"text.replace";case"text.deleteBackward":return"text.deleteBackward";case"text.deleteForward":return"text.deleteForward";case"text.paste":return"text.pastePlain";case"history.undo":return"history.undo";case"history.redo":return"history.redo";case"structural.splitBlock":return"structural.enter";case"structural.indent":return"structural.listIndent";case"structural.outdent":return"structural.listOutdent";default:return null}}function Q_(e){switch(e){case"comments.create":return"comments.createFromSelection";case"comments.resolve":return"review.commentResolve";case"comments.reopen":return"review.commentReopen";case"comments.delete":return"review.commentDelete";case"comments.reply":return"review.commentReply";case"comments.edit":return"review.commentEdit";case"trackedChanges.accept":case"trackedChanges.reject":return"review.trackedChangeDecide";case"trackedChanges.acceptAll":return"trackedChanges.acceptAll";case"trackedChanges.rejectAll":return"trackedChanges.rejectAll";default:return null}}function J_(e,t){return e.editableSubset.commands.find(n=>n.command===t)??null}function MP(e){return e?.status==="supported"||e?.enabled===!0}function LP(e){return e?.rejectionCode??e?.reason??null}function DP(e){return e?.detail??void 0}function gm(e,t){return MP(J_(e,t))}function eA(e,t){const n=J_(e,t),r=LP(n);return r?{reason:nA(r),detail:DP(n)}:e.documentMode==="viewing"?{reason:"document-readonly",detail:"review-surface-read-only"}:{reason:"command-unsupported",detail:`unsupported:${t}`}}function tA(e,t){const n=t?.reason;return e==="history.undo"?n==="NO_EFFECT"||n==="apply-rejected"?"no-effect":"nothing-to-undo":n==="NO_EFFECT"||n==="apply-rejected"?"no-effect":"nothing-to-redo"}function nA(e){switch(e){case"host-saving":return"host-saving";case"document-readonly":return"document-readonly";case"selection-invalidated":case"review-target-invalidated":return"selection-invalidated";case"review-command-unavailable":return"review-command-unavailable";case"review-surface-read-only":return"document-readonly";case"editing-selection-required":return"selection-unsupported";case"format-target-unsupported":case"selection-target-unsupported":case"input-target-unsupported":case"composition-target-unsupported":case"enter-context-unsupported":case"boundary-merge-unsupported":case"tracked-structural-edit-unsupported":case"comment-anchor-create-unsupported":case"comment-anchor-move-unsupported":return"target-unsupported";case"unsupported-command":return"command-unsupported";case"editing-mount-required":case"host-not-ready":case"host-disposed":return"runtime-not-ready";default:return"command-failed"}}function OP(e){const{id:t,documentId:n,root:r,host:o,getLegacyEditorProjection:i,onUnregister:s}=e;let a=o.getSnapshot(),l=!1,u=!1,d=null,f=0,p=0,g=null,m=null,v=null,k=null;const b=new Map,S=new Set;function C(ge){for(const Te of Array.from(S))try{Te(ge)}catch{}}function w(){f+=1,b.clear()}function T(ge){const Te=`v2-runtime-pos-${p++}`;return b.set(Te,ge),{runtimeId:t,tokenId:Te,revision:f}}function L(ge){return ge.runtimeId!==t?{ok:!1,reason:"wrong-runtime-token"}:ge.revision!==f||!b.has(ge.tokenId)?{ok:!1,reason:"stale-position-token"}:{ok:!0}}function z(){return o.getHandles().editing?.selection??null}function W(){const ge=z()?.getSnapshot()??null;return ge?{isRange:ge.anchor!==ge.focus,isEmpty:ge.anchor===ge.focus,text:"",anchor:T(ge.anchor),focus:T(ge.focus)}:null}function V(){const ge=z();ge!==k&&(g?.(),g=null,k=ge,ge&&(g=ge.subscribe(Te=>{w(),C({type:"selection-change",selection:Te?{isRange:Te.anchor!==Te.focus,isEmpty:Te.anchor===Te.focus,text:"",anchor:T(Te.anchor),focus:T(Te.focus)}:{isRange:!1,isEmpty:!0,text:""}})})))}function j(){const ge=o.getDocumentFacade?.()??null;return ge?.available===!0?ge.doc:null}function Z(){const ge=j();return!!(ge?.comments&&ge.trackChanges)}function R(ge){if(!mm(Vf(ge)))return[];const Te=xP.filter(Je=>{const ct=Z_(Je);return ct!==null&&gm(ge,ct)}),Ne=Z()?X_.filter(Je=>{const ct=Q_(Je);return ct!==null&&gm(ge,ct)}):[];return[...Te,...Ne,...RP]}function K(ge=a){const Te=Vf(ge),Ne=Te!=="disposed",Je=R(ge);return{lifecycle:{canFocus:Ne,canDispose:!0},selection:{canReadSelectedText:!0,canReadSelectionSnapshot:!0,canMintPositionTokens:!0},commands:{canDispatch:mm(Te)&&Je.length>0,supportedCommands:Je},layout:{supported:!0,hasSyncSnapshot:!0},zoom:{supported:!0,min:25,max:400},navigation:{supported:!1,targets:[]},persistence:{canSave:!0,canExportDocx:!0},comments:{supported:!0,canMutate:ge.commentCommandsReason!=="author-required"&&["comments.create","comments.resolve","comments.reopen","comments.delete","comments.reply","comments.edit"].some(ct=>Je.includes(ct))},trackedChanges:{supported:!0,canDecide:Je.includes("trackedChanges.accept")||Je.includes("trackedChanges.reject"),canToggleAuthoring:mm(Te)}}}function x(){const ge=o.getPageMetricsSnapshot();return{pageCount:ge.pages.length,currentPage:1,zoom:ge.zoom.percent}}function $(ge=a){return{id:t,kind:"v2",documentId:n,state:Vf(ge),documentMode:ge.documentMode,reason:ge.reason,capabilities:K(ge)}}function H(ge){return ge?.success===!0?(w(),{status:"committed",receipt:ge}):ge&&"failure"in ge?{status:"receipt-failure",failure:ge.failure}:{status:"rejected",reason:"command-failed"}}function J(ge,Te){return Te?Te.noop===!0?{status:"history-noop",reason:tA(ge,Te),result:Te}:(w(),{status:"history-committed",result:Te}):{status:"rejected",reason:"command-failed"}}async function Q(ge){const Te=Q_(ge.kind);if(Te&&!gm(a,Te)){const ct=eA(a,Te);return{status:"rejected",reason:ct.reason,detail:ct.detail}}const Ne=Z_(ge.kind);if((ge.kind==="history.undo"||ge.kind==="history.redo")&&Ne&&!gm(a,Ne)){const ct=eA(a,Ne);return{status:"rejected",reason:ct.reason,detail:ct.detail}}const Je=j();if(!Je)return X_.includes(ge.kind)?{status:"rejected",reason:"review-command-unavailable"}:null;try{switch(ge.kind){case"comments.create":{const ct=await Je.selection?.current?.(),tt=ct?.empty===!1?ct.target:void 0;return H(await Je.comments?.create?.({text:ge.text,...tt?{target:tt}:{}}))}case"comments.resolve":return H(await Je.comments?.patch?.({commentId:ge.commentId,status:"resolved"}));case"comments.reopen":return H(await Je.comments?.patch?.({commentId:ge.commentId,status:"active"}));case"comments.delete":return H(await Je.comments?.delete?.({commentId:ge.commentId}));case"comments.reply":return H(await Je.comments?.create?.({parentCommentId:ge.parentCommentId,text:ge.text}));case"comments.edit":return H(await Je.comments?.patch?.({commentId:ge.commentId,text:ge.text}));case"trackedChanges.accept":return H(await Je.trackChanges?.decide?.({decision:"accept",target:{kind:"id",id:ge.id}}));case"trackedChanges.reject":return H(await Je.trackChanges?.decide?.({decision:"reject",target:{kind:"id",id:ge.id}}));case"trackedChanges.acceptAll":return H(await Je.trackChanges?.decide?.({decision:"accept",target:{kind:"all"}}));case"trackedChanges.rejectAll":return H(await Je.trackChanges?.decide?.({decision:"reject",target:{kind:"all"}}));case"history.undo":return J("history.undo",await Je.history?.undo?.());case"history.redo":return J("history.redo",await Je.history?.redo?.());default:return null}}catch(ct){return{status:"rejected",reason:"command-failed",detail:ct instanceof Error?ct.message:String(ct)}}}function Y(ge){a=ge,w(),V(),C({type:"state-change",state:Vf(ge)}),C({type:"capabilities-change",capabilities:K(ge)}),ge.state==="disposed"&&!l&&(l=!0,m?.(),v?.(),g?.(),g=null,C({type:"disposed"}),S.clear(),u||(u=!0,s?.(t)))}m=o.subscribe(Y),v=o.subscribePageMetrics?.(()=>{C({type:"layout-change",layout:x()})})??null,V();async function _e(ge){const Te=Vf(a);if(Te==="disposed")return{status:"rejected",reason:"runtime-not-ready"};if(Te==="saving")return{status:"rejected",reason:"host-saving"};if(!mm(Te))return{status:"rejected",reason:"runtime-not-ready"};const Ne="at"in ge?ge.at:"range"in ge?ge.range:void 0;if(Ne){const Tt=L(Ne);return Tt.ok?{status:"rejected",reason:"target-unsupported",detail:"positioned dispatch is deferred until the shared runtime can target host selections explicitly"}:{status:"rejected",reason:Tt.reason}}if(ge.kind==="trackedChanges.setAuthoringMode")return o.setDocumentMode(ge.mode==="tracked"?"suggesting":"editing"),w(),{status:"committed"};const Je=await Q(ge);if(Je)return Je;let ct=null;switch(ge.kind){case"text.insert":ct={kind:"text.insert",text:ge.text};break;case"text.replace":ct={kind:"text.replace",text:ge.text};break;case"text.deleteBackward":ct={kind:"text.deleteBackward"};break;case"text.deleteForward":ct={kind:"text.deleteForward"};break;case"text.paste":ct={kind:"text.pastePlain",text:ge.text};break;case"history.undo":ct={kind:"history.undo"};break;case"history.redo":ct={kind:"history.redo"};break;case"structural.splitBlock":ct={kind:"structural.enter"};break;case"structural.indent":ct={kind:"structural.listIndent"};break;case"structural.outdent":ct={kind:"structural.listOutdent"};break;default:return{status:"rejected",reason:"command-unsupported",detail:ge.kind}}const tt=await o.dispatch(ct);switch(tt.status){case"committed":return w(),{status:"committed",receipt:tt.receipt};case"history-committed":return w(),{status:"history-committed",result:tt.result};case"history-noop":return{status:"history-noop",reason:tA(ge.kind,tt.result),result:tt.result};case"receipt-failure":return{status:"receipt-failure",failure:tt.failure};case"rejected":return{status:"rejected",reason:nA(tt.rejection.code),detail:tt.rejection.detail}}}async function ue(ge){if(l||a.state==="disposed")return!1;const Te=d?.focus;return Te&&typeof Te.focus=="function"?await Te.focus({restoreSelection:ge?.restoreSelection,preventScroll:ge?.preventScroll})!==!1:typeof r.focus=="function"?(r.focus({preventScroll:ge?.preventScroll}),!0):!1}async function ve(){l||(await o.dispose(),l||(l=!0,m?.(),v?.(),g?.(),g=null,C({type:"disposed"}),S.clear(),u||(u=!0,s?.(t))))}return{runtime:{id:t,kind:"v2",documentId:n,root:r,getCapabilities:()=>K(),getSnapshot:()=>$(),setDocumentMode(ge){o.setDocumentMode(ge)},getDocumentMode:()=>o.getDocumentMode(),setTrackedChangesRenderOptions(ge){o.setTrackedChangesRenderOptions(ge)},getLegacyEditorProjection:()=>i?.()??TP,focus:ue,dispose:ve,dispatch:_e,getSelectedText:()=>"",getSelectionSnapshot:W,getToolbarState(){return{activeMarks:[],disabled:["formatting.applyMark","formatting.applyParagraph"]}},getLayoutSnapshot:x,save:()=>o.save(),exportDocx:ge=>o.save({format:"docx",commentExportMode:ge?.commentsType==="clean"?"strip":"preserve"}),async setZoom(ge){const Te=o.setZoom(ge);return Te.status==="ok"?{status:"committed"}:{status:"rejected",reason:Te.reason==="host-disposed"?"runtime-not-ready":"target-unsupported",detail:Te.reason}},async reveal(ge){if(ge.kind==="position"){const Te=L(ge.position);if(!Te.ok)return{status:"rejected",reason:Te.reason}}return{status:"rejected",reason:"capability-unsupported",detail:`${ge.kind} reveal is not exposed through the shared runtime yet`}},subscribe(ge){return S.add(ge),()=>{S.delete(ge)}}},attachMountHandle(ge){d=ge,V()}}}var rA=".superdoc-toolbar";function PP(e){return Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.items)?e.items:[]}function FP(e){if(e&&typeof e=="object"){const t=e;return t.target??t.address??t.handle??e}return e}function vm(e){return typeof e=="function"}function oA(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function ym(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function NP(e){return ym(e)&&e.kind==="text"&&Array.isArray(e.segments)&&e.segments.length>0}function BP(e){return ym(e)&&e.kind==="story"&&(e.storyType==="headerFooterSlot"||e.storyType==="headerFooterPart")}function zP(e){if(!vm(e.selection?.current))return{handled:!1,reason:"page-field-selection-unavailable"};let t;try{t=e.selection.current({includeText:!1})}catch{return{handled:!1,reason:"page-field-selection-unavailable"}}return oA(t)?{handled:!1,reason:"page-field-selection-async"}:!ym(t)||!NP(t.target)?{handled:!1,reason:"page-field-selection-unavailable"}:BP(t.target.story)?{handled:!0,target:t.target}:{handled:!1,reason:"page-field-context-unavailable"}}function Cb(e,t){return!vm(e)||!vm(t)?!1:(Promise.resolve().then(()=>e()).then(n=>{for(const r of PP(n))try{Promise.resolve(t({target:FP(r)})).catch(()=>{})}catch{}}).catch(()=>{}),!0)}function jP(e){return{focusToolbar:()=>{const o=e.resolveToolbarElement();if(!o)return{handled:!1,reason:"no-toolbar"};const i=typeof o.matches=="function"&&o.matches(rA)?o:o.querySelector?.(rA)??o;return i?(i.hasAttribute("tabindex")||i.setAttribute("tabindex","0"),typeof i.focus!="function"?{handled:!1,reason:"no-toolbar"}:(i.focus(),!0)):{handled:!1,reason:"no-toolbar"}},updateFields:()=>{const o=e.getDocumentApi();if(!o)return{handled:!1,reason:"document-api-unavailable"};let i=Cb(o.toc?.list,o.toc?.update);return i=Cb(o.fields?.list,o.fields?.rebuild)||i,i=Cb(o.index?.list,o.index?.rebuild)||i,i?!0:{handled:!1,reason:"field-update-workflow-unavailable"}},insertPageField:o=>{const i=e.getDocumentApi();if(!i)return{handled:!1,reason:"document-api-unavailable"};if(!vm(i.fields?.insert))return{handled:!1,reason:"page-field-insert-unavailable"};const s=zP(i);if(!s.handled||!s.target)return{handled:!1,reason:s.reason??"page-field-context-unavailable"};const a=o==="page"?"PAGE":"NUMPAGES";try{const l=i.fields.insert({at:s.target,instruction:a,mode:"raw"});if(oA(l))l.catch(()=>{});else if(ym(l)&&l.success===!1)return{handled:!1,reason:"page-field-insert-failed"}}catch{return{handled:!1,reason:"page-field-insert-failed"}}return!0}}}function VP(e){let t=null;return n=>{const r=t;let o;const i=new Promise(a=>{o=a});t=i;const s=async()=>{try{return await e(n)}finally{t===i&&(t=null),o()}};return r?r.then(s):s()}}var bm="data-superdoc-runtime-id";function UP(e,t){e.setAttribute(bm,t)}function iA(e){e.removeAttribute(bm)}function HP(e,t){let n,r;switch(e){case"collaboration-access-denied":n="access-denied",r="The collaboration server rejected access to this room.";break;case"collaboration-connection-failed":n="connection-failed",r="The collaboration connection failed.";break;case"collaboration-sync-timeout":n="sync-timeout",r="The collaboration room did not finish synchronizing in time.";break;default:return null}return{error:new Error(r),code:e,collaborationReason:n,documentId:t,editor:null}}function $P(e){const t=e.telemetry;return t===null||t?.enabled===!1?null:{enabled:!0,endpoint:t?.endpoint,metadata:t?.metadata,licenseKey:e.licenseKey!==void 0?e.licenseKey:t?.licenseKey??"community-and-eval-agplv3"}}function GP(e){const t=new WeakSet;return{trackDocumentOpen(n,r,o=null){n&&t.has(n)||(n&&t.add(n),e.trackDocumentOpen(r,o))}}}function WP(e){const t=$P(e);return t?GP(new fx(t)):null}var KP="PKG-payload-",qP=new Set(["main-document-fallback"]),YP=new Set(["dangling-content-type-override","dangling-internal-relationship","relationship-id-collision","parts-not-referenced-from-known-rels"]);function sA(e,t={}){if(!e||typeof e.code!="string")return null;const{code:n,severity:r,message:o}=e,i=r==="error",s=r==="warn"&&qP.has(n);if(!i&&!s||YP.has(n)&&!i)return null;const a=n.startsWith(KP)?"PERFORMANCE_ERROR":"PARSE_ERROR";return{error:new Error(o||n),diagnosticCode:a,diagnosticStage:"unzip",severity:i?"error":"warn",internalCode:n,documentId:t.documentId??null,editor:t.editor??null,message:o||n}}function XP(e,t={}){if(!e||typeof e.code!="string")return null;const{code:n,reason:r,severity:o}=e;if(o!=="error"&&o!=="warn"||n==="render.exact-content-hydration-failed")return null;let i;if(n.includes("page-geometry.failed")||n.includes("section-metadata.failed")||n.includes("page-furniture.failed")||n==="render.provider-error")i="RENDER_ERROR";else if(n.includes("unsupported"))i="UNSUPPORTED_FEATURE";else if(n.includes("degraded"))i=typeof r=="string"&&(r.includes("retained ")||r.includes("localized resolve "))?"RENDER_ERROR":"PERFORMANCE_ERROR";else if(o==="error")i="RENDER_ERROR";else return null;const s=r||n;return{error:new Error(s),diagnosticCode:i,diagnosticStage:"render",severity:o,internalCode:n,documentId:t.documentId??null,editor:t.editor??null,message:s}}var aA={OpenRenderNoProgressError:"PERFORMANCE_ERROR",BoundedLocalPageCapError:"PERFORMANCE_ERROR",MountedEnginePassInterrupt:"RENDER_ERROR",RenderSchedulerWaitError:"RENDER_ERROR"},ZP=new Set(["open-failed","source-load-failed"]),lA=new Map([["input-too-large-for-inline-review","unzip"]]);function QP(e,t,n={}){const{bootErrorName:r,documentId:o,editor:i}=n;if(r&&aA[r]){const a=t||r;return{error:new Error(a),diagnosticCode:aA[r],diagnosticStage:"render",severity:"error",internalCode:r,documentId:o??null,editor:i??null,message:a}}if(lA.has(e)){const a=t||e;return{error:new Error(a),diagnosticCode:"PERFORMANCE_ERROR",diagnosticStage:lA.get(e),severity:"error",internalCode:e,documentId:o??null,editor:i??null,message:a}}if(!ZP.has(e))return null;const s=t||e;return{error:new Error(s),diagnosticCode:"PARSE_ERROR",diagnosticStage:"unzip",severity:"error",internalCode:e,documentId:o??null,editor:i??null,message:s}}var JP=new Set(["SSIG-SECT-parse-error","SSIG-PAGE-parse-error","SSIG-SETTINGS-parse-error","SSIG-USAGE-body-parse-error","SSIG-USAGE-numbering-parse-error"]);function eF(e,t={}){if(!e||typeof e.code!="string")return null;const{code:n,severity:r,message:o}=e;return!JP.has(n)||r!=="error"?null:{error:new Error(o||n),diagnosticCode:"PARSE_ERROR",diagnosticStage:"parse",severity:r,internalCode:n,documentId:t.documentId??null,editor:t.editor??null,message:o||n}}function tF(e,t={}){const n=e&&typeof e=="object"&&typeof e.name=="string"&&e.name||"export-failed",r=e&&typeof e=="object"&&typeof e.message=="string"&&e.message||"DOCX export failed";return{error:e,diagnosticCode:"RENDER_ERROR",diagnosticStage:"export",severity:"error",internalCode:n,documentId:t.documentId??null,editor:t.editor??null,message:r}}function wm(e){return typeof e?.generation=="number"?e.generation:0}function nF(){const e=new Map,t=new Map;return{shouldEmit(n,r,o){const i=n??"";let s=e.get(i);(!s||t.get(i)!==r)&&(s=new Set,e.set(i,s),t.set(i,r));const a=o??"";return s.has(a)?!1:(s.add(a),!0)}}}function rF(e,t,n){return!!e&&e.internalCode===t&&n.length>0}Ft(),mn();var oF={__name:"SurfaceExternalMount",props:{surfaceId:{type:String,required:!0},mode:{type:String,required:!0},request:{type:Object,required:!0},render:{type:Function,required:!0},resolve:{type:Function,required:!0},close:{type:Function,required:!0}},setup(e){const t=e,n=re(null);let r=null;function o(){i(),!(!n.value||!t.render)&&(r=t.render({container:n.value,surfaceId:t.surfaceId,mode:t.mode,request:t.request,resolve:t.resolve,close:t.close})?.destroy??null)}function i(){typeof r=="function"&&r(),r=null,n.value&&(n.value.innerHTML="")}return Nn(o),cr(i),jt(()=>t.surfaceId,()=>{o()}),(s,a)=>(ye(),De("div",{ref_key:"container",ref:n,class:"sd-surface-external-mount"},null,512))}},cA=un(oF,[["__scopeId","data-v-b2412c5d"]]),kb=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");Ft(),mn();var iF=["aria-labelledby","aria-label"],sF=["id"],aF={class:"sd-surface-dialog__content"},lF={__name:"SurfaceDialog",props:{surface:{type:Object,required:!0},scrollLockTarget:{type:Object,default:null}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,o=re(null),i=ke(()=>n.surface.request.title?`sd-surface-title-${n.surface.id}`:void 0),s=ke(()=>i.value??n.surface.request.ariaLabelledBy??void 0),a=ke(()=>s.value?void 0:n.surface.request.ariaLabel);let l=null;function u(T){if(!o.value)return;const L=o.value.querySelectorAll(kb);if(L.length===0)return;const z=L[0],W=L[L.length-1];T.shiftKey&&document.activeElement===z?(T.preventDefault(),W.focus()):!T.shiftKey&&document.activeElement===W&&(T.preventDefault(),z.focus())}function d(){if(!o.value)return;const T=o.value.querySelector(kb);T?T.focus():o.value.focus()}let f=null,p="";function g(){if(n.scrollLockTarget)f=n.scrollLockTarget;else{const T=o.value?.closest(".superdoc");f=T?.querySelector(".superdoc__layers")??T}f&&(p=f.style.overflow,f.style.overflow="hidden")}function m(){f&&(f.style.overflow=p,f=null,p="")}function v(T){if(T.key==="Tab"){u(T);return}T.key==="Escape"&&n.surface.request.closeOnEscape!==!1&&(T.stopPropagation(),r("close"))}function k(T){T.target===T.currentTarget&&n.surface.request.closeOnBackdrop!==!1&&r("close")}const b=ke(()=>({surfaceId:n.surface.id,mode:"dialog",request:n.surface.request,resolve:n.surface.resolve,close:n.surface.close})),S=ke(()=>({...n.surface.props??{},...b.value})),C=ke(()=>{const T=n.surface.request.dialog?.maxWidth;if(T!=null)return typeof T=="number"?`${T}px`:T}),w=ke(()=>{const T={};return C.value&&(T["max-width"]=C.value),T});return Nn(async()=>{l=document.activeElement,g(),await St(),d()}),jt(()=>n.scrollLockTarget,(T,L)=>{T!==L&&(m(),g())}),cr(()=>{m(),l&&typeof l.focus=="function"&&l.focus(),l=null}),(T,L)=>(ye(),De("div",{class:"sd-surface-dialog-backdrop",onMousedown:Jt(k,["self"]),onKeydown:v},[He("div",{ref_key:"dialogRef",ref:o,class:"sd-surface-dialog",style:bn(w.value),role:"dialog","aria-modal":"true","aria-labelledby":s.value,"aria-label":a.value,tabindex:"-1"},[e.surface.request.title?(ye(),De("div",{key:0,id:i.value,class:"sd-surface-dialog__title"},Ut(e.surface.request.title),9,sF)):vt("",!0),He("div",aF,[e.surface.render?(ye(),an(cA,{key:0,"surface-id":e.surface.id,mode:"dialog",request:e.surface.request,render:e.surface.render,resolve:e.surface.resolve,close:e.surface.close},null,8,["surface-id","request","render","resolve","close"])):e.surface.component?(ye(),an(Av(e.surface.component),Ug(Ls({key:1},S.value)),null,16)):vt("",!0)])],12,iF)],32))}},cF=un(lF,[["__scopeId","data-v-20bf8e4b"]]);Ft(),mn();var uF=["aria-labelledby","aria-label"],dF=["id"],fF={class:"sd-surface-floating__content"},hF={__name:"SurfaceFloating",props:{surface:{type:Object,required:!0}},setup(e,{expose:t}){const n=e,r=re(null);t({rootEl:r});const o=re({}),i=ke(()=>n.surface.request.title?`sd-surface-title-${n.surface.id}`:void 0),s=ke(()=>i.value??n.surface.request.ariaLabelledBy??void 0),a=ke(()=>s.value?void 0:n.surface.request.ariaLabel),l=ke(()=>n.surface.request.floating??{}),u=ke(()=>{const C=l.value;return C.top!=null||C.right!=null||C.bottom!=null||C.left!=null}),d=ke(()=>{const C=["sd-surface-floating"];if(!u.value){const w=l.value.placement??"top-right";C.push(`sd-surface-floating--${w}`)}return C});function f(C){if(C!=null)return typeof C=="number"?`${C}px`:C}const p=ke(()=>{const C=l.value,w={};return C.top!=null&&(w.top=f(C.top)),C.right!=null&&(w.right=f(C.right)),C.bottom!=null&&(w.bottom=f(C.bottom)),C.left!=null&&(w.left=f(C.left)),C.width!=null&&(w.width=f(C.width)),C.maxWidth!=null&&(w["max-width"]=f(C.maxWidth)),C.maxHeight!=null&&(w["max-height"]=f(C.maxHeight)),{...w,...o.value}});async function g(){if(o.value={},!u.value)return;await St(),await new Promise(j=>requestAnimationFrame(j));const C=r.value,w=C?.parentElement;if(!C||!w)return;const T=8,L=C.getBoundingClientRect(),z=w.getBoundingClientRect(),W={},V=l.value;if(V.left!=null&&V.right==null){const j=L.left-z.left,Z=Math.max(T,z.width-L.width-T),R=Math.min(Math.max(j,T),Z);R!==j&&(W.left=`${R}px`)}if(V.top!=null&&V.bottom==null){const j=L.top-z.top,Z=Math.max(T,z.height-L.height-T),R=Math.min(Math.max(j,T),Z);R!==j&&(W.top=`${R}px`)}o.value=W}jt(l,g,{deep:!0});const m=ke(()=>({surfaceId:n.surface.id,mode:"floating",request:n.surface.request,resolve:n.surface.resolve,close:n.surface.close})),v=ke(()=>({...n.surface.props??{},...m.value}));let k=null,b=!1,S=null;return Nn(async()=>{if(g(),window.addEventListener("resize",g),typeof ResizeObserver<"u"&&r.value?.parentElement&&(S=new ResizeObserver(g),S.observe(r.value.parentElement),S.observe(r.value)),l.value.autoFocus===!1||(await St(),!r.value))return;const C=r.value.querySelector("[data-sd-autofocus]")??r.value.querySelector(kb);C&&(k=document.activeElement,C.focus(),b=!0)}),cr(()=>{window.removeEventListener("resize",g),S?.disconnect(),S=null,b&&k&&typeof k.focus=="function"&&k.focus(),k=null,b=!1}),(C,w)=>(ye(),De("div",{ref_key:"floatingRef",ref:r,class:en(d.value),style:bn(p.value),role:"dialog","aria-labelledby":s.value,"aria-label":a.value,"data-editor-ui-surface":""},[e.surface.request.title?(ye(),De("div",{key:0,id:i.value,class:"sd-surface-floating__title"},Ut(e.surface.request.title),9,dF)):vt("",!0),He("div",fF,[e.surface.render?(ye(),an(cA,{key:0,"surface-id":e.surface.id,mode:"floating",request:e.surface.request,render:e.surface.render,resolve:e.surface.resolve,close:e.surface.close},null,8,["surface-id","request","render","resolve","close"])):e.surface.component?(ye(),an(Av(e.surface.component),Ug(Ls({key:1},v.value)),null,16)):vt("",!0)])],14,uF))}},pF=un(hF,[["__scopeId","data-v-cd2be5db"]]);Ft(),mn();var mF={__name:"SurfaceHost",props:{geometryTarget:{type:Object,default:null}},setup(e){const t=e,n=ll("surfaceManager",null),r=ke(()=>n?.activeDialog.value??null),o=ke(()=>n?.activeFloating.value??null),i=ke(()=>r.value!=null||o.value!=null),s=re(null),a=re(null),l=re({}),u=new Set(["hidden","scroll","auto","clip"]);function d(K){const x=[];let $=K.parentElement;for(;$;){const H=getComputedStyle($);(u.has(H.overflowX)||u.has(H.overflowY))&&x.push($),$=$.parentElement}return x}function f(K,x){let $=0,H=0,J=window.innerWidth,Q=window.innerHeight;for(const _e of x){const ue=_e.getBoundingClientRect(),ve=getComputedStyle(_e);u.has(ve.overflowX)&&(H=Math.max(H,ue.left),J=Math.min(J,ue.right)),u.has(ve.overflowY)&&($=Math.max($,ue.top),Q=Math.min(Q,ue.bottom))}const Y=K.getBoundingClientRect();return $=Math.max($,Y.top),H=Math.max(H,Y.left),J=Math.min(J,Y.right),Q=Math.min(Q,Y.bottom),{top:$,left:H,width:Math.max(J-H,0),height:Math.max(Q-$,0)}}let p=null,g=[],m=0,v=null;function k(){if(!p)return;const{top:K,left:x,width:$,height:H}=f(p,g);l.value={position:"fixed",top:`${K}px`,left:`${x}px`,width:`${$}px`,height:`${H}px`}}function b(){m||(m=requestAnimationFrame(()=>{m=0,k()}))}function S(){if(p=t.geometryTarget??null,!!p){g=d(p),k(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),v=new ResizeObserver(b),v.observe(p);for(const K of g)v.observe(K)}}function C(){m&&(cancelAnimationFrame(m),m=0),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b),v&&(v.disconnect(),v=null),p=null,g=[]}jt(i,K=>{K?S():C()}),jt(()=>t.geometryTarget,K=>{K&&i.value&&!p&&S()}),Nn(()=>{i.value&&S()});function w(K){const x=o.value;!x||x.settled||r.value||K.key==="Escape"&&x.request.closeOnEscape!==!1&&(K.stopPropagation(),n.close(x.id))}let T=!1;function L(){T||(document.addEventListener("keydown",w,!0),T=!0)}function z(){T&&(document.removeEventListener("keydown",w,!0),T=!1)}function W(K){const x=o.value;if(!x||x.settled||r.value)return;const $=a.value?.rootEl;$&&!$.contains(K.target)&&n.close(x.id)}let V=!1;function j(){V||(document.addEventListener("pointerdown",W,!0),V=!0)}function Z(){V&&(document.removeEventListener("pointerdown",W,!0),V=!1)}jt(o,K=>{K&&!K.settled?(L(),K.request.floating?.closeOnOutsidePointerDown?j():Z()):(z(),Z())},{immediate:!0}),cr(()=>{C(),z(),Z()});function R(){const K=r.value;K&&!K.settled&&n.close(K.id)}return(K,x)=>(ye(),an(dl,{to:"body"},[i.value?(ye(),De("div",{key:0,ref_key:"hostRef",ref:s,class:"sd-surface-host",style:bn(l.value)},[o.value?(ye(),an(pF,{key:o.value.id,surface:o.value,ref_key:"floatingRef",ref:a},null,8,["surface"])):vt("",!0),r.value?(ye(),an(cF,{key:r.value.id,surface:r.value,"scroll-lock-target":Qe(p),onClose:R},null,8,["surface","scroll-lock-target"])):vt("",!0)],4)):vt("",!0)]))}},gF=un(mF,[["__scopeId","data-v-c6a3b75f"]]),Sb,vF=xr((()=>{Sb=(e,t)=>{const n=10**(t||0);return Math.floor(e*n)/n}})),uA,yF=xr((()=>{uA=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=o=>t(o.target.result),r.onerror=n,r.readAsDataURL(e)})})),dA,bF=xr((()=>{dA=(e,t)=>{const n=t-e;return Array.from({length:n},(r,o)=>e+o)}}));function wF(e){return`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${e}/pdf.worker.min.mjs`}var fA,hA,pA,mA,CF=xr((()=>{bF(),fA=e=>({adapter:"pdfjs",...e}),hA=class BE{constructor(){if(Object.getPrototypeOf(this).constructor===BE)throw new Error("Abstract class should not be instantiated")}},pA=class extends hA{constructor(e){super(),this.pdfLib=e.pdfLib,this.workerSrc=e.workerSrc,e.setWorker&&(this.workerSrc?this.pdfLib.GlobalWorkerOptions.workerSrc=e.workerSrc:this.pdfLib.GlobalWorkerOptions.workerSrc=wF(this.pdfLib.version))}async getDocument(e){return await this.pdfLib.getDocument(e).promise}async getPages(e,t,n){const r=dA(t,n+1).map(o=>e.getPage(o));return await Promise.all(r)}},mA=class{static create(e){const t={pdfjs:()=>new pA(e),default:()=>{throw new Error("Unsupported adapter")}};return(t[e.adapter]??t.default)()}}})),kF=xr((()=>{})),SF=xr((()=>{})),gA,vA,yA,bA,_F=xr((()=>{Ft(),cb(),kF(),SF(),mn(),gA=["data-page-id","data-page-number"],vA={class:"sd-pdf-viewer-page__canvas-wrapper"},yA={__name:"PdfViewerPage",props:{config:{type:Object,required:!0},page:{type:Object,required:!0},pages:{type:Array,required:!0},scale:{type:Number,required:!0},hasTextLayer:{type:Boolean,default:!1},outputScale:{type:Number,default:2},documentEl:{type:[Object],default:null}},emits:["page-rendered","page-error","text-layer-rendered","text-layer-error","selection-raw","bypass-selection"],setup(e,{emit:t}){const n=t,r=e,o=Br(null),i=re(null),s=re(null),a=re(null);let l;const u=ke(()=>r.pages.findIndex(j=>j.pageId===r.page.pageId)),d=ke(()=>u.value===-1?0:u.value+1);function f(j){const Z=window.getSelection();if(!Z||Z.rangeCount===0)return null;const R=Z.getRangeAt(0).getClientRects();if(!R.length)return null;const K=j.getBoundingClientRect(),x=r.scale??1,$=R[0];let H={top:$.top,left:$.left,bottom:$.bottom,right:$.right};for(let J=1;J<R.length;J+=1){const Q=R[J];Q.width===0||Q.height===0||(H.top=Math.min(H.top,Q.top),H.left=Math.min(H.left,Q.left),H.bottom=Math.max(H.bottom,Q.bottom),H.right=Math.max(H.right,Q.right))}return{top:(H.top-K.top)/x+j.scrollTop,left:(H.left-K.left)/x+j.scrollLeft,bottom:(H.bottom-K.top)/x+j.scrollTop,right:(H.right-K.left)/x+j.scrollLeft}}const p=ke(()=>{let{width:j,height:Z}=o.value;return[j,Z]=[j,Z].map(R=>Math.ceil(R)),{width:j,height:Z}}),g=ke(()=>{const{width:j,height:Z}=p.value;return{width:j,height:Z}}),m=ke(()=>{const{width:j,height:Z}=b();return{"--scale-factor":`${C()}`,width:`calc(var(--scale-factor) * ${j}px)`,height:`calc(var(--scale-factor) * ${Z}px)`}});function v(){const j=window.getSelection();if(!j||j.toString().length===0)return;const Z=f(r.documentEl?.value??r.documentEl??i.value);Z&&n("selection-raw",{selectionBounds:Z,documentId:r.page.documentId,page:d.value,source:"pdf"})}function k(j){j?.target&&j.target.tagName!=="SPAN"&&n("bypass-selection",j)}function b(){const j=_l*r.outputScale;let{width:Z,height:R}=o.value;return Z=Z/j,R=R/j,[Z,R]=[Z,R].map(K=>Math.ceil(K)),{width:Z,height:R}}function S(){const{width:j,height:Z}=b(),R=C();return{width:j*R,height:Z*R}}function C(){return(r.scale??1)*_l}function w(){const{pdfjsPage:j}=r.page;o.value=j.getViewport({scale:_l*r.outputScale})}async function T(){if(l)return;const j=s.value;if(!j||!o.value)return;const Z={canvasContext:j.getContext("2d"),viewport:o.value};try{const{pdfjsPage:R}=r.page;l=R.render(Z),await l.promise;const K=S(),x=b(),$={page:r.page,documentId:r.page.documentId,pageIndex:u.value,pageNumber:d.value,width:K.width,height:K.height,originalWidth:x.width*_l,originalHeight:x.height*_l};n("page-rendered",$)}catch{V(),n("page-error",r.page)}}async function L(){if(!r.hasTextLayer)return;const j=a.value;if(!j)return;j.innerHTML="";const Z=r.config?.pdfLib?.TextLayer;if(Z)try{const R=(r.scale??1)*_l,K=r.page.pdfjsPage.getViewport({scale:R});await new Z({textContentSource:await r.page.pdfjsPage.getTextContent(),container:j,viewport:K}).render(),n("text-layer-rendered",r.page)}catch(R){n("text-layer-error",r.page),console.error(R)}}async function z(){await T(),await L()}function W(j){j?.pdfjsPage&&j.pdfjsPage.cleanup(),V()}function V(){l&&(l.cancel(),l=null)}return jt(()=>r.scale,()=>{L()}),w(),Nn(()=>{z()}),cr(()=>{W(r.page)}),(j,Z)=>(ye(),De("div",{class:"sd-pdf-viewer-page","data-page-id":e.page.pageId,"data-page-number":d.value,style:bn(m.value),"data-pdf-page":"",ref_key:"pageRef",ref:i,onMousedown:k,onMouseup:v},[He("div",vA,[He("canvas",Ls({class:"sd-pdf-viewer-page__canvas"},g.value,{ref_key:"canvasRef",ref:s}),null,16)]),e.hasTextLayer?(ye(),De("div",{key:0,class:"sd-pdf-viewer-page__text-layer",ref_key:"textLayerRef",ref:a},null,512)):vt("",!0)],44,gA))}},bA=un(yA,[["__scopeId","data-v-d7a9857d"]])})),AF=xr((()=>{})),wA,CA,IF=xr((()=>{Ft(),_F(),AF(),mn(),wA={__name:"PdfViewerDocument",props:{config:{type:Object,required:!0},pdf:{type:Object},pages:{type:Array,required:!0},scale:{type:Number},hasTextLayer:{type:Boolean,default:!1},outputScale:{type:Number}},emits:["page-focus","page-rendered","page-error","selection-raw","bypass-selection"],setup(e,{emit:t}){const n=t,r=re(null),o=re(null);function i(u){n("page-rendered",u)}function s(u){n("page-error",u)}function a(u){n("selection-raw",u)}function l(u){n("bypass-selection",u)}return(u,d)=>(ye(),De("div",{class:"sd-pdf-viewer-document",ref_key:"documentRef",ref:r},[He("div",{class:"sd-pdf-viewer-document__wrapper",ref_key:"documentWrapper",ref:o},[(ye(!0),De(Kt,null,ir(e.pages,f=>(ye(),an(bA,Ls({key:f.pageId},{ref_for:!0},{page:f,pages:e.pages,scale:e.scale,config:e.config,hasTextLayer:e.hasTextLayer,outputScale:e.outputScale,documentEl:r.value},{onPageRendered:i,onPageError:s,onSelectionRaw:a,onBypassSelection:l}),null,16))),128))],512)],512))}},CA=un(wA,[["__scopeId","data-v-2152178b"]])})),EF=xr((()=>{})),TF=Ld({default:()=>_A}),kA,SA,_A,xF=xr((()=>{Ft(),vF(),yF(),cb(),CF(),IF(),EF(),mn(),kA={class:"sd-pdf-viewer__main"},SA={__name:"PdfViewer",props:{config:{type:Object,required:!0},file:{type:Object,required:!0},fileId:{type:String},initialScale:{type:Number,default:1}},emits:["page-rendered","pages-loaded","document-loaded","document-ready","document-error","selection-raw","bypass-selection"],setup(e,{expose:t,emit:n}){const r=n,o=e,i=fA({pdfLib:Wr(o.config.pdfLib),workerSrc:o.config.workerSrc,setWorker:o.config.setWorker}),s=mA.create(i),a=re(null),l=re(null),u=re(null),d=re([]),f=re(typeof o.initialScale=="number"&&Number.isFinite(o.initialScale)&&o.initialScale>0?Sb(o.initialScale,2):1),p=re(0),g=re(0),m=ke(()=>o.config?.textLayer===!0),v=ke(()=>o.config?.outputScale??2);function k(Z){const R=Z?.page;R&&(R.pageIsRendered=!0),C(),r("page-rendered",Z)}function b(Z){r("selection-raw",Z)}function S(Z){r("bypass-selection",Z)}function C(){p.value<=0||(g.value+=1,g.value>=p.value&&r("document-ready",{documentId:u.value?.documentId,viewerContainer:a.value}))}function w(Z){d.value=Z,p.value=Z.length,g.value=0}function T(Z){const R=Sb(Z,2);f.value=R}t({updateScale:T});async function L(Z){if(Z)try{const R=await uA(Z),K=o.fileId||V("document"),x=await s.getDocument(R);u.value={documentId:K,pdfjsDocument:Wr(x)},r("document-loaded",Z)}catch(R){r("document-error",R),console.error(R)}}async function z(){if(!u.value)return;const{pdfjsDocument:Z}=u.value,R=1,K=Z.numPages;try{const x=await s.getPages(Z,R,K),$=J=>({documentId:u.value.documentId,pageId:j(u.value.documentId,J.pageNumber),pageNumber:J.pageNumber,pageIsRendered:!1,pdfjsPage:Wr(J)}),H=x.map($);w(H),r("pages-loaded",H)}catch(x){r("document-error",x),console.error(x)}}function W(){d.value=[],f.value=1}function V(Z){return`pdf-${Z.replace(/\W/g,"")}-${Math.random().toString(36).slice(2)}-${Date.now()}`}function j(Z,R){return`${Z}-page-${R}`}return jt(()=>o.file,Z=>{L(Z)},{immediate:!0}),jt(u,(Z,R)=>{Z&&(R&&W(),z())}),(Z,R)=>(ye(),De("div",{class:"sd-pdf-viewer",ref_key:"rootRef",ref:a},[He("div",kA,[Xt(CA,Ls({pdf:u.value,pages:d.value,scale:f.value,config:e.config,hasTextLayer:m.value,outputScale:v.value},{onPageRendered:k,onSelectionRaw:b,onBypassSelection:S,ref_key:"documentRef",ref:l}),null,16)])],512))}},_A=un(SA,[["__scopeId","data-v-05c9d9b5"]])}));Ft(),mn();var RF=["innerHTML"],MF={class:"superdoc__document document"},LF={class:"floating-comments"},AA="superdoc:v2-tracked-change-carriers-restamped",DF=!1,OF=3,PF={__name:"SuperDoc",emits:["selection-update"],setup(e,{emit:t}){const n=X1(()=>Promise.resolve().then(()=>(xF(),TF))),r=O=>O.password??F.$superdoc.config.password,o=O=>{const G=O?.v2Collaboration,pe=G&&typeof G=="object"&&"value"in G?G.value:G;if(pe==null)return{state:"absent"};const Ce=bk({v2Collaboration:pe,documentType:O?.type??null,documentCount:a.value.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!Ce.ok)return{state:"invalid",failure:{code:Ce.reason==="invalid-room-mode"?"collaboration-open-intent-invalid":"collaboration-config-invalid",message:`SuperDoc rejected the v2 collaboration configuration (${Ce.reason}).`}};const{providerFamily:rt,...xt}=Ce.target;return{state:"valid",config:{providerType:rt,...xt}}},i=Uu(),s=Us(),{documents:a,isReady:l,areDocumentsReady:u,selectionPosition:d,activeSelection:f,activeZoom:p,zoomMode:g,measurementUnit:m,viewportMetrics:v}=Ns(i),{handlePageReady:k,modules:b,user:S,getDocument:C}=i,w=ll("surfaceManager",null),T=BD({getSurfaceManager:()=>w,getPasswordPromptConfig:()=>F.$superdoc?.config?.modules?.surfaces?.passwordPrompt,onUnhandled:(O,G,pe)=>{F.$superdoc?.emit("exception",{error:pe?.error??new Error(`Password prompt unhandled: ${G}`),editor:pe?.editor??null,code:G,documentId:O?.id})}}),{getConfig:L,documentsWithConverations:z,commentsList:W,pendingComment:V,activeComment:j,skipSelectionUpdate:Z,commentsByDocument:R,isCommentsListVisible:K,isFloatingCommentsReady:x,generalCommentIds:$,hasSyncedCollaborationComments:H,editorCommentPositions:J,hasInitializedLocations:Q,isCommentHighlighted:Y,hasOpenTrackedChanges:_e}=Ns(s),{showAddComment:ue,handleEditorLocationsUpdate:ve,handleTrackedChangeUpdate:ge,refreshTrackedChangeCommentsByIds:Te,syncTrackedChangePositionsWithDocument:Ne,syncTrackedChangeComments:Je,addComment:ct,addHydratedComment:tt,getComment:Tt,resolveCommentPositionEntry:ae,belongsToDocument:Ee,COMMENT_EVENTS:Ue,requestInstantSidebarAlignment:ie,peekInstantSidebarAlignment:I,clearInstantSidebarAlignment:se}=s,{proxy:F}=pr();s.proxy=F;const q=WP(F.$superdoc.config),P=F7(F.$superdoc.config),ee=Wr(P.EditorComponent),be=P.RulerComponent?Wr(P.RulerComponent):null,N=ke(()=>{const O=Qe(s.getFloatingComments);return Array.isArray(O)?O:[]}),{isHighContrastMode:B}=ds(),{uiFontFamily:de}=ib(),Se=()=>s.viewingVisibility.documentMode==="viewing",Ae=()=>!!F?.$superdoc?.config?.allowSelectionInViewMode,Le=ke(()=>Se()&&s.viewingVisibility.commentsVisible===!0),Xe=ke(()=>F?.$superdoc?.uiConfig?.search?.enabled===!0);ke(()=>Se()&&s.viewingVisibility.trackChangesVisible===!0);const it=ke(()=>s.shouldRenderReviewInViewing),yt=ke(()=>F.$superdoc.config.proofing!==void 0?F.$superdoc.config.proofing:F.$superdoc.config.layoutEngineOptions?.proofing),Mt=ke(()=>{const O=b.comments;if(O===!1||O==null)return null;const G=F.$superdoc?.uiConfig?.comments?.options;return!G||Object.keys(G).length===0?O:cD(O,G)}),Lt=ke(()=>{const O={"--sd-ui-font-family":de.value},G=Mt.value;if(!G)return O;G.highlightHoverColor&&(O["--sd-comments-highlight-hover"]=G.highlightHoverColor);const pe={...G.trackChangeHighlightColors||{},...G.trackChangeActiveHighlightColors||{}};return pe.insertBorder&&(O["--sd-tracked-changes-insert-border"]=pe.insertBorder),pe.insertBackground&&(O["--sd-tracked-changes-insert-background"]=pe.insertBackground),pe.deleteBorder&&(O["--sd-tracked-changes-delete-border"]=pe.deleteBorder),pe.deleteBackground&&(O["--sd-tracked-changes-delete-background"]=pe.deleteBackground),pe.formatBorder&&(O["--sd-tracked-changes-format-border"]=pe.formatBorder),O}),Wt=re(null),Be=re(null),rn=re(null),zn=re(null),Ht=re(!1),xn=no({top:null,right:"-25px",zIndex:101}),{superdocContainerWidth:Ur,isCompactCommentsMode:yr,recalculateCompactCommentsMode:Ar,ensureCompactMeasurementObserver:et}=Y9({commentsModuleConfig:Mt,superdocRoot:Wt,layers:Be}),kt=ke(()=>!0),Bt=Br(null),cn=re(!1),fn=re(!1),nn=re(null);let wn=0,Qt=0,er=null;const go=ke(()=>F.$superdoc.activeEditor),je=()=>F.$superdoc?.ui??null,$e=Object.freeze({enabled:!1,active:!1,supported:!1}),nt=HD({getSurfaceManager:()=>w,getActiveEditor:()=>F.$superdoc?.activeEditor,activeEditorRef:go,getFindReplaceConfig:()=>F.$superdoc?.uiConfig?.search?.enabled?F.$superdoc.uiConfig.search.options:!1,getSuperDocUI:je}),Ct=()=>w||(typeof F.$superdoc?.openSurface!="function"?null:{open:O=>F.$superdoc.openSurface(O)}),Pt=()=>{const O=hm(F.$superdoc?.config);return O.editableActivationDisabled?()=>({type:"none"}):O.handler},gn=EP({getSurfaceManager:Ct,getActiveEditor:()=>F.$superdoc?.activeEditor,getUi:je,getActivationHandler:Pt,getActivationHandlerSource:()=>hm(F.$superdoc?.config).handlerSource,getBuiltInEditorDisabled:()=>hm(F.$superdoc?.config).builtInEditorDisabled,shouldInterceptNavigationOnlyHyperlinks:()=>hm(F.$superdoc?.config).interceptsNavigationOnly,getLayerElement:()=>Be.value,emitException:O=>{F.$superdoc?.emit("exception",{...O,editor:F.$superdoc?.activeEditor??null})}}),vo=F.$superdoc.config.modules?.pdf||{},Po=()=>{Ht.value&&(Ht.value=!1,Je({superdoc:F.$superdoc,editor:F.$superdoc?.activeEditor}))},Hi=()=>{Ht.value=!0,St(()=>{Po()})},on=(O,G)=>{const pe=C(O);pe.isReady=!0,pe.container=G,u.value&&(F.$superdoc.config.collaboration||(l.value=!0)),Xo(),x.value=!0,Q.value=!0,F.$superdoc.broadcastPdfDocumentReady()},Kn=()=>{if(!d.value||!Be.value)return null;const O=d.value.source==="pdf"?(p.value??100)/100:1,G=Number(d.value.top);return Number.isFinite(G)?Be.value.getBoundingClientRect().top+G*O:null},Hn=async()=>{if((await ue(F.$superdoc,Kn()))?.ok===!1||!kt.value)return;const O=Ul();O&&zc(O)},Yr=async O=>{const G={comments:()=>Hn()};O in G&&await G[O](f.value,d.value),f.value=null,xn.top=null},ln=()=>xn.top=null,Ln=new Map,br=new Map,Ao=new Map,Io=new Map;let Wo=0;const _i=O=>{const G=Ao.get(O);if(G){Ao.delete(O);try{G.unbind?.()}catch(pe){console.warn("[SuperDoc] v2 command-shortcut unbind failed",pe)}}},Ai=()=>{const O=F.$superdoc?.toolbar;return!O||typeof O.getToolbarItemByName!="function"?null:()=>{const G=O.getToolbarItemByName("link");!G||G.disabled?.value===!0||(G.expand&&typeof G.expand=="object"&&"value"in G.expand&&(G.expand.value=!0),O.updateToolbarState?.())}},yo=({documentId:O,bindEditShortcuts:G})=>{if(!O||(_i(O),typeof G!="function"))return;const pe=Ai(),Ce=G({commandRoute:{executeAsync:(rt,xt)=>{const Nt=je();return Nt?Nt.commands.executeAsync(rt,xt):Promise.resolve(DF)},getState:rt=>je()?.commands.get(rt).getState()??$e},...pe?{openLinkWorkflow:pe}:{}});Ao.set(O,{unbind:Ce})},Eo=O=>{const G=Io.get(O);if(G){Io.delete(O);try{G.unbind?.()}catch(pe){console.warn("[SuperDoc] v2 session-shortcut unbind failed",pe)}}},Bl=({documentId:O,bindSessionShortcuts:G,documentApi:pe})=>{if(!O||(Eo(O),typeof G!="function"))return;const Ce=G({routes:jP({resolveToolbarElement:()=>F.$superdoc?.toolbar?.toolbarContainer??null,getDocumentApi:()=>pe??null}),isMutationAllowed:()=>!Se()});Io.set(O,{unbind:Ce})},Zs=(O,G)=>{O?.id&&(G?Ln.set(O.id,G):Ln.delete(O.id))},ai=O=>{_i(O),Eo(O);const G=C(O),pe=G?.provider??null;pe&&F.$superdoc.provider===pe&&(F.$superdoc.provider=void 0),G&&pe?.sendStateless&&(G.provider=null);const Ce=br.get(O);if(!Ce)return;F.$superdoc.unregisterEditorRuntime(Ce.runtimeId),br.delete(O);const rt=Ln.get(O);rt&&iA(rt)},Ie=({documentId:O,host:G,mount:pe,facade:Ce})=>{const rt=Ln.get(O);if(!rt)return console.warn("[SuperDoc] v2 runtime host root unavailable; skipping runtime registration for",O),!1;br.has(O)&&ai(O);const xt=`v2:${O}:${++Wo}`,Nt=OP({id:xt,documentId:O,root:rt,host:G,getLegacyEditorProjection:()=>Ce,onUnregister:vn=>{F.$superdoc.unregisterEditorRuntime(vn);const sn=br.get(O);sn&&sn.runtimeId===vn&&br.delete(O);const En=Ln.get(O);En&&iA(En)}});return Nt.attachMountHandle(pe??null),UP(rt,xt),F.$superdoc.registerEditorRuntime(Nt.runtime),br.set(O,{runtimeId:xt,adapter:Nt}),F.$superdoc.setActiveRuntime(xt,"v2-editor-ready"),!0},ze=P.createReviewWindowController({applyReviewWindow:(O,G)=>s.applyReviewWindowFromV2?.({superdoc:O?.superdoc,commentsAdapter:O?.commentsAdapter,trackedChangesAdapter:O?.trackedChangesAdapter,documentId:O?.documentId,commentItems:G?.comments?.items,trackedChangeItems:G?.trackedChanges?.items,requestedCommentIds:G?.comments?.requestedIds,requestedTrackedChangeIds:G?.trackedChanges?.requestedIds,unresolvedCommentIds:G?.comments?.unresolvedCommentIds,trackedList:{complete:!1,visibleWindowSource:"visible-window"},patch:pe=>s.$patch(pe)})??{ok:!1,reason:"store-action-missing"}}),mt=re({}),ht=nF(),Rn=bD(),Vn=xD(),Hr=O=>typeof O=="string"&&O.length>0?`document:${O}`:"document:default",Xr=O=>{const G=Hr(O);Rn.clear(G),Vn.clear(G)},bo=(O,G)=>{Rn.shouldNotify(Hr(O),G)&&F.$superdoc.emit("exception",{error:new Error(yD,{cause:JS(G)}),code:vD,editor:null,...typeof O=="string"&&O.length>0?{documentId:O}:{}})},oo=(O,G)=>{Vn.shouldNotify(Hr(O),G)&&F.$superdoc.emit("exception",TD(O,G))},li=(O,G)=>{O&&(mt.value={...mt.value,[O]:G})},Fo=O=>{if(!O||!mt.value[O])return;const G={...mt.value};delete G[O],mt.value=G},qn=(O=null)=>{const G=F.$superdoc?.activeEditor,pe=O??G?.documentId??G?.options?.documentId??null;if(!pe){G?.editorVersion===2&&F.$superdoc.setActiveEditor(null);return}if(O&&G?.editorVersion===2){const xt=G.documentId??G.options?.documentId??null;if(xt&&xt!==O)return}const Ce=pe?C(pe):null;Ce&&(Ce.isReady=!1,typeof Ce.setEditor=="function"&&Ce.setEditor(null));const rt=br.has(pe);ai(pe),!rt&&G?.editorVersion===2&&(G.documentId??G.options?.documentId??null)===pe&&F.$superdoc.setActiveEditor(null)},zl=O=>{const G=typeof O?.getExtensionManager=="function"?O.getExtensionManager():null;if(!G)return null;const pe=G.commands;return{commands:{execute:(Ce,rt)=>pe.execute(Ce,rt),getState:Ce=>{const rt=pe.get(Ce);return rt?{enabled:!(rt.getState()??{}).disabled,reason:null}:null},list:()=>pe.list().map(Ce=>{const rt=Ce.getState()??{};return rt.label?{id:Ce.id,label:rt.label}:{id:Ce.id}})},diagnostics:{getSnapshot:()=>G.diagnostics()}}},Qs=O=>{const G=a.value.find(Ce=>Ce.id===O),pe=F.$superdoc.config.documents.find(Ce=>Ce.id===O);G&&(G.fieldContext={}),pe&&(pe.fieldContext={})},ci=O=>{if(!O)return;Fo(O.documentId??null),Xr(O.documentId??null);const{host:G,mount:pe,documentId:Ce,capabilities:rt,editCommands:xt,bindEditShortcuts:Nt,bindSessionShortcuts:vn,commentsAdapter:sn,trackedChangesAdapter:En,contextMenu:Dt,documentApi:Sn,documentMutationReadiness:Yn,documentApiUnavailableReason:eo,pageMetrics:ns,pageLayout:Jo,pageFurniture:Ja,presence:nc,lock:lg,collaborationProvider:cg,fonts:ca,replaceFile:rs,upgradeToCollaboration:Di,documentOpenToken:Eh}=O;q?.trackDocumentOpen(Eh??null,Ce??null);const ug=VP(async(Rt={})=>{if(!G||typeof G.save!="function")throw new Error("v2-editor: save unavailable");return G.save(Rt)}),dg=async(Rt={})=>{const Vt=Rt?.commentsType==="clean"?"strip":"preserve",yn=await ug({format:"docx",commentExportMode:Vt});return new Blob([yn],{type:Sr})},Th=async Rt=>{if(typeof rs!="function")throw new Error("v2-editor: replaceFile unavailable");const Vt=await rs(Rt);return(Vt?.state==="review-ready"||Vt?.state==="editing-ready")&&Qs(Ce),Vt},y2=async(Rt,Vt)=>{if(typeof Di!="function")throw new Error("v2-editor: upgradeToCollaboration unavailable");return Di(Rt,Vt)},xh=(Rt={})=>pe?.focus&&typeof pe.focus.focus=="function"?pe.focus.focus(Rt):!1,nr=(Rt,Vt=void 0)=>{const yn={ok:!1,reason:Rt};return Vt&&(yn.detail=Vt),yn},fg=Rt=>Array.isArray(Rt?.items)?Rt.items:[],hg=Rt=>{const Vt=Number(Rt);return Number.isFinite(Vt)&&Vt>0?Math.floor(Vt):0},pg=async({text:Rt,occurrence:Vt=0}={})=>{if(typeof Rt!="string"||Rt.length===0)return nr("invalid-text","text must be a non-empty string");if(!Sn?.query||typeof Sn.query.match!="function")return nr("query-unavailable","activeEditor.doc.query.match is not available");const yn=hg(Vt),Ir=await Sn.query.match({select:{type:"text",pattern:Rt},limit:yn+1}),to=fg(Ir),$r=to[yn]??null;return $r?.target?{ok:!0,item:$r,target:$r.target,ref:typeof $r?.handle?.ref=="string"?$r.handle.ref:null,text:Rt,occurrence:yn,total:Number.isFinite(Number(Ir?.total))?Number(Ir.total):to.length}:nr("text-not-found",`text not found: ${Rt}`)},mg=(Rt,Vt)=>{if(!Rt||typeof Rt!="object"||Rt.kind!=="selection"||Vt!=="start"&&Vt!=="end")return Rt;const yn=Vt==="start"?Rt.start:Rt.end;return yn?{kind:"selection",start:yn,end:yn,...Rt.story?{story:Rt.story}:{}}:Rt},gg=async({target:Rt,collapse:Vt=null,focus:yn=!0}={})=>{if(!Rt||typeof Rt!="object")return nr("invalid-target","target must be a SelectionTarget object");const Ir=mg(Rt,Vt),to=(G?.getHandles?.()?.editing??null)?.selectionTargets??null;if(typeof to?.apply!="function")return nr("selection-target-unavailable","editing.selectionTargets.apply is not available");let $r;try{$r=to.apply(Ir)}catch(Pi){const rr=Pi instanceof Error?Pi.message:String(Pi);return nr("selection-target-threw",rr)}return $r?.ok?(yn!==!1&&await Promise.resolve(xh()),{ok:!0,mode:$r.mode??"range"}):nr($r?.reason??"selection-target-rejected",$r?.detail)},vg=()=>F.$superdoc.config.documentMode==="suggesting"?"tracked":"direct",yg=()=>{const Rt=(G?.getHandles?.()?.editing??null)?.selection??null;if(typeof Rt?.toSelectionTarget!="function")return nr("selection-target-unavailable","editing.selection.toSelectionTarget is not available");const Vt=Rt.toSelectionTarget();if(!Vt||Vt.kind==="rejected"){const yn=Vt?.rejection??{};return nr(yn.reason??yn.code??"selection-target-rejected",yn.detail)}return!Vt.target||typeof Vt.target!="object"?nr("selection-target-rejected","selection target was not produced"):{ok:!0,target:Vt.target,mode:Vt.mode??"range",story:Vt.story}},Oi=(Rt,Vt)=>{const yn=Rt?.failure??Rt;return nr(yn?.code??Rt?.reason??Vt,yn?.message??yn?.detail??Rt?.detail)},No={focusEditable:xh,readBlocks:(Rt={includeText:!0})=>Sn?.blocks?.list?.(Rt),setSelectionTarget:(Rt={})=>gg(Rt),setSelectionByText:async(Rt={})=>{const Vt=await pg(Rt);if(!Vt.ok)return Vt;const yn=await gg({target:Vt.target,collapse:Rt?.collapse??null,focus:Rt?.focus});return yn.ok?{ok:!0,mode:yn.mode,text:Vt.text,occurrence:Vt.occurrence,target:Vt.target}:yn},replaceTextByText:async({findText:Rt,replacement:Vt,occurrence:yn=0,mode:Ir="direct"}={})=>{if(typeof Vt!="string")return nr("invalid-replacement","replacement must be a string");if(!Sn?.text||typeof Sn.text.replace!="function")return nr("text-replace-unavailable","activeEditor.doc.text.replace is not available");const to=await pg({text:Rt,occurrence:yn});if(!to.ok)return to;const $r=to.ref?{ref:to.ref,text:Vt,mode:Ir}:{target:to.target,text:Vt,mode:Ir},Pi=await Sn.text.replace($r);return Pi?.ok===!1?nr(Pi.reason??"text-replace-failed",Pi.detail):(await Promise.resolve(Yn?.whenPainted?.(Pi)),{ok:!0,receipt:Pi,text:Vt,replacedText:Rt,occurrence:hg(yn)})},replaceSelection:async({target:Rt,replacement:Vt="",mode:yn="direct"}={})=>{if(!Rt||typeof Rt!="object")return nr("invalid-target","target must be a SelectionTarget object");if(typeof Vt!="string")return nr("invalid-replacement","replacement must be a string");if(!Sn?.text||typeof Sn.text.replace!="function")return nr("text-replace-unavailable","activeEditor.doc.text.replace is not available");const Ir=await Sn.text.replace({target:Rt,text:Vt,mode:yn});return Ir?.ok===!1?nr(Ir.reason??"text-replace-failed",Ir.detail):(await Promise.resolve(Yn?.whenPainted?.(Ir)),{ok:!0,receipt:Ir,text:Vt})},serializeSelectionToClipboard:async({includeHtml:Rt=!0}={})=>{if(!Sn?.clipboard||typeof Sn.clipboard.serializeSelection!="function")return nr("clipboard-serialize-unavailable","activeEditor.doc.clipboard.serializeSelection is not available");const Vt=yg();if(!Vt.ok)return Vt;let yn;try{yn=await Sn.clipboard.serializeSelection({target:Vt.target,includeHtml:Rt!==!1})}catch(Ir){return nr("clipboard-serialize-threw",Ir instanceof Error?Ir.message:String(Ir))}return yn?.payload?{ok:!0,payload:yn.payload,plan:yn.plan,target:Vt.target,mode:Vt.mode}:nr("clipboard-serialize-failed","clipboard serialization did not return a payload")},pasteClipboardPayload:async({payload:Rt,target:Vt=null,mode:yn=vg(),fallback:Ir=void 0}={})=>{if(!Rt||typeof Rt!="object")return nr("invalid-clipboard-payload","payload must be a ClipboardPayload object");if(!Sn?.clipboard||typeof Sn.clipboard.insert!="function")return nr("clipboard-insert-unavailable","activeEditor.doc.clipboard.insert is not available");let to=Vt,$r=null;if(!to){const Ad=yg();if(!Ad.ok)return Ad;to=Ad.target,$r=Ad.mode}if(!to||typeof to!="object")return nr("invalid-target","target must be a SelectionTarget or ClipboardTarget object");const Pi={payload:Rt,target:to,changeMode:yn==="tracked"?"tracked":"direct",...Ir!==void 0?{fallback:Ir}:{}},rr=await Sn.clipboard.insert(Pi);return!rr||rr.success===!1||rr.ok===!1?Oi(rr,"clipboard-insert-failed"):(await Promise.resolve(Yn?.whenPainted?.(rr)),{ok:!0,receipt:rr,target:to,mode:$r})},pastePlainText:async({text:Rt,target:Vt=null,mode:yn=vg()}={})=>typeof Rt!="string"?nr("invalid-text","text must be a string"):No.pasteClipboardPayload({payload:{source:"api",items:[{type:"text/plain",kind:"string",data:Rt}]},target:Vt,mode:yn})},el={editorVersion:2,documentId:Ce,host:G,mount:pe,options:{documentId:Ce,documentMode:F.$superdoc.config.documentMode},capabilities:rt??G?.getCapabilities?.()??null,save:ug,exportDocx:dg,replaceFile:Th,upgradeToCollaboration:y2,doc:Sn??null,documentMutationReadiness:Yn??null,documentApiUnavailableReason:eo??null,focus:xh,authoring:No,editCommands:xt??null,v2Comments:sn??null,v2TrackedChanges:En??null,contextMenu:Dt??null,pageMetrics:ns??null,pageLayout:Jo??null,pageFurniture:Ja??null,presence:nc??null,lock:lg??null,provider:cg??null,reviewWindow:{getDiagnostics:()=>ze.getDiagnostics(),getSnapshot:()=>ze.getSnapshot?.()??null,subscribe:Rt=>ze.subscribe?.(Rt)??(()=>{})},extensions:zl(G),fonts:ca??G?.getFontRuntime?.()??null,commands:null,state:null,view:null},Is=C(Ce);if(Is&&(Is.isReady=!0,typeof Is.setEditor=="function"&&Is.setEditor(el)),Ie({documentId:Ce,host:G,mount:pe,facade:el})||F.$superdoc.setActiveEditor(el),cg){const Rt=Wr(cg);F.$superdoc.provider=Rt,Is&&(Is.provider=Rt)}F.$superdoc.broadcastEditorCreate(el),yo({documentId:Ce,bindEditShortcuts:Nt}),Bl({documentId:Ce,bindSessionShortcuts:vn,documentApi:Sn}),o(C(Ce)).state==="valid"&&vd({editor:el}),ns&&Jo&&wo();const Bo=F.$superdoc.config.modules?.comments!==!1;sn&&Bo&&s.setV2CommentsAdapter?.(sn),En&&Bo&&s.setV2TrackedChangesAdapter?.(En),(sn||En)&&ze.setContext({superdoc:F.$superdoc,documentId:Ce,commentsAdapter:sn??null,trackedChangesAdapter:En??null,resolveReviewWindow:Rt=>G.resolveReviewWindow(Rt)}),u.value&&!F.$superdoc.config.collaboration&&(l.value=!0),x.value=!0,Q.value=!0},fr=re(!1),Ko=Br(null),$i=re(!1);let Gi=0,Js=0,Wi=0;const Ki=({editor:O,sourceEditor:G,surface:pe="body",headerId:Ce=null,sectionType:rt=null}={})=>{const xt=F.$superdoc?.activeEditor??null,Nt=O??G??xt??void 0;return{editor:Nt,sourceEditor:G??Nt,surface:pe,headerId:Ce,sectionType:rt}},ea=(O={})=>{F.$superdoc.emit("editor-update",Ki(O))},Ii=()=>{Gi&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Gi),Js&&clearTimeout(Js),Gi=0,Js=0},Ei=(O=OF)=>{Ii();const G=()=>{Gi=0,Js=0,ra(),fr.value&&qo.value&&!d.value&&O>0&&Ei(O-1)};if(typeof requestAnimationFrame=="function"){Gi=requestAnimationFrame(G);return}Js=setTimeout(G,0)},ta=()=>{Wi&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Wi),Wi=0},$a=()=>{fr.value=!1,Ko.value=null,Ii(),ra()},ud=(O,G)=>{if(!O||O.rangeCount<1||O.isCollapsed||!G)return!1;const pe=O.getRangeAt(0);return G.contains(pe.startContainer)&&G.contains(pe.endContainer)},qi=()=>{if(Wi=0,!kt.value)return;let O=null;try{O=F.$superdoc?.activeEditor?.host?.getHandles?.()??null}catch{O=null}const G=F.$superdoc?.config?.documentMode;if(G==="editing"||G==="suggesting"){const xt=O?.editing?.selection?.getSnapshot?.()??null,Nt=O?.editing?.selection?.toSelectionTarget?.();if(Nt?Nt.kind==="ok"&&Nt.mode==="range":LD(G,xt)){const vn=Zr();if(MD(window.getSelection?.()??null,vn)){$a();return}fr.value=!0,Ko.value=xt,Ei();return}}else if(G!=="viewing"){$a();return}const pe=Zr(),Ce=window.getSelection?.()??null;if(!ud(Ce,pe)){const xt=O?.selection?.toSelectionTarget?.(),Nt=xt?.kind==="ok"&&xt.mode==="range";if(Nt&&V.value){fr.value=!0,Ko.value=O?.selection?.getSnapshot?.()??null,O?.selection?.syncVisibleOverlay?.(),Ei();return}Nt&&$i.value&&(O?.selection?.clear?.(),$i.value=!1),$a();return}const rt=O?.selection?.applyDomSelection?.(Ce);if(!rt?.ok||rt.mode!=="range"){$a();return}$i.value=!0,fr.value=!0,Ko.value=O?.selection?.getSnapshot?.()??null,Ei()},jl=()=>{if(kt.value){if(ta(),typeof requestAnimationFrame!="function"){qi();return}Wi=requestAnimationFrame(qi)}},ws=()=>{jl()},Nc=({hasRangeSelection:O,snapshot:G}={})=>{if(Od(F.$superdoc,"selection:changed",()=>({hasRangeSelection:O,selection:G})),fr.value=O===!0,Ko.value=O===!0?G??null:null,fr.value){Ei();return}Ii(),ra()},Zr=()=>Bt.value?.mountContainer??F.$superdoc?.activeEditor?.mount?.container??null,na=O=>{const G=String(O);return globalThis.CSS?.escape?globalThis.CSS.escape(G):G.replace(/["\\]/g,"\\$&")},dd=()=>{const O=Ko.value,G=Zr();if(!O||!G?.querySelector)return null;const pe=O.anchor??null,Ce=[pe?.fragmentId,pe?.blockId,pe?.position?.anchor?.nativeId].filter(rt=>rt!=null&&rt!=="");for(const rt of Ce){const xt=na(rt),Nt=G.querySelector(`[data-source-node-id="${xt}"]`)??G.querySelector(`[data-layout-block-ref="${xt}"]`)??G.querySelector(`[data-layout-fragment-id="${xt}"]`);if(Nt instanceof HTMLElement)return Nt}return null};function gh(O=null){const G=window.getSelection?.();if(!G||G.rangeCount<1||G.isCollapsed)return null;const pe=G.getRangeAt(0);if(!pe)return null;if(O){const{startContainer:Ce,endContainer:rt}=pe;if(!O.contains(Ce)||!O.contains(rt))return null}try{const Ce=pe.getBoundingClientRect();return!Ce||Ce.width<=0&&Ce.height<=0?null:Ce}catch{return null}}const Bc=O=>{if(!O||!Be.value)return null;const G=Be.value.getBoundingClientRect();return{top:O.top-G.top,left:O.left-G.left,right:O.right-G.left,bottom:O.bottom-G.top,width:O.width,height:O.height}},Ti=O=>{let G=O;for(;G&&G.nodeType===1;){const pe=G.dataset?.pageIndex;if(pe!=null&&pe!==""){const Ce=Number(pe);if(Number.isFinite(Ce))return Ce}G=G.parentElement}return null},Vl=()=>{if(!fr.value||!qo.value)return null;const O=gh(Zr()),G=Bc(O)??Ul()?.bounds??null;if(!G)return null;const pe=F.$superdoc?.activeEditor?.options?.documentId??F.$superdoc?.activeEditor?.documentId;if(!pe)return null;const Ce=Ti(dd());return Nf({selectionBounds:G,page:Ce!=null?Ce+1:1,documentId:pe,source:Sc})},Ul=()=>{if(!Be.value)return null;const O=dd();if(!O)return null;const G=O.getBoundingClientRect();if(!G||G.width<=0&&G.height<=0)return null;const pe=Be.value.getBoundingClientRect(),Ce={top:G.top-pe.top,left:G.left-pe.left,right:G.right-pe.left,bottom:G.bottom-pe.top,width:G.width,height:G.height},rt=Ti(O);return{threadId:"pending",key:"pending",kind:"pending",storyKey:"body",bounds:Ce,...rt!=null?{pageIndex:rt}:{},...nn.value!=null?{generation:nn.value}:{}}},ra=()=>{if(!kt.value)return;if(!fr.value){f.value=null,le();return}const O=Vl();if(!O){f.value=null,le();return}ce(O)},zc=O=>{O&&ve({...J.value??{},pending:O})},$n=P.createGeometryPublisher({getLayersContainer:()=>Be.value??null,isCommentsEnabled:()=>!!Mt.value&&it.value,publishPositions:(O,G)=>ve(O,G),clearPositions:()=>{s.clearEditorCommentPositions?.()},readCurrentPositions:()=>J.value??{},setGeometryAvailable:O=>{const G=!!O;cn.value=G,G&&(fn.value=!0,nn.value=$n.getLastEpoch())}}),Hl=(O="tracked-change-restamp")=>{Qt=Math.max(Qt,3),er=O},jc=()=>{const O=Qt>0?er??"tracked-change-restamp":"render-epoch-handoff";return Qt>0&&(Qt-=1),Qt<=0&&(er=null),{retainMissingTrackedChangeGeometry:!0,reason:O}},fd=()=>{Qt=0,er=null},Ga=O=>typeof O=="function"?O():O,Vc=(O,G=void 0)=>{if(Bt.value=O,wn&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(wn),typeof requestAnimationFrame!="function"){$n.publish(Bt.value,Ga(G));return}wn=requestAnimationFrame(()=>{wn=0,$n.publish(Bt.value,Ga(G))})},Yi=O=>{O&&(Vc(O,()=>jc()),fr.value&&Ei())},oa=Br(null),ia=new Map;let Wa=null;const Uc=O=>{if(!O?.snapshot)return;const G=O.snapshot,pe=O.stage;if(typeof HTMLElement<"u"&&pe instanceof HTMLElement){Wa=pe;const rt=pe.dataset?.superdocV2DocumentId;rt&&ia.set(rt,pe)}oa.value=G;const Ce=Array.isArray(G.pages)?G.pages.length:0;F.$superdoc.emit("pagination-update",{totalPages:Ce,superdoc:F.$superdoc}),St(()=>{Cr(),Ql()})},$l=O=>{gn.destroy(),ta(),Ii(),wn&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(wn),wn=0,Bt.value=null,nn.value=null,cn.value=!1,fn.value=!1,fd(),$n.reset(),fr.value=!1,Ko.value=null,f.value=null,le(),oa.value=null;const G=O?.documentId==null?null:String(O.documentId);Xr(G),s.cancelImportedTrackedChangeBootstrap?.(G??void 0),G&&ia.delete(G),Wa&&(G==null||Wa.dataset?.superdocV2DocumentId===G)&&(Wa=null),ze.reset("render-cleared"),s.setV2CommentsAdapter?.(null),s.setV2TrackedChangesAdapter?.(null),s.clearEditorCommentPositions?.(),qn(O?.documentId??null),wo()},wr=(O,G)=>{if(!G||(Od(F.$superdoc,G.type,()=>({...G,documentId:O?.id??null})),G.type==="mutation:committed"&&G.origin==="extension"))return;const pe=O?.id??null;if(G.type==="collaboration:document-replaced"&&Qs(pe),G.type==="review-mutation:started"){ze.beginMutation(G.reviewMutation);return}if(G.type==="review-mutation:aborted"){ze.settleMutation(G.reviewMutation?.token,{outcome:"aborted",resumeDomains:["comments","trackedChanges"],trackedRowCount:s.getV2TrackedChangeRowCount?.(pe)??null});return}if(G.type==="reviewTarget:changed"){yh(G.next);return}if(G.type==="collaboration:remote-changed"){G.reviewChanged!==!1&&(ze.invalidate("collaboration:remote-review-changed"),ze.refreshCommittedWindow("collaboration:remote-review-changed"));return}if(G.type==="source:complete"){F.$superdoc.broadcastSourceComplete();return}if(G.type==="source:signals-complete"){const Nt=wm(G);for(const vn of G.diagnostics??[]){const sn=eF(vn,{documentId:pe,editor:null});sn&&ht.shouldEmit(pe,Nt,sn.internalCode)&&F.$superdoc.emit("exception",sn)}F.$superdoc.broadcastSourceSignalsComplete();return}if(G.type==="mutation:rejected"){G.reviewMutation?.token&&ze.settleMutation(G.reviewMutation.token,{outcome:"rejected",resumeDomains:["comments","trackedChanges"],trackedRowCount:s.getV2TrackedChangeRowCount?.(pe)??null}),n_(G)?bo(pe,G):oo(pe,G);return}if(G.type==="mutation:committed"){const Nt=wD(pe,G.trackedChangeBulkDecision);Nt&&F.$superdoc.emit("tracked-changes:bulk-decision",Nt),ea()}if(G.type!=="mutation:committed")return;G.origin==="history"?ze.refreshCommittedWindow(`history-${G.direction}`):G.reviewSidecarOnly===!0&&ze.refreshCommittedWindow("review-sidecar-committed");const Ce=ZS(G);dD({event:G,commentsStore:s,superdoc:F.$superdoc,documentId:pe}),Array.isArray(Ce?.remappedPairs)&&Ce.remappedPairs.length>0&&s.remapTrackedChangeIdentities?.(Ce.remappedPairs,{documentId:pe}),Ce&&Hl("tracked-change-mutation");const rt=F.$superdoc?.activeEditor??null,xt=Ce?s.reconcileTrackedChangeMutationFromV2?.({superdoc:F.$superdoc,adapter:rt?.v2TrackedChanges??null,documentId:pe,...Ce}):Promise.resolve({ok:!0});if(G.reviewMutation?.token){const Nt=G.reviewMutation,vn=!!(Ce?.allResolved??G.trackedChangeAllResolved),sn=En=>{const Dt=vn&&En?.ok===!0&&En?.allResolved===!0;ze.settleMutation(Nt.token,{outcome:"committed",allResolved:Dt,resumeDomains:Dt?["comments"]:["comments","trackedChanges"],trackedRowCount:s.getV2TrackedChangeRowCount?.(pe)??null})};Promise.resolve(xt).then(sn,()=>sn(null));return}Promise.resolve(xt).catch(()=>{})},Gl=O=>{gn.handleLinkClick(O)},Wl=async O=>{try{await s.announceV2CommentCreated?.({superdoc:F.$superdoc,commentId:O?.commentId})}catch(G){console.warn("[SuperDoc][v2] context-menu comment reconciliation failed",G)}},xi=(O=void 0)=>{if(kt.value&&$n.getLastPayload()){if(wn&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(wn),typeof requestAnimationFrame!="function"){$n.recollect(Ga(O));return}wn=requestAnimationFrame(()=>{wn=0,$n.recollect(Ga(O))})}},hd=()=>{if(!kt.value)return;try{ze.refreshCommittedWindow("document-mode-change")}catch(G){console.warn("[SuperDoc][v2] document-mode review-window refresh failed",G)}const O=()=>{kt.value&&(it.value?Bt.value?Vc(Bt.value):xi():(s.clearEditorCommentPositions?.(),cn.value=!1))};St(()=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>O()):O()})},pd=O=>{switch(O){case"editing-mount-required":return"SuperDoc could not load the document editor because the page did not provide a mount container.";case"source-load-failed":return"SuperDoc could not load the document editor because the document source could not be prepared.";case"unsupported-cdn-v2-editor":return"SuperDoc could not load the document editor because this build does not include the V2 runtime.";case"v2-integration-unavailable":return"SuperDoc could not load the document editor because the bundled V2 runtime is unavailable in this environment.";case"worker-init-failed":return"SuperDoc could not load the document editor because the browser worker failed to start.";case"input-too-large-for-inline-review":return"SuperDoc could not load the document editor because this document is too large to open without the browser worker.";case"collaboration-unsupported-huge-document":return"SuperDoc could not load the document editor because large documents cannot be opened with collaboration enabled yet.";case"collaboration-v1-config-unsupported":return"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.collaboration with a v2 room instead.";case"collaboration-room-format-unsupported":return"SuperDoc v2 cannot open this collaboration state because it is not stored in the SuperDoc v2 room format. No changes were made.";case"collaboration-room-format-conflict":return"SuperDoc v2 found conflicting room formats in one collaboration document. No changes were made.";case"collaboration-room-corrupt":return"SuperDoc v2 found a structurally invalid collaboration room. No changes were made.";case"collaboration-v2-room-missing":return'SuperDoc v2 could not find a committed v2 collaboration room. No changes were made. Use roomMode: "create" only when creating a new room.';case"collaboration-v2-room-already-exists":return'SuperDoc v2 was asked to create a collaboration room that already exists. Use roomMode: "join" to open it.';case"collaboration-v2-room-initializing":return"The SuperDoc v2 collaboration room is still initializing. Join mode did not modify it.";case"collaboration-open-intent-invalid":return"SuperDoc v2 received an invalid collaboration room mode. No provider was connected.";case"collaboration-config-invalid":return"SuperDoc v2 received an invalid collaboration configuration. No provider was connected.";default:return"SuperDoc could not load the document editor."}},Ka=O=>typeof O=="string"&&O.trim().length>0?O.trim():null,md=O=>{qn(O?.documentId??null);const G=typeof O?.reason=="string"&&O.reason.length>0?O.reason:"open-failed",pe=Ka(O?.detail),Ce=typeof O?.documentId=="string"&&O.documentId.length>0?O.documentId:null,rt=HP(G,Ce),xt=rt?.error.message??pd(G),Nt=O?.workerFailure&&typeof O.workerFailure=="object"?O.workerFailure:null;li(Ce,{reason:G,message:xt,detail:pe,...Nt?{workerFailure:Nt}:{}});const vn={...pe?{detail:pe}:{},...Ce?{documentId:Ce}:{},...Nt?{workerFailure:Nt}:{},reason:G};G==="collaboration-v1-config-unsupported"||G==="collaboration-room-format-unsupported"||G==="collaboration-room-format-conflict"||G==="collaboration-room-corrupt"||G==="collaboration-v2-room-missing"||G==="collaboration-v2-room-already-exists"||G==="collaboration-v2-room-initializing"||G==="collaboration-open-intent-invalid"||G==="collaboration-config-invalid"?console.warn(`[SuperDoc] ${xt}`,vn):console.error(`[SuperDoc] ${xt}`,vn),F.$superdoc.emit("exception",rt??{error:new Error(xt),code:G,...Ce?{documentId:Ce}:{},editor:null,...Nt?{workerFailure:Nt}:{}});const sn=QP(G,pe,{documentId:Ce,editor:null,bootErrorName:typeof O?.bootErrorName=="string"?O.bootErrorName:void 0}),En=Array.isArray(O?.diagnostics)?O.diagnostics:[],Dt=wm(O),Sn=En.map(eo=>({record:eo,diagnostic:sA(eo,{documentId:Ce,editor:null})})).filter(eo=>eo.diagnostic),Yn=rF(sn,G,Sn);sn&&!Yn&&F.$superdoc.emit("exception",sn);for(const{diagnostic:eo}of Sn)ht.shouldEmit(Ce,Dt,eo.internalCode)&&F.$superdoc.emit("exception",eo)},Kl=(O,G)=>{const pe=O?.id??null,Ce=G?.snapshot?.diagnostics;if(!Array.isArray(Ce)||Ce.length===0)return;const rt=wm(G);for(const xt of Ce){const Nt=XP(xt,{documentId:pe,editor:null});Nt&&ht.shouldEmit(pe,rt,Nt.internalCode)&&F.$superdoc.emit("exception",Nt)}},Hc=(O,G)=>{const pe=O?.id??(typeof G?.documentId=="string"?G.documentId:null),Ce=G?.diagnostics;if(!Array.isArray(Ce)||Ce.length===0)return;const rt=wm(G);for(const xt of Ce){const Nt=sA(xt,{documentId:pe,editor:null});Nt&&ht.shouldEmit(pe,rt,Nt.internalCode)&&F.$superdoc.emit("exception",Nt)}},ql=(O,G)=>{F.$superdoc?.activateRuntimeFromEventTarget?.(O.target,G)},Qr=O=>ql(O,"focusin"),$c=O=>ql(O,"pointerdown"),gd=O=>ql(O,"mousedown"),vd=({editor:O})=>{F.$superdoc.emit("collaboration-ready",{editor:O}),St(()=>{l.value=!0;const G=new URLSearchParams(window.location.search).get("commentId");G&&ks(G)})};let Gc=0;const yd=()=>{Gc=Date.now()+250},qa=()=>Date.now()<Gc,bd=O=>{const G=Wt.value;G&&(!(O.target instanceof Node)||!G.contains(O.target)||(Be.value?.contains(O.target)&&(W9(O.target)||s.setActiveComment(F.$superdoc,null),s.removePendingComment(F.$superdoc),Cs()),yd()))},Ya=O=>{const G=F.$superdoc.listeners?.("fonts-resolved")?.length>0?F.$superdoc.listeners("fonts-resolved")[0]:null,pe=F.$superdoc.config.useLayoutEngine!==!1,Ce=O.isNewFile,rt=F.$superdoc.config?.benchmarkExecutionMode,xt=F.$superdoc.config?.benchmarkTraceEnabled===!0,Nt=o(O),vn=Nt.state==="valid"?Nt.config:null,sn=F.$superdoc.config.v2CollaborationPreflightFailure??(Nt.state==="invalid"?Nt.failure:null);return{isDebug:F.$superdoc.config.isDebug||!1,documentId:O.id,user:F.$superdoc.user,users:F.$superdoc.users,colors:F.$superdoc.colors,role:F.$superdoc.config.role,interaction:F.$superdoc.interactionConfig,html:O.html,markdown:O.markdown,documentMode:F.$superdoc.config.documentMode,...rt?{benchmarkExecutionMode:rt}:{},...xt?{benchmarkTraceEnabled:!0}:{},allowSelectionInViewMode:F.$superdoc.config.allowSelectionInViewMode,rulers:O.rulers,rulerContainer:Or.value,isInternal:F.$superdoc.config.isInternal,annotations:F.$superdoc.config.annotations,isCommentsEnabled:!!Mt.value,isAiEnabled:F.$superdoc.config.modules?.ai,contextMenuConfig:(F.$superdoc.config.modules?.slashMenu&&!F.$superdoc.config.modules?.contextMenu&&console.warn("[SuperDoc] modules.slashMenu is deprecated. Use modules.contextMenu instead."),F.$superdoc.uiConfig.contextMenu.options),slashMenuConfig:F.$superdoc.config.modules?.contextMenu??F.$superdoc.config.modules?.slashMenu,comments:{highlightColors:Mt.value?.highlightColors,highlightOpacity:Mt.value?.highlightOpacity},trackedChanges:F.$superdoc.config.modules?.trackChanges,experimental:F.$superdoc.config.experimental,...vn?{v2Collaboration:vn}:{},...sn?{collaborationPreflightFailure:sn}:{},onCollaborationReady:vd,onCommentsUpdate:qc,onFontsResolved:G,onPageCountKnown:F.$superdoc.config.onPageCountKnown??null,onReviewWindowCommitted:En=>{ze.onCommittedPagePaint?.({...En,documentId:O.id})},fontAssets:F.$superdoc.config.fonts,workerUrls:F.$superdoc.config.workerUrls,fieldContext:O.fieldContext,fieldUpdatePolicy:F.$superdoc.config.fieldUpdatePolicy,workerStartupTimeoutMs:F.$superdoc.config.workerStartupTimeoutMs,proofing:yt.value,isNewFile:Ce,password:r(O),handleImageUpload:F.$superdoc.config.handleImageUpload,externalExtensions:F.$superdoc.config.editorExtensions||[],extensions:F.$superdoc.config.extensions||[],...vo?.pdfLib?{pdfLib:vo.pdfLib}:{},suppressDefaultDocxStyles:F.$superdoc.config.suppressDefaultDocxStyles,disableContextMenu:!F.$superdoc.uiConfig.contextMenu.enabled||F.$superdoc.config.disableContextMenu===!0,jsonOverride:F.$superdoc.config.jsonOverride,viewOptions:F.$superdoc.config.viewOptions,contained:F.$superdoc.config.contained,styleNonce:F.$superdoc.config.cspNonce,documentLoading:F.$superdoc.uiConfig.loading.enabled,linkPopoverResolver:Pt(),layoutEngineOptions:pe?{...F.$superdoc.config.layoutEngineOptions||{},proofing:yt.value,debugLabel:F.$superdoc.config.layoutEngineOptions?.debugLabel??O.name??O.id,zoom:(p.value??100)/100,emitCommentPositionsInViewing:Se()&&it.value,enableCommentsInViewing:Le.value,contentControlsChrome:F.$superdoc.uiConfig.contentControls.options.chrome,resolveTrackedChangeColor:P9(F.$superdoc.config.modules?.trackChanges?.authorColors)}:void 0,permissionResolver:(En={})=>F.$superdoc.canPerformPermission({role:F.$superdoc.config.role,isInternal:F.$superdoc.config.isInternal,...En})}},vh=new Set(["commentText","isInternal","parentCommentId","trackedChangeParentId","trackedChangeThreadParentId","threadingParentCommentId","trackedChange","trackedChangeType","trackedChangeText","trackedChangeDisplayType","semanticColorKey","semanticColor","trackedChangeStory","trackedChangeStoryKind","trackedChangeStoryLabel","trackedChangeAnchorKey","trackedChangeLabel","trackedChangeDetailLines","deletedText","resolvedTime","resolvedById","resolvedByEmail","resolvedByName","importedAuthor","docxCommentJSON"]),wd=(O,G={})=>{if(!(!O||G.isDone===void 0)&&!(G.resolvedTime!=null||G.resolvedById!=null||G.resolvedByEmail!=null||G.resolvedByName!=null)){if(G.isDone){O.resolvedTime=O.resolvedTime||Date.now(),O.resolvedById=O.resolvedById||G.creatorId||null,O.resolvedByEmail=O.resolvedByEmail||G.creatorEmail||null,O.resolvedByName=O.resolvedByName||G.creatorName||null;return}O.resolvedTime=null,O.resolvedById=null,O.resolvedByEmail=null,O.resolvedByName=null}},Cd=(O,G,pe)=>{!O||!G||(Array.isArray(G.elements)&&(O.docxCommentJSON=G.elements),Object.entries(G).forEach(([Ce,rt])=>{rt!==void 0&&Ce!=="text"&&Ce!=="elements"&&vh.has(Ce)&&(O[Ce]=rt)}),pe!==void 0&&(O.commentText=pe),wd(O,G))},kd=(O={})=>{const G={...O};return!G.commentText&&G.text&&(G.commentText=G.text),!G.docxCommentJSON&&Array.isArray(G.elements)&&(G.docxCommentJSON=G.elements),wd(G,G),G},Wc=O=>{if(Number.isFinite(I()))return;if(O==null){se();return}const G=Be.value,{key:pe,entry:Ce}=ae(O),rt=MS(G,Ce);if(Number.isFinite(rt)){ie(rt,O,pe??O);return}se()},Kc=O=>O==null||j.value==null?!1:String(j.value)===String(O),yh=O=>{if(O?.origin!=="document"||qa())return;const G=hD(O,Tt);G&&(Wc(G),j.value=G,Y.value=!0,setTimeout(()=>{Y.value=!1},0))},qc=(O={})=>{let{activeCommentId:G,type:pe,comment:Ce}=O,rt=Object.prototype.hasOwnProperty.call(O,"activeCommentId");const xt=vn=>{const sn=[vn?.importedId,vn?.commentId].filter(Boolean).map(En=>String(En));return[...new Set(sn)]},Nt=vn=>{const sn=[vn?.importedId,vn?.commentId].filter(Boolean).map(Dt=>String(Dt)),En=F.$superdoc?.activeEditor?.options?.documentId!=null?String(F.$superdoc.activeEditor.options.documentId):null;for(const Dt of sn){const Sn=W.value.find(Yn=>{const eo=Yn?.commentId!=null?String(Yn.commentId):null,ns=Yn?.importedId!=null?String(Yn.importedId):null;return eo===Dt||ns===Dt?!En||typeof Ee!="function"?!0:Ee(Yn,En):!1});if(Sn){const Yn=Sn?.commentId??Sn?.importedId??Dt;return{id:Yn!=null?String(Yn):null,existingComment:Sn}}}return{id:sn[0]||null,existingComment:null}};if(pe==="replayCompleted"&&Hi(),Ue?.ADD&&pe===Ue.ADD&&Ce){Ce=kd(Ce);const vn=F.$superdoc?.user;vn&&(Ce.creatorId||(Ce.creatorId=vn.id),Ce.creatorName||(Ce.creatorName=vn.name),Ce.creatorEmail||(Ce.creatorEmail=vn.email)),Ce.createdTime||(Ce.createdTime=Date.now());const sn=Ce.documentId||a.value?.[0]?.id;!Ce.documentId&&sn&&(Ce.documentId=sn),!Ce.fileId&&sn&&(Ce.fileId=sn);const{id:En,existingComment:Dt}=Nt(Ce);if(En&&!Dt){const Sn=Vs(Ce);tt({superdoc:F.$superdoc,comment:Sn,skipEditorUpdate:!0})}}if(Ue?.UPDATE&&pe===Ue.UPDATE&&Ce){const{id:vn,existingComment:sn}=Nt(Ce);if(vn){const En=Ce.commentText||Ce.text;if(sn)Cd(sn,Ce,En);else{const Dt=Vs(kd(Ce));tt({superdoc:F.$superdoc,comment:Dt,skipEditorUpdate:!0})}}}if(Ue?.DELETED&&pe===Ue.DELETED&&Ce){const vn=xt(Ce);if(vn.length){const sn=F.$superdoc?.activeEditor?.options?.documentId!=null?String(F.$superdoc.activeEditor.options.documentId):null,En=Sn=>!sn||typeof Ee!="function"?!0:Ee(Sn,sn),Dt=$9(W.value,vn,En);if(Dt.size){const Sn=[...W.value];W.value=W.value.filter(Jo=>{if(!En(Jo))return!0;const Ja=Jo.commentId!=null?String(Jo.commentId):null,nc=Jo.importedId!=null?String(Jo.importedId):null;return!(Ja&&Dt.has(Ja)||nc&&Dt.has(nc))});const Yn=j.value!=null?String(j.value):null,eo=Yn!=null?Sn.find(Jo=>{const Ja=Jo.commentId!=null?String(Jo.commentId):null,nc=Jo.importedId!=null?String(Jo.importedId):null;return Ja===Yn||nc===Yn}):null,ns=eo?En(eo):!1;Yn&&Dt.has(Yn)&&ns&&(G=null,rt=!0)}}}pe==="trackedChange"&&ge({superdoc:F.$superdoc,params:O}),rt&&G!=null&&qa()&&(rt=!1),rt&&(G==null||!Kc(G))&&Wc(G),St(()=>{V.value||(rt&&s.setActiveComment(F.$superdoc,G),rt&&(Y.value=!0,setTimeout(()=>{Y.value=!1},0)))}),typeof F.$superdoc.config.onCommentsUpdate=="function"&&F.$superdoc.config.onCommentsUpdate(O)},qo=ke(()=>!!Mt.value),Yc=ke(()=>Array.isArray(a.value)?a.value.filter(O=>O?.type===Ea):[]),Xc=ke(()=>Yc.value.length>0),Zc=ke(()=>Xc.value&&qo.value),bh=ke(()=>new Set(Yc.value.map(O=>String(O.id)))),Yl=O=>typeof O=="number"?Number.isFinite(O):typeof O=="string"&&O.trim()!==""?Number.isFinite(Number(O)):!1,wh=O=>{const G=O?.selection?.selectionBounds;return!!G&&Yl(G.top)&&Yl(G.left)&&Yl(G.right)&&Yl(G.bottom)},Ch=O=>{const G=O?.fileId??O?.documentId??O?.selection?.documentId;return G!=null?String(G):null},kh=O=>{const G=bh.value;if(!G.size)return!1;const pe=Ch(O);return pe?G.has(pe):G.size===1},Qc=O=>O?.selection?.source==="pdf"&&wh(O)&&kh(O),Xa=ke(()=>{if(!Xc.value)return!1;const O=N.value.some(pe=>Qc(pe)),G=Qc(V.value);return O||G}),Jc=ke(()=>{const O=Mt.value?.layout??"sidebar";return!fb.has(O)||O==="sidebar"?!0:O==="inline"?!1:O!=="auto"?!0:!yr.value}),ui=ke(()=>kt.value&&!cn.value&&!fn.value&&!Xa.value||!it.value||!Jc.value?!1:V.value||(N.value.length>0||_e.value)&&l.value&&Be.value&&qo.value&&!K.value),sa=ke(()=>{if(ui.value||!qo.value)return null;if(V.value)return V.value;if(!j.value)return null;const O=Tt(j.value)??null;return kt.value&&Jc.value&&O?.trackedChange&&!Xa.value?null:O}),{compactCommentPopoverStyle:Sh,closeCompactCommentPopover:_h,resetClickAnchor:Cs}=lD({activeComment:j,pendingComment:V,activeCompactComment:sa,showCommentsSidebar:ui,superdocRoot:Wt,layers:Be,documents:a,resolveCommentPositionEntry:ae,selectionPosition:d,activeZoom:p,clearActiveComment:()=>s.setActiveComment(F.$superdoc,null),clearPendingComment:()=>s.removePendingComment(F.$superdoc)}),Sd=ke(()=>qo.value?d.value&&xn.top&&!L.value?.readOnly:!1);ke(()=>qo.value?!L.value?.readOnly&&d.value:!1),jt(ui,O=>{F.$superdoc.broadcastSidebarToggle(O)}),l9({getSuperdoc:()=>F.$superdoc,superdocContainerWidth:Ur,isReady:l,activeZoom:p,zoomMode:g,viewportMetrics:v,showCommentsSidebar:ui,rightSidebarRef:rn,superdocRoot:Wt,documents:a});const ks=O=>{F.$superdoc.scrollToComment(O)},Xl=()=>{xi()},Xi=O=>{if(!kt.value)return;const G=Array.isArray(O?.detail?.itemIds)?O.detail.itemIds.map(pe=>pe==null?"":String(pe)).filter(Boolean):[];Hl(O?.detail?.refreshReason??"tracked-change-restamp"),xi({retainMissingTrackedChangeGeometry:!0,...G.length>0?{retainedTrackedChangeIds:G}:{},reason:"tracked-change-restamp"})};Nn(()=>{document.addEventListener("contextmenu",bd,!0),document.addEventListener("keydown",M,!0),F.$superdoc?.on?.("search:open",Za),vb(aa),Wt.value?.addEventListener("pointerdown",Zi,!0),Wt.value?.addEventListener("focusin",Zi,!0),Wt.value?.addEventListener(AA,Xi),typeof window<"u"&&(window.addEventListener("scroll",Xl,!0),window.addEventListener("resize",Xl,!0)),document.addEventListener("focusin",Qr,!0),document.addEventListener("pointerdown",$c,!0),document.addEventListener("mousedown",gd,!0),document.addEventListener("pointerup",ws,!0),document.addEventListener("mouseup",ws,!0),document.addEventListener("selectionchange",ws),F.$superdoc?.on?.("document-mode-change",hd),F.$superdoc?.on?.("active-editor-change",wo),Ar(),et()}),jt(it,O=>{kt.value&&(O?Bt.value&&Vc(Bt.value):(s.clearEditorCommentPositions?.(),cn.value=!1))}),jt(Be,()=>{xi()});function io(O){return(O.metaKey||O.ctrlKey)&&!O.altKey&&O.key?.toLowerCase?.()==="f"}function Ah(O){return(O.metaKey||O.ctrlKey)&&O.shiftKey&&!O.altKey&&(O.code==="Digit8"||O.key==="8"||O.key==="*")}function Zl(){const O=Wt.value,G=document.activeElement;if(!(G instanceof Node))return!1;if(O?.contains(G))return!0;const pe=F.$superdoc?.activeEditor?.view?.dom;return pe instanceof Node&&(G===pe||pe.contains?.(G))}const aa={};function _d(O){io(O)&&Xe.value&&WD(O,{focusInside:Zl(),owner:aa})&&nt.wouldOpen()&&(O.preventDefault(),O.stopPropagation(),vb(aa),nt.open())}function Zi(){vb(aa)}function Za(){Xe.value&&nt.open()}function A(O){Ah(O)&&(kt.value||Zl()&&(O.preventDefault(),O.stopPropagation(),F.$superdoc.toggleFormattingMarks?.()))}function M(O){if(O.key==="Escape"&&sa.value){O.preventDefault(),O.stopPropagation(),_h();return}_d(O),!O.defaultPrevented&&A(O)}function X(O){_d(O),!O.defaultPrevented&&A(O)}cr(()=>{s.cancelImportedTrackedChangeBootstrap?.(),T.destroy(),nt.destroy(),gn.destroy(),ta(),Ii(),Mi(),Ri();for(const O of Array.from(br.keys()))ai(O);for(const O of Array.from(Ao.keys()))_i(O);for(const O of Array.from(Io.keys()))Eo(O);br.clear(),Ln.clear(),document.removeEventListener("contextmenu",bd,!0),document.removeEventListener("keydown",M,!0),F.$superdoc?.off?.("search:open",Za),Wt.value?.removeEventListener("pointerdown",Zi,!0),Wt.value?.removeEventListener("focusin",Zi,!0),Wt.value?.removeEventListener(AA,Xi),$D(aa),typeof window<"u"&&(window.removeEventListener("scroll",Xl,!0),window.removeEventListener("resize",Xl,!0)),wn&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(wn),wn=0),document.removeEventListener("focusin",Qr,!0),document.removeEventListener("pointerdown",$c,!0),document.removeEventListener("mousedown",gd,!0),document.removeEventListener("pointerup",ws,!0),document.removeEventListener("mouseup",ws,!0),document.removeEventListener("selectionchange",ws),F.$superdoc?.off?.("document-mode-change",hd),F.$superdoc?.off?.("active-editor-change",wo)});const te=re(null),ne=re(!1),he=ke(()=>{if(!d.value||d.value.source==="document-editor")return{x:null,y:null};const O=d.value.source==="pdf"?(p.value??100)/100:1,G=d.value.top*O,pe=d.value.left*O,Ce=d.value.right*O,rt=d.value.bottom*O;return{zIndex:500,borderRadius:"4px",top:G+"px",left:pe+"px",height:Math.abs(G-rt)+"px",width:Math.abs(pe-Ce)+"px"}}),ce=O=>{if(Se()&&!Ae()){le();return}if(!O.selectionBounds||!qo.value)return;le();const G=window.matchMedia("(max-width: 768px)").matches;if(we({startX:O.selectionBounds.left,startY:O.selectionBounds.top,x:O.selectionBounds.right,y:O.selectionBounds.bottom,source:O.source}),!d.value)return;const pe=Math.abs(d.value.left-d.value.right)>5,Ce=Math.abs(d.value.top-d.value.bottom)>5;if(!pe||!Ce){te.value?.style&&(te.value.style.pointerEvents="none"),le();return}f.value=O;const rt=O.source==="pdf"||O.source?.value==="pdf"?(p.value??100)/100:1,xt=O.selectionBounds.top*rt;xn.top=xt+"px",xn.right=G?"0":"-25px"},le=()=>{d.value=null,xn.top=null},we=({startX:O,startY:G,x:pe,y:Ce,source:rt,page:xt})=>{if(!(typeof O=="number"||typeof G=="number")&&!(typeof pe=="number"||typeof Ce=="number")){le();return}if(!d.value){if(G==null||O==null)return;d.value={top:G,left:O,right:O,bottom:G,startX:O,startY:G,source:rt,page:xt??null}}typeof O=="number"&&(d.value.startX=O),typeof G=="number"&&(d.value.startY=G),typeof Ce=="number"&&(Ce<d.value.startY?d.value.top=Ce:d.value.bottom=Ce),typeof pe=="number"&&(pe<d.value.startX?d.value.left=pe:d.value.right=pe)},xe=O=>{const G=O?.clientX,pe=O?.clientY;if(typeof G!="number"||typeof pe!="number")return null;const Ce=document.elementsFromPoint(G,pe).find(rt=>rt?.dataset?.pdfPage!=null);if(Ce){const rt=Number(Ce.dataset?.pageNumber);return Number.isFinite(rt)?rt:null}return null},Ve=O=>{le(),te.value.style.pointerEvents="auto",St(()=>{ne.value=!0,te.value.style.pointerEvents="none";const G=xe(O);if(te.value.style.pointerEvents="auto",!G){ne.value=!1,te.value.style.pointerEvents="none";return}const pe=te.value.getBoundingClientRect(),Ce=p.value/100,rt=(O.clientX-pe.left)/Ce,xt=(O.clientY-pe.top)/Ce;we({startX:rt,startY:xt,page:G,source:"pdf"}),te.value.addEventListener("mousemove",Me)})},Me=O=>{if(!ne.value)return;const G=te.value.getBoundingClientRect(),pe=p.value/100,Ce=(O.clientX-G.left)/pe,rt=(O.clientY-G.top)/pe;we({x:Ce,y:rt})},Ge=O=>{if(!ne.value||(te.value.removeEventListener("mousemove",Me),!d.value))return;const G=d.value.page??xe(O),pe=Nf({selectionBounds:{top:d.value.top,left:d.value.left,right:d.value.right,bottom:d.value.bottom},page:G??1,documentId:a.value[0].id,source:"pdf"});ce(pe),te.value.style.pointerEvents="none"},st=ke(()=>{if(!F.$superdoc.uiConfig.comments.enabled)return!1;const O=F.$superdoc.config.modules?.comments;return!O||O===!1?!1:!O.readOnly}),ot=re(!1),bt=re(null),pt=O=>O&&typeof O=="object"&&"value"in O?O.value:O,qt=O=>{if(!kt.value||!O||O.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||F.$superdoc.config.viewOptions?.layout==="web"||F.$superdoc.uiConfig.ruler.suppressed||!pt(O.rulers)||!ot.value)return!1;const G=F.$superdoc?.activeEditor;if(!G||G.editorVersion!==2)return!1;const pe=pt(O.id),Ce=bt.value;return pe&&Ce&&pe!==Ce?!1:!!(G.pageMetrics&&G.pageLayout)},Cn=re({}),hr=re(null);let Yt=null,Pn=null,hn=0,tr=null,Jr=null;const Or=ke(()=>F.$superdoc?.uiConfig?.ruler?.container??null),Qi=()=>{const O=Or.value;return O?typeof O=="string"?(typeof document<"u"?document:globalThis.document)?.querySelector(O)??null:typeof HTMLElement<"u"&&O instanceof HTMLElement?O:null:null},di=()=>F.$superdoc?.activeEditor?.documentId??F.$superdoc?.activeEditor?.options?.documentId??null,ut=()=>{if(Or.value)return Qi();const O=di();return O==null?null:Ln.get(O)??Ln.get(String(O))??null},kn=()=>{const O=di(),G=O==null?Wa:ia.get(String(O))??null;if(!G?.isConnected)return null;const pe=Array.from(G.children).find(rt=>rt.dataset?.v2PaintWrapper==="true")??G,Ce=Array.from(pe.children).filter(rt=>rt.classList?.contains("superdoc-page"));return(Ce.find(rt=>Number(rt.dataset?.pageIndex)===hn)??Ce[0]??pe).getBoundingClientRect()},Cr=()=>{if(!kt.value){Cn.value={},hr.value=null;return}const O=ut();if(!O){Cn.value={},hr.value=null;return}const G=kn();if(!G){Cn.value={},hr.value=null;return}const pe=O.getBoundingClientRect(),Ce=Math.max(0,G.left-pe.left),rt=Math.max(0,pe.right-G.right);Cn.value={paddingLeft:`${Ce}px`,paddingRight:`${rt}px`},hr.value={left:G.left,top:G.top,width:G.width,height:G.height}},Ri=()=>{const O=Jr;Jr=null,tr=null,hn=0;try{O?.()}catch{}},Qa=O=>{if(Ri(),!!O){tr=O;try{hn=O.getActiveRulerContext?.()?.pageIndex??0,Jr=O.subscribeActiveRulerContext?.(G=>{if(tr!==O)return;const pe=G?.pageIndex??0;pe!==hn&&(hn=pe,St(()=>Cr()))})??null}catch{Ri()}}},wo=()=>{const O=F.$superdoc?.activeEditor,G=O?.documentId??O?.options?.documentId??null;if(bt.value=G,O?.editorVersion!==2||!O.pageMetrics||!O.pageLayout){Mi(),Ri(),Cn.value={},ot.value=!1;return}tr!==O.pageLayout&&Qa(O.pageLayout),ot.value=!0,St(()=>{Cr(),Ql()})},Mi=()=>{typeof window<"u"&&window.removeEventListener("scroll",Cr,!0);try{Yt?.disconnect()}catch{}Yt=null;try{Pn?.disconnect()}catch{}Pn=null},Ql=()=>{if(Mi(),typeof window<"u"&&window.addEventListener("scroll",Cr,!0),typeof ResizeObserver>"u")return;const O=Be.value,G=ut();O&&(Yt=new ResizeObserver(()=>Cr()),Yt.observe(O)),G&&(Pn=new ResizeObserver(()=>Cr()),Pn.observe(G))},Ji=(O,G)=>{!O||!G||(O.documentMarginsLastChange=G.pageMargins??null,F.$superdoc.emit("page-margins-change",{documentId:O.id,editorVersion:2,sectionId:G.sectionId,sectionIndex:G.sectionIndex,side:G.side,value:G.value,pageMargins:G.pageMargins}))},eu=O=>{qo.value&&(le(),ne.value=!0,Ve(O))},Ss=({selectionBounds:O,documentId:G,page:pe})=>{if(!O||!G)return;const Ce=Nf({selectionBounds:O,documentId:G,page:pe,source:"pdf"});ce(Ce)},fi=O=>{Be.value?.querySelectorAll(".superdoc__sub-document")?.forEach(G=>{G.querySelector(".sd-pdf-viewer")||(O===1?(G.style.transformOrigin="",G.style.transform="",G.style.width=""):(G.style.transformOrigin="top left",G.style.transform=`scale(${O})`,G.style.width=`${100/O}%`))})};let Yo=!1;const Xo=()=>{if(Yo||F.$superdoc.config.useLayoutEngine!==!1)return;const O=(p.value??100)/100;O!==1&&(Yo=!0,St(()=>fi(O)))};jt(()=>p.value,O=>{const G=(O??100)/100,pe=O??100,Ce=F.$superdoc?.activeEditor?.pageMetrics??null;if(kt.value&&F.$superdoc?.activeEditor?.editorVersion===2&&Ce?.setZoom)try{Ce.setZoom(pe)}catch(rt){console.warn("[SuperDoc][v2] setZoom failed",rt)}else Yo=!0,fi(G);tc()?.updateScale(G),St(()=>{la(),Li()})}),jt(N,()=>{Q.value||(Q.value=!0)});const{whiteboardModuleConfig:_s,whiteboard:hi,whiteboardPages:es,whiteboardPageSizes:Jl,whiteboardPageOffsets:As,whiteboardEnabled:ec,whiteboardOpacity:Zo,handleWhiteboardPageReady:ts,updateWhiteboardPageSizes:la,updateWhiteboardPageOffsets:Li}=A9({proxy:F,layers:Be,documents:a,modules:b}),tc=()=>Array.isArray(zn.value)?zn.value[0]:zn.value,Qo=ke(()=>Xc.value&&!!_s.value),Ih=ke(()=>ec.value);return(O,G)=>(ye(),De("div",{ref_key:"superdocRoot",ref:Wt,class:en(["superdoc",{"superdoc--with-sidebar":ui.value,"superdoc--web-layout":Qe(F).$superdoc.config.viewOptions?.layout==="web","superdoc--contained":Qe(F).$superdoc.config.contained,"high-contrast":Qe(B)}]),style:bn(Lt.value),onKeydown:X},[He("div",{class:"superdoc__layers layers",ref_key:"layers",ref:Be,role:"group"},[Sd.value?(ye(),De("div",{key:0,class:"superdoc__tools tools",style:bn(xn)},[He("div",{class:"tools-item","data-id":"is-tool",onMousedown:G[0]||(G[0]=Jt(pe=>Yr("comments"),["stop","prevent"]))},[He("div",{class:"superdoc__tools-icon",innerHTML:Qe(Pa).comment},null,8,RF)],32)],4)):vt("",!0),He("div",MF,[qo.value?(ye(),De("div",{key:0,class:"superdoc__selection-layer selection-layer",onMousedown:Ve,onMouseup:Ge,ref_key:"selectionLayer",ref:te},[Qe(d)&&st.value?(ye(),De("div",{key:0,style:bn(he.value),class:"superdoc__temp-selection temp-selection sd-highlight sd-initial-highlight"},null,4)):vt("",!0)],544)):vt("",!0),(ye(!0),De(Kt,null,ir(Qe(a),pe=>(ye(),De("div",{class:"superdoc__sub-document sub-document",key:`${pe.id}:${pe.editorMountNonce}`,ref_for:!0,ref:Ce=>Zs(pe,Ce)},[pe.type===Qe("application/pdf")?(ye(),an(Qe(n),{key:0,file:pe.data,"file-id":pe.id,"initial-scale":(Qe(p)??100)/100,config:Qe(vo),onSelectionRaw:Ss,onBypassSelection:eu,onPageRendered:Qe(ts),onDocumentReady:G[1]||(G[1]=({documentId:Ce,viewerContainer:rt})=>on(Ce,rt)),ref_for:!0,ref_key:"pdfViewerRef",ref:zn},null,8,["file","file-id","initial-scale","config","onPageRendered"])):vt("",!0),pe.type===Qe("application/vnd.openxmlformats-officedocument.wordprocessingml.document")&&Qe(be)&&qt(pe)?(ye(),De(Kt,{key:1},[Or.value?(ye(),an(dl,{key:0,to:Or.value},[He("div",{class:"v2-ruler-host",style:bn(Cn.value)},[Xt(Qe(be),{"page-layout":Qe(F).$superdoc.activeEditor.pageLayout,"measurement-unit":Qe(m),"active-page-rect":hr.value,onPageMarginsChange:Ce=>Ji(pe,Ce)},null,8,["page-layout","measurement-unit","active-page-rect","onPageMarginsChange"])],4)],8,["to"])):(ye(),De("div",{key:1,class:"v2-ruler-host",style:bn(Cn.value)},[Xt(Qe(be),{"page-layout":Qe(F).$superdoc.activeEditor.pageLayout,"measurement-unit":Qe(m),"active-page-rect":hr.value,onPageMarginsChange:Ce=>Ji(pe,Ce)},null,8,["page-layout","measurement-unit","active-page-rect","onPageMarginsChange"])],4))],64)):vt("",!0),pe.type===Qe("application/vnd.openxmlformats-officedocument.wordprocessingml.document")?(ye(),an(Qe(ee),{key:2,"file-source":pe.data,"document-id":pe.id,options:Ya(pe),"measurement-unit":Qe(m),onV2EditorReady:ci,onV2EditorFailed:md,onV2Render:Yi,onV2RenderCleared:$l,onV2SelectionChanged:Nc,onV2HostEvent:Ce=>wr(pe,Ce),onV2LinkClick:Gl,onV2CommentCreated:Wl,onV2PageMetrics:Uc,onV2RenderReadiness:Ce=>Kl(pe,Ce),onV2OpenDiagnostics:Ce=>Hc(pe,Ce)},null,8,["file-source","document-id","options","measurement-unit","onV2HostEvent","onV2RenderReadiness","onV2OpenDiagnostics"])):vt("",!0),pe.type===Qe("text/html")?(ye(),an(H9,{key:3,onReady:G[2]||(G[2]=Ce=>on(Ce,null)),onSelectionChange:ce,"file-source":pe.data,"document-id":pe.id},null,8,["file-source","document-id"])):vt("",!0)]))),128)),Qo.value?(ye(),an(R9,{key:1,class:"superdoc__whiteboard-layer",whiteboard:Qe(hi),pages:Qe(es),"page-sizes":Qe(Jl),"page-offsets":Qe(As),enabled:Qe(ec),interactive:Ih.value,opacity:Qe(Zo)},null,8,["whiteboard","pages","page-sizes","page-offsets","enabled","interactive","opacity"])):vt("",!0),Zc.value?(ye(),an(_9,{key:2,onAnchorActivate:ln})):vt("",!0)])],512),ui.value?(ye(),De("div",{key:0,ref_key:"rightSidebarRef",ref:rn,class:"superdoc__right-sidebar right-sidebar"},[He("div",LF,[Qe(Q)&&(N.value.length>0||Qe(V))?(ye(!0),De(Kt,{key:0},ir(Qe(z),pe=>(ye(),an(v9,{parent:Be.value,"current-document":pe},null,8,["parent","current-document"]))),256)):vt("",!0)])],512)):vt("",!0),sa.value?(ye(),De("div",{key:1,class:"superdoc__compact-comment-popover",style:bn(Qe(Sh))},[Xt(lb,{comment:sa.value,parent:Be.value},null,8,["comment","parent"])],4)):vt("",!0),Xt(gF,{"geometry-target":Be.value},null,8,["geometry-target"])],38))}},FF=un(PF,[["__scopeId","data-v-4e56e5b9"]]);Ft();var IA="devtools-plugin:setup",EA="dev.esm.pinia",dn={disabledAppRefCounts:new Map,hook:null,originalHookEmit:null,isHookPropertyPatched:!1,originalHookPropertyDescriptor:null,hookPropertyValue:void 0,isQueuePropertyPatched:!1,originalQueuePropertyDescriptor:null,queuePropertyValue:void 0,queue:null,originalQueuePush:null},TA=(e,t)=>e===IA&&t?.id===EA&&t?.app&&dn.disabledAppRefCounts.has(t.app),NF=e=>Array.isArray(e)&&TA(IA,e[0]),BF=e=>{if(dn.isQueuePropertyPatched){dn.queuePropertyValue=e;return}globalThis.__VUE_DEVTOOLS_PLUGINS__=e},zF=e=>{const t=globalThis.__VUE_DEVTOOLS_PLUGINS__;if(Array.isArray(t))for(let n=t.length-1;n>=0;n--){const[r]=t[n];r?.id===EA&&r?.app===e&&t.splice(n,1)}},xA=()=>{const{queue:e,originalQueuePush:t}=dn;e&&typeof t=="function"&&(e.push=t),dn.queue=null,dn.originalQueuePush=null},RA=()=>{const{hook:e,originalHookEmit:t}=dn;e&&typeof t=="function"&&(e.emit=t),dn.hook=null,dn.originalHookEmit=null},Uf=()=>{const e=globalThis.__VUE_DEVTOOLS_PLUGINS__;if(e==null){BF([]),Uf();return}if(!Array.isArray(e))return;const t=e;if(dn.queue===t)return;xA();const n=t.push;typeof n=="function"&&(dn.queue=t,dn.originalQueuePush=n,t.push=function(...o){const i=o.filter(s=>!NF(s));return i.length===0?this.length:n.apply(this,i)})},jF=()=>{if(dn.isQueuePropertyPatched){Uf();return}const e=Object.getOwnPropertyDescriptor(globalThis,"__VUE_DEVTOOLS_PLUGINS__");if(e?.configurable===!1){Uf();return}dn.originalQueuePropertyDescriptor=e??null,dn.queuePropertyValue=globalThis.__VUE_DEVTOOLS_PLUGINS__,Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",{configurable:!0,enumerable:e?.enumerable??!0,get(){return dn.queuePropertyValue},set(t){dn.queuePropertyValue=t,Uf()}}),dn.isQueuePropertyPatched=!0,Uf()},VF=()=>{if(!dn.isQueuePropertyPatched)return;const{queuePropertyValue:e,originalQueuePropertyDescriptor:t}=dn;delete globalThis.__VUE_DEVTOOLS_PLUGINS__,t?"value"in t?Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",{configurable:t.configurable,enumerable:t.enumerable,writable:t.writable,value:e}):(Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",t),typeof t.set=="function"&&t.set.call(globalThis,e)):e!==void 0&&(globalThis.__VUE_DEVTOOLS_PLUGINS__=e),dn.isQueuePropertyPatched=!1,dn.originalQueuePropertyDescriptor=null,dn.queuePropertyValue=void 0},Cm=()=>{const e=globalThis?.__VUE_DEVTOOLS_GLOBAL_HOOK__;if(!e||typeof e.emit!="function"||dn.hook===e)return;RA();const t=e.emit;dn.hook=e,dn.originalHookEmit=t,e.emit=function(r,...o){const[i]=o;if(!TA(r,i))return t.call(this,r,...o)}},UF=()=>{if(dn.isHookPropertyPatched){Cm();return}const e=Object.getOwnPropertyDescriptor(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__");if(e?.configurable===!1){Cm();return}dn.originalHookPropertyDescriptor=e??null,dn.hookPropertyValue=globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__,Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",{configurable:!0,enumerable:e?.enumerable??!0,get(){return dn.hookPropertyValue},set(t){dn.hookPropertyValue=t,Cm()}}),dn.isHookPropertyPatched=!0,Cm()},HF=()=>{if(!dn.isHookPropertyPatched)return;const{hookPropertyValue:e,originalHookPropertyDescriptor:t}=dn;delete globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__,t?"value"in t?Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",{configurable:t.configurable,enumerable:t.enumerable,writable:t.writable,value:e}):(Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",t),typeof t.set=="function"&&t.set.call(globalThis,e)):e!==void 0&&(globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__=e),dn.isHookPropertyPatched=!1,dn.originalHookPropertyDescriptor=null,dn.hookPropertyValue=void 0},$F=()=>{dn.disabledAppRefCounts.size>0||(RA(),HF(),xA(),VF())},GF=(e,t)=>{if(!t)return()=>{};const n=dn.disabledAppRefCounts.get(e)??0;return dn.disabledAppRefCounts.set(e,n+1),UF(),jF(),()=>{const r=dn.disabledAppRefCounts.get(e);r&&(r===1?dn.disabledAppRefCounts.delete(e):dn.disabledAppRefCounts.set(e,r-1),$F())}},WF=({disablePiniaDevtools:e=!1}={})=>{const t=yc(FF),n=wx(),r=GF(t,e);let o,i,s;try{t.use(n),e&&zF(t),t.directive("click-outside",Hy),o=Uu(),i=Us(),s=ds()}catch(a){throw r(),a}if(typeof t.unmount=="function"){const a=t.unmount.bind(t);t.unmount=(...l)=>(r(),a(...l))}return{app:t,pinia:n,superdocStore:o,commentsStore:i,highContrastModeStore:s}},KF={docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",pdf:"application/pdf",zip:"application/zip",html:"text/html",txt:"text/plain;charset=utf-8",json:"application/json"},qF=e=>!e||typeof e.toLowerCase!="function"?"application/octet-stream":KF[e.toLowerCase()]||"application/octet-stream",MA=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,YF=e=>{if(!MA)return!1;try{return MA.call(e),!0}catch{return!1}},XF=(e,t)=>{const n=qF(t);if(YF(e))return e instanceof Blob?e:new Blob([e],{type:e.type||n});if(e instanceof ArrayBuffer)return new Blob([e],{type:n});if(ArrayBuffer.isView(e)){const{buffer:r,byteOffset:o,byteLength:i}=e,s=r.slice(o,o+i);return new Blob([s],{type:n})}if(typeof e=="string")return new Blob([e],{type:n});throw e==null?new TypeError("createDownload requires a Blob, ArrayBuffer, or ArrayBufferView."):new TypeError(`Cannot create download from value of type ${typeof e}`)},LA=(e,t,n)=>{const r=XF(e,n);if(typeof URL>"u"||typeof URL.createObjectURL!="function"||typeof document>"u"||typeof document.createElement!="function")return r;const o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`${t}.${n}`;const s=document.body&&typeof document.body.appendChild=="function";return s&&document.body.appendChild(i),i.click(),s&&document.body.removeChild(i),typeof URL.revokeObjectURL=="function"&&setTimeout(()=>URL.revokeObjectURL(o),0),r},DA=e=>{const t=e.toLowerCase();return t.endsWith(".docx")?e.slice(0,-5):t.endsWith(".pdf")?e.slice(0,-4):e},ZF=class{#e=new Map;#n=1;idFor(e){const t=this.#e.get(e);if(t!==void 0)return t;const n=this.#n++;return this.#e.set(e,n),n}has(e){return this.#e.has(e)}};function QF(e){const t=typeof e.email=="string"&&e.email.length>0?e.email:null;return t?`email:${t}`:`label:${e.actorLabel}`}function JF(e,t){const n=e.displayName??null,r=e.email??null,o={clientId:t};return n&&(o.name=n),r&&(o.email=r),typeof e.color=="string"&&e.color.length>0&&(o.color=e.color),o}function eN(e){const t={clientId:0};e?.id!=null&&(t.id=e.id),e?.name!=null&&(t.name=e.name),e?.email!=null&&(t.email=e.email);const n=e?.color;return typeof n=="string"&&n.length>0&&(t.color=n),t}function tN(e){const t=new ZF;let n=new Set;return{registry:t,next(r){const o=[],i=new Set,s=new Set;for(const u of r.remoteActors){const d=QF(u);if(s.has(d))continue;s.add(d);const f=t.idFor(d);i.add(f),o.push(JF(u,f))}const a=[];for(const u of i)n.has(u)||a.push(u);const l=[];for(const u of n)i.has(u)||l.push(u);return n=i,{states:[eN(e()),...o],added:a,removed:l}}}}var nN=class{#e=new Map;on(e,t){const n=this.#e.get(e);n?n.push(t):this.#e.set(e,[t])}emit(e,...t){const n=this.#e.get(e);if(n)for(const r of n)r.apply(this,t)}off(e,t){const n=this.#e.get(e);n&&(t?this.#e.set(e,n.filter(r=>r!==t)):this.#e.delete(e))}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};this.on(e,n)}removeAllListeners(){this.#e=new Map}};function rN(e){return e.flatMap(t=>[t[0],t[1]])}function OA(e="id"){return`${e}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function PA(e={}){const{value:t="",left:n,top:r,width:o,height:i,fontSize:s=16,fontFamily:a="Arial, sans-serif",color:l="#000",background:u="transparent",resize:d="none"}=e,f=document.createElement("textarea");f.value=t;const p=f.style;return p.position="absolute",n!=null&&(p.left=`${n}px`),r!=null&&(p.top=`${r}px`),o!=null&&(p.width=typeof o=="number"?`${o}px`:o),i!=null&&(p.height=typeof i=="number"?`${i}px`:i),p.minWidth=120,p.fontSize=typeof s=="number"?`${s}px`:s,p.fontFamily=a,p.color=l,p.background=u,p.border="2px solid #3c97fe80",p.padding="2px 4px",p.margin="0",p.zIndex="1000",p.overflow="hidden",p.resize=d,p.outline="none",f}var km=18,oN=class{pageIndex=null;strokes=[];text=[];images=[];size=null;originalSize=null;#e=null;#n=null;#t=null;#r=null;#i=null;#a=null;#u=new Set;#h=!1;#l=null;#f=[];#v=null;#o="select";#s=!1;#p=null;#w="#2293fb";#k=5;#y=null;#A=null;constructor(e){this.#I(e)}#I(e){this.#e=e.Renderer,this.#s=e.enabled,this.pageIndex=e.pageIndex,this.#y=e.onChange,this.#A=e.onToolChange}#L(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{xN:e/n,yN:t/r}}#R(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{x:e*n,y:t*r}}#b(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{wN:e/n,hN:t/r}}#C(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{width:e*n,height:t*r}}#E(e){const{width:t=1,height:n=1}=this.size||{};return{points:(Array.isArray(e.pointsN)?e.pointsN:[]).map(r=>[r[0]*t,r[1]*n]),strokeWidth:Number.isFinite(e.widthN)?e.widthN*((t+n)/2):this.#k}}#x(e){const{width:t=1,height:n=1}=this.size||{};return{pointsN:(Array.isArray(e.points)?e.points:[]).map(r=>[r[0]/t,r[1]/n]),widthN:Number.isFinite(e.width)?e.width/((t+n)/2):void 0}}#_(e){const{width:t=1,height:n=1}=this.size||{};return{x:(e.xN??0)*t,y:(e.yN??0)*n,width:Number.isFinite(e.widthN)?e.widthN*t:void 0,fontSize:Number.isFinite(e.fontSizeN)?e.fontSizeN*n:km}}#d(e){const{width:t=1,height:n=1}=this.size||{},r=this.originalSize?.height??n;return{xN:(e.x??0)/t,yN:(e.y??0)/n,widthN:Number.isFinite(e.width)?e.width/t:null,fontSizeN:Number.isFinite(e.fontSize)?e.fontSize/r:km/r}}#m(e){const{width:t=1,height:n=1}=this.size||{};return{x:(e.xN??0)*t,y:(e.yN??0)*n,width:Number.isFinite(e.widthN)?e.widthN*t:void 0,height:Number.isFinite(e.heightN)?e.heightN*n:void 0}}#D(e){const{width:t=1,height:n=1}=this.size||{};return{xN:(e.x??0)/t,yN:(e.y??0)/n,widthN:Number.isFinite(e.width)?e.width/t:null,heightN:Number.isFinite(e.height)?e.height/n:null}}#T(){const e=this.size?.width,t=this.originalSize?.width??e;return!Number.isFinite(e)||!Number.isFinite(t)||!t?1:e/t}#Y(){!this.#n||!this.#t||(this.#n.on("mousedown touchstart",e=>{this.#le(e)}),this.#n.on("mousemove touchmove",e=>{this.#Q(e)}),this.#n.on("mouseup touchend",e=>{this.#F(e)}),this.#n.on("click tap",e=>{this.#Z(e)}),window.addEventListener("keydown",this.#V))}setTool(e){this.#o=e,this.#O(),this.#M(),this.render()}getTool(){return this.#o}setEnabled(e){this.#s=!!e,this.#O(),this.#M(),this.render()}isEnabled(){return this.#s}setSize(e){if(!e)return;const{width:t,height:n,originalWidth:r,originalHeight:o}=e;this.size={width:t,height:n},this.originalSize={width:r??null,height:o??null}}resize(e,t){this.#n&&(this.#n.size({width:e,height:t}),this.#z(),this.render())}mount(e){if(!e||this.#n&&this.#a===e)return;this.#n&&this.destroy();const t=this.size?.width||e.clientWidth||1,n=this.size?.height||e.clientHeight||1;this.#a=e,this.#n=new this.#e.Stage({container:e,width:t,height:n}),this.#t=new this.#e.Layer,this.#r=new this.#e.Layer,this.#n.add(this.#t),this.#n.add(this.#r),this.#z(),this.#O(),this.#Y(),this.render()}render(){this.#t&&(this.#i&&(this.#i.destroy(),this.#i=null),this.#t.find(".wb-text").forEach(e=>e.destroy()),this.#r.destroyChildren(),this.renderStrokes(),this.renderText(),this.renderImages(),this.#t.batchDraw(),this.#r.batchDraw())}#z(){const e=Math.min(window.devicePixelRatio||1,1.5);this.#t?.getCanvas&&this.#t.getCanvas().setPixelRatio(e),this.#r?.getCanvas&&this.#r.getCanvas().setPixelRatio(e)}#O(){if(!this.#r)return;const e=this.#o==="draw"||this.#o==="erase",t=!!(this.#s&&e);this.#r.listening(t)}renderStrokes(){this.strokes.forEach(e=>{const{points:t,strokeWidth:n}=this.#E(e),r=new this.#e.Line({points:rN(t),stroke:e.color||this.#w,strokeWidth:n,lineCap:"round",lineJoin:"round",globalCompositeOperation:e.type==="erase"?"destination-out":"source-over"});r.name("wb-stroke"),this.#r.add(r)})}renderText(){this.text.forEach(e=>{const{x:t,y:n,width:r,fontSize:o}=this.#_(e),i=new this.#e.Text({x:t,y:n,text:e.content,fontSize:o,fontFamily:"Arial, sans-serif",fill:"#2293fb",draggable:this.#o==="select",width:r});i.name("wb-text"),i._whiteboardId=e.id,this.#X(i,e),this.#t.add(i)})}#X(e,t){e.on("click tap",n=>{this.#o!=="select"||!this.#s||(n.cancelBubble=!0,this.#j(e))}),e.on("dragend",()=>{const{xN:n,yN:r}=this.#d({x:e.x(),y:e.y(),fontSize:t.fontSizeN?t.fontSizeN*(this.size?.height||1):km,width:t.widthN?t.widthN*(this.size?.width||1):null});t.xN=n,t.yN=r,this.#S()}),e.on("transform",()=>{e.scaleY(1),e.setAttrs({width:e.width()*e.scaleX(),scaleX:1})}),e.on("transformend",()=>{e.setAttrs({width:Math.max(1,e.width()*e.scaleX()),scaleX:1,scaleY:1});const n=e.width(),r=this.size?.width||1;t.widthN=n/r,t.xN=e.x()/r,t.yN=e.y()/(this.size?.height||1),this.#S()}),e.on("dblclick dbltap",n=>{this.#o!=="select"||!this.#s||(n.cancelBubble=!0,this.#ee(e,t))})}renderImages(){const e=this.#t?.find(".wb-image")??[],t=new Map;e.forEach(o=>{t.set(o._whiteboardId,o)});const n=new Set(this.images.map(o=>o.id));e.forEach(o=>{n.has(o._whiteboardId)||o.destroy()});const r=(o,i)=>{const{x:s,y:a,width:l,height:u}=this.#m(o),d=t.get(o.id);if(d){Number.isFinite(s)&&d.x(s),Number.isFinite(a)&&d.y(a),Number.isFinite(l)&&d.width(l),Number.isFinite(u)&&d.height(u),d.draggable(this.#o==="select");return}if(this.#u.has(o.id))return;this.#u.add(o.id);const f=new window.Image;f.crossOrigin="Anonymous",f.onload=()=>{if(t.get(o.id)){this.#u.delete(o.id);return}if(!this.#t){this.#u.delete(o.id);return}const p=new this.#e.Image({x:s,y:a,image:f,width:l??f.width,height:u??f.height,draggable:this.#o==="select"});p.name(i),p._whiteboardId=o.id,this.#P(p,o),this.#t.add(p),this.#t.batchDraw(),this.#u.delete(o.id)},f.onerror=()=>{this.#u.delete(o.id)},f.src=o.src};this.images.forEach(o=>r(o,"wb-image"))}#P(e,t){e.on("click tap",n=>{this.#o!=="select"||!this.#s||(n.cancelBubble=!0,this.#j(e))}),e.on("dragend",()=>{const n=this.size?.width||1,r=this.size?.height||1;t.xN=e.x()/n,t.yN=e.y()/r,this.#S()}),e.on("transformend",()=>{const n=e.scaleX(),r=e.scaleY(),o=Math.max(1,e.width()*n),i=Math.max(1,e.height()*r);e.scale({x:1,y:1}),e.width(o),e.height(i);const s=this.size?.width||1,a=this.size?.height||1;t.widthN=o/s,t.heightN=i/a,t.xN=e.x()/s,t.yN=e.y()/a,this.#S()})}destroy(){this.#n&&this.#n.destroy(),this.#n=null,this.#t=null,this.#r=null,this.#a=null,this.#h=!1,this.#l=null,this.#f=[],this.#p=null,this.#i=null,window.removeEventListener("keydown",this.#V)}toJSON(){return{strokes:this.strokes,text:this.text,images:this.images}}applyData(e={}){const t=Array.isArray(e.strokes)?e.strokes:[],n=Array.isArray(e.text)?e.text:[],r=Array.isArray(e.images)?e.images:[];this.strokes=t,this.text=n,this.images=r,this.render()}#S(){this.#y&&this.#y()}addStroke(e){if(!e||!Array.isArray(e.points))return;const{pointsN:t,widthN:n}=this.#x(e);this.strokes.push({pointsN:t,widthN:n,color:e.color,type:e.type})}addText(e){if(!e||typeof e.content!="string")return;const{xN:t,yN:n,widthN:r,fontSizeN:o}=this.#d(e);this.text.push({id:e.id??OA("text"),xN:t,yN:n,content:e.content,fontSizeN:o,widthN:r}),this.render(),this.#S()}addImage(e){if(!e||!e.src)return;const{xN:t,yN:n,widthN:r,heightN:o}=this.#D(e),i={id:e.id??OA("image"),stickerId:e.stickerId??(e.type==="sticker"?e.id??null:null),xN:t,yN:n,src:e.src,widthN:r,heightN:o,type:e.type??"image"};this.images.push(i),this.render(),this.#S()}#M(){this.#i&&(this.#i.destroy(),this.#i=null,this.#p=null,this.#t?.batchDraw())}#j(e){if(!this.#t)return;this.#p=e;const t=e.name&&e.name()==="wb-text",n=t?["middle-left","middle-right"]:["top-left","top-right","bottom-left","bottom-right"],r=(o,i)=>i.width<20?o:t?{...i,height:o.height,y:o.y}:i.height<20?o:i;this.#i?(this.#i.nodes([e]),this.#i.enabledAnchors(n),this.#i.boundBoxFunc(r)):(this.#i=new this.#e.Transformer({nodes:[e],enabledAnchors:n,rotateEnabled:!1,keepRatio:!1,boundBoxFunc:r}),this.#t.add(this.#i)),this.#t.batchDraw()}#c(){if(!this.#p)return;const e=this.#p,t={"wb-text":()=>{const n=e._whiteboardId;this.text=this.text.filter(r=>r.id!==n)},"wb-image":()=>{const n=e._whiteboardId;this.images=this.images.filter(r=>r.id!==n)}}[e.name&&e.name()];t&&t(),e.destroy(),this.#M(),this.render()}#V=e=>{if(!this.#p||!this.#s||this.#o!=="select")return;const t=e.target?.tagName;t==="INPUT"||t==="TEXTAREA"||(e.key==="Backspace"||e.key==="Delete")&&(e.preventDefault(),this.#c(),this.#S())};#Z(e){if(!this.#s||!this.#n)return;const t={text:()=>{const n=this.#n.getPointerPosition();n&&this.#J(n.x,n.y)},select:()=>{e?.target===this.#n&&this.#M()}}[this.#o];t&&t()}#le(){if(!this.#s||this.#o!=="draw"&&this.#o!=="erase")return;this.#h=!0;const e=this.#n.getPointerPosition();if(!e)return;const t=this.#o==="erase",n=this.#k*this.#T();this.#f=[e.x,e.y],this.#l=new this.#e.Line({points:this.#f,stroke:this.#w,strokeWidth:t?n*3:n,lineCap:"round",lineJoin:"round",globalCompositeOperation:t?"destination-out":"source-over"}),this.#v=n,this.#r.add(this.#l)}#Q(){if(!this.#s||this.#o!=="draw"&&this.#o!=="erase"||!this.#h||!this.#l)return;const e=this.#n.getPointerPosition();e&&(this.#f.push(e.x,e.y),this.#l.points(this.#f),this.#r.batchDraw())}#F(){if(!this.#s||this.#o!=="draw"&&this.#o!=="erase"||!this.#h||!this.#l)return;this.#h=!1;const e=[];for(let r=0;r<this.#f.length;r+=2)e.push([this.#f[r],this.#f[r+1]]);const t=this.#o==="erase",n=this.#v??this.#k;this.addStroke({points:e,color:this.#w,width:t?n*3:n,type:t?"erase":"draw"}),this.#S(),this.#l=null,this.#f=[],this.#v=null}#J(e,t){if(!this.#a)return;const n=this.#T(),r=km*n,o=PA({left:e,top:t,height:Math.ceil(r*1.4),background:"transparent",fontSize:r,color:"#2293fb"});this.#a.append(o),o.focus(),o.select();let i=!1;const s=()=>{if(i)return;i=!0;const a=o.value.trim();a&&(this.addText({x:e,y:t,content:a}),this.#o==="text"&&this.#A&&this.#A("select")),o.parentNode===this.#a&&this.#a.removeChild(o)};o.addEventListener("keydown",a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),s()),a.key==="Escape"&&(a.preventDefault(),s())}),o.addEventListener("blur",s)}#ee(e,t){if(!this.#a||!this.#n)return;this.#M();const n=e.position(),r=PA({value:e.text(),left:n.x,top:n.y,width:Math.max(e.width(),120),height:Math.max(e.height(),24),fontSize:e.fontSize(),fontFamily:e.fontFamily(),color:e.fill?e.fill():"#2293fb",background:"white",resize:"both"});this.#a.appendChild(r),r.focus(),r.select();let o=!1;const i=()=>{if(o)return;o=!0;const s=r.value.trim();s&&(e.text(s),t.content=s,this.#t.batchDraw(),this.#S()),r.parentNode&&r.parentNode.removeChild(r)};r.addEventListener("keydown",s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),i()),s.key==="Escape"&&(s.preventDefault(),i())}),r.addEventListener("blur",i)}},iN=class extends nN{#e=null;#n=null;#t=new Map;#r=new Map;#i="select";#a=!1;#u=1;#h=null;#l=null;#f=null;constructor(e={}){super(),this.#v(e)}#v(e){this.#e=e.Renderer,this.#n=e.superdoc,this.#a=e.enabled,this.#h=e.onChange,this.#l=e.onSetData,this.#f=e.onEnabledChange}register(e,t){this.#r.set(e,t)}getType(e){return this.#r.get(e)}setTool(e){this.#i=e,this.#t.forEach(t=>t.setTool(e)),this.emit("tool",e)}getTool(){return this.#i}setEnabled(e){this.#a=e,this.#t.forEach(t=>t.setEnabled(this.#a)),this.emit("enabled",this.#a),this.#f&&this.#f(this.#a)}isEnabled(){return this.#a}setOpacity(e){const t=e;this.#u=Number.isFinite(t)?Math.min(1,Math.max(0,t)):1,this.emit("opacity",this.#u)}getOpacity(){return this.#u}getPages(){return Array.from(this.#t.values())}rerender(){this.#t.forEach(e=>e.render())}setPageSize(e,t){this.#o(e).setSize(t)}#o(e){const t=this.#t.get(e);if(t)return t;const n=new oN({Renderer:this.#e,enabled:this.#a,pageIndex:e,onChange:()=>{this.#s()},onToolChange:r=>{this.setTool(r)}});return n.setTool(this.#i),n.setEnabled(this.#a),this.#t.set(e,n),n}getPage(e){return this.#t.get(e)}getWhiteboardData(){const e={},t={};for(const n of this.#t.values())e[n.pageIndex]=n.toJSON(),n.size&&(t[n.pageIndex]={width:n.size.width,height:n.size.height,originalWidth:n.originalSize?.width??null,originalHeight:n.originalSize?.height??null});return{pages:e,meta:{pageSizes:t},version:1}}setWhiteboardData(e){this.#t.clear();const t=e?.pages||{};Object.keys(t).forEach(n=>{const r=Number(n),o=Number.isNaN(r)?n:r;this.#o(o).applyData(t[n])}),this.emit("setData",this.getPages()),this.#l&&this.#l(this.getPages()),this.#s()}#s(){const e=this.getWhiteboardData();this.emit("change",e),this.#h&&this.#h(e)}},sN=Math.PI/180;function aN(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}var Ac=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},_t={_global:Ac,version:"10.2.5",isBrowser:aN(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return _t.angleDeg?e*sN:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:"web",legacyTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return _t.DD.isDragging},isTransforming(){var e,t;return(t=(e=_t.Transformer)===null||e===void 0?void 0:e.isTransforming())!==null&&t!==void 0?t:!1},isDragReady(){return!!_t.DD.node},releaseCanvasOnDestroy:!0,document:Ac.document,_injectGlobal(e){typeof Ac.Konva<"u"&&console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."),Ac.Konva=e}},_r=e=>{_t[e.prototype.getClassName()]=e};_t._injectGlobal(_t);var lN=`Konva.js unsupported environment.
|
|
86
|
+
`,sr={undo:RS,redo:wO,bold:ZD,italic:QD,underline:JD,color:AO,link:z_,image:dO,tableOfContents:KO,alignLeft:fO,alignRight:pO,alignCenter:hO,alignJustify:mO,bulletList:B_,bulletListDisc:B_,bulletListCircle:eO,bulletListSquare:tO,numberedList:nO,numberedListDecimal:rO,numberedListDecimalParen:oO,numberedListUpperRoman:iO,numberedListLowerRoman:sO,numberedListUpperAlpha:aO,numberedListUpperAlphaParen:lO,numberedListLowerAlpha:cO,numberedListLowerAlphaParen:uO,indentLeft:vO,indentRight:gO,directionLtr:qO,directionRtl:YO,pageBreak:IO,copyFormat:yO,clearFormatting:bO,trackChanges:SO,trackChangesFinal:_O,trackChangesOriginal:V_,trackChangesAccept:CO,trackChangesReject:kO,documentMode:j_,documentEditingMode:j_,documentSuggestingMode:IS,documentViewingMode:V_,colorOption:EO,colorOptionCheck:ob,linkInput:z_,removeLink:TS,openLink:TO,overflow:xS,dropdownCaretUp:xO,dropdownCaretDown:ES,ruler:RO,paintbrush:MO,highlight:LO,ai:DO,table:OO,tableActions:PO,splitCell:FO,mergeCells:NO,addRowBefore:pm,addRowAfter:pm,addColumnBefore:pm,addColumnAfter:pm,deleteRow:yb,deleteColumn:yb,deleteTable:yb,deleteBorders:zO,fixTables:BO,lineHeight:jO,search:VO,cut:UO,copy:HO,paste:$O,strikethrough:GO,formattingMarks:WO};Ft(),mn();var XO={key:0,class:"link-title"},ZO={key:1,class:"link-title"},QO={key:2,class:"link-title"},JO={key:3,class:"link-title"},eP={key:4,class:"link-input-wrapper"},tP={class:"input-row text-input-row"},nP=["readonly","onKeydown"],rP={class:"input-row url-input-row"},oP=["innerHTML"],iP=["readonly","onKeydown"],sP=["innerHTML"],aP={key:0,class:"input-row link-buttons"},lP=["innerHTML"],cP={key:5,class:"input-row go-to-anchor clickable"},uP={__name:"LinkInput",props:{showInput:{type:Boolean,default:!0},showLink:{type:Boolean,default:!0},goToAnchor:{type:Function,default:()=>{}},ui:{type:Object,default:null},linkItem:{type:Object,default:null},closePopover:{type:Function,default:()=>{}},href:{type:String,default:null},target:{type:String,default:null},rel:{type:String,default:null},tooltip:{type:String,default:null},clickedElement:{type:Object,default:null},hyperlinkTarget:{type:Object,default:null},hyperlinkText:{type:String,default:null},textTarget:{type:Object,default:null},restoreSelection:{type:Function,default:()=>{}},documentMode:{type:String,default:null}},setup(e){const t=e,{isHighContrastMode:n}=ds(),r=re(!1),o=()=>{if(typeof t.hyperlinkText=="string"&&t.hyperlinkText)return t.hyperlinkText;const W=t.ui?.selection?.getSnapshot?.();if(typeof W?.quotedText=="string"&&W.quotedText)return W.quotedText;const V=t.clickedElement?.innerText??t.clickedElement?.textContent;return typeof V=="string"?V:""},i=()=>{if(typeof t.href=="string"&&t.href)return t.href;const W=t.ui?.toolbar?.getSnapshot?.()?.commands?.link?.value;if(typeof W=="string"&&W)return W;const V=t.linkItem?.attributes?.value?.href;return typeof V=="string"?V:""},s=()=>t.documentMode??t.ui?.document?.getSnapshot?.()?.mode??null,a=re(""),l=re(""),u=re(!1),d=/^[a-z][a-z0-9+.-]*:/i,f=ke(()=>{const W=l.value.trim();return W?W.startsWith("#")||d.test(W)?W:"https://"+W:""}),p=ke(()=>f.value?XD(f.value):null),g=ke(()=>p.value!==null),m=re(!1),v=ke(()=>!u.value&&m.value),k=ke(()=>!g.value),b=ke(()=>s()==="viewing"),S=()=>{const W=p.value?.href;W&&window.open(W,"_blank","noopener")},C=()=>{const W=document.querySelector(".link-input-ctn input");W&&W.focus()};Nn(()=>{a.value=o(),l.value=i(),m.value=!!l.value,u.value=l.value.startsWith("#"),t.showInput&&!b.value&&C()});const w=W=>{const V=t.ui;return V?.commands?.execute?(t.restoreSelection?.(),V.commands.execute("link",W)):!1},T=()=>{if(b.value)return;if(!l.value){w({href:null,hyperlinkTarget:t.hyperlinkTarget}),t.closePopover();return}if(!g.value){r.value=!0;return}const W=p.value?.href;if(!W){r.value=!0;return}const V={href:W,currentText:o(),hyperlinkTarget:t.hyperlinkTarget,textTarget:t.textTarget};a.value?V.text=a.value:v.value||(V.text=W),w(V),t.closePopover()},L=()=>{w({href:null,hyperlinkTarget:t.hyperlinkTarget}),t.closePopover()},z=W=>{t.goToAnchor&&t.goToAnchor(W)};return(W,V)=>(ye(),De("div",{class:en(["link-input-ctn",{"high-contrast":Qe(n)}])},[u.value?(ye(),De("div",XO,"Page anchor")):b.value?(ye(),De("div",ZO,"Link details")):v.value?(ye(),De("div",QO,"Edit link")):(ye(),De("div",JO,"Add link")),e.showInput&&!u.value?(ye(),De("div",eP,[He("div",tP,[V[4]||(V[4]=He("div",{class:"input-icon text-input-icon"},"T",-1)),ya(He("input",{type:"text",name:"text",placeholder:"Text","onUpdate:modelValue":V[0]||(V[0]=j=>a.value=j),readonly:b.value,onKeydown:ii(Jt(T,["stop","prevent"]),["enter"])},null,40,nP),[[ji,a.value]])]),He("div",rP,[He("div",{class:"input-icon",innerHTML:Qe(sr).linkInput},null,8,oP),ya(He("input",{type:"text",name:"link",placeholder:"Type or paste a link",class:en({"sd-error":r.value}),"onUpdate:modelValue":V[1]||(V[1]=j=>l.value=j),readonly:b.value,onKeydown:[ii(Jt(T,["stop","prevent"]),["enter"]),V[2]||(V[2]=j=>r.value=!1)]},null,42,iP),[[ji,l.value]]),He("div",{class:en(["open-link-icon",{"sd-disabled":!g.value}]),innerHTML:Qe(sr).openLink,onClick:S,"data-item":"btn-link-open"},null,10,sP)]),b.value?vt("",!0):(ye(),De("div",aP,[v.value?(ye(),De("button",{key:0,class:"remove-btn",onClick:L,"data-item":"btn-link-remove"},[He("div",{class:"remove-btn__icon",innerHTML:Qe(sr).removeLink},null,8,lP),V[5]||(V[5]=as(" Remove ",-1))])):vt("",!0),He("button",{class:en(["sd-submit-btn",{"disable-btn":k.value}]),onClick:T,"data-item":"btn-link-apply"}," Apply ",2)]))])):u.value?(ye(),De("div",cP,[He("a",{onClick:V[3]||(V[3]=Jt(j=>z(l.value),["stop","prevent"]))},"Go to "+Ut(l.value.startsWith("#_")?l.value.substring(2):l.value),1)])):vt("",!0)],2))}},U_=un(uP,[["__scopeId","data-v-3e4bd44e"]]);function dP(e){let t=e;for(;t;){const n=window.getComputedStyle(t).overflowY;if(/(auto|scroll)/.test(n)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return document.scrollingElement||document.documentElement}function H_(e,t={behavior:"smooth",block:"start"}){if(!e)return;const n=dP(e),r=n.getBoundingClientRect(),o=e.getBoundingClientRect(),i=n===(document.scrollingElement||document.documentElement)?0:r.top,s=o.top-i+n.scrollTop,a=window.getComputedStyle(n).scrollPaddingTop?.trim(),l=a?.endsWith("px")?Number(a.slice(0,-2)):0,u=Number.isFinite(l)&&l>=0?l:0;n.scrollTo({top:t.block==="start"?s-u:s-n.clientHeight+e.offsetHeight,behavior:t.behavior})}Ft();var fP="link-popover",hP=500,pP=4,mP=e=>!!(e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"),qu=e=>!!(e&&typeof e=="object"&&!Array.isArray(e));function gP(e){if(!qu(e)||e.kind!=="inline"||e.nodeType!=="hyperlink")return!1;const t=qu(e.anchor)?e.anchor:null,n=t&&qu(t.start)?t.start:null,r=t&&qu(t.end)?t.end:null;return typeof n?.blockId=="string"&&typeof n.offset=="number"&&typeof r?.blockId=="string"&&typeof r.offset=="number"}function vP(e){return qu(e)?e.type==="default"||e.type==="suppress"||e.type==="none"?!0:e.type==="custom"?e.component!=null:e.type==="external"||e.type==="render"?typeof e.render=="function":!1:!1}function $_(e){return e instanceof Error?e:new Error(String(e))}function yP(e){return typeof e!="string"?"":e.split(/\s+/).map(t=>t.trim().toLowerCase()).filter(t=>t==="noopener"||t==="noreferrer").filter((t,n,r)=>r.indexOf(t)===n).join(",")}function bP(e,t){const n=yP(e);if(t!=="_blank")return n;const r=n?n.split(","):[];return r.includes("noopener")||r.unshift("noopener"),r.join(",")}function wP(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):String(e).replace(/['"\\]/g,"\\$&")}function CP(e){try{return decodeURIComponent(e)}catch{return e}}function G_(e){const t=e?.dataset?.sourceAnchor;if(!t)return null;try{const n=JSON.parse(t)?.sourceRef;if(!qu(n))return null;const r=typeof n.partUri=="string"?n.partUri:void 0,o=typeof n.xpathLikePath=="string"?n.xpathLikePath:void 0;return r||o?{partUri:r,xpathLikePath:o}:null}catch{return null}}function kP(e){const t=G_(e)?.xpathLikePath?.match(/w:p\[ordinal=(\d+)\]/);return t?Number(t[1]):null}function SP(e,t){const n=kP(e),r=t?.blocks?.list?.()?.blocks,o=Array.isArray(r)?r.find(i=>i.ordinal===n):null;return typeof o?.nodeId=="string"?o.nodeId:e?.dataset?.blockId}function W_(e,t){const n=e?.closest?.("[data-block-id][data-pm-start]"),r=SP(n,t);if(!r||!n||!e?.ownerDocument)return null;const o=Number(e?.dataset?.pmStart),i=Number(e?.dataset?.pmEnd);if(Number.isFinite(o)&&Number.isFinite(i)&&i>o){const g=Number(n?.dataset?.pmStart),m=Number.isFinite(g)&&o>=g,v=m?o-g:o,k=m?i-g:i;return v<0||k<=v?null:{kind:"selection",start:{kind:"text",blockId:r,offset:v},end:{kind:"text",blockId:r,offset:k}}}const s=e.ownerDocument.defaultView,a=s?.NodeFilter,l=s?.Node;if(!a||!l)return null;let u=0;const d=e.ownerDocument.createTreeWalker(n,a.SHOW_ELEMENT|a.SHOW_TEXT);let f=d.nextNode();for(;f&&f!==e;)f.nodeType===l.TEXT_NODE&&!e.contains(f)&&(u+=f.textContent?.length??0),f=d.nextNode();if(f!==e)return null;const p=u+(e.textContent?.length??0);return p<=u?null:{kind:"selection",start:{kind:"text",blockId:r,offset:u},end:{kind:"text",blockId:r,offset:p}}}function _P(e){const t=e?.closest?.("[data-source-anchor]");return G_(t)?.partUri??null}function K_(e){return e.startsWith("/")?e:`/${e}`}function bb(e){if(typeof e!="string")return"";try{return new URL(e,window.location.href).href}catch{return e}}function wb(e){return typeof e?.externalTarget=="string"&&e.externalTarget?e.externalTarget:typeof e?.anchor=="string"&&e.anchor?`#${e.anchor}`:""}function q_(e){const t=e?.anchor?.start,n=e?.anchor?.end;return typeof t?.blockId!="string"||typeof t?.offset!="number"||typeof n?.blockId!="string"||typeof n?.offset!="number"||t.blockId!==n.blockId?null:{kind:"selection",start:{kind:"text",blockId:t.blockId,offset:t.offset},end:{kind:"text",blockId:n.blockId,offset:n.offset}}}function AP(e,t){const n=q_(t);return n?n.start.blockId===e?.start?.blockId&&n.start.offset===e?.start?.offset&&n.end.blockId===e?.end?.blockId&&n.end.offset===e?.end?.offset:!1}function IP(e,t,n){if(typeof t!="string"||!t)return null;const r=e?.query?.match?.({select:{type:"text",pattern:t,caseSensitive:!0},require:"any"}),o=(Array.isArray(r?.items)?r.items:[]).map(s=>s?.target).filter(s=>s?.kind==="selection"&&!!s?.start?.blockId&&!!s?.end?.blockId),i=typeof n=="string"?o.filter(s=>s.start.blockId===n&&s.end.blockId===n):o;return i.length===1?i[0]:typeof n=="string"?null:o.length===1?o[0]:null}function Y_(e){return!!(e&&typeof e.closest=="function"&&e.closest(".superdoc-toc-entry"))}function EP({getSurfaceManager:e,getActiveEditor:t,getUi:n,getActivationHandler:r,getActivationHandlerSource:o=()=>null,getBuiltInEditorDisabled:i=()=>!1,shouldInterceptNavigationOnlyHyperlinks:s=()=>!1,getLayerElement:a,emitException:l}){let u=null,d=null,f=0;const p=new WeakMap;function g(){f+=1}function m(H,J){if(!H||!u||u.handle!==H)return;const Q=u;Q.unbindPointerDown?.();const Y=Q.element.ownerDocument?.defaultView?.Node,_e=Y!=null&&Q.pointerDownTarget instanceof Y&&Q.element.contains(Q.pointerDownTarget);J?.status==="closed"&&J.reason===void 0&&_e&&(d={href:Q.href,element:Q.element,closedAt:Date.now()}),u=null}function v(H="closed"){g();const J=u;u=null,d=null,J?.unbindPointerDown?.(),J?.handle?.close?.(H)}function k(H){return{id:fP,mode:"floating",closeOnEscape:!0,floating:{top:H.position.top,left:H.position.left,autoFocus:!0,closeOnOutsidePointerDown:!0,width:"auto"}}}function b(H,J){const Q={href:H.href,element:H.element,handle:J,pointerDownTarget:null,unbindPointerDown:null},Y=H.element.ownerDocument,_e=ue=>{Q.pointerDownTarget=ue.target??null};Y.addEventListener("pointerdown",_e,!0),Q.unbindPointerDown=()=>Y.removeEventListener("pointerdown",_e,!0),u=Q,d=null,J.result?.then?.(ue=>m(J,ue),()=>m(J))}function S(H,J){return H?.querySelector?.(`a[name='${J}'], [data-bookmark-marker='start'][data-bookmark-name='${J}']`)??null}async function C(H){const J=t()?.authoring?.setSelectionTarget;if(typeof J!="function")return;const Q={kind:"story",storyType:"body"},Y={kind:"text",blockId:H,offset:0,story:Q},_e={kind:"selection",start:Y,end:Y,story:Q};try{await Promise.resolve(J({target:_e,collapse:"start",focus:!0}))}catch{}}async function w(H,{placeCaret:J=!1}={}){if(typeof H!="string"||!H.startsWith("#"))return;const Q=CP(H.slice(1)),Y=t()?.doc,_e=Y?.bookmarks?.get;if(typeof _e!="function"){const ct=S(n()?.viewport?.getHost?.()??null,wP(Q));ct&&H_(ct,{block:"start",behavior:"instant"});return}let ue=null;try{ue=await Promise.resolve(_e.call(Y.bookmarks,{target:{kind:"entity",entityType:"bookmark",name:Q}})),ue??=null}catch{return}const ve=ue?.address?.story;if(ve&&ve.storyType!=="body")return;const ge=ue?.range?.from?.blockId;if(typeof ge!="string")return;J&&await C(ge);const Te=n()?.viewport,Ne=Te?.scrollIntoView;if(typeof Ne!="function")return;const Je={kind:"text",blockId:ge,range:{start:0,end:0}};for(let ct=0;ct<pP;ct+=1)try{if((await Promise.resolve(Ne.call(Te,{target:Je,block:"start",behavior:"instant"})))?.success!==!1)return}catch{return}}async function T(H){const J=H.editor?.doc;let Q;try{Q=await Promise.resolve(J?.hyperlinks?.list?.())}catch{return null}const Y=Array.isArray(Q?.stories)?Q.stories:[],_e=H.element?.dataset?.linkRid,ue=H.element?.textContent??"",ve=bb(H.href),ge=W_(H.element,J),Te=_P(H.element),Ne=Y.filter(ct=>typeof ct?.partUri=="string"),Je=Te&&Ne.length>0?Ne.filter(ct=>K_(ct.partUri)===K_(Te)):Y;for(const ct of Je){const tt=Array.isArray(ct?.hyperlinks)?ct.hyperlinks:[],Tt=async B=>{if(!B?.hyperlinkNodeId||!ct?.storyId||B.address)return B;try{const de=await Promise.resolve(J?.hyperlinks?.get?.({storyId:ct.storyId,hyperlinkNodeId:B.hyperlinkNodeId}));return de?.success&&de.hyperlink?de.hyperlink:B}catch{return B}},ae=async B=>{if(!ge)return null;const de=(await Promise.all(B.map(Tt))).filter(Se=>AP(ge,Se.address));return de.length===1?de[0]:null},Ee=_e?tt.filter(B=>B.rId===_e):[],Ue=Ee.filter(B=>B.text===ue),ie=tt.filter(B=>bb(wb(B))===ve&&B.text===ue),I=tt.filter(B=>B.text===ue),se=tt.filter(B=>{const de=bb(wb(B));return ue&&de===ve&&B.text?.includes?.(ue)}),F=Ue.length===1?Ue[0]:null,q=ie.length===1?ie[0]:null,P=I.length===1?I[0]:null,ee=se.length===1?se[0]:null,be=Ee.length===1?Ee[0]:null,N=F??await ae(Ue)??q??await ae(ie)??P??await ae(I)??ee??await ae(se)??be??await ae(Ee);if(N?.hyperlinkNodeId&&ct?.storyId){const B=await Tt(N),de=q_(B.address);return{storyId:ct.storyId,hyperlinkNodeId:B.hyperlinkNodeId,href:wb(B),text:B.text,targetKind:B.targetKind,address:gP(B.address)?B.address:void 0,textTarget:de??IP(J,B.text,ge?.start?.blockId)}}}return null}function L(H){const J=p.get(H);if(J)return J;const Q=T(H);return p.set(H,Q),Q}function z(H){if(!d)return!1;const J=d.element===H.element&&d.href===H.href,Q=Date.now()-d.closedAt<=hP;return!J||!Q?!1:(d=null,!0)}function W(H,J){const Q=e();if(!Q?.open)return;const Y=f;queueMicrotask(()=>{Y===f&&b(H,Q.open(J))})}function V(H){if(v("replace"),H.isAnchorLink&&Y_(H.element)){w(H.href,{placeCaret:H.documentMode!=="viewing"});return}if(H.defaultAction==="navigate"){if(H.isAnchorLink)w(H.href);else if(H.href){const ue=H.target||"_self",ve=bP(H.rel,ue);ve?window.open(H.href,ue,ve):window.open(H.href,ue)}return}if(i())return;const J=()=>v("closed"),Q=ue=>{J(),w(ue,{placeCaret:!0})},Y=f,_e=ue=>{Y===f&&W(H,{...k(H),component:Wr(U_),props:{href:ue?.href||H.href,target:H.target,rel:H.rel,tooltip:H.tooltip,clickedElement:H.element,hyperlinkTarget:ue,hyperlinkText:ue?.text,textTarget:ue?.textTarget??W_(H.element,H.editor?.doc),documentMode:H.documentMode,ui:n(),closePopover:J,goToAnchor:Q}})};L(H).then(_e,()=>_e(null))}function j(H,J){v("replace");const Q=()=>v("closed");W(H,{...k(H),component:Wr(J.component),props:{...J.props,editor:H.editor,href:H.href,closePopover:Q}})}function Z(H,J){v("replace");const Q=J.render;W(H,{...k(H),render:Y=>{try{const _e={container:Y.container,editor:H.editor,href:H.href};return J.type==="render"?Q({..._e,close:()=>Y.close("closed")}):Q({..._e,closePopover:()=>Y.close("closed")})}catch(_e){const ue=J.type==="render";if(l({error:$_(_e),source:ue?"hyperlinks.onActivate.render":"linkPopoverExternalRender"}),Y.close("external-error"),!ue){const ve=f;queueMicrotask(()=>{ve===f&&V(H)})}return}}})}function R(H){const J=a()?.getBoundingClientRect?.(),Q=typeof J?.left=="number"?J.left:0,Y=typeof J?.top=="number"?J.top:0,_e={editor:t(),href:H.href,target:H.target,rel:H.rel,tooltip:H.tooltip,element:H.element,clientX:H.clientX,clientY:H.clientY,isAnchorLink:H.href.startsWith("#"),documentMode:H.documentMode,defaultAction:H.documentMode==="viewing"||H.editableText===!1||H.href.startsWith("#")&&Y_(H.element)?"navigate":"edit",position:{left:`${Math.max(0,H.clientX-Q)}px`,top:`${Math.max(0,H.clientY-Y)}px`},getDocumentTarget:async()=>(await L(_e))?.address??null,closePopover:()=>v("closed")};return _e}function K(H){const J=r();if(typeof J!="function")return{type:"default"};const Q=o()==="hyperlinks.onActivate",Y=Q?"hyperlinks.onActivate":"linkPopoverResolver",_e=()=>Q?{type:"suppress"}:{type:"default"};try{const ue=J(H);return mP(ue)?(Promise.resolve(ue).catch(()=>{}),l({error:new Error(Q?"hyperlinks.onActivate must return synchronously; Promises are not supported.":"The hyperlink activation handler must return synchronously."),source:Y}),_e()):ue==null?{type:"default"}:vP(ue)?ue:(l({error:new Error(Q?"hyperlinks.onActivate returned an invalid result.":"The hyperlink activation handler returned an invalid result."),source:Y}),_e())}catch(ue){return l({error:$_(ue),source:Y}),_e()}}function x(H){if(!H?.element||typeof H.href!="string")return;if(g(),u&&u.element===H.element&&u.href===H.href){v("toggle");return}if(z(H))return;const J=R(H);if(H.editableText===!1&&!s()){V(J);return}const Q=K(J);if(Q.type==="suppress"||Q.type==="none"){v("none");return}if(Q.type==="custom"){j(J,Q);return}if(Q.type==="external"||Q.type==="render"){Z(J,Q);return}V(J)}function $(){v("destroyed")}return{handleLinkClick:x,closeCurrentPopover:v,destroy:$}}var TP=Object.freeze({editorVersion:2,commands:null,state:null,view:null}),xP=["text.insert","text.replace","text.deleteBackward","text.deleteForward","text.paste","history.undo","history.redo","structural.splitBlock","structural.indent","structural.outdent"],X_=["comments.create","comments.resolve","comments.reopen","comments.delete","comments.reply","comments.edit","trackedChanges.accept","trackedChanges.reject","trackedChanges.acceptAll","trackedChanges.rejectAll"],RP=["trackedChanges.setAuthoringMode"];function Vf(e){return e.state!=="ready"?e.state:e.documentMode==="viewing"?"review-ready":"editing-ready"}function mm(e){return e==="review-ready"||e==="editing-ready"}function Z_(e){switch(e){case"text.insert":return"text.insert";case"text.replace":return"text.replace";case"text.deleteBackward":return"text.deleteBackward";case"text.deleteForward":return"text.deleteForward";case"text.paste":return"text.pastePlain";case"history.undo":return"history.undo";case"history.redo":return"history.redo";case"structural.splitBlock":return"structural.enter";case"structural.indent":return"structural.listIndent";case"structural.outdent":return"structural.listOutdent";default:return null}}function Q_(e){switch(e){case"comments.create":return"comments.createFromSelection";case"comments.resolve":return"review.commentResolve";case"comments.reopen":return"review.commentReopen";case"comments.delete":return"review.commentDelete";case"comments.reply":return"review.commentReply";case"comments.edit":return"review.commentEdit";case"trackedChanges.accept":case"trackedChanges.reject":return"review.trackedChangeDecide";case"trackedChanges.acceptAll":return"trackedChanges.acceptAll";case"trackedChanges.rejectAll":return"trackedChanges.rejectAll";default:return null}}function J_(e,t){return e.editableSubset.commands.find(n=>n.command===t)??null}function MP(e){return e?.status==="supported"||e?.enabled===!0}function LP(e){return e?.rejectionCode??e?.reason??null}function DP(e){return e?.detail??void 0}function gm(e,t){return MP(J_(e,t))}function eA(e,t){const n=J_(e,t),r=LP(n);return r?{reason:nA(r),detail:DP(n)}:e.documentMode==="viewing"?{reason:"document-readonly",detail:"review-surface-read-only"}:{reason:"command-unsupported",detail:`unsupported:${t}`}}function tA(e,t){const n=t?.reason;return e==="history.undo"?n==="NO_EFFECT"||n==="apply-rejected"?"no-effect":"nothing-to-undo":n==="NO_EFFECT"||n==="apply-rejected"?"no-effect":"nothing-to-redo"}function nA(e){switch(e){case"host-saving":return"host-saving";case"document-readonly":return"document-readonly";case"selection-invalidated":case"review-target-invalidated":return"selection-invalidated";case"review-command-unavailable":return"review-command-unavailable";case"review-surface-read-only":return"document-readonly";case"editing-selection-required":return"selection-unsupported";case"format-target-unsupported":case"selection-target-unsupported":case"input-target-unsupported":case"composition-target-unsupported":case"enter-context-unsupported":case"boundary-merge-unsupported":case"tracked-structural-edit-unsupported":case"comment-anchor-create-unsupported":case"comment-anchor-move-unsupported":return"target-unsupported";case"unsupported-command":return"command-unsupported";case"editing-mount-required":case"host-not-ready":case"host-disposed":return"runtime-not-ready";default:return"command-failed"}}function OP(e){const{id:t,documentId:n,root:r,host:o,getLegacyEditorProjection:i,onUnregister:s}=e;let a=o.getSnapshot(),l=!1,u=!1,d=null,f=0,p=0,g=null,m=null,v=null,k=null;const b=new Map,S=new Set;function C(ge){for(const Te of Array.from(S))try{Te(ge)}catch{}}function w(){f+=1,b.clear()}function T(ge){const Te=`v2-runtime-pos-${p++}`;return b.set(Te,ge),{runtimeId:t,tokenId:Te,revision:f}}function L(ge){return ge.runtimeId!==t?{ok:!1,reason:"wrong-runtime-token"}:ge.revision!==f||!b.has(ge.tokenId)?{ok:!1,reason:"stale-position-token"}:{ok:!0}}function z(){return o.getHandles().editing?.selection??null}function W(){const ge=z()?.getSnapshot()??null;return ge?{isRange:ge.anchor!==ge.focus,isEmpty:ge.anchor===ge.focus,text:"",anchor:T(ge.anchor),focus:T(ge.focus)}:null}function V(){const ge=z();ge!==k&&(g?.(),g=null,k=ge,ge&&(g=ge.subscribe(Te=>{w(),C({type:"selection-change",selection:Te?{isRange:Te.anchor!==Te.focus,isEmpty:Te.anchor===Te.focus,text:"",anchor:T(Te.anchor),focus:T(Te.focus)}:{isRange:!1,isEmpty:!0,text:""}})})))}function j(){const ge=o.getDocumentFacade?.()??null;return ge?.available===!0?ge.doc:null}function Z(){const ge=j();return!!(ge?.comments&&ge.trackChanges)}function R(ge){if(!mm(Vf(ge)))return[];const Te=xP.filter(Je=>{const ct=Z_(Je);return ct!==null&&gm(ge,ct)}),Ne=Z()?X_.filter(Je=>{const ct=Q_(Je);return ct!==null&&gm(ge,ct)}):[];return[...Te,...Ne,...RP]}function K(ge=a){const Te=Vf(ge),Ne=Te!=="disposed",Je=R(ge);return{lifecycle:{canFocus:Ne,canDispose:!0},selection:{canReadSelectedText:!0,canReadSelectionSnapshot:!0,canMintPositionTokens:!0},commands:{canDispatch:mm(Te)&&Je.length>0,supportedCommands:Je},layout:{supported:!0,hasSyncSnapshot:!0},zoom:{supported:!0,min:25,max:400},navigation:{supported:!1,targets:[]},persistence:{canSave:!0,canExportDocx:!0},comments:{supported:!0,canMutate:ge.commentCommandsReason!=="author-required"&&["comments.create","comments.resolve","comments.reopen","comments.delete","comments.reply","comments.edit"].some(ct=>Je.includes(ct))},trackedChanges:{supported:!0,canDecide:Je.includes("trackedChanges.accept")||Je.includes("trackedChanges.reject"),canToggleAuthoring:mm(Te)}}}function x(){const ge=o.getPageMetricsSnapshot();return{pageCount:ge.pages.length,currentPage:1,zoom:ge.zoom.percent}}function $(ge=a){return{id:t,kind:"v2",documentId:n,state:Vf(ge),documentMode:ge.documentMode,reason:ge.reason,capabilities:K(ge)}}function H(ge){return ge?.success===!0?(w(),{status:"committed",receipt:ge}):ge&&"failure"in ge?{status:"receipt-failure",failure:ge.failure}:{status:"rejected",reason:"command-failed"}}function J(ge,Te){return Te?Te.noop===!0?{status:"history-noop",reason:tA(ge,Te),result:Te}:(w(),{status:"history-committed",result:Te}):{status:"rejected",reason:"command-failed"}}async function Q(ge){const Te=Q_(ge.kind);if(Te&&!gm(a,Te)){const ct=eA(a,Te);return{status:"rejected",reason:ct.reason,detail:ct.detail}}const Ne=Z_(ge.kind);if((ge.kind==="history.undo"||ge.kind==="history.redo")&&Ne&&!gm(a,Ne)){const ct=eA(a,Ne);return{status:"rejected",reason:ct.reason,detail:ct.detail}}const Je=j();if(!Je)return X_.includes(ge.kind)?{status:"rejected",reason:"review-command-unavailable"}:null;try{switch(ge.kind){case"comments.create":{const ct=await Je.selection?.current?.(),tt=ct?.empty===!1?ct.target:void 0;return H(await Je.comments?.create?.({text:ge.text,...tt?{target:tt}:{}}))}case"comments.resolve":return H(await Je.comments?.patch?.({commentId:ge.commentId,status:"resolved"}));case"comments.reopen":return H(await Je.comments?.patch?.({commentId:ge.commentId,status:"active"}));case"comments.delete":return H(await Je.comments?.delete?.({commentId:ge.commentId}));case"comments.reply":return H(await Je.comments?.create?.({parentCommentId:ge.parentCommentId,text:ge.text}));case"comments.edit":return H(await Je.comments?.patch?.({commentId:ge.commentId,text:ge.text}));case"trackedChanges.accept":return H(await Je.trackChanges?.decide?.({decision:"accept",target:{kind:"id",id:ge.id}}));case"trackedChanges.reject":return H(await Je.trackChanges?.decide?.({decision:"reject",target:{kind:"id",id:ge.id}}));case"trackedChanges.acceptAll":return H(await Je.trackChanges?.decide?.({decision:"accept",target:{kind:"all"}}));case"trackedChanges.rejectAll":return H(await Je.trackChanges?.decide?.({decision:"reject",target:{kind:"all"}}));case"history.undo":return J("history.undo",await Je.history?.undo?.());case"history.redo":return J("history.redo",await Je.history?.redo?.());default:return null}}catch(ct){return{status:"rejected",reason:"command-failed",detail:ct instanceof Error?ct.message:String(ct)}}}function Y(ge){a=ge,w(),V(),C({type:"state-change",state:Vf(ge)}),C({type:"capabilities-change",capabilities:K(ge)}),ge.state==="disposed"&&!l&&(l=!0,m?.(),v?.(),g?.(),g=null,C({type:"disposed"}),S.clear(),u||(u=!0,s?.(t)))}m=o.subscribe(Y),v=o.subscribePageMetrics?.(()=>{C({type:"layout-change",layout:x()})})??null,V();async function _e(ge){const Te=Vf(a);if(Te==="disposed")return{status:"rejected",reason:"runtime-not-ready"};if(Te==="saving")return{status:"rejected",reason:"host-saving"};if(!mm(Te))return{status:"rejected",reason:"runtime-not-ready"};const Ne="at"in ge?ge.at:"range"in ge?ge.range:void 0;if(Ne){const Tt=L(Ne);return Tt.ok?{status:"rejected",reason:"target-unsupported",detail:"positioned dispatch is deferred until the shared runtime can target host selections explicitly"}:{status:"rejected",reason:Tt.reason}}if(ge.kind==="trackedChanges.setAuthoringMode")return o.setDocumentMode(ge.mode==="tracked"?"suggesting":"editing"),w(),{status:"committed"};const Je=await Q(ge);if(Je)return Je;let ct=null;switch(ge.kind){case"text.insert":ct={kind:"text.insert",text:ge.text};break;case"text.replace":ct={kind:"text.replace",text:ge.text};break;case"text.deleteBackward":ct={kind:"text.deleteBackward"};break;case"text.deleteForward":ct={kind:"text.deleteForward"};break;case"text.paste":ct={kind:"text.pastePlain",text:ge.text};break;case"history.undo":ct={kind:"history.undo"};break;case"history.redo":ct={kind:"history.redo"};break;case"structural.splitBlock":ct={kind:"structural.enter"};break;case"structural.indent":ct={kind:"structural.listIndent"};break;case"structural.outdent":ct={kind:"structural.listOutdent"};break;default:return{status:"rejected",reason:"command-unsupported",detail:ge.kind}}const tt=await o.dispatch(ct);switch(tt.status){case"committed":return w(),{status:"committed",receipt:tt.receipt};case"history-committed":return w(),{status:"history-committed",result:tt.result};case"history-noop":return{status:"history-noop",reason:tA(ge.kind,tt.result),result:tt.result};case"receipt-failure":return{status:"receipt-failure",failure:tt.failure};case"rejected":return{status:"rejected",reason:nA(tt.rejection.code),detail:tt.rejection.detail}}}async function ue(ge){if(l||a.state==="disposed")return!1;const Te=d?.focus;return Te&&typeof Te.focus=="function"?await Te.focus({restoreSelection:ge?.restoreSelection,preventScroll:ge?.preventScroll})!==!1:typeof r.focus=="function"?(r.focus({preventScroll:ge?.preventScroll}),!0):!1}async function ve(){l||(await o.dispose(),l||(l=!0,m?.(),v?.(),g?.(),g=null,C({type:"disposed"}),S.clear(),u||(u=!0,s?.(t))))}return{runtime:{id:t,kind:"v2",documentId:n,root:r,getCapabilities:()=>K(),getSnapshot:()=>$(),setDocumentMode(ge){o.setDocumentMode(ge)},getDocumentMode:()=>o.getDocumentMode(),setTrackedChangesRenderOptions(ge){o.setTrackedChangesRenderOptions(ge)},getLegacyEditorProjection:()=>i?.()??TP,focus:ue,dispose:ve,dispatch:_e,getSelectedText:()=>"",getSelectionSnapshot:W,getToolbarState(){return{activeMarks:[],disabled:["formatting.applyMark","formatting.applyParagraph"]}},getLayoutSnapshot:x,save:()=>o.save(),exportDocx:ge=>o.save({format:"docx",commentExportMode:ge?.commentsType==="clean"?"strip":"preserve"}),async setZoom(ge){const Te=o.setZoom(ge);return Te.status==="ok"?{status:"committed"}:{status:"rejected",reason:Te.reason==="host-disposed"?"runtime-not-ready":"target-unsupported",detail:Te.reason}},async reveal(ge){if(ge.kind==="position"){const Te=L(ge.position);if(!Te.ok)return{status:"rejected",reason:Te.reason}}return{status:"rejected",reason:"capability-unsupported",detail:`${ge.kind} reveal is not exposed through the shared runtime yet`}},subscribe(ge){return S.add(ge),()=>{S.delete(ge)}}},attachMountHandle(ge){d=ge,V()}}}var rA=".superdoc-toolbar";function PP(e){return Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.items)?e.items:[]}function FP(e){if(e&&typeof e=="object"){const t=e;return t.target??t.address??t.handle??e}return e}function vm(e){return typeof e=="function"}function oA(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function ym(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function NP(e){return ym(e)&&e.kind==="text"&&Array.isArray(e.segments)&&e.segments.length>0}function BP(e){return ym(e)&&e.kind==="story"&&(e.storyType==="headerFooterSlot"||e.storyType==="headerFooterPart")}function zP(e){if(!vm(e.selection?.current))return{handled:!1,reason:"page-field-selection-unavailable"};let t;try{t=e.selection.current({includeText:!1})}catch{return{handled:!1,reason:"page-field-selection-unavailable"}}return oA(t)?{handled:!1,reason:"page-field-selection-async"}:!ym(t)||!NP(t.target)?{handled:!1,reason:"page-field-selection-unavailable"}:BP(t.target.story)?{handled:!0,target:t.target}:{handled:!1,reason:"page-field-context-unavailable"}}function Cb(e,t){return!vm(e)||!vm(t)?!1:(Promise.resolve().then(()=>e()).then(n=>{for(const r of PP(n))try{Promise.resolve(t({target:FP(r)})).catch(()=>{})}catch{}}).catch(()=>{}),!0)}function jP(e){return{focusToolbar:()=>{const o=e.resolveToolbarElement();if(!o)return{handled:!1,reason:"no-toolbar"};const i=typeof o.matches=="function"&&o.matches(rA)?o:o.querySelector?.(rA)??o;return i?(i.hasAttribute("tabindex")||i.setAttribute("tabindex","0"),typeof i.focus!="function"?{handled:!1,reason:"no-toolbar"}:(i.focus(),!0)):{handled:!1,reason:"no-toolbar"}},updateFields:()=>{const o=e.getDocumentApi();if(!o)return{handled:!1,reason:"document-api-unavailable"};let i=Cb(o.toc?.list,o.toc?.update);return i=Cb(o.fields?.list,o.fields?.rebuild)||i,i=Cb(o.index?.list,o.index?.rebuild)||i,i?!0:{handled:!1,reason:"field-update-workflow-unavailable"}},insertPageField:o=>{const i=e.getDocumentApi();if(!i)return{handled:!1,reason:"document-api-unavailable"};if(!vm(i.fields?.insert))return{handled:!1,reason:"page-field-insert-unavailable"};const s=zP(i);if(!s.handled||!s.target)return{handled:!1,reason:s.reason??"page-field-context-unavailable"};const a=o==="page"?"PAGE":"NUMPAGES";try{const l=i.fields.insert({at:s.target,instruction:a,mode:"raw"});if(oA(l))l.catch(()=>{});else if(ym(l)&&l.success===!1)return{handled:!1,reason:"page-field-insert-failed"}}catch{return{handled:!1,reason:"page-field-insert-failed"}}return!0}}}function VP(e){let t=null;return n=>{const r=t;let o;const i=new Promise(a=>{o=a});t=i;const s=async()=>{try{return await e(n)}finally{t===i&&(t=null),o()}};return r?r.then(s):s()}}var bm="data-superdoc-runtime-id";function UP(e,t){e.setAttribute(bm,t)}function iA(e){e.removeAttribute(bm)}function HP(e,t){let n,r;switch(e){case"collaboration-access-denied":n="access-denied",r="The collaboration server rejected access to this room.";break;case"collaboration-connection-failed":n="connection-failed",r="The collaboration connection failed.";break;case"collaboration-sync-timeout":n="sync-timeout",r="The collaboration room did not finish synchronizing in time.";break;default:return null}return{error:new Error(r),code:e,collaborationReason:n,documentId:t,editor:null}}function $P(e){const t=e.telemetry;return t===null||t?.enabled===!1?null:{enabled:!0,endpoint:t?.endpoint,metadata:t?.metadata,licenseKey:e.licenseKey!==void 0?e.licenseKey:t?.licenseKey??"community-and-eval-agplv3"}}function GP(e){const t=new WeakSet;return{trackDocumentOpen(n,r,o=null){n&&t.has(n)||(n&&t.add(n),e.trackDocumentOpen(r,o))}}}function WP(e){const t=$P(e);return t?GP(new f5(t)):null}var KP="PKG-payload-",qP=new Set(["main-document-fallback"]),YP=new Set(["dangling-content-type-override","dangling-internal-relationship","relationship-id-collision","parts-not-referenced-from-known-rels"]);function sA(e,t={}){if(!e||typeof e.code!="string")return null;const{code:n,severity:r,message:o}=e,i=r==="error",s=r==="warn"&&qP.has(n);if(!i&&!s||YP.has(n)&&!i)return null;const a=n.startsWith(KP)?"PERFORMANCE_ERROR":"PARSE_ERROR";return{error:new Error(o||n),diagnosticCode:a,diagnosticStage:"unzip",severity:i?"error":"warn",internalCode:n,documentId:t.documentId??null,editor:t.editor??null,message:o||n}}function XP(e,t={}){if(!e||typeof e.code!="string")return null;const{code:n,reason:r,severity:o}=e;if(o!=="error"&&o!=="warn"||n==="render.exact-content-hydration-failed")return null;let i;if(n.includes("page-geometry.failed")||n.includes("section-metadata.failed")||n.includes("page-furniture.failed")||n==="render.provider-error")i="RENDER_ERROR";else if(n.includes("unsupported"))i="UNSUPPORTED_FEATURE";else if(n.includes("degraded"))i=typeof r=="string"&&(r.includes("retained ")||r.includes("localized resolve "))?"RENDER_ERROR":"PERFORMANCE_ERROR";else if(o==="error")i="RENDER_ERROR";else return null;const s=r||n;return{error:new Error(s),diagnosticCode:i,diagnosticStage:"render",severity:o,internalCode:n,documentId:t.documentId??null,editor:t.editor??null,message:s}}var aA={OpenRenderNoProgressError:"PERFORMANCE_ERROR",BoundedLocalPageCapError:"PERFORMANCE_ERROR",MountedEnginePassInterrupt:"RENDER_ERROR",RenderSchedulerWaitError:"RENDER_ERROR"},ZP=new Set(["open-failed","source-load-failed"]),lA=new Map([["input-too-large-for-inline-review","unzip"]]);function QP(e,t,n={}){const{bootErrorName:r,documentId:o,editor:i}=n;if(r&&aA[r]){const a=t||r;return{error:new Error(a),diagnosticCode:aA[r],diagnosticStage:"render",severity:"error",internalCode:r,documentId:o??null,editor:i??null,message:a}}if(lA.has(e)){const a=t||e;return{error:new Error(a),diagnosticCode:"PERFORMANCE_ERROR",diagnosticStage:lA.get(e),severity:"error",internalCode:e,documentId:o??null,editor:i??null,message:a}}if(!ZP.has(e))return null;const s=t||e;return{error:new Error(s),diagnosticCode:"PARSE_ERROR",diagnosticStage:"unzip",severity:"error",internalCode:e,documentId:o??null,editor:i??null,message:s}}var JP=new Set(["SSIG-SECT-parse-error","SSIG-PAGE-parse-error","SSIG-SETTINGS-parse-error","SSIG-USAGE-body-parse-error","SSIG-USAGE-numbering-parse-error"]);function eF(e,t={}){if(!e||typeof e.code!="string")return null;const{code:n,severity:r,message:o}=e;return!JP.has(n)||r!=="error"?null:{error:new Error(o||n),diagnosticCode:"PARSE_ERROR",diagnosticStage:"parse",severity:r,internalCode:n,documentId:t.documentId??null,editor:t.editor??null,message:o||n}}function tF(e,t={}){const n=e&&typeof e=="object"&&typeof e.name=="string"&&e.name||"export-failed",r=e&&typeof e=="object"&&typeof e.message=="string"&&e.message||"DOCX export failed";return{error:e,diagnosticCode:"RENDER_ERROR",diagnosticStage:"export",severity:"error",internalCode:n,documentId:t.documentId??null,editor:t.editor??null,message:r}}function wm(e){return typeof e?.generation=="number"?e.generation:0}function nF(){const e=new Map,t=new Map;return{shouldEmit(n,r,o){const i=n??"";let s=e.get(i);(!s||t.get(i)!==r)&&(s=new Set,e.set(i,s),t.set(i,r));const a=o??"";return s.has(a)?!1:(s.add(a),!0)}}}function rF(e,t,n){return!!e&&e.internalCode===t&&n.length>0}Ft(),mn();var oF={__name:"SurfaceExternalMount",props:{surfaceId:{type:String,required:!0},mode:{type:String,required:!0},request:{type:Object,required:!0},render:{type:Function,required:!0},resolve:{type:Function,required:!0},close:{type:Function,required:!0}},setup(e){const t=e,n=re(null);let r=null;function o(){i(),!(!n.value||!t.render)&&(r=t.render({container:n.value,surfaceId:t.surfaceId,mode:t.mode,request:t.request,resolve:t.resolve,close:t.close})?.destroy??null)}function i(){typeof r=="function"&&r(),r=null,n.value&&(n.value.innerHTML="")}return Nn(o),cr(i),jt(()=>t.surfaceId,()=>{o()}),(s,a)=>(ye(),De("div",{ref_key:"container",ref:n,class:"sd-surface-external-mount"},null,512))}},cA=un(oF,[["__scopeId","data-v-b2412c5d"]]),kb=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");Ft(),mn();var iF=["aria-labelledby","aria-label"],sF=["id"],aF={class:"sd-surface-dialog__content"},lF={__name:"SurfaceDialog",props:{surface:{type:Object,required:!0},scrollLockTarget:{type:Object,default:null}},emits:["close"],setup(e,{emit:t}){const n=e,r=t,o=re(null),i=ke(()=>n.surface.request.title?`sd-surface-title-${n.surface.id}`:void 0),s=ke(()=>i.value??n.surface.request.ariaLabelledBy??void 0),a=ke(()=>s.value?void 0:n.surface.request.ariaLabel);let l=null;function u(T){if(!o.value)return;const L=o.value.querySelectorAll(kb);if(L.length===0)return;const z=L[0],W=L[L.length-1];T.shiftKey&&document.activeElement===z?(T.preventDefault(),W.focus()):!T.shiftKey&&document.activeElement===W&&(T.preventDefault(),z.focus())}function d(){if(!o.value)return;const T=o.value.querySelector(kb);T?T.focus():o.value.focus()}let f=null,p="";function g(){if(n.scrollLockTarget)f=n.scrollLockTarget;else{const T=o.value?.closest(".superdoc");f=T?.querySelector(".superdoc__layers")??T}f&&(p=f.style.overflow,f.style.overflow="hidden")}function m(){f&&(f.style.overflow=p,f=null,p="")}function v(T){if(T.key==="Tab"){u(T);return}T.key==="Escape"&&n.surface.request.closeOnEscape!==!1&&(T.stopPropagation(),r("close"))}function k(T){T.target===T.currentTarget&&n.surface.request.closeOnBackdrop!==!1&&r("close")}const b=ke(()=>({surfaceId:n.surface.id,mode:"dialog",request:n.surface.request,resolve:n.surface.resolve,close:n.surface.close})),S=ke(()=>({...n.surface.props??{},...b.value})),C=ke(()=>{const T=n.surface.request.dialog?.maxWidth;if(T!=null)return typeof T=="number"?`${T}px`:T}),w=ke(()=>{const T={};return C.value&&(T["max-width"]=C.value),T});return Nn(async()=>{l=document.activeElement,g(),await St(),d()}),jt(()=>n.scrollLockTarget,(T,L)=>{T!==L&&(m(),g())}),cr(()=>{m(),l&&typeof l.focus=="function"&&l.focus(),l=null}),(T,L)=>(ye(),De("div",{class:"sd-surface-dialog-backdrop",onMousedown:Jt(k,["self"]),onKeydown:v},[He("div",{ref_key:"dialogRef",ref:o,class:"sd-surface-dialog",style:bn(w.value),role:"dialog","aria-modal":"true","aria-labelledby":s.value,"aria-label":a.value,tabindex:"-1"},[e.surface.request.title?(ye(),De("div",{key:0,id:i.value,class:"sd-surface-dialog__title"},Ut(e.surface.request.title),9,sF)):vt("",!0),He("div",aF,[e.surface.render?(ye(),an(cA,{key:0,"surface-id":e.surface.id,mode:"dialog",request:e.surface.request,render:e.surface.render,resolve:e.surface.resolve,close:e.surface.close},null,8,["surface-id","request","render","resolve","close"])):e.surface.component?(ye(),an(Av(e.surface.component),Ug(Ls({key:1},S.value)),null,16)):vt("",!0)])],12,iF)],32))}},cF=un(lF,[["__scopeId","data-v-20bf8e4b"]]);Ft(),mn();var uF=["aria-labelledby","aria-label"],dF=["id"],fF={class:"sd-surface-floating__content"},hF={__name:"SurfaceFloating",props:{surface:{type:Object,required:!0}},setup(e,{expose:t}){const n=e,r=re(null);t({rootEl:r});const o=re({}),i=ke(()=>n.surface.request.title?`sd-surface-title-${n.surface.id}`:void 0),s=ke(()=>i.value??n.surface.request.ariaLabelledBy??void 0),a=ke(()=>s.value?void 0:n.surface.request.ariaLabel),l=ke(()=>n.surface.request.floating??{}),u=ke(()=>{const C=l.value;return C.top!=null||C.right!=null||C.bottom!=null||C.left!=null}),d=ke(()=>{const C=["sd-surface-floating"];if(!u.value){const w=l.value.placement??"top-right";C.push(`sd-surface-floating--${w}`)}return C});function f(C){if(C!=null)return typeof C=="number"?`${C}px`:C}const p=ke(()=>{const C=l.value,w={};return C.top!=null&&(w.top=f(C.top)),C.right!=null&&(w.right=f(C.right)),C.bottom!=null&&(w.bottom=f(C.bottom)),C.left!=null&&(w.left=f(C.left)),C.width!=null&&(w.width=f(C.width)),C.maxWidth!=null&&(w["max-width"]=f(C.maxWidth)),C.maxHeight!=null&&(w["max-height"]=f(C.maxHeight)),{...w,...o.value}});async function g(){if(o.value={},!u.value)return;await St(),await new Promise(j=>requestAnimationFrame(j));const C=r.value,w=C?.parentElement;if(!C||!w)return;const T=8,L=C.getBoundingClientRect(),z=w.getBoundingClientRect(),W={},V=l.value;if(V.left!=null&&V.right==null){const j=L.left-z.left,Z=Math.max(T,z.width-L.width-T),R=Math.min(Math.max(j,T),Z);R!==j&&(W.left=`${R}px`)}if(V.top!=null&&V.bottom==null){const j=L.top-z.top,Z=Math.max(T,z.height-L.height-T),R=Math.min(Math.max(j,T),Z);R!==j&&(W.top=`${R}px`)}o.value=W}jt(l,g,{deep:!0});const m=ke(()=>({surfaceId:n.surface.id,mode:"floating",request:n.surface.request,resolve:n.surface.resolve,close:n.surface.close})),v=ke(()=>({...n.surface.props??{},...m.value}));let k=null,b=!1,S=null;return Nn(async()=>{if(g(),window.addEventListener("resize",g),typeof ResizeObserver<"u"&&r.value?.parentElement&&(S=new ResizeObserver(g),S.observe(r.value.parentElement),S.observe(r.value)),l.value.autoFocus===!1||(await St(),!r.value))return;const C=r.value.querySelector("[data-sd-autofocus]")??r.value.querySelector(kb);C&&(k=document.activeElement,C.focus(),b=!0)}),cr(()=>{window.removeEventListener("resize",g),S?.disconnect(),S=null,b&&k&&typeof k.focus=="function"&&k.focus(),k=null,b=!1}),(C,w)=>(ye(),De("div",{ref_key:"floatingRef",ref:r,class:en(d.value),style:bn(p.value),role:"dialog","aria-labelledby":s.value,"aria-label":a.value,"data-editor-ui-surface":""},[e.surface.request.title?(ye(),De("div",{key:0,id:i.value,class:"sd-surface-floating__title"},Ut(e.surface.request.title),9,dF)):vt("",!0),He("div",fF,[e.surface.render?(ye(),an(cA,{key:0,"surface-id":e.surface.id,mode:"floating",request:e.surface.request,render:e.surface.render,resolve:e.surface.resolve,close:e.surface.close},null,8,["surface-id","request","render","resolve","close"])):e.surface.component?(ye(),an(Av(e.surface.component),Ug(Ls({key:1},v.value)),null,16)):vt("",!0)])],14,uF))}},pF=un(hF,[["__scopeId","data-v-cd2be5db"]]);Ft(),mn();var mF={__name:"SurfaceHost",props:{geometryTarget:{type:Object,default:null}},setup(e){const t=e,n=ll("surfaceManager",null),r=ke(()=>n?.activeDialog.value??null),o=ke(()=>n?.activeFloating.value??null),i=ke(()=>r.value!=null||o.value!=null),s=re(null),a=re(null),l=re({}),u=new Set(["hidden","scroll","auto","clip"]);function d(K){const x=[];let $=K.parentElement;for(;$;){const H=getComputedStyle($);(u.has(H.overflowX)||u.has(H.overflowY))&&x.push($),$=$.parentElement}return x}function f(K,x){let $=0,H=0,J=window.innerWidth,Q=window.innerHeight;for(const _e of x){const ue=_e.getBoundingClientRect(),ve=getComputedStyle(_e);u.has(ve.overflowX)&&(H=Math.max(H,ue.left),J=Math.min(J,ue.right)),u.has(ve.overflowY)&&($=Math.max($,ue.top),Q=Math.min(Q,ue.bottom))}const Y=K.getBoundingClientRect();return $=Math.max($,Y.top),H=Math.max(H,Y.left),J=Math.min(J,Y.right),Q=Math.min(Q,Y.bottom),{top:$,left:H,width:Math.max(J-H,0),height:Math.max(Q-$,0)}}let p=null,g=[],m=0,v=null;function k(){if(!p)return;const{top:K,left:x,width:$,height:H}=f(p,g);l.value={position:"fixed",top:`${K}px`,left:`${x}px`,width:`${$}px`,height:`${H}px`}}function b(){m||(m=requestAnimationFrame(()=>{m=0,k()}))}function S(){if(p=t.geometryTarget??null,!!p){g=d(p),k(),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),v=new ResizeObserver(b),v.observe(p);for(const K of g)v.observe(K)}}function C(){m&&(cancelAnimationFrame(m),m=0),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",b),v&&(v.disconnect(),v=null),p=null,g=[]}jt(i,K=>{K?S():C()}),jt(()=>t.geometryTarget,K=>{K&&i.value&&!p&&S()}),Nn(()=>{i.value&&S()});function w(K){const x=o.value;!x||x.settled||r.value||K.key==="Escape"&&x.request.closeOnEscape!==!1&&(K.stopPropagation(),n.close(x.id))}let T=!1;function L(){T||(document.addEventListener("keydown",w,!0),T=!0)}function z(){T&&(document.removeEventListener("keydown",w,!0),T=!1)}function W(K){const x=o.value;if(!x||x.settled||r.value)return;const $=a.value?.rootEl;$&&!$.contains(K.target)&&n.close(x.id)}let V=!1;function j(){V||(document.addEventListener("pointerdown",W,!0),V=!0)}function Z(){V&&(document.removeEventListener("pointerdown",W,!0),V=!1)}jt(o,K=>{K&&!K.settled?(L(),K.request.floating?.closeOnOutsidePointerDown?j():Z()):(z(),Z())},{immediate:!0}),cr(()=>{C(),z(),Z()});function R(){const K=r.value;K&&!K.settled&&n.close(K.id)}return(K,x)=>(ye(),an(dl,{to:"body"},[i.value?(ye(),De("div",{key:0,ref_key:"hostRef",ref:s,class:"sd-surface-host",style:bn(l.value)},[o.value?(ye(),an(pF,{key:o.value.id,surface:o.value,ref_key:"floatingRef",ref:a},null,8,["surface"])):vt("",!0),r.value?(ye(),an(cF,{key:r.value.id,surface:r.value,"scroll-lock-target":Qe(p),onClose:R},null,8,["surface","scroll-lock-target"])):vt("",!0)],4)):vt("",!0)]))}},gF=un(mF,[["__scopeId","data-v-c6a3b75f"]]),Sb,vF=xr((()=>{Sb=(e,t)=>{const n=10**(t||0);return Math.floor(e*n)/n}})),uA,yF=xr((()=>{uA=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=o=>t(o.target.result),r.onerror=n,r.readAsDataURL(e)})})),dA,bF=xr((()=>{dA=(e,t)=>{const n=t-e;return Array.from({length:n},(r,o)=>e+o)}}));function wF(e){return`https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${e}/pdf.worker.min.mjs`}var fA,hA,pA,mA,CF=xr((()=>{bF(),fA=e=>({adapter:"pdfjs",...e}),hA=class BE{constructor(){if(Object.getPrototypeOf(this).constructor===BE)throw new Error("Abstract class should not be instantiated")}},pA=class extends hA{constructor(e){super(),this.pdfLib=e.pdfLib,this.workerSrc=e.workerSrc,e.setWorker&&(this.workerSrc?this.pdfLib.GlobalWorkerOptions.workerSrc=e.workerSrc:this.pdfLib.GlobalWorkerOptions.workerSrc=wF(this.pdfLib.version))}async getDocument(e){return await this.pdfLib.getDocument(e).promise}async getPages(e,t,n){const r=dA(t,n+1).map(o=>e.getPage(o));return await Promise.all(r)}},mA=class{static create(e){const t={pdfjs:()=>new pA(e),default:()=>{throw new Error("Unsupported adapter")}};return(t[e.adapter]??t.default)()}}})),kF=xr((()=>{})),SF=xr((()=>{})),gA,vA,yA,bA,_F=xr((()=>{Ft(),cb(),kF(),SF(),mn(),gA=["data-page-id","data-page-number"],vA={class:"sd-pdf-viewer-page__canvas-wrapper"},yA={__name:"PdfViewerPage",props:{config:{type:Object,required:!0},page:{type:Object,required:!0},pages:{type:Array,required:!0},scale:{type:Number,required:!0},hasTextLayer:{type:Boolean,default:!1},outputScale:{type:Number,default:2},documentEl:{type:[Object],default:null}},emits:["page-rendered","page-error","text-layer-rendered","text-layer-error","selection-raw","bypass-selection"],setup(e,{emit:t}){const n=t,r=e,o=Br(null),i=re(null),s=re(null),a=re(null);let l;const u=ke(()=>r.pages.findIndex(j=>j.pageId===r.page.pageId)),d=ke(()=>u.value===-1?0:u.value+1);function f(j){const Z=window.getSelection();if(!Z||Z.rangeCount===0)return null;const R=Z.getRangeAt(0).getClientRects();if(!R.length)return null;const K=j.getBoundingClientRect(),x=r.scale??1,$=R[0];let H={top:$.top,left:$.left,bottom:$.bottom,right:$.right};for(let J=1;J<R.length;J+=1){const Q=R[J];Q.width===0||Q.height===0||(H.top=Math.min(H.top,Q.top),H.left=Math.min(H.left,Q.left),H.bottom=Math.max(H.bottom,Q.bottom),H.right=Math.max(H.right,Q.right))}return{top:(H.top-K.top)/x+j.scrollTop,left:(H.left-K.left)/x+j.scrollLeft,bottom:(H.bottom-K.top)/x+j.scrollTop,right:(H.right-K.left)/x+j.scrollLeft}}const p=ke(()=>{let{width:j,height:Z}=o.value;return[j,Z]=[j,Z].map(R=>Math.ceil(R)),{width:j,height:Z}}),g=ke(()=>{const{width:j,height:Z}=p.value;return{width:j,height:Z}}),m=ke(()=>{const{width:j,height:Z}=b();return{"--scale-factor":`${C()}`,width:`calc(var(--scale-factor) * ${j}px)`,height:`calc(var(--scale-factor) * ${Z}px)`}});function v(){const j=window.getSelection();if(!j||j.toString().length===0)return;const Z=f(r.documentEl?.value??r.documentEl??i.value);Z&&n("selection-raw",{selectionBounds:Z,documentId:r.page.documentId,page:d.value,source:"pdf"})}function k(j){j?.target&&j.target.tagName!=="SPAN"&&n("bypass-selection",j)}function b(){const j=_l*r.outputScale;let{width:Z,height:R}=o.value;return Z=Z/j,R=R/j,[Z,R]=[Z,R].map(K=>Math.ceil(K)),{width:Z,height:R}}function S(){const{width:j,height:Z}=b(),R=C();return{width:j*R,height:Z*R}}function C(){return(r.scale??1)*_l}function w(){const{pdfjsPage:j}=r.page;o.value=j.getViewport({scale:_l*r.outputScale})}async function T(){if(l)return;const j=s.value;if(!j||!o.value)return;const Z={canvasContext:j.getContext("2d"),viewport:o.value};try{const{pdfjsPage:R}=r.page;l=R.render(Z),await l.promise;const K=S(),x=b(),$={page:r.page,documentId:r.page.documentId,pageIndex:u.value,pageNumber:d.value,width:K.width,height:K.height,originalWidth:x.width*_l,originalHeight:x.height*_l};n("page-rendered",$)}catch{V(),n("page-error",r.page)}}async function L(){if(!r.hasTextLayer)return;const j=a.value;if(!j)return;j.innerHTML="";const Z=r.config?.pdfLib?.TextLayer;if(Z)try{const R=(r.scale??1)*_l,K=r.page.pdfjsPage.getViewport({scale:R});await new Z({textContentSource:await r.page.pdfjsPage.getTextContent(),container:j,viewport:K}).render(),n("text-layer-rendered",r.page)}catch(R){n("text-layer-error",r.page),console.error(R)}}async function z(){await T(),await L()}function W(j){j?.pdfjsPage&&j.pdfjsPage.cleanup(),V()}function V(){l&&(l.cancel(),l=null)}return jt(()=>r.scale,()=>{L()}),w(),Nn(()=>{z()}),cr(()=>{W(r.page)}),(j,Z)=>(ye(),De("div",{class:"sd-pdf-viewer-page","data-page-id":e.page.pageId,"data-page-number":d.value,style:bn(m.value),"data-pdf-page":"",ref_key:"pageRef",ref:i,onMousedown:k,onMouseup:v},[He("div",vA,[He("canvas",Ls({class:"sd-pdf-viewer-page__canvas"},g.value,{ref_key:"canvasRef",ref:s}),null,16)]),e.hasTextLayer?(ye(),De("div",{key:0,class:"sd-pdf-viewer-page__text-layer",ref_key:"textLayerRef",ref:a},null,512)):vt("",!0)],44,gA))}},bA=un(yA,[["__scopeId","data-v-d7a9857d"]])})),AF=xr((()=>{})),wA,CA,IF=xr((()=>{Ft(),_F(),AF(),mn(),wA={__name:"PdfViewerDocument",props:{config:{type:Object,required:!0},pdf:{type:Object},pages:{type:Array,required:!0},scale:{type:Number},hasTextLayer:{type:Boolean,default:!1},outputScale:{type:Number}},emits:["page-focus","page-rendered","page-error","selection-raw","bypass-selection"],setup(e,{emit:t}){const n=t,r=re(null),o=re(null);function i(u){n("page-rendered",u)}function s(u){n("page-error",u)}function a(u){n("selection-raw",u)}function l(u){n("bypass-selection",u)}return(u,d)=>(ye(),De("div",{class:"sd-pdf-viewer-document",ref_key:"documentRef",ref:r},[He("div",{class:"sd-pdf-viewer-document__wrapper",ref_key:"documentWrapper",ref:o},[(ye(!0),De(Kt,null,ir(e.pages,f=>(ye(),an(bA,Ls({key:f.pageId},{ref_for:!0},{page:f,pages:e.pages,scale:e.scale,config:e.config,hasTextLayer:e.hasTextLayer,outputScale:e.outputScale,documentEl:r.value},{onPageRendered:i,onPageError:s,onSelectionRaw:a,onBypassSelection:l}),null,16))),128))],512)],512))}},CA=un(wA,[["__scopeId","data-v-2152178b"]])})),EF=xr((()=>{})),TF=Ld({default:()=>_A}),kA,SA,_A,xF=xr((()=>{Ft(),vF(),yF(),cb(),CF(),IF(),EF(),mn(),kA={class:"sd-pdf-viewer__main"},SA={__name:"PdfViewer",props:{config:{type:Object,required:!0},file:{type:Object,required:!0},fileId:{type:String},initialScale:{type:Number,default:1}},emits:["page-rendered","pages-loaded","document-loaded","document-ready","document-error","selection-raw","bypass-selection"],setup(e,{expose:t,emit:n}){const r=n,o=e,i=fA({pdfLib:Wr(o.config.pdfLib),workerSrc:o.config.workerSrc,setWorker:o.config.setWorker}),s=mA.create(i),a=re(null),l=re(null),u=re(null),d=re([]),f=re(typeof o.initialScale=="number"&&Number.isFinite(o.initialScale)&&o.initialScale>0?Sb(o.initialScale,2):1),p=re(0),g=re(0),m=ke(()=>o.config?.textLayer===!0),v=ke(()=>o.config?.outputScale??2);function k(Z){const R=Z?.page;R&&(R.pageIsRendered=!0),C(),r("page-rendered",Z)}function b(Z){r("selection-raw",Z)}function S(Z){r("bypass-selection",Z)}function C(){p.value<=0||(g.value+=1,g.value>=p.value&&r("document-ready",{documentId:u.value?.documentId,viewerContainer:a.value}))}function w(Z){d.value=Z,p.value=Z.length,g.value=0}function T(Z){const R=Sb(Z,2);f.value=R}t({updateScale:T});async function L(Z){if(Z)try{const R=await uA(Z),K=o.fileId||V("document"),x=await s.getDocument(R);u.value={documentId:K,pdfjsDocument:Wr(x)},r("document-loaded",Z)}catch(R){r("document-error",R),console.error(R)}}async function z(){if(!u.value)return;const{pdfjsDocument:Z}=u.value,R=1,K=Z.numPages;try{const x=await s.getPages(Z,R,K),$=J=>({documentId:u.value.documentId,pageId:j(u.value.documentId,J.pageNumber),pageNumber:J.pageNumber,pageIsRendered:!1,pdfjsPage:Wr(J)}),H=x.map($);w(H),r("pages-loaded",H)}catch(x){r("document-error",x),console.error(x)}}function W(){d.value=[],f.value=1}function V(Z){return`pdf-${Z.replace(/\W/g,"")}-${Math.random().toString(36).slice(2)}-${Date.now()}`}function j(Z,R){return`${Z}-page-${R}`}return jt(()=>o.file,Z=>{L(Z)},{immediate:!0}),jt(u,(Z,R)=>{Z&&(R&&W(),z())}),(Z,R)=>(ye(),De("div",{class:"sd-pdf-viewer",ref_key:"rootRef",ref:a},[He("div",kA,[Xt(CA,Ls({pdf:u.value,pages:d.value,scale:f.value,config:e.config,hasTextLayer:m.value,outputScale:v.value},{onPageRendered:k,onSelectionRaw:b,onBypassSelection:S,ref_key:"documentRef",ref:l}),null,16)])],512))}},_A=un(SA,[["__scopeId","data-v-05c9d9b5"]])}));Ft(),mn();var RF=["innerHTML"],MF={class:"superdoc__document document"},LF={class:"floating-comments"},AA="superdoc:v2-tracked-change-carriers-restamped",DF=!1,OF=3,PF={__name:"SuperDoc",emits:["selection-update"],setup(e,{emit:t}){const n=X1(()=>Promise.resolve().then(()=>(xF(),TF))),r=O=>O.password??F.$superdoc.config.password,o=O=>{const G=O?.v2Collaboration,pe=G&&typeof G=="object"&&"value"in G?G.value:G;if(pe==null)return{state:"absent"};const Ce=bk({v2Collaboration:pe,documentType:O?.type??null,documentCount:a.value.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!Ce.ok)return{state:"invalid",failure:{code:Ce.reason==="invalid-room-mode"?"collaboration-open-intent-invalid":"collaboration-config-invalid",message:`SuperDoc rejected the v2 collaboration configuration (${Ce.reason}).`}};const{providerFamily:rt,...xt}=Ce.target;return{state:"valid",config:{providerType:rt,...xt}}},i=Uu(),s=Us(),{documents:a,isReady:l,areDocumentsReady:u,selectionPosition:d,activeSelection:f,activeZoom:p,zoomMode:g,measurementUnit:m,viewportMetrics:v}=Ns(i),{handlePageReady:k,modules:b,user:S,getDocument:C}=i,w=ll("surfaceManager",null),T=BD({getSurfaceManager:()=>w,getPasswordPromptConfig:()=>F.$superdoc?.config?.modules?.surfaces?.passwordPrompt,onUnhandled:(O,G,pe)=>{F.$superdoc?.emit("exception",{error:pe?.error??new Error(`Password prompt unhandled: ${G}`),editor:pe?.editor??null,code:G,documentId:O?.id})}}),{getConfig:L,documentsWithConverations:z,commentsList:W,pendingComment:V,activeComment:j,skipSelectionUpdate:Z,commentsByDocument:R,isCommentsListVisible:K,isFloatingCommentsReady:x,generalCommentIds:$,hasSyncedCollaborationComments:H,editorCommentPositions:J,hasInitializedLocations:Q,isCommentHighlighted:Y,hasOpenTrackedChanges:_e}=Ns(s),{showAddComment:ue,handleEditorLocationsUpdate:ve,handleTrackedChangeUpdate:ge,refreshTrackedChangeCommentsByIds:Te,syncTrackedChangePositionsWithDocument:Ne,syncTrackedChangeComments:Je,addComment:ct,addHydratedComment:tt,getComment:Tt,resolveCommentPositionEntry:ae,belongsToDocument:Ee,COMMENT_EVENTS:Ue,requestInstantSidebarAlignment:ie,peekInstantSidebarAlignment:I,clearInstantSidebarAlignment:se}=s,{proxy:F}=pr();s.proxy=F;const q=WP(F.$superdoc.config),P=F7(F.$superdoc.config),ee=Wr(P.EditorComponent),be=P.RulerComponent?Wr(P.RulerComponent):null,N=ke(()=>{const O=Qe(s.getFloatingComments);return Array.isArray(O)?O:[]}),{isHighContrastMode:B}=ds(),{uiFontFamily:de}=ib(),Se=()=>s.viewingVisibility.documentMode==="viewing",Ae=()=>!!F?.$superdoc?.config?.allowSelectionInViewMode,Le=ke(()=>Se()&&s.viewingVisibility.commentsVisible===!0),Xe=ke(()=>F?.$superdoc?.uiConfig?.search?.enabled===!0);ke(()=>Se()&&s.viewingVisibility.trackChangesVisible===!0);const it=ke(()=>s.shouldRenderReviewInViewing),yt=ke(()=>F.$superdoc.config.proofing!==void 0?F.$superdoc.config.proofing:F.$superdoc.config.layoutEngineOptions?.proofing),Mt=ke(()=>{const O=b.comments;if(O===!1||O==null)return null;const G=F.$superdoc?.uiConfig?.comments?.options;return!G||Object.keys(G).length===0?O:cD(O,G)}),Lt=ke(()=>{const O={"--sd-ui-font-family":de.value},G=Mt.value;if(!G)return O;G.highlightHoverColor&&(O["--sd-comments-highlight-hover"]=G.highlightHoverColor);const pe={...G.trackChangeHighlightColors||{},...G.trackChangeActiveHighlightColors||{}};return pe.insertBorder&&(O["--sd-tracked-changes-insert-border"]=pe.insertBorder),pe.insertBackground&&(O["--sd-tracked-changes-insert-background"]=pe.insertBackground),pe.deleteBorder&&(O["--sd-tracked-changes-delete-border"]=pe.deleteBorder),pe.deleteBackground&&(O["--sd-tracked-changes-delete-background"]=pe.deleteBackground),pe.formatBorder&&(O["--sd-tracked-changes-format-border"]=pe.formatBorder),O}),Wt=re(null),Be=re(null),rn=re(null),zn=re(null),Ht=re(!1),xn=no({top:null,right:"-25px",zIndex:101}),{superdocContainerWidth:Ur,isCompactCommentsMode:yr,recalculateCompactCommentsMode:Ar,ensureCompactMeasurementObserver:et}=Y9({commentsModuleConfig:Mt,superdocRoot:Wt,layers:Be}),kt=ke(()=>!0),Bt=Br(null),cn=re(!1),fn=re(!1),nn=re(null);let wn=0,Qt=0,er=null;const go=ke(()=>F.$superdoc.activeEditor),je=()=>F.$superdoc?.ui??null,$e=Object.freeze({enabled:!1,active:!1,supported:!1}),nt=HD({getSurfaceManager:()=>w,getActiveEditor:()=>F.$superdoc?.activeEditor,activeEditorRef:go,getFindReplaceConfig:()=>F.$superdoc?.uiConfig?.search?.enabled?F.$superdoc.uiConfig.search.options:!1,getSuperDocUI:je}),Ct=()=>w||(typeof F.$superdoc?.openSurface!="function"?null:{open:O=>F.$superdoc.openSurface(O)}),Pt=()=>{const O=hm(F.$superdoc?.config);return O.editableActivationDisabled?()=>({type:"none"}):O.handler},gn=EP({getSurfaceManager:Ct,getActiveEditor:()=>F.$superdoc?.activeEditor,getUi:je,getActivationHandler:Pt,getActivationHandlerSource:()=>hm(F.$superdoc?.config).handlerSource,getBuiltInEditorDisabled:()=>hm(F.$superdoc?.config).builtInEditorDisabled,shouldInterceptNavigationOnlyHyperlinks:()=>hm(F.$superdoc?.config).interceptsNavigationOnly,getLayerElement:()=>Be.value,emitException:O=>{F.$superdoc?.emit("exception",{...O,editor:F.$superdoc?.activeEditor??null})}}),vo=F.$superdoc.config.modules?.pdf||{},Po=()=>{Ht.value&&(Ht.value=!1,Je({superdoc:F.$superdoc,editor:F.$superdoc?.activeEditor}))},Hi=()=>{Ht.value=!0,St(()=>{Po()})},on=(O,G)=>{const pe=C(O);pe.isReady=!0,pe.container=G,u.value&&(F.$superdoc.config.collaboration||(l.value=!0)),Xo(),x.value=!0,Q.value=!0,F.$superdoc.broadcastPdfDocumentReady()},Kn=()=>{if(!d.value||!Be.value)return null;const O=d.value.source==="pdf"?(p.value??100)/100:1,G=Number(d.value.top);return Number.isFinite(G)?Be.value.getBoundingClientRect().top+G*O:null},Hn=async()=>{if((await ue(F.$superdoc,Kn()))?.ok===!1||!kt.value)return;const O=Ul();O&&zc(O)},Yr=async O=>{const G={comments:()=>Hn()};O in G&&await G[O](f.value,d.value),f.value=null,xn.top=null},ln=()=>xn.top=null,Ln=new Map,br=new Map,Ao=new Map,Io=new Map;let Wo=0;const _i=O=>{const G=Ao.get(O);if(G){Ao.delete(O);try{G.unbind?.()}catch(pe){console.warn("[SuperDoc] v2 command-shortcut unbind failed",pe)}}},Ai=()=>{const O=F.$superdoc?.toolbar;return!O||typeof O.getToolbarItemByName!="function"?null:()=>{const G=O.getToolbarItemByName("link");!G||G.disabled?.value===!0||(G.expand&&typeof G.expand=="object"&&"value"in G.expand&&(G.expand.value=!0),O.updateToolbarState?.())}},yo=({documentId:O,bindEditShortcuts:G})=>{if(!O||(_i(O),typeof G!="function"))return;const pe=Ai(),Ce=G({commandRoute:{executeAsync:(rt,xt)=>{const Nt=je();return Nt?Nt.commands.executeAsync(rt,xt):Promise.resolve(DF)},getState:rt=>je()?.commands.get(rt).getState()??$e},...pe?{openLinkWorkflow:pe}:{}});Ao.set(O,{unbind:Ce})},Eo=O=>{const G=Io.get(O);if(G){Io.delete(O);try{G.unbind?.()}catch(pe){console.warn("[SuperDoc] v2 session-shortcut unbind failed",pe)}}},Bl=({documentId:O,bindSessionShortcuts:G,documentApi:pe})=>{if(!O||(Eo(O),typeof G!="function"))return;const Ce=G({routes:jP({resolveToolbarElement:()=>F.$superdoc?.toolbar?.toolbarContainer??null,getDocumentApi:()=>pe??null}),isMutationAllowed:()=>!Se()});Io.set(O,{unbind:Ce})},Zs=(O,G)=>{O?.id&&(G?Ln.set(O.id,G):Ln.delete(O.id))},ai=O=>{_i(O),Eo(O);const G=C(O),pe=G?.provider??null;pe&&F.$superdoc.provider===pe&&(F.$superdoc.provider=void 0),G&&pe?.sendStateless&&(G.provider=null);const Ce=br.get(O);if(!Ce)return;F.$superdoc.unregisterEditorRuntime(Ce.runtimeId),br.delete(O);const rt=Ln.get(O);rt&&iA(rt)},Ie=({documentId:O,host:G,mount:pe,facade:Ce})=>{const rt=Ln.get(O);if(!rt)return console.warn("[SuperDoc] v2 runtime host root unavailable; skipping runtime registration for",O),!1;br.has(O)&&ai(O);const xt=`v2:${O}:${++Wo}`,Nt=OP({id:xt,documentId:O,root:rt,host:G,getLegacyEditorProjection:()=>Ce,onUnregister:vn=>{F.$superdoc.unregisterEditorRuntime(vn);const sn=br.get(O);sn&&sn.runtimeId===vn&&br.delete(O);const En=Ln.get(O);En&&iA(En)}});return Nt.attachMountHandle(pe??null),UP(rt,xt),F.$superdoc.registerEditorRuntime(Nt.runtime),br.set(O,{runtimeId:xt,adapter:Nt}),F.$superdoc.setActiveRuntime(xt,"v2-editor-ready"),!0},ze=P.createReviewWindowController({applyReviewWindow:(O,G)=>s.applyReviewWindowFromV2?.({superdoc:O?.superdoc,commentsAdapter:O?.commentsAdapter,trackedChangesAdapter:O?.trackedChangesAdapter,documentId:O?.documentId,commentItems:G?.comments?.items,trackedChangeItems:G?.trackedChanges?.items,requestedCommentIds:G?.comments?.requestedIds,requestedTrackedChangeIds:G?.trackedChanges?.requestedIds,unresolvedCommentIds:G?.comments?.unresolvedCommentIds,trackedList:{complete:!1,visibleWindowSource:"visible-window"},patch:pe=>s.$patch(pe)})??{ok:!1,reason:"store-action-missing"}}),mt=re({}),ht=nF(),Rn=bD(),Vn=xD(),Hr=O=>typeof O=="string"&&O.length>0?`document:${O}`:"document:default",Xr=O=>{const G=Hr(O);Rn.clear(G),Vn.clear(G)},bo=(O,G)=>{Rn.shouldNotify(Hr(O),G)&&F.$superdoc.emit("exception",{error:new Error(yD,{cause:JS(G)}),code:vD,editor:null,...typeof O=="string"&&O.length>0?{documentId:O}:{}})},oo=(O,G)=>{Vn.shouldNotify(Hr(O),G)&&F.$superdoc.emit("exception",TD(O,G))},li=(O,G)=>{O&&(mt.value={...mt.value,[O]:G})},Fo=O=>{if(!O||!mt.value[O])return;const G={...mt.value};delete G[O],mt.value=G},qn=(O=null)=>{const G=F.$superdoc?.activeEditor,pe=O??G?.documentId??G?.options?.documentId??null;if(!pe){G?.editorVersion===2&&F.$superdoc.setActiveEditor(null);return}if(O&&G?.editorVersion===2){const xt=G.documentId??G.options?.documentId??null;if(xt&&xt!==O)return}const Ce=pe?C(pe):null;Ce&&(Ce.isReady=!1,typeof Ce.setEditor=="function"&&Ce.setEditor(null));const rt=br.has(pe);ai(pe),!rt&&G?.editorVersion===2&&(G.documentId??G.options?.documentId??null)===pe&&F.$superdoc.setActiveEditor(null)},zl=O=>{const G=typeof O?.getExtensionManager=="function"?O.getExtensionManager():null;if(!G)return null;const pe=G.commands;return{commands:{execute:(Ce,rt)=>pe.execute(Ce,rt),getState:Ce=>{const rt=pe.get(Ce);return rt?{enabled:!(rt.getState()??{}).disabled,reason:null}:null},list:()=>pe.list().map(Ce=>{const rt=Ce.getState()??{};return rt.label?{id:Ce.id,label:rt.label}:{id:Ce.id}})},diagnostics:{getSnapshot:()=>G.diagnostics()}}},Qs=O=>{const G=a.value.find(Ce=>Ce.id===O),pe=F.$superdoc.config.documents.find(Ce=>Ce.id===O);G&&(G.fieldContext={}),pe&&(pe.fieldContext={})},ci=O=>{if(!O)return;Fo(O.documentId??null),Xr(O.documentId??null);const{host:G,mount:pe,documentId:Ce,capabilities:rt,editCommands:xt,bindEditShortcuts:Nt,bindSessionShortcuts:vn,commentsAdapter:sn,trackedChangesAdapter:En,contextMenu:Dt,documentApi:Sn,documentMutationReadiness:Yn,documentApiUnavailableReason:eo,pageMetrics:ns,pageLayout:Jo,pageFurniture:Ja,presence:nc,lock:lg,collaborationProvider:cg,fonts:ca,replaceFile:rs,upgradeToCollaboration:Di,documentOpenToken:Eh}=O;q?.trackDocumentOpen(Eh??null,Ce??null);const ug=VP(async(Rt={})=>{if(!G||typeof G.save!="function")throw new Error("v2-editor: save unavailable");return G.save(Rt)}),dg=async(Rt={})=>{const Vt=Rt?.commentsType==="clean"?"strip":"preserve",yn=await ug({format:"docx",commentExportMode:Vt});return new Blob([yn],{type:Sr})},Th=async Rt=>{if(typeof rs!="function")throw new Error("v2-editor: replaceFile unavailable");const Vt=await rs(Rt);return(Vt?.state==="review-ready"||Vt?.state==="editing-ready")&&Qs(Ce),Vt},y2=async(Rt,Vt)=>{if(typeof Di!="function")throw new Error("v2-editor: upgradeToCollaboration unavailable");return Di(Rt,Vt)},xh=(Rt={})=>pe?.focus&&typeof pe.focus.focus=="function"?pe.focus.focus(Rt):!1,nr=(Rt,Vt=void 0)=>{const yn={ok:!1,reason:Rt};return Vt&&(yn.detail=Vt),yn},fg=Rt=>Array.isArray(Rt?.items)?Rt.items:[],hg=Rt=>{const Vt=Number(Rt);return Number.isFinite(Vt)&&Vt>0?Math.floor(Vt):0},pg=async({text:Rt,occurrence:Vt=0}={})=>{if(typeof Rt!="string"||Rt.length===0)return nr("invalid-text","text must be a non-empty string");if(!Sn?.query||typeof Sn.query.match!="function")return nr("query-unavailable","activeEditor.doc.query.match is not available");const yn=hg(Vt),Ir=await Sn.query.match({select:{type:"text",pattern:Rt},limit:yn+1}),to=fg(Ir),$r=to[yn]??null;return $r?.target?{ok:!0,item:$r,target:$r.target,ref:typeof $r?.handle?.ref=="string"?$r.handle.ref:null,text:Rt,occurrence:yn,total:Number.isFinite(Number(Ir?.total))?Number(Ir.total):to.length}:nr("text-not-found",`text not found: ${Rt}`)},mg=(Rt,Vt)=>{if(!Rt||typeof Rt!="object"||Rt.kind!=="selection"||Vt!=="start"&&Vt!=="end")return Rt;const yn=Vt==="start"?Rt.start:Rt.end;return yn?{kind:"selection",start:yn,end:yn,...Rt.story?{story:Rt.story}:{}}:Rt},gg=async({target:Rt,collapse:Vt=null,focus:yn=!0}={})=>{if(!Rt||typeof Rt!="object")return nr("invalid-target","target must be a SelectionTarget object");const Ir=mg(Rt,Vt),to=(G?.getHandles?.()?.editing??null)?.selectionTargets??null;if(typeof to?.apply!="function")return nr("selection-target-unavailable","editing.selectionTargets.apply is not available");let $r;try{$r=to.apply(Ir)}catch(Pi){const rr=Pi instanceof Error?Pi.message:String(Pi);return nr("selection-target-threw",rr)}return $r?.ok?(yn!==!1&&await Promise.resolve(xh()),{ok:!0,mode:$r.mode??"range"}):nr($r?.reason??"selection-target-rejected",$r?.detail)},vg=()=>F.$superdoc.config.documentMode==="suggesting"?"tracked":"direct",yg=()=>{const Rt=(G?.getHandles?.()?.editing??null)?.selection??null;if(typeof Rt?.toSelectionTarget!="function")return nr("selection-target-unavailable","editing.selection.toSelectionTarget is not available");const Vt=Rt.toSelectionTarget();if(!Vt||Vt.kind==="rejected"){const yn=Vt?.rejection??{};return nr(yn.reason??yn.code??"selection-target-rejected",yn.detail)}return!Vt.target||typeof Vt.target!="object"?nr("selection-target-rejected","selection target was not produced"):{ok:!0,target:Vt.target,mode:Vt.mode??"range",story:Vt.story}},Oi=(Rt,Vt)=>{const yn=Rt?.failure??Rt;return nr(yn?.code??Rt?.reason??Vt,yn?.message??yn?.detail??Rt?.detail)},No={focusEditable:xh,readBlocks:(Rt={includeText:!0})=>Sn?.blocks?.list?.(Rt),setSelectionTarget:(Rt={})=>gg(Rt),setSelectionByText:async(Rt={})=>{const Vt=await pg(Rt);if(!Vt.ok)return Vt;const yn=await gg({target:Vt.target,collapse:Rt?.collapse??null,focus:Rt?.focus});return yn.ok?{ok:!0,mode:yn.mode,text:Vt.text,occurrence:Vt.occurrence,target:Vt.target}:yn},replaceTextByText:async({findText:Rt,replacement:Vt,occurrence:yn=0,mode:Ir="direct"}={})=>{if(typeof Vt!="string")return nr("invalid-replacement","replacement must be a string");if(!Sn?.text||typeof Sn.text.replace!="function")return nr("text-replace-unavailable","activeEditor.doc.text.replace is not available");const to=await pg({text:Rt,occurrence:yn});if(!to.ok)return to;const $r=to.ref?{ref:to.ref,text:Vt,mode:Ir}:{target:to.target,text:Vt,mode:Ir},Pi=await Sn.text.replace($r);return Pi?.ok===!1?nr(Pi.reason??"text-replace-failed",Pi.detail):(await Promise.resolve(Yn?.whenPainted?.(Pi)),{ok:!0,receipt:Pi,text:Vt,replacedText:Rt,occurrence:hg(yn)})},replaceSelection:async({target:Rt,replacement:Vt="",mode:yn="direct"}={})=>{if(!Rt||typeof Rt!="object")return nr("invalid-target","target must be a SelectionTarget object");if(typeof Vt!="string")return nr("invalid-replacement","replacement must be a string");if(!Sn?.text||typeof Sn.text.replace!="function")return nr("text-replace-unavailable","activeEditor.doc.text.replace is not available");const Ir=await Sn.text.replace({target:Rt,text:Vt,mode:yn});return Ir?.ok===!1?nr(Ir.reason??"text-replace-failed",Ir.detail):(await Promise.resolve(Yn?.whenPainted?.(Ir)),{ok:!0,receipt:Ir,text:Vt})},serializeSelectionToClipboard:async({includeHtml:Rt=!0}={})=>{if(!Sn?.clipboard||typeof Sn.clipboard.serializeSelection!="function")return nr("clipboard-serialize-unavailable","activeEditor.doc.clipboard.serializeSelection is not available");const Vt=yg();if(!Vt.ok)return Vt;let yn;try{yn=await Sn.clipboard.serializeSelection({target:Vt.target,includeHtml:Rt!==!1})}catch(Ir){return nr("clipboard-serialize-threw",Ir instanceof Error?Ir.message:String(Ir))}return yn?.payload?{ok:!0,payload:yn.payload,plan:yn.plan,target:Vt.target,mode:Vt.mode}:nr("clipboard-serialize-failed","clipboard serialization did not return a payload")},pasteClipboardPayload:async({payload:Rt,target:Vt=null,mode:yn=vg(),fallback:Ir=void 0}={})=>{if(!Rt||typeof Rt!="object")return nr("invalid-clipboard-payload","payload must be a ClipboardPayload object");if(!Sn?.clipboard||typeof Sn.clipboard.insert!="function")return nr("clipboard-insert-unavailable","activeEditor.doc.clipboard.insert is not available");let to=Vt,$r=null;if(!to){const Ad=yg();if(!Ad.ok)return Ad;to=Ad.target,$r=Ad.mode}if(!to||typeof to!="object")return nr("invalid-target","target must be a SelectionTarget or ClipboardTarget object");const Pi={payload:Rt,target:to,changeMode:yn==="tracked"?"tracked":"direct",...Ir!==void 0?{fallback:Ir}:{}},rr=await Sn.clipboard.insert(Pi);return!rr||rr.success===!1||rr.ok===!1?Oi(rr,"clipboard-insert-failed"):(await Promise.resolve(Yn?.whenPainted?.(rr)),{ok:!0,receipt:rr,target:to,mode:$r})},pastePlainText:async({text:Rt,target:Vt=null,mode:yn=vg()}={})=>typeof Rt!="string"?nr("invalid-text","text must be a string"):No.pasteClipboardPayload({payload:{source:"api",items:[{type:"text/plain",kind:"string",data:Rt}]},target:Vt,mode:yn})},el={editorVersion:2,documentId:Ce,host:G,mount:pe,options:{documentId:Ce,documentMode:F.$superdoc.config.documentMode},capabilities:rt??G?.getCapabilities?.()??null,save:ug,exportDocx:dg,replaceFile:Th,upgradeToCollaboration:y2,doc:Sn??null,documentMutationReadiness:Yn??null,documentApiUnavailableReason:eo??null,focus:xh,authoring:No,editCommands:xt??null,v2Comments:sn??null,v2TrackedChanges:En??null,contextMenu:Dt??null,pageMetrics:ns??null,pageLayout:Jo??null,pageFurniture:Ja??null,presence:nc??null,lock:lg??null,provider:cg??null,reviewWindow:{getDiagnostics:()=>ze.getDiagnostics(),getSnapshot:()=>ze.getSnapshot?.()??null,subscribe:Rt=>ze.subscribe?.(Rt)??(()=>{})},extensions:zl(G),fonts:ca??G?.getFontRuntime?.()??null,commands:null,state:null,view:null},Is=C(Ce);if(Is&&(Is.isReady=!0,typeof Is.setEditor=="function"&&Is.setEditor(el)),Ie({documentId:Ce,host:G,mount:pe,facade:el})||F.$superdoc.setActiveEditor(el),cg){const Rt=Wr(cg);F.$superdoc.provider=Rt,Is&&(Is.provider=Rt)}F.$superdoc.broadcastEditorCreate(el),yo({documentId:Ce,bindEditShortcuts:Nt}),Bl({documentId:Ce,bindSessionShortcuts:vn,documentApi:Sn}),o(C(Ce)).state==="valid"&&vd({editor:el}),ns&&Jo&&wo();const Bo=F.$superdoc.config.modules?.comments!==!1;sn&&Bo&&s.setV2CommentsAdapter?.(sn),En&&Bo&&s.setV2TrackedChangesAdapter?.(En),(sn||En)&&ze.setContext({superdoc:F.$superdoc,documentId:Ce,commentsAdapter:sn??null,trackedChangesAdapter:En??null,resolveReviewWindow:Rt=>G.resolveReviewWindow(Rt)}),u.value&&!F.$superdoc.config.collaboration&&(l.value=!0),x.value=!0,Q.value=!0},fr=re(!1),Ko=Br(null),$i=re(!1);let Gi=0,Js=0,Wi=0;const Ki=({editor:O,sourceEditor:G,surface:pe="body",headerId:Ce=null,sectionType:rt=null}={})=>{const xt=F.$superdoc?.activeEditor??null,Nt=O??G??xt??void 0;return{editor:Nt,sourceEditor:G??Nt,surface:pe,headerId:Ce,sectionType:rt}},ea=(O={})=>{F.$superdoc.emit("editor-update",Ki(O))},Ii=()=>{Gi&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Gi),Js&&clearTimeout(Js),Gi=0,Js=0},Ei=(O=OF)=>{Ii();const G=()=>{Gi=0,Js=0,ra(),fr.value&&qo.value&&!d.value&&O>0&&Ei(O-1)};if(typeof requestAnimationFrame=="function"){Gi=requestAnimationFrame(G);return}Js=setTimeout(G,0)},ta=()=>{Wi&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(Wi),Wi=0},$a=()=>{fr.value=!1,Ko.value=null,Ii(),ra()},ud=(O,G)=>{if(!O||O.rangeCount<1||O.isCollapsed||!G)return!1;const pe=O.getRangeAt(0);return G.contains(pe.startContainer)&&G.contains(pe.endContainer)},qi=()=>{if(Wi=0,!kt.value)return;let O=null;try{O=F.$superdoc?.activeEditor?.host?.getHandles?.()??null}catch{O=null}const G=F.$superdoc?.config?.documentMode;if(G==="editing"||G==="suggesting"){const xt=O?.editing?.selection?.getSnapshot?.()??null,Nt=O?.editing?.selection?.toSelectionTarget?.();if(Nt?Nt.kind==="ok"&&Nt.mode==="range":LD(G,xt)){const vn=Zr();if(MD(window.getSelection?.()??null,vn)){$a();return}fr.value=!0,Ko.value=xt,Ei();return}}else if(G!=="viewing"){$a();return}const pe=Zr(),Ce=window.getSelection?.()??null;if(!ud(Ce,pe)){const xt=O?.selection?.toSelectionTarget?.(),Nt=xt?.kind==="ok"&&xt.mode==="range";if(Nt&&V.value){fr.value=!0,Ko.value=O?.selection?.getSnapshot?.()??null,O?.selection?.syncVisibleOverlay?.(),Ei();return}Nt&&$i.value&&(O?.selection?.clear?.(),$i.value=!1),$a();return}const rt=O?.selection?.applyDomSelection?.(Ce);if(!rt?.ok||rt.mode!=="range"){$a();return}$i.value=!0,fr.value=!0,Ko.value=O?.selection?.getSnapshot?.()??null,Ei()},jl=()=>{if(kt.value){if(ta(),typeof requestAnimationFrame!="function"){qi();return}Wi=requestAnimationFrame(qi)}},ws=()=>{jl()},Nc=({hasRangeSelection:O,snapshot:G}={})=>{if(Od(F.$superdoc,"selection:changed",()=>({hasRangeSelection:O,selection:G})),fr.value=O===!0,Ko.value=O===!0?G??null:null,fr.value){Ei();return}Ii(),ra()},Zr=()=>Bt.value?.mountContainer??F.$superdoc?.activeEditor?.mount?.container??null,na=O=>{const G=String(O);return globalThis.CSS?.escape?globalThis.CSS.escape(G):G.replace(/["\\]/g,"\\$&")},dd=()=>{const O=Ko.value,G=Zr();if(!O||!G?.querySelector)return null;const pe=O.anchor??null,Ce=[pe?.fragmentId,pe?.blockId,pe?.position?.anchor?.nativeId].filter(rt=>rt!=null&&rt!=="");for(const rt of Ce){const xt=na(rt),Nt=G.querySelector(`[data-source-node-id="${xt}"]`)??G.querySelector(`[data-layout-block-ref="${xt}"]`)??G.querySelector(`[data-layout-fragment-id="${xt}"]`);if(Nt instanceof HTMLElement)return Nt}return null};function gh(O=null){const G=window.getSelection?.();if(!G||G.rangeCount<1||G.isCollapsed)return null;const pe=G.getRangeAt(0);if(!pe)return null;if(O){const{startContainer:Ce,endContainer:rt}=pe;if(!O.contains(Ce)||!O.contains(rt))return null}try{const Ce=pe.getBoundingClientRect();return!Ce||Ce.width<=0&&Ce.height<=0?null:Ce}catch{return null}}const Bc=O=>{if(!O||!Be.value)return null;const G=Be.value.getBoundingClientRect();return{top:O.top-G.top,left:O.left-G.left,right:O.right-G.left,bottom:O.bottom-G.top,width:O.width,height:O.height}},Ti=O=>{let G=O;for(;G&&G.nodeType===1;){const pe=G.dataset?.pageIndex;if(pe!=null&&pe!==""){const Ce=Number(pe);if(Number.isFinite(Ce))return Ce}G=G.parentElement}return null},Vl=()=>{if(!fr.value||!qo.value)return null;const O=gh(Zr()),G=Bc(O)??Ul()?.bounds??null;if(!G)return null;const pe=F.$superdoc?.activeEditor?.options?.documentId??F.$superdoc?.activeEditor?.documentId;if(!pe)return null;const Ce=Ti(dd());return Nf({selectionBounds:G,page:Ce!=null?Ce+1:1,documentId:pe,source:Sc})},Ul=()=>{if(!Be.value)return null;const O=dd();if(!O)return null;const G=O.getBoundingClientRect();if(!G||G.width<=0&&G.height<=0)return null;const pe=Be.value.getBoundingClientRect(),Ce={top:G.top-pe.top,left:G.left-pe.left,right:G.right-pe.left,bottom:G.bottom-pe.top,width:G.width,height:G.height},rt=Ti(O);return{threadId:"pending",key:"pending",kind:"pending",storyKey:"body",bounds:Ce,...rt!=null?{pageIndex:rt}:{},...nn.value!=null?{generation:nn.value}:{}}},ra=()=>{if(!kt.value)return;if(!fr.value){f.value=null,le();return}const O=Vl();if(!O){f.value=null,le();return}ce(O)},zc=O=>{O&&ve({...J.value??{},pending:O})},$n=P.createGeometryPublisher({getLayersContainer:()=>Be.value??null,isCommentsEnabled:()=>!!Mt.value&&it.value,publishPositions:(O,G)=>ve(O,G),clearPositions:()=>{s.clearEditorCommentPositions?.()},readCurrentPositions:()=>J.value??{},setGeometryAvailable:O=>{const G=!!O;cn.value=G,G&&(fn.value=!0,nn.value=$n.getLastEpoch())}}),Hl=(O="tracked-change-restamp")=>{Qt=Math.max(Qt,3),er=O},jc=()=>{const O=Qt>0?er??"tracked-change-restamp":"render-epoch-handoff";return Qt>0&&(Qt-=1),Qt<=0&&(er=null),{retainMissingTrackedChangeGeometry:!0,reason:O}},fd=()=>{Qt=0,er=null},Ga=O=>typeof O=="function"?O():O,Vc=(O,G=void 0)=>{if(Bt.value=O,wn&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(wn),typeof requestAnimationFrame!="function"){$n.publish(Bt.value,Ga(G));return}wn=requestAnimationFrame(()=>{wn=0,$n.publish(Bt.value,Ga(G))})},Yi=O=>{O&&(Vc(O,()=>jc()),fr.value&&Ei())},oa=Br(null),ia=new Map;let Wa=null;const Uc=O=>{if(!O?.snapshot)return;const G=O.snapshot,pe=O.stage;if(typeof HTMLElement<"u"&&pe instanceof HTMLElement){Wa=pe;const rt=pe.dataset?.superdocV2DocumentId;rt&&ia.set(rt,pe)}oa.value=G;const Ce=Array.isArray(G.pages)?G.pages.length:0;F.$superdoc.emit("pagination-update",{totalPages:Ce,superdoc:F.$superdoc}),St(()=>{Cr(),Ql()})},$l=O=>{gn.destroy(),ta(),Ii(),wn&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(wn),wn=0,Bt.value=null,nn.value=null,cn.value=!1,fn.value=!1,fd(),$n.reset(),fr.value=!1,Ko.value=null,f.value=null,le(),oa.value=null;const G=O?.documentId==null?null:String(O.documentId);Xr(G),s.cancelImportedTrackedChangeBootstrap?.(G??void 0),G&&ia.delete(G),Wa&&(G==null||Wa.dataset?.superdocV2DocumentId===G)&&(Wa=null),ze.reset("render-cleared"),s.setV2CommentsAdapter?.(null),s.setV2TrackedChangesAdapter?.(null),s.clearEditorCommentPositions?.(),qn(O?.documentId??null),wo()},wr=(O,G)=>{if(!G||(Od(F.$superdoc,G.type,()=>({...G,documentId:O?.id??null})),G.type==="mutation:committed"&&G.origin==="extension"))return;const pe=O?.id??null;if(G.type==="collaboration:document-replaced"&&Qs(pe),G.type==="review-mutation:started"){ze.beginMutation(G.reviewMutation);return}if(G.type==="review-mutation:aborted"){ze.settleMutation(G.reviewMutation?.token,{outcome:"aborted",resumeDomains:["comments","trackedChanges"],trackedRowCount:s.getV2TrackedChangeRowCount?.(pe)??null});return}if(G.type==="reviewTarget:changed"){yh(G.next);return}if(G.type==="collaboration:remote-changed"){G.reviewChanged!==!1&&(ze.invalidate("collaboration:remote-review-changed"),ze.refreshCommittedWindow("collaboration:remote-review-changed"));return}if(G.type==="source:complete"){F.$superdoc.broadcastSourceComplete();return}if(G.type==="source:signals-complete"){const Nt=wm(G);for(const vn of G.diagnostics??[]){const sn=eF(vn,{documentId:pe,editor:null});sn&&ht.shouldEmit(pe,Nt,sn.internalCode)&&F.$superdoc.emit("exception",sn)}F.$superdoc.broadcastSourceSignalsComplete();return}if(G.type==="mutation:rejected"){G.reviewMutation?.token&&ze.settleMutation(G.reviewMutation.token,{outcome:"rejected",resumeDomains:["comments","trackedChanges"],trackedRowCount:s.getV2TrackedChangeRowCount?.(pe)??null}),n_(G)?bo(pe,G):oo(pe,G);return}if(G.type==="mutation:committed"){const Nt=wD(pe,G.trackedChangeBulkDecision);Nt&&F.$superdoc.emit("tracked-changes:bulk-decision",Nt),ea()}if(G.type!=="mutation:committed")return;G.origin==="history"?ze.refreshCommittedWindow(`history-${G.direction}`):G.reviewSidecarOnly===!0&&ze.refreshCommittedWindow("review-sidecar-committed");const Ce=ZS(G);dD({event:G,commentsStore:s,superdoc:F.$superdoc,documentId:pe}),Array.isArray(Ce?.remappedPairs)&&Ce.remappedPairs.length>0&&s.remapTrackedChangeIdentities?.(Ce.remappedPairs,{documentId:pe}),Ce&&Hl("tracked-change-mutation");const rt=F.$superdoc?.activeEditor??null,xt=Ce?s.reconcileTrackedChangeMutationFromV2?.({superdoc:F.$superdoc,adapter:rt?.v2TrackedChanges??null,documentId:pe,...Ce}):Promise.resolve({ok:!0});if(G.reviewMutation?.token){const Nt=G.reviewMutation,vn=!!(Ce?.allResolved??G.trackedChangeAllResolved),sn=En=>{const Dt=vn&&En?.ok===!0&&En?.allResolved===!0;ze.settleMutation(Nt.token,{outcome:"committed",allResolved:Dt,resumeDomains:Dt?["comments"]:["comments","trackedChanges"],trackedRowCount:s.getV2TrackedChangeRowCount?.(pe)??null})};Promise.resolve(xt).then(sn,()=>sn(null));return}Promise.resolve(xt).catch(()=>{})},Gl=O=>{gn.handleLinkClick(O)},Wl=async O=>{try{await s.announceV2CommentCreated?.({superdoc:F.$superdoc,commentId:O?.commentId})}catch(G){console.warn("[SuperDoc][v2] context-menu comment reconciliation failed",G)}},xi=(O=void 0)=>{if(kt.value&&$n.getLastPayload()){if(wn&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(wn),typeof requestAnimationFrame!="function"){$n.recollect(Ga(O));return}wn=requestAnimationFrame(()=>{wn=0,$n.recollect(Ga(O))})}},hd=()=>{if(!kt.value)return;try{ze.refreshCommittedWindow("document-mode-change")}catch(G){console.warn("[SuperDoc][v2] document-mode review-window refresh failed",G)}const O=()=>{kt.value&&(it.value?Bt.value?Vc(Bt.value):xi():(s.clearEditorCommentPositions?.(),cn.value=!1))};St(()=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>O()):O()})},pd=O=>{switch(O){case"editing-mount-required":return"SuperDoc could not load the document editor because the page did not provide a mount container.";case"source-load-failed":return"SuperDoc could not load the document editor because the document source could not be prepared.";case"unsupported-cdn-v2-editor":return"SuperDoc could not load the document editor because this build does not include the V2 runtime.";case"v2-integration-unavailable":return"SuperDoc could not load the document editor because the bundled V2 runtime is unavailable in this environment.";case"worker-init-failed":return"SuperDoc could not load the document editor because the browser worker failed to start.";case"input-too-large-for-inline-review":return"SuperDoc could not load the document editor because this document is too large to open without the browser worker.";case"collaboration-unsupported-huge-document":return"SuperDoc could not load the document editor because large documents cannot be opened with collaboration enabled yet.";case"collaboration-v1-config-unsupported":return"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.collaboration with a v2 room instead.";case"collaboration-room-format-unsupported":return"SuperDoc v2 cannot open this collaboration state because it is not stored in the SuperDoc v2 room format. No changes were made.";case"collaboration-room-format-conflict":return"SuperDoc v2 found conflicting room formats in one collaboration document. No changes were made.";case"collaboration-room-corrupt":return"SuperDoc v2 found a structurally invalid collaboration room. No changes were made.";case"collaboration-v2-room-missing":return'SuperDoc v2 could not find a committed v2 collaboration room. No changes were made. Use roomMode: "create" only when creating a new room.';case"collaboration-v2-room-already-exists":return'SuperDoc v2 was asked to create a collaboration room that already exists. Use roomMode: "join" to open it.';case"collaboration-v2-room-initializing":return"The SuperDoc v2 collaboration room is still initializing. Join mode did not modify it.";case"collaboration-open-intent-invalid":return"SuperDoc v2 received an invalid collaboration room mode. No provider was connected.";case"collaboration-config-invalid":return"SuperDoc v2 received an invalid collaboration configuration. No provider was connected.";default:return"SuperDoc could not load the document editor."}},Ka=O=>typeof O=="string"&&O.trim().length>0?O.trim():null,md=O=>{qn(O?.documentId??null);const G=typeof O?.reason=="string"&&O.reason.length>0?O.reason:"open-failed",pe=Ka(O?.detail),Ce=typeof O?.documentId=="string"&&O.documentId.length>0?O.documentId:null,rt=HP(G,Ce),xt=rt?.error.message??pd(G),Nt=O?.workerFailure&&typeof O.workerFailure=="object"?O.workerFailure:null;li(Ce,{reason:G,message:xt,detail:pe,...Nt?{workerFailure:Nt}:{}});const vn={...pe?{detail:pe}:{},...Ce?{documentId:Ce}:{},...Nt?{workerFailure:Nt}:{},reason:G};G==="collaboration-v1-config-unsupported"||G==="collaboration-room-format-unsupported"||G==="collaboration-room-format-conflict"||G==="collaboration-room-corrupt"||G==="collaboration-v2-room-missing"||G==="collaboration-v2-room-already-exists"||G==="collaboration-v2-room-initializing"||G==="collaboration-open-intent-invalid"||G==="collaboration-config-invalid"?console.warn(`[SuperDoc] ${xt}`,vn):console.error(`[SuperDoc] ${xt}`,vn),F.$superdoc.emit("exception",rt??{error:new Error(xt),code:G,...Ce?{documentId:Ce}:{},editor:null,...Nt?{workerFailure:Nt}:{}});const sn=QP(G,pe,{documentId:Ce,editor:null,bootErrorName:typeof O?.bootErrorName=="string"?O.bootErrorName:void 0}),En=Array.isArray(O?.diagnostics)?O.diagnostics:[],Dt=wm(O),Sn=En.map(eo=>({record:eo,diagnostic:sA(eo,{documentId:Ce,editor:null})})).filter(eo=>eo.diagnostic),Yn=rF(sn,G,Sn);sn&&!Yn&&F.$superdoc.emit("exception",sn);for(const{diagnostic:eo}of Sn)ht.shouldEmit(Ce,Dt,eo.internalCode)&&F.$superdoc.emit("exception",eo)},Kl=(O,G)=>{const pe=O?.id??null,Ce=G?.snapshot?.diagnostics;if(!Array.isArray(Ce)||Ce.length===0)return;const rt=wm(G);for(const xt of Ce){const Nt=XP(xt,{documentId:pe,editor:null});Nt&&ht.shouldEmit(pe,rt,Nt.internalCode)&&F.$superdoc.emit("exception",Nt)}},Hc=(O,G)=>{const pe=O?.id??(typeof G?.documentId=="string"?G.documentId:null),Ce=G?.diagnostics;if(!Array.isArray(Ce)||Ce.length===0)return;const rt=wm(G);for(const xt of Ce){const Nt=sA(xt,{documentId:pe,editor:null});Nt&&ht.shouldEmit(pe,rt,Nt.internalCode)&&F.$superdoc.emit("exception",Nt)}},ql=(O,G)=>{F.$superdoc?.activateRuntimeFromEventTarget?.(O.target,G)},Qr=O=>ql(O,"focusin"),$c=O=>ql(O,"pointerdown"),gd=O=>ql(O,"mousedown"),vd=({editor:O})=>{F.$superdoc.emit("collaboration-ready",{editor:O}),St(()=>{l.value=!0;const G=new URLSearchParams(window.location.search).get("commentId");G&&ks(G)})};let Gc=0;const yd=()=>{Gc=Date.now()+250},qa=()=>Date.now()<Gc,bd=O=>{const G=Wt.value;G&&(!(O.target instanceof Node)||!G.contains(O.target)||(Be.value?.contains(O.target)&&(W9(O.target)||s.setActiveComment(F.$superdoc,null),s.removePendingComment(F.$superdoc),Cs()),yd()))},Ya=O=>{const G=F.$superdoc.listeners?.("fonts-resolved")?.length>0?F.$superdoc.listeners("fonts-resolved")[0]:null,pe=F.$superdoc.config.useLayoutEngine!==!1,Ce=O.isNewFile,rt=F.$superdoc.config?.benchmarkExecutionMode,xt=F.$superdoc.config?.benchmarkTraceEnabled===!0,Nt=o(O),vn=Nt.state==="valid"?Nt.config:null,sn=F.$superdoc.config.v2CollaborationPreflightFailure??(Nt.state==="invalid"?Nt.failure:null);return{isDebug:F.$superdoc.config.isDebug||!1,documentId:O.id,user:F.$superdoc.user,users:F.$superdoc.users,colors:F.$superdoc.colors,role:F.$superdoc.config.role,interaction:F.$superdoc.interactionConfig,html:O.html,markdown:O.markdown,documentMode:F.$superdoc.config.documentMode,...rt?{benchmarkExecutionMode:rt}:{},...xt?{benchmarkTraceEnabled:!0}:{},allowSelectionInViewMode:F.$superdoc.config.allowSelectionInViewMode,rulers:O.rulers,rulerContainer:Or.value,isInternal:F.$superdoc.config.isInternal,annotations:F.$superdoc.config.annotations,isCommentsEnabled:!!Mt.value,isAiEnabled:F.$superdoc.config.modules?.ai,contextMenuConfig:(F.$superdoc.config.modules?.slashMenu&&!F.$superdoc.config.modules?.contextMenu&&console.warn("[SuperDoc] modules.slashMenu is deprecated. Use modules.contextMenu instead."),F.$superdoc.uiConfig.contextMenu.options),slashMenuConfig:F.$superdoc.config.modules?.contextMenu??F.$superdoc.config.modules?.slashMenu,comments:{highlightColors:Mt.value?.highlightColors,highlightOpacity:Mt.value?.highlightOpacity},trackedChanges:F.$superdoc.config.modules?.trackChanges,experimental:F.$superdoc.config.experimental,...vn?{v2Collaboration:vn}:{},...sn?{collaborationPreflightFailure:sn}:{},onCollaborationReady:vd,onCommentsUpdate:qc,onFontsResolved:G,onPageCountKnown:F.$superdoc.config.onPageCountKnown??null,onReviewWindowCommitted:En=>{ze.onCommittedPagePaint?.({...En,documentId:O.id})},fontAssets:F.$superdoc.config.fonts,workerUrls:F.$superdoc.config.workerUrls,fieldContext:O.fieldContext,fieldUpdatePolicy:F.$superdoc.config.fieldUpdatePolicy,workerStartupTimeoutMs:F.$superdoc.config.workerStartupTimeoutMs,proofing:yt.value,isNewFile:Ce,password:r(O),handleImageUpload:F.$superdoc.config.handleImageUpload,externalExtensions:F.$superdoc.config.editorExtensions||[],extensions:F.$superdoc.config.extensions||[],...vo?.pdfLib?{pdfLib:vo.pdfLib}:{},suppressDefaultDocxStyles:F.$superdoc.config.suppressDefaultDocxStyles,disableContextMenu:!F.$superdoc.uiConfig.contextMenu.enabled||F.$superdoc.config.disableContextMenu===!0,jsonOverride:F.$superdoc.config.jsonOverride,viewOptions:F.$superdoc.config.viewOptions,contained:F.$superdoc.config.contained,styleNonce:F.$superdoc.config.cspNonce,documentLoading:F.$superdoc.uiConfig.loading.enabled,linkPopoverResolver:Pt(),layoutEngineOptions:pe?{...F.$superdoc.config.layoutEngineOptions||{},proofing:yt.value,debugLabel:F.$superdoc.config.layoutEngineOptions?.debugLabel??O.name??O.id,zoom:(p.value??100)/100,emitCommentPositionsInViewing:Se()&&it.value,enableCommentsInViewing:Le.value,contentControlsChrome:F.$superdoc.uiConfig.contentControls.options.chrome,resolveTrackedChangeColor:P9(F.$superdoc.config.modules?.trackChanges?.authorColors)}:void 0,permissionResolver:(En={})=>F.$superdoc.canPerformPermission({role:F.$superdoc.config.role,isInternal:F.$superdoc.config.isInternal,...En})}},vh=new Set(["commentText","isInternal","parentCommentId","trackedChangeParentId","trackedChangeThreadParentId","threadingParentCommentId","trackedChange","trackedChangeType","trackedChangeText","trackedChangeDisplayType","semanticColorKey","semanticColor","trackedChangeStory","trackedChangeStoryKind","trackedChangeStoryLabel","trackedChangeAnchorKey","trackedChangeLabel","trackedChangeDetailLines","deletedText","resolvedTime","resolvedById","resolvedByEmail","resolvedByName","importedAuthor","docxCommentJSON"]),wd=(O,G={})=>{if(!(!O||G.isDone===void 0)&&!(G.resolvedTime!=null||G.resolvedById!=null||G.resolvedByEmail!=null||G.resolvedByName!=null)){if(G.isDone){O.resolvedTime=O.resolvedTime||Date.now(),O.resolvedById=O.resolvedById||G.creatorId||null,O.resolvedByEmail=O.resolvedByEmail||G.creatorEmail||null,O.resolvedByName=O.resolvedByName||G.creatorName||null;return}O.resolvedTime=null,O.resolvedById=null,O.resolvedByEmail=null,O.resolvedByName=null}},Cd=(O,G,pe)=>{!O||!G||(Array.isArray(G.elements)&&(O.docxCommentJSON=G.elements),Object.entries(G).forEach(([Ce,rt])=>{rt!==void 0&&Ce!=="text"&&Ce!=="elements"&&vh.has(Ce)&&(O[Ce]=rt)}),pe!==void 0&&(O.commentText=pe),wd(O,G))},kd=(O={})=>{const G={...O};return!G.commentText&&G.text&&(G.commentText=G.text),!G.docxCommentJSON&&Array.isArray(G.elements)&&(G.docxCommentJSON=G.elements),wd(G,G),G},Wc=O=>{if(Number.isFinite(I()))return;if(O==null){se();return}const G=Be.value,{key:pe,entry:Ce}=ae(O),rt=MS(G,Ce);if(Number.isFinite(rt)){ie(rt,O,pe??O);return}se()},Kc=O=>O==null||j.value==null?!1:String(j.value)===String(O),yh=O=>{if(O?.origin!=="document"||qa())return;const G=hD(O,Tt);G&&(Wc(G),j.value=G,Y.value=!0,setTimeout(()=>{Y.value=!1},0))},qc=(O={})=>{let{activeCommentId:G,type:pe,comment:Ce}=O,rt=Object.prototype.hasOwnProperty.call(O,"activeCommentId");const xt=vn=>{const sn=[vn?.importedId,vn?.commentId].filter(Boolean).map(En=>String(En));return[...new Set(sn)]},Nt=vn=>{const sn=[vn?.importedId,vn?.commentId].filter(Boolean).map(Dt=>String(Dt)),En=F.$superdoc?.activeEditor?.options?.documentId!=null?String(F.$superdoc.activeEditor.options.documentId):null;for(const Dt of sn){const Sn=W.value.find(Yn=>{const eo=Yn?.commentId!=null?String(Yn.commentId):null,ns=Yn?.importedId!=null?String(Yn.importedId):null;return eo===Dt||ns===Dt?!En||typeof Ee!="function"?!0:Ee(Yn,En):!1});if(Sn){const Yn=Sn?.commentId??Sn?.importedId??Dt;return{id:Yn!=null?String(Yn):null,existingComment:Sn}}}return{id:sn[0]||null,existingComment:null}};if(pe==="replayCompleted"&&Hi(),Ue?.ADD&&pe===Ue.ADD&&Ce){Ce=kd(Ce);const vn=F.$superdoc?.user;vn&&(Ce.creatorId||(Ce.creatorId=vn.id),Ce.creatorName||(Ce.creatorName=vn.name),Ce.creatorEmail||(Ce.creatorEmail=vn.email)),Ce.createdTime||(Ce.createdTime=Date.now());const sn=Ce.documentId||a.value?.[0]?.id;!Ce.documentId&&sn&&(Ce.documentId=sn),!Ce.fileId&&sn&&(Ce.fileId=sn);const{id:En,existingComment:Dt}=Nt(Ce);if(En&&!Dt){const Sn=Vs(Ce);tt({superdoc:F.$superdoc,comment:Sn,skipEditorUpdate:!0})}}if(Ue?.UPDATE&&pe===Ue.UPDATE&&Ce){const{id:vn,existingComment:sn}=Nt(Ce);if(vn){const En=Ce.commentText||Ce.text;if(sn)Cd(sn,Ce,En);else{const Dt=Vs(kd(Ce));tt({superdoc:F.$superdoc,comment:Dt,skipEditorUpdate:!0})}}}if(Ue?.DELETED&&pe===Ue.DELETED&&Ce){const vn=xt(Ce);if(vn.length){const sn=F.$superdoc?.activeEditor?.options?.documentId!=null?String(F.$superdoc.activeEditor.options.documentId):null,En=Sn=>!sn||typeof Ee!="function"?!0:Ee(Sn,sn),Dt=$9(W.value,vn,En);if(Dt.size){const Sn=[...W.value];W.value=W.value.filter(Jo=>{if(!En(Jo))return!0;const Ja=Jo.commentId!=null?String(Jo.commentId):null,nc=Jo.importedId!=null?String(Jo.importedId):null;return!(Ja&&Dt.has(Ja)||nc&&Dt.has(nc))});const Yn=j.value!=null?String(j.value):null,eo=Yn!=null?Sn.find(Jo=>{const Ja=Jo.commentId!=null?String(Jo.commentId):null,nc=Jo.importedId!=null?String(Jo.importedId):null;return Ja===Yn||nc===Yn}):null,ns=eo?En(eo):!1;Yn&&Dt.has(Yn)&&ns&&(G=null,rt=!0)}}}pe==="trackedChange"&&ge({superdoc:F.$superdoc,params:O}),rt&&G!=null&&qa()&&(rt=!1),rt&&(G==null||!Kc(G))&&Wc(G),St(()=>{V.value||(rt&&s.setActiveComment(F.$superdoc,G),rt&&(Y.value=!0,setTimeout(()=>{Y.value=!1},0)))}),typeof F.$superdoc.config.onCommentsUpdate=="function"&&F.$superdoc.config.onCommentsUpdate(O)},qo=ke(()=>!!Mt.value),Yc=ke(()=>Array.isArray(a.value)?a.value.filter(O=>O?.type===Ea):[]),Xc=ke(()=>Yc.value.length>0),Zc=ke(()=>Xc.value&&qo.value),bh=ke(()=>new Set(Yc.value.map(O=>String(O.id)))),Yl=O=>typeof O=="number"?Number.isFinite(O):typeof O=="string"&&O.trim()!==""?Number.isFinite(Number(O)):!1,wh=O=>{const G=O?.selection?.selectionBounds;return!!G&&Yl(G.top)&&Yl(G.left)&&Yl(G.right)&&Yl(G.bottom)},Ch=O=>{const G=O?.fileId??O?.documentId??O?.selection?.documentId;return G!=null?String(G):null},kh=O=>{const G=bh.value;if(!G.size)return!1;const pe=Ch(O);return pe?G.has(pe):G.size===1},Qc=O=>O?.selection?.source==="pdf"&&wh(O)&&kh(O),Xa=ke(()=>{if(!Xc.value)return!1;const O=N.value.some(pe=>Qc(pe)),G=Qc(V.value);return O||G}),Jc=ke(()=>{const O=Mt.value?.layout??"sidebar";return!fb.has(O)||O==="sidebar"?!0:O==="inline"?!1:O!=="auto"?!0:!yr.value}),ui=ke(()=>kt.value&&!cn.value&&!fn.value&&!Xa.value||!it.value||!Jc.value?!1:V.value||(N.value.length>0||_e.value)&&l.value&&Be.value&&qo.value&&!K.value),sa=ke(()=>{if(ui.value||!qo.value)return null;if(V.value)return V.value;if(!j.value)return null;const O=Tt(j.value)??null;return kt.value&&Jc.value&&O?.trackedChange&&!Xa.value?null:O}),{compactCommentPopoverStyle:Sh,closeCompactCommentPopover:_h,resetClickAnchor:Cs}=lD({activeComment:j,pendingComment:V,activeCompactComment:sa,showCommentsSidebar:ui,superdocRoot:Wt,layers:Be,documents:a,resolveCommentPositionEntry:ae,selectionPosition:d,activeZoom:p,clearActiveComment:()=>s.setActiveComment(F.$superdoc,null),clearPendingComment:()=>s.removePendingComment(F.$superdoc)}),Sd=ke(()=>qo.value?d.value&&xn.top&&!L.value?.readOnly:!1);ke(()=>qo.value?!L.value?.readOnly&&d.value:!1),jt(ui,O=>{F.$superdoc.broadcastSidebarToggle(O)}),l9({getSuperdoc:()=>F.$superdoc,superdocContainerWidth:Ur,isReady:l,activeZoom:p,zoomMode:g,viewportMetrics:v,showCommentsSidebar:ui,rightSidebarRef:rn,superdocRoot:Wt,documents:a});const ks=O=>{F.$superdoc.scrollToComment(O)},Xl=()=>{xi()},Xi=O=>{if(!kt.value)return;const G=Array.isArray(O?.detail?.itemIds)?O.detail.itemIds.map(pe=>pe==null?"":String(pe)).filter(Boolean):[];Hl(O?.detail?.refreshReason??"tracked-change-restamp"),xi({retainMissingTrackedChangeGeometry:!0,...G.length>0?{retainedTrackedChangeIds:G}:{},reason:"tracked-change-restamp"})};Nn(()=>{document.addEventListener("contextmenu",bd,!0),document.addEventListener("keydown",M,!0),F.$superdoc?.on?.("search:open",Za),vb(aa),Wt.value?.addEventListener("pointerdown",Zi,!0),Wt.value?.addEventListener("focusin",Zi,!0),Wt.value?.addEventListener(AA,Xi),typeof window<"u"&&(window.addEventListener("scroll",Xl,!0),window.addEventListener("resize",Xl,!0)),document.addEventListener("focusin",Qr,!0),document.addEventListener("pointerdown",$c,!0),document.addEventListener("mousedown",gd,!0),document.addEventListener("pointerup",ws,!0),document.addEventListener("mouseup",ws,!0),document.addEventListener("selectionchange",ws),F.$superdoc?.on?.("document-mode-change",hd),F.$superdoc?.on?.("active-editor-change",wo),Ar(),et()}),jt(it,O=>{kt.value&&(O?Bt.value&&Vc(Bt.value):(s.clearEditorCommentPositions?.(),cn.value=!1))}),jt(Be,()=>{xi()});function io(O){return(O.metaKey||O.ctrlKey)&&!O.altKey&&O.key?.toLowerCase?.()==="f"}function Ah(O){return(O.metaKey||O.ctrlKey)&&O.shiftKey&&!O.altKey&&(O.code==="Digit8"||O.key==="8"||O.key==="*")}function Zl(){const O=Wt.value,G=document.activeElement;if(!(G instanceof Node))return!1;if(O?.contains(G))return!0;const pe=F.$superdoc?.activeEditor?.view?.dom;return pe instanceof Node&&(G===pe||pe.contains?.(G))}const aa={};function _d(O){io(O)&&Xe.value&&WD(O,{focusInside:Zl(),owner:aa})&&nt.wouldOpen()&&(O.preventDefault(),O.stopPropagation(),vb(aa),nt.open())}function Zi(){vb(aa)}function Za(){Xe.value&&nt.open()}function A(O){Ah(O)&&(kt.value||Zl()&&(O.preventDefault(),O.stopPropagation(),F.$superdoc.toggleFormattingMarks?.()))}function M(O){if(O.key==="Escape"&&sa.value){O.preventDefault(),O.stopPropagation(),_h();return}_d(O),!O.defaultPrevented&&A(O)}function X(O){_d(O),!O.defaultPrevented&&A(O)}cr(()=>{s.cancelImportedTrackedChangeBootstrap?.(),T.destroy(),nt.destroy(),gn.destroy(),ta(),Ii(),Mi(),Ri();for(const O of Array.from(br.keys()))ai(O);for(const O of Array.from(Ao.keys()))_i(O);for(const O of Array.from(Io.keys()))Eo(O);br.clear(),Ln.clear(),document.removeEventListener("contextmenu",bd,!0),document.removeEventListener("keydown",M,!0),F.$superdoc?.off?.("search:open",Za),Wt.value?.removeEventListener("pointerdown",Zi,!0),Wt.value?.removeEventListener("focusin",Zi,!0),Wt.value?.removeEventListener(AA,Xi),$D(aa),typeof window<"u"&&(window.removeEventListener("scroll",Xl,!0),window.removeEventListener("resize",Xl,!0)),wn&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(wn),wn=0),document.removeEventListener("focusin",Qr,!0),document.removeEventListener("pointerdown",$c,!0),document.removeEventListener("mousedown",gd,!0),document.removeEventListener("pointerup",ws,!0),document.removeEventListener("mouseup",ws,!0),document.removeEventListener("selectionchange",ws),F.$superdoc?.off?.("document-mode-change",hd),F.$superdoc?.off?.("active-editor-change",wo)});const te=re(null),ne=re(!1),he=ke(()=>{if(!d.value||d.value.source==="document-editor")return{x:null,y:null};const O=d.value.source==="pdf"?(p.value??100)/100:1,G=d.value.top*O,pe=d.value.left*O,Ce=d.value.right*O,rt=d.value.bottom*O;return{zIndex:500,borderRadius:"4px",top:G+"px",left:pe+"px",height:Math.abs(G-rt)+"px",width:Math.abs(pe-Ce)+"px"}}),ce=O=>{if(Se()&&!Ae()){le();return}if(!O.selectionBounds||!qo.value)return;le();const G=window.matchMedia("(max-width: 768px)").matches;if(we({startX:O.selectionBounds.left,startY:O.selectionBounds.top,x:O.selectionBounds.right,y:O.selectionBounds.bottom,source:O.source}),!d.value)return;const pe=Math.abs(d.value.left-d.value.right)>5,Ce=Math.abs(d.value.top-d.value.bottom)>5;if(!pe||!Ce){te.value?.style&&(te.value.style.pointerEvents="none"),le();return}f.value=O;const rt=O.source==="pdf"||O.source?.value==="pdf"?(p.value??100)/100:1,xt=O.selectionBounds.top*rt;xn.top=xt+"px",xn.right=G?"0":"-25px"},le=()=>{d.value=null,xn.top=null},we=({startX:O,startY:G,x:pe,y:Ce,source:rt,page:xt})=>{if(!(typeof O=="number"||typeof G=="number")&&!(typeof pe=="number"||typeof Ce=="number")){le();return}if(!d.value){if(G==null||O==null)return;d.value={top:G,left:O,right:O,bottom:G,startX:O,startY:G,source:rt,page:xt??null}}typeof O=="number"&&(d.value.startX=O),typeof G=="number"&&(d.value.startY=G),typeof Ce=="number"&&(Ce<d.value.startY?d.value.top=Ce:d.value.bottom=Ce),typeof pe=="number"&&(pe<d.value.startX?d.value.left=pe:d.value.right=pe)},xe=O=>{const G=O?.clientX,pe=O?.clientY;if(typeof G!="number"||typeof pe!="number")return null;const Ce=document.elementsFromPoint(G,pe).find(rt=>rt?.dataset?.pdfPage!=null);if(Ce){const rt=Number(Ce.dataset?.pageNumber);return Number.isFinite(rt)?rt:null}return null},Ve=O=>{le(),te.value.style.pointerEvents="auto",St(()=>{ne.value=!0,te.value.style.pointerEvents="none";const G=xe(O);if(te.value.style.pointerEvents="auto",!G){ne.value=!1,te.value.style.pointerEvents="none";return}const pe=te.value.getBoundingClientRect(),Ce=p.value/100,rt=(O.clientX-pe.left)/Ce,xt=(O.clientY-pe.top)/Ce;we({startX:rt,startY:xt,page:G,source:"pdf"}),te.value.addEventListener("mousemove",Me)})},Me=O=>{if(!ne.value)return;const G=te.value.getBoundingClientRect(),pe=p.value/100,Ce=(O.clientX-G.left)/pe,rt=(O.clientY-G.top)/pe;we({x:Ce,y:rt})},Ge=O=>{if(!ne.value||(te.value.removeEventListener("mousemove",Me),!d.value))return;const G=d.value.page??xe(O),pe=Nf({selectionBounds:{top:d.value.top,left:d.value.left,right:d.value.right,bottom:d.value.bottom},page:G??1,documentId:a.value[0].id,source:"pdf"});ce(pe),te.value.style.pointerEvents="none"},st=ke(()=>{if(!F.$superdoc.uiConfig.comments.enabled)return!1;const O=F.$superdoc.config.modules?.comments;return!O||O===!1?!1:!O.readOnly}),ot=re(!1),bt=re(null),pt=O=>O&&typeof O=="object"&&"value"in O?O.value:O,qt=O=>{if(!kt.value||!O||O.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||F.$superdoc.config.viewOptions?.layout==="web"||F.$superdoc.uiConfig.ruler.suppressed||!pt(O.rulers)||!ot.value)return!1;const G=F.$superdoc?.activeEditor;if(!G||G.editorVersion!==2)return!1;const pe=pt(O.id),Ce=bt.value;return pe&&Ce&&pe!==Ce?!1:!!(G.pageMetrics&&G.pageLayout)},Cn=re({}),hr=re(null);let Yt=null,Pn=null,hn=0,tr=null,Jr=null;const Or=ke(()=>F.$superdoc?.uiConfig?.ruler?.container??null),Qi=()=>{const O=Or.value;return O?typeof O=="string"?(typeof document<"u"?document:globalThis.document)?.querySelector(O)??null:typeof HTMLElement<"u"&&O instanceof HTMLElement?O:null:null},di=()=>F.$superdoc?.activeEditor?.documentId??F.$superdoc?.activeEditor?.options?.documentId??null,ut=()=>{if(Or.value)return Qi();const O=di();return O==null?null:Ln.get(O)??Ln.get(String(O))??null},kn=()=>{const O=di(),G=O==null?Wa:ia.get(String(O))??null;if(!G?.isConnected)return null;const pe=Array.from(G.children).find(rt=>rt.dataset?.v2PaintWrapper==="true")??G,Ce=Array.from(pe.children).filter(rt=>rt.classList?.contains("superdoc-page"));return(Ce.find(rt=>Number(rt.dataset?.pageIndex)===hn)??Ce[0]??pe).getBoundingClientRect()},Cr=()=>{if(!kt.value){Cn.value={},hr.value=null;return}const O=ut();if(!O){Cn.value={},hr.value=null;return}const G=kn();if(!G){Cn.value={},hr.value=null;return}const pe=O.getBoundingClientRect(),Ce=Math.max(0,G.left-pe.left),rt=Math.max(0,pe.right-G.right);Cn.value={paddingLeft:`${Ce}px`,paddingRight:`${rt}px`},hr.value={left:G.left,top:G.top,width:G.width,height:G.height}},Ri=()=>{const O=Jr;Jr=null,tr=null,hn=0;try{O?.()}catch{}},Qa=O=>{if(Ri(),!!O){tr=O;try{hn=O.getActiveRulerContext?.()?.pageIndex??0,Jr=O.subscribeActiveRulerContext?.(G=>{if(tr!==O)return;const pe=G?.pageIndex??0;pe!==hn&&(hn=pe,St(()=>Cr()))})??null}catch{Ri()}}},wo=()=>{const O=F.$superdoc?.activeEditor,G=O?.documentId??O?.options?.documentId??null;if(bt.value=G,O?.editorVersion!==2||!O.pageMetrics||!O.pageLayout){Mi(),Ri(),Cn.value={},ot.value=!1;return}tr!==O.pageLayout&&Qa(O.pageLayout),ot.value=!0,St(()=>{Cr(),Ql()})},Mi=()=>{typeof window<"u"&&window.removeEventListener("scroll",Cr,!0);try{Yt?.disconnect()}catch{}Yt=null;try{Pn?.disconnect()}catch{}Pn=null},Ql=()=>{if(Mi(),typeof window<"u"&&window.addEventListener("scroll",Cr,!0),typeof ResizeObserver>"u")return;const O=Be.value,G=ut();O&&(Yt=new ResizeObserver(()=>Cr()),Yt.observe(O)),G&&(Pn=new ResizeObserver(()=>Cr()),Pn.observe(G))},Ji=(O,G)=>{!O||!G||(O.documentMarginsLastChange=G.pageMargins??null,F.$superdoc.emit("page-margins-change",{documentId:O.id,editorVersion:2,sectionId:G.sectionId,sectionIndex:G.sectionIndex,side:G.side,value:G.value,pageMargins:G.pageMargins}))},eu=O=>{qo.value&&(le(),ne.value=!0,Ve(O))},Ss=({selectionBounds:O,documentId:G,page:pe})=>{if(!O||!G)return;const Ce=Nf({selectionBounds:O,documentId:G,page:pe,source:"pdf"});ce(Ce)},fi=O=>{Be.value?.querySelectorAll(".superdoc__sub-document")?.forEach(G=>{G.querySelector(".sd-pdf-viewer")||(O===1?(G.style.transformOrigin="",G.style.transform="",G.style.width=""):(G.style.transformOrigin="top left",G.style.transform=`scale(${O})`,G.style.width=`${100/O}%`))})};let Yo=!1;const Xo=()=>{if(Yo||F.$superdoc.config.useLayoutEngine!==!1)return;const O=(p.value??100)/100;O!==1&&(Yo=!0,St(()=>fi(O)))};jt(()=>p.value,O=>{const G=(O??100)/100,pe=O??100,Ce=F.$superdoc?.activeEditor?.pageMetrics??null;if(kt.value&&F.$superdoc?.activeEditor?.editorVersion===2&&Ce?.setZoom)try{Ce.setZoom(pe)}catch(rt){console.warn("[SuperDoc][v2] setZoom failed",rt)}else Yo=!0,fi(G);tc()?.updateScale(G),St(()=>{la(),Li()})}),jt(N,()=>{Q.value||(Q.value=!0)});const{whiteboardModuleConfig:_s,whiteboard:hi,whiteboardPages:es,whiteboardPageSizes:Jl,whiteboardPageOffsets:As,whiteboardEnabled:ec,whiteboardOpacity:Zo,handleWhiteboardPageReady:ts,updateWhiteboardPageSizes:la,updateWhiteboardPageOffsets:Li}=A9({proxy:F,layers:Be,documents:a,modules:b}),tc=()=>Array.isArray(zn.value)?zn.value[0]:zn.value,Qo=ke(()=>Xc.value&&!!_s.value),Ih=ke(()=>ec.value);return(O,G)=>(ye(),De("div",{ref_key:"superdocRoot",ref:Wt,class:en(["superdoc",{"superdoc--with-sidebar":ui.value,"superdoc--web-layout":Qe(F).$superdoc.config.viewOptions?.layout==="web","superdoc--contained":Qe(F).$superdoc.config.contained,"high-contrast":Qe(B)}]),style:bn(Lt.value),onKeydown:X},[He("div",{class:"superdoc__layers layers",ref_key:"layers",ref:Be,role:"group"},[Sd.value?(ye(),De("div",{key:0,class:"superdoc__tools tools",style:bn(xn)},[He("div",{class:"tools-item","data-id":"is-tool",onMousedown:G[0]||(G[0]=Jt(pe=>Yr("comments"),["stop","prevent"]))},[He("div",{class:"superdoc__tools-icon",innerHTML:Qe(Pa).comment},null,8,RF)],32)],4)):vt("",!0),He("div",MF,[qo.value?(ye(),De("div",{key:0,class:"superdoc__selection-layer selection-layer",onMousedown:Ve,onMouseup:Ge,ref_key:"selectionLayer",ref:te},[Qe(d)&&st.value?(ye(),De("div",{key:0,style:bn(he.value),class:"superdoc__temp-selection temp-selection sd-highlight sd-initial-highlight"},null,4)):vt("",!0)],544)):vt("",!0),(ye(!0),De(Kt,null,ir(Qe(a),pe=>(ye(),De("div",{class:"superdoc__sub-document sub-document",key:`${pe.id}:${pe.editorMountNonce}`,ref_for:!0,ref:Ce=>Zs(pe,Ce)},[pe.type===Qe("application/pdf")?(ye(),an(Qe(n),{key:0,file:pe.data,"file-id":pe.id,"initial-scale":(Qe(p)??100)/100,config:Qe(vo),onSelectionRaw:Ss,onBypassSelection:eu,onPageRendered:Qe(ts),onDocumentReady:G[1]||(G[1]=({documentId:Ce,viewerContainer:rt})=>on(Ce,rt)),ref_for:!0,ref_key:"pdfViewerRef",ref:zn},null,8,["file","file-id","initial-scale","config","onPageRendered"])):vt("",!0),pe.type===Qe("application/vnd.openxmlformats-officedocument.wordprocessingml.document")&&Qe(be)&&qt(pe)?(ye(),De(Kt,{key:1},[Or.value?(ye(),an(dl,{key:0,to:Or.value},[He("div",{class:"v2-ruler-host",style:bn(Cn.value)},[Xt(Qe(be),{"page-layout":Qe(F).$superdoc.activeEditor.pageLayout,"measurement-unit":Qe(m),"active-page-rect":hr.value,onPageMarginsChange:Ce=>Ji(pe,Ce)},null,8,["page-layout","measurement-unit","active-page-rect","onPageMarginsChange"])],4)],8,["to"])):(ye(),De("div",{key:1,class:"v2-ruler-host",style:bn(Cn.value)},[Xt(Qe(be),{"page-layout":Qe(F).$superdoc.activeEditor.pageLayout,"measurement-unit":Qe(m),"active-page-rect":hr.value,onPageMarginsChange:Ce=>Ji(pe,Ce)},null,8,["page-layout","measurement-unit","active-page-rect","onPageMarginsChange"])],4))],64)):vt("",!0),pe.type===Qe("application/vnd.openxmlformats-officedocument.wordprocessingml.document")?(ye(),an(Qe(ee),{key:2,"file-source":pe.data,"document-id":pe.id,options:Ya(pe),"measurement-unit":Qe(m),onV2EditorReady:ci,onV2EditorFailed:md,onV2Render:Yi,onV2RenderCleared:$l,onV2SelectionChanged:Nc,onV2HostEvent:Ce=>wr(pe,Ce),onV2LinkClick:Gl,onV2CommentCreated:Wl,onV2PageMetrics:Uc,onV2RenderReadiness:Ce=>Kl(pe,Ce),onV2OpenDiagnostics:Ce=>Hc(pe,Ce)},null,8,["file-source","document-id","options","measurement-unit","onV2HostEvent","onV2RenderReadiness","onV2OpenDiagnostics"])):vt("",!0),pe.type===Qe("text/html")?(ye(),an(H9,{key:3,onReady:G[2]||(G[2]=Ce=>on(Ce,null)),onSelectionChange:ce,"file-source":pe.data,"document-id":pe.id},null,8,["file-source","document-id"])):vt("",!0)]))),128)),Qo.value?(ye(),an(R9,{key:1,class:"superdoc__whiteboard-layer",whiteboard:Qe(hi),pages:Qe(es),"page-sizes":Qe(Jl),"page-offsets":Qe(As),enabled:Qe(ec),interactive:Ih.value,opacity:Qe(Zo)},null,8,["whiteboard","pages","page-sizes","page-offsets","enabled","interactive","opacity"])):vt("",!0),Zc.value?(ye(),an(_9,{key:2,onAnchorActivate:ln})):vt("",!0)])],512),ui.value?(ye(),De("div",{key:0,ref_key:"rightSidebarRef",ref:rn,class:"superdoc__right-sidebar right-sidebar"},[He("div",LF,[Qe(Q)&&(N.value.length>0||Qe(V))?(ye(!0),De(Kt,{key:0},ir(Qe(z),pe=>(ye(),an(v9,{parent:Be.value,"current-document":pe},null,8,["parent","current-document"]))),256)):vt("",!0)])],512)):vt("",!0),sa.value?(ye(),De("div",{key:1,class:"superdoc__compact-comment-popover",style:bn(Qe(Sh))},[Xt(lb,{comment:sa.value,parent:Be.value},null,8,["comment","parent"])],4)):vt("",!0),Xt(gF,{"geometry-target":Be.value},null,8,["geometry-target"])],38))}},FF=un(PF,[["__scopeId","data-v-4e56e5b9"]]);Ft();var IA="devtools-plugin:setup",EA="dev.esm.pinia",dn={disabledAppRefCounts:new Map,hook:null,originalHookEmit:null,isHookPropertyPatched:!1,originalHookPropertyDescriptor:null,hookPropertyValue:void 0,isQueuePropertyPatched:!1,originalQueuePropertyDescriptor:null,queuePropertyValue:void 0,queue:null,originalQueuePush:null},TA=(e,t)=>e===IA&&t?.id===EA&&t?.app&&dn.disabledAppRefCounts.has(t.app),NF=e=>Array.isArray(e)&&TA(IA,e[0]),BF=e=>{if(dn.isQueuePropertyPatched){dn.queuePropertyValue=e;return}globalThis.__VUE_DEVTOOLS_PLUGINS__=e},zF=e=>{const t=globalThis.__VUE_DEVTOOLS_PLUGINS__;if(Array.isArray(t))for(let n=t.length-1;n>=0;n--){const[r]=t[n];r?.id===EA&&r?.app===e&&t.splice(n,1)}},xA=()=>{const{queue:e,originalQueuePush:t}=dn;e&&typeof t=="function"&&(e.push=t),dn.queue=null,dn.originalQueuePush=null},RA=()=>{const{hook:e,originalHookEmit:t}=dn;e&&typeof t=="function"&&(e.emit=t),dn.hook=null,dn.originalHookEmit=null},Uf=()=>{const e=globalThis.__VUE_DEVTOOLS_PLUGINS__;if(e==null){BF([]),Uf();return}if(!Array.isArray(e))return;const t=e;if(dn.queue===t)return;xA();const n=t.push;typeof n=="function"&&(dn.queue=t,dn.originalQueuePush=n,t.push=function(...o){const i=o.filter(s=>!NF(s));return i.length===0?this.length:n.apply(this,i)})},jF=()=>{if(dn.isQueuePropertyPatched){Uf();return}const e=Object.getOwnPropertyDescriptor(globalThis,"__VUE_DEVTOOLS_PLUGINS__");if(e?.configurable===!1){Uf();return}dn.originalQueuePropertyDescriptor=e??null,dn.queuePropertyValue=globalThis.__VUE_DEVTOOLS_PLUGINS__,Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",{configurable:!0,enumerable:e?.enumerable??!0,get(){return dn.queuePropertyValue},set(t){dn.queuePropertyValue=t,Uf()}}),dn.isQueuePropertyPatched=!0,Uf()},VF=()=>{if(!dn.isQueuePropertyPatched)return;const{queuePropertyValue:e,originalQueuePropertyDescriptor:t}=dn;delete globalThis.__VUE_DEVTOOLS_PLUGINS__,t?"value"in t?Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",{configurable:t.configurable,enumerable:t.enumerable,writable:t.writable,value:e}):(Object.defineProperty(globalThis,"__VUE_DEVTOOLS_PLUGINS__",t),typeof t.set=="function"&&t.set.call(globalThis,e)):e!==void 0&&(globalThis.__VUE_DEVTOOLS_PLUGINS__=e),dn.isQueuePropertyPatched=!1,dn.originalQueuePropertyDescriptor=null,dn.queuePropertyValue=void 0},Cm=()=>{const e=globalThis?.__VUE_DEVTOOLS_GLOBAL_HOOK__;if(!e||typeof e.emit!="function"||dn.hook===e)return;RA();const t=e.emit;dn.hook=e,dn.originalHookEmit=t,e.emit=function(r,...o){const[i]=o;if(!TA(r,i))return t.call(this,r,...o)}},UF=()=>{if(dn.isHookPropertyPatched){Cm();return}const e=Object.getOwnPropertyDescriptor(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__");if(e?.configurable===!1){Cm();return}dn.originalHookPropertyDescriptor=e??null,dn.hookPropertyValue=globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__,Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",{configurable:!0,enumerable:e?.enumerable??!0,get(){return dn.hookPropertyValue},set(t){dn.hookPropertyValue=t,Cm()}}),dn.isHookPropertyPatched=!0,Cm()},HF=()=>{if(!dn.isHookPropertyPatched)return;const{hookPropertyValue:e,originalHookPropertyDescriptor:t}=dn;delete globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__,t?"value"in t?Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",{configurable:t.configurable,enumerable:t.enumerable,writable:t.writable,value:e}):(Object.defineProperty(globalThis,"__VUE_DEVTOOLS_GLOBAL_HOOK__",t),typeof t.set=="function"&&t.set.call(globalThis,e)):e!==void 0&&(globalThis.__VUE_DEVTOOLS_GLOBAL_HOOK__=e),dn.isHookPropertyPatched=!1,dn.originalHookPropertyDescriptor=null,dn.hookPropertyValue=void 0},$F=()=>{dn.disabledAppRefCounts.size>0||(RA(),HF(),xA(),VF())},GF=(e,t)=>{if(!t)return()=>{};const n=dn.disabledAppRefCounts.get(e)??0;return dn.disabledAppRefCounts.set(e,n+1),UF(),jF(),()=>{const r=dn.disabledAppRefCounts.get(e);r&&(r===1?dn.disabledAppRefCounts.delete(e):dn.disabledAppRefCounts.set(e,r-1),$F())}},WF=({disablePiniaDevtools:e=!1}={})=>{const t=yc(FF),n=w5(),r=GF(t,e);let o,i,s;try{t.use(n),e&&zF(t),t.directive("click-outside",Hy),o=Uu(),i=Us(),s=ds()}catch(a){throw r(),a}if(typeof t.unmount=="function"){const a=t.unmount.bind(t);t.unmount=(...l)=>(r(),a(...l))}return{app:t,pinia:n,superdocStore:o,commentsStore:i,highContrastModeStore:s}},KF={docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",pdf:"application/pdf",zip:"application/zip",html:"text/html",txt:"text/plain;charset=utf-8",json:"application/json"},qF=e=>!e||typeof e.toLowerCase!="function"?"application/octet-stream":KF[e.toLowerCase()]||"application/octet-stream",MA=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,YF=e=>{if(!MA)return!1;try{return MA.call(e),!0}catch{return!1}},XF=(e,t)=>{const n=qF(t);if(YF(e))return e instanceof Blob?e:new Blob([e],{type:e.type||n});if(e instanceof ArrayBuffer)return new Blob([e],{type:n});if(ArrayBuffer.isView(e)){const{buffer:r,byteOffset:o,byteLength:i}=e,s=r.slice(o,o+i);return new Blob([s],{type:n})}if(typeof e=="string")return new Blob([e],{type:n});throw e==null?new TypeError("createDownload requires a Blob, ArrayBuffer, or ArrayBufferView."):new TypeError(`Cannot create download from value of type ${typeof e}`)},LA=(e,t,n)=>{const r=XF(e,n);if(typeof URL>"u"||typeof URL.createObjectURL!="function"||typeof document>"u"||typeof document.createElement!="function")return r;const o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`${t}.${n}`;const s=document.body&&typeof document.body.appendChild=="function";return s&&document.body.appendChild(i),i.click(),s&&document.body.removeChild(i),typeof URL.revokeObjectURL=="function"&&setTimeout(()=>URL.revokeObjectURL(o),0),r},DA=e=>{const t=e.toLowerCase();return t.endsWith(".docx")?e.slice(0,-5):t.endsWith(".pdf")?e.slice(0,-4):e},ZF=class{#e=new Map;#n=1;idFor(e){const t=this.#e.get(e);if(t!==void 0)return t;const n=this.#n++;return this.#e.set(e,n),n}has(e){return this.#e.has(e)}};function QF(e){const t=typeof e.email=="string"&&e.email.length>0?e.email:null;return t?`email:${t}`:`label:${e.actorLabel}`}function JF(e,t){const n=e.displayName??null,r=e.email??null,o={clientId:t};return n&&(o.name=n),r&&(o.email=r),typeof e.color=="string"&&e.color.length>0&&(o.color=e.color),o}function eN(e){const t={clientId:0};e?.id!=null&&(t.id=e.id),e?.name!=null&&(t.name=e.name),e?.email!=null&&(t.email=e.email);const n=e?.color;return typeof n=="string"&&n.length>0&&(t.color=n),t}function tN(e){const t=new ZF;let n=new Set;return{registry:t,next(r){const o=[],i=new Set,s=new Set;for(const u of r.remoteActors){const d=QF(u);if(s.has(d))continue;s.add(d);const f=t.idFor(d);i.add(f),o.push(JF(u,f))}const a=[];for(const u of i)n.has(u)||a.push(u);const l=[];for(const u of n)i.has(u)||l.push(u);return n=i,{states:[eN(e()),...o],added:a,removed:l}}}}var nN=class{#e=new Map;on(e,t){const n=this.#e.get(e);n?n.push(t):this.#e.set(e,[t])}emit(e,...t){const n=this.#e.get(e);if(n)for(const r of n)r.apply(this,t)}off(e,t){const n=this.#e.get(e);n&&(t?this.#e.set(e,n.filter(r=>r!==t)):this.#e.delete(e))}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};this.on(e,n)}removeAllListeners(){this.#e=new Map}};function rN(e){return e.flatMap(t=>[t[0],t[1]])}function OA(e="id"){return`${e}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function PA(e={}){const{value:t="",left:n,top:r,width:o,height:i,fontSize:s=16,fontFamily:a="Arial, sans-serif",color:l="#000",background:u="transparent",resize:d="none"}=e,f=document.createElement("textarea");f.value=t;const p=f.style;return p.position="absolute",n!=null&&(p.left=`${n}px`),r!=null&&(p.top=`${r}px`),o!=null&&(p.width=typeof o=="number"?`${o}px`:o),i!=null&&(p.height=typeof i=="number"?`${i}px`:i),p.minWidth=120,p.fontSize=typeof s=="number"?`${s}px`:s,p.fontFamily=a,p.color=l,p.background=u,p.border="2px solid #3c97fe80",p.padding="2px 4px",p.margin="0",p.zIndex="1000",p.overflow="hidden",p.resize=d,p.outline="none",f}var km=18,oN=class{pageIndex=null;strokes=[];text=[];images=[];size=null;originalSize=null;#e=null;#n=null;#t=null;#r=null;#i=null;#a=null;#u=new Set;#h=!1;#l=null;#f=[];#v=null;#o="select";#s=!1;#p=null;#w="#2293fb";#k=5;#y=null;#A=null;constructor(e){this.#I(e)}#I(e){this.#e=e.Renderer,this.#s=e.enabled,this.pageIndex=e.pageIndex,this.#y=e.onChange,this.#A=e.onToolChange}#L(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{xN:e/n,yN:t/r}}#R(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{x:e*n,y:t*r}}#b(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{wN:e/n,hN:t/r}}#C(e,t){const n=this.size?.width||1,r=this.size?.height||1;return{width:e*n,height:t*r}}#E(e){const{width:t=1,height:n=1}=this.size||{};return{points:(Array.isArray(e.pointsN)?e.pointsN:[]).map(r=>[r[0]*t,r[1]*n]),strokeWidth:Number.isFinite(e.widthN)?e.widthN*((t+n)/2):this.#k}}#x(e){const{width:t=1,height:n=1}=this.size||{};return{pointsN:(Array.isArray(e.points)?e.points:[]).map(r=>[r[0]/t,r[1]/n]),widthN:Number.isFinite(e.width)?e.width/((t+n)/2):void 0}}#_(e){const{width:t=1,height:n=1}=this.size||{};return{x:(e.xN??0)*t,y:(e.yN??0)*n,width:Number.isFinite(e.widthN)?e.widthN*t:void 0,fontSize:Number.isFinite(e.fontSizeN)?e.fontSizeN*n:km}}#d(e){const{width:t=1,height:n=1}=this.size||{},r=this.originalSize?.height??n;return{xN:(e.x??0)/t,yN:(e.y??0)/n,widthN:Number.isFinite(e.width)?e.width/t:null,fontSizeN:Number.isFinite(e.fontSize)?e.fontSize/r:km/r}}#m(e){const{width:t=1,height:n=1}=this.size||{};return{x:(e.xN??0)*t,y:(e.yN??0)*n,width:Number.isFinite(e.widthN)?e.widthN*t:void 0,height:Number.isFinite(e.heightN)?e.heightN*n:void 0}}#D(e){const{width:t=1,height:n=1}=this.size||{};return{xN:(e.x??0)/t,yN:(e.y??0)/n,widthN:Number.isFinite(e.width)?e.width/t:null,heightN:Number.isFinite(e.height)?e.height/n:null}}#T(){const e=this.size?.width,t=this.originalSize?.width??e;return!Number.isFinite(e)||!Number.isFinite(t)||!t?1:e/t}#Y(){!this.#n||!this.#t||(this.#n.on("mousedown touchstart",e=>{this.#le(e)}),this.#n.on("mousemove touchmove",e=>{this.#Q(e)}),this.#n.on("mouseup touchend",e=>{this.#F(e)}),this.#n.on("click tap",e=>{this.#Z(e)}),window.addEventListener("keydown",this.#V))}setTool(e){this.#o=e,this.#O(),this.#M(),this.render()}getTool(){return this.#o}setEnabled(e){this.#s=!!e,this.#O(),this.#M(),this.render()}isEnabled(){return this.#s}setSize(e){if(!e)return;const{width:t,height:n,originalWidth:r,originalHeight:o}=e;this.size={width:t,height:n},this.originalSize={width:r??null,height:o??null}}resize(e,t){this.#n&&(this.#n.size({width:e,height:t}),this.#z(),this.render())}mount(e){if(!e||this.#n&&this.#a===e)return;this.#n&&this.destroy();const t=this.size?.width||e.clientWidth||1,n=this.size?.height||e.clientHeight||1;this.#a=e,this.#n=new this.#e.Stage({container:e,width:t,height:n}),this.#t=new this.#e.Layer,this.#r=new this.#e.Layer,this.#n.add(this.#t),this.#n.add(this.#r),this.#z(),this.#O(),this.#Y(),this.render()}render(){this.#t&&(this.#i&&(this.#i.destroy(),this.#i=null),this.#t.find(".wb-text").forEach(e=>e.destroy()),this.#r.destroyChildren(),this.renderStrokes(),this.renderText(),this.renderImages(),this.#t.batchDraw(),this.#r.batchDraw())}#z(){const e=Math.min(window.devicePixelRatio||1,1.5);this.#t?.getCanvas&&this.#t.getCanvas().setPixelRatio(e),this.#r?.getCanvas&&this.#r.getCanvas().setPixelRatio(e)}#O(){if(!this.#r)return;const e=this.#o==="draw"||this.#o==="erase",t=!!(this.#s&&e);this.#r.listening(t)}renderStrokes(){this.strokes.forEach(e=>{const{points:t,strokeWidth:n}=this.#E(e),r=new this.#e.Line({points:rN(t),stroke:e.color||this.#w,strokeWidth:n,lineCap:"round",lineJoin:"round",globalCompositeOperation:e.type==="erase"?"destination-out":"source-over"});r.name("wb-stroke"),this.#r.add(r)})}renderText(){this.text.forEach(e=>{const{x:t,y:n,width:r,fontSize:o}=this.#_(e),i=new this.#e.Text({x:t,y:n,text:e.content,fontSize:o,fontFamily:"Arial, sans-serif",fill:"#2293fb",draggable:this.#o==="select",width:r});i.name("wb-text"),i._whiteboardId=e.id,this.#X(i,e),this.#t.add(i)})}#X(e,t){e.on("click tap",n=>{this.#o!=="select"||!this.#s||(n.cancelBubble=!0,this.#j(e))}),e.on("dragend",()=>{const{xN:n,yN:r}=this.#d({x:e.x(),y:e.y(),fontSize:t.fontSizeN?t.fontSizeN*(this.size?.height||1):km,width:t.widthN?t.widthN*(this.size?.width||1):null});t.xN=n,t.yN=r,this.#S()}),e.on("transform",()=>{e.scaleY(1),e.setAttrs({width:e.width()*e.scaleX(),scaleX:1})}),e.on("transformend",()=>{e.setAttrs({width:Math.max(1,e.width()*e.scaleX()),scaleX:1,scaleY:1});const n=e.width(),r=this.size?.width||1;t.widthN=n/r,t.xN=e.x()/r,t.yN=e.y()/(this.size?.height||1),this.#S()}),e.on("dblclick dbltap",n=>{this.#o!=="select"||!this.#s||(n.cancelBubble=!0,this.#ee(e,t))})}renderImages(){const e=this.#t?.find(".wb-image")??[],t=new Map;e.forEach(o=>{t.set(o._whiteboardId,o)});const n=new Set(this.images.map(o=>o.id));e.forEach(o=>{n.has(o._whiteboardId)||o.destroy()});const r=(o,i)=>{const{x:s,y:a,width:l,height:u}=this.#m(o),d=t.get(o.id);if(d){Number.isFinite(s)&&d.x(s),Number.isFinite(a)&&d.y(a),Number.isFinite(l)&&d.width(l),Number.isFinite(u)&&d.height(u),d.draggable(this.#o==="select");return}if(this.#u.has(o.id))return;this.#u.add(o.id);const f=new window.Image;f.crossOrigin="Anonymous",f.onload=()=>{if(t.get(o.id)){this.#u.delete(o.id);return}if(!this.#t){this.#u.delete(o.id);return}const p=new this.#e.Image({x:s,y:a,image:f,width:l??f.width,height:u??f.height,draggable:this.#o==="select"});p.name(i),p._whiteboardId=o.id,this.#P(p,o),this.#t.add(p),this.#t.batchDraw(),this.#u.delete(o.id)},f.onerror=()=>{this.#u.delete(o.id)},f.src=o.src};this.images.forEach(o=>r(o,"wb-image"))}#P(e,t){e.on("click tap",n=>{this.#o!=="select"||!this.#s||(n.cancelBubble=!0,this.#j(e))}),e.on("dragend",()=>{const n=this.size?.width||1,r=this.size?.height||1;t.xN=e.x()/n,t.yN=e.y()/r,this.#S()}),e.on("transformend",()=>{const n=e.scaleX(),r=e.scaleY(),o=Math.max(1,e.width()*n),i=Math.max(1,e.height()*r);e.scale({x:1,y:1}),e.width(o),e.height(i);const s=this.size?.width||1,a=this.size?.height||1;t.widthN=o/s,t.heightN=i/a,t.xN=e.x()/s,t.yN=e.y()/a,this.#S()})}destroy(){this.#n&&this.#n.destroy(),this.#n=null,this.#t=null,this.#r=null,this.#a=null,this.#h=!1,this.#l=null,this.#f=[],this.#p=null,this.#i=null,window.removeEventListener("keydown",this.#V)}toJSON(){return{strokes:this.strokes,text:this.text,images:this.images}}applyData(e={}){const t=Array.isArray(e.strokes)?e.strokes:[],n=Array.isArray(e.text)?e.text:[],r=Array.isArray(e.images)?e.images:[];this.strokes=t,this.text=n,this.images=r,this.render()}#S(){this.#y&&this.#y()}addStroke(e){if(!e||!Array.isArray(e.points))return;const{pointsN:t,widthN:n}=this.#x(e);this.strokes.push({pointsN:t,widthN:n,color:e.color,type:e.type})}addText(e){if(!e||typeof e.content!="string")return;const{xN:t,yN:n,widthN:r,fontSizeN:o}=this.#d(e);this.text.push({id:e.id??OA("text"),xN:t,yN:n,content:e.content,fontSizeN:o,widthN:r}),this.render(),this.#S()}addImage(e){if(!e||!e.src)return;const{xN:t,yN:n,widthN:r,heightN:o}=this.#D(e),i={id:e.id??OA("image"),stickerId:e.stickerId??(e.type==="sticker"?e.id??null:null),xN:t,yN:n,src:e.src,widthN:r,heightN:o,type:e.type??"image"};this.images.push(i),this.render(),this.#S()}#M(){this.#i&&(this.#i.destroy(),this.#i=null,this.#p=null,this.#t?.batchDraw())}#j(e){if(!this.#t)return;this.#p=e;const t=e.name&&e.name()==="wb-text",n=t?["middle-left","middle-right"]:["top-left","top-right","bottom-left","bottom-right"],r=(o,i)=>i.width<20?o:t?{...i,height:o.height,y:o.y}:i.height<20?o:i;this.#i?(this.#i.nodes([e]),this.#i.enabledAnchors(n),this.#i.boundBoxFunc(r)):(this.#i=new this.#e.Transformer({nodes:[e],enabledAnchors:n,rotateEnabled:!1,keepRatio:!1,boundBoxFunc:r}),this.#t.add(this.#i)),this.#t.batchDraw()}#c(){if(!this.#p)return;const e=this.#p,t={"wb-text":()=>{const n=e._whiteboardId;this.text=this.text.filter(r=>r.id!==n)},"wb-image":()=>{const n=e._whiteboardId;this.images=this.images.filter(r=>r.id!==n)}}[e.name&&e.name()];t&&t(),e.destroy(),this.#M(),this.render()}#V=e=>{if(!this.#p||!this.#s||this.#o!=="select")return;const t=e.target?.tagName;t==="INPUT"||t==="TEXTAREA"||(e.key==="Backspace"||e.key==="Delete")&&(e.preventDefault(),this.#c(),this.#S())};#Z(e){if(!this.#s||!this.#n)return;const t={text:()=>{const n=this.#n.getPointerPosition();n&&this.#J(n.x,n.y)},select:()=>{e?.target===this.#n&&this.#M()}}[this.#o];t&&t()}#le(){if(!this.#s||this.#o!=="draw"&&this.#o!=="erase")return;this.#h=!0;const e=this.#n.getPointerPosition();if(!e)return;const t=this.#o==="erase",n=this.#k*this.#T();this.#f=[e.x,e.y],this.#l=new this.#e.Line({points:this.#f,stroke:this.#w,strokeWidth:t?n*3:n,lineCap:"round",lineJoin:"round",globalCompositeOperation:t?"destination-out":"source-over"}),this.#v=n,this.#r.add(this.#l)}#Q(){if(!this.#s||this.#o!=="draw"&&this.#o!=="erase"||!this.#h||!this.#l)return;const e=this.#n.getPointerPosition();e&&(this.#f.push(e.x,e.y),this.#l.points(this.#f),this.#r.batchDraw())}#F(){if(!this.#s||this.#o!=="draw"&&this.#o!=="erase"||!this.#h||!this.#l)return;this.#h=!1;const e=[];for(let r=0;r<this.#f.length;r+=2)e.push([this.#f[r],this.#f[r+1]]);const t=this.#o==="erase",n=this.#v??this.#k;this.addStroke({points:e,color:this.#w,width:t?n*3:n,type:t?"erase":"draw"}),this.#S(),this.#l=null,this.#f=[],this.#v=null}#J(e,t){if(!this.#a)return;const n=this.#T(),r=km*n,o=PA({left:e,top:t,height:Math.ceil(r*1.4),background:"transparent",fontSize:r,color:"#2293fb"});this.#a.append(o),o.focus(),o.select();let i=!1;const s=()=>{if(i)return;i=!0;const a=o.value.trim();a&&(this.addText({x:e,y:t,content:a}),this.#o==="text"&&this.#A&&this.#A("select")),o.parentNode===this.#a&&this.#a.removeChild(o)};o.addEventListener("keydown",a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),s()),a.key==="Escape"&&(a.preventDefault(),s())}),o.addEventListener("blur",s)}#ee(e,t){if(!this.#a||!this.#n)return;this.#M();const n=e.position(),r=PA({value:e.text(),left:n.x,top:n.y,width:Math.max(e.width(),120),height:Math.max(e.height(),24),fontSize:e.fontSize(),fontFamily:e.fontFamily(),color:e.fill?e.fill():"#2293fb",background:"white",resize:"both"});this.#a.appendChild(r),r.focus(),r.select();let o=!1;const i=()=>{if(o)return;o=!0;const s=r.value.trim();s&&(e.text(s),t.content=s,this.#t.batchDraw(),this.#S()),r.parentNode&&r.parentNode.removeChild(r)};r.addEventListener("keydown",s=>{s.key==="Enter"&&!s.shiftKey&&(s.preventDefault(),i()),s.key==="Escape"&&(s.preventDefault(),i())}),r.addEventListener("blur",i)}},iN=class extends nN{#e=null;#n=null;#t=new Map;#r=new Map;#i="select";#a=!1;#u=1;#h=null;#l=null;#f=null;constructor(e={}){super(),this.#v(e)}#v(e){this.#e=e.Renderer,this.#n=e.superdoc,this.#a=e.enabled,this.#h=e.onChange,this.#l=e.onSetData,this.#f=e.onEnabledChange}register(e,t){this.#r.set(e,t)}getType(e){return this.#r.get(e)}setTool(e){this.#i=e,this.#t.forEach(t=>t.setTool(e)),this.emit("tool",e)}getTool(){return this.#i}setEnabled(e){this.#a=e,this.#t.forEach(t=>t.setEnabled(this.#a)),this.emit("enabled",this.#a),this.#f&&this.#f(this.#a)}isEnabled(){return this.#a}setOpacity(e){const t=e;this.#u=Number.isFinite(t)?Math.min(1,Math.max(0,t)):1,this.emit("opacity",this.#u)}getOpacity(){return this.#u}getPages(){return Array.from(this.#t.values())}rerender(){this.#t.forEach(e=>e.render())}setPageSize(e,t){this.#o(e).setSize(t)}#o(e){const t=this.#t.get(e);if(t)return t;const n=new oN({Renderer:this.#e,enabled:this.#a,pageIndex:e,onChange:()=>{this.#s()},onToolChange:r=>{this.setTool(r)}});return n.setTool(this.#i),n.setEnabled(this.#a),this.#t.set(e,n),n}getPage(e){return this.#t.get(e)}getWhiteboardData(){const e={},t={};for(const n of this.#t.values())e[n.pageIndex]=n.toJSON(),n.size&&(t[n.pageIndex]={width:n.size.width,height:n.size.height,originalWidth:n.originalSize?.width??null,originalHeight:n.originalSize?.height??null});return{pages:e,meta:{pageSizes:t},version:1}}setWhiteboardData(e){this.#t.clear();const t=e?.pages||{};Object.keys(t).forEach(n=>{const r=Number(n),o=Number.isNaN(r)?n:r;this.#o(o).applyData(t[n])}),this.emit("setData",this.getPages()),this.#l&&this.#l(this.getPages()),this.#s()}#s(){const e=this.getWhiteboardData();this.emit("change",e),this.#h&&this.#h(e)}},sN=Math.PI/180;function aN(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}var Ac=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},_t={_global:Ac,version:"10.2.5",isBrowser:aN(),isUnminified:/param/.test(function(e){}.toString()),dblClickWindow:400,getAngle(e){return _t.angleDeg?e*sN:e},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:"web",legacyTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return _t.DD.isDragging},isTransforming(){var e,t;return(t=(e=_t.Transformer)===null||e===void 0?void 0:e.isTransforming())!==null&&t!==void 0?t:!1},isDragReady(){return!!_t.DD.node},releaseCanvasOnDestroy:!0,document:Ac.document,_injectGlobal(e){typeof Ac.Konva<"u"&&console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."),Ac.Konva=e}},_r=e=>{_t[e.prototype.getClassName()]=e};_t._injectGlobal(_t);var lN=`Konva.js unsupported environment.
|
|
87
87
|
|
|
88
88
|
Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
|
|
89
89
|
|
|
@@ -99,10 +99,10 @@ js: import "konva/skia-backend";
|
|
|
99
99
|
`,FA=()=>{if(typeof document>"u")throw new Error(lN)},hs=class zE{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new zE(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){const n=this.m;return{x:n[0]*t.x+n[2]*t.y+n[4],y:n[1]*t.x+n[3]*t.y+n[5]}}translate(t,n){return this.m[4]+=this.m[0]*t+this.m[2]*n,this.m[5]+=this.m[1]*t+this.m[3]*n,this}scale(t,n){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=n,this.m[3]*=n,this}rotate(t){const n=Math.cos(t),r=Math.sin(t),o=this.m[0]*n+this.m[2]*r,i=this.m[1]*n+this.m[3]*r,s=this.m[0]*-r+this.m[2]*n,a=this.m[1]*-r+this.m[3]*n;return this.m[0]=o,this.m[1]=i,this.m[2]=s,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,n){const r=this.m[0]+this.m[2]*n,o=this.m[1]+this.m[3]*n,i=this.m[2]+this.m[0]*t,s=this.m[3]+this.m[1]*t;return this.m[0]=r,this.m[1]=o,this.m[2]=i,this.m[3]=s,this}multiply(t){const n=this.m[0]*t.m[0]+this.m[2]*t.m[1],r=this.m[1]*t.m[0]+this.m[3]*t.m[1],o=this.m[0]*t.m[2]+this.m[2]*t.m[3],i=this.m[1]*t.m[2]+this.m[3]*t.m[3],s=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],a=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this.m[4]=s,this.m[5]=a,this}invert(){const t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*t,r=-this.m[1]*t,o=-this.m[2]*t,i=this.m[0]*t,s=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this.m[4]=s,this.m[5]=a,this}getMatrix(){return this.m}decompose(){const t=this.m[0],n=this.m[1],r=this.m[2],o=this.m[3],i=this.m[4],s=this.m[5],a=t*o-n*r,l={x:i,y:s,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(t!=0||n!=0){const u=Math.sqrt(t*t+n*n);l.rotation=n>0?Math.acos(t/u):-Math.acos(t/u),l.scaleX=u,l.scaleY=a/u,l.skewX=(t*r+n*o)/a,l.skewY=0}else if(r!=0||o!=0){const u=Math.sqrt(r*r+o*o);l.rotation=Math.PI/2-(o>0?Math.acos(-r/u):-Math.acos(r/u)),l.scaleX=a/u,l.scaleY=u,l.skewX=0,l.skewY=(t*r+n*o)/a}return l.rotation=Oe._getRotation(l.rotation),l}},cN="[object Array]",uN="[object Number]",dN="[object String]",fN="[object Boolean]",hN=Math.PI/180,pN=180/Math.PI,Hf="#",mN="",gN="0",vN="Konva warning: ",NA="Konva error: ",yN="rgb(",_b={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},bN=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Sm=[],$f=null,wN=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(e){setTimeout(e,16)},Oe={_isElement(e){return!!(e&&e.nodeType==1)},_isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},_isPlainObject(e){return!!e&&e.constructor===Object},_isArray(e){return Object.prototype.toString.call(e)===cN},_isNumber(e){return Object.prototype.toString.call(e)===uN&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===dN},_isBoolean(e){return Object.prototype.toString.call(e)===fN},isObject(e){return e instanceof Object},isValidSelector(e){if(typeof e!="string")return!1;const t=e[0];return t==="#"||t==="."||t===t.toUpperCase()},_sign(e){return e===0||e>0?1:-1},requestAnimFrame(e){Sm.push(e),Sm.length===1&&wN(function(){const t=Sm;Sm=[],t.forEach(function(n){n()})})},createCanvasElement(){FA();const e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return FA(),document.createElement("img")},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){const n=Oe.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex(e,t,n){return((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)},_hexToRgb(e){e=e.replace(Hf,mN);const t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:t&255}},getRandomColor(){let e=(Math.random()*16777215<<0).toString(16);for(;e.length<6;)e=gN+e;return Hf+e},isCanvasFarblingActive(){if($f!==null)return $f;if(typeof document>"u")return $f=!1,!1;const e=this.createCanvasElement();e.width=10,e.height=10;const t=e.getContext("2d",{willReadFrequently:!0});t.clearRect(0,0,10,10),t.fillStyle="#282828",t.fillRect(0,0,10,10);const n=t.getImageData(0,0,10,10).data;let r=!1;for(let o=0;o<100;o++)if(n[o*4]!==40||n[o*4+1]!==40||n[o*4+2]!==40||n[o*4+3]!==255){r=!0;break}return $f=r,this.releaseCanvas(e),$f},getHitColor(){const e=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(e):e},getHitColorKey(e,t,n){return this.isCanvasFarblingActive()&&(e=Math.round(e/5)*5,t=Math.round(t/5)*5,n=Math.round(n/5)*5),Hf+this._rgbToHex(e,t,n)},getSnappedHexColor(e){const t=this._hexToRgb(e);return Hf+this._rgbToHex(Math.round(t.r/5)*5,Math.round(t.g/5)*5,Math.round(t.b/5)*5)},getRGB(e){let t;return e in _b?(t=_b[e],{r:t[0],g:t[1],b:t[2]}):e[0]===Hf?this._hexToRgb(e.substring(1)):e.substr(0,4)===yN?(t=bN.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA(e){return e=e||"black",Oe._namedColorToRBA(e)||Oe._hex3ColorToRGBA(e)||Oe._hex4ColorToRGBA(e)||Oe._hex6ColorToRGBA(e)||Oe._hex8ColorToRGBA(e)||Oe._rgbColorToRGBA(e)||Oe._rgbaColorToRGBA(e)||Oe._hslColorToRGBA(e)},_namedColorToRBA(e){const t=_b[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(e.indexOf("rgb(")===0){e=e.match(/rgb\(([^)]+)\)/)[1];const t=e.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(e.indexOf("rgba(")===0){e=e.match(/rgba\(([^)]+)\)/)[1];const t=e.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if(e[0]==="#"&&e.length===9)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e[0]==="#"&&e.length===7)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e[0]==="#"&&e.length===5)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e[0]==="#"&&e.length===4)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,o=Number(n[1])/100,i=Number(n[2])/100;let s,a,l;if(o===0)return l=i*255,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};i<.5?s=i*(1+o):s=i+o-i*o;const u=2*i-s,d=[0,0,0];for(let f=0;f<3;f++)a=r+1/3*-(f-1),a<0&&a++,a>1&&a--,6*a<1?l=u+(s-u)*6*a:2*a<1?l=s:3*a<2?l=u+(s-u)*(2/3-a)*6:l=u,d[f]=l*255;return{r:Math.round(d[0]),g:Math.round(d[1]),b:Math.round(d[2]),a:1}}},haveIntersection(e,t){return!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y)},cloneObject(e){const t={};for(const n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray(e){return e.slice(0)},degToRad(e){return e*hN},radToDeg(e){return e*pN},_degToRad(e){return Oe.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),Oe.degToRad(e)},_radToDeg(e){return Oe.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),Oe.radToDeg(e)},_getRotation(e){return _t.angleDeg?Oe.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw new Error(NA+e)},error(e){console.error(NA+e)},warn(e){_t.showWarnings&&console.warn(vN+e)},each(e,t){for(const n in e)t(n,e[n])},_inRange(e,t,n){return t<=e&&e<n},_getProjectionToSegment(e,t,n,r,o,i){let s,a,l;const u=(e-n)*(e-n)+(t-r)*(t-r);if(u==0)s=e,a=t,l=(o-n)*(o-n)+(i-r)*(i-r);else{const d=((o-e)*(n-e)+(i-t)*(r-t))/u;d<0?(s=e,a=t,l=(e-o)*(e-o)+(t-i)*(t-i)):d>1?(s=n,a=r,l=(n-o)*(n-o)+(r-i)*(r-i)):(s=e+d*(n-e),a=t+d*(r-t),l=(s-o)*(s-o)+(a-i)*(a-i))}return[s,a,l]},_getProjectionToLine(e,t,n){const r=Oe.cloneObject(e);let o=Number.MAX_VALUE;return t.forEach(function(i,s){if(!n&&s===t.length-1)return;const a=t[(s+1)%t.length],l=Oe._getProjectionToSegment(i.x,i.y,a.x,a.y,e.x,e.y),u=l[0],d=l[1],f=l[2];f<o&&(r.x=u,r.y=d,o=f)}),r},_prepareArrayForTween(e,t,n){const r=[],o=[];if(e.length>t.length){const s=t;t=e,e=s}for(let s=0;s<e.length;s+=2)r.push({x:e[s],y:e[s+1]});for(let s=0;s<t.length;s+=2)o.push({x:t[s],y:t[s+1]});const i=[];return o.forEach(function(s){const a=Oe._getProjectionToLine(s,r,n);i.push(a.x),i.push(a.y)}),i},_prepareToStringify(e){let t;e.visitedByCircularReferenceRemoval=!0;for(const n in e)if(e.hasOwnProperty(n)&&e[n]&&typeof e[n]=="object"){if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||Oe._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(Oe._prepareToStringify(e[n])===null)if(t.configurable)delete e[n];else return null}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(const n in t)e[n]=t[n];return e},_getFirstPointerId(e){return e.touches?e.changedTouches[0].identifier:e.pointerId||999},releaseCanvas(...e){_t.releaseCanvasOnDestroy&&e.forEach(t=>{t.width=0,t.height=0})},drawRoundedRectPath(e,t,n,r){let o=t<0?t:0,i=n<0?n:0;t=Math.abs(t),n=Math.abs(n);let s=0,a=0,l=0,u=0;typeof r=="number"?s=a=l=u=Math.min(r,t/2,n/2):(s=Math.min(r[0]||0,t/2,n/2),a=Math.min(r[1]||0,t/2,n/2),u=Math.min(r[2]||0,t/2,n/2),l=Math.min(r[3]||0,t/2,n/2)),e.moveTo(o+s,i),e.lineTo(o+t-a,i),e.arc(o+t-a,i+a,a,Math.PI*3/2,0,!1),e.lineTo(o+t,i+n-u),e.arc(o+t-u,i+n-u,u,0,Math.PI/2,!1),e.lineTo(o+l,i+n),e.arc(o+l,i+n-l,l,Math.PI/2,Math.PI,!1),e.lineTo(o,i+s),e.arc(o+s,i+s,s,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,t,n,r,o){r=Math.abs(r);for(let i=0;i<n;i++){const s=t[(i-1+n)%n],a=t[i],l=t[(i+1)%n],u={x:a.x-s.x,y:a.y-s.y},d={x:l.x-a.x,y:l.y-a.y},f=Math.hypot(u.x,u.y),p=Math.hypot(d.x,d.y);let g;typeof o=="number"?g=o:g=i<o.length?o[i]:0,g=r*Math.cos(Math.PI/n)*Math.min(1,g/r*2);const m={x:u.x/f,y:u.y/f},v={x:d.x/p,y:d.y/p},k={x:a.x-m.x*g,y:a.y-m.y*g},b={x:a.x+v.x*g,y:a.y+v.y*g};i===0?e.moveTo(k.x,k.y):e.lineTo(k.x,k.y),e.arcTo(a.x,a.y,b.x,b.y,g)}}};function CN(e){const t=[],n=e.length,r=Oe;for(let o=0;o<n;o++){let i=e[o];r._isNumber(i)?i=Math.round(i*1e3)/1e3:r._isString(i)||(i=i+""),t.push(i)}return t}var BA=",",kN="(",SN=")",_N="([",AN="])",IN=";",EN="()",TN="=",zA=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],xN=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],RN=100,_m=null;function jA(){if(_m!==null)return _m;try{const e=Oe.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(_m=!1,!1)}catch{return _m=!1,!1}}var Am=class{constructor(e){this.canvas=e,_t.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){let n=this.traceArr,r=n.length,o="",i,s,a,l;for(i=0;i<r;i++)s=n[i],a=s.method,a?(l=s.args,o+=a,e?o+=EN:Oe._isArray(l[0])?o+=_N+l.join(BA)+AN:(t&&(l=l.map(u=>typeof u=="number"?Math.floor(u):u)),o+=kN+l.join(BA)+SN)):(o+=s.property,e||(o+=TN+s.val)),o+=IN;return o}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=RN&&t.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){const t=e.attrs.lineCap;t&&this.setAttr("lineCap",t)}_applyOpacity(e){const t=e.getAbsoluteOpacity();t!==1&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){const t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}_applyMiterLimit(e){const t=e.attrs.miterLimit;t!=null&&this.setAttr("miterLimit",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,o,i){this._context.arc(e,t,n,r,o,i)}arcTo(e,t,n,r,o){this._context.arcTo(e,t,n,r,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,o,i){this._context.bezierCurveTo(e,t,n,r,o,i)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){const n=arguments;if(n.length===2)return this._context.createImageData(e,t);if(n.length===1)return this._context.createImageData(e)}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,o,i){return this._context.createRadialGradient(e,t,n,r,o,i)}drawImage(e,t,n,r,o,i,s,a,l){const u=arguments,d=this._context;u.length===3?d.drawImage(e,t,n):u.length===5?d.drawImage(e,t,n,r,o):u.length===9&&d.drawImage(e,t,n,r,o,i,s,a,l)}ellipse(e,t,n,r,o,i,s,a){this._context.ellipse(e,t,n,r,o,i,s,a)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}roundRect(e,t,n,r,o){this._context.roundRect(e,t,n,r,o)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,o,i){this._context.setTransform(e,t,n,r,o,i)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,o,i){this._context.transform(e,t,n,r,o,i)}translate(e,t){this._context.translate(e,t)}_enableTrace(){let e=this,t=zA.length,n=this.setAttr,r,o;const i=function(s){let a=e[s],l;e[s]=function(){return o=CN(Array.prototype.slice.call(arguments,0)),l=a.apply(e,arguments),e._trace({method:s,args:o}),l}};for(r=0;r<t;r++)i(zA[r]);e.setAttr=function(){n.apply(e,arguments);const s=arguments[0];let a=arguments[1];(s==="shadowOffsetX"||s==="shadowOffsetY"||s==="shadowBlur")&&(a=a/this.canvas.getPixelRatio()),e._trace({property:s,val:a})}}_applyGlobalCompositeOperation(e){const t=e.attrs.globalCompositeOperation;!t||t==="source-over"||this.setAttr("globalCompositeOperation",t)}};xN.forEach(function(e){Object.defineProperty(Am.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var MN=class extends Am{constructor(e,{willReadFrequently:t=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:t})}_fillColor(e){const t=e.fill();this.setAttr("fillStyle",t),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){const t=e._getLinearGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fillRadialGradient(e){const t=e._getRadialGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fill(e){const t=e.fill(),n=e.getFillPriority();if(t&&n==="color"){this._fillColor(e);return}const r=e.getFillPatternImage();if(r&&n==="pattern"){this._fillPattern(e);return}const o=e.getFillLinearGradientColorStops();if(o&&n==="linear-gradient"){this._fillLinearGradient(e);return}const i=e.getFillRadialGradientColorStops();if(i&&n==="radial-gradient"){this._fillRadialGradient(e);return}t?this._fillColor(e):r?this._fillPattern(e):o?this._fillLinearGradient(e):i&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),o=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(let i=0;i<r.length;i+=2)o.addColorStop(r[i],r[i+1]);this.setAttr("strokeStyle",o)}}_stroke(e){const t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();const r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){var t,n,r;const o=(t=e.getShadowRGBA())!==null&&t!==void 0?t:"black",i=(n=e.getShadowBlur())!==null&&n!==void 0?n:5,s=(r=e.getShadowOffset())!==null&&r!==void 0?r:{x:0,y:0},a=e.getAbsoluteScale(),l=this.canvas.getPixelRatio(),u=a.x*l,d=a.y*l;this.setAttr("shadowColor",o),this.setAttr("shadowBlur",i*Math.min(Math.abs(u),Math.abs(d))),this.setAttr("shadowOffsetX",s.x*u),this.setAttr("shadowOffsetY",s.y*d)}},LN=class extends Am{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const t=e.getStrokeScaleEnabled();if(!t){this.save();const o=this.getCanvas().getPixelRatio();this.setTransform(o,0,0,o,0,0)}this._applyLineCap(e);const n=e.hitStrokeWidth(),r=n==="auto"?e.strokeWidth():n;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),t||this.restore()}}},Im;function DN(){if(Im)return Im;const e=Oe.createCanvasElement(),t=e.getContext("2d");return Im=(function(){return(_t._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),Oe.releaseCanvas(e),Im}var Ab=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const t=(e||{}).pixelRatio||_t.pixelRatio||DN();this.pixelRatio=t,this._canvas=Oe.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){const t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch{try{return this._canvas.toDataURL()}catch(r){return Oe.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}},El=class extends Ab{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new MN(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},Ib=class extends Ab{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new LN(this),this.setSize(e.width,e.height)}},Bn={get isDragging(){let e=!1;return Bn._dragElements.forEach(t=>{t.dragStatus==="dragging"&&(e=!0)}),e},justDragged:!1,get node(){let e;return Bn._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];Bn._dragElements.forEach((n,r)=>{const{node:o}=n,i=o.getStage();i.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=Oe._getFirstPointerId(e));const s=i._changedPointerPositions.find(a=>a.id===n.pointerId);if(s){if(n.dragStatus!=="dragging"){const a=o.dragDistance();if(Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y))<a||(o.startDrag({evt:e}),!o.isDragging()))return}o._setDragPosition(e,n),t.push(o)}}),t.forEach(n=>{n.getStage()&&n.fire("dragmove",{type:"dragmove",target:n,evt:e},!0)})},_endDragBefore(e){const t=[];Bn._dragElements.forEach(n=>{const{node:r}=n,o=r.getStage();if(e&&o.setPointersPositions(e),!o._changedPointerPositions.find(s=>s.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(Bn.justDragged=!0,_t._mouseListenClick=!1,_t._touchListenClick=!1,_t._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof _t.Stage&&n.node;i&&t.indexOf(i)===-1&&t.push(i)}),t.forEach(n=>{n.draw()})},_endDragAfter(e){Bn._dragElements.forEach((t,n)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),t.dragStatus!=="dragging"&&Bn._dragElements.delete(n)})}};_t.isBrowser&&(window.addEventListener("mouseup",Bn._endDragBefore,!0),window.addEventListener("touchend",Bn._endDragBefore,!0),window.addEventListener("touchcancel",Bn._endDragBefore,!0),window.addEventListener("mousemove",Bn._drag),window.addEventListener("touchmove",Bn._drag),window.addEventListener("mouseup",Bn._endDragAfter,!1),window.addEventListener("touchend",Bn._endDragAfter,!1),window.addEventListener("touchcancel",Bn._endDragAfter,!1));function Tl(e){return Oe._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||Oe._isBoolean(e)?e:Object.prototype.toString.call(e)}function VA(e){return e>255?255:e<0?0:Math.round(e)}function wt(){if(_t.isUnminified)return function(e,t){return Oe._isNumber(e)||Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function Em(e){if(_t.isUnminified)return function(t,n){let r=Oe._isNumber(t),o=Oe._isArray(t)&&t.length==e;return!r&&!o&&Oe.warn(Tl(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function Eb(){if(_t.isUnminified)return function(e,t){return Oe._isNumber(e)||e==="auto"||Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function Ic(){if(_t.isUnminified)return function(e,t){return Oe._isString(e)||Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function UA(){if(_t.isUnminified)return function(e,t){const n=Oe._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function ON(){if(_t.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(Oe._isArray(e)?e.forEach(function(r){Oe._isNumber(r)||Oe.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function ps(){if(_t.isUnminified)return function(e,t){return e===!0||e===!1||Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function PN(e){if(_t.isUnminified)return function(t,n){return t==null||Oe.isObject(t)||Oe.warn(Tl(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var Gf="get",Wf="set",me={addGetterSetter(e,t,n,r,o){me.addGetter(e,t,n),me.addSetter(e,t,r,o),me.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){const r=Gf+Oe._capitalize(t);e.prototype[r]=e.prototype[r]||function(){const o=this.attrs[t];return o===void 0?n:o}},addSetter(e,t,n,r){const o=Wf+Oe._capitalize(t);e.prototype[o]||me.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){const o=Wf+Oe._capitalize(t);e.prototype[o]=function(i){return n&&i!==void 0&&i!==null&&(i=n.call(this,i,t)),this._setAttr(t,i),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,o){const i=n.length,s=Oe._capitalize,a=Gf+s(t),l=Wf+s(t);e.prototype[a]=function(){const d={};for(let f=0;f<i;f++){const p=n[f];d[p]=this.getAttr(t+s(p))}return d};const u=PN(n);e.prototype[l]=function(d){const f=this.attrs[t];r&&(d=r.call(this,d,t)),u&&u.call(this,d,t);for(const p in d)d.hasOwnProperty(p)&&this._setAttr(t+s(p),d[p]);return d||n.forEach(p=>{this._setAttr(t+s(p),void 0)}),this._fireChangeEvent(t,f,d),o&&o.call(this),this},me.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){const n=Oe._capitalize(t),r=Wf+n,o=Gf+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(e,t,n,r){Oe.error("Adding deprecated "+t);const o=Gf+Oe._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){Oe.error(i);const s=this.attrs[t];return s===void 0?n:s},me.addSetter(e,t,r,function(){Oe.error(i)}),me.addOverloadedGetterSetter(e,t)},backCompat(e,t){Oe.each(t,function(n,r){const o=e.prototype[r],i=Gf+Oe._capitalize(n),s=Wf+Oe._capitalize(n);function a(){o.apply(this,arguments),Oe.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+r+'" instead.')}e.prototype[n]=a,e.prototype[i]=a,e.prototype[s]=a})},afterSetFilter(){this._filterUpToDate=!1}};function FN(e){const t=/(\w+)\(([^)]+)\)/g;let n;for(;(n=t.exec(e))!==null;){const[,r,o]=n;switch(r){case"blur":{const i=parseFloat(o.replace("px",""));return function(s){this.blurRadius(i*.5);const a=_t.Filters;a&&a.Blur&&a.Blur.call(this,s)}}case"brightness":{const i=o.includes("%")?parseFloat(o)/100:parseFloat(o);return function(s){this.brightness(i);const a=_t.Filters;a&&a.Brightness&&a.Brightness.call(this,s)}}case"contrast":{const i=parseFloat(o);return function(s){const a=100*(Math.sqrt(i)-1);this.contrast(a);const l=_t.Filters;l&&l.Contrast&&l.Contrast.call(this,s)}}case"grayscale":return function(i){const s=_t.Filters;s&&s.Grayscale&&s.Grayscale.call(this,i)};case"sepia":return function(i){const s=_t.Filters;s&&s.Sepia&&s.Sepia.call(this,i)};case"invert":return function(i){const s=_t.Filters;s&&s.Invert&&s.Invert.call(this,i)};default:Oe.warn(`CSS filter "${r}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var Tm="absoluteOpacity",HA="allEventListeners",Na="absoluteTransform",$A="absoluteScale",Ec="canvas",NN="Change",BN="children",zN="konva",Tb="listening",jN="mouseenter",VN="mouseleave",UN="pointerenter",HN="pointerleave",$N="touchenter",GN="touchleave",GA="set",WA="Shape",xm=" ",KA="stage",xl="transform",WN="Stage",xb="visible",KN=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(xm),qN=1,It=class Ph{constructor(t){this._id=qN++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===xl||t===Na)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){let r=this._cache.get(t);return(r===void 0||(t===xl||t===Na)&&r.dirty===!0)&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const o=n.map(i=>i+"Change.konva").join(xm);this.on(o,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Ec)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===Na&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Ec)){const{scene:t,filter:n,hit:r}=this._cache.get(Ec);Oe.releaseCanvas(t._canvas,n._canvas,r._canvas),this._cache.delete(Ec)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){const n=t||{};let r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let o=Math.ceil(n.width||r.width),i=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,d=n.drawBorder||!1,f=n.hitCanvasPixelRatio||1;if(!o||!i){Oe.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const p=Math.abs(Math.round(r.x)-a)>.5?1:0,g=Math.abs(Math.round(r.y)-l)>.5?1:0;o+=u*2+p,i+=u*2+g,a-=u,l-=u;const m=new El({pixelRatio:s,width:o,height:i}),v=new El({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),k=new Ib({pixelRatio:f,width:o,height:i}),b=m.getContext(),S=k.getContext(),C=new El({width:m.width/m.pixelRatio+Math.abs(a),height:m.height/m.pixelRatio+Math.abs(l),pixelRatio:m.pixelRatio}),w=C.getContext();return k.isCache=!0,m.isCache=!0,this._cache.delete(Ec),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(m.getContext()._context.imageSmoothingEnabled=!1,v.getContext()._context.imageSmoothingEnabled=!1),b.save(),S.save(),w.save(),b.translate(-a,-l),S.translate(-a,-l),w.translate(-a,-l),C.x=a,C.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Tm),this._clearSelfAndDescendantCache($A),this.drawScene(m,this,C),this.drawHit(k,this),this._isUnderCache=!1,b.restore(),S.restore(),d&&(b.save(),b.beginPath(),b.rect(0,0,o,i),b.closePath(),b.setAttr("strokeStyle","red"),b.setAttr("lineWidth",5),b.stroke(),b.restore()),Oe.releaseCanvas(C._canvas),this._cache.set(Ec,{scene:m,filter:v,hit:k,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Ec)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){const r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];let o=1/0,i=1/0,s=-1/0,a=-1/0;const l=this.getAbsoluteTransform(n);return r.forEach(function(u){const d=l.point(u);o===void 0&&(o=s=d.x,i=a=d.y),o=Math.min(o,d.x),i=Math.min(i,d.y),s=Math.max(s,d.x),a=Math.max(a,d.y)}),{x:o,y:i,width:s-o,height:a-i}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);const r=this._getCachedSceneCanvas(),o=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/o,r.height/o),t.restore()}_drawCachedHitCanvas(t){const n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){let t=this.filters(),n=this._getCanvasCache(),r=n.scene,o=n.filter,i=o.getContext(),s,a,l,u;if(!t||t.length===0)return r;if(this._filterUpToDate)return o;let d=!0;for(let p=0;p<t.length;p++)if(typeof t[p]=="string"&&jA(),typeof t[p]!="string"||!jA()){d=!1;break}const f=r.pixelRatio;if(o.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio),d){const p=t.join(" ");return i.save(),i.setAttr("filter",p),i.drawImage(r._canvas,0,0,r.getWidth()/f,r.getHeight()/f),i.restore(),this._filterUpToDate=!0,o}try{for(s=t.length,i.clear(),i.drawImage(r._canvas,0,0,r.getWidth()/f,r.getHeight()/f),a=i.getImageData(0,0,o.getWidth(),o.getHeight()),l=0;l<s;l++)u=t[l],typeof u=="string"&&(u=FN(u)),u.call(this,a),i.putImageData(a,0,0)}catch(p){Oe.error("Unable to apply filter. "+p.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,o}on(...t){const n=t[0],r=t[1];if(t[2],this._cache&&this._cache.delete(HA),t.length===3)return this._delegate.apply(this,t);const o=n.split(xm);for(let i=0;i<o.length;i++){const s=o[i].split("."),a=s[0],l=s[1]||"";this.eventListeners[a]||(this.eventListeners[a]=[]),this.eventListeners[a].push({name:l,handler:r})}return this}off(t,n){let r=(t||"").split(xm),o=r.length,i,s,a,l,u,d;if(this._cache&&this._cache.delete(HA),!t)for(s in this.eventListeners)this._off(s);for(i=0;i<o;i++)if(a=r[i],l=a.split("."),u=l[0],d=l[1],u)this.eventListeners[u]&&this._off(u,d,n);else for(s in this.eventListeners)this._off(s,d,n);return this}dispatchEvent(t){const n={target:this,type:t.type,evt:t};return this.fire(t.type,n),this}addEventListener(t,n){return this.on(t,function(r){n.call(this,r.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,n,r){const o=this;return this.on(t,function(i){const s=i.target.findAncestors(n,!0,o);for(let a=0;a<s.length;a++)i=Oe.cloneObject(i),i.currentTarget=s[a],r.call(s[a],i)}),this}remove(){return this.isDragging()&&this.stopDrag(),Bn._dragElements.delete(this._id),Bn._dragElements.forEach((t,n)=>{this.isAncestorOf(t.node)&&Bn._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Na),this._clearSelfAndDescendantCache(Tm),this._clearSelfAndDescendantCache($A),this._clearSelfAndDescendantCache(KA),this._clearSelfAndDescendantCache(xb),this._clearSelfAndDescendantCache(Tb)}_remove(){this._clearCaches();const t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){const n="get"+Oe._capitalize(t);return Oe._isFunction(this[n])?this[n]():this.attrs[t]}getAncestors(){let t=this.getParent(),n=[];for(;t;)n.push(t),t=t.getParent();return n}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{let n,r;if(!t)return this;for(n in t)n!==BN&&(r=GA+Oe._capitalize(n),Oe._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(Tb,this._isListening)}_isListening(t){if(!this.listening())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isListening(t):!0}isVisible(){return this._getCache(xb,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);const r=this.getLayer();let o=!1;Bn._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(o=!0)});const i=!n&&!_t.hitOnDragEnabled&&(o||_t.isTransforming());return this.isListening()&&this.isVisible()&&!i}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let t=this.getDepth(),n=this,r=0,o,i,s,a;function l(d){for(o=[],i=d.length,s=0;s<i;s++)a=d[s],r++,a.nodeType!==WA&&(o=o.concat(a.getChildren().slice())),a._id===n._id&&(s=i);o.length>0&&o[0].getDepth()<=t&&l(o)}const u=this.getStage();return n.nodeType!==WN&&u&&l(u.getChildren()),r}getDepth(){let t=0,n=this.parent;for(;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(xl),this._clearSelfAndDescendantCache(Na)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;const n=t.getPointerPosition();if(!n)return null;const r=this.getAbsoluteTransform().copy();return r.invert(),r.point(n)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);const o=this.getAbsoluteTransform(t).getMatrix(),i=new hs,s=this.offset();return i.m=o.slice(),i.translate(s.x,s.y),i.getTranslation()}setAbsolutePosition(t){const{x:n,y:r,...o}=this._clearTransform();this.attrs.x=n,this.attrs.y=r,this._clearCache(xl);const i=this._getAbsoluteTransform().copy();return i.invert(),i.translate(t.x,t.y),t={x:this.attrs.x+i.getTranslation().x,y:this.attrs.y+i.getTranslation().y},this._setTransform(o),this.setPosition({x:t.x,y:t.y}),this._clearCache(xl),this._clearSelfAndDescendantCache(Na),this}_setTransform(t){let n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){const t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){let n=t.x,r=t.y,o=this.x(),i=this.y();return n!==void 0&&(o+=n),r!==void 0&&(i+=r),this.setPosition({x:o,y:i}),this}_eachAncestorReverse(t,n){let r=[],o=this.getParent(),i,s;if(!(n&&n._id===this._id)){for(r.unshift(this);o&&(!n||o._id!==n._id);)r.unshift(o),o=o.parent;for(i=r.length,s=0;s<i;s++)t(r[s])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return Oe.warn("Node has no parent. moveToTop function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1?(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Oe.warn("Node has no parent. moveUp function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1?(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Oe.warn("Node has no parent. moveDown function is ignored."),!1;const t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Oe.warn("Node has no parent. moveToBottom function is ignored."),!1;const t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return Oe.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Oe.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Tm,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let t=this.opacity();const n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){let t=this.getAttrs(),n,r,o,i,s;const a={attrs:{},className:this.getClassName()};for(n in t)r=t[n],s=Oe.isObject(r)&&!Oe._isPlainObject(r)&&!Oe._isArray(r),!s&&(o=typeof this[n]=="function"&&this[n],delete t[n],i=o?o.call(this):null,t[n]=r,i!==r&&(a.attrs[n]=r));return Oe._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){const o=[];n&&this._isMatch(t)&&o.push(this);let i=this.parent;for(;i;){if(i===r)return o;i._isMatch(t)&&o.push(i),i=i.parent}return o}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);let n=t.replace(/ /g,"").split(","),r=n.length,o,i;for(o=0;o<r;o++)if(i=n[o],Oe.isValidSelector(i)||(Oe.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Oe.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Oe.warn("Konva is awesome, right?")),i.charAt(0)==="#"){if(this.id()===i.slice(1))return!0}else if(i.charAt(0)==="."){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){const t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(KA,this._getStage)}_getStage(){const t=this.getParent();return t?t.getStage():null}fire(t,n={},r){return n.target=n.target||this,r?this._fireAndBubble(t,n):this._fire(t,n),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache(Na,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let n;if(t)return n=new hs,this._eachAncestorReverse(function(r){const o=r.transformsEnabled();o==="all"?n.multiply(r.getTransform()):o==="position"&&n.translate(r.x()-r.offsetX(),r.y()-r.offsetY())},t),n;{n=this._cache.get(Na)||new hs,this.parent?this.parent.getAbsoluteTransform().copyInto(n):n.reset();const r=this.transformsEnabled();if(r==="all")n.multiply(this.getTransform());else if(r==="position"){const o=this.attrs.x||0,i=this.attrs.y||0,s=this.attrs.offsetX||0,a=this.attrs.offsetY||0;n.translate(o-s,i-a)}return n.dirty=!1,n}}getAbsoluteScale(t){let n=this;for(;n;)n._isUnderCache&&(t=n),n=n.getParent();const r=this.getAbsoluteTransform(t).decompose();return{x:r.scaleX,y:r.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(xl,this._getTransform)}_getTransform(){var t,n;const r=this._cache.get(xl)||new hs;r.reset();const o=this.x(),i=this.y(),s=_t.getAngle(this.rotation()),a=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,l=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,u=this.attrs.skewX||0,d=this.attrs.skewY||0,f=this.attrs.offsetX||0,p=this.attrs.offsetY||0;return(o!==0||i!==0)&&r.translate(o,i),s!==0&&r.rotate(s),(u!==0||d!==0)&&r.skew(u,d),(a!==1||l!==1)&&r.scale(a,l),(f!==0||p!==0)&&r.translate(-1*f,-1*p),r.dirty=!1,r}clone(t){let n=Oe.cloneObject(this.attrs),r,o,i,s,a;for(r in t)n[r]=t[r];const l=new this.constructor(n);for(r in this.eventListeners)for(o=this.eventListeners[r],i=o.length,s=0;s<i;s++)a=o[s],a.name.indexOf(zN)<0&&(l.eventListeners[r]||(l.eventListeners[r]=[]),l.eventListeners[r].push(a));return l}_toKonvaCanvas(t){t=t||{};const n=this.getClientRect(),r=this.getStage(),o=t.x!==void 0?t.x:Math.floor(n.x),i=t.y!==void 0?t.y:Math.floor(n.y),s=t.pixelRatio||1,a=new El({width:t.width||Math.ceil(n.width)||(r?r.width():0),height:t.height||Math.ceil(n.height)||(r?r.height():0),pixelRatio:s}),l=a.getContext(),u=new El({width:a.width/a.pixelRatio+Math.abs(o),height:a.height/a.pixelRatio+Math.abs(i),pixelRatio:a.pixelRatio});return t.imageSmoothingEnabled===!1&&(l._context.imageSmoothingEnabled=!1),l.save(),(o||i)&&l.translate(-1*o,-1*i),this.drawScene(a,void 0,u),l.restore(),a}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};const n=t.mimeType||null,r=t.quality||null,o=this._toKonvaCanvas(t).toDataURL(n,r);return t.callback&&t.callback(o),o}toImage(t){return new Promise((n,r)=>{try{const o=t?.callback;o&&delete t.callback,Oe._urlToImage(this.toDataURL(t),function(i){n(i),o?.(i)})}catch(o){r(o)}})}toBlob(t){return new Promise((n,r)=>{try{const o=t?.callback;o&&delete t.callback,this.toCanvas(t).toBlob(i=>{n(i),o?.(i)},t?.mimeType,t?.quality)}catch(o){r(o)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():_t.dragDistance}_off(t,n,r){let o=this.eventListeners[t],i,s,a;for(i=0;i<o.length;i++)if(s=o[i].name,a=o[i].handler,(s!=="konva"||n==="konva")&&(!n||s===n)&&(!r||r===a)){if(o.splice(i,1),o.length===0){delete this.eventListeners[t];break}i--}}_fireChangeEvent(t,n,r){this._fire(t+NN,{oldVal:n,newVal:r})}addName(t){if(!this.hasName(t)){const n=this.name(),r=n?n+" "+t:t;this.name(r)}return this}hasName(t){if(!t)return!1;const n=this.name();return n?(n||"").split(/\s/g).indexOf(t)!==-1:!1}removeName(t){const n=(this.name()||"").split(/\s/g),r=n.indexOf(t);return r!==-1&&(n.splice(r,1),this.name(n.join(" "))),this}setAttr(t,n){const r=this[GA+Oe._capitalize(t)];return Oe._isFunction(r)?r.call(this,n):this._setAttr(t,n),this}_requestDraw(){if(_t.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,n){const r=this.attrs[t];r===n&&!Oe.isObject(n)||(n==null?delete this.attrs[t]:this.attrs[t]=n,this._shouldFireChangeEvents&&this._fireChangeEvent(t,r,n),this._requestDraw())}_setComponentAttr(t,n,r){let o;r!==void 0&&(o=this.attrs[t],o||(this.attrs[t]=this.getAttr(t)),this.attrs[t][n]=r,this._fireChangeEvent(t,o,r))}_fireAndBubble(t,n,r){n&&this.nodeType===WA&&(n.target=this);const o=[jN,VN,UN,HN,$N,GN];if(!(o.indexOf(t)!==-1&&(r&&(this===r||this.isAncestorOf&&this.isAncestorOf(r))||this.nodeType==="Stage"&&!r))){this._fire(t,n);const i=o.indexOf(t)!==-1&&r&&r.isAncestorOf&&r.isAncestorOf(this)&&!r.isAncestorOf(this.parent);(n&&!n.cancelBubble||!n)&&this.parent&&this.parent.isListening()&&!i&&(r&&r.parent?this._fireAndBubble.call(this.parent,t,n,r):this._fireAndBubble.call(this.parent,t,n))}}_getProtoListeners(t){var n,r;const{nodeType:o}=this,i=Ph.protoListenerMap.get(o)||{};let s=i?.[t];if(s===void 0){s=[];let a=Object.getPrototypeOf(this);for(;a;){const l=(r=(n=a.eventListeners)===null||n===void 0?void 0:n[t])!==null&&r!==void 0?r:[];s.push(...l),a=Object.getPrototypeOf(a)}i[t]=s,Ph.protoListenerMap.set(o,i)}return s}_fire(t,n){n=n||{},n.currentTarget=this,n.type=t;const r=this._getProtoListeners(t);if(r){const i=r.slice();for(let s=0;s<i.length;s++)i[s].handler.call(this,n)}const o=this.eventListeners[t];if(o){const i=o.slice(),s=i.length;for(let l=0;l<i.length;l++)i[l].handler.call(this,n);const a=this.eventListeners[t];if(a)for(let l=s;l<a.length;l++)a[l].handler.call(this,n)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){const n=t?t.pointerId:void 0,r=this.getStage(),o=this.getAbsolutePosition();if(!r)return;const i=r._getPointerById(n)||r._changedPointerPositions[0]||o;Bn._dragElements.set(this._id,{node:this,startPointerPos:i,offset:{x:i.x-o.x,y:i.y-o.y},dragStatus:"ready",pointerId:n,startEvent:t})}startDrag(t,n=!0){Bn._dragElements.has(this._id)||this._createDragElement(t);const r=Bn._dragElements.get(this._id);r.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:r.startEvent&&r.startEvent.evt||t&&t.evt},n)}_setDragPosition(t,n){const r=this.getStage()._getPointerById(n.pointerId);if(!r)return;let o={x:r.x-n.offset.x,y:r.y-n.offset.y};const i=this.dragBoundFunc();if(i!==void 0){const s=i.call(this,o,t);s?o=s:Oe.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==o.x||this._lastPos.y!==o.y)&&(this.setAbsolutePosition(o),this._requestDraw()),this._lastPos=o}stopDrag(t){const n=Bn._dragElements.get(this._id);n&&(n.dragStatus="stopped"),Bn._endDragBefore(t),Bn._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=Bn._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){if(!(t.evt.button===void 0||_t.dragButtons.indexOf(t.evt.button)>=0)||this.isDragging())return;let n=!1;Bn._dragElements.forEach(r=>{this.isAncestorOf(r.node)&&(n=!0)}),n||this._createDragElement(t)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const t=Bn._dragElements.get(this._id),n=t&&t.dragStatus==="dragging",r=t&&t.dragStatus==="ready";n?this.stopDrag():r&&Bn._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return Oe.haveIntersection(r,this.getClientRect())}static create(t,n){return Oe._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){let r=Ph.prototype.getClassName.call(t),o=t.children,i,s,a;n&&(t.attrs.container=n),_t[r]||(Oe.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=_t[r];if(i=new l(t.attrs),o)for(s=o.length,a=0;a<s;a++)i.add(Ph._createNode(o[a]));return i}};It.protoListenerMap=new Map,It.prototype.nodeType="Node",It.prototype._attrsAffectingSize=[],It.prototype.eventListeners={},It.prototype.on(KN,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(xl),this._clearSelfAndDescendantCache(Na)}),It.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(xb)}),It.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(Tb)}),It.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(Tm)});var Qn=me.addGetterSetter;Qn(It,"zIndex"),Qn(It,"absolutePosition"),Qn(It,"position"),Qn(It,"x",0,wt()),Qn(It,"y",0,wt()),Qn(It,"globalCompositeOperation","source-over",Ic()),Qn(It,"opacity",1,wt()),Qn(It,"name","",Ic()),Qn(It,"id","",Ic()),Qn(It,"rotation",0,wt()),me.addComponentsGetterSetter(It,"scale",["x","y"]),Qn(It,"scaleX",1,wt()),Qn(It,"scaleY",1,wt()),me.addComponentsGetterSetter(It,"skew",["x","y"]),Qn(It,"skewX",0,wt()),Qn(It,"skewY",0,wt()),me.addComponentsGetterSetter(It,"offset",["x","y"]),Qn(It,"offsetX",0,wt()),Qn(It,"offsetY",0,wt()),Qn(It,"dragDistance",void 0,wt()),Qn(It,"width",0,wt()),Qn(It,"height",0,wt()),Qn(It,"listening",!0,ps()),Qn(It,"preventDefault",!0,ps()),Qn(It,"filters",void 0,function(e){return this._filterUpToDate=!1,e}),Qn(It,"visible",!0,ps()),Qn(It,"transformsEnabled","all",Ic()),Qn(It,"size"),Qn(It,"dragBoundFunc"),Qn(It,"draggable",!1,ps()),me.backCompat(It,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Ci=class extends It{constructor(){super(...arguments),this.children=[]}getChildren(e){const t=this.children||[];return e?t.filter(e):t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let n=0;n<e.length;n++)this.add(e[n]);return this}const t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire("add",{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){const t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){const n=[];return this._descendants(r=>{const o=r._isMatch(e);return o&&n.push(r),!!(o&&t)}),n}_descendants(e){let t=!1;const n=this.getChildren();for(const r of n){if(t=e(r),t)return!0;if(r.hasChildren()&&(t=r._descendants(e),t))return!0}return!1}toObject(){const e=It.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(t=>{e.children.push(t.toObject())}),e}isAncestorOf(e){let t=e.getParent();for(;t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){const t=It.prototype.clone.call(this,e);return this.getChildren().forEach(function(n){t.add(n.clone())}),t}getAllIntersections(e){const t=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),!this.isCached()&&((t=this.children)===null||t===void 0||t.forEach(function(n){n._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(t,n){t.index=n}),this._requestDraw()}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas(),i=o&&o.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=o&&o.isCache;if(!this.isVisible()&&!l)return this;if(a){i.save();const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(i),i.restore()}else this._drawChildren("drawScene",o,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;const n=this.getLayer(),r=e||n&&n.hitCanvas,o=r&&r.getContext(),i=this._getCanvasCache();if(i&&i.hit){o.save();const s=this.getAbsoluteTransform(t).getMatrix();o.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n,r){var o;const i=t&&t.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=typeof s=="number"&&typeof a=="number"||l,d=n===this;if(u){i.save();const p=this.getAbsoluteTransform(n);let g=p.getMatrix();i.transform(g[0],g[1],g[2],g[3],g[4],g[5]),i.beginPath();let m;if(l)m=l.call(this,i,this);else{const v=this.clipX(),k=this.clipY();i.rect(v||0,k||0,s,a)}i.clip.apply(i,m),g=p.copy().invert().getMatrix(),i.transform(g[0],g[1],g[2],g[3],g[4],g[5])}const f=!d&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";f&&(i.save(),i._applyGlobalCompositeOperation(this)),(o=this.children)===null||o===void 0||o.forEach(function(p){p[e](t,n,r)}),f&&i.restore(),u&&i.restore()}getClientRect(e={}){var t;const n=e.skipTransform,r=e.relativeTo;let o,i,s,a,l={x:1/0,y:1/0,width:0,height:0};const u=this;(t=this.children)===null||t===void 0||t.forEach(function(p){if(!p.visible())return;const g=p.getClientRect({relativeTo:u,skipShadow:e.skipShadow,skipStroke:e.skipStroke});g.width===0&&g.height===0||(o===void 0?(o=g.x,i=g.y,s=g.x+g.width,a=g.y+g.height):(o=Math.min(o,g.x),i=Math.min(i,g.y),s=Math.max(s,g.x+g.width),a=Math.max(a,g.y+g.height)))});const d=this.find("Shape");let f=!1;for(let p=0;p<d.length;p++)if(d[p]._isVisible(this)){f=!0;break}return f&&o!==void 0?l={x:o,y:i,width:s-o,height:a-i}:l={x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,r)}};me.addComponentsGetterSetter(Ci,"clip",["x","y","width","height"]),me.addGetterSetter(Ci,"clipX",void 0,wt()),me.addGetterSetter(Ci,"clipY",void 0,wt()),me.addGetterSetter(Ci,"clipWidth",void 0,wt()),me.addGetterSetter(Ci,"clipHeight",void 0,wt()),me.addGetterSetter(Ci,"clipFunc");var Kf=new Map,qA=_t._global.PointerEvent!==void 0;function Rb(e){return Kf.get(e)}function Mb(e){return{evt:e,pointerId:e.pointerId}}function YA(e,t){return Kf.get(e)===t}function XA(e,t){qf(e),t.getStage()&&(Kf.set(e,t),qA&&t._fire("gotpointercapture",Mb(new PointerEvent("gotpointercapture"))))}function qf(e,t){const n=Kf.get(e);if(!n)return;const r=n.getStage();r&&r.content,Kf.delete(e),qA&&n._fire("lostpointercapture",Mb(new PointerEvent("lostpointercapture")))}var YN="Stage",XN="string",ZA="px",ZN="mouseout",QA="mouseleave",JA="mouseover",e4="mouseenter",t4="mousemove",n4="mousedown",r4="mouseup",Yf="pointermove",Xf="pointerdown",Yu="pointerup",Zf="pointercancel",QN="lostpointercapture",Rm="pointerout",Qf="pointerleave",Mm="pointerover",Lm="pointerenter",Lb="contextmenu",o4="touchstart",i4="touchend",s4="touchmove",a4="touchcancel",Db="wheel",JN=5,eB=[[e4,"_pointerenter"],[n4,"_pointerdown"],[t4,"_pointermove"],[r4,"_pointerup"],[QA,"_pointerleave"],[o4,"_pointerdown"],[s4,"_pointermove"],[i4,"_pointerup"],[a4,"_pointercancel"],[JA,"_pointerover"],[Db,"_wheel"],[Lb,"_contextmenu"],[Xf,"_pointerdown"],[Yf,"_pointermove"],[Yu,"_pointerup"],[Zf,"_pointercancel"],[Qf,"_pointerleave"],[QN,"_lostpointercapture"]],Ob={mouse:{[Rm]:ZN,[Qf]:QA,[Mm]:JA,[Lm]:e4,[Yf]:t4,[Xf]:n4,[Yu]:r4,[Zf]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[Rm]:"touchout",[Qf]:"touchleave",[Mm]:"touchover",[Lm]:"touchenter",[Yf]:s4,[Xf]:o4,[Yu]:i4,[Zf]:a4,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[Rm]:Rm,[Qf]:Qf,[Mm]:Mm,[Lm]:Lm,[Yf]:Yf,[Xf]:Xf,[Yu]:Yu,[Zf]:Zf,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Jf=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",Xu=e=>{const t=Jf(e);if(t==="pointer")return _t.pointerEventsEnabled&&Ob.pointer;if(t==="touch")return Ob.touch;if(t==="mouse")return Ob.mouse};function l4(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&Oe.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var tB="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);",eh=[],Dm=class extends Ci{constructor(e){super(l4(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),eh.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{l4(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t=e.getType()==="Layer",n=e.getType()==="FastLayer";t||n||Oe.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===XN){let t;if(e.charAt(0)==="."){const n=e.slice(1);e=document.getElementsByClassName(n)[0]}else e.charAt(0)!=="#"?t=e:t=e.slice(1),e=document.getElementById(t);if(!e)throw"Can not find container in document with id "+t}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const e=this.children,t=e.length;for(let n=0;n<t;n++)e[n].clear();return this}clone(e){return e||(e={}),e.container=typeof document<"u"&&document.createElement("div"),Ci.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&Oe._isInDocument(e)&&this.container().removeChild(e);const t=eh.indexOf(this);return t>-1&&eh.splice(t,1),Oe.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(Oe.warn(tB),null)}_getPointerById(e){return this._pointerPositions.find(t=>t.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();const t=new El({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach(function(o){if(!o.isVisible())return;const i=o._toKonvaCanvas(e);n.drawImage(i._canvas,e.x,e.y,i.getWidth()/i.getPixelRatio(),i.getHeight()/i.getPixelRatio())}),t}getIntersection(e){if(!e)return null;const t=this.children,n=t.length-1;for(let r=n;r>=0;r--){const o=t[r].getIntersection(e);if(o)return o}return null}_resizeDOM(){const e=this.width(),t=this.height();this.content&&(this.content.style.width=e+ZA,this.content.style.height=t+ZA),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach(n=>{n.setSize({width:e,height:t}),n.draw()})}add(e,...t){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.add(arguments[r]);return this}super.add(e);const n=this.children.length;return n>JN&&Oe.warn("The stage has "+n+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),_t.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return YA(e,this)}setPointerCapture(e){XA(e,this)}releaseCapture(e){qf(e,this)}getLayers(){return this.children}_bindContentEvents(){_t.isBrowser&&eB.forEach(([e,t])=>{this.content.addEventListener(e,n=>{this[t](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=Xu(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=Xu(e.type);t&&this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=Xu(e.type),n=Jf(e.type);if(!t)return;this.setPointersPositions(e);const r=this._getTargetShape(n),o=!(_t.isDragging()||_t.isTransforming())||_t.hitOnDragEnabled;r&&o?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):o&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){const t=Xu(e.type),n=Jf(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(o=>{const i=this.getIntersection(o);if(Bn.justDragged=!1,_t["_"+n+"ListenClick"]=!0,!i||!i.isListening()){this[n+"ClickStartShape"]=void 0;return}_t.capturePointerEventsEnabled&&i.setPointerCapture(o.id),this[n+"ClickStartShape"]=i,i._fireAndBubble(t.pointerdown,{evt:e,pointerId:o.id}),r=!0;const s=e.type.indexOf("touch")>=0;i.preventDefault()&&e.cancelable&&s&&e.preventDefault()}),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){const t=Xu(e.type),n=Jf(e.type);if(!t)return;const r=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(_t.isDragging()&&Bn.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(_t.isDragging()||_t.isTransforming())||_t.hitOnDragEnabled))return;const o={};let i=!1;const s=this._getTargetShape(n);this._changedPointerPositions.forEach(a=>{const l=Rb(a.id)||this.getIntersection(a),u=a.id,d={evt:e,pointerId:u},f=s!==l;if(f&&s&&(s._fireAndBubble(t.pointerout,{...d},l),s._fireAndBubble(t.pointerleave,{...d},l)),l){if(o[l._id])return;o[l._id]=!0}l&&l.isListening()?(i=!0,f&&(l._fireAndBubble(t.pointerover,{...d},s),l._fireAndBubble(t.pointerenter,{...d},s),this[n+"targetShape"]=l),l._fireAndBubble(t.pointermove,{...d})):s&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:u}),this[n+"targetShape"]=null)}),i||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=Xu(e.type),n=Jf(e.type);if(!t)return;this.setPointersPositions(e);const r=this[n+"ClickStartShape"],o=this[n+"ClickEndShape"],i={};let s=!1;this._changedPointerPositions.forEach(a=>{const l=Rb(a.id)||this.getIntersection(a);if(l){if(l.releaseCapture(a.id),i[l._id])return;i[l._id]=!0}const u=a.id,d={evt:e,pointerId:u};let f=!1;_t["_"+n+"InDblClickWindow"]?(f=!0,clearTimeout(this[n+"DblTimeout"])):Bn.justDragged||(_t["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){_t["_"+n+"InDblClickWindow"]=!1},_t.dblClickWindow),l&&l.isListening()?(s=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,{...d}),_t["_"+n+"ListenClick"]&&r&&r===l&&(l._fireAndBubble(t.pointerclick,{...d}),f&&o&&o===l&&l._fireAndBubble(t.pointerdblclick,{...d}))):(this[n+"ClickEndShape"]=null,s||(this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),s=!0),_t["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:u}),f&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:u}))}),s||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),_t["_"+n+"ListenClick"]=!1,e.cancelable&&n!=="touch"&&n!=="pointer"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Lb,{evt:e}):this._fire(Lb,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Db,{evt:e}):this._fire(Db,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=Rb(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(Yu,Mb(e)),qf(e.pointerId)}_lostpointercapture(e){qf(e.pointerId)}setPointersPositions(e){const t=this._getContentPosition();let n=null,r=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,o=>{this._pointerPositions.push({id:o.identifier,x:(o.clientX-t.left)/t.scaleX,y:(o.clientY-t.top)/t.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,o=>{this._changedPointerPositions.push({id:o.identifier,x:(o.clientX-t.left)/t.scaleX,y:(o.clientY-t.top)/t.scaleY})})):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:Oe._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:Oe._getFirstPointerId(e)}])}_setPointerPosition(e){Oe.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new El({width:this.width(),height:this.height()}),this.bufferHitCanvas=new Ib({pixelRatio:1,width:this.width(),height:this.height()}),!_t.isBrowser)return;const e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}cache(){return Oe.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}};Dm.prototype.nodeType=YN,_r(Dm),me.addGetterSetter(Dm,"container"),_t.isBrowser&&document.addEventListener("visibilitychange",()=>{eh.forEach(e=>{e.batchDraw()})});var c4="hasShadow",u4="shadowRGBA",d4="patternImage",f4="linearGradient",h4="radialGradient",Om;function Pb(){return Om||(Om=Oe.createCanvasElement().getContext("2d"),Om)}var th={};function nB(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function rB(e){e.stroke()}function oB(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function iB(e){e.stroke()}function sB(){this._clearCache(c4)}function aB(){this._clearCache(u4)}function lB(){this._clearCache(d4)}function cB(){this._clearCache(f4)}function uB(){this._clearCache(h4)}var gt=class extends It{constructor(e){super(e);let t,n=0;for(;t=Oe.getHitColor(),!(t&&!(t in th));)if(n++,n>=1e4){Oe.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."),t=Oe.getRandomColor();break}this.colorKey=t,th[t]=this}getContext(){return Oe.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Oe.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(c4,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(d4,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=Pb().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new hs;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(_t.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),r=typeof DOMMatrix>"u"?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(f4,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=Pb(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),o=t.createLinearGradient(n.x,n.y,r.x,r.y);for(let i=0;i<e.length;i+=2)o.addColorStop(e[i],e[i+1]);return o}}_getRadialGradient(){return this._getCache(h4,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const t=Pb(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),o=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius());for(let i=0;i<e.length;i+=2)o.addColorStop(e[i],e[i+1]);return o}}getShadowRGBA(){return this._getCache(u4,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=Oe.colorToRGBA(this.shadowColor());if(e)return"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){const t=this.getStage();if(!t)return!1;const n=t.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return It.prototype.destroy.call(this),delete th[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(!(!((t=this.attrs.perfectDrawEnabled)!==null&&t!==void 0)||t))return!1;const n=e||this.hasFill(),r=this.hasStroke(),o=this.getAbsoluteOpacity()!==1;if(n&&r&&o)return!0;const i=this.hasShadow(),s=this.shadowForStrokeEnabled();return!!(n&&r&&i&&s)}setStrokeHitEnabled(e){Oe.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}const r=e.skipTransform,o=e.relativeTo||t&&this.getStage()||void 0,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,a=i.width+s,l=i.height+s,u=!e.skipShadow&&this.hasShadow(),d=u?this.shadowOffsetX():0,f=u?this.shadowOffsetY():0,p=a+Math.abs(d),g=l+Math.abs(f),m=u&&this.shadowBlur()||0,v={width:p+m*2,height:g+m*2,x:-(s/2+m)+Math.min(d,0)+i.x,y:-(s/2+m)+Math.min(f,0)+i.y};return r?v:this._transformedRect(v,o)}drawScene(e,t,n){const r=this.getLayer(),o=(e||r.getCanvas()).getContext(),i=this._getCanvasCache(),s=this.getSceneFunc(),a=this.hasShadow();let l;const u=t===this;if(!this.isVisible()&&!u)return this;if(i){o.save();const d=this.getAbsoluteTransform(t).getMatrix();return o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),this._useBufferCanvas()){l=this.getStage();const d=n||l.bufferCanvas,f=d.getContext();n?(f.save(),f.setTransform(1,0,0,1,0,0),f.clearRect(0,0,d.width,d.height),f.restore()):f.clear(),f.save(),f._applyLineJoin(this),f._applyMiterLimit(this);const p=this.getAbsoluteTransform(t).getMatrix();f.transform(p[0],p[1],p[2],p[3],p[4],p[5]),s.call(this,f,this),f.restore();const g=d.pixelRatio;a&&o._applyShadow(this),u||(o._applyOpacity(this),o._applyGlobalCompositeOperation(this)),o.drawImage(d._canvas,d.x||0,d.y||0,d.width/g,d.height/g)}else{if(o._applyLineJoin(this),o._applyMiterLimit(this),!u){const d=this.getAbsoluteTransform(t).getMatrix();o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}a&&o._applyShadow(this),s.call(this,o,this)}return o.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;const r=this.getLayer(),o=e||r.hitCanvas,i=o&&o.getContext(),s=this.hitFunc()||this.sceneFunc(),a=this._getCanvasCache(),l=a&&a.hit;if(this.colorKey||Oe.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){i.save();const u=this.getAbsoluteTransform(t).getMatrix();return i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedHitCanvas(i),i.restore(),this}if(!s)return this;if(i.save(),i._applyLineJoin(this),i._applyMiterLimit(this),this!==t){const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return s.call(this,i,this),i.restore(),this}drawHitFromCache(e=0){const t=this._getCanvasCache(),n=this._getCachedSceneCanvas(),r=t.hit,o=r.getContext(),i=r.getWidth(),s=r.getHeight();o.clear(),o.drawImage(n._canvas,0,0,i,s);try{const a=o.getImageData(0,0,i,s),l=a.data,u=l.length,d=Oe._hexToRgb(this.colorKey);for(let f=0;f<u;f+=4)l[f+3]>e?(l[f]=d.r,l[f+1]=d.g,l[f+2]=d.b,l[f+3]=255):l[f+3]=0;o.putImageData(a,0,0)}catch(a){Oe.error("Unable to draw hit graph from cached scene canvas. "+a.message)}return this}hasPointerCapture(e){return YA(e,this)}setPointerCapture(e){XA(e,this)}releaseCapture(e){qf(e,this)}};gt.prototype._fillFunc=nB,gt.prototype._strokeFunc=rB,gt.prototype._fillFuncHit=oB,gt.prototype._strokeFuncHit=iB,gt.prototype._centroid=!1,gt.prototype.nodeType="Shape",_r(gt),gt.prototype.eventListeners={},gt.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",sB),gt.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",aB),gt.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",lB),gt.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",cB),gt.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",uB),me.addGetterSetter(gt,"stroke",void 0,UA()),me.addGetterSetter(gt,"strokeWidth",2,wt()),me.addGetterSetter(gt,"fillAfterStrokeEnabled",!1),me.addGetterSetter(gt,"hitStrokeWidth","auto",Eb()),me.addGetterSetter(gt,"strokeHitEnabled",!0,ps()),me.addGetterSetter(gt,"perfectDrawEnabled",!0,ps()),me.addGetterSetter(gt,"shadowForStrokeEnabled",!0,ps()),me.addGetterSetter(gt,"lineJoin"),me.addGetterSetter(gt,"lineCap"),me.addGetterSetter(gt,"miterLimit"),me.addGetterSetter(gt,"sceneFunc"),me.addGetterSetter(gt,"hitFunc"),me.addGetterSetter(gt,"dash"),me.addGetterSetter(gt,"dashOffset",0,wt()),me.addGetterSetter(gt,"shadowColor",void 0,Ic()),me.addGetterSetter(gt,"shadowBlur",0,wt()),me.addGetterSetter(gt,"shadowOpacity",1,wt()),me.addComponentsGetterSetter(gt,"shadowOffset",["x","y"]),me.addGetterSetter(gt,"shadowOffsetX",0,wt()),me.addGetterSetter(gt,"shadowOffsetY",0,wt()),me.addGetterSetter(gt,"fillPatternImage"),me.addGetterSetter(gt,"fill",void 0,UA()),me.addGetterSetter(gt,"fillPatternX",0,wt()),me.addGetterSetter(gt,"fillPatternY",0,wt()),me.addGetterSetter(gt,"fillLinearGradientColorStops"),me.addGetterSetter(gt,"strokeLinearGradientColorStops"),me.addGetterSetter(gt,"fillRadialGradientStartRadius",0),me.addGetterSetter(gt,"fillRadialGradientEndRadius",0),me.addGetterSetter(gt,"fillRadialGradientColorStops"),me.addGetterSetter(gt,"fillPatternRepeat","repeat"),me.addGetterSetter(gt,"fillEnabled",!0),me.addGetterSetter(gt,"strokeEnabled",!0),me.addGetterSetter(gt,"shadowEnabled",!0),me.addGetterSetter(gt,"dashEnabled",!0),me.addGetterSetter(gt,"strokeScaleEnabled",!0),me.addGetterSetter(gt,"fillPriority","color"),me.addComponentsGetterSetter(gt,"fillPatternOffset",["x","y"]),me.addGetterSetter(gt,"fillPatternOffsetX",0,wt()),me.addGetterSetter(gt,"fillPatternOffsetY",0,wt()),me.addComponentsGetterSetter(gt,"fillPatternScale",["x","y"]),me.addGetterSetter(gt,"fillPatternScaleX",1,wt()),me.addGetterSetter(gt,"fillPatternScaleY",1,wt()),me.addComponentsGetterSetter(gt,"fillLinearGradientStartPoint",["x","y"]),me.addComponentsGetterSetter(gt,"strokeLinearGradientStartPoint",["x","y"]),me.addGetterSetter(gt,"fillLinearGradientStartPointX",0),me.addGetterSetter(gt,"strokeLinearGradientStartPointX",0),me.addGetterSetter(gt,"fillLinearGradientStartPointY",0),me.addGetterSetter(gt,"strokeLinearGradientStartPointY",0),me.addComponentsGetterSetter(gt,"fillLinearGradientEndPoint",["x","y"]),me.addComponentsGetterSetter(gt,"strokeLinearGradientEndPoint",["x","y"]),me.addGetterSetter(gt,"fillLinearGradientEndPointX",0),me.addGetterSetter(gt,"strokeLinearGradientEndPointX",0),me.addGetterSetter(gt,"fillLinearGradientEndPointY",0),me.addGetterSetter(gt,"strokeLinearGradientEndPointY",0),me.addComponentsGetterSetter(gt,"fillRadialGradientStartPoint",["x","y"]),me.addGetterSetter(gt,"fillRadialGradientStartPointX",0),me.addGetterSetter(gt,"fillRadialGradientStartPointY",0),me.addComponentsGetterSetter(gt,"fillRadialGradientEndPoint",["x","y"]),me.addGetterSetter(gt,"fillRadialGradientEndPointX",0),me.addGetterSetter(gt,"fillRadialGradientEndPointY",0),me.addGetterSetter(gt,"fillPatternRotation",0),me.addGetterSetter(gt,"fillRule",void 0,Ic()),me.backCompat(gt,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var dB="beforeDraw",fB="draw",p4=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],hB=p4.length,Tc=class extends Ci{constructor(e){super(e),this.canvas=new El,this.hitCanvas=new Ib({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){It.prototype.moveToTop.call(this);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!It.prototype.moveUp.call(this))return!1;const e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(It.prototype.moveDown.call(this)){const e=this.getStage();if(e){const t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(It.prototype.moveToBottom.call(this)){const e=this.getStage();if(e){const t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const e=this.getNativeCanvasElement();return It.prototype.remove.call(this),e&&e.parentNode&&Oe._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Oe.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),It.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Oe.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Oe.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Oe.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let t=1,n=!1;for(;;){for(let r=0;r<hB;r++){const o=p4[r],i=this._getIntersection({x:e.x+o.x*t,y:e.y+o.y*t}),s=i.shape;if(s)return s;if(n=!!i.antialiased,!i.antialiased)break}if(n)t+=1;else return null}}_getIntersection(e){const t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(r===255){const o=th[Oe.getHitColorKey(n[0],n[1],n[2])];return o?{shape:o}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas();return this._fire(dB,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),Ci.prototype.drawScene.call(this,o,t,n),this._fire(fB,{node:this}),this}drawHit(e,t){const n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Ci.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Oe.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Oe.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return Oe.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Tc.prototype.nodeType="Layer",_r(Tc),me.addGetterSetter(Tc,"imageSmoothingEnabled",!0),me.addGetterSetter(Tc,"clearBeforeDraw",!0),me.addGetterSetter(Tc,"hitGraphEnabled",!0,ps());var Fb=class extends Tc{constructor(e){super(e),this.listening(!1),Oe.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};Fb.prototype.nodeType="FastLayer",_r(Fb);var Zu=class extends Ci{_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Oe.throw("You may only add groups and shapes to groups.")}};Zu.prototype.nodeType="Group",_r(Zu);var Nb=(function(){return Ac.performance&&Ac.performance.now?function(){return Ac.performance.now()}:function(){return new Date().getTime()}})(),Qu=class Md{constructor(t,n){this.id=Md.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Nb(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){let n=[];return t&&(n=Array.isArray(t)?t:[t]),this.layers=n,this}getLayers(){return this.layers}addLayer(t){const n=this.layers,r=n.length;for(let o=0;o<r;o++)if(n[o]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const t=Md.animations,n=t.length;for(let r=0;r<n;r++)if(t[r].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=Nb(),Md._addAnimation(this),this}stop(){return Md._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const n=t.id,r=this.animations,o=r.length;for(let i=0;i<o;i++)if(r[i].id===n){this.animations.splice(i,1);break}}static _runFrames(){const t={},n=this.animations;for(let r=0;r<n.length;r++){const o=n[r],i=o.layers,s=o.func;o._updateFrameObject(Nb());const a=i.length;let l;if(s?l=s.call(o,o.frame)!==!1:l=!0,!!l)for(let u=0;u<a;u++){const d=i[u];d._id!==void 0&&(t[d._id]=d)}}for(const r in t)t.hasOwnProperty(r)&&t[r].batchDraw()}static _animationLoop(){const t=Md;t.animations.length?(t._runFrames(),Oe.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Oe.requestAnimFrame(this._animationLoop))}};Qu.animations=[],Qu.animIdCounter=0,Qu.animRunning=!1;var pB={node:1,duration:1,easing:1,onFinish:1,yoyo:1},mB=1,m4=2,g4=3,v4=["fill","stroke","shadowColor"],gB=0,vB=class{constructor(e,t,n,r,o,i,s){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=i,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=o-this.begin,this.pause()}fire(e){const t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=m4,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=g4,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const e=this.getTimer()-this._startTime;this.state===m4?this.setTime(e):this.state===g4&&this.setTime(this.duration-e)}pause(){this.state=mB,this.fire("onPause")}getTimer(){return new Date().getTime()}},Pm=class Fr{constructor(t){const n=this,r=t.node,o=r._id,i=t.easing||nh.Linear,s=!!t.yoyo;let a,l;typeof t.duration>"u"?a=.3:t.duration===0?a=.001:a=t.duration,this.node=r,this._id=gB++;const u=r.getLayer()||(r instanceof _t.Stage?r.getLayers():null);u||Oe.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Qu(function(){n.tween.onEnterFrame()},u),this.tween=new vB(l,function(d){n._tweenFunc(d)},i,0,1,a*1e3,s),this._addListeners(),Fr.attrs[o]||(Fr.attrs[o]={}),Fr.attrs[o][this._id]||(Fr.attrs[o][this._id]={}),Fr.tweens[o]||(Fr.tweens[o]={});for(l in t)pB[l]===void 0&&this._addAttr(l,t[l]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,n){const r=this.node,o=r._id;let i,s,a,l,u;const d=Fr.tweens[o][t];d&&delete Fr.attrs[o][d][t];let f=r.getAttr(t);if(Oe._isArray(n))if(i=[],s=Math.max(n.length,f.length),t==="points"&&n.length!==f.length&&(n.length>f.length?(l=f,f=Oe._prepareArrayForTween(f,n,r.closed())):(a=n,n=Oe._prepareArrayForTween(n,f,r.closed()))),t.indexOf("fill")===0)for(let p=0;p<s;p++)if(p%2===0)i.push(n[p]-f[p]);else{const g=Oe.colorToRGBA(f[p]);u=Oe.colorToRGBA(n[p]),f[p]=g,i.push({r:u.r-g.r,g:u.g-g.g,b:u.b-g.b,a:u.a-g.a})}else for(let p=0;p<s;p++)i.push(n[p]-f[p]);else v4.indexOf(t)!==-1?(f=Oe.colorToRGBA(f),u=Oe.colorToRGBA(n),i={r:u.r-f.r,g:u.g-f.g,b:u.b-f.b,a:u.a-f.a}):i=n-f;Fr.attrs[o][this._id][t]={start:f,diff:i,end:n,trueEnd:a,trueStart:l},Fr.tweens[o][t]=this._id}_tweenFunc(t){const n=this.node,r=Fr.attrs[n._id][this._id];let o,i,s,a,l,u,d,f;for(o in r){if(i=r[o],s=i.start,a=i.diff,f=i.end,Oe._isArray(s))if(l=[],d=Math.max(s.length,f.length),o.indexOf("fill")===0)for(u=0;u<d;u++)u%2===0?l.push((s[u]||0)+a[u]*t):l.push("rgba("+Math.round(s[u].r+a[u].r*t)+","+Math.round(s[u].g+a[u].g*t)+","+Math.round(s[u].b+a[u].b*t)+","+(s[u].a+a[u].a*t)+")");else for(u=0;u<d;u++)l.push((s[u]||0)+a[u]*t);else v4.indexOf(o)!==-1?l="rgba("+Math.round(s.r+a.r*t)+","+Math.round(s.g+a.g*t)+","+Math.round(s.b+a.b*t)+","+(s.a+a.a*t)+")":l=s+a*t;n.setAttr(o,l)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const t=this.node,n=Fr.attrs[t._id][this._id];n.points&&n.points.trueEnd&&t.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const t=this.node,n=Fr.attrs[t._id][this._id];n.points&&n.points.trueStart&&t.points(n.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(t*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const t=this.node._id,n=this._id,r=Fr.tweens[t];this.pause(),this.anim&&this.anim.stop();for(const o in r)delete Fr.tweens[t][o];delete Fr.attrs[t][n],Fr.tweens[t]&&(Object.keys(Fr.tweens[t]).length===0&&delete Fr.tweens[t],Object.keys(Fr.attrs[t]).length===0&&delete Fr.attrs[t])}};Pm.attrs={},Pm.tweens={},It.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new Pm(e).play()};var nh={BackEaseIn(e,t,n,r){return n*(e/=r)*e*(2.70158*e-1.70158)+t},BackEaseOut(e,t,n,r){return n*((e=e/r-1)*e*(2.70158*e+1.70158)+1)+t},BackEaseInOut(e,t,n,r){let o=1.70158;return(e/=r/2)<1?n/2*(e*e*(((o*=1.525)+1)*e-o))+t:n/2*((e-=2)*e*(((o*=1.525)+1)*e+o)+2)+t},ElasticEaseIn(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r)===1?t+n:(i||(i=r*.3),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),-(o*Math.pow(2,10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i))+t)},ElasticEaseOut(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r)===1?t+n:(i||(i=r*.3),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),o*Math.pow(2,-10*e)*Math.sin((e*r-s)*(2*Math.PI)/i)+n+t)},ElasticEaseInOut(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r/2)===2?t+n:(i||(i=r*(.3*1.5)),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),e<1?-.5*(o*Math.pow(2,10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i))+t:o*Math.pow(2,-10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i)*.5+n+t)},BounceEaseOut(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},BounceEaseIn(e,t,n,r){return n-nh.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?nh.BounceEaseIn(e*2,0,n,r)*.5+t:nh.BounceEaseOut(e*2-r,0,n,r)*.5+n*.5+t},EaseIn(e,t,n,r){return n*(e/=r)*e+t},EaseOut(e,t,n,r){return-n*(e/=r)*(e-2)+t},EaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},StrongEaseIn(e,t,n,r){return n*(e/=r)*e*e*e*e+t},StrongEaseOut(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t},StrongEaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},Linear(e,t,n,r){return n*e/r+t}},y4=Oe._assign(_t,{Util:Oe,Transform:hs,Node:It,Container:Ci,Stage:Dm,stages:eh,Layer:Tc,FastLayer:Fb,Group:Zu,DD:Bn,Shape:gt,shapes:th,Animation:Qu,Tween:Pm,Easings:nh,Context:Am,Canvas:Ab}),Ba=class extends gt{_sceneFunc(e){const t=_t.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=_t.getAngle(n?360-this.angle():this.angle()),o=Math.cos(Math.min(r,Math.PI)),i=1,s=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),a=Math.sin(Math.min(r,Math.PI/2)),l=o*(o>0?e:t),u=i*t,d=s*(s>0?e:t),f=a*(a>0?t:e);return{x:l,y:n?-1*f:d,width:u-l,height:f-d}}};Ba.prototype._centroid=!0,Ba.prototype.className="Arc",Ba.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],_r(Ba),me.addGetterSetter(Ba,"innerRadius",0,wt()),me.addGetterSetter(Ba,"outerRadius",0,wt()),me.addGetterSetter(Ba,"angle",0,wt()),me.addGetterSetter(Ba,"clockwise",!1,ps());function Bb(e,t,n,r,o,i,s){const a=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(o-n,2)+Math.pow(i-r,2)),u=s*a/(a+l),d=s*l/(a+l);return[n-u*(o-e),r-u*(i-t),n+d*(o-e),r+d*(i-t)]}function b4(e,t){const n=e.length,r=[];for(let o=2;o<n-2;o+=2){const i=Bb(e[o-2],e[o-1],e[o],e[o+1],e[o+2],e[o+3],t);isNaN(i[0])||(r.push(i[0]),r.push(i[1]),r.push(e[o]),r.push(e[o+1]),r.push(i[2]),r.push(i[3]))}return r}function yB(e){const t=[[e[0],e[2],e[4],e[6]],[e[1],e[3],e[5],e[7]]],n=[];for(const r of t){const o=-3*r[0]+9*r[1]-9*r[2]+3*r[3];if(o!==0){const i=6*r[0]-12*r[1]+6*r[2],s=-3*r[0]+3*r[1],a=i*i-4*o*s;if(a>=0){const l=Math.sqrt(a);n.push((-i+l)/(2*o)),n.push((-i-l)/(2*o))}}}return n.filter(r=>r>0&&r<1).flatMap(r=>t.map(o=>{const i=1-r;return i*i*i*o[0]+3*i*i*r*o[1]+3*i*r*r*o[2]+r*r*r*o[3]}))}var za=class extends gt{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){const t=this.points(),n=t.length,r=this.tension(),o=this.closed(),i=this.bezier();if(!n)return;let s=0;if(e.beginPath(),e.moveTo(t[0],t[1]),r!==0&&n>4){const a=this.getTensionPoints(),l=a.length;for(s=o?0:4,o||e.quadraticCurveTo(a[0],a[1],a[2],a[3]);s<l-2;)e.bezierCurveTo(a[s++],a[s++],a[s++],a[s++],a[s++],a[s++]);o||e.quadraticCurveTo(a[l-2],a[l-1],t[n-2],t[n-1])}else if(i)for(s=2;s<n;)e.bezierCurveTo(t[s++],t[s++],t[s++],t[s++],t[s++],t[s++]);else for(s=2;s<n;s+=2)e.lineTo(t[s],t[s+1]);o?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():b4(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),t=e.length,n=this.tension(),r=Bb(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),o=Bb(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),i=b4(e,n);return[r[2],r[3]].concat(i).concat([o[0],o[1],e[t-2],e[t-1],o[2],o[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.bezier()?e=[e[0],e[1],...yB(this.points()),e[e.length-2],e[e.length-1]]:e=this.points();let t=e[0],n=e[0],r=e[1],o=e[1],i,s;for(let a=0;a<e.length/2;a++)i=e[a*2],s=e[a*2+1],t=Math.min(t,i),n=Math.max(n,i),r=Math.min(r,s),o=Math.max(o,s);return{x:t,y:r,width:n-t,height:o-r}}};za.prototype.className="Line",za.prototype._attrsAffectingSize=["points","bezier","tension"],_r(za),me.addGetterSetter(za,"closed",!1),me.addGetterSetter(za,"bezier",!1),me.addGetterSetter(za,"tension",0,wt()),me.addGetterSetter(za,"points",[],ON());var bB=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],wB=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],CB=[[1],[1,1],[1,2,1],[1,3,3,1]],w4=(e,t,n)=>{let r,o;const s=n/2;r=0;for(let a=0;a<20;a++)o=s*bB[20][a]+s,r+=wB[20][a]*kB(e,t,o);return s*r},C4=(e,t,n)=>{n===void 0&&(n=1);const r=e[0]-2*e[1]+e[2],o=t[0]-2*t[1]+t[2],i=2*e[1]-2*e[0],s=2*t[1]-2*t[0],a=4*(r*r+o*o),l=4*(r*i+o*s),u=i*i+s*s;if(a===0)return n*Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(t[2]-t[0],2));const d=l/(2*a),f=u/a,p=n+d,g=f-d*d,m=p*p+g>0?Math.sqrt(p*p+g):0,v=d*d+g>0?Math.sqrt(d*d+g):0,k=d+Math.sqrt(d*d+g)!==0?g*Math.log(Math.abs((p+m)/(d+v))):0;return Math.sqrt(a)/2*(p*m-d*v+k)};function kB(e,t,n){const r=zb(1,n,e),o=zb(1,n,t),i=r*r+o*o;return Math.sqrt(i)}var zb=(e,t,n)=>{const r=n.length-1;let o,i;if(r===0)return 0;if(e===0){i=0;for(let s=0;s<=r;s++)i+=CB[r][s]*Math.pow(1-t,r-s)*Math.pow(t,s)*n[s];return i}else{o=new Array(r);for(let s=0;s<r;s++)o[s]=r*(n[s+1]-n[s]);return zb(e-1,t,o)}},k4=(e,t,n)=>{let r=1,o=e/t,i=(e-n(o))/t,s=0;for(;r>.001;){const a=n(o+i),l=Math.abs(e-a)/t;if(l<r)r=l,o+=i;else{const u=n(o-i),d=Math.abs(e-u)/t;d<r?(r=d,o-=i):i/=2}if(s++,s>500)break}return o},Ui=class mi extends gt{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=mi.parsePathData(this.data()),this.pathLength=mi.getPathLength(this.dataArray)}_sceneFunc(t){const n=this.dataArray;t.beginPath();let r=!1;for(let o=0;o<n.length;o++){const i=n[o].command,s=n[o].points;switch(i){case"L":t.lineTo(s[0],s[1]);break;case"M":t.moveTo(s[0],s[1]);break;case"C":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"Q":t.quadraticCurveTo(s[0],s[1],s[2],s[3]);break;case"A":const a=s[0],l=s[1],u=s[2],d=s[3],f=s[4],p=s[5],g=s[6],m=s[7],v=u>d?u:d,k=u>d?1:u/d,b=u>d?d/u:1;t.translate(a,l),t.rotate(g),t.scale(k,b),t.arc(0,0,v,f,f+p,1-m),t.scale(1/k,1/b),t.rotate(-g),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(l){if(l.command==="A"){const u=l.points[4],d=l.points[5],f=l.points[4]+d;let p=Math.PI/180;if(Math.abs(u-f)<p&&(p=Math.abs(u-f)),d<0)for(let g=u-p;g>f;g-=p){const m=mi.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(m.x,m.y)}else for(let g=u+p;g<f;g+=p){const m=mi.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(m.x,m.y)}}else if(l.command==="C")for(let u=0;u<=1;u+=.01){const d=mi.getPointOnCubicBezier(u,l.start.x,l.start.y,l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]);t.push(d.x,d.y)}else t=t.concat(l.points)});let n=t[0],r=t[0],o=t[1],i=t[1],s,a;for(let l=0;l<t.length/2;l++)s=t[l*2],a=t[l*2+1],isNaN(s)||(n=Math.min(n,s),r=Math.max(r,s)),isNaN(a)||(o=Math.min(o,a),i=Math.max(i,a));return{x:n,y:o,width:r-n,height:i-o}}getLength(){return this.pathLength}getPointAtLength(t){return mi.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,n,r,o){return Math.sqrt((r-t)*(r-t)+(o-n)*(o-n))}static getPathLength(t){let n=0;for(let r=0;r<t.length;++r)n+=t[r].pathLength;return n}static getPointAtLengthOfDataArray(t,n){let r,o=0,i=n.length;if(!i)return null;for(;o<i&&t>n[o].pathLength;)t-=n[o].pathLength,++o;if(o===i)return r=n[o-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return n[o].command==="M"?(r=n[o].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[o].start.x,y:n[o].start.y};const s=n[o],a=s.points;switch(s.command){case"L":return mi.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return mi.getPointOnCubicBezier(k4(t,mi.getPathLength(n),v=>w4([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return mi.getPointOnQuadraticBezier(k4(t,mi.getPathLength(n),v=>C4([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":const l=a[0],u=a[1],d=a[2],f=a[3],p=a[5],g=a[6];let m=a[4];return m+=p*t/s.pathLength,mi.getPointOnEllipticalArc(l,u,d,f,m,g)}return null}static getPointOnLine(t,n,r,o,i,s,a){s=s??n,a=a??r;const l=this.getLineLength(n,r,o,i);if(l<1e-10)return{x:n,y:r};if(o===n)return{x:s,y:a+(i>r?t:-t)};const u=(i-r)/(o-n),d=Math.sqrt(t*t/(1+u*u))*(o<n?-1:1),f=u*d;if(Math.abs(a-r-u*(s-n))<1e-10)return{x:s+d,y:a+f};const p=((s-n)*(o-n)+(a-r)*(i-r))/(l*l),g=n+p*(o-n),m=r+p*(i-r),v=this.getLineLength(s,a,g,m),k=Math.sqrt(t*t-v*v),b=Math.sqrt(k*k/(1+u*u))*(o<n?-1:1),S=u*b;return{x:g+b,y:m+S}}static getPointOnCubicBezier(t,n,r,o,i,s,a,l,u){function d(m){return m*m*m}function f(m){return 3*m*m*(1-m)}function p(m){return 3*m*(1-m)*(1-m)}function g(m){return(1-m)*(1-m)*(1-m)}return{x:l*d(t)+s*f(t)+o*p(t)+n*g(t),y:u*d(t)+a*f(t)+i*p(t)+r*g(t)}}static getPointOnQuadraticBezier(t,n,r,o,i,s,a){function l(f){return f*f}function u(f){return 2*f*(1-f)}function d(f){return(1-f)*(1-f)}return{x:s*l(t)+o*u(t)+n*d(t),y:a*l(t)+i*u(t)+r*d(t)}}static getPointOnEllipticalArc(t,n,r,o,i,s){const a=Math.cos(s),l=Math.sin(s),u={x:r*Math.cos(i),y:o*Math.sin(i)};return{x:t+(u.x*a-u.y*l),y:n+(u.x*l+u.y*a)}}static parsePathData(t){if(!t)return[];let n=t;const r=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let f=0;f<r.length;f++)n=n.replace(new RegExp(r[f],"g"),"|"+r[f]);const o=n.split("|"),i=[],s=[];let a=0,l=0;const u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let d;for(let f=1;f<o.length;f++){let p=o[f],g=p.charAt(0);for(p=p.slice(1),s.length=0;d=u.exec(p);)s.push(d[0]);let m=[],v=g==="A"||g==="a"?0:-1;for(let k=0,b=s.length;k<b;k++){const S=s[k];if(S==="00"){m.push(0,0),v>=0&&(v+=2,v>=7&&(v-=7));continue}if(v>=0){if(v===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(S)){m.push(parseInt(S[0],10)),m.push(parseInt(S[1],10)),m.push(parseFloat(S.slice(2))),v+=3,v>=7&&(v-=7);continue}if(S==="11"||S==="10"||S==="01"){m.push(parseInt(S[0],10)),m.push(parseInt(S[1],10)),v+=2,v>=7&&(v-=7);continue}if(S==="0"||S==="1"){m.push(parseInt(S,10)),v+=1,v>=7&&(v-=7);continue}}else if(v===4){if(/^[01]\d+(?:\.\d+)?$/.test(S)){m.push(parseInt(S[0],10)),m.push(parseFloat(S.slice(1))),v+=2,v>=7&&(v-=7);continue}if(S==="0"||S==="1"){m.push(parseInt(S,10)),v+=1,v>=7&&(v-=7);continue}}const C=parseFloat(S);isNaN(C)?m.push(0):m.push(C),v+=1,v>=7&&(v-=7)}else{const C=parseFloat(S);isNaN(C)?m.push(0):m.push(C)}}for(;m.length>0&&!isNaN(m[0]);){let k="",b=[];const S=a,C=l;let w,T,L,z,W,V,j,Z,R,K;switch(g){case"l":a+=m.shift(),l+=m.shift(),k="L",b.push(a,l);break;case"L":a=m.shift(),l=m.shift(),b.push(a,l);break;case"m":const x=m.shift(),$=m.shift();if(a+=x,l+=$,k="M",i.length>2&&i[i.length-1].command==="z"){for(let H=i.length-2;H>=0;H--)if(i[H].command==="M"){a=i[H].points[0]+x,l=i[H].points[1]+$;break}}b.push(a,l),g="l";break;case"M":a=m.shift(),l=m.shift(),k="M",b.push(a,l),g="L";break;case"h":a+=m.shift(),k="L",b.push(a,l);break;case"H":a=m.shift(),k="L",b.push(a,l);break;case"v":l+=m.shift(),k="L",b.push(a,l);break;case"V":l=m.shift(),k="L",b.push(a,l);break;case"C":b.push(m.shift(),m.shift(),m.shift(),m.shift()),a=m.shift(),l=m.shift(),b.push(a,l);break;case"c":b.push(a+m.shift(),l+m.shift(),a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),k="C",b.push(a,l);break;case"S":T=a,L=l,w=i[i.length-1],w.command==="C"&&(T=a+(a-w.points[2]),L=l+(l-w.points[3])),b.push(T,L,m.shift(),m.shift()),a=m.shift(),l=m.shift(),k="C",b.push(a,l);break;case"s":T=a,L=l,w=i[i.length-1],w.command==="C"&&(T=a+(a-w.points[2]),L=l+(l-w.points[3])),b.push(T,L,a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),k="C",b.push(a,l);break;case"Q":b.push(m.shift(),m.shift()),a=m.shift(),l=m.shift(),b.push(a,l);break;case"q":b.push(a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),k="Q",b.push(a,l);break;case"T":T=a,L=l,w=i[i.length-1],w.command==="Q"&&(T=a+(a-w.points[0]),L=l+(l-w.points[1])),a=m.shift(),l=m.shift(),k="Q",b.push(T,L,a,l);break;case"t":T=a,L=l,w=i[i.length-1],w.command==="Q"&&(T=a+(a-w.points[0]),L=l+(l-w.points[1])),a+=m.shift(),l+=m.shift(),k="Q",b.push(T,L,a,l);break;case"A":z=m.shift(),W=m.shift(),V=m.shift(),j=m.shift(),Z=m.shift(),R=a,K=l,a=m.shift(),l=m.shift(),k="A",b=this.convertEndpointToCenterParameterization(R,K,a,l,j,Z,z,W,V);break;case"a":z=m.shift(),W=m.shift(),V=m.shift(),j=m.shift(),Z=m.shift(),R=a,K=l,a+=m.shift(),l+=m.shift(),k="A",b=this.convertEndpointToCenterParameterization(R,K,a,l,j,Z,z,W,V);break}i.push({command:k||g,points:b,start:{x:S,y:C},pathLength:this.calcLength(S,C,k||g,b)})}(g==="z"||g==="Z")&&i.push({command:"z",points:[],start:void 0,pathLength:0})}return i}static calcLength(t,n,r,o){let i,s,a,l;const u=mi;switch(r){case"L":return u.getLineLength(t,n,o[0],o[1]);case"C":return w4([t,o[0],o[2],o[4]],[n,o[1],o[3],o[5]],1);case"Q":return C4([t,o[0],o[2]],[n,o[1],o[3]],1);case"A":i=0;const d=o[4],f=o[5],p=o[4]+f;let g=Math.PI/180;if(Math.abs(d-p)<g&&(g=Math.abs(d-p)),s=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],d,0),f<0)for(l=d-g;l>p;l-=g)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=d+g;l<p;l+=g)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;return a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],p,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),i}return 0}static convertEndpointToCenterParameterization(t,n,r,o,i,s,a,l,u){const d=u*(Math.PI/180),f=Math.cos(d)*(t-r)/2+Math.sin(d)*(n-o)/2,p=-1*Math.sin(d)*(t-r)/2+Math.cos(d)*(n-o)/2,g=f*f/(a*a)+p*p/(l*l);g>1&&(a*=Math.sqrt(g),l*=Math.sqrt(g));let m=Math.sqrt((a*a*(l*l)-a*a*(p*p)-l*l*(f*f))/(a*a*(p*p)+l*l*(f*f)));i===s&&(m*=-1),isNaN(m)&&(m=0);const v=m*a*p/l,k=m*-l*f/a,b=(t+r)/2+Math.cos(d)*v-Math.sin(d)*k,S=(n+o)/2+Math.sin(d)*v+Math.cos(d)*k,C=function(j){return Math.sqrt(j[0]*j[0]+j[1]*j[1])},w=function(j,Z){return(j[0]*Z[0]+j[1]*Z[1])/(C(j)*C(Z))},T=function(j,Z){return(j[0]*Z[1]<j[1]*Z[0]?-1:1)*Math.acos(w(j,Z))},L=T([1,0],[(f-v)/a,(p-k)/l]),z=[(f-v)/a,(p-k)/l],W=[(-1*f-v)/a,(-1*p-k)/l];let V=T(z,W);return w(z,W)<=-1&&(V=Math.PI),w(z,W)>=1&&(V=0),s===0&&V>0&&(V=V-2*Math.PI),s===1&&V<0&&(V=V+2*Math.PI),[b,S,a,l,L,V,d,s]}};Ui.prototype.className="Path",Ui.prototype._attrsAffectingSize=["data"],_r(Ui),me.addGetterSetter(Ui,"data");var xc=class extends za{_sceneFunc(e){super._sceneFunc(e);const t=Math.PI*2,n=this.points();let r=n;const o=this.tension()!==0&&n.length>4;o&&(r=this.getTensionPoints());const i=this.pointerLength(),s=n.length;let a,l;if(o){const f=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[s-2],n[s-1]],p=Ui.calcLength(r[r.length-4],r[r.length-3],"C",f),g=Ui.getPointOnQuadraticBezier(Math.min(1,1-i/p),f[0],f[1],f[2],f[3],f[4],f[5]);a=n[s-2]-g.x,l=n[s-1]-g.y}else a=n[s-2]-n[s-4],l=n[s-1]-n[s-3];const u=(Math.atan2(l,a)+t)%t,d=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(u),e.moveTo(0,0),e.lineTo(-i,d/2),e.lineTo(-i,-d/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),o?(a=(r[0]+r[2])/2-n[0],l=(r[1]+r[3])/2-n[1]):(a=n[2]-n[0],l=n[3]-n[1]),e.rotate((Math.atan2(-l,-a)+t)%t),e.moveTo(0,0),e.lineTo(-i,d/2),e.lineTo(-i,-d/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x,y:e.y-t,width:e.width,height:e.height+t*2}}};xc.prototype.className="Arrow",_r(xc),me.addGetterSetter(xc,"pointerLength",10,wt()),me.addGetterSetter(xc,"pointerWidth",10,wt()),me.addGetterSetter(xc,"pointerAtBeginning",!1),me.addGetterSetter(xc,"pointerAtEnding",!0);var Ju=class extends gt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}};Ju.prototype._centroid=!0,Ju.prototype.className="Circle",Ju.prototype._attrsAffectingSize=["radius"],_r(Ju),me.addGetterSetter(Ju,"radius",0,wt());var Rl=class extends gt{_sceneFunc(e){const t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}};Rl.prototype.className="Ellipse",Rl.prototype._centroid=!0,Rl.prototype._attrsAffectingSize=["radiusX","radiusY"],_r(Rl),me.addComponentsGetterSetter(Rl,"radius",["x","y"]),me.addGetterSetter(Rl,"radiusX",0,wt()),me.addGetterSetter(Rl,"radiusY",0,wt());var ms=class jE extends gt{constructor(t){super(t),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",n=>{this._removeImageLoad(n.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",this._loadListener)}_removeImageLoad(t){t&&t.removeEventListener&&t.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const t=!!this.cornerRadius(),n=this.hasShadow();return t&&n?!0:super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),o=this.cornerRadius(),i=this.attrs.image;let s;if(i){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?s=[i,this.cropX(),this.cropY(),a,l,0,0,n,r]:s=[i,0,0,n,r]}(this.hasFill()||this.hasStroke()||o)&&(t.beginPath(),o?Oe.drawRoundedRectPath(t,n,r,o):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),i&&(o&&t.clip(),t.drawImage.apply(t,s))}_hitFunc(t){const n=this.width(),r=this.height(),o=this.cornerRadius();t.beginPath(),o?Oe.drawRoundedRectPath(t,n,r,o):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n,r;return(r=(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width)!==null&&r!==void 0?r:0}getHeight(){var t,n,r;return(r=(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height)!==null&&r!==void 0?r:0}static fromURL(t,n,r=null){const o=Oe.createImageElement();o.onload=function(){n(new jE({image:o}))},o.onerror=r,o.crossOrigin="Anonymous",o.src=t}};ms.prototype.className="Image",ms.prototype._attrsAffectingSize=["image"],_r(ms),me.addGetterSetter(ms,"cornerRadius",0,Em(4)),me.addGetterSetter(ms,"image"),me.addComponentsGetterSetter(ms,"crop",["x","y","width","height"]),me.addGetterSetter(ms,"cropX",0,wt()),me.addGetterSetter(ms,"cropY",0,wt()),me.addGetterSetter(ms,"cropWidth",0,wt()),me.addGetterSetter(ms,"cropHeight",0,wt());var S4=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],SB="Change.konva",_B="none",jb="up",Vb="right",Ub="down",Hb="left",AB=S4.length,$b=class extends Zu{constructor(e){super(e),this.on("add.konva",function(t){this._addListeners(t.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let t=this,n;const r=function(){t._sync()};for(n=0;n<AB;n++)e.on(S4[n]+SB,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),t=this.getTag(),n,r,o,i,s,a,l;if(e&&t){switch(n=e.width(),r=e.height(),o=t.pointerDirection(),i=t.pointerWidth(),l=t.pointerHeight(),s=0,a=0,o){case jb:s=n/2,a=-1*l;break;case Vb:s=n+i,a=r/2;break;case Ub:s=n/2,a=r+l;break;case Hb:s=-1*i,a=r/2;break}t.setAttrs({x:-1*s,y:-1*a,width:n,height:r}),e.setAttrs({x:-1*s,y:-1*a})}}};$b.prototype.className="Label",_r($b);var Rc=class extends gt{_sceneFunc(e){const t=this.width(),n=this.height(),r=this.pointerDirection(),o=this.pointerWidth(),i=this.pointerHeight(),s=this.cornerRadius();let a=0,l=0,u=0,d=0;typeof s=="number"?a=l=u=d=Math.min(s,t/2,n/2):(a=Math.min(s[0]||0,t/2,n/2),l=Math.min(s[1]||0,t/2,n/2),d=Math.min(s[2]||0,t/2,n/2),u=Math.min(s[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(a,0),r===jb&&(e.lineTo((t-o)/2,0),e.lineTo(t/2,-1*i),e.lineTo((t+o)/2,0)),e.lineTo(t-l,0),e.arc(t-l,l,l,Math.PI*3/2,0,!1),r===Vb&&(e.lineTo(t,(n-i)/2),e.lineTo(t+o,n/2),e.lineTo(t,(n+i)/2)),e.lineTo(t,n-d),e.arc(t-d,n-d,d,0,Math.PI/2,!1),r===Ub&&(e.lineTo((t+o)/2,n),e.lineTo(t/2,n+i),e.lineTo((t-o)/2,n)),e.lineTo(u,n),e.arc(u,n-u,u,Math.PI/2,Math.PI,!1),r===Hb&&(e.lineTo(0,(n+i)/2),e.lineTo(-1*o,n/2),e.lineTo(0,(n-i)/2)),e.lineTo(0,a),e.arc(a,a,a,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),o=this.pointerDirection(),i=this.width(),s=this.height();return o===jb?(t-=r,s+=r):o===Ub?s+=r:o===Hb?(e-=n*1.5,i+=n):o===Vb&&(i+=n*1.5),{x:e,y:t,width:i,height:s}}};Rc.prototype.className="Tag",_r(Rc),me.addGetterSetter(Rc,"pointerDirection",_B),me.addGetterSetter(Rc,"pointerWidth",0,wt()),me.addGetterSetter(Rc,"pointerHeight",0,wt()),me.addGetterSetter(Rc,"cornerRadius",0,Em(4));var rh=class extends gt{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?Oe.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};rh.prototype.className="Rect",_r(rh),me.addGetterSetter(rh,"cornerRadius",0,Em(4));var Ml=class extends gt{_sceneFunc(e){const t=this._getPoints(),n=this.radius(),r=this.sides(),o=this.cornerRadius();if(e.beginPath(),o)Oe.drawRoundedPolygonPath(e,t,r,n,o);else{e.moveTo(t[0].x,t[0].y);for(let i=1;i<t.length;i++)e.lineTo(t[i].x,t[i].y)}e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(let r=0;r<e;r++)n.push({x:t*Math.sin(r*2*Math.PI/e),y:-1*t*Math.cos(r*2*Math.PI/e)});return n}getSelfRect(){const e=this._getPoints();let t=e[0].x,n=e[0].x,r=e[0].y,o=e[0].y;return e.forEach(i=>{t=Math.min(t,i.x),n=Math.max(n,i.x),r=Math.min(r,i.y),o=Math.max(o,i.y)}),{x:t,y:r,width:n-t,height:o-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};Ml.prototype.className="RegularPolygon",Ml.prototype._centroid=!0,Ml.prototype._attrsAffectingSize=["radius"],_r(Ml),me.addGetterSetter(Ml,"radius",0,wt()),me.addGetterSetter(Ml,"sides",0,wt()),me.addGetterSetter(Ml,"cornerRadius",0,Em(4));var _4=Math.PI*2,Mc=class extends gt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,_4,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),_4,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};Mc.prototype.className="Ring",Mc.prototype._centroid=!0,Mc.prototype._attrsAffectingSize=["innerRadius","outerRadius"],_r(Mc),me.addGetterSetter(Mc,"innerRadius",0,wt()),me.addGetterSetter(Mc,"outerRadius",0,wt());var $s=class extends gt{constructor(e){super(e),this._updated=!0,this.anim=new Qu(()=>{const t=this._updated;return this._updated=!1,t}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+0],a=o[r+1],l=o[r+2],u=o[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,u),e.closePath(),e.fillStrokeShape(this)),d)if(i){const f=i[t],p=n*2;e.drawImage(d,s,a,l,u,f[p+0],f[p+1],l,u)}else e.drawImage(d,s,a,l,u,0,0,l,u)}_hitFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+2],a=o[r+3];if(e.beginPath(),i){const l=i[t],u=n*2;e.rect(l[u+0],l[u+1],s,a)}else e.rect(0,0,s,a);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}};$s.prototype.className="Sprite",_r($s),me.addGetterSetter($s,"animation"),me.addGetterSetter($s,"animations"),me.addGetterSetter($s,"frameOffsets"),me.addGetterSetter($s,"image"),me.addGetterSetter($s,"frameIndex",0,wt()),me.addGetterSetter($s,"frameRate",17,wt()),me.backCompat($s,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Ll=class extends gt{_sceneFunc(e){const t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(let o=1;o<r*2;o++){const i=o%2===0?n:t,s=i*Math.sin(o*Math.PI/r),a=-1*i*Math.cos(o*Math.PI/r);e.lineTo(s,a)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};Ll.prototype.className="Star",Ll.prototype._centroid=!0,Ll.prototype._attrsAffectingSize=["innerRadius","outerRadius"],_r(Ll),me.addGetterSetter(Ll,"numPoints",5,wt()),me.addGetterSetter(Ll,"innerRadius",0,wt()),me.addGetterSetter(Ll,"outerRadius",0,wt());function Dl(e){return[...e].reduce((t,n,r,o)=>{if(/\p{Emoji}/u.test(n)){const i=o[r+1];i&&/\p{Emoji_Modifier}|\u200D/u.test(i)?(t.push(n+i),o[r+1]=""):t.push(n)}else/\p{Regional_Indicator}{2}/u.test(n+(o[r+1]||""))?t.push(n+o[r+1]):r>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(n)?t[t.length-1]+=n:n&&t.push(n);return t},[])}var ed="auto",IB="center",A4="inherit",oh="justify",EB="Change.konva",I4="2d",E4="-",T4="left",TB="text",xB="Text",RB="top",MB="bottom",x4="middle",R4="normal",LB="px ",Fm=" ",DB="right",M4="rtl",OB="word",PB="char",L4="none",Gb="…",D4=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],FB=D4.length,ih=null;function NB(){if(ih!==null)return ih;ih=!1;try{const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext(I4);if(t){t.globalAlpha=0,t.shadowColor="black",t.shadowBlur=5,t.shadowOffsetX=5,t.shadowOffsetY=5,t.fillStyle="black",t.font="10px Arial",t.fillText("X",0,10);const n=t.getImageData(0,0,10,10).data;for(let r=3;r<n.length;r+=4)if(n[r]>0){ih=!0;break}}}catch{}return ih}function BB(e){return e.split(",").map(t=>{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var Nm;function Wb(){return Nm||(Nm=Oe.createCanvasElement().getContext(I4),Nm)}function zB(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function jB(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function VB(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}var ar=class extends gt{constructor(e){super(VB(e)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<FB;t++)this.on(D4[t]+EB,this._setTextData);this._setTextData()}_sceneFunc(e){var t,n;const r=this.textArr,o=r.length;if(!this.text())return;let i=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,l=this.verticalAlign(),u=this.direction(),d=0,f=this.align(),p=this.getWidth(),g=this.letterSpacing(),m=this.charRenderFunc(),v=this.fill(),k=this.textDecoration(),b=this.underlineOffset(),S=k.indexOf("underline")!==-1,C=k.indexOf("line-through")!==-1,w;u=u===A4?e.direction:u;let T=a/2,L=x4;if(!_t.legacyTextRendering){const z=this.measureSize("M");L="alphabetic",T=(((t=z.fontBoundingBoxAscent)!==null&&t!==void 0?t:z.actualBoundingBoxAscent)-((n=z.fontBoundingBoxDescent)!==null&&n!==void 0?n:z.actualBoundingBoxDescent))/2+a/2}for(u===M4&&e.setAttr("direction",u),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",L),e.setAttr("textAlign",T4),l===x4?d=(this.getHeight()-o*a-i*2)/2:l===MB&&(d=this.getHeight()-o*a-i*2),e.translate(i,d+i),w=0;w<o;w++){let z=0,W=0;const V=r[w],j=V.text,Z=V.width,R=V.lastInParagraph;if(e.save(),f===DB?z+=p-Z-i*2:f===IB&&(z+=(p-Z-i*2)/2),S){e.save(),e.beginPath();const x=b??(_t.legacyTextRendering?Math.round(s/2):Math.round(s/4)),$=z,H=T+W+x;e.moveTo($,H);const J=f===oh&&!R?p-i*2:Z;e.lineTo($+Math.round(J),H),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}const K=z;if(u!==M4&&(g!==0||f===oh||m)){const x=j.split(" ").length-1,$=Dl(j);for(let H=0;H<$.length;H++){const J=$[H];if(J===" "&&!R&&f===oh&&(z+=(p-i*2-Z)/x),this._partialTextX=z,this._partialTextY=T+W,this._partialText=J,m){e.save();const Q=r.slice(0,w).reduce((Y,_e)=>Y+Dl(_e.text).length,0);m({char:J,index:H+Q,x:z,y:T+W,lineIndex:w,column:H,isLastInLine:R,width:this.measureSize(J).width,context:e})}e.fillStrokeShape(this),m&&e.restore(),z+=this.measureSize(J).width+g}}else g!==0&&e.setAttr("letterSpacing",`${g}px`),this._partialTextX=z,this._partialTextY=T+W,this._partialText=j,e.fillStrokeShape(this);if(C){e.save(),e.beginPath();const x=_t.legacyTextRendering?0:-Math.round(s/4),$=K;e.moveTo($,T+W+x);const H=f===oh&&!R?p-i*2:Z;e.lineTo($+Math.round(H),T+W+x),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}e.restore(),o>1&&(T+=a)}}_hitFunc(e){const t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){const t=Oe._isString(e)?e:e==null?"":e+"";return this._setAttr(TB,t),this}getWidth(){return this.attrs.width===ed||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===ed||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Oe.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n,r,o,i,s,a,l,u,d,f;let p=Wb(),g=this.fontSize(),m;p.save(),p.font=this._getContextFont(),m=p.measureText(e),p.restore();const v=g/100;return{actualBoundingBoxAscent:(t=m.actualBoundingBoxAscent)!==null&&t!==void 0?t:71.58203125*v,actualBoundingBoxDescent:(n=m.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(r=m.actualBoundingBoxLeft)!==null&&r!==void 0?r:-7.421875*v,actualBoundingBoxRight:(o=m.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*v,alphabeticBaseline:(i=m.alphabeticBaseline)!==null&&i!==void 0?i:0,emHeightAscent:(s=m.emHeightAscent)!==null&&s!==void 0?s:100*v,emHeightDescent:(a=m.emHeightDescent)!==null&&a!==void 0?a:-20*v,fontBoundingBoxAscent:(l=m.fontBoundingBoxAscent)!==null&&l!==void 0?l:91*v,fontBoundingBoxDescent:(u=m.fontBoundingBoxDescent)!==null&&u!==void 0?u:21*v,hangingBaseline:(d=m.hangingBaseline)!==null&&d!==void 0?d:72.80000305175781*v,ideographicBaseline:(f=m.ideographicBaseline)!==null&&f!==void 0?f:-21*v,width:m.width,height:g}}_getContextFont(){return this.fontStyle()+Fm+this.fontVariant()+Fm+(this.fontSize()+LB)+BB(this.fontFamily())}_addTextLine(e){this.align()===oh&&(e=e.trim());const t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){const t=this.letterSpacing(),n=e.length;return Wb().measureText(e).width+t*n}_setTextData(){let e=this.text().split(`
|
|
100
100
|
`),t=+this.fontSize(),n=0,r=this.lineHeight()*t,o=this.attrs.width,i=this.attrs.height,s=o!==ed&&o!==void 0,a=i!==ed&&i!==void 0,l=this.padding(),u=o-l*2,d=i-l*2,f=0,p=this.wrap(),g=p!==PB&&p!==L4,m=this.ellipsis();this.textArr=[],Wb().font=this._getContextFont();const v=m?this._getTextWidth(Gb):0;for(let k=0,b=e.length;k<b;++k){let S=e[k],C=this._getTextWidth(S);if(s&&C>u)for(;S.length>0;){let w=0,T=Dl(S).length,L="",z=0;for(;w<T;){const W=w+T>>>1,V=Dl(S).slice(0,W+1).join(""),j=this._getTextWidth(V);(m&&a&&f+r>d?j+v:j)<=u?(w=W+1,L=V,z=j):T=W}if(L){if(g){const W=Dl(S),V=Dl(L),j=W[V.length],Z=j===Fm||j===E4;let R;if(Z&&z<=u)R=V.length;else{const K=V.lastIndexOf(Fm),x=V.lastIndexOf(E4);R=Math.max(K,x)+1}R>0&&(w=R,L=W.slice(0,w).join(""),z=this._getTextWidth(L))}if(L=L.trimRight(),this._addTextLine(L),n=Math.max(n,z),f+=r,this._shouldHandleEllipsis(f)){this._tryToAddEllipsisToLastLine();break}if(S=Dl(S).slice(w).join("").trimLeft(),S.length>0&&(C=this._getTextWidth(S),C<=u)){this._addTextLine(S),f+=r,n=Math.max(n,C);break}}else break}else this._addTextLine(S),f+=r,n=Math.max(n,C),this._shouldHandleEllipsis(f)&&k<b-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),a&&f+r>d)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){const t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,o=r!==ed&&r!==void 0,i=r-this.padding()*2;return this.wrap()===L4||o&&e+n>i}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==ed&&e!==void 0,n=e-this.padding()*2,r=this.ellipsis(),o=this.textArr[this.textArr.length-1];!o||!r||(t&&(this._getTextWidth(o.text+Gb)<n||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+Gb))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,t=this.hasShadow();return e&&t||t&&this.getAbsoluteOpacity()!==1&&NB()?!0:super._useBufferCanvas()}};ar.prototype._fillFunc=zB,ar.prototype._strokeFunc=jB,ar.prototype.className=xB,ar.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],_r(ar),me.overWriteSetter(ar,"width",Eb()),me.overWriteSetter(ar,"height",Eb()),me.addGetterSetter(ar,"direction",A4),me.addGetterSetter(ar,"fontFamily","Arial"),me.addGetterSetter(ar,"fontSize",12,wt()),me.addGetterSetter(ar,"fontStyle",R4),me.addGetterSetter(ar,"fontVariant",R4),me.addGetterSetter(ar,"padding",0,wt()),me.addGetterSetter(ar,"align",T4),me.addGetterSetter(ar,"verticalAlign",RB),me.addGetterSetter(ar,"lineHeight",1,wt()),me.addGetterSetter(ar,"wrap",OB),me.addGetterSetter(ar,"ellipsis",!1,ps()),me.addGetterSetter(ar,"letterSpacing",0,wt()),me.addGetterSetter(ar,"text","",Ic()),me.addGetterSetter(ar,"textDecoration",""),me.addGetterSetter(ar,"underlineOffset",void 0,wt()),me.addGetterSetter(ar,"charRenderFunc",void 0);var UB="",O4="normal";function P4(e){e.fillText(this.partialText,0,0)}function F4(e){e.strokeText(this.partialText,0,0)}var ro=class extends gt{constructor(e){super(e),this.dummyCanvas=Oe.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return Ui.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:Ui.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Ui.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();const t=this.textDecoration(),n=this.fill(),r=this.fontSize(),o=this.glyphInfo,i=t.indexOf("underline")!==-1,s=t.indexOf("line-through")!==-1;i&&e.beginPath();for(let a=0;a<o.length;a++){e.save();const l=o[a].p0;e.translate(l.x,l.y),e.rotate(o[a].rotation),this.partialText=o[a].text,e.fillStrokeShape(this),i&&(a===0&&e.moveTo(0,r/2+1),e.lineTo(o[a].width,r/2+1)),e.restore()}if(i&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),s){e.beginPath();for(let a=0;a<o.length;a++){e.save();const l=o[a].p0;e.translate(l.x,l.y),e.rotate(o[a].rotation),a===0&&e.moveTo(0,0),e.lineTo(o[a].width,0),e.restore()}e.strokeStyle=n,e.lineWidth=r/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();const t=this.glyphInfo;if(t.length>=1){const n=t[0].p0;e.moveTo(n.x,n.y)}for(let n=0;n<t.length;n++){const r=t[n].p1;e.lineTo(r.x,r.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return Oe.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return ar.prototype.setText.call(this,e)}_getContextFont(){return ar.prototype._getContextFont.call(this)}_getTextSize(e){const t=this.dummyCanvas.getContext("2d");t.save(),t.font=this._getContextFont();const n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const e=Dl(this.text()),t=[];let n=0;for(let p=0;p<e.length;p++)t.push({char:e[p],width:this._getTextSize(e[p]).width}),n+=t[p].width;const{width:r,height:o}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=o,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),s=this.align(),a=this.kerningFunc(),l=Math.max(0,n-r),u=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let d=0;s==="center"&&(d=Math.max(0,this.pathLength/2-u/2)),s==="right"&&(d=Math.max(0,this.pathLength-u));let f=d;for(let p=0;p<t.length;p++){const g=this._getPointAtLength(f);if(!g)return;const m=t[p].char;let v=t[p].width+i;if(m===" "&&s==="justify"){const L=this.text().split(" ").length-1;v+=(this.pathLength-u)/L}const k=f+v,b=this._getPointAtLength(k>this.pathLength&&k-this.pathLength<=l?this.pathLength:k);if(!b)return;const S=Ui.getLineLength(g.x,g.y,b.x,b.y);let C=0;if(a)try{C=a(t[p-1].char,m)*this.fontSize()}catch{C=0}g.x+=C,b.x+=C,this.textWidth+=C;const w=Ui.getPointOnLine(C+S/2,g.x,g.y,b.x,b.y),T=Math.atan2(b.y-g.y,b.x-g.x);this.glyphInfo.push({transposeX:w.x,transposeY:w.y,text:e[p],rotation:T,p0:g,p1:b,width:S}),f+=v}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(l){e.push(l.p0.x),e.push(l.p0.y),e.push(l.p1.x),e.push(l.p1.y)});let t=e[0]||0,n=e[0]||0,r=e[1]||0,o=e[1]||0,i,s;for(let l=0;l<e.length/2;l++)i=e[l*2],s=e[l*2+1],t=Math.min(t,i),n=Math.max(n,i),r=Math.min(r,s),o=Math.max(o,s);const a=this.fontSize();return{x:t-a/2,y:r-a/2,width:n-t+a,height:o-r+a}}destroy(){return Oe.releaseCanvas(this.dummyCanvas),super.destroy()}};ro.prototype._fillFunc=P4,ro.prototype._strokeFunc=F4,ro.prototype._fillFuncHit=P4,ro.prototype._strokeFuncHit=F4,ro.prototype.className="TextPath",ro.prototype._attrsAffectingSize=["text","fontSize","data"],_r(ro),me.addGetterSetter(ro,"data"),me.addGetterSetter(ro,"fontFamily","Arial"),me.addGetterSetter(ro,"fontSize",12,wt()),me.addGetterSetter(ro,"fontStyle",O4),me.addGetterSetter(ro,"align","left"),me.addGetterSetter(ro,"letterSpacing",0,wt()),me.addGetterSetter(ro,"textBaseline","middle"),me.addGetterSetter(ro,"fontVariant",O4),me.addGetterSetter(ro,"text",UB),me.addGetterSetter(ro,"textDecoration",""),me.addGetterSetter(ro,"kerningFunc",void 0);var N4="tr-konva",HB=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(e=>e+`.${N4}`).join(" "),B4="nodesRect",$B=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],GB={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},WB="ontouchstart"in _t._global;function KB(e,t,n){if(e==="rotater")return n;t+=Oe.degToRad(GB[e]||0);const r=(Oe.radToDeg(t)%360+360)%360;return Oe._inRange(r,337.5,360)||Oe._inRange(r,0,22.5)?"ns-resize":Oe._inRange(r,22.5,67.5)?"nesw-resize":Oe._inRange(r,67.5,112.5)?"ew-resize":Oe._inRange(r,112.5,157.5)?"nwse-resize":Oe._inRange(r,157.5,202.5)?"ns-resize":Oe._inRange(r,202.5,247.5)?"nesw-resize":Oe._inRange(r,247.5,292.5)?"ew-resize":Oe._inRange(r,292.5,337.5)?"nwse-resize":(Oe.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var Bm=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function qB(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function z4(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),o=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return{...e,rotation:e.rotation+t,x:r,y:o}}function YB(e,t){return z4(e,t,qB(e))}function XB(e,t,n){let r=t;for(let o=0;o<e.length;o++){const i=_t.getAngle(e[o]),s=Math.abs(i-t)%(Math.PI*2);Math.min(s,Math.PI*2-s)<n&&(r=i)}return r}var Kb=0,On=class extends Zu{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._elementsCreated=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(HB,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Oe.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return N4+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const t=e.filter(n=>n.isAncestorOf(this)?(Oe.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=e=t,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(n=>{const r=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(n._attrsAffectingSize.length){const o=n._attrsAffectingSize.map(i=>i+"Change."+this._getEventNamespace()).join(" ");n.on(o,r)}n.on($B.map(o=>o+`.${this._getEventNamespace()}`).join(" "),r),n.on(`absoluteTransformChange.${this._getEventNamespace()}`,r),this._proxyDrag(n)}),this._resetTransformCache(),this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,n=>{t=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(n,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!t)return;const r=e.getAbsolutePosition(),o=r.x-t.x,i=r.y-t.y;this.nodes().forEach(s=>{if(s===e||s.isDragging())return;const a=s.getAbsolutePosition();s.setAbsolutePosition({x:a.x+o,y:a.y+i}),s.startDrag(n)}),t=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(B4),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(B4,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){const r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=e.getAbsoluteScale(n),i=e.getAbsolutePosition(n),s=r.x*o.x-e.offsetX()*o.x,a=r.y*o.y-e.offsetY()*o.y,l=(_t.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return z4({x:i.x+s*Math.cos(l)+a*Math.sin(-l),y:i.y+a*Math.cos(l)+s*Math.sin(l),width:r.width*o.x,height:r.height*o.y,rotation:l},-_t.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const e=[];this.nodes().map(a=>{const l=a.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),u=[{x:l.x,y:l.y},{x:l.x+l.width,y:l.y},{x:l.x+l.width,y:l.y+l.height},{x:l.x,y:l.y+l.height}],d=a.getAbsoluteTransform();u.forEach(function(f){const p=d.point(f);e.push(p)})});const t=new hs;t.rotate(-_t.getAngle(this.rotation()));let n=1/0,r=1/0,o=-1/0,i=-1/0;e.forEach(function(a){const l=t.point(a);n===void 0&&(n=o=l.x,r=i=l.y),n=Math.min(n,l.x),r=Math.min(r,l.y),o=Math.max(o,l.x),i=Math.max(i,l.y)}),t.invert();const s=t.point({x:n,y:r});return{x:s.x,y:s.y,width:o-n,height:i-r,rotation:_t.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),Bm.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){const t=new rh({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:WB?10:"auto"}),n=this;t.on("mousedown touchstart",function(r){n._handleMouseDown(r)}),t.on("dragstart",r=>{t.stopDrag(),r.cancelBubble=!0}),t.on("dragend",r=>{r.cancelBubble=!0}),t.on("mouseenter",()=>{const r=KB(e,_t.getAngle(this.rotation()),this.rotateAnchorCursor());t.getStage().content&&(t.getStage().content.style.cursor=r),this._cursorChange=!0}),t.on("mouseout",()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(t)}_createBack(){const e=new gt({name:"back",width:0,height:0,sceneFunc(t,n){const r=n.getParent(),o=r.padding(),i=n.width(),s=n.height();if(t.beginPath(),t.rect(-o,-o,i+o*2,s+o*2),r.rotateEnabled()&&r.rotateLineVisible()){const a=r.rotateAnchorAngle(),l=r.rotateAnchorOffset(),u=Oe.degToRad(a),d=Math.sin(u),f=-Math.cos(u),p=i/2,g=s/2;let m=1/0;f<0?m=Math.min(m,-g/f):f>0&&(m=Math.min(m,(s-g)/f)),d<0?m=Math.min(m,-p/d):d>0&&(m=Math.min(m,(i-p)/d));const v=p+d*m,k=g+f*m,b=Oe._sign(s),S=v+d*l*b,C=k+f*l*b;t.moveTo(v,k),t.lineTo(S,C)}t.fillStrokeShape(n)},hitFunc:(t,n)=>{if(!this.shouldOverdrawWholeArea())return;const r=this.padding();t.beginPath(),t.rect(-r,-r,n.width()+r*2,n.height()+r*2),t.fillStrokeShape(n)}});this.add(e),this._proxyDrag(e),e.on("dragstart",t=>{t.cancelBubble=!0}),e.on("dragmove",t=>{t.cancelBubble=!0}),e.on("dragend",t=>{t.cancelBubble=!0}),this.on("dragmove",t=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const t=this._getNodeRect(),n=t.width,r=t.height,o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/o),this.cos=Math.abs(n/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const i=e.target.getAbsolutePosition(),s=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-i.x,y:s.y-i.y},Kb++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(a=>{a._fire("transformstart",{evt:e.evt,target:a})})}_handleMouseMove(e){let t,n,r;const o=this.findOne("."+this._movingAnchorName),i=o.getStage();i.setPointersPositions(e);const s=i.getPointerPosition();let a={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const l=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(a=this.anchorDragBoundFunc()(l,a,e)),o.setAbsolutePosition(a);const u=o.getAbsolutePosition();if(l.x===u.x&&l.y===u.y)return;if(this._movingAnchorName==="rotater"){const b=this._getNodeRect();t=o.x()-b.width/2,n=-o.y()+b.height/2;const S=_t.getAngle(this.rotateAnchorAngle());let C=Math.atan2(-n,t)+Math.PI/2-S;b.height<0&&(C-=Math.PI);const w=_t.getAngle(this.rotation())+C,T=_t.getAngle(this.rotationSnapTolerance()),L=YB(b,XB(this.rotationSnaps(),w,T)-b.rotation);this._fitNodesInto(L,e);return}const d=this.shiftBehavior();let f;d==="inverted"?f=this.keepRatio()&&!e.shiftKey:d==="none"?f=this.keepRatio():f=this.keepRatio()||e.shiftKey;let p=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(f){const b=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(b.x-o.x(),2)+Math.pow(b.y-o.y(),2));const S=this.findOne(".top-left").x()>b.x?-1:1,C=this.findOne(".top-left").y()>b.y?-1:1;t=r*this.cos*S,n=r*this.sin*C,this.findOne(".top-left").x(b.x-t),this.findOne(".top-left").y(b.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(f){const b=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(o.x()-b.x,2)+Math.pow(b.y-o.y(),2));const S=this.findOne(".top-right").x()<b.x?-1:1,C=this.findOne(".top-right").y()>b.y?-1:1;t=r*this.cos*S,n=r*this.sin*C,this.findOne(".top-right").x(b.x+t),this.findOne(".top-right").y(b.y-n)}var g=o.position();this.findOne(".top-left").y(g.y),this.findOne(".bottom-right").x(g.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(f){const b=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(b.x-o.x(),2)+Math.pow(o.y()-b.y,2));const S=b.x<o.x()?-1:1,C=o.y()<b.y?-1:1;t=r*this.cos*S,n=r*this.sin*C,o.x(b.x-t),o.y(b.y+n)}g=o.position(),this.findOne(".top-left").x(g.x),this.findOne(".bottom-right").y(g.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(o.y());else if(this._movingAnchorName==="bottom-right"){if(f){const b=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(o.x()-b.x,2)+Math.pow(o.y()-b.y,2));const S=this.findOne(".bottom-right").x()<b.x?-1:1,C=this.findOne(".bottom-right").y()<b.y?-1:1;t=r*this.cos*S,n=r*this.sin*C,this.findOne(".bottom-right").x(b.x+t),this.findOne(".bottom-right").y(b.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(p=this.centeredScaling()||e.altKey,p){const b=this.findOne(".top-left"),S=this.findOne(".bottom-right"),C=b.x(),w=b.y(),T=this.getWidth()-S.x(),L=this.getHeight()-S.y();S.move({x:-C,y:-w}),b.move({x:T,y:L})}const m=this.findOne(".top-left").getAbsolutePosition();t=m.x,n=m.y;const v=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),k=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:v,height:k,rotation:_t.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var t;if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const n=this.getNode();Kb--,this._fire("transformend",{evt:e,target:n}),(t=this.getLayer())===null||t===void 0||t.batchDraw(),n&&this._nodes.forEach(r=>{var o;r._fire("transformend",{evt:e,target:r}),(o=r.getLayer())===null||o===void 0||o.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,t){const n=this._getNodeRect(),r=1;if(Oe._inRange(e.width,-this.padding()*2-r,r)){this.update();return}if(Oe._inRange(e.height,-this.padding()*2-r,r)){this.update();return}const o=new hs;if(o.rotate(_t.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const f=o.point({x:-this.padding()*2,y:0});e.x+=f.x,e.y+=f.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const f=o.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const f=o.point({x:0,y:-this.padding()*2});e.x+=f.x,e.y+=f.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const f=o.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const f=this.boundBoxFunc()(n,e);f?e=f:Oe.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,s=new hs;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/i,n.height/i);const a=new hs,l=e.width/i,u=e.height/i;this.flipEnabled()===!1?(a.translate(e.x,e.y),a.rotate(e.rotation),a.translate(e.width<0?e.width:0,e.height<0?e.height:0),a.scale(Math.abs(l),Math.abs(u))):(a.translate(e.x,e.y),a.rotate(e.rotation),a.scale(l,u));const d=a.multiply(s.invert());this._nodes.forEach(f=>{var p;if(!f.getStage())return;const g=f.getParent().getAbsoluteTransform(),m=f.getTransform().copy();m.translate(f.offsetX(),f.offsetY());const v=new hs;v.multiply(g.copy().invert()).multiply(d).multiply(g).multiply(m);const k=v.decompose();f.setAttrs(k),(p=f.getLayer())===null||p===void 0||p.batchDraw()}),this.rotation(Oe._getRotation(e.rotation)),this._nodes.forEach(f=>{this._fire("transform",{evt:t,target:f}),f._fire("transform",{evt:t,target:f})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e;const t=this._getNodeRect();this.rotation(Oe._getRotation(t.rotation));const n=t.width,r=t.height,o=this.enabledAnchors(),i=this.resizeEnabled(),s=this.padding(),a=this.anchorSize(),l=this.find("._anchor");l.forEach(T=>{T.setAttrs({width:a,height:a,offsetX:a/2,offsetY:a/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:a/2+s,offsetY:a/2+s,visible:i&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:a/2+s,visible:i&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:a/2-s,offsetY:a/2+s,visible:i&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:a/2+s,visible:i&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:a/2-s,visible:i&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:a/2+s,offsetY:a/2-s,visible:i&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:a/2-s,visible:i&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:a/2-s,offsetY:a/2-s,visible:i&&o.indexOf("bottom-right")>=0});const u=this.rotateAnchorAngle(),d=this.rotateAnchorOffset(),f=Oe.degToRad(u),p=Math.sin(f),g=-Math.cos(f),m=n/2,v=r/2;let k=1/0;g<0?k=Math.min(k,-v/g):g>0&&(k=Math.min(k,(r-v)/g)),p<0?k=Math.min(k,-m/p):p>0&&(k=Math.min(k,(n-m)/p));const b=m+p*k,S=v+g*k,C=Oe._sign(r);this._batchChangeChild(".rotater",{x:b+p*d*C,y:S+g*d*C-s*g,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(T=>T.draggable()),x:0,y:0});const w=this.anchorStyleFunc();w&&l.forEach(T=>{w(T)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Zu.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(Oe.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this):super.add(...e)}toObject(){return It.prototype.toObject.call(this)}clone(e){return It.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};On.isTransforming=()=>Kb>0;function ZB(e){return e instanceof Array||Oe.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){Bm.indexOf(t)===-1&&Oe.warn("Unknown anchor name: "+t+". Available names are: "+Bm.join(", "))}),e||[]}On.prototype.className="Transformer",_r(On),me.addGetterSetter(On,"enabledAnchors",Bm,ZB),me.addGetterSetter(On,"flipEnabled",!0,ps()),me.addGetterSetter(On,"resizeEnabled",!0),me.addGetterSetter(On,"anchorSize",10,wt()),me.addGetterSetter(On,"rotateEnabled",!0),me.addGetterSetter(On,"rotateLineVisible",!0),me.addGetterSetter(On,"rotationSnaps",[]),me.addGetterSetter(On,"rotateAnchorOffset",50,wt()),me.addGetterSetter(On,"rotateAnchorAngle",0,wt()),me.addGetterSetter(On,"rotateAnchorCursor","crosshair"),me.addGetterSetter(On,"rotationSnapTolerance",5,wt()),me.addGetterSetter(On,"borderEnabled",!0),me.addGetterSetter(On,"anchorStroke","rgb(0, 161, 255)"),me.addGetterSetter(On,"anchorStrokeWidth",1,wt()),me.addGetterSetter(On,"anchorFill","white"),me.addGetterSetter(On,"anchorCornerRadius",0,wt()),me.addGetterSetter(On,"borderStroke","rgb(0, 161, 255)"),me.addGetterSetter(On,"borderStrokeWidth",1,wt()),me.addGetterSetter(On,"borderDash"),me.addGetterSetter(On,"keepRatio",!0),me.addGetterSetter(On,"shiftBehavior","default"),me.addGetterSetter(On,"centeredScaling",!1),me.addGetterSetter(On,"ignoreStroke",!1),me.addGetterSetter(On,"padding",0,wt()),me.addGetterSetter(On,"nodes"),me.addGetterSetter(On,"node"),me.addGetterSetter(On,"boundBoxFunc"),me.addGetterSetter(On,"anchorDragBoundFunc"),me.addGetterSetter(On,"anchorStyleFunc"),me.addGetterSetter(On,"shouldOverdrawWholeArea",!1),me.addGetterSetter(On,"useSingleNodeRotation",!0),me.backCompat(On,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var ja=class extends gt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,_t.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};ja.prototype.className="Wedge",ja.prototype._centroid=!0,ja.prototype._attrsAffectingSize=["radius"],_r(ja),me.addGetterSetter(ja,"radius",0,wt()),me.addGetterSetter(ja,"angle",0,wt()),me.addGetterSetter(ja,"clockwise",!1),me.backCompat(ja,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function j4(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var QB=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],JB=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function ez(e,t){const n=e.data,r=e.width,o=e.height;let i,s,a,l,u,d,f,p,g,m,v,k,b,S,C,w,T,L,z,W;const V=t+t+1,j=r-1,Z=o-1,R=t+1,K=R*(R+1)/2,x=new j4,$=QB[t],H=JB[t];let J=null,Q=x,Y=null,_e=null;for(let ue=1;ue<V;ue++)Q=Q.next=new j4,ue===R&&(J=Q);Q.next=x,a=s=0;for(let ue=0;ue<o;ue++){k=b=S=C=l=u=d=f=0,p=R*(w=n[s]),g=R*(T=n[s+1]),m=R*(L=n[s+2]),v=R*(z=n[s+3]),l+=K*w,u+=K*T,d+=K*L,f+=K*z,Q=x;for(let ve=0;ve<R;ve++)Q.r=w,Q.g=T,Q.b=L,Q.a=z,Q=Q.next;for(let ve=1;ve<R;ve++)i=s+((j<ve?j:ve)<<2),l+=(Q.r=w=n[i])*(W=R-ve),u+=(Q.g=T=n[i+1])*W,d+=(Q.b=L=n[i+2])*W,f+=(Q.a=z=n[i+3])*W,k+=w,b+=T,S+=L,C+=z,Q=Q.next;Y=x,_e=J;for(let ve=0;ve<r;ve++)n[s+3]=z=f*$>>H,z!==0?(z=255/z,n[s]=(l*$>>H)*z,n[s+1]=(u*$>>H)*z,n[s+2]=(d*$>>H)*z):n[s]=n[s+1]=n[s+2]=0,l-=p,u-=g,d-=m,f-=v,p-=Y.r,g-=Y.g,m-=Y.b,v-=Y.a,i=a+((i=ve+t+1)<j?i:j)<<2,k+=Y.r=n[i],b+=Y.g=n[i+1],S+=Y.b=n[i+2],C+=Y.a=n[i+3],l+=k,u+=b,d+=S,f+=C,Y=Y.next,p+=w=_e.r,g+=T=_e.g,m+=L=_e.b,v+=z=_e.a,k-=w,b-=T,S-=L,C-=z,_e=_e.next,s+=4;a+=r}for(let ue=0;ue<r;ue++){b=S=C=k=u=d=f=l=0,s=ue<<2,p=R*(w=n[s]),g=R*(T=n[s+1]),m=R*(L=n[s+2]),v=R*(z=n[s+3]),l+=K*w,u+=K*T,d+=K*L,f+=K*z,Q=x;for(let ge=0;ge<R;ge++)Q.r=w,Q.g=T,Q.b=L,Q.a=z,Q=Q.next;let ve=r;for(let ge=1;ge<=t;ge++)s=ve+ue<<2,l+=(Q.r=w=n[s])*(W=R-ge),u+=(Q.g=T=n[s+1])*W,d+=(Q.b=L=n[s+2])*W,f+=(Q.a=z=n[s+3])*W,k+=w,b+=T,S+=L,C+=z,Q=Q.next,ge<Z&&(ve+=r);s=ue,Y=x,_e=J;for(let ge=0;ge<o;ge++)i=s<<2,n[i+3]=z=f*$>>H,z>0?(z=255/z,n[i]=(l*$>>H)*z,n[i+1]=(u*$>>H)*z,n[i+2]=(d*$>>H)*z):n[i]=n[i+1]=n[i+2]=0,l-=p,u-=g,d-=m,f-=v,p-=Y.r,g-=Y.g,m-=Y.b,v-=Y.a,i=ue+((i=ge+R)<Z?i:Z)*r<<2,l+=k+=Y.r=n[i],u+=b+=Y.g=n[i+1],d+=S+=Y.b=n[i+2],f+=C+=Y.a=n[i+3],Y=Y.next,p+=w=_e.r,g+=T=_e.g,m+=L=_e.b,v+=z=_e.a,k-=w,b-=T,S-=L,C-=z,_e=_e.next,s+=r}}var tz=function(t){const n=Math.round(this.blurRadius());n>0&&ez(t,n)};me.addGetterSetter(It,"blurRadius",0,wt(),me.afterSetFilter);var nz=function(e){const t=this.brightness()*255,n=e.data,r=n.length;for(let o=0;o<r;o+=4)n[o]+=t,n[o+1]+=t,n[o+2]+=t};me.addGetterSetter(It,"brightness",0,wt(),me.afterSetFilter);var rz=function(e){const t=this.brightness(),n=e.data,r=n.length;for(let o=0;o<r;o+=4)n[o]=Math.min(255,n[o]*t),n[o+1]=Math.min(255,n[o+1]*t),n[o+2]=Math.min(255,n[o+2]*t)},oz=function(e){const t=Math.pow((this.contrast()+100)/100,2),n=e.data,r=n.length;let o=150,i=150,s=150;for(let a=0;a<r;a+=4)o=n[a],i=n[a+1],s=n[a+2],o/=255,o-=.5,o*=t,o+=.5,o*=255,i/=255,i-=.5,i*=t,i+=.5,i*=255,s/=255,s-=.5,s*=t,s+=.5,s*=255,o=o<0?0:o>255?255:o,i=i<0?0:i>255?255:i,s=s<0?0:s>255?255:s,n[a]=o,n[a+1]=i,n[a+2]=s};me.addGetterSetter(It,"contrast",0,wt(),me.afterSetFilter);var iz=function(e){var t,n,r,o,i,s,a,l,u;const d=e.data,f=e.width,p=e.height,g=Math.min(1,Math.max(0,(n=(t=this.embossStrength)===null||t===void 0?void 0:t.call(this))!==null&&n!==void 0?n:.5)),m=Math.min(1,Math.max(0,(o=(r=this.embossWhiteLevel)===null||r===void 0?void 0:r.call(this))!==null&&o!==void 0?o:.5)),v=(a={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(s=(i=this.embossDirection)===null||i===void 0?void 0:i.call(this))!==null&&s!==void 0?s:"top-left"])!==null&&a!==void 0?a:315,k=!!((u=(l=this.embossBlend)===null||l===void 0?void 0:l.call(this))!==null&&u!==void 0&&u),b=g*10,S=m*255,C=v*Math.PI/180,w=Math.cos(C),T=Math.sin(C),L=128/1020*b,z=new Uint8ClampedArray(d),W=new Float32Array(f*p);for(let K=0,x=0;x<d.length;x+=4,K++)W[K]=.2126*z[x]+.7152*z[x+1]+.0722*z[x+2];const V=[-1,0,1,-2,0,2,-1,0,1],j=[-1,-2,-1,0,0,0,1,2,1],Z=[-f-1,-f,-f+1,-1,0,1,f-1,f,f+1],R=K=>K<0?0:K>255?255:K;for(let K=1;K<p-1;K++)for(let x=1;x<f-1;x++){const $=K*f+x;let H=0,J=0;H+=W[$+Z[0]]*V[0],J+=W[$+Z[0]]*j[0],H+=W[$+Z[1]]*V[1],J+=W[$+Z[1]]*j[1],H+=W[$+Z[2]]*V[2],J+=W[$+Z[2]]*j[2],H+=W[$+Z[3]]*V[3],J+=W[$+Z[3]]*j[3],H+=W[$+Z[5]]*V[5],J+=W[$+Z[5]]*j[5],H+=W[$+Z[6]]*V[6],J+=W[$+Z[6]]*j[6],H+=W[$+Z[7]]*V[7],J+=W[$+Z[7]]*j[7],H+=W[$+Z[8]]*V[8],J+=W[$+Z[8]]*j[8];const Q=R(S+(w*H+T*J)*L),Y=$*4;if(k){const _e=Q-S;d[Y]=R(z[Y]+_e),d[Y+1]=R(z[Y+1]+_e),d[Y+2]=R(z[Y+2]+_e),d[Y+3]=z[Y+3]}else d[Y]=d[Y+1]=d[Y+2]=Q,d[Y+3]=z[Y+3]}for(let K=0;K<f;K++){let x=K*4,$=((p-1)*f+K)*4;d[x]=z[x],d[x+1]=z[x+1],d[x+2]=z[x+2],d[x+3]=z[x+3],d[$]=z[$],d[$+1]=z[$+1],d[$+2]=z[$+2],d[$+3]=z[$+3]}for(let K=1;K<p-1;K++){let x=K*f*4,$=(K*f+(f-1))*4;d[x]=z[x],d[x+1]=z[x+1],d[x+2]=z[x+2],d[x+3]=z[x+3],d[$]=z[$],d[$+1]=z[$+1],d[$+2]=z[$+2],d[$+3]=z[$+3]}return e};me.addGetterSetter(It,"embossStrength",.5,wt(),me.afterSetFilter),me.addGetterSetter(It,"embossWhiteLevel",.5,wt(),me.afterSetFilter),me.addGetterSetter(It,"embossDirection","top-left",void 0,me.afterSetFilter),me.addGetterSetter(It,"embossBlend",!1,void 0,me.afterSetFilter);function qb(e,t,n,r,o){const i=n-t,s=o-r;if(i===0)return r+s/2;if(s===0)return r;let a=(e-t)/i;return a=s*a+r,a}var sz=function(e){const t=e.data,n=t.length;let r=t[0],o=r,i,s=t[1],a=s,l,u=t[2],d=u,f;const p=this.enhance();if(p===0)return;for(let C=0;C<n;C+=4)i=t[C+0],i<r?r=i:i>o&&(o=i),l=t[C+1],l<s?s=l:l>a&&(a=l),f=t[C+2],f<u?u=f:f>d&&(d=f);o===r&&(o=255,r=0),a===s&&(a=255,s=0),d===u&&(d=255,u=0);let g,m,v,k,b,S;if(p>0)g=o+p*(255-o),m=r-p*(r-0),v=a+p*(255-a),k=s-p*(s-0),b=d+p*(255-d),S=u-p*(u-0);else{const C=(o+r)*.5;g=o+p*(o-C),m=r+p*(r-C);const w=(a+s)*.5;v=a+p*(a-w),k=s+p*(s-w);const T=(d+u)*.5;b=d+p*(d-T),S=u+p*(u-T)}for(let C=0;C<n;C+=4)t[C+0]=qb(t[C+0],r,o,m,g),t[C+1]=qb(t[C+1],s,a,k,v),t[C+2]=qb(t[C+2],u,d,S,b)};me.addGetterSetter(It,"enhance",0,wt(),me.afterSetFilter);var az=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4){const o=.34*t[r]+.5*t[r+1]+.16*t[r+2];t[r]=o,t[r+1]=o,t[r+2]=o}};me.addGetterSetter(It,"hue",0,wt(),me.afterSetFilter),me.addGetterSetter(It,"saturation",0,wt(),me.afterSetFilter),me.addGetterSetter(It,"luminance",0,wt(),me.afterSetFilter);var lz=function(e){const t=e.data,n=t.length,r=1,o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=this.luminance()*127,a=r*o*Math.cos(i*Math.PI/180),l=r*o*Math.sin(i*Math.PI/180),u=.299*r+.701*a+.167*l,d=.587*r-.587*a+.33*l,f=.114*r-.114*a-.497*l,p=.299*r-.299*a-.328*l,g=.587*r+.413*a+.035*l,m=.114*r-.114*a+.293*l,v=.299*r-.3*a+1.25*l,k=.587*r-.586*a-1.05*l,b=.114*r+.886*a-.2*l;let S,C,w,T;for(let L=0;L<n;L+=4)S=t[L+0],C=t[L+1],w=t[L+2],T=t[L+3],t[L+0]=u*S+d*C+f*w+s,t[L+1]=p*S+g*C+m*w+s,t[L+2]=v*S+k*C+b*w+s,t[L+3]=T},cz=function(e){const t=e.data,n=t.length,r=Math.pow(2,this.value()),o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=r*o*Math.cos(i*Math.PI/180),a=r*o*Math.sin(i*Math.PI/180),l=.299*r+.701*s+.167*a,u=.587*r-.587*s+.33*a,d=.114*r-.114*s-.497*a,f=.299*r-.299*s-.328*a,p=.587*r+.413*s+.035*a,g=.114*r-.114*s+.293*a,m=.299*r-.3*s+1.25*a,v=.587*r-.586*s-1.05*a,k=.114*r+.886*s-.2*a;for(let b=0;b<n;b+=4){const S=t[b+0],C=t[b+1],w=t[b+2],T=t[b+3];t[b+0]=l*S+u*C+d*w,t[b+1]=f*S+p*C+g*w,t[b+2]=m*S+v*C+k*w,t[b+3]=T}};me.addGetterSetter(It,"hue",0,wt(),me.afterSetFilter),me.addGetterSetter(It,"saturation",0,wt(),me.afterSetFilter),me.addGetterSetter(It,"value",0,wt(),me.afterSetFilter);var uz=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4)t[r]=255-t[r],t[r+1]=255-t[r+1],t[r+2]=255-t[r+2]},dz=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const p=Math.sqrt(d*d+f*f);u=p>u?p:u;const g=s,m=i,v=360/m*Math.PI/180;for(let k=0;k<m;k+=1){const b=Math.sin(k*v),S=Math.cos(k*v);for(let C=0;C<g;C+=1){d=Math.floor(a+u*C/g*S),f=Math.floor(l+u*C/g*b);let w=(f*i+d)*4;const T=r[w+0],L=r[w+1],z=r[w+2],W=r[w+3];w=(k+C*i)*4,o[w+0]=T,o[w+1]=L,o[w+2]=z,o[w+3]=W}}},fz=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const p=Math.sqrt(d*d+f*f);u=p>u?p:u;const g=s,m=i,v=n.polarRotation||0;let k,b;for(d=0;d<i;d+=1)for(f=0;f<s;f+=1){const S=d-a,C=f-l,w=Math.sqrt(S*S+C*C)*g/u;let T=(Math.atan2(C,S)*180/Math.PI+360+v)%360;T=T*m/360,k=Math.floor(T),b=Math.floor(w);let L=(b*i+k)*4;const z=r[L+0],W=r[L+1],V=r[L+2],j=r[L+3];L=(f*i+d)*4,o[L+0]=z,o[L+1]=W,o[L+2]=V,o[L+3]=j}},hz=function(e){const t=e.width,n=e.height;let r,o,i,s,a,l,u,d,f,p,g=Math.round(this.kaleidoscopePower());const m=Math.round(this.kaleidoscopeAngle()),v=Math.floor(t*(m%360)/360);if(g<1)return;const k=Oe.createCanvasElement();k.width=t,k.height=n;const b=k.getContext("2d").getImageData(0,0,t,n);Oe.releaseCanvas(k),dz(e,b,{polarCenterX:t/2,polarCenterY:n/2});let S=t/Math.pow(2,g);for(;S<=8;)S=S*2,g-=1;S=Math.ceil(S);let C=S,w=0,T=C,L=1;for(v+S>t&&(w=C,T=0,L=-1),o=0;o<n;o+=1)for(r=w;r!==T;r+=L)i=Math.round(r+v)%t,f=(t*o+i)*4,a=b.data[f+0],l=b.data[f+1],u=b.data[f+2],d=b.data[f+3],p=(t*o+r)*4,b.data[p+0]=a,b.data[p+1]=l,b.data[p+2]=u,b.data[p+3]=d;for(o=0;o<n;o+=1)for(C=Math.floor(S),s=0;s<g;s+=1){for(r=0;r<C+1;r+=1)f=(t*o+r)*4,a=b.data[f+0],l=b.data[f+1],u=b.data[f+2],d=b.data[f+3],p=(t*o+C*2-r-1)*4,b.data[p+0]=a,b.data[p+1]=l,b.data[p+2]=u,b.data[p+3]=d;C*=2}fz(b,e,{polarRotation:0})};me.addGetterSetter(It,"kaleidoscopePower",2,wt(),me.afterSetFilter),me.addGetterSetter(It,"kaleidoscopeAngle",0,wt(),me.afterSetFilter);function zm(e,t,n){let r=(n*e.width+t)*4;const o=[];return o.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),o}function sh(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}function pz(e){const t=[0,0,0];for(let n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}function mz(e,t){const n=zm(e,0,0),r=zm(e,e.width-1,0),o=zm(e,0,e.height-1),i=zm(e,e.width-1,e.height-1),s=t||10;if(sh(n,r)<s&&sh(r,i)<s&&sh(i,o)<s&&sh(o,n)<s){const a=pz([r,n,i,o]),l=[];for(let u=0;u<e.width*e.height;u++)l[u]=sh(a,[e.data[u*4],e.data[u*4+1],e.data[u*4+2]])<s?0:255;return l}}function gz(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function vz(e,t,n){const r=[1,1,1,1,0,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,k=r[f*o+p];d+=e[v]*k}}s[u]=d===2040?255:0}return s}function yz(e,t,n){const r=[1,1,1,1,1,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,k=r[f*o+p];d+=e[v]*k}}s[u]=d>=1020?255:0}return s}function bz(e,t,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,k=r[f*o+p];d+=e[v]*k}}s[u]=d}return s}var wz=function(e){let t=mz(e,this.threshold());return t&&(t=vz(t,e.width,e.height),t=yz(t,e.width,e.height),t=bz(t,e.width,e.height),gz(e,t)),e};me.addGetterSetter(It,"threshold",0,wt(),me.afterSetFilter);var Cz=function(e){const t=this.noise()*255,n=e.data,r=n.length,o=t/2;for(let i=0;i<r;i+=4)n[i+0]+=o-2*o*Math.random(),n[i+1]+=o-2*o*Math.random(),n[i+2]+=o-2*o*Math.random()};me.addGetterSetter(It,"noise",.2,wt(),me.afterSetFilter);var kz=function(e){let t=Math.ceil(this.pixelSize()),n=e.width,r=e.height,o=Math.ceil(n/t),i=Math.ceil(r/t),s=e.data;if(t<=0){Oe.error("pixelSize value can not be <= 0");return}for(let a=0;a<o;a+=1)for(let l=0;l<i;l+=1){let u=0,d=0,f=0,p=0;const g=a*t,m=g+t,v=l*t,k=v+t;let b=0;for(let S=g;S<m;S+=1)if(!(S>=n))for(let C=v;C<k;C+=1){if(C>=r)continue;const w=(n*C+S)*4;u+=s[w+0],d+=s[w+1],f+=s[w+2],p+=s[w+3],b+=1}u=u/b,d=d/b,f=f/b,p=p/b;for(let S=g;S<m;S+=1)if(!(S>=n))for(let C=v;C<k;C+=1){if(C>=r)continue;const w=(n*C+S)*4;s[w+0]=u,s[w+1]=d,s[w+2]=f,s[w+3]=p}}};me.addGetterSetter(It,"pixelSize",8,wt(),me.afterSetFilter);var Sz=function(e){const t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,o=255/t;for(let i=0;i<r;i+=1)n[i]=Math.floor(n[i]/o)*o};me.addGetterSetter(It,"levels",.5,wt(),me.afterSetFilter);var _z=function(e){const t=e.data,n=t.length,r=this.red(),o=this.green(),i=this.blue();for(let s=0;s<n;s+=4){const a=(.34*t[s]+.5*t[s+1]+.16*t[s+2])/255;t[s]=a*r,t[s+1]=a*o,t[s+2]=a*i,t[s+3]=t[s+3]}};me.addGetterSetter(It,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(It,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(It,"blue",0,VA,me.afterSetFilter);var Az=function(e){const t=e.data,n=t.length,r=this.red(),o=this.green(),i=this.blue(),s=this.alpha();for(let a=0;a<n;a+=4){const l=1-s;t[a]=r*s+t[a]*l,t[a+1]=o*s+t[a+1]*l,t[a+2]=i*s+t[a+2]*l}};me.addGetterSetter(It,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(It,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(It,"blue",0,VA,me.afterSetFilter),me.addGetterSetter(It,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var Iz=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4){const o=t[r+0],i=t[r+1],s=t[r+2];t[r+0]=Math.min(255,o*.393+i*.769+s*.189),t[r+1]=Math.min(255,o*.349+i*.686+s*.168),t[r+2]=Math.min(255,o*.272+i*.534+s*.131)}},Ez=function(e){const n=e.data;for(let r=0;r<n.length;r+=4){const o=n[r],i=n[r+1],s=n[r+2];.2126*o+.7152*i+.0722*s>=128&&(n[r]=255-o,n[r+1]=255-i,n[r+2]=255-s)}return e},Tz=function(e){const t=this.threshold()*255,n=e.data,r=n.length;for(let o=0;o<r;o+=1)n[o]=n[o]<t?0:255};me.addGetterSetter(It,"threshold",.5,wt(),me.afterSetFilter);var xz=y4.Util._assign(y4,{Arc:Ba,Arrow:xc,Circle:Ju,Ellipse:Rl,Image:ms,Label:$b,Tag:Rc,Line:za,Path:Ui,Rect:rh,RegularPolygon:Ml,Ring:Mc,Sprite:$s,Star:Ll,Text:ar,TextPath:ro,Transformer:On,Wedge:ja,Filters:{Blur:tz,Brightness:rz,Brighten:nz,Contrast:oz,Emboss:iz,Enhance:sz,Grayscale:az,HSL:lz,HSV:cz,Invert:uz,Kaleidoscope:hz,Mask:wz,Noise:Cz,Pixelate:kz,Posterize:Sz,RGB:_z,RGBA:Az,Sepia:Iz,Solarize:Ez,Threshold:Tz}}),Rz=xz;Ft();var Mz=["dialog","floating"],V4=["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"];function Lz(e){if(!e||typeof e!="object")throw new Error("SurfaceManager: request must be a non-null object.");if(!Mz.includes(e.mode))throw new Error(`SurfaceManager: mode must be "dialog" or "floating", got "${e.mode}".`);const t="kind"in e&&e.kind!=null,n="component"in e&&e.component!=null,r="render"in e&&typeof e.render=="function";if(n&&r)throw new Error('SurfaceManager: request cannot provide both "component" and "render". Use one or the other.');if(!t&&!n&&!r)throw new Error('SurfaceManager: request must provide "kind" (intent-based) or "component"/"render" (direct-render).');if(e.mode==="floating"&&e.floating?.placement!=null&&!V4.includes(e.floating.placement))throw new Error(`SurfaceManager: floating.placement must be one of ${V4.join(", ")}, got "${e.floating.placement}".`)}var Dz=class{activeDialog=Br(null);activeFloating=Br(null);#e=!1;#n=1;#t;constructor({getModuleConfig:e}){this.#t=e}open(e){if(this.#e)return this.#l(e);Lz(e);const t=this.#u(e),{component:n,props:r,render:o}=this.#h(t);let i,s=!1;const a=new Promise(g=>{i=m=>s?!1:(s=!0,g(m),!0)});let l;const u=g=>{i({status:"submitted",data:g})&&this.#i(l)},d=g=>{i({status:"closed",reason:g})&&this.#i(l)};l={id:t.id,mode:t.mode,request:t,component:n,props:r,render:o,resolve:u,close:d,settle:g=>i(g),get settled(){return s}};const f=t.mode==="dialog"?"activeDialog":"activeFloating",p=this[f].value;return p&&!p.settled&&p.settle({status:"replaced",replacedBy:t.id}),this[f].value=l,{id:t.id,mode:t.mode,close:g=>this.#r(l,g),result:a}}close(e,t){if(e!=null){const o=this.#a(e);o&&this.#r(o,t);return}const n=this.activeDialog.value;if(n&&!n.settled){this.#r(n,t);return}const r=this.activeFloating.value;r&&!r.settled&&this.#r(r,t)}settleAll(e){for(const t of[this.activeDialog,this.activeFloating]){const n=t.value;n&&!n.settled&&n.settle(e),t.value=null}}destroy(){this.#e=!0,this.settleAll({status:"destroyed"})}#r(e,t){e.settled||(e.settle({status:"closed",reason:t}),this.#i(e))}#i(e){const t=e.mode==="dialog"?this.activeDialog:this.activeFloating;t.value===e&&(t.value=null)}#a(e){return this.activeDialog.value?.id===e?this.activeDialog.value:this.activeFloating.value?.id===e?this.activeFloating.value:null}#u(e){const t=e.id??`surface-${this.#n++}`,n=this.#t()??{},r=e.mode==="dialog"?n.dialog:n.floating,o=e.mode==="dialog"?{maxWidth:r?.maxWidth,...e.dialog}:e.dialog,i=e.mode==="floating"?{placement:r?.placement??"top-right",width:r?.width,maxWidth:r?.maxWidth,maxHeight:r?.maxHeight,autoFocus:r?.autoFocus??!0,closeOnOutsidePointerDown:r?.closeOnOutsidePointerDown??!1,...e.floating}:e.floating;return{...e,id:t,closeOnEscape:e.closeOnEscape??r?.closeOnEscape??!0,closeOnBackdrop:e.mode==="dialog"?e.closeOnBackdrop??r?.closeOnBackdrop??!0:!1,dialog:o,floating:i}}#h(e){if("component"in e&&e.component!=null)return{component:e.component,props:e.props};if("render"in e&&typeof e.render=="function")return{render:e.render};const t=this.#t()?.resolver;if(typeof t=="function"){const n=t(e);if(n!=null){if(n.type==="none")throw new Error(`SurfaceManager: resolver explicitly suppressed surface for kind "${e.kind}".`);if(n.type==="custom")return{component:n.component,props:n.props};if(n.type==="external")return{render:n.render}}}throw new Error(`SurfaceManager: no renderer resolved for kind "${e.kind}". Provide a resolver via surfaces.resolver, or use a direct-render request.`)}#l(e){return{id:e?.id??`surface-${this.#n++}`,mode:e?.mode??"dialog",close:()=>{},result:Promise.resolve({status:"destroyed"})}}},Oz="https://docs.superdoc.dev/guides/migration/document-api",U4=new Set;function Pz(e,t){U4.has(e)||(U4.add(e),console.warn(t))}var Fz={state:"editor.state",view:"editor.view",schema:"editor.schema",commands:"editor.commands",chain:"editor.chain()",can:"editor.can()",dispatch:"editor.dispatch()"},H4=Symbol.for("superdoc:rawEditor"),$4=new WeakMap;function G4(e){return!e||e[H4]?e:new Proxy(e,{get(t,n){if(n===H4)return t;const r=Fz[n];r&&Pz(`deprecated:${String(n)}`,`[SuperDoc] ${r} is deprecated and will be removed in a future version. Use the Document API (editor.doc) instead. See ${Oz}`);const o=Reflect.get(t,n,t);if(typeof o=="function"){let i=$4.get(t);return i||(i=new Map,$4.set(t,i)),i.has(n)||i.set(n,o.bind(t)),i.get(n)}return o}})}var W4=["review","original","final","off"],Nz=["original","markup","final"],Bz=["paired","independent"],K4=Symbol.for("@superdoc/trackChanges:normalized"),q4=new Set;function Yb(e,t){q4.has(e)||(q4.add(e),console.warn(`[SuperDoc] ${e} is deprecated — use ${t} instead.`))}function Y4(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n}function zz(e,t,n){return typeof e=="string"&&W4.includes(e)?e:typeof t=="string"&&W4.includes(t)?t:n}function jz(e){return typeof e!="string"||!Nz.includes(e)?null:e}function Vz(e){return e==="markup"?"review":e}function Uz(e){return typeof e=="string"&&Bz.includes(e)?e:null}function Hz(e){return e==="grouped"?"paired":e==="separate"?"independent":null}function $z(e){return e==="paired"?"grouped":"separate"}function gs(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function Xb(e){const t=e[K4]===!0,n=gs(e.viewing),r=jz(n?.trackedChanges);gs(e.modules)||(e.modules={});const o=gs(e.trackChanges),i=gs(e.modules.trackChanges),s=gs(e.layoutEngineOptions?.trackedChanges);t||(o&&Object.prototype.hasOwnProperty.call(o,"visible")&&Yb("config.trackChanges.visible","config.viewing.trackedChanges"),i&&Yb("config.modules.trackChanges","config.trackChanges for behavior and config.viewing.trackedChanges for viewing projection"),s&&Yb("config.layoutEngineOptions.trackedChanges","config.viewing.trackedChanges for display and config.trackChanges.enabled for behavior"));const a=r?r==="markup":Y4(o?.visible,i?.visible,!1),l=Y4(o?.enabled,i?.enabled,typeof s?.enabled=="boolean"?s.enabled:!0),u=Hz(o?.replacementMode)??Uz(i?.replacements)??"paired",d=gs(o?.authorColors)??gs(i?.authorColors),f=d||void 0,p=gs(o?.semanticColors)??gs(i?.semanticColors),g=p||void 0,m=e.documentMode==="viewing",v=m?a?"review":"original":"review",k=r?m?Vz(r):"review":zz(i?.mode,s?.mode,v),b={visible:a,mode:k,enabled:l,replacements:u};return f&&(b.authorColors=f),g&&(b.semanticColors=g),e.modules.trackChanges=b,e.trackChanges={visible:a,enabled:l,replacementMode:$z(u)},f&&(e.trackChanges.authorColors=f),g&&(e.trackChanges.semanticColors=g),gs(e.layoutEngineOptions)||(e.layoutEngineOptions={}),e.layoutEngineOptions.trackedChanges={mode:k,enabled:l},typeof n?.comments=="boolean"&&(gs(e.comments)||(e.comments={}),e.comments.visible=n.comments),Object.defineProperty(e,K4,{value:!0,writable:!0,configurable:!0,enumerable:!1}),b}var Zb=Object.freeze({id:null,name:"Default SuperDoc user",email:null});function Gz(e){return!e||typeof e!="object"?{...Zb}:{...Zb,...e}}var jm=Object.freeze({"font-family":"fontFamily","font-size":"fontSize",strikethrough:"strike","highlight-color":"highlight","text-color":"color","table-of-contents":"tableOfContents","table-actions":"tableActions","text-align":"textAlign","bullet-list":"list","numbered-list":"numberedlist","indent-decrease":"indentleft","indent-increase":"indentright","line-height":"lineHeight","linked-style":"linkedStyles","measurement-unit":"measurementUnit","formatting-marks":"formattingMarks","copy-format":"copyFormat","clear-formatting":"clearFormatting","document-mode":"documentMode","track-changes-accept-selection":"acceptTrackedChangeBySelection","track-changes-reject-selection":"rejectTrackedChangeOnSelection"}),X4=Object.freeze({toolbar:!0,comments:!0,contextMenu:!0,loading:!0,search:!1,linkPopover:!1,ruler:!1,contentControls:!0}),Wz=Object.freeze(["left","center","right"]),Kz=Object.freeze({compact:32,default:80,wide:120}),hK=Object.freeze(Object.keys(X4)),qr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Z4(e,t){const n=e?.[t];return n===!1?!1:n===void 0?X4[t]:!0}function qz(e,t){const n=e?.[t];return qr(n)?n:{}}var Q4=Object.freeze(["level","readOnly","allowResolve","permissionResolver"]);function Yz(e){if(!Q4.some(n=>n in e))return e;const t={...e};for(const n of Q4)delete t[n];return t}function J4(e){const t={...e},n=Il(e.sections,e.customItems),r=Il(e.defaultItems,e.includeDefaultItems);return delete t.customItems,delete t.includeDefaultItems,$o(t,{sections:n,defaultItems:r})}var eI=Object.freeze({findPlaceholder:"findPlaceholder",findAriaLabel:"findAriaLabel",replacePlaceholder:"replacePlaceholder",replaceAriaLabel:"replaceAriaLabel",noResults:"noResultsLabel",previousMatchTitle:"previousMatchLabel",previousMatchAriaLabel:"previousMatchAriaLabel",nextMatchTitle:"nextMatchLabel",nextMatchAriaLabel:"nextMatchAriaLabel",closeTitle:"closeLabel",closeAriaLabel:"closeAriaLabel",replace:"replaceLabel",replaceAll:"replaceAllLabel",toggleReplaceTitle:"toggleReplaceLabel",toggleReplaceAriaLabel:"toggleReplaceAriaLabel",matchCase:"matchCaseLabel",matchCaseAriaLabel:"matchCaseAriaLabel",ignoreDiacritics:"ignoreDiacriticsLabel",ignoreDiacriticsAriaLabel:"ignoreDiacriticsAriaLabel",regex:"regexLabel",regexAriaLabel:"regexAriaLabel",invalidPattern:"invalidPatternLabel"});function Xz(e){return qr(e)?Object.fromEntries(Object.entries(e).filter(([t,n])=>eI[t]!==void 0&&n!==void 0).map(([t,n])=>[eI[t],n])):{}}function tI(e){const t={...e};return delete t.strings,delete t.replaceControls,delete t.includeTrackedDeletions,$o(t,Xz(e.strings),{replaceEnabled:Il(e.replaceControls,e.replaceEnabled),includeDeletedText:Il(e.includeTrackedDeletions,e.includeDeletedText)})}var Zz=Object.freeze({"text-color":"color","table-of-contents":"tableOfContents","align-left":"alignLeft","align-right":"alignRight","align-center":"alignCenter","align-justify":"alignJustify","bullet-list":"bulletList","numbered-list":"numberedList","indent-decrease":"indentLeft","indent-increase":"indentRight","copy-format":"copyFormat","clear-formatting":"clearFormatting","track-changes-accept-selection":"trackChangesAccept","track-changes-reject-selection":"trackChangesReject","document-mode":"documentMode","document-mode-editing":"documentEditingMode","document-mode-suggesting":"documentSuggestingMode","document-mode-viewing":"documentViewingMode","highlight-color":"highlight","linked-style":"paintbrush","table-actions":"tableActions","split-cell":"splitCell","merge-cells":"mergeCells","insert-row-before":"addRowBefore","insert-row-after":"addRowAfter","insert-column-before":"addColumnBefore","insert-column-after":"addColumnAfter","delete-row":"deleteRow","delete-column":"deleteColumn","delete-table":"deleteTable","remove-borders":"deleteBorders","fix-tables":"fixTables","line-height":"lineHeight","formatting-marks":"formattingMarks"}),Qz=Object.freeze({"font-family":"fontFamily","font-size":"fontSize","highlight-color":"highlight","text-color":"color","table-of-contents":"tableOfContents","table-actions":"tableActions","insert-row-before":"addRowBefore","insert-row-after":"addRowAfter","insert-column-before":"addColumnBefore","insert-column-after":"addColumnAfter","delete-row":"deleteRow","delete-column":"deleteColumn","delete-table":"deleteTable","remove-borders":"removeBorders","merge-cells":"mergeCells","split-cell":"splitCell","fix-tables":"fixTables","text-align":"textAlign","bullet-list":"bulletList","numbered-list":"numberedList","indent-decrease":"indentLeft","indent-increase":"indentRight","measurement-unit":"measurementUnit","track-changes-accept-selection":"trackChangesAccept","track-changes-reject-selection":"trackChangesReject","clear-formatting":"clearFormatting","copy-format":"copyFormat","line-height":"lineHeight","linked-style-label":"formatText","formatting-marks":"formattingMarks","document-mode-editing":"documentEditingMode","document-mode-suggesting":"documentSuggestingMode","document-mode-viewing":"documentViewingMode","document-mode-editing-description":"documentEditingModeDescription","document-mode-suggesting-description":"documentSuggestingModeDescription","document-mode-viewing-description":"documentViewingModeDescription","linked-style":"linkedStyles"});function Vm(e,t){return t[e]??e}function Qb(e,t){if(!qr(e))return;const n=Object.entries(e),r=n.filter(([i])=>t[i]===void 0),o=n.filter(([i])=>t[i]!==void 0);return Object.fromEntries([...r,...o].map(([i,s])=>[Vm(i,t),s]))}function nI(e){return Array.isArray(e)?e.map(t=>Vm(t,jm)):e}function rI(e){return qr(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,nI(n)])):e}function Jz(e,t){if(!qr(e)||!Array.isArray(t))return e;const n={...e};for(const r of t){if(!qr(r))continue;const o=r.region??"center";n[o]===void 0&&(n[o]=[])}return n}var ej=Object.freeze({"formatting-marks":"right","table-of-contents":"center"});function tj(e,t){if(!qr(e)||!Array.isArray(t))return e;const n=Object.fromEntries(Object.entries(e).map(([o,i])=>[o,Array.isArray(i)?[...i]:i])),r=new Set(Object.values(n).flatMap(o=>Array.isArray(o)?o:[]).map(o=>Vm(o,jm)));for(const o of t){const i=Vm(o,jm);if(r.has(i))continue;const s=ej[o];s&&(Array.isArray(n[s])||(n[s]=[]),n[s].push(o),r.add(i))}return n}function oI(e,t){return Jz(tj(e,t.includeItems),t.customItems)}function nj(e){return Array.isArray(e)?e.map(t=>{if(!qr(t))return t;const{value:n,label:r,previewFamily:o}=t;return{key:n,value:n,label:r,...o?{props:{style:{fontFamily:o}}}:{}}}):e}function rj(e){return Array.isArray(e)?e.map(t=>{if(!qr(t)||typeof t.id!="string")return t;const n=t.size??"default",r=t.type==="separator"?void 0:Kz[n],o={...t,name:t.id,group:t.region,isNarrow:n==="compact",isWide:n==="wide",...r?{layoutWidth:r,style:{...t.style,width:`${r-2}px`}}:{}};return t.label&&(o.defaultLabel===void 0&&(o.defaultLabel=t.label),o.attributes={...t.attributes,ariaLabel:t.attributes?.ariaLabel??t.label}),t.type==="dropdown"&&Array.isArray(t.options)&&(o.options=t.options.map(i=>qr(i)?{...i,key:i.value??i.id,value:i.value??i.id}:i),o.dropdownValueKey="value"),typeof t.onSelect=="function"&&(o.command=({item:i,argument:s,payload:a,...l})=>t.onSelect({...l,value:s})),delete o.id,delete o.region,delete o.size,delete o.onSelect,o}):e}function oj(e){const t={...e},n=Il(e.items,qr(e.groups)?e.groups:void 0),r=qr(e.items)&&Object.keys(e.items).length===0?{center:[]}:n,o=oI(r,e),i=o===void 0?e.groups:rI(o),s=Qb(e.icons,Zz),a=$o(Qb(e.texts,{}),Qb(e.strings,Qz)),l=Array.isArray(e.includeItems)?new Set(e.includeItems):null,u=qr(r)?new Set(Object.values(r).flatMap(d=>Array.isArray(d)?d:[])):new Set;return delete t.items,delete t.includeItems,delete t.overflow,delete t.responsiveTo,delete t.fontOptions,delete t.customItems,delete t.strings,$o(t,{groups:i,excludeItems:nI(e.excludeItems),icons:s,texts:a,hideButtons:e.overflow===void 0?e.hideButtons:e.overflow==="menu",responsiveToContainer:e.responsiveTo===void 0?e.responsiveToContainer:e.responsiveTo==="container",fonts:e.fontOptions===void 0?e.fonts:nj(e.fontOptions),customButtons:e.customItems===void 0?e.customButtons:rj(e.customItems),showFormattingMarksButton:l===null&&!u.has("formatting-marks")?e.showFormattingMarksButton:u.has("formatting-marks")||l?.has("formatting-marks"),showTableOfContentsButton:l===null&&!u.has("table-of-contents")?e.showTableOfContentsButton:u.has("table-of-contents")||l?.has("table-of-contents")})}function iI(e={}){const t=e.ui,n=t===!1,r=qr(t)?t:void 0,o=K=>!n&&Z4(r,K),i=K=>n?!1:r?.[K]===void 0?void 0:Z4(r,K),s=K=>n?{}:qz(r,K),a=n||i("ruler")===!1,l=n||i("linkPopover")===!1,u=l?void 0:Il(s("linkPopover").popoverResolver,e.modules?.links?.popoverResolver),d=i("contentControls")??(!n&&e.modules?.contentControls?.chrome!=="none"),f=e.modules?.contentControls?.chrome==="none"?void 0:e.modules?.contentControls?.chrome,p=s("toolbar"),g=oj(p),m=qr(p.items),v=e.modules?.toolbar,k=qr(v)?v:{},b=e.modules?.contextMenu??e.modules?.slashMenu,S=qr(b)?b:{},C=e.modules?.surfaces?.findReplace,w=tI(qr(C)?C:{}),T=qr(k.groups)?rI(oI(k.groups,p)):k.groups,L=[g.groups,T],z=L.find(qr),W=L.find(Array.isArray),V=m?Object.keys(g.groups??{}):Il(W,k.toolbarGroups,e.toolbarGroups),j=Array.isArray(V)?V:null,Z=(K,x)=>Object.prototype.hasOwnProperty.call(K,x),R=z&&j?Object.fromEntries([...j.filter(K=>Z(z,K)),...Object.keys(z).filter(K=>!Wz.includes(K))].map(K=>[K,z[K]])):z;return{enabled:!n,toolbar:{enabled:o("toolbar"),container:n?null:Il(g.container,k.selector,e.toolbar)??null,options:n?{}:{...$o(k,g),groups:R,toolbarGroups:V,icons:$o(e.toolbarIcons,k.icons,g.icons),texts:$o(e.toolbarTexts,k.texts,g.texts)}},comments:{enabled:i("comments")??(!n&&e.modules?.comments!==!1),options:n?{}:GS(Yz(s("comments")))},contextMenu:{enabled:i("contextMenu")??(!n&&e.disableContextMenu!==!0),suppressed:n||i("contextMenu")===!1,options:n?{}:$o(J4(S),J4(s("contextMenu")))},loading:{enabled:o("loading")},search:{enabled:i("search")??(!n&&!!e.modules?.surfaces?.findReplace),options:n?{}:$o(w,tI(s("search")))},linkPopover:{enabled:typeof u=="function",suppressed:l,options:$o(s("linkPopover"),{popoverResolver:u})},ruler:{enabled:i("ruler")??(!n&&!!e.rulers),suppressed:a,container:a?null:s("ruler").container??e.rulerContainer??null},contentControls:{enabled:d,options:d?$o({chrome:f},s("contentControls")):{chrome:"none"}}}}var Um=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ij=e=>e==="read"||e==="write"||e==="resolve";function sI(e={}){const t=Um(e.interaction)?e.interaction:{},n=Um(t.comments)?t.comments:{},r=Um(t.trackedChanges)?t.trackedChanges:{},o=Um(e.modules?.comments)?e.modules.comments:{},i=(n.readOnly??o.readOnly??!1)===!0,s=(n.allowResolve??o.allowResolve??!0)!==!1,a=ij(n.level),l=a?n.level:i?"read":s?"resolve":"write",u=r.allowDecisions;return{comments:{level:l,readOnly:a?l==="read":i,allowResolve:a?l==="resolve":s},trackedChanges:{allowDecisions:typeof u=="boolean"?u:!i}}}var aI=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function lI(e={}){const t=aI(e.surfaces)?e.surfaces:{},n=aI(e.modules?.surfaces)?e.modules.surfaces:{},r=t.resolver===void 0?n.resolver:t.resolver;return{resolver:typeof r=="function"?r:null,dialog:$o(n.dialog,t.dialog),floating:$o(n.floating,t.floating)}}var sj="https://docs.superdoc.dev/editor/fonts/";function aj(e){return e==="localhost"||e.endsWith(".localhost")||e==="0.0.0.0"||e==="::1"||e==="[::1]"||e.startsWith("127.")}function lj(e,t,n=typeof window>"u"?"":window.location.hostname){if(!aj(n)||!Array.isArray(e))return;const r=[...new Set(e.map(s=>s.trim()).filter(Boolean))].filter(s=>!t.has(s));if(r.length===0)return;for(const s of r)t.add(s);const o=r.length===1?"font":"fonts",i=r.map(s=>`"${s}"`).join(", ");console.warn(`[SuperDoc] Missing document ${o}: ${i}. The browser is using fallback fonts, which can change line and page breaks. Configure document fonts: ${sj}`)}var cj=class{#e=new Map;#n=new Map;#t=null;#r=new Set;register(e){if(this.#e.has(e.id))throw new Error(`EditorRuntimeRegistry: duplicate runtime id "${e.id}"`);const t=e.root,n=t?this.#n.get(t):void 0;if(n!==void 0&&n!==e.id)throw new Error(`EditorRuntimeRegistry: root element already registered to runtime "${n}"`);this.#e.set(e.id,e),t&&this.#n.set(t,e.id)}unregister(e){const t=this.#e.get(e);return t?(this.#e.delete(e),t.root&&this.#n.delete(t.root),this.#t===e&&(this.#t=null,this.#i({previousRuntimeId:e,nextRuntimeId:null,reason:"active-runtime-unregistered",legacyEditorProjection:null})),!0):!1}get(e){return this.#e.get(e)??null}getAll(){return Array.from(this.#e.values())}getAllByDocumentId(e){const t=[];for(const n of this.#e.values())n.documentId===e&&t.push(n);return t}getActive(){return this.#t===null?null:this.#e.get(this.#t)}getActiveId(){return this.#t}setActive(e,t){if(e!==null&&!this.#e.has(e))throw new Error(`EditorRuntimeRegistry: cannot activate unknown runtime "${e}"`);if(e===this.#t)return;const n=this.#t;this.#t=e;let r=null;e!==null&&(r=this.#e.get(e).getLegacyEditorProjection?.()??null),this.#i({previousRuntimeId:n,nextRuntimeId:e,reason:t,legacyEditorProjection:r})}resolveFromEventTarget(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null;if(!t)return null;const n=t.closest(`[${bm}]`);if(!n)return null;const r=n.getAttribute(bm),o=r?this.get(r):null;return o&&o.root===n?o:null}subscribe(e){return this.#r.add(e),()=>{this.#r.delete(e)}}clear(){this.#e.clear(),this.#n.clear(),this.#t=null,this.#r.clear()}#i(e){for(const t of Array.from(this.#r))try{t(e)}catch{}}},lt={notReady:"not-ready",documentApiUnavailable:"document-api-unavailable",documentReadonly:"document-readonly",trackedChangeDecisionsDisabled:"tracked-change-decisions-disabled",selectionRequired:"selection-required",rangeSelectionRequired:"range-selection-required",contextUnavailable:"context-unavailable",geometryUnavailable:"geometry-unavailable",targetUnresolved:"target-unresolved",targetNotVisible:"target-not-visible",commandUnsupported:"command-unsupported",commandDeferred:"command-deferred",tableContextUnavailable:"table-context-unavailable",operationUnavailable:"operation-unavailable",bulkDecisionsDisabled:"bulk-decisions-disabled",hostCapabilityUnavailable:"host-capability-unavailable",historyEmpty:"history-empty",searchUnavailable:"search-unavailable",searchInvalidPattern:"search-invalid-pattern",replaceUnsupported:"replace-unsupported",contentControlLocked:"content-control-locked",permissionDenied:"permission-denied"},cI={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strikethrough",fontFamily:"font-family",fontSize:"font-size",setFontFamily:"setFontFamily",setFontSize:"setFontSize",undo:"undo",redo:"redo",acceptChange:"acceptChange",rejectChange:"rejectChange",acceptAllChanges:"acceptAllChanges",rejectAllChanges:"rejectAllChanges",bulletList:"bullet-list",numberedList:"numbered-list"};function uI(e){const t=n=>typeof n=="string"?n.replace(/\s*pt$/i,"").trim():n;if(typeof e=="string")return t(e);if(e&&typeof e=="object"&&"value"in e){const n=e;return{...n,value:t(n.value)}}return e}function uj(e){const t=(n,r)=>!r&&n>0&&n<=5?n*100:n;if(typeof e=="string"){const n=e.includes("%"),r=Number.parseFloat(e.replace("%","").trim());return Number.isFinite(r)?t(r,n):e}return typeof e=="number"&&Number.isFinite(e)?t(e,!1):e}function dj(e){const t=e&&typeof e=="object"&&"value"in e?e.value:e;if(t==="in"||t==="cm")return t;if(typeof t=="string"){const n=t.trim().toLowerCase();if(n==="in"||n==="inch"||n==="inches")return"in";if(n==="cm"||n==="centimeter"||n==="centimeters"||n==="centimetre"||n==="centimetres")return"cm"}return t}function dI(e){const t=n=>{if(n===null)return null;if(typeof n!="string")return n;const r=n.trim();return r===""?n:/^#[0-9a-fA-F]{6}$/.test(r)?r:/^[0-9a-fA-F]{6}$/.test(r)?`#${r}`:r};if(e&&typeof e=="object"&&"value"in e){const n=e;return{...n,value:t(n.value)}}return t(e)}function Jb(e,t){if(e&&typeof e=="object"){const n=e;for(const r of t)if(r in n)return n[r]}return e}function fj(e){const t=Jb(e,["alignment","value"]);if(typeof t!="string")return t;const n=t.trim().toLowerCase();return n==="justified"||n==="both"?"justify":n}function hj(e){const t=Jb(e,["line","lineHeight","value"]),n=typeof t=="number"?t:typeof t=="string"?Number.parseFloat(t.trim()):NaN;return!Number.isFinite(n)||n<=0?t:n<=10?Math.round(n*240):Math.round(n)}function pj(e){if(e&&typeof e=="object"&&"role"in e)return e;const t=Jb(e,["styleId","value","style"]);return typeof t=="string"?t.trim():t}function mj(e){if(typeof e=="string")return e;if(e&&typeof e=="object"){const t=e.mode;if(typeof t=="string")return t}return e}var gj=lt.commandUnsupported,Gs=lt.tableContextUnavailable,fI=[{id:"bold",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.bold",activeMark:"bold",inline:{key:"bold",kind:"toggle"}},{id:"italic",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.italic",activeMark:"italic",inline:{key:"italic",kind:"toggle"}},{id:"underline",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.underline",activeMark:"underline",inline:{key:"underline",kind:"toggle"}},{id:"strikethrough",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.strikethrough",activeMark:"strikethrough",inline:{key:"strike",kind:"toggle"}},{id:"font-family",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontFamily",aliases:["setFontFamily"],inline:{key:"fontFamily",kind:"value-string"}},{id:"font-size",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontSize",aliases:["setFontSize"],normalizePayload:uI,inline:{key:"fontSize",kind:"value-number"}},{id:"setFontFamily",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontFamily",aliasOf:"font-family",inline:{key:"fontFamily",kind:"value-string"}},{id:"setFontSize",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontSize",aliasOf:"font-size",normalizePayload:uI,inline:{key:"fontSize",kind:"value-number"}},{id:"undo",family:"history",disposition:"routed",mutates:!0,docRoute:"history.undo"},{id:"redo",family:"history",disposition:"routed",mutates:!0,docRoute:"history.redo"},{id:"acceptChange",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"id"},aliases:["track-changes-accept-selection"]},{id:"rejectChange",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"id"},aliases:["track-changes-reject-selection"]},{id:"acceptAllChanges",family:"tracked changes (bulk)",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"all"}},{id:"rejectAllChanges",family:"tracked changes (bulk)",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"all"}},{id:"track-changes-accept-selection",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"id"},aliasOf:"acceptChange"},{id:"track-changes-reject-selection",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"id"},aliasOf:"rejectChange"},{id:"zoom",family:"zoom",disposition:"routed",mutates:!1,instanceRoute:"setZoom",valueFrom:"zoom",normalizePayload:uj},{id:"zoom-fit-width",family:"zoom",disposition:"routed",mutates:!1,instanceRoute:"setZoomMode",fixedArg:"fit-width",valueFrom:"zoom"},{id:"document-mode",family:"document",disposition:"routed",mutates:!1,instanceRoute:"setDocumentMode",valueFrom:"documentMode",normalizePayload:mj},{id:"measurement-unit",family:"measurement",disposition:"routed",mutates:!1,instanceRoute:"setMeasurementUnit",valueFrom:"measurementUnit",normalizePayload:dj},{id:"text-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.color",inline:{key:"color",kind:"value-string"},normalizePayload:dI},{id:"highlight-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.highlight",inline:{key:"highlight",kind:"value-string"},normalizePayload:dI},{id:"link",family:"links",disposition:"routed",mutates:!0,docRoute:"hyperlinks.wrap",activeMark:"link",link:{kind:"link"}},{id:"text-align",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setAlignment",blockParagraph:{kind:"alignment"},normalizePayload:fj},{id:"line-height",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setSpacing",blockParagraph:{kind:"spacing-line"},normalizePayload:hj},{id:"linked-style",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"styles.paragraph.setStyle",blockParagraph:{kind:"style"},normalizePayload:pj},{id:"bullet-list",family:"lists",disposition:"routed",mutates:!0,docRoute:"lists.apply",list:{mode:"toggle-seed",seed:"bullet"}},{id:"numbered-list",family:"lists",disposition:"routed",mutates:!0,docRoute:"lists.apply",list:{mode:"toggle-seed",seed:"ordered"}},{id:"indent-increase",family:"lists/indent",disposition:"routed",mutates:!0,docRoute:"lists.indent",list:{mode:"indent"}},{id:"indent-decrease",family:"lists/indent",disposition:"routed",mutates:!0,docRoute:"lists.outdent",list:{mode:"outdent"}},{id:"direction-ltr",family:"direction",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setDirection",blockParagraph:{kind:"direction",fixedValue:"ltr"}},{id:"direction-rtl",family:"direction",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setDirection",blockParagraph:{kind:"direction",fixedValue:"rtl"}},{id:"clear-formatting",family:"formatting",disposition:"routed",mutates:!0,docRoute:"format.apply",inline:{key:"*",kind:"clear"}},{id:"image",family:"media",disposition:"routed",mutates:!0,docRoute:"create.image",create:{kind:"image"}},{id:"table-of-contents-insert",family:"TOC",disposition:"routed",mutates:!0,docRoute:"create.tableOfContents",create:{kind:"toc"}},{id:"table-insert",family:"tables",disposition:"routed",mutates:!0,docRoute:"create.table",create:{kind:"table"}},{id:"table-add-row-before",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertRow",table:{action:"insert-row-before",op:"insertRow"},reason:Gs},{id:"table-add-row-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertRow",table:{action:"insert-row-after",op:"insertRow"},reason:Gs},{id:"table-delete-row",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteRow",table:{action:"delete-row",op:"deleteRow"},reason:Gs},{id:"table-add-column-before",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-before",op:"insertColumn"},reason:Gs},{id:"table-add-column-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-after",op:"insertColumn"},reason:Gs},{id:"table-delete-column",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteColumn",table:{action:"delete-column",op:"deleteColumn"},reason:Gs},{id:"table-delete",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.delete",table:{action:"delete-table",op:"delete"},reason:Gs},{id:"table-merge-cells",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.mergeCells",table:{action:"merge-cells",op:"mergeCells"},reason:Gs},{id:"table-split-cell",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.splitCell",table:{action:"split-cell",op:"splitCell",requiresCell:!0},reason:Gs},{id:"table-remove-borders",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.setBorders",table:{action:"remove-borders",op:"setBorders"},reason:Gs},{id:"ruler",family:"UI chrome",disposition:"routed",mutates:!1,instanceRoute:"toggleRuler",valueFrom:"ruler"},{id:"formatting-marks",family:"UI chrome",disposition:"routed",mutates:!1,instanceRoute:"toggleFormattingMarks",valueFrom:"formattingMarks"},{id:"copy-format",family:"formatting",disposition:"routed",mutates:!1},{id:"table-fix",family:"tables",disposition:"unsupported",mutates:!0,reason:gj}],vj=new Map(fI.map(e=>[e.id,e])),yj=fI.map(e=>e.id);function td(e){return vj.get(e)??null}var bj=["table-add-row-before","table-add-row-after","table-delete-row","table-add-column-before","table-add-column-after","table-delete-column","table-delete","table-merge-cells","table-split-cell","table-remove-borders"],hI=[{name:"bold",commandId:"bold",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"italic",commandId:"italic",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"underline",commandId:"underline",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"strike",commandId:"strikethrough",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"clearFormatting",commandId:"clear-formatting",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"copyFormat",commandId:"copy-format",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"fontFamily",commandId:"font-family",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"fontSize",commandId:"font-size",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"color",commandId:"text-color",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"highlight",commandId:"highlight-color",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"textAlign",commandId:"text-align",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"list",commandId:"bullet-list",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"numberedlist",commandId:"numbered-list",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"indentleft",commandId:"indent-decrease",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"indentright",commandId:"indent-increase",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"lineHeight",commandId:"line-height",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"linkedStyles",commandId:"linked-style",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"link",commandId:"link",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"image",commandId:"image",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"table",commandId:"table-insert",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"tableActions",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"center",memberCommandIds:bj,note:"table editing dropdown is shell chrome; its member commands are controller-routed through the shared table-context facade (ui.tables / host.getTableContext()) and fail closed with table-context-unavailable when the caret is not in a table"},{name:"undo",commandId:"undo",instanceMethod:null,disposition:"controller-routed",group:"left"},{name:"redo",commandId:"redo",instanceMethod:null,disposition:"controller-routed",group:"left"},{name:"search",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"right",note:"built-in search button; opens the shared find/replace surface (the same one Cmd/Ctrl+F opens) by emitting a `search:open` event on the SuperDoc instance, which the shell handles. The surface reads/drives the controller search surface (ui.search), backed by the single V2 host search session (host.search) which owns query, navigation, reveal, and replace. Find/navigation are always available when the host exposes search; replace/replaceAll mutate through the host session and fail closed (document-readonly) in viewing/read-only mode. If a runtime cannot expose search, the surface fails closed with search-unavailable"},{name:"zoom",commandId:"zoom",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"measurementUnit",commandId:"measurement-unit",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"ruler",commandId:null,instanceMethod:"toggleRuler",disposition:"host-routed",group:"right",note:"built-in shell toggles ruler visibility through the public SuperDoc.toggleRuler() instance method; the controller also routes the ruler command through it so custom UIs drive the same chrome (active state from config.rulers)"},{name:"formattingMarks",commandId:null,instanceMethod:"toggleFormattingMarks",disposition:"host-routed",group:"right",note:"built-in shell toggles nonprinting marks through the public SuperDoc.toggleFormattingMarks()/setShowFormattingMarks() instance methods (not a controller command)"},{name:"documentMode",commandId:"document-mode",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"acceptTrackedChangeBySelection",commandId:"track-changes-accept-selection",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"rejectTrackedChangeOnSelection",commandId:"track-changes-reject-selection",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"customButtons",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"center",note:"consumer-defined buttons the rendered shell owns; their execution context surface is phase 2"}],pI=new Map(hI.map(e=>[e.name,e])),wj=hI.map(e=>e.name);function e2(e){return pI.get(e)??null}function Cj(e){const t=pI.get(e);return t?.disposition==="controller-routed"?t.commandId:null}var kj=".png,.jpg,.jpeg,image/png,image/jpeg",mI=new Set(["image/png","image/jpeg","image/jpg"]),Sj=/\.(png|jpe?g)$/i;function _j(e){if(!e)return!1;const t=typeof e.type=="string"?e.type.toLowerCase():"";return t?mI.has(t):Sj.test(String(e.name??""))}function gI(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(Aj(String(r.result),e)),r.onerror=()=>n(r.error??new Error("image-read-failed")),r.readAsDataURL(e)})}function Aj(e,t){const n=/^data:([^;,]*);base64,/.exec(e);if(!n)return e;const r=n[1].toLowerCase();if(mI.has(r))return e;const o=String(t?.name??""),i=/\.jpe?g$/i.test(o)?"image/jpeg":/\.png$/i.test(o)?"image/png":null;return i?`data:${i};base64,${e.slice(n[0].length)}`:e}async function Ij(e,t){if(typeof t=="function"){const n=await t(e);if(typeof n!="string"||n.trim()==="")throw new Error("handleImageUpload returned an empty result");return n.startsWith("data:")?n:Ej(n,e)}return gI(e)}async function Ej(e,t){const n=await fetch(e);if(!n.ok)throw new Error(`image fetch failed: ${n.status}`);const r=await n.blob(),o=(/\.(?:png|jpe?g)(?:$|[?#])/i.test(e)?e.split(/[?#]/)[0]:"")||t?.name||"";return gI(o?Object.assign(r,{name:o}):r)}function Tj({ownerDocument:e=document,onPick:t,onError:n}={}){const r=e.createElement("input");return r.type="file",r.accept=kj,r.hidden=!0,r.tabIndex=-1,r.setAttribute("data-superdoc-image-picker","true"),r.setAttribute("aria-hidden","true"),r.addEventListener("change",()=>{const o=r.files&&r.files[0];if(r.value="",!!o){if(!_j(o)){n?.(new Error(`unsupported image type: ${o.type||o.name}`));return}try{const i=t?.(o);i&&typeof i.then=="function"&&i.catch(s=>n?.(s))}catch(i){n?.(i)}}}),e.body?.appendChild(r),{input:r,open(){r.click()},destroy(){r.remove()}}}var xj=(e,t)=>{let n=e.replace(/[^0-9.]/g,"");return n=parseFloat(n),isNaN(n)&&(n=t),n=parseFloat(n),n},Rj=(e,t,n)=>{let r,o,i,s=0;n||(n={});const a=()=>{s=n.leading===!1?0:Date.now(),r=null,i=e(...o),r||(o=null)},l=(...u)=>{const d=Date.now();!s&&n.leading===!1&&(s=d);const f=t-(d-s);return o=u,f<=0||f>t?(r&&(clearTimeout(r),r=null),s=d,i=e(...u),r||(o=null)):!r&&n.trailing!==!1&&(r=setTimeout(a,f)),i};return l.cancel=function(){clearTimeout(r),s=0,r=o=null},l};Ft(),mn();var Mj={class:"sd-toolbar-icon"},Lj=["innerHTML"],Dj={__name:"ToolbarButtonIcon",props:{name:{type:String,required:!0},color:{type:String,default:null},icon:{type:String,default:null}},setup(e){const t=e,n=ke(()=>{if(t.name==="color")return{backgroundColor:t.color||"#111111"};if(t.name==="highlight")return{backgroundColor:t.color||"#D6D6D6"}}),r=ke(()=>["color","highlight"].includes(t.name));return(o,i)=>(ye(),De("div",Mj,[He("div",{class:en(["sd-toolbar-icon__icon",[`sd-toolbar-icon__icon--${t.name}`]]),innerHTML:e.icon},null,10,Lj),r.value?(ye(),De("div",{key:0,class:"color-bar",style:bn(n.value)},null,4)):vt("",!0)]))}},vI=un(Dj,[["__scopeId","data-v-d7d79424"]]);Ft(),mn();var Oj=["role","aria-label","aria-disabled"],Pj=["data-item"],Fj=["data-item"],Nj={key:1,class:"sd-button-label"},Bj=["data-item","aria-label"],zj=["innerHTML"],jj={key:2},Vj=["onKeydown","id"],Uj=["placeholder","onKeydown","id","data-item"],Hj=["data-item","innerHTML"],$j={"aria-live":"polite",class:"sd-visually-hidden"},Gj={__name:"ToolbarButton",props:{iconColor:{type:String,default:null},active:{type:Boolean,default:!1},isNarrow:{type:Boolean,default:!1},isWide:{type:Boolean,default:!1},toolbarItem:{type:Object,required:!0},defaultLabel:{type:String,default:null},isOverflowItem:{type:Boolean,default:!1},allowEnterPropagation:{type:Boolean,default:!1}},emits:["buttonClick","textSubmit","mainClick"],setup(e,{emit:t}){const n=t,{proxy:r}=pr(),o=e,{name:i,active:s,icon:a,label:l,hideLabel:u,iconColor:d,hasCaret:f,splitButton:p,disabled:g,expand:m,inlineTextInputVisible:v,hasInlineTextInput:k,minWidth:b,style:S,attributes:C}=o.toolbarItem,w=ke(()=>!!p?.value&&!!f?.value),T=ke(()=>i?.value??""),L=re(""),z=re(null),{isHighContrastMode:W}=ds();jt(()=>l?.value,Te=>{document.activeElement!==z.value&&(L.value=Te==null?"":String(Te))},{immediate:!0});const V=()=>{k&&St(()=>{z.value?.focus(),z.value?.select()}),n("buttonClick")},j=Te=>{g?.value||(Te?.stopPropagation(),n("mainClick"))},Z=()=>{w.value||V()},R=Te=>{if(w.value){j(Te);return}V()},K=Te=>{o.allowEnterPropagation||Te.stopPropagation(),R(Te)},x=Te=>{const Ne=o.toolbarItem?.nestedOptions?.value??[],Je=Te.trim();if(!Je)return"";const ct=Ne.find(tt=>typeof tt?.label=="string"&&tt.label.toLowerCase()===Je.toLowerCase());return ct?.label?ct.label:Ne.find(tt=>typeof tt?.label=="string"&&tt.label.toLowerCase().startsWith(Je.toLowerCase()))?.label??Je},$=()=>{const Te=String(L.value??"").trim();let Ne=Te;if(T.value==="fontSize"){const Je=Number.parseFloat(Te);Ne=Te.match(/^\d+(\.5)?$/)?Te:Number.isFinite(Je)?Math.floor(Je).toString():""}else T.value==="fontFamily"&&(Ne=x(Te));return Ne?(n("textSubmit",Ne),L.value=Ne,!0):!1},H=Te=>{const Ne=Te?.currentTarget;Ne instanceof HTMLInputElement&&(Ne.focus({preventScroll:!0}),Ne.select())},J=Te=>{requestAnimationFrame(()=>{const Ne=document.getElementById(`inlineTextInput-${Te}`);Ne instanceof HTMLInputElement&&(Ne.focus({preventScroll:!0}),Ne.select())})},Q=()=>{const Te=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Te instanceof HTMLElement?(Te.focus({preventScroll:!0}),!0):!1},Y=()=>{const Te=r?.$toolbar?.pendingSelectionCapture,Ne=()=>{Te&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Te)};if(Q()){Ne();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Ne())},_e=()=>{$()&&Y()},ue=Te=>{if($(),Te.shiftKey){T.value==="fontSize"&&(Te.preventDefault(),St(()=>J("fontFamily")));return}if(Te.preventDefault(),T.value==="fontFamily"){St(()=>J("fontSize"));return}T.value==="fontSize"&&St(Y)},ve=ke(()=>S.value?S.value:{minWidth:o.minWidth}),ge=ke(()=>m?.value?sr.dropdownCaretUp:sr.dropdownCaretDown);return(Te,Ne)=>(ye(),De("div",{class:en(["sd-toolbar-item",Qe(C).className]),style:bn(ve.value),role:e.isOverflowItem?"menuitem":"button","aria-label":Qe(C).ariaLabel,"aria-disabled":Qe(g)?"true":void 0,"data-sd-part":"toolbar-item",onClick:Z,onKeydown:Ne[9]||(Ne[9]=ii(Je=>K(Je),["enter"])),tabindex:"0"},[He("div",{class:en(["sd-toolbar-button",{"sd-active":Qe(s),"sd-disabled":Qe(g),narrow:e.isNarrow,wide:e.isWide,split:w.value,"has-inline-text-input":Qe(k),"high-contrast":Qe(W)}]),"data-item":`btn-${Qe(i)||""}`},[w.value?(ye(),De("div",{key:0,class:"sd-toolbar-button__main","data-item":`btn-${Qe(i)||""}-main`,onClick:Ne[0]||(Ne[0]=Je=>j(Je))},[Qe(a)?(ye(),an(vI,{key:0,color:Qe(d),class:"sd-toolbar-icon",icon:Qe(a),name:Qe(i)},null,8,["color","icon","name"])):vt("",!0),Qe(l)&&!Qe(u)&&!Qe(v)?(ye(),De("div",Nj,Ut(Qe(l)),1)):vt("",!0)],8,Fj)):vt("",!0),w.value?(ye(),De("div",{key:1,class:"sd-toolbar-button__caret","data-item":`btn-${Qe(i)||""}-caret`,"aria-label":`${Qe(C).ariaLabel} options`,role:"button"},[He("div",{class:"sd-dropdown-caret",innerHTML:ge.value,style:bn({opacity:Qe(g)?.6:1})},null,12,zj)],8,Bj)):(ye(),De(Kt,{key:2},[Qe(a)?(ye(),an(vI,{key:0,color:Qe(d),class:"sd-toolbar-icon",icon:Qe(a),name:Qe(i)},null,8,["color","icon","name"])):vt("",!0),Qe(l)&&!Qe(u)&&(!Qe(v)||T.value==="fontFamily")?(ye(),De("div",{key:1,class:en(["sd-button-label",{"sd-visually-hidden":Qe(v)&&T.value==="fontFamily"}])},Ut(Qe(l)),3)):vt("",!0),Qe(v)?(ye(),De("span",jj,[Qe(i)==="fontSize"?ya((ye(),De("input",{key:0,"onUpdate:modelValue":Ne[1]||(Ne[1]=Je=>L.value=Je),onKeydown:[ii(Jt(_e,["stop","prevent"]),["enter"]),Ne[2]||(Ne[2]=ii(Je=>ue(Je),["tab"]))],onClick:Ne[3]||(Ne[3]=Jt(Je=>H(Je),["stop"])),onFocus:Ne[4]||(Ne[4]=Je=>H(Je)),type:"text",class:en(["button-text-input button-text-input--font-size",{"high-contrast":Qe(W)}]),id:"inlineTextInput-"+Qe(i),autocomplete:"off",ref_key:"inlineInput",ref:z},null,42,Vj)),[[ji,L.value]]):ya((ye(),De("input",{key:1,"onUpdate:modelValue":Ne[5]||(Ne[5]=Je=>L.value=Je),placeholder:Qe(l),onKeydown:[ii(Jt(_e,["stop","prevent"]),["enter"]),Ne[6]||(Ne[6]=ii(Je=>ue(Je),["tab"]))],onClick:Ne[7]||(Ne[7]=Jt(Je=>H(Je),["stop"])),onFocus:Ne[8]||(Ne[8]=Je=>H(Je)),type:"text",class:en(["button-text-input",{"button-text-input--font-family":T.value==="fontFamily","high-contrast":Qe(W)}]),id:"inlineTextInput-"+Qe(i),"data-item":T.value==="fontFamily"?`btn-${Qe(i)}-input`:void 0,autocomplete:"off",ref_key:"inlineInput",ref:z},null,42,Uj)),[[ji,L.value]])])):vt("",!0),Qe(f)?(ye(),De("div",{key:3,class:"sd-dropdown-caret","data-item":`btn-${Qe(i)||""}-toggle`,innerHTML:ge.value,style:bn({opacity:Qe(g)?.6:1})},null,12,Hj)):vt("",!0)],64)),He("div",$j,Ut(`${Qe(C).ariaLabel} ${Qe(s)?"selected":"unset"}`),1)],10,Pj)],46,Oj))}},t2=un(Gj,[["__scopeId","data-v-22817fa7"]]);Ft(),mn();var Wj={class:"toolbar-separator",role:"separator","aria-label":"Toolbar separator"},Kj={__name:"ToolbarSeparator",props:{active:{type:Boolean,default:!1}},emits:["command"],setup(e,{emit:t}){const{isHighContrastMode:n}=ds(),r=()=>n.value?"#000":"var(--sd-ui-border, #dbdbdb)";return(o,i)=>(ye(),De("div",Wj,[He("div",{class:"separator-inner",style:bn({backgroundColor:r()})},null,4)]))}},qj=un(Kj,[["__scopeId","data-v-cb82253a"]]);Ft(),mn();var Yj={class:"toolbar-dropdown"},Xj=["onClick"],Zj={key:0,class:"toolbar-dropdown-option__icon"},Qj={class:"toolbar-dropdown-option__label"},Hm='button, [href], input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])',Jj={__name:"ToolbarDropdown",props:{options:{type:Array,default:()=>[]},show:{type:Boolean,required:!0},placement:{type:String,default:"bottom-start"},disabled:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})},menuProps:{type:Function,default:null},nodeProps:{type:Function,default:null},closeOnEscape:{type:Boolean,default:!0},hasOpenChild:{type:Boolean,default:!1}},emits:["update:show","select"],setup(e,{emit:t}){const n=e,r=t,o=tw(),i=re(null),s=re(null),a=re({top:"0px",left:"0px",maxHeight:"none"}),l=re([]),u=re(-1),d=ke(()=>!!n.show),f=re(document.fullscreenElement),p=ke(()=>d.value&&f.value?f.value:document.body),g=ke(()=>n.options.some(ae=>ae?.type==="render")),m=ke(()=>!!o.menu),v=ke(()=>typeof n.menuProps!="function"?{}:n.menuProps()||{}),k=ke(()=>{const{class:ae,style:Ee,...Ue}=v.value;return Ue}),b=ke(()=>["toolbar-dropdown-menu",v.value.class,{"toolbar-dropdown-menu--render-only":m.value||n.options.length>0&&n.options.every(ae=>ae&&ae.type==="render")}]),S=ke(()=>{const ae=v.value.style||{};return{...n.contentStyle,...ae}}),C=ke(()=>({...S.value,position:"fixed",top:a.value.top,left:a.value.left,maxHeight:a.value.maxHeight,zIndex:2e3})),w=ae=>{r("update:show",ae)},T=()=>{d.value&&w(!1)},L=()=>{if(!i.value)return;const ae=i.value.getBoundingClientRect(),Ee=s.value,Ue=Ee?.offsetWidth??0,ie=Ee?.scrollHeight??Ee?.offsetHeight??0,I=window.innerWidth||document.documentElement.clientWidth||0,se=window.innerHeight||document.documentElement.clientHeight||0,F=8,q=4,P=ae.bottom+q,ee=ae.top-q,be=Math.max(0,se-P-F),N=Math.max(0,ee-F),B=be<ie&&N>be,de=B?N:be,Se=B?Math.max(F,ee-(ie?Math.min(ie,de):de)):P;let Ae=ae.left;n.placement==="bottom-end"&&(Ae=ae.right-Ue);const Le=Math.max(F,I-Ue-F);Ae=Math.min(Math.max(F,Ae),Le),a.value={top:`${Se}px`,left:`${Ae}px`,maxHeight:`${de}px`}},z=async()=>{f.value=document.fullscreenElement,d.value&&(await St(),L())},W=()=>{n.disabled||w(!d.value)},V=ae=>typeof n.nodeProps!="function"?{}:n.nodeProps(ae)||{},j=ae=>{ae?.disabled||ae?.type!=="render"&&(r("select",ae?.key,ae),T())},Z=ae=>ae?.type==="render",R=ae=>!ae?.disabled&&ae?.type!=="render",K=ae=>typeof ae?.icon=="function"||!!ae?.icon,x=ae=>typeof ae?.icon=="function"?ae.icon(ae):ae?.icon||null,$=ae=>ae?typeof ae=="string"?ae.split(/\s+/).includes("sd-selected"):Array.isArray(ae)?ae.some($):typeof ae=="object"?!!ae["sd-selected"]:!1:!1,H=ae=>$(ae?.props?.class)||$(ae?.class),J=()=>n.options.map((ae,Ee)=>R(ae)?Ee:-1).filter(ae=>ae>=0),Q=()=>{const ae=n.options.findIndex(Ee=>R(Ee)&&H(Ee));return ae>=0?ae:J()[0]??-1},Y=(ae,Ee)=>{if(!ae){delete l.value[Ee];return}l.value[Ee]=ae},_e=()=>{l.value.forEach((Ee,Ue)=>{Ee&&Ee.setAttribute("tabindex",Ue===u.value?"0":"-1")});const ae=l.value[u.value];ae&&typeof ae.focus=="function"&&(ae.focus(),ae.scrollIntoView?.({block:"nearest",inline:"nearest"}))},ue=ae=>{const Ee=J();if(!Ee.length){u.value=-1;return}const Ue=Ee.indexOf(u.value);if(Ue<0){u.value=ae>0?Ee[0]:Ee[Ee.length-1];return}const ie=(Ue+ae+Ee.length)%Ee.length;u.value=Ee[ie]},ve=()=>{let ae=n.options[u.value];if(!R(ae)){const Ee=J()[0];ae=Ee===void 0?null:n.options[Ee]}ae&&j(ae)},ge=uc({name:"ToolbarDropdownRenderOption",props:{option:{type:Object,required:!0}},setup(ae){return()=>typeof ae.option.render!="function"?null:ae.option.render()}}),Te=uc({name:"ToolbarDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(ae){return()=>{const Ee=x(ae.option);return typeof Ee=="string"?zr("span",{innerHTML:Ee}):Ee}}}),Ne=ae=>{if(!d.value)return;const Ee=ae.target;if(!(Ee instanceof Element))return;const Ue=i.value?.contains(Ee),ie=s.value?.contains(Ee);Ue||ie||n.hasOpenChild&&Ee.closest('[data-sd-part="dropdown-menu"]')||T()},Je=re(null),ct=()=>{const ae=i.value,Ee=document.activeElement;if(ae&&Ee instanceof HTMLElement&&ae.contains(Ee)){Je.value=Ee;return}Je.value=ae?.matches?.(Hm)?ae:ae?.querySelector(Hm)},tt=()=>{const ae=Je.value;if(ae instanceof HTMLElement&&document.contains(ae)){ae.focus();return}const Ee=i.value;if(!Ee)return;const Ue=Ee.matches?.(Hm)?Ee:Ee.querySelector(Hm);if(Ue instanceof HTMLElement){Ue.focus();return}Ee.setAttribute("tabindex","-1"),Ee.focus()},Tt=ae=>{if(!d.value)return;const{key:Ee}=ae;if(["Escape","ArrowDown","ArrowUp","Enter"].includes(Ee)){if(Ee==="Escape"){if(!n.closeOnEscape)return;ae.preventDefault(),T(),St(()=>{requestAnimationFrame(tt)});return}if(!(g.value||m.value)){if(ae.preventDefault(),Ee==="ArrowDown"){ue(1),_e();return}if(Ee==="ArrowUp"){ue(-1),_e();return}Ee==="Enter"&&ve()}}};return jt(d,async ae=>{if(!ae){u.value=-1,l.value=[];return}ct(),await St(),L(),!(g.value||m.value)&&(u.value=Q(),await St(),_e())},{immediate:!0}),jt(d,ae=>{ae?(document.addEventListener("pointerdown",Ne,!0),document.addEventListener("keydown",Tt,!0),window.addEventListener("resize",L),window.addEventListener("scroll",L,!0)):(document.removeEventListener("pointerdown",Ne,!0),document.removeEventListener("keydown",Tt,!0),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0))},{immediate:!0}),Nn(()=>{document.addEventListener("fullscreenchange",z)}),cr(()=>{document.removeEventListener("fullscreenchange",z),document.removeEventListener("pointerdown",Ne,!0),document.removeEventListener("keydown",Tt,!0),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0)}),(ae,Ee)=>(ye(),De("div",Yj,[He("div",{ref_key:"triggerRef",ref:i,class:"toolbar-dropdown-trigger","data-sd-part":"dropdown-trigger",onClick:W},[pu(ae.$slots,"trigger",{},void 0,!0)],512),(ye(),an(dl,{to:p.value},[Xt(Ap,{name:"fade-in-scale-up-transition"},{default:ao(()=>[d.value?(ye(),De("div",Ls({key:0,ref_key:"menuRef",ref:s,"data-sd-part":"dropdown-menu",class:b.value,style:C.value},k.value),[m.value?pu(ae.$slots,"menu",{key:0},void 0,!0):vt("",!0),(ye(!0),De(Kt,null,ir(m.value?[]:e.options,(Ue,ie)=>(ye(),De("div",Ls({key:Ue.key,ref_for:!0,ref:I=>Y(I,ie),class:["toolbar-dropdown-option",[Ue.class,Ue.props?.class,{"sd-disabled":Ue.disabled,"sd-render":Z(Ue)}]],tabindex:"-1",onClick:I=>j(Ue)},{ref_for:!0},{...Ue.props,...V(Ue)}),[Z(Ue)?(ye(),an(Qe(ge),{key:0,option:Ue},null,8,["option"])):(ye(),De(Kt,{key:1},[K(Ue)?(ye(),De("span",Zj,[Xt(Qe(Te),{option:Ue},null,8,["option"])])):vt("",!0),He("span",Qj,Ut(Ue.label),1)],64))],16,Xj))),128))],16)):vt("",!0)]),_:3})],8,["to"]))]))}},yI=un(Jj,[["__scopeId","data-v-764d5fd7"]]),bI=e=>{const t=e?.target;t instanceof Element&&(t.closest('input, textarea, [contenteditable="true"]')||e.preventDefault())},Lc=(e,t=null)=>{if(typeof t?.focus=="function"){t.focus();return}const n=e?.superdoc?.focus??e?.activeEditor?.focus;if(typeof n=="function"){n.call(e?.superdoc??e?.activeEditor,{preventScroll:!0});return}const r=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');r instanceof HTMLElement&&r.focus({preventScroll:!0})};Ft(),mn();var eV={__name:"OverflowMenu",props:{toolbarItem:{type:Object,required:!0},overflowItems:{type:Array,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["buttonClick","close","command"],setup(e,{emit:t}){const n=t,r=e,o=ke(()=>r.toolbarItem.expand.value),i=ke(()=>r.overflowItems.some(u=>u.type==="dropdown"&&Qe(u.expand))),s=ke(()=>({...r.toolbarItem,active:o.value})),a=u=>{if(u!==o.value){if(u){n("buttonClick",r.toolbarItem);return}n("close")}},l=({item:u,argument:d,option:f})=>{n("command",{item:u,argument:d,option:f})};return(u,d)=>(ye(),an(yI,{class:"overflow-menu","close-on-escape":!i.value,"has-open-child":i.value,"content-style":{width:"200px",padding:"4px 8px",fontFamily:r.uiFontFamily},options:[],placement:"bottom-end",show:o.value,"onUpdate:show":a,"menu-props":()=>({role:"group",class:["overflow-menu_items","sd-toolbar-overflow-menu"]})},{trigger:ao(()=>[Xt(t2,{"toolbar-item":s.value},null,8,["toolbar-item"])]),menu:ao(()=>[Xt(Wm,{class:"superdoc-toolbar-overflow","toolbar-items":e.overflowItems,"ui-font-family":r.uiFontFamily,"from-overflow":"",onMousedown:Qe(bI),onCommand:l},null,8,["toolbar-items","ui-font-family","onMousedown"])]),_:1},8,["close-on-escape","has-open-child","content-style","show"]))}},tV=un(eV,[["__scopeId","data-v-5f8ee279"]]),wI=e=>String(e??"").trim().toLowerCase(),$m=(e,t)=>{const n=wI(e);if(!n)return-1;for(let r=0;r<t.length;r+=1)if(wI(t[r]).startsWith(n))return r;return-1},nV=(e,t,{autocomplete:n=!0}={})=>{const r=String(e??""),o=$m(r,t),i=o>=0?String(t[o]??""):"";return n&&o>=0&&i.length>r.length?{matchIndex:o,display:i,selectionStart:r.length,selectionEnd:i.length}:{matchIndex:o,display:r,selectionStart:r.length,selectionEnd:r.length}},rV=e=>{let t=String(e??"").trim();for(;t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"));)t=t.slice(1,-1).trim();return t},oV=e=>e<=31||e===127,iV=e=>e===32||e===160||e===65279,sV=e=>Array.from(String(e)).filter(t=>!oV(t.charCodeAt(0))).join(""),aV=e=>{let t="",n=!1;for(const r of String(e)){if(iV(r.charCodeAt(0))){n=t.length>0;continue}n&&(t+=" "),n=!1,t+=r}return t},lV=e=>{const t=String(e??"").split(",")[0]??"",n=sV(t);return aV(rV(n)).trim()},cV=1,uV=1638,dV=e=>{const t=String(e??"").replace(/[^0-9.-]/g,""),n=Number.parseFloat(t);if(!Number.isFinite(n))return"";const r=Math.round(n*2)/2;return r<cV?"":String(Math.min(r,uV))};Ft(),mn();var fV=["data-item"],hV=["id","value","disabled","aria-label","aria-expanded","aria-controls","aria-activedescendant","data-item"],pV=["data-item","aria-label","disabled"],mV=["innerHTML"],gV=["id","aria-label"],vV=["id","aria-selected","aria-label","onMousedown","onMouseenter"],yV={class:"toolbar-dropdown-option__label"},bV={class:"sd-button-label sd-font-combobox__legacy-label","aria-hidden":"true"},wV={__name:"ToolbarComboBox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"},showPreview:{type:Boolean,default:!1},normalizeValue:{type:Function,default:e=>String(e??"").trim()}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t,{isHighContrastMode:o}=ds(),i=re(null),s=re(null),a=re(null),l=re([]),u=re(!1),d=re(!1),f=re(-1),p=re(""),g=re(""),m=re(!1),v=re({top:"0px",left:"0px",minWidth:"0px",maxHeight:"none"}),k=ke(()=>n.item.nestedOptions?.value??[]),b=ke(()=>k.value.map(N=>String(N?.label??""))),S=ke(()=>String(n.item.label?.value??"")),C=ke(()=>!!n.item.disabled?.value),w=ke(()=>String(n.item.name?.value??"")),T=ke(()=>n.item.attributes?.value?.ariaLabel??"Font family"),L=ke(()=>u.value?g.value:S.value),z=ke(()=>`sd-${w.value||"combobox"}-listbox-${n.item.id?.value??"default"}`),W=N=>`${z.value}-option-${N}`,V=ke(()=>d.value&&f.value>=0?W(f.value):void 0),j=ke(()=>d.value?sr.dropdownCaretUp:sr.dropdownCaretDown),Z=N=>{const B=String(N??"").trim().toLowerCase();return k.value.find(de=>String(de?.label??"").trim().toLowerCase()===B)?.props?.style?.fontFamily||N||n.uiFontFamily},R=ke(()=>n.showPreview?{fontFamily:Z(u.value?g.value:S.value)}:{fontFamily:n.uiFontFamily}),K=()=>{const N=n.item.selectedValue?.value;if(N){const B=k.value.findIndex(de=>de?.key===N);if(B>=0)return B}return b.value.findIndex(B=>B.toLowerCase()===S.value.toLowerCase())},x=(N,B)=>{const de=i.value;if(!(!de||typeof de.setSelectionRange!="function"))try{de.setSelectionRange(N,B)}catch{}},$=()=>{l.value[f.value]?.scrollIntoView?.({block:"nearest",inline:"nearest"})},H=()=>{l.value[f.value]?.focus?.()},J=()=>{const N=s.value;if(!N)return;const B=N.getBoundingClientRect(),de=a.value,Se=de?.scrollHeight??de?.offsetHeight??0,Ae=window.innerHeight||document.documentElement.clientHeight||0,Le=window.innerWidth||document.documentElement.clientWidth||0,Xe=8,it=4,yt=B.bottom+it,Mt=B.top-it,Lt=Math.max(0,Ae-yt-Xe),Wt=Math.max(0,Mt-Xe),Be=Lt<Se&&Wt>Lt,rn=Be?Wt:Lt,zn=Be?Math.max(Xe,Mt-(Se?Math.min(Se,rn):rn)):yt,Ht=Math.min(Math.max(Xe,B.left),Math.max(Xe,Le-B.width-Xe));v.value={top:`${zn}px`,left:`${Ht}px`,minWidth:`${B.width}px`,maxHeight:`${rn}px`}},Q=ke(()=>({position:"fixed",top:v.value.top,left:v.value.left,minWidth:v.value.minWidth,maxHeight:v.value.maxHeight,fontFamily:n.uiFontFamily,zIndex:2e3})),Y=N=>{n.item.expand&&typeof n.item.expand=="object"&&"value"in n.item.expand&&(n.item.expand.value=N)},_e=(N,{focusInput:B=!1,focusOption:de=!1}={})=>{if(C.value||!k.value.length){Y(!1);return}d.value=!0,Y(!0),f.value=N??-1,B&&(u.value=!0,g.value=S.value,i.value?.focus()),St(()=>{J(),$(),de&&H()})},ue=({syncItem:N=!0}={})=>{d.value=!1,f.value=-1,N&&Y(!1)},ve=()=>{ue(),u.value=!1,p.value="",g.value=S.value},ge=()=>{C.value||(d.value||r("item-clicked"),u.value=!0,p.value="",g.value=S.value,St(()=>x(0,g.value.length)))},Te=N=>{if(C.value)return;const B=document.activeElement===i.value;if(r("item-clicked"),u.value=!0,B||(p.value="",g.value=S.value,N.preventDefault(),i.value?.focus({preventScroll:!0}),x(0,S.value.length)),!d.value){const de=K();_e(de>=0?de:0)}},Ne=N=>{const B=N.relatedTarget;B instanceof Node&&s.value?.contains(B)||B instanceof Node&&a.value?.contains(B)||ve()},Je=N=>{if(m.value)return;const B=N.target,de=B.value,Se=typeof B.selectionStart=="number"?B.selectionStart:de.length,Ae=typeof B.selectionEnd=="number"?B.selectionEnd:Se,Le=typeof N.inputType=="string"&&N.inputType.startsWith("delete"),Xe=Se===de.length&&Ae===de.length;p.value=de;const it=nV(de,b.value,{autocomplete:!Le&&Xe});g.value=it.display,B.value=it.display,it.display===de&&!Xe?x(Se,Ae):x(it.selectionStart,it.selectionEnd),d.value&&(f.value=it.matchIndex,St($))},ct=N=>{m.value=!1,Je(N)},tt=N=>{if(!k.value.length)return;const B=k.value.length,de=f.value<0?N>0?-1:0:f.value;f.value=(de+N+B)%B,St($)},Tt=(N,B)=>{r("item-clicked"),r("command",{item:n.item,argument:N,option:B}),B&&(n.item.selectedValue.value=B.key)},ae=N=>{N&&(Tt(N.value??N.label,N),u.value=!1,p.value="",g.value=N.label,ue())},Ee=()=>{if(d.value&&f.value>=0)return ae(k.value[f.value]),!0;const N=$m(p.value,b.value);if(N>=0)return ae(k.value[N]),!0;const B=n.normalizeValue(p.value);return B?(Tt(B,null),u.value=!1,p.value="",g.value=B,ue(),!0):!1},Ue=N=>{if(!(N.isComposing||m.value||N.keyCode===229)&&!(N.ctrlKey||N.metaKey||N.altKey))switch(N.key){case"ArrowDown":if(N.preventDefault(),d.value)H();else{const B=$m(p.value,b.value),de=B>=0?B:K();_e(de>=0?de:0,{focusOption:!0})}break;case"ArrowUp":if(N.preventDefault(),d.value)H();else{const B=$m(p.value,b.value),de=B>=0?B:K();_e(de>=0?de:k.value.length-1,{focusOption:!0})}break;case"Enter":N.preventDefault(),Ee()&&r("editor-handoff"),i.value?.blur();break;case"Tab":N.preventDefault(),Ee(),ue(),i.value?.blur(),r("tab-out",N);break;case"Escape":N.preventDefault(),ve(),St(()=>i.value?.focus());break;default:break}},ie=N=>{if(N.preventDefault(),!C.value)if(r("item-clicked"),d.value)ue(),i.value?.focus();else{const B=K();_e(B>=0?B:0,{focusOption:!0})}},I=(N,B)=>{N.preventDefault(),ae(B),r("editor-handoff"),i.value?.blur()},se=N=>{f.value=N},F=N=>{if(!(N.ctrlKey||N.metaKey||N.altKey))switch(N.key){case"ArrowDown":N.preventDefault(),tt(1),H();break;case"ArrowUp":N.preventDefault(),tt(-1),H();break;case"Enter":N.preventDefault(),f.value>=0&&(ae(k.value[f.value]),r("editor-handoff"));break;case"Escape":N.preventDefault(),ve(),St(()=>i.value?.focus());break;case"Tab":N.preventDefault(),f.value>=0?ae(k.value[f.value]):ue(),r("tab-out",{shiftKey:N.shiftKey,target:i.value});break;default:break}},q=N=>{if(!d.value)return;const B=N.target;B instanceof Element&&(s.value?.contains(B)||a.value?.contains(B)||ve())};jt(d,N=>{N?(document.addEventListener("pointerdown",q,!0),window.addEventListener("resize",J),window.addEventListener("scroll",J,!0)):(document.removeEventListener("pointerdown",q,!0),window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0),l.value=[])},{immediate:!0}),cr(()=>{document.removeEventListener("pointerdown",q,!0),window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0)});const P=(N,B)=>{if(!N){delete l.value[B];return}l.value[B]=N},ee=N=>N===f.value,be=N=>N?.key&&N.key===n.item.selectedValue?.value;return jt(S,N=>{u.value||(g.value=N)}),jt(()=>!!n.item.expand?.value,N=>{if(N&&!d.value){const B=K();_e(B>=0?B:0,{focusInput:!0});return}!N&&d.value&&ue({syncItem:!1})}),(N,B)=>(ye(),De("div",{ref_key:"rootRef",ref:s,class:en(["sd-font-combobox sd-toolbar-split-field",{"sd-disabled":C.value,"high-contrast":Qe(o)}]),style:bn(n.item.style?.value),"data-item":`btn-${w.value}`},[He("span",{class:"sd-font-combobox__field sd-toolbar-split-field__main",onMousedown:Te},[He("input",{ref_key:"inputRef",ref:i,id:`inlineTextInput-${w.value}`,class:"button-text-input sd-font-combobox__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:"false",value:L.value,style:bn(R.value),disabled:C.value,"aria-label":T.value,"aria-expanded":d.value?"true":"false","aria-controls":z.value,"aria-activedescendant":V.value,"aria-haspopup":"listbox","aria-autocomplete":"both","data-item":`btn-${w.value}-input`,onFocus:ge,onBlur:Ne,onInput:Je,onKeydown:Ue,onCompositionstart:B[0]||(B[0]=de=>m.value=!0),onCompositionend:ct},null,44,hV)],32),He("button",{type:"button",class:"sd-font-combobox__caret sd-toolbar-split-field__caret","data-item":`btn-${w.value}-toggle`,tabindex:"-1","aria-label":`${T.value} options`,disabled:C.value,onMousedown:ie},[He("span",{class:"sd-dropdown-caret",innerHTML:j.value},null,8,mV)],40,pV),(ye(),an(dl,{to:"body"},[d.value?(ye(),De("div",{key:0,ref_key:"popupRef",ref:a,role:"listbox",id:z.value,"aria-label":T.value,class:en(["sd-font-combobox__listbox",{"high-contrast":Qe(o)}]),style:bn(Q.value)},[(ye(!0),De(Kt,null,ir(k.value,(de,Se)=>(ye(),De("div",Ls({key:de.key,ref_for:!0,ref:Ae=>P(Ae,Se),id:W(Se),role:"option",tabindex:"-1",class:["toolbar-dropdown-option sd-font-combobox__option",{"sd-active":ee(Se),"sd-selected":be(de)}],"aria-selected":be(de)?"true":"false","aria-label":`${T.value} - ${de.label}`},{ref_for:!0},de.props,{onMousedown:Ae=>I(Ae,de),onMouseenter:Ae=>se(Se),onKeydown:F}),[He("span",yV,Ut(de.label),1)],16,vV))),128))],14,gV)):vt("",!0)])),He("span",bV,Ut(S.value),1)],14,fV))}},CI=un(wV,[["__scopeId","data-v-53e0af20"]]);Ft();var CV={__name:"FontFamilyCombobox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t;return(o,i)=>(ye(),an(CI,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!0,"normalize-value":Qe(lV),onCommand:i[0]||(i[0]=s=>r("command",s)),onItemClicked:i[1]||(i[1]=s=>r("item-clicked")),onTabOut:i[2]||(i[2]=s=>r("tab-out",s)),onEditorHandoff:i[3]||(i[3]=s=>r("editor-handoff"))},null,8,["item","ui-font-family","normalize-value"]))}};Ft();var kV={__name:"FontSizeCombobox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t;return(o,i)=>(ye(),an(CI,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!1,"normalize-value":Qe(dV),onCommand:i[0]||(i[0]=s=>r("command",s)),onItemClicked:i[1]||(i[1]=s=>r("item-clicked")),onTabOut:i[2]||(i[2]=s=>r("tab-out",s)),onEditorHandoff:i[3]||(i[3]=s=>r("editor-handoff"))},null,8,["item","ui-font-family","normalize-value"]))}};Ft(),mn();var SV=["data-placement"],_V=2500,AV=Object.assign({inheritAttrs:!1},{__name:"SdTooltip",props:{trigger:{type:String,default:"hover"},delay:{type:Number,default:100},duration:{type:Number,default:100},disabled:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})}},setup(e){const t=e,n=nw(),r=re(!1),o=re(null),i=re(null),s=re({top:"0px",left:"0px"}),a=re("top");let l=null,u=null,d=null;const f=ke(()=>["sd-tooltip-content",n.class]),p=ke(()=>({...t.contentStyle,...n.style||{},position:"fixed",top:s.value.top,left:s.value.left,zIndex:2100})),g=()=>{l&&(window.clearTimeout(l),l=null)},m=()=>{u&&(window.clearTimeout(u),u=null)},v=()=>{d&&(window.clearTimeout(d),d=null)},k=()=>{v(),d=window.setTimeout(()=>{d=null,w()},_V)},b=(R,K)=>{const x=window.getComputedStyle(R),$=parseFloat(x[K]);return Number.isFinite($)?x.boxSizing==="border-box"?$:(K==="width"?["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"]:["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"]).reduce((H,J)=>H+(parseFloat(x[J])||0),$):K==="width"?R.offsetWidth:R.offsetHeight},S=()=>{if(!o.value||!i.value)return;const R=o.value.getBoundingClientRect(),K=b(i.value,"width"),x=b(i.value,"height"),$=window.innerWidth||document.documentElement.clientWidth||0,H=document.documentElement.clientHeight||window.innerHeight||0,J=8,Q=10;let Y=R.left+R.width/2-K/2;Y=Math.max(J,Math.min(Y,$-K-J));const _e=R.top-x-Q,ue=R.bottom+Q,ve=_e>=J,ge=ue+x<=H-J,Te=R.top-Q,Ne=H-R.bottom-Q;ve?a.value="top":ge?a.value="bottom":a.value=Te>=Ne?"top":"bottom";const Je=a.value==="top"?_e:ue,ct=Math.min(J,Math.max(0,H-x)),tt=Math.max(ct,H-x-J);s.value={top:`${Math.max(ct,Math.min(Je,tt))}px`,left:`${Y}px`}},C=async()=>{t.disabled||(g(),m(),!r.value&&(r.value=!0,k(),await St(),S()))},w=()=>{m(),g(),v(),r.value&&(r.value=!1)},T=()=>{if(g(),m(),!r.value){if(t.delay===0){C();return}u=window.setTimeout(()=>{u=null,C()},t.delay)}},L=()=>{if(m(),g(),!!r.value){if(t.duration===0){w();return}l=window.setTimeout(()=>{l=null,w()},t.duration)}},z=()=>{t.trigger==="hover"&&T()},W=()=>{t.trigger==="hover"&&L()},V=()=>{m(),g()},j=()=>{L()},Z=R=>{R.key==="Escape"&&w()};return jt(()=>t.disabled,R=>{R&&w()}),jt(r,R=>{R?(window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),document.addEventListener("keydown",Z,!0)):(window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),document.removeEventListener("keydown",Z,!0))}),cr(()=>{m(),g(),v(),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),document.removeEventListener("keydown",Z,!0)}),(R,K)=>(ye(),De(Kt,null,[He("span",{ref_key:"triggerRef",ref:o,class:"sd-tooltip-trigger",onMouseenter:z,onMouseleave:W,onFocusin:z,onFocusout:W},[pu(R.$slots,"trigger",{},void 0,!0)],544),(ye(),an(dl,{to:"body"},[Xt(Ap,{name:"fade-in-scale-up-transition"},{default:ao(()=>[r.value&&!e.disabled?(ye(),De("div",{key:0,ref_key:"contentRef",ref:i,class:en(f.value),style:bn(p.value),"data-placement":a.value,onMouseenter:V,onMouseleave:j},[K[0]||(K[0]=He("span",{class:"sd-tooltip-arrow","aria-hidden":"true"},null,-1)),pu(R.$slots,"default",{},void 0,!0)],46,SV)):vt("",!0)]),_:3})]))],64))}}),Gm=un(AV,[["__scopeId","data-v-88d296cd"]]);Ft(),mn();var IV=["onKeydown","tabindex","data-item-id"],EV={key:0},TV={key:0},xV={key:0},RV={key:0},MV={key:0},LV={__name:"ButtonGroup",props:{toolbarItems:{type:Array,required:!0},overflowItems:{type:Array,default:()=>[]},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"},position:{type:String,default:"left"},fromOverflow:{type:Boolean,default:!1},compactSideGroups:{type:Boolean,default:!1}},emits:["command","item-clicked","dropdown-update-show"],setup(e,{emit:t}){const n=t,{proxy:r}=pr(),o=re([]),i=re(null),s=e,a=re(null),{isHighContrastMode:l}=ds(),u=window.matchMedia("(max-width: 768px)").matches,d=ke(()=>s.position==="left"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-start"}:s.position==="right"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-end"}:{flexGrow:u?0:1,justifyContent:"center"}),f=ae=>ae.type==="button",p=ae=>ae.type==="dropdown",g=ae=>ae.type==="dropdown"&&ae.name?.value==="fontFamily",m=ae=>ae.type==="dropdown"&&ae.name?.value==="fontSize",v=ae=>ae.type==="separator",k=ae=>ae.type==="overflow",b=ae=>!!ae.nestedOptions?.value?.length,S=ae=>{if(!ae)return!1;const Ee=ae.expand;return typeof Ee=="object"&&Ee!==null&&"value"in Ee?!!Ee.value:!!Ee},C=(ae,Ee)=>{ae?.expand&&(ae.expand.value=Ee)},w=(ae,Ee=void 0)=>{if(ae.disabled.value)return;if(k(ae)){const ie=!S(ae);ie&&z(),C(ae,ie),a.value=ie?ae:null,n("item-clicked");return}if(p(ae))return;a.value&&p(a.value)&&S(a.value)&&z(),n("item-clicked");const Ue=Ee!==void 0?Ee:ae.argument?.value;n("command",Ue===void 0?{item:ae}:{item:ae,argument:Ue})},T=(ae,Ee)=>{ae.disabled.value||(a.value=null,n("command",{item:ae,argument:Ee}))},L=ae=>{if(ae.disabled.value)return;z();const Ee=ae.splitButtonCommand,Ue=ae.command,ie=Ee||Ue;if(!ie)return;const I={...ae,command:ie};n("item-clicked"),n("command",{item:I})},z=()=>{const ae=r?.$toolbar?.toolbarItems||[],Ee=r?.$toolbar?.overflowItems||[],Ue=[...ae,...Ee];(Ue.length?Ue:s.toolbarItems).forEach(ie=>{const I=k(ie)&&!s.fromOverflow;(p(ie)||I)&&C(ie,!1)}),a.value=null},W=(ae,Ee)=>{z();const Ue=ae.dropdownValueKey.value?Ee[ae.dropdownValueKey.value]:Ee.label;n("command",{item:ae,argument:Ue,option:Ee}),ae.selectedValue.value=Ee.key,ae.restoreEditorFocus&&Lc(r?.$toolbar)},V=ae=>{n("command",ae)},j=()=>{z(),n("item-clicked")},Z=()=>{const ae=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return ae instanceof HTMLElement?(ae.focus({preventScroll:!0}),!0):!1},R=()=>{const ae=r?.$toolbar?.pendingSelectionCapture,Ee=()=>{ae&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(ae)};if(Z()){Ee();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Ee())},K=ae=>!(ae instanceof HTMLElement)||ae.classList.contains("sd-disabled")?null:ae.querySelector("input:not([disabled]), textarea:not([disabled]), select:not([disabled])")||ae.querySelector('button:not([disabled]), [role="button"]:not(.sd-disabled), [tabindex]:not([tabindex="-1"])'),x=(ae,Ee)=>{const Ue=ae?.target?.closest?.(".sd-toolbar-item-ctn");if(!(Ue instanceof HTMLElement))return!1;let ie=Ee>0?Ue.nextElementSibling:Ue.previousElementSibling;for(;ie;){const I=K(ie);if(I instanceof HTMLElement)return Ue.setAttribute("tabindex","-1"),ie.setAttribute("tabindex","0"),I.focus(),!0;ie=Ee>0?ie.nextElementSibling:ie.previousElementSibling}return!1},$=ae=>{z();const Ee=ae?.shiftKey?-1:1;x(ae,Ee)||R()},H=ae=>{if(z(),ae?.shiftKey){x(ae,-1)||R();return}R()},J=()=>{R()},Q=ae=>ae.nestedOptions?.value?.length?ae.nestedOptions.value.map(Ee=>{const Ue=Ee?.type!=="render"&&ae.selectedValue.value===Ee.key;return{...Ee,props:{...Ee.props,class:Ue?"sd-selected":""}}}):[],Y=(ae,Ee)=>({role:"menuitem","aria-label":`${Ee.attributes.value.ariaLabel} - ${ae.label}`}),_e=ae=>{const Ee=ae.target,Ue=ae.target.closest(".sd-toolbar-item-ctn").nextElementSibling;Ue&&(Ee.setAttribute("tabindex","-1"),Ue.setAttribute("tabindex","0"),Ue.focus())},ue=ae=>{const Ee=ae.target,Ue=ae.target.closest(".sd-toolbar-item-ctn").previousElementSibling;Ue&&(Ee.setAttribute("tabindex","-1"),Ue.setAttribute("tabindex","0"),Ue.focus())},ve=ae=>{const Ee=ae.target.closest(".button-group").nextElementSibling;if(Ee)Ee.setAttribute("tabindex","0"),Ee.focus();else{const Ue=document.querySelector(".ProseMirror");Ue&&Ue.focus()}},ge=ae=>{const Ee=ae.target.closest(".button-group").previousElementSibling;Ee&&(Ee.setAttribute("tabindex","0"),Ee.focus())},Te=ae=>{if(!ae.disabled.value){if(p(ae)){ct(!S(ae),ae);return}w(ae)}},Ne=(ae,Ee)=>{const Ue=ae.target.nodeName==="INPUT"||ae.target.nodeName==="TEXTAREA",ie=Ee.name.value==="fontSize"||Ee.name.value==="fontFamily";if(!(Ue&&ie)&&["Enter"," ","Spacebar","Escape","ArrowRight","ArrowLeft","Tab"].includes(ae.key))switch(ae.preventDefault(),ae.key){case"Enter":case" ":case"Spacebar":Te(Ee);break;case"Escape":z();break;case"ArrowRight":z(),_e(ae);break;case"ArrowLeft":z(),ue(ae);break;case"Tab":ae.shiftKey?ge(ae):ve(ae);break;default:break}},Je=ae=>{const Ee=o.value.find(Ue=>!Ue.classList.contains("sd-disabled"));Ee&&(Ee.setAttribute("tabindex","0"),Ee.focus())},ct=(ae,Ee)=>{if(n("item-clicked"),!ae){z(),n("dropdown-update-show",!1);return}z(),a.value=Ee,C(Ee,!0),n("dropdown-update-show",!0)},tt=ae=>{if(!a.value)return;const Ee=ae.target;Ee instanceof Element&&(Ee.closest('[data-sd-part="dropdown-menu"]')||i.value?.contains(Ee)||z())};return jt(()=>S(a.value),ae=>{ae?document.addEventListener("pointerdown",tt,!0):document.removeEventListener("pointerdown",tt,!0)},{immediate:!0}),cr(()=>{document.removeEventListener("pointerdown",tt,!0)}),(ae,Ee)=>(ye(),De("div",{style:bn(d.value),class:"button-group",role:"group",onFocus:Je,ref_key:"buttonGroupRef",ref:i},[(ye(!0),De(Kt,null,ir(e.toolbarItems,(Ue,ie)=>(ye(),De("div",{key:Ue.id.value,class:en([{narrow:Ue.isNarrow.value,wide:Ue.isWide.value,"sd-disabled":Ue.disabled.value},"sd-toolbar-item-ctn"]),onKeydown:I=>Ne(I,Ue),ref_for:!0,ref_key:"toolbarItemRefs",ref:o,tabindex:ie===0?0:-1,"data-item-id":Ue.id.value},[v(Ue)?(ye(),an(qj,{key:0,style:{width:"20px"}})):vt("",!0),g(Ue)&&b(Ue)?(ye(),an(Gm,{key:1,trigger:"hover",disabled:!Ue.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ao(()=>[Xt(CV,{item:Ue,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:V,onItemClicked:j,onTabOut:Ee[0]||(Ee[0]=I=>$(I)),onEditorHandoff:J},null,8,["item","ui-font-family"])]),default:ao(()=>[He("div",null,[as(Ut(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),De("span",EV,"(disabled)")):vt("",!0)])]),_:2},1032,["disabled","content-style"])):m(Ue)&&b(Ue)?(ye(),an(Gm,{key:2,trigger:"hover",disabled:!Ue.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ao(()=>[Xt(kV,{item:Ue,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:V,onItemClicked:j,onTabOut:Ee[1]||(Ee[1]=I=>H(I)),onEditorHandoff:J},null,8,["item","ui-font-family"])]),default:ao(()=>[He("div",null,[as(Ut(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),De("span",TV,"(disabled)")):vt("",!0)])]),_:2},1032,["disabled","content-style"])):p(Ue)&&Ue.nestedOptions?.value?.length?(ye(),an(yI,{key:3,options:Q(Ue),disabled:Ue.disabled.value,show:S(Ue),"content-style":{fontFamily:s.uiFontFamily},placement:"bottom-start",class:"sd-toolbar-button sd-editor-toolbar-dropdown",onSelect:(I,se)=>W(Ue,se),"onUpdate:show":I=>ct(I,Ue),style:bn(Ue.dropdownStyles.value),"menu-props":()=>({role:"menu",style:{fontFamily:s.uiFontFamily},class:["sd-toolbar-dropdown-menu",{"high-contrast":Qe(l)}]}),"node-props":I=>Y(I,Ue)},{trigger:ao(()=>[Xt(Gm,{trigger:"hover",disabled:!Ue.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ao(()=>[Xt(t2,{"toolbar-item":Ue,disabled:Ue.disabled.value,"allow-enter-propagation":!0,onTextSubmit:I=>T(Ue,I),onMainClick:I=>L(Ue)},null,8,["toolbar-item","disabled","onTextSubmit","onMainClick"])]),default:ao(()=>[He("div",null,[as(Ut(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),De("span",xV,"(disabled)")):vt("",!0)])]),_:2},1032,["disabled","content-style"])]),_:2},1032,["options","disabled","show","content-style","onSelect","onUpdate:show","style","menu-props","node-props"])):f(Ue)?(ye(),an(Gm,{key:4,trigger:"hover",class:"sd-editor-toolbar-tooltip","content-style":{fontFamily:s.uiFontFamily}},{trigger:ao(()=>[Xt(t2,{"toolbar-item":Ue,"is-overflow-item":e.fromOverflow,onTextSubmit:I=>T(Ue,I),onButtonClick:I=>w(Ue)},null,8,["toolbar-item","is-overflow-item","onTextSubmit","onButtonClick"])]),default:ao(()=>[Ue.tooltip?(ye(),De("div",RV,[as(Ut(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),De("span",MV,"(disabled)")):vt("",!0)])):vt("",!0)]),_:2},1032,["content-style"])):vt("",!0),k(Ue)&&e.overflowItems.length?(ye(),an(tV,{key:5,"toolbar-item":Ue,"ui-font-family":s.uiFontFamily,onButtonClick:I=>w(Ue),"overflow-items":e.overflowItems,onClose:z,onCommand:Ee[2]||(Ee[2]=I=>n("command",I))},null,8,["toolbar-item","ui-font-family","onButtonClick","overflow-items"])):vt("",!0)],42,IV))),128))],36))}},Wm=un(LV,[["__scopeId","data-v-8d7a9de1"]]),DV=[["Arial","sans-serif"],["Arial Black","sans-serif"],["Arial Narrow","sans-serif"],["Baskerville Old Face","serif"],["Bookman Old Style","serif"],["Brush Script MT","cursive"],["Calibri","sans-serif"],["Century","serif"],["Century Gothic","sans-serif"],["Comic Sans MS","sans-serif"],["Cooper Black","serif"],["Courier New","monospace"],["Garamond","serif"],["Georgia","serif"],["Gill Sans MT Condensed","sans-serif"],["Helvetica","sans-serif"],["Lucida Console","monospace"],["Segoe UI","sans-serif"],["Tahoma","sans-serif"],["Times New Roman","serif"],["Trebuchet MS","sans-serif"],["Verdana","sans-serif"]],OV=DV.map(([e,t])=>({label:e,key:e,props:{style:{fontFamily:`${e}, ${t}`},"data-item":"btn-fontFamily-option"}}));function PV(e){if(e?.length)return e.map(t=>({label:t.label,key:t.value,props:{style:{fontFamily:t.previewFamily||t.label},"data-item":"btn-fontFamily-option"}}))}var FV=[{label:"8",key:"8pt",props:{"data-item":"btn-fontSize-option"}},{label:"9",key:"9pt",props:{"data-item":"btn-fontSize-option"}},{label:"10",key:"10pt",props:{"data-item":"btn-fontSize-option"}},{label:"11",key:"11pt",props:{"data-item":"btn-fontSize-option"}},{label:"12",key:"12pt",props:{"data-item":"btn-fontSize-option"}},{label:"14",key:"14pt",props:{"data-item":"btn-fontSize-option"}},{label:"18",key:"18pt",props:{"data-item":"btn-fontSize-option"}},{label:"24",key:"24pt",props:{"data-item":"btn-fontSize-option"}},{label:"30",key:"30pt",props:{"data-item":"btn-fontSize-option"}},{label:"36",key:"36pt",props:{"data-item":"btn-fontSize-option"}},{label:"48",key:"48pt",props:{"data-item":"btn-fontSize-option"}},{label:"60",key:"60pt",props:{"data-item":"btn-fontSize-option"}},{label:"72",key:"72pt",props:{"data-item":"btn-fontSize-option"}},{label:"96",key:"96pt",props:{"data-item":"btn-fontSize-option"}}],ah={sm:768,md:1024,lg:1280,xl:1410},n2={undo:"undo",redo:"redo",bold:"bold",italic:"italic",underline:"underline",strike:"strikethrough",acceptTrackedChangeBySelection:"track-changes-accept-selection",rejectTrackedChangeOnSelection:"track-changes-reject-selection",ruler:"ruler",formattingMarks:"formatting-marks",zoom:"zoom",measurementUnit:"measurement-unit",documentMode:"document-mode",link:"link",fontFamily:"font-family",fontSize:"font-size",list:"bullet-list",numberedlist:"numbered-list",table:"table-insert",image:"image",tableOfContents:"table-of-contents-insert",color:"text-color",highlight:"highlight-color",textAlign:"text-align",lineHeight:"line-height",linkedStyles:"linked-style",indentleft:"indent-decrease",indentright:"indent-increase",directionLtr:"direction-ltr",directionRtl:"direction-rtl",clearFormatting:"clear-formatting",copyFormat:"copy-format"},kI={addRowBefore:"table-add-row-before",addRowAfter:"table-add-row-after",deleteRow:"table-delete-row",addColumnBefore:"table-add-column-before",addColumnAfter:"table-add-column-after",deleteColumn:"table-delete-column",deleteTable:"table-delete",deleteCellAndTableBorders:"table-remove-borders",mergeCells:"table-merge-cells",splitCell:"table-split-cell",fixTables:"table-fix"},SI=Object.values(kI),pK=[...new Set([...Object.values(n2),...SI])],NV=new Set(["link"]),mK=new Set(Object.keys(n2).filter(e=>!NV.has(e)));Ft(),mn();var BV="Arial, Helvetica, sans-serif",zV={__name:"Toolbar",emits:["command","toggle","select"],setup(e,{emit:t}){const{proxy:n}=pr();let r=re(1);const o=re(0),i=re(!1);let s=null,a=null;const l=ke(()=>{const W=n?.$toolbar?.config?.uiDisplayFallbackFont;return typeof W=="string"&&W.trim()?W.trim():BV}),u=n.$toolbar.config?.toolbarGroups?.includes("left"),d=n.$toolbar.config?.toolbarGroups?.includes("right"),f=n.$toolbar.config?.toolbarButtonsExclude||[],p=W=>(o.value,n.$toolbar.getToolbarItemByGroup(W).filter(V=>!f.includes(V.name.value))),g=()=>{i.value=n.$toolbar.getAvailableWidth()<=ah.lg},v=Rj(async()=>{await n.$toolbar.onToolbarResize(),g(),r.value+=1},300),k=()=>{r.value+=1},b=()=>{o.value+=1};function S(){window.removeEventListener("resize",v),n.$toolbar.off?.("toolbar-items-changed",k),n.$toolbar.off?.("toolbar-state-change",b),s?.disconnect(),s=null}function C(){S(),window.addEventListener("resize",v),n.$toolbar.on?.("toolbar-items-changed",k),n.$toolbar.on?.("toolbar-state-change",b),typeof ResizeObserver<"u"&&n.$toolbar.config?.responsiveToContainer&&n.$toolbar.toolbarContainer&&(s=new ResizeObserver(()=>{v()}),s.observe(n.$toolbar.toolbarContainer)),g()}Nn(C),kv(C),Sv(S),cr(S);const w=()=>{if(!n.$toolbar.activeEditor){a=null,n.$toolbar.pendingSelectionCapture=null;return}a=n.$toolbar.ui?.selection?.capture?.()??null,n.$toolbar.pendingSelectionCapture=a},T=({item:W,argument:V,option:j})=>{L(),n.$toolbar.emitCommand({item:W,argument:V,option:j})},L=()=>{const W=n.$toolbar.activeEditor;if(!W)return;const V=n.$toolbar.pendingSelectionCapture??a;if(V&&typeof n.$toolbar.ui?.selection?.restore=="function"){n.$toolbar.ui.selection.restore(V);return}W.commands?.restoreSelection?.()},z=W=>{w(),bI(W)};return(W,V)=>(ye(),De("div",{class:"superdoc-toolbar",key:Qe(r),role:"toolbar","aria-label":"Toolbar","data-sd-part":"toolbar","data-editor-ui-surface":"",onMousedown:z},[Qe(u)?(ye(),an(Wm,{key:0,tabindex:"0","toolbar-items":p("left"),"overflow-items":Qe(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"left",onCommand:T,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):vt("",!0),Xt(Wm,{tabindex:"0","toolbar-items":p("center"),"overflow-items":Qe(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"center",onCommand:T},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"]),Qe(d)?(ye(),an(Wm,{key:1,tabindex:"0","toolbar-items":p("right"),"overflow-items":Qe(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"right",onCommand:T,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):vt("",!0)],32))}},jV=un(zV,[["__scopeId","data-v-ed19716b"]]),VV=e=>{if(!e)return e;const t=e.props?.style?.fontFamily??e.label??e.key;return{...e,props:{...e.props,style:{...e.props?.style,fontFamily:t},"data-item":e.props?.["data-item"]??"btn-fontFamily-option"}}};Ft();var Mn=e=>{if(!["button","options","separator","dropdown","overflow"].includes(e.type))throw new Error("Invalid toolbar item type - "+e.type);if(e.type==="button"&&!e.defaultLabel&&!e.icon)throw new Error(`Toolbar button item needs either "icon" or "defaultLabel" - ${e.name}. "label" is the live label and is not a substitute for "defaultLabel".`);if(!e.name)throw new Error("Invalid toolbar item name - "+e.name);const t=re(ol()),n=e.type,r=re(e.name),o=e.command,i=e.noArgumentCommand,s=re(e.icon),a=re(e.group||"center"),l=re(e.allowWithoutEditor),u=re(e.attributes||{}),d=!!e.disabled,f=re(e.disabled),p=re(!1),g=re(!1),m=re(e.style),v=re(e.isNarrow),k=re(e.isWide),b=re(e.minWidth),S=re(e.layoutWidth),C=re(e.suppressActiveHighlight||!1),w=re(e.argument),T=re(null),L=re(null),z=re(e.iconColor),W=re(e.hasCaret),V=re(!!e.splitButton),j=e.splitButtonCommand,Z=!!e.restoreEditorFocus,R=re(e.dropdownStyles),K=re(e.tooltip),x=re(e.tooltipVisible),$=re(e.tooltipTimeout),H=re(e.defaultLabel),J=re(e.label),Q=re(e.hideLabel),Y=re(e.inlineTextInputVisible),_e=re(e.hasInlineTextInput),ue=re(e.markName),ve=re(e.labelAttr),ge=re(e.selectedValue),Te=re(e.dropdownValueKey),Ne=re(e.inputRef||null),Je=re([]);if(e.options){if(!Array.isArray(e.options))throw new Error("Invalid toolbar item options - "+e.options);let se=0;for(let F=0;F<e.options.length;F+=1){const q=e.options[F];(!q||typeof q!="object")&&(se+=1)}if(se)throw new Error(`Toolbar item options must all be objects - ${e.name}. ${se} row(s) are not, so this item is skipped.`);Je.value?.push(...e.options)}const ct=(se={},...F)=>{Ee(se,...F),!C.value&&(p.value=!0)},tt=()=>{Ue(),p.value=!1},Tt=se=>{f.value=se},ae=()=>{f.value=d},Ee=e.onActivate||(()=>null),Ue=e.onDeactivate||(()=>null),ie=()=>{const se={};return Object.keys(I).forEach(F=>{I[F].value!==void 0&&(se[F]=I[F].value)}),se},I={id:t,name:r,type:n,command:o,noArgumentCommand:i,icon:s,tooltip:K,group:a,attributes:u,disabled:f,active:p,expand:g,nestedOptions:Je,style:m,isNarrow:v,isWide:k,minWidth:b,layoutWidth:S,argument:w,parentItem:L,iconColor:z,hasCaret:W,splitButton:V,splitButtonCommand:j,dropdownStyles:R,tooltipVisible:x,tooltipTimeout:$,defaultLabel:H,label:J,hideLabel:Q,inlineTextInputVisible:Y,hasInlineTextInput:_e,restoreEditorFocus:Z,markName:ue,labelAttr:ve,childItem:T,allowWithoutEditor:l,dropdownValueKey:Te,selectedValue:ge,inputRef:Ne};return{...I,initiallyDisabled:d,unref:ie,activate:ct,deactivate:tt,setDisabled:Tt,resetDisabled:ae,onActivate:Ee,onDeactivate:Ue}};Ft(),mn();var UV=["onClick","innerHTML","aria-label","onKeydown"],HV={__name:"AlignmentButtons",emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=ds(),r=t,o=re([]),i=[{key:"left",ariaLabel:"Align left",icon:sr.alignLeft},{key:"center",ariaLabel:"Align center",icon:sr.alignCenter},{key:"right",ariaLabel:"Align right",icon:sr.alignRight},{key:"justify",ariaLabel:"Justify",icon:sr.alignJustify}],s=d=>{r("select",d)},a=d=>{if(d===o.value.length-1)return;const f=o.value[d+1];f&&(f.setAttribute("tabindex","0"),f.focus())},l=d=>{if(d===0)return;const f=o.value[d-1];f&&(f.setAttribute("tabindex","0"),f.focus())},u=(d,f)=>{switch(d.key){case"ArrowLeft":l(f);break;case"ArrowRight":a(f);break;case"Enter":s(i[f].key);break;default:break}};return Nn(()=>{const d=o.value[0];d&&(d.setAttribute("tabindex","0"),d.focus())}),(d,f)=>(ye(),De("div",{class:en(["alignment-buttons",{"high-contrast":Qe(n)}])},[(ye(),De(Kt,null,ir(i,(p,g)=>He("div",{key:p.key,class:"sd-button-icon",onClick:m=>s(p.key),innerHTML:p.icon,"data-item":"btn-textAlign-option",role:"menuitem","aria-label":p.ariaLabel,ref_for:!0,ref_key:"alignmentButtonsRefs",ref:o,onKeydown:Jt(m=>u(m,g),["prevent"])},null,40,UV)),64))],2))}},$V=un(HV,[["__scopeId","data-v-13e5f7a4"]]);Ft(),mn();var GV=["onClick","innerHTML","aria-label","onKeydown"],WV={__name:"StyleButtonsList",props:{buttons:{type:Array,required:!0},selectedStyle:{type:String,default:null},iconSize:{type:Number,default:25}},emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=ds(),r=t,o=e,i=re([]),s=ke(()=>({width:`${o.iconSize}px`,height:`${o.iconSize}px`})),a=f=>{r("select",f)},l=f=>{if(f===i.value.length-1)return;const p=i.value[f+1];p&&(p.setAttribute("tabindex","0"),p.focus())},u=f=>{if(f===0)return;const p=i.value[f-1];p&&(p.setAttribute("tabindex","0"),p.focus())},d=(f,p)=>{switch(f.key){case"ArrowLeft":u(p);break;case"ArrowRight":l(p);break;case"Enter":a(o.buttons[p].key);break;default:break}};return Nn(()=>{const f=i.value[0];f&&(f.setAttribute("tabindex","0"),f.focus())}),(f,p)=>(ye(),De("div",{class:en(["style-buttons-list",{"high-contrast":Qe(n)}])},[(ye(!0),De(Kt,null,ir(o.buttons,(g,m)=>(ye(),De("div",{key:g.key,class:en(["sd-button-icon",{"sd-selected":o.selectedStyle===g.key}]),style:bn(s.value),onClick:v=>a(g.key),innerHTML:g.icon,role:"menuitem","aria-label":g.ariaLabel,ref_for:!0,ref_key:"buttonRefs",ref:i,onKeydown:Jt(v=>d(v,m),["prevent"])},null,46,GV))),128))],2))}},_I=un(WV,[["__scopeId","data-v-44f37ff6"]]),KV=[{key:"disc",icon:sr.bulletListDisc,ariaLabel:"Opaque circle"},{key:"circle",icon:sr.bulletListCircle,ariaLabel:"Outline circle"},{key:"square",icon:sr.bulletListSquare,ariaLabel:"Opaque square"}],qV=[{key:"decimal",icon:sr.numberedListDecimal,ariaLabel:"1. 2. 3."},{key:"decimal-paren",icon:sr.numberedListDecimalParen,ariaLabel:"1) 2) 3)"},{key:"upper-roman",icon:sr.numberedListUpperRoman,ariaLabel:"I. II. III."},{key:"lower-roman",icon:sr.numberedListLowerRoman,ariaLabel:"i. ii. iii."},{key:"upper-alpha",icon:sr.numberedListUpperAlpha,ariaLabel:"A. B. C."},{key:"upper-alpha-paren",icon:sr.numberedListUpperAlphaParen,ariaLabel:"A) B) C)"},{key:"lower-alpha",icon:sr.numberedListLowerAlpha,ariaLabel:"a. b. c."},{key:"lower-alpha-paren",icon:sr.numberedListLowerAlphaParen,ariaLabel:"a) b) c)"}];Ft(),mn();var YV=["onClick","onKeydown"],XV={class:"document-mode-column icon-column"},ZV=["innerHTML"],QV={class:"document-mode-column text-column"},JV={class:"document-mode-type"},eU={class:"document-mode-description"},tU={__name:"DocumentMode",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=re([]),{isHighContrastMode:o}=ds(),i=e,s=d=>{n("select",d)},a=d=>{if(d===r.value.length-1)return;const f=r.value[d+1];f&&(f.setAttribute("tabindex","0"),f.focus())},l=d=>{if(d===0)return;const f=r.value[d-1];f&&(f.setAttribute("tabindex","0"),f.focus())},u=(d,f)=>{switch(d.key){case"ArrowDown":a(f);break;case"ArrowUp":l(f);break;case"Enter":s(i.options[f]);break;default:break}};return Nn(()=>{r.value[0].setAttribute("tabindex","0"),r.value[0].focus()}),(d,f)=>(ye(),De("div",{class:en(["document-mode",{"high-contrast":Qe(o)}])},[(ye(!0),De(Kt,null,ir(e.options,(p,g)=>(ye(),De("div",{class:en(["sd-option-item",{"sd-disabled":p.disabled}]),onClick:m=>s(p),"data-item":"btn-documentMode-option",role:"menuitem",ref_for:!0,ref_key:"documentModeRefs",ref:r,onKeydown:Jt(m=>u(m,g),["prevent"])},[He("div",XV,[He("div",{class:"icon-column__icon",innerHTML:p.icon},null,8,ZV)]),He("div",QV,[He("div",JV,Ut(p.label),1),He("div",eU,Ut(p.description),1)])],42,YV))),256))],2))}},nU=un(tU,[["__scopeId","data-v-bee14d7a"]]);Ft(),mn();var rU={class:"linked-style-buttons","data-editor-ui-surface":""},oU=["onClick","onKeydown","aria-label"],iU={__name:"LinkedStyle",props:{styles:{type:Array,default:()=>[]},selectedOption:{type:String,default:null}},emits:["select"],setup(e,{emit:t}){const n=t,r=re([]),o=e,i=p=>{n("select",p)},s=p=>{if(p===r.value.length-1)return;const g=r.value[p+1];g.setAttribute("tabindex","0"),g.focus()},a=p=>{if(p===0)return;const g=r.value[p-1];g.setAttribute("tabindex","0"),g.focus()},l=(p,g,m)=>{switch(p.key){case"ArrowDown":s(g);break;case"ArrowUp":a(g);break;case"Enter":p.preventDefault(),i(m);break;default:break}},u=p=>p?.name??p?.id??"",d=p=>{const g=p?.preview?.css;return g&&typeof g=="object"?g:void 0},f=()=>{r.value[0]&&(r.value[0].setAttribute("tabindex","0"),r.value[0].focus())};return Nn(f),jt(()=>o.styles.length,async(p,g)=>{p===0||g!==0||(await St(),f())}),(p,g)=>(ye(),De("div",rU,[(ye(!0),De(Kt,null,ir(o.styles,(m,v)=>(ye(),De("div",{key:m.id??v,class:en(["style-item",{selected:e.selectedOption===m.id}]),onClick:k=>i(m),onKeydown:k=>l(k,v,m),"aria-label":`Linked style - ${m.id??u(m)}`,ref_for:!0,ref_key:"styleRefs",ref:r},[He("div",{class:"style-name","data-item":"btn-linkedStyles-option",style:bn(d(m))},Ut(u(m)),5)],42,oU))),128))]))}},sU=un(iU,[["__scopeId","data-v-74c8924b"]]);Ft(),mn();var aU=["placeholder"],lU={class:"sd-ai-writer__footer"},cU={key:0,class:"sd-ai-writer__error",role:"alert"},uU=["disabled"],dU="https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights",fU="You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.",hU={__name:"AIWriter",props:{selectedText:{type:String,default:""},target:{type:Object,default:null},doc:{type:Object,default:null},apiKey:{type:String,default:""},endpoint:{type:String,default:""},restoreSelection:{type:Function,default:null},handleClose:{type:Function,required:!0}},setup(e){const t=e,n=re(""),r=re(!1),o=re(""),i=re(null),s=ke(()=>t.selectedText?"Insert prompt to update text":"Insert prompt to generate text"),a=ke(()=>n.value.trim().length>0&&!r.value);Nn(()=>{St(()=>{i.value?.focus()})});function l(m){if(typeof m=="string")return m;if(!m||typeof m!="object")return"";const v=m.custom_prompt;if(Array.isArray(v)){const k=v[0];if(k&&typeof k.value=="string")return k.value}return v&&typeof v=="object"&&typeof v.value=="string"?v.value:typeof m.value=="string"?m.value:typeof m.text=="string"?m.text:""}async function u(m){const v={"Content-Type":"application/json"};t.apiKey&&(v["x-api-key"]=t.apiKey);const k=t.selectedText.trim(),b=k?`Rewrite the following text: "${k}" using these instructions: ${m}`:`Generate text based on the following prompt: ${m}`,S=await fetch(t.endpoint||dU,{method:"POST",headers:v,body:JSON.stringify({stream:!1,context:fU,insights:[{type:"custom_prompt",name:k?"text_rewrite":"text_generation",message:b,format:[{value:""}]}]})});if(!S.ok){const w=await S.text().catch(()=>"");throw new Error(w||`AI request failed with ${S.status}`)}const C=l((S.headers.get("content-type")||"").includes("application/json")?await S.json():await S.text()).trim();if(!C)throw new Error("AI returned no text.");return C}function d(m){return!m||typeof m!="object"?!0:!(m.success===!1||m.ok===!1)}function f(m){const v=t.doc;if(!v)throw new Error("Document API is unavailable.");t.restoreSelection?.();let k=null,b=!1;if(t.selectedText&&t.target&&typeof v.replace=="function"?(k=v.replace({target:t.target,text:m}),b=!0):t.target&&typeof v.insert=="function"?(k=v.insert({target:t.target,value:m,type:"text"}),b=!0):typeof v.insert=="function"&&(k=v.insert({value:m,type:"text"}),b=!0),!b)throw new Error("Document text insertion is unavailable.");if(!d(k))throw new Error("Unable to insert generated text.")}async function p(){if(a.value){o.value="",r.value=!0;try{f(await u(n.value.trim())),t.handleClose()}catch(m){o.value=m instanceof Error?m.message:String(m)}finally{r.value=!1}}}function g(m){m.key!=="Enter"||m.shiftKey||(m.preventDefault(),p())}return(m,v)=>(ye(),De("form",{class:"sd-ai-writer","data-item":"ai-writer",onSubmit:Jt(p,["prevent"])},[ya(He("textarea",{ref_key:"textareaRef",ref:i,"onUpdate:modelValue":v[0]||(v[0]=k=>n.value=k),class:"sd-ai-writer__input",placeholder:s.value,rows:"4",onKeydown:g},null,40,aU),[[ji,n.value]]),He("div",lU,[o.value?(ye(),De("p",cU,Ut(o.value),1)):vt("",!0),He("button",{class:"sd-ai-writer__submit",type:"submit",disabled:!a.value},Ut(r.value?"Generating":"Generate"),9,uU)])],32))}},pU=un(hU,[["__scopeId","data-v-67f6c6f7"]]);Ft(),mn();var mU=["aria-label","onClick","onKeydown"],gU=["innerHTML"],vU=["innerHTML"],Km=7,yU={__name:"IconGridRow",props:{icons:{type:Array,required:!0},activeColor:{type:Object,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=e,o=ke(()=>m=>r.activeColor.value?r.activeColor.value.toUpperCase()===m.value:!1),i=(m,v)=>v===5||["#FFFFFF","#FAFF09"].includes(m)?{color:"#000"}:{color:"#FFF"},s=m=>{n("select",m.value)},a=re([]),l=re([]);Nn(()=>{if(!r.icons.every(v=>Array.isArray(v)))throw new Error("icon props must be 2d array");const m=l.value[0];m&&(m.setAttribute("tabindex","0"),m.focus({preventScroll:!0}))});const u=(m,v)=>{const k=Km*m+v+1,b=l.value[k];b&&(b.setAttribute("tabindex","0"),b.focus({preventScroll:!0}))},d=(m,v)=>{const k=Km*m+v-1,b=l.value[k];b&&(b.setAttribute("tabindex","0"),b.focus({preventScroll:!0}))},f=(m,v)=>{const k=v+Km*(m+1),b=l.value[k];b&&(b.setAttribute("tabindex","0"),b.focus({preventScroll:!0}))},p=(m,v)=>{const k=v+Km*(m-1),b=l.value[k];b&&(b.setAttribute("tabindex","0"),b.focus({preventScroll:!0}))},g=(m,v,k,b)=>{switch(m.key){case"ArrowRight":u(v,k);break;case"ArrowLeft":d(v,k);break;case"ArrowDown":f(v,k);break;case"ArrowUp":p(v,k);break;case"Enter":s(b);break;case"Escape":n("clickoutside");break;default:break}};return(m,v)=>(ye(!0),De(Kt,null,ir(e.icons,(k,b)=>(ye(),De("div",{class:"sd-option-row",key:b,role:"group",ref_for:!0,ref_key:"rowRefs",ref:a},[(ye(!0),De(Kt,null,ir(k,(S,C)=>(ye(),De("div",{class:"sd-option",key:C,"aria-label":S.label,role:"menuitem",ref_for:!0,ref_key:"iconRefs",ref:l,onClick:Jt(w=>s(S),["stop","prevent"]),onKeydown:Jt(w=>g(w,b,C,S),["prevent"])},[He("div",{class:"sd-option__icon",innerHTML:S.icon,style:bn(S.style)},null,12,gU),o.value(S)?(ye(),De("div",{key:0,class:"sd-option__check",innerHTML:Qe(sr).colorOptionCheck,style:bn(i(S.value,C))},null,12,vU)):vt("",!0)],40,mU))),128))]))),128))}},AI=un(yU,[["__scopeId","data-v-05eb02fc"]]),bU=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 512c53.2 0 101.4-21.6 136.1-56.6l-298.3-235C140 257.1 128 292.3 128 320c0 106 86 192 192 192zM505.2 370.7c4.4-16.2 6.8-33.1 6.8-50.7c0-91.2-130.2-262.3-166.6-308.3C339.4 4.2 330.5 0 320.9 0l-1.8 0c-9.6 0-18.5 4.2-24.5 11.7C277.8 33 240.7 81.3 205.8 136L38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L505.2 370.7zM224 336c0 44.2 35.8 80 80 80c8.8 0 16 7.2 16 16s-7.2 16-16 16c-61.9 0-112-50.1-112-112c0-8.8 7.2-16 16-16s16 7.2 16 16z"/></svg>
|
|
101
101
|
`;Ft(),mn();var wU={class:"options-grid-wrap"},CU=["innerHTML"],kU={class:"option-grid-ctn"},SU={__name:"IconGrid",props:{icons:{type:Array,required:!0},customIcons:{type:Array,required:!1},activeColor:{type:Object,required:!1},hasNoneIcon:{type:Boolean,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=o=>{n("select",o)};return(o,i)=>(ye(),De("div",wU,[e.hasNoneIcon?(ye(),De("div",{key:0,class:"none-option",role:"menuitem","aria-label":"Clear color selection",onClick:i[0]||(i[0]=s=>r("none"))},[He("span",{innerHTML:Qe(bU),class:"none-icon"},null,8,CU),i[1]||(i[1]=as(" None ",-1))])):vt("",!0),He("div",kU,[Xt(AI,{icons:e.icons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"]),e.customIcons.flat().length?(ye(),De(Kt,{key:0},[i[2]||(i[2]=He("span",{class:"option-grid-ctn__subtitle"},"Custom colors",-1)),Xt(AI,{icons:e.customIcons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"])],64)):vt("",!0)])]))}},_U=un(SU,[["__scopeId","data-v-52b0283a"]]);Ft();var AU=e=>{e.expand.value=!1},Gt=(e,t=null)=>({label:t,icon:sr.colorOption,value:e,style:{color:e,boxShadow:"0 0 5px 1px rgba(0, 0, 0, 0.1)",borderRadius:"50%"}}),r2=(e,t,n=[],r=!1)=>{const o=i=>{t.iconColor.value=i,e.emitCommand({item:t,argument:i}),AU(t),Lc(e)};return zr("div",{},[zr(_U,{icons:IU,customIcons:n,activeColor:t.iconColor,hasNoneIcon:r,onSelect:o})])},IU=[[Gt("#111111","black"),Gt("#333333","dark gray"),Gt("#5C5C5C","medium gray"),Gt("#858585","light gray"),Gt("#ADADAD","very light gray"),Gt("#D6D6D6","transparent gray"),Gt("#FFFFFF","white")],[Gt("#860028","dark red"),Gt("#D2003F","red"),Gt("#DB3365","coral red"),Gt("#E4668C","light red"),Gt("#ED99B2","pale pink"),Gt("#F6CCD9","transparent pink"),Gt("#FF004D","bright pink")],[Gt("#83015E","dark purple"),Gt("#CD0194","purple"),Gt("#D734A9","orchid"),Gt("#E167BF","light purple"),Gt("#EB99D4","lavender"),Gt("#F5CCEA","transparent pink"),Gt("#FF00A8","neon pink")],[Gt("#8E220A","maroon"),Gt("#DD340F","red-orange"),Gt("#E45C3F","burnt orange"),Gt("#EB856F","peach"),Gt("#F1AE9F","pale peach"),Gt("#F8D6CF","transparent peach"),Gt("#FF7A00","orange")],[Gt("#947D02","olive"),Gt("#E7C302","mustard yellow"),Gt("#ECCF35","yellow"),Gt("#F1DB67","light yellow"),Gt("#F5E79A","very pale yellow"),Gt("#FAF3CC","transparent yellow"),Gt("#FAFF09","neon yellow")],[Gt("#055432","forest green"),Gt("#07834F","green"),Gt("#399C72","medium green"),Gt("#6AB595","light green"),Gt("#9CCDB9","mint"),Gt("#CDE6DC","transparent mint"),Gt("#05F38F","bright teal")],[Gt("#063E7E","navy blue"),Gt("#0A60C5","blue"),Gt("#3B80D1","sky blue"),Gt("#6CA0DC","cornflower blue"),Gt("#9DBFE8","light blue"),Gt("#CEDFF3","very light blue"),Gt("#21c8ce","cyan")],[Gt("#3E027A","deep purple"),Gt("#6103BF","indigo"),Gt("#8136CC","violet"),Gt("#A068D9","lavender pink"),Gt("#C09AE6","light lilac"),Gt("#DFCDF2","transparent lilac"),Gt("#A91DFF","neon purple")]];Ft(),mn();var EU=["data-cols","data-rows","onKeydown","onClick"],TU=["aria-valuetext"],qm=5,xU={__name:"TableGrid",emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=re(0),o=re(0),{isHighContrastMode:i}=ds(),s=re([]),a=f=>{let p=f.target;if(p.dataset.grid)return;let g=[...p.parentElement.querySelectorAll("[data-item]")],m=parseInt(p.dataset.cols,10),v=parseInt(p.dataset.rows,10);l(g,m,v)},l=(f,p,g)=>{o.value=p,r.value=g;for(let m=0;m<f.length;m++){let v=f[m],k=parseInt(v.dataset.cols,10),b=parseInt(v.dataset.rows,10);k<=p&&b<=g?v.classList.add("sd-selected"):v.classList.remove("sd-selected")}},u=({cols:f,rows:p})=>{n("select",{cols:f,rows:p})},d=(f,p,g)=>{let m=p-1,v=g-1;switch(f.key){case"ArrowRight":{if(m>=4)return;const k=v*qm;s.value[k+m+1].setAttribute("tabindex","0"),s.value[k+m+1].focus(),l(s.value,p+1,g);break}case"ArrowLeft":{if(m<=0)return;const k=v*qm;s.value[k+m-1].setAttribute("tabindex","0"),s.value[k+m-1].focus(),l(s.value,p-1,g);break}case"ArrowDown":{if(v>=4)return;const k=(v+1)*qm;s.value[k+m].setAttribute("tabindex","0"),s.value[k+m].focus(),l(s.value,p,g+1);break}case"ArrowUp":{if(v<=0)return;const k=(v-1)*qm;s.value[k+m].setAttribute("tabindex","0"),s.value[k+m].focus(),l(s.value,p,g-1);break}case"Enter":u({cols:p,rows:g});break;default:break}};return Nn(()=>{s.value[0].setAttribute("tabindex","0"),s.value[0].focus(),l(s.value,1,1)}),(f,p)=>(ye(),De("div",{class:en(["toolbar-table-grid-wrapper",{"high-contrast":Qe(i)}])},[He("div",{class:"toolbar-table-grid",onMouseover:a,"data-grid":"true"},[(ye(),De(Kt,null,ir(5,g=>(ye(),De(Kt,{key:g},[(ye(),De(Kt,null,ir(5,m=>He("div",{class:"toolbar-table-grid__item",key:`${g}_${m}`,"data-cols":m,"data-rows":g,"data-item":"true",ref_for:!0,ref_key:"tableGridItems",ref:s,onKeydown:Jt(v=>d(v,m,g),["prevent"]),onClick:Jt(v=>u({cols:m,rows:g}),["stop","prevent"])},null,40,EU)),64))],64))),64))],32),He("div",{class:"toolbar-table-grid-value","aria-valuetext":`${r.value} x ${o.value}`},Ut(r.value)+" x "+Ut(o.value),9,TU)],2))}},RU=un(xU,[["__scopeId","data-v-b87d6ca2"]]);Ft(),mn();var MU={class:"toolbar-table-actions"},LU=["onClick","data-item","ariaLabel"],DU={class:"toolbar-table-actions__icon"},OU=["innerHTML"],PU={class:"toolbar-table-actions__label"},FU={__name:"TableActions",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=o=>{n("select",{command:o.command})};return(o,i)=>(ye(),De("div",MU,[(ye(!0),De(Kt,null,ir(e.options,s=>(ye(),De("div",{class:en(["toolbar-table-actions__item",{"toolbar-table-actions__item--border":s.bottomBorder}]),onClick:a=>r(s),"data-item":s.props?.["data-item"]||"",ariaLabel:s.props?.ariaLabel,role:"menuitem"},[He("div",DU,[He("div",{class:"toolbar-table-actions__icon-wrapper",innerHTML:s.icon},null,8,OU)]),He("div",PU,Ut(s.label),1)],10,LU))),256))]))}},NU=un(FU,[["__scopeId","data-v-0cdad084"]]),BU=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>
|
|
102
|
-
`;Ft();var Ws=e=>{e.expand.value=!1},o2=(e,t)=>{const n=e.layoutWidth?.value;return Number.isFinite(n)&&n>0?n:e.type==="separator"?t.get("separator"):t.get(e.name.value)||t.get("default")};function i2(e,t){const n={...e};return t?n.href=t:delete n.href,n}function II(e){const t=Array.isArray(e?.segments)?e.segments:[];if(e?.kind!=="text"||!t.length)return null;const n=t[0],r=t[t.length-1];if(!n?.blockId||!r?.blockId||!n.range||!r.range)return null;const o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start??0,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end??0,...o?{story:o}:{}},...o?{story:o}:{}}}function zU(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function EI(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function jU(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function VU(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var UU=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,excludedItemNames:u,additionalItems:d=[]}={})=>{const f=Mn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),p=(r??OV).map(VV),g=Mn({type:"dropdown",name:"fontFamily",tooltip:n.fontFamily,command:"setFontFamily",defaultLabel:"Arial",label:"Arial",markName:"textStyle",labelAttr:"fontFamily",hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,isWide:!0,style:{width:"116px"},suppressActiveHighlight:!0,attributes:{ariaLabel:"Font family"},options:p,onActivate:({fontFamily:et}={},kt=!1)=>{if(kt){g.label.value="",g.selectedValue.value="";return}if(!et)return;et=et.split(",")[0];const Bt=nn=>nn.value??nn.label,cn=p.find(nn=>Bt(nn)===g.defaultLabel.value),fn=p.find(nn=>Bt(nn)===et);fn?(g.label.value=fn.label,g.selectedValue.value=fn.key):cn?(g.label.value=et,g.selectedValue.value=cn.key):(g.label.value=et,g.selectedValue.value="")},onDeactivate:()=>{const et=p.find(kt=>(kt.value??kt.label)===g.defaultLabel.value);g.label.value=et?.label??g.defaultLabel.value,g.selectedValue.value=et?.key??""}}),m=Mn({type:"dropdown",name:"ai",dropdownStyles:{padding:0,outline:"none"},tooltip:n.ai,icon:t.ai,hideLabel:!0,hasCaret:!1,isWide:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:"AI"},options:[{type:"render",key:"ai",render:()=>v(m)}]});function v(et){const kt=EI(e),Bt=kt?.selectionTarget??II(kt?.target),cn=kt?.empty?"":zU(kt),fn=VU(e),nn=()=>Ws(et),wn=()=>{const Qt=e.pendingSelectionCapture;Qt&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Qt)};return zr("div",{},[zr(pU,{handleClose:nn,selectedText:cn,target:Bt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:fn?.apiKey||e.config?.aiApiKey||"",endpoint:fn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:wn})])}const k=FV,b=Mn({type:"dropdown",name:"fontSize",defaultLabel:"12",label:"12",style:{width:"56px"},markName:"textStyle",labelAttr:"fontSize",tooltip:n.fontSize,hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,suppressActiveHighlight:!0,isWide:!0,command:"setFontSize",attributes:{ariaLabel:"Font size"},options:k,onActivate:({fontSize:et},kt=!1)=>{if(kt){b.label.value="",b.selectedValue.value="";return}const Bt=k.find(wn=>wn.label===String(b.defaultLabel.value));if(!et){b.label.value=b.defaultLabel.value,Bt?b.selectedValue.value=Bt.key:b.selectedValue.value="";return}let cn=xj(et,12);cn<8&&(cn=8),cn>96&&(cn=96);let fn=String(cn);const nn=k.find(wn=>wn.label===fn||wn.key===fn);nn?b.selectedValue.value=nn.key:b.selectedValue.value="",b.label.value=fn},onDeactivate:()=>{b.label.value=b.defaultLabel.value;const et=k.find(kt=>kt.label===String(b.defaultLabel.value));et?b.selectedValue.value=et.key:b.selectedValue.value=""}}),S=()=>Mn({type:"separator",name:"separator",isNarrow:!0}),C=Mn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),w=Mn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),T=Mn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),L=Mn({type:"dropdown",name:"highlight",icon:t.highlight,hideLabel:!0,markName:"highlight",labelAttr:"color",active:!1,tooltip:n.highlight,command:"setHighlight",noArgumentCommand:"unsetHighlight",suppressActiveHighlight:!0,attributes:{ariaLabel:"Highlight"},options:[{key:"color",type:"render",render:()=>r2(e,L,[],!0)}],onActivate:({color:et})=>{L.iconColor.value=et||""},onDeactivate:()=>L.iconColor.value=""}),z=Mn({type:"dropdown",name:"color",icon:t.color,hideLabel:!0,markName:"textStyle",labelAttr:"color",active:!1,tooltip:n.color,command:"setColor",suppressActiveHighlight:!0,attributes:{ariaLabel:"Color"},options:[{key:"color",type:"render",render:()=>r2(e,z)}],onActivate:({color:et})=>{z.iconColor.value=et},onDeactivate:()=>z.iconColor.value="#000"}),W=Mn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),V=Mn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>j(V)}],onActivate:({href:et})=>{V.attributes.value=i2(V.attributes.value,et)},onDeactivate:()=>{V.attributes.value=i2(V.attributes.value,null),V.expand.value=!1}});function j(et){const kt=EI(e),Bt=kt?.selectionTarget??II(kt?.target),cn=()=>{const fn=e.pendingSelectionCapture;fn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(fn)};return zr("div",{},[zr(U_,{ui:e.ui,linkItem:et,textTarget:Bt,restoreSelection:cn,closePopover:()=>{Ws(et),Lc(e)},goToAnchor:()=>{Ws(et);const fn=et.attributes.value?.href;if(!fn)return;const nn=fn.slice(1),wn=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${nn}']`);wn&&H_(wn)}})])}const Z=Mn({type:"options",name:"linkInput",command:"toggleLink",active:!1});V.childItem=Z,Z.parentItem=V;const R=Mn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),K=Mn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),x=Mn({type:"dropdown",name:"table",icon:t.table,hideLabel:!0,labelAttr:"table",active:!1,tooltip:n.table,command:"insertTable",suppressActiveHighlight:!0,attributes:{ariaLabel:"Table"},options:[{key:"table",type:"render",render:()=>$(x)}]});function $(et){return zr("div",{},[zr(RU,{onSelect:Bt=>{e.emitCommand({item:et,argument:Bt}),Ws(et),Lc(e)}})])}const H=Mn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>Q(H)}]}),J=[{label:n.addRowBefore,command:"addRowBefore",icon:t.addRowBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row before"}},{label:n.addRowAfter,command:"addRowAfter",icon:t.addRowAfter,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row after"}},{label:n.addColumnBefore,command:"addColumnBefore",icon:t.addColumnBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column before"}},{label:n.addColumnAfter,command:"addColumnAfter",icon:t.addColumnAfter,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column after"}},{label:n.deleteRow,command:"deleteRow",icon:t.deleteRow,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete row"}},{label:n.deleteColumn,command:"deleteColumn",icon:t.deleteColumn,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete column"}},{label:n.deleteTable,command:"deleteTable",icon:t.deleteTable,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete table"}},{label:n.removeBorders,command:"deleteCellAndTableBorders",icon:t.deleteBorders,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete cell and table borders"}},{label:n.mergeCells,command:"mergeCells",icon:t.mergeCells,props:{"data-item":"btn-tableActions-option",ariaLabel:"Merge cells"}},{label:n.splitCell,command:"splitCell",icon:t.splitCell,props:{"data-item":"btn-tableActions-option",ariaLabel:"Split cells"}},{label:n.fixTables,command:"fixTables",icon:t.fixTables,props:{"data-item":"btn-tableActions-option",ariaLabel:"Fix tables"}}];function Q(et){return zr(NU,{options:J,onSelect:kt=>{Ws(et);const{command:Bt}=kt;e.emitCommand({item:et,argument:{command:Bt}}),Lc(e)}})}const Y=Mn({type:"dropdown",name:"textAlign",tooltip:n.textAlign,icon:t.alignLeft,command:"setTextAlign",hasCaret:!0,markName:"textAlign",labelAttr:"textAlign",suppressActiveHighlight:!0,attributes:{ariaLabel:"Text align"},options:[{type:"render",render:()=>zr("div",{},[zr($V,{onSelect:kt=>{Ws(Y);const Bt={...Y,command:"setTextAlign"};Bt.command="setTextAlign",e.emitCommand({item:Bt,argument:kt}),_e(Y,kt),Lc(e)}})]),key:"alignment"}],onActivate:({textAlign:et})=>{_e(Y,et)},onDeactivate:()=>{_e(Y,"left")}}),_e=(et,kt)=>{let Bt=kt==="both"?"justify":kt,cn={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},fn=cn[Bt]??cn.left;et.icon.value=fn},ue=Mn({type:"dropdown",name:"list",command:"toggleBulletListStyle",splitButton:!0,splitButtonCommand:"toggleBulletList",icon:t.bulletList,hasCaret:!0,tooltip:n.bulletList,restoreEditorFocus:!0,attributes:{ariaLabel:"Bullet list"},options:[{type:"render",key:"bullet-style-buttons",render:()=>{const et=kt=>{Ws(ue);const Bt={...ue,command:"toggleBulletListStyle"};e.emitCommand({item:Bt,argument:kt})};return zr(_I,{buttons:KV,iconSize:25,selectedStyle:ue.selectedValue.value,onSelect:et})}}]}),ve=Mn({type:"dropdown",name:"numberedlist",command:"toggleOrderedListStyle",splitButton:!0,splitButtonCommand:"toggleOrderedList",icon:t.numberedList,hasCaret:!0,tooltip:n.numberedList,restoreEditorFocus:!0,attributes:{ariaLabel:"Numbered list"},options:[{type:"render",key:"numbered-style-buttons",render:()=>{const et=kt=>{Ws(ve);const Bt={...ve,command:"toggleOrderedListStyle"};e.emitCommand({item:Bt,argument:kt})};return zr(_I,{buttons:qV,iconSize:30,selectedStyle:ve.selectedValue.value,onSelect:et})}}]}),ge=Mn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Te=Mn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Ne=Mn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),Je=Mn({type:"dropdown",name:"zoom",allowWithoutEditor:!0,tooltip:n.zoom,defaultLabel:"100%",label:"100%",hasCaret:!0,command:"setZoom",isWide:!0,style:{width:"71px",minWidth:"71px"},inlineTextInputVisible:!1,hasInlineTextInput:!0,attributes:{ariaLabel:"Zoom"},options:[{label:"50%",key:.5,props:{"data-item":"btn-zoom-option"}},{label:"75%",key:.75,props:{"data-item":"btn-zoom-option"}},{label:"90%",key:.9,props:{"data-item":"btn-zoom-option"}},{label:"100%",key:1,props:{"data-item":"btn-zoom-option"}},{label:"125%",key:1.25,props:{"data-item":"btn-zoom-option"}},{label:"150%",key:1.5,props:{"data-item":"btn-zoom-option"}},{label:"200%",key:2,props:{"data-item":"btn-zoom-option"}}],onActivate:({zoom:et})=>{et&&(Je.label.value=et)}}),ct=Mn({type:"dropdown",name:"measurementUnit",allowWithoutEditor:!0,tooltip:n.measurementUnit,defaultLabel:"in",label:"in",hasCaret:!0,command:"setMeasurementUnit",group:"right",style:{width:"52px",minWidth:"52px"},inlineTextInputVisible:!1,hasInlineTextInput:!1,attributes:{ariaLabel:"Measurement unit"},options:[{label:"Inches",key:"in",props:{"data-item":"btn-measurement-unit-option"}},{label:"Centimeters",key:"cm",props:{"data-item":"btn-measurement-unit-option"}}],onActivate:({measurementUnit:et})=>{et&&(ct.label.value=et)}}),tt=Mn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),Tt=Mn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),ae=Mn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),Ee=Mn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Ue=Mn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),ie=Mn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),I=(et,kt)=>et==="editor"?kt:et==="suggester"?kt.filter(Bt=>Bt.value==="suggesting"):kt.filter(Bt=>Bt.value==="viewing"),se=et=>et==="editor"?"Editing":et==="suggester"?"Suggesting":"Viewing",F=Mn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:se(s),label:se(s),hasCaret:s==="editor",isWide:!0,style:{display:"flex",justifyContent:"flex-end"},inlineTextInputVisible:!1,hasInlineTextInput:!1,group:"right",disabled:s!=="editor",attributes:{dropdownPosition:"right",className:"sd-toolbar-item--doc-mode",ariaLabel:"Document mode"},options:[{type:"render",render:()=>P(F)}]}),q=[{label:n.documentEditingMode,value:"editing",icon:t.documentEditingMode,description:n.documentEditingModeDescription},{label:n.documentSuggestingMode,value:"suggesting",icon:t.documentSuggestingMode,description:n.documentSuggestingModeDescription},{label:n.documentViewingMode,value:"viewing",icon:t.documentViewingMode,description:n.documentViewingModeDescription}];function P(et){return zr(nU,{options:I(s,q),onSelect:kt=>{const Bt=e.superdoc?.activeEditor??e.activeEditor;Ws(et);const{label:cn,icon:fn,value:nn}=kt;F.label.value=cn,F.icon.value=fn,e.emitCommand({item:F,argument:nn}),Lc(e,Bt)}})}const ee=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),be=["search","ruler","undo","overflow","documentMode"],N=Mn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),B=Mn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),de=Mn({type:"dropdown",name:"linkedStyles",command:"setLinkedStyle",tooltip:n.linkedStyles,icon:t.paintbrush,defaultLabel:n.formatText,label:n.formatText,hasCaret:!0,isWide:!0,style:{width:"140px"},suppressActiveHighlight:!0,disabled:!1,attributes:{className:"sd-toolbar-item--linked-styles",ariaLabel:"Linked styles"},options:[{type:"render",key:"linkedStyle",render:()=>{const et=Bt=>{Ws(de);const cn=typeof Bt=="string"?Bt:Bt?.id??null;if(!cn)return;const fn={...de,command:"setLinkedStyle"};e.emitCommand({item:fn,argument:cn})},kt=e.getActiveLinkedStyleId?.()??null;return zr("div",{},[zr(sU,{styles:e.getLinkedStyleOptions?.()??[],onSelect:et,selectedOption:kt})])}}],onActivate:({styleId:et,styleName:kt})=>{const Bt=kt||et;de.label.value=et&&et!=="Normal"?String(Bt):n.formatText,de.disabled.value=!1},onDeactivate:()=>{de.disabled.value=!0,de.label.value=n.formatText}}),Se=(et,kt)=>{if(kt.value==et)return zr("div",{innerHTML:BU,class:"dropdown-select-icon"})},Ae=Mn({type:"dropdown",name:"lineHeight",tooltip:n.lineHeight,icon:t.lineHeight,hasCaret:!1,hasInlineTextInput:!1,hideLabel:!0,inlineTextInputVisible:!1,suppressActiveHighlight:!0,restoreEditorFocus:!0,isWide:!1,command:"setLineHeight",dropdownValueKey:"key",selectedValue:"1",attributes:{ariaLabel:"Line height"},options:[1,1.15,1.5,2,2.5,3].map(et=>({label:et.toFixed(2),key:et,icon:()=>Se(et,Ae.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),Le=20,Xe=32,it=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],yt=["zoom","fontFamily","fontSize","redo"],Mt=i<=ah.lg,Lt=e.config?.showFormattingMarksButton===!0,Wt=e.config?.showTableOfContentsButton===!0;Mt&&(F.attributes.value={...F.attributes.value,className:`${F.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),Mt&&(de.attributes.value={...de.attributes.value,className:`${de.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Be=[tt,Tt,ae,Ee,W,Je,g,S(),b,S(),f,C,w,T,z,L,S(),V,R,...Wt?[K]:[],x,H,S(),Y,ue,ve,ge,Te,Ae,S(),de,S(),N,ct,...Lt?[B]:[],ie,Ue,...jU(e)?[m]:[],Ne,F,...d];if(i<=ah.md&&o&&(Be=Be.filter(et=>et.type!=="separator")),e.config.mode!=="docx"){const et=Be.findIndex(Bt=>Bt.name.value==="linkedStyles");Be.splice(et-1,2);const kt=["ruler","zoom","undo","redo"];Be=Be.filter(Bt=>!kt.includes(Bt.name.value))}const rn=[];a||(s==="viewer"&&rn.push(ae,Ee),Be=Be.filter(et=>!rn.includes(et))),l&&(Be=Be.filter(et=>et.name.value==="overflow"||et.isCustomToolbarItem||l.has(et.name.value))),u?.size&&(Be=Be.filter(et=>!u.has(et.name.value)));const zn=et=>be.includes(et.name.value),Ht=Be.find(et=>et.name.value==="overflow"),xn=Be.filter(et=>et!==Ht),Ur=et=>{const kt=[],Bt=[],cn=xn.filter(zn).reduce((nn,wn)=>nn+o2(wn,ee),0);let fn=Xe+cn+(et&&Ht?o2(Ht,ee):0);return xn.forEach((nn,wn)=>{const Qt=o2(nn,ee);if(nn.type==="separator"&&xn[wn-1]?.name.value==="linkedStyles"&&kt.includes(xn[wn-1])){kt.push(nn);return}if(i<ah.xl+Le&&it.includes(nn.name.value)&&o){kt.push(nn);return}if(i<ah.sm&&yt.includes(nn.name.value)&&o){kt.push(nn);return}if(zn(nn)){Bt.push(nn);return}fn+Qt<=i||!o?(Bt.push(nn),fn+=Qt):kt.push(nn)}),{visibleItems:Bt,overflowItems:kt}};let{visibleItems:yr,overflowItems:Ar}=Ur(!1);if(o&&Ht&&Ar.some(et=>et.type!=="separator")){({visibleItems:yr,overflowItems:Ar}=Ur(!0));const et=Be.indexOf(Ht),kt=yr.findIndex(Bt=>Be.indexOf(Bt)>et);kt===-1?yr.push(Ht):yr.splice(kt,0,Ht)}return{defaultItems:yr,overflowItems:Ar.filter(et=>et.type!=="separator")}},TI={bold:"Bold",fontFamily:"Font family",ai:"AI text generation",fontSize:"Font size",italic:"Italic",underline:"Underline",highlight:"Highlight color",strikethrough:"Strikethrough",color:"Text color",search:"Search",link:"Link",image:"Image",tableOfContents:"Table of contents",table:"Insert table",tableActions:"Table options",addRowBefore:"Insert row above",addRowAfter:"Insert row below",addColumnBefore:"Insert column left",addColumnAfter:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",removeBorders:"Remove borders",mergeCells:"Merge cells",splitCell:"Split cell",fixTables:"Fix tables",textAlign:"Alignment",bulletList:"Bullet list",numberedList:"Numbered list",indentLeft:"Left indent",indentRight:"Right indent",directionLtr:"Left-to-right",directionRtl:"Right-to-left",zoom:"Zoom",measurementUnit:"Measurement unit",undo:"Undo",redo:"Redo",trackChanges:"Track Changes",trackChangesAccept:"Accept changes under selection",trackChangesReject:"Reject changes under selection",trackChangesOriginal:"Toggle Show Original",trackChangesFinal:"Toggle Show Final",clearFormatting:"Clear formatting",copyFormat:"Format painter",lineHeight:"Line height",formatText:"Format text",ruler:"Show or hide ruler",formattingMarks:"Show or hide formatting marks",pageBreak:"Insert page break",documentEditingMode:"Editing",documentSuggestingMode:"Suggesting",documentViewingMode:"Viewing",documentEditingModeDescription:"Edit document directly",documentSuggestingModeDescription:"Edits become suggestions",documentViewingModeDescription:"View clean version of document only",linkedStyles:"Linked styles"},HU=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Ft();function xI(e){return Cj(e)??n2[e]??null}function Ym(e,t,n,r={}){if(!e?.commands||!t||typeof e.commands.has=="function"&&!e.commands.has(t))return!1;const o=typeof e.commands.executeAsync=="function"?e.commands.executeAsync:e.commands.execute;if(typeof o!="function")return!1;const i=n===void 0?o.call(e.commands,t):o.call(e.commands,t,n),s=a=>{!r.reportUnhandled||a!==!1||r.onError?.(new Error(`[superdoc toolbar] Command "${t}" did not run. Check that it is enabled and has the required input.`))};return i&&typeof i.then=="function"?Promise.resolve(i).then(a=>{s(a),r.onSettled?.()},a=>{r.onError?.(a),r.onSettled?.()}):(s(i),r.onSettled?.()),!0}var $U=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),GU=new Set(["list","numberedlist"]);function WU(e,t){if(e==="fontFamily"||e==="fontSize"||GU.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!$U.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function RI(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function KU(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var qU=new Set([...wj,...Object.keys(jm),"ai","overflow","tableOfContents"]),YU=class extends jg.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...sr},texts:{...TI},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1};toolbarItems=[];overflowItems=[];#e=null;#n=null;isDev=!1;role="editor";superdoc;toolbarContainer=null;toolbar=null;_detachFontsChanged=null;_linkedStyleOptions=Br([]);constructor(e={}){if(super(),this.config={...this.config,...e},this.toolbarItems=[],this.overflowItems=[],this.isDev=e.isDev||!1,this.superdoc=e.superdoc,this.role=e.role||"editor",this.toolbarContainer=null,this.config.icons={...sr,...e.icons},this.config.texts={...TI,...e.texts},this.config.hideButtons=e.hideButtons??!0,this.config.responsiveToContainer=e.responsiveToContainer??!1,this.activeEditor=e.editor??this.superdoc?.activeEditor??null,this.ui=null,this.snapshot=null,this._unsubscribeController=null,this._detachFormatPainterModeChange=null,this._customCommandRegs=new Map,this._reportedInvalidCustomItems=new Set,this._lastFontOptionsSignature="",!this.config.selector&&this.config.element&&(this.config.selector=this.config.element),this.toolbarContainer=HU(this.config.selector),this.toolbarContainer){const t=(this.config?.uiDisplayFallbackFont||"").toString().trim()||"Arial, Helvetica, sans-serif";this.toolbarContainer.style.setProperty("--sd-ui-font-family",t)}try{if(this.#t(),this.#u(),this.#l(),this.#i(),this._lastFontOptionsSignature=this.#o(),!this.toolbarContainer){this.updateToolbarState();return}this.app=yc(jV),this.app.directive("click-outside",Hy),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#t(){this.ui=this.superdoc?.ui??null,this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot(),this._unsubscribeController=this.ui.toolbar.subscribe(()=>{this.snapshot=this.ui.toolbar.getSnapshot(),this.getToolbarItemByName("linkedStyles")?.expand.value&&this.#p(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#_():this.#d()}))}#r(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#d();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#i(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#v()),this.updateToolbarState()};this.superdoc.on("fonts-changed",e),this._detachFontsChanged=()=>{this.superdoc?.off?.("fonts-changed",e)}}#a(){this._detachFontsChanged?.(),this._detachFontsChanged=null}#u(){if(Array.isArray(this.config.groups)){this.config.toolbarGroups=this.config.groups,this.config.groups=null;return}this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length&&(this.config.toolbarGroups=Object.keys(this.config.groups))}getAvailableWidth(){const e=document.documentElement.clientWidth,t=this.toolbarContainer?.offsetWidth??0;return this.config.responsiveToContainer?t:e}#h(e){return e||PV(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#l(){const e=this.getAvailableWidth(),t=new Map(this.#s().filter(k=>k.isCustomToolbarItem&&k.type==="dropdown").map(k=>[k.name.value,k.selectedValue.value])),n=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,r=n?new Set(Object.values(this.config.groups).flatMap(k=>k)):null,o=new Set(this.config.excludeItems),i=this.config.customButtons||[],s=new Set(qU),a=i.map((k,b)=>{try{if(k?.name&&s.has(k.name))throw new Error(`Toolbar item name "${k.name}" is already taken by another item, so this entry is skipped.`);const S=this.#f(k);return t.has(S.name.value)&&(S.selectedValue.value=t.get(S.name.value)),s.add(S.name?.value),S}catch(S){const C=`${k?.name??`<unnamed@${b}>`}::${S?.message??String(S)}`;return this._reportedInvalidCustomItems.has(C)||(this._reportedInvalidCustomItems.add(C),this.#m(S,k?.name??null)),null}}).filter(Boolean),l=n?new Set(Object.keys(this.config.groups)):null,u=l?a.filter(k=>l.has(k.group?.value||"center")):a,{defaultItems:d,overflowItems:f}=UU({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#h(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev,configuredItemNames:r,excludedItemNames:o,additionalItems:u});let p=[...d.map(k=>k.name.value),...f.map(k=>k.name.value)];if(n){const k=Object.values(this.config.groups).flatMap(S=>S),b=a.filter(S=>l.has(S.group?.value||"center")).map(S=>S.name.value);p=[...new Set([...k,...b])]}const g=f.filter(k=>p.includes(k.name.value)&&!o.has(k.name.value)),m=g.length?[...p,"overflow"]:p,v=d.filter(k=>m.includes(k.name.value)).filter(k=>!o.has(k.name.value));if(n)for(const[k,b]of Object.entries(this.config.groups))for(const S of v)b.includes(S.name.value)&&(S.group.value=k);this.toolbarItems=v,this.overflowItems=g}#f(e){const t=Mn({...e});t.isCustomToolbarItem=!0;const n=e.command;if(typeof n=="function"&&this.ui?.commands?.register){const r=`__builtin_toolbar__${e.name}`;if(!this._customCommandRegs.has(r)){const o=this.ui.commands.register({id:r,execute:i=>{const s=i?.payload&&typeof i.payload=="object"?i.payload:{};try{const a=n({...i,item:t,argument:s.argument,option:s.option});return a&&typeof a.then=="function"?Promise.resolve(a).catch(l=>(this.#m(l,e.name),!1)):a}catch(a){return this.#m(a,e.name),!1}}});this._customCommandRegs.set(r,o)}}return t}#v(){this.#l(),this.emit("toolbar-items-changed")}#o(){if(this.config.fonts)return"custom-fonts";const e=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return JSON.stringify(e.map(t=>[t.label,t.value,t.previewFamily]))}getToolbarItemByGroup(e){return this.toolbarItems.filter(t=>(t.group?.value||"center")===e)}getToolbarItemByName(e){return this.#s().find(t=>t.name.value===e)}#s(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.#p(),this._linkedStyleOptions.value}#p(){this.ui?.styles?.getCatalog?.({includePreview:!0});const e=this.ui?.styles?.getCatalog?.({view:"quickGallery",includePreview:!0})?.items??this.ui?.styles?.getQuickGallery?.()??[];e!==this._linkedStyleOptions.value&&(this._linkedStyleOptions.value=e)}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}setActiveEditor(e){this.activeEditor=e;const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#v()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#l(),this.updateToolbarState()};#w(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#k(e){return e==="ruler"?typeof this.superdoc?.toggleRuler=="function":e==="formattingMarks"?typeof this.superdoc?.toggleFormattingMarks=="function"||typeof this.superdoc?.setShowFormattingMarks=="function":!1}#y(){const e=this.getToolbarItemByName("documentMode");if(!e)return;const t=(this.snapshot?.commands?.["document-mode"]?.value||"editing").toLowerCase(),n=this.config.texts||{},r=this.config.icons||{},o={editing:{label:n.documentEditingMode||"Editing",icon:r.documentEditingMode||r.documentMode},suggesting:{label:n.documentSuggestingMode||"Suggesting",icon:r.documentSuggestingMode||r.documentMode},viewing:{label:n.documentViewingMode||"Viewing",icon:r.documentViewingMode||r.documentMode}},i=o[t]||o.editing;e.label?.value!==void 0&&(e.label.value=i.label),e.defaultLabel?.value!==void 0&&(e.defaultLabel.value=i.label),e.icon?.value!==void 0&&i.icon&&(e.icon.value=i.icon)}#A(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>r2(this,e,[],!0)};e.nestedOptions.value=[t]}#I(e){return!!e?.active&&e?.value==null}#L(e){return!!e&&e.disabled===!1&&e.value==null}#R(e){const t=e.name.value;if(e.isCustomToolbarItem&&typeof e.command=="string"){const i=this.snapshot?.commands?.[e.command];return e.setDisabled(e.initiallyDisabled||!i||!!i.disabled),i?.active?e.activate():e.deactivate(),!0}if(t==="tableActions"){const i=SI.map(s=>this.snapshot?.commands?.[s]).some(s=>s&&!s.disabled);return e.setDisabled(!i),!0}if(t==="search")return e.setDisabled(this.superdoc?.uiConfig?.search?.enabled!==!0),!0;if(e2(t)?.disposition==="host-routed")return e.setDisabled(!this.#k(t)),this.#w(t)?e.activate():e.deactivate(),!0;const n=xI(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];WU(t,r)?e.setDisabled(!1):e.setDisabled(!!r?.disabled);const o={textAlign:()=>{r?.value?e.activate({textAlign:r.value}):e.deactivate()},lineHeight:()=>{e.selectedValue.value=r?.value!=null?r.value:""},zoom:()=>{if(r?.value!=null){const i=typeof r.value=="number"?`${r.value}%`:String(r.value);e.onActivate({zoom:i})}},measurementUnit:()=>{r?.value!=null&&e.onActivate({measurementUnit:String(r.value)})},documentMode:()=>{this.#y()},link:()=>{e.active.value=!!r?.active,e.attributes.value=i2(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#L(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#I(r)){e.activate({},!0);return}e.deactivate()},color:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},highlight:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},linkedStyles:()=>{const i=r?.value,s=typeof i=="string"?i:i?.styleId,a=i&&typeof i=="object"?i.styleName:null;s?e.activate({styleId:s,styleName:a}):e.label.value=this.config.texts?.formatText||"Format text"},list:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},numberedlist:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},default:()=>{r?.active?e.activate():e.deactivate()}};return(o[t]??o.default)(),!0}updateToolbarState(){this.#y(),this.#A();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#b(),this.#s().forEach(n=>{const r=n.isCustomToolbarItem&&typeof n.command=="string";(n.allowWithoutEditor?.value||r)&&this.#R(n)})):this.#s().forEach(n=>{n.resetDisabled(),this.#R(n)});const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#b(){this.#s().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#C(e,t){const n=this.superdoc;if(e==="ruler")return typeof n?.toggleRuler=="function"?(n.toggleRuler(),!0):!1;if(e==="formattingMarks"){if(typeof t=="boolean"&&typeof n?.setShowFormattingMarks=="function")return n.setShowFormattingMarks(t),!0;if(typeof n?.toggleFormattingMarks=="function")return n.toggleFormattingMarks(),!0}return!1}#E(e,t){const n=e?.name?.value;if(!n)return!1;const r={onSettled:()=>this.updateToolbarState(),onError:i=>this.#m(i,n)};if(n==="image"&&t==null)return this.#x();if(n==="tableActions"){const i=kI[t?.command];return i?Ym(this.ui,i,void 0,r):!1}if(e2(n)?.disposition==="unsupported")return!0;const o=xI(n);return o?Ym(this.ui,o,t,r):!1}#x(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=Tj({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await Ij(e,this.superdoc?.config?.handleImageUpload);Ym(this.ui,"image",{src:t},{onSettled:()=>this.updateToolbarState(),onError:n=>this.#m(n,"image")})},onError:e=>this.#m(e,"image")})),this.#e.open()),!0}#_(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{RI(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!RI(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}KU(i)&&this.ui.formatPainter.setKeyboardSelecting(!0)},o=()=>{this.ui.formatPainter.setKeyboardSelecting(!1),this.ui.formatPainter.notifyKeyUp()};e.addEventListener("pointerdown",t),e.addEventListener("pointerup",n),e.addEventListener("keydown",r),e.addEventListener("keyup",o),this.#n=()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("pointerup",n),e.removeEventListener("keydown",r),e.removeEventListener("keyup",o)}}#d(){this.#n&&(this.#n(),this.#n=null)}#m(e,t){const n={error:e instanceof Error?e:new Error(String(e)),originalError:e,itemName:t??null,editor:this.superdoc?.activeEditor??this.activeEditor??null},r={...n};this.emit("exception",n),this.superdoc?.emit?.("exception",r)}emitCommand({item:e,argument:t,option:n}){const r=e?.name?.value,{command:o}=e,i=t!=null;if(!(e?.type==="dropdown"&&!i&&(o==="setFontFamily"||o==="setFontSize"))){if(r==="search"){this.superdoc?.emit?.("search:open");return}try{if(e2(r)?.disposition==="host-routed"){this.#C(r,t),this.updateToolbarState();return}if(typeof o=="function"){const s=`__builtin_toolbar__${r}`;if(this._customCommandRegs.has(s)&&this.ui?.commands?.execute)this.ui.commands.execute(s,{argument:t,option:n});else{const a=o({item:e,argument:t,option:n,ui:this.ui,superdoc:this.superdoc});a&&typeof a.then=="function"&&Promise.resolve(a).catch(l=>this.#m(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!Ym(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#m(s,r),reportUnhandled:!0}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#E(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#m(s,r)}}}destroy(){this.#d(),this.#e?.destroy(),this.#e=null,this.#a(),this.#r(),this.app?.unmount(),this.app=null,this.toolbar=null}};function XU(e){return new YU(e)}function ZU(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null||Array.isArray(e)!==Array.isArray(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}function QU(e){if(!e||typeof e!="object")return{};const t={};e.fonts&&(t.rFonts={ascii:e.fonts.ascii,hAnsi:e.fonts.hAnsi,eastAsia:e.fonts.eastAsia,cs:e.fonts.cs,asciiTheme:e.fonts.asciiTheme,hAnsiTheme:e.fonts.hAnsiTheme,eastAsiaTheme:e.fonts.eastAsiaTheme,csTheme:e.fonts.csTheme,hint:e.fonts.hint}),e.fontFamily!=null&&(t.fontFamily=e.fontFamily),e.lang&&(t.lang={val:e.lang.val,eastAsia:e.lang.eastAsia,bidi:e.lang.bidi}),e.fontSize!=null&&(t.fontSize=e.fontSize),e.fontSizeCs!=null&&(t.fontSizeCs=e.fontSizeCs);const n=Xm(e.color);n!=null&&(t.color=n),e.highlight!=null&&(t.highlight=e.highlight);const r=eH(e.shading);r&&(t.shading=r),e.cs!=null&&(t.cs=e.cs),e.rtl!=null&&(t.rtl=e.rtl),e.bold!=null&&(t.bold=e.bold),e.boldCs!=null&&(t.bCs=e.boldCs),e.italic!=null&&(t.italic=e.italic),e.italicCs!=null&&(t.iCs=e.italicCs);const o=JU(e.underline);o!==void 0&&(t.underline=o),e.strikethrough!=null&&(t.strike=e.strikethrough),e.doubleStrikethrough!=null&&(t.dstrike=e.doubleStrikethrough),e.caps!=null&&(t.caps=e.caps),e.smallCaps!=null&&(t.smallCaps=e.smallCaps),e.outline!=null&&(t.outline=e.outline),e.shadow!=null&&(t.shadow=e.shadow),e.emboss!=null&&(t.emboss=e.emboss),e.imprint!=null&&(t.imprint=e.imprint),e.verticalAlign!=null&&(t.vertAlign=e.verticalAlign),e.characterSpacing!=null&&(t.letterSpacing=e.characterSpacing),e.characterScale!=null&&(t.charScale=e.characterScale),e.kern!=null&&(t.kerning=e.kern),e.baselineShift!=null&&(t.position=e.baselineShift),e.fitTextWidth!=null&&(t.fitText={val:e.fitTextWidth}),e.vanish!=null&&(t.vanish=e.vanish),e.webHidden!=null&&(t.webHidden=e.webHidden),e.specVanish!=null&&(t.specVanish=e.specVanish);const i=tH(e.border);return i&&(t.border=i),t}function Xm(e){if(e){if(typeof e=="string")return e;if(e.model==="rgb")return e.value;if(e.model==="auto")return"auto"}}function JU(e){if(e==null)return;const t={};return e.style!=null&&(t.style=e.style),e.color?.model==="rgb"&&(t.color=e.color.value),e.color?.model==="theme"&&(t.themeColor=e.color.theme),Object.keys(t).length>0?t:!0}function eH(e){if(!e)return;const t={},n=Xm(e.fill);n!=null&&(t.fill=n);const r=Xm(e.color);return r!=null&&(t.color=r),e.pattern!=null&&(t.val=e.pattern),Object.keys(t).length>0?t:void 0}function tH(e){if(!e)return;const t={};e.style!=null&&(t.val=e.style),e.width!=null&&(t.sz=e.width),e.space!=null&&(t.space=e.space);const n=Xm(e.color);return n!=null&&(t.color=n),Object.keys(t).length>0?t:void 0}function Dc(e){const t=e?.selectionTarget??e?.target;if(!e||!t)return"";try{return JSON.stringify(t)}catch{return String(t)}}var nH=new Set(["insert-text","replace-text","plain-text-paste","delete-backward","delete-forward","text.insert","text.replace","text.pastePlain","text.deleteBackward","text.deleteForward","structural.enter","structural:enter-split-paragraph","structural:enter-insert-paragraph-before","structural:enter-insert-paragraph-after","structural:shift-enter-line-break","structural:backspace-boundary-merge-with-previous","structural:delete-boundary-merge-with-next","backspace:boundary-merge-with-previous","backspace:list-remove","backspace:list-outdent"]),rH=e=>e?.type!=="mutation:committed"||e.origin!=="command"?!1:nH.has(e.editableCommandKind);function MI(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function oH(e){const t=[],n=o=>{o&&!t.includes(o)&&t.push(o)};n(e.getAttribute("data-track-change-preferred-target-id"));const r=e.getAttribute("data-track-change-ids");if(r)for(const o of MI(r))n(o);return n(e.getAttribute("data-track-change-id")),t}function LI(e,t){if(!e||typeof e.getAttribute!="function")return[];const n=[],r=new Set;let o=[],i=e;for(;i;){const s=i,a=oH(s),l=a.length>0?s.getAttribute("data-story-key"):null;for(const m of a){const v=`trackedChange:${m}`;if(!r.has(v)){r.add(v);const k={type:"trackedChange",id:m};l&&(k.storyKey=l),n.push(k),o.push(k)}}const u=s.getAttribute("data-layout-story");if(u&&o.length>0){for(const m of o)m.story=u;o=[]}const d=s.getAttribute("data-citation-id");if(d){const m=`citation:${d}`;r.has(m)||(r.add(m),n.push({type:"citation",id:d}))}const f=s.getAttribute("data-comment-ids");if(f)for(const m of MI(f)){const v=`comment:${m}`;r.has(v)||(r.add(v),n.push({type:"comment",id:m}))}const p=s.getAttribute("data-sdt-type"),g=s.getAttribute("data-sdt-id");if(g&&p==="structuredContent"){const m=`contentControl:${g}`;if(!r.has(m)){r.add(m);const v=s.getAttribute("data-sdt-scope"),k=s.getAttribute("data-sdt-tag"),b={type:"contentControl",id:g};(v==="block"||v==="inline")&&(b.scope=v),k&&(b.tag=k),n.push(b)}}if(t&&i===t)break;i=i.parentElement}return n}var po=()=>({oneOf:[{type:"boolean"},{type:"null"}]}),Ol=()=>({oneOf:[{type:"string",minLength:1},{type:"null"}]}),nd=()=>({oneOf:[{type:"number"},{type:"null"}]}),rd=e=>({oneOf:[{type:"object",properties:e,additionalProperties:!1,minProperties:1},{type:"null"}]}),iH={type:"object",properties:{style:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},themeColor:{oneOf:[{type:"string",minLength:1},{type:"null"}]}},additionalProperties:!1,minProperties:1},sH={type:"object",properties:{id:{type:"number"},val:{type:"boolean"}},required:["id"],additionalProperties:!1},aH=()=>({oneOf:[{type:"boolean"},{type:"null"},iH]}),lH=()=>({oneOf:[{type:"array",items:sH,minItems:1},{type:"null"}]});function Zm(e,t){return{storage:"mark",markName:e,textStyleAttr:t}}function cH(e){return{storage:"runAttribute",nodeName:"run",runPropertyKey:e}}var s2=(e,t,n)=>({key:e,type:"boolean",ooxmlElement:t,storage:"mark",tracked:!0,carrier:Zm(n),schema:po()}),Oc=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"mark",tracked:!0,carrier:Zm("textStyle",o??e),schema:r}),Un=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"runAttribute",tracked:!1,carrier:cH(o??e),schema:r}),Qm=[s2("bold","w:b","bold"),s2("italic","w:i","italic"),s2("strike","w:strike","strike"),{key:"underline",type:"object",ooxmlElement:"w:u",storage:"mark",tracked:!0,carrier:Zm("underline"),schema:aH()},{key:"highlight",type:"string",ooxmlElement:"w:highlight",storage:"mark",tracked:!0,carrier:Zm("highlight"),schema:Ol()},Oc("color","string","w:color",Ol()),Oc("fontSize","number","w:sz",nd()),Oc("fontFamily","string","w:rFonts",Ol()),Oc("letterSpacing","number","w:spacing",nd()),Oc("vertAlign","string","w:vertAlign",{oneOf:[{enum:["superscript","subscript","baseline"]},{type:"null"}]}),Oc("position","number","w:position",nd()),Un("dstrike","boolean","w:dstrike",po()),Un("smallCaps","boolean","w:smallCaps",po()),Oc("caps","boolean","w:caps",po(),"textTransform"),Un("shading","object","w:shd",rd({fill:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},val:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("border","object","w:bdr",rd({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},sz:{oneOf:[{type:"number"},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},space:{oneOf:[{type:"number"},{type:"null"}]}}),"borders"),Un("outline","boolean","w:outline",po()),Un("shadow","boolean","w:shadow",po()),Un("emboss","boolean","w:emboss",po()),Un("imprint","boolean","w:imprint",po()),Un("charScale","number","w:w",nd(),"w"),Un("kerning","number","w:kern",nd(),"kern"),Un("vanish","boolean","w:vanish",po()),Un("webHidden","boolean","w:webHidden",po()),Un("specVanish","boolean","w:specVanish",po()),Un("rtl","boolean","w:rtl",po()),Un("cs","boolean","w:cs",po()),Un("bCs","boolean","w:bCs",po(),"boldCs"),Un("iCs","boolean","w:iCs",po(),"italicCs"),Un("eastAsianLayout","object","w:eastAsianLayout",rd({id:{oneOf:[{type:"string",minLength:1},{type:"null"}]},combine:{oneOf:[{type:"boolean"},{type:"null"}]},combineBrackets:{oneOf:[{type:"string",minLength:1},{type:"null"}]},vert:{oneOf:[{type:"boolean"},{type:"null"}]},vertCompress:{oneOf:[{type:"boolean"},{type:"null"}]}})),Un("em","string","w:em",Ol()),Un("fitText","object","w:fitText",rd({val:{oneOf:[{type:"number"},{type:"null"}]},id:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("snapToGrid","boolean","w:snapToGrid",po()),Un("lang","object","w:lang",rd({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},bidi:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("oMath","boolean","w:oMath",po()),Un("rStyle","string","w:rStyle",Ol(),"styleId"),Un("rFonts","object","w:rFonts",rd({ascii:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsi:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},cs:{oneOf:[{type:"string",minLength:1},{type:"null"}]},asciiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsiaTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},csTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hint:{oneOf:[{type:"string",minLength:1},{type:"null"}]}}),"fontFamily"),Un("fontSizeCs","number","w:szCs",nd()),Un("ligatures","string","w14:ligatures",Ol()),Un("numForm","string","w14:numForm",Ol()),Un("numSpacing","string","w14:numSpacing",Ol()),Un("stylisticSets","array","w14:stylisticSets",lH()),Un("contextualAlternates","boolean","w14:cntxtAlts",po())],gK=new Set(Qm.map(e=>e.key)),uH=Object.fromEntries(Qm.map(e=>[e.key,e])),vK={mark:Qm.filter(e=>e.storage==="mark").map(e=>e.key),runAttribute:Qm.filter(e=>e.storage==="runAttribute").map(e=>e.key)};function Va(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Jm(){const e=globalThis;return{sink:typeof e.__superdocV2BenchPipelineTiming=="function"?e.__superdocV2BenchPipelineTiming:null,workerContext:e.__superdocV2BenchWorkerMessageContext??null}}function a2(e){const{sink:t}=Jm();if(t)try{t(e)}catch{}}var l2=new WeakMap;function dH(e){let t=l2.get(e);return t||(t={refCount:0,generation:0,abortController:new AbortController,inFlight:null,activeMutationTokens:new Set},l2.set(e,t)),t.refCount+=1,t}function fH(e,t){t.refCount=Math.max(0,t.refCount-1),!(t.refCount>0)&&(t.abortController.abort("ui-controller-destroyed"),t.inFlight=null,t.activeMutationTokens.clear(),l2.delete(e))}var hH=new Set(Object.values(lt));function eg(e,t){return typeof e=="string"&&hH.has(e)?e:t}function DI(e){if(e&&typeof e=="object"&&e.ok===!1){const t=e.reason;return t==="host-not-ready"||t==="host-disposed"||t==="editing-mount-required"?{ok:!1,reason:lt.notReady}:{ok:!1,reason:eg(t,lt.targetUnresolved)}}return{ok:!0}}var pH=["document-replaced","editorCreate","active-editor-change","document-mode-change","zoomChange","measurement-unit-change","viewport-change","fonts-changed"],mH={[cI.bulletList]:"bullet",[cI.numberedList]:"ordered"};function OI(e){return mH[e]??null}var gH={disc:"disc",circle:"circle",square:"square",decimal:"decimal","decimal-paren":"decimalParenthesis","upper-roman":"upperRoman","lower-roman":"lowerRoman","upper-alpha":"upperLetter","upper-alpha-paren":"upperLetterParenthesis","lower-alpha":"lowerLetter","lower-alpha-paren":"lowerLetterParenthesis"};function vH(e){const t=gH[e];return t?{preset:t,behavior:"toggleStyle"}:{}}var yH={status:"ready",empty:!0,target:null,selectionTarget:null,activeMarks:[],activeCommentIds:[],activeChangeIds:[],quotedText:""},bH=[{key:"contentControls",match:"exact",note:"full-document SDT catalog parse (the measured during-load cliff)"},{key:"contentControls:inRange:",match:"prefix",note:"same adapter load() as the catalog, issued per settled selection"},{key:"hyperlinks:",match:"prefix",note:"per-block hyperlink list over the loading story"},{key:"styles:catalog:",match:"prefix",note:"WordStyleModel recompile from package bytes"},{key:"comments",match:"exact",note:"audited: full comments list; stale-served during load"},{key:"trackChanges",match:"exact",note:"audited: shared all-story tracked-changes catalog; stale-served during load"},{key:"trackChanges:all",match:"exact",note:"audited: current-token validation over the shared all-story catalog; consumers fail closed on non-ready"},{key:"tables",match:"exact",note:"reserved: full tables catalog"},{key:"sections",match:"exact",note:"reserved: full sections list"}],wH=new Set(["/word/comments.xml","/word/commentsExtended.xml","/word/commentsIds.xml"]);function CH(e){return bH.some(t=>t.match==="exact"?t.key===e:e.startsWith(t.key))}var PI={ready:0,stale:1,pending:2};function Pl(...e){let t="ready";for(const n of e)PI[n]>PI[t]&&(t=n);return t}function Ot(e,t){if(typeof e!="function")return t;try{const n=e();return n===void 0?t:n}catch{return t}}function Lr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function vr(e,t){if(!e)return null;const n=t.split(".");let r=e;for(const o of n){if(r==null)return null;r=r[o]}return typeof r=="function"?r:null}function Wn(e,t="CAPABILITY_UNAVAILABLE"){return{success:!1,failure:{code:t,message:e}}}function lh(e,t){return{success:!1,failure:{code:"PARTIAL_LINK_EDIT",message:"Hyperlink target was updated, but display text replacement failed."},applied:{href:!0,text:!1},hyperlinkResult:e,textResult:t}}function ch(e){if(!e||typeof e!="object")return null;const t=e.target;return t&&typeof t=="object"?t:null}function c2(e){if(!e||typeof e!="object")return!1;const t=e,n=i=>{if(!i||typeof i!="object")return!1;const s=i;return s.kind==="text"&&typeof s.blockId=="string"&&typeof s.offset=="number"},r=i=>{if(!i||typeof i!="object")return!1;const s=i,a=s.range;return typeof s.blockId=="string"&&typeof a?.start=="number"&&typeof a.end=="number"};if(Array.isArray(t.segments)){const i=t.segments[0],s=t.segments[t.segments.length-1];return r(i)&&r(s)}if(t.kind==="selection")return n(t.start)&&n(t.end);if(t.kind!=="text"||typeof t.blockId!="string")return!1;const o=t.range;return typeof o?.start=="number"&&typeof o.end=="number"}function FI(e,t){if(!e||typeof e!="object")return null;const n=ch(e),r=e,o=r.navigationTarget&&typeof r.navigationTarget=="object"?r.navigationTarget:null;if(o?.kind==="block"&&typeof o.blockId=="string"&&o.blockId.length>0){const i={kind:"text",blockId:o.blockId,range:{start:0,end:0},...o.story&&typeof o.story=="object"?{story:o.story}:{},...r.address&&typeof r.address=="object"?{address:r.address}:{}};if(t?.preferStableBlock||!c2(n))return i}return n}function Jn(e){if(!e||typeof e!="object")return"story:body";const t=e,n=typeof t.storyType=="string"?t.storyType:"body";switch(n){case"body":return"story:body";case"headerFooterPart":return`story:headerFooterPart:${typeof t.refId=="string"?t.refId:""}`;case"headerFooterSlot":return JSON.stringify({storyType:n,section:t.section??null,headerFooterKind:t.headerFooterKind??null,variant:t.variant??null,resolution:t.resolution??"effective",onWrite:t.onWrite??"materializeIfInherited"});case"footnote":return`story:footnote:${typeof t.noteId=="string"?t.noteId:""}`;case"endnote":return`story:endnote:${typeof t.noteId=="string"?t.noteId:""}`;case"textbox":return`story:textbox:${typeof t.textboxId=="string"?t.textboxId:""}`;default:return JSON.stringify(t)}}function uh(e){if(!e||typeof e!="object")return null;const t=e,n=t.address&&typeof t.address=="object"?t.address:null;if(n?.story&&typeof n.story=="object")return n.story;if(t.storyLocator&&typeof t.storyLocator=="object")return t.storyLocator;if(t.trackedChangeStory&&typeof t.trackedChangeStory=="object")return t.trackedChangeStory;const r=ch(e);if(!r||typeof r!="object")return null;const o=r;if(o.story&&typeof o.story=="object")return o.story;const i=o.address&&typeof o.address=="object"?o.address:null;return i?.story&&typeof i.story=="object"?i.story:null}function ki(e,t,n){return Vr(e)!==t?!1:n?Jn(uh(e))===Jn(n):!0}function dh(e){const t=uh(e);if(!(!t||Jn(t)===Jn(null)))return t}function kH(e){if(typeof e!="string"||e.length===0)return;const t=hx(e);switch(t.kind){case"body":return;case"footnote":return t.id?{kind:"story",storyType:"footnote",noteId:t.id}:void 0;case"endnote":return t.id?{kind:"story",storyType:"endnote",noteId:t.id}:void 0;case"header":case"footer":return t.id?{kind:"story",storyType:"headerFooterPart",refId:t.id}:void 0;default:return}}function SH(e){if(!(typeof e!="string"||e.length===0||e==="body")){if(e.startsWith("hf:part:")){const t=e.slice(8);return t?{kind:"story",storyType:"headerFooterPart",refId:t}:void 0}if(e.startsWith("fn:")){const t=e.slice(3);return t?{kind:"story",storyType:"footnote",noteId:t}:void 0}if(e.startsWith("en:")){const t=e.slice(3);return t?{kind:"story",storyType:"endnote",noteId:t}:void 0}}}function tg(e){if(!e||typeof e!="object")return null;const t=e.selectionTarget;return t&&typeof t=="object"?t:null}function fh(e){if(!e||typeof e!="object")return null;const t=e.id;return typeof t=="string"&&t.length>0?t:null}function _H(e){if(!e||typeof e!="object")return null;const t=e;if(t.kind!=="selection")return e;const n=t.start;return!n||typeof n!="object"?null:{...t,end:n}}function Vr(e){if(!e||typeof e!="object")return null;const t=e,n=t.id??t.commentId??t.changeId;return typeof n=="string"&&n.length>0?n:null}function od(e){return typeof e=="string"?e.trim():""}function AH(e,t){const n=t??{},r=od(n.id).toLowerCase(),o=od(e.authorId).toLowerCase();if(r&&o)return r===o;const i=od(n.email).toLowerCase(),s=od(e.authorEmail).toLowerCase();if(i&&s)return i===s;if(r||i||o||s)return!1;const a=od(e.author).replace(/\s+/g," ").toLowerCase();if(!a)return!0;const l=od(n.name).replace(/\s+/g," ").toLowerCase();return!!(l&&l===a)}function IH(e){if(!e||typeof e!="object")return null;const t=e,n=t.anchor,r=t.focus,o=n?.visualCaret,i=r?.visualCaret,s=o?.trackChangeId,a=i?.trackChangeId;return typeof s=="string"&&s.length>0&&s===a?s:null}var NI=new WeakMap;function BI(e){const t=[],n=i=>{typeof i=="string"&&i.length>0&&!t.includes(i)&&t.push(i)},r=i=>{if(!i||typeof i!="object")return;const s=i,a=s.sourceIds;if(a&&typeof a=="object"&&(n(a.wordIdInsert),n(a.wordIdDelete),Array.isArray(a.wordIdOther)))for(const f of a.wordIdOther)n(f);const l=s.wordRevisionIds;l&&typeof l=="object"&&(n(l.insert),n(l.delete),n(l.format));const u=s.replacement;if(u&&typeof u=="object")for(const f of[u.inserted,u.deleted])f&&typeof f=="object"&&(n(f.id),n(f.wordId));const d=s.move;if(d&&typeof d=="object")for(const f of[d.source,d.destination])f&&typeof f=="object"&&(n(f.id),n(f.wordId))};r(e);const o=e?.change;return o&&o!==e&&r(o),t}function Ks(e){const t=NI.get(e);if(t)return t;const n=new Set,r=new Map;for(const i of e){const s=Vr(i);if(s){n.add(s);for(const a of BI(i)){r.has(a)||r.set(a,s);const l=`imported:${a}`;r.has(l)||r.set(l,s)}}}const o={toPublicId(i){if(n.has(i))return i;const s=r.get(i);return s!=null&&n.has(s)?s:null},aliasesFor(i){const s=[i];for(const[a,l]of r)l===i&&!s.includes(a)&&s.push(a);return s}};return NI.set(e,o),o}var zI=new WeakMap,jI=new WeakMap;function Fl(e,t){const n=Jn(t);let r=zI.get(e);r||(r=new Map,zI.set(e,r));const o=r.get(n);if(o)return o;const i=Ks(e.filter(s=>Jn(uh(s))===n));return r.set(n,i),i}function EH(e){return!!e&&typeof e=="object"&&e.storyType==="textbox"}function TH(e,t){const n=t.filter(o=>e.some(i=>Vr(i)===o&&uh(i)==null));if(n.length===0)return null;if(n.length===1)return n[0];const r=new Set;for(const o of n){const i=e.find(s=>Vr(s)===o);if(i)for(const s of BI(i)){if(r.has(s))return null;r.add(s)}}return n[0]}function xH(e){const t=jI.get(e);if(t)return t;const n=e.filter(o=>uh(o)!=null),r=n.length===e.length?e:n;return jI.set(e,r),r}function RH(e){const{selectionIds:t,publicIds:n,selection:r,bodyItems:o,allStoryItems:i}=e;if(t.length===0)return null;const s=u=>{for(const d of t){const f=u.toPublicId(d);if(f)return f}return null},a=vs(r),l=Jn(a)===Jn(null);if(i){const u=l?xH(i):i,d=s(Fl(u,a));if(d)return d;const f=n?.find(p=>u.some(g=>ki(g,p,a)));return f||(l?s(Ks(o)):EH(a)?TH(i,t):null)}return l?s(Ks(o))??t[0]??null:null}function MH(e,t){const n=e.find(r=>Vr(r)===t||r.importedId===t);return n?n.rootCommentId??n.parentCommentId??Vr(n)??t:null}function LH(e){const t=e.selectionTarget;if(t){const s=t.start,a=t.end,l=typeof s?.blockId=="string"?s.blockId:void 0,u=typeof a?.blockId=="string"?a.blockId:l;if(l)return{startBlockId:l,endBlockId:u??l}}const n=e.target,r=n&&Array.isArray(n.segments)?n.segments:[],o=r[0]?.blockId,i=r[r.length-1]?.blockId;return typeof o=="string"?{startBlockId:o,endBlockId:typeof i=="string"?i:o}:null}function Dr(e){const t=[],n=s=>{typeof s=="string"&&s.length>0&&!t.includes(s)&&t.push(s)},r=e.target,o=r&&Array.isArray(r.segments)?r.segments:[];for(const s of o)n(s?.blockId);const i=e.selectionTarget;return i&&(n(i.start?.blockId),n(i.end?.blockId)),t}var DH=64;function Pc(e){return e.length<=DH}function vs(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:{kind:"story",storyType:"body"}}function _o(e,t){return{kind:"block",nodeType:"paragraph",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}function Ua(e){return{kind:"block",nodeType:"paragraph",nodeId:e}}function VI(e,t){return{kind:"block",nodeType:"listItem",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}var UI=720;function qs(e){return Math.round(e*20)}function id(e){return typeof e=="number"&&Number.isFinite(e)}function OH(e){if(!e||typeof e!="object")return null;const t=e.node;if(!t||typeof t!="object")return null;const n=t.kind==="heading"?t.heading??null:t.kind==="paragraph"?t.paragraph??null:null;if(!n)return null;const r=n.resolved,o=n.props,i=r?.indent??o?.indent;if(!i||typeof i!="object")return null;const s=id(i.left)?qs(i.left):id(i.start)?qs(i.start):void 0,a=id(i.right)?qs(i.right):id(i.end)?qs(i.end):void 0,l=id(i.firstLine)?qs(i.firstLine):void 0,u=id(i.hanging)?qs(i.hanging):void 0;return s==null&&a==null&&l==null&&u==null?null:{...s!=null?{left:s}:{},...a!=null?{right:a}:{},...l!=null?{firstLine:l}:{},...u!=null?{hanging:u}:{}}}function u2(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=t?.story,o=[];for(const i of n){if(!i||typeof i.blockId!="string")continue;const s=i.range;!s||typeof s.start!="number"||typeof s.end!="number"||s.start===s.end||o.push({kind:"text",blockId:i.blockId,range:{start:s.start,end:s.end},...r?{story:r}:{}})}return o}function PH(e){if(!e||typeof e!="object")return[];const t=e,n=t.story,r=[];if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const o=t.range;return typeof o.start=="number"&&typeof o.end=="number"&&o.start!==o.end&&r.push({kind:"text",blockId:t.blockId,range:{start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)},...n?{story:n}:{}}),r}if(t.kind==="text"&&Array.isArray(t.segments)){for(const o of t.segments){const i=o?.range;typeof o?.blockId=="string"&&typeof i?.start=="number"&&typeof i?.end=="number"&&i.start!==i.end&&r.push({kind:"text",blockId:o.blockId,range:{start:Math.min(i.start,i.end),end:Math.max(i.start,i.end)},...n?{story:n}:{}})}return r}if(t.kind==="selection"){const o=t.start,i=t.end,s=typeof o?.blockId=="string"&&i?.blockId===o.blockId?o.blockId:null;o?.kind==="text"&&i?.kind==="text"&&s&&typeof o.offset=="number"&&typeof i.offset=="number"&&o.offset!==i.offset&&r.push({kind:"text",blockId:s,range:{start:Math.min(o.offset,i.offset),end:Math.max(o.offset,i.offset)},...t.story??o.story?{story:t.story??o.story}:{}})}return r}function hh(e){if(!e||typeof e!="object")return null;const t=e,n=t.story;if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const r=t.range;if(typeof r.start=="number"&&typeof r.end=="number"&&r.start===r.end)return{kind:"text",blockId:t.blockId,range:{start:r.start,end:r.end},...n?{story:n}:{}}}if(t.kind==="text"&&Array.isArray(t.segments)){const r=t.segments[0],o=r?.range;if(typeof r?.blockId=="string"&&typeof o?.start=="number"&&typeof o?.end=="number"&&o.start===o.end)return{kind:"text",blockId:r.blockId,range:{start:o.start,end:o.end},...n?{story:n}:{}}}if(t.kind==="selection"){const r=t.start,o=t.end,i=typeof r?.blockId=="string"&&o?.blockId===r.blockId?r.blockId:null;if(r?.kind==="text"&&o?.kind==="text"&&i&&typeof r.offset=="number"&&typeof o.offset=="number"&&r.offset===o.offset)return{kind:"text",blockId:i,range:{start:r.offset,end:r.offset},...t.story??r.story?{story:t.story??r.story}:{}}}return null}function Ys(e){return hh(e.target)??hh(e.selectionTarget)}var HI=["fontFamily","fontSize","color","highlight"],FH={undo:"history.undo",redo:"history.redo"},ph=["bold","italic","underline","strikethrough"];function d2(e){return HI.includes(e)}function sd(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=[],o=(l,u,d)=>{typeof l!="string"||typeof u!="number"||typeof d!="number"||r.push({blockId:l,start:Math.min(u,d),end:Math.max(u,d)})};for(const l of n){const u=l?.range;o(l?.blockId,u?.start,u?.end)}if(r.length>0)return r;const i=e.selectionTarget,s=i?.start,a=i?.end;return!s||!a||s.blockId!==a.blockId||o(s.blockId,s.offset,a.offset),r}function ys(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:void 0}function NH(e){const t=ys(e);if(!t||typeof t!="object")return"body";const n=t;return JSON.stringify({storyType:typeof n.storyType=="string"?n.storyType:"body",refId:typeof n.refId=="string"?n.refId:null,noteId:typeof n.noteId=="string"?n.noteId:null,textboxId:typeof n.textboxId=="string"?n.textboxId:null})}function Ha(e){const t=sd(e);return t.length===0?null:[NH(e),...t.map(n=>`${n.blockId}:${n.start}-${n.end}`)].join("|")}function $I(e){const t=e.selectionTarget;return!t||typeof t!="object"?null:Dc({selectionTarget:t})}function BH(e,t){if(e==="fontSize"){const r=typeof t=="number"?t:Number(t);return Number.isFinite(r)&&r>0?String(r):null}if(typeof t!="string")return null;const n=t.trim();return n.length===0?null:e==="color"||e==="highlight"?n.toUpperCase():n}function zH(e,t){return Math.max(e.start,t.start)<Math.min(e.end,t.end)}function jH(e){if(!e)return[];const t=Array.isArray(e.blocks)?e.blocks:[],n=[];for(const r of t){const o=r?.range,i=r?.blockId;typeof i!="string"||typeof o?.start!="number"||typeof o?.end!="number"||n.push({blockId:i,start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)})}return n}function VH(e,t){return e.length!==t.length?!1:e.every((n,r)=>{const o=t[r];return o?.blockId===n.blockId&&o?.start===n.start&&o?.end===n.end})}function GI(e,t){const n=sd(t);if(n.length===0)return null;const r=e&&Array.isArray(e.items)?e.items:[];if(r.length===0)return null;const o=r.find(i=>VH(n,jH(i)));if(o)return o;if(n.length===1){const i=r.find(s=>{const a=s?.address;return a?.kind==="block"&&a.nodeId===n[0].blockId});if(i)return i}return r[0]??null}function UH(e,t){const n=t==="fontSize"?e?.fontSizePt??e?.fontSize:t==="highlight"?e?.highlight??e?.backgroundColor:e?.[t];if(typeof n=="number")return Number.isFinite(n)?String(n):void 0;if(typeof n!="string")return;const r=n.trim();if(r.length!==0)return t==="color"||t==="highlight"?r.toUpperCase():r}function f2(e){if(typeof e!="string")return;const t=e.split(",")[0]?.trim().replace(/^['"]+|['"]+$/g,"").trim();if(!t)return;const n=t.toLowerCase();if(!(n==="serif"||n==="sans-serif"||n==="monospace"||n==="cursive"||n==="fantasy"))return t}function HH(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return;const t=Math.round(e*.75*2)/2;if(!(t<=0))return String(t)}function $H(e,t){return e==="fontFamily"?t.toLowerCase():e==="color"||e==="highlight"?t.toUpperCase():t}function WI(e,t){if(!e)return{};const n=new Map;for(const i of sd(t)){const s=n.get(i.blockId)??[];s.push({start:i.start,end:i.end}),n.set(i.blockId,s)}if(n.size===0)return{};const r=Array.isArray(e.blocks)?e.blocks:[],o={};for(const i of HI){const s=new Map;let a=!1,l=!1;for(const u of r){const d=typeof u?.blockId=="string"?u.blockId:null;if(!d)continue;const f=n.get(d);if(!f?.length)continue;const p=Array.isArray(u?.runs)?u.runs:[];for(const g of p){const m=g?.range,v=typeof m?.start=="number"?m.start:null,k=typeof m?.end=="number"?m.end:null;if(v==null||k==null||!f.some(C=>zH(C,{start:v,end:k})))continue;a=!0;const b=UH(g?.styles,i);if(b===void 0){l=!0;continue}const S=$H(i,b);if(s.has(S)||s.set(S,b),s.size>1)break}if(s.size>1)break}a&&!l&&s.size===1&&(o[i]=[...s.values()][0])}return o}function h2(e,t){const n=Dr(e)[0];return n?t==="nodeId"?{kind:"after",nodeId:n}:{kind:"after",target:_o(n)}:{kind:"documentEnd"}}function tn(e,t){const n=e.supported??t!=="unsupported",r=e.enabled??(e.disabled!==void 0?!e.disabled:n);return{enabled:r,disabled:!r,active:e.active??!1,supported:n,value:e.value,source:t,reason:r?void 0:e.reason}}function ad(e){if(!e||typeof e!="object")return null;const t=e,n=t.change,r=n&&typeof n=="object"?n:t;return{...t,id:t.id??r.id,change:r}}function ld(e){const t=e,n=t.change;return n&&typeof n=="object"?n:t}function Xs(e){if(Lr(e))return!0;if(e===!1)return!1;if(e===!0||e==null||typeof e!="object")return!0;const t=e;return"success"in t||"failure"in t||"effects"in t?e:t.status!=="rejected"}function ng(e){return!!e&&typeof e=="object"&&e.success===!0}function GH(e){if(e.dryRun===!0)return!1;const t=e.receipt;return!(t&&typeof t=="object"&&t.changed===!1||t&&typeof t=="object"&&t.noop===!0||t&&typeof t=="object"&&t.status==="NO_OP")}function mo(e){return!(e===!1||e&&typeof e=="object"&&e.success===!1)}function mh(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function p2(e){const t=[],n=r=>{if(!r||typeof r!="object")return;const o=r;if(Array.isArray(o.runs)&&t.push(o),Array.isArray(o.rows))for(const i of o.rows){const s=i?.cells;if(Array.isArray(s))for(const a of s){const l=a;if(Array.isArray(l?.blocks))for(const u of l.blocks)n(u);l?.paragraph&&n(l.paragraph)}}};if(Array.isArray(e))for(const r of e)n(r);return t}function Fc(e,t){return e.sourceAnchor?.sourceNodeId===t?!0:e.id===t}function rg(e){return e.trackedChange?.kind==="delete"?0:typeof e.text=="string"?e.text.length:0}function Si(e){let t=!1,n=null,r=null,o=null;for(const i of e)t=i,!mo(i)&&n===null&&(n=i),ng(i)&&(o=i),i!==!1&&(r=i);return n??o??r??t}function WH(e){const t=e?.anchor,n=t?.start,r=t?.end;return typeof n?.blockId!="string"||typeof r?.blockId!="string"||n.blockId!==r.blockId||typeof n.offset!="number"||typeof r.offset!="number"?null:{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.offset},end:{kind:"text",blockId:r.blockId,offset:r.offset}}}function KH(e){return e.startsWith("#")?{kind:"anchor",anchor:e.slice(1)}:{kind:"external",url:e}}function og(e){return td(e)?.trackDecision??null}function qH(e){return{found:e.length>0,success:e.length>0,rects:e,rect:e[0]}}function Nl(e){return{found:!1,success:!1,rects:[],reason:e}}function YH(e,t){if(!t||typeof t.getBoundingClientRect!="function"||e.rects.length===0)return e;let n;try{const o=t.getBoundingClientRect();n={left:o.left,top:o.top}}catch{return e}const r=e.rects.map(o=>({...o,left:o.left-n.left,right:o.right-n.left,top:o.top-n.top,bottom:o.bottom-n.top}));return{...e,rects:r,rect:r[0]}}function XH(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.blockId!="string"||!t.range||typeof t.range!="object")return!1;const n=t.range;return Number.isInteger(n.start)&&Number.isInteger(n.end)&&n.start>=0&&n.start<=n.end}function KI(e){if(!e||e.kind!=="text"||!Array.isArray(e.segments)||e.segments.length===0)return null;const t=Array.from(e.segments);if(!t.every(XH))return null;const n=t[0],r=t[t.length-1],o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end,...o?{story:o}:{}},...o?{story:o}:{}}}function ZH(e){return e.selectionTarget?e.selectionTarget:KI(e.target)}function cd(e){if(e.empty)return null;if(e.selectionTarget)return e.selectionTarget;const t=KI(e.target);return t&&t.start.kind==="text"&&t.end.kind==="text"&&t.start.blockId!==t.end.blockId?null:t}function m2(e){return!e.inline||typeof e.docRoute!="string"?null:e.docRoute.startsWith("format.")?e.docRoute.slice(7):null}var g2={bold:null,italic:null,underline:null,strike:null,color:null,highlight:null,fontFamily:null,fontSize:null,vertAlign:null,smallCaps:null,caps:null,letterSpacing:null,dstrike:null},QH=Object.fromEntries(Object.entries(g2).filter(([e])=>uH[e]?.tracked===!0));function JH(e,t,n,r){switch(e.kind){case"toggle":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return typeof o=="boolean"||o===null?{target:t,value:o}:{target:t,value:!r}}case"value-string":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return o===null?{target:t,value:null}:typeof o!="string"||o.trim()===""?null:{target:t,value:o}}case"value-number":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n,i=typeof o=="number"?o:Number(o);return!Number.isFinite(i)||i<=0?null:{target:t,value:i}}case"clear":return{target:t,inline:{...g2}};default:return null}}function e$(e){const t=o=>{if(!o||typeof o!="object")return null;const i=o,s=i.rowIndex,a=i.columnIndex;return typeof s!="number"||!Number.isInteger(s)||typeof a!="number"||!Number.isInteger(a)?null:{rowIndex:s,columnIndex:a}};if(!e)return null;const n=t(e.start),r=t(e.end);return!n||!r?null:{start:n,end:r}}function t$(e,t){const{tableNodeId:n,rowIndex:r,columnIndex:o,cellNodeId:i,mergeRange:s}=t;switch(e){case"insert-row-before":return{nodeId:n,rowIndex:r,position:"above"};case"insert-row-after":return{nodeId:n,rowIndex:r,position:"below"};case"delete-row":return{nodeId:n,rowIndex:r};case"insert-column-before":return{nodeId:n,columnIndex:o,position:"left"};case"insert-column-after":return{nodeId:n,columnIndex:o,position:"right"};case"delete-column":return{nodeId:n,columnIndex:o};case"delete-table":return{nodeId:n};case"merge-cells":{const a=s??{start:{rowIndex:r,columnIndex:o},end:{rowIndex:r,columnIndex:o}};return{nodeId:n,start:a.start,end:a.end}}case"split-cell":return i?{nodeId:i,rows:1,columns:2}:null;case"remove-borders":return{nodeId:n,mode:"applyTo",applyTo:"all",border:null};default:return null}}function n$(e){const t=e.superdoc,n=new Map,r=new Map;let o=null,i=0;const s=[];let a=null,l=0,u=!1,d=Promise.resolve(),f=null,p={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:0,pointerSelecting:!1,keyboardSelecting:!1},g=0;const m=new Set;let v={},k="",b=null;const S=()=>{const c=t?.activeEditor;return c&&typeof c=="object"?c:null},C={open:()=>{if(ee)return{ok:!1,reason:lt.notReady};const c=S();if(!c)return{ok:!1,reason:lt.notReady};const h=c.contextMenu;if(!h||typeof h!="object"||typeof h.open!="function")return{ok:!1,reason:lt.operationUnavailable};try{const y=h.open();return y&&typeof y=="object"&&y.ok===!1?{ok:!1,reason:eg(y.reason,lt.operationUnavailable)}:{ok:!0}}catch{return{ok:!1,reason:lt.operationUnavailable}}},close:()=>{if(ee)return;const c=S()?.contextMenu;if(!(!c||typeof c!="object"||typeof c.close!="function"))try{c.close()}catch{}},contextAt:wE},w=()=>{const c=S()?.doc;return c&&typeof c=="object"?c:null},T=()=>{const c=S()?.v2TrackedChanges;return c&&typeof c=="object"?c:null},L=()=>{const c=S();if(c?.editorVersion!==2)return null;const h=c.reviewWindow;return h&&typeof h=="object"?h:null},z=()=>{const c=L();return!c||typeof c.getSnapshot!="function"?null:Ot(()=>c.getSnapshot(),null)},W=()=>typeof L()?.getSnapshot=="function",V=c=>{const h=c?.status;return h==="ready"||h==="stale"?h:"pending"},j=()=>{const c=S()?.host;return c&&typeof c=="object"?c:null},Z=c=>{if(c.storyType!=="headerFooterPart"||typeof c.refId!="string")return null;const h=S(),y=j(),_=h?.pageLayout??y?.pageLayout;if(!_||typeof _!="object")return null;const E=_.getActiveRulerContext,D=y?.resolveHeaderFooterEditTarget;if(typeof E!="function"||typeof D!="function")return null;const U=Ot(()=>E.call(_),null);if(!U||typeof U.pageIndex!="number")return null;for(const oe of["header","footer"]){const fe=Ot(()=>D.call(y,{pageIndex:U.pageIndex,kind:oe}),null);if(!(fe?.status!=="ready"||fe.refId!==c.refId||typeof fe.sectionId!="string"||!["default","first","even"].includes(String(fe.slotVariant))))return{kind:"story",storyType:"headerFooterSlot",section:{kind:"section",sectionId:fe.sectionId},headerFooterKind:oe,variant:fe.slotVariant}}return null},R=()=>{const c=j(),h=c?.getPendingInlineFormat;if(typeof h!="function")return null;const y=Ot(()=>h.call(c),null);return y&&typeof y=="object"?y:null},K=c=>{const h=m2(c);if(!h)return null;const y=R();if(!y||!(h in y))return null;const _=y[h];return c.inline?.kind==="toggle"?_===!0:_!=null&&_!==""},x=c=>{const h=m2(c);if(!h)return;const y=R();if(!y||!(h in y))return;const _=y[h];if(typeof _=="string"&&_!=="")return _;if(typeof _=="number"&&Number.isFinite(_))return String(_)},$=(c,h)=>{const y=j(),_=y?.setPendingInlineFormat;typeof _=="function"&&Ot(()=>_.call(y,c,h),void 0)},H=c=>{const h=j(),y=h?.clearPendingInlineFormat;typeof y=="function"&&Ot(()=>y.call(h,c),void 0)},J=new Set(["bold","italic","underline","strikethrough"]),Q=c=>{const h=R();if(!h)return;const y=Array.isArray(c.activeMarks)?c.activeMarks:[];let _=null;for(const E of Object.keys(h)){const D=h[E];let U;if(J.has(E)){if(D===!1)continue;U=y.includes(E)===(D===!0)}else if(d2(E)){if(D==null)continue;_||(_=Xa(c)),U=_[E]===D}else U=!1;U&&H(E)}},Y=()=>{const c=S()?.editCommands;return c&&typeof c=="object"?c:null},_e=c=>{const h=Y();if(!h||typeof h.getSnapshot!="function")return null;const y=Ot(()=>h.getSnapshot(),null)?.commands?.[c];return y&&typeof y=="object"?y:null},ue=()=>_e("lists.apply"),ve=c=>{const h=c?.value?.seed;return h==="bullet"||h==="ordered"?h:null},ge=c=>{const h=FH[c];return h?_e(h):null},Te=()=>{const c=j();if(!c||typeof c.getTableContext!="function")return null;const h=Ot(()=>c.getTableContext(),null);return h&&typeof h=="object"?h:null},Ne=()=>{const c=Te();if(!c||c.inTable!==!0)return null;const h=c.table,y=typeof h?.nodeId=="string"&&h.nodeId.length>0?h.nodeId:null;if(!y)return null;const _=c.row,E=c.column,D=c.cell,U=typeof _?.index=="number"&&Number.isInteger(_.index)?_.index:null,oe=typeof E?.index=="number"&&Number.isInteger(E.index)?E.index:null;if(U==null||oe==null)return null;const fe=typeof D?.nodeId=="string"&&D.nodeId.length>0?D.nodeId:null,Re=c.cellRange;return{tableNodeId:y,rowIndex:U,columnIndex:oe,cellNodeId:fe,mergeRange:e$(Re)}},Je=new Map;let ct=null,tt=null,Tt=0,ae=0,Ee=0;const Ue=new Set,ie=(c,h)=>c===h?!0:!c||!h?!1:c.id===h.id&&c.paintedEntityId===h.paintedEntityId&&Jn(c.story)===Jn(h.story),I=c=>Array.from(Ue).some(h=>ie(h,c)),se=c=>{const h=j();if(typeof h?.getHandles!="function")return;const y=Ot(()=>h.getHandles(),null),_=y?.review;if(_){if(c){if(typeof _.setActiveReviewTarget!="function")return;const E=y?.layout;Ot(()=>_.setActiveReviewTarget({entityType:"trackedChange",entityId:c.id,...c.paintedEntityId?{paintedEntityId:c.paintedEntityId}:{},origin:"panel",layoutEpoch:typeof E?.generation=="number"?E.generation:0,story:c.story??{kind:"story",storyType:"body"}}),null);return}typeof _.getActiveReviewTarget!="function"||typeof _.clearActiveReviewTarget!="function"||Ot(()=>_.getActiveReviewTarget(),null)?.entityType==="trackedChange"&&Ot(()=>_.clearActiveReviewTarget(),void 0)}},F=(c,h)=>{tt=c,Tt+=1,Ee+=1,h?.invalidateQueuedNavigation!==!1&&(ae+=1)},q=new Set;let P,ee=!1,be=null;const N=new Map,B=new Set;let de=null,Se=null,Ae=!1,Le=null,Xe=0,it=null,yt=null,Mt=null;const Lt=[],Wt=()=>{if(Ae||ee)return;Ae=!0;const c=()=>{Ae=!1,ee||Dt("async-read-settled")};typeof queueMicrotask=="function"?queueMicrotask(c):Promise.resolve().then(c)},Be=250,rn=5e3,zn=c=>{ee||Le&&Xe<=c||(Le&&clearTimeout(Le),Xe=c,Le=setTimeout(()=>{Le=null,Xe=0,ee||Dt()},Math.max(0,c-Date.now())))},Ht=new WeakMap;let xn=0;const Ur=c=>{if(!c)return"none";let h=Ht.get(c);return h==null&&(h=xn+=1,Ht.set(c,h)),`e${h}`};let yr=0;const Ar=e.superdoc,et=dH(Ar),kt=()=>{et.abortController.abort("review-mutation-started"),et.inFlight=null},Bt=()=>{et.generation+=1,et.abortController=new AbortController,et.inFlight=null},cn=c=>{const h=et.activeMutationTokens;if(typeof c!="string"||c.length===0||h.has(c))return;const y=h.size===0;h.add(c),y&&kt()},fn=c=>{const h=et.activeMutationTokens;typeof c!="string"||!h.delete(c)||h.size===0&&Bt()},nn=c=>{const h=T(),y=h?.listTrackedChanges;if(typeof y!="function")return S()?.editorVersion===2?Promise.reject(new Error("v2-tracked-changes-bridge-pending")):c();if(et.activeMutationTokens.size>0)return Promise.reject(new Error("ui-review-catalog-superseded"));const _=et.generation,E=et.inFlight;if(E?.generation===_)return E.promise;const D=et.abortController.signal,U=Re=>{if(D.aborted||_!==et.generation||Re?.reason==="review-hydration-superseded")throw new Error("ui-review-catalog-superseded");return Re},oe=y.call(h,{blocking:!1,signal:D});if(!Lr(oe))return U(oe);const fe=Promise.resolve(oe).then(U);return et.inFlight={generation:_,promise:fe},fe.then(()=>{et.inFlight?.promise===fe&&(et.inFlight=null)},()=>{et.inFlight?.promise===fe&&(et.inFlight=null)}),fe};let wn=null,Qt=new Set,er=null,go=0,je=null;const $e=new WeakSet,nt=new WeakMap,Ct=c=>{if(nt.has(c))return;const h=typeof c.getLocalMutationRevision=="function"?Ot(()=>c.getLocalMutationRevision(),null):null,y=typeof h=="number"?h:0;nt.set(c,y),y>0?$e.add(c):h===0&&$e.delete(c)},Pt=()=>{const c=j();return c?(Ct(c),$e.has(c)):!1},ft=()=>`${Ur(S())}|m${yr}`,In=()=>{wn=null,Qt=new Set},$t=c=>{for(const h of["trackChanges","trackChanges:all"]){const y=N.get(h);if(!y?.hasSettled||!Array.isArray(y.value))continue;const _=y.value.filter(E=>{const D=Vr(E);return!D||!c.has(D)});_.length!==y.value.length&&N.set(h,{...y,value:_})}},gn=c=>{const h=()=>{if(!ee)for(const D of[...q])D(P)},y=mh(c)?c:null,_=S()?.documentMutationReadiness,E=()=>{const D=globalThis.requestAnimationFrame;return typeof D!="function"?Promise.resolve():new Promise(U=>{let oe=!1;const fe=()=>{oe||(oe=!0,clearTimeout(Re),U())},Re=setTimeout(fe,250);D(()=>D(()=>setTimeout(fe,0)))})};if(y?.success===!0&&typeof y.txId=="string"&&y.txId.length>0&&typeof _?.whenPainted=="function")try{Promise.resolve(_.whenPainted.call(_,y)).then(E,()=>{}).then(h,h);return}catch{}h()},vo=(c,h)=>{const y=P.trackChanges,_=y.items.filter(U=>{const oe=Vr(U);return!oe||!c.has(oe)});if(_.length===y.items.length)return;tt&&c.has(tt.id)&&F(null);const E=new Set;for(const U of _){const oe=ld(U),fe=U,Re=oe.author??oe.authorEmail??fe.author??fe.authorEmail;typeof Re=="string"&&E.add(Re)}const D=y.items.length-_.length;P={...P,trackChanges:{...y,items:_,total:Math.max(_.length,y.total-D),activeId:y.activeId&&c.has(y.activeId)?null:y.activeId,authors:[...E]}},gn(h)},Po=c=>{const h=P.trackChanges,y=h.items.length>0||h.total!==0||h.activeId!==null||h.authors.length>0;er=ft(),tt!==null&&F(null),P={...P,trackChanges:{...h,items:[],total:0,activeId:null,authors:[]}},y&&gn(c)},Hi=(c,h)=>{if(c.size===0)return;const y=ft(),_=wn===y?Qt:new Set,E=new Set([...c].filter(D=>!_.has(D)));E.size!==0&&(wn=y,Qt=new Set([..._,...E]),$t(Qt),vo(E,h))},on=c=>wn===c&&Qt.size>0?Qt:null,Kn=c=>{const h=ft(),y=on(h),_=c.map(ad).filter(E=>{if(E==null)return!1;const D=Vr(E);return D!=null&&!y?.has(D)});for(const E of["trackChanges","trackChanges:all"])N.set(E,{token:h,value:[..._],hasSettled:!0,inflightToken:null})},Hn=()=>`${ft()}|m${$n()}|s${go}`,Yr=c=>JSON.stringify({t:c.target??null,s:c.selectionTarget??null}),ln=["contentControls:inRange:","query:","effInline:"],Ln=120,br=180,Ao=()=>{const c=j(),h=c?.getDocumentLoadingSnapshot;if(typeof h!="function")return"unknown";const y=Ot(()=>h.call(c),null)?.sourceStage;return y==="opening"||y==="bootstrap-ready"||y==="source-loading"?"loading":y==="source-complete"||y==="source-failed"||y==="source-cancelled"?"complete":"unknown"},Io=new Map,Wo=new Map,_i=new Map;let Ai=null;const yo={comments:0,trackChanges:0,contentControls:0},Eo=c=>{const h=ft();Io.get(c)!==h&&(Io.set(c,h),Wt())},Bl=()=>{const c=N.get("comments");return c?.hasSettled?Array.isArray(c.value)&&c.value.length>0:c?.inflightToken!=null},Zs=(c,h)=>Io.get(c)===h,ai=()=>{const c=ft();let h=!1;for(const[y,_]of Wo){if(_!==c){Wo.delete(y);continue}if(_i.get(y)===c)continue;const E=N.get(y);!E?.hasSettled||E.token!==c||E.inflightToken!=null||(N.set(y,{...E,token:null,inflightToken:null}),_i.set(y,c),h=!0)}h&&Wt()},Ie=c=>{yo[c]+=1,Eo(c);let h=!1;return()=>{h||(h=!0,yo[c]=Math.max(0,yo[c]-1),yo[c]===0&&Io.get(c)===ft()&&Io.delete(c),Wt())}},ze=c=>{Eo("contentControls")},mt=()=>{const c=N.get("trackChanges");c?.hasSettled||c?.inflightToken!=null||Eo("trackChanges")},ht=()=>{const c=N.get("comments");c?.hasSettled||c?.inflightToken!=null||Eo("comments")},Rn=6500,Vn=250;let Hr=0,Xr=0,bo=!1,oo=null;const li=()=>{if(ee||oo)return;const c=()=>{if(oo=null,ee)return;const h=Date.now()-Hr;if(ci()||h<Rn){oo=setTimeout(c,Vn);return}bo=!1,Dt()};oo=setTimeout(c,0)};let Fo=null,qn=null;const zl=()=>{const c=j();if(!c||Fo===c)return;qn&&(qn(),qn=null),Fo=c;const h=c.subscribeDocumentLoading;if(typeof h!="function"){Fo=null,fr(Rn);return}try{const y=D=>{const U=D?.sourceStage;(U==="source-complete"||U==="source-failed"||U==="source-cancelled")&&(Ai=ft(),ai(),Hr=Math.max(Hr,Date.now()),li())},_=h.call(c,y);typeof _=="function"&&(qn=_);const E=c.getDocumentLoadingSnapshot;typeof E=="function"&&y(Ot(()=>E.call(c),null))}catch{Fo=null,fr(Rn)}},Qs=()=>{const c=S()?.host,h=c?.getForegroundMutationState;if(typeof h!="function")return null;const y=Ot(()=>h.call(c),null);return{active:typeof y?.active=="number"?y.active:0,pending:typeof y?.pending=="number"?y.pending:0}},ci=()=>{const c=Qs();return!!(c&&(c.active>0||c.pending>0))},fr=(c=Ln)=>{ee||it||(it=setTimeout(()=>{if(it=null,ee)return;if(ci()){fr();return}const h=yt;yt=null,h===Hn()&&Nc("selection",h,Uc,Yi),Dt()},c))},Ko=(c,h)=>{if(!Qs())return!1;const y=`${c}\0${h}`;return B.has(y)?!1:(B.add(y),fr(br),!0)},$i=c=>{if(de==null||c===de)return Se?.timer&&clearTimeout(Se.timer),Se=null,de=c,!1;if(Se?.key===c)return Se.ready?(Se=null,de=c,!1):!0;Se?.timer&&clearTimeout(Se.timer);const h={key:c,ready:!1,timer:null};return h.timer=setTimeout(()=>{ee||Se!==h||(h.timer=null,h.ready=!0,Dt())},br),Se=h,!0},Gi=c=>rH(c),Js=()=>{Ti(),Dt()};let Wi=null,Ki=null,ea=!1,Ii=0,Ei=!1,ta=0;const $a=()=>{Wi=null,ea=!1,Ii+=1},ud=()=>{Ki=null,Ei=!1,ta+=1},qi=()=>{const c=S(),h=c?.documentMutationReadiness;if(!c||typeof h?.whenPainted!="function"||(Wi={editor:c,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Ot(()=>h.getRenderEpoch.call(h),null):null},ea))return;ea=!0;const y=Ii;(async()=>{for(;!ee&&y===Ii;){const E=Wi;if(Wi=null,!E){ea=!1;return}let D=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),D=!0}catch{}if(ee||y!==Ii)return;if(S()!==E.editor){$a();return}D&&Js()}})()},jl=()=>{const c=S(),h=c?.documentMutationReadiness;if(!c||typeof h?.whenPainted!="function")return!1;if(Ki={editor:c,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Ot(()=>h.getRenderEpoch.call(h),null):null},Ei)return!0;Ei=!0;const y=ta;return(async()=>{for(;!ee&&y===ta;){const E=Ki;if(Ki=null,!E){Ei=!1;return}let D=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),D=!0}catch{}if(ee||y!==ta)return;if(S()!==E.editor){ud();return}Ki||(go+=1,wr(),Dt(D?"post-paint-selection":"post-paint-selection-failed"))}})(),!0},ws=()=>{Mt&&clearTimeout(Mt),Mt=setTimeout(()=>{Mt=null,ee||Js()},500)},Nc=(c,h,y,_)=>{let E;try{E=y()}catch{E=void 0}if(!Lr(E)){const oe={token:h,value:_(E),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0};return N.set(c,oe),oe}const D=N.get(c),U=D?.failedToken===h;return N.set(c,{token:D?.token??null,value:D?.value??null,hasSettled:D?.hasSettled??!1,inflightToken:h,failedToken:U?h:null,failureCount:U?D.failureCount??0:0,retryAtMs:0}),Promise.resolve(E).then(oe=>{const fe=N.get(c);if(!fe||fe.inflightToken!==h)return;N.set(c,{token:h,value:_(oe),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0});const{sink:Re,workerContext:Fe}=Jm();if(Re){const Pe=Va();Lt.push({key:c,settledAtMs:Pe,commandId:Fe?.commandId??null,commandKind:Fe?.commandKind??null}),a2({stage:"superdoc-ui-async-read-settled",atMs:Pe,key:c,settledAtMs:Pe,commandId:Fe?.commandId??null,commandKind:Fe?.commandKind??null})}Wt()},()=>{const oe=N.get(c);if(!oe||oe.inflightToken!==h)return;const fe=oe.failedToken===h?(oe.failureCount??0)+1:1,Re=Math.min(rn,Be*2**Math.min(fe-1,8)),Fe=Date.now()+Re;N.set(c,{...oe,inflightToken:null,failedToken:h,failureCount:fe,retryAtMs:Fe}),zn(Fe)}),null},Zr=(c,h,y,_)=>{const E=N.get(c);if(E&&E.token===h&&E.hasSettled)return{value:E.value,status:"ready"};if(CH(c)&&!Zs(c,h)){if(Ao()==="loading")return bo=!0,zl(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(bo)return li(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(Date.now()-Xr<Rn)return bo=!0,li(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"}}if(ci())return fr(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(E?.failedToken===h&&E.inflightToken==null&&(E.retryAtMs??0)>Date.now())return zn(E.retryAtMs),E.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(!E&&c.startsWith("effInline:")&&$i(c))return{value:null,status:"pending"};if(!E&&Ko(c,h))return{value:null,status:"pending"};if(!E||E.inflightToken!==h){const U=Nc(c,h,y,_);if(U)return{value:U.value,status:"ready"}}const D=N.get(c);return D?.hasSettled?{value:D.value,status:"stale"}:{value:null,status:"pending"}},na=c=>{for(const h of N.keys())c(h)&&N.delete(h)},dd=c=>{const h=Yr(c),y=$I(c);return new Set([`contentControls:inRange:${h}`,`query:${h}`,...y?[`effInline:${y}`]:[]])},gh=c=>{const h=dd(c);na(y=>ln.some(_=>y.startsWith(_))&&!h.has(y));for(const y of B){const _=y.split("\0",1)[0];ln.some(E=>_.startsWith(E))&&!h.has(_)&&B.delete(y)}},Bc=()=>{const c=S();c!==je&&($a(),ud(),je=c,N.clear(),Le&&clearTimeout(Le),Le=null,Xe=0,Se?.timer&&clearTimeout(Se.timer),Se=null,de=null,b=null,o=null,yt=null,B.clear(),Io.clear(),Wo.clear(),_i.clear(),Ai=null,bo=!1,qn&&qn(),qn=null,Fo=null,In(),er=null)},Ti=()=>{yr+=1,Wo.clear(),_i.clear(),Ai=null,In()},Vl=()=>{const c=er===ft();Ti(),c&&(Kn([]),er=ft()),Dt()},Ul=c=>{if(typeof c!="string"||c.length===0)return Wn("insertText requires a non-empty string.","INVALID_INPUT");if($n()==="viewing")return Wn("The document is read-only.","DOCUMENT_READONLY");const h=w(),y=h?.insert;if(!h||typeof y!="function")return Wn("insert is unavailable.");const _=h.selection?.current;if(typeof _!="function")return Wn("selection.current is unavailable.");const E=U=>{const oe=U&&typeof U=="object"?U:null,fe=oe?.selectionTarget??oe?.target??null;return!fe||typeof fe!="object"?Wn("insertText requires a live selection target.","PRECONDITION_FAILED"):Ot(()=>rc(y.call(h,{type:"text",value:c,target:fe}),Wn("insert failed.")),Wn("insert failed."))};let D;try{D=_.call(h.selection)}catch{return Wn("insertText could not resolve the live selection.","PRECONDITION_FAILED")}return Lr(D)?Promise.resolve(D).then(E,()=>Wn("insertText could not resolve the live selection.","PRECONDITION_FAILED")):E(D)},ra=(c,h)=>({payload:c,state:P,editor:S(),superdoc:t,context:h,ui:be,execute:(y,_)=>tu(y,_),executeAsync:(y,_)=>Cg(y,_),doc:w(),selection:P.selection,documentMode:$n(),insertText:Ul}),zc=c=>c==="editing"||c==="suggesting"||c==="viewing"?c:null,$n=()=>{const c=S(),h=t&&typeof t=="object"?t:null,y=zc(h?.config?.documentMode),_=Ot(typeof h?.getActiveRuntime=="function"?()=>{const U=h.getActiveRuntime();return typeof U?.getSnapshot=="function"?U.getSnapshot():null}:void 0,null),E=zc(_?.documentMode),D=zc(c?.options?.documentMode);return y&&E&&y!==E?y:E??y??D},Hl=()=>{const c=t&&typeof t=="object"?t:null,h=c?.interactionConfig?.comments;if(h&&typeof h.readOnly=="boolean")return h.readOnly===!0;const y=c?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.readOnly===!0},jc=()=>{if($n()==="viewing")return lt.documentReadonly;const c=(t&&typeof t=="object"?t:null)?.interactionConfig?.trackedChanges;return c&&typeof c.allowDecisions=="boolean"?c.allowDecisions?void 0:lt.trackedChangeDecisionsDisabled:Hl()?lt.documentReadonly:void 0},fd=()=>{const c=t&&typeof t=="object"?t:null,h=c?.interactionConfig?.comments;if(h&&typeof h.allowResolve=="boolean")return h.allowResolve===!1;const y=c?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.allowResolve===!1},Ga=()=>Hl(),Vc=()=>jc()!=null,Yi=c=>c&&typeof c=="object"?c:null,oa=(c,h)=>{if(!c)return{...yH,status:h};const y=c.target??null,_=typeof c.text=="string"?c.text:"";return{status:h,empty:c.empty===!0,target:y,selectionTarget:c.selectionTarget??null,activeMarks:Array.isArray(c.activeMarks)?c.activeMarks:[],activeCommentIds:Array.isArray(c.activeCommentIds)?c.activeCommentIds:[],activeChangeIds:Array.isArray(c.activeChangeIds)?c.activeChangeIds:[],quotedText:_}},ia=()=>{const c=w()?.selection;return Zr("selection",Hn(),()=>c?.current?c.current({includeText:!0}):void 0,Yi)},Wa=()=>{const{value:c,status:h}=ia();return oa(c,h)},Uc=()=>{const c=w()?.selection;return c?.current?c.current({includeText:!0}):void 0},$l=c=>{if(c.empty!==!0)return!1;const h=c.selectionTarget,y=h?.start,_=h?.end;return y?.kind==="text"&&_?.kind==="text"&&typeof y.blockId=="string"&&y.blockId===_.blockId&&typeof y.offset=="number"&&y.offset===_.offset},wr=c=>{const h=j(),y=h?.readLiveSelectionSyncSnapshot;if(typeof y!="function")return;const _=Yi(Ot(()=>y.call(h),null));if(!_||!$l(_))return;const E=Hn(),D=Qs(),U=!!(D&&(D.active>0||D.pending>0));if(U)yt=E,fr();else if(yt=null,Nc("selection",E,Uc,Yi))return;const oe=N.get("selection"),fe=Array.isArray(_.activeMarks)&&_.activeMarks.length>0?_.activeMarks:Array.isArray(P.selection.activeMarks)?P.selection.activeMarks:[],Re=Array.isArray(_.activeCommentIds)?_.activeCommentIds:[],Fe=IH(c),Pe=Ys(P.selection),Ye=hh(_.selectionTarget)??hh(_.target),Ze=Pe?.range,Ke=Ye?.range,We=!!(D&&D.active>0&&Pe&&Ye&&Pe.blockId===Ye.blockId&&Jn(Pe.story)===Jn(Ye.story)&&typeof Ze?.start=="number"&&typeof Ke?.start=="number"&&Math.abs(Ke.start-Ze.start)<=2),at=Fe!=null||We?P.selection.activeChangeIds.filter(qe=>Fe==null||Ks(P.trackChanges.items).aliasesFor(qe).includes(Fe)):[],dt=Array.isArray(_.activeChangeIds)&&_.activeChangeIds.length>0?_.activeChangeIds:at;N.set("selection",{token:E,value:{..._,activeMarks:fe,activeCommentIds:Re,activeChangeIds:dt},hasSettled:!0,inflightToken:U?null:oe?.inflightToken??null})},Gl=async(c=0)=>{const h=w()?.selection,y=h?.current,_=Hn();if(typeof y!="function")return N.set("selection",{token:_,value:null,hasSettled:!0,inflightToken:null}),Dt(),P.selection;let E;try{E=y.call(h,{includeText:!0}),Lr(E)&&(E=await Promise.resolve(E))}catch{E=null}return ee?oa(null,"pending"):Hn()!==_?c<1?Gl(c+1):P.selection:(N.set("selection",{token:_,value:Yi(E),hasSettled:!0,inflightToken:null}),Dt(),P.selection)},Wl=()=>{const c=w()?.comments;return Zr("comments",ft(),()=>c?.list?c.list():void 0,h=>h&&Array.isArray(h.items)?h.items:[])},xi=(c="trackChanges")=>{const h=ft(),y=w()?.trackChanges,_=T(),E=typeof _?.listTrackedChanges=="function"?_.listTrackedChanges:null,D=Zr(c,h,()=>E?nn(()=>y?.list?.({in:"all"})):y?.list?y.list({in:"all"}):void 0,U=>{const oe=U&&typeof U=="object"?U:null;if(oe?.complete===!1||oe?.sourceCoverageComplete===!1){if(Wo.set(c,h),zl(),Ai===h||Ao()==="complete"){const fe=()=>{ee||ai()};typeof queueMicrotask=="function"?queueMicrotask(fe):Promise.resolve().then(fe)}}else Wo.get(c)===h&&Wo.delete(c);return oe&&Array.isArray(oe.items)?oe.items:[]});return Wo.get(c)===h&&D.status==="ready"?{...D,status:"stale"}:D},hd=c=>{const h=z(),y=W(),_=y?null:Wl(),E=y&&Array.isArray(h?.commentItems)?h.commentItems:null,D=y?E:_.value,U=y?V(h):_.status,oe=D??[],fe=c.activeCommentIds,Re=N.get("comments"),Fe=Re?.token===ft()&&Re.hasSettled&&Array.isArray(Re.value)?Re.value:null,Pe=yo.comments>0?Fe:oe;ct&&Pe&&!Pe.some(Ze=>Vr(Ze)===ct)&&(ct=null);const Ye=ct??fe[0]??null;return{status:Pl(U,c.status),listStatus:U,items:oe,total:oe.length,activeIds:fe,activeId:Ye}},pd=new WeakMap,Ka=c=>{const h=pd.get(c);if(h)return h;const y=c.map(ad).filter(_=>_!=null);return pd.set(c,y),y},md=new WeakMap,Kl=(c,h)=>{const y=md.get(c);if(y?.suppressedIds===h)return y.value;const _=h?c.filter(E=>{const D=Vr(E);return!D||!h.has(D)}):c;return md.set(c,{suppressedIds:h,value:_}),_},Hc=new WeakMap,ql=c=>{const h=Hc.get(c);if(h)return h;const y=new Set;for(const E of c){const D=ld(E),U=E,oe=D.author??D.authorEmail??U.author??U.authorEmail;typeof oe=="string"&&y.add(oe)}const _=[...y];return Hc.set(c,_),_},Qr=()=>{const c=ft();if(W()){const _=N.get("trackChanges"),E=_?.token===c&&_.hasSettled&&Array.isArray(_.value)?_.value:z()?.trackedChangeItems;return Array.isArray(E)?Ka(E):null}const{value:h,status:y}=xi("trackChanges:all");return y==="ready"?Ka(h??[]):null},$c=c=>{const h=ft(),y=on(h),_=z(),E=W(),D=E?null:xi(),U=E&&Array.isArray(_?.trackedChangeItems)?_.trackedChangeItems:null,oe=E?U:D.value,fe=E?V(_):D.status,Re=Kl(Ka(oe??[]),y),Fe=Qr(),Pe=tt;if(Pe&&!Ue.has(Pe)){const Et=N.get("trackChanges"),_n=Et?.token===h&&Et.hasSettled&&Array.isArray(Et.value)?Kl(Ka(Et.value),y):null,An=yo.trackChanges>0?_n:Pe.story?Fe:Re;An&&!An.some(kr=>ki(kr,Pe.id,Pe.story))&&F(null)}const Ye=Fe??Re,Ze=Fl(Ye,vs(c)),Ke=er===h?[]:y?c.activeChangeIds.filter(Et=>!y.has(Et)):c.activeChangeIds,We=Ke.map(Et=>Ze.toPublicId(Et)??Et),at=tt?.story?Fl(Ye,tt.story):Ks(Ye),dt=tt?at.toPublicId(tt.id)??tt.id:null,qe=RH({selectionIds:Ke,publicIds:We,selection:c,bodyItems:Re,allStoryItems:Fe}),At=dt??qe;return{status:Pl(fe,c.status),items:Re,total:Re.length,activeId:At,authors:ql(Re)}},gd=(c,h)=>{if(!W())return h;Eo("comments");const y=Wl(),_=y.value??h.items;return{status:Pl(y.status,c.status),listStatus:y.status,items:_,total:_.length,activeIds:c.activeCommentIds,activeId:ct??c.activeCommentIds[0]??null}},vd=(c,h)=>{if(!W())return h;Eo("trackChanges");const y=xi(),_=on(ft()),E=Kl(Ka(y.value??h.items),_),D=tt?.story?Fl(E,tt.story):Ks(E),U=tt?D.toPublicId(tt.id)??tt.id:h.activeId;return{status:Pl(y.status,c.status),items:E,total:E.length,activeId:U,authors:ql(E)}};let Gc=null,yd=[];const qa=(c,h)=>{const y=ft();return h==="ready"?(Gc=y,yd=c,{items:c,status:h}):h==="pending"&&Gc===y?{items:yd,status:"stale"}:{items:c,status:h}},bd=c=>{const h=w()?.contentControls,{value:y,status:_}=Zr("contentControls",ft(),()=>h?.list?h.list():void 0,Pe=>Pe&&Array.isArray(Pe.items)?Pe.items:[]),E=y??[],{items:D,status:U}=vh(h,c),oe=new Map(D.map(Pe=>[Pe.id,Pe])),fe=new Set(E.map(Pe=>Pe.id)),Re=[...E.map(Pe=>oe.get(Pe.id)??Pe),...D.filter(Pe=>!fe.has(Pe.id))],Fe=D.map(Pe=>Pe.id);return{status:Pl(_,U,c.status),items:Re,total:Re.length,activeId:Fe[0]??null,activeIds:Fe}},Ya=(c,h)=>{if(!c||typeof c.listInRange!="function")return{lockModesById:new Map,rows:[],status:"ready"};const y=LH(h);if(!y)return{lockModesById:new Map,rows:[],status:"ready"};const{value:_,status:E}=Zr(`contentControls:inRange:${Yr(h)}`,ft(),()=>c.listInRange(y),oe=>oe&&Array.isArray(oe.items)?oe.items:[]),D=_??[],U=new Map;for(const oe of D)typeof oe?.id=="string"&&U.set(oe.id,typeof oe.lockMode=="string"?oe.lockMode:"unlocked");return{lockModesById:U,rows:D,status:E}},vh=(c,h)=>{const{rows:y,status:_}=Ya(c,h),E=h.selectionTarget,D=h.target;let U=E?.start;if(E){if(E.kind!=="selection"||U?.kind!=="text"||typeof U.blockId!="string"||typeof U.offset!="number")return qa([],_)}else{const We=D?.kind==="text"&&Array.isArray(D.segments)?D.segments[0]:void 0,at=We?.range;if(typeof We?.blockId!="string"||typeof at?.start!="number")return qa([],_);U={kind:"text",blockId:We.blockId,offset:at.start,story:D?.story}}const oe=(D?.coordinateSpace!=="tracked"&&Array.isArray(D?.segments)?D.segments:[]).find(We=>We.blockId===U.blockId),fe=oe?.range,Re=oe&&typeof oe.blockId=="string"&&typeof fe?.start=="number"?{kind:"text",blockId:oe.blockId,offset:fe.start,story:D?.story??U.story}:null,Fe=(E?E.coordinateSpace:D?.coordinateSpace)==="tracked"?"tracked":"visible",Pe=Fe==="tracked"?Re:U,Ye=Dr(h),Ze=Ye.indexOf((Pe??U).blockId),Ke=y.map((We,at)=>({item:We,index:at})).filter(({item:We})=>{const at=We.selectionTarget,dt=at?.coordinateSpace==="tracked"?"tracked":"visible";if(dt==="tracked"&&Fe!=="tracked")return!1;const qe=dt==="tracked"?U:Pe;if(!qe)return!1;const At=at?.start,Et=at?.end;if(at?.kind!=="selection"||At?.kind!=="text"||Et?.kind!=="text"||typeof At.blockId!="string"||typeof Et.blockId!="string"||typeof At.offset!="number"||typeof Et.offset!="number"||Jn(at.story??At.story??Et.story)!==Jn(E?.story??qe.story))return!1;if(At.blockId===Et.blockId){if(qe.blockId!==At.blockId)return!1;const kr=Math.min(At.offset,Et.offset),Er=Math.max(At.offset,Et.offset);return kr===Er?qe.offset===kr:qe.offset>=kr&&qe.offset<Er}if(qe.blockId===At.blockId)return qe.offset>=At.offset;if(qe.blockId===Et.blockId)return qe.offset<Et.offset;if(Ze===-1)return!1;const _n=Ye.indexOf(At.blockId),An=Ye.indexOf(Et.blockId);return _n!==-1&&An!==-1?Ze>Math.min(_n,An)&&Ze<Math.max(_n,An):_n!==-1?Ze>_n:An!==-1?Ze<An:!0}).sort((We,at)=>{const dt=We.item.selectionTarget,qe=at.item.selectionTarget,At=dt.start.kind==="text"&&dt.end.kind==="text"&&dt.start.blockId===dt.end.blockId,Et=qe.start.kind==="text"&&qe.end.kind==="text"&&qe.start.blockId===qe.end.blockId;if(At!==Et)return At?-1:1;if(We.item.kind!==at.item.kind)return We.item.kind==="inline"?-1:1;if(At&&Et&&dt.start.kind==="text"&&dt.end.kind==="text"&&qe.start.kind==="text"&&qe.end.kind==="text"){const _n=Math.abs(dt.end.offset-dt.start.offset),An=Math.abs(qe.end.offset-qe.start.offset);if(_n!==An)return _n-An}return at.index-We.index}).map(({item:We})=>We);return qa(Ke,_)},wd=()=>{const c=t?.fonts;return{options:a$(i$(Ot(c?.getDocumentFontOptions?()=>c.getDocumentFontOptions():void 0,[])),s$(Ot(c?.getFontFamilyOptions?()=>c.getFontFamilyOptions():void 0,[]))),sizeOptions:l$}},Cd=()=>{const c=Ot(t?.getZoomState?()=>t.getZoomState():void 0,null),h=typeof c?.value=="number"?c.value:100,y=c?.mode;return{mode:y==="manual"||y==="fit-width"?y:y==="fixed"?"manual":null,value:h,min:typeof c?.min=="number"?c.min:10,max:typeof c?.max=="number"?c.max:100}},kd=()=>Ot(t?.getMeasurementUnit?()=>t.getMeasurementUnit():void 0,"in")==="cm"?"cm":"in",Wc=()=>{const c=S(),h=c?c.isDirty:void 0;return{ready:c!=null,mode:$n(),dirty:c?h===void 0?Pt():!!h:!1}},Kc=c=>{const h=c.quotedText;if(typeof h!="string"||h.length===0)return null;const y=sd(c);if(y.length===0||!Pc(y.map(D=>D.blockId)))return null;const _=c.target,E=y.length===1?_o(y[0].blockId,_?.story):void 0;return{select:{type:"text",pattern:h,mode:"contains",caseSensitive:!0},...E?{within:E}:{},require:"any"}},yh=c=>{const h=w()?.query;if(typeof h?.match!="function")return null;const y=Kc(c);if(!y)return null;const{value:_}=Zr(`query:${Yr(c)}`,ft(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return GI(_,c)},qc=c=>{const h=j(),y=new Set(Dr(c));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const D=Ot(()=>{if(typeof _!="function")return E.call(h);const We=ys(c);return We?_.call(h,[...y],We):_.call(h,[...y])},null);if(!Array.isArray(D))return{};const U=p2(D),oe=We=>{const at={},dt=f2(We.fontFamily);dt&&(at.fontFamily=dt);const qe=HH(We.fontSize);return qe&&(at.fontSize=qe),typeof We.color=="string"&&We.color.trim()!==""&&(at.color=We.color.trim().toUpperCase()),typeof We.highlight=="string"&&We.highlight.trim()!==""&&(at.highlight=We.highlight.trim().toUpperCase()),at},fe=Ys(c),Re=fe&&typeof fe.range?.start=="number"?fe.range.start:null;if(fe&&Re!==null&&y.has(fe.blockId)){const We=U.find(dt=>Fc(dt,fe.blockId)),at=We&&Array.isArray(We.runs)?We.runs:null;if(at&&at.length>0&&at.every(dt=>dt?.kind==="text"||dt?.kind==="tab")){let dt=0,qe=null;for(const At of at){const Et=rg(At);if(Re>=dt&&Re<dt+Et){qe=At;break}dt+=Et}if(!qe){for(let At=at.length-1;At>=0&&!qe;At-=1)at[At]?.kind==="text"&&(qe=at[At]);qe??=at[at.length-1]??null}return qe?oe(qe):{}}}const Fe=sd(c);if(Fe.length>0){const We=new Set,at=new Set;let dt=!1,qe=!0;for(const At of Fe){const Et=U.find(kr=>Fc(kr,At.blockId));if(!Et)return{};const _n=Array.isArray(Et.runs)?Et.runs:[];if(_n.length===0)continue;if(!_n.every(kr=>kr?.kind==="text"||kr?.kind==="tab")){qe=!1;break}let An=0;for(const kr of _n){const Er=rg(kr),Tr=An,Pr=An+Er;if(Tr<At.end&&Pr>At.start){dt=!0;const ei=oe(kr);ei.fontFamily&&We.add(ei.fontFamily),ei.fontSize&&at.add(ei.fontSize)}An=Pr}}if(qe&&dt){const At={};return We.size===1&&(At.fontFamily=[...We][0]),at.size===1&&(At.fontSize=[...at][0]),At}}const Pe=new Set,Ye=new Set;let Ze=!1;for(const We of U){if(![...y].some(dt=>Fc(We,dt)))continue;const at=Array.isArray(We.runs)?We.runs:[];for(const dt of at){if(dt?.kind!=="text")continue;Ze=!0;const qe=oe(dt);qe.fontFamily&&Pe.add(qe.fontFamily),qe.fontSize&&Ye.add(qe.fontSize)}}if(!Ze)return{};const Ke={};return Pe.size===1&&(Ke.fontFamily=[...Pe][0]),Ye.size===1&&(Ke.fontSize=[...Ye][0]),Ke},qo=c=>{const h=j(),y=new Set(Dr(c));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const D=Ot(()=>{if(typeof _!="function")return E.call(h);const Ke=ys(c);return Ke?_.call(h,[...y],Ke):_.call(h,[...y])},null);if(!Array.isArray(D))return{};const U=p2(D),oe=Ke=>({bold:Ke.bold===!0,italic:Ke.italic===!0,underline:Ke.underline!=null,strikethrough:Ke.strike===!0}),fe=Ke=>{const We={};for(const at of ph){const dt=Ke[at];dt.size===1&&(We[at]=[...dt][0])}return We},Re=Ys(c),Fe=Re&&typeof Re.range?.start=="number"?Re.range.start:null;if(Re&&Fe!==null&&y.has(Re.blockId)){const Ke=U.find(at=>Fc(at,Re.blockId)),We=Ke&&Array.isArray(Ke.runs)?Ke.runs:null;if(We&&We.length>0&&We.every(at=>at?.kind==="text"||at?.kind==="tab")){let at=0,dt=null;for(const qe of We){const At=rg(qe);if(Fe>=at&&Fe<at+At){dt=qe;break}at+=At}if(!dt){for(let qe=We.length-1;qe>=0&&!dt;qe-=1)We[qe]?.kind==="text"&&(dt=We[qe]);dt??=We[We.length-1]??null}return dt?oe(dt):{}}}const Pe=sd(c);if(Pe.length>0){const Ke={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let We=!1,at=!0;for(const dt of Pe){const qe=U.find(_n=>Fc(_n,dt.blockId));if(!qe)return{};const At=Array.isArray(qe.runs)?qe.runs:[];if(At.length===0)continue;if(!At.every(_n=>_n?.kind==="text"||_n?.kind==="tab")){at=!1;break}let Et=0;for(const _n of At){const An=rg(_n),kr=Et,Er=Et+An;if(kr<dt.end&&Er>dt.start){We=!0;const Tr=oe(_n);for(const Pr of ph)Ke[Pr].add(Tr[Pr])}Et=Er}}if(at&&We)return fe(Ke)}const Ye={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Ze=!1;for(const Ke of U){if(![...y].some(at=>Fc(Ke,at)))continue;const We=Array.isArray(Ke.runs)?Ke.runs:[];for(const at of We){if(at?.kind!=="text")continue;Ze=!0;const dt=oe(at);for(const qe of ph)Ye[qe].add(dt[qe])}}return Ze?fe(Ye):{}},Yc=(c,h)=>{if(h.fontFamily!==void 0&&h.fontSize!==void 0&&h.color!==void 0&&h.highlight!==void 0)return{values:h,effectiveUniformityStatus:"ready"};const y=qc(c),_={...y.fontFamily!==void 0?{fontFamily:y.fontFamily}:{},...y.fontSize!==void 0?{fontSize:y.fontSize}:{},...y.color!==void 0?{color:y.color}:{},...y.highlight!==void 0?{highlight:y.highlight}:{},...h};if(!c.empty&&(_.fontFamily===void 0||_.fontSize===void 0)){const E=bh(c);return E.values&&(_.fontFamily===void 0&&E.values.fontFamily!==void 0&&(_.fontFamily=E.values.fontFamily),_.fontSize===void 0&&E.values.fontSize!==void 0&&(_.fontSize=E.values.fontSize)),{values:_,effectiveUniformityStatus:E.status}}return{values:_,effectiveUniformityStatus:"ready"}},Xc=["fontFamily","fontSize","bold","italic","underline","strikethrough"],Zc=c=>{const h=c.selectionTarget;if(!h)return{value:null,status:"ready"};const y=vr(w(),"format.readEffectiveInlineUniformity");if(!y)return{value:null,status:"ready"};const _=$I(c)??Yr(c);return Zr(`effInline:${_}`,ft(),()=>y({target:h,offsetSpace:"selection",keys:Xc}),E=>E&&typeof E=="object"?E:null)},bh=c=>{const{value:h,status:y}=Zc(c);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E=D=>{const U=_?.[D];if(!(!U||U.state!=="uniform"||typeof U.value!="string"))return D==="fontFamily"?f2(U.value):U.value};return{values:{fontFamily:E("fontFamily"),fontSize:E("fontSize")},status:y}},Yl=c=>{const{value:h,status:y}=Zc(c);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E={};for(const D of ph){const U=_?.[D];U?.state==="uniform"&&(U.value==="true"||U.value==="false")&&(E[D]=U.value==="true")}return{values:E,status:y}},wh=(c,h)=>{const y=c.activeMark;if(!y||!ph.includes(y))return null;const _=y,E=qo(h)[_];if(E!==void 0)return E;const{values:D}=Yl(h),U=D?.[_];return U!==void 0?U:null},Ch=async c=>{const h=c.selectionTarget;if(!h)return null;const y=vr(w(),"format.readEffectiveInlineUniformity");if(!y)return null;try{const _=await Promise.resolve(y({target:h,offsetSpace:"selection"}));return _&&typeof _=="object"&&_.success===!0?_:null}catch{return null}},kh=(c,h,y)=>{const _=y.values;for(const E of["fontFamily","fontSize"]){if(h[E]!==void 0)continue;const D=_?.[E];D?.state==="uniform"&&typeof D.value=="string"?c[E]=E==="fontFamily"?f2(D.value):D.value:delete c[E]}},Qc=c=>Yc(c,WI(yh(c),c)),Xa=c=>Qc(c).values,Jc=async c=>{const h=w()?.query,y=Kc(c);if(typeof h?.match!="function"||!y)return Xa(c);try{const _=await Promise.resolve(h.match(y)),E=WI(GI(_&&typeof _=="object"?_:null,c),c),D=Yc(c,E);if(D.effectiveUniformityStatus!=="ready"&&(E.fontFamily===void 0||E.fontSize===void 0)){const U=await Ch(c);U&&kh(D.values,E,U)}return D.values}catch{return Xa(c)}},ui=async c=>{const h=w();if(h)return typeof h.getNode=="function"?await Promise.resolve(h.getNode(c)):await Promise.resolve(h.getNodeById?.({nodeId:c.nodeId,nodeType:c.nodeType}))},sa=c=>{const h=w()?.query;if(typeof h?.match!="function")return"ready";const y=Kc(c);if(!y)return"ready";const{status:_}=Zr(`query:${Yr(c)}`,ft(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return _},Sh=c=>{const h=Qc(c),y=h.values;if(c.empty)return h;const _=Ha(c);return _?c.status==="ready"&&sa(c)==="ready"&&h.effectiveUniformityStatus==="ready"?(b={key:_,values:y},h):b&&b.key===_?{...h,values:{...b.values,...y}}:h:h},_h=c=>{const h=w(),y=Sh(c),_=y.values;c.status==="ready"&&!c.empty&&sa(c)==="ready"&&y.effectiveUniformityStatus==="ready"&&(v=_,k=`${Dc(c)}:${ft()}`);const E=h?.contentControls,{lockModesById:D}=Ya(E,c),U={};for(const oe of di())U[oe]=aa(oe,h,c,_,D);return U},Cs=c=>c?lt.operationUnavailable:S()?lt.documentApiUnavailable:lt.notReady,Sd=c=>c==="contentLocked"||c==="sdtContentLocked",ks=c=>{for(const h of c.values())if(Sd(h))return lt.contentControlLocked},Xl=(c,h,y,_,E)=>{if(!h)return c.scope==="all"?lt.bulkDecisionsDisabled:Cs(E);if(y)return y;if(c.scope!=="all"&&_.activeChangeIds.length===0)return lt.selectionRequired},Xi=c=>{Bc();let h;if(W()){const E=Qr()?.find(U=>Vr(U)===c);if(E)return ld(E);const D=N.get("trackChanges");h=D?.hasSettled&&Array.isArray(D.value)?D.value:null}else h=xi("trackChanges:all").value;const y=h?.find(E=>Vr(E)===c),_=ad(y);return _?ld(_):null},io=(c,h)=>{const y=t.canPerformPermission;if(typeof y!="function"||h.length===0)return;const _=t.config&&typeof t.config=="object"?t.config.user:null;for(const E of h){const D=Xi(E)??{id:E},U=AH(D,_),oe=c==="accept"?U?"RESOLVE_OWN":"RESOLVE_OTHER":U?"REJECT_OWN":"REJECT_OTHER";let fe;try{fe=y.call(t,{permission:oe,trackedChange:D,comment:null})}catch{return}if(fe===!1)return lt.permissionDenied}},Ah=c=>{const h=j(),y=Ot(typeof h?.getCapabilities=="function"?()=>h.getCapabilities():void 0,null)?.editableSubset?.commands;if(Array.isArray(y))return y.find(_=>_?.command===c||_?.id===c)??null;if(y&&typeof y=="object"){const _=y[c];return _&&typeof _=="object"?_:null}return null},Zl=(c,h)=>{if(c.scope!=="all"||typeof h?.[`${c.kind}All`]=="function")return;const y=Ah(`trackedChanges.${c.kind}All`);if(!(y&&(y.status==="supported"||y.enabled===!0)))return lt.bulkDecisionsDisabled},aa=(c,h,y,_,E=new Map)=>{if(Je.has(c))return tn({supported:!0,enabled:!0,...Ot(Je.get(c).getState?()=>Je.get(c).getState(ra(void 0)):void 0,{})},"custom");const D=$n()==="viewing",U=OI(c);if(U&&typeof Y()?.lists?.apply=="function"){const Ze=ue(),Ke=typeof Ze?.shippedStatus=="string"?Ze.shippedStatus:null,We=Ke!=="not-shipped"&&Ke!=="disabled",at=We&&(typeof Ze?.enabled=="boolean"?Ze.enabled:!0),dt=We?ve(Ze):null;return tn(D?{enabled:!1,active:dt===U,supported:We,value:Ze?.value,reason:lt.documentReadonly}:{enabled:at,active:dt===U,supported:We,value:Ze?.value},"builtin")}const oe=og(c);if(oe){const Ze=h?.trackChanges,Ke=typeof Ze?.decide=="function"||typeof Ze?.[oe.kind]=="function",We=typeof Ze?.decide=="function"||typeof Ze?.[`${oe.kind}All`]=="function",at=oe.scope==="all"?We:Ke,dt=Zl(oe,Ze)??Xl(oe,at,jc(),y,h)??(oe.scope==="all"?void 0:io(oe.kind,y.activeChangeIds));return tn({enabled:dt==null,active:!1,supported:at,reason:dt},"builtin")}if(c==="copy-format")return $n()==="viewing"?tn({supported:!0,enabled:!1,active:!1},"builtin"):S()?tn({supported:!0,enabled:!0,active:p.mode!=="idle"},"builtin"):tn({supported:!0,enabled:!1,active:!1,reason:lt.notReady},"builtin");const fe=td(c);if(!fe)return tn({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(fe.disposition!=="routed")return tn({enabled:!1,active:!1,supported:!1,reason:fe.reason??lt.commandUnsupported},fe.disposition==="unsupported"?"unsupported":"builtin");if(fe.instanceRoute)return hn(fe);if(fe.table)return Jr(fe,h,D);if(fe.inline?.kind==="clear"){if(fe.mutates&&D)return tn({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const Ze=ks(E);if(Ze)return tn({enabled:!1,active:!1,supported:!0,reason:Ze},"builtin");const Ke=Dr(y).length>0||cd(y)!=null;return tn({enabled:Ke,active:!1,supported:!0,reason:Ke?void 0:lt.selectionRequired},"builtin")}const Re=fe.docRoute;if(!Re)return tn({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(vr(h,Re)==null)return tn({enabled:!1,active:!1,supported:!1,reason:Cs(h)},"builtin");const Fe=ge(c);if(Fe){const Ze=Fe.shippedStatus,Ke=Ze!=="not-shipped"&&Ze!=="disabled",We=typeof Fe.enabled=="boolean"?Fe.enabled:!0,at=c==="undo"||c==="redo",dt=at&&Fe.historyResolved===!1,qe=at&&Ke&&We===!1&&Fe.reason===null&&!dt,At=Fe.reason===void 0?void 0:qe?lt.historyEmpty:dt?lt.notReady:eg(Fe.reason,lt.commandUnsupported);return fe.mutates&&D?tn({enabled:!1,active:!1,supported:Ke,reason:lt.documentReadonly},"builtin"):tn({enabled:Ke&&We,active:!1,supported:Ke,reason:At},"builtin")}const Pe=Za(fe,h,y),Ye=A(fe,h,y,_);if(fe.list?.mode==="indent"||fe.list?.mode==="outdent")return hr(fe,h,D,y,Pe,Ye);if(fe.list?.mode==="toggle-seed")return Yt(fe,h,D,y,Pe,Ye);if(fe.mutates&&D)return tn({enabled:!1,active:Pe,supported:!0,value:Ye,reason:lt.documentReadonly},"builtin");if(fe.inline&&!cd(y)){const Ze=ks(E);return tn(Ze?{enabled:!1,active:Pe,supported:!0,value:Ye,reason:Ze}:Dr(y).length>0&&typeof j()?.setPendingInlineFormat=="function"?{enabled:!0,active:Pe,supported:!0,value:Ye}:{enabled:!1,active:Pe,supported:!0,value:Ye,reason:lt.rangeSelectionRequired},"builtin")}if((fe.blockParagraph||fe.list)&&Dr(y).length===0)return tn({enabled:!1,active:Pe,supported:!0,value:Ye,reason:lt.selectionRequired},"builtin");if(fe.link&&!Pe&&u2(y).length===0&&!Ys(y))return tn({enabled:!1,active:Pe,supported:!0,reason:lt.rangeSelectionRequired},"builtin");if(fe.inline){const Ze=ks(E);if(Ze)return tn({enabled:!1,active:Pe,supported:!0,value:Ye,reason:Ze},"builtin")}return tn({enabled:!0,active:Pe,supported:!0,value:Ye},"builtin")};function _d(c,h){const y=c.address?.anchor,_=y?.start,E=y?.end,D=typeof _?.blockId=="string"?_.blockId:null,U=typeof E?.blockId=="string"?E.blockId:null;if(!D||!U)return!1;const oe=typeof _?.offset=="number"?_.offset:null,fe=typeof E?.offset=="number"?E.offset:null;if(oe==null||fe==null)return!1;const Re=h.target,Fe=Re&&Array.isArray(Re.segments)?Re.segments:[];for(const Pe of Fe){const Ye=typeof Pe?.blockId=="string"?Pe.blockId:null;if(!Ye)continue;const Ze=Pe.range,Ke=typeof Ze?.start=="number"?Ze.start:null,We=typeof Ze?.end=="number"?Ze.end:null;if(!(Ke==null||We==null)){if(D!==U){if(Ye===D&&We>oe||Ye===U&&Ke<fe)return!0;continue}if(Ye===D){if(Ke===We){if(Ke>=oe&&Ke<=fe)return!0;continue}if(Math.max(Ke,oe)<Math.min(We,fe))return!0}}}return!1}const Zi=(c,h)=>{const y=c?.hyperlinks;if(!y||typeof y.list!="function")return null;const _=Dr(h);if(!Pc(_))return null;for(const E of _){const D={kind:"block",nodeType:"paragraph",nodeId:E},{value:U}=Zr(`hyperlinks:${E}`,ft(),()=>y.list({within:D}),fe=>fe&&typeof fe=="object"?fe:null),oe=(U&&Array.isArray(U.items)?U.items:[]).find(fe=>_d(fe,h));if(oe)return oe}return null},Za=(c,h,y)=>{if(c.link)return Zi(h,y)!=null;if(c.list?.mode==="toggle-seed"&&c.list.seed)return he(h,y)===c.list.seed;const _=K(c);if(_!==null)return _;const E=r.get(c.id),D=Ha(y);if(D&&E?.selectionSignature===D)return E.active;const U=wh(c,y);return U!==null?U:c$(c,y)},A=(c,h,y,_)=>{if(c.inline&&d2(c.inline.key)){const E=x(c);if(E!==void 0)return E;const D=_[c.inline.key];if(D!==void 0)return D;const U=Ha(y),oe=U?n.get(c.inline.key):void 0;if(U&&oe?.selectionSignature===U)return oe.value}if(c.id==="linked-style"){const{style:E}=Mi(y,Qa().cache);return!E.styleId||E.mixed?void 0:{styleId:E.styleId,styleName:E.styleName}}if(c.id==="text-align")return st(h,y);if(c.id==="link")return Pn(h,y)??void 0},M=(c,h,y)=>{const _=c?.lists;if(!_)return{value:null,status:"ready"};const E=y.storyType==="body",D=typeof _.getStateInStory=="function"?()=>_.getStateInStory({target:Ua(h),story:y}):E&&typeof _.getState=="function"?()=>_.getState({target:Ua(h)}):null;if(!D)return{value:null,status:"ready"};const{value:U,status:oe}=Zr(`lists:${Jn(y)}:${h}`,ft(),D,fe=>fe&&typeof fe=="object"?fe:null);return{value:U?.success===!0?U:null,status:oe}},X=(c,h,y)=>M(c,h,y).value,te=(c,h,y)=>{const _=X(c,h,y);return!_||_.isListItem!==!0?null:_.seed==="bullet"||_.seed==="ordered"?_.seed:null},ne=(c,h,y)=>{const _=M(c,h,y),E=_.value;return{value:E&&typeof E.isListItem=="boolean"?E.isListItem:null,status:_.status}},he=(c,h)=>{const y=Dr(h);if(y.length===0||!Pc(y))return null;const _=vs(h),E=te(c,y[0],_);if(E!=="bullet"&&E!=="ordered")return null;for(const D of y.slice(1))if(te(c,D,_)!==E)return null;return E},ce=(c,h,y)=>{if(!c)return{value:null,status:"ready",refreshing:!1};const _=Jn(y),E=_==="story:body";if(E&&typeof c.getNodeById!="function")return{value:null,status:"ready",refreshing:!1};if(!E&&typeof c.getNode!="function")return{value:null,status:"ready",refreshing:!1};const D=`node:${_}:${h}`,U=ft(),oe=Zr(D,U,()=>E?c.getNodeById({nodeId:h,nodeType:"paragraph"}):c.getNode(_o(h,y)),Re=>Re&&typeof Re=="object"?Re:null),fe=N.get(D);return{...oe,refreshing:oe.status==="stale"&&fe?.inflightToken===U&&fe.failedToken!==U}},le=c=>c==="left"||c==="center"||c==="right"||c==="justify"?c:void 0,we=c=>c==="start"||c==="end"||c==="distributed"||c==="numTab"||c==="lowKashida"||c==="mediumKashida"||c==="highKashida"||c==="thaiDistribute",xe=(c,h)=>{const y=j(),_=y?.readMountedProjectionBlocksByIds;if(typeof _!="function")return null;const E=ys(c),D=Ot(()=>E?_.call(y,[...h],E):_.call(y,[...h]),null);if(!Array.isArray(D))return new Map;const U=p2(D),oe=new Map;for(const fe of h){const Re=U.find(Ze=>Fc(Ze,fe));if(!Re)continue;const Fe=Re.attrs,Pe=le(Fe?.alignment),Ye=M9(Fe);oe.set(fe,Pe??(Ye==="rtl"?"right":"left"))}return oe},Ve=(c,h,y,_)=>{const{value:E,status:D,refreshing:U}=ce(c,h,y),oe=_?.get(h);if(D==="pending")return oe?{status:"uniform",value:oe}:{status:"pending"};if(D==="stale"&&!U)return{status:"pending"};if(D==="stale"&&oe)return{status:"uniform",value:oe};if(D==="stale"&&_&&!oe)return{status:"unavailable"};if(!E)return{status:"unavailable"};const fe=E.node;if(!fe)return{status:"unavailable"};const Re=fe.kind;if(Re!=="paragraph"&&Re!=="heading")return{status:"unavailable"};const Fe=fe[Re];if(!Fe||typeof Fe!="object")return{status:"unavailable"};const Pe=Fe.props?.alignment;if(Pe==null)return oe?{status:"uniform",value:oe}:{status:"unavailable"};const Ye=le(Pe);return Ye?{status:"uniform",value:Ye}:we(Pe)&&oe?{status:"uniform",value:oe}:{status:"unavailable"}},Me=(c,h)=>{const y=Dr(h);if(y.length===0||!Pc(y))return{status:"unavailable"};const _=vs(h),E=xe(h,y),D=Ve(c,y[0],_,E);if(D.status!=="uniform")return D;for(const U of y.slice(1)){const oe=Ve(c,U,_,E);if(oe.status!=="uniform")return oe;if(oe.value!==D.value)return{status:"mixed"}}return D},Ge=c=>{const h=Dr(c);return h.length===0?null:`${Jn(vs(c))}:${h.join(",")}`},st=(c,h)=>{const y=Me(c,h),_=y.status==="uniform"?y.value:void 0,E=o;if(!E)return _;const D=Ge(h);return D&&D!==E.selectionSignature?(o=null,_):!D||!E.settled?E.value:y.status!=="pending"?(o=null,_):E.value},ot=(c,h)=>{const y=le(h),_=Ge(c),E=Dr(c);if(!y||!_||E.length===0)return null;const D=++i;return o={selectionSignature:_,value:y,generation:D,settled:!1,canReconcile:Pc(E)},Dt(),D},bt=(c,h)=>{if(c==null)return;const y=o;if(!(!y||y.generation!==c)){if(!mo(h)){o=null;return}if(!y.canReconcile){o=null;return}y.settled=!0}},pt=async(c,h,y)=>{const _=c?.lists;if(!_)return null;try{const E=y.storyType==="body",D=typeof _.getStateInStory=="function"?await _.getStateInStory({target:Ua(h),story:y}):E&&typeof _.getState=="function"?await _.getState({target:Ua(h)}):null,U=D&&typeof D=="object"?D:null;return!U||U.success!==!0||typeof U.isListItem!="boolean"?null:U.isListItem}catch{return null}},qt=(c,h,y)=>{const _={resolved:!1,seed:null},E=c?.lists;if(!E)return _;const D=y.storyType==="body",U=typeof E.getStateInStory=="function"?()=>E.getStateInStory({target:Ua(h),story:y}):D&&typeof E.getState=="function"?()=>E.getState({target:Ua(h)}):null;if(!U)return _;const oe=fe=>{const Re=fe&&typeof fe=="object"?fe:null;return!Re||Re.success!==!0||typeof Re.isListItem!="boolean"?_:{resolved:!0,seed:Re.isListItem===!0&&(Re.seed==="bullet"||Re.seed==="ordered")?Re.seed:null}};try{const fe=U();return Lr(fe)?Promise.resolve(fe).then(oe,()=>_):oe(fe)}catch{return _}},Cn=async(c,h,y)=>{if(!c)return null;try{const _=!y||y.storyType==="body",E=y&&typeof c.getNode=="function"?await c.getNode(_o(h,y)):_&&typeof c.getNodeById=="function"?await c.getNodeById({nodeId:h,nodeType:"paragraph"}):null;return OH(E&&typeof E=="object"?E:null)}catch{return null}},hr=(c,h,y,_,E,D)=>{if(c.mutates&&y)return tn({enabled:!1,active:E,supported:!0,value:D,reason:lt.documentReadonly},"builtin");const U=Dr(_);if(U.length===0)return tn({enabled:!1,active:E,supported:!0,value:D,reason:lt.selectionRequired},"builtin");const oe=c.docRoute?vr(h,c.docRoute):null,fe=vr(h,"format.paragraph.setIndentation"),Re=vr(h,"format.paragraph.clearIndentation"),Fe=c.list?.mode,Pe=Fe==="indent"?fe!=null:fe!=null||Re!=null,Ye=vs(_);let Ze=null;if(Ye.storyType!=="body"){Ze=[];for(const Ke of U){const{value:We,status:at}=ne(h,Ke,Ye);if(We===null)return at!=="ready"&&(oe!=null||Pe)?tn({enabled:!0,active:E,supported:!0,value:D},"builtin"):tn({enabled:!1,active:E,supported:!1,value:D,reason:Cs(h)},"builtin");Ze.push(We)}}if(Ze?.some(Ke=>Ke===!0)){const Ke=Fe==="indent"?"lists.indentRange":"lists.outdentRange",We=$n()!=="suggesting"&&Ze.every(dt=>dt===!0)&&vr(h,Ke)!=null,at=Fe==="outdent"&&vr(h,"lists.outdentInStory")!=null;if(!We&&!at)return tn({enabled:!1,active:E,supported:!1,value:D,reason:Cs(h)},"builtin")}for(const[Ke,We]of U.entries()){const at=Ze?{value:Ze[Ke]??null,status:"ready"}:ne(h,We,Ye),dt=at.value;if(dt===!0){if(oe!=null)return tn({enabled:!0,active:E,supported:!0,value:D},"builtin");continue}if(dt===!1&&Pe){if(Ye.storyType!=="body"&&typeof h?.getNode!="function")continue;return tn({enabled:!0,active:E,supported:!0,value:D},"builtin")}if(dt===null)return at.status!=="ready"&&(oe!=null||Pe)?tn({enabled:!0,active:E,supported:!0,value:D},"builtin"):tn({enabled:!1,active:E,supported:!1,value:D,reason:Cs(h)},"builtin")}return tn({enabled:!1,active:E,supported:!1,value:D,reason:Cs(h)},"builtin")},Yt=(c,h,y,_,E,D)=>{if(c.mutates&&y)return tn({enabled:!1,active:E,supported:!0,value:D,reason:lt.documentReadonly},"builtin");const U=Dr(_);if(U.length===0)return tn({enabled:!1,active:E,supported:!0,value:D,reason:lt.selectionRequired},"builtin");const oe=vs(_),fe=h?.lists;if(!(typeof fe?.getStateInStory=="function"||oe.storyType==="body"&&typeof fe?.getState=="function"))return tn({enabled:!1,active:E,supported:!1,value:D,reason:lt.operationUnavailable},"builtin");if(!Pc(U))return tn(oe.storyType==="body"&&vr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:D}:{enabled:!1,active:E,supported:!1,value:D,reason:lt.operationUnavailable},"builtin");const Re=U.map(Ze=>M(h,Ze,oe));if(Re.some(({status:Ze})=>Ze!=="ready"))return tn({enabled:!0,active:E,supported:!0,value:D},"builtin");if(Re.some(({value:Ze})=>Ze===null))return tn({enabled:!1,active:E,supported:!1,value:D,reason:lt.operationUnavailable},"builtin");const Fe=c.list?.seed,Pe=Re.every(({value:Ze})=>Ze?.isListItem===!0&&Ze.seed===Fe);if(oe.storyType==="body")return tn(!Pe||vr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:D}:{enabled:!1,active:E,supported:!1,value:D,reason:lt.operationUnavailable},"builtin");const Ye=vr(h,"lists.removeInStory");return tn(Pe&&Ye?{enabled:!0,active:E,supported:!0,value:D}:{enabled:!1,active:E,supported:!1,value:D,reason:lt.operationUnavailable},"builtin")},Pn=(c,h)=>{const y=Zi(c,h)?.properties?.href;return typeof y=="string"?y:null},hn=c=>{if(!S())return tn({enabled:!1,active:!1,supported:!1,reason:lt.notReady},"builtin");const h=c.instanceRoute;return typeof t?.[h]!="function"?tn({enabled:!1,active:!1,supported:!1,reason:lt.operationUnavailable},"builtin"):tn({enabled:!0,active:tr(c),supported:!0,value:Or(c)},"builtin")},tr=c=>{const h=t?.config??void 0;return c.valueFrom==="ruler"?!!h?.rulers:c.valueFrom==="formattingMarks"?!!h?.layoutEngineOptions?.showFormattingMarks:!1},Jr=(c,h,y)=>{if(y)return tn({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const _=Ne();return _!=null&&(!c.table.requiresCell||_.cellNodeId!=null)?(c.docRoute?vr(h,c.docRoute):null)==null?tn({enabled:!1,active:!1,supported:!1,reason:Cs(h)},"builtin"):tn({enabled:!0,active:!1,supported:!0},"builtin"):tn({enabled:!1,active:!1,supported:!0,reason:lt.tableContextUnavailable},"builtin")},Or=c=>{if(c.valueFrom==="zoom")return Cd().value;if(c.valueFrom==="documentMode")return $n();if(c.valueFrom==="measurementUnit")return kd();if(c.valueFrom==="ruler"||c.valueFrom==="formattingMarks")return tr(c)},Qi=(c,h)=>c.id==="zoom"?typeof h=="number"&&Number.isFinite(h)&&h>0:c.id==="document-mode"?h==="editing"||h==="suggesting"||h==="viewing":c.id==="measurement-unit"?h==="in"||h==="cm":!0,di=()=>[...new Set([...yj,...Je.keys()])],ut="Normal",kn={ready:!1,status:"ready",catalogRevision:null,quickGallery:[],activeParagraphStyleId:null,activeParagraphStyleName:null,mixedSelection:!1,sourceStatus:null,diagnostics:[]},Cr=c=>`styles:catalog:${JSON.stringify(c??{})}`,Ri=c=>{const h=w()?.styles;return!h||typeof h.getCatalog!="function"?{value:null,status:"ready"}:Zr(Cr(c),ft(),()=>h.getCatalog(c),y=>y&&typeof y=="object"?y:null)},Qa=()=>{const c=Ri({includePreview:!0});if(!c.value)return{cache:null,status:c.status};const h=Ri({view:"quickGallery",includePreview:!0}),y=h.value?h.value.items:c.value.styles.filter(E=>E.visibility.quickGallery),_=new Map;for(const E of c.value.styles)_.set(E.id,E);return{cache:{full:c.value,quickGallery:y,byId:_},status:Pl(c.status,h.status)}},wo=(c,h,y)=>{const{value:_,status:E}=ce(c,h,y);if(!_)return{ok:!1,styleRef:null,status:E};const D=_.node;if(!D||typeof D!="object")return{ok:!1,styleRef:null,status:E};const U=D.kind,oe=typeof U=="string"?D[U]:void 0,fe=oe&&typeof oe=="object"?oe.styleRef:void 0;return{ok:!0,styleRef:typeof fe=="string"&&fe.length>0?fe:null,status:E}},Mi=(c,h)=>{const y=[],_=w();if(!_)return y.push({severity:"warning",code:"active-style-unavailable",message:"Active paragraph style is unavailable: the Document API is not reachable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};const E=Dr(c);if(E.length===0)return y.push({severity:"info",code:"active-style-no-selection",message:"No paragraph block is resolvable from the current selection; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};if(!Pc(E))return y.push({severity:"info",code:"active-style-selection-too-large",message:"Active paragraph style is unavailable for a large multi-paragraph selection."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};const D=h?.full.defaults.paragraphStyleId??(h?ut:null),U=new Set;let oe=0,fe=0,Re=0,Fe="ready";const Pe=vs(c);for(const Ke of E){const We=wo(_,Ke,Pe);if(Fe=Pl(Fe,We.status),!We.ok){fe+=1;continue}if(!We.styleRef&&!D){Re+=1;continue}const at=We.styleRef??D;if(!at){Re+=1;continue}oe+=1,U.add(at)}if(oe===0){const Ke=Re>0&&fe===0;return y.push({severity:"warning",code:Ke?"active-style-default-unavailable":"active-style-read-failed",message:Ke?"Selected paragraphs have no explicit style and the style catalogue is unavailable, so the document default cannot be resolved.":"Could not read the paragraph style of any selected block; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:Fe}}const Ye=fe+Re;if(Ye>0)return y.push({severity:"warning",code:"active-style-partial",message:`Active paragraph style resolved from ${oe} of ${oe+Ye} selected blocks; ${Ye} could not be read, so the active style is unavailable.`}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:Fe};if(U.size>1)return{style:{styleId:null,styleName:null,mixed:!0,diagnostics:y},status:Fe};const Ze=[...U][0];return{style:{styleId:Ze,styleName:h?.byId.get(Ze)?.name??null,mixed:!1,diagnostics:y},status:Fe}},Ql=c=>{if(!S())return kn;const{cache:h,status:y}=Qa(),{style:_,status:E}=Mi(c,h);let D;return h?D=_.diagnostics.length===0?h.full.diagnostics:[...h.full.diagnostics,..._.diagnostics]:D=[{severity:"warning",code:"catalog-unavailable",message:"The style catalogue is unavailable: the Document API styles surface is not reachable (e.g. viewing mode or a worker-backed editor)."},..._.diagnostics],{ready:!0,status:Pl(y,E,c.status),catalogRevision:h?.full.revision??null,quickGallery:h?.quickGallery??[],activeParagraphStyleId:_.styleId,activeParagraphStyleName:_.styleName,mixedSelection:_.mixed,sourceStatus:h?.full.sourceStatus??null,diagnostics:D}},Ji=(c="direct")=>{const{sink:h}=Jm(),y=h?Va():0,_={},E=(Re,Fe)=>{if(!h)return Fe();const Pe=Va();try{return Fe()}finally{_[Re]=Va()-Pe}},D=E("documentMode",$n),U=E("selection",Wa);U.status==="ready"&&gh(U),Q(U);const oe=Ha(U);for(const[Re,Fe]of r)(!oe||Fe.selectionSignature!==oe||Fe.settled&&U.status==="ready")&&r.delete(Re);const fe={ready:S()!=null,documentMode:D,document:E("document",Wc),selection:U,toolbar:{context:D,commands:E("toolbarCommands",()=>_h(U)),copyFormatActive:p.mode!=="idle"},comments:E("comments",()=>hd(U)),trackChanges:E("trackChanges",()=>$c(U)),contentControls:E("contentControls",()=>bd(U)),zoom:E("zoom",Cd),fonts:E("fonts",wd),styles:E("styles",()=>Ql(U))};if(h){const Re=Va();a2({stage:"superdoc-ui-compute-state",atMs:Re,reason:c,startedAtMs:y,completedAtMs:Re,durationMs:Re-y,phaseMs:_,asyncReadSettlements:Lt.splice(0)})}return fe},eu=c=>{const h=Ha(c);h&&a&&h!==a&&(n.clear(),r.clear()),h&&(a=h)};let Ss=null,fi=null,Yo=null,Xo=null,_s=null,hi=null,es=!1;const Jl=()=>{if(ee||es)return;es=!0;const c=()=>{es&&(es=!1,!ee&&Dt())};typeof queueMicrotask=="function"?queueMicrotask(c):Promise.resolve().then(c)},As=()=>{const c=Y();if(c!==Yo&&(Xo&&(Xo(),Xo=null),Yo=c,!(!c||typeof c.subscribe!="function")))try{const h=c.subscribe(()=>Jl());typeof h=="function"&&(Xo=h)}catch{Yo=null}},ec=()=>{const c=L();if(c!==_s&&(hi&&(hi(),hi=null),_s=c,!(!c||typeof c.subscribe!="function")))try{const h=c.subscribe(()=>Dt());typeof h=="function"&&(hi=h)}catch{_s=null}};let Zo=null,ts=null,la=null,Li=null,tc=null,Qo=null;const Ih=()=>{const c=S()?.host,h=Ot(c?.getHandles?()=>c.getHandles():void 0,null)?.editing?.selection;return h&&typeof h.subscribe=="function"?h:null},O=()=>{const c=j(),h=c?.readLiveSelectionSyncSnapshot;if(typeof h!="function")return!1;const y=Yi(Ot(()=>h.call(c),null));if(!y||!$l(y))return!1;const _=oa(y,"ready"),E=Ys(P.selection),D=Ys(_);if(E&&D&&E.blockId===D.blockId&&Jn(E.story)===Jn(D.story))return!1;const U=qc(_),oe=P.toolbar.commands["font-family"]?.value,fe=P.toolbar.commands["font-size"]?.value,Re=typeof oe=="string"&&oe.length>0,Fe=typeof fe=="string"&&fe.length>0||typeof fe=="number"&&Number.isFinite(fe);return Re&&U.fontFamily===void 0||Fe&&U.fontSize===void 0},G=()=>{const c=Ih();if(c!==Ss&&(fi&&(fi(),fi=null),Ss=c,!!c))try{const h=c.subscribe(y=>{ci()&&O()&&jl()||(go+=1,wr(y),Dt("host-selection"))});typeof h=="function"&&(fi=h)}catch{Ss=null}},pe=()=>{const c=S()?.host,h=Ot(c?.getHandles?()=>c.getHandles():void 0,null)?.review;return h&&typeof h.subscribe=="function"?h:null},Ce=c=>c?typeof c.getActiveReviewTarget=="function"?Ot(()=>c.getActiveReviewTarget(),null):typeof c.getSnapshot=="function"?Ot(()=>c.getSnapshot(),null)?.activeReviewTarget??null:null:null;let rt=0;const xt=(c,h)=>{const y=(h&&typeof h=="object"?h:null)?.lastInteractionRejection;if(c==null&&y&&typeof y=="object"&&y.code==="review-target-invalidated"&&y.detail==="not-painted"&&tt)return!1;const _=c&&typeof c=="object"?c:null;let E=null;if(_?.entityType==="trackedChange"&&typeof _.entityId=="string"&&_.entityId.length>0){const D=_.story&&typeof _.story=="object"?_.story:void 0,U=D&&Jn(D)!==Jn(null)?D:void 0,oe=typeof _.paintedEntityId=="string"&&_.paintedEntityId.length>0?_.paintedEntityId:null,fe=oe??_.entityId,Re=(()=>{if(U){const Ye=Qr(),Ze=Ye?Fl(Ye,U):null;return Ze?.toPublicId(fe)??Ze?.toPublicId(_.entityId)??_.entityId}const Pe=Ks(Array.isArray(P?.trackChanges.items)?P.trackChanges.items:[]);return Pe.toPublicId(fe)??Pe.toPublicId(_.entityId)??_.entityId})(),Fe=oe??(fe!==Re?fe:null);E={id:Re,...U?{story:U}:{},...Fe&&Fe!==Re?{paintedEntityId:Fe}:{}}}return c==null&&E==null&&tt!=null&&I(tt)||ie(tt,E)?!1:(F(E),!0)},Nt=()=>{const c=pe();if(c===Zo)return;if(ts&&(ts(),ts=null),Zo=c,!c){xt(null);return}let h=!0;try{const y=c.subscribe(_=>{const E=_&&typeof _=="object"?_:null,D=E&&Object.prototype.hasOwnProperty.call(E,"activeReviewTarget")?E.activeReviewTarget:Ce(c);!xt(D,_)||h||Dt()});typeof y=="function"&&(ts=y),xt(Ce(c))}catch{Zo=null}finally{h=!1}},vn=()=>{if(Ss||$n()!=="viewing")return null;const c=S()?.mount?.container,h=(c&&typeof c=="object"&&"ownerDocument"in c?c.ownerDocument??null:null)??globalThis.document??null;return h&&typeof h.addEventListener=="function"?h:null},sn=()=>{const c=vn();if(c===tc||(Qo&&(Qo(),Qo=null),tc=c,!c))return;const h=()=>{go+=1,Dt()};c.addEventListener("selectionchange",h),c.addEventListener("pointerup",h,!0),c.addEventListener("mouseup",h,!0),Qo=()=>{c.removeEventListener("selectionchange",h),c.removeEventListener("pointerup",h,!0),c.removeEventListener("mouseup",h,!0)}};Bc(),xt(Ce(pe())),P=Ji("initial"),a=Ha(P.selection);const En=()=>{const c=S()?.host,h=c?.events,y=h&&typeof h.subscribe=="function"?h:null;if(y!==la&&(Li&&(Li(),Li=null),la=y,!!y)){c&&(nt.delete(c),Ct(c));try{const _=y.subscribe(E=>{const D=E?.type,U=D==="document:mutated"&&E.hasCommitEvent!==!0;if((D==="document:mutated"||D==="mutation:committed"&&GH(E))&&c&&!$e.has(c)&&($e.add(c),Dt("document-dirty")),D==="collaboration:document-replaced"&&c&&($e.delete(c),nt.delete(c),Ct(c),Dt("document-dirty")),D==="review-mutation:started"){cn(E.reviewMutation?.token);return}if(D==="review-mutation:aborted"){fn(E.reviewMutation?.token),Wt();return}if(D==="mutation:rejected"&&E.reviewMutation&&(fn(E.reviewMutation.token),Wt()),D==="mutation:committed"&&E.reviewMutation&&fn(E.reviewMutation.token),D==="source:complete"||D==="source:signals-complete"){Ai=ft(),ai();return}if((U||D==="mutation:committed"||D==="collaboration:remote-changed")&&(Hr=Date.now()),U||D==="mutation:committed"||D==="save:completed"||D==="collaboration:remote-changed"){const oe=D==="mutation:committed"?ZS(E):null;if(oe?.allResolved){Kn([]),Po(E.receipt);return}oe?.removedIds.size&&Hi(new Set(oe.removedIds),E.receipt);const fe=D==="mutation:committed"&&Gi(E)||D==="collaboration:remote-changed"&&Array.isArray(E.changedStoryIds)&&E.changedStoryIds.length>0;if(fe&&(Xr=Date.now()),D==="mutation:committed"&&fe){ws();return}if(oe?.removedIds.size&&oe.upsertIds.size===0)return;(U||D==="collaboration:remote-changed"||D==="mutation:committed"&&!fe)&&qi();const Re=D==="collaboration:remote-changed"&&Array.isArray(E.changedPartUris)&&E.changedPartUris.some(Pe=>typeof Pe=="string"&&wH.has(Pe)),Fe=D==="collaboration:remote-changed"&&Array.isArray(E.changedStoryIds)&&E.changedStoryIds.length>0&&Bl();Re&&!fe&&(bo=!0),Ti(),Re&&!fe?Eo("comments"):Fe&&(bo=!0,li()),Dt()}});typeof _=="function"&&(Li=_)}catch{la=null}}},Dt=(c="unspecified")=>{if(ee)return;const{sink:h}=Jm(),y=h?Va():0;es=!1,Bc(),G(),As(),ec(),Nt(),sn(),En();const _=Ji(c);eu(_.selection),P=_;let E=0,D=0;for(const U of[...q]){if(!h){U(P);continue}const oe=Va();U(P);const fe=Va()-oe;E+=fe,D=Math.max(D,fe)}if(h){const U=Va();a2({stage:"superdoc-ui-recompute",atMs:U,reason:c,startedAtMs:y,completedAtMs:U,durationMs:U-y,listenerCount:q.size,listenerTotalMs:E,listenerMaxMs:D})}},Sn=[],Yn=[],eo=[],ns=c=>{for(const h of c)try{h()}catch{}},Jo=()=>ns(Sn),Ja=()=>ns(Yn),nc=()=>ns(eo),lg=[];((c,h)=>{if(!(!c||typeof c.on!="function"))for(const y of h){const _=y==="active-editor-change"?()=>{Jo(),Ja(),Dt()}:y==="document-replaced"?E=>{const D=E&&typeof E=="object"?E:null,U=D?.editor,oe=D?.host,fe=!!U&&U===S(),Re=!!oe&&oe===j();if(!fe&&!Re)return;const Fe=Re?oe:j();Fe&&($e.delete(Fe),nt.delete(Fe)),Ja(),N.clear(),Ti(),Dt()}:y==="document-mode-change"?()=>{Dt(),nc()}:()=>Dt();try{c.on(y,_),lg.push(()=>{try{typeof c.off=="function"&&c.off(y,_)}catch{}})}catch{}}})(t,pH),G(),As(),ec(),Nt(),sn(),En();const ca=(c,h=ZU)=>({get:()=>c(P),subscribe:y=>{let _=c(P);const E=D=>{const U=c(D);h(_,U)||(_=U,y(U))};return q.add(E),()=>q.delete(E)}}),rs=c=>ca(c),Di=c=>{const h=y=>{const _=D=>{try{y(D)}catch{}},E=c.subscribe(_);return _(c.get()),E};return{get:()=>c.get(),getSnapshot:()=>c.get(),observe:h,subscribe:y=>h(_=>y({snapshot:_}))}},Eh=(c,h,y)=>{const _=Di(c),E=Di(h),D=U=>{const oe=Ie(y);Dt();const fe=E.observe(U);return()=>{fe(),oe()}};return{get:_.get,getSnapshot:_.getSnapshot,observe:D,subscribe:U=>D(oe=>U({snapshot:oe}))}};function ug(c){return c&&typeof c=="object"&&typeof c.id=="string"?String(c.id):null}function dg(c){const h=ys(c);return h&&Jn(h)!==Jn(null)?h:void 0}function Th(c,h){return{kind:"id",id:c,...h?{story:h}:{}}}function y2(c){if(c.empty)return null;const h=c.selectionTarget,y=h?.start,_=h?.end;if(h?.kind!=="selection"||y?.kind!=="text"||_?.kind!=="text"||typeof y.blockId!="string"||y.blockId!==_.blockId||!Number.isInteger(y.offset)||!Number.isInteger(_.offset)||y.offset<0||_.offset<0||y.offset===_.offset)return null;const E=Math.min(y.offset,_.offset),D=Math.max(y.offset,_.offset),U=ys(c);return{kind:"range",coordinateSpace:h.coordinateSpace==="tracked"?"tracked":"visible",range:{kind:"text",...U?{story:U}:{},segments:[{blockId:y.blockId,range:{start:E,end:D}}]}}}function xh(c,h){if(Jn(h)!==Jn(null))return;const y=w()?.trackChanges,_=y?.list;if(typeof _!="function")return;const E=Ot(()=>_.call(y),null);if(Lr(E)||!E||typeof E!="object")return;const D=E.items;if(Array.isArray(D))return D.map(ad).find(U=>U!=null&&ki(U,c,h))}function nr(c,h){const y=fg(c.quotedText);if(!y)return!1;const _=ld(h);return[_.insertedText,_.deletedText,_.excerpt].some(E=>fg(E)===y)}function fg(c){return typeof c=="string"?c.replace(/\s+/g," ").trim():""}function hg(){const c=P.selection.activeChangeIds[0];if(!c)return"unavailable";const h=ys(P.selection),y=(P.trackChanges.status==="ready"?P.trackChanges.items.find(U=>ki(U,c,h)):void 0)??xh(c,h)??Qr()?.find(U=>ki(U,c,h));if(!y)return"unavailable";const _=ld(y),E=_.type,D=_.grouping;return nr(P.selection,y)?"id":E==="replacement"&&D==="replacement-pair"||(E==="insertion"||E==="deletion"||E==="insert"||E==="delete")&&D==="standalone"?"range":"id"}function pg(c,h,y,_){const E=()=>S2(c,Th(y,_),y,_);try{const D=S2(c,h,y,_);if(Lr(D))return To(Promise.resolve(D).then(oe=>mo(Xs(oe))?oe:E()));const U=Xs(D);return To(mo(U)?D:E())}catch{return!1}}function mg(c){if(typeof c=="string"&&c.length>0)return{target:{kind:"id",id:c},changeId:c};if(c&&typeof c=="object"){const h=c;if(h.target&&typeof h.target=="object"){const _=h.target;return{target:_,changeId:ug(_),story:_.story}}const y=typeof h.changeId=="string"?h.changeId:h.id;if(typeof y=="string"&&y.length>0)return{target:Th(y,h.story),changeId:y,story:h.story}}return null}function gg(c,h){if(c.scope==="all")return{target:{kind:"all"},changeId:null};const y=mg(h);if(y)return y;const _=P.selection.activeChangeIds[0],E=dg(P.selection);return _?{target:Th(_,E),changeId:_,story:E}:null}function vg(c,h){if(c.scope==="id"&&h==null){if(P.selection.activeChangeIds.length>1)return nu(c.kind,{kind:"ids",ids:P.selection.activeChangeIds},null);if(P.selection.activeChangeIds.length===1&&!P.selection.empty&&P.selection.selectionTarget){const _=hg();if(_==="unavailable")return!1;if(_==="range"){const E=y2(P.selection),D=dg(P.selection);return E?pg(c.kind,E,P.selection.activeChangeIds[0],D):!1}if(_==="id"){const E=P.selection.activeChangeIds[0],D=ys(P.selection),U=D&&Jn(D)!==Jn(null)?D:void 0;return Lh(c.kind,U?{id:E,story:U}:E)}}}const y=gg(c,h);return y?nu(c.kind,y.target,y.changeId,y.story):!1}function yg(c,h){const y=Y()?.lists,_=y?.apply;if(typeof _!="function")return!1;const{behavior:E,preset:D,continuity:U}=typeof h=="string"?vH(h):h&&typeof h=="object"?h:{},oe={kind:c,behavior:E??"toggle"};D!==void 0&&(oe.preset=D),U!==void 0&&(oe.continuity=U);try{return To(_.call(y,oe))}catch{return!1}}let Oi=Promise.resolve(!1),No=null,el=Promise.resolve(!1);const Is=async c=>{if(!ng(c))return c;const h=S()?.documentMutationReadiness,y=h?.whenPainted;if(typeof y!="function")return c;const _=typeof c.txId=="string"?c.txId:void 0;try{await y.call(h,_?{txId:_}:void 0)}catch{}return c},Bo=c=>{if(Lr(c)){const y=Promise.resolve(c);return{immediate:!0,committed:y.then(_=>Xs(_),()=>!1),settled:y.then(_=>Is(Xs(_)),()=>!1)}}const h=Xs(c);return{immediate:h,committed:Promise.resolve(h),settled:Is(h)}},Rt=()=>{const c=s.shift();if(!c){u=!1,f?.(),f=null;return}try{c.resolve(ee?!1:c.mutate())}catch{c.resolve(!1)}},Vt=()=>{let c=!1;return()=>{c||(c=!0,Rt())}},yn=(c,h)=>{if(!u){u=!0,d=new Promise(D=>{f=D});try{return{result:h(),release:Vt()}}catch(D){throw u=!1,f?.(),f=null,D}}const y=s.find(D=>D.key===c);if(y)return y.mutate=h,{result:y.result,release:()=>{}};let _;const E=new Promise(D=>{_=D});return s.push({key:c,mutate:h,result:E,resolve:_}),{result:E,release:Vt()}},Ir=new Set(["create.tableOfContents"]),to=c=>Wn(`Tracked authoring is not supported for ${c}.`),$r=c=>{if($n()==="suggesting")return Ir.has(c)?to(c):{changeMode:"tracked"}},Pi=()=>$n()==="suggesting"?QH:g2,rr=(c,h,y)=>{const _=$r(c);return _&&_.success===!1?_:_?h(y,_):h(y)},Ad=(c,h,y,_)=>{const E=c.inline;if(!E)return;const D=Xs(_);if(D===!1||typeof D=="object"&&D&&D.success===!1)return;if(E.kind==="clear"){n.clear();return}if(E.kind==="toggle"||!d2(E.key))return;const U=Ha(h);if(!U)return;const oe=BH(E.key,y.value);if(oe==null){n.delete(E.key);return}n.set(E.key,{selectionSignature:U,value:oe})},B$=(c,h,y,_)=>!c.inline||c.inline.kind==="toggle"?_:Lr(_)?Promise.resolve(_).then(E=>(Ad(c,h,y,E),E)):_,z$=(c,h,y,_)=>{if(c.inline?.kind!=="toggle"||!mo(Xs(_))||typeof y.value!="boolean"&&y.value!==null)return null;const E=Ha(h);if(!E)return null;const D=++l;return r.set(c.id,{selectionSignature:E,active:y.value===!0,generation:D,settled:!1}),Dt(),D},j$=(c,h,y)=>{if(h==null)return;const _=r.get(c.id);if(!(!_||_.generation!==h)){if(!mo(y)){r.delete(c.id);return}_.settled=!0}},bg=(c,h)=>c.then(y=>(h?.(y),Vl(),y),()=>(h?.(!1),Vl(),!1)),To=(c,h)=>{const y=No;if(No=null,y)return Oi=bg(y,h),Xs(c);if(Lr(c))return Oi=bg(Bo(c).settled,h),!0;const _=Xs(c);return ng(_)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(Oi=bg(Is(_),h),_):(h?.(_),Oi=Promise.resolve(_),Vl(),_)},V$=(c,h)=>!c||typeof c!="object"?h:c,rc=(c,h=Wn("Document API operation failed."))=>{if(Lr(c))return Promise.resolve(c).then(_=>rc(_,h),()=>h);const y=V$(c,h);return Ti(),ng(y)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(bg(Is(y)),Dt(),y):(Dt(),y)},U$=(c,h,y,_)=>{const E=[],D=[];for(const U of y){const oe=_(U);if(oe)try{const fe=Bo(rr(c,h,oe));E.push(fe.immediate),D.push(fe.settled)}catch{E.push(!1),D.push(Promise.resolve(!1))}}return No=D.length?Promise.all(D).then(U=>Si(U)):null,Si(E)},H$=(c,h,y,_)=>{const E=[],D=[];for(const U of y){const oe=_(U);if(oe)try{const fe=Bo(rr(c,h,oe));E.push(fe.immediate),D.push(fe.settled)}catch{E.push(!1),D.push(Promise.resolve(!1))}}return No=D.length?Promise.all(D).then(U=>Si(U)):null,Si(E)},b2=(c,h,y,_=P.selection)=>{const E=$r(c);return E&&E.success===!1?E:_.selectionTarget?h(y,{...E,offsetSpace:"selection"}):E?h(y,E):h(y)},$$=(c,h,y,_)=>{const E=_o(h,_);switch(c.kind){case"alignment":{const D=y;return D!=="left"&&D!=="center"&&D!=="right"&&D!=="justify"?null:{target:E,alignment:D}}case"spacing-line":{const D=typeof y=="number"?y:Number(y);return!Number.isFinite(D)||D<=0?null:{target:E,line:D,lineRule:"auto"}}case"style":if(y&&typeof y=="object"){const D=y.role;if(D&&typeof D=="object")return{target:E,role:D}}return typeof y!="string"||y.trim()===""?null:{target:E,styleId:y};case"direction":{const D=c.fixedValue;return D!=="ltr"&&D!=="rtl"?null:{target:E,direction:D}}default:return null}},G$=(c,h)=>{const y=c.inline,_=m2(c),E=j();if(!y||typeof E?.setPendingInlineFormat!="function")return!1;if(y.kind==="clear")return H(),!0;if(!_)return!1;let D;if(y.kind==="toggle")D=!Za(c,w(),P.selection);else{const U=h&&typeof h=="object"&&"value"in h?h.value:h;if(y.kind==="value-number"){const oe=typeof U=="number"?U:Number(U);D=Number.isFinite(oe)&&oe>0?oe:null}else D=typeof U=="string"&&U.trim()!==""?U:null;if(D===null)return $(_,null),!0}return $(_,D),!0},W$=()=>{const c=w(),{lockModesById:h}=Ya(c?.contentControls,P.selection);if(ks(h))return!1;const y=[],_=[],E=Ze=>{const Ke=Bo(Ze);y.push(Ke.immediate),_.push(Ke.settled)},D=(Ze,Ke,We)=>{try{E(We?Ze(Ke,We):Ze(Ke))}catch{y.push(!1),_.push(Promise.resolve(!1))}},U=Qa().cache?.full.defaults.paragraphStyleId??ut,oe=cd(P.selection);if(oe){const Ze=vr(c,"format.apply");if(Ze)try{E(b2("format.apply",Ze,{target:oe,inline:{...Pi()}}))}catch{y.push(!1),_.push(Promise.resolve(!1))}}const fe=vr(c,"format.paragraph.resetDirectFormatting"),Re=vr(c,"styles.paragraph.setStyleRef"),Fe=ys(P.selection),Pe=!Fe||Fe.storyType==="body",Ye=vr(c,Pe?"lists.remove":"lists.removeInStory");for(const Ze of Dr(P.selection)){const Ke=_o(Ze,Fe);if(fe&&D(fe,{target:Ke}),Ye)try{const We=Ua(Ze),at=Bo(Ye(Pe?{target:We}:{target:We,story:Fe}));_.push(at.settled.then(dt=>mo(dt)?dt:!0))}catch{}Re&&D(Re,{target:Ke,styleId:U})}if(!oe&&$n()!=="suggesting"){const Ze=vr(c,"format.paragraph.setMarkRunProps");if(Ze)for(const Ke of Dr(P.selection))D(Ze,{target:_o(Ke,Fe),markRunProps:{bold:!1,italic:!1,strikethrough:!1,doubleStrikethrough:!1,smallCaps:!1,caps:!1,verticalAlign:"baseline"}})}return No=_.length?Promise.all(_).then(Ze=>Si(Ze)):null,Si(y.length?y:[!1])},K$=(c,h,y)=>{const _=Dr(P.selection);if(_.length===0)return!1;const E=ys(P.selection);return U$(c.docRoute,h,_,D=>$$(c.blockParagraph,D,y,E))},q$=(c,h,y)=>{const _=w(),E=vr(_,"format.paragraph.setIndentation"),D=vr(_,"format.paragraph.clearIndentation"),U=c.list?.mode,oe=vs(P.selection),fe=ys(P.selection),Re=async Fe=>{const Pe=await pt(_,Fe,oe);if(Pe===!0)return{kind:"list",routeToCall:c.docRoute,opToCall:h,input:{target:VI(Fe)}};if(Pe===null||fe&&fe.storyType!=="body"&&typeof _?.getNode!="function")return null;const Ye=await Cn(_,Fe,fe),Ze={};if(Ye?.right!=null&&(Ze.right=Ye.right),Ye?.firstLine!=null&&(Ze.firstLine=Ye.firstLine),Ye?.hanging!=null&&(Ze.hanging=Ye.hanging),U==="indent")return E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Fe,fe),left:Math.max(0,Ye?.left??0)+UI,...Ze}}:null;const Ke=Math.max(0,(Ye?.left??0)-UI);return Ke>0&&(Ze.left=Ke),Object.keys(Ze).length===0?D?{kind:"paragraph",routeToCall:"format.paragraph.clearIndentation",opToCall:D,input:{target:_o(Fe,fe)}}:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Fe,fe),left:0}}:null:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Fe,fe),...Ze}}:null};return No=(async()=>{const Fe=await Promise.all(y.map(Ke=>Re(Ke).catch(()=>null)));if(Fe.length===y.length&&Fe.every(Ke=>Ke?.kind==="list")&&$n()!=="suggesting"){const Ke=U==="indent"?"lists.indentRange":"lists.outdentRange",We=vr(_,Ke);if(We)try{return await Bo(rr(Ke,We,{paraIds:y,story:oe})).settled}catch{return!1}}const Pe=oe.storyType!=="body"&&Fe.some(Ke=>Ke?.kind==="list"),Ye=Pe&&U==="outdent"?vr(_,"lists.outdentInStory"):null;if(Pe&&!Ye)return!1;const Ze=Fe.map(Ke=>{if(!Ke)return Promise.resolve(!1);try{return Ke.kind==="list"&&Ye?Bo(rr("lists.outdentInStory",Ye,{target:Ke.input.target,story:oe})).settled:Bo(rr(Ke.routeToCall,Ke.opToCall,Ke.input)).settled}catch{return Promise.resolve(!1)}});return Si(await Promise.all(Ze))})(),!0},Y$=(c,h)=>{const y=c.list,_=w(),E=Dr(P.selection);if(E.length===0)return!1;const D=vs(P.selection),U=D.storyType==="body";if(y.mode==="indent"||y.mode==="outdent")return q$(c,h,E);const oe=y.seed,fe=Pe=>{if(Pe.some(dt=>!dt.resolved))return{immediate:!1,settled:null};const Ye=Pe.every(dt=>dt.seed===oe);if(!Ye&&!U)return{immediate:!1,settled:null};const Ze=Ye?U?"lists.remove":"lists.removeInStory":c.docRoute,Ke=Ye?vr(_,Ze):h;if(!Ke)return{immediate:!1,settled:null};const We=[],at=[];return E.forEach((dt,qe)=>{if(!Ye&&Pe[qe]?.seed===oe)return;const At=Ye?{target:Ua(dt),...U?{}:{story:D}}:{target:Ua(dt),seed:oe};try{const Et=Bo(rr(Ze,Ke,At));We.push(Et.immediate),at.push(Et.settled)}catch{We.push(!1),at.push(Promise.resolve(!1))}}),{immediate:Si(We),settled:at.length?Promise.all(at).then(dt=>Si(dt)):null}},Re=E.map(Pe=>qt(_,Pe,D));if(Re.some(Lr))return No=Promise.all(Re).then(async Pe=>{const Ye=fe(Pe);return Ye.settled?await Ye.settled:Ye.immediate}),!0;const Fe=fe(Re);return No=Fe.settled,Fe.immediate};function Rh(c){return c&&typeof c=="object"?c:{}}function X$(c){if(typeof c=="string")return c;const h=Rh(c);if(Object.prototype.hasOwnProperty.call(h,"href"))return h.href;if(Object.prototype.hasOwnProperty.call(h,"value"))return h.value}function Z$(c,h){const y=Rh(c).text;return typeof y=="string"&&y.trim()!==""?y:h}function sE(c){const h=Rh(c),y=h.capture&&typeof h.capture=="object"?h.capture:null;return h.target??y?.target??y?.selectionTarget??h.selectionTarget??h.textTarget??null}const Q$=c=>{const h=w(),y=h?.hyperlinks;if(!y)return!1;const _=Rh(c),E=X$(c),D=sE(c),U=typeof _.text=="string"?_.text:void 0,oe=typeof _.currentText=="string"?_.currentText:void 0,fe=mh(_.hyperlinkTarget)?_.hyperlinkTarget:null,Re=mh(_.textTarget)?_.textTarget:null,Fe=Zi(h,P.selection),Pe=typeof fe?.storyId=="string"&&typeof fe?.hyperlinkNodeId=="string";if(Pe&&E===null){const Ye=y.remove;if(typeof Ye!="function")return!1;try{return rr("hyperlinks.remove",Ye,{storyId:fe.storyId,hyperlinkNodeId:fe.hyperlinkNodeId,keepText:!0})}catch{return!1}}if(Fe&&E===null){const Ye=y.remove;if(typeof Ye!="function")return!1;try{return rr("hyperlinks.remove",Ye,{target:Fe.address,mode:"unwrap"})}catch{return!1}}if((Fe||fe)&&typeof E=="string"&&E.trim()!==""){const Ye=y.patch,Ze=y.updateTarget;if(!(!Pe&&Fe&&typeof Ye=="function")&&!(Pe&&typeof Ze=="function"))return!1;const Ke=typeof U=="string"&&U!==(Pe?oe:Fe?.text??oe),We=h?.text?.replace,at=Ke?Pe?Re:WH(Fe?.address):null,dt=Ke&&!!at&&typeof We=="function";if(Ke&&!dt)return!1;const qe=[],At=[];let Et=null,_n=null,An=null,kr=!1;try{if(Pe){if(typeof Ze!="function")return!1;const Er=rr("hyperlinks.updateTarget",Ze,{storyId:fe.storyId,hyperlinkNodeId:fe.hyperlinkNodeId,newTarget:KH(E)});kr=Lr(Er);const Tr=Bo(Er);if(!mo(Tr.immediate))return!1;qe.push(Tr.immediate),At.push(Tr.settled),Et=Tr.immediate,_n=Tr.committed,An=Tr.settled}else if(Fe){if(typeof Ye!="function")return!1;const Er=rr("hyperlinks.patch",Ye,{target:Fe.address,patch:{href:E}});kr=Lr(Er);const Tr=Bo(Er);if(!mo(Tr.immediate))return!1;qe.push(Tr.immediate),At.push(Tr.settled),Et=Tr.immediate,_n=Tr.committed,An=Tr.settled}}catch{return!1}if(dt){const Er=(Pr,ei)=>mo(ei)?Si([Pr,ei]):mo(Pr)?lh(Pr,ei):ei,Tr=Pr=>{if(!mo(Pr))return Pr;try{const ei=Bo(rr("text.replace",We,{target:at,text:U}));return mo(ei.immediate)?Promise.all([An??Promise.resolve(Pr),ei.settled]).then(([R2,BG])=>Er(R2,BG)):lh(Pr,ei.immediate)}catch{return lh(Pr,!1)}};if(kr)return No=(_n??Promise.resolve(Et??!1)).then(Tr),Si(qe);try{const Pr=Bo(rr("text.replace",We,{target:at,text:U}));if(!mo(Pr.immediate))return Et?lh(Et,Pr.immediate):Pr.immediate;qe.push(Pr.immediate),At.push(Pr.settled),No=Promise.all([An??Promise.resolve(Et??!1),Pr.settled]).then(([ei,R2])=>Er(ei,R2))}catch{return Et?lh(Et,!1):!1}}return!dt&&At.length>0&&(No=Promise.all(At).then(Er=>Si(Er))),Si(qe)}if(typeof E=="string"&&E.trim()!==""){const Ye=E.trim(),Ze=y.wrap,Ke=PH(D),We=Ke.length>0?Ke:u2(P.selection);if(We.length>0){if(typeof Ze!="function")return!1;try{return H$("hyperlinks.wrap",Ze,We,At=>({target:At,link:{destination:{href:Ye}}}))}catch{return!1}}const at=y.insert,dt=Z$(c,Ye);if(typeof at!="function"||dt.trim()==="")return!1;const qe=hh(D)??Ys(P.selection);if(!qe)return!1;try{return rr("hyperlinks.insert",at,{target:qe,text:dt,link:{destination:{href:Ye}}})}catch{return!1}}return!1},J$=(c,h,y)=>{const _=c.create.kind,E=y&&typeof y=="object"?y:{};if(_==="table"){const U=Number(E.rows??E.rowCount),oe=Number(E.columns??E.cols??E.colCount);if(!Number.isInteger(U)||U<1||!Number.isInteger(oe)||oe<1)return!1;const fe=Ys(P.selection),Re=fe&&typeof fe.blockId=="string"?{kind:"inParagraph",target:_o(fe.blockId),offset:fe.range?.start??0}:h2(P.selection,"nodeId");try{return rr(c.docRoute,h,{rows:U,columns:oe,at:Re})}catch{return!1}}if(_==="image"){const U=E.src??E.value;if(typeof U!="string"||U.trim()==="")return!1;const oe=Ys(P.selection),fe=vs(P.selection),Re=fe.storyType==="body"?null:fe;let Fe;oe&&typeof oe.blockId=="string"?Fe={kind:"inParagraph",target:_o(oe.blockId,Re),offset:oe.range?.start??0}:(Fe=h2(P.selection,"target"),Re&&Fe.kind==="after"&&(Fe={...Fe,target:{...Fe.target,story:Re}}));const Pe={src:U,at:Fe};Re&&(Pe.in=Fe.kind==="inParagraph"?Z(Re)??Re:Re),typeof E.alt=="string"&&(Pe.alt=E.alt),typeof E.title=="string"&&(Pe.title=E.title),E.size&&typeof E.size=="object"&&(Pe.size=E.size);try{return rr(c.docRoute,h,Pe)}catch{return!1}}const D={at:h2(P.selection,"target")};typeof E.instruction=="string"&&(D.instruction=E.instruction),E.config&&typeof E.config=="object"&&(D.config=E.config);try{return rr(c.docRoute,h,D)}catch{return!1}},eG=(c,h)=>{const y=c.table,_=Ne();if(!_||y.requiresCell&&!_.cellNodeId)return!1;const E=t$(y.action,_);if(!E)return!1;try{if(y.action==="insert-row-before"||y.action==="insert-row-after"){const D=j(),U=(typeof D?.getHandles=="function"?D.getHandles():null)?.editing?.tables;if(typeof U?.insertRow!="function")return!1;const oe=$r(c.docRoute);return oe&&oe.success===!1?oe:oe?U.insertRow(E,oe):U.insertRow(E)}if(y.action==="insert-column-before"||y.action==="insert-column-after"){const D=j(),U=(typeof D?.getHandles=="function"?D.getHandles():null)?.editing?.tables;if(typeof U?.insertColumn!="function")return!1;const oe=$r(c.docRoute);return oe&&oe.success===!1?oe:oe?U.insertColumn(E,_.rowIndex,oe):U.insertColumn(E,_.rowIndex)}return rr(c.docRoute,h,E)}catch{return!1}},tG=c=>!c||c.disposition!=="routed"?!1:!!(c.inline||c.blockParagraph||c.list||c.link||c.create),nG=c=>{const h=Rh(c);return!!(sE(c)||mh(h.hyperlinkTarget)||mh(h.textTarget))},rG=(c,h,y)=>P.selection.status!=="ready"?!1:og(c)?.scope==="id"||!h||h.disposition!=="routed"?!0:h.inline?.kind==="clear"?Dr(P.selection).length>0||cd(P.selection)!=null:h.inline?cd(P.selection)!=null||Dr(P.selection).length>0:h.blockParagraph||h.list?Dr(P.selection).length>0:h.link?nG(y)||u2(P.selection).length>0||Ys(P.selection)!=null||Za(h,w(),P.selection):!0,oG=(c,h)=>{const y=og(c),_=td(c);return y?.scope==="id"&&mg(h)||y?.scope!=="id"&&!tG(_)?!1:!rG(c,_,h)},iG=(c,h)=>oG(c,h)?Gl().then(()=>{}):null,sG=(c,h,y)=>{if(No=null,Oi=Promise.resolve(!1),ee)return!1;const _=Je.get(c);if(_)try{const Pe=_.execute(ra(h,y));return To(Pe)}catch{return!1}const E=OI(c);if(E){if($n()==="viewing")return!1;if(typeof Y()?.lists?.apply=="function")return yg(E,h)}const D=og(c);if(D)return vg(D,h);if(c==="copy-format")return To(aG());const U=td(c);if(!U||U.disposition!=="routed")return!1;const oe=U.normalizePayload?U.normalizePayload(h):h;if(U.instanceRoute){if(!S()||!Qi(U,oe))return!1;const Pe=t?.[U.instanceRoute];if(typeof Pe!="function")return!1;try{const Ye=U.fixedArg!==void 0?U.fixedArg:oe,Ze=Pe.call(t,Ye);return To(Ze)}catch{return!1}}if(U.inline?.kind==="clear")return U.mutates&&$n()==="viewing"?!1:To(W$());const fe=U.docRoute;if(!fe||U.mutates&&$n()==="viewing")return!1;const Re=w(),Fe=vr(Re,fe);if(!Fe)return!1;if(U.inline){const{lockModesById:Pe}=Ya(Re?.contentControls,P.selection);if(ks(Pe))return!1;const Ye=cd(P.selection);if(!Ye)return P.selection.empty===!1?To(!1):To(G$(U,oe));const Ze=Za(U,Re,P.selection),Ke=JH(U.inline,Ye,oe,Ze);if(!Ke)return!1;let We=null;try{const at=S(),dt=$n(),qe=()=>S()!==at||w()!==Re||$n()!==dt?!1:b2(fe,Fe,Ke),At=Ha(P.selection)??Dc(P.selection),Et=U.inline.kind==="toggle"?yn(`${U.id}:${At}`,qe):null;We=Et?.release??null;const _n=Et?Et.result:qe(),An=z$(U,P.selection,Ke,_n),kr=B$(U,P.selection,Ke,_n),Er=To(kr,Tr=>{j$(U,An,Tr),We?.(),We=null});return U.inline.kind==="toggle"&&(el=Oi),Er}catch{return We?.(),!1}}if(U.blockParagraph){const Pe=K$(U,Fe,oe),Ye=U.blockParagraph.kind==="alignment"&&mo(Pe)?ot(P.selection,oe):null;return To(Pe,Ze=>{bt(Ye,Ze)})}if(U.list){const Pe=Y$(U,Fe);return To(Pe)}if(U.link){const Pe=Q$(oe);return To(Pe)}if(U.create){const Pe=J$(U,Fe,oe);return To(Pe)}if(U.table){const Pe=eG(U,Fe);return To(Pe)}try{return To(U.mutates?rr(fe,Fe,oe):Fe(oe))}catch{return!1}},tu=(c,h,y)=>{const _=QE(t,"command:started",()=>({commandId:c,selection:P.selection}));let E;try{E=sG(c,h,y)}catch(U){throw Od(t,"command:settled",()=>({actionId:_,commandId:c,outcome:"threw"})),U}const D=U=>Od(t,"command:settled",()=>({actionId:_,commandId:c,outcome:mo(U)?"succeeded":"rejected",result:U}));if(E===!1)D(E);else try{Oi.then(D,()=>D(!1))}catch{}return E},wg=()=>{g+=1,p={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:p.lastClickAt,pointerSelecting:!1,keyboardSelecting:!1};for(const c of m)c("idle");Dt()},aG=async()=>{const c=["bold","italic","underline","strikethrough"].filter(Fe=>P.toolbar.commands[Fe]?.active===!0),h=await el;await d;const y=mo(h)?c:[],_=500,E=Date.now();if(p.mode!=="idle"){if(p.mode==="armed"&&E-p.lastClickAt<_){p={...p,mode:"persistent",lastClickAt:E};for(const Fe of m)Fe("persistent");return Dt(),!0}return wg(),!1}const D=E-p.lastClickAt<_,U=++g;p={...p,lastClickAt:E};const oe=await Gl(),fe=`${Dc(oe)}:${ft()}`,Re=await lG(null,oe,fe&&fe===k?v:void 0,y);if(U!==g)return!0;p={...p,mode:D?"persistent":"armed",snapshot:Re,sourceSelectionKey:Dc(oe),lastClickAt:E};for(const Fe of m)Fe(p.mode);return Dt(),!0},lG=async(c,h,y,_=[])=>{const E=h?.target??c?.target;if(!E||E.kind!=="text")return null;const D=Array.isArray(E.segments)?E.segments:[];if(D.length===0)return null;const U=w();if(!U)return null;const oe=E.story;let fe=null;for(const Ke of D){const We=(await ui(_o(Ke.blockId,oe)))?.node??null;if(!We)continue;const at=w2(We),dt=Array.isArray(at?.inlines)?at.inlines:[],qe=cG(dt,Ke.range);fe?fe=aE(fe,qe):fe=qe}const Re=fe?QU(fe):{},Fe={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike"},Pe=new Set([...h?.activeMarks??(Array.isArray(c?.activeMarks)?c.activeMarks:[]),..._]);for(const[Ke,We]of Object.entries(Fe))Pe.has(Ke)&&(Re[We]=!0);const Ye=y??await Jc(h??oa(c,"ready"));if(Ye.fontFamily&&(Re.fontFamily=Ye.fontFamily),Ye.color&&(Re.color=Ye.color),Ye.highlight&&(Re.highlight=Ye.highlight),Ye.fontSize){const Ke=Number.parseFloat(Ye.fontSize);Number.isNaN(Ke)||(Re.fontSize=Ke)}let Ze=null;if(D.length===1){const Ke=D[0],We=(await ui(_o(Ke.blockId,oe)))?.node??null;We&&w2(We)&&(Ze=await uG(We,Ke.blockId,U,oe))}return{story:oe??null,inline:Re,paragraph:Ze}},w2=c=>c?c.kind==="paragraph"?c.paragraph??null:c.kind==="heading"?c.heading??null:null:null,cG=(c,h)=>{const y=U=>{const oe=U.run;return typeof oe?.text=="string"?oe.text:""},_=U=>U.run?.props;if(h.start===h.end){let U=0;for(const oe of c){const fe=y(oe),Re=U,Fe=U+fe.length;if(U=Fe,h.start>=Re&&h.start<=Fe){const Pe=_(oe);return Pe?{...Pe}:{}}}return{}}let E=0;const D=[];for(const U of c){const oe=y(U),fe=E,Re=E+oe.length;if(E=Re,Re<=h.start||fe>=h.end)continue;const Fe=_(U);Fe&&D.push(Fe)}return D.length===0?{}:D.length===1?{...D[0]}:aE(D[0],...D.slice(1))},aE=(c,...h)=>{const y={...c};for(const _ of h)for(const E of Object.keys(y)){if(!(E in _)){delete y[E];continue}const D=y[E],U=_[E];(typeof D!=typeof U||JSON.stringify(D)!==JSON.stringify(U))&&delete y[E]}return y},uG=async(c,h,y,_)=>{const E=w2(c),D=E.props??{},U=E.styleRef??null,oe=D.alignment??null,fe=D.spacing??null,Re=D.indent??null,Fe=Re?{...Re.left!=null?{left:Re.left}:{},...Re.right!=null?{right:Re.right}:{},...Re.firstLine!=null?{firstLine:Re.firstLine}:{},...Re.hanging!=null?{hanging:Re.hanging}:{}}:null,Pe=D.markRunProps??null,Ye=D.numbering?.numId,Ze=typeof Ye=="string"?parseInt(Ye,10):typeof Ye=="number"?Ye:NaN,Ke=D.numbering?.level,We=isNaN(Ze)?null:{numId:Ze,...Ke!=null?{level:Ke}:{}};let at=null;if(We&&typeof y.lists?.getState=="function")try{const dt=await y.lists.getState({target:_o(h,_)});dt&&typeof y.lists?.getStyle=="function"&&(at=await y.lists.getStyle(dt)??null)}catch{}return{styleId:U,alignment:oe,spacing:fe,indentation:Fe,markRunProps:Pe,numbering:We,listStyle:at}},lE=async()=>{if(p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;const c=w()?.selection,h=async()=>{const U=typeof c?.current=="function"?await Promise.resolve(c.current({includeText:!0})):ia().value;return Yi(U)},y=()=>new Promise(U=>setTimeout(U,16)),_=8;let E=null,D="";for(let U=0;U<_;U+=1){if(U>0&&await y(),p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;if(E=await h(),!(!E||E.empty)&&(D=Dc(E),D!==p.sourceSelectionKey))break}if(E&&!E.empty&&D!==p.sourceSelectionKey){await cE(E);return}if(p.snapshot?.paragraph){const U=await h();if(!U||Dc(U)===p.sourceSelectionKey)return;await cE(U)}},cE=async c=>{const h=p.snapshot;if(!h){p.mode==="armed"&&wg();return}const y=w();if(!y)return;const _=oa(c,"ready"),{lockModesById:E}=Ya(y.contentControls,_);if(ks(E)){Dt();return}const D=c.target,U=c.selectionTarget;if(c.empty!==!0&&Object.keys(h.inline).length>0){const oe=vr(y,"format.apply");if(oe&&U)try{if(!mo(Xs(await Promise.resolve(b2("format.apply",oe,{target:U,inline:h.inline},c))))){Dt();return}}catch{Dt();return}}if(h.paragraph){const oe=Array.isArray(D?.segments)?D.segments:[],fe=D?.story;for(const Re of oe){const Fe=_o(Re.blockId,fe),Pe=await ui(Fe),Ye=Pe?.node??null,Ze=Pe?.address??null;if(!Ye)continue;const Ke={kind:"block",nodeType:Ze?.nodeType??Ye.kind??"paragraph",nodeId:Re.blockId,...fe&&typeof fe=="object"?{story:fe}:{}},{styleId:We,alignment:at,spacing:dt,indentation:qe,markRunProps:At,numbering:Et,listStyle:_n}=h.paragraph;if(We&&await y.styles?.paragraph?.setStyle?.({target:Ke,styleId:We}),at&&await y.format?.paragraph?.setAlignment?.({target:Ke,alignment:at}),dt){const An=dt,kr=An.lineRule??"auto",Er=new Set(["auto","exact","atLeast"]).has(kr)?kr:"auto",Tr={...An.before!=null?{before:Math.round(An.before*20)}:{},...An.after!=null?{after:Math.round(An.after*20)}:{},...An.line!=null?{line:Math.round(Er==="auto"?An.line*240:An.line*20),lineRule:Er}:{}};await y.format?.paragraph?.setSpacing?.({target:Ke,...Tr})}if(qe){const An={...qe.left!=null?{left:qs(qe.left)}:{},...qe.right!=null?{right:qs(qe.right)}:{},...qe.firstLine!=null?{firstLine:qs(qe.firstLine)}:{},...qe.hanging!=null?{hanging:qs(qe.hanging)}:{}};await y.format?.paragraph?.setIndentation?.({target:Ke,...An})}At&&await y.format?.paragraph?.setMarkRunProps?.({target:Ke,markRunProps:At}),Et&&await y.format?.paragraph?.setNumbering?.({target:Ke,...Et}),_n&&((await ui(Fe))?.address?.nodeType==="listItem"?await y.lists?.applyStyle?.({target:VI(Re.blockId,fe),style:_n}):Et&&await y.format?.paragraph?.setNumbering?.({target:Ke,...Et}))}}p.mode==="armed"&&wg(),Dt()},Cg=(c,h,y)=>{const _=iG(c,h),E=_?_.then(()=>(tu(c,h,y),Oi)):(tu(c,h,y),Oi);return td(c)?.inline?.kind==="toggle"&&(el=E),E},uE=c=>({id:c,getState:()=>P.toolbar.commands[c]??aa(c,w(),P.selection,Xa(P.selection)),observe:h=>ca(y=>y.toolbar.commands[c]??{enabled:!1,active:!1,supported:!1,source:"unsupported",reason:lt.commandUnsupported}).subscribe(h),execute:h=>tu(c,h),executeAsync:h=>Cg(c,h)}),dG=c=>{Je.set(c.id,c),Dt();const h=()=>{Je.delete(c.id),Dt()};return Object.assign(h,{handle:uE(c.id),unregister:h})},kg=rs(c=>c.selection),Sg=Di(kg),dE=()=>{const c=j();if(typeof c?.getHandles!="function")return{reason:lt.hostCapabilityUnavailable};let h=null;try{h=c.getHandles()}catch(E){const D=E?.reason;return{reason:D==="host-not-ready"||D==="host-disposed"||D==="editing-mount-required"?lt.notReady:lt.hostCapabilityUnavailable}}const y=h?.editing?.selectionTargets;if(typeof y?.apply=="function")return{helper:y};const _=h?.selection;return typeof _?.apply=="function"?{helper:_}:{reason:lt.hostCapabilityUnavailable}},fG=()=>{const c=j();if(typeof c?.getHandles!="function")return null;let h=null;try{h=c.getHandles()}catch{return null}const y=h?.editing?.selection?.toSelectionTarget?.()??h?.selection?.toSelectionTarget?.();if(!y||typeof y!="object"||y.kind!=="ok")return null;const _=y.target;return _&&typeof _=="object"?_:null},hG=c=>{const h=j();if(typeof h?.getHandles=="function")try{const y=h.getHandles()?.editing?.contentControls;typeof y?.activate=="function"&&y.activate({id:c})}catch{}},fE={get:Sg.get,getSnapshot:Sg.getSnapshot,subscribe:Sg.subscribe,observe:Sg.observe,current:()=>ia().value,capture:()=>{const c=kg.get();return c.empty||!c.target&&!c.selectionTarget?null:{...c,capturedAt:Date.now()}},restore:c=>{const h=E=>(Dt(),{...E,success:E.ok});if(!c||typeof c!="object")return h({ok:!1,reason:lt.targetUnresolved});if(!S())return h({ok:!1,reason:lt.notReady});const y=ZH(c);if(!y)return h({ok:!1,reason:lt.targetUnresolved});const _=dE();if(!("helper"in _))return h({ok:!1,reason:_.reason});try{return h(DI(_.helper.apply(y)))}catch{return h({ok:!1,reason:lt.hostCapabilityUnavailable})}},apply:c=>{if(!S())return{ok:!1,reason:lt.notReady};const h=dE();if(!("helper"in h))return{ok:!1,reason:h.reason};try{const y=h.helper.apply(c);return Dt(),DI(y)}catch{return{ok:!1,reason:lt.hostCapabilityUnavailable}}},getAnchorRect:c=>{const h=j();if(typeof h?.getSelectionAnchorRect=="function"){const y=Ot(()=>h.getSelectionAnchorRect(c),null);return y&&typeof y=="object"&&(Number(y.width)>0||Number(y.height)>0)?y:null}return null},getRects:c=>{const h=kg.get(),y=h.selectionTarget??h.target;if(h.empty||!y)return[];const _=Og.getRect({target:y,relativeTo:c?.relativeTo});return _.found?_.rects:[]}},pG={get ids(){return di()},has:c=>td(c)!=null||Je.has(c),get:c=>uE(c),execute:tu,executeAsync:Cg,register:dG,getContextMenuItems:c=>{const h=[];for(const y of Je.values()){const _=y.contextMenu;_&&Ot(_.when?()=>_.when(c):void 0,!0)&&h.push({id:y.id,label:_.label,group:_.group,order:_.order,invoke:()=>tu(y.id,void 0,c)})}return h.sort((y,_)=>(y.order??0)-(_.order??0)||y.label.localeCompare(_.label))}},C2=Di(rs(c=>c.toolbar)),mG={get:C2.get,getSnapshot:()=>P.toolbar,subscribe:C2.subscribe,observe:C2.observe,execute:tu,executeAsync:Cg},Id=async(c,h)=>{if(!S())return{success:!1,ok:!1,reason:lt.notReady};if(!c)return{success:!1,ok:!1,reason:lt.targetUnresolved};const y=j(),_=y?.scrollTargetIntoView;if(typeof _!="function")return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable};try{const E={target:c,block:h?.block??"center",behavior:h?.behavior??"smooth"},D=await Promise.resolve(h?.shouldContinue?_.call(y,E,h.shouldContinue):_.call(y,E));return D&&typeof D=="object"&&D.success===!1?{success:!1,ok:!1,reason:eg(D.reason,lt.targetUnresolved)}:{success:!0,ok:!0}}catch{return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable}}},hE=c=>{if(!c||typeof c!="object")return null;const h=c,y=h.wordRevisionIds&&typeof h.wordRevisionIds=="object"?h.wordRevisionIds:null,_=h.sourceIds&&typeof h.sourceIds=="object"?h.sourceIds:null,E=Array.isArray(_?.wordIdOther)?_.wordIdOther:void 0,D=y?.insert??y?.delete??y?.format??_?.wordIdInsert??_?.wordIdDelete??E?.[0];return typeof D=="string"&&D.length>0?D:null},pE=async(c,h,y,_,E)=>{const D=await Id(h,E);if(D.ok)return D;const U=T(),oe=U?.focusTrackedChange;if(typeof oe!="function")return D;const fe=y||_?{commentId:c,...y?{trackedChangeStory:y}:{},..._?{importedId:_}:{}}:c;try{const Re=await Promise.resolve(oe.call(U,fe));if(Re&&typeof Re=="object"&&Re.ok===!0)return{success:!0,ok:!0}}catch{}return D},_g=async(c,h,y,_)=>{const E=c==="trackChanges"?_?.story:void 0,D=c==="trackChanges"?_?.matchStory??E:void 0,U=qe=>{if(!E||!qe||typeof qe!="object")return qe;const At=qe,Et=At.address&&typeof At.address=="object"?At.address:null;return At.story||Et?.story?qe:{...At,story:E}},oe=c==="trackChanges"?FI:ch,fe=y.find(qe=>ki(qe,h,D)),Re=fe&&typeof fe=="object"?fe:null,Fe=c==="trackChanges"&&Re?.type==="move"&&(Re.subtype==="move-to"||Re.subtype==="move-from")?Re.subtype:null,Pe=Fe&&typeof Re?.trackedChangeCanonicalId=="string"?Re.trackedChangeCanonicalId:h,Ye=qe=>{if(!Fe)return c==="trackChanges"?FI(qe,{preferStableBlock:!0}):oe(qe);const At=ch(qe);if(At?.kind!=="move")return null;const Et=Fe==="move-to"?At.destination:At.source;return c2(Et)?Et:null},Ze=oe(fe),Ke=c!=="trackChanges"||!Fe&&c2(ch(fe));if(Ze&&Ke)return U(Ze);const We=w()?.[c],at=c==="comments"?{commentId:h}:{id:Pe,...E?{story:E}:{}},dt=We?.get;if(typeof dt!="function")return U(Ze);try{return U(Ye(await Promise.resolve(dt.call(We,at)))??Ze)}catch{return U(Ze)}};function mE(c,h){if(Ga())return Wn("Comments are read-only.","DOCUMENT_READONLY");if(fd())return Wn("Resolving comments is disabled.","DOCUMENT_READONLY");const y=w()?.comments,_=y?.patch;if(typeof _!="function")return Wn("comments.patch is unavailable.");const E=Wn("comments.patch failed.");return Ot(()=>rc(_.call(y,{commentId:c,status:h}),E),E)}const Mh=()=>Ga()?Wn("Comments are read-only.","DOCUMENT_READONLY"):null,gG=(c,h)=>{const y=h&&typeof h=="object"?h:null;let _=Array.from(c);y?.includeResolved===!1&&(_=_.filter(fe=>fe.status!=="resolved"));const E=Number(y?.offset),D=Number.isInteger(E)&&E>0?E:0,U=Number(y?.limit),oe=Number.isInteger(U)&&U>=0?D+U:void 0;return _.slice(D,oe)},Ed=rs(c=>c.comments),Ag=Eh(Ed,ca(c=>gd(c.selection,c.comments)),"comments"),vG={get:Ag.get,getSnapshot:Ag.getSnapshot,subscribe:Ag.subscribe,observe:Ag.observe,list:c=>{ht();const h=Wl();return gG(h.value??Ed.get().items,c)},getById:c=>{const h=Ed.get().items.find(E=>Vr(E)===c)??null;if(h)return h;const y=w()?.comments,_=Ot(y?.get?()=>y.get({commentId:c}):void 0,null);return Lr(_)?null:_},createFromCapture:(c,h)=>{const y=Mh();if(y)return y;const _=w()?.comments,E=_?.create;if(typeof E!="function")return Wn("comments.create is unavailable.");const D=Wn("comments.create failed.");return Ot(()=>{const U=c&&typeof c=="object"?c.target??c.selectionTarget:null;return U==null?Wn("A range selection is required to comment.","NO_SELECTION"):rc(E.call(_,{target:U,text:h.text}),D)},D)},createFromSelection:c=>{const h=Mh();if(h)return h;const y=w()?.comments,_=y?.create;if(typeof _!="function")return Wn("comments.create is unavailable.");const E=kg.get();let D=E.target??E.selectionTarget;if(E.empty||!D){const oe=fG();oe&&(D=oe)}if(!D)return Wn("A range selection is required to comment.","NO_SELECTION");const U=Wn("comments.create failed.");return Ot(()=>rc(_.call(y,{target:D,text:c.text}),U),U)},reply:(c,h)=>{const y=Mh();if(y)return y;const _=w()?.comments,E=_?.reply??_?.create;if(typeof E!="function")return Wn("comments.reply is unavailable.");const D=Wn("comments.reply failed.");return Ot(()=>rc(E===_?.reply?E.call(_,{parentCommentId:c,text:h.text}):E.call(_,{parentCommentId:c,text:h.text}),D),D)},edit:(c,h)=>{const y=Mh();if(y)return y;const _=w()?.comments,E=_?.patch;if(typeof E!="function")return Wn("comments.patch is unavailable.");const D=Wn("comments.patch failed.");return Ot(()=>rc(E.call(_,{commentId:c,text:h.text}),D),D)},resolve:c=>mE(c,"resolved"),reopen:c=>mE(c,"active"),delete:c=>{const h=Mh();if(h)return h;const y=w()?.comments,_=y?.delete??y?.remove;if(typeof _!="function")return Wn("comments.delete is unavailable.");const E=Wn("comments.delete failed.");return Ot(()=>rc(_.call(y,{commentId:c}),E),E)},setActive:c=>{if(c==null)return ct=null,Dt(),!0;if(!S())return!1;const h=Ed.get(),y=N.get("comments"),_=y?.token===ft()&&y.hasSettled&&Array.isArray(y.value)?y.value:null,E=_??h.items;if(!_&&h.listStatus!=="ready")return!1;const D=MH(E,c);return!D||!E.some(U=>Vr(U)===D)?!1:(ct=D,Dt(),!0)},scrollTo:async c=>{if(!w())return{success:!1,ok:!1,reason:S()?lt.documentApiUnavailable:lt.notReady};const h=await _g("comments",c,Ed.get().items);return h?Id(h):{success:!1,ok:!1,reason:lt.targetUnresolved}}},os=rs(c=>c.trackChanges),k2=(c,h)=>{mt();const y=(xi().value??os.get().items).map(ad).filter(Pe=>Pe!=null&&Vr(Pe)!==null);if(y.length===0)return null;const _=P.trackChanges.activeId,E=tt?.id===_?tt.story:void 0,D=y.filter(Pe=>dh(Pe)==null),U=E||D.length===0?y:D;let oe=_?U.findIndex(Pe=>ki(Pe,_,E)):-1;oe===-1&&_&&E&&(oe=U.findIndex(Pe=>ki(Pe,_)));const fe=U[oe===-1?c>0?0:U.length-1:(oe+c+U.length)%U.length],Re=Vr(fe),Fe=dh(fe);return F(Fe?{id:Re,story:Fe}:{id:Re},h),Dt(),Re},gE=async c=>{const h=T(),y=h?.listTrackedChanges;if(typeof y=="function")try{await Promise.resolve(y.call(h,{mode:"visible-window",targetIds:[c],refreshReason:"ui-track-change-reveal-restamp",blocking:!0}))}catch{}};let vE=Promise.resolve();const yG=c=>{const h=ae;return vE.catch(()=>{}).then(()=>bG(c,h))},bG=async(c,h)=>{if(ae!==h)return{success:!1};const y=tt,_=k2(c,{invalidateQueuedNavigation:!1});if(_==null)return{success:!1};const E=tt,D=Tt,U=()=>ae===h&&tt===E&&Tt===D,oe=()=>{U()&&(F(y,{invalidateQueuedNavigation:!1}),Dt())};E&&Ue.add(E);try{const fe=await _g("trackChanges",_,os.get().items,E?.story?{story:E.story}:void 0);if(!U())return{success:!1};if(!fe)return oe(),{success:!1};const Re=os.get().items.find(Pe=>ki(Pe,_,E?.story))??os.get().items.find(Pe=>Vr(Pe)===_),Fe=hE(Re);rt+=1;try{const Pe=await pE(_,fe,E?.story,Fe,{behavior:"auto",shouldContinue:U});if(!U())return{success:!1};if(!Pe.ok&&Pe.reason!==lt.targetNotVisible)oe(),se(y);else{if(Pe.ok&&await gE(_),!U())return{success:!1};se(E)}return{success:Pe.ok}}finally{rt=Math.max(0,rt-1),rt===0&&(U()?Zo&&xt(Ce(Zo)):se(tt))}}finally{E&&Ue.delete(E)}},yE=c=>{const h=yG(c);return vE=h.then(()=>{},()=>{}),h},Ig=Eh(os,ca(c=>vd(c.selection,c.trackChanges)),"trackChanges"),wG={get:Ig.get,getSnapshot:Ig.getSnapshot,subscribe:Ig.subscribe,observe:Ig.observe,list:()=>{mt();const c=xi().value??os.get().items,h=on(ft());return c.map(ad).filter(y=>y!=null).filter(y=>{const _=Vr(y);return!_||!h?.has(_)})},accept:c=>Lh("accept",c),acceptAsync:c=>Eg(()=>Lh("accept",c)),reject:c=>Lh("reject",c),rejectAsync:c=>Eg(()=>Lh("reject",c)),acceptAll:()=>nu("accept",{kind:"all"},null),acceptAllAsync:()=>Eg(()=>nu("accept",{kind:"all"},null)),rejectAll:()=>nu("reject",{kind:"all"},null),rejectAllAsync:()=>Eg(()=>nu("reject",{kind:"all"},null)),next:()=>k2(1),previous:()=>k2(-1),navigateNext:()=>yE(1),navigatePrevious:()=>yE(-1),getAt:c=>{if(!c||typeof c!="object"||typeof c.x!="number"||typeof c.y!="number")return null;const h=E2(c);if(h.length===0)return null;const y=os.get().items;let _;for(const E of h){if(E.type!=="trackedChange")continue;let D;if(E.story){if(_===void 0&&(_=Qr()),!_)continue;D=_}else D=y;const U=D.find(oe=>ki(oe,E.id,E.story));if(U)return E.story?{id:U.id,item:U,story:E.story}:{id:U.id,item:U}}return null},setActive:c=>{if(c==null)return F(null),se(null),Dt(),!0;if(!S())return!1;const h=typeof c=="string"?{id:c}:{id:c.id,story:c.story};if(typeof h.id!="string"||h.id.length===0)return!1;const y=h.id;if(h.story){const _=Qr();if(!_)return!1;const E=Fl(_,h.story).toPublicId(h.id)??h.id;if(!_.some(D=>ki(D,E,h.story)))return!1;h.id=E}else{const _=Qr()??os.get().items,E=Ks(_).toPublicId(h.id)??h.id,D=_.find(U=>Vr(U)===E);if(!D)return!1;h.id=E,h.story=dh(D)}return y!==h.id&&(h.paintedEntityId=y),F(h),se(h),Dt(),!0},scrollTo:async c=>{if(!w())return{success:!1,ok:!1,reason:S()?lt.documentApiUnavailable:lt.notReady};const h=typeof c=="string"?c:c.id,y=typeof c=="string"||!c.story||typeof c.story!="object"?void 0:c.story,_=y?dh({address:{story:y}}):void 0;if(typeof h!="string"||h.length===0)return{success:!1,ok:!1,reason:lt.targetUnresolved};ae+=1,Ee+=1;const E=Ee,D=y?Qr()??os.get().items:os.get().items,U=y?Fl(D,y).toPublicId(h)??h:Ks(D).toPublicId(h)??h,oe=y?D.find(Ye=>ki(Ye,U,y)):D.find(Ye=>Vr(Ye)===U),fe=y?_:dh(oe),Re=hE(oe),Fe=tt,Pe={id:U,...fe?{story:fe}:{},...U!==h?{paintedEntityId:h}:{}};Ue.add(Pe);try{const Ye=await _g("trackChanges",U,D,fe||y?{story:fe,matchStory:y}:void 0);if(Ee!==E)return{success:!1,ok:!1};if(!Ye)return{success:!1,ok:!1,reason:lt.targetUnresolved};F(Pe);const Ze=Ee,Ke=tt,We=Tt,at=()=>Ee===Ze&&tt===Ke&&Tt===We,dt=()=>{at()&&(F(Fe,{invalidateQueuedNavigation:!1}),Dt())};Dt(),rt+=1;try{const qe=await pE(U,Ye,fe,Re,{behavior:"auto",shouldContinue:at});if(!at())return{success:!1,ok:!1};if(!qe.ok&&qe.reason!==lt.targetNotVisible)dt(),se(Fe);else{if(qe.ok&&await gE(U),!at())return{success:!1,ok:!1};se(Pe)}return qe}finally{rt=Math.max(0,rt-1),rt===0&&(at()?Zo&&xt(Ce(Zo)):se(tt))}}finally{Ue.delete(Pe)}}},Lh=(c,h)=>{const{id:y,story:_}=typeof h=="string"?{id:h,story:void 0}:h;if(typeof y!="string"||y.length===0)return!1;const E={kind:"id",id:y,..._?{story:_}:{}};return nu(c,E,y,_)},Eg=c=>(No=null,Oi=Promise.resolve(!1),ee||c()===!1?Promise.resolve(!1):Oi),nu=(c,h,y,_)=>{try{return To(S2(c,h,y,_))}catch{return!1}},S2=(c,h,y,_)=>{if(Vc())return!1;const E=w()?.trackChanges,D=h.kind==="all"||h.scope==="all",U=h.kind==="range",oe=h.kind==="ids",fe=D?[]:oe&&Array.isArray(h.ids)?h.ids.filter(Ye=>typeof Ye=="string"&&Ye.length>0):y?[y]:[];if(fe.length>0&&io(c,fe)||Zl({kind:c,scope:D?"all":"id"},E))return!1;const Re=D?`${c}All`:c,Fe=!U&&!oe&&!_&&E&&typeof E[Re]=="function"?E[Re]:null,Pe=E&&typeof E.decide=="function"?E.decide:null;return!Fe&&!Pe?!1:Fe?Fe.call(E,y??{}):Pe.call(E,{decision:c,target:h})},Tg=rs(c=>c.contentControls),Dh=c=>Tg.get().items.find(h=>h?.id===c)??null,xg=Eh(Tg,ca(c=>(yo.contentControls>0&&Eo("contentControls"),c.contentControls)),"contentControls"),CG=(c=>{if(c===void 0)return xg.get();const h=fh(c);return h?Dh(h):null}),kG=Di(Tg);let _2=0,A2=null;const I2=()=>{_2+=1;const c=A2??j();A2=null,Ot(()=>c?.clearContentControlHighlight?.call(c),void 0)};Yn.push(I2);const SG={clearHighlight:I2,highlight:async c=>{const h=fh(c);if(!h)return{success:!1,reason:"invalid-id"};const y=j(),_=S(),E=w()?.contentControls;if(ee||!y||typeof y.highlightContentControl!="function"||typeof E?.list!="function")return{success:!1,reason:"not-ready"};const D=++_2;A2=y,Ot(()=>y.cancelContentControlHighlightRequest?.call(y),void 0);const U=()=>ee||D!==_2||_!==S();try{const oe=await E.list.call(E);if(U())return{success:!1,reason:"cancelled"};const fe=oe?.items?.find(Pe=>Pe.id===h);if(!fe)return{success:!1,reason:"not-found"};const Re=tg(fe);if(!Re||fe.isEmpty)return{success:!1,reason:"not-reachable"};const Fe=await y.highlightContentControl.call(y,h,Re);return U()?{success:!1,reason:"cancelled"}:Fe?{success:!0}:{success:!1,reason:"not-reachable"}}catch{return{success:!1,reason:U()?"cancelled":"not-reachable"}}},get:(c=>(c!==void 0&&ze("api"),CG(c))),getSnapshot:xg.getSnapshot,subscribe:xg.subscribe,observe:xg.observe,observeActivePath:kG.observe,list:()=>(ze("api"),Tg.get().items),getById:c=>(ze("api"),Dh(c)),getRect:c=>{const h=fh(c);if(!h)return Nl("unresolved");ze("panel");const y=Dh(h);if(!y)return Nl("unresolved");const _=tg(y);return _?Og.getRect({target:_}):Nl("unavailable")},scrollIntoView:async c=>{const h=fh(c);if(!h)return{success:!1};ze("panel");const y=Dh(h);if(!y)return{success:!1};const _=tg(y);return _?{success:(await Id(_,{block:c.block,behavior:c.behavior})).ok}:{success:!1}},focus:async c=>{const h=fh(c);if(!h)return{success:!1,reason:"invalid-id"};if(!S())return{success:!1,reason:"not-ready"};ze("panel");const y=Dh(h);if(!y)return{success:!1,reason:"not-found"};const _=tg(y);if(!_)return{success:!1,reason:"not-reachable"};if(!(await Id(_,{block:c.block,behavior:c.behavior})).ok)return{success:!1,reason:"not-reachable"};const E=_H(_);if(!E)return{success:!1,reason:"not-reachable"};const D=fE.apply(E);return!D.ok&&D.reason!==lt.hostCapabilityUnavailable?{success:!1,reason:"not-reachable"}:(hG(h),{success:!0})}},Rg=Di(rs(c=>c.fonts)),_G={get:Rg.get,getSnapshot:Rg.getSnapshot,subscribe:Rg.subscribe,observe:Rg.observe,getFamilyOptions:()=>P.fonts.options,getSizeOptions:()=>P.fonts.sizeOptions},Mg=Di(rs(c=>c.zoom)),AG={get:Mg.get,getSnapshot:Mg.getSnapshot,subscribe:Mg.subscribe,observe:Mg.observe,set:c=>{if(typeof t?.setZoom=="function")try{t.setZoom(c),Dt()}catch{}},setMode:c=>{if(typeof t?.setZoomMode=="function")try{t.setZoomMode(c),Dt()}catch{}}},Lg=Di(rs(c=>c.document)),IG={get:Lg.get,getSnapshot:Lg.getSnapshot,subscribe:Lg.subscribe,observe:Lg.observe,setMode:c=>{if(typeof t?.setDocumentMode=="function")try{t.setDocumentMode(c),Dt()}catch{}},export:c=>{if(typeof t?.export=="function")try{return Promise.resolve(t.export(c))}catch{return}},getText:()=>{const c=w(),h=Ot(c?.getText?()=>c.getText({}):void 0,null);return typeof h=="string"?h:h&&typeof h=="object"&&typeof h.text=="string"?h.text:null},replaceDocument:async c=>{const h=e.superdoc;return typeof h.replaceDocument!="function"?{ok:!1,reason:lt.operationUnavailable}:h.replaceDocument(c)},replaceFile:c=>{const h=t?.replaceFile??t?.loadDocument??t?.reload;if(typeof h=="function")try{return Promise.resolve(h.call(t,c))}catch{return}}},bE=()=>{if(typeof HTMLElement>"u")return null;const c=S()?.mount?.container;if(c instanceof HTMLElement)return c;const h=t?.element;return h instanceof HTMLElement?h:null},EG=(c,h)=>{if(typeof c!="number"||typeof h!="number"||!Number.isFinite(c)||!Number.isFinite(h))return[];const y=globalThis.document;if(!y||typeof y.elementFromPoint!="function")return[];const _=bE();if(!_)return[];const E=y.elementFromPoint(c,h);if(!E||!_.contains(E))return[];const D=[E],U=qe=>{qe&&_.contains(qe)&&!D.includes(qe)&&D.push(qe)},oe=y.elementsFromPoint;if(typeof oe=="function"){let qe=[];try{qe=oe.call(y,c,h)??[]}catch{qe=[]}for(const At of qe)U(At)}const fe=[],Re=qe=>{qe&&_.contains(qe)&&!fe.includes(qe)&&!D.includes(qe)&&fe.push(qe)},Fe=qe=>{const At=qe.getBoundingClientRect;if(typeof At!="function")return!1;let Et;try{Et=At.call(qe)}catch{return!1}return Et!=null&&c>=Et.left&&c<=Et.right&&h>=Et.top&&h<=Et.bottom};for(const qe of D){const At=qe.querySelectorAll;if(typeof At!="function")continue;let Et;try{Et=At.call(qe,"[data-track-change-marker]")}catch{continue}for(let _n=0;_n<Et.length;_n+=1)Fe(Et[_n])&&Re(Et[_n])}fe.reverse();const Pe=[...fe,...D],Ye=LI(Pe[0],_);for(let qe=1;qe<Pe.length;qe+=1)for(const At of LI(Pe[qe],_))Ye.push(At);if(Ye.length===0)return Ye;const Ze=os.get().items,Ke=Ks(Ze);let We;const at=new Set,dt=[];for(const qe of Ye){if(qe.type!=="trackedChange"){const An=`${qe.type}:${qe.id}`;if(at.has(An))continue;at.add(An),dt.push(qe);continue}const At=SH(qe.storyKey)??kH(qe.story);let Et;if(At){if(We===void 0&&(We=Qr()),!We||(Et=Fl(We,At).toPublicId(qe.id),!Et||!We.some(An=>ki(An,Et,At))))continue}else if(Et=Ke.toPublicId(qe.id),!Et)continue;const _n=`trackedChange:${Et}`;at.has(_n)||(at.add(_n),dt.push(At?{type:"trackedChange",id:Et,story:At}:{type:"trackedChange",id:Et}))}return dt};function E2(c,h){return typeof c=="object"?EG(c?.x,c?.y):null}function wE(c){const h=!!c&&typeof c.x=="number"&&typeof c.y=="number",y=h?{x:c.x,y:c.y}:{x:0,y:0};return{point:y,entities:h?E2(y):[],selection:P.selection,position:null,insideSelection:!1}}const Td=new Set;let T2=!1;const CE=c=>{const h=j();if(typeof h?.observeGeometry!="function")return;let y=!1;const _=Ot(()=>{const E=h.observeGeometry(()=>c.schedule());return y=!0,E},null);c.detach=typeof _=="function"?_:null,c.boundHost=y?h:null},Dg=c=>{if(c.detach){try{c.detach()}catch{}c.detach=null}c.boundHost=null},kE=()=>{if(T2=!1,!(ee||j()))for(const c of Td)Dg(c)},TG=()=>{if(!T2){if(T2=!0,typeof queueMicrotask=="function"){queueMicrotask(kE);return}Promise.resolve().then(kE)}},xG=()=>{const c=j();if(!c){TG();return}for(const h of Td)h.boundHost&&h.boundHost===c||(Dg(h),CE(h),h.schedule())};Sn.push(xG);const Og={getRect:c=>{const h=j(),y=h?.getTargetRects;if(typeof y=="function"){const _=Ot(()=>y.call(h,{target:c.target}),null);return _&&typeof _=="object"?_.success===!0&&Array.isArray(_.rects)?YH(qH(_.rects.filter(E=>E!=null&&typeof E=="object")),c.relativeTo):Nl(typeof _.reason=="string"?_.reason:"unresolved"):Nl("unresolved")}return Nl("unavailable")},observe:c=>{const h=[];let y=0;const _=typeof requestAnimationFrame=="function",E=()=>{if(!_){c();return}y||(y=requestAnimationFrame(()=>{y=0,c()}))},D=ca(oe=>({ready:oe.ready,selection:oe.selection,zoom:oe.zoom}));h.push(D.subscribe(()=>E()));const U={schedule:E,detach:null,boundHost:null};return CE(U),Td.add(U),()=>{Td.delete(U),Dg(U),y&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(y);for(const oe of h.splice(0))try{oe()}catch{}}},getHost:()=>bE(),entityAt:E2,contextAt:wE,scrollIntoView:async c=>{const h=c?.target;if(!h)return{success:!1};let y=null;if(h.kind==="entity"){const _=h.entityType==="comment"?"comments":"trackChanges",E=_==="comments"?Ed.get().items:os.get().items,D=h.entityType==="trackedChange"&&h.story?{story:h.story}:void 0;y=await _g(_,h.entityId,E,D)}else{const _=h,E=h,D=Array.isArray(_.segments)&&_.segments.length>0?_.segments:E.blockId&&E.range?[{blockId:E.blockId,range:E.range}]:null;if(D){const U=h.story;y={kind:"text",segments:D,...U?{story:U}:{}}}}return y?{success:(await Id(y,{block:c.block??"center",behavior:c.behavior??"smooth"})).ok}:{success:!1}}},SE=c=>{const h=(c&&typeof c=="object"?c:null)?.target;return h&&typeof h=="object"?h:null},_E=c=>`metadata:resolve:${c}`,RG=c=>{const h=w()?.metadata;if(!h||typeof h.resolve!="function")return null;const{value:y}=Zr(_E(c),ft(),()=>h.resolve({id:c}),SE);return y},MG=async c=>{const h=w()?.metadata;if(!h||typeof h.resolve!="function")return null;try{const y=ft(),_=await Promise.resolve(h.resolve({id:c}));if(y!==ft())return null;const E=SE(_);return N.set(_E(c),{token:y,value:E,hasSettled:!0,inflightToken:null}),E}catch{return null}},LG={getRect:c=>{const h=w()?.metadata;if(!h||typeof h.resolve!="function")return Nl("unavailable");const y=RG(c.id);return y?Og.getRect({target:y}):Nl("unresolved")},scrollIntoView:async c=>{const h=await MG(c.id);return h?{success:(await Id(h,{block:c.block,behavior:c.behavior})).ok}:{success:!1}}},DG={inTable:!1,tableNodeId:null,rowIndex:null,columnIndex:null,cellNodeId:null,rows:null,columns:null},OG={getContext:()=>{const c=Ne();if(!c)return{...DG};const h=Te()?.table;return{inTable:!0,tableNodeId:c.tableNodeId,rowIndex:c.rowIndex,columnIndex:c.columnIndex,cellNodeId:c.cellNodeId,rows:typeof h?.rows=="number"?h.rows:null,columns:typeof h?.columns=="number"?h.columns:null}},isInTable:()=>Ne()!=null},Pg={query:"",total:0,activeIndex:-1,open:!1,available:!1,caseSensitive:!1,includeTrackedDeletions:!1,includeDeletedText:!1,regex:!1,canReplace:!1,canReplaceAll:!1,reason:lt.searchUnavailable};let Tn={...Pg};const Fg=new Set,tl=()=>{const c=j()?.search;return c&&typeof c=="object"?c:null},Es=()=>{const c=Y()?.search;return c&&typeof c=="object"?c:null},Oh=()=>{const c=tl();if(c&&typeof c.setSession=="function")return!0;const h=Es();return!!h&&typeof h.query=="function"&&typeof h.getState=="function"},is=()=>{for(const c of[...Fg])try{c(Tn)}catch{}},pi=c=>{Tn={...Tn,...c};const h=c.includeTrackedDeletions??c.includeDeletedText;return h!==void 0&&(Tn.includeTrackedDeletions=h,Tn.includeDeletedText=h),is(),Tn};let Gr=0,xd=null,ru=null;const AE=()=>{const c=ru;ru=null,c&&Ot(()=>(c(),null),null)},PG=()=>{Gr+=1,xd=null,nl=!1,AE();const c=Oh();Tn={...Pg,available:c,reason:c?void 0:lt.searchUnavailable},is()};Yn.push(PG),eo.push(()=>{if(xd===Gr)return;const c=Tn,h=ua();(h.canReplace!==c.canReplace||h.canReplaceAll!==c.canReplaceAll||h.available!==c.available||h.reason!==c.reason)&&is()});const FG=c=>{if(!c)return!1;const h=c.queryError;if(h&&typeof h=="object"&&h.code==="invalid-pattern")return!0;const y=c.rejection;return c.status==="rejected"&&!!y&&typeof y=="object"&&y.code==="invalid-pattern"},x2=(c,h=!1,y=h)=>{const _=c&&typeof c=="object"?c:null;if(!_)return null;const E=Array.isArray(_.matches)?_.matches:[],D=typeof _.total=="number"&&Number.isFinite(_.total)?_.total:E.length,U=typeof _.activeMatchIndex=="number"?_.activeMatchIndex:typeof _.activeIndex=="number"?_.activeIndex:-1,oe=_.canReplace===!0||h;return{...typeof _.query=="string"?{query:_.query}:{},total:D,activeIndex:U,canReplace:oe,canReplaceAll:oe&&D>0&&_.truncated!==!0&&(_.canReplace===!0||y),...typeof _.caseSensitive=="boolean"?{caseSensitive:_.caseSensitive}:{},...typeof _.includeDeletedText=="boolean"?{includeDeletedText:_.includeDeletedText}:{},..._.regex===!0?{regex:!0}:{},...FG(_)?{invalidPattern:!0}:{}}};let nl=!1;const IE=()=>{if(!nl)return;nl=!1;const c=Es();c&&typeof c.query=="function"&&Ot(()=>c.query({query:""}),null)},zo=()=>_e("find.replace")?.enabled===!0,jo=()=>_e("find.replaceAll")?.enabled===!0,xo=(c,h=!1,y=h)=>{const _=x2(c,h,y);if(!_){pi({total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,reason:void 0});return}pi({..._.query!==void 0?{query:_.query}:{},total:_.total,activeIndex:_.activeIndex,canReplace:_.canReplace,canReplaceAll:_.canReplaceAll,..._.includeDeletedText!==void 0?{includeDeletedText:_.includeDeletedText}:{},..._.regex!==void 0?{regex:_.regex}:{},reason:_.invalidPattern?lt.searchInvalidPattern:void 0})},ua=()=>{const c=tl();if(c&&typeof c.getState!="function")return Tn={...Tn,available:Oh(),reason:Oh()?void 0:lt.searchUnavailable},Tn;if(!c){const y=Es();if(y&&typeof y.getState=="function"){const _=x2(Ot(()=>y.getState(),null),zo(),jo());if(xd===Gr)return Tn;if(_)return Tn={...Tn,..._.query!==void 0?{query:_.query}:{},total:_.total,activeIndex:_.activeIndex,canReplace:_.canReplace,canReplaceAll:_.canReplaceAll,available:!0,reason:_.invalidPattern?lt.searchInvalidPattern:void 0,open:Tn.open||!!_.query},Tn}return Tn={...Pg,query:Tn.query,caseSensitive:Tn.caseSensitive,includeTrackedDeletions:Tn.includeTrackedDeletions,includeDeletedText:Tn.includeDeletedText},Tn}const h=x2(Ot(()=>c.getState(),null));return h&&(Tn={...Tn,...h.query!==void 0?{query:h.query}:{},total:h.total,activeIndex:h.activeIndex,canReplace:h.canReplace,canReplaceAll:h.canReplaceAll,...h.includeDeletedText!==void 0?{includeDeletedText:h.includeDeletedText}:{},...h.includeDeletedText!==void 0?{includeTrackedDeletions:h.includeDeletedText}:{},...h.regex!==void 0?{regex:h.regex}:{},available:!0,reason:h.invalidPattern?lt.searchInvalidPattern:void 0,open:Tn.open||!!h.query}),Tn},Rd=c=>{const h=c&&typeof c=="object"?c:null;if(h?.status==="committed")return{ok:!0};if(h?.status==="rejected"&&h.reason==="read-only")return{ok:!1,reason:lt.documentReadonly};const y=h?.rejection;return h?.status==="rejected"&&y&&typeof y=="object"&&y.code==="read-only-document"?{ok:!1,reason:lt.documentReadonly}:{ok:!1,reason:lt.operationUnavailable}},Ng=Di({get:()=>ua(),subscribe:c=>(Fg.add(c),()=>Fg.delete(c))}),EE={get:Ng.get,getSnapshot:Ng.getSnapshot,subscribe:Ng.subscribe,observe:Ng.observe,open:()=>Oh()?(pi({available:!0,open:!0,reason:void 0}),{ok:!0}):(pi({available:!1,open:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}),close:()=>{if(Gr+=1,ru)AE();else{const c=tl();if(c&&typeof c.clear=="function")Ot(()=>c.clear(),null);else{const h=Es();h&&typeof h.query=="function"&&Ot(()=>h.query({query:""}),null)}}Tn={...Pg,available:Oh(),reason:void 0},Tn.available||(Tn.reason=lt.searchUnavailable),is()},find:(c,h)=>{const y=tl(),_=!!h?.caseSensitive,E=(h?.includeTrackedDeletions??h?.includeDeletedText)===!0,D=h?.regex===!0,U=++Gr;if(IE(),!y||typeof y.setSession!="function"){const fe=Es();if(fe&&typeof fe.query=="function"&&typeof fe.getState=="function"){xd=U,pi({query:c,caseSensitive:_,includeDeletedText:E,regex:D,total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,available:!0,open:!0,reason:void 0}),ru=()=>{fe.query({query:""})};const Re=Ot(()=>fe.query({query:c,caseSensitive:_,includeDeletedText:E,regex:D}),null);return Lr(Re)?(nl=!0,Promise.resolve(Re).then(Fe=>{U===Gr&&(nl=!1,xd=null,xo(Fe,zo(),jo()))},()=>{U===Gr&&(nl=!1,pi({available:!1,reason:lt.searchUnavailable}))}),Tn):(xd=null,xo(Re,zo(),jo()),xo(Ot(()=>fe.getState(),null),zo(),jo()),Tn)}return pi({query:c,total:0,activeIndex:-1,available:!1,caseSensitive:_,includeDeletedText:E,regex:D,reason:lt.searchUnavailable})}pi({query:c,caseSensitive:_,includeDeletedText:E,regex:D,available:!0,open:!0,reason:void 0}),ru=()=>{typeof y.clear=="function"&&y.clear()};const oe=Ot(()=>y.setSession(c,{caseSensitive:_,includeDeletedText:E,...D?{regex:!0}:{},highlight:!0}),null);if(xo(oe),c.length>0&&Tn.total===0&&Tn.reason!==lt.searchInvalidPattern){const fe=Es();if(fe&&typeof fe.query=="function"&&typeof fe.getState=="function"){const Re=ru;ru=()=>{Re?.(),fe.query({query:""})};const Fe=Ot(()=>fe.query({query:c,caseSensitive:_,includeDeletedText:E,regex:D}),null);Lr(Fe)?(nl=!0,Promise.resolve(Fe).then(Pe=>{U===Gr&&(nl=!1,xo(Pe,zo(),jo()))},()=>{U===Gr&&(nl=!1,pi({available:!1,reason:lt.searchUnavailable}))})):xo(Fe,zo(),jo()),xo(Ot(()=>fe.getState(),null),zo(),jo())}}return Tn},search:(c,h)=>EE.find(c,h),next:()=>{const c=tl();if(!c||typeof c.next!="function"){const h=Es();if(!h||typeof h.next!="function"||typeof h.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Tn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Ot(()=>h.next(),null);if(Lr(y)){const _=Gr;Promise.resolve(y).then(E=>{_===Gr&&xo(E,zo(),jo())}).catch(()=>{_===Gr&&pi({available:!1,reason:lt.searchUnavailable})})}else xo(y,zo(),jo());return xo(Ot(()=>h.getState(),null),zo(),jo()),{ok:!0}}return Tn.total===0?{ok:!1,reason:lt.operationUnavailable}:(xo(Ot(()=>c.next(),null)),{ok:!0})},previous:()=>{const c=tl();if(!c||typeof c.previous!="function"){const h=Es();if(!h||typeof h.previous!="function"||typeof h.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Tn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Ot(()=>h.previous(),null);if(Lr(y)){const _=Gr;Promise.resolve(y).then(E=>{_===Gr&&xo(E,zo(),jo())}).catch(()=>{_===Gr&&pi({available:!1,reason:lt.searchUnavailable})})}else xo(y,zo(),jo());return xo(Ot(()=>h.getState(),null),zo(),jo()),{ok:!0}}return Tn.total===0?{ok:!1,reason:lt.operationUnavailable}:(xo(Ot(()=>c.previous(),null)),{ok:!0})},clear:()=>{Gr+=1,IE();const c=tl();if(c&&typeof c.clear=="function"&&Ot(()=>c.clear(),null),!c||typeof c.clear!="function"){const h=Es();h&&typeof h.query=="function"&&Ot(()=>h.query({query:""}),null)}pi({query:"",total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,reason:void 0})},replace:c=>{const h=tl();if(!h){const _=Es();if(!_||typeof _.replace!="function"||typeof _.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!zo())return{ok:!1,reason:lt.operationUnavailable};const E=Ot(()=>_.replace({replacement:typeof c=="string"?c:""}),null);if(Lr(E)){const D=Gr;ua(),is();const U=()=>D===Gr;return Promise.resolve(E).then(oe=>(U()&&(xo(oe,zo(),jo()),ua(),is()),Rd(oe)),()=>(U()&&pi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return ua(),is(),Rd(E)}if(typeof h.replaceCurrent!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Ot(()=>h.replaceCurrent(typeof c=="string"?c:""),null);return ua(),is(),Rd(y)},replaceAll:c=>{const h=tl();if(!h){const _=Es();if(!_||typeof _.replaceAll!="function"||typeof _.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!jo())return{ok:!1,reason:lt.operationUnavailable};const E=Ot(()=>_.replaceAll({replacement:typeof c=="string"?c:""}),null);if(Lr(E)){const D=Gr;ua(),is();const U=()=>D===Gr;return Promise.resolve(E).then(oe=>(U()&&(xo(oe,zo(),jo()),ua(),is()),Rd(oe)),()=>(U()&&pi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return ua(),is(),Rd(E)}if(typeof h.replaceAll!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Ot(()=>h.replaceAll(typeof c=="string"?c:""),null);return ua(),is(),Rd(y)}},TE=rs(c=>c.styles),Bg=Di(TE),NG={get:Bg.get,getSnapshot:Bg.getSnapshot,subscribe:Bg.subscribe,observe:Bg.observe,getCatalog:c=>(Eo(Cr(c)),Ri(c).value),getQuickGallery:()=>TE.get().quickGallery,getActiveParagraphStyle:()=>Mi(P.selection,Qa().cache).style},xE={select:ca,get state(){return P},selection:fE,commands:pG,toolbar:mG,comments:vG,trackChanges:wG,contentControls:SG,fonts:_G,zoom:AG,document:IG,viewport:Og,metadata:LG,tables:OG,search:EE,contextMenu:C,styles:NG,formatPainter:{setPointerSelecting(c){ee||(p={...p,pointerSelecting:c})},notifyPointerUp(){ee||(p={...p,pointerSelecting:!1},lE())},setKeyboardSelecting(c){ee||(p={...p,keyboardSelecting:c})},notifyKeyUp(){ee||(p={...p,keyboardSelecting:!1},lE())},cancel(){ee||wg()},onModeChange(c){return ee?()=>{}:(m.add(c),()=>m.delete(c))}},createScope:()=>{const c=[];return{select:(h,y)=>{const _=ca(h,y);return{get:_.get,subscribe:E=>{const D=_.subscribe(E);return c.push(D),D}}},dispose:()=>{for(const h of c.splice(0))h()}}},destroy:()=>{if(!ee){I2(),ee=!0,fH(Ar,et),it&&(clearTimeout(it),it=null),Le&&(clearTimeout(Le),Le=null,Xe=0),Se?.timer&&(clearTimeout(Se.timer),Se.timer=null),Se=null,Mt&&(clearTimeout(Mt),Mt=null),oo&&(clearTimeout(oo),oo=null),qn&&qn(),qn=null,Fo=null;for(const c of Object.keys(yo))yo[c]=0;Io.clear(),Wo.clear(),_i.clear(),Ai=null,B.clear();for(const c of lg.splice(0))c();fi&&fi(),fi=null,Ss=null,Xo&&Xo(),Xo=null,Yo=null,hi&&hi(),hi=null,_s=null,ts&&ts(),ts=null,Zo=null,Li&&Li(),Li=null,la=null,Qo&&Qo(),Qo=null,tc=null;for(const c of Td)Dg(c);Td.clear(),q.clear(),Fg.clear(),g+=1,m.clear(),Gr+=1,Je.clear()}}};return be=xE,xE}var r$=[{value:"Arial",label:"Arial",previewFamily:"Arial, sans-serif"},{value:"Calibri",label:"Calibri",previewFamily:"Calibri, sans-serif"},{value:"Courier New",label:"Courier New",previewFamily:'"Courier New", monospace'},{value:"Georgia",label:"Georgia",previewFamily:"Georgia, serif"},{value:"Times New Roman",label:"Times New Roman",previewFamily:'"Times New Roman", serif'},{value:"Verdana",label:"Verdana",previewFamily:"Verdana, sans-serif"}];function o$(e){const t=e.trim(),n=t[0];if(n==='"'||n==="'"){const o=t.indexOf(n,1);if(o>0)return t.slice(1,o).trim()}const r=t.indexOf(",");return(r===-1?t:t.slice(0,r)).trim().replace(/^["']|["']$/g,"")}function i$(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.logicalFamily=="string"?o$(r.logicalFamily):"";if(!o)continue;const i=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:o,previewFamily:i})}return t}function s$(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.value=="string"?r.value.trim():"";if(!o)continue;const i=typeof r.label=="string"&&r.label.trim()?r.label.trim():o,s=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:i,previewFamily:s})}return t}function a$(e,t=[]){const n=[],r=new Set,o=s=>{const a=String(s.value).trim().toLowerCase();!a||r.has(a)||(r.add(a),n.push(s))};for(const s of e)o(s);const i=t.length?t:r$;for(const s of i)o(s);return n}var l$=[{value:"8",label:"8"},{value:"9",label:"9"},{value:"10",label:"10"},{value:"11",label:"11"},{value:"12",label:"12"},{value:"14",label:"14"},{value:"16",label:"16"},{value:"18",label:"18"},{value:"24",label:"24"},{value:"36",label:"36"}];function c$(e,t){return e.activeMark?t.activeMarks.includes(e.activeMark):!1}Ft();var u$=['[data-sdt-type="structuredContent"][data-sdt-id]','[data-sdt-type="structuredContent"][data-sdt-container-id]','[data-sdt-container-type="structuredContent"][data-sdt-container-id]'].join(", "),d$=800,qI=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,YI=e=>{if(!qI)return!1;try{return qI.call(e),!0}catch{return!1}};function f$(e){return e.key==="Alt"||e.key==="Control"||e.key==="Meta"||e.key==="Shift"||(e.ctrlKey||e.metaKey)&&e.shiftKey&&!e.altKey&&(e.code==="Digit8"||e.key==="8"||e.key==="*")?!0:(e.ctrlKey||e.metaKey)&&["b","c","f","i","s","u"].includes(e.key.toLowerCase())}var h$=Object.freeze(["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F","#BB8FCE","#85C1E2","#F1948A","#82E0AA","#F8C471","#AED6F1","#D7BDE2","#A3E4D7","#F0B27A","#AEB6BF","#E74C3C","#2ECC71","#3498DB","#E67E22","#1ABC9C","#9B59B6","#34495E","#F39C12"]),p$=["original","markup","final"],m$=["review","original","final","off"];function XI(e){return p$.includes(e)}function g$(e){return e==="markup"?"review":e}function ZI(e){return m$.includes(e)}function v$(e){const t=e.modules?.trackChanges?.mode;if(ZI(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return ZI(n)?n:null}function ig(e,t){const n=e.viewing,r=XI(n?.trackedChanges)?n.trackedChanges:null,o=r?g$(r):t||(e.trackChanges?.visible===!0?"review":"original");return{comments:typeof n?.comments=="boolean"?n.comments:e.comments?.visible===!0,renderMode:o,trackChangesVisible:r?r==="markup":e.trackChanges?.visible===!0}}async function y$(e,t){const n=new tx.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function v2(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function QI(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function b$(e,t){if(!e)return()=>{};if(v2(e))return t(),()=>{};const n=typeof e.on=="function"?e.on.bind(e):null,r=typeof e.off=="function"?e.off.bind(e):null;if(!n)return t(),()=>{};let o=!1;const i=()=>{o||(o=!0,r?.("synced",a),r?.("sync",l))},s=()=>{o||(i(),t())},a=()=>{QI(e),s()},l=u=>{u!==!1&&(u===!0||v2(e))&&(QI(e),s())};return n("synced",a),n("sync",l),v2(e)&&s(),i}function w$(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(u$));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(Op.BLOCK_SDT_LABEL)),i=r.getAttribute("data-sdt-container-id")?.trim()||null,s=r.getAttribute("data-sdt-id")?.trim()||null;return o?i??s:s??i}function C$(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function JI(e){if(!e||typeof e.id!="string"||e.kind!=="inline"&&e.kind!=="block"||typeof e.controlType!="string")return null;const t=e.properties?.tag,n=e.properties?.alias;return{id:e.id,controlType:e.controlType,scope:e.kind,...typeof t=="string"&&t?{tag:t}:{},...typeof n=="string"&&n?{alias:n}:{}}}function eE(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function Go(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function tE(e){return typeof e=="string"&&e.length>0?e:null}function nE(e){return e?Go(e)?tE(e.documentId??e.options?.documentId??null):tE(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function k$(e){if(!e||Go(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function bs(e){if(!e)return null;if(Go(e))return e.fonts??null;const t=k$(e);return t?{getReport:()=>t.getFontReport?.()??[],getMissingFonts:()=>t.getMissingFonts?.()??[],getDocumentFonts:()=>[...new Set((t.getFontReport?.()??[]).map(n=>n.logicalFamily))],getDocumentFontOptions:()=>t.getDocumentFontOptions?.()??[],getFontFamilyOptions:()=>t.getFontFamilyOptions?.()??[],getLastFontsChangedPayload:()=>t.getLastFontsChangedPayload?.()??null,map:n=>t.mapFonts(n),unmap:n=>t.unmapFonts(n),add:n=>t.addFonts(Array.isArray(n)?n:[n]),preload:n=>t.preloadFonts(n)}:null}var sg=class extends jg.default{static{this.allowedTypes=[Sr,Ea,Iu]}#e;#n;#t;#r;#i;#a;#u;#h;#l;#f;#v;#o;#s;#p;#w;#k;#y;#A;#I;#L;#R;#b;#C;get uiConfig(){return this.#C}#E;get interactionConfig(){return this.#E}#x;get surfacesConfig(){return this.#x}#_;#d;#m;#D;#T;constructor(e){if(super(),this.#e=!1,this.#t=!1,this.#r=null,this.#i=null,this.#a=null,this.#u=null,this.#h=null,this.#l=null,this.#f=null,this.#v=!1,this.#o=!1,this.#s=null,this.#p=null,this.#w=!1,this.#k=null,this.#y=null,this.#A=n=>{this.listenerCount("content-control:active-change")>0&&(this.#w||(this.#k=n.pointerId),this.#w=!0,this.#s="pointer",this.#p=null)},this.#I=n=>{n.pointerId===this.#k&&(this.#w=!1,this.#k=null,this.#s??="pointer",this.#s==="pointer"&&(this.#p=Date.now()+d$))},this.#L=n=>{this.listenerCount("content-control:active-change")>0&&!f$(n)&&(this.#s="keyboard",this.#p=null)},this.#R=n=>{this.#Y(n)},this.#b=null,this.#C=iI({}),this.#E=sI({}),this.#x=lI({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#d=new cj,this.#m=null,this.#D=!1,this.#T=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...Zb},layoutEngineOptions:{},modules:{},licenseKey:void 0,telemetry:{enabled:!0},title:"SuperDoc",conversations:[],isInternal:!1,comments:{visible:!1},toolbarGroups:["left","center","right"],toolbarIcons:{},toolbarTexts:{},uiDisplayFallbackFont:"Arial, Helvetica, sans-serif",isDev:!1,disablePiniaDevtools:!1,onEditorBeforeCreate:()=>null,onEditorCreate:()=>null,onEditorDestroy:()=>null,onSourceComplete:()=>null,onSourceSignalsComplete:()=>null,onContentError:()=>null,onReady:()=>null,onCommentsUpdate:()=>null,onContentControlActiveChange:()=>null,onContentControlClick:()=>null,onAwarenessUpdate:()=>null,onLocked:()=>null,onPdfDocumentReady:()=>null,onSidebarToggle:()=>null,onCollaborationReady:()=>null,onEditorUpdate:()=>null,onCommentsListChange:()=>null,onException:()=>null,onListDefinitionsChange:()=>null,onPaginationUpdate:()=>null,onTransaction:()=>null,disableContextMenu:!1,viewOptions:{layout:"print"},useLayoutEngine:!0},this.#te=new WeakSet,this.#ne=new WeakMap,this.#re=null,this.#W=null,this.#B=null,!e.selector)throw new Error("SuperDoc: selector is required");const t=typeof e.selector=="string"?document.querySelector(e.selector):e.selector;if(!(t instanceof HTMLElement))throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");this.#n=ZE(this,e,()=>this.version,t),this.#_=new Dz({getModuleConfig:()=>this.#x}),this.#l=t,t.addEventListener("pointerdown",this.#A,!0),t.ownerDocument.addEventListener("pointerup",this.#I,!0),t.ownerDocument.addEventListener("pointercancel",this.#I,!0),t.addEventListener("keydown",this.#L,!0),t.addEventListener("click",this.#R,!0),this.#c("content-control:active-change",e.onContentControlActiveChange),this.#z(e,t),this.#o=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#Y(e){const t=this.#l;if(!t)return;const n=w$(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=JI(C$(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#z(e,t){this.#T=v$(e),this.config={...this.config,...e,modules:{...this.config.modules,...e.modules},layoutEngineOptions:{...this.config.layoutEngineOptions,...e.layoutEngineOptions}},typeof this.config.viewing?.comments=="boolean"&&(this.config.comments={...this.config.comments,visible:this.config.viewing.comments}),!this.config.comments||typeof this.config.comments!="object"?this.config.comments={visible:!1}:typeof this.config.comments.visible!="boolean"&&(this.config.comments.visible=!1),Xb(this.config),this.config.documents=this.config.documents||[],this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};const n=this.config.viewOptions?.layout==="web",r=this.config.layoutEngineOptions?.flowMode==="semantic";if(!n&&r&&(console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'."),this.config.layoutEngineOptions.flowMode="paginated"),this.editorVersion=2,this.#Pe(),this.config.user=Gz(this.config.user),this.config.layoutEngineOptions.virtualization||(this.config.layoutEngineOptions.virtualization={enabled:!0,window:5,overscan:1}),this.config.modules=this.config.modules||{},Object.prototype.hasOwnProperty.call(this.config.modules,"comments")||(this.config.modules.comments={}),this.config.modules.comments=GS(this.config.modules.comments),this.#C=iI(this.config),this.#E=sI(this.config),this.#x=lI(this.config),this.config.disableContextMenu=!this.#C.contextMenu.enabled,this.config.rulers=this.#C.ruler.enabled,this.#C.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#C.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&(i.readOnly=this.#E.comments.readOnly,i.allowResolve=this.#E.comments.allowResolve)}if(this.config.colors=cx(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.18.0-next.5",this.#oe("🦋 [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||ol(),this.colors=this.config.colors??[],this.#M(),await x7(),this.#e)return;if(await this.#Z(this.config.modules),this.#e){this.#ye();return}this.user=this.config.user,this.users=this.config.users||[],this.socket=null,this.isDev=this.config.isDev||!1,this.activeEditor=null,this.comments=[],this.#m||(this.#m=this.#d.subscribe(i=>{this.#Ne(i.nextRuntimeId,i.legacyEditorProjection)})),this.isLocked=this.config.isLocked||!1,this.lockedBy=this.config.lockedBy||null;const o=document.createElement("div");o.style.display="contents",t.appendChild(o),this.#h=o,this.#V(),this.#X(),this.#Be(),this.#O()}#O(){if(this.#j(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#h)}#X(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new iN({Renderer:Rz,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#g("requiredNumberOfEditors").documents.filter(e=>e.type===Sr).length}get ui(){return this.#b||(this.#b=n$({superdoc:this}),this.#e&&this.#b.destroy()),this.#S(),this.#b}get diagnostics(){return this.#n}emit(e,...t){return(e==="exception"||e==="document-replaced"||e==="ready"||e==="active-editor-change"||e==="collaboration-ready"||e==="locked")&&Od(this,e,()=>t[0]),super.emit(e,...t)}on(e,t,n){return super.on(e,t,n),e==="content-control:active-change"&&this.#o&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#o&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#o&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#P(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#P(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#P(),this}#P(){this.listenerCount("content-control:active-change")>0||(this.#f?.(),this.#f=null,this.#y=null,this.#s=null,this.#p=null,this.#w=!1,this.#k=null)}#S(){if(this.#f||this.#v||!this.#b||this.#e||this.listenerCount("content-control:active-change")===0)return;let e=null,t=[],n=null,r=null,o=!0;this.#v=!0;try{n=this.#b.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=eE(s);if(!a)return;this.#s==="pointer"&&this.#p!==null&&Date.now()>this.#p&&(this.#s=null,this.#p=null);const l=this.#s??(this.#w?"pointer":null),u=this.activeEditor;(l||this.#y?.editor!==u||this.#y.key!==a)&&(this.#y={editor:u,key:a,source:l??"keyboard"}),this.#s=null,this.#p=null}),r=this.#b.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>JI(s.items.find(k=>k.id===v)));if(l.some(v=>v===null))return;const u=l,d=a===e,f=u.length===t.length&&u.every((v,k)=>v.id===t[k]?.id);if(d&&f)return;if(u.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=u;const g=eE(this.#b.selection.getSnapshot()),m=this.#y;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:g&&m?.editor===a&&m.key===g?m.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#f=i}catch(i){throw n?.(),r?.(),i}finally{this.#v=!1}}get state(){return{documents:this.#g("state").documents.map(e=>bl(e.data)?{...e,data:Zy(e.data,e.type||"application/vnd.openxmlformats-officedocument.wordprocessingml.document")}:e),users:this.users}}getDocumentRuntimeForDocument(e){return typeof e!="string"||e.length===0?null:(this.superdocStore?.documents??[]).find(t=>t?.getEditor?.()?.options?.documentId===e)?.getDocumentRuntime?.()??null}getComment(e){return typeof e!="string"||e.length===0?null:this.commentsStore?.getComment?.(e)??null}get element(){return typeof this.config.selector=="string"?document.querySelector(this.config.selector):this.config.selector}#M(){const e=this.config.document,t=!!e&&typeof e=="object"&&(bl(e)||typeof Blob=="function"&&e instanceof Blob||Object.keys(e).length>0),n=typeof e=="string"&&e.length>0,r=this.config.documents&&this.config.documents?.length;if((t||n)&&r&&console.warn("🦋 [superdoc] You can only provide one of document or documents"),t){const o=Jy(e);this.config.documents=[{id:ol(),...o}]}else n&&(this.config.documents=[{id:ol(),type:Sr,url:this.config.document,name:"document.docx"}]);Array.isArray(this.config.documents)&&this.config.documents.length>0&&(this.config.documents=this.config.documents.map(o=>{const i=Jy(o);if(!i||typeof i!="object")return i;const s=typeof i=="object"&&"id"in i&&i.id||o&&typeof o=="object"&&"id"in o&&o.id;return{...i,id:s||ol()}}))}#j(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=WF({disablePiniaDevtools:!!this.config.disablePiniaDevtools});this.app=e,this.pinia=t,this.app.config.globalProperties.$config=this.config,this.app.config.globalProperties.$documentMode=this.config.documentMode,this.app.config.globalProperties.$superdoc=this,this.app.provide("surfaceManager",this.#_),this.superdocStore=n,this.commentsStore=r,this.highContrastModeStore=o,typeof this.superdocStore.setExceptionHandler=="function"&&this.superdocStore.setExceptionHandler(s=>this.emit("exception",s)),this.superdocStore.init(this.config);const i=this.config.modules.comments;this.commentsStore.init(i||{}),this.isCollaborative&&p7(this),this.#ae()}#c(e,t){t&&this.on(e,t)}#V(){this.#c("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#c("editorCreate",this.config.onEditorCreate),this.#c("editorDestroy",this.config.onEditorDestroy),this.#c("source:complete",this.config.onSourceComplete),this.#c("source:signals-complete",this.config.onSourceSignalsComplete),this.#c("ready",this.config.onReady),this.#c("comments-update",this.config.onCommentsUpdate),this.#c("content-control:click",this.config.onContentControlClick),this.#c("awareness-update",this.config.onAwarenessUpdate),this.#c("locked",this.config.onLocked),this.#c("pdf:document-ready",this.config.onPdfDocumentReady),this.#c("sidebar-toggle",this.config.onSidebarToggle),this.#c("collaboration-ready",this.config.onCollaborationReady),this.on("collaboration-ready",e=>this.#J(e?.editor??null)),this.#c("editor-update",this.config.onEditorUpdate),this.#c("tracked-changes:bulk-decision",this.config.onTrackedChangesBulkDecision),this.on("content-error",this.onContentError),this.#c("exception",this.config.onException),this.#c("list-definitions-change",this.config.onListDefinitionsChange),this.#c("pagination-update",this.config.onPaginationUpdate),this.#c("fonts-resolved",this.config.onFontsResolved),this.#c("fonts-changed",this.config.onFontsChanged),this.#c("zoomChange",this.config.onZoomChange),this.#c("viewport-change",this.config.onViewportChange),this.#c("page-margins-change",this.config.onPageMarginsChange)}async#Z({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:ol(),type:Sr,name:"document.docx"}]),this.config.v2CollaborationPreflightFailure={code:"collaboration-v1-config-unsupported",message:"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.v2Collaboration with a v2 room instead."},this.config.documents):this.config.documents}#le(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=Wr(e),this.provider=Wr(t),this.#Ce();const n=this.config;this._cleanupAwareness=c7(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#Q(){this.#u=null,this.#F(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null),this.isCollaborative=!1,this._commentsCollabInitialized=!1,this.ydoc=void 0,this.provider=void 0;const e=this.config;delete e.modules.collaboration,e.documents.forEach(t=>{delete t.ydoc,delete t.provider})}#F(){if(this.#i){try{this.#i()}catch{}this.#i=null}if(this.#a){try{this.#a()}catch{}this.#a=null}}#J(e){this.#F(),Go(e)&&(this.#ee(e),this.#be(e))}#ee(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=tN(()=>this.user),r=o=>{if(this.#e)return;const i=n.next(o);this.emit("awareness-update",{...i,superdoc:this})};try{const o=t.getSnapshot?.();o&&r(o),this.#i=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#be(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#U(!!r.isLocked,this.#ce(r.lockedBy??null))};try{if(this.#u&&typeof t.setLocked=="function"){const o=this.#u;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#u=null}const r=t.getSnapshot?.();r&&n(r),this.#a=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#ce(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#we(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#U(e,t){this.isLocked===e&&this.#we(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#oe("🦋 [superdoc] Locking superdoc:",e,t,`
|
|
102
|
+
`;Ft();var Ws=e=>{e.expand.value=!1},o2=(e,t)=>{const n=e.layoutWidth?.value;return Number.isFinite(n)&&n>0?n:e.type==="separator"?t.get("separator"):t.get(e.name.value)||t.get("default")};function i2(e,t){const n={...e};return t?n.href=t:delete n.href,n}function II(e){const t=Array.isArray(e?.segments)?e.segments:[];if(e?.kind!=="text"||!t.length)return null;const n=t[0],r=t[t.length-1];if(!n?.blockId||!r?.blockId||!n.range||!r.range)return null;const o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start??0,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end??0,...o?{story:o}:{}},...o?{story:o}:{}}}function zU(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function EI(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function jU(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function VU(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var UU=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,excludedItemNames:u,additionalItems:d=[]}={})=>{const f=Mn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),p=(r??OV).map(VV),g=Mn({type:"dropdown",name:"fontFamily",tooltip:n.fontFamily,command:"setFontFamily",defaultLabel:"Arial",label:"Arial",markName:"textStyle",labelAttr:"fontFamily",hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,isWide:!0,style:{width:"116px"},suppressActiveHighlight:!0,attributes:{ariaLabel:"Font family"},options:p,onActivate:({fontFamily:et}={},kt=!1)=>{if(kt){g.label.value="",g.selectedValue.value="";return}if(!et)return;et=et.split(",")[0];const Bt=nn=>nn.value??nn.label,cn=p.find(nn=>Bt(nn)===g.defaultLabel.value),fn=p.find(nn=>Bt(nn)===et);fn?(g.label.value=fn.label,g.selectedValue.value=fn.key):cn?(g.label.value=et,g.selectedValue.value=cn.key):(g.label.value=et,g.selectedValue.value="")},onDeactivate:()=>{const et=p.find(kt=>(kt.value??kt.label)===g.defaultLabel.value);g.label.value=et?.label??g.defaultLabel.value,g.selectedValue.value=et?.key??""}}),m=Mn({type:"dropdown",name:"ai",dropdownStyles:{padding:0,outline:"none"},tooltip:n.ai,icon:t.ai,hideLabel:!0,hasCaret:!1,isWide:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:"AI"},options:[{type:"render",key:"ai",render:()=>v(m)}]});function v(et){const kt=EI(e),Bt=kt?.selectionTarget??II(kt?.target),cn=kt?.empty?"":zU(kt),fn=VU(e),nn=()=>Ws(et),wn=()=>{const Qt=e.pendingSelectionCapture;Qt&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Qt)};return zr("div",{},[zr(pU,{handleClose:nn,selectedText:cn,target:Bt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:fn?.apiKey||e.config?.aiApiKey||"",endpoint:fn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:wn})])}const k=FV,b=Mn({type:"dropdown",name:"fontSize",defaultLabel:"12",label:"12",style:{width:"56px"},markName:"textStyle",labelAttr:"fontSize",tooltip:n.fontSize,hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,suppressActiveHighlight:!0,isWide:!0,command:"setFontSize",attributes:{ariaLabel:"Font size"},options:k,onActivate:({fontSize:et},kt=!1)=>{if(kt){b.label.value="",b.selectedValue.value="";return}const Bt=k.find(wn=>wn.label===String(b.defaultLabel.value));if(!et){b.label.value=b.defaultLabel.value,Bt?b.selectedValue.value=Bt.key:b.selectedValue.value="";return}let cn=xj(et,12);cn<8&&(cn=8),cn>96&&(cn=96);let fn=String(cn);const nn=k.find(wn=>wn.label===fn||wn.key===fn);nn?b.selectedValue.value=nn.key:b.selectedValue.value="",b.label.value=fn},onDeactivate:()=>{b.label.value=b.defaultLabel.value;const et=k.find(kt=>kt.label===String(b.defaultLabel.value));et?b.selectedValue.value=et.key:b.selectedValue.value=""}}),S=()=>Mn({type:"separator",name:"separator",isNarrow:!0}),C=Mn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),w=Mn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),T=Mn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),L=Mn({type:"dropdown",name:"highlight",icon:t.highlight,hideLabel:!0,markName:"highlight",labelAttr:"color",active:!1,tooltip:n.highlight,command:"setHighlight",noArgumentCommand:"unsetHighlight",suppressActiveHighlight:!0,attributes:{ariaLabel:"Highlight"},options:[{key:"color",type:"render",render:()=>r2(e,L,[],!0)}],onActivate:({color:et})=>{L.iconColor.value=et||""},onDeactivate:()=>L.iconColor.value=""}),z=Mn({type:"dropdown",name:"color",icon:t.color,hideLabel:!0,markName:"textStyle",labelAttr:"color",active:!1,tooltip:n.color,command:"setColor",suppressActiveHighlight:!0,attributes:{ariaLabel:"Color"},options:[{key:"color",type:"render",render:()=>r2(e,z)}],onActivate:({color:et})=>{z.iconColor.value=et},onDeactivate:()=>z.iconColor.value="#000"}),W=Mn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),V=Mn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>j(V)}],onActivate:({href:et})=>{V.attributes.value=i2(V.attributes.value,et)},onDeactivate:()=>{V.attributes.value=i2(V.attributes.value,null),V.expand.value=!1}});function j(et){const kt=EI(e),Bt=kt?.selectionTarget??II(kt?.target),cn=()=>{const fn=e.pendingSelectionCapture;fn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(fn)};return zr("div",{},[zr(U_,{ui:e.ui,linkItem:et,textTarget:Bt,restoreSelection:cn,closePopover:()=>{Ws(et),Lc(e)},goToAnchor:()=>{Ws(et);const fn=et.attributes.value?.href;if(!fn)return;const nn=fn.slice(1),wn=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${nn}']`);wn&&H_(wn)}})])}const Z=Mn({type:"options",name:"linkInput",command:"toggleLink",active:!1});V.childItem=Z,Z.parentItem=V;const R=Mn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),K=Mn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),x=Mn({type:"dropdown",name:"table",icon:t.table,hideLabel:!0,labelAttr:"table",active:!1,tooltip:n.table,command:"insertTable",suppressActiveHighlight:!0,attributes:{ariaLabel:"Table"},options:[{key:"table",type:"render",render:()=>$(x)}]});function $(et){return zr("div",{},[zr(RU,{onSelect:Bt=>{e.emitCommand({item:et,argument:Bt}),Ws(et),Lc(e)}})])}const H=Mn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>Q(H)}]}),J=[{label:n.addRowBefore,command:"addRowBefore",icon:t.addRowBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row before"}},{label:n.addRowAfter,command:"addRowAfter",icon:t.addRowAfter,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row after"}},{label:n.addColumnBefore,command:"addColumnBefore",icon:t.addColumnBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column before"}},{label:n.addColumnAfter,command:"addColumnAfter",icon:t.addColumnAfter,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column after"}},{label:n.deleteRow,command:"deleteRow",icon:t.deleteRow,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete row"}},{label:n.deleteColumn,command:"deleteColumn",icon:t.deleteColumn,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete column"}},{label:n.deleteTable,command:"deleteTable",icon:t.deleteTable,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete table"}},{label:n.removeBorders,command:"deleteCellAndTableBorders",icon:t.deleteBorders,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete cell and table borders"}},{label:n.mergeCells,command:"mergeCells",icon:t.mergeCells,props:{"data-item":"btn-tableActions-option",ariaLabel:"Merge cells"}},{label:n.splitCell,command:"splitCell",icon:t.splitCell,props:{"data-item":"btn-tableActions-option",ariaLabel:"Split cells"}},{label:n.fixTables,command:"fixTables",icon:t.fixTables,props:{"data-item":"btn-tableActions-option",ariaLabel:"Fix tables"}}];function Q(et){return zr(NU,{options:J,onSelect:kt=>{Ws(et);const{command:Bt}=kt;e.emitCommand({item:et,argument:{command:Bt}}),Lc(e)}})}const Y=Mn({type:"dropdown",name:"textAlign",tooltip:n.textAlign,icon:t.alignLeft,command:"setTextAlign",hasCaret:!0,markName:"textAlign",labelAttr:"textAlign",suppressActiveHighlight:!0,attributes:{ariaLabel:"Text align"},options:[{type:"render",render:()=>zr("div",{},[zr($V,{onSelect:kt=>{Ws(Y);const Bt={...Y,command:"setTextAlign"};Bt.command="setTextAlign",e.emitCommand({item:Bt,argument:kt}),_e(Y,kt),Lc(e)}})]),key:"alignment"}],onActivate:({textAlign:et})=>{_e(Y,et)},onDeactivate:()=>{_e(Y,"left")}}),_e=(et,kt)=>{let Bt=kt==="both"?"justify":kt,cn={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},fn=cn[Bt]??cn.left;et.icon.value=fn},ue=Mn({type:"dropdown",name:"list",command:"toggleBulletListStyle",splitButton:!0,splitButtonCommand:"toggleBulletList",icon:t.bulletList,hasCaret:!0,tooltip:n.bulletList,restoreEditorFocus:!0,attributes:{ariaLabel:"Bullet list"},options:[{type:"render",key:"bullet-style-buttons",render:()=>{const et=kt=>{Ws(ue);const Bt={...ue,command:"toggleBulletListStyle"};e.emitCommand({item:Bt,argument:kt})};return zr(_I,{buttons:KV,iconSize:25,selectedStyle:ue.selectedValue.value,onSelect:et})}}]}),ve=Mn({type:"dropdown",name:"numberedlist",command:"toggleOrderedListStyle",splitButton:!0,splitButtonCommand:"toggleOrderedList",icon:t.numberedList,hasCaret:!0,tooltip:n.numberedList,restoreEditorFocus:!0,attributes:{ariaLabel:"Numbered list"},options:[{type:"render",key:"numbered-style-buttons",render:()=>{const et=kt=>{Ws(ve);const Bt={...ve,command:"toggleOrderedListStyle"};e.emitCommand({item:Bt,argument:kt})};return zr(_I,{buttons:qV,iconSize:30,selectedStyle:ve.selectedValue.value,onSelect:et})}}]}),ge=Mn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Te=Mn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Ne=Mn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),Je=Mn({type:"dropdown",name:"zoom",allowWithoutEditor:!0,tooltip:n.zoom,defaultLabel:"100%",label:"100%",hasCaret:!0,command:"setZoom",isWide:!0,style:{width:"71px",minWidth:"71px"},inlineTextInputVisible:!1,hasInlineTextInput:!0,attributes:{ariaLabel:"Zoom"},options:[{label:"50%",key:.5,props:{"data-item":"btn-zoom-option"}},{label:"75%",key:.75,props:{"data-item":"btn-zoom-option"}},{label:"90%",key:.9,props:{"data-item":"btn-zoom-option"}},{label:"100%",key:1,props:{"data-item":"btn-zoom-option"}},{label:"125%",key:1.25,props:{"data-item":"btn-zoom-option"}},{label:"150%",key:1.5,props:{"data-item":"btn-zoom-option"}},{label:"200%",key:2,props:{"data-item":"btn-zoom-option"}}],onActivate:({zoom:et})=>{et&&(Je.label.value=et)}}),ct=Mn({type:"dropdown",name:"measurementUnit",allowWithoutEditor:!0,tooltip:n.measurementUnit,defaultLabel:"in",label:"in",hasCaret:!0,command:"setMeasurementUnit",group:"right",style:{width:"52px",minWidth:"52px"},inlineTextInputVisible:!1,hasInlineTextInput:!1,attributes:{ariaLabel:"Measurement unit"},options:[{label:"Inches",key:"in",props:{"data-item":"btn-measurement-unit-option"}},{label:"Centimeters",key:"cm",props:{"data-item":"btn-measurement-unit-option"}}],onActivate:({measurementUnit:et})=>{et&&(ct.label.value=et)}}),tt=Mn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),Tt=Mn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),ae=Mn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),Ee=Mn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Ue=Mn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),ie=Mn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),I=(et,kt)=>et==="editor"?kt:et==="suggester"?kt.filter(Bt=>Bt.value==="suggesting"):kt.filter(Bt=>Bt.value==="viewing"),se=et=>et==="editor"?"Editing":et==="suggester"?"Suggesting":"Viewing",F=Mn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:se(s),label:se(s),hasCaret:s==="editor",isWide:!0,style:{display:"flex",justifyContent:"flex-end"},inlineTextInputVisible:!1,hasInlineTextInput:!1,group:"right",disabled:s!=="editor",attributes:{dropdownPosition:"right",className:"sd-toolbar-item--doc-mode",ariaLabel:"Document mode"},options:[{type:"render",render:()=>P(F)}]}),q=[{label:n.documentEditingMode,value:"editing",icon:t.documentEditingMode,description:n.documentEditingModeDescription},{label:n.documentSuggestingMode,value:"suggesting",icon:t.documentSuggestingMode,description:n.documentSuggestingModeDescription},{label:n.documentViewingMode,value:"viewing",icon:t.documentViewingMode,description:n.documentViewingModeDescription}];function P(et){return zr(nU,{options:I(s,q),onSelect:kt=>{const Bt=e.superdoc?.activeEditor??e.activeEditor;Ws(et);const{label:cn,icon:fn,value:nn}=kt;F.label.value=cn,F.icon.value=fn,e.emitCommand({item:F,argument:nn}),Lc(e,Bt)}})}const ee=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),be=["search","ruler","undo","overflow","documentMode"],N=Mn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),B=Mn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),de=Mn({type:"dropdown",name:"linkedStyles",command:"setLinkedStyle",tooltip:n.linkedStyles,icon:t.paintbrush,defaultLabel:n.formatText,label:n.formatText,hasCaret:!0,isWide:!0,style:{width:"140px"},suppressActiveHighlight:!0,disabled:!1,attributes:{className:"sd-toolbar-item--linked-styles",ariaLabel:"Linked styles"},options:[{type:"render",key:"linkedStyle",render:()=>{const et=Bt=>{Ws(de);const cn=typeof Bt=="string"?Bt:Bt?.id??null;if(!cn)return;const fn={...de,command:"setLinkedStyle"};e.emitCommand({item:fn,argument:cn})},kt=e.getActiveLinkedStyleId?.()??null;return zr("div",{},[zr(sU,{styles:e.getLinkedStyleOptions?.()??[],onSelect:et,selectedOption:kt})])}}],onActivate:({styleId:et,styleName:kt})=>{const Bt=kt||et;de.label.value=et&&et!=="Normal"?String(Bt):n.formatText,de.disabled.value=!1},onDeactivate:()=>{de.disabled.value=!0,de.label.value=n.formatText}}),Se=(et,kt)=>{if(kt.value==et)return zr("div",{innerHTML:BU,class:"dropdown-select-icon"})},Ae=Mn({type:"dropdown",name:"lineHeight",tooltip:n.lineHeight,icon:t.lineHeight,hasCaret:!1,hasInlineTextInput:!1,hideLabel:!0,inlineTextInputVisible:!1,suppressActiveHighlight:!0,restoreEditorFocus:!0,isWide:!1,command:"setLineHeight",dropdownValueKey:"key",selectedValue:"1",attributes:{ariaLabel:"Line height"},options:[1,1.15,1.5,2,2.5,3].map(et=>({label:et.toFixed(2),key:et,icon:()=>Se(et,Ae.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),Le=20,Xe=32,it=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],yt=["zoom","fontFamily","fontSize","redo"],Mt=i<=ah.lg,Lt=e.config?.showFormattingMarksButton===!0,Wt=e.config?.showTableOfContentsButton===!0;Mt&&(F.attributes.value={...F.attributes.value,className:`${F.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),Mt&&(de.attributes.value={...de.attributes.value,className:`${de.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Be=[tt,Tt,ae,Ee,W,Je,g,S(),b,S(),f,C,w,T,z,L,S(),V,R,...Wt?[K]:[],x,H,S(),Y,ue,ve,ge,Te,Ae,S(),de,S(),N,ct,...Lt?[B]:[],ie,Ue,...jU(e)?[m]:[],Ne,F,...d];if(i<=ah.md&&o&&(Be=Be.filter(et=>et.type!=="separator")),e.config.mode!=="docx"){const et=Be.findIndex(Bt=>Bt.name.value==="linkedStyles");Be.splice(et-1,2);const kt=["ruler","zoom","undo","redo"];Be=Be.filter(Bt=>!kt.includes(Bt.name.value))}const rn=[];a||(s==="viewer"&&rn.push(ae,Ee),Be=Be.filter(et=>!rn.includes(et))),l&&(Be=Be.filter(et=>et.name.value==="overflow"||et.isCustomToolbarItem||l.has(et.name.value))),u?.size&&(Be=Be.filter(et=>!u.has(et.name.value)));const zn=et=>be.includes(et.name.value),Ht=Be.find(et=>et.name.value==="overflow"),xn=Be.filter(et=>et!==Ht),Ur=et=>{const kt=[],Bt=[],cn=xn.filter(zn).reduce((nn,wn)=>nn+o2(wn,ee),0);let fn=Xe+cn+(et&&Ht?o2(Ht,ee):0);return xn.forEach((nn,wn)=>{const Qt=o2(nn,ee);if(nn.type==="separator"&&xn[wn-1]?.name.value==="linkedStyles"&&kt.includes(xn[wn-1])){kt.push(nn);return}if(i<ah.xl+Le&&it.includes(nn.name.value)&&o){kt.push(nn);return}if(i<ah.sm&&yt.includes(nn.name.value)&&o){kt.push(nn);return}if(zn(nn)){Bt.push(nn);return}fn+Qt<=i||!o?(Bt.push(nn),fn+=Qt):kt.push(nn)}),{visibleItems:Bt,overflowItems:kt}};let{visibleItems:yr,overflowItems:Ar}=Ur(!1);if(o&&Ht&&Ar.some(et=>et.type!=="separator")){({visibleItems:yr,overflowItems:Ar}=Ur(!0));const et=Be.indexOf(Ht),kt=yr.findIndex(Bt=>Be.indexOf(Bt)>et);kt===-1?yr.push(Ht):yr.splice(kt,0,Ht)}return{defaultItems:yr,overflowItems:Ar.filter(et=>et.type!=="separator")}},TI={bold:"Bold",fontFamily:"Font family",ai:"AI text generation",fontSize:"Font size",italic:"Italic",underline:"Underline",highlight:"Highlight color",strikethrough:"Strikethrough",color:"Text color",search:"Search",link:"Link",image:"Image",tableOfContents:"Table of contents",table:"Insert table",tableActions:"Table options",addRowBefore:"Insert row above",addRowAfter:"Insert row below",addColumnBefore:"Insert column left",addColumnAfter:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",removeBorders:"Remove borders",mergeCells:"Merge cells",splitCell:"Split cell",fixTables:"Fix tables",textAlign:"Alignment",bulletList:"Bullet list",numberedList:"Numbered list",indentLeft:"Left indent",indentRight:"Right indent",directionLtr:"Left-to-right",directionRtl:"Right-to-left",zoom:"Zoom",measurementUnit:"Measurement unit",undo:"Undo",redo:"Redo",trackChanges:"Track Changes",trackChangesAccept:"Accept changes under selection",trackChangesReject:"Reject changes under selection",trackChangesOriginal:"Toggle Show Original",trackChangesFinal:"Toggle Show Final",clearFormatting:"Clear formatting",copyFormat:"Format painter",lineHeight:"Line height",formatText:"Format text",ruler:"Show or hide ruler",formattingMarks:"Show or hide formatting marks",pageBreak:"Insert page break",documentEditingMode:"Editing",documentSuggestingMode:"Suggesting",documentViewingMode:"Viewing",documentEditingModeDescription:"Edit document directly",documentSuggestingModeDescription:"Edits become suggestions",documentViewingModeDescription:"View clean version of document only",linkedStyles:"Linked styles"},HU=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Ft();function xI(e){return Cj(e)??n2[e]??null}function Ym(e,t,n,r={}){if(!e?.commands||!t||typeof e.commands.has=="function"&&!e.commands.has(t))return!1;const o=typeof e.commands.executeAsync=="function"?e.commands.executeAsync:e.commands.execute;if(typeof o!="function")return!1;const i=n===void 0?o.call(e.commands,t):o.call(e.commands,t,n),s=a=>{!r.reportUnhandled||a!==!1||r.onError?.(new Error(`[superdoc toolbar] Command "${t}" did not run. Check that it is enabled and has the required input.`))};return i&&typeof i.then=="function"?Promise.resolve(i).then(a=>{s(a),r.onSettled?.()},a=>{r.onError?.(a),r.onSettled?.()}):(s(i),r.onSettled?.()),!0}var $U=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),GU=new Set(["list","numberedlist"]);function WU(e,t){if(e==="fontFamily"||e==="fontSize"||GU.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!$U.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function RI(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function KU(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var qU=new Set([...wj,...Object.keys(jm),"ai","overflow","tableOfContents"]),YU=class extends jg.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...sr},texts:{...TI},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1};toolbarItems=[];overflowItems=[];#e=null;#n=null;isDev=!1;role="editor";superdoc;toolbarContainer=null;toolbar=null;_detachFontsChanged=null;_linkedStyleOptions=Br([]);constructor(e={}){if(super(),this.config={...this.config,...e},this.toolbarItems=[],this.overflowItems=[],this.isDev=e.isDev||!1,this.superdoc=e.superdoc,this.role=e.role||"editor",this.toolbarContainer=null,this.config.icons={...sr,...e.icons},this.config.texts={...TI,...e.texts},this.config.hideButtons=e.hideButtons??!0,this.config.responsiveToContainer=e.responsiveToContainer??!1,this.activeEditor=e.editor??this.superdoc?.activeEditor??null,this.ui=null,this.snapshot=null,this._unsubscribeController=null,this._detachFormatPainterModeChange=null,this._customCommandRegs=new Map,this._reportedInvalidCustomItems=new Set,this._lastFontOptionsSignature="",!this.config.selector&&this.config.element&&(this.config.selector=this.config.element),this.toolbarContainer=HU(this.config.selector),this.toolbarContainer){const t=(this.config?.uiDisplayFallbackFont||"").toString().trim()||"Arial, Helvetica, sans-serif";this.toolbarContainer.style.setProperty("--sd-ui-font-family",t)}try{if(this.#t(),this.#u(),this.#l(),this.#i(),this._lastFontOptionsSignature=this.#o(),!this.toolbarContainer){this.updateToolbarState();return}this.app=yc(jV),this.app.directive("click-outside",Hy),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#t(){this.ui=this.superdoc?.ui??null,this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot(),this._unsubscribeController=this.ui.toolbar.subscribe(()=>{this.snapshot=this.ui.toolbar.getSnapshot(),this.getToolbarItemByName("linkedStyles")?.expand.value&&this.#p(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#_():this.#d()}))}#r(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#d();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#i(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#v()),this.updateToolbarState()};this.superdoc.on("fonts-changed",e),this._detachFontsChanged=()=>{this.superdoc?.off?.("fonts-changed",e)}}#a(){this._detachFontsChanged?.(),this._detachFontsChanged=null}#u(){if(Array.isArray(this.config.groups)){this.config.toolbarGroups=this.config.groups,this.config.groups=null;return}this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length&&(this.config.toolbarGroups=Object.keys(this.config.groups))}getAvailableWidth(){const e=document.documentElement.clientWidth,t=this.toolbarContainer?.offsetWidth??0;return this.config.responsiveToContainer?t:e}#h(e){return e||PV(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#l(){const e=this.getAvailableWidth(),t=new Map(this.#s().filter(k=>k.isCustomToolbarItem&&k.type==="dropdown").map(k=>[k.name.value,k.selectedValue.value])),n=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,r=n?new Set(Object.values(this.config.groups).flatMap(k=>k)):null,o=new Set(this.config.excludeItems),i=this.config.customButtons||[],s=new Set(qU),a=i.map((k,b)=>{try{if(k?.name&&s.has(k.name))throw new Error(`Toolbar item name "${k.name}" is already taken by another item, so this entry is skipped.`);const S=this.#f(k);return t.has(S.name.value)&&(S.selectedValue.value=t.get(S.name.value)),s.add(S.name?.value),S}catch(S){const C=`${k?.name??`<unnamed@${b}>`}::${S?.message??String(S)}`;return this._reportedInvalidCustomItems.has(C)||(this._reportedInvalidCustomItems.add(C),this.#m(S,k?.name??null)),null}}).filter(Boolean),l=n?new Set(Object.keys(this.config.groups)):null,u=l?a.filter(k=>l.has(k.group?.value||"center")):a,{defaultItems:d,overflowItems:f}=UU({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#h(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev,configuredItemNames:r,excludedItemNames:o,additionalItems:u});let p=[...d.map(k=>k.name.value),...f.map(k=>k.name.value)];if(n){const k=Object.values(this.config.groups).flatMap(S=>S),b=a.filter(S=>l.has(S.group?.value||"center")).map(S=>S.name.value);p=[...new Set([...k,...b])]}const g=f.filter(k=>p.includes(k.name.value)&&!o.has(k.name.value)),m=g.length?[...p,"overflow"]:p,v=d.filter(k=>m.includes(k.name.value)).filter(k=>!o.has(k.name.value));if(n)for(const[k,b]of Object.entries(this.config.groups))for(const S of v)b.includes(S.name.value)&&(S.group.value=k);this.toolbarItems=v,this.overflowItems=g}#f(e){const t=Mn({...e});t.isCustomToolbarItem=!0;const n=e.command;if(typeof n=="function"&&this.ui?.commands?.register){const r=`__builtin_toolbar__${e.name}`;if(!this._customCommandRegs.has(r)){const o=this.ui.commands.register({id:r,execute:i=>{const s=i?.payload&&typeof i.payload=="object"?i.payload:{};try{const a=n({...i,item:t,argument:s.argument,option:s.option});return a&&typeof a.then=="function"?Promise.resolve(a).catch(l=>(this.#m(l,e.name),!1)):a}catch(a){return this.#m(a,e.name),!1}}});this._customCommandRegs.set(r,o)}}return t}#v(){this.#l(),this.emit("toolbar-items-changed")}#o(){if(this.config.fonts)return"custom-fonts";const e=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return JSON.stringify(e.map(t=>[t.label,t.value,t.previewFamily]))}getToolbarItemByGroup(e){return this.toolbarItems.filter(t=>(t.group?.value||"center")===e)}getToolbarItemByName(e){return this.#s().find(t=>t.name.value===e)}#s(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.#p(),this._linkedStyleOptions.value}#p(){this.ui?.styles?.getCatalog?.({includePreview:!0});const e=this.ui?.styles?.getCatalog?.({view:"quickGallery",includePreview:!0})?.items??this.ui?.styles?.getQuickGallery?.()??[];e!==this._linkedStyleOptions.value&&(this._linkedStyleOptions.value=e)}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}setActiveEditor(e){this.activeEditor=e;const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#v()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#l(),this.updateToolbarState()};#w(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#k(e){return e==="ruler"?typeof this.superdoc?.toggleRuler=="function":e==="formattingMarks"?typeof this.superdoc?.toggleFormattingMarks=="function"||typeof this.superdoc?.setShowFormattingMarks=="function":!1}#y(){const e=this.getToolbarItemByName("documentMode");if(!e)return;const t=(this.snapshot?.commands?.["document-mode"]?.value||"editing").toLowerCase(),n=this.config.texts||{},r=this.config.icons||{},o={editing:{label:n.documentEditingMode||"Editing",icon:r.documentEditingMode||r.documentMode},suggesting:{label:n.documentSuggestingMode||"Suggesting",icon:r.documentSuggestingMode||r.documentMode},viewing:{label:n.documentViewingMode||"Viewing",icon:r.documentViewingMode||r.documentMode}},i=o[t]||o.editing;e.label?.value!==void 0&&(e.label.value=i.label),e.defaultLabel?.value!==void 0&&(e.defaultLabel.value=i.label),e.icon?.value!==void 0&&i.icon&&(e.icon.value=i.icon)}#A(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>r2(this,e,[],!0)};e.nestedOptions.value=[t]}#I(e){return!!e?.active&&e?.value==null}#L(e){return!!e&&e.disabled===!1&&e.value==null}#R(e){const t=e.name.value;if(e.isCustomToolbarItem&&typeof e.command=="string"){const i=this.snapshot?.commands?.[e.command];return e.setDisabled(e.initiallyDisabled||!i||!!i.disabled),i?.active?e.activate():e.deactivate(),!0}if(t==="tableActions"){const i=SI.map(s=>this.snapshot?.commands?.[s]).some(s=>s&&!s.disabled);return e.setDisabled(!i),!0}if(t==="search")return e.setDisabled(this.superdoc?.uiConfig?.search?.enabled!==!0),!0;if(e2(t)?.disposition==="host-routed")return e.setDisabled(!this.#k(t)),this.#w(t)?e.activate():e.deactivate(),!0;const n=xI(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];WU(t,r)?e.setDisabled(!1):e.setDisabled(!!r?.disabled);const o={textAlign:()=>{r?.value?e.activate({textAlign:r.value}):e.deactivate()},lineHeight:()=>{e.selectedValue.value=r?.value!=null?r.value:""},zoom:()=>{if(r?.value!=null){const i=typeof r.value=="number"?`${r.value}%`:String(r.value);e.onActivate({zoom:i})}},measurementUnit:()=>{r?.value!=null&&e.onActivate({measurementUnit:String(r.value)})},documentMode:()=>{this.#y()},link:()=>{e.active.value=!!r?.active,e.attributes.value=i2(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#L(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#I(r)){e.activate({},!0);return}e.deactivate()},color:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},highlight:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},linkedStyles:()=>{const i=r?.value,s=typeof i=="string"?i:i?.styleId,a=i&&typeof i=="object"?i.styleName:null;s?e.activate({styleId:s,styleName:a}):e.label.value=this.config.texts?.formatText||"Format text"},list:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},numberedlist:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},default:()=>{r?.active?e.activate():e.deactivate()}};return(o[t]??o.default)(),!0}updateToolbarState(){this.#y(),this.#A();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#b(),this.#s().forEach(n=>{const r=n.isCustomToolbarItem&&typeof n.command=="string";(n.allowWithoutEditor?.value||r)&&this.#R(n)})):this.#s().forEach(n=>{n.resetDisabled(),this.#R(n)});const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#b(){this.#s().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#C(e,t){const n=this.superdoc;if(e==="ruler")return typeof n?.toggleRuler=="function"?(n.toggleRuler(),!0):!1;if(e==="formattingMarks"){if(typeof t=="boolean"&&typeof n?.setShowFormattingMarks=="function")return n.setShowFormattingMarks(t),!0;if(typeof n?.toggleFormattingMarks=="function")return n.toggleFormattingMarks(),!0}return!1}#E(e,t){const n=e?.name?.value;if(!n)return!1;const r={onSettled:()=>this.updateToolbarState(),onError:i=>this.#m(i,n)};if(n==="image"&&t==null)return this.#x();if(n==="tableActions"){const i=kI[t?.command];return i?Ym(this.ui,i,void 0,r):!1}if(e2(n)?.disposition==="unsupported")return!0;const o=xI(n);return o?Ym(this.ui,o,t,r):!1}#x(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=Tj({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await Ij(e,this.superdoc?.config?.handleImageUpload);Ym(this.ui,"image",{src:t},{onSettled:()=>this.updateToolbarState(),onError:n=>this.#m(n,"image")})},onError:e=>this.#m(e,"image")})),this.#e.open()),!0}#_(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{RI(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!RI(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}KU(i)&&this.ui.formatPainter.setKeyboardSelecting(!0)},o=()=>{this.ui.formatPainter.setKeyboardSelecting(!1),this.ui.formatPainter.notifyKeyUp()};e.addEventListener("pointerdown",t),e.addEventListener("pointerup",n),e.addEventListener("keydown",r),e.addEventListener("keyup",o),this.#n=()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("pointerup",n),e.removeEventListener("keydown",r),e.removeEventListener("keyup",o)}}#d(){this.#n&&(this.#n(),this.#n=null)}#m(e,t){const n={error:e instanceof Error?e:new Error(String(e)),originalError:e,itemName:t??null,editor:this.superdoc?.activeEditor??this.activeEditor??null},r={...n};this.emit("exception",n),this.superdoc?.emit?.("exception",r)}emitCommand({item:e,argument:t,option:n}){const r=e?.name?.value,{command:o}=e,i=t!=null;if(!(e?.type==="dropdown"&&!i&&(o==="setFontFamily"||o==="setFontSize"))){if(r==="search"){this.superdoc?.emit?.("search:open");return}try{if(e2(r)?.disposition==="host-routed"){this.#C(r,t),this.updateToolbarState();return}if(typeof o=="function"){const s=`__builtin_toolbar__${r}`;if(this._customCommandRegs.has(s)&&this.ui?.commands?.execute)this.ui.commands.execute(s,{argument:t,option:n});else{const a=o({item:e,argument:t,option:n,ui:this.ui,superdoc:this.superdoc});a&&typeof a.then=="function"&&Promise.resolve(a).catch(l=>this.#m(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!Ym(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#m(s,r),reportUnhandled:!0}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#E(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#m(s,r)}}}destroy(){this.#d(),this.#e?.destroy(),this.#e=null,this.#a(),this.#r(),this.app?.unmount(),this.app=null,this.toolbar=null}};function XU(e){return new YU(e)}function ZU(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null||Array.isArray(e)!==Array.isArray(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}function QU(e){if(!e||typeof e!="object")return{};const t={};e.fonts&&(t.rFonts={ascii:e.fonts.ascii,hAnsi:e.fonts.hAnsi,eastAsia:e.fonts.eastAsia,cs:e.fonts.cs,asciiTheme:e.fonts.asciiTheme,hAnsiTheme:e.fonts.hAnsiTheme,eastAsiaTheme:e.fonts.eastAsiaTheme,csTheme:e.fonts.csTheme,hint:e.fonts.hint}),e.fontFamily!=null&&(t.fontFamily=e.fontFamily),e.lang&&(t.lang={val:e.lang.val,eastAsia:e.lang.eastAsia,bidi:e.lang.bidi}),e.fontSize!=null&&(t.fontSize=e.fontSize),e.fontSizeCs!=null&&(t.fontSizeCs=e.fontSizeCs);const n=Xm(e.color);n!=null&&(t.color=n),e.highlight!=null&&(t.highlight=e.highlight);const r=eH(e.shading);r&&(t.shading=r),e.cs!=null&&(t.cs=e.cs),e.rtl!=null&&(t.rtl=e.rtl),e.bold!=null&&(t.bold=e.bold),e.boldCs!=null&&(t.bCs=e.boldCs),e.italic!=null&&(t.italic=e.italic),e.italicCs!=null&&(t.iCs=e.italicCs);const o=JU(e.underline);o!==void 0&&(t.underline=o),e.strikethrough!=null&&(t.strike=e.strikethrough),e.doubleStrikethrough!=null&&(t.dstrike=e.doubleStrikethrough),e.caps!=null&&(t.caps=e.caps),e.smallCaps!=null&&(t.smallCaps=e.smallCaps),e.outline!=null&&(t.outline=e.outline),e.shadow!=null&&(t.shadow=e.shadow),e.emboss!=null&&(t.emboss=e.emboss),e.imprint!=null&&(t.imprint=e.imprint),e.verticalAlign!=null&&(t.vertAlign=e.verticalAlign),e.characterSpacing!=null&&(t.letterSpacing=e.characterSpacing),e.characterScale!=null&&(t.charScale=e.characterScale),e.kern!=null&&(t.kerning=e.kern),e.baselineShift!=null&&(t.position=e.baselineShift),e.fitTextWidth!=null&&(t.fitText={val:e.fitTextWidth}),e.vanish!=null&&(t.vanish=e.vanish),e.webHidden!=null&&(t.webHidden=e.webHidden),e.specVanish!=null&&(t.specVanish=e.specVanish);const i=tH(e.border);return i&&(t.border=i),t}function Xm(e){if(e){if(typeof e=="string")return e;if(e.model==="rgb")return e.value;if(e.model==="auto")return"auto"}}function JU(e){if(e==null)return;const t={};return e.style!=null&&(t.style=e.style),e.color?.model==="rgb"&&(t.color=e.color.value),e.color?.model==="theme"&&(t.themeColor=e.color.theme),Object.keys(t).length>0?t:!0}function eH(e){if(!e)return;const t={},n=Xm(e.fill);n!=null&&(t.fill=n);const r=Xm(e.color);return r!=null&&(t.color=r),e.pattern!=null&&(t.val=e.pattern),Object.keys(t).length>0?t:void 0}function tH(e){if(!e)return;const t={};e.style!=null&&(t.val=e.style),e.width!=null&&(t.sz=e.width),e.space!=null&&(t.space=e.space);const n=Xm(e.color);return n!=null&&(t.color=n),Object.keys(t).length>0?t:void 0}function Dc(e){const t=e?.selectionTarget??e?.target;if(!e||!t)return"";try{return JSON.stringify(t)}catch{return String(t)}}var nH=new Set(["insert-text","replace-text","plain-text-paste","delete-backward","delete-forward","text.insert","text.replace","text.pastePlain","text.deleteBackward","text.deleteForward","structural.enter","structural:enter-split-paragraph","structural:enter-insert-paragraph-before","structural:enter-insert-paragraph-after","structural:shift-enter-line-break","structural:backspace-boundary-merge-with-previous","structural:delete-boundary-merge-with-next","backspace:boundary-merge-with-previous","backspace:list-remove","backspace:list-outdent"]),rH=e=>e?.type!=="mutation:committed"||e.origin!=="command"?!1:nH.has(e.editableCommandKind);function MI(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function oH(e){const t=[],n=o=>{o&&!t.includes(o)&&t.push(o)};n(e.getAttribute("data-track-change-preferred-target-id"));const r=e.getAttribute("data-track-change-ids");if(r)for(const o of MI(r))n(o);return n(e.getAttribute("data-track-change-id")),t}function LI(e,t){if(!e||typeof e.getAttribute!="function")return[];const n=[],r=new Set;let o=[],i=e;for(;i;){const s=i,a=oH(s),l=a.length>0?s.getAttribute("data-story-key"):null;for(const m of a){const v=`trackedChange:${m}`;if(!r.has(v)){r.add(v);const k={type:"trackedChange",id:m};l&&(k.storyKey=l),n.push(k),o.push(k)}}const u=s.getAttribute("data-layout-story");if(u&&o.length>0){for(const m of o)m.story=u;o=[]}const d=s.getAttribute("data-citation-id");if(d){const m=`citation:${d}`;r.has(m)||(r.add(m),n.push({type:"citation",id:d}))}const f=s.getAttribute("data-comment-ids");if(f)for(const m of MI(f)){const v=`comment:${m}`;r.has(v)||(r.add(v),n.push({type:"comment",id:m}))}const p=s.getAttribute("data-sdt-type"),g=s.getAttribute("data-sdt-id");if(g&&p==="structuredContent"){const m=`contentControl:${g}`;if(!r.has(m)){r.add(m);const v=s.getAttribute("data-sdt-scope"),k=s.getAttribute("data-sdt-tag"),b={type:"contentControl",id:g};(v==="block"||v==="inline")&&(b.scope=v),k&&(b.tag=k),n.push(b)}}if(t&&i===t)break;i=i.parentElement}return n}var po=()=>({oneOf:[{type:"boolean"},{type:"null"}]}),Ol=()=>({oneOf:[{type:"string",minLength:1},{type:"null"}]}),nd=()=>({oneOf:[{type:"number"},{type:"null"}]}),rd=e=>({oneOf:[{type:"object",properties:e,additionalProperties:!1,minProperties:1},{type:"null"}]}),iH={type:"object",properties:{style:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},themeColor:{oneOf:[{type:"string",minLength:1},{type:"null"}]}},additionalProperties:!1,minProperties:1},sH={type:"object",properties:{id:{type:"number"},val:{type:"boolean"}},required:["id"],additionalProperties:!1},aH=()=>({oneOf:[{type:"boolean"},{type:"null"},iH]}),lH=()=>({oneOf:[{type:"array",items:sH,minItems:1},{type:"null"}]});function Zm(e,t){return{storage:"mark",markName:e,textStyleAttr:t}}function cH(e){return{storage:"runAttribute",nodeName:"run",runPropertyKey:e}}var s2=(e,t,n)=>({key:e,type:"boolean",ooxmlElement:t,storage:"mark",tracked:!0,carrier:Zm(n),schema:po()}),Oc=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"mark",tracked:!0,carrier:Zm("textStyle",o??e),schema:r}),Un=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"runAttribute",tracked:!1,carrier:cH(o??e),schema:r}),Qm=[s2("bold","w:b","bold"),s2("italic","w:i","italic"),s2("strike","w:strike","strike"),{key:"underline",type:"object",ooxmlElement:"w:u",storage:"mark",tracked:!0,carrier:Zm("underline"),schema:aH()},{key:"highlight",type:"string",ooxmlElement:"w:highlight",storage:"mark",tracked:!0,carrier:Zm("highlight"),schema:Ol()},Oc("color","string","w:color",Ol()),Oc("fontSize","number","w:sz",nd()),Oc("fontFamily","string","w:rFonts",Ol()),Oc("letterSpacing","number","w:spacing",nd()),Oc("vertAlign","string","w:vertAlign",{oneOf:[{enum:["superscript","subscript","baseline"]},{type:"null"}]}),Oc("position","number","w:position",nd()),Un("dstrike","boolean","w:dstrike",po()),Un("smallCaps","boolean","w:smallCaps",po()),Oc("caps","boolean","w:caps",po(),"textTransform"),Un("shading","object","w:shd",rd({fill:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},val:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("border","object","w:bdr",rd({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},sz:{oneOf:[{type:"number"},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},space:{oneOf:[{type:"number"},{type:"null"}]}}),"borders"),Un("outline","boolean","w:outline",po()),Un("shadow","boolean","w:shadow",po()),Un("emboss","boolean","w:emboss",po()),Un("imprint","boolean","w:imprint",po()),Un("charScale","number","w:w",nd(),"w"),Un("kerning","number","w:kern",nd(),"kern"),Un("vanish","boolean","w:vanish",po()),Un("webHidden","boolean","w:webHidden",po()),Un("specVanish","boolean","w:specVanish",po()),Un("rtl","boolean","w:rtl",po()),Un("cs","boolean","w:cs",po()),Un("bCs","boolean","w:bCs",po(),"boldCs"),Un("iCs","boolean","w:iCs",po(),"italicCs"),Un("eastAsianLayout","object","w:eastAsianLayout",rd({id:{oneOf:[{type:"string",minLength:1},{type:"null"}]},combine:{oneOf:[{type:"boolean"},{type:"null"}]},combineBrackets:{oneOf:[{type:"string",minLength:1},{type:"null"}]},vert:{oneOf:[{type:"boolean"},{type:"null"}]},vertCompress:{oneOf:[{type:"boolean"},{type:"null"}]}})),Un("em","string","w:em",Ol()),Un("fitText","object","w:fitText",rd({val:{oneOf:[{type:"number"},{type:"null"}]},id:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("snapToGrid","boolean","w:snapToGrid",po()),Un("lang","object","w:lang",rd({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},bidi:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("oMath","boolean","w:oMath",po()),Un("rStyle","string","w:rStyle",Ol(),"styleId"),Un("rFonts","object","w:rFonts",rd({ascii:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsi:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},cs:{oneOf:[{type:"string",minLength:1},{type:"null"}]},asciiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsiaTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},csTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hint:{oneOf:[{type:"string",minLength:1},{type:"null"}]}}),"fontFamily"),Un("fontSizeCs","number","w:szCs",nd()),Un("ligatures","string","w14:ligatures",Ol()),Un("numForm","string","w14:numForm",Ol()),Un("numSpacing","string","w14:numSpacing",Ol()),Un("stylisticSets","array","w14:stylisticSets",lH()),Un("contextualAlternates","boolean","w14:cntxtAlts",po())],gK=new Set(Qm.map(e=>e.key)),uH=Object.fromEntries(Qm.map(e=>[e.key,e])),vK={mark:Qm.filter(e=>e.storage==="mark").map(e=>e.key),runAttribute:Qm.filter(e=>e.storage==="runAttribute").map(e=>e.key)};function Va(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Jm(){const e=globalThis;return{sink:typeof e.__superdocV2BenchPipelineTiming=="function"?e.__superdocV2BenchPipelineTiming:null,workerContext:e.__superdocV2BenchWorkerMessageContext??null}}function a2(e){const{sink:t}=Jm();if(t)try{t(e)}catch{}}var l2=new WeakMap;function dH(e){let t=l2.get(e);return t||(t={refCount:0,generation:0,abortController:new AbortController,inFlight:null,activeMutationTokens:new Set},l2.set(e,t)),t.refCount+=1,t}function fH(e,t){t.refCount=Math.max(0,t.refCount-1),!(t.refCount>0)&&(t.abortController.abort("ui-controller-destroyed"),t.inFlight=null,t.activeMutationTokens.clear(),l2.delete(e))}var hH=new Set(Object.values(lt));function eg(e,t){return typeof e=="string"&&hH.has(e)?e:t}function DI(e){if(e&&typeof e=="object"&&e.ok===!1){const t=e.reason;return t==="host-not-ready"||t==="host-disposed"||t==="editing-mount-required"?{ok:!1,reason:lt.notReady}:{ok:!1,reason:eg(t,lt.targetUnresolved)}}return{ok:!0}}var pH=["document-replaced","editorCreate","active-editor-change","document-mode-change","zoomChange","measurement-unit-change","viewport-change","fonts-changed"],mH={[cI.bulletList]:"bullet",[cI.numberedList]:"ordered"};function OI(e){return mH[e]??null}var gH={disc:"disc",circle:"circle",square:"square",decimal:"decimal","decimal-paren":"decimalParenthesis","upper-roman":"upperRoman","lower-roman":"lowerRoman","upper-alpha":"upperLetter","upper-alpha-paren":"upperLetterParenthesis","lower-alpha":"lowerLetter","lower-alpha-paren":"lowerLetterParenthesis"};function vH(e){const t=gH[e];return t?{preset:t,behavior:"toggleStyle"}:{}}var yH={status:"ready",empty:!0,target:null,selectionTarget:null,activeMarks:[],activeCommentIds:[],activeChangeIds:[],quotedText:""},bH=[{key:"contentControls",match:"exact",note:"full-document SDT catalog parse (the measured during-load cliff)"},{key:"contentControls:inRange:",match:"prefix",note:"same adapter load() as the catalog, issued per settled selection"},{key:"hyperlinks:",match:"prefix",note:"per-block hyperlink list over the loading story"},{key:"styles:catalog:",match:"prefix",note:"WordStyleModel recompile from package bytes"},{key:"comments",match:"exact",note:"audited: full comments list; stale-served during load"},{key:"trackChanges",match:"exact",note:"audited: shared all-story tracked-changes catalog; stale-served during load"},{key:"trackChanges:all",match:"exact",note:"audited: current-token validation over the shared all-story catalog; consumers fail closed on non-ready"},{key:"tables",match:"exact",note:"reserved: full tables catalog"},{key:"sections",match:"exact",note:"reserved: full sections list"}],wH=new Set(["/word/comments.xml","/word/commentsExtended.xml","/word/commentsIds.xml"]);function CH(e){return bH.some(t=>t.match==="exact"?t.key===e:e.startsWith(t.key))}var PI={ready:0,stale:1,pending:2};function Pl(...e){let t="ready";for(const n of e)PI[n]>PI[t]&&(t=n);return t}function Ot(e,t){if(typeof e!="function")return t;try{const n=e();return n===void 0?t:n}catch{return t}}function Lr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function vr(e,t){if(!e)return null;const n=t.split(".");let r=e;for(const o of n){if(r==null)return null;r=r[o]}return typeof r=="function"?r:null}function Wn(e,t="CAPABILITY_UNAVAILABLE"){return{success:!1,failure:{code:t,message:e}}}function lh(e,t){return{success:!1,failure:{code:"PARTIAL_LINK_EDIT",message:"Hyperlink target was updated, but display text replacement failed."},applied:{href:!0,text:!1},hyperlinkResult:e,textResult:t}}function ch(e){if(!e||typeof e!="object")return null;const t=e.target;return t&&typeof t=="object"?t:null}function c2(e){if(!e||typeof e!="object")return!1;const t=e,n=i=>{if(!i||typeof i!="object")return!1;const s=i;return s.kind==="text"&&typeof s.blockId=="string"&&typeof s.offset=="number"},r=i=>{if(!i||typeof i!="object")return!1;const s=i,a=s.range;return typeof s.blockId=="string"&&typeof a?.start=="number"&&typeof a.end=="number"};if(Array.isArray(t.segments)){const i=t.segments[0],s=t.segments[t.segments.length-1];return r(i)&&r(s)}if(t.kind==="selection")return n(t.start)&&n(t.end);if(t.kind!=="text"||typeof t.blockId!="string")return!1;const o=t.range;return typeof o?.start=="number"&&typeof o.end=="number"}function FI(e,t){if(!e||typeof e!="object")return null;const n=ch(e),r=e,o=r.navigationTarget&&typeof r.navigationTarget=="object"?r.navigationTarget:null;if(o?.kind==="block"&&typeof o.blockId=="string"&&o.blockId.length>0){const i={kind:"text",blockId:o.blockId,range:{start:0,end:0},...o.story&&typeof o.story=="object"?{story:o.story}:{},...r.address&&typeof r.address=="object"?{address:r.address}:{}};if(t?.preferStableBlock||!c2(n))return i}return n}function Jn(e){if(!e||typeof e!="object")return"story:body";const t=e,n=typeof t.storyType=="string"?t.storyType:"body";switch(n){case"body":return"story:body";case"headerFooterPart":return`story:headerFooterPart:${typeof t.refId=="string"?t.refId:""}`;case"headerFooterSlot":return JSON.stringify({storyType:n,section:t.section??null,headerFooterKind:t.headerFooterKind??null,variant:t.variant??null,resolution:t.resolution??"effective",onWrite:t.onWrite??"materializeIfInherited"});case"footnote":return`story:footnote:${typeof t.noteId=="string"?t.noteId:""}`;case"endnote":return`story:endnote:${typeof t.noteId=="string"?t.noteId:""}`;case"textbox":return`story:textbox:${typeof t.textboxId=="string"?t.textboxId:""}`;default:return JSON.stringify(t)}}function uh(e){if(!e||typeof e!="object")return null;const t=e,n=t.address&&typeof t.address=="object"?t.address:null;if(n?.story&&typeof n.story=="object")return n.story;if(t.storyLocator&&typeof t.storyLocator=="object")return t.storyLocator;if(t.trackedChangeStory&&typeof t.trackedChangeStory=="object")return t.trackedChangeStory;const r=ch(e);if(!r||typeof r!="object")return null;const o=r;if(o.story&&typeof o.story=="object")return o.story;const i=o.address&&typeof o.address=="object"?o.address:null;return i?.story&&typeof i.story=="object"?i.story:null}function ki(e,t,n){return Vr(e)!==t?!1:n?Jn(uh(e))===Jn(n):!0}function dh(e){const t=uh(e);if(!(!t||Jn(t)===Jn(null)))return t}function kH(e){if(typeof e!="string"||e.length===0)return;const t=h5(e);switch(t.kind){case"body":return;case"footnote":return t.id?{kind:"story",storyType:"footnote",noteId:t.id}:void 0;case"endnote":return t.id?{kind:"story",storyType:"endnote",noteId:t.id}:void 0;case"header":case"footer":return t.id?{kind:"story",storyType:"headerFooterPart",refId:t.id}:void 0;default:return}}function SH(e){if(!(typeof e!="string"||e.length===0||e==="body")){if(e.startsWith("hf:part:")){const t=e.slice(8);return t?{kind:"story",storyType:"headerFooterPart",refId:t}:void 0}if(e.startsWith("fn:")){const t=e.slice(3);return t?{kind:"story",storyType:"footnote",noteId:t}:void 0}if(e.startsWith("en:")){const t=e.slice(3);return t?{kind:"story",storyType:"endnote",noteId:t}:void 0}}}function tg(e){if(!e||typeof e!="object")return null;const t=e.selectionTarget;return t&&typeof t=="object"?t:null}function fh(e){if(!e||typeof e!="object")return null;const t=e.id;return typeof t=="string"&&t.length>0?t:null}function _H(e){if(!e||typeof e!="object")return null;const t=e;if(t.kind!=="selection")return e;const n=t.start;return!n||typeof n!="object"?null:{...t,end:n}}function Vr(e){if(!e||typeof e!="object")return null;const t=e,n=t.id??t.commentId??t.changeId;return typeof n=="string"&&n.length>0?n:null}function od(e){return typeof e=="string"?e.trim():""}function AH(e,t){const n=t??{},r=od(n.id).toLowerCase(),o=od(e.authorId).toLowerCase();if(r&&o)return r===o;const i=od(n.email).toLowerCase(),s=od(e.authorEmail).toLowerCase();if(i&&s)return i===s;if(r||i||o||s)return!1;const a=od(e.author).replace(/\s+/g," ").toLowerCase();if(!a)return!0;const l=od(n.name).replace(/\s+/g," ").toLowerCase();return!!(l&&l===a)}function IH(e){if(!e||typeof e!="object")return null;const t=e,n=t.anchor,r=t.focus,o=n?.visualCaret,i=r?.visualCaret,s=o?.trackChangeId,a=i?.trackChangeId;return typeof s=="string"&&s.length>0&&s===a?s:null}var NI=new WeakMap;function BI(e){const t=[],n=i=>{typeof i=="string"&&i.length>0&&!t.includes(i)&&t.push(i)},r=i=>{if(!i||typeof i!="object")return;const s=i,a=s.sourceIds;if(a&&typeof a=="object"&&(n(a.wordIdInsert),n(a.wordIdDelete),Array.isArray(a.wordIdOther)))for(const f of a.wordIdOther)n(f);const l=s.wordRevisionIds;l&&typeof l=="object"&&(n(l.insert),n(l.delete),n(l.format));const u=s.replacement;if(u&&typeof u=="object")for(const f of[u.inserted,u.deleted])f&&typeof f=="object"&&(n(f.id),n(f.wordId));const d=s.move;if(d&&typeof d=="object")for(const f of[d.source,d.destination])f&&typeof f=="object"&&(n(f.id),n(f.wordId))};r(e);const o=e?.change;return o&&o!==e&&r(o),t}function Ks(e){const t=NI.get(e);if(t)return t;const n=new Set,r=new Map;for(const i of e){const s=Vr(i);if(s){n.add(s);for(const a of BI(i)){r.has(a)||r.set(a,s);const l=`imported:${a}`;r.has(l)||r.set(l,s)}}}const o={toPublicId(i){if(n.has(i))return i;const s=r.get(i);return s!=null&&n.has(s)?s:null},aliasesFor(i){const s=[i];for(const[a,l]of r)l===i&&!s.includes(a)&&s.push(a);return s}};return NI.set(e,o),o}var zI=new WeakMap,jI=new WeakMap;function Fl(e,t){const n=Jn(t);let r=zI.get(e);r||(r=new Map,zI.set(e,r));const o=r.get(n);if(o)return o;const i=Ks(e.filter(s=>Jn(uh(s))===n));return r.set(n,i),i}function EH(e){return!!e&&typeof e=="object"&&e.storyType==="textbox"}function TH(e,t){const n=t.filter(o=>e.some(i=>Vr(i)===o&&uh(i)==null));if(n.length===0)return null;if(n.length===1)return n[0];const r=new Set;for(const o of n){const i=e.find(s=>Vr(s)===o);if(i)for(const s of BI(i)){if(r.has(s))return null;r.add(s)}}return n[0]}function xH(e){const t=jI.get(e);if(t)return t;const n=e.filter(o=>uh(o)!=null),r=n.length===e.length?e:n;return jI.set(e,r),r}function RH(e){const{selectionIds:t,publicIds:n,selection:r,bodyItems:o,allStoryItems:i}=e;if(t.length===0)return null;const s=u=>{for(const d of t){const f=u.toPublicId(d);if(f)return f}return null},a=vs(r),l=Jn(a)===Jn(null);if(i){const u=l?xH(i):i,d=s(Fl(u,a));if(d)return d;const f=n?.find(p=>u.some(g=>ki(g,p,a)));return f||(l?s(Ks(o)):EH(a)?TH(i,t):null)}return l?s(Ks(o))??t[0]??null:null}function MH(e,t){const n=e.find(r=>Vr(r)===t||r.importedId===t);return n?n.rootCommentId??n.parentCommentId??Vr(n)??t:null}function LH(e){const t=e.selectionTarget;if(t){const s=t.start,a=t.end,l=typeof s?.blockId=="string"?s.blockId:void 0,u=typeof a?.blockId=="string"?a.blockId:l;if(l)return{startBlockId:l,endBlockId:u??l}}const n=e.target,r=n&&Array.isArray(n.segments)?n.segments:[],o=r[0]?.blockId,i=r[r.length-1]?.blockId;return typeof o=="string"?{startBlockId:o,endBlockId:typeof i=="string"?i:o}:null}function Dr(e){const t=[],n=s=>{typeof s=="string"&&s.length>0&&!t.includes(s)&&t.push(s)},r=e.target,o=r&&Array.isArray(r.segments)?r.segments:[];for(const s of o)n(s?.blockId);const i=e.selectionTarget;return i&&(n(i.start?.blockId),n(i.end?.blockId)),t}var DH=64;function Pc(e){return e.length<=DH}function vs(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:{kind:"story",storyType:"body"}}function _o(e,t){return{kind:"block",nodeType:"paragraph",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}function Ua(e){return{kind:"block",nodeType:"paragraph",nodeId:e}}function VI(e,t){return{kind:"block",nodeType:"listItem",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}var UI=720;function qs(e){return Math.round(e*20)}function id(e){return typeof e=="number"&&Number.isFinite(e)}function OH(e){if(!e||typeof e!="object")return null;const t=e.node;if(!t||typeof t!="object")return null;const n=t.kind==="heading"?t.heading??null:t.kind==="paragraph"?t.paragraph??null:null;if(!n)return null;const r=n.resolved,o=n.props,i=r?.indent??o?.indent;if(!i||typeof i!="object")return null;const s=id(i.left)?qs(i.left):id(i.start)?qs(i.start):void 0,a=id(i.right)?qs(i.right):id(i.end)?qs(i.end):void 0,l=id(i.firstLine)?qs(i.firstLine):void 0,u=id(i.hanging)?qs(i.hanging):void 0;return s==null&&a==null&&l==null&&u==null?null:{...s!=null?{left:s}:{},...a!=null?{right:a}:{},...l!=null?{firstLine:l}:{},...u!=null?{hanging:u}:{}}}function u2(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=t?.story,o=[];for(const i of n){if(!i||typeof i.blockId!="string")continue;const s=i.range;!s||typeof s.start!="number"||typeof s.end!="number"||s.start===s.end||o.push({kind:"text",blockId:i.blockId,range:{start:s.start,end:s.end},...r?{story:r}:{}})}return o}function PH(e){if(!e||typeof e!="object")return[];const t=e,n=t.story,r=[];if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const o=t.range;return typeof o.start=="number"&&typeof o.end=="number"&&o.start!==o.end&&r.push({kind:"text",blockId:t.blockId,range:{start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)},...n?{story:n}:{}}),r}if(t.kind==="text"&&Array.isArray(t.segments)){for(const o of t.segments){const i=o?.range;typeof o?.blockId=="string"&&typeof i?.start=="number"&&typeof i?.end=="number"&&i.start!==i.end&&r.push({kind:"text",blockId:o.blockId,range:{start:Math.min(i.start,i.end),end:Math.max(i.start,i.end)},...n?{story:n}:{}})}return r}if(t.kind==="selection"){const o=t.start,i=t.end,s=typeof o?.blockId=="string"&&i?.blockId===o.blockId?o.blockId:null;o?.kind==="text"&&i?.kind==="text"&&s&&typeof o.offset=="number"&&typeof i.offset=="number"&&o.offset!==i.offset&&r.push({kind:"text",blockId:s,range:{start:Math.min(o.offset,i.offset),end:Math.max(o.offset,i.offset)},...t.story??o.story?{story:t.story??o.story}:{}})}return r}function hh(e){if(!e||typeof e!="object")return null;const t=e,n=t.story;if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const r=t.range;if(typeof r.start=="number"&&typeof r.end=="number"&&r.start===r.end)return{kind:"text",blockId:t.blockId,range:{start:r.start,end:r.end},...n?{story:n}:{}}}if(t.kind==="text"&&Array.isArray(t.segments)){const r=t.segments[0],o=r?.range;if(typeof r?.blockId=="string"&&typeof o?.start=="number"&&typeof o?.end=="number"&&o.start===o.end)return{kind:"text",blockId:r.blockId,range:{start:o.start,end:o.end},...n?{story:n}:{}}}if(t.kind==="selection"){const r=t.start,o=t.end,i=typeof r?.blockId=="string"&&o?.blockId===r.blockId?r.blockId:null;if(r?.kind==="text"&&o?.kind==="text"&&i&&typeof r.offset=="number"&&typeof o.offset=="number"&&r.offset===o.offset)return{kind:"text",blockId:i,range:{start:r.offset,end:r.offset},...t.story??r.story?{story:t.story??r.story}:{}}}return null}function Ys(e){return hh(e.target)??hh(e.selectionTarget)}var HI=["fontFamily","fontSize","color","highlight"],FH={undo:"history.undo",redo:"history.redo"},ph=["bold","italic","underline","strikethrough"];function d2(e){return HI.includes(e)}function sd(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=[],o=(l,u,d)=>{typeof l!="string"||typeof u!="number"||typeof d!="number"||r.push({blockId:l,start:Math.min(u,d),end:Math.max(u,d)})};for(const l of n){const u=l?.range;o(l?.blockId,u?.start,u?.end)}if(r.length>0)return r;const i=e.selectionTarget,s=i?.start,a=i?.end;return!s||!a||s.blockId!==a.blockId||o(s.blockId,s.offset,a.offset),r}function ys(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:void 0}function NH(e){const t=ys(e);if(!t||typeof t!="object")return"body";const n=t;return JSON.stringify({storyType:typeof n.storyType=="string"?n.storyType:"body",refId:typeof n.refId=="string"?n.refId:null,noteId:typeof n.noteId=="string"?n.noteId:null,textboxId:typeof n.textboxId=="string"?n.textboxId:null})}function Ha(e){const t=sd(e);return t.length===0?null:[NH(e),...t.map(n=>`${n.blockId}:${n.start}-${n.end}`)].join("|")}function $I(e){const t=e.selectionTarget;return!t||typeof t!="object"?null:Dc({selectionTarget:t})}function BH(e,t){if(e==="fontSize"){const r=typeof t=="number"?t:Number(t);return Number.isFinite(r)&&r>0?String(r):null}if(typeof t!="string")return null;const n=t.trim();return n.length===0?null:e==="color"||e==="highlight"?n.toUpperCase():n}function zH(e,t){return Math.max(e.start,t.start)<Math.min(e.end,t.end)}function jH(e){if(!e)return[];const t=Array.isArray(e.blocks)?e.blocks:[],n=[];for(const r of t){const o=r?.range,i=r?.blockId;typeof i!="string"||typeof o?.start!="number"||typeof o?.end!="number"||n.push({blockId:i,start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)})}return n}function VH(e,t){return e.length!==t.length?!1:e.every((n,r)=>{const o=t[r];return o?.blockId===n.blockId&&o?.start===n.start&&o?.end===n.end})}function GI(e,t){const n=sd(t);if(n.length===0)return null;const r=e&&Array.isArray(e.items)?e.items:[];if(r.length===0)return null;const o=r.find(i=>VH(n,jH(i)));if(o)return o;if(n.length===1){const i=r.find(s=>{const a=s?.address;return a?.kind==="block"&&a.nodeId===n[0].blockId});if(i)return i}return r[0]??null}function UH(e,t){const n=t==="fontSize"?e?.fontSizePt??e?.fontSize:t==="highlight"?e?.highlight??e?.backgroundColor:e?.[t];if(typeof n=="number")return Number.isFinite(n)?String(n):void 0;if(typeof n!="string")return;const r=n.trim();if(r.length!==0)return t==="color"||t==="highlight"?r.toUpperCase():r}function f2(e){if(typeof e!="string")return;const t=e.split(",")[0]?.trim().replace(/^['"]+|['"]+$/g,"").trim();if(!t)return;const n=t.toLowerCase();if(!(n==="serif"||n==="sans-serif"||n==="monospace"||n==="cursive"||n==="fantasy"))return t}function HH(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return;const t=Math.round(e*.75*2)/2;if(!(t<=0))return String(t)}function $H(e,t){return e==="fontFamily"?t.toLowerCase():e==="color"||e==="highlight"?t.toUpperCase():t}function WI(e,t){if(!e)return{};const n=new Map;for(const i of sd(t)){const s=n.get(i.blockId)??[];s.push({start:i.start,end:i.end}),n.set(i.blockId,s)}if(n.size===0)return{};const r=Array.isArray(e.blocks)?e.blocks:[],o={};for(const i of HI){const s=new Map;let a=!1,l=!1;for(const u of r){const d=typeof u?.blockId=="string"?u.blockId:null;if(!d)continue;const f=n.get(d);if(!f?.length)continue;const p=Array.isArray(u?.runs)?u.runs:[];for(const g of p){const m=g?.range,v=typeof m?.start=="number"?m.start:null,k=typeof m?.end=="number"?m.end:null;if(v==null||k==null||!f.some(C=>zH(C,{start:v,end:k})))continue;a=!0;const b=UH(g?.styles,i);if(b===void 0){l=!0;continue}const S=$H(i,b);if(s.has(S)||s.set(S,b),s.size>1)break}if(s.size>1)break}a&&!l&&s.size===1&&(o[i]=[...s.values()][0])}return o}function h2(e,t){const n=Dr(e)[0];return n?t==="nodeId"?{kind:"after",nodeId:n}:{kind:"after",target:_o(n)}:{kind:"documentEnd"}}function tn(e,t){const n=e.supported??t!=="unsupported",r=e.enabled??(e.disabled!==void 0?!e.disabled:n);return{enabled:r,disabled:!r,active:e.active??!1,supported:n,value:e.value,source:t,reason:r?void 0:e.reason}}function ad(e){if(!e||typeof e!="object")return null;const t=e,n=t.change,r=n&&typeof n=="object"?n:t;return{...t,id:t.id??r.id,change:r}}function ld(e){const t=e,n=t.change;return n&&typeof n=="object"?n:t}function Xs(e){if(Lr(e))return!0;if(e===!1)return!1;if(e===!0||e==null||typeof e!="object")return!0;const t=e;return"success"in t||"failure"in t||"effects"in t?e:t.status!=="rejected"}function ng(e){return!!e&&typeof e=="object"&&e.success===!0}function GH(e){if(e.dryRun===!0)return!1;const t=e.receipt;return!(t&&typeof t=="object"&&t.changed===!1||t&&typeof t=="object"&&t.noop===!0||t&&typeof t=="object"&&t.status==="NO_OP")}function mo(e){return!(e===!1||e&&typeof e=="object"&&e.success===!1)}function mh(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function p2(e){const t=[],n=r=>{if(!r||typeof r!="object")return;const o=r;if(Array.isArray(o.runs)&&t.push(o),Array.isArray(o.rows))for(const i of o.rows){const s=i?.cells;if(Array.isArray(s))for(const a of s){const l=a;if(Array.isArray(l?.blocks))for(const u of l.blocks)n(u);l?.paragraph&&n(l.paragraph)}}};if(Array.isArray(e))for(const r of e)n(r);return t}function Fc(e,t){return e.sourceAnchor?.sourceNodeId===t?!0:e.id===t}function rg(e){return e.trackedChange?.kind==="delete"?0:typeof e.text=="string"?e.text.length:0}function Si(e){let t=!1,n=null,r=null,o=null;for(const i of e)t=i,!mo(i)&&n===null&&(n=i),ng(i)&&(o=i),i!==!1&&(r=i);return n??o??r??t}function WH(e){const t=e?.anchor,n=t?.start,r=t?.end;return typeof n?.blockId!="string"||typeof r?.blockId!="string"||n.blockId!==r.blockId||typeof n.offset!="number"||typeof r.offset!="number"?null:{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.offset},end:{kind:"text",blockId:r.blockId,offset:r.offset}}}function KH(e){return e.startsWith("#")?{kind:"anchor",anchor:e.slice(1)}:{kind:"external",url:e}}function og(e){return td(e)?.trackDecision??null}function qH(e){return{found:e.length>0,success:e.length>0,rects:e,rect:e[0]}}function Nl(e){return{found:!1,success:!1,rects:[],reason:e}}function YH(e,t){if(!t||typeof t.getBoundingClientRect!="function"||e.rects.length===0)return e;let n;try{const o=t.getBoundingClientRect();n={left:o.left,top:o.top}}catch{return e}const r=e.rects.map(o=>({...o,left:o.left-n.left,right:o.right-n.left,top:o.top-n.top,bottom:o.bottom-n.top}));return{...e,rects:r,rect:r[0]}}function XH(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.blockId!="string"||!t.range||typeof t.range!="object")return!1;const n=t.range;return Number.isInteger(n.start)&&Number.isInteger(n.end)&&n.start>=0&&n.start<=n.end}function KI(e){if(!e||e.kind!=="text"||!Array.isArray(e.segments)||e.segments.length===0)return null;const t=Array.from(e.segments);if(!t.every(XH))return null;const n=t[0],r=t[t.length-1],o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end,...o?{story:o}:{}},...o?{story:o}:{}}}function ZH(e){return e.selectionTarget?e.selectionTarget:KI(e.target)}function cd(e){if(e.empty)return null;if(e.selectionTarget)return e.selectionTarget;const t=KI(e.target);return t&&t.start.kind==="text"&&t.end.kind==="text"&&t.start.blockId!==t.end.blockId?null:t}function m2(e){return!e.inline||typeof e.docRoute!="string"?null:e.docRoute.startsWith("format.")?e.docRoute.slice(7):null}var g2={bold:null,italic:null,underline:null,strike:null,color:null,highlight:null,fontFamily:null,fontSize:null,vertAlign:null,smallCaps:null,caps:null,letterSpacing:null,dstrike:null},QH=Object.fromEntries(Object.entries(g2).filter(([e])=>uH[e]?.tracked===!0));function JH(e,t,n,r){switch(e.kind){case"toggle":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return typeof o=="boolean"||o===null?{target:t,value:o}:{target:t,value:!r}}case"value-string":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return o===null?{target:t,value:null}:typeof o!="string"||o.trim()===""?null:{target:t,value:o}}case"value-number":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n,i=typeof o=="number"?o:Number(o);return!Number.isFinite(i)||i<=0?null:{target:t,value:i}}case"clear":return{target:t,inline:{...g2}};default:return null}}function e$(e){const t=o=>{if(!o||typeof o!="object")return null;const i=o,s=i.rowIndex,a=i.columnIndex;return typeof s!="number"||!Number.isInteger(s)||typeof a!="number"||!Number.isInteger(a)?null:{rowIndex:s,columnIndex:a}};if(!e)return null;const n=t(e.start),r=t(e.end);return!n||!r?null:{start:n,end:r}}function t$(e,t){const{tableNodeId:n,rowIndex:r,columnIndex:o,cellNodeId:i,mergeRange:s}=t;switch(e){case"insert-row-before":return{nodeId:n,rowIndex:r,position:"above"};case"insert-row-after":return{nodeId:n,rowIndex:r,position:"below"};case"delete-row":return{nodeId:n,rowIndex:r};case"insert-column-before":return{nodeId:n,columnIndex:o,position:"left"};case"insert-column-after":return{nodeId:n,columnIndex:o,position:"right"};case"delete-column":return{nodeId:n,columnIndex:o};case"delete-table":return{nodeId:n};case"merge-cells":{const a=s??{start:{rowIndex:r,columnIndex:o},end:{rowIndex:r,columnIndex:o}};return{nodeId:n,start:a.start,end:a.end}}case"split-cell":return i?{nodeId:i,rows:1,columns:2}:null;case"remove-borders":return{nodeId:n,mode:"applyTo",applyTo:"all",border:null};default:return null}}function n$(e){const t=e.superdoc,n=new Map,r=new Map;let o=null,i=0;const s=[];let a=null,l=0,u=!1,d=Promise.resolve(),f=null,p={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:0,pointerSelecting:!1,keyboardSelecting:!1},g=0;const m=new Set;let v={},k="",b=null;const S=()=>{const c=t?.activeEditor;return c&&typeof c=="object"?c:null},C={open:()=>{if(ee)return{ok:!1,reason:lt.notReady};const c=S();if(!c)return{ok:!1,reason:lt.notReady};const h=c.contextMenu;if(!h||typeof h!="object"||typeof h.open!="function")return{ok:!1,reason:lt.operationUnavailable};try{const y=h.open();return y&&typeof y=="object"&&y.ok===!1?{ok:!1,reason:eg(y.reason,lt.operationUnavailable)}:{ok:!0}}catch{return{ok:!1,reason:lt.operationUnavailable}}},close:()=>{if(ee)return;const c=S()?.contextMenu;if(!(!c||typeof c!="object"||typeof c.close!="function"))try{c.close()}catch{}},contextAt:wE},w=()=>{const c=S()?.doc;return c&&typeof c=="object"?c:null},T=()=>{const c=S()?.v2TrackedChanges;return c&&typeof c=="object"?c:null},L=()=>{const c=S();if(c?.editorVersion!==2)return null;const h=c.reviewWindow;return h&&typeof h=="object"?h:null},z=()=>{const c=L();return!c||typeof c.getSnapshot!="function"?null:Ot(()=>c.getSnapshot(),null)},W=()=>typeof L()?.getSnapshot=="function",V=c=>{const h=c?.status;return h==="ready"||h==="stale"?h:"pending"},j=()=>{const c=S()?.host;return c&&typeof c=="object"?c:null},Z=c=>{if(c.storyType!=="headerFooterPart"||typeof c.refId!="string")return null;const h=S(),y=j(),_=h?.pageLayout??y?.pageLayout;if(!_||typeof _!="object")return null;const E=_.getActiveRulerContext,D=y?.resolveHeaderFooterEditTarget;if(typeof E!="function"||typeof D!="function")return null;const U=Ot(()=>E.call(_),null);if(!U||typeof U.pageIndex!="number")return null;for(const oe of["header","footer"]){const fe=Ot(()=>D.call(y,{pageIndex:U.pageIndex,kind:oe}),null);if(!(fe?.status!=="ready"||fe.refId!==c.refId||typeof fe.sectionId!="string"||!["default","first","even"].includes(String(fe.slotVariant))))return{kind:"story",storyType:"headerFooterSlot",section:{kind:"section",sectionId:fe.sectionId},headerFooterKind:oe,variant:fe.slotVariant}}return null},R=()=>{const c=j(),h=c?.getPendingInlineFormat;if(typeof h!="function")return null;const y=Ot(()=>h.call(c),null);return y&&typeof y=="object"?y:null},K=c=>{const h=m2(c);if(!h)return null;const y=R();if(!y||!(h in y))return null;const _=y[h];return c.inline?.kind==="toggle"?_===!0:_!=null&&_!==""},x=c=>{const h=m2(c);if(!h)return;const y=R();if(!y||!(h in y))return;const _=y[h];if(typeof _=="string"&&_!=="")return _;if(typeof _=="number"&&Number.isFinite(_))return String(_)},$=(c,h)=>{const y=j(),_=y?.setPendingInlineFormat;typeof _=="function"&&Ot(()=>_.call(y,c,h),void 0)},H=c=>{const h=j(),y=h?.clearPendingInlineFormat;typeof y=="function"&&Ot(()=>y.call(h,c),void 0)},J=new Set(["bold","italic","underline","strikethrough"]),Q=c=>{const h=R();if(!h)return;const y=Array.isArray(c.activeMarks)?c.activeMarks:[];let _=null;for(const E of Object.keys(h)){const D=h[E];let U;if(J.has(E)){if(D===!1)continue;U=y.includes(E)===(D===!0)}else if(d2(E)){if(D==null)continue;_||(_=Xa(c)),U=_[E]===D}else U=!1;U&&H(E)}},Y=()=>{const c=S()?.editCommands;return c&&typeof c=="object"?c:null},_e=c=>{const h=Y();if(!h||typeof h.getSnapshot!="function")return null;const y=Ot(()=>h.getSnapshot(),null)?.commands?.[c];return y&&typeof y=="object"?y:null},ue=()=>_e("lists.apply"),ve=c=>{const h=c?.value?.seed;return h==="bullet"||h==="ordered"?h:null},ge=c=>{const h=FH[c];return h?_e(h):null},Te=()=>{const c=j();if(!c||typeof c.getTableContext!="function")return null;const h=Ot(()=>c.getTableContext(),null);return h&&typeof h=="object"?h:null},Ne=()=>{const c=Te();if(!c||c.inTable!==!0)return null;const h=c.table,y=typeof h?.nodeId=="string"&&h.nodeId.length>0?h.nodeId:null;if(!y)return null;const _=c.row,E=c.column,D=c.cell,U=typeof _?.index=="number"&&Number.isInteger(_.index)?_.index:null,oe=typeof E?.index=="number"&&Number.isInteger(E.index)?E.index:null;if(U==null||oe==null)return null;const fe=typeof D?.nodeId=="string"&&D.nodeId.length>0?D.nodeId:null,Re=c.cellRange;return{tableNodeId:y,rowIndex:U,columnIndex:oe,cellNodeId:fe,mergeRange:e$(Re)}},Je=new Map;let ct=null,tt=null,Tt=0,ae=0,Ee=0;const Ue=new Set,ie=(c,h)=>c===h?!0:!c||!h?!1:c.id===h.id&&c.paintedEntityId===h.paintedEntityId&&Jn(c.story)===Jn(h.story),I=c=>Array.from(Ue).some(h=>ie(h,c)),se=c=>{const h=j();if(typeof h?.getHandles!="function")return;const y=Ot(()=>h.getHandles(),null),_=y?.review;if(_){if(c){if(typeof _.setActiveReviewTarget!="function")return;const E=y?.layout;Ot(()=>_.setActiveReviewTarget({entityType:"trackedChange",entityId:c.id,...c.paintedEntityId?{paintedEntityId:c.paintedEntityId}:{},origin:"panel",layoutEpoch:typeof E?.generation=="number"?E.generation:0,story:c.story??{kind:"story",storyType:"body"}}),null);return}typeof _.getActiveReviewTarget!="function"||typeof _.clearActiveReviewTarget!="function"||Ot(()=>_.getActiveReviewTarget(),null)?.entityType==="trackedChange"&&Ot(()=>_.clearActiveReviewTarget(),void 0)}},F=(c,h)=>{tt=c,Tt+=1,Ee+=1,h?.invalidateQueuedNavigation!==!1&&(ae+=1)},q=new Set;let P,ee=!1,be=null;const N=new Map,B=new Set;let de=null,Se=null,Ae=!1,Le=null,Xe=0,it=null,yt=null,Mt=null;const Lt=[],Wt=()=>{if(Ae||ee)return;Ae=!0;const c=()=>{Ae=!1,ee||Dt("async-read-settled")};typeof queueMicrotask=="function"?queueMicrotask(c):Promise.resolve().then(c)},Be=250,rn=5e3,zn=c=>{ee||Le&&Xe<=c||(Le&&clearTimeout(Le),Xe=c,Le=setTimeout(()=>{Le=null,Xe=0,ee||Dt()},Math.max(0,c-Date.now())))},Ht=new WeakMap;let xn=0;const Ur=c=>{if(!c)return"none";let h=Ht.get(c);return h==null&&(h=xn+=1,Ht.set(c,h)),`e${h}`};let yr=0;const Ar=e.superdoc,et=dH(Ar),kt=()=>{et.abortController.abort("review-mutation-started"),et.inFlight=null},Bt=()=>{et.generation+=1,et.abortController=new AbortController,et.inFlight=null},cn=c=>{const h=et.activeMutationTokens;if(typeof c!="string"||c.length===0||h.has(c))return;const y=h.size===0;h.add(c),y&&kt()},fn=c=>{const h=et.activeMutationTokens;typeof c!="string"||!h.delete(c)||h.size===0&&Bt()},nn=c=>{const h=T(),y=h?.listTrackedChanges;if(typeof y!="function")return S()?.editorVersion===2?Promise.reject(new Error("v2-tracked-changes-bridge-pending")):c();if(et.activeMutationTokens.size>0)return Promise.reject(new Error("ui-review-catalog-superseded"));const _=et.generation,E=et.inFlight;if(E?.generation===_)return E.promise;const D=et.abortController.signal,U=Re=>{if(D.aborted||_!==et.generation||Re?.reason==="review-hydration-superseded")throw new Error("ui-review-catalog-superseded");return Re},oe=y.call(h,{blocking:!1,signal:D});if(!Lr(oe))return U(oe);const fe=Promise.resolve(oe).then(U);return et.inFlight={generation:_,promise:fe},fe.then(()=>{et.inFlight?.promise===fe&&(et.inFlight=null)},()=>{et.inFlight?.promise===fe&&(et.inFlight=null)}),fe};let wn=null,Qt=new Set,er=null,go=0,je=null;const $e=new WeakSet,nt=new WeakMap,Ct=c=>{if(nt.has(c))return;const h=typeof c.getLocalMutationRevision=="function"?Ot(()=>c.getLocalMutationRevision(),null):null,y=typeof h=="number"?h:0;nt.set(c,y),y>0?$e.add(c):h===0&&$e.delete(c)},Pt=()=>{const c=j();return c?(Ct(c),$e.has(c)):!1},ft=()=>`${Ur(S())}|m${yr}`,In=()=>{wn=null,Qt=new Set},$t=c=>{for(const h of["trackChanges","trackChanges:all"]){const y=N.get(h);if(!y?.hasSettled||!Array.isArray(y.value))continue;const _=y.value.filter(E=>{const D=Vr(E);return!D||!c.has(D)});_.length!==y.value.length&&N.set(h,{...y,value:_})}},gn=c=>{const h=()=>{if(!ee)for(const D of[...q])D(P)},y=mh(c)?c:null,_=S()?.documentMutationReadiness,E=()=>{const D=globalThis.requestAnimationFrame;return typeof D!="function"?Promise.resolve():new Promise(U=>{let oe=!1;const fe=()=>{oe||(oe=!0,clearTimeout(Re),U())},Re=setTimeout(fe,250);D(()=>D(()=>setTimeout(fe,0)))})};if(y?.success===!0&&typeof y.txId=="string"&&y.txId.length>0&&typeof _?.whenPainted=="function")try{Promise.resolve(_.whenPainted.call(_,y)).then(E,()=>{}).then(h,h);return}catch{}h()},vo=(c,h)=>{const y=P.trackChanges,_=y.items.filter(U=>{const oe=Vr(U);return!oe||!c.has(oe)});if(_.length===y.items.length)return;tt&&c.has(tt.id)&&F(null);const E=new Set;for(const U of _){const oe=ld(U),fe=U,Re=oe.author??oe.authorEmail??fe.author??fe.authorEmail;typeof Re=="string"&&E.add(Re)}const D=y.items.length-_.length;P={...P,trackChanges:{...y,items:_,total:Math.max(_.length,y.total-D),activeId:y.activeId&&c.has(y.activeId)?null:y.activeId,authors:[...E]}},gn(h)},Po=c=>{const h=P.trackChanges,y=h.items.length>0||h.total!==0||h.activeId!==null||h.authors.length>0;er=ft(),tt!==null&&F(null),P={...P,trackChanges:{...h,items:[],total:0,activeId:null,authors:[]}},y&&gn(c)},Hi=(c,h)=>{if(c.size===0)return;const y=ft(),_=wn===y?Qt:new Set,E=new Set([...c].filter(D=>!_.has(D)));E.size!==0&&(wn=y,Qt=new Set([..._,...E]),$t(Qt),vo(E,h))},on=c=>wn===c&&Qt.size>0?Qt:null,Kn=c=>{const h=ft(),y=on(h),_=c.map(ad).filter(E=>{if(E==null)return!1;const D=Vr(E);return D!=null&&!y?.has(D)});for(const E of["trackChanges","trackChanges:all"])N.set(E,{token:h,value:[..._],hasSettled:!0,inflightToken:null})},Hn=()=>`${ft()}|m${$n()}|s${go}`,Yr=c=>JSON.stringify({t:c.target??null,s:c.selectionTarget??null}),ln=["contentControls:inRange:","query:","effInline:"],Ln=120,br=180,Ao=()=>{const c=j(),h=c?.getDocumentLoadingSnapshot;if(typeof h!="function")return"unknown";const y=Ot(()=>h.call(c),null)?.sourceStage;return y==="opening"||y==="bootstrap-ready"||y==="source-loading"?"loading":y==="source-complete"||y==="source-failed"||y==="source-cancelled"?"complete":"unknown"},Io=new Map,Wo=new Map,_i=new Map;let Ai=null;const yo={comments:0,trackChanges:0,contentControls:0},Eo=c=>{const h=ft();Io.get(c)!==h&&(Io.set(c,h),Wt())},Bl=()=>{const c=N.get("comments");return c?.hasSettled?Array.isArray(c.value)&&c.value.length>0:c?.inflightToken!=null},Zs=(c,h)=>Io.get(c)===h,ai=()=>{const c=ft();let h=!1;for(const[y,_]of Wo){if(_!==c){Wo.delete(y);continue}if(_i.get(y)===c)continue;const E=N.get(y);!E?.hasSettled||E.token!==c||E.inflightToken!=null||(N.set(y,{...E,token:null,inflightToken:null}),_i.set(y,c),h=!0)}h&&Wt()},Ie=c=>{yo[c]+=1,Eo(c);let h=!1;return()=>{h||(h=!0,yo[c]=Math.max(0,yo[c]-1),yo[c]===0&&Io.get(c)===ft()&&Io.delete(c),Wt())}},ze=c=>{Eo("contentControls")},mt=()=>{const c=N.get("trackChanges");c?.hasSettled||c?.inflightToken!=null||Eo("trackChanges")},ht=()=>{const c=N.get("comments");c?.hasSettled||c?.inflightToken!=null||Eo("comments")},Rn=6500,Vn=250;let Hr=0,Xr=0,bo=!1,oo=null;const li=()=>{if(ee||oo)return;const c=()=>{if(oo=null,ee)return;const h=Date.now()-Hr;if(ci()||h<Rn){oo=setTimeout(c,Vn);return}bo=!1,Dt()};oo=setTimeout(c,0)};let Fo=null,qn=null;const zl=()=>{const c=j();if(!c||Fo===c)return;qn&&(qn(),qn=null),Fo=c;const h=c.subscribeDocumentLoading;if(typeof h!="function"){Fo=null,fr(Rn);return}try{const y=D=>{const U=D?.sourceStage;(U==="source-complete"||U==="source-failed"||U==="source-cancelled")&&(Ai=ft(),ai(),Hr=Math.max(Hr,Date.now()),li())},_=h.call(c,y);typeof _=="function"&&(qn=_);const E=c.getDocumentLoadingSnapshot;typeof E=="function"&&y(Ot(()=>E.call(c),null))}catch{Fo=null,fr(Rn)}},Qs=()=>{const c=S()?.host,h=c?.getForegroundMutationState;if(typeof h!="function")return null;const y=Ot(()=>h.call(c),null);return{active:typeof y?.active=="number"?y.active:0,pending:typeof y?.pending=="number"?y.pending:0}},ci=()=>{const c=Qs();return!!(c&&(c.active>0||c.pending>0))},fr=(c=Ln)=>{ee||it||(it=setTimeout(()=>{if(it=null,ee)return;if(ci()){fr();return}const h=yt;yt=null,h===Hn()&&Nc("selection",h,Uc,Yi),Dt()},c))},Ko=(c,h)=>{if(!Qs())return!1;const y=`${c}\0${h}`;return B.has(y)?!1:(B.add(y),fr(br),!0)},$i=c=>{if(de==null||c===de)return Se?.timer&&clearTimeout(Se.timer),Se=null,de=c,!1;if(Se?.key===c)return Se.ready?(Se=null,de=c,!1):!0;Se?.timer&&clearTimeout(Se.timer);const h={key:c,ready:!1,timer:null};return h.timer=setTimeout(()=>{ee||Se!==h||(h.timer=null,h.ready=!0,Dt())},br),Se=h,!0},Gi=c=>rH(c),Js=()=>{Ti(),Dt()};let Wi=null,Ki=null,ea=!1,Ii=0,Ei=!1,ta=0;const $a=()=>{Wi=null,ea=!1,Ii+=1},ud=()=>{Ki=null,Ei=!1,ta+=1},qi=()=>{const c=S(),h=c?.documentMutationReadiness;if(!c||typeof h?.whenPainted!="function"||(Wi={editor:c,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Ot(()=>h.getRenderEpoch.call(h),null):null},ea))return;ea=!0;const y=Ii;(async()=>{for(;!ee&&y===Ii;){const E=Wi;if(Wi=null,!E){ea=!1;return}let D=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),D=!0}catch{}if(ee||y!==Ii)return;if(S()!==E.editor){$a();return}D&&Js()}})()},jl=()=>{const c=S(),h=c?.documentMutationReadiness;if(!c||typeof h?.whenPainted!="function")return!1;if(Ki={editor:c,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Ot(()=>h.getRenderEpoch.call(h),null):null},Ei)return!0;Ei=!0;const y=ta;return(async()=>{for(;!ee&&y===ta;){const E=Ki;if(Ki=null,!E){Ei=!1;return}let D=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),D=!0}catch{}if(ee||y!==ta)return;if(S()!==E.editor){ud();return}Ki||(go+=1,wr(),Dt(D?"post-paint-selection":"post-paint-selection-failed"))}})(),!0},ws=()=>{Mt&&clearTimeout(Mt),Mt=setTimeout(()=>{Mt=null,ee||Js()},500)},Nc=(c,h,y,_)=>{let E;try{E=y()}catch{E=void 0}if(!Lr(E)){const oe={token:h,value:_(E),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0};return N.set(c,oe),oe}const D=N.get(c),U=D?.failedToken===h;return N.set(c,{token:D?.token??null,value:D?.value??null,hasSettled:D?.hasSettled??!1,inflightToken:h,failedToken:U?h:null,failureCount:U?D.failureCount??0:0,retryAtMs:0}),Promise.resolve(E).then(oe=>{const fe=N.get(c);if(!fe||fe.inflightToken!==h)return;N.set(c,{token:h,value:_(oe),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0});const{sink:Re,workerContext:Fe}=Jm();if(Re){const Pe=Va();Lt.push({key:c,settledAtMs:Pe,commandId:Fe?.commandId??null,commandKind:Fe?.commandKind??null}),a2({stage:"superdoc-ui-async-read-settled",atMs:Pe,key:c,settledAtMs:Pe,commandId:Fe?.commandId??null,commandKind:Fe?.commandKind??null})}Wt()},()=>{const oe=N.get(c);if(!oe||oe.inflightToken!==h)return;const fe=oe.failedToken===h?(oe.failureCount??0)+1:1,Re=Math.min(rn,Be*2**Math.min(fe-1,8)),Fe=Date.now()+Re;N.set(c,{...oe,inflightToken:null,failedToken:h,failureCount:fe,retryAtMs:Fe}),zn(Fe)}),null},Zr=(c,h,y,_)=>{const E=N.get(c);if(E&&E.token===h&&E.hasSettled)return{value:E.value,status:"ready"};if(CH(c)&&!Zs(c,h)){if(Ao()==="loading")return bo=!0,zl(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(bo)return li(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(Date.now()-Xr<Rn)return bo=!0,li(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"}}if(ci())return fr(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(E?.failedToken===h&&E.inflightToken==null&&(E.retryAtMs??0)>Date.now())return zn(E.retryAtMs),E.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(!E&&c.startsWith("effInline:")&&$i(c))return{value:null,status:"pending"};if(!E&&Ko(c,h))return{value:null,status:"pending"};if(!E||E.inflightToken!==h){const U=Nc(c,h,y,_);if(U)return{value:U.value,status:"ready"}}const D=N.get(c);return D?.hasSettled?{value:D.value,status:"stale"}:{value:null,status:"pending"}},na=c=>{for(const h of N.keys())c(h)&&N.delete(h)},dd=c=>{const h=Yr(c),y=$I(c);return new Set([`contentControls:inRange:${h}`,`query:${h}`,...y?[`effInline:${y}`]:[]])},gh=c=>{const h=dd(c);na(y=>ln.some(_=>y.startsWith(_))&&!h.has(y));for(const y of B){const _=y.split("\0",1)[0];ln.some(E=>_.startsWith(E))&&!h.has(_)&&B.delete(y)}},Bc=()=>{const c=S();c!==je&&($a(),ud(),je=c,N.clear(),Le&&clearTimeout(Le),Le=null,Xe=0,Se?.timer&&clearTimeout(Se.timer),Se=null,de=null,b=null,o=null,yt=null,B.clear(),Io.clear(),Wo.clear(),_i.clear(),Ai=null,bo=!1,qn&&qn(),qn=null,Fo=null,In(),er=null)},Ti=()=>{yr+=1,Wo.clear(),_i.clear(),Ai=null,In()},Vl=()=>{const c=er===ft();Ti(),c&&(Kn([]),er=ft()),Dt()},Ul=c=>{if(typeof c!="string"||c.length===0)return Wn("insertText requires a non-empty string.","INVALID_INPUT");if($n()==="viewing")return Wn("The document is read-only.","DOCUMENT_READONLY");const h=w(),y=h?.insert;if(!h||typeof y!="function")return Wn("insert is unavailable.");const _=h.selection?.current;if(typeof _!="function")return Wn("selection.current is unavailable.");const E=U=>{const oe=U&&typeof U=="object"?U:null,fe=oe?.selectionTarget??oe?.target??null;return!fe||typeof fe!="object"?Wn("insertText requires a live selection target.","PRECONDITION_FAILED"):Ot(()=>rc(y.call(h,{type:"text",value:c,target:fe}),Wn("insert failed.")),Wn("insert failed."))};let D;try{D=_.call(h.selection)}catch{return Wn("insertText could not resolve the live selection.","PRECONDITION_FAILED")}return Lr(D)?Promise.resolve(D).then(E,()=>Wn("insertText could not resolve the live selection.","PRECONDITION_FAILED")):E(D)},ra=(c,h)=>({payload:c,state:P,editor:S(),superdoc:t,context:h,ui:be,execute:(y,_)=>tu(y,_),executeAsync:(y,_)=>Cg(y,_),doc:w(),selection:P.selection,documentMode:$n(),insertText:Ul}),zc=c=>c==="editing"||c==="suggesting"||c==="viewing"?c:null,$n=()=>{const c=S(),h=t&&typeof t=="object"?t:null,y=zc(h?.config?.documentMode),_=Ot(typeof h?.getActiveRuntime=="function"?()=>{const U=h.getActiveRuntime();return typeof U?.getSnapshot=="function"?U.getSnapshot():null}:void 0,null),E=zc(_?.documentMode),D=zc(c?.options?.documentMode);return y&&E&&y!==E?y:E??y??D},Hl=()=>{const c=t&&typeof t=="object"?t:null,h=c?.interactionConfig?.comments;if(h&&typeof h.readOnly=="boolean")return h.readOnly===!0;const y=c?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.readOnly===!0},jc=()=>{if($n()==="viewing")return lt.documentReadonly;const c=(t&&typeof t=="object"?t:null)?.interactionConfig?.trackedChanges;return c&&typeof c.allowDecisions=="boolean"?c.allowDecisions?void 0:lt.trackedChangeDecisionsDisabled:Hl()?lt.documentReadonly:void 0},fd=()=>{const c=t&&typeof t=="object"?t:null,h=c?.interactionConfig?.comments;if(h&&typeof h.allowResolve=="boolean")return h.allowResolve===!1;const y=c?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.allowResolve===!1},Ga=()=>Hl(),Vc=()=>jc()!=null,Yi=c=>c&&typeof c=="object"?c:null,oa=(c,h)=>{if(!c)return{...yH,status:h};const y=c.target??null,_=typeof c.text=="string"?c.text:"";return{status:h,empty:c.empty===!0,target:y,selectionTarget:c.selectionTarget??null,activeMarks:Array.isArray(c.activeMarks)?c.activeMarks:[],activeCommentIds:Array.isArray(c.activeCommentIds)?c.activeCommentIds:[],activeChangeIds:Array.isArray(c.activeChangeIds)?c.activeChangeIds:[],quotedText:_}},ia=()=>{const c=w()?.selection;return Zr("selection",Hn(),()=>c?.current?c.current({includeText:!0}):void 0,Yi)},Wa=()=>{const{value:c,status:h}=ia();return oa(c,h)},Uc=()=>{const c=w()?.selection;return c?.current?c.current({includeText:!0}):void 0},$l=c=>{if(c.empty!==!0)return!1;const h=c.selectionTarget,y=h?.start,_=h?.end;return y?.kind==="text"&&_?.kind==="text"&&typeof y.blockId=="string"&&y.blockId===_.blockId&&typeof y.offset=="number"&&y.offset===_.offset},wr=c=>{const h=j(),y=h?.readLiveSelectionSyncSnapshot;if(typeof y!="function")return;const _=Yi(Ot(()=>y.call(h),null));if(!_||!$l(_))return;const E=Hn(),D=Qs(),U=!!(D&&(D.active>0||D.pending>0));if(U)yt=E,fr();else if(yt=null,Nc("selection",E,Uc,Yi))return;const oe=N.get("selection"),fe=Array.isArray(_.activeMarks)&&_.activeMarks.length>0?_.activeMarks:Array.isArray(P.selection.activeMarks)?P.selection.activeMarks:[],Re=Array.isArray(_.activeCommentIds)?_.activeCommentIds:[],Fe=IH(c),Pe=Ys(P.selection),Ye=hh(_.selectionTarget)??hh(_.target),Ze=Pe?.range,Ke=Ye?.range,We=!!(D&&D.active>0&&Pe&&Ye&&Pe.blockId===Ye.blockId&&Jn(Pe.story)===Jn(Ye.story)&&typeof Ze?.start=="number"&&typeof Ke?.start=="number"&&Math.abs(Ke.start-Ze.start)<=2),at=Fe!=null||We?P.selection.activeChangeIds.filter(qe=>Fe==null||Ks(P.trackChanges.items).aliasesFor(qe).includes(Fe)):[],dt=Array.isArray(_.activeChangeIds)&&_.activeChangeIds.length>0?_.activeChangeIds:at;N.set("selection",{token:E,value:{..._,activeMarks:fe,activeCommentIds:Re,activeChangeIds:dt},hasSettled:!0,inflightToken:U?null:oe?.inflightToken??null})},Gl=async(c=0)=>{const h=w()?.selection,y=h?.current,_=Hn();if(typeof y!="function")return N.set("selection",{token:_,value:null,hasSettled:!0,inflightToken:null}),Dt(),P.selection;let E;try{E=y.call(h,{includeText:!0}),Lr(E)&&(E=await Promise.resolve(E))}catch{E=null}return ee?oa(null,"pending"):Hn()!==_?c<1?Gl(c+1):P.selection:(N.set("selection",{token:_,value:Yi(E),hasSettled:!0,inflightToken:null}),Dt(),P.selection)},Wl=()=>{const c=w()?.comments;return Zr("comments",ft(),()=>c?.list?c.list():void 0,h=>h&&Array.isArray(h.items)?h.items:[])},xi=(c="trackChanges")=>{const h=ft(),y=w()?.trackChanges,_=T(),E=typeof _?.listTrackedChanges=="function"?_.listTrackedChanges:null,D=Zr(c,h,()=>E?nn(()=>y?.list?.({in:"all"})):y?.list?y.list({in:"all"}):void 0,U=>{const oe=U&&typeof U=="object"?U:null;if(oe?.complete===!1||oe?.sourceCoverageComplete===!1){if(Wo.set(c,h),zl(),Ai===h||Ao()==="complete"){const fe=()=>{ee||ai()};typeof queueMicrotask=="function"?queueMicrotask(fe):Promise.resolve().then(fe)}}else Wo.get(c)===h&&Wo.delete(c);return oe&&Array.isArray(oe.items)?oe.items:[]});return Wo.get(c)===h&&D.status==="ready"?{...D,status:"stale"}:D},hd=c=>{const h=z(),y=W(),_=y?null:Wl(),E=y&&Array.isArray(h?.commentItems)?h.commentItems:null,D=y?E:_.value,U=y?V(h):_.status,oe=D??[],fe=c.activeCommentIds,Re=N.get("comments"),Fe=Re?.token===ft()&&Re.hasSettled&&Array.isArray(Re.value)?Re.value:null,Pe=yo.comments>0?Fe:oe;ct&&Pe&&!Pe.some(Ze=>Vr(Ze)===ct)&&(ct=null);const Ye=ct??fe[0]??null;return{status:Pl(U,c.status),listStatus:U,items:oe,total:oe.length,activeIds:fe,activeId:Ye}},pd=new WeakMap,Ka=c=>{const h=pd.get(c);if(h)return h;const y=c.map(ad).filter(_=>_!=null);return pd.set(c,y),y},md=new WeakMap,Kl=(c,h)=>{const y=md.get(c);if(y?.suppressedIds===h)return y.value;const _=h?c.filter(E=>{const D=Vr(E);return!D||!h.has(D)}):c;return md.set(c,{suppressedIds:h,value:_}),_},Hc=new WeakMap,ql=c=>{const h=Hc.get(c);if(h)return h;const y=new Set;for(const E of c){const D=ld(E),U=E,oe=D.author??D.authorEmail??U.author??U.authorEmail;typeof oe=="string"&&y.add(oe)}const _=[...y];return Hc.set(c,_),_},Qr=()=>{const c=ft();if(W()){const _=N.get("trackChanges"),E=_?.token===c&&_.hasSettled&&Array.isArray(_.value)?_.value:z()?.trackedChangeItems;return Array.isArray(E)?Ka(E):null}const{value:h,status:y}=xi("trackChanges:all");return y==="ready"?Ka(h??[]):null},$c=c=>{const h=ft(),y=on(h),_=z(),E=W(),D=E?null:xi(),U=E&&Array.isArray(_?.trackedChangeItems)?_.trackedChangeItems:null,oe=E?U:D.value,fe=E?V(_):D.status,Re=Kl(Ka(oe??[]),y),Fe=Qr(),Pe=tt;if(Pe&&!Ue.has(Pe)){const Et=N.get("trackChanges"),_n=Et?.token===h&&Et.hasSettled&&Array.isArray(Et.value)?Kl(Ka(Et.value),y):null,An=yo.trackChanges>0?_n:Pe.story?Fe:Re;An&&!An.some(kr=>ki(kr,Pe.id,Pe.story))&&F(null)}const Ye=Fe??Re,Ze=Fl(Ye,vs(c)),Ke=er===h?[]:y?c.activeChangeIds.filter(Et=>!y.has(Et)):c.activeChangeIds,We=Ke.map(Et=>Ze.toPublicId(Et)??Et),at=tt?.story?Fl(Ye,tt.story):Ks(Ye),dt=tt?at.toPublicId(tt.id)??tt.id:null,qe=RH({selectionIds:Ke,publicIds:We,selection:c,bodyItems:Re,allStoryItems:Fe}),At=dt??qe;return{status:Pl(fe,c.status),items:Re,total:Re.length,activeId:At,authors:ql(Re)}},gd=(c,h)=>{if(!W())return h;Eo("comments");const y=Wl(),_=y.value??h.items;return{status:Pl(y.status,c.status),listStatus:y.status,items:_,total:_.length,activeIds:c.activeCommentIds,activeId:ct??c.activeCommentIds[0]??null}},vd=(c,h)=>{if(!W())return h;Eo("trackChanges");const y=xi(),_=on(ft()),E=Kl(Ka(y.value??h.items),_),D=tt?.story?Fl(E,tt.story):Ks(E),U=tt?D.toPublicId(tt.id)??tt.id:h.activeId;return{status:Pl(y.status,c.status),items:E,total:E.length,activeId:U,authors:ql(E)}};let Gc=null,yd=[];const qa=(c,h)=>{const y=ft();return h==="ready"?(Gc=y,yd=c,{items:c,status:h}):h==="pending"&&Gc===y?{items:yd,status:"stale"}:{items:c,status:h}},bd=c=>{const h=w()?.contentControls,{value:y,status:_}=Zr("contentControls",ft(),()=>h?.list?h.list():void 0,Pe=>Pe&&Array.isArray(Pe.items)?Pe.items:[]),E=y??[],{items:D,status:U}=vh(h,c),oe=new Map(D.map(Pe=>[Pe.id,Pe])),fe=new Set(E.map(Pe=>Pe.id)),Re=[...E.map(Pe=>oe.get(Pe.id)??Pe),...D.filter(Pe=>!fe.has(Pe.id))],Fe=D.map(Pe=>Pe.id);return{status:Pl(_,U,c.status),items:Re,total:Re.length,activeId:Fe[0]??null,activeIds:Fe}},Ya=(c,h)=>{if(!c||typeof c.listInRange!="function")return{lockModesById:new Map,rows:[],status:"ready"};const y=LH(h);if(!y)return{lockModesById:new Map,rows:[],status:"ready"};const{value:_,status:E}=Zr(`contentControls:inRange:${Yr(h)}`,ft(),()=>c.listInRange(y),oe=>oe&&Array.isArray(oe.items)?oe.items:[]),D=_??[],U=new Map;for(const oe of D)typeof oe?.id=="string"&&U.set(oe.id,typeof oe.lockMode=="string"?oe.lockMode:"unlocked");return{lockModesById:U,rows:D,status:E}},vh=(c,h)=>{const{rows:y,status:_}=Ya(c,h),E=h.selectionTarget,D=h.target;let U=E?.start;if(E){if(E.kind!=="selection"||U?.kind!=="text"||typeof U.blockId!="string"||typeof U.offset!="number")return qa([],_)}else{const We=D?.kind==="text"&&Array.isArray(D.segments)?D.segments[0]:void 0,at=We?.range;if(typeof We?.blockId!="string"||typeof at?.start!="number")return qa([],_);U={kind:"text",blockId:We.blockId,offset:at.start,story:D?.story}}const oe=(D?.coordinateSpace!=="tracked"&&Array.isArray(D?.segments)?D.segments:[]).find(We=>We.blockId===U.blockId),fe=oe?.range,Re=oe&&typeof oe.blockId=="string"&&typeof fe?.start=="number"?{kind:"text",blockId:oe.blockId,offset:fe.start,story:D?.story??U.story}:null,Fe=(E?E.coordinateSpace:D?.coordinateSpace)==="tracked"?"tracked":"visible",Pe=Fe==="tracked"?Re:U,Ye=Dr(h),Ze=Ye.indexOf((Pe??U).blockId),Ke=y.map((We,at)=>({item:We,index:at})).filter(({item:We})=>{const at=We.selectionTarget,dt=at?.coordinateSpace==="tracked"?"tracked":"visible";if(dt==="tracked"&&Fe!=="tracked")return!1;const qe=dt==="tracked"?U:Pe;if(!qe)return!1;const At=at?.start,Et=at?.end;if(at?.kind!=="selection"||At?.kind!=="text"||Et?.kind!=="text"||typeof At.blockId!="string"||typeof Et.blockId!="string"||typeof At.offset!="number"||typeof Et.offset!="number"||Jn(at.story??At.story??Et.story)!==Jn(E?.story??qe.story))return!1;if(At.blockId===Et.blockId){if(qe.blockId!==At.blockId)return!1;const kr=Math.min(At.offset,Et.offset),Er=Math.max(At.offset,Et.offset);return kr===Er?qe.offset===kr:qe.offset>=kr&&qe.offset<Er}if(qe.blockId===At.blockId)return qe.offset>=At.offset;if(qe.blockId===Et.blockId)return qe.offset<Et.offset;if(Ze===-1)return!1;const _n=Ye.indexOf(At.blockId),An=Ye.indexOf(Et.blockId);return _n!==-1&&An!==-1?Ze>Math.min(_n,An)&&Ze<Math.max(_n,An):_n!==-1?Ze>_n:An!==-1?Ze<An:!0}).sort((We,at)=>{const dt=We.item.selectionTarget,qe=at.item.selectionTarget,At=dt.start.kind==="text"&&dt.end.kind==="text"&&dt.start.blockId===dt.end.blockId,Et=qe.start.kind==="text"&&qe.end.kind==="text"&&qe.start.blockId===qe.end.blockId;if(At!==Et)return At?-1:1;if(We.item.kind!==at.item.kind)return We.item.kind==="inline"?-1:1;if(At&&Et&&dt.start.kind==="text"&&dt.end.kind==="text"&&qe.start.kind==="text"&&qe.end.kind==="text"){const _n=Math.abs(dt.end.offset-dt.start.offset),An=Math.abs(qe.end.offset-qe.start.offset);if(_n!==An)return _n-An}return at.index-We.index}).map(({item:We})=>We);return qa(Ke,_)},wd=()=>{const c=t?.fonts;return{options:a$(i$(Ot(c?.getDocumentFontOptions?()=>c.getDocumentFontOptions():void 0,[])),s$(Ot(c?.getFontFamilyOptions?()=>c.getFontFamilyOptions():void 0,[]))),sizeOptions:l$}},Cd=()=>{const c=Ot(t?.getZoomState?()=>t.getZoomState():void 0,null),h=typeof c?.value=="number"?c.value:100,y=c?.mode;return{mode:y==="manual"||y==="fit-width"?y:y==="fixed"?"manual":null,value:h,min:typeof c?.min=="number"?c.min:10,max:typeof c?.max=="number"?c.max:100}},kd=()=>Ot(t?.getMeasurementUnit?()=>t.getMeasurementUnit():void 0,"in")==="cm"?"cm":"in",Wc=()=>{const c=S(),h=c?c.isDirty:void 0;return{ready:c!=null,mode:$n(),dirty:c?h===void 0?Pt():!!h:!1}},Kc=c=>{const h=c.quotedText;if(typeof h!="string"||h.length===0)return null;const y=sd(c);if(y.length===0||!Pc(y.map(D=>D.blockId)))return null;const _=c.target,E=y.length===1?_o(y[0].blockId,_?.story):void 0;return{select:{type:"text",pattern:h,mode:"contains",caseSensitive:!0},...E?{within:E}:{},require:"any"}},yh=c=>{const h=w()?.query;if(typeof h?.match!="function")return null;const y=Kc(c);if(!y)return null;const{value:_}=Zr(`query:${Yr(c)}`,ft(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return GI(_,c)},qc=c=>{const h=j(),y=new Set(Dr(c));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const D=Ot(()=>{if(typeof _!="function")return E.call(h);const We=ys(c);return We?_.call(h,[...y],We):_.call(h,[...y])},null);if(!Array.isArray(D))return{};const U=p2(D),oe=We=>{const at={},dt=f2(We.fontFamily);dt&&(at.fontFamily=dt);const qe=HH(We.fontSize);return qe&&(at.fontSize=qe),typeof We.color=="string"&&We.color.trim()!==""&&(at.color=We.color.trim().toUpperCase()),typeof We.highlight=="string"&&We.highlight.trim()!==""&&(at.highlight=We.highlight.trim().toUpperCase()),at},fe=Ys(c),Re=fe&&typeof fe.range?.start=="number"?fe.range.start:null;if(fe&&Re!==null&&y.has(fe.blockId)){const We=U.find(dt=>Fc(dt,fe.blockId)),at=We&&Array.isArray(We.runs)?We.runs:null;if(at&&at.length>0&&at.every(dt=>dt?.kind==="text"||dt?.kind==="tab")){let dt=0,qe=null;for(const At of at){const Et=rg(At);if(Re>=dt&&Re<dt+Et){qe=At;break}dt+=Et}if(!qe){for(let At=at.length-1;At>=0&&!qe;At-=1)at[At]?.kind==="text"&&(qe=at[At]);qe??=at[at.length-1]??null}return qe?oe(qe):{}}}const Fe=sd(c);if(Fe.length>0){const We=new Set,at=new Set;let dt=!1,qe=!0;for(const At of Fe){const Et=U.find(kr=>Fc(kr,At.blockId));if(!Et)return{};const _n=Array.isArray(Et.runs)?Et.runs:[];if(_n.length===0)continue;if(!_n.every(kr=>kr?.kind==="text"||kr?.kind==="tab")){qe=!1;break}let An=0;for(const kr of _n){const Er=rg(kr),Tr=An,Pr=An+Er;if(Tr<At.end&&Pr>At.start){dt=!0;const ei=oe(kr);ei.fontFamily&&We.add(ei.fontFamily),ei.fontSize&&at.add(ei.fontSize)}An=Pr}}if(qe&&dt){const At={};return We.size===1&&(At.fontFamily=[...We][0]),at.size===1&&(At.fontSize=[...at][0]),At}}const Pe=new Set,Ye=new Set;let Ze=!1;for(const We of U){if(![...y].some(dt=>Fc(We,dt)))continue;const at=Array.isArray(We.runs)?We.runs:[];for(const dt of at){if(dt?.kind!=="text")continue;Ze=!0;const qe=oe(dt);qe.fontFamily&&Pe.add(qe.fontFamily),qe.fontSize&&Ye.add(qe.fontSize)}}if(!Ze)return{};const Ke={};return Pe.size===1&&(Ke.fontFamily=[...Pe][0]),Ye.size===1&&(Ke.fontSize=[...Ye][0]),Ke},qo=c=>{const h=j(),y=new Set(Dr(c));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const D=Ot(()=>{if(typeof _!="function")return E.call(h);const Ke=ys(c);return Ke?_.call(h,[...y],Ke):_.call(h,[...y])},null);if(!Array.isArray(D))return{};const U=p2(D),oe=Ke=>({bold:Ke.bold===!0,italic:Ke.italic===!0,underline:Ke.underline!=null,strikethrough:Ke.strike===!0}),fe=Ke=>{const We={};for(const at of ph){const dt=Ke[at];dt.size===1&&(We[at]=[...dt][0])}return We},Re=Ys(c),Fe=Re&&typeof Re.range?.start=="number"?Re.range.start:null;if(Re&&Fe!==null&&y.has(Re.blockId)){const Ke=U.find(at=>Fc(at,Re.blockId)),We=Ke&&Array.isArray(Ke.runs)?Ke.runs:null;if(We&&We.length>0&&We.every(at=>at?.kind==="text"||at?.kind==="tab")){let at=0,dt=null;for(const qe of We){const At=rg(qe);if(Fe>=at&&Fe<at+At){dt=qe;break}at+=At}if(!dt){for(let qe=We.length-1;qe>=0&&!dt;qe-=1)We[qe]?.kind==="text"&&(dt=We[qe]);dt??=We[We.length-1]??null}return dt?oe(dt):{}}}const Pe=sd(c);if(Pe.length>0){const Ke={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let We=!1,at=!0;for(const dt of Pe){const qe=U.find(_n=>Fc(_n,dt.blockId));if(!qe)return{};const At=Array.isArray(qe.runs)?qe.runs:[];if(At.length===0)continue;if(!At.every(_n=>_n?.kind==="text"||_n?.kind==="tab")){at=!1;break}let Et=0;for(const _n of At){const An=rg(_n),kr=Et,Er=Et+An;if(kr<dt.end&&Er>dt.start){We=!0;const Tr=oe(_n);for(const Pr of ph)Ke[Pr].add(Tr[Pr])}Et=Er}}if(at&&We)return fe(Ke)}const Ye={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Ze=!1;for(const Ke of U){if(![...y].some(at=>Fc(Ke,at)))continue;const We=Array.isArray(Ke.runs)?Ke.runs:[];for(const at of We){if(at?.kind!=="text")continue;Ze=!0;const dt=oe(at);for(const qe of ph)Ye[qe].add(dt[qe])}}return Ze?fe(Ye):{}},Yc=(c,h)=>{if(h.fontFamily!==void 0&&h.fontSize!==void 0&&h.color!==void 0&&h.highlight!==void 0)return{values:h,effectiveUniformityStatus:"ready"};const y=qc(c),_={...y.fontFamily!==void 0?{fontFamily:y.fontFamily}:{},...y.fontSize!==void 0?{fontSize:y.fontSize}:{},...y.color!==void 0?{color:y.color}:{},...y.highlight!==void 0?{highlight:y.highlight}:{},...h};if(!c.empty&&(_.fontFamily===void 0||_.fontSize===void 0)){const E=bh(c);return E.values&&(_.fontFamily===void 0&&E.values.fontFamily!==void 0&&(_.fontFamily=E.values.fontFamily),_.fontSize===void 0&&E.values.fontSize!==void 0&&(_.fontSize=E.values.fontSize)),{values:_,effectiveUniformityStatus:E.status}}return{values:_,effectiveUniformityStatus:"ready"}},Xc=["fontFamily","fontSize","bold","italic","underline","strikethrough"],Zc=c=>{const h=c.selectionTarget;if(!h)return{value:null,status:"ready"};const y=vr(w(),"format.readEffectiveInlineUniformity");if(!y)return{value:null,status:"ready"};const _=$I(c)??Yr(c);return Zr(`effInline:${_}`,ft(),()=>y({target:h,offsetSpace:"selection",keys:Xc}),E=>E&&typeof E=="object"?E:null)},bh=c=>{const{value:h,status:y}=Zc(c);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E=D=>{const U=_?.[D];if(!(!U||U.state!=="uniform"||typeof U.value!="string"))return D==="fontFamily"?f2(U.value):U.value};return{values:{fontFamily:E("fontFamily"),fontSize:E("fontSize")},status:y}},Yl=c=>{const{value:h,status:y}=Zc(c);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E={};for(const D of ph){const U=_?.[D];U?.state==="uniform"&&(U.value==="true"||U.value==="false")&&(E[D]=U.value==="true")}return{values:E,status:y}},wh=(c,h)=>{const y=c.activeMark;if(!y||!ph.includes(y))return null;const _=y,E=qo(h)[_];if(E!==void 0)return E;const{values:D}=Yl(h),U=D?.[_];return U!==void 0?U:null},Ch=async c=>{const h=c.selectionTarget;if(!h)return null;const y=vr(w(),"format.readEffectiveInlineUniformity");if(!y)return null;try{const _=await Promise.resolve(y({target:h,offsetSpace:"selection"}));return _&&typeof _=="object"&&_.success===!0?_:null}catch{return null}},kh=(c,h,y)=>{const _=y.values;for(const E of["fontFamily","fontSize"]){if(h[E]!==void 0)continue;const D=_?.[E];D?.state==="uniform"&&typeof D.value=="string"?c[E]=E==="fontFamily"?f2(D.value):D.value:delete c[E]}},Qc=c=>Yc(c,WI(yh(c),c)),Xa=c=>Qc(c).values,Jc=async c=>{const h=w()?.query,y=Kc(c);if(typeof h?.match!="function"||!y)return Xa(c);try{const _=await Promise.resolve(h.match(y)),E=WI(GI(_&&typeof _=="object"?_:null,c),c),D=Yc(c,E);if(D.effectiveUniformityStatus!=="ready"&&(E.fontFamily===void 0||E.fontSize===void 0)){const U=await Ch(c);U&&kh(D.values,E,U)}return D.values}catch{return Xa(c)}},ui=async c=>{const h=w();if(h)return typeof h.getNode=="function"?await Promise.resolve(h.getNode(c)):await Promise.resolve(h.getNodeById?.({nodeId:c.nodeId,nodeType:c.nodeType}))},sa=c=>{const h=w()?.query;if(typeof h?.match!="function")return"ready";const y=Kc(c);if(!y)return"ready";const{status:_}=Zr(`query:${Yr(c)}`,ft(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return _},Sh=c=>{const h=Qc(c),y=h.values;if(c.empty)return h;const _=Ha(c);return _?c.status==="ready"&&sa(c)==="ready"&&h.effectiveUniformityStatus==="ready"?(b={key:_,values:y},h):b&&b.key===_?{...h,values:{...b.values,...y}}:h:h},_h=c=>{const h=w(),y=Sh(c),_=y.values;c.status==="ready"&&!c.empty&&sa(c)==="ready"&&y.effectiveUniformityStatus==="ready"&&(v=_,k=`${Dc(c)}:${ft()}`);const E=h?.contentControls,{lockModesById:D}=Ya(E,c),U={};for(const oe of di())U[oe]=aa(oe,h,c,_,D);return U},Cs=c=>c?lt.operationUnavailable:S()?lt.documentApiUnavailable:lt.notReady,Sd=c=>c==="contentLocked"||c==="sdtContentLocked",ks=c=>{for(const h of c.values())if(Sd(h))return lt.contentControlLocked},Xl=(c,h,y,_,E)=>{if(!h)return c.scope==="all"?lt.bulkDecisionsDisabled:Cs(E);if(y)return y;if(c.scope!=="all"&&_.activeChangeIds.length===0)return lt.selectionRequired},Xi=c=>{Bc();let h;if(W()){const E=Qr()?.find(U=>Vr(U)===c);if(E)return ld(E);const D=N.get("trackChanges");h=D?.hasSettled&&Array.isArray(D.value)?D.value:null}else h=xi("trackChanges:all").value;const y=h?.find(E=>Vr(E)===c),_=ad(y);return _?ld(_):null},io=(c,h)=>{const y=t.canPerformPermission;if(typeof y!="function"||h.length===0)return;const _=t.config&&typeof t.config=="object"?t.config.user:null;for(const E of h){const D=Xi(E)??{id:E},U=AH(D,_),oe=c==="accept"?U?"RESOLVE_OWN":"RESOLVE_OTHER":U?"REJECT_OWN":"REJECT_OTHER";let fe;try{fe=y.call(t,{permission:oe,trackedChange:D,comment:null})}catch{return}if(fe===!1)return lt.permissionDenied}},Ah=c=>{const h=j(),y=Ot(typeof h?.getCapabilities=="function"?()=>h.getCapabilities():void 0,null)?.editableSubset?.commands;if(Array.isArray(y))return y.find(_=>_?.command===c||_?.id===c)??null;if(y&&typeof y=="object"){const _=y[c];return _&&typeof _=="object"?_:null}return null},Zl=(c,h)=>{if(c.scope!=="all"||typeof h?.[`${c.kind}All`]=="function")return;const y=Ah(`trackedChanges.${c.kind}All`);if(!(y&&(y.status==="supported"||y.enabled===!0)))return lt.bulkDecisionsDisabled},aa=(c,h,y,_,E=new Map)=>{if(Je.has(c))return tn({supported:!0,enabled:!0,...Ot(Je.get(c).getState?()=>Je.get(c).getState(ra(void 0)):void 0,{})},"custom");const D=$n()==="viewing",U=OI(c);if(U&&typeof Y()?.lists?.apply=="function"){const Ze=ue(),Ke=typeof Ze?.shippedStatus=="string"?Ze.shippedStatus:null,We=Ke!=="not-shipped"&&Ke!=="disabled",at=We&&(typeof Ze?.enabled=="boolean"?Ze.enabled:!0),dt=We?ve(Ze):null;return tn(D?{enabled:!1,active:dt===U,supported:We,value:Ze?.value,reason:lt.documentReadonly}:{enabled:at,active:dt===U,supported:We,value:Ze?.value},"builtin")}const oe=og(c);if(oe){const Ze=h?.trackChanges,Ke=typeof Ze?.decide=="function"||typeof Ze?.[oe.kind]=="function",We=typeof Ze?.decide=="function"||typeof Ze?.[`${oe.kind}All`]=="function",at=oe.scope==="all"?We:Ke,dt=Zl(oe,Ze)??Xl(oe,at,jc(),y,h)??(oe.scope==="all"?void 0:io(oe.kind,y.activeChangeIds));return tn({enabled:dt==null,active:!1,supported:at,reason:dt},"builtin")}if(c==="copy-format")return $n()==="viewing"?tn({supported:!0,enabled:!1,active:!1},"builtin"):S()?tn({supported:!0,enabled:!0,active:p.mode!=="idle"},"builtin"):tn({supported:!0,enabled:!1,active:!1,reason:lt.notReady},"builtin");const fe=td(c);if(!fe)return tn({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(fe.disposition!=="routed")return tn({enabled:!1,active:!1,supported:!1,reason:fe.reason??lt.commandUnsupported},fe.disposition==="unsupported"?"unsupported":"builtin");if(fe.instanceRoute)return hn(fe);if(fe.table)return Jr(fe,h,D);if(fe.inline?.kind==="clear"){if(fe.mutates&&D)return tn({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const Ze=ks(E);if(Ze)return tn({enabled:!1,active:!1,supported:!0,reason:Ze},"builtin");const Ke=Dr(y).length>0||cd(y)!=null;return tn({enabled:Ke,active:!1,supported:!0,reason:Ke?void 0:lt.selectionRequired},"builtin")}const Re=fe.docRoute;if(!Re)return tn({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(vr(h,Re)==null)return tn({enabled:!1,active:!1,supported:!1,reason:Cs(h)},"builtin");const Fe=ge(c);if(Fe){const Ze=Fe.shippedStatus,Ke=Ze!=="not-shipped"&&Ze!=="disabled",We=typeof Fe.enabled=="boolean"?Fe.enabled:!0,at=c==="undo"||c==="redo",dt=at&&Fe.historyResolved===!1,qe=at&&Ke&&We===!1&&Fe.reason===null&&!dt,At=Fe.reason===void 0?void 0:qe?lt.historyEmpty:dt?lt.notReady:eg(Fe.reason,lt.commandUnsupported);return fe.mutates&&D?tn({enabled:!1,active:!1,supported:Ke,reason:lt.documentReadonly},"builtin"):tn({enabled:Ke&&We,active:!1,supported:Ke,reason:At},"builtin")}const Pe=Za(fe,h,y),Ye=A(fe,h,y,_);if(fe.list?.mode==="indent"||fe.list?.mode==="outdent")return hr(fe,h,D,y,Pe,Ye);if(fe.list?.mode==="toggle-seed")return Yt(fe,h,D,y,Pe,Ye);if(fe.mutates&&D)return tn({enabled:!1,active:Pe,supported:!0,value:Ye,reason:lt.documentReadonly},"builtin");if(fe.inline&&!cd(y)){const Ze=ks(E);return tn(Ze?{enabled:!1,active:Pe,supported:!0,value:Ye,reason:Ze}:Dr(y).length>0&&typeof j()?.setPendingInlineFormat=="function"?{enabled:!0,active:Pe,supported:!0,value:Ye}:{enabled:!1,active:Pe,supported:!0,value:Ye,reason:lt.rangeSelectionRequired},"builtin")}if((fe.blockParagraph||fe.list)&&Dr(y).length===0)return tn({enabled:!1,active:Pe,supported:!0,value:Ye,reason:lt.selectionRequired},"builtin");if(fe.link&&!Pe&&u2(y).length===0&&!Ys(y))return tn({enabled:!1,active:Pe,supported:!0,reason:lt.rangeSelectionRequired},"builtin");if(fe.inline){const Ze=ks(E);if(Ze)return tn({enabled:!1,active:Pe,supported:!0,value:Ye,reason:Ze},"builtin")}return tn({enabled:!0,active:Pe,supported:!0,value:Ye},"builtin")};function _d(c,h){const y=c.address?.anchor,_=y?.start,E=y?.end,D=typeof _?.blockId=="string"?_.blockId:null,U=typeof E?.blockId=="string"?E.blockId:null;if(!D||!U)return!1;const oe=typeof _?.offset=="number"?_.offset:null,fe=typeof E?.offset=="number"?E.offset:null;if(oe==null||fe==null)return!1;const Re=h.target,Fe=Re&&Array.isArray(Re.segments)?Re.segments:[];for(const Pe of Fe){const Ye=typeof Pe?.blockId=="string"?Pe.blockId:null;if(!Ye)continue;const Ze=Pe.range,Ke=typeof Ze?.start=="number"?Ze.start:null,We=typeof Ze?.end=="number"?Ze.end:null;if(!(Ke==null||We==null)){if(D!==U){if(Ye===D&&We>oe||Ye===U&&Ke<fe)return!0;continue}if(Ye===D){if(Ke===We){if(Ke>=oe&&Ke<=fe)return!0;continue}if(Math.max(Ke,oe)<Math.min(We,fe))return!0}}}return!1}const Zi=(c,h)=>{const y=c?.hyperlinks;if(!y||typeof y.list!="function")return null;const _=Dr(h);if(!Pc(_))return null;for(const E of _){const D={kind:"block",nodeType:"paragraph",nodeId:E},{value:U}=Zr(`hyperlinks:${E}`,ft(),()=>y.list({within:D}),fe=>fe&&typeof fe=="object"?fe:null),oe=(U&&Array.isArray(U.items)?U.items:[]).find(fe=>_d(fe,h));if(oe)return oe}return null},Za=(c,h,y)=>{if(c.link)return Zi(h,y)!=null;if(c.list?.mode==="toggle-seed"&&c.list.seed)return he(h,y)===c.list.seed;const _=K(c);if(_!==null)return _;const E=r.get(c.id),D=Ha(y);if(D&&E?.selectionSignature===D)return E.active;const U=wh(c,y);return U!==null?U:c$(c,y)},A=(c,h,y,_)=>{if(c.inline&&d2(c.inline.key)){const E=x(c);if(E!==void 0)return E;const D=_[c.inline.key];if(D!==void 0)return D;const U=Ha(y),oe=U?n.get(c.inline.key):void 0;if(U&&oe?.selectionSignature===U)return oe.value}if(c.id==="linked-style"){const{style:E}=Mi(y,Qa().cache);return!E.styleId||E.mixed?void 0:{styleId:E.styleId,styleName:E.styleName}}if(c.id==="text-align")return st(h,y);if(c.id==="link")return Pn(h,y)??void 0},M=(c,h,y)=>{const _=c?.lists;if(!_)return{value:null,status:"ready"};const E=y.storyType==="body",D=typeof _.getStateInStory=="function"?()=>_.getStateInStory({target:Ua(h),story:y}):E&&typeof _.getState=="function"?()=>_.getState({target:Ua(h)}):null;if(!D)return{value:null,status:"ready"};const{value:U,status:oe}=Zr(`lists:${Jn(y)}:${h}`,ft(),D,fe=>fe&&typeof fe=="object"?fe:null);return{value:U?.success===!0?U:null,status:oe}},X=(c,h,y)=>M(c,h,y).value,te=(c,h,y)=>{const _=X(c,h,y);return!_||_.isListItem!==!0?null:_.seed==="bullet"||_.seed==="ordered"?_.seed:null},ne=(c,h,y)=>{const _=M(c,h,y),E=_.value;return{value:E&&typeof E.isListItem=="boolean"?E.isListItem:null,status:_.status}},he=(c,h)=>{const y=Dr(h);if(y.length===0||!Pc(y))return null;const _=vs(h),E=te(c,y[0],_);if(E!=="bullet"&&E!=="ordered")return null;for(const D of y.slice(1))if(te(c,D,_)!==E)return null;return E},ce=(c,h,y)=>{if(!c)return{value:null,status:"ready",refreshing:!1};const _=Jn(y),E=_==="story:body";if(E&&typeof c.getNodeById!="function")return{value:null,status:"ready",refreshing:!1};if(!E&&typeof c.getNode!="function")return{value:null,status:"ready",refreshing:!1};const D=`node:${_}:${h}`,U=ft(),oe=Zr(D,U,()=>E?c.getNodeById({nodeId:h,nodeType:"paragraph"}):c.getNode(_o(h,y)),Re=>Re&&typeof Re=="object"?Re:null),fe=N.get(D);return{...oe,refreshing:oe.status==="stale"&&fe?.inflightToken===U&&fe.failedToken!==U}},le=c=>c==="left"||c==="center"||c==="right"||c==="justify"?c:void 0,we=c=>c==="start"||c==="end"||c==="distributed"||c==="numTab"||c==="lowKashida"||c==="mediumKashida"||c==="highKashida"||c==="thaiDistribute",xe=(c,h)=>{const y=j(),_=y?.readMountedProjectionBlocksByIds;if(typeof _!="function")return null;const E=ys(c),D=Ot(()=>E?_.call(y,[...h],E):_.call(y,[...h]),null);if(!Array.isArray(D))return new Map;const U=p2(D),oe=new Map;for(const fe of h){const Re=U.find(Ze=>Fc(Ze,fe));if(!Re)continue;const Fe=Re.attrs,Pe=le(Fe?.alignment),Ye=M9(Fe);oe.set(fe,Pe??(Ye==="rtl"?"right":"left"))}return oe},Ve=(c,h,y,_)=>{const{value:E,status:D,refreshing:U}=ce(c,h,y),oe=_?.get(h);if(D==="pending")return oe?{status:"uniform",value:oe}:{status:"pending"};if(D==="stale"&&!U)return{status:"pending"};if(D==="stale"&&oe)return{status:"uniform",value:oe};if(D==="stale"&&_&&!oe)return{status:"unavailable"};if(!E)return{status:"unavailable"};const fe=E.node;if(!fe)return{status:"unavailable"};const Re=fe.kind;if(Re!=="paragraph"&&Re!=="heading")return{status:"unavailable"};const Fe=fe[Re];if(!Fe||typeof Fe!="object")return{status:"unavailable"};const Pe=Fe.props?.alignment;if(Pe==null)return oe?{status:"uniform",value:oe}:{status:"unavailable"};const Ye=le(Pe);return Ye?{status:"uniform",value:Ye}:we(Pe)&&oe?{status:"uniform",value:oe}:{status:"unavailable"}},Me=(c,h)=>{const y=Dr(h);if(y.length===0||!Pc(y))return{status:"unavailable"};const _=vs(h),E=xe(h,y),D=Ve(c,y[0],_,E);if(D.status!=="uniform")return D;for(const U of y.slice(1)){const oe=Ve(c,U,_,E);if(oe.status!=="uniform")return oe;if(oe.value!==D.value)return{status:"mixed"}}return D},Ge=c=>{const h=Dr(c);return h.length===0?null:`${Jn(vs(c))}:${h.join(",")}`},st=(c,h)=>{const y=Me(c,h),_=y.status==="uniform"?y.value:void 0,E=o;if(!E)return _;const D=Ge(h);return D&&D!==E.selectionSignature?(o=null,_):!D||!E.settled?E.value:y.status!=="pending"?(o=null,_):E.value},ot=(c,h)=>{const y=le(h),_=Ge(c),E=Dr(c);if(!y||!_||E.length===0)return null;const D=++i;return o={selectionSignature:_,value:y,generation:D,settled:!1,canReconcile:Pc(E)},Dt(),D},bt=(c,h)=>{if(c==null)return;const y=o;if(!(!y||y.generation!==c)){if(!mo(h)){o=null;return}if(!y.canReconcile){o=null;return}y.settled=!0}},pt=async(c,h,y)=>{const _=c?.lists;if(!_)return null;try{const E=y.storyType==="body",D=typeof _.getStateInStory=="function"?await _.getStateInStory({target:Ua(h),story:y}):E&&typeof _.getState=="function"?await _.getState({target:Ua(h)}):null,U=D&&typeof D=="object"?D:null;return!U||U.success!==!0||typeof U.isListItem!="boolean"?null:U.isListItem}catch{return null}},qt=(c,h,y)=>{const _={resolved:!1,seed:null},E=c?.lists;if(!E)return _;const D=y.storyType==="body",U=typeof E.getStateInStory=="function"?()=>E.getStateInStory({target:Ua(h),story:y}):D&&typeof E.getState=="function"?()=>E.getState({target:Ua(h)}):null;if(!U)return _;const oe=fe=>{const Re=fe&&typeof fe=="object"?fe:null;return!Re||Re.success!==!0||typeof Re.isListItem!="boolean"?_:{resolved:!0,seed:Re.isListItem===!0&&(Re.seed==="bullet"||Re.seed==="ordered")?Re.seed:null}};try{const fe=U();return Lr(fe)?Promise.resolve(fe).then(oe,()=>_):oe(fe)}catch{return _}},Cn=async(c,h,y)=>{if(!c)return null;try{const _=!y||y.storyType==="body",E=y&&typeof c.getNode=="function"?await c.getNode(_o(h,y)):_&&typeof c.getNodeById=="function"?await c.getNodeById({nodeId:h,nodeType:"paragraph"}):null;return OH(E&&typeof E=="object"?E:null)}catch{return null}},hr=(c,h,y,_,E,D)=>{if(c.mutates&&y)return tn({enabled:!1,active:E,supported:!0,value:D,reason:lt.documentReadonly},"builtin");const U=Dr(_);if(U.length===0)return tn({enabled:!1,active:E,supported:!0,value:D,reason:lt.selectionRequired},"builtin");const oe=c.docRoute?vr(h,c.docRoute):null,fe=vr(h,"format.paragraph.setIndentation"),Re=vr(h,"format.paragraph.clearIndentation"),Fe=c.list?.mode,Pe=Fe==="indent"?fe!=null:fe!=null||Re!=null,Ye=vs(_);let Ze=null;if(Ye.storyType!=="body"){Ze=[];for(const Ke of U){const{value:We,status:at}=ne(h,Ke,Ye);if(We===null)return at!=="ready"&&(oe!=null||Pe)?tn({enabled:!0,active:E,supported:!0,value:D},"builtin"):tn({enabled:!1,active:E,supported:!1,value:D,reason:Cs(h)},"builtin");Ze.push(We)}}if(Ze?.some(Ke=>Ke===!0)){const Ke=Fe==="indent"?"lists.indentRange":"lists.outdentRange",We=$n()!=="suggesting"&&Ze.every(dt=>dt===!0)&&vr(h,Ke)!=null,at=Fe==="outdent"&&vr(h,"lists.outdentInStory")!=null;if(!We&&!at)return tn({enabled:!1,active:E,supported:!1,value:D,reason:Cs(h)},"builtin")}for(const[Ke,We]of U.entries()){const at=Ze?{value:Ze[Ke]??null,status:"ready"}:ne(h,We,Ye),dt=at.value;if(dt===!0){if(oe!=null)return tn({enabled:!0,active:E,supported:!0,value:D},"builtin");continue}if(dt===!1&&Pe){if(Ye.storyType!=="body"&&typeof h?.getNode!="function")continue;return tn({enabled:!0,active:E,supported:!0,value:D},"builtin")}if(dt===null)return at.status!=="ready"&&(oe!=null||Pe)?tn({enabled:!0,active:E,supported:!0,value:D},"builtin"):tn({enabled:!1,active:E,supported:!1,value:D,reason:Cs(h)},"builtin")}return tn({enabled:!1,active:E,supported:!1,value:D,reason:Cs(h)},"builtin")},Yt=(c,h,y,_,E,D)=>{if(c.mutates&&y)return tn({enabled:!1,active:E,supported:!0,value:D,reason:lt.documentReadonly},"builtin");const U=Dr(_);if(U.length===0)return tn({enabled:!1,active:E,supported:!0,value:D,reason:lt.selectionRequired},"builtin");const oe=vs(_),fe=h?.lists;if(!(typeof fe?.getStateInStory=="function"||oe.storyType==="body"&&typeof fe?.getState=="function"))return tn({enabled:!1,active:E,supported:!1,value:D,reason:lt.operationUnavailable},"builtin");if(!Pc(U))return tn(oe.storyType==="body"&&vr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:D}:{enabled:!1,active:E,supported:!1,value:D,reason:lt.operationUnavailable},"builtin");const Re=U.map(Ze=>M(h,Ze,oe));if(Re.some(({status:Ze})=>Ze!=="ready"))return tn({enabled:!0,active:E,supported:!0,value:D},"builtin");if(Re.some(({value:Ze})=>Ze===null))return tn({enabled:!1,active:E,supported:!1,value:D,reason:lt.operationUnavailable},"builtin");const Fe=c.list?.seed,Pe=Re.every(({value:Ze})=>Ze?.isListItem===!0&&Ze.seed===Fe);if(oe.storyType==="body")return tn(!Pe||vr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:D}:{enabled:!1,active:E,supported:!1,value:D,reason:lt.operationUnavailable},"builtin");const Ye=vr(h,"lists.removeInStory");return tn(Pe&&Ye?{enabled:!0,active:E,supported:!0,value:D}:{enabled:!1,active:E,supported:!1,value:D,reason:lt.operationUnavailable},"builtin")},Pn=(c,h)=>{const y=Zi(c,h)?.properties?.href;return typeof y=="string"?y:null},hn=c=>{if(!S())return tn({enabled:!1,active:!1,supported:!1,reason:lt.notReady},"builtin");const h=c.instanceRoute;return typeof t?.[h]!="function"?tn({enabled:!1,active:!1,supported:!1,reason:lt.operationUnavailable},"builtin"):tn({enabled:!0,active:tr(c),supported:!0,value:Or(c)},"builtin")},tr=c=>{const h=t?.config??void 0;return c.valueFrom==="ruler"?!!h?.rulers:c.valueFrom==="formattingMarks"?!!h?.layoutEngineOptions?.showFormattingMarks:!1},Jr=(c,h,y)=>{if(y)return tn({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const _=Ne();return _!=null&&(!c.table.requiresCell||_.cellNodeId!=null)?(c.docRoute?vr(h,c.docRoute):null)==null?tn({enabled:!1,active:!1,supported:!1,reason:Cs(h)},"builtin"):tn({enabled:!0,active:!1,supported:!0},"builtin"):tn({enabled:!1,active:!1,supported:!0,reason:lt.tableContextUnavailable},"builtin")},Or=c=>{if(c.valueFrom==="zoom")return Cd().value;if(c.valueFrom==="documentMode")return $n();if(c.valueFrom==="measurementUnit")return kd();if(c.valueFrom==="ruler"||c.valueFrom==="formattingMarks")return tr(c)},Qi=(c,h)=>c.id==="zoom"?typeof h=="number"&&Number.isFinite(h)&&h>0:c.id==="document-mode"?h==="editing"||h==="suggesting"||h==="viewing":c.id==="measurement-unit"?h==="in"||h==="cm":!0,di=()=>[...new Set([...yj,...Je.keys()])],ut="Normal",kn={ready:!1,status:"ready",catalogRevision:null,quickGallery:[],activeParagraphStyleId:null,activeParagraphStyleName:null,mixedSelection:!1,sourceStatus:null,diagnostics:[]},Cr=c=>`styles:catalog:${JSON.stringify(c??{})}`,Ri=c=>{const h=w()?.styles;return!h||typeof h.getCatalog!="function"?{value:null,status:"ready"}:Zr(Cr(c),ft(),()=>h.getCatalog(c),y=>y&&typeof y=="object"?y:null)},Qa=()=>{const c=Ri({includePreview:!0});if(!c.value)return{cache:null,status:c.status};const h=Ri({view:"quickGallery",includePreview:!0}),y=h.value?h.value.items:c.value.styles.filter(E=>E.visibility.quickGallery),_=new Map;for(const E of c.value.styles)_.set(E.id,E);return{cache:{full:c.value,quickGallery:y,byId:_},status:Pl(c.status,h.status)}},wo=(c,h,y)=>{const{value:_,status:E}=ce(c,h,y);if(!_)return{ok:!1,styleRef:null,status:E};const D=_.node;if(!D||typeof D!="object")return{ok:!1,styleRef:null,status:E};const U=D.kind,oe=typeof U=="string"?D[U]:void 0,fe=oe&&typeof oe=="object"?oe.styleRef:void 0;return{ok:!0,styleRef:typeof fe=="string"&&fe.length>0?fe:null,status:E}},Mi=(c,h)=>{const y=[],_=w();if(!_)return y.push({severity:"warning",code:"active-style-unavailable",message:"Active paragraph style is unavailable: the Document API is not reachable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};const E=Dr(c);if(E.length===0)return y.push({severity:"info",code:"active-style-no-selection",message:"No paragraph block is resolvable from the current selection; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};if(!Pc(E))return y.push({severity:"info",code:"active-style-selection-too-large",message:"Active paragraph style is unavailable for a large multi-paragraph selection."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};const D=h?.full.defaults.paragraphStyleId??(h?ut:null),U=new Set;let oe=0,fe=0,Re=0,Fe="ready";const Pe=vs(c);for(const Ke of E){const We=wo(_,Ke,Pe);if(Fe=Pl(Fe,We.status),!We.ok){fe+=1;continue}if(!We.styleRef&&!D){Re+=1;continue}const at=We.styleRef??D;if(!at){Re+=1;continue}oe+=1,U.add(at)}if(oe===0){const Ke=Re>0&&fe===0;return y.push({severity:"warning",code:Ke?"active-style-default-unavailable":"active-style-read-failed",message:Ke?"Selected paragraphs have no explicit style and the style catalogue is unavailable, so the document default cannot be resolved.":"Could not read the paragraph style of any selected block; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:Fe}}const Ye=fe+Re;if(Ye>0)return y.push({severity:"warning",code:"active-style-partial",message:`Active paragraph style resolved from ${oe} of ${oe+Ye} selected blocks; ${Ye} could not be read, so the active style is unavailable.`}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:Fe};if(U.size>1)return{style:{styleId:null,styleName:null,mixed:!0,diagnostics:y},status:Fe};const Ze=[...U][0];return{style:{styleId:Ze,styleName:h?.byId.get(Ze)?.name??null,mixed:!1,diagnostics:y},status:Fe}},Ql=c=>{if(!S())return kn;const{cache:h,status:y}=Qa(),{style:_,status:E}=Mi(c,h);let D;return h?D=_.diagnostics.length===0?h.full.diagnostics:[...h.full.diagnostics,..._.diagnostics]:D=[{severity:"warning",code:"catalog-unavailable",message:"The style catalogue is unavailable: the Document API styles surface is not reachable (e.g. viewing mode or a worker-backed editor)."},..._.diagnostics],{ready:!0,status:Pl(y,E,c.status),catalogRevision:h?.full.revision??null,quickGallery:h?.quickGallery??[],activeParagraphStyleId:_.styleId,activeParagraphStyleName:_.styleName,mixedSelection:_.mixed,sourceStatus:h?.full.sourceStatus??null,diagnostics:D}},Ji=(c="direct")=>{const{sink:h}=Jm(),y=h?Va():0,_={},E=(Re,Fe)=>{if(!h)return Fe();const Pe=Va();try{return Fe()}finally{_[Re]=Va()-Pe}},D=E("documentMode",$n),U=E("selection",Wa);U.status==="ready"&&gh(U),Q(U);const oe=Ha(U);for(const[Re,Fe]of r)(!oe||Fe.selectionSignature!==oe||Fe.settled&&U.status==="ready")&&r.delete(Re);const fe={ready:S()!=null,documentMode:D,document:E("document",Wc),selection:U,toolbar:{context:D,commands:E("toolbarCommands",()=>_h(U)),copyFormatActive:p.mode!=="idle"},comments:E("comments",()=>hd(U)),trackChanges:E("trackChanges",()=>$c(U)),contentControls:E("contentControls",()=>bd(U)),zoom:E("zoom",Cd),fonts:E("fonts",wd),styles:E("styles",()=>Ql(U))};if(h){const Re=Va();a2({stage:"superdoc-ui-compute-state",atMs:Re,reason:c,startedAtMs:y,completedAtMs:Re,durationMs:Re-y,phaseMs:_,asyncReadSettlements:Lt.splice(0)})}return fe},eu=c=>{const h=Ha(c);h&&a&&h!==a&&(n.clear(),r.clear()),h&&(a=h)};let Ss=null,fi=null,Yo=null,Xo=null,_s=null,hi=null,es=!1;const Jl=()=>{if(ee||es)return;es=!0;const c=()=>{es&&(es=!1,!ee&&Dt())};typeof queueMicrotask=="function"?queueMicrotask(c):Promise.resolve().then(c)},As=()=>{const c=Y();if(c!==Yo&&(Xo&&(Xo(),Xo=null),Yo=c,!(!c||typeof c.subscribe!="function")))try{const h=c.subscribe(()=>Jl());typeof h=="function"&&(Xo=h)}catch{Yo=null}},ec=()=>{const c=L();if(c!==_s&&(hi&&(hi(),hi=null),_s=c,!(!c||typeof c.subscribe!="function")))try{const h=c.subscribe(()=>Dt());typeof h=="function"&&(hi=h)}catch{_s=null}};let Zo=null,ts=null,la=null,Li=null,tc=null,Qo=null;const Ih=()=>{const c=S()?.host,h=Ot(c?.getHandles?()=>c.getHandles():void 0,null)?.editing?.selection;return h&&typeof h.subscribe=="function"?h:null},O=()=>{const c=j(),h=c?.readLiveSelectionSyncSnapshot;if(typeof h!="function")return!1;const y=Yi(Ot(()=>h.call(c),null));if(!y||!$l(y))return!1;const _=oa(y,"ready"),E=Ys(P.selection),D=Ys(_);if(E&&D&&E.blockId===D.blockId&&Jn(E.story)===Jn(D.story))return!1;const U=qc(_),oe=P.toolbar.commands["font-family"]?.value,fe=P.toolbar.commands["font-size"]?.value,Re=typeof oe=="string"&&oe.length>0,Fe=typeof fe=="string"&&fe.length>0||typeof fe=="number"&&Number.isFinite(fe);return Re&&U.fontFamily===void 0||Fe&&U.fontSize===void 0},G=()=>{const c=Ih();if(c!==Ss&&(fi&&(fi(),fi=null),Ss=c,!!c))try{const h=c.subscribe(y=>{ci()&&O()&&jl()||(go+=1,wr(y),Dt("host-selection"))});typeof h=="function"&&(fi=h)}catch{Ss=null}},pe=()=>{const c=S()?.host,h=Ot(c?.getHandles?()=>c.getHandles():void 0,null)?.review;return h&&typeof h.subscribe=="function"?h:null},Ce=c=>c?typeof c.getActiveReviewTarget=="function"?Ot(()=>c.getActiveReviewTarget(),null):typeof c.getSnapshot=="function"?Ot(()=>c.getSnapshot(),null)?.activeReviewTarget??null:null:null;let rt=0;const xt=(c,h)=>{const y=(h&&typeof h=="object"?h:null)?.lastInteractionRejection;if(c==null&&y&&typeof y=="object"&&y.code==="review-target-invalidated"&&y.detail==="not-painted"&&tt)return!1;const _=c&&typeof c=="object"?c:null;let E=null;if(_?.entityType==="trackedChange"&&typeof _.entityId=="string"&&_.entityId.length>0){const D=_.story&&typeof _.story=="object"?_.story:void 0,U=D&&Jn(D)!==Jn(null)?D:void 0,oe=typeof _.paintedEntityId=="string"&&_.paintedEntityId.length>0?_.paintedEntityId:null,fe=oe??_.entityId,Re=(()=>{if(U){const Ye=Qr(),Ze=Ye?Fl(Ye,U):null;return Ze?.toPublicId(fe)??Ze?.toPublicId(_.entityId)??_.entityId}const Pe=Ks(Array.isArray(P?.trackChanges.items)?P.trackChanges.items:[]);return Pe.toPublicId(fe)??Pe.toPublicId(_.entityId)??_.entityId})(),Fe=oe??(fe!==Re?fe:null);E={id:Re,...U?{story:U}:{},...Fe&&Fe!==Re?{paintedEntityId:Fe}:{}}}return c==null&&E==null&&tt!=null&&I(tt)||ie(tt,E)?!1:(F(E),!0)},Nt=()=>{const c=pe();if(c===Zo)return;if(ts&&(ts(),ts=null),Zo=c,!c){xt(null);return}let h=!0;try{const y=c.subscribe(_=>{const E=_&&typeof _=="object"?_:null,D=E&&Object.prototype.hasOwnProperty.call(E,"activeReviewTarget")?E.activeReviewTarget:Ce(c);!xt(D,_)||h||Dt()});typeof y=="function"&&(ts=y),xt(Ce(c))}catch{Zo=null}finally{h=!1}},vn=()=>{if(Ss||$n()!=="viewing")return null;const c=S()?.mount?.container,h=(c&&typeof c=="object"&&"ownerDocument"in c?c.ownerDocument??null:null)??globalThis.document??null;return h&&typeof h.addEventListener=="function"?h:null},sn=()=>{const c=vn();if(c===tc||(Qo&&(Qo(),Qo=null),tc=c,!c))return;const h=()=>{go+=1,Dt()};c.addEventListener("selectionchange",h),c.addEventListener("pointerup",h,!0),c.addEventListener("mouseup",h,!0),Qo=()=>{c.removeEventListener("selectionchange",h),c.removeEventListener("pointerup",h,!0),c.removeEventListener("mouseup",h,!0)}};Bc(),xt(Ce(pe())),P=Ji("initial"),a=Ha(P.selection);const En=()=>{const c=S()?.host,h=c?.events,y=h&&typeof h.subscribe=="function"?h:null;if(y!==la&&(Li&&(Li(),Li=null),la=y,!!y)){c&&(nt.delete(c),Ct(c));try{const _=y.subscribe(E=>{const D=E?.type,U=D==="document:mutated"&&E.hasCommitEvent!==!0;if((D==="document:mutated"||D==="mutation:committed"&&GH(E))&&c&&!$e.has(c)&&($e.add(c),Dt("document-dirty")),D==="collaboration:document-replaced"&&c&&($e.delete(c),nt.delete(c),Ct(c),Dt("document-dirty")),D==="review-mutation:started"){cn(E.reviewMutation?.token);return}if(D==="review-mutation:aborted"){fn(E.reviewMutation?.token),Wt();return}if(D==="mutation:rejected"&&E.reviewMutation&&(fn(E.reviewMutation.token),Wt()),D==="mutation:committed"&&E.reviewMutation&&fn(E.reviewMutation.token),D==="source:complete"||D==="source:signals-complete"){Ai=ft(),ai();return}if((U||D==="mutation:committed"||D==="collaboration:remote-changed")&&(Hr=Date.now()),U||D==="mutation:committed"||D==="save:completed"||D==="collaboration:remote-changed"){const oe=D==="mutation:committed"?ZS(E):null;if(oe?.allResolved){Kn([]),Po(E.receipt);return}oe?.removedIds.size&&Hi(new Set(oe.removedIds),E.receipt);const fe=D==="mutation:committed"&&Gi(E)||D==="collaboration:remote-changed"&&Array.isArray(E.changedStoryIds)&&E.changedStoryIds.length>0;if(fe&&(Xr=Date.now()),D==="mutation:committed"&&fe){ws();return}if(oe?.removedIds.size&&oe.upsertIds.size===0)return;(U||D==="collaboration:remote-changed"||D==="mutation:committed"&&!fe)&&qi();const Re=D==="collaboration:remote-changed"&&Array.isArray(E.changedPartUris)&&E.changedPartUris.some(Pe=>typeof Pe=="string"&&wH.has(Pe)),Fe=D==="collaboration:remote-changed"&&Array.isArray(E.changedStoryIds)&&E.changedStoryIds.length>0&&Bl();Re&&!fe&&(bo=!0),Ti(),Re&&!fe?Eo("comments"):Fe&&(bo=!0,li()),Dt()}});typeof _=="function"&&(Li=_)}catch{la=null}}},Dt=(c="unspecified")=>{if(ee)return;const{sink:h}=Jm(),y=h?Va():0;es=!1,Bc(),G(),As(),ec(),Nt(),sn(),En();const _=Ji(c);eu(_.selection),P=_;let E=0,D=0;for(const U of[...q]){if(!h){U(P);continue}const oe=Va();U(P);const fe=Va()-oe;E+=fe,D=Math.max(D,fe)}if(h){const U=Va();a2({stage:"superdoc-ui-recompute",atMs:U,reason:c,startedAtMs:y,completedAtMs:U,durationMs:U-y,listenerCount:q.size,listenerTotalMs:E,listenerMaxMs:D})}},Sn=[],Yn=[],eo=[],ns=c=>{for(const h of c)try{h()}catch{}},Jo=()=>ns(Sn),Ja=()=>ns(Yn),nc=()=>ns(eo),lg=[];((c,h)=>{if(!(!c||typeof c.on!="function"))for(const y of h){const _=y==="active-editor-change"?()=>{Jo(),Ja(),Dt()}:y==="document-replaced"?E=>{const D=E&&typeof E=="object"?E:null,U=D?.editor,oe=D?.host,fe=!!U&&U===S(),Re=!!oe&&oe===j();if(!fe&&!Re)return;const Fe=Re?oe:j();Fe&&($e.delete(Fe),nt.delete(Fe)),Ja(),N.clear(),Ti(),Dt()}:y==="document-mode-change"?()=>{Dt(),nc()}:()=>Dt();try{c.on(y,_),lg.push(()=>{try{typeof c.off=="function"&&c.off(y,_)}catch{}})}catch{}}})(t,pH),G(),As(),ec(),Nt(),sn(),En();const ca=(c,h=ZU)=>({get:()=>c(P),subscribe:y=>{let _=c(P);const E=D=>{const U=c(D);h(_,U)||(_=U,y(U))};return q.add(E),()=>q.delete(E)}}),rs=c=>ca(c),Di=c=>{const h=y=>{const _=D=>{try{y(D)}catch{}},E=c.subscribe(_);return _(c.get()),E};return{get:()=>c.get(),getSnapshot:()=>c.get(),observe:h,subscribe:y=>h(_=>y({snapshot:_}))}},Eh=(c,h,y)=>{const _=Di(c),E=Di(h),D=U=>{const oe=Ie(y);Dt();const fe=E.observe(U);return()=>{fe(),oe()}};return{get:_.get,getSnapshot:_.getSnapshot,observe:D,subscribe:U=>D(oe=>U({snapshot:oe}))}};function ug(c){return c&&typeof c=="object"&&typeof c.id=="string"?String(c.id):null}function dg(c){const h=ys(c);return h&&Jn(h)!==Jn(null)?h:void 0}function Th(c,h){return{kind:"id",id:c,...h?{story:h}:{}}}function y2(c){if(c.empty)return null;const h=c.selectionTarget,y=h?.start,_=h?.end;if(h?.kind!=="selection"||y?.kind!=="text"||_?.kind!=="text"||typeof y.blockId!="string"||y.blockId!==_.blockId||!Number.isInteger(y.offset)||!Number.isInteger(_.offset)||y.offset<0||_.offset<0||y.offset===_.offset)return null;const E=Math.min(y.offset,_.offset),D=Math.max(y.offset,_.offset),U=ys(c);return{kind:"range",coordinateSpace:h.coordinateSpace==="tracked"?"tracked":"visible",range:{kind:"text",...U?{story:U}:{},segments:[{blockId:y.blockId,range:{start:E,end:D}}]}}}function xh(c,h){if(Jn(h)!==Jn(null))return;const y=w()?.trackChanges,_=y?.list;if(typeof _!="function")return;const E=Ot(()=>_.call(y),null);if(Lr(E)||!E||typeof E!="object")return;const D=E.items;if(Array.isArray(D))return D.map(ad).find(U=>U!=null&&ki(U,c,h))}function nr(c,h){const y=fg(c.quotedText);if(!y)return!1;const _=ld(h);return[_.insertedText,_.deletedText,_.excerpt].some(E=>fg(E)===y)}function fg(c){return typeof c=="string"?c.replace(/\s+/g," ").trim():""}function hg(){const c=P.selection.activeChangeIds[0];if(!c)return"unavailable";const h=ys(P.selection),y=(P.trackChanges.status==="ready"?P.trackChanges.items.find(U=>ki(U,c,h)):void 0)??xh(c,h)??Qr()?.find(U=>ki(U,c,h));if(!y)return"unavailable";const _=ld(y),E=_.type,D=_.grouping;return nr(P.selection,y)?"id":E==="replacement"&&D==="replacement-pair"||(E==="insertion"||E==="deletion"||E==="insert"||E==="delete")&&D==="standalone"?"range":"id"}function pg(c,h,y,_){const E=()=>S2(c,Th(y,_),y,_);try{const D=S2(c,h,y,_);if(Lr(D))return To(Promise.resolve(D).then(oe=>mo(Xs(oe))?oe:E()));const U=Xs(D);return To(mo(U)?D:E())}catch{return!1}}function mg(c){if(typeof c=="string"&&c.length>0)return{target:{kind:"id",id:c},changeId:c};if(c&&typeof c=="object"){const h=c;if(h.target&&typeof h.target=="object"){const _=h.target;return{target:_,changeId:ug(_),story:_.story}}const y=typeof h.changeId=="string"?h.changeId:h.id;if(typeof y=="string"&&y.length>0)return{target:Th(y,h.story),changeId:y,story:h.story}}return null}function gg(c,h){if(c.scope==="all")return{target:{kind:"all"},changeId:null};const y=mg(h);if(y)return y;const _=P.selection.activeChangeIds[0],E=dg(P.selection);return _?{target:Th(_,E),changeId:_,story:E}:null}function vg(c,h){if(c.scope==="id"&&h==null){if(P.selection.activeChangeIds.length>1)return nu(c.kind,{kind:"ids",ids:P.selection.activeChangeIds},null);if(P.selection.activeChangeIds.length===1&&!P.selection.empty&&P.selection.selectionTarget){const _=hg();if(_==="unavailable")return!1;if(_==="range"){const E=y2(P.selection),D=dg(P.selection);return E?pg(c.kind,E,P.selection.activeChangeIds[0],D):!1}if(_==="id"){const E=P.selection.activeChangeIds[0],D=ys(P.selection),U=D&&Jn(D)!==Jn(null)?D:void 0;return Lh(c.kind,U?{id:E,story:U}:E)}}}const y=gg(c,h);return y?nu(c.kind,y.target,y.changeId,y.story):!1}function yg(c,h){const y=Y()?.lists,_=y?.apply;if(typeof _!="function")return!1;const{behavior:E,preset:D,continuity:U}=typeof h=="string"?vH(h):h&&typeof h=="object"?h:{},oe={kind:c,behavior:E??"toggle"};D!==void 0&&(oe.preset=D),U!==void 0&&(oe.continuity=U);try{return To(_.call(y,oe))}catch{return!1}}let Oi=Promise.resolve(!1),No=null,el=Promise.resolve(!1);const Is=async c=>{if(!ng(c))return c;const h=S()?.documentMutationReadiness,y=h?.whenPainted;if(typeof y!="function")return c;const _=typeof c.txId=="string"?c.txId:void 0;try{await y.call(h,_?{txId:_}:void 0)}catch{}return c},Bo=c=>{if(Lr(c)){const y=Promise.resolve(c);return{immediate:!0,committed:y.then(_=>Xs(_),()=>!1),settled:y.then(_=>Is(Xs(_)),()=>!1)}}const h=Xs(c);return{immediate:h,committed:Promise.resolve(h),settled:Is(h)}},Rt=()=>{const c=s.shift();if(!c){u=!1,f?.(),f=null;return}try{c.resolve(ee?!1:c.mutate())}catch{c.resolve(!1)}},Vt=()=>{let c=!1;return()=>{c||(c=!0,Rt())}},yn=(c,h)=>{if(!u){u=!0,d=new Promise(D=>{f=D});try{return{result:h(),release:Vt()}}catch(D){throw u=!1,f?.(),f=null,D}}const y=s.find(D=>D.key===c);if(y)return y.mutate=h,{result:y.result,release:()=>{}};let _;const E=new Promise(D=>{_=D});return s.push({key:c,mutate:h,result:E,resolve:_}),{result:E,release:Vt()}},Ir=new Set(["create.tableOfContents"]),to=c=>Wn(`Tracked authoring is not supported for ${c}.`),$r=c=>{if($n()==="suggesting")return Ir.has(c)?to(c):{changeMode:"tracked"}},Pi=()=>$n()==="suggesting"?QH:g2,rr=(c,h,y)=>{const _=$r(c);return _&&_.success===!1?_:_?h(y,_):h(y)},Ad=(c,h,y,_)=>{const E=c.inline;if(!E)return;const D=Xs(_);if(D===!1||typeof D=="object"&&D&&D.success===!1)return;if(E.kind==="clear"){n.clear();return}if(E.kind==="toggle"||!d2(E.key))return;const U=Ha(h);if(!U)return;const oe=BH(E.key,y.value);if(oe==null){n.delete(E.key);return}n.set(E.key,{selectionSignature:U,value:oe})},B$=(c,h,y,_)=>!c.inline||c.inline.kind==="toggle"?_:Lr(_)?Promise.resolve(_).then(E=>(Ad(c,h,y,E),E)):_,z$=(c,h,y,_)=>{if(c.inline?.kind!=="toggle"||!mo(Xs(_))||typeof y.value!="boolean"&&y.value!==null)return null;const E=Ha(h);if(!E)return null;const D=++l;return r.set(c.id,{selectionSignature:E,active:y.value===!0,generation:D,settled:!1}),Dt(),D},j$=(c,h,y)=>{if(h==null)return;const _=r.get(c.id);if(!(!_||_.generation!==h)){if(!mo(y)){r.delete(c.id);return}_.settled=!0}},bg=(c,h)=>c.then(y=>(h?.(y),Vl(),y),()=>(h?.(!1),Vl(),!1)),To=(c,h)=>{const y=No;if(No=null,y)return Oi=bg(y,h),Xs(c);if(Lr(c))return Oi=bg(Bo(c).settled,h),!0;const _=Xs(c);return ng(_)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(Oi=bg(Is(_),h),_):(h?.(_),Oi=Promise.resolve(_),Vl(),_)},V$=(c,h)=>!c||typeof c!="object"?h:c,rc=(c,h=Wn("Document API operation failed."))=>{if(Lr(c))return Promise.resolve(c).then(_=>rc(_,h),()=>h);const y=V$(c,h);return Ti(),ng(y)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(bg(Is(y)),Dt(),y):(Dt(),y)},U$=(c,h,y,_)=>{const E=[],D=[];for(const U of y){const oe=_(U);if(oe)try{const fe=Bo(rr(c,h,oe));E.push(fe.immediate),D.push(fe.settled)}catch{E.push(!1),D.push(Promise.resolve(!1))}}return No=D.length?Promise.all(D).then(U=>Si(U)):null,Si(E)},H$=(c,h,y,_)=>{const E=[],D=[];for(const U of y){const oe=_(U);if(oe)try{const fe=Bo(rr(c,h,oe));E.push(fe.immediate),D.push(fe.settled)}catch{E.push(!1),D.push(Promise.resolve(!1))}}return No=D.length?Promise.all(D).then(U=>Si(U)):null,Si(E)},b2=(c,h,y,_=P.selection)=>{const E=$r(c);return E&&E.success===!1?E:_.selectionTarget?h(y,{...E,offsetSpace:"selection"}):E?h(y,E):h(y)},$$=(c,h,y,_)=>{const E=_o(h,_);switch(c.kind){case"alignment":{const D=y;return D!=="left"&&D!=="center"&&D!=="right"&&D!=="justify"?null:{target:E,alignment:D}}case"spacing-line":{const D=typeof y=="number"?y:Number(y);return!Number.isFinite(D)||D<=0?null:{target:E,line:D,lineRule:"auto"}}case"style":if(y&&typeof y=="object"){const D=y.role;if(D&&typeof D=="object")return{target:E,role:D}}return typeof y!="string"||y.trim()===""?null:{target:E,styleId:y};case"direction":{const D=c.fixedValue;return D!=="ltr"&&D!=="rtl"?null:{target:E,direction:D}}default:return null}},G$=(c,h)=>{const y=c.inline,_=m2(c),E=j();if(!y||typeof E?.setPendingInlineFormat!="function")return!1;if(y.kind==="clear")return H(),!0;if(!_)return!1;let D;if(y.kind==="toggle")D=!Za(c,w(),P.selection);else{const U=h&&typeof h=="object"&&"value"in h?h.value:h;if(y.kind==="value-number"){const oe=typeof U=="number"?U:Number(U);D=Number.isFinite(oe)&&oe>0?oe:null}else D=typeof U=="string"&&U.trim()!==""?U:null;if(D===null)return $(_,null),!0}return $(_,D),!0},W$=()=>{const c=w(),{lockModesById:h}=Ya(c?.contentControls,P.selection);if(ks(h))return!1;const y=[],_=[],E=Ze=>{const Ke=Bo(Ze);y.push(Ke.immediate),_.push(Ke.settled)},D=(Ze,Ke,We)=>{try{E(We?Ze(Ke,We):Ze(Ke))}catch{y.push(!1),_.push(Promise.resolve(!1))}},U=Qa().cache?.full.defaults.paragraphStyleId??ut,oe=cd(P.selection);if(oe){const Ze=vr(c,"format.apply");if(Ze)try{E(b2("format.apply",Ze,{target:oe,inline:{...Pi()}}))}catch{y.push(!1),_.push(Promise.resolve(!1))}}const fe=vr(c,"format.paragraph.resetDirectFormatting"),Re=vr(c,"styles.paragraph.setStyleRef"),Fe=ys(P.selection),Pe=!Fe||Fe.storyType==="body",Ye=vr(c,Pe?"lists.remove":"lists.removeInStory");for(const Ze of Dr(P.selection)){const Ke=_o(Ze,Fe);if(fe&&D(fe,{target:Ke}),Ye)try{const We=Ua(Ze),at=Bo(Ye(Pe?{target:We}:{target:We,story:Fe}));_.push(at.settled.then(dt=>mo(dt)?dt:!0))}catch{}Re&&D(Re,{target:Ke,styleId:U})}if(!oe&&$n()!=="suggesting"){const Ze=vr(c,"format.paragraph.setMarkRunProps");if(Ze)for(const Ke of Dr(P.selection))D(Ze,{target:_o(Ke,Fe),markRunProps:{bold:!1,italic:!1,strikethrough:!1,doubleStrikethrough:!1,smallCaps:!1,caps:!1,verticalAlign:"baseline"}})}return No=_.length?Promise.all(_).then(Ze=>Si(Ze)):null,Si(y.length?y:[!1])},K$=(c,h,y)=>{const _=Dr(P.selection);if(_.length===0)return!1;const E=ys(P.selection);return U$(c.docRoute,h,_,D=>$$(c.blockParagraph,D,y,E))},q$=(c,h,y)=>{const _=w(),E=vr(_,"format.paragraph.setIndentation"),D=vr(_,"format.paragraph.clearIndentation"),U=c.list?.mode,oe=vs(P.selection),fe=ys(P.selection),Re=async Fe=>{const Pe=await pt(_,Fe,oe);if(Pe===!0)return{kind:"list",routeToCall:c.docRoute,opToCall:h,input:{target:VI(Fe)}};if(Pe===null||fe&&fe.storyType!=="body"&&typeof _?.getNode!="function")return null;const Ye=await Cn(_,Fe,fe),Ze={};if(Ye?.right!=null&&(Ze.right=Ye.right),Ye?.firstLine!=null&&(Ze.firstLine=Ye.firstLine),Ye?.hanging!=null&&(Ze.hanging=Ye.hanging),U==="indent")return E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Fe,fe),left:Math.max(0,Ye?.left??0)+UI,...Ze}}:null;const Ke=Math.max(0,(Ye?.left??0)-UI);return Ke>0&&(Ze.left=Ke),Object.keys(Ze).length===0?D?{kind:"paragraph",routeToCall:"format.paragraph.clearIndentation",opToCall:D,input:{target:_o(Fe,fe)}}:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Fe,fe),left:0}}:null:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Fe,fe),...Ze}}:null};return No=(async()=>{const Fe=await Promise.all(y.map(Ke=>Re(Ke).catch(()=>null)));if(Fe.length===y.length&&Fe.every(Ke=>Ke?.kind==="list")&&$n()!=="suggesting"){const Ke=U==="indent"?"lists.indentRange":"lists.outdentRange",We=vr(_,Ke);if(We)try{return await Bo(rr(Ke,We,{paraIds:y,story:oe})).settled}catch{return!1}}const Pe=oe.storyType!=="body"&&Fe.some(Ke=>Ke?.kind==="list"),Ye=Pe&&U==="outdent"?vr(_,"lists.outdentInStory"):null;if(Pe&&!Ye)return!1;const Ze=Fe.map(Ke=>{if(!Ke)return Promise.resolve(!1);try{return Ke.kind==="list"&&Ye?Bo(rr("lists.outdentInStory",Ye,{target:Ke.input.target,story:oe})).settled:Bo(rr(Ke.routeToCall,Ke.opToCall,Ke.input)).settled}catch{return Promise.resolve(!1)}});return Si(await Promise.all(Ze))})(),!0},Y$=(c,h)=>{const y=c.list,_=w(),E=Dr(P.selection);if(E.length===0)return!1;const D=vs(P.selection),U=D.storyType==="body";if(y.mode==="indent"||y.mode==="outdent")return q$(c,h,E);const oe=y.seed,fe=Pe=>{if(Pe.some(dt=>!dt.resolved))return{immediate:!1,settled:null};const Ye=Pe.every(dt=>dt.seed===oe);if(!Ye&&!U)return{immediate:!1,settled:null};const Ze=Ye?U?"lists.remove":"lists.removeInStory":c.docRoute,Ke=Ye?vr(_,Ze):h;if(!Ke)return{immediate:!1,settled:null};const We=[],at=[];return E.forEach((dt,qe)=>{if(!Ye&&Pe[qe]?.seed===oe)return;const At=Ye?{target:Ua(dt),...U?{}:{story:D}}:{target:Ua(dt),seed:oe};try{const Et=Bo(rr(Ze,Ke,At));We.push(Et.immediate),at.push(Et.settled)}catch{We.push(!1),at.push(Promise.resolve(!1))}}),{immediate:Si(We),settled:at.length?Promise.all(at).then(dt=>Si(dt)):null}},Re=E.map(Pe=>qt(_,Pe,D));if(Re.some(Lr))return No=Promise.all(Re).then(async Pe=>{const Ye=fe(Pe);return Ye.settled?await Ye.settled:Ye.immediate}),!0;const Fe=fe(Re);return No=Fe.settled,Fe.immediate};function Rh(c){return c&&typeof c=="object"?c:{}}function X$(c){if(typeof c=="string")return c;const h=Rh(c);if(Object.prototype.hasOwnProperty.call(h,"href"))return h.href;if(Object.prototype.hasOwnProperty.call(h,"value"))return h.value}function Z$(c,h){const y=Rh(c).text;return typeof y=="string"&&y.trim()!==""?y:h}function sE(c){const h=Rh(c),y=h.capture&&typeof h.capture=="object"?h.capture:null;return h.target??y?.target??y?.selectionTarget??h.selectionTarget??h.textTarget??null}const Q$=c=>{const h=w(),y=h?.hyperlinks;if(!y)return!1;const _=Rh(c),E=X$(c),D=sE(c),U=typeof _.text=="string"?_.text:void 0,oe=typeof _.currentText=="string"?_.currentText:void 0,fe=mh(_.hyperlinkTarget)?_.hyperlinkTarget:null,Re=mh(_.textTarget)?_.textTarget:null,Fe=Zi(h,P.selection),Pe=typeof fe?.storyId=="string"&&typeof fe?.hyperlinkNodeId=="string";if(Pe&&E===null){const Ye=y.remove;if(typeof Ye!="function")return!1;try{return rr("hyperlinks.remove",Ye,{storyId:fe.storyId,hyperlinkNodeId:fe.hyperlinkNodeId,keepText:!0})}catch{return!1}}if(Fe&&E===null){const Ye=y.remove;if(typeof Ye!="function")return!1;try{return rr("hyperlinks.remove",Ye,{target:Fe.address,mode:"unwrap"})}catch{return!1}}if((Fe||fe)&&typeof E=="string"&&E.trim()!==""){const Ye=y.patch,Ze=y.updateTarget;if(!(!Pe&&Fe&&typeof Ye=="function")&&!(Pe&&typeof Ze=="function"))return!1;const Ke=typeof U=="string"&&U!==(Pe?oe:Fe?.text??oe),We=h?.text?.replace,at=Ke?Pe?Re:WH(Fe?.address):null,dt=Ke&&!!at&&typeof We=="function";if(Ke&&!dt)return!1;const qe=[],At=[];let Et=null,_n=null,An=null,kr=!1;try{if(Pe){if(typeof Ze!="function")return!1;const Er=rr("hyperlinks.updateTarget",Ze,{storyId:fe.storyId,hyperlinkNodeId:fe.hyperlinkNodeId,newTarget:KH(E)});kr=Lr(Er);const Tr=Bo(Er);if(!mo(Tr.immediate))return!1;qe.push(Tr.immediate),At.push(Tr.settled),Et=Tr.immediate,_n=Tr.committed,An=Tr.settled}else if(Fe){if(typeof Ye!="function")return!1;const Er=rr("hyperlinks.patch",Ye,{target:Fe.address,patch:{href:E}});kr=Lr(Er);const Tr=Bo(Er);if(!mo(Tr.immediate))return!1;qe.push(Tr.immediate),At.push(Tr.settled),Et=Tr.immediate,_n=Tr.committed,An=Tr.settled}}catch{return!1}if(dt){const Er=(Pr,ei)=>mo(ei)?Si([Pr,ei]):mo(Pr)?lh(Pr,ei):ei,Tr=Pr=>{if(!mo(Pr))return Pr;try{const ei=Bo(rr("text.replace",We,{target:at,text:U}));return mo(ei.immediate)?Promise.all([An??Promise.resolve(Pr),ei.settled]).then(([R2,BG])=>Er(R2,BG)):lh(Pr,ei.immediate)}catch{return lh(Pr,!1)}};if(kr)return No=(_n??Promise.resolve(Et??!1)).then(Tr),Si(qe);try{const Pr=Bo(rr("text.replace",We,{target:at,text:U}));if(!mo(Pr.immediate))return Et?lh(Et,Pr.immediate):Pr.immediate;qe.push(Pr.immediate),At.push(Pr.settled),No=Promise.all([An??Promise.resolve(Et??!1),Pr.settled]).then(([ei,R2])=>Er(ei,R2))}catch{return Et?lh(Et,!1):!1}}return!dt&&At.length>0&&(No=Promise.all(At).then(Er=>Si(Er))),Si(qe)}if(typeof E=="string"&&E.trim()!==""){const Ye=E.trim(),Ze=y.wrap,Ke=PH(D),We=Ke.length>0?Ke:u2(P.selection);if(We.length>0){if(typeof Ze!="function")return!1;try{return H$("hyperlinks.wrap",Ze,We,At=>({target:At,link:{destination:{href:Ye}}}))}catch{return!1}}const at=y.insert,dt=Z$(c,Ye);if(typeof at!="function"||dt.trim()==="")return!1;const qe=hh(D)??Ys(P.selection);if(!qe)return!1;try{return rr("hyperlinks.insert",at,{target:qe,text:dt,link:{destination:{href:Ye}}})}catch{return!1}}return!1},J$=(c,h,y)=>{const _=c.create.kind,E=y&&typeof y=="object"?y:{};if(_==="table"){const U=Number(E.rows??E.rowCount),oe=Number(E.columns??E.cols??E.colCount);if(!Number.isInteger(U)||U<1||!Number.isInteger(oe)||oe<1)return!1;const fe=Ys(P.selection),Re=fe&&typeof fe.blockId=="string"?{kind:"inParagraph",target:_o(fe.blockId),offset:fe.range?.start??0}:h2(P.selection,"nodeId");try{return rr(c.docRoute,h,{rows:U,columns:oe,at:Re})}catch{return!1}}if(_==="image"){const U=E.src??E.value;if(typeof U!="string"||U.trim()==="")return!1;const oe=Ys(P.selection),fe=vs(P.selection),Re=fe.storyType==="body"?null:fe;let Fe;oe&&typeof oe.blockId=="string"?Fe={kind:"inParagraph",target:_o(oe.blockId,Re),offset:oe.range?.start??0}:(Fe=h2(P.selection,"target"),Re&&Fe.kind==="after"&&(Fe={...Fe,target:{...Fe.target,story:Re}}));const Pe={src:U,at:Fe};Re&&(Pe.in=Fe.kind==="inParagraph"?Z(Re)??Re:Re),typeof E.alt=="string"&&(Pe.alt=E.alt),typeof E.title=="string"&&(Pe.title=E.title),E.size&&typeof E.size=="object"&&(Pe.size=E.size);try{return rr(c.docRoute,h,Pe)}catch{return!1}}const D={at:h2(P.selection,"target")};typeof E.instruction=="string"&&(D.instruction=E.instruction),E.config&&typeof E.config=="object"&&(D.config=E.config);try{return rr(c.docRoute,h,D)}catch{return!1}},eG=(c,h)=>{const y=c.table,_=Ne();if(!_||y.requiresCell&&!_.cellNodeId)return!1;const E=t$(y.action,_);if(!E)return!1;try{if(y.action==="insert-row-before"||y.action==="insert-row-after"){const D=j(),U=(typeof D?.getHandles=="function"?D.getHandles():null)?.editing?.tables;if(typeof U?.insertRow!="function")return!1;const oe=$r(c.docRoute);return oe&&oe.success===!1?oe:oe?U.insertRow(E,oe):U.insertRow(E)}if(y.action==="insert-column-before"||y.action==="insert-column-after"){const D=j(),U=(typeof D?.getHandles=="function"?D.getHandles():null)?.editing?.tables;if(typeof U?.insertColumn!="function")return!1;const oe=$r(c.docRoute);return oe&&oe.success===!1?oe:oe?U.insertColumn(E,_.rowIndex,oe):U.insertColumn(E,_.rowIndex)}return rr(c.docRoute,h,E)}catch{return!1}},tG=c=>!c||c.disposition!=="routed"?!1:!!(c.inline||c.blockParagraph||c.list||c.link||c.create),nG=c=>{const h=Rh(c);return!!(sE(c)||mh(h.hyperlinkTarget)||mh(h.textTarget))},rG=(c,h,y)=>P.selection.status!=="ready"?!1:og(c)?.scope==="id"||!h||h.disposition!=="routed"?!0:h.inline?.kind==="clear"?Dr(P.selection).length>0||cd(P.selection)!=null:h.inline?cd(P.selection)!=null||Dr(P.selection).length>0:h.blockParagraph||h.list?Dr(P.selection).length>0:h.link?nG(y)||u2(P.selection).length>0||Ys(P.selection)!=null||Za(h,w(),P.selection):!0,oG=(c,h)=>{const y=og(c),_=td(c);return y?.scope==="id"&&mg(h)||y?.scope!=="id"&&!tG(_)?!1:!rG(c,_,h)},iG=(c,h)=>oG(c,h)?Gl().then(()=>{}):null,sG=(c,h,y)=>{if(No=null,Oi=Promise.resolve(!1),ee)return!1;const _=Je.get(c);if(_)try{const Pe=_.execute(ra(h,y));return To(Pe)}catch{return!1}const E=OI(c);if(E){if($n()==="viewing")return!1;if(typeof Y()?.lists?.apply=="function")return yg(E,h)}const D=og(c);if(D)return vg(D,h);if(c==="copy-format")return To(aG());const U=td(c);if(!U||U.disposition!=="routed")return!1;const oe=U.normalizePayload?U.normalizePayload(h):h;if(U.instanceRoute){if(!S()||!Qi(U,oe))return!1;const Pe=t?.[U.instanceRoute];if(typeof Pe!="function")return!1;try{const Ye=U.fixedArg!==void 0?U.fixedArg:oe,Ze=Pe.call(t,Ye);return To(Ze)}catch{return!1}}if(U.inline?.kind==="clear")return U.mutates&&$n()==="viewing"?!1:To(W$());const fe=U.docRoute;if(!fe||U.mutates&&$n()==="viewing")return!1;const Re=w(),Fe=vr(Re,fe);if(!Fe)return!1;if(U.inline){const{lockModesById:Pe}=Ya(Re?.contentControls,P.selection);if(ks(Pe))return!1;const Ye=cd(P.selection);if(!Ye)return P.selection.empty===!1?To(!1):To(G$(U,oe));const Ze=Za(U,Re,P.selection),Ke=JH(U.inline,Ye,oe,Ze);if(!Ke)return!1;let We=null;try{const at=S(),dt=$n(),qe=()=>S()!==at||w()!==Re||$n()!==dt?!1:b2(fe,Fe,Ke),At=Ha(P.selection)??Dc(P.selection),Et=U.inline.kind==="toggle"?yn(`${U.id}:${At}`,qe):null;We=Et?.release??null;const _n=Et?Et.result:qe(),An=z$(U,P.selection,Ke,_n),kr=B$(U,P.selection,Ke,_n),Er=To(kr,Tr=>{j$(U,An,Tr),We?.(),We=null});return U.inline.kind==="toggle"&&(el=Oi),Er}catch{return We?.(),!1}}if(U.blockParagraph){const Pe=K$(U,Fe,oe),Ye=U.blockParagraph.kind==="alignment"&&mo(Pe)?ot(P.selection,oe):null;return To(Pe,Ze=>{bt(Ye,Ze)})}if(U.list){const Pe=Y$(U,Fe);return To(Pe)}if(U.link){const Pe=Q$(oe);return To(Pe)}if(U.create){const Pe=J$(U,Fe,oe);return To(Pe)}if(U.table){const Pe=eG(U,Fe);return To(Pe)}try{return To(U.mutates?rr(fe,Fe,oe):Fe(oe))}catch{return!1}},tu=(c,h,y)=>{const _=QE(t,"command:started",()=>({commandId:c,selection:P.selection}));let E;try{E=sG(c,h,y)}catch(U){throw Od(t,"command:settled",()=>({actionId:_,commandId:c,outcome:"threw"})),U}const D=U=>Od(t,"command:settled",()=>({actionId:_,commandId:c,outcome:mo(U)?"succeeded":"rejected",result:U}));if(E===!1)D(E);else try{Oi.then(D,()=>D(!1))}catch{}return E},wg=()=>{g+=1,p={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:p.lastClickAt,pointerSelecting:!1,keyboardSelecting:!1};for(const c of m)c("idle");Dt()},aG=async()=>{const c=["bold","italic","underline","strikethrough"].filter(Fe=>P.toolbar.commands[Fe]?.active===!0),h=await el;await d;const y=mo(h)?c:[],_=500,E=Date.now();if(p.mode!=="idle"){if(p.mode==="armed"&&E-p.lastClickAt<_){p={...p,mode:"persistent",lastClickAt:E};for(const Fe of m)Fe("persistent");return Dt(),!0}return wg(),!1}const D=E-p.lastClickAt<_,U=++g;p={...p,lastClickAt:E};const oe=await Gl(),fe=`${Dc(oe)}:${ft()}`,Re=await lG(null,oe,fe&&fe===k?v:void 0,y);if(U!==g)return!0;p={...p,mode:D?"persistent":"armed",snapshot:Re,sourceSelectionKey:Dc(oe),lastClickAt:E};for(const Fe of m)Fe(p.mode);return Dt(),!0},lG=async(c,h,y,_=[])=>{const E=h?.target??c?.target;if(!E||E.kind!=="text")return null;const D=Array.isArray(E.segments)?E.segments:[];if(D.length===0)return null;const U=w();if(!U)return null;const oe=E.story;let fe=null;for(const Ke of D){const We=(await ui(_o(Ke.blockId,oe)))?.node??null;if(!We)continue;const at=w2(We),dt=Array.isArray(at?.inlines)?at.inlines:[],qe=cG(dt,Ke.range);fe?fe=aE(fe,qe):fe=qe}const Re=fe?QU(fe):{},Fe={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike"},Pe=new Set([...h?.activeMarks??(Array.isArray(c?.activeMarks)?c.activeMarks:[]),..._]);for(const[Ke,We]of Object.entries(Fe))Pe.has(Ke)&&(Re[We]=!0);const Ye=y??await Jc(h??oa(c,"ready"));if(Ye.fontFamily&&(Re.fontFamily=Ye.fontFamily),Ye.color&&(Re.color=Ye.color),Ye.highlight&&(Re.highlight=Ye.highlight),Ye.fontSize){const Ke=Number.parseFloat(Ye.fontSize);Number.isNaN(Ke)||(Re.fontSize=Ke)}let Ze=null;if(D.length===1){const Ke=D[0],We=(await ui(_o(Ke.blockId,oe)))?.node??null;We&&w2(We)&&(Ze=await uG(We,Ke.blockId,U,oe))}return{story:oe??null,inline:Re,paragraph:Ze}},w2=c=>c?c.kind==="paragraph"?c.paragraph??null:c.kind==="heading"?c.heading??null:null:null,cG=(c,h)=>{const y=U=>{const oe=U.run;return typeof oe?.text=="string"?oe.text:""},_=U=>U.run?.props;if(h.start===h.end){let U=0;for(const oe of c){const fe=y(oe),Re=U,Fe=U+fe.length;if(U=Fe,h.start>=Re&&h.start<=Fe){const Pe=_(oe);return Pe?{...Pe}:{}}}return{}}let E=0;const D=[];for(const U of c){const oe=y(U),fe=E,Re=E+oe.length;if(E=Re,Re<=h.start||fe>=h.end)continue;const Fe=_(U);Fe&&D.push(Fe)}return D.length===0?{}:D.length===1?{...D[0]}:aE(D[0],...D.slice(1))},aE=(c,...h)=>{const y={...c};for(const _ of h)for(const E of Object.keys(y)){if(!(E in _)){delete y[E];continue}const D=y[E],U=_[E];(typeof D!=typeof U||JSON.stringify(D)!==JSON.stringify(U))&&delete y[E]}return y},uG=async(c,h,y,_)=>{const E=w2(c),D=E.props??{},U=E.styleRef??null,oe=D.alignment??null,fe=D.spacing??null,Re=D.indent??null,Fe=Re?{...Re.left!=null?{left:Re.left}:{},...Re.right!=null?{right:Re.right}:{},...Re.firstLine!=null?{firstLine:Re.firstLine}:{},...Re.hanging!=null?{hanging:Re.hanging}:{}}:null,Pe=D.markRunProps??null,Ye=D.numbering?.numId,Ze=typeof Ye=="string"?parseInt(Ye,10):typeof Ye=="number"?Ye:NaN,Ke=D.numbering?.level,We=isNaN(Ze)?null:{numId:Ze,...Ke!=null?{level:Ke}:{}};let at=null;if(We&&typeof y.lists?.getState=="function")try{const dt=await y.lists.getState({target:_o(h,_)});dt&&typeof y.lists?.getStyle=="function"&&(at=await y.lists.getStyle(dt)??null)}catch{}return{styleId:U,alignment:oe,spacing:fe,indentation:Fe,markRunProps:Pe,numbering:We,listStyle:at}},lE=async()=>{if(p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;const c=w()?.selection,h=async()=>{const U=typeof c?.current=="function"?await Promise.resolve(c.current({includeText:!0})):ia().value;return Yi(U)},y=()=>new Promise(U=>setTimeout(U,16)),_=8;let E=null,D="";for(let U=0;U<_;U+=1){if(U>0&&await y(),p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;if(E=await h(),!(!E||E.empty)&&(D=Dc(E),D!==p.sourceSelectionKey))break}if(E&&!E.empty&&D!==p.sourceSelectionKey){await cE(E);return}if(p.snapshot?.paragraph){const U=await h();if(!U||Dc(U)===p.sourceSelectionKey)return;await cE(U)}},cE=async c=>{const h=p.snapshot;if(!h){p.mode==="armed"&&wg();return}const y=w();if(!y)return;const _=oa(c,"ready"),{lockModesById:E}=Ya(y.contentControls,_);if(ks(E)){Dt();return}const D=c.target,U=c.selectionTarget;if(c.empty!==!0&&Object.keys(h.inline).length>0){const oe=vr(y,"format.apply");if(oe&&U)try{if(!mo(Xs(await Promise.resolve(b2("format.apply",oe,{target:U,inline:h.inline},c))))){Dt();return}}catch{Dt();return}}if(h.paragraph){const oe=Array.isArray(D?.segments)?D.segments:[],fe=D?.story;for(const Re of oe){const Fe=_o(Re.blockId,fe),Pe=await ui(Fe),Ye=Pe?.node??null,Ze=Pe?.address??null;if(!Ye)continue;const Ke={kind:"block",nodeType:Ze?.nodeType??Ye.kind??"paragraph",nodeId:Re.blockId,...fe&&typeof fe=="object"?{story:fe}:{}},{styleId:We,alignment:at,spacing:dt,indentation:qe,markRunProps:At,numbering:Et,listStyle:_n}=h.paragraph;if(We&&await y.styles?.paragraph?.setStyle?.({target:Ke,styleId:We}),at&&await y.format?.paragraph?.setAlignment?.({target:Ke,alignment:at}),dt){const An=dt,kr=An.lineRule??"auto",Er=new Set(["auto","exact","atLeast"]).has(kr)?kr:"auto",Tr={...An.before!=null?{before:Math.round(An.before*20)}:{},...An.after!=null?{after:Math.round(An.after*20)}:{},...An.line!=null?{line:Math.round(Er==="auto"?An.line*240:An.line*20),lineRule:Er}:{}};await y.format?.paragraph?.setSpacing?.({target:Ke,...Tr})}if(qe){const An={...qe.left!=null?{left:qs(qe.left)}:{},...qe.right!=null?{right:qs(qe.right)}:{},...qe.firstLine!=null?{firstLine:qs(qe.firstLine)}:{},...qe.hanging!=null?{hanging:qs(qe.hanging)}:{}};await y.format?.paragraph?.setIndentation?.({target:Ke,...An})}At&&await y.format?.paragraph?.setMarkRunProps?.({target:Ke,markRunProps:At}),Et&&await y.format?.paragraph?.setNumbering?.({target:Ke,...Et}),_n&&((await ui(Fe))?.address?.nodeType==="listItem"?await y.lists?.applyStyle?.({target:VI(Re.blockId,fe),style:_n}):Et&&await y.format?.paragraph?.setNumbering?.({target:Ke,...Et}))}}p.mode==="armed"&&wg(),Dt()},Cg=(c,h,y)=>{const _=iG(c,h),E=_?_.then(()=>(tu(c,h,y),Oi)):(tu(c,h,y),Oi);return td(c)?.inline?.kind==="toggle"&&(el=E),E},uE=c=>({id:c,getState:()=>P.toolbar.commands[c]??aa(c,w(),P.selection,Xa(P.selection)),observe:h=>ca(y=>y.toolbar.commands[c]??{enabled:!1,active:!1,supported:!1,source:"unsupported",reason:lt.commandUnsupported}).subscribe(h),execute:h=>tu(c,h),executeAsync:h=>Cg(c,h)}),dG=c=>{Je.set(c.id,c),Dt();const h=()=>{Je.delete(c.id),Dt()};return Object.assign(h,{handle:uE(c.id),unregister:h})},kg=rs(c=>c.selection),Sg=Di(kg),dE=()=>{const c=j();if(typeof c?.getHandles!="function")return{reason:lt.hostCapabilityUnavailable};let h=null;try{h=c.getHandles()}catch(E){const D=E?.reason;return{reason:D==="host-not-ready"||D==="host-disposed"||D==="editing-mount-required"?lt.notReady:lt.hostCapabilityUnavailable}}const y=h?.editing?.selectionTargets;if(typeof y?.apply=="function")return{helper:y};const _=h?.selection;return typeof _?.apply=="function"?{helper:_}:{reason:lt.hostCapabilityUnavailable}},fG=()=>{const c=j();if(typeof c?.getHandles!="function")return null;let h=null;try{h=c.getHandles()}catch{return null}const y=h?.editing?.selection?.toSelectionTarget?.()??h?.selection?.toSelectionTarget?.();if(!y||typeof y!="object"||y.kind!=="ok")return null;const _=y.target;return _&&typeof _=="object"?_:null},hG=c=>{const h=j();if(typeof h?.getHandles=="function")try{const y=h.getHandles()?.editing?.contentControls;typeof y?.activate=="function"&&y.activate({id:c})}catch{}},fE={get:Sg.get,getSnapshot:Sg.getSnapshot,subscribe:Sg.subscribe,observe:Sg.observe,current:()=>ia().value,capture:()=>{const c=kg.get();return c.empty||!c.target&&!c.selectionTarget?null:{...c,capturedAt:Date.now()}},restore:c=>{const h=E=>(Dt(),{...E,success:E.ok});if(!c||typeof c!="object")return h({ok:!1,reason:lt.targetUnresolved});if(!S())return h({ok:!1,reason:lt.notReady});const y=ZH(c);if(!y)return h({ok:!1,reason:lt.targetUnresolved});const _=dE();if(!("helper"in _))return h({ok:!1,reason:_.reason});try{return h(DI(_.helper.apply(y)))}catch{return h({ok:!1,reason:lt.hostCapabilityUnavailable})}},apply:c=>{if(!S())return{ok:!1,reason:lt.notReady};const h=dE();if(!("helper"in h))return{ok:!1,reason:h.reason};try{const y=h.helper.apply(c);return Dt(),DI(y)}catch{return{ok:!1,reason:lt.hostCapabilityUnavailable}}},getAnchorRect:c=>{const h=j();if(typeof h?.getSelectionAnchorRect=="function"){const y=Ot(()=>h.getSelectionAnchorRect(c),null);return y&&typeof y=="object"&&(Number(y.width)>0||Number(y.height)>0)?y:null}return null},getRects:c=>{const h=kg.get(),y=h.selectionTarget??h.target;if(h.empty||!y)return[];const _=Og.getRect({target:y,relativeTo:c?.relativeTo});return _.found?_.rects:[]}},pG={get ids(){return di()},has:c=>td(c)!=null||Je.has(c),get:c=>uE(c),execute:tu,executeAsync:Cg,register:dG,getContextMenuItems:c=>{const h=[];for(const y of Je.values()){const _=y.contextMenu;_&&Ot(_.when?()=>_.when(c):void 0,!0)&&h.push({id:y.id,label:_.label,group:_.group,order:_.order,invoke:()=>tu(y.id,void 0,c)})}return h.sort((y,_)=>(y.order??0)-(_.order??0)||y.label.localeCompare(_.label))}},C2=Di(rs(c=>c.toolbar)),mG={get:C2.get,getSnapshot:()=>P.toolbar,subscribe:C2.subscribe,observe:C2.observe,execute:tu,executeAsync:Cg},Id=async(c,h)=>{if(!S())return{success:!1,ok:!1,reason:lt.notReady};if(!c)return{success:!1,ok:!1,reason:lt.targetUnresolved};const y=j(),_=y?.scrollTargetIntoView;if(typeof _!="function")return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable};try{const E={target:c,block:h?.block??"center",behavior:h?.behavior??"smooth"},D=await Promise.resolve(h?.shouldContinue?_.call(y,E,h.shouldContinue):_.call(y,E));return D&&typeof D=="object"&&D.success===!1?{success:!1,ok:!1,reason:eg(D.reason,lt.targetUnresolved)}:{success:!0,ok:!0}}catch{return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable}}},hE=c=>{if(!c||typeof c!="object")return null;const h=c,y=h.wordRevisionIds&&typeof h.wordRevisionIds=="object"?h.wordRevisionIds:null,_=h.sourceIds&&typeof h.sourceIds=="object"?h.sourceIds:null,E=Array.isArray(_?.wordIdOther)?_.wordIdOther:void 0,D=y?.insert??y?.delete??y?.format??_?.wordIdInsert??_?.wordIdDelete??E?.[0];return typeof D=="string"&&D.length>0?D:null},pE=async(c,h,y,_,E)=>{const D=await Id(h,E);if(D.ok)return D;const U=T(),oe=U?.focusTrackedChange;if(typeof oe!="function")return D;const fe=y||_?{commentId:c,...y?{trackedChangeStory:y}:{},..._?{importedId:_}:{}}:c;try{const Re=await Promise.resolve(oe.call(U,fe));if(Re&&typeof Re=="object"&&Re.ok===!0)return{success:!0,ok:!0}}catch{}return D},_g=async(c,h,y,_)=>{const E=c==="trackChanges"?_?.story:void 0,D=c==="trackChanges"?_?.matchStory??E:void 0,U=qe=>{if(!E||!qe||typeof qe!="object")return qe;const At=qe,Et=At.address&&typeof At.address=="object"?At.address:null;return At.story||Et?.story?qe:{...At,story:E}},oe=c==="trackChanges"?FI:ch,fe=y.find(qe=>ki(qe,h,D)),Re=fe&&typeof fe=="object"?fe:null,Fe=c==="trackChanges"&&Re?.type==="move"&&(Re.subtype==="move-to"||Re.subtype==="move-from")?Re.subtype:null,Pe=Fe&&typeof Re?.trackedChangeCanonicalId=="string"?Re.trackedChangeCanonicalId:h,Ye=qe=>{if(!Fe)return c==="trackChanges"?FI(qe,{preferStableBlock:!0}):oe(qe);const At=ch(qe);if(At?.kind!=="move")return null;const Et=Fe==="move-to"?At.destination:At.source;return c2(Et)?Et:null},Ze=oe(fe),Ke=c!=="trackChanges"||!Fe&&c2(ch(fe));if(Ze&&Ke)return U(Ze);const We=w()?.[c],at=c==="comments"?{commentId:h}:{id:Pe,...E?{story:E}:{}},dt=We?.get;if(typeof dt!="function")return U(Ze);try{return U(Ye(await Promise.resolve(dt.call(We,at)))??Ze)}catch{return U(Ze)}};function mE(c,h){if(Ga())return Wn("Comments are read-only.","DOCUMENT_READONLY");if(fd())return Wn("Resolving comments is disabled.","DOCUMENT_READONLY");const y=w()?.comments,_=y?.patch;if(typeof _!="function")return Wn("comments.patch is unavailable.");const E=Wn("comments.patch failed.");return Ot(()=>rc(_.call(y,{commentId:c,status:h}),E),E)}const Mh=()=>Ga()?Wn("Comments are read-only.","DOCUMENT_READONLY"):null,gG=(c,h)=>{const y=h&&typeof h=="object"?h:null;let _=Array.from(c);y?.includeResolved===!1&&(_=_.filter(fe=>fe.status!=="resolved"));const E=Number(y?.offset),D=Number.isInteger(E)&&E>0?E:0,U=Number(y?.limit),oe=Number.isInteger(U)&&U>=0?D+U:void 0;return _.slice(D,oe)},Ed=rs(c=>c.comments),Ag=Eh(Ed,ca(c=>gd(c.selection,c.comments)),"comments"),vG={get:Ag.get,getSnapshot:Ag.getSnapshot,subscribe:Ag.subscribe,observe:Ag.observe,list:c=>{ht();const h=Wl();return gG(h.value??Ed.get().items,c)},getById:c=>{const h=Ed.get().items.find(E=>Vr(E)===c)??null;if(h)return h;const y=w()?.comments,_=Ot(y?.get?()=>y.get({commentId:c}):void 0,null);return Lr(_)?null:_},createFromCapture:(c,h)=>{const y=Mh();if(y)return y;const _=w()?.comments,E=_?.create;if(typeof E!="function")return Wn("comments.create is unavailable.");const D=Wn("comments.create failed.");return Ot(()=>{const U=c&&typeof c=="object"?c.target??c.selectionTarget:null;return U==null?Wn("A range selection is required to comment.","NO_SELECTION"):rc(E.call(_,{target:U,text:h.text}),D)},D)},createFromSelection:c=>{const h=Mh();if(h)return h;const y=w()?.comments,_=y?.create;if(typeof _!="function")return Wn("comments.create is unavailable.");const E=kg.get();let D=E.target??E.selectionTarget;if(E.empty||!D){const oe=fG();oe&&(D=oe)}if(!D)return Wn("A range selection is required to comment.","NO_SELECTION");const U=Wn("comments.create failed.");return Ot(()=>rc(_.call(y,{target:D,text:c.text}),U),U)},reply:(c,h)=>{const y=Mh();if(y)return y;const _=w()?.comments,E=_?.reply??_?.create;if(typeof E!="function")return Wn("comments.reply is unavailable.");const D=Wn("comments.reply failed.");return Ot(()=>rc(E===_?.reply?E.call(_,{parentCommentId:c,text:h.text}):E.call(_,{parentCommentId:c,text:h.text}),D),D)},edit:(c,h)=>{const y=Mh();if(y)return y;const _=w()?.comments,E=_?.patch;if(typeof E!="function")return Wn("comments.patch is unavailable.");const D=Wn("comments.patch failed.");return Ot(()=>rc(E.call(_,{commentId:c,text:h.text}),D),D)},resolve:c=>mE(c,"resolved"),reopen:c=>mE(c,"active"),delete:c=>{const h=Mh();if(h)return h;const y=w()?.comments,_=y?.delete??y?.remove;if(typeof _!="function")return Wn("comments.delete is unavailable.");const E=Wn("comments.delete failed.");return Ot(()=>rc(_.call(y,{commentId:c}),E),E)},setActive:c=>{if(c==null)return ct=null,Dt(),!0;if(!S())return!1;const h=Ed.get(),y=N.get("comments"),_=y?.token===ft()&&y.hasSettled&&Array.isArray(y.value)?y.value:null,E=_??h.items;if(!_&&h.listStatus!=="ready")return!1;const D=MH(E,c);return!D||!E.some(U=>Vr(U)===D)?!1:(ct=D,Dt(),!0)},scrollTo:async c=>{if(!w())return{success:!1,ok:!1,reason:S()?lt.documentApiUnavailable:lt.notReady};const h=await _g("comments",c,Ed.get().items);return h?Id(h):{success:!1,ok:!1,reason:lt.targetUnresolved}}},os=rs(c=>c.trackChanges),k2=(c,h)=>{mt();const y=(xi().value??os.get().items).map(ad).filter(Pe=>Pe!=null&&Vr(Pe)!==null);if(y.length===0)return null;const _=P.trackChanges.activeId,E=tt?.id===_?tt.story:void 0,D=y.filter(Pe=>dh(Pe)==null),U=E||D.length===0?y:D;let oe=_?U.findIndex(Pe=>ki(Pe,_,E)):-1;oe===-1&&_&&E&&(oe=U.findIndex(Pe=>ki(Pe,_)));const fe=U[oe===-1?c>0?0:U.length-1:(oe+c+U.length)%U.length],Re=Vr(fe),Fe=dh(fe);return F(Fe?{id:Re,story:Fe}:{id:Re},h),Dt(),Re},gE=async c=>{const h=T(),y=h?.listTrackedChanges;if(typeof y=="function")try{await Promise.resolve(y.call(h,{mode:"visible-window",targetIds:[c],refreshReason:"ui-track-change-reveal-restamp",blocking:!0}))}catch{}};let vE=Promise.resolve();const yG=c=>{const h=ae;return vE.catch(()=>{}).then(()=>bG(c,h))},bG=async(c,h)=>{if(ae!==h)return{success:!1};const y=tt,_=k2(c,{invalidateQueuedNavigation:!1});if(_==null)return{success:!1};const E=tt,D=Tt,U=()=>ae===h&&tt===E&&Tt===D,oe=()=>{U()&&(F(y,{invalidateQueuedNavigation:!1}),Dt())};E&&Ue.add(E);try{const fe=await _g("trackChanges",_,os.get().items,E?.story?{story:E.story}:void 0);if(!U())return{success:!1};if(!fe)return oe(),{success:!1};const Re=os.get().items.find(Pe=>ki(Pe,_,E?.story))??os.get().items.find(Pe=>Vr(Pe)===_),Fe=hE(Re);rt+=1;try{const Pe=await pE(_,fe,E?.story,Fe,{behavior:"auto",shouldContinue:U});if(!U())return{success:!1};if(!Pe.ok&&Pe.reason!==lt.targetNotVisible)oe(),se(y);else{if(Pe.ok&&await gE(_),!U())return{success:!1};se(E)}return{success:Pe.ok}}finally{rt=Math.max(0,rt-1),rt===0&&(U()?Zo&&xt(Ce(Zo)):se(tt))}}finally{E&&Ue.delete(E)}},yE=c=>{const h=yG(c);return vE=h.then(()=>{},()=>{}),h},Ig=Eh(os,ca(c=>vd(c.selection,c.trackChanges)),"trackChanges"),wG={get:Ig.get,getSnapshot:Ig.getSnapshot,subscribe:Ig.subscribe,observe:Ig.observe,list:()=>{mt();const c=xi().value??os.get().items,h=on(ft());return c.map(ad).filter(y=>y!=null).filter(y=>{const _=Vr(y);return!_||!h?.has(_)})},accept:c=>Lh("accept",c),acceptAsync:c=>Eg(()=>Lh("accept",c)),reject:c=>Lh("reject",c),rejectAsync:c=>Eg(()=>Lh("reject",c)),acceptAll:()=>nu("accept",{kind:"all"},null),acceptAllAsync:()=>Eg(()=>nu("accept",{kind:"all"},null)),rejectAll:()=>nu("reject",{kind:"all"},null),rejectAllAsync:()=>Eg(()=>nu("reject",{kind:"all"},null)),next:()=>k2(1),previous:()=>k2(-1),navigateNext:()=>yE(1),navigatePrevious:()=>yE(-1),getAt:c=>{if(!c||typeof c!="object"||typeof c.x!="number"||typeof c.y!="number")return null;const h=E2(c);if(h.length===0)return null;const y=os.get().items;let _;for(const E of h){if(E.type!=="trackedChange")continue;let D;if(E.story){if(_===void 0&&(_=Qr()),!_)continue;D=_}else D=y;const U=D.find(oe=>ki(oe,E.id,E.story));if(U)return E.story?{id:U.id,item:U,story:E.story}:{id:U.id,item:U}}return null},setActive:c=>{if(c==null)return F(null),se(null),Dt(),!0;if(!S())return!1;const h=typeof c=="string"?{id:c}:{id:c.id,story:c.story};if(typeof h.id!="string"||h.id.length===0)return!1;const y=h.id;if(h.story){const _=Qr();if(!_)return!1;const E=Fl(_,h.story).toPublicId(h.id)??h.id;if(!_.some(D=>ki(D,E,h.story)))return!1;h.id=E}else{const _=Qr()??os.get().items,E=Ks(_).toPublicId(h.id)??h.id,D=_.find(U=>Vr(U)===E);if(!D)return!1;h.id=E,h.story=dh(D)}return y!==h.id&&(h.paintedEntityId=y),F(h),se(h),Dt(),!0},scrollTo:async c=>{if(!w())return{success:!1,ok:!1,reason:S()?lt.documentApiUnavailable:lt.notReady};const h=typeof c=="string"?c:c.id,y=typeof c=="string"||!c.story||typeof c.story!="object"?void 0:c.story,_=y?dh({address:{story:y}}):void 0;if(typeof h!="string"||h.length===0)return{success:!1,ok:!1,reason:lt.targetUnresolved};ae+=1,Ee+=1;const E=Ee,D=y?Qr()??os.get().items:os.get().items,U=y?Fl(D,y).toPublicId(h)??h:Ks(D).toPublicId(h)??h,oe=y?D.find(Ye=>ki(Ye,U,y)):D.find(Ye=>Vr(Ye)===U),fe=y?_:dh(oe),Re=hE(oe),Fe=tt,Pe={id:U,...fe?{story:fe}:{},...U!==h?{paintedEntityId:h}:{}};Ue.add(Pe);try{const Ye=await _g("trackChanges",U,D,fe||y?{story:fe,matchStory:y}:void 0);if(Ee!==E)return{success:!1,ok:!1};if(!Ye)return{success:!1,ok:!1,reason:lt.targetUnresolved};F(Pe);const Ze=Ee,Ke=tt,We=Tt,at=()=>Ee===Ze&&tt===Ke&&Tt===We,dt=()=>{at()&&(F(Fe,{invalidateQueuedNavigation:!1}),Dt())};Dt(),rt+=1;try{const qe=await pE(U,Ye,fe,Re,{behavior:"auto",shouldContinue:at});if(!at())return{success:!1,ok:!1};if(!qe.ok&&qe.reason!==lt.targetNotVisible)dt(),se(Fe);else{if(qe.ok&&await gE(U),!at())return{success:!1,ok:!1};se(Pe)}return qe}finally{rt=Math.max(0,rt-1),rt===0&&(at()?Zo&&xt(Ce(Zo)):se(tt))}}finally{Ue.delete(Pe)}}},Lh=(c,h)=>{const{id:y,story:_}=typeof h=="string"?{id:h,story:void 0}:h;if(typeof y!="string"||y.length===0)return!1;const E={kind:"id",id:y,..._?{story:_}:{}};return nu(c,E,y,_)},Eg=c=>(No=null,Oi=Promise.resolve(!1),ee||c()===!1?Promise.resolve(!1):Oi),nu=(c,h,y,_)=>{try{return To(S2(c,h,y,_))}catch{return!1}},S2=(c,h,y,_)=>{if(Vc())return!1;const E=w()?.trackChanges,D=h.kind==="all"||h.scope==="all",U=h.kind==="range",oe=h.kind==="ids",fe=D?[]:oe&&Array.isArray(h.ids)?h.ids.filter(Ye=>typeof Ye=="string"&&Ye.length>0):y?[y]:[];if(fe.length>0&&io(c,fe)||Zl({kind:c,scope:D?"all":"id"},E))return!1;const Re=D?`${c}All`:c,Fe=!U&&!oe&&!_&&E&&typeof E[Re]=="function"?E[Re]:null,Pe=E&&typeof E.decide=="function"?E.decide:null;return!Fe&&!Pe?!1:Fe?Fe.call(E,y??{}):Pe.call(E,{decision:c,target:h})},Tg=rs(c=>c.contentControls),Dh=c=>Tg.get().items.find(h=>h?.id===c)??null,xg=Eh(Tg,ca(c=>(yo.contentControls>0&&Eo("contentControls"),c.contentControls)),"contentControls"),CG=(c=>{if(c===void 0)return xg.get();const h=fh(c);return h?Dh(h):null}),kG=Di(Tg);let _2=0,A2=null;const I2=()=>{_2+=1;const c=A2??j();A2=null,Ot(()=>c?.clearContentControlHighlight?.call(c),void 0)};Yn.push(I2);const SG={clearHighlight:I2,highlight:async c=>{const h=fh(c);if(!h)return{success:!1,reason:"invalid-id"};const y=j(),_=S(),E=w()?.contentControls;if(ee||!y||typeof y.highlightContentControl!="function"||typeof E?.list!="function")return{success:!1,reason:"not-ready"};const D=++_2;A2=y,Ot(()=>y.cancelContentControlHighlightRequest?.call(y),void 0);const U=()=>ee||D!==_2||_!==S();try{const oe=await E.list.call(E);if(U())return{success:!1,reason:"cancelled"};const fe=oe?.items?.find(Pe=>Pe.id===h);if(!fe)return{success:!1,reason:"not-found"};const Re=tg(fe);if(!Re||fe.isEmpty)return{success:!1,reason:"not-reachable"};const Fe=await y.highlightContentControl.call(y,h,Re);return U()?{success:!1,reason:"cancelled"}:Fe?{success:!0}:{success:!1,reason:"not-reachable"}}catch{return{success:!1,reason:U()?"cancelled":"not-reachable"}}},get:(c=>(c!==void 0&&ze("api"),CG(c))),getSnapshot:xg.getSnapshot,subscribe:xg.subscribe,observe:xg.observe,observeActivePath:kG.observe,list:()=>(ze("api"),Tg.get().items),getById:c=>(ze("api"),Dh(c)),getRect:c=>{const h=fh(c);if(!h)return Nl("unresolved");ze("panel");const y=Dh(h);if(!y)return Nl("unresolved");const _=tg(y);return _?Og.getRect({target:_}):Nl("unavailable")},scrollIntoView:async c=>{const h=fh(c);if(!h)return{success:!1};ze("panel");const y=Dh(h);if(!y)return{success:!1};const _=tg(y);return _?{success:(await Id(_,{block:c.block,behavior:c.behavior})).ok}:{success:!1}},focus:async c=>{const h=fh(c);if(!h)return{success:!1,reason:"invalid-id"};if(!S())return{success:!1,reason:"not-ready"};ze("panel");const y=Dh(h);if(!y)return{success:!1,reason:"not-found"};const _=tg(y);if(!_)return{success:!1,reason:"not-reachable"};if(!(await Id(_,{block:c.block,behavior:c.behavior})).ok)return{success:!1,reason:"not-reachable"};const E=_H(_);if(!E)return{success:!1,reason:"not-reachable"};const D=fE.apply(E);return!D.ok&&D.reason!==lt.hostCapabilityUnavailable?{success:!1,reason:"not-reachable"}:(hG(h),{success:!0})}},Rg=Di(rs(c=>c.fonts)),_G={get:Rg.get,getSnapshot:Rg.getSnapshot,subscribe:Rg.subscribe,observe:Rg.observe,getFamilyOptions:()=>P.fonts.options,getSizeOptions:()=>P.fonts.sizeOptions},Mg=Di(rs(c=>c.zoom)),AG={get:Mg.get,getSnapshot:Mg.getSnapshot,subscribe:Mg.subscribe,observe:Mg.observe,set:c=>{if(typeof t?.setZoom=="function")try{t.setZoom(c),Dt()}catch{}},setMode:c=>{if(typeof t?.setZoomMode=="function")try{t.setZoomMode(c),Dt()}catch{}}},Lg=Di(rs(c=>c.document)),IG={get:Lg.get,getSnapshot:Lg.getSnapshot,subscribe:Lg.subscribe,observe:Lg.observe,setMode:c=>{if(typeof t?.setDocumentMode=="function")try{t.setDocumentMode(c),Dt()}catch{}},export:c=>{if(typeof t?.export=="function")try{return Promise.resolve(t.export(c))}catch{return}},getText:()=>{const c=w(),h=Ot(c?.getText?()=>c.getText({}):void 0,null);return typeof h=="string"?h:h&&typeof h=="object"&&typeof h.text=="string"?h.text:null},replaceDocument:async c=>{const h=e.superdoc;return typeof h.replaceDocument!="function"?{ok:!1,reason:lt.operationUnavailable}:h.replaceDocument(c)},replaceFile:c=>{const h=t?.replaceFile??t?.loadDocument??t?.reload;if(typeof h=="function")try{return Promise.resolve(h.call(t,c))}catch{return}}},bE=()=>{if(typeof HTMLElement>"u")return null;const c=S()?.mount?.container;if(c instanceof HTMLElement)return c;const h=t?.element;return h instanceof HTMLElement?h:null},EG=(c,h)=>{if(typeof c!="number"||typeof h!="number"||!Number.isFinite(c)||!Number.isFinite(h))return[];const y=globalThis.document;if(!y||typeof y.elementFromPoint!="function")return[];const _=bE();if(!_)return[];const E=y.elementFromPoint(c,h);if(!E||!_.contains(E))return[];const D=[E],U=qe=>{qe&&_.contains(qe)&&!D.includes(qe)&&D.push(qe)},oe=y.elementsFromPoint;if(typeof oe=="function"){let qe=[];try{qe=oe.call(y,c,h)??[]}catch{qe=[]}for(const At of qe)U(At)}const fe=[],Re=qe=>{qe&&_.contains(qe)&&!fe.includes(qe)&&!D.includes(qe)&&fe.push(qe)},Fe=qe=>{const At=qe.getBoundingClientRect;if(typeof At!="function")return!1;let Et;try{Et=At.call(qe)}catch{return!1}return Et!=null&&c>=Et.left&&c<=Et.right&&h>=Et.top&&h<=Et.bottom};for(const qe of D){const At=qe.querySelectorAll;if(typeof At!="function")continue;let Et;try{Et=At.call(qe,"[data-track-change-marker]")}catch{continue}for(let _n=0;_n<Et.length;_n+=1)Fe(Et[_n])&&Re(Et[_n])}fe.reverse();const Pe=[...fe,...D],Ye=LI(Pe[0],_);for(let qe=1;qe<Pe.length;qe+=1)for(const At of LI(Pe[qe],_))Ye.push(At);if(Ye.length===0)return Ye;const Ze=os.get().items,Ke=Ks(Ze);let We;const at=new Set,dt=[];for(const qe of Ye){if(qe.type!=="trackedChange"){const An=`${qe.type}:${qe.id}`;if(at.has(An))continue;at.add(An),dt.push(qe);continue}const At=SH(qe.storyKey)??kH(qe.story);let Et;if(At){if(We===void 0&&(We=Qr()),!We||(Et=Fl(We,At).toPublicId(qe.id),!Et||!We.some(An=>ki(An,Et,At))))continue}else if(Et=Ke.toPublicId(qe.id),!Et)continue;const _n=`trackedChange:${Et}`;at.has(_n)||(at.add(_n),dt.push(At?{type:"trackedChange",id:Et,story:At}:{type:"trackedChange",id:Et}))}return dt};function E2(c,h){return typeof c=="object"?EG(c?.x,c?.y):null}function wE(c){const h=!!c&&typeof c.x=="number"&&typeof c.y=="number",y=h?{x:c.x,y:c.y}:{x:0,y:0};return{point:y,entities:h?E2(y):[],selection:P.selection,position:null,insideSelection:!1}}const Td=new Set;let T2=!1;const CE=c=>{const h=j();if(typeof h?.observeGeometry!="function")return;let y=!1;const _=Ot(()=>{const E=h.observeGeometry(()=>c.schedule());return y=!0,E},null);c.detach=typeof _=="function"?_:null,c.boundHost=y?h:null},Dg=c=>{if(c.detach){try{c.detach()}catch{}c.detach=null}c.boundHost=null},kE=()=>{if(T2=!1,!(ee||j()))for(const c of Td)Dg(c)},TG=()=>{if(!T2){if(T2=!0,typeof queueMicrotask=="function"){queueMicrotask(kE);return}Promise.resolve().then(kE)}},xG=()=>{const c=j();if(!c){TG();return}for(const h of Td)h.boundHost&&h.boundHost===c||(Dg(h),CE(h),h.schedule())};Sn.push(xG);const Og={getRect:c=>{const h=j(),y=h?.getTargetRects;if(typeof y=="function"){const _=Ot(()=>y.call(h,{target:c.target}),null);return _&&typeof _=="object"?_.success===!0&&Array.isArray(_.rects)?YH(qH(_.rects.filter(E=>E!=null&&typeof E=="object")),c.relativeTo):Nl(typeof _.reason=="string"?_.reason:"unresolved"):Nl("unresolved")}return Nl("unavailable")},observe:c=>{const h=[];let y=0;const _=typeof requestAnimationFrame=="function",E=()=>{if(!_){c();return}y||(y=requestAnimationFrame(()=>{y=0,c()}))},D=ca(oe=>({ready:oe.ready,selection:oe.selection,zoom:oe.zoom}));h.push(D.subscribe(()=>E()));const U={schedule:E,detach:null,boundHost:null};return CE(U),Td.add(U),()=>{Td.delete(U),Dg(U),y&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(y);for(const oe of h.splice(0))try{oe()}catch{}}},getHost:()=>bE(),entityAt:E2,contextAt:wE,scrollIntoView:async c=>{const h=c?.target;if(!h)return{success:!1};let y=null;if(h.kind==="entity"){const _=h.entityType==="comment"?"comments":"trackChanges",E=_==="comments"?Ed.get().items:os.get().items,D=h.entityType==="trackedChange"&&h.story?{story:h.story}:void 0;y=await _g(_,h.entityId,E,D)}else{const _=h,E=h,D=Array.isArray(_.segments)&&_.segments.length>0?_.segments:E.blockId&&E.range?[{blockId:E.blockId,range:E.range}]:null;if(D){const U=h.story;y={kind:"text",segments:D,...U?{story:U}:{}}}}return y?{success:(await Id(y,{block:c.block??"center",behavior:c.behavior??"smooth"})).ok}:{success:!1}}},SE=c=>{const h=(c&&typeof c=="object"?c:null)?.target;return h&&typeof h=="object"?h:null},_E=c=>`metadata:resolve:${c}`,RG=c=>{const h=w()?.metadata;if(!h||typeof h.resolve!="function")return null;const{value:y}=Zr(_E(c),ft(),()=>h.resolve({id:c}),SE);return y},MG=async c=>{const h=w()?.metadata;if(!h||typeof h.resolve!="function")return null;try{const y=ft(),_=await Promise.resolve(h.resolve({id:c}));if(y!==ft())return null;const E=SE(_);return N.set(_E(c),{token:y,value:E,hasSettled:!0,inflightToken:null}),E}catch{return null}},LG={getRect:c=>{const h=w()?.metadata;if(!h||typeof h.resolve!="function")return Nl("unavailable");const y=RG(c.id);return y?Og.getRect({target:y}):Nl("unresolved")},scrollIntoView:async c=>{const h=await MG(c.id);return h?{success:(await Id(h,{block:c.block,behavior:c.behavior})).ok}:{success:!1}}},DG={inTable:!1,tableNodeId:null,rowIndex:null,columnIndex:null,cellNodeId:null,rows:null,columns:null},OG={getContext:()=>{const c=Ne();if(!c)return{...DG};const h=Te()?.table;return{inTable:!0,tableNodeId:c.tableNodeId,rowIndex:c.rowIndex,columnIndex:c.columnIndex,cellNodeId:c.cellNodeId,rows:typeof h?.rows=="number"?h.rows:null,columns:typeof h?.columns=="number"?h.columns:null}},isInTable:()=>Ne()!=null},Pg={query:"",total:0,activeIndex:-1,open:!1,available:!1,caseSensitive:!1,includeTrackedDeletions:!1,includeDeletedText:!1,regex:!1,canReplace:!1,canReplaceAll:!1,reason:lt.searchUnavailable};let Tn={...Pg};const Fg=new Set,tl=()=>{const c=j()?.search;return c&&typeof c=="object"?c:null},Es=()=>{const c=Y()?.search;return c&&typeof c=="object"?c:null},Oh=()=>{const c=tl();if(c&&typeof c.setSession=="function")return!0;const h=Es();return!!h&&typeof h.query=="function"&&typeof h.getState=="function"},is=()=>{for(const c of[...Fg])try{c(Tn)}catch{}},pi=c=>{Tn={...Tn,...c};const h=c.includeTrackedDeletions??c.includeDeletedText;return h!==void 0&&(Tn.includeTrackedDeletions=h,Tn.includeDeletedText=h),is(),Tn};let Gr=0,xd=null,ru=null;const AE=()=>{const c=ru;ru=null,c&&Ot(()=>(c(),null),null)},PG=()=>{Gr+=1,xd=null,nl=!1,AE();const c=Oh();Tn={...Pg,available:c,reason:c?void 0:lt.searchUnavailable},is()};Yn.push(PG),eo.push(()=>{if(xd===Gr)return;const c=Tn,h=ua();(h.canReplace!==c.canReplace||h.canReplaceAll!==c.canReplaceAll||h.available!==c.available||h.reason!==c.reason)&&is()});const FG=c=>{if(!c)return!1;const h=c.queryError;if(h&&typeof h=="object"&&h.code==="invalid-pattern")return!0;const y=c.rejection;return c.status==="rejected"&&!!y&&typeof y=="object"&&y.code==="invalid-pattern"},x2=(c,h=!1,y=h)=>{const _=c&&typeof c=="object"?c:null;if(!_)return null;const E=Array.isArray(_.matches)?_.matches:[],D=typeof _.total=="number"&&Number.isFinite(_.total)?_.total:E.length,U=typeof _.activeMatchIndex=="number"?_.activeMatchIndex:typeof _.activeIndex=="number"?_.activeIndex:-1,oe=_.canReplace===!0||h;return{...typeof _.query=="string"?{query:_.query}:{},total:D,activeIndex:U,canReplace:oe,canReplaceAll:oe&&D>0&&_.truncated!==!0&&(_.canReplace===!0||y),...typeof _.caseSensitive=="boolean"?{caseSensitive:_.caseSensitive}:{},...typeof _.includeDeletedText=="boolean"?{includeDeletedText:_.includeDeletedText}:{},..._.regex===!0?{regex:!0}:{},...FG(_)?{invalidPattern:!0}:{}}};let nl=!1;const IE=()=>{if(!nl)return;nl=!1;const c=Es();c&&typeof c.query=="function"&&Ot(()=>c.query({query:""}),null)},zo=()=>_e("find.replace")?.enabled===!0,jo=()=>_e("find.replaceAll")?.enabled===!0,xo=(c,h=!1,y=h)=>{const _=x2(c,h,y);if(!_){pi({total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,reason:void 0});return}pi({..._.query!==void 0?{query:_.query}:{},total:_.total,activeIndex:_.activeIndex,canReplace:_.canReplace,canReplaceAll:_.canReplaceAll,..._.includeDeletedText!==void 0?{includeDeletedText:_.includeDeletedText}:{},..._.regex!==void 0?{regex:_.regex}:{},reason:_.invalidPattern?lt.searchInvalidPattern:void 0})},ua=()=>{const c=tl();if(c&&typeof c.getState!="function")return Tn={...Tn,available:Oh(),reason:Oh()?void 0:lt.searchUnavailable},Tn;if(!c){const y=Es();if(y&&typeof y.getState=="function"){const _=x2(Ot(()=>y.getState(),null),zo(),jo());if(xd===Gr)return Tn;if(_)return Tn={...Tn,..._.query!==void 0?{query:_.query}:{},total:_.total,activeIndex:_.activeIndex,canReplace:_.canReplace,canReplaceAll:_.canReplaceAll,available:!0,reason:_.invalidPattern?lt.searchInvalidPattern:void 0,open:Tn.open||!!_.query},Tn}return Tn={...Pg,query:Tn.query,caseSensitive:Tn.caseSensitive,includeTrackedDeletions:Tn.includeTrackedDeletions,includeDeletedText:Tn.includeDeletedText},Tn}const h=x2(Ot(()=>c.getState(),null));return h&&(Tn={...Tn,...h.query!==void 0?{query:h.query}:{},total:h.total,activeIndex:h.activeIndex,canReplace:h.canReplace,canReplaceAll:h.canReplaceAll,...h.includeDeletedText!==void 0?{includeDeletedText:h.includeDeletedText}:{},...h.includeDeletedText!==void 0?{includeTrackedDeletions:h.includeDeletedText}:{},...h.regex!==void 0?{regex:h.regex}:{},available:!0,reason:h.invalidPattern?lt.searchInvalidPattern:void 0,open:Tn.open||!!h.query}),Tn},Rd=c=>{const h=c&&typeof c=="object"?c:null;if(h?.status==="committed")return{ok:!0};if(h?.status==="rejected"&&h.reason==="read-only")return{ok:!1,reason:lt.documentReadonly};const y=h?.rejection;return h?.status==="rejected"&&y&&typeof y=="object"&&y.code==="read-only-document"?{ok:!1,reason:lt.documentReadonly}:{ok:!1,reason:lt.operationUnavailable}},Ng=Di({get:()=>ua(),subscribe:c=>(Fg.add(c),()=>Fg.delete(c))}),EE={get:Ng.get,getSnapshot:Ng.getSnapshot,subscribe:Ng.subscribe,observe:Ng.observe,open:()=>Oh()?(pi({available:!0,open:!0,reason:void 0}),{ok:!0}):(pi({available:!1,open:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}),close:()=>{if(Gr+=1,ru)AE();else{const c=tl();if(c&&typeof c.clear=="function")Ot(()=>c.clear(),null);else{const h=Es();h&&typeof h.query=="function"&&Ot(()=>h.query({query:""}),null)}}Tn={...Pg,available:Oh(),reason:void 0},Tn.available||(Tn.reason=lt.searchUnavailable),is()},find:(c,h)=>{const y=tl(),_=!!h?.caseSensitive,E=(h?.includeTrackedDeletions??h?.includeDeletedText)===!0,D=h?.regex===!0,U=++Gr;if(IE(),!y||typeof y.setSession!="function"){const fe=Es();if(fe&&typeof fe.query=="function"&&typeof fe.getState=="function"){xd=U,pi({query:c,caseSensitive:_,includeDeletedText:E,regex:D,total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,available:!0,open:!0,reason:void 0}),ru=()=>{fe.query({query:""})};const Re=Ot(()=>fe.query({query:c,caseSensitive:_,includeDeletedText:E,regex:D}),null);return Lr(Re)?(nl=!0,Promise.resolve(Re).then(Fe=>{U===Gr&&(nl=!1,xd=null,xo(Fe,zo(),jo()))},()=>{U===Gr&&(nl=!1,pi({available:!1,reason:lt.searchUnavailable}))}),Tn):(xd=null,xo(Re,zo(),jo()),xo(Ot(()=>fe.getState(),null),zo(),jo()),Tn)}return pi({query:c,total:0,activeIndex:-1,available:!1,caseSensitive:_,includeDeletedText:E,regex:D,reason:lt.searchUnavailable})}pi({query:c,caseSensitive:_,includeDeletedText:E,regex:D,available:!0,open:!0,reason:void 0}),ru=()=>{typeof y.clear=="function"&&y.clear()};const oe=Ot(()=>y.setSession(c,{caseSensitive:_,includeDeletedText:E,...D?{regex:!0}:{},highlight:!0}),null);if(xo(oe),c.length>0&&Tn.total===0&&Tn.reason!==lt.searchInvalidPattern){const fe=Es();if(fe&&typeof fe.query=="function"&&typeof fe.getState=="function"){const Re=ru;ru=()=>{Re?.(),fe.query({query:""})};const Fe=Ot(()=>fe.query({query:c,caseSensitive:_,includeDeletedText:E,regex:D}),null);Lr(Fe)?(nl=!0,Promise.resolve(Fe).then(Pe=>{U===Gr&&(nl=!1,xo(Pe,zo(),jo()))},()=>{U===Gr&&(nl=!1,pi({available:!1,reason:lt.searchUnavailable}))})):xo(Fe,zo(),jo()),xo(Ot(()=>fe.getState(),null),zo(),jo())}}return Tn},search:(c,h)=>EE.find(c,h),next:()=>{const c=tl();if(!c||typeof c.next!="function"){const h=Es();if(!h||typeof h.next!="function"||typeof h.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Tn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Ot(()=>h.next(),null);if(Lr(y)){const _=Gr;Promise.resolve(y).then(E=>{_===Gr&&xo(E,zo(),jo())}).catch(()=>{_===Gr&&pi({available:!1,reason:lt.searchUnavailable})})}else xo(y,zo(),jo());return xo(Ot(()=>h.getState(),null),zo(),jo()),{ok:!0}}return Tn.total===0?{ok:!1,reason:lt.operationUnavailable}:(xo(Ot(()=>c.next(),null)),{ok:!0})},previous:()=>{const c=tl();if(!c||typeof c.previous!="function"){const h=Es();if(!h||typeof h.previous!="function"||typeof h.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Tn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Ot(()=>h.previous(),null);if(Lr(y)){const _=Gr;Promise.resolve(y).then(E=>{_===Gr&&xo(E,zo(),jo())}).catch(()=>{_===Gr&&pi({available:!1,reason:lt.searchUnavailable})})}else xo(y,zo(),jo());return xo(Ot(()=>h.getState(),null),zo(),jo()),{ok:!0}}return Tn.total===0?{ok:!1,reason:lt.operationUnavailable}:(xo(Ot(()=>c.previous(),null)),{ok:!0})},clear:()=>{Gr+=1,IE();const c=tl();if(c&&typeof c.clear=="function"&&Ot(()=>c.clear(),null),!c||typeof c.clear!="function"){const h=Es();h&&typeof h.query=="function"&&Ot(()=>h.query({query:""}),null)}pi({query:"",total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,reason:void 0})},replace:c=>{const h=tl();if(!h){const _=Es();if(!_||typeof _.replace!="function"||typeof _.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!zo())return{ok:!1,reason:lt.operationUnavailable};const E=Ot(()=>_.replace({replacement:typeof c=="string"?c:""}),null);if(Lr(E)){const D=Gr;ua(),is();const U=()=>D===Gr;return Promise.resolve(E).then(oe=>(U()&&(xo(oe,zo(),jo()),ua(),is()),Rd(oe)),()=>(U()&&pi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return ua(),is(),Rd(E)}if(typeof h.replaceCurrent!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Ot(()=>h.replaceCurrent(typeof c=="string"?c:""),null);return ua(),is(),Rd(y)},replaceAll:c=>{const h=tl();if(!h){const _=Es();if(!_||typeof _.replaceAll!="function"||typeof _.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!jo())return{ok:!1,reason:lt.operationUnavailable};const E=Ot(()=>_.replaceAll({replacement:typeof c=="string"?c:""}),null);if(Lr(E)){const D=Gr;ua(),is();const U=()=>D===Gr;return Promise.resolve(E).then(oe=>(U()&&(xo(oe,zo(),jo()),ua(),is()),Rd(oe)),()=>(U()&&pi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return ua(),is(),Rd(E)}if(typeof h.replaceAll!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Ot(()=>h.replaceAll(typeof c=="string"?c:""),null);return ua(),is(),Rd(y)}},TE=rs(c=>c.styles),Bg=Di(TE),NG={get:Bg.get,getSnapshot:Bg.getSnapshot,subscribe:Bg.subscribe,observe:Bg.observe,getCatalog:c=>(Eo(Cr(c)),Ri(c).value),getQuickGallery:()=>TE.get().quickGallery,getActiveParagraphStyle:()=>Mi(P.selection,Qa().cache).style},xE={select:ca,get state(){return P},selection:fE,commands:pG,toolbar:mG,comments:vG,trackChanges:wG,contentControls:SG,fonts:_G,zoom:AG,document:IG,viewport:Og,metadata:LG,tables:OG,search:EE,contextMenu:C,styles:NG,formatPainter:{setPointerSelecting(c){ee||(p={...p,pointerSelecting:c})},notifyPointerUp(){ee||(p={...p,pointerSelecting:!1},lE())},setKeyboardSelecting(c){ee||(p={...p,keyboardSelecting:c})},notifyKeyUp(){ee||(p={...p,keyboardSelecting:!1},lE())},cancel(){ee||wg()},onModeChange(c){return ee?()=>{}:(m.add(c),()=>m.delete(c))}},createScope:()=>{const c=[];return{select:(h,y)=>{const _=ca(h,y);return{get:_.get,subscribe:E=>{const D=_.subscribe(E);return c.push(D),D}}},dispose:()=>{for(const h of c.splice(0))h()}}},destroy:()=>{if(!ee){I2(),ee=!0,fH(Ar,et),it&&(clearTimeout(it),it=null),Le&&(clearTimeout(Le),Le=null,Xe=0),Se?.timer&&(clearTimeout(Se.timer),Se.timer=null),Se=null,Mt&&(clearTimeout(Mt),Mt=null),oo&&(clearTimeout(oo),oo=null),qn&&qn(),qn=null,Fo=null;for(const c of Object.keys(yo))yo[c]=0;Io.clear(),Wo.clear(),_i.clear(),Ai=null,B.clear();for(const c of lg.splice(0))c();fi&&fi(),fi=null,Ss=null,Xo&&Xo(),Xo=null,Yo=null,hi&&hi(),hi=null,_s=null,ts&&ts(),ts=null,Zo=null,Li&&Li(),Li=null,la=null,Qo&&Qo(),Qo=null,tc=null;for(const c of Td)Dg(c);Td.clear(),q.clear(),Fg.clear(),g+=1,m.clear(),Gr+=1,Je.clear()}}};return be=xE,xE}var r$=[{value:"Arial",label:"Arial",previewFamily:"Arial, sans-serif"},{value:"Calibri",label:"Calibri",previewFamily:"Calibri, sans-serif"},{value:"Courier New",label:"Courier New",previewFamily:'"Courier New", monospace'},{value:"Georgia",label:"Georgia",previewFamily:"Georgia, serif"},{value:"Times New Roman",label:"Times New Roman",previewFamily:'"Times New Roman", serif'},{value:"Verdana",label:"Verdana",previewFamily:"Verdana, sans-serif"}];function o$(e){const t=e.trim(),n=t[0];if(n==='"'||n==="'"){const o=t.indexOf(n,1);if(o>0)return t.slice(1,o).trim()}const r=t.indexOf(",");return(r===-1?t:t.slice(0,r)).trim().replace(/^["']|["']$/g,"")}function i$(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.logicalFamily=="string"?o$(r.logicalFamily):"";if(!o)continue;const i=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:o,previewFamily:i})}return t}function s$(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.value=="string"?r.value.trim():"";if(!o)continue;const i=typeof r.label=="string"&&r.label.trim()?r.label.trim():o,s=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:i,previewFamily:s})}return t}function a$(e,t=[]){const n=[],r=new Set,o=s=>{const a=String(s.value).trim().toLowerCase();!a||r.has(a)||(r.add(a),n.push(s))};for(const s of e)o(s);const i=t.length?t:r$;for(const s of i)o(s);return n}var l$=[{value:"8",label:"8"},{value:"9",label:"9"},{value:"10",label:"10"},{value:"11",label:"11"},{value:"12",label:"12"},{value:"14",label:"14"},{value:"16",label:"16"},{value:"18",label:"18"},{value:"24",label:"24"},{value:"36",label:"36"}];function c$(e,t){return e.activeMark?t.activeMarks.includes(e.activeMark):!1}Ft();var u$=['[data-sdt-type="structuredContent"][data-sdt-id]','[data-sdt-type="structuredContent"][data-sdt-container-id]','[data-sdt-container-type="structuredContent"][data-sdt-container-id]'].join(", "),d$=800,qI=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,YI=e=>{if(!qI)return!1;try{return qI.call(e),!0}catch{return!1}};function f$(e){return e.key==="Alt"||e.key==="Control"||e.key==="Meta"||e.key==="Shift"||(e.ctrlKey||e.metaKey)&&e.shiftKey&&!e.altKey&&(e.code==="Digit8"||e.key==="8"||e.key==="*")?!0:(e.ctrlKey||e.metaKey)&&["b","c","f","i","s","u"].includes(e.key.toLowerCase())}var h$=Object.freeze(["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F","#BB8FCE","#85C1E2","#F1948A","#82E0AA","#F8C471","#AED6F1","#D7BDE2","#A3E4D7","#F0B27A","#AEB6BF","#E74C3C","#2ECC71","#3498DB","#E67E22","#1ABC9C","#9B59B6","#34495E","#F39C12"]),p$=["original","markup","final"],m$=["review","original","final","off"];function XI(e){return p$.includes(e)}function g$(e){return e==="markup"?"review":e}function ZI(e){return m$.includes(e)}function v$(e){const t=e.modules?.trackChanges?.mode;if(ZI(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return ZI(n)?n:null}function ig(e,t){const n=e.viewing,r=XI(n?.trackedChanges)?n.trackedChanges:null,o=r?g$(r):t||(e.trackChanges?.visible===!0?"review":"original");return{comments:typeof n?.comments=="boolean"?n.comments:e.comments?.visible===!0,renderMode:o,trackChangesVisible:r?r==="markup":e.trackChanges?.visible===!0}}async function y$(e,t){const n=new t5.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function v2(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function QI(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function b$(e,t){if(!e)return()=>{};if(v2(e))return t(),()=>{};const n=typeof e.on=="function"?e.on.bind(e):null,r=typeof e.off=="function"?e.off.bind(e):null;if(!n)return t(),()=>{};let o=!1;const i=()=>{o||(o=!0,r?.("synced",a),r?.("sync",l))},s=()=>{o||(i(),t())},a=()=>{QI(e),s()},l=u=>{u!==!1&&(u===!0||v2(e))&&(QI(e),s())};return n("synced",a),n("sync",l),v2(e)&&s(),i}function w$(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(u$));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(Op.BLOCK_SDT_LABEL)),i=r.getAttribute("data-sdt-container-id")?.trim()||null,s=r.getAttribute("data-sdt-id")?.trim()||null;return o?i??s:s??i}function C$(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function JI(e){if(!e||typeof e.id!="string"||e.kind!=="inline"&&e.kind!=="block"||typeof e.controlType!="string")return null;const t=e.properties?.tag,n=e.properties?.alias;return{id:e.id,controlType:e.controlType,scope:e.kind,...typeof t=="string"&&t?{tag:t}:{},...typeof n=="string"&&n?{alias:n}:{}}}function eE(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function Go(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function tE(e){return typeof e=="string"&&e.length>0?e:null}function nE(e){return e?Go(e)?tE(e.documentId??e.options?.documentId??null):tE(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function k$(e){if(!e||Go(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function bs(e){if(!e)return null;if(Go(e))return e.fonts??null;const t=k$(e);return t?{getReport:()=>t.getFontReport?.()??[],getMissingFonts:()=>t.getMissingFonts?.()??[],getDocumentFonts:()=>[...new Set((t.getFontReport?.()??[]).map(n=>n.logicalFamily))],getDocumentFontOptions:()=>t.getDocumentFontOptions?.()??[],getFontFamilyOptions:()=>t.getFontFamilyOptions?.()??[],getLastFontsChangedPayload:()=>t.getLastFontsChangedPayload?.()??null,map:n=>t.mapFonts(n),unmap:n=>t.unmapFonts(n),add:n=>t.addFonts(Array.isArray(n)?n:[n]),preload:n=>t.preloadFonts(n)}:null}var sg=class extends jg.default{static{this.allowedTypes=[Sr,Ea,Iu]}#e;#n;#t;#r;#i;#a;#u;#h;#l;#f;#v;#o;#s;#p;#w;#k;#y;#A;#I;#L;#R;#b;#C;get uiConfig(){return this.#C}#E;get interactionConfig(){return this.#E}#x;get surfacesConfig(){return this.#x}#_;#d;#m;#D;#T;constructor(e){if(super(),this.#e=!1,this.#t=!1,this.#r=null,this.#i=null,this.#a=null,this.#u=null,this.#h=null,this.#l=null,this.#f=null,this.#v=!1,this.#o=!1,this.#s=null,this.#p=null,this.#w=!1,this.#k=null,this.#y=null,this.#A=n=>{this.listenerCount("content-control:active-change")>0&&(this.#w||(this.#k=n.pointerId),this.#w=!0,this.#s="pointer",this.#p=null)},this.#I=n=>{n.pointerId===this.#k&&(this.#w=!1,this.#k=null,this.#s??="pointer",this.#s==="pointer"&&(this.#p=Date.now()+d$))},this.#L=n=>{this.listenerCount("content-control:active-change")>0&&!f$(n)&&(this.#s="keyboard",this.#p=null)},this.#R=n=>{this.#Y(n)},this.#b=null,this.#C=iI({}),this.#E=sI({}),this.#x=lI({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#d=new cj,this.#m=null,this.#D=!1,this.#T=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...Zb},layoutEngineOptions:{},modules:{},licenseKey:void 0,telemetry:{enabled:!0},title:"SuperDoc",conversations:[],isInternal:!1,comments:{visible:!1},toolbarGroups:["left","center","right"],toolbarIcons:{},toolbarTexts:{},uiDisplayFallbackFont:"Arial, Helvetica, sans-serif",isDev:!1,disablePiniaDevtools:!1,onEditorBeforeCreate:()=>null,onEditorCreate:()=>null,onEditorDestroy:()=>null,onSourceComplete:()=>null,onSourceSignalsComplete:()=>null,onContentError:()=>null,onReady:()=>null,onCommentsUpdate:()=>null,onContentControlActiveChange:()=>null,onContentControlClick:()=>null,onAwarenessUpdate:()=>null,onLocked:()=>null,onPdfDocumentReady:()=>null,onSidebarToggle:()=>null,onCollaborationReady:()=>null,onEditorUpdate:()=>null,onCommentsListChange:()=>null,onException:()=>null,onListDefinitionsChange:()=>null,onPaginationUpdate:()=>null,onTransaction:()=>null,disableContextMenu:!1,viewOptions:{layout:"print"},useLayoutEngine:!0},this.#te=new WeakSet,this.#ne=new WeakMap,this.#re=null,this.#W=null,this.#B=null,!e.selector)throw new Error("SuperDoc: selector is required");const t=typeof e.selector=="string"?document.querySelector(e.selector):e.selector;if(!(t instanceof HTMLElement))throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");this.#n=ZE(this,e,()=>this.version,t),this.#_=new Dz({getModuleConfig:()=>this.#x}),this.#l=t,t.addEventListener("pointerdown",this.#A,!0),t.ownerDocument.addEventListener("pointerup",this.#I,!0),t.ownerDocument.addEventListener("pointercancel",this.#I,!0),t.addEventListener("keydown",this.#L,!0),t.addEventListener("click",this.#R,!0),this.#c("content-control:active-change",e.onContentControlActiveChange),this.#z(e,t),this.#o=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#Y(e){const t=this.#l;if(!t)return;const n=w$(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=JI(C$(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#z(e,t){this.#T=v$(e),this.config={...this.config,...e,modules:{...this.config.modules,...e.modules},layoutEngineOptions:{...this.config.layoutEngineOptions,...e.layoutEngineOptions}},typeof this.config.viewing?.comments=="boolean"&&(this.config.comments={...this.config.comments,visible:this.config.viewing.comments}),!this.config.comments||typeof this.config.comments!="object"?this.config.comments={visible:!1}:typeof this.config.comments.visible!="boolean"&&(this.config.comments.visible=!1),Xb(this.config),this.config.documents=this.config.documents||[],this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};const n=this.config.viewOptions?.layout==="web",r=this.config.layoutEngineOptions?.flowMode==="semantic";if(!n&&r&&(console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'."),this.config.layoutEngineOptions.flowMode="paginated"),this.editorVersion=2,this.#Pe(),this.config.user=Gz(this.config.user),this.config.layoutEngineOptions.virtualization||(this.config.layoutEngineOptions.virtualization={enabled:!0,window:5,overscan:1}),this.config.modules=this.config.modules||{},Object.prototype.hasOwnProperty.call(this.config.modules,"comments")||(this.config.modules.comments={}),this.config.modules.comments=GS(this.config.modules.comments),this.#C=iI(this.config),this.#E=sI(this.config),this.#x=lI(this.config),this.config.disableContextMenu=!this.#C.contextMenu.enabled,this.config.rulers=this.#C.ruler.enabled,this.#C.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#C.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&(i.readOnly=this.#E.comments.readOnly,i.allowResolve=this.#E.comments.allowResolve)}if(this.config.colors=c5(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.18.0-next.6",this.#oe("🦋 [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||ol(),this.colors=this.config.colors??[],this.#M(),await x7(),this.#e)return;if(await this.#Z(this.config.modules),this.#e){this.#ye();return}this.user=this.config.user,this.users=this.config.users||[],this.socket=null,this.isDev=this.config.isDev||!1,this.activeEditor=null,this.comments=[],this.#m||(this.#m=this.#d.subscribe(i=>{this.#Ne(i.nextRuntimeId,i.legacyEditorProjection)})),this.isLocked=this.config.isLocked||!1,this.lockedBy=this.config.lockedBy||null;const o=document.createElement("div");o.style.display="contents",t.appendChild(o),this.#h=o,this.#V(),this.#X(),this.#Be(),this.#O()}#O(){if(this.#j(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#h)}#X(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new iN({Renderer:Rz,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#g("requiredNumberOfEditors").documents.filter(e=>e.type===Sr).length}get ui(){return this.#b||(this.#b=n$({superdoc:this}),this.#e&&this.#b.destroy()),this.#S(),this.#b}get diagnostics(){return this.#n}emit(e,...t){return(e==="exception"||e==="document-replaced"||e==="ready"||e==="active-editor-change"||e==="collaboration-ready"||e==="locked")&&Od(this,e,()=>t[0]),super.emit(e,...t)}on(e,t,n){return super.on(e,t,n),e==="content-control:active-change"&&this.#o&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#o&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#o&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#P(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#P(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#P(),this}#P(){this.listenerCount("content-control:active-change")>0||(this.#f?.(),this.#f=null,this.#y=null,this.#s=null,this.#p=null,this.#w=!1,this.#k=null)}#S(){if(this.#f||this.#v||!this.#b||this.#e||this.listenerCount("content-control:active-change")===0)return;let e=null,t=[],n=null,r=null,o=!0;this.#v=!0;try{n=this.#b.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=eE(s);if(!a)return;this.#s==="pointer"&&this.#p!==null&&Date.now()>this.#p&&(this.#s=null,this.#p=null);const l=this.#s??(this.#w?"pointer":null),u=this.activeEditor;(l||this.#y?.editor!==u||this.#y.key!==a)&&(this.#y={editor:u,key:a,source:l??"keyboard"}),this.#s=null,this.#p=null}),r=this.#b.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>JI(s.items.find(k=>k.id===v)));if(l.some(v=>v===null))return;const u=l,d=a===e,f=u.length===t.length&&u.every((v,k)=>v.id===t[k]?.id);if(d&&f)return;if(u.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=u;const g=eE(this.#b.selection.getSnapshot()),m=this.#y;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:g&&m?.editor===a&&m.key===g?m.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#f=i}catch(i){throw n?.(),r?.(),i}finally{this.#v=!1}}get state(){return{documents:this.#g("state").documents.map(e=>bl(e.data)?{...e,data:Zy(e.data,e.type||"application/vnd.openxmlformats-officedocument.wordprocessingml.document")}:e),users:this.users}}getDocumentRuntimeForDocument(e){return typeof e!="string"||e.length===0?null:(this.superdocStore?.documents??[]).find(t=>t?.getEditor?.()?.options?.documentId===e)?.getDocumentRuntime?.()??null}getComment(e){return typeof e!="string"||e.length===0?null:this.commentsStore?.getComment?.(e)??null}get element(){return typeof this.config.selector=="string"?document.querySelector(this.config.selector):this.config.selector}#M(){const e=this.config.document,t=!!e&&typeof e=="object"&&(bl(e)||typeof Blob=="function"&&e instanceof Blob||Object.keys(e).length>0),n=typeof e=="string"&&e.length>0,r=this.config.documents&&this.config.documents?.length;if((t||n)&&r&&console.warn("🦋 [superdoc] You can only provide one of document or documents"),t){const o=Jy(e);this.config.documents=[{id:ol(),...o}]}else n&&(this.config.documents=[{id:ol(),type:Sr,url:this.config.document,name:"document.docx"}]);Array.isArray(this.config.documents)&&this.config.documents.length>0&&(this.config.documents=this.config.documents.map(o=>{const i=Jy(o);if(!i||typeof i!="object")return i;const s=typeof i=="object"&&"id"in i&&i.id||o&&typeof o=="object"&&"id"in o&&o.id;return{...i,id:s||ol()}}))}#j(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=WF({disablePiniaDevtools:!!this.config.disablePiniaDevtools});this.app=e,this.pinia=t,this.app.config.globalProperties.$config=this.config,this.app.config.globalProperties.$documentMode=this.config.documentMode,this.app.config.globalProperties.$superdoc=this,this.app.provide("surfaceManager",this.#_),this.superdocStore=n,this.commentsStore=r,this.highContrastModeStore=o,typeof this.superdocStore.setExceptionHandler=="function"&&this.superdocStore.setExceptionHandler(s=>this.emit("exception",s)),this.superdocStore.init(this.config);const i=this.config.modules.comments;this.commentsStore.init(i||{}),this.isCollaborative&&p7(this),this.#ae()}#c(e,t){t&&this.on(e,t)}#V(){this.#c("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#c("editorCreate",this.config.onEditorCreate),this.#c("editorDestroy",this.config.onEditorDestroy),this.#c("source:complete",this.config.onSourceComplete),this.#c("source:signals-complete",this.config.onSourceSignalsComplete),this.#c("ready",this.config.onReady),this.#c("comments-update",this.config.onCommentsUpdate),this.#c("content-control:click",this.config.onContentControlClick),this.#c("awareness-update",this.config.onAwarenessUpdate),this.#c("locked",this.config.onLocked),this.#c("pdf:document-ready",this.config.onPdfDocumentReady),this.#c("sidebar-toggle",this.config.onSidebarToggle),this.#c("collaboration-ready",this.config.onCollaborationReady),this.on("collaboration-ready",e=>this.#J(e?.editor??null)),this.#c("editor-update",this.config.onEditorUpdate),this.#c("tracked-changes:bulk-decision",this.config.onTrackedChangesBulkDecision),this.on("content-error",this.onContentError),this.#c("exception",this.config.onException),this.#c("list-definitions-change",this.config.onListDefinitionsChange),this.#c("pagination-update",this.config.onPaginationUpdate),this.#c("fonts-resolved",this.config.onFontsResolved),this.#c("fonts-changed",this.config.onFontsChanged),this.#c("zoomChange",this.config.onZoomChange),this.#c("viewport-change",this.config.onViewportChange),this.#c("page-margins-change",this.config.onPageMarginsChange)}async#Z({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:ol(),type:Sr,name:"document.docx"}]),this.config.v2CollaborationPreflightFailure={code:"collaboration-v1-config-unsupported",message:"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.v2Collaboration with a v2 room instead."},this.config.documents):this.config.documents}#le(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=Wr(e),this.provider=Wr(t),this.#Ce();const n=this.config;this._cleanupAwareness=c7(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#Q(){this.#u=null,this.#F(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null),this.isCollaborative=!1,this._commentsCollabInitialized=!1,this.ydoc=void 0,this.provider=void 0;const e=this.config;delete e.modules.collaboration,e.documents.forEach(t=>{delete t.ydoc,delete t.provider})}#F(){if(this.#i){try{this.#i()}catch{}this.#i=null}if(this.#a){try{this.#a()}catch{}this.#a=null}}#J(e){this.#F(),Go(e)&&(this.#ee(e),this.#be(e))}#ee(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=tN(()=>this.user),r=o=>{if(this.#e)return;const i=n.next(o);this.emit("awareness-update",{...i,superdoc:this})};try{const o=t.getSnapshot?.();o&&r(o),this.#i=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#be(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#U(!!r.isLocked,this.#ce(r.lockedBy??null))};try{if(this.#u&&typeof t.setLocked=="function"){const o=this.#u;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#u=null}const r=t.getSnapshot?.();r&&n(r),this.#a=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#ce(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#we(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#U(e,t){this.isLocked===e&&this.#we(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#oe("🦋 [superdoc] Locking superdoc:",e,t,`
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
`),this.emit("locked",{isLocked:e,lockedBy:t}))}#Ce(){const e=this.config.user;if(!e||e.color)return;const t=this.colors.length>0?this.colors:h$,n=e.id||e.email||e.name||"";let r=5381;for(let o=0;o<n.length;o++)r=(r<<5)+r^n.charCodeAt(o);e.color=t[Math.abs(r)%t.length]}async upgradeToCollaboration(e){const{target:t}=this.#Me(e);this.#t=!0;try{const n=await this.#Re(),r=this.#Se(),o=this.#ke();this.#Ae();try{this.#u=o;const i=await this.#Te(t,n);this.#xe(i,t),this.#u=null}catch(i){throw this.#_e(r),i}}finally{this.#r=null,this.#t=!1}}#ke(){return{isLocked:this.isLocked,lockedBy:this.lockedBy?{...this.lockedBy}:null}}#Se(){const e=this.config.documents.find(r=>r.type===Sr),t=this.superdocStore?.documents.find(r=>r.id===e.id)??null,n=t?pn(t):null;return{isCollaborative:this.isCollaborative,configV2Collaboration:e.v2Collaboration??null,configData:e.data,storeDoc:t,storeV2Collaboration:this.#Ee(n),storeData:t?.data}}#_e(e){this.#u=null;const t=this.config.documents.find(n=>n.type===Sr);t.v2Collaboration=e.configV2Collaboration,t.data=e.configData,this.isCollaborative=e.isCollaborative,e.storeDoc&&(e.storeDoc.data=e.storeData,this.#$(e.storeDoc,e.storeV2Collaboration))}#Ae(){if(this.#e)throw new Error("SuperDoc: instance was destroyed during upgrade")}#g(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.superdocStore}#Ve(e){if(!this.commentsStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.commentsStore}#H(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`)}#Ie(e,t){const n=this.superdocStore?.documents;if(Array.isArray(n))for(const r of n){const o=pn(r);o.ydoc&&typeof o.ydoc=="object"&&"value"in o.ydoc&&(o.ydoc.value=e),o.provider&&typeof o.provider=="object"&&"value"in o.provider&&(o.provider.value=t)}}#Ee(e){if(!e)return null;const t=e.v2Collaboration;return t&&typeof t=="object"&&"value"in t?t.value:t??null}#$(e,t){const n=pn(e).v2Collaboration;if(n&&typeof n=="object"&&"value"in n){n.value=t;return}e.v2Collaboration=t}#ue(e){const t=e.syncTimeoutMs===void 0?{}:{syncTimeoutMs:e.syncTimeoutMs};return e.providerFamily==="extension"?{providerType:"extension",adapterId:e.adapterId,documentId:e.documentId,roomMode:e.roomMode,...t,...e.providerOptions!==void 0?{providerOptions:e.providerOptions}:{},...e.token?{token:e.token}:{}}:e.providerFamily==="liveblocks"?{providerType:"liveblocks",documentId:e.documentId,roomMode:e.roomMode,...t,...e.publicApiKey?{publicApiKey:e.publicApiKey}:{},...e.authEndpoint?{authEndpoint:e.authEndpoint}:{}}:e.providerFamily==="hocuspocus"?{providerType:"hocuspocus",documentId:e.documentId,roomMode:e.roomMode,...t,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{},...e.token?{token:e.token}:{}}:{providerType:"y-websocket",documentId:e.documentId,roomMode:e.roomMode,...t,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{}}}async#Te(e,t){const n=this.config.documents.find(s=>s.type===Sr),r=this.#g("upgradeToCollaboration").documents.find(s=>s.id===n.id);if(!r)throw new Error("SuperDoc: source document store entry is not available for upgrade");const o=r.getEditor?.();if(!Go(o)||typeof o.upgradeToCollaboration!="function")throw new Error("SuperDoc: live v2 editor cannot attach collaboration in place");const i=this.#ue({...e,roomMode:"create"});return n.v2Collaboration=i,this.#$(r,i),this.isCollaborative=!0,await o.upgradeToCollaboration(t,i),n.data=t,r.data=t,{configDoc:n,storeDoc:r}}#xe(e,t){const n=this.#ue({...t,roomMode:"join"});e.configDoc.v2Collaboration=n,this.#$(e.storeDoc,n)}async#Re(){const e=this.activeEditor;if(Go(e)&&typeof e.save=="function"){const r=await e.save();return this.#N(r)}const t=this.config.documents.find(r=>r.type===Sr),n=(this.superdocStore?.documents.find(r=>r.id===t.id)??null)?.data??t.data;if(n instanceof Blob)return n;if(bl(n))return this.#N(n);throw new Error("SuperDoc: upgradeToCollaboration() requires a live v2 editor save or DOCX Blob source")}#N(e){if(e instanceof Blob)return e;if(bl(e))return Zy(e,Sr);throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#de(e,t){const n=nE(e),r=(n?this.config.documents.find(a=>a.id===n):null)??this.config.documents.find(a=>a.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document");if(!r)return;const o=this.#N(t),i=r.v2Collaboration&&typeof r.v2Collaboration=="object"&&r.v2Collaboration.roomMode==="create"?{...r.v2Collaboration,roomMode:"join"}:null;r.data=o,r.fieldContext={},i&&(r.v2Collaboration=i);const s=this.superdocStore?.documents.find(a=>a.id===r.id)??null;s&&(s.data=o,s.fieldContext={},i&&this.#$(s,i))}#Ue(){const e=this.superdocStore?.documents;if(!e?.length)throw new Error("SuperDoc: no store documents available for upgrade");const t=e[0].getDocumentRuntime?.()||e[0].getEditor?.();if(!t?.attachCollaboration)throw new Error("SuperDoc: editor does not support attachCollaboration");return t}#He(){this.#Q(),this.#Ie(null,null)}#$e(e){const n=e.editor??e;return n.options?.collaborationIsReady?Promise.resolve():new Promise(r=>{let o=!1;const i=()=>{o||(o=!0,clearTimeout(s),typeof n.off=="function"&&n.off("collaborationReady",a))},s=setTimeout(()=>{i(),console.warn("[SuperDoc] collaborationReady did not fire within 10 s after collaboration attach. Continuing — collaboration is active but cursor/presence setup may be delayed."),r(void 0)},1e4),a=()=>{i(),r(void 0)};this.#r=()=>{i(),r(void 0)},typeof n.on=="function"?n.on("collaborationReady",a):(i(),r(void 0))})}#Ge(e){return new Promise((n,r)=>{let o,i=!1,s=()=>{};const a=()=>{i=!0,clearTimeout(o),s()};s=b$(e,()=>{i||(a(),n())}),i||(o=setTimeout(()=>{a(),r(new Error("SuperDoc: collaboration provider did not sync within 10000 ms. The provider exposes on/off but never emitted sync(true) or synced."))},1e4)),this.#r=()=>{i||(a(),r(new Error("SuperDoc: instance was destroyed during upgrade")))}})}#Me(e){if(this.#e)throw new Error("SuperDoc: cannot upgrade a destroyed instance");if(this.#t)throw new Error("SuperDoc: upgrade already in progress");if(this.isCollaborative)throw new Error("SuperDoc: instance is already collaborative");const t=this.config,n=t.documents.filter(u=>u.type===Sr);if(n.length===0)throw new Error("SuperDoc: no DOCX document found for upgrade");if(n.length>1)throw new Error("SuperDoc: upgradeToCollaboration() only supports a single DOCX document");if(t.documents.length!==n.length)throw new Error("SuperDoc: upgradeToCollaboration() only supports single-DOCX instances");if(!Go(this.#De()))throw new Error("SuperDoc: upgradeToCollaboration() requires a ready v2 DOCX editor");const r=n[0],o=r.id;if(typeof o!="string"||o.length===0)throw new Error("SuperDoc: source document is missing its mounted document identity");const i=t.modules?.collaboration,s=e.ydoc||e.provider?{ydoc:e.ydoc,provider:e.provider}:i?{...i}:null,a=e.v2Collaboration??this.#Le(r.v2Collaboration)??i?.v2Collaboration??i?.v2??null,l=bk({collaboration:e.collaboration,v2Collaboration:a,legacyCollaboration:s,documentType:Sr,documentCount:t.documents.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!l.ok)throw new Error(`SuperDoc: upgradeToCollaboration() ${l.reason}: ${l.message}`);return{target:l.target}}#Le(e){return e&&typeof e=="object"&&"value"in e?e.value:e}#De(){const e=this.config.documents.find(n=>n.type===Sr),t=this.#g("upgradeToCollaboration").documents.find(n=>n.id===e.id)?.getEditor?.();if(!t)throw new Error("SuperDoc: source editor not yet created — wait for the ready event before upgrading");return t}addSharedUser(e){this.#H("addSharedUser");const t=Eu({actor:e});t&&this.users.some(n=>Eu({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#H("removeSharedUser");const t=typeof e=="string"?Vy(e):"",n=typeof e=="string"?`email:${t}`:Eu({actor:e});this.users=this.users.filter(r=>{const o=Eu({actor:r});return n?o!==n:t?Vy(r.email)!==t:!0})}onContentError({error:e,editor:t}){const n=t.options?.documentId,r=this.#g("onContentError").documents.find(a=>a.id===n),o=typeof r?.id=="string"?r.id:typeof n=="string"?n:"",i=r?.data,s=YI(i)?i:bl(i)?this.#N(i):i==null?i:void 0;this.config.onContentError?.({error:e,editor:t,documentId:o,file:s})}broadcastPdfDocumentReady(){this.emit("pdf:document-ready")}broadcastReady(){this.readyEditors===this.requiredNumberOfEditors&&this.emit("ready",{superdoc:this})}broadcastEditorBeforeCreate(e){this.emit("editorBeforeCreate",{editor:G4(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#Oe(e),this.emit("editorCreate",{editor:G4(e)})}broadcastSourceComplete(){this.emit("source:complete")}broadcastSourceSignalsComplete(){this.emit("source:signals-complete")}#te;#ne;#Oe(e){if(!e||typeof e.on!="function"||this.#te.has(e))return;this.#te.add(e),e.on("fonts-changed",n=>{this.#fe(e)&&this.#G(e,n)});const t=(e.documentRenderer??e.presentationEditor)?.getLastFontsChangedPayload?.();t&&this.#fe(e)&&this.#G(e,t)}#fe(e){return!this.activeEditor||e===this.activeEditor}#re;#G(e,t){if(this.#re=t,e.editorVersion===2){let n=this.#ne.get(e);n||(n=new Set,this.#ne.set(e,n)),lj(t.missingFonts,n)}this.emit("fonts-changed",t)}broadcastEditorDestroy(){this.emit("editorDestroy")}broadcastSidebarToggle(e){this.emit("sidebar-toggle",e)}#Pe(){Array.isArray(this.config.editorExtensions)&&this.config.editorExtensions.length>0&&console.warn("[SuperDoc] `editorExtensions` is ignored by superdoc@2. Use `extensions` with `defineSuperDocExtension`. ProseMirror APIs such as `Node.create`, `Mark.create`, `addPmPlugins`, and custom schemas do not run in v2."),this.config.modules.ai&&console.warn("[SuperDoc] `modules.ai` is deprecated and will be removed in v3. Use `ui.toolbar.customItems` for the action, make the model request in your application, and apply the result with `doc.insert()` or `doc.replace()`.")}#oe(...e){(console.debug?console.debug:console.log)("🦋 🦸♀️ [superdoc]",...e)}#W;get fonts(){return this.#W||(this.#W={getReport:()=>bs(this.activeEditor)?.getReport()??[],getMissingFonts:()=>bs(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>bs(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>bs(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>bs(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?bs(t)?.getLastFontsChangedPayload?.()??null:this.#re??null;return n&&e(n),this.on("fonts-changed",e),()=>this.off("fonts-changed",e)},map:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError("superdoc.fonts.map requires a mapping object, for example { Aptos: 'Carlito' }");const t=bs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=bs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=bs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=bs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.preload requires an active editor");return t.preload(e)}}),this.#W}#K(){const e=this.activeEditor!==null;this.#he(),this.activeEditor=null,this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null),e&&this.emit("active-editor-change")}#B;#he(){if(this.#B){try{this.#B()}catch{}this.#B=null}}#Fe(e){this.#he();const t=bs(e);if(!e||!t?.onChanged)return;const n=t.getLastFontsChangedPayload?.();n&&this.#G(e,n),this.#B=t.onChanged(r=>this.#G(e,r))}#Ne(e,t){this.#D=!0;try{if(e===null){this.#K();return}this.#d.get(e)?.kind==="v2"&&Go(t)?this.#pe(t):this.#K()}finally{this.#D=!1}}#pe(e){if(Go(e)){!this.#D&&this.#d.getActive()&&this.#d.setActive(null,"set-active-v2-facade");const t=this.activeEditor;this.activeEditor=e,this.#Fe(e),this.toolbar?.setActiveEditor?.(e),t!==this.activeEditor&&this.emit("active-editor-change");return}this.#K()}setActiveEditor(e){this.#pe(e)}getV2FeatureMatrix(){return[{feature:"source.docx-bytes",status:"supported",reason:"SuperDoc normalizes File/Blob/ArrayBuffer/Uint8Array DOCX inputs for the separate DOCX Engine dependency"},{feature:"source.url",status:"supported",reason:"shell-owned source normalization resolves URL-backed DOCX inputs before opening the injected v2 editor"},{feature:"source.blank",status:"supported",reason:"shell-owned blank-document seeding resolves to DOCX bytes before mounting the injected v2 editor"},{feature:"execution.browser-worker",status:"supported",reason:"the shipped public v2 shell opens DOCX documents through the browser-worker path by default when collaboration is not active"},{feature:"distribution.cdn-iife",status:"supported",reason:"the CDN/IIFE distribution ships the public bundle plus the emitted v2 browser-worker asset and opens DOCX documents through the worker-backed v2 runtime"},{feature:"docx.open-render",status:"supported",reason:"superdoc@2 opens and renders DOCX documents through its DOCX Engine dependency"},{feature:"docx.review-handles",status:"supported",reason:"Comment/tracked-change list + decide via v2 host handles"},{feature:"shell.toolbar",status:"supported",reason:"new SuperDoc({ toolbar }) mounts the rendered built-in toolbar shell and the superdoc.toolbar handle, both backed by the V2 command controller and the internal compatibility catalog. Explicit item-level limits stay fail-closed in the shared command matrix (for example search replace and copyFormat)."},{feature:"shell.rich-formatting",status:"supported",reason:"Rich inline, paragraph, and list formatting route through the V2 command controller and public Document API (format.* / styles.* / lists.*): bold, italic, underline, strikethrough, font family/size, text/highlight color, alignment, line spacing, linked styles, bullet/numbered lists, indent, and clear formatting."},{feature:"shell.comments-sidebar",status:"supported",reason:"ui-phase3-002: v2 comments adapter routes create/reply/edit/resolve/delete through V2EditorHost.dispatch"},{feature:"shell.comments-sidebar.reopen",status:"supported",reason:'ui-phase3-002: v2 comments sidebar reopens resolved threads through the v2 comments adapter (activeEditor.doc.comments.patch({ status: "active" }))'},{feature:"shell.tracked-change-sidebar",status:"supported",reason:"SD-3722: v2 tracked-change adapter lists and decides exact body, header/footer-part, and note targets"},{feature:"shell.tracked-change-sidebar.bulk",status:"supported",reason:"SD-4039/SD-4040: the shipped v2 command posture exposes all-story Accept All and Reject All through the canonical doc.trackChanges.decide({ target: { kind: 'all' } }) mutation"},{feature:"shell.tracked-change-sidebar.non-body",status:"supported",reason:"SD-3722: public v2 shell hydrates and targets header/footer-part and note tracked changes"},{feature:"shell.comments-sidebar.persistence",status:"supported",reason:"ui-phase3-004: comment create/reply/edit/resolve/delete persist through SuperDoc.export() → re-mount via the v2 host save bridge"},{feature:"shell.tracked-change-sidebar.persistence",status:"supported",reason:"ui-phase3-004: tracked-change accept/reject persist through SuperDoc.export() → re-mount via the v2 host save bridge"},{feature:"shell.comments-sidebar.author-required",status:"supported",reason:"ui-phase3-004: v2 comments adapter surfaces commentCommandsReason=author-required from the host capability matrix; write controls disable and forced dispatch reports ok:false"},{feature:"shell.find-replace",status:"supported",reason:"Ctrl/Cmd+F opens the SuperDoc find/replace surface in v2; find/navigation/replace/replaceAll route through the single host search session (host.search) via ui.search, with replace failing closed in viewing/read-only mode"},{feature:"shell.ai-writer",status:"supported",reason:"built-in toolbar renders the modules.ai-gated AI writer and applies generated text through the public Document API facade"},{feature:"shell.collaboration",status:"supported",reason:"v2 single-doc y-websocket collaboration is wired through document.v2Collaboration, including collaboration-ready, awareness-update, and locked event bridges; arbitrary external { ydoc, provider } adapters remain unsupported"},{feature:"shell.context-menu",status:"supported",reason:"v2 renders the built-in right-click and slash context menu, forwards ui.contextMenu custom items, and honors ui.contextMenu: false for application-owned replacements"},{feature:"shell.page-metrics",status:"supported",reason:"ui-phase4-001: v2 page metrics snapshot (editorVersion: 2, documentId, renderEpoch, layoutGeneration, zoom, pages[], capabilities) available via superdoc.activeEditor.pageMetrics.{ getSnapshot, subscribe, setZoom, scrollToPage, revealBodyTarget, pageIndexForBodyTarget }"},{feature:"shell.zoom",status:"supported",reason:"ui-phase4-001: SuperDoc.setZoom routes to V2EditorHost.setZoom in v2 mode; single CSS-transform wrapper applies scale to the painted document, page metrics viewport coords scale with the same zoom value"},{feature:"shell.ruler-page-margins",status:"supported",reason:"ui-phase4-002: v2 ruler renders against the V2PageMetricsSnapshot and dispatches margin drags through a narrow v2 page-layout bridge (`activeEditor.pageLayout.setMargins(...)`) backed by `doc.sections.setPageMargins(...)`. The v2 page metrics snapshot now reports `capabilities.marginEdit = { supported: true }`"},{feature:"shell.custom-extensions",status:"supported",reason:"superdoc@2 supports customer extensions through `extensions` + `defineSuperDocExtension`; command execution and diagnostics are exposed through the narrow `activeEditor.extensions` facet. Legacy ProseMirror `editorExtensions` are ignored in v2."},{feature:"pdf.viewer",status:"supported",reason:"editorVersion ignored for PDF documents"},{feature:"html.viewer",status:"supported",reason:"editorVersion ignored for HTML documents"}]}get v2(){return this.editorVersion!==2?null:{version:2,featureMatrix:this.getV2FeatureMatrix()}}registerEditorRuntime(e){this.#d.register(e)}unregisterEditorRuntime(e){return this.#d.unregister(e)}getActiveRuntime(){return this.#d.getActive()}setActiveRuntime(e,t){this.#d.setActive(e,t)}resolveRuntimeFromEventTarget(e){return this.#d.resolveFromEventTarget(e)}activateRuntimeFromEventTarget(e,t){const n=this.#d.resolveFromEventTarget(e);return n?(this.#d.setActive(n.id,t),!0):!1}toggleRuler(){const e=this.#g("toggleRuler");this.config.rulers=!this.config.rulers,e.documents.forEach(t=>{t.rulers=this.config.rulers}),this.toolbar?.updateToolbarState?.()}canPerformPermission({permission:e,role:t=this.config.role,isInternal:n=this.config.isInternal,comment:r=null,trackedChange:o=null}={}){if(!e)return!1;let i=r??o?.comment??null;const s=o?.commentId||o?.id;if(!i&&s&&this.commentsStore?.getComment){const a=this.commentsStore.getComment(s),l=a?.getValues;i=typeof l=="function"?l.call(a):a}return Fa(e,t,n,{superdoc:this,currentUser:this.config.user,comment:i??null,trackedChange:o??null})}#Be(){const e=this.config.modules?.toolbar,t=e&&typeof e=="object"?e:{},n=this.#C.toolbar;this.toolbarElement=n.container??void 0;const r=this.config.ui,o=typeof r=="object"&&r!==null&&r.toolbar!==void 0;if(!(n.enabled&&(n.container||e===!0||e!=null&&typeof e=="object"||o))){this.toolbar=null;return}try{this.toolbar=XU({...t,...n.options,selector:this.toolbarElement,superdoc:this,editor:this.activeEditor,role:this.config.role,isDev:this.isDev,documentMode:this.config.documentMode,groups:n.options.groups,toolbarGroups:n.options.toolbarGroups,icons:n.options.icons,texts:n.options.texts,uiDisplayFallbackFont:this.config.uiDisplayFallbackFont})}catch(i){console.warn("[SuperDoc] built-in toolbar mount failed",i),this.toolbar=null}}addCommentsList(e){!this.config?.modules?.comments||this.config.role==="viewer"||(this.commentsList?.close(),e&&(this.config.modules.comments.element=e),this.commentsList=new n9(this.config.modules?.comments,this),this.config.onCommentsListChange&&this.config.onCommentsListChange({isRendered:!0}),this.emit("comments-list-change",{isRendered:!0}))}removeCommentsList(){this.commentsList&&(this.commentsList.close(),this.commentsList=null,this.config.onCommentsListChange&&this.config.onCommentsListChange({isRendered:!1}),this.emit("comments-list-change",{isRendered:!1}))}scrollToComment(e,t={}){if(!this.config?.modules?.comments||!e||typeof e!="string")return!1;const n=this.element||document,r=globalThis.CSS?.escape?globalThis.CSS.escape(e):e.replace(/"/g,'\\"'),o=n.querySelector(`[data-comment-ids*="${r}"]`);if(!o)return!1;const{behavior:i="smooth",block:s="start"}=t??{};return o.scrollIntoView({behavior:i,block:s}),this.commentsStore?.setActiveComment?.(this,e),!0}async navigateTo(e){const t=this.superdocStore?.documents;if(!t?.length)return!1;const n=t[0].getDocumentRuntime?.();return n?.navigateTo?n.navigateTo(e):!1}async scrollToElement(e){const t=this.superdocStore?.documents;if(!t?.length)return!1;const n=t[0].getDocumentRuntime?.();return n?.scrollToElement?n.scrollToElement(e):!1}setDisableContextMenu(e=!0){if(!e&&this.#C.contextMenu.suppressed)return;const t=!!e;this.config.disableContextMenu!==t&&(this.config.disableContextMenu=t,this.superdocStore?.documents?.forEach(n=>{const r=n.getDocumentRuntime?.();r?.setContextMenuDisabled&&r.setContextMenuDisabled(t);const o=n.getEditor?.();o?.setOptions&&o.setOptions({disableContextMenu:t})}))}setShowBookmarks(e=!0){const t=!!e,n=this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};n.showBookmarks!==t&&(n.showBookmarks=t,this.superdocStore?.documents?.forEach(r=>{r.getDocumentRuntime?.()?.setShowBookmarks?.(t)}))}setShowFormattingMarks(e=!0){const t=!!e,n=this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};n.showFormattingMarks!==t&&(n.showFormattingMarks=t,this.superdocStore?.documents?.forEach(r=>{r.getDocumentRuntime?.()?.setShowFormattingMarks?.(t)}),this.emit("formatting-marks-change",{showFormattingMarks:t,superdoc:this}),this.toolbar?.updateToolbarState?.())}toggleFormattingMarks(){const e=!!this.config.layoutEngineOptions?.showFormattingMarks;this.setShowFormattingMarks(!e)}setDocumentMode(e){if(!e)return;this.#H("setDocumentMode");const t=e.toLowerCase(),n=this.config.role==="viewer"?"viewing":this.config.role==="suggester"&&t==="editing"?"suggesting":t;this.config.documentMode=n,Xb(this.config),this.#ae();const r={viewing:()=>this.#se(),editing:()=>this.#ze(),suggesting:()=>this.#ge()};r[n]&&(r[n](),this.emit("document-mode-change",{documentMode:n}))}#ie(e,t){const n=typeof e.id=="string"&&e.id.length>0?e.id:null;if(n){const i=this.#d.getAllByDocumentId(n);if(i.length>0){for(const s of i)s.setDocumentMode(t);return}}const r=typeof e.getDocumentRuntime=="function"?e.getDocumentRuntime():null;if(typeof r?.setDocumentMode=="function"){r.setDocumentMode(t);return}const o=typeof e.getEditor=="function"?e.getEditor():null;o&&typeof o.setDocumentMode=="function"&&o.setDocumentMode(t)}setTrackedChangesPreferences(e){typeof e?.enabled=="boolean"&&(this.config.trackChanges={...this.config.trackChanges,enabled:e.enabled},this.config.modules.trackChanges={...this.config.modules.trackChanges,enabled:e.enabled}),this.#q(e)}#me(){return typeof this.config.trackChanges?.enabled=="boolean"?this.config.trackChanges.enabled:typeof this.config.modules?.trackChanges?.enabled=="boolean"?this.config.modules.trackChanges.enabled:!0}#q(e){const t=e&&Object.keys(e).length?{...e}:void 0;this.config.layoutEngineOptions||(this.config.layoutEngineOptions={}),this.config.layoutEngineOptions.trackedChanges=t,this.superdocStore?.documents?.forEach(n=>{let r=!1;const o=typeof n.id=="string"&&n.id.length>0?n.id:null;if(o)for(const s of this.#d.getAllByDocumentId(o))s.setTrackedChangesRenderOptions(t),r=!0;if(r)return;const i=typeof n.getDocumentRuntime=="function"?n.getDocumentRuntime():null;i?.setTrackedChangesOverrides&&i.setTrackedChangesOverrides(t)})}setViewingOptions(e){if(!e||typeof e!="object")return;this.#H("setViewingOptions");const t=ig(this.config,this.#T),n={...this.config.viewing},r=typeof e.comments=="boolean",o=XI(e.trackedChanges);if(!(!r&&!o)&&(r&&(n.comments=e.comments),o&&(n.trackedChanges=e.trackedChanges),this.config.viewing=n,typeof n.comments=="boolean"&&(this.config.comments={...this.config.comments,visible:n.comments}),o&&Xb(this.config),this.#ae(),this.config.documentMode==="viewing")){const i=ig(this.config,this.#T),s=t.comments||t.trackChangesVisible,a=i.comments||i.trackChangesVisible;this.#se({updateTrackedChangesProjection:o,updateCommentVisibility:s!==a})}}#ze(){if(this.config.role!=="editor")return this.#ge();const e=this.#g("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#q({mode:"review",enabled:this.#me()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#ie(t,"editing")})}#ge(){if(!["editor","suggester"].includes(this.config.role??""))return this.#se();const e=this.#g("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#q({mode:"review",enabled:this.#me()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#ie(t,"suggesting")})}#se(e={}){const t=this.#g("setDocumentMode");this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null);const n=ig(this.config,this.#T),r=n.comments,o=n.trackChangesVisible;e.updateTrackedChangesProjection!==!1&&this.#q({mode:n.renderMode,enabled:this.config.modules.trackChanges?.enabled??!0}),e.updateCommentVisibility!==!1&&!r&&!o&&this.commentsStore?.clearEditorCommentPositions?.(),t.documents.forEach(i=>{e.updateCommentVisibility!==!1&&(r||o?i.restoreComments?.():i.removeComments?.()),this.#ie(i,"viewing")})}#ae(){const e=ig(this.config,this.#T),t=e.comments,n=e.trackChangesVisible,r=this.config.documentMode==="viewing",o=t||n;this.commentsStore?.setViewingVisibility&&this.commentsStore.setViewingVisibility({documentMode:this.config.documentMode,commentsVisible:t,trackChangesVisible:n});const i=this.superdocStore?.documents;Array.isArray(i)&&i.length>0&&i.forEach(s=>{const a=typeof s.getDocumentRuntime=="function"?s.getDocumentRuntime():null;a?.setViewingCommentOptions&&a.setViewingCommentOptions({emitCommentPositionsInViewing:r&&o,enableCommentsInViewing:r&&t})})}search(e){const t=this.activeEditor?.commands,n=t?.search;if(typeof n=="function")return n.call(t,e,{searchModel:"visible"})}goToSearchResult(e){const t=this.activeEditor?.commands,n=t?.goToSearchResult;if(typeof n=="function")return!!n.call(t,e)}getZoom(){return this.superdocStore?.activeZoom??100}setZoom(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0){console.warn("[SuperDoc] setZoom expects a positive number representing percentage");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoom called before initialization; use config.zoom.initial for the starting zoom");return}this.superdocStore.activeZoom=e,this.superdocStore.zoomMode="manual",this.emit("zoomChange",{zoom:e,mode:"manual"})}setZoomMode(e){if(e!=="manual"&&e!=="fit-width"){console.warn("[SuperDoc] setZoomMode expects 'manual' or 'fit-width'");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoomMode called before initialization; use config.zoom.mode for the starting mode");return}if(this.superdocStore.zoomMode!==e){if(this.superdocStore.zoomMode=e,e==="fit-width"){const t=this.superdocStore.viewportMetrics;if(t){const n=zS(t.availableWidth,t.documentWidth,db(this.config.zoom?.fitWidth));n!==null&&(this.superdocStore.activeZoom=n)}}this.emit("zoomChange",{zoom:this.getZoom(),mode:e})}}getZoomState(){const e=db(this.config.zoom?.fitWidth);return{mode:this.superdocStore?.zoomMode??"manual",value:this.superdocStore?.activeZoom??100,fitZoom:this.superdocStore?.viewportMetrics?.fitZoom??null,min:e.min,max:e.max}}getViewportMetrics(){return this.superdocStore?.viewportMetrics??null}getMeasurementUnit(){return this.superdocStore?.measurementUnit??"in"}setMeasurementUnit(e){if(e!=="in"&&e!=="cm"){console.warn("[SuperDoc] setMeasurementUnit expects 'in' or 'cm'");return}if(!this.superdocStore){console.warn("[SuperDoc] setMeasurementUnit called before initialization; use config.measurementUnit for the starting unit");return}this.superdocStore.measurementUnit!==e&&(this.superdocStore.measurementUnit=e,this.emit("measurement-unit-change",{unit:e}))}setLocked(e=!0){const t=this.activeEditor;if(Go(t)&&typeof t.lock?.setLocked=="function"){t.lock.setLocked(e,e?{...this.user}:null);const n=t.lock.getSnapshot?.();n&&this.#U(!!n.isLocked,this.#ce(n.lockedBy??null));return}this.config.documents.forEach(n=>{const r=n.ydoc;if(!r)return;const o=r.getMap("meta");r.transact(()=>{o.set("locked",e),e?o.set("lockedBy",this.user):o.delete("lockedBy")})}),this.#U(e,e?this.user:null)}getHTML(e={}){const t=[];return this.#g("getHTML").documents.forEach(n=>{const r=n.getEditor?.();r&&t.push(r)}),t.map(n=>n.getHTML(e))}lockSuperdoc(e=!1,t=null){this.#U(e,t)}async export({exportType:e=["docx"],commentsType:t="external",exportedName:n,additionalFiles:r=[],additionalFileNames:o=[],isFinalDoc:i=!1,triggerDownload:s=!0,fieldsHighlightColor:a=null}={}){if(!Array.isArray(e)||e.length!==1||e[0]!=="docx")throw new TypeError('SuperDoc.export() only supports exportType: ["docx"].');const l=DA(n||this.config.title),u=await this.exportEditorsToDOCX({commentsType:t,isFinalDoc:i,fieldsHighlightColor:a}),d=[...r],f=[...o];if(e.includes("docx")&&u.forEach(g=>{d.push(g),f.push(`${l}.docx`)}),d.length===1)return s?LA(d[0],l,e[0]):d[0];const p=await y$(d,f);return s?LA(p,l,"zip"):p}async replaceFile(e){return(await this.#ve(e)).raw}async replaceDocument(e){const{raw:t,confirmed:n}=await this.#ve(e);if(n)return{ok:!0};const r={ok:!1};return t&&typeof t=="object"&&("reason"in t&&typeof t.reason=="string"&&(r.reason=t.reason),"detail"in t&&typeof t.detail=="string"&&(r.detail=t.detail)),r}async#ve(e){const t=this.activeEditor;if(Go(t)&&typeof t.replaceFile=="function"){const r=await t.replaceFile(e),o=r&&typeof r=="object"?r.state:null,i=o===null||o==="review-ready"||o==="editing-ready";return i&&(this.#de(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),{raw:r,confirmed:i}}const n=t&&!Go(t)?t.replaceFile:null;if(typeof n=="function"){const r=await n.call(t,e),o=r&&typeof r=="object"?r.state:void 0,i=o==null||o==="review-ready"||o==="editing-ready";return i&&(this.#de(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),{raw:r,confirmed:i}}throw new Error("SuperDoc: replaceFile is unavailable for the active editor")}async exportEditorsToDOCX({commentsType:e,isFinalDoc:t,fieldsHighlightColor:n}={}){const r=this.config?.modules?.comments!==!1;let o,i=!1;const s=()=>(i||(i=!0,e==="clean"?o=[]:r&&this.commentsStore&&typeof this.commentsStore.translateCommentsForExport=="function"&&(o=this.commentsStore.translateCommentsForExport(),Array.isArray(o)||(o=[]))),o),a=new WeakSet,l=u=>{"editor"in u&&u.error&&typeof u.error=="object"&&a.add(u.error)};this.on("exception",l);try{const u=this.#g("exportEditorsToDOCX").documents.map(async d=>{if(!d||d.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return null;const f=typeof d.getEditor=="function"?d.getEditor():null,p=()=>YI(d.data)?d.data.type&&d.data.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?null:d.data:bl(d.data)?this.#N(d.data):null;if(!f||typeof f.exportDocx!="function")return p();const g=f.editorVersion===2;try{const m=await f.exportDocx(g?{isFinalDoc:t,commentsType:e,fieldsHighlightColor:n}:{isFinalDoc:t,comments:s(),commentsType:e,fieldsHighlightColor:n});if(m)return m}catch(m){if((!m||typeof m!="object"||!a.has(m))&&(this.emit("exception",{error:m,document:d}),this.emit("exception",tF(m,{documentId:d.id,editor:null}))),g)throw m}return p()});return(await Promise.all(u)).filter(d=>d!=null)}finally{this.off("exception",l)}}async save(){const e=this.#g("save").documents;await Promise.all(e.map(async t=>{if(t.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return;const n=t.getEditor?.();if(!Go(n)||typeof n.save!="function")throw new Error(`SuperDoc: save is unavailable for document "${t.id}"`);await n.save()}))}#je(e,t){const n=e.provider;n&&n!==this.provider&&!t.some(o=>o.provider===n)&&(n.disconnect?.(),n.destroy?.());const r=e.ydoc;r&&r!==this.ydoc&&!t.some(o=>o.ydoc===r)&&r.destroy?.()}#ye(){this.#u=null,this.#F(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null);const e=this.config;e.socket?.cancelWebsocketRetry?.(),e.socket?.disconnect(),e.socket?.destroy(),this.ydoc?.destroy(),this.provider?.disconnect?.(),this.provider?.destroy?.(),e.documents.forEach(t=>{t.provider?.disconnect?.(),t.provider?.destroy?.(),t.ydoc?.destroy()})}openSurface(e){return this.#_.open(e)}closeSurface(e){this.#_.close(e)}async removeDocument(e){const t=typeof e=="string"?e:String(e??"");if(!t)return!1;const n=this.#g("removeDocument"),r=this.activeEditor,o=nE(r);for(const s of this.#d.getAllByDocumentId(t))this.#d.unregister(s.id);o===t&&r!==null&&this.#K();const i=n.removeDocument(t);return i?(this.#je(i,n.documents),await St(),!0):!1}destroy(){JE(this),this.#e=!0,this.#l?.removeEventListener("click",this.#R,!0),this.#l?.removeEventListener("pointerdown",this.#A,!0),this.#l?.ownerDocument.removeEventListener("pointerup",this.#I,!0),this.#l?.ownerDocument.removeEventListener("pointercancel",this.#I,!0),this.#l?.removeEventListener("keydown",this.#L,!0),this.#l=null,this.#f?.(),this.#f=null,this.#r&&(this.#r(),this.#r=null),this.#_&&this.#_.destroy(),this.toolbar?.destroy?.(),this.commentsList?.close(),this.commentsList=null,this.app&&(this.#oe("[superdoc] Unmounting app"),this.superdocStore?.reset(),this.app.unmount(),this.removeAllListeners(),delete this.app.config.globalProperties.$config,delete this.app.config.globalProperties.$superdoc),this.#b?.destroy(),this.#ye(),this.#m?.(),this.#m=null,this.#d.clear(),this.#h&&(this.#h.remove(),this.#h=null)}focus(e={}){const t=this.getActiveRuntime();if(t?.getCapabilities().lifecycle.canFocus){t.focus(e).catch(n=>{console.warn("[SuperDoc] active editor runtime focus failed",n)});return}this.activeEditor?Go(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#g("focus").documents.find(n=>{const r=n.getEditor?.();return r?(Go(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};Ft();var rE="__SUPERDOC_V2_BROWSER_RUNTIME__";function S$(e=globalThis){const t=e[rE];return t&&typeof t=="object"?t:null}function _$(e={},t=globalThis){const n=S$(t)??{},r={...n,...e,vue:e.vue??n.vue??Q5};return t[rE]=r,r}_$();var A$={action:"--sd-ui-action",actionHover:"--sd-ui-action-hover",actionText:"--sd-ui-action-text",bg:"--sd-ui-bg",hoverBg:"--sd-ui-hover-bg",activeBg:"--sd-ui-active-bg",disabledBg:"--sd-ui-disabled-bg",text:"--sd-ui-text",textMuted:"--sd-ui-text-muted",textDisabled:"--sd-ui-text-disabled",border:"--sd-ui-border"},I$=0;function oE(e){const{name:t,font:n,radius:r,shadow:o,colors:i,vars:s}=e,a=`sd-theme-${(t?t.replace(/[^a-zA-Z0-9-_]/g,"-"):null)||`custom-${++I$}`}`,l=[];if(i)for(const[u,d]of Object.entries(i)){if(d==null)continue;const f=A$[u];f&&l.push(` ${f}: ${d};`)}if(n!=null&&l.push(` --sd-ui-font-family: ${n};`),r!=null&&l.push(` --sd-ui-radius: ${r};`),o!=null&&l.push(` --sd-ui-shadow: ${o};`),s)for(const[u,d]of Object.entries(s))d!=null&&l.push(` ${u}: ${d};`);return{className:a,css:l.length>0?`.${a} {
|
|
105
|
+
`),this.emit("locked",{isLocked:e,lockedBy:t}))}#Ce(){const e=this.config.user;if(!e||e.color)return;const t=this.colors.length>0?this.colors:h$,n=e.id||e.email||e.name||"";let r=5381;for(let o=0;o<n.length;o++)r=(r<<5)+r^n.charCodeAt(o);e.color=t[Math.abs(r)%t.length]}async upgradeToCollaboration(e){const{target:t}=this.#Me(e);this.#t=!0;try{const n=await this.#Re(),r=this.#Se(),o=this.#ke();this.#Ae();try{this.#u=o;const i=await this.#Te(t,n);this.#xe(i,t),this.#u=null}catch(i){throw this.#_e(r),i}}finally{this.#r=null,this.#t=!1}}#ke(){return{isLocked:this.isLocked,lockedBy:this.lockedBy?{...this.lockedBy}:null}}#Se(){const e=this.config.documents.find(r=>r.type===Sr),t=this.superdocStore?.documents.find(r=>r.id===e.id)??null,n=t?pn(t):null;return{isCollaborative:this.isCollaborative,configV2Collaboration:e.v2Collaboration??null,configData:e.data,storeDoc:t,storeV2Collaboration:this.#Ee(n),storeData:t?.data}}#_e(e){this.#u=null;const t=this.config.documents.find(n=>n.type===Sr);t.v2Collaboration=e.configV2Collaboration,t.data=e.configData,this.isCollaborative=e.isCollaborative,e.storeDoc&&(e.storeDoc.data=e.storeData,this.#$(e.storeDoc,e.storeV2Collaboration))}#Ae(){if(this.#e)throw new Error("SuperDoc: instance was destroyed during upgrade")}#g(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.superdocStore}#je(e){if(!this.commentsStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.commentsStore}#H(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`)}#Ie(e,t){const n=this.superdocStore?.documents;if(Array.isArray(n))for(const r of n){const o=pn(r);o.ydoc&&typeof o.ydoc=="object"&&"value"in o.ydoc&&(o.ydoc.value=e),o.provider&&typeof o.provider=="object"&&"value"in o.provider&&(o.provider.value=t)}}#Ee(e){if(!e)return null;const t=e.v2Collaboration;return t&&typeof t=="object"&&"value"in t?t.value:t??null}#$(e,t){const n=pn(e).v2Collaboration;if(n&&typeof n=="object"&&"value"in n){n.value=t;return}e.v2Collaboration=t}#ue(e){const t=e.syncTimeoutMs===void 0?{}:{syncTimeoutMs:e.syncTimeoutMs};return e.providerFamily==="extension"?{providerType:"extension",adapterId:e.adapterId,documentId:e.documentId,roomMode:e.roomMode,...t,...e.providerOptions!==void 0?{providerOptions:e.providerOptions}:{},...e.token?{token:e.token}:{}}:e.providerFamily==="liveblocks"?{providerType:"liveblocks",documentId:e.documentId,roomMode:e.roomMode,...t,...e.publicApiKey?{publicApiKey:e.publicApiKey}:{},...e.authEndpoint?{authEndpoint:e.authEndpoint}:{}}:e.providerFamily==="hocuspocus"?{providerType:"hocuspocus",documentId:e.documentId,roomMode:e.roomMode,...t,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{},...e.token?{token:e.token}:{}}:{providerType:"y-websocket",documentId:e.documentId,roomMode:e.roomMode,...t,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{}}}async#Te(e,t){const n=this.config.documents.find(s=>s.type===Sr),r=this.#g("upgradeToCollaboration").documents.find(s=>s.id===n.id);if(!r)throw new Error("SuperDoc: source document store entry is not available for upgrade");const o=r.getEditor?.();if(!Go(o)||typeof o.upgradeToCollaboration!="function")throw new Error("SuperDoc: live v2 editor cannot attach collaboration in place");const i=this.#ue({...e,roomMode:"create"});return n.v2Collaboration=i,this.#$(r,i),this.isCollaborative=!0,await o.upgradeToCollaboration(t,i),n.data=t,r.data=t,{configDoc:n,storeDoc:r}}#xe(e,t){const n=this.#ue({...t,roomMode:"join"});e.configDoc.v2Collaboration=n,this.#$(e.storeDoc,n)}async#Re(){const e=this.activeEditor;if(Go(e)&&typeof e.save=="function"){const r=await e.save();return this.#N(r)}const t=this.config.documents.find(r=>r.type===Sr),n=(this.superdocStore?.documents.find(r=>r.id===t.id)??null)?.data??t.data;if(n instanceof Blob)return n;if(bl(n))return this.#N(n);throw new Error("SuperDoc: upgradeToCollaboration() requires a live v2 editor save or DOCX Blob source")}#N(e){if(e instanceof Blob)return e;if(bl(e))return Zy(e,Sr);throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#de(e,t){const n=nE(e),r=(n?this.config.documents.find(a=>a.id===n):null)??this.config.documents.find(a=>a.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document");if(!r)return;const o=this.#N(t),i=r.v2Collaboration&&typeof r.v2Collaboration=="object"&&r.v2Collaboration.roomMode==="create"?{...r.v2Collaboration,roomMode:"join"}:null;r.data=o,r.fieldContext={},i&&(r.v2Collaboration=i);const s=this.superdocStore?.documents.find(a=>a.id===r.id)??null;s&&(s.data=o,s.fieldContext={},i&&this.#$(s,i))}#Ve(){const e=this.superdocStore?.documents;if(!e?.length)throw new Error("SuperDoc: no store documents available for upgrade");const t=e[0].getDocumentRuntime?.()||e[0].getEditor?.();if(!t?.attachCollaboration)throw new Error("SuperDoc: editor does not support attachCollaboration");return t}#Ue(){this.#Q(),this.#Ie(null,null)}#He(e){const n=e.editor??e;return n.options?.collaborationIsReady?Promise.resolve():new Promise(r=>{let o=!1;const i=()=>{o||(o=!0,clearTimeout(s),typeof n.off=="function"&&n.off("collaborationReady",a))},s=setTimeout(()=>{i(),console.warn("[SuperDoc] collaborationReady did not fire within 10 s after collaboration attach. Continuing — collaboration is active but cursor/presence setup may be delayed."),r(void 0)},1e4),a=()=>{i(),r(void 0)};this.#r=()=>{i(),r(void 0)},typeof n.on=="function"?n.on("collaborationReady",a):(i(),r(void 0))})}#$e(e){return new Promise((n,r)=>{let o,i=!1,s=()=>{};const a=()=>{i=!0,clearTimeout(o),s()};s=b$(e,()=>{i||(a(),n())}),i||(o=setTimeout(()=>{a(),r(new Error("SuperDoc: collaboration provider did not sync within 10000 ms. The provider exposes on/off but never emitted sync(true) or synced."))},1e4)),this.#r=()=>{i||(a(),r(new Error("SuperDoc: instance was destroyed during upgrade")))}})}#Me(e){if(this.#e)throw new Error("SuperDoc: cannot upgrade a destroyed instance");if(this.#t)throw new Error("SuperDoc: upgrade already in progress");if(this.isCollaborative)throw new Error("SuperDoc: instance is already collaborative");const t=this.config,n=t.documents.filter(u=>u.type===Sr);if(n.length===0)throw new Error("SuperDoc: no DOCX document found for upgrade");if(n.length>1)throw new Error("SuperDoc: upgradeToCollaboration() only supports a single DOCX document");if(t.documents.length!==n.length)throw new Error("SuperDoc: upgradeToCollaboration() only supports single-DOCX instances");if(!Go(this.#De()))throw new Error("SuperDoc: upgradeToCollaboration() requires a ready v2 DOCX editor");const r=n[0],o=r.id;if(typeof o!="string"||o.length===0)throw new Error("SuperDoc: source document is missing its mounted document identity");const i=t.modules?.collaboration,s=e.ydoc||e.provider?{ydoc:e.ydoc,provider:e.provider}:i?{...i}:null,a=e.v2Collaboration??this.#Le(r.v2Collaboration)??i?.v2Collaboration??i?.v2??null,l=bk({collaboration:e.collaboration,v2Collaboration:a,legacyCollaboration:s,documentType:Sr,documentCount:t.documents.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!l.ok)throw new Error(`SuperDoc: upgradeToCollaboration() ${l.reason}: ${l.message}`);return{target:l.target}}#Le(e){return e&&typeof e=="object"&&"value"in e?e.value:e}#De(){const e=this.config.documents.find(n=>n.type===Sr),t=this.#g("upgradeToCollaboration").documents.find(n=>n.id===e.id)?.getEditor?.();if(!t)throw new Error("SuperDoc: source editor not yet created — wait for the ready event before upgrading");return t}addSharedUser(e){this.#H("addSharedUser");const t=Eu({actor:e});t&&this.users.some(n=>Eu({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#H("removeSharedUser");const t=typeof e=="string"?Vy(e):"",n=typeof e=="string"?`email:${t}`:Eu({actor:e});this.users=this.users.filter(r=>{const o=Eu({actor:r});return n?o!==n:t?Vy(r.email)!==t:!0})}onContentError({error:e,editor:t}){const n=t.options?.documentId,r=this.#g("onContentError").documents.find(a=>a.id===n),o=typeof r?.id=="string"?r.id:typeof n=="string"?n:"",i=r?.data,s=YI(i)?i:bl(i)?this.#N(i):i==null?i:void 0;this.config.onContentError?.({error:e,editor:t,documentId:o,file:s})}broadcastPdfDocumentReady(){this.emit("pdf:document-ready")}broadcastReady(){this.readyEditors===this.requiredNumberOfEditors&&this.emit("ready",{superdoc:this})}broadcastEditorBeforeCreate(e){this.emit("editorBeforeCreate",{editor:G4(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#Oe(e),this.emit("editorCreate",{editor:G4(e)})}broadcastSourceComplete(){this.emit("source:complete")}broadcastSourceSignalsComplete(){this.emit("source:signals-complete")}#te;#ne;#Oe(e){if(!e||typeof e.on!="function"||this.#te.has(e))return;this.#te.add(e),e.on("fonts-changed",n=>{this.#fe(e)&&this.#G(e,n)});const t=(e.documentRenderer??e.presentationEditor)?.getLastFontsChangedPayload?.();t&&this.#fe(e)&&this.#G(e,t)}#fe(e){return!this.activeEditor||e===this.activeEditor}#re;#G(e,t){if(this.#re=t,e.editorVersion===2){let n=this.#ne.get(e);n||(n=new Set,this.#ne.set(e,n)),lj(t.missingFonts,n)}this.emit("fonts-changed",t)}broadcastEditorDestroy(){this.emit("editorDestroy")}broadcastSidebarToggle(e){this.emit("sidebar-toggle",e)}#Pe(){Array.isArray(this.config.editorExtensions)&&this.config.editorExtensions.length>0&&console.warn("[SuperDoc] `editorExtensions` is ignored by superdoc@2. Use `extensions` with `defineSuperDocExtension`. ProseMirror APIs such as `Node.create`, `Mark.create`, `addPmPlugins`, and custom schemas do not run in v2."),this.config.modules.ai&&console.warn("[SuperDoc] `modules.ai` is deprecated and will be removed in v3. Use `ui.toolbar.customItems` for the action, make the model request in your application, and apply the result with `doc.insert()` or `doc.replace()`.")}#oe(...e){(console.debug?console.debug:console.log)("🦋 🦸♀️ [superdoc]",...e)}#W;get fonts(){return this.#W||(this.#W={getReport:()=>bs(this.activeEditor)?.getReport()??[],getMissingFonts:()=>bs(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>bs(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>bs(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>bs(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?bs(t)?.getLastFontsChangedPayload?.()??null:this.#re??null;return n&&e(n),this.on("fonts-changed",e),()=>this.off("fonts-changed",e)},map:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError("superdoc.fonts.map requires a mapping object, for example { Aptos: 'Carlito' }");const t=bs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=bs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=bs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=bs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.preload requires an active editor");return t.preload(e)}}),this.#W}#K(){const e=this.activeEditor!==null;this.#he(),this.activeEditor=null,this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null),e&&this.emit("active-editor-change")}#B;#he(){if(this.#B){try{this.#B()}catch{}this.#B=null}}#Fe(e){this.#he();const t=bs(e);if(!e||!t?.onChanged)return;const n=t.getLastFontsChangedPayload?.();n&&this.#G(e,n),this.#B=t.onChanged(r=>this.#G(e,r))}#Ne(e,t){this.#D=!0;try{if(e===null){this.#K();return}this.#d.get(e)?.kind==="v2"&&Go(t)?this.#pe(t):this.#K()}finally{this.#D=!1}}#pe(e){if(Go(e)){!this.#D&&this.#d.getActive()&&this.#d.setActive(null,"set-active-v2-facade");const t=this.activeEditor;this.activeEditor=e,this.#Fe(e),this.toolbar?.setActiveEditor?.(e),t!==this.activeEditor&&this.emit("active-editor-change");return}this.#K()}setActiveEditor(e){this.#pe(e)}getV2FeatureMatrix(){return[{feature:"source.docx-bytes",status:"supported",reason:"SuperDoc normalizes File/Blob/ArrayBuffer/Uint8Array DOCX inputs for the separate DOCX Engine dependency"},{feature:"source.url",status:"supported",reason:"shell-owned source normalization resolves URL-backed DOCX inputs before opening the injected v2 editor"},{feature:"source.blank",status:"supported",reason:"shell-owned blank-document seeding resolves to DOCX bytes before mounting the injected v2 editor"},{feature:"execution.browser-worker",status:"supported",reason:"the shipped public v2 shell opens DOCX documents through the browser-worker path by default when collaboration is not active"},{feature:"distribution.cdn-iife",status:"supported",reason:"the CDN/IIFE distribution ships the public bundle plus the emitted v2 browser-worker asset and opens DOCX documents through the worker-backed v2 runtime"},{feature:"docx.open-render",status:"supported",reason:"superdoc@2 opens and renders DOCX documents through its DOCX Engine dependency"},{feature:"docx.review-handles",status:"supported",reason:"Comment/tracked-change list + decide via v2 host handles"},{feature:"shell.toolbar",status:"supported",reason:"new SuperDoc({ toolbar }) mounts the rendered built-in toolbar shell and the superdoc.toolbar handle, both backed by the V2 command controller and the internal compatibility catalog. Explicit item-level limits stay fail-closed in the shared command matrix (for example search replace and copyFormat)."},{feature:"shell.rich-formatting",status:"supported",reason:"Rich inline, paragraph, and list formatting route through the V2 command controller and public Document API (format.* / styles.* / lists.*): bold, italic, underline, strikethrough, font family/size, text/highlight color, alignment, line spacing, linked styles, bullet/numbered lists, indent, and clear formatting."},{feature:"shell.comments-sidebar",status:"supported",reason:"ui-phase3-002: v2 comments adapter routes create/reply/edit/resolve/delete through V2EditorHost.dispatch"},{feature:"shell.comments-sidebar.reopen",status:"supported",reason:'ui-phase3-002: v2 comments sidebar reopens resolved threads through the v2 comments adapter (activeEditor.doc.comments.patch({ status: "active" }))'},{feature:"shell.tracked-change-sidebar",status:"supported",reason:"SD-3722: v2 tracked-change adapter lists and decides exact body, header/footer-part, and note targets"},{feature:"shell.tracked-change-sidebar.bulk",status:"supported",reason:"SD-4039/SD-4040: the shipped v2 command posture exposes all-story Accept All and Reject All through the canonical doc.trackChanges.decide({ target: { kind: 'all' } }) mutation"},{feature:"shell.tracked-change-sidebar.non-body",status:"supported",reason:"SD-3722: public v2 shell hydrates and targets header/footer-part and note tracked changes"},{feature:"shell.comments-sidebar.persistence",status:"supported",reason:"ui-phase3-004: comment create/reply/edit/resolve/delete persist through SuperDoc.export() → re-mount via the v2 host save bridge"},{feature:"shell.tracked-change-sidebar.persistence",status:"supported",reason:"ui-phase3-004: tracked-change accept/reject persist through SuperDoc.export() → re-mount via the v2 host save bridge"},{feature:"shell.comments-sidebar.author-required",status:"supported",reason:"ui-phase3-004: v2 comments adapter surfaces commentCommandsReason=author-required from the host capability matrix; write controls disable and forced dispatch reports ok:false"},{feature:"shell.find-replace",status:"supported",reason:"Ctrl/Cmd+F opens the SuperDoc find/replace surface in v2; find/navigation/replace/replaceAll route through the single host search session (host.search) via ui.search, with replace failing closed in viewing/read-only mode"},{feature:"shell.ai-writer",status:"supported",reason:"built-in toolbar renders the modules.ai-gated AI writer and applies generated text through the public Document API facade"},{feature:"shell.collaboration",status:"supported",reason:"v2 single-doc y-websocket collaboration is wired through document.v2Collaboration, including collaboration-ready, awareness-update, and locked event bridges; arbitrary external { ydoc, provider } adapters remain unsupported"},{feature:"shell.context-menu",status:"supported",reason:"v2 renders the built-in right-click and slash context menu, forwards ui.contextMenu custom items, and honors ui.contextMenu: false for application-owned replacements"},{feature:"shell.page-metrics",status:"supported",reason:"ui-phase4-001: v2 page metrics snapshot (editorVersion: 2, documentId, renderEpoch, layoutGeneration, zoom, pages[], capabilities) available via superdoc.activeEditor.pageMetrics.{ getSnapshot, subscribe, setZoom, scrollToPage, revealBodyTarget, pageIndexForBodyTarget }"},{feature:"shell.zoom",status:"supported",reason:"ui-phase4-001: SuperDoc.setZoom routes to V2EditorHost.setZoom in v2 mode; single CSS-transform wrapper applies scale to the painted document, page metrics viewport coords scale with the same zoom value"},{feature:"shell.ruler-page-margins",status:"supported",reason:"ui-phase4-002: v2 ruler renders against the V2PageMetricsSnapshot and dispatches margin drags through a narrow v2 page-layout bridge (`activeEditor.pageLayout.setMargins(...)`) backed by `doc.sections.setPageMargins(...)`. The v2 page metrics snapshot now reports `capabilities.marginEdit = { supported: true }`"},{feature:"shell.custom-extensions",status:"supported",reason:"superdoc@2 supports customer extensions through `extensions` + `defineSuperDocExtension`; command execution and diagnostics are exposed through the narrow `activeEditor.extensions` facet. Legacy ProseMirror `editorExtensions` are ignored in v2."},{feature:"pdf.viewer",status:"supported",reason:"editorVersion ignored for PDF documents"},{feature:"html.viewer",status:"supported",reason:"editorVersion ignored for HTML documents"}]}get v2(){return this.editorVersion!==2?null:{version:2,featureMatrix:this.getV2FeatureMatrix()}}registerEditorRuntime(e){this.#d.register(e)}unregisterEditorRuntime(e){return this.#d.unregister(e)}getActiveRuntime(){return this.#d.getActive()}setActiveRuntime(e,t){this.#d.setActive(e,t)}resolveRuntimeFromEventTarget(e){return this.#d.resolveFromEventTarget(e)}activateRuntimeFromEventTarget(e,t){const n=this.#d.resolveFromEventTarget(e);return n?(this.#d.setActive(n.id,t),!0):!1}toggleRuler(){const e=this.#g("toggleRuler");this.config.rulers=!this.config.rulers,e.documents.forEach(t=>{t.rulers=this.config.rulers}),this.toolbar?.updateToolbarState?.()}canPerformPermission({permission:e,role:t=this.config.role,isInternal:n=this.config.isInternal,comment:r=null,trackedChange:o=null}={}){if(!e)return!1;let i=r??o?.comment??null;const s=o?.commentId||o?.id;if(!i&&s&&this.commentsStore?.getComment){const a=this.commentsStore.getComment(s),l=a?.getValues;i=typeof l=="function"?l.call(a):a}return Fa(e,t,n,{superdoc:this,currentUser:this.config.user,comment:i??null,trackedChange:o??null})}#Be(){const e=this.config.modules?.toolbar,t=e&&typeof e=="object"?e:{},n=this.#C.toolbar;this.toolbarElement=n.container??void 0;const r=this.config.ui,o=typeof r=="object"&&r!==null&&r.toolbar!==void 0;if(!(n.enabled&&(n.container||e===!0||e!=null&&typeof e=="object"||o))){this.toolbar=null;return}try{this.toolbar=XU({...t,...n.options,selector:this.toolbarElement,superdoc:this,editor:this.activeEditor,role:this.config.role,isDev:this.isDev,documentMode:this.config.documentMode,groups:n.options.groups,toolbarGroups:n.options.toolbarGroups,icons:n.options.icons,texts:n.options.texts,uiDisplayFallbackFont:this.config.uiDisplayFallbackFont})}catch(i){console.warn("[SuperDoc] built-in toolbar mount failed",i),this.toolbar=null}}addCommentsList(e){!this.config?.modules?.comments||this.config.role==="viewer"||(this.commentsList?.close(),e&&(this.config.modules.comments.element=e),this.commentsList=new n9(this.config.modules?.comments,this),this.config.onCommentsListChange&&this.config.onCommentsListChange({isRendered:!0}),this.emit("comments-list-change",{isRendered:!0}))}removeCommentsList(){this.commentsList&&(this.commentsList.close(),this.commentsList=null,this.config.onCommentsListChange&&this.config.onCommentsListChange({isRendered:!1}),this.emit("comments-list-change",{isRendered:!1}))}scrollToComment(e,t={}){if(!this.config?.modules?.comments||!e||typeof e!="string")return!1;const n=this.element||document,r=globalThis.CSS?.escape?globalThis.CSS.escape(e):e.replace(/"/g,'\\"'),o=n.querySelector(`[data-comment-ids*="${r}"]`);if(!o)return!1;const{behavior:i="smooth",block:s="start"}=t??{};return o.scrollIntoView({behavior:i,block:s}),this.commentsStore?.setActiveComment?.(this,e),!0}async navigateTo(e){const t=this.superdocStore?.documents;if(!t?.length)return!1;const n=t[0].getDocumentRuntime?.();return n?.navigateTo?n.navigateTo(e):!1}async scrollToElement(e){const t=this.superdocStore?.documents;if(!t?.length)return!1;const n=t[0].getDocumentRuntime?.();return n?.scrollToElement?n.scrollToElement(e):!1}setDisableContextMenu(e=!0){if(!e&&this.#C.contextMenu.suppressed)return;const t=!!e;this.config.disableContextMenu!==t&&(this.config.disableContextMenu=t,this.superdocStore?.documents?.forEach(n=>{const r=n.getDocumentRuntime?.();r?.setContextMenuDisabled&&r.setContextMenuDisabled(t);const o=n.getEditor?.();o?.setOptions&&o.setOptions({disableContextMenu:t})}))}setShowBookmarks(e=!0){const t=!!e,n=this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};n.showBookmarks!==t&&(n.showBookmarks=t,this.superdocStore?.documents?.forEach(r=>{r.getDocumentRuntime?.()?.setShowBookmarks?.(t)}))}setShowFormattingMarks(e=!0){const t=!!e,n=this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};n.showFormattingMarks!==t&&(n.showFormattingMarks=t,this.superdocStore?.documents?.forEach(r=>{r.getDocumentRuntime?.()?.setShowFormattingMarks?.(t)}),this.emit("formatting-marks-change",{showFormattingMarks:t,superdoc:this}),this.toolbar?.updateToolbarState?.())}toggleFormattingMarks(){const e=!!this.config.layoutEngineOptions?.showFormattingMarks;this.setShowFormattingMarks(!e)}setDocumentMode(e){if(!e)return;this.#H("setDocumentMode");const t=e.toLowerCase(),n=this.config.role==="viewer"?"viewing":this.config.role==="suggester"&&t==="editing"?"suggesting":t;this.config.documentMode=n,Xb(this.config),this.#ae();const r={viewing:()=>this.#se(),editing:()=>this.#ze(),suggesting:()=>this.#ge()};r[n]&&(r[n](),this.emit("document-mode-change",{documentMode:n}))}#ie(e,t){const n=typeof e.id=="string"&&e.id.length>0?e.id:null;if(n){const i=this.#d.getAllByDocumentId(n);if(i.length>0){for(const s of i)s.setDocumentMode(t);return}}const r=typeof e.getDocumentRuntime=="function"?e.getDocumentRuntime():null;if(typeof r?.setDocumentMode=="function"){r.setDocumentMode(t);return}const o=typeof e.getEditor=="function"?e.getEditor():null;o&&typeof o.setDocumentMode=="function"&&o.setDocumentMode(t)}setTrackedChangesPreferences(e){typeof e?.enabled=="boolean"&&(this.config.trackChanges={...this.config.trackChanges,enabled:e.enabled},this.config.modules.trackChanges={...this.config.modules.trackChanges,enabled:e.enabled}),this.#q(e)}#me(){return typeof this.config.trackChanges?.enabled=="boolean"?this.config.trackChanges.enabled:typeof this.config.modules?.trackChanges?.enabled=="boolean"?this.config.modules.trackChanges.enabled:!0}#q(e){const t=e&&Object.keys(e).length?{...e}:void 0;this.config.layoutEngineOptions||(this.config.layoutEngineOptions={}),this.config.layoutEngineOptions.trackedChanges=t,this.superdocStore?.documents?.forEach(n=>{let r=!1;const o=typeof n.id=="string"&&n.id.length>0?n.id:null;if(o)for(const s of this.#d.getAllByDocumentId(o))s.setTrackedChangesRenderOptions(t),r=!0;if(r)return;const i=typeof n.getDocumentRuntime=="function"?n.getDocumentRuntime():null;i?.setTrackedChangesOverrides&&i.setTrackedChangesOverrides(t)})}setViewingOptions(e){if(!e||typeof e!="object")return;this.#H("setViewingOptions");const t=ig(this.config,this.#T),n={...this.config.viewing},r=typeof e.comments=="boolean",o=XI(e.trackedChanges);if(!(!r&&!o)&&(r&&(n.comments=e.comments),o&&(n.trackedChanges=e.trackedChanges),this.config.viewing=n,typeof n.comments=="boolean"&&(this.config.comments={...this.config.comments,visible:n.comments}),o&&Xb(this.config),this.#ae(),this.config.documentMode==="viewing")){const i=ig(this.config,this.#T),s=t.comments||t.trackChangesVisible,a=i.comments||i.trackChangesVisible;this.#se({updateTrackedChangesProjection:o,updateCommentVisibility:s!==a})}}#ze(){if(this.config.role!=="editor")return this.#ge();const e=this.#g("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#q({mode:"review",enabled:this.#me()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#ie(t,"editing")})}#ge(){if(!["editor","suggester"].includes(this.config.role??""))return this.#se();const e=this.#g("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#q({mode:"review",enabled:this.#me()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#ie(t,"suggesting")})}#se(e={}){const t=this.#g("setDocumentMode");this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null);const n=ig(this.config,this.#T),r=n.comments,o=n.trackChangesVisible;e.updateTrackedChangesProjection!==!1&&this.#q({mode:n.renderMode,enabled:this.config.modules.trackChanges?.enabled??!0}),e.updateCommentVisibility!==!1&&!r&&!o&&this.commentsStore?.clearEditorCommentPositions?.(),t.documents.forEach(i=>{e.updateCommentVisibility!==!1&&(r||o?i.restoreComments?.():i.removeComments?.()),this.#ie(i,"viewing")})}#ae(){const e=ig(this.config,this.#T),t=e.comments,n=e.trackChangesVisible,r=this.config.documentMode==="viewing",o=t||n;this.commentsStore?.setViewingVisibility&&this.commentsStore.setViewingVisibility({documentMode:this.config.documentMode,commentsVisible:t,trackChangesVisible:n});const i=this.superdocStore?.documents;Array.isArray(i)&&i.length>0&&i.forEach(s=>{const a=typeof s.getDocumentRuntime=="function"?s.getDocumentRuntime():null;a?.setViewingCommentOptions&&a.setViewingCommentOptions({emitCommentPositionsInViewing:r&&o,enableCommentsInViewing:r&&t})})}search(e){const t=this.activeEditor?.commands,n=t?.search;if(typeof n=="function")return n.call(t,e,{searchModel:"visible"})}goToSearchResult(e){const t=this.activeEditor?.commands,n=t?.goToSearchResult;if(typeof n=="function")return!!n.call(t,e)}getZoom(){return this.superdocStore?.activeZoom??100}setZoom(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0){console.warn("[SuperDoc] setZoom expects a positive number representing percentage");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoom called before initialization; use config.zoom.initial for the starting zoom");return}this.superdocStore.activeZoom=e,this.superdocStore.zoomMode="manual",this.emit("zoomChange",{zoom:e,mode:"manual"})}setZoomMode(e){if(e!=="manual"&&e!=="fit-width"){console.warn("[SuperDoc] setZoomMode expects 'manual' or 'fit-width'");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoomMode called before initialization; use config.zoom.mode for the starting mode");return}if(this.superdocStore.zoomMode!==e){if(this.superdocStore.zoomMode=e,e==="fit-width"){const t=this.superdocStore.viewportMetrics;if(t){const n=zS(t.availableWidth,t.documentWidth,db(this.config.zoom?.fitWidth));n!==null&&(this.superdocStore.activeZoom=n)}}this.emit("zoomChange",{zoom:this.getZoom(),mode:e})}}getZoomState(){const e=db(this.config.zoom?.fitWidth);return{mode:this.superdocStore?.zoomMode??"manual",value:this.superdocStore?.activeZoom??100,fitZoom:this.superdocStore?.viewportMetrics?.fitZoom??null,min:e.min,max:e.max}}getViewportMetrics(){return this.superdocStore?.viewportMetrics??null}getMeasurementUnit(){return this.superdocStore?.measurementUnit??"in"}setMeasurementUnit(e){if(e!=="in"&&e!=="cm"){console.warn("[SuperDoc] setMeasurementUnit expects 'in' or 'cm'");return}if(!this.superdocStore){console.warn("[SuperDoc] setMeasurementUnit called before initialization; use config.measurementUnit for the starting unit");return}this.superdocStore.measurementUnit!==e&&(this.superdocStore.measurementUnit=e,this.emit("measurement-unit-change",{unit:e}))}setLocked(e=!0){const t=this.activeEditor;if(Go(t)&&typeof t.lock?.setLocked=="function"){t.lock.setLocked(e,e?{...this.user}:null);const n=t.lock.getSnapshot?.();n&&this.#U(!!n.isLocked,this.#ce(n.lockedBy??null));return}this.config.documents.forEach(n=>{const r=n.ydoc;if(!r)return;const o=r.getMap("meta");r.transact(()=>{o.set("locked",e),e?o.set("lockedBy",this.user):o.delete("lockedBy")})}),this.#U(e,e?this.user:null)}getHTML(e={}){const t=[];return this.#g("getHTML").documents.forEach(n=>{const r=n.getEditor?.();r&&t.push(r)}),t.map(n=>n.getHTML(e))}lockSuperdoc(e=!1,t=null){this.#U(e,t)}async export({exportType:e=["docx"],commentsType:t="external",exportedName:n,additionalFiles:r=[],additionalFileNames:o=[],isFinalDoc:i=!1,triggerDownload:s=!0,fieldsHighlightColor:a=null}={}){if(!Array.isArray(e)||e.length!==1||e[0]!=="docx")throw new TypeError('SuperDoc.export() only supports exportType: ["docx"].');const l=DA(n||this.config.title),u=await this.exportEditorsToDOCX({commentsType:t,isFinalDoc:i,fieldsHighlightColor:a}),d=[...r],f=[...o];if(e.includes("docx")&&u.forEach(g=>{d.push(g),f.push(`${l}.docx`)}),d.length===1)return s?LA(d[0],l,e[0]):d[0];const p=await y$(d,f);return s?LA(p,l,"zip"):p}async replaceFile(e){return(await this.#ve(e)).raw}async replaceDocument(e){const{raw:t,confirmed:n}=await this.#ve(e);if(n)return{ok:!0};const r={ok:!1};return t&&typeof t=="object"&&("reason"in t&&typeof t.reason=="string"&&(r.reason=t.reason),"detail"in t&&typeof t.detail=="string"&&(r.detail=t.detail)),r}async#ve(e){const t=this.activeEditor;if(Go(t)&&typeof t.replaceFile=="function"){const r=await t.replaceFile(e),o=r&&typeof r=="object"?r.state:null,i=o===null||o==="review-ready"||o==="editing-ready";return i&&(this.#de(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),{raw:r,confirmed:i}}const n=t&&!Go(t)?t.replaceFile:null;if(typeof n=="function"){const r=await n.call(t,e),o=r&&typeof r=="object"?r.state:void 0,i=o==null||o==="review-ready"||o==="editing-ready";return i&&(this.#de(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),{raw:r,confirmed:i}}throw new Error("SuperDoc: replaceFile is unavailable for the active editor")}async exportEditorsToDOCX({commentsType:e,isFinalDoc:t,fieldsHighlightColor:n}={}){const r=this.config?.modules?.comments!==!1;let o,i=!1;const s=()=>(i||(i=!0,e==="clean"?o=[]:r&&this.commentsStore&&typeof this.commentsStore.translateCommentsForExport=="function"&&(o=this.commentsStore.translateCommentsForExport(),Array.isArray(o)||(o=[]))),o),a=new WeakSet,l=u=>{"editor"in u&&u.error&&typeof u.error=="object"&&a.add(u.error)};this.on("exception",l);try{const u=this.#g("exportEditorsToDOCX").documents.map(async d=>{if(!d||d.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return null;const f=typeof d.getEditor=="function"?d.getEditor():null,p=()=>YI(d.data)?d.data.type&&d.data.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?null:d.data:bl(d.data)?this.#N(d.data):null;if(!f||typeof f.exportDocx!="function")return p();const g=f.editorVersion===2;try{const m=await f.exportDocx(g?{isFinalDoc:t,commentsType:e,fieldsHighlightColor:n}:{isFinalDoc:t,comments:s(),commentsType:e,fieldsHighlightColor:n});if(m)return m}catch(m){if((!m||typeof m!="object"||!a.has(m))&&(this.emit("exception",{error:m,document:d}),this.emit("exception",tF(m,{documentId:d.id,editor:null}))),g)throw m}return p()});return(await Promise.all(u)).filter(d=>d!=null)}finally{this.off("exception",l)}}async save(){const e=this.#g("save").documents;await Promise.all(e.map(async t=>{if(t.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return;const n=t.getEditor?.();if(!Go(n)||typeof n.save!="function")throw new Error(`SuperDoc: save is unavailable for document "${t.id}"`);await n.save()}))}#ye(){this.#u=null,this.#F(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null);const e=this.config;e.socket?.cancelWebsocketRetry?.(),e.socket?.disconnect(),e.socket?.destroy(),this.ydoc?.destroy(),this.provider?.disconnect?.(),this.provider?.destroy?.()}openSurface(e){return this.#_.open(e)}closeSurface(e){this.#_.close(e)}async removeDocument(e){const t=typeof e=="string"?e:String(e??"");if(!t)return!1;const n=this.#g("removeDocument"),r=this.activeEditor,o=nE(r);for(const i of this.#d.getAllByDocumentId(t))this.#d.unregister(i.id);return o===t&&r!==null&&this.#K(),n.removeDocument(t)?(await St(),!0):!1}destroy(){JE(this),this.#e=!0,this.#l?.removeEventListener("click",this.#R,!0),this.#l?.removeEventListener("pointerdown",this.#A,!0),this.#l?.ownerDocument.removeEventListener("pointerup",this.#I,!0),this.#l?.ownerDocument.removeEventListener("pointercancel",this.#I,!0),this.#l?.removeEventListener("keydown",this.#L,!0),this.#l=null,this.#f?.(),this.#f=null,this.#r&&(this.#r(),this.#r=null),this.#_&&this.#_.destroy(),this.toolbar?.destroy?.(),this.commentsList?.close(),this.commentsList=null,this.app&&(this.#oe("[superdoc] Unmounting app"),this.superdocStore?.reset(),this.app.unmount(),this.removeAllListeners(),delete this.app.config.globalProperties.$config,delete this.app.config.globalProperties.$superdoc),this.#b?.destroy(),this.#ye(),this.#m?.(),this.#m=null,this.#d.clear(),this.#h&&(this.#h.remove(),this.#h=null)}focus(e={}){const t=this.getActiveRuntime();if(t?.getCapabilities().lifecycle.canFocus){t.focus(e).catch(n=>{console.warn("[SuperDoc] active editor runtime focus failed",n)});return}this.activeEditor?Go(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#g("focus").documents.find(n=>{const r=n.getEditor?.();return r?(Go(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};Ft();var rE="__SUPERDOC_V2_BROWSER_RUNTIME__";function S$(e=globalThis){const t=e[rE];return t&&typeof t=="object"?t:null}function _$(e={},t=globalThis){const n=S$(t)??{},r={...n,...e,vue:e.vue??n.vue??Qx};return t[rE]=r,r}_$();var A$={action:"--sd-ui-action",actionHover:"--sd-ui-action-hover",actionText:"--sd-ui-action-text",bg:"--sd-ui-bg",hoverBg:"--sd-ui-hover-bg",activeBg:"--sd-ui-active-bg",disabledBg:"--sd-ui-disabled-bg",text:"--sd-ui-text",textMuted:"--sd-ui-text-muted",textDisabled:"--sd-ui-text-disabled",border:"--sd-ui-border"},I$=0;function oE(e){const{name:t,font:n,radius:r,shadow:o,colors:i,vars:s}=e,a=`sd-theme-${(t?t.replace(/[^a-zA-Z0-9-_]/g,"-"):null)||`custom-${++I$}`}`,l=[];if(i)for(const[u,d]of Object.entries(i)){if(d==null)continue;const f=A$[u];f&&l.push(` ${f}: ${d};`)}if(n!=null&&l.push(` --sd-ui-font-family: ${n};`),r!=null&&l.push(` --sd-ui-radius: ${r};`),o!=null&&l.push(` --sd-ui-shadow: ${o};`),s)for(const[u,d]of Object.entries(s))d!=null&&l.push(` ${u}: ${d};`);return{className:a,css:l.length>0?`.${a} {
|
|
106
106
|
${l.join(`
|
|
107
107
|
`)}
|
|
108
|
-
}`:""}}function E$(e,t){if(typeof document>"u"||!t)return;let n=document.querySelector(`[data-sd-theme="${e}"]`);n||(n=document.createElement("style"),n.setAttribute("data-sd-theme",e),document.head.appendChild(n)),n.textContent=t}function T$(e){const{className:t,css:n}=oE(e);return E$(t,n),t}function x$(e){return oE(e)}function R$(e){if(!e||typeof e!="object")throw new Error("defineSuperDocExtension requires an extension object.");if(typeof e.id!="string"||e.id.length===0)throw new Error("defineSuperDocExtension requires a non-empty string `id`.");if(typeof e.activate!="function")throw new Error(`defineSuperDocExtension("${e.id}") requires an \`activate(ctx)\` function.`);if(e.storage!==void 0&&typeof e.storage!="function")throw new Error(`defineSuperDocExtension("${e.id}") \`storage\` must be a function returning the initial storage object.`);return e}var M$=Ld({BlankDOCX:()=>pS,DOCX:()=>Sr,HTML:()=>Iu,PDF:()=>Ea,SuperDoc:()=>sg,buildTheme:()=>x$,compareVersions:()=>
|
|
108
|
+
}`:""}}function E$(e,t){if(typeof document>"u"||!t)return;let n=document.querySelector(`[data-sd-theme="${e}"]`);n||(n=document.createElement("style"),n.setAttribute("data-sd-theme",e),document.head.appendChild(n)),n.textContent=t}function T$(e){const{className:t,css:n}=oE(e);return E$(t,n),t}function x$(e){return oE(e)}function R$(e){if(!e||typeof e!="object")throw new Error("defineSuperDocExtension requires an extension object.");if(typeof e.id!="string"||e.id.length===0)throw new Error("defineSuperDocExtension requires a non-empty string `id`.");if(typeof e.activate!="function")throw new Error(`defineSuperDocExtension("${e.id}") requires an \`activate(ctx)\` function.`);if(e.storage!==void 0&&typeof e.storage!="function")throw new Error(`defineSuperDocExtension("${e.id}") \`storage\` must be a function returning the initial storage object.`);return e}var M$=Ld({BlankDOCX:()=>pS,DOCX:()=>Sr,HTML:()=>Iu,PDF:()=>Ea,SuperDoc:()=>sg,buildTheme:()=>x$,compareVersions:()=>s5,createTheme:()=>T$,defineSuperDocExtension:()=>R$,getFileObject:()=>Uy}),L$="SUPERDOC_ENGINE_CDN_BASE_URL",iE=Symbol.for("superdoc.docx-engine.cdn-load-state"),ag="superdocDocxEngineStatus";function D$(e,t,n=null){const r=e?.[L$],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return O$(o);if(!t)throw new Error("SuperDoc: the CDN build is missing its exact DOCX Engine version");return`https://cdn.jsdelivr.net/npm/@superdoc/docx-engine@${t}`}function O$(e){const t=e.trim().replace(/\/+$/,""),n=t.match(/^([a-z][a-z\d+.-]*):/iu)?.[1]?.toLowerCase();if(n&&n!=="http"&&n!=="https")throw new TypeError(`SuperDoc: unsupported DOCX Engine CDN URL scheme ${n}:`);return t}function P$({engineVersion:e,buildBaseUrl:t}){E7(()=>{const n=D$(globalThis,e,t),r=globalThis[iE],o=r instanceof Map?r:new Map;if(globalThis[iE]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),F$(`${n}/dist-cdn/style.css`)]).then(([s])=>s);o.set(n,i),i.catch(()=>{o.get(n)===i&&o.delete(n)})}return o.get(n)})}function F$(e){if(typeof document>"u")return Promise.resolve();const t=new URL(e,document.baseURI).href,n=Array.from(document.querySelectorAll('link[rel~="stylesheet"]')).find(o=>o.href===t);if(n?.sheet||n?.dataset[ag]==="loaded")return Promise.resolve();const r=n?.dataset[ag]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(g,m)=>{a||(a=!0,l?.disconnect(),s.dataset[ag]=g,m())},d=()=>u("loaded",o),f=()=>u("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),p=()=>{s.isConnected||u("error",()=>i(new Error(`SuperDoc: DOCX Engine stylesheet was removed while loading from ${t}`)))};s.addEventListener("load",d,{once:!0}),s.addEventListener("error",f,{once:!0}),typeof globalThis.MutationObserver=="function"&&(l=new globalThis.MutationObserver(p),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[ag]="loading",document.head.appendChild(s))})}P$({engineVersion:"0.17.0-next.7",buildBaseUrl:null});for(const[e,t]of Object.entries(M$))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(sg,e)||(sg[e]=t);var N$=sg;return N$})();
|