superdoc 2.18.1-next.3 β†’ 2.18.1-next.4

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.
@@ -1,7 +1,7 @@
1
1
  var SuperDoc=(function(){var nT=Object.create,Vh=Object.defineProperty,rT=Object.getOwnPropertyDescriptor,oT=Object.getOwnPropertyNames,iT=Object.getPrototypeOf,sT=Object.prototype.hasOwnProperty,Er=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}},Y2=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Nd=(e,t)=>{let n={};for(var r in e)Vh(n,r,{get:e[r],enumerable:!0});return t||Vh(n,Symbol.toStringTag,{value:"Module"}),n},aT=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=oT(t),i=0,s=o.length,a;i<s;i++)a=o[i],!sT.call(e,a)&&a!==n&&Vh(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=rT(t,a))||r.enumerable});return e},X2=(e,t,n)=>(n=e!=null?nT(iT(e)):{},aT(t||!e||!e.__esModule?Vh(n,"default",{value:e,enumerable:!0}):n,e)),Bd=new WeakMap,lT=0,Z2=["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"],cT=["text","data","message","errorMessage","quotedText","value"];function sl(e,t){if(!(!e||typeof e!="object"))return Object.getOwnPropertyDescriptor(e,t)?.value}function Q2(e,t,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=n?e:t}var uT=class{constructor(e,t){this.version=t,this.sessionId=`interaction-${++lT}`,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=sl(sl(e,"diagnostics"),"history");this.enabled=sl(n,"enabled")!==!1,this.captureContent=sl(n,"captureContent")===!0,this.maxEvents=Q2(sl(n,"maxEvents"),500,1e4),this.maxBytes=Q2(sl(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 m=0;m<f&&r>0;m++)p.push(o(sl(l,String(m)),u+1)??null);return p}const d={};for(const f of this.captureContent?[...Z2,...cT]:Z2){if(r<=0){n=!0;break}const p=sl(l,f);if(p===void 0)continue;const m=o(p,u+1);m!==void 0&&(d[f]=m)}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=[]}},J2=()=>({schemaVersion:1,sessionId:"unavailable",version:"unknown",enabled:!1,events:[],retainedBytes:0,evictedEvents:0,truncatedEvents:0,captureFailures:1}),dT=Object.freeze({getSnapshot:J2,clear(){}});function fT(e,t,n,r){try{const o=new uT(t,n);Bd.set(e,o),o.attach(r);const i=Object.freeze({getSnapshot:()=>{try{return o.snapshot()}catch{return J2()}},clear:()=>{try{o.clear()}catch{}}});return o.record("instance:created",()=>({})),i}catch{return dT}}function zd(e,t,n){try{e&&Bd.get(e)?.record(t,n)}catch{}}function hT(e,t,n){try{const r=Bd.get(e),o=r?.action();return o&&r?.record(t,()=>({...n(),actionId:o})),o}catch{return}}function pT(e){try{Bd.get(e)?.close(),Bd.delete(e)}catch{}}var mT=Y2(((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,m){if(typeof f!="function")throw new TypeError("The listener must be a function");var g=new i(f,p||u,m),v=r?r+d:d;return u._events[v]?u._events[v].fn?u._events[v]=[u._events[v],g]:u._events[v].push(g):(u._events[v]=g,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 m=0,g=p.length,v=new Array(g);m<g;m++)v[m]=p[m].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,m,g,v){var C=r?r+d:d;if(!this._events[C])return!1;var w=this._events[C],_=arguments.length,y,k;if(w.fn){switch(w.once&&this.removeListener(d,w.fn,void 0,!0),_){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,f),!0;case 3:return w.fn.call(w.context,f,p),!0;case 4:return w.fn.call(w.context,f,p,m),!0;case 5:return w.fn.call(w.context,f,p,m,g),!0;case 6:return w.fn.call(w.context,f,p,m,g,v),!0}for(k=1,y=new Array(_-1);k<_;k++)y[k-1]=arguments[k];w.fn.apply(w.context,y)}else{var T=w.length,M;for(k=0;k<T;k++)switch(w[k].once&&this.removeListener(d,w[k].fn,void 0,!0),_){case 1:w[k].fn.call(w[k].context);break;case 2:w[k].fn.call(w[k].context,f);break;case 3:w[k].fn.call(w[k].context,f,p);break;case 4:w[k].fn.call(w[k].context,f,p,m);break;default:if(!y)for(M=1,y=new Array(_-1);M<_;M++)y[M-1]=arguments[M];w[k].fn.apply(w[k].context,y)}}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,m){var g=r?r+d:d;if(!this._events[g])return this;if(!f)return a(this,g),this;var v=this._events[g];if(v.fn)v.fn===f&&(!m||v.once)&&(!p||v.context===p)&&a(this,g);else{for(var C=0,w=[],_=v.length;C<_;C++)(v[C].fn!==f||m&&!v[C].once||p&&v[C].context!==p)&&w.push(v[C]);w.length?this._events[g]=w.length===1?w[0]:w:a(this,g)}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=X2(mT(),1),wo=[];for(let e=0;e<256;++e)wo.push((e+256).toString(16).slice(1));function gT(e,t=0){return(wo[e[t+0]]+wo[e[t+1]]+wo[e[t+2]]+wo[e[t+3]]+"-"+wo[e[t+4]]+wo[e[t+5]]+"-"+wo[e[t+6]]+wo[e[t+7]]+"-"+wo[e[t+8]]+wo[e[t+9]]+"-"+wo[e[t+10]]+wo[e[t+11]]+wo[e[t+12]]+wo[e[t+13]]+wo[e[t+14]]+wo[e[t+15]]).toLowerCase()}var Vg,vT=new Uint8Array(16);function yT(){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(vT)}var bT=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),e1={randomUUID:bT};function al(e,t,n){if(e1.randomUUID&&!t&&!e)return e1.randomUUID();e=e||{};const r=e.random??e.rng?.()??yT();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 gT(r)}function jd(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}function wn(e){if(jt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Kn(r)?wT(r):wn(r);if(o)for(const i in o)t[i]=o[i]}return t}else if(Kn(e)||Nn(e))return e}function wT(e){const t={};return e.replace(d1,"").split(c1).forEach(n=>{if(n){const r=n.split(u1);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function tn(e){let t="";if(Kn(e))t=e;else if(jt(e))for(let n=0;n<e.length;n++){const r=tn(e[n]);r&&(t+=r+" ")}else if(Nn(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&&!Kn(t)&&(e.class=tn(t)),n&&(e.style=wn(n)),e}function t1(e){return!!e||e===""}function CT(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=ma(e[r],t[r]);return n}function ma(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=ei(e),r=ei(t),n||r)return e===t;if(n=jt(e),r=jt(t),n||r)return n&&r?CT(e,t):!1;if(n=Nn(e),r=Nn(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||!ma(e[o],t[o]))return!1}}return String(e)===String(t)}function Uh(e,t){return e.findIndex(n=>ma(n,t))}function kT(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:(typeof e!="number"||Number.isFinite(e),String(e))}var On,sc,vi,Hg,iu,Vd,$n,Hh,n1,Un,jt,ac,ll,$g,r1,Jt,Kn,ei,Nn,$h,Gg,lc,o1,Ud,Hd,cl,$d,i1,Nr,s1,Go,su,au,oo,cc,Wg,Gd,Wd,a1,Kd,l1,c1,u1,d1,Kg,f1,ST,qg,$t,Yg,Gh,Xg=Er((()=>{On={},sc=[],vi=()=>{},Hg=()=>!1,iu=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Vd=e=>e.startsWith("onUpdate:"),$n=Object.assign,Hh=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},n1=Object.prototype.hasOwnProperty,Un=(e,t)=>n1.call(e,t),jt=Array.isArray,ac=e=>lc(e)==="[object Map]",ll=e=>lc(e)==="[object Set]",$g=e=>lc(e)==="[object Date]",r1=e=>lc(e)==="[object RegExp]",Jt=e=>typeof e=="function",Kn=e=>typeof e=="string",ei=e=>typeof e=="symbol",Nn=e=>e!==null&&typeof e=="object",$h=e=>(Nn(e)||Jt(e))&&Jt(e.then)&&Jt(e.catch),Gg=Object.prototype.toString,lc=e=>Gg.call(e),o1=e=>lc(e).slice(8,-1),Ud=e=>lc(e)==="[object Object]",Hd=e=>Kn(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,cl=jd(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),$d=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},i1=/-\w/g,Nr=$d(e=>e.replace(i1,t=>t.slice(1).toUpperCase())),s1=/\B([A-Z])/g,Go=$d(e=>e.replace(s1,"-$1").toLowerCase()),su=$d(e=>e.charAt(0).toUpperCase()+e.slice(1)),au=$d(e=>e?`on${su(e)}`:""),oo=(e,t)=>!Object.is(e,t),cc=(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})},Gd=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Wd=e=>{const t=Kn(e)?Number(e):NaN;return isNaN(t)?e:t},Kd=()=>a1||(a1=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),l1=jd("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"),c1=/;(?![^(]*\))/g,u1=/:([^]+)/,d1=/\/\*[^]*?\*\//g,Kg="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",f1=jd(Kg),ST=jd(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),$t=e=>Kn(e)?e:e==null?"":jt(e)||Nn(e)&&(e.toString===Gg||!Jt(e.toString))?qg(e)?$t(e.value):JSON.stringify(e,Yg,2):String(e),Yg=(e,t)=>qg(t)?Yg(e,t.value):ac(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],i)=>(n[Gh(r,i)+" =>"]=o,n),{})}:ll(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Gh(n))}:ei(t)?Gh(t):Nn(t)&&!jt(t)&&!Ud(t)?String(t):t,Gh=(e,t="")=>{var n;return ei(e)?`Symbol(${(n=e.description)!=null?n:t})`:e}}));function Zg(e){return new Zh(e)}function Qg(){return Oo}function h1(e,t=!1){Oo&&Oo.cleanups.push(e)}function p1(e,t=!1){if(e.flags|=8,t){e.next=Zd,Zd=e;return}e.next=Xd,Xd=e}function Jg(){av++}function ev(){if(--av>0)return;if(Zd){let t=Zd;for(Zd=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Xd;){let t=Xd;for(Xd=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 m1(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function g1(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),nv(r),_T(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&&(v1(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function v1(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===uu)||(e.globalVersion=uu,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!tv(e))))return;e.flags|=2;const t=e.dep,n=tr,r=Ni;tr=e,Ni=!0;try{m1(e);const o=e.fn(e._value);(t.version===0||oo(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{tr=n,Ni=r,g1(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 _T(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function AT(e,t){e.effect instanceof cu&&(e=e.effect.fn);const n=new cu(e);t&&$n(n,t);try{n.run()}catch(o){throw n.stop(),o}const r=n.run.bind(n);return r.effect=n,r}function IT(e){e.effect.stop()}function ga(){lv.push(Ni),Ni=!1}function va(){const e=lv.pop();Ni=e===void 0?!0:e}function y1(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=tr;tr=void 0;try{t()}finally{tr=n}}}function b1(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)b1(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}function Do(e,t,n){if(Ni&&tr){let r=Jd.get(e);r||Jd.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new Qd),o.map=r,o.key=n),o.track()}}function ya(e,t,n,r,o,i){const s=Jd.get(e);if(!s){uu++;return}const a=l=>{l&&l.trigger()};if(Jg(),t==="clear")s.forEach(a);else{const l=jt(e),u=l&&Hd(n);if(l&&n==="length"){const d=Number(r);s.forEach((f,p)=>{(p==="length"||p===du||!ei(p)&&p>=d)&&a(f)})}else switch((n!==void 0||s.has(void 0))&&a(s.get(n)),u&&a(s.get(du)),t){case"add":l?u&&a(s.get("length")):(a(s.get(ul)),ac(e)&&a(s.get(Jh)));break;case"delete":l||(a(s.get(ul)),ac(e)&&a(s.get(Jh)));break;case"set":ac(e)&&a(s.get(ul));break}}ev()}function ET(e,t){const n=Jd.get(e);return n&&n.get(t)}function lu(e){const t=yn(e);return t===e?t:(Do(t,"iterate",du),ti(e)?t:t.map(Bi))}function Wh(e){return Do(e=yn(e),"iterate",du),e}function Rs(e,t){return Ms(e)?uc(Fi(e)?Bi(t):t):Bi(t)}function rv(e,t,n){const r=Wh(e),o=r[t]();return r!==e&&!ti(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}function ba(e,t,n,r,o,i){const s=Wh(e),a=s!==e&&!ti(e),l=s[t];if(l!==x1[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,Rs(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 w1(e,t,n,r){const o=Wh(e),i=o!==e&&!ti(e);let s=n,a=!1;o!==e&&(i?(a=r.length===0,s=function(u,d,f){return a&&(a=!1,u=Rs(e,u)),n.call(this,u,Rs(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?Rs(e,l):l}function ov(e,t,n){const r=yn(e);Do(r,"iterate",du);const o=r[t](...n);return(o===-1||o===!1)&&Yd(n[0])?(n[0]=yn(n[0]),r[t](...n)):o}function qd(e,t,n=[]){ga(),Jg();const r=yn(e)[t].apply(e,n);return ev(),va(),r}function TT(e){ei(e)||(e=String(e));const t=yn(this);return Do(t,"has",e),t.hasOwnProperty(e)}function xT(e,t,n){return function(...r){const o=this.__v_raw,i=yn(o),s=ac(i),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,u=o[e](...r),d=n?ep:t?uc:Bi;return!t&&Do(i,"iterate",l?Jh:ul),$n(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 Kh(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function RT(e,t){const n={get(r){const o=this.__v_raw,i=yn(o),s=yn(r);e||(oo(r,s)&&Do(i,"get",r),Do(i,"get",s));const{has:a}=ef(i),l=t?ep:e?uc: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&&Do(yn(r),"iterate",ul),r.size},has(r){const o=this.__v_raw,i=yn(o),s=yn(r);return e||(oo(r,s)&&Do(i,"has",r),Do(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=yn(s),l=t?ep:e?uc:Bi;return!e&&Do(a,"iterate",ul),s.forEach((u,d)=>r.call(o,l(u),l(d),i))}};return $n(n,e?{add:Kh("add"),set:Kh("set"),delete:Kh("delete"),clear:Kh("clear")}:{add(r){const o=yn(this),i=ef(o),s=yn(r),a=!t&&!ti(r)&&!Ms(r)?s:r;return i.has.call(o,a)||oo(r,a)&&i.has.call(o,r)||oo(s,a)&&i.has.call(o,s)||(o.add(a),ya(o,"add",a,a)),this},set(r,o){!t&&!ti(o)&&!Ms(o)&&(o=yn(o));const i=yn(this),{has:s,get:a}=ef(i);let l=s.call(i,r);l||(r=yn(r),l=s.call(i,r));const u=a.call(i,r);return i.set(r,o),l?oo(o,u)&&ya(i,"set",r,o,u):ya(i,"add",r,o),this},delete(r){const o=yn(this),{has:i,get:s}=ef(o);let a=i.call(o,r);a||(r=yn(r),a=i.call(o,r));const l=s?s.call(o,r):void 0,u=o.delete(r);return a&&ya(o,"delete",r,void 0,l),u},clear(){const r=yn(this),o=r.size!==0,i=void 0,s=r.clear();return o&&ya(r,"clear",void 0,void 0,i),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=xT(r,e,t)}),n}function qh(e,t){const n=RT(e,t);return(r,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(Un(n,o)&&o in r?n:r,o,i)}function MT(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function LT(e){return e.__v_skip||!Object.isExtensible(e)?0:MT(o1(e))}function Zr(e){return Ms(e)?e:Xh(e,!1,M1,P1,hv)}function C1(e){return Xh(e,!1,D1,F1,pv)}function Yh(e){return Xh(e,!0,L1,N1,mv)}function DT(e){return Xh(e,!0,O1,B1,gv)}function Xh(e,t,n,r,o){if(!Nn(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=LT(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 Ms(e)?Fi(e.__v_raw):!!(e&&e.__v_isReactive)}function Ms(e){return!!(e&&e.__v_isReadonly)}function ti(e){return!!(e&&e.__v_isShallow)}function Yd(e){return e?!!e.__v_raw:!1}function yn(e){const t=e&&e.__v_raw;return t?yn(t):e}function $r(e){return!Un(e,"__v_skip")&&Object.isExtensible(e)&&Wg(e,"__v_skip",!0),e}function sr(e){return e?e.__v_isRef===!0:!1}function re(e){return k1(e,!1)}function Br(e){return k1(e,!0)}function k1(e,t){return sr(e)?e:new z1(e,t)}function OT(e){e.dep&&e.dep.trigger()}function Qe(e){return sr(e)?e.value:e}function PT(e){return Jt(e)?e():Qe(e)}function iv(e){return Fi(e)?e:new Proxy(e,j1)}function S1(e){return new V1(e)}function _1(e){const t=jt(e)?new Array(e.length):{};for(const n in e)t[n]=A1(e,n);return t}function sv(e,t,n){return sr(e)?e:Jt(e)?new H1(e):Nn(e)&&arguments.length>1?A1(e,t,n):re(e)}function A1(e,t,n){return new U1(e,t,n)}function FT(e,t,n=!1){let r,o;return Jt(e)?r=e:(r=e.get,o=e.set),new $1(r,o,n)}function NT(){return Ca}function I1(e,t=!1,n=Ca){if(n){let r=nf.get(n);r||nf.set(n,r=[]),r.push(e)}}function BT(e,t,n=On){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,u=k=>o?k:ti(k)||o===!1||o===0?wa(k,1):wa(k);let d,f,p,m,g=!1,v=!1;if(sr(e)?(f=()=>e.value,g=ti(e)):Fi(e)?(f=()=>u(e),g=!0):jt(e)?(v=!0,g=e.some(k=>Fi(k)||ti(k)),f=()=>e.map(k=>{if(sr(k))return k.value;if(Fi(k))return u(k);if(Jt(k))return l?l(k,2):k()})):Jt(e)?t?f=l?()=>l(e,2):e:f=()=>{if(p){ga();try{p()}finally{va()}}const k=Ca;Ca=d;try{return l?l(e,3,[m]):e(m)}finally{Ca=k}}:f=vi,t&&o){const k=f,T=o===!0?1/0:o;f=()=>wa(k(),T)}const C=Qg(),w=()=>{d.stop(),C&&C.active&&Hh(C.effects,d)};if(i&&t){const k=t;t=(...T)=>{k(...T),w()}}let _=v?new Array(e.length).fill(tf):tf;const y=k=>{if(!(!(d.flags&1)||!d.dirty&&!k))if(t){const T=d.run();if(o||g||(v?T.some((M,B)=>oo(M,_[B])):oo(T,_))){p&&p();const M=Ca;Ca=d;try{const B=[T,_===tf?void 0:v&&_[0]===tf?[]:_,m];_=T,l?l(t,3,B):t(...B)}finally{Ca=M}}}else d.run()};return a&&a(y),d=new cu(f),d.scheduler=s?()=>s(y,!1):y,m=k=>I1(k,!1,d),p=d.onStop=()=>{const k=nf.get(d);if(k){if(l)l(k,4);else for(const T of k)T();nf.delete(d)}},t?r?y(!0):_=d.run():s?s(y.bind(null,!0),!0):d.run(),w.pause=d.pause.bind(d),w.resume=d.resume.bind(d),w.stop=w,w}function wa(e,t=1/0,n){if(t<=0||!Nn(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,sr(e))wa(e.value,t,n);else if(jt(e))for(let r=0;r<e.length;r++)wa(e[r],t,n);else if(ll(e)||ac(e))e.forEach(r=>{wa(r,t,n)});else if(Ud(e)){for(const r in e)wa(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&wa(e[r],t,n)}return e}var Oo,Zh,tr,Qh,cu,av,Xd,Zd,Ni,lv,uu,E1,Qd,Jd,ul,Jh,du,T1,x1,R1,cv,uv,dv,fv,M1,L1,D1,O1,ep,ef,P1,F1,N1,B1,hv,pv,mv,gv,Bi,uc,z1,j1,V1,U1,H1,$1,G1,W1,tf,nf,Ca,zT=Er((()=>{Xg(),Zh=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=Oo,!e&&Oo&&(this.index=(Oo.scopes||(Oo.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=Oo;try{return Oo=this,e()}finally{Oo=t}}}on(){++this._on===1&&(this.prevScope=Oo,Oo=this)}off(){this._on>0&&--this._on===0&&(Oo=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}}},Qh=new WeakSet,cu=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,Oo&&Oo.active&&Oo.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Qh.has(this)&&(Qh.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||p1(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,y1(this),m1(this);const e=tr,t=Ni;tr=this,Ni=!0;try{return this.fn()}finally{g1(this),tr=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,y1(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Qh.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){tv(this)&&this.run()}get dirty(){return tv(this)}},av=0,Ni=!0,lv=[],uu=0,E1=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}},Qd=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(!tr||!Ni||tr===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==tr)t=this.activeLink=new E1(tr,this),tr.deps?(t.prevDep=tr.depsTail,tr.depsTail.nextDep=t,tr.depsTail=t):tr.deps=tr.depsTail=t,b1(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=tr.depsTail,t.nextDep=void 0,tr.depsTail.nextDep=t,tr.depsTail=t,tr.deps===t&&(tr.deps=n)}return t}trigger(e){this.version++,uu++,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()}}},Jd=new WeakMap,ul=Symbol(""),Jh=Symbol(""),du=Symbol(""),T1={__proto__:null,[Symbol.iterator](){return rv(this,Symbol.iterator,e=>Rs(this,e))},concat(...e){return lu(this).concat(...e.map(t=>jt(t)?lu(t):t))},entries(){return rv(this,"entries",e=>(e[1]=Rs(this,e[1]),e))},every(e,t){return ba(this,"every",e,t,void 0,arguments)},filter(e,t){return ba(this,"filter",e,t,n=>n.map(r=>Rs(this,r)),arguments)},find(e,t){return ba(this,"find",e,t,n=>Rs(this,n),arguments)},findIndex(e,t){return ba(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ba(this,"findLast",e,t,n=>Rs(this,n),arguments)},findLastIndex(e,t){return ba(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ba(this,"forEach",e,t,void 0,arguments)},includes(...e){return ov(this,"includes",e)},indexOf(...e){return ov(this,"indexOf",e)},join(e){return lu(this).join(e)},lastIndexOf(...e){return ov(this,"lastIndexOf",e)},map(e,t){return ba(this,"map",e,t,void 0,arguments)},pop(){return qd(this,"pop")},push(...e){return qd(this,"push",e)},reduce(e,...t){return w1(this,"reduce",e,t)},reduceRight(e,...t){return w1(this,"reduceRight",e,t)},shift(){return qd(this,"shift")},some(e,t){return ba(this,"some",e,t,void 0,arguments)},splice(...e){return qd(this,"splice",e)},toReversed(){return lu(this).toReversed()},toSorted(e){return lu(this).toSorted(e)},toSpliced(...e){return lu(this).toSpliced(...e)},unshift(...e){return qd(this,"unshift",e)},values(){return rv(this,"values",e=>Rs(this,e))}},x1=Array.prototype,R1=jd("__proto__,__v_isRef,__isVue"),cv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(ei)),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=jt(e);if(!r){let a;if(i&&(a=T1[t]))return a;if(t==="hasOwnProperty")return TT}const s=Reflect.get(e,t,sr(e)?e:n);if((ei(t)?cv.has(t):R1(t))||(r||Do(e,"get",t),o))return s;if(sr(s)){const a=i&&Hd(t)?s:s.value;return r&&Nn(a)?Yh(a):a}return Nn(s)?r?Yh(s):Zr(s):s}},dv=class extends uv{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t];const i=jt(e)&&Hd(t);if(!this._isShallow){const l=Ms(o);if(!ti(n)&&!Ms(n)&&(o=yn(o),n=yn(n)),!i&&sr(o)&&!sr(n))return l||(o.value=n),!0}const s=i?Number(t)<e.length:Un(e,t),a=Reflect.set(e,t,n,sr(e)?e:r);return e===yn(r)&&(s?oo(n,o)&&ya(e,"set",t,n,o):ya(e,"add",t,n)),a}deleteProperty(e,t){const n=Un(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&ya(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return(!ei(t)||!cv.has(t))&&Do(e,"has",t),n}ownKeys(e){return Do(e,"iterate",jt(e)?"length":ul),Reflect.ownKeys(e)}},fv=class extends uv{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},M1=new dv,L1=new fv,D1=new dv(!0),O1=new fv(!0),ep=e=>e,ef=e=>Reflect.getPrototypeOf(e),P1={get:qh(!1,!1)},F1={get:qh(!1,!0)},N1={get:qh(!0,!1)},B1={get:qh(!0,!0)},hv=new WeakMap,pv=new WeakMap,mv=new WeakMap,gv=new WeakMap,Bi=e=>Nn(e)?Zr(e):e,uc=e=>Nn(e)?Yh(e):e,z1=class{constructor(e,t){this.dep=new Qd,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:yn(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||ti(e)||Ms(e);e=n?e:yn(e),oo(e,t)&&(this._rawValue=e,this._value=n?e:Bi(e),this.dep.trigger())}},j1={get:(e,t,n)=>t==="__v_raw"?e:Qe(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return sr(o)&&!sr(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}},V1=class{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new Qd,{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)}},U1=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=ei(t)?t:String(t),this._raw=yn(e);let r=!0,o=e;if(!jt(e)||ei(this._key)||!Hd(this._key))do r=!Yd(o)||ti(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&&sr(this._raw[this._key])){const t=this._object[this._key];if(sr(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return ET(this._raw,this._key)}},H1=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()}},$1=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Qd(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=uu-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&tr!==this)return p1(this,!0),!0}get value(){const e=this.dep.track();return v1(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},G1={GET:"get",HAS:"has",ITERATE:"iterate"},W1={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},tf={},nf=new WeakMap,Ca=void 0}));function jT(e){Fv.push(e)}function VT(){Fv.pop()}function UT(e,t){}function fu(e,t,n,r){try{return r?e(...r):e()}catch(o){dc(o,t,n)}}function zi(e,t,n,r){if(Jt(e)){const o=fu(e,t,n,r);return o&&$h(o)&&o.catch(i=>{dc(i,t,n)}),o}if(jt(e)){const o=[];for(let i=0;i<e.length;i++)o.push(zi(e[i],t,n,r));return o}}function dc(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||On;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){ga(),fu(i,null,10,[e,l,u]),va();return}}HT(e,n,o,r,s)}function HT(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}function St(e){const t=pf||Nv;return e?t.then(this?e.bind(this):e):t}function $T(e){let t=as+1,n=Po.length;for(;t<n;){const r=t+n>>>1,o=Po[r],i=vu(o);i<e||i===e&&o.flags&2?t=r+1:n=r}return t}function vv(e){if(!(e.flags&1)){const t=vu(e),n=Po[Po.length-1];!n||!(e.flags&2)&&t>=vu(n)?Po.push(e):Po.splice($T(t),0,e),e.flags|=1,K1()}}function K1(){pf||(pf=Nv.then(Y1))}function rf(e){jt(e)?pc.push(...e):Ia&&e.id===-1?Ia.splice(mc+1,0,e):e.flags&1||(pc.push(e),e.flags|=1),K1()}function q1(e,t,n=as+1){for(;n<Po.length;n++){const r=Po[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Po.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function tp(e){if(pc.length){const t=[...new Set(pc)].sort((n,r)=>vu(n)-vu(r));if(pc.length=0,Ia){Ia.push(...t);return}for(Ia=t,mc=0;mc<Ia.length;mc++){const n=Ia[mc];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Ia=null,mc=0}}function Y1(e){try{for(as=0;as<Po.length;as++){const t=Po[as];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),fu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;as<Po.length;as++){const t=Po[as];t&&(t.flags&=-2)}as=-1,Po.length=0,tp(e),pf=null,(Po.length||pc.length)&&Y1(e)}}function X1(e,t){var n,r;yu=e,yu?(yu.enabled=!0,mf.forEach(({event:o,args:i})=>yu.emit(o,...i)),mf=[]):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=>{X1(o,t)}),setTimeout(()=>{yu||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,mf=[])},3e3)):mf=[]}function of(e){const t=so;return so=e,gf=e&&e.type.__scopeId||null,t}function GT(e){gf=e}function WT(){gf=null}function io(e,t=so,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&ff(-1);const i=of(t);let s;try{s=e(...o)}finally{of(i),r._d&&ff(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function ka(e,t){if(so===null)return e;const n=hf(so),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,s,a,l=On]=t[o];i&&(Jt(i)&&(i={mounted:i,updated:i}),i.deep&&wa(s),r.push({dir:i,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function Ls(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&&(ga(),zi(l,n,8,[e.el,a,e,t]),va())}}function Z1(e,t){if(ao){let n=ao.provides;const r=ao.parent&&ao.parent.provides;r===n&&(n=ao.provides=Object.create(r)),n[e]=t}}function dl(e,t,n=!1){const r=hr();if(r||ml){let o=ml?ml._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&&Jt(t)?t.call(r&&r.proxy):t}}function Q1(){return!!(hr()||ml)}function KT(e,t){return sf(e,null,t)}function qT(e,t){return sf(e,null,{flush:"post"})}function J1(e,t){return sf(e,null,{flush:"sync"})}function Vt(e,t,n){return sf(e,t,n)}function sf(e,t,n=On){const{immediate:r,deep:o,flush:i,once:s}=n,a=$n({},n),l=t&&r||!t&&i!=="post";let u;if(yl){if(i==="sync"){const m=zv();u=m.__watcherHandles||(m.__watcherHandles=[])}else if(!l){const m=()=>{};return m.stop=vi,m.resume=vi,m.pause=vi,m}}const d=ao;a.call=(m,g,v)=>zi(m,d,g,v);let f=!1;i==="post"?a.scheduler=m=>{jr(m,d&&d.suspense)}:i!=="sync"&&(f=!0,a.scheduler=(m,g)=>{g?m():vv(m)}),a.augmentJob=m=>{t&&(m.flags|=4),f&&(m.flags|=2,d&&(m.id=d.uid,m.i=d))};const p=BT(e,t,a);return yl&&(u?u.push(p):l&&p()),p}function YT(e,t,n){const r=this.proxy,o=Kn(e)?e.includes(".")?ew(r,e):()=>r[e]:e.bind(r,r);let i;Jt(t)?i=t:(i=t.handler,n=t);const s=yc(this),a=sf(o,i.bind(r),n);return s(),a}function ew(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 np(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||hl(d))&&l&16)for(let p=0;p<u.length;p++)o(u[p],t,n,2);f&&r(a,t,n)}function XT(e,t,n,r,o,i,{o:{nextSibling:s,parentNode:a,querySelector:l,insert:u,createText:d}},f){function p(C,w){let _=w;for(;_;){if(_&&_.nodeType===8){if(_.data==="teleport start anchor")t.targetStart=_;else if(_.data==="teleport anchor"){t.targetAnchor=_,C._lpa=t.targetAnchor&&s(t.targetAnchor);break}}_=s(_)}}function m(C,w){w.anchor=f(s(C),w,a(C),n,r,o,i)}const g=t.target=hp(t.props,l),v=hl(t.props);if(g){const C=g._lpa||g.firstChild;t.shapeFlag&16&&(v?(m(e,t),p(g,C),t.targetAnchor||yv(g,t,d,u,a(e)===g?e:null)):(t.anchor=s(e),p(g,C),t.targetAnchor||yv(g,t,d,u),f(C&&s(C),t,g,n,r,o,i))),af(t,v)}else v&&t.shapeFlag&16&&(m(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}function af(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 Bn(()=>{e.isMounted=!0}),ar(()=>{e.isUnmounting=!0}),e}function tw(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Tr){t=n;break}}return t}function nw(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 hu(e,t,n,r,o){const{appear:i,mode:s,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:d,onEnterCancelled:f,onBeforeLeave:p,onLeave:m,onAfterLeave:g,onLeaveCancelled:v,onBeforeAppear:C,onAppear:w,onAfterAppear:_,onAppearCancelled:y}=t,k=String(e.key),T=nw(n,e),M=(z,V)=>{z&&zi(z,r,9,V)},B=(z,V)=>{const Z=V[1];M(z,V),jt(z)?z.every(R=>R.length<=1)&&Z():z.length<=1&&Z()},W={mode:s,persisted:a,beforeEnter(z){let V=l;if(!n.isMounted)if(i)V=C||l;else return;z[ls]&&z[ls](!0);const Z=T[k];Z&&is(e,Z)&&Z.el[ls]&&Z.el[ls](),M(V,[z])},enter(z){if(T[k]===e)return;let V=u,Z=d,R=f;if(!n.isMounted)if(i)V=w||u,Z=_||d,R=y||f;else return;let K=!1;z[bu]=G=>{K||(K=!0,G?M(R,[z]):M(Z,[z]),W.delayedLeave&&W.delayedLeave(),z[bu]=void 0)};const x=z[bu].bind(null,!1);V?B(V,[z,x]):x()},leave(z,V){const Z=String(e.key);if(z[bu]&&z[bu](!0),n.isUnmounting)return V();M(p,[z]);let R=!1;z[ls]=x=>{R||(R=!0,V(),x?M(v,[z]):M(g,[z]),z[ls]=void 0,T[Z]===e&&delete T[Z])};const K=z[ls].bind(null,!1);T[Z]=e,m?B(m,[z,K]):K()},clone(z){const V=hu(z,t,n,r,o);return o&&o(V),V}};return W}function wv(e){if(wu(e))return e=Ds(e),e.children=null,e}function rw(e){if(!wu(e))return Vv(e.type)&&e.children?tw(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&&Jt(n.default))return n.default()}}function Sa(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Sa(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 rp(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===qt?(s.patchFlag&128&&o++,r=r.concat(rp(s.children,t,a))):(t||s.type!==Tr)&&r.push(a!=null?Ds(s,{key:a}):s)}if(o>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function fc(e,t){return Jt(e)?$n({name:e.name},t,{setup:e}):e}function ZT(){const e=hr();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 QT(e){const t=hr(),n=Br(null);if(t){const r=t.refs===On?t.refs={}:t.refs;Object.defineProperty(r,e,{enumerable:!0,get:()=>n.value,set:o=>n.value=o})}return n}function ow(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}function pu(e,t,n,r,o=!1){if(jt(e)){e.forEach((v,C)=>pu(v,t&&(jt(t)?t[C]:t),n,r,o));return}if(Ps(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&pu(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?hf(r.component):r.el,s=o?null:i,{i:a,r:l}=e,u=t&&t.r,d=a.refs===On?a.refs={}:a.refs,f=a.setupState,p=yn(f),m=f===On?Hg:v=>ow(d,v)?!1:Un(p,v),g=(v,C)=>!(C&&ow(d,C));if(u!=null&&u!==l){if(iw(t),Kn(u))d[u]=null,m(u)&&(f[u]=null);else if(sr(u)){const v=t;g(u,v.k)&&(u.value=null),v.k&&(d[v.k]=null)}}if(Jt(l))fu(l,a,12,[s,d]);else{const v=Kn(l),C=sr(l);if(v||C){const w=()=>{if(e.f){const _=v?m(l)?f[l]:d[l]:g(l)||!e.k?l.value:d[e.k];if(o)jt(_)&&Hh(_,i);else if(jt(_))_.includes(i)||_.push(i);else if(v)d[l]=[i],m(l)&&(f[l]=d[l]);else{const y=[i];g(l,e.k)&&(l.value=y),e.k&&(d[e.k]=y)}}else v?(d[l]=s,m(l)&&(f[l]=s)):C&&(g(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const _=()=>{w(),vf.delete(e)};_.id=-1,vf.set(e,_),jr(_,n)}else iw(e),w()}}}function iw(e){const t=vf.get(e);t&&(t.flags|=8,vf.delete(e))}function JT(e){const{mt:t,p:n,o:{patchProp:r,createText:o,nextSibling:i,parentNode:s,remove:a,insert:l,createComment:u}}=e,d=(y,k)=>{if(!k.hasChildNodes()){n(null,y,k),tp(),k._vnode=y;return}f(k.firstChild,y,null,null,null),tp(),k._vnode=y},f=(y,k,T,M,B,W=!1)=>{W=W||!!k.dynamicChildren;const z=vc(y)&&y.data==="[",V=()=>v(y,k,T,M,B,z),{type:Z,ref:R,shapeFlag:K,patchFlag:x}=k;let G=y.nodeType;k.el=y,x===-2&&(W=!1,k.dynamicChildren=null);let H=null;switch(Z){case Ea:G!==3?k.children===""?(l(k.el=o(""),s(y),y),H=y):H=V():(y.data!==k.children&&(gc(),y.data=k.children),H=i(y));break;case Tr:_(y)?(H=i(y),w(k.el=y.content.firstChild,y,T)):G!==8||z?H=V():H=i(y);break;case gl:if(z&&(y=i(y),G=y.nodeType),G===1||G===3){H=y;const J=!k.children.length;for(let Q=0;Q<k.staticCount;Q++)J&&(k.children+=H.nodeType===1?H.outerHTML:H.data),Q===k.staticCount-1&&(k.anchor=H),H=i(H);return z?i(H):H}else V();break;case qt:z?H=g(y,k,T,M,B,W):H=V();break;default:if(K&1)(G!==1||k.type.toLowerCase()!==y.tagName.toLowerCase())&&!_(y)?H=V():H=p(y,k,T,M,B,W);else if(K&6){k.slotScopeIds=B;const J=s(y);if(z?H=C(y):vc(y)&&y.data==="teleport start"?H=C(y,y.data,"teleport end"):H=i(y),t(k,J,null,T,M,yf(J),W),Ps(k)&&!k.type.__asyncResolved){let Q;z?(Q=Qt(qt),Q.anchor=H?H.previousSibling:J.lastChild):Q=y.nodeType===3?ss(""):Qt("div"),Q.el=y,k.component.subTree=Q}}else K&64?G!==8?H=V():H=k.type.hydrate(y,k,T,M,B,W,e,m):K&128&&(H=k.type.hydrate(y,k,T,M,yf(s(y)),B,W,e,f))}return R!=null&&pu(R,null,M,k),H},p=(y,k,T,M,B,W)=>{W=W||!!k.dynamicChildren;const{type:z,props:V,patchFlag:Z,shapeFlag:R,dirs:K,transition:x}=k,G=z==="input"||z==="option";if(G||Z!==-1){K&&Ls(k,null,T,"created");let H=!1;if(_(y)){H=Tw(null,x)&&T&&T.vnode.props&&T.vnode.props.appear;const Q=y.content.firstChild;if(H){const X=Q.getAttribute("class");X&&(Q.$cls=X),x.beforeEnter(Q)}w(Q,y,T),k.el=y=Q}if(R&16&&!(V&&(V.innerHTML||V.textContent))){let Q=m(y.firstChild,k,y,T,M,B,W);for(;Q;){op(y,1)||gc();const X=Q;Q=Q.nextSibling,a(X)}}else if(R&8){let Q=k.children;Q[0]===`
2
2
  `&&(y.tagName==="PRE"||y.tagName==="TEXTAREA")&&(Q=Q.slice(1));const{textContent:X}=y;X!==Q&&X!==Q.replace(/\r\n|\r/g,`
3
3
  `)&&(op(y,0)||gc(),y.textContent=k.children)}if(V){if(G||!W||Z&48){const Q=y.tagName.includes("-");for(const X in V)(G&&(X.endsWith("value")||X==="indeterminate")||iu(X)&&!cl(X)||X[0]==="."||Q&&!cl(X))&&r(y,X,null,V[X],void 0,T)}else if(V.onClick)r(y,"onClick",null,V.onClick,void 0,T);else if(Z&4&&Fi(V.style))for(const Q in V.style)V.style[Q]}let J;(J=V&&V.onVnodeBeforeMount)&&ri(J,T,k),K&&Ls(k,null,T,"beforeMount"),((J=V&&V.onVnodeMounted)||K||H)&&Dw(()=>{J&&ri(J,T,k),H&&x.enter(y),K&&Ls(k,null,T,"mounted")},M)}return y.nextSibling},m=(y,k,T,M,B,W,z)=>{z=z||!!k.dynamicChildren;const V=k.children,Z=V.length;for(let R=0;R<Z;R++){const K=z?V[R]:V[R]=ni(V[R]),x=K.type===Ea;y?(x&&!z&&R+1<Z&&ni(V[R+1]).type===Ea&&(l(o(y.data.slice(K.children.length)),T,i(y)),y.data=K.children),y=f(y,K,M,B,W,z)):x&&!K.children?l(K.el=o(""),T):(op(T,1)||gc(),n(null,K,T,null,M,B,yf(T),W))}return y},g=(y,k,T,M,B,W)=>{const{slotScopeIds:z}=k;z&&(B=B?B.concat(z):z);const V=s(y),Z=m(i(y),k,V,T,M,B,W);return Z&&vc(Z)&&Z.data==="]"?i(k.anchor=Z):(gc(),l(k.anchor=u("]"),V,Z),Z)},v=(y,k,T,M,B,W)=>{if(op(y.parentElement,1)||gc(),k.el=null,W){const Z=C(y);for(;;){const R=i(y);if(R&&R!==Z)a(R);else break}}const z=i(y),V=s(y);return a(y),n(null,k,V,z,T,M,yf(V),B),T&&(T.vnode.el=k.el,dp(T,k.el)),z},C=(y,k="[",T="]")=>{let M=0;for(;y;)if(y=i(y),y&&vc(y)&&(y.data===k&&M++,y.data===T)){if(M===0)return i(y);M--}return y},w=(y,k,T)=>{const M=k.parentNode;M&&M.replaceChild(y,k);let B=T;for(;B;)B.vnode.el===k&&(B.vnode.el=B.subTree.el=y),B=B.parent},_=y=>y.nodeType===1&&y.tagName==="TEMPLATE";return[d,f]}function op(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(Zw[t])}}function ex(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 tx(e,t){if(vc(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(vc(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function sw(e){Jt(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,m()),m=()=>{let g;return u||(g=u=t().catch(v=>{if(v=v instanceof Error?v:new Error(String(v)),l)return new Promise((C,w)=>{l(v,()=>C(p()),()=>w(v),f+1)});throw v}).then(v=>g!==u&&u?u:(v&&(v.__esModule||v[Symbol.toStringTag]==="Module")&&(v=v.default),d=v,v)))};return fc({name:"AsyncComponentWrapper",__asyncLoader:m,__asyncHydrate(g,v,C){let w=!1;(v.bu||(v.bu=[])).push(()=>w=!0);const _=()=>{w||C()},y=i?()=>{const k=i(_,T=>tx(g,T));k&&(v.bum||(v.bum=[])).push(k)}:_;d?y():m().then(()=>!v.isUnmounted&&y())},get __asyncResolved(){return d},setup(){const g=ao;if(Cv(g),d)return()=>ip(d,g);const v=y=>{u=null,dc(y,g,13,!r)};if(a&&g.suspense||yl)return m().then(y=>()=>ip(y,g)).catch(y=>(v(y),()=>r?Qt(r,{error:y}):null));const C=re(!1),w=re(),_=re(!!o);return o&&setTimeout(()=>{_.value=!1},o),s!=null&&setTimeout(()=>{if(!C.value&&!w.value){const y=new Error(`Async component timed out after ${s}ms.`);v(y),w.value=y}},s),m().then(()=>{C.value=!0,g.parent&&wu(g.parent.vnode)&&g.parent.update()}).catch(y=>{v(y),w.value=y}),()=>{if(C.value&&d)return ip(d,g);if(w.value&&r)return Qt(r,{error:w.value});if(n&&!_.value)return ip(n,g)}}})}function ip(e,t){const{ref:n,props:r,children:o,ce:i}=t.vnode,s=Qt(e,r,o);return s.ref=n,s.ce=i,delete t.vnode.ce,s}function lf(e,t){return jt(e)?e.some(n=>lf(n,t)):Kn(e)?e.split(",").includes(t):r1(e)?(e.lastIndex=0,e.test(t)):!1}function kv(e,t){aw(e,"a",t)}function Sv(e,t){aw(e,"da",t)}function aw(e,t,n=ao){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(ap(t,r,n),n){let o=n.parent;for(;o&&o.parent;)wu(o.parent.vnode)&&nx(r,t,n,o),o=o.parent}}function nx(e,t,n,r){const o=ap(t,e,r,!0);wf(()=>{Hh(r[t],o)},n)}function _v(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function sp(e){return e.shapeFlag&128?e.ssContent:e}function ap(e,t,n=ao,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{ga();const a=yc(n),l=zi(t,n,e,s);return a(),va(),l});return r?o.unshift(i):o.push(i),i}}function lw(e,t=ao){ap("ec",e,t)}function rx(e,t){return Iv(gp,e,!0,t)||e}function Av(e){return Kn(e)?Iv(gp,e,!1)||e:e||Qv}function cw(e){return Iv(iC,e)}function Iv(e,t,n=!0,r=!1){const o=so||ao;if(o){const i=o.type;if(e===gp){const a=Pv(i,!1);if(a&&(a===t||a===Nr(t)||a===su(Nr(t))))return i}const s=uw(o[e]||i[e],t)||uw(o.appContext[e],t);return!s&&r?i:s}}function uw(e,t){return e&&(e[t]||e[Nr(t)]||e[su(Nr(t))])}function nr(e,t,n,r){let o;const i=n&&n[r],s=jt(e);if(s||Kn(e)){const a=s&&Fi(e);let l=!1,u=!1;a&&(l=!ti(e),u=Ms(e),e=Wh(e)),o=new Array(e.length);for(let d=0,f=e.length;d<f;d++)o[d]=t(l?u?uc(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(Nn(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 ox(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(jt(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 mu(e,t,n={},r,o){if(so.ce||so.parent&&Ps(so.parent)&&so.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),ye(),cn(qt,null,[Qt("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=cn(qt,{key:(a&&!ei(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=>_a(t)?!(t.type===Tr||t.type===qt&&!Ev(t.children)):!0)?e:null}function ix(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:au(r)]=e[r];return n}function sx(){return null}function ax(){return null}function lx(e){}function cx(e){}function ux(){return null}function dx(){}function fx(e,t){return null}function dw(){return hw("useSlots").slots}function fw(){return hw("useAttrs").attrs}function hw(e){const t=hr();return t.setupContext||(t.setupContext=Vw(t))}function cf(e){return jt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function hx(e,t){const n=cf(e);for(const r in t){if(r.startsWith("__skip"))continue;let o=n[r];o?jt(o)||Jt(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 px(e,t){return!e||!t?e||t:jt(e)&&jt(t)?e.concat(t):$n({},cf(e),cf(t))}function mx(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function gx(e){const t=hr(),n=yl;let r=e();_u(),n&&Su(!1);const o=()=>{yc(t),n&&Su(!0)},i=()=>{hr()!==t&&t.scope.off(),_u(),n&&Su(!1)};return $h(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function vx(e){const t=Tv(e),n=e.proxy,r=e.ctx;wp=!1,t.beforeCreate&&pw(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:u,created:d,beforeMount:f,mounted:p,beforeUpdate:m,updated:g,activated:v,deactivated:C,beforeDestroy:w,beforeUnmount:_,destroyed:y,unmounted:k,render:T,renderTracked:M,renderTriggered:B,errorCaptured:W,serverPrefetch:z,expose:V,inheritAttrs:Z,components:R,directives:K,filters:x}=t;if(u&&yx(u,r,null),s)for(const J in s){const Q=s[J];Jt(Q)&&(r[J]=Q.bind(n))}if(o){const J=o.call(n,n);Nn(J)&&(e.data=Zr(J))}if(wp=!0,i)for(const J in i){const Q=i[J],X=Jt(Q)?Q.bind(n,n):Jt(Q.get)?Q.get.bind(n,n):vi,Te=!Jt(Q)&&Jt(Q.set)?Q.set.bind(n):vi,de=Se({get:X,set:Te});Object.defineProperty(r,J,{enumerable:!0,configurable:!0,get:()=>de.value,set:ge=>de.value=ge})}if(a)for(const J in a)mw(a[J],r,n,J);if(l){const J=Jt(l)?l.call(n):l;Reflect.ownKeys(J).forEach(Q=>{Z1(Q,J[Q])})}d&&pw(d,e,"c");function H(J,Q){jt(Q)?Q.forEach(X=>J(X.bind(n))):Q&&J(Q.bind(n))}if(H(qv,f),H(Bn,p),H(mp,m),H(bf,g),H(kv,v),H(Sv,C),H(lw,W),H(Zv,M),H(Xv,B),H(ar,_),H(wf,k),H(Yv,z),jt(V))if(V.length){const J=e.exposed||(e.exposed={});V.forEach(Q=>{Object.defineProperty(J,Q,{get:()=>n[Q],set:X=>n[Q]=X,enumerable:!0})})}else e.exposed||(e.exposed={});T&&e.render===vi&&(e.render=T),Z!=null&&(e.inheritAttrs=Z),R&&(e.components=R),K&&(e.directives=K),z&&Cv(e)}function yx(e,t,n=vi){jt(e)&&(e=xv(e));for(const r in e){const o=e[r];let i;Nn(o)?"default"in o?i=dl(o.from||r,o.default,!0):i=dl(o.from||r):i=dl(o),sr(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function pw(e,t,n){zi(jt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function mw(e,t,n,r){let o=r.includes(".")?ew(n,r):()=>n[r];if(Kn(e)){const i=t[e];Jt(i)&&Vt(o,i)}else if(Jt(e))Vt(o,e.bind(n));else if(Nn(e))if(jt(e))e.forEach(i=>mw(i,t,n,r));else{const i=Jt(e.handler)?e.handler.bind(n):t[e.handler];Jt(i)&&Vt(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=>lp(l,u,s,!0)),lp(l,t,s)),Nn(t)&&i.set(t,l),l}function lp(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&lp(e,i,n,!0),o&&o.forEach(s=>lp(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=aC[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function gw(e,t){return t?e?function(){return $n(Jt(e)?e.call(this,this):e,Jt(t)?t.call(this,this):t)}:t:e}function bx(e,t){return uf(xv(e),xv(t))}function xv(e){if(jt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Wo(e,t){return e?[...new Set([].concat(e,t))]:t}function uf(e,t){return e?$n(Object.create(null),e,t):t}function vw(e,t){return e?jt(e)&&jt(t)?[...new Set([...e,...t])]:$n(Object.create(null),cf(e),cf(t??{})):t}function wx(e,t){if(!e)return t;if(!t)return e;const n=$n(Object.create(null),e);for(const r in t)n[r]=Wo(e[r],t[r]);return n}function yw(){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 Cx(e,t){return function(r,o=null){Jt(r)||(r=$n({},r)),o!=null&&!Nn(o)&&(o=null);const i=yw(),s=new WeakSet,a=[];let l=!1;const u=i.app={_uid:lC++,_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&&Jt(d.install)?(s.add(d),d.install(u,...f)):Jt(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 m=u._ceVNode||Qt(r,o);return m.appContext=i,p===!0?p="svg":p===!1&&(p=void 0),f&&t?t(m,d):e(m,d,p),l=!0,u._container=d,d.__vue_app__=u,hf(m.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=ml;ml=u;try{return d()}finally{ml=f}}};return u}}function kx(e,t,n=On){const r=hr(),o=Nr(t),i=Go(t),s=Jv(e,o),a=S1((l,u)=>{let d,f=On,p;return J1(()=>{const m=e[o];oo(d,m)&&(d=m,u())}),{get(){return l(),n.get?n.get(d):d},set(m){const g=n.set?n.set(m):m;if(!oo(g,d)&&!(f!==On&&oo(m,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=m,u()),r.emit(`update:${t}`,g),oo(m,g)&&oo(m,f)&&!oo(g,p)&&u(),f=m,p=g}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||On:a,done:!1}:{done:!0}}}},a}function Sx(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||On;let o=n;const i=t.startsWith("update:"),s=i&&Jv(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>Kn(d)?d.trim():d)),s.number&&(o=n.map(Gd)));let a,l=r[a=au(t)]||r[a=au(Nr(t))];!l&&i&&(l=r[a=au(Go(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 bw(e,t,n=!1){const r=n?cC:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const i=e.emits;let s={},a=!1;if(!Jt(e)){const l=u=>{const d=bw(u,t,!0);d&&(a=!0,$n(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(Nn(e)&&r.set(e,null),null):(jt(i)?i.forEach(l=>s[l]=null):$n(s,i),Nn(e)&&r.set(e,s),s)}function cp(e,t){return!e||!iu(t)?!1:(t=t.slice(2).replace(/Once$/,""),Un(e,t[0].toLowerCase()+t.slice(1))||Un(e,Go(t))||Un(e,t))}function up(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:m,ctx:g,inheritAttrs:v}=e,C=of(e);let w,_;try{if(n.shapeFlag&4){const k=o||r,T=k;w=ni(u.call(T,k,d,f,m,p,g)),_=a}else{const k=t;w=ni(k.length>1?k(f,{attrs:a,slots:s,emit:l}):k(f,null)),_=t.props?a:uC(a)}}catch(k){ku.length=0,dc(k,e,1),w=Qt(Tr)}let y=w;if(_&&v!==!1){const k=Object.keys(_),{shapeFlag:T}=y;k.length&&T&7&&(i&&k.some(Vd)&&(_=dC(_,i)),y=Ds(y,_,!1,!0))}return n.dirs&&(y=Ds(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(n.dirs):n.dirs),n.transition&&Sa(y,n.transition),w=y,of(C),w}function _x(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(_a(o)){if(o.type!==Tr||o.children==="v-if"){if(n)return;n=o}}else return}return n}function Ax(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?ww(r,s,u):!!s;if(l&8){const d=t.dynamicProps;for(let f=0;f<d.length;f++){const p=d[f];if(Cw(s,r,p)&&!cp(u,p))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?ww(r,s,u):!0:!!s;return!1}function ww(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(Cw(t,e,i)&&!cp(n,i))return!0}return!1}function Cw(e,t,n){const r=e[n],o=t[n];return n==="style"&&Nn(r)&&Nn(o)?!ma(r,o):r!==o}function dp({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 Ix(e,t,n,r=!1){const o={},i=ty();e.propsDefaults=Object.create(null),kw(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:C1(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function Ex(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=yn(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(cp(e.emitsOptions,p))continue;const m=t[p];if(l)if(Un(i,p))m!==i[p]&&(i[p]=m,u=!0);else{const g=Nr(p);o[g]=Rv(l,a,g,m,e,!1)}else m!==i[p]&&(i[p]=m,u=!0)}}}else{kw(e,t,o,i)&&(u=!0);let d;for(const f in a)(!t||!Un(t,f)&&((d=Go(f))===f||!Un(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||!Un(t,f))&&(delete i[f],u=!0)}u&&ya(e.attrs,"set","")}function kw(e,t,n,r){const[o,i]=e.propsOptions;let s=!1,a;if(t)for(let l in t){if(cl(l))continue;const u=t[l];let d;o&&Un(o,d=Nr(l))?!i||!i.includes(d)?n[d]=u:(a||(a={}))[d]=u:cp(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(i){const l=yn(n),u=a||On;for(let d=0;d<i.length;d++){const f=i[d];n[f]=Rv(o,l,f,u[f],e,!Un(u,f))}}return s}function Rv(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=Un(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&Jt(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const d=yc(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===Go(n))&&(r=!0))}return r}function Sw(e,t,n=!1){const r=n?fC:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(!Jt(e)){const d=f=>{l=!0;const[p,m]=Sw(f,t,!0);$n(s,p),m&&a.push(...m)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!i&&!l)return Nn(e)&&r.set(e,sc),sc;if(jt(i))for(let d=0;d<i.length;d++){const f=Nr(i[d]);_w(f)&&(s[f]=On)}else if(i)for(const d in i){const f=Nr(d);if(_w(f)){const p=i[d],m=s[f]=jt(p)||Jt(p)?{type:p}:$n({},p),g=m.type;let v=!1,C=!0;if(jt(g))for(let w=0;w<g.length;++w){const _=g[w],y=Jt(_)&&_.name;if(y==="Boolean"){v=!0;break}else y==="String"&&(C=!1)}else v=Jt(g)&&g.name==="Boolean";m[0]=v,m[1]=C,(v||Un(m,"default"))&&a.push(f)}}const u=[s,a];return Nn(e)&&r.set(e,u),u}function _w(e){return e[0]!=="$"&&!cl(e)}function Aw(e){return Ew(e)}function Iw(e){return Ew(e,JT)}function Ew(e,t){const n=Kd();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:m=vi,insertStaticContent:g}=e,v=(ne,I,ae,N=null,Y=null,U=null,ie=void 0,be=null,L=!!I.dynamicChildren)=>{if(ne===I)return;ne&&!is(ne,I)&&(N=ut(ne),ge(ne,Y,U,!0),ne=null),I.patchFlag===-2&&(L=!1,I.dynamicChildren=null);const{type:F,ref:fe,shapeFlag:Ce}=I;switch(F){case Ea:C(ne,I,ae,N);break;case Tr:w(ne,I,ae,N);break;case gl:ne==null&&_(I,ae,N,ie);break;case qt:R(ne,I,ae,N,Y,U,ie,be,L);break;default:Ce&1?T(ne,I,ae,N,Y,U,ie,be,L):Ce&6?K(ne,I,ae,N,Y,U,ie,be,L):(Ce&64||Ce&128)&&F.process(ne,I,ae,N,Y,U,ie,be,L,se)}fe!=null&&Y?pu(fe,ne&&ne.ref,U,I||ne,!I):fe==null&&ne&&ne.ref!=null&&pu(ne.ref,null,U,ne,!0)},C=(ne,I,ae,N)=>{if(ne==null)r(I.el=a(I.children),ae,N);else{const Y=I.el=ne.el;I.children!==ne.children&&u(Y,I.children)}},w=(ne,I,ae,N)=>{ne==null?r(I.el=l(I.children||""),ae,N):I.el=ne.el},_=(ne,I,ae,N)=>{[ne.el,ne.anchor]=g(ne.children,I,ae,N,ne.el,ne.anchor)},y=({el:ne,anchor:I},ae,N)=>{let Y;for(;ne&&ne!==I;)Y=p(ne),r(ne,ae,N),ne=Y;r(I,ae,N)},k=({el:ne,anchor:I})=>{let ae;for(;ne&&ne!==I;)ae=p(ne),o(ne),ne=ae;o(I)},T=(ne,I,ae,N,Y,U,ie,be,L)=>{if(I.type==="svg"?ie="svg":I.type==="math"&&(ie="mathml"),ne==null)M(I,ae,N,Y,U,ie,be,L);else{const F=ne.el&&ne.el._isVueCE?ne.el:null;try{F&&F._beginPatch(),z(ne,I,Y,U,ie,be,L)}finally{F&&F._endPatch()}}},M=(ne,I,ae,N,Y,U,ie,be)=>{let L,F;const{props:fe,shapeFlag:Ce,transition:_e,dirs:Pe}=ne;if(L=ne.el=s(ne.type,U,fe&&fe.is,fe),Ce&8?d(L,ne.children):Ce&16&&W(ne.children,L,null,N,Y,Mv(ne,U),ie,be),Pe&&Ls(ne,null,N,"created"),B(L,ne,ne.scopeId,ie,N),fe){for(const it in fe)it!=="value"&&!cl(it)&&i(L,it,null,fe[it],U,N);"value"in fe&&i(L,"value",null,fe.value,U),(F=fe.onVnodeBeforeMount)&&ri(F,N,ne)}Pe&&Ls(ne,null,N,"beforeMount");const We=Tw(Y,_e);We&&_e.beforeEnter(L),r(L,I,ae),((F=fe&&fe.onVnodeMounted)||We||Pe)&&jr(()=>{F&&ri(F,N,ne),We&&_e.enter(L),Pe&&Ls(ne,null,N,"mounted")},Y)},B=(ne,I,ae,N,Y)=>{if(ae&&m(ne,ae),N)for(let U=0;U<N.length;U++)m(ne,N[U]);if(Y){let U=Y.subTree;if(I===U||Cf(U.type)&&(U.ssContent===I||U.ssFallback===I)){const ie=Y.vnode;B(ne,ie,ie.scopeId,ie.slotScopeIds,Y.parent)}}},W=(ne,I,ae,N,Y,U,ie,be,L=0)=>{for(let F=L;F<ne.length;F++){const fe=ne[F]=be?Aa(ne[F]):ni(ne[F]);v(null,fe,I,ae,N,Y,U,ie,be)}},z=(ne,I,ae,N,Y,U,ie)=>{const be=I.el=ne.el;let{patchFlag:L,dynamicChildren:F,dirs:fe}=I;L|=ne.patchFlag&16;const Ce=ne.props||On,_e=I.props||On;let Pe;if(ae&&hc(ae,!1),(Pe=_e.onVnodeBeforeUpdate)&&ri(Pe,ae,I,ne),fe&&Ls(I,ne,ae,"beforeUpdate"),ae&&hc(ae,!0),(Ce.innerHTML&&_e.innerHTML==null||Ce.textContent&&_e.textContent==null)&&d(be,""),F?V(ne.dynamicChildren,F,be,ae,N,Mv(I,Y),U):ie||Q(ne,I,be,null,ae,N,Mv(I,Y),U,!1),L>0){if(L&16)Z(be,Ce,_e,ae,Y);else if(L&2&&Ce.class!==_e.class&&i(be,"class",null,_e.class,Y),L&4&&i(be,"style",Ce.style,_e.style,Y),L&8){const We=I.dynamicProps;for(let it=0;it<We.length;it++){const ht=We[it],Lt=Ce[ht],Tt=_e[ht];(Tt!==Lt||ht==="value")&&i(be,ht,Lt,Tt,Y,ae)}}L&1&&ne.children!==I.children&&d(be,I.children)}else!ie&&F==null&&Z(be,Ce,_e,ae,Y);((Pe=_e.onVnodeUpdated)||fe)&&jr(()=>{Pe&&ri(Pe,ae,I,ne),fe&&Ls(I,ne,ae,"updated")},N)},V=(ne,I,ae,N,Y,U,ie)=>{for(let be=0;be<I.length;be++){const L=ne[be],F=I[be],fe=L.el&&(L.type===qt||!is(L,F)||L.shapeFlag&198)?f(L.el):ae;v(L,F,fe,null,N,Y,U,ie,!0)}},Z=(ne,I,ae,N,Y)=>{if(I!==ae){if(I!==On)for(const U in I)!cl(U)&&!(U in ae)&&i(ne,U,I[U],null,Y,N);for(const U in ae){if(cl(U))continue;const ie=ae[U],be=I[U];ie!==be&&U!=="value"&&i(ne,U,be,ie,Y,N)}"value"in ae&&i(ne,"value",I.value,ae.value,Y)}},R=(ne,I,ae,N,Y,U,ie,be,L)=>{const F=I.el=ne?ne.el:a(""),fe=I.anchor=ne?ne.anchor:a("");let{patchFlag:Ce,dynamicChildren:_e,slotScopeIds:Pe}=I;Pe&&(be=be?be.concat(Pe):Pe),ne==null?(r(F,ae,N),r(fe,ae,N),W(I.children||[],ae,fe,Y,U,ie,be,L)):Ce>0&&Ce&64&&_e&&ne.dynamicChildren&&ne.dynamicChildren.length===_e.length?(V(ne.dynamicChildren,_e,ae,Y,U,ie,be),(I.key!=null||Y&&I===Y.subTree)&&Lv(ne,I,!0)):Q(ne,I,ae,fe,Y,U,ie,be,L)},K=(ne,I,ae,N,Y,U,ie,be,L)=>{I.slotScopeIds=be,ne==null?I.shapeFlag&512?Y.ctx.activate(I,ae,N,ie,L):x(I,ae,N,Y,U,ie,L):G(ne,I,L)},x=(ne,I,ae,N,Y,U,ie)=>{const be=ne.component=Nw(ne,N,Y);if(wu(ne)&&(be.ctx.renderer=se),zw(be,!1,ie),be.asyncDep){if(Y&&Y.registerDep(be,H,ie),!ne.el){const L=be.subTree=Qt(Tr);w(null,L,I,ae),ne.placeholder=L.el}}else H(be,ne,I,ae,Y,U,ie)},G=(ne,I,ae)=>{const N=I.component=ne.component;if(Ax(ne,I,ae))if(N.asyncDep&&!N.asyncResolved){J(N,I,ae);return}else N.next=I,N.update();else I.el=ne.el,N.vnode=I},H=(ne,I,ae,N,Y,U,ie)=>{const be=()=>{if(ne.isMounted){let{next:Ce,bu:_e,u:Pe,parent:We,vnode:it}=ne;{const Fe=xw(ne);if(Fe){Ce&&(Ce.el=it.el,J(ne,Ce,ie)),Fe.asyncDep.then(()=>{jr(()=>{ne.isUnmounted||F()},Y)});return}}let ht=Ce,Lt;hc(ne,!1),Ce?(Ce.el=it.el,J(ne,Ce,ie)):Ce=it,_e&&cc(_e),(Lt=Ce.props&&Ce.props.onVnodeBeforeUpdate)&&ri(Lt,We,Ce,it),hc(ne,!0);const Tt=up(ne),Yt=ne.subTree;ne.subTree=Tt,v(Yt,Tt,f(Yt.el),ut(Yt),ne,Y,U),Ce.el=Tt.el,ht===null&&dp(ne,Tt.el),Pe&&jr(Pe,Y),(Lt=Ce.props&&Ce.props.onVnodeUpdated)&&jr(()=>ri(Lt,We,Ce,it),Y)}else{let Ce;const{el:_e,props:Pe}=I,{bm:We,m:it,parent:ht,root:Lt,type:Tt}=ne,Yt=Ps(I);if(hc(ne,!1),We&&cc(We),!Yt&&(Ce=Pe&&Pe.onVnodeBeforeMount)&&ri(Ce,ht,I),hc(ne,!0),_e&&Ue){const Fe=()=>{ne.subTree=up(ne),Ue(_e,ne.subTree,ne,Y,null)};Yt&&Tt.__asyncHydrate?Tt.__asyncHydrate(_e,ne,Fe):Fe()}else{Lt.ce&&Lt.ce._hasShadowRoot()&&Lt.ce._injectChildStyle(Tt,ne.parent?ne.parent.type:void 0);const Fe=ne.subTree=up(ne);v(null,Fe,ae,N,ne,Y,U),I.el=Fe.el}if(it&&jr(it,Y),!Yt&&(Ce=Pe&&Pe.onVnodeMounted)){const Fe=I;jr(()=>ri(Ce,ht,Fe),Y)}(I.shapeFlag&256||ht&&Ps(ht.vnode)&&ht.vnode.shapeFlag&256)&&ne.a&&jr(ne.a,Y),ne.isMounted=!0,I=ae=N=null}};ne.scope.on();const L=ne.effect=new cu(be);ne.scope.off();const F=ne.update=L.run.bind(L),fe=ne.job=L.runIfDirty.bind(L);fe.i=ne,fe.id=ne.uid,L.scheduler=()=>vv(fe),hc(ne,!0),F()},J=(ne,I,ae)=>{I.component=ne;const N=ne.vnode.props;ne.vnode=I,ne.next=null,Ex(ne,I.props,N,ae),mC(ne,I.children,ae),ga(),q1(ne),va()},Q=(ne,I,ae,N,Y,U,ie,be,L=!1)=>{const F=ne&&ne.children,fe=ne?ne.shapeFlag:0,Ce=I.children,{patchFlag:_e,shapeFlag:Pe}=I;if(_e>0){if(_e&128){Te(F,Ce,ae,N,Y,U,ie,be,L);return}else if(_e&256){X(F,Ce,ae,N,Y,U,ie,be,L);return}}Pe&8?(fe&16&&tt(F,Y,U),Ce!==F&&d(ae,Ce)):fe&16?Pe&16?Te(F,Ce,ae,N,Y,U,ie,be,L):tt(F,Y,U,!0):(fe&8&&d(ae,""),Pe&16&&W(Ce,ae,N,Y,U,ie,be,L))},X=(ne,I,ae,N,Y,U,ie,be,L)=>{ne=ne||sc,I=I||sc;const F=ne.length,fe=I.length,Ce=Math.min(F,fe);let _e;for(_e=0;_e<Ce;_e++){const Pe=I[_e]=L?Aa(I[_e]):ni(I[_e]);v(ne[_e],Pe,ae,null,Y,U,ie,be,L)}F>fe?tt(ne,Y,U,!0,!1,Ce):W(I,ae,N,Y,U,ie,be,L,Ce)},Te=(ne,I,ae,N,Y,U,ie,be,L)=>{let F=0;const fe=I.length;let Ce=ne.length-1,_e=fe-1;for(;F<=Ce&&F<=_e;){const Pe=ne[F],We=I[F]=L?Aa(I[F]):ni(I[F]);if(is(Pe,We))v(Pe,We,ae,null,Y,U,ie,be,L);else break;F++}for(;F<=Ce&&F<=_e;){const Pe=ne[Ce],We=I[_e]=L?Aa(I[_e]):ni(I[_e]);if(is(Pe,We))v(Pe,We,ae,null,Y,U,ie,be,L);else break;Ce--,_e--}if(F>Ce){if(F<=_e){const Pe=_e+1,We=Pe<fe?I[Pe].el:N;for(;F<=_e;)v(null,I[F]=L?Aa(I[F]):ni(I[F]),ae,We,Y,U,ie,be,L),F++}}else if(F>_e)for(;F<=Ce;)ge(ne[F],Y,U,!0),F++;else{const Pe=F,We=F,it=new Map;for(F=We;F<=_e;F++){const Kt=I[F]=L?Aa(I[F]):ni(I[F]);Kt.key!=null&&it.set(Kt.key,F)}let ht,Lt=0;const Tt=_e-We+1;let Yt=!1,Fe=0;const rn=new Array(Tt);for(F=0;F<Tt;F++)rn[F]=0;for(F=Pe;F<=Ce;F++){const Kt=ne[F];if(Lt>=Tt){ge(Kt,Y,U,!0);continue}let Rn;if(Kt.key!=null)Rn=it.get(Kt.key);else for(ht=We;ht<=_e;ht++)if(rn[ht-We]===0&&is(Kt,I[ht])){Rn=ht;break}Rn===void 0?ge(Kt,Y,U,!0):(rn[Rn-We]=F+1,Rn>=Fe?Fe=Rn:Yt=!0,v(Kt,I[Rn],ae,null,Y,U,ie,be,L),Lt++)}const Dn=Yt?Tx(rn):sc;for(ht=Dn.length-1,F=Tt-1;F>=0;F--){const Kt=We+F,Rn=I[Kt],Lr=I[Kt+1],yr=Kt+1<fe?Lr.el||Rw(Lr):N;rn[F]===0?v(null,Rn,ae,yr,Y,U,ie,be,L):Yt&&(ht<0||F!==Dn[ht]?de(Rn,ae,yr,2):ht--)}}},de=(ne,I,ae,N,Y=null)=>{const{el:U,type:ie,transition:be,children:L,shapeFlag:F}=ne;if(F&6){de(ne.component.subTree,I,ae,N);return}if(F&128){ne.suspense.move(I,ae,N);return}if(F&64){ie.move(ne,I,ae,se);return}if(ie===qt){r(U,I,ae);for(let fe=0;fe<L.length;fe++)de(L[fe],I,ae,N);r(ne.anchor,I,ae);return}if(ie===gl){y(ne,I,ae);return}if(N!==2&&F&1&&be)if(N===0)be.beforeEnter(U),r(U,I,ae),jr(()=>be.enter(U),Y);else{const{leave:fe,delayLeave:Ce,afterLeave:_e}=be,Pe=()=>{ne.ctx.isUnmounted?o(U):r(U,I,ae)},We=()=>{U._isLeaving&&U[ls](!0),fe(U,()=>{Pe(),_e&&_e()})};Ce?Ce(U,Pe,We):We()}else r(U,I,ae)},ge=(ne,I,ae,N=!1,Y=!1)=>{const{type:U,props:ie,ref:be,children:L,dynamicChildren:F,shapeFlag:fe,patchFlag:Ce,dirs:_e,cacheIndex:Pe,memo:We}=ne;if(Ce===-2&&(Y=!1),be!=null&&(ga(),pu(be,null,ae,ne,!0),va()),Pe!=null&&(I.renderCache[Pe]=void 0),fe&256){I.ctx.deactivate(ne);return}const it=fe&1&&_e,ht=!Ps(ne);let Lt;if(ht&&(Lt=ie&&ie.onVnodeBeforeUnmount)&&ri(Lt,I,ne),fe&6)Be(ne.component,ae,N);else{if(fe&128){ne.suspense.unmount(ae,N);return}it&&Ls(ne,null,I,"beforeUnmount"),fe&64?ne.type.remove(ne,I,ae,se,N):F&&!F.hasOnce&&(U!==qt||Ce>0&&Ce&64)?tt(F,I,ae,!1,!0):(U===qt&&Ce&384||!Y&&fe&16)&&tt(L,I,ae),N&&ve(ne)}const Tt=We!=null&&Pe==null;(ht&&(Lt=ie&&ie.onVnodeUnmounted)||it||Tt)&&jr(()=>{Lt&&ri(Lt,I,ne),it&&Ls(ne,null,I,"unmounted"),Tt&&(ne.el=null)},ae)},ve=ne=>{const{type:I,el:ae,anchor:N,transition:Y}=ne;if(I===qt){Re(ae,N);return}if(I===gl){k(ne);return}const U=()=>{o(ae),Y&&!Y.persisted&&Y.afterLeave&&Y.afterLeave()};if(ne.shapeFlag&1&&Y&&!Y.persisted){const{leave:ie,delayLeave:be}=Y,L=()=>ie(ae,U);be?be(ne.el,U,L):L()}else U()},Re=(ne,I)=>{let ae;for(;ne!==I;)ae=p(ne),o(ne),ne=ae;o(I)},Be=(ne,I,ae)=>{const{bum:N,scope:Y,job:U,subTree:ie,um:be,m:L,a:F}=ne;fp(L),fp(F),N&&cc(N),Y.stop(),U&&(U.flags|=8,ge(ie,ne,I,ae)),be&&jr(be,I),jr(()=>{ne.isUnmounted=!0},I)},tt=(ne,I,ae,N=!1,Y=!1,U=0)=>{for(let ie=U;ie<ne.length;ie++)ge(ne[ie],I,ae,N,Y)},ut=ne=>{if(ne.shapeFlag&6)return ut(ne.component.subTree);if(ne.shapeFlag&128)return ne.suspense.next();const I=p(ne.anchor||ne.el),ae=I&&I[jv];return ae?p(ae):I};let dt=!1;const _t=(ne,I,ae)=>{let N;ne==null?I._vnode&&(ge(I._vnode,null,null,!0),N=I._vnode.component):v(I._vnode||null,ne,I,null,null,null,ae),I._vnode=ne,dt||(dt=!0,q1(N),tp(),dt=!1)},se={p:v,um:ge,m:de,r:ve,mt:x,mc:W,pc:Q,pbc:V,n:ut,o:e};let ke,Ue;return t&&([ke,Ue]=t(se)),{render:_t,hydrate:ke,createApp:Cx(_t,ke)}}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 hc({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Tw(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Lv(e,t,n=!1){const r=e.children,o=t.children;if(jt(r)&&jt(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]=Aa(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&Lv(s,a)),a.type===Ea&&(a.patchFlag===-1&&(a=o[i]=Aa(a)),a.el=s.el),a.type===Tr&&!a.el&&(a.el=s.el)}}function Tx(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 xw(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:xw(t)}function fp(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Rw(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Rw(t.subTree):null}function df(e,t){const n=e.props&&e.props[t];Jt(n)&&n()}function xx(e,t,n,r,o,i,s,a,l){const{p:u,o:{createElement:d}}=l,f=d("div"),p=e.suspense=Mw(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?(df(e,"onPending"),df(e,"onFallback"),u(null,e.ssFallback,t,n,r,null,i,s),gu(p,e.ssFallback)):p.resolve(!1,!0)}function Rx(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,m=t.ssFallback,{activeBranch:g,pendingBranch:v,isInFallback:C,isHydrating:w}=f;if(v)f.pendingBranch=p,is(v,p)?(l(v,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():C&&(w||(l(g,m,n,r,o,null,i,s,a),gu(f,m)))):(f.pendingId=Sp++,w?(f.isHydrating=!1,f.activeBranch=v):u(v,o,f),f.deps=0,f.effects.length=0,f.hiddenContainer=d("div"),C?(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():(l(g,m,n,r,o,null,i,s,a),gu(f,m))):g&&is(g,p)?(l(g,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(g&&is(g,p))l(g,p,n,r,o,f,i,s,a),gu(f,p);else if(df(t,"onPending"),f.pendingBranch=p,p.shapeFlag&512?f.pendingId=p.component.suspenseId:f.pendingId=Sp++,l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0)f.resolve();else{const{timeout:_,pendingId:y}=f;_>0?setTimeout(()=>{f.pendingId===y&&f.fallback(m)},_):_===0&&f.fallback(m)}}function Mw(e,t,n,r,o,i,s,a,l,u,d=!1){const{p:f,m:p,um:m,n:g,o:{parentNode:v,remove:C}}=u;let w;const _=Dx(e);_&&t&&t.pendingBranch&&(w=t.pendingId,t.deps++);const y=e.props?Wd(e.props.timeout):void 0,k=i,T={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:Sp++,timeout:typeof y=="number"?y:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!d,isHydrating:d,isUnmounted:!1,effects:[],resolve(M=!1,B=!1){const{vnode:W,activeBranch:z,pendingBranch:V,pendingId:Z,effects:R,parentComponent:K,container:x,isInFallback:G}=T;let H=!1;T.isHydrating?T.isHydrating=!1:M||(H=z&&V.transition&&V.transition.mode==="out-in",H&&(z.transition.afterLeave=()=>{Z===T.pendingId&&(p(V,x,i===k?g(z):i,0),rf(R),G&&W.ssFallback&&(W.ssFallback.el=null))}),z&&!T.isFallbackMountPending&&(v(z.el)===x&&(i=g(z)),m(z,K,T,!0),!H&&G&&W.ssFallback&&jr(()=>W.ssFallback.el=null,T)),H||p(V,x,i,0)),T.isFallbackMountPending=!1,gu(T,V),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&&rf(R),T.effects=[],_&&t&&t.pendingBranch&&w===t.pendingId&&(t.deps--,t.deps===0&&!B&&t.resolve()),df(W,"onResolve")},fallback(M){if(!T.pendingBranch)return;const{vnode:B,activeBranch:W,parentComponent:z,container:V,namespace:Z}=T;df(B,"onFallback");const R=g(W),K=()=>{T.isFallbackMountPending=!1,T.isInFallback&&(f(null,M,V,R,z,null,Z,a,l),gu(T,M))},x=M.transition&&M.transition.mode==="out-in";x&&(T.isFallbackMountPending=!0,W.transition.afterLeave=K),T.isInFallback=!0,m(W,z,null,!0),x||K()},move(M,B,W){T.activeBranch&&p(T.activeBranch,M,B,W),T.container=M},next(){return T.activeBranch&&g(T.activeBranch)},registerDep(M,B,W){const z=!!T.pendingBranch;z&&T.deps++;const V=M.vnode.el;M.asyncDep.catch(Z=>{dc(Z,M,0)}).then(Z=>{if(M.isUnmounted||T.isUnmounted||T.pendingId!==M.suspenseId)return;_u(),M.asyncResolved=!0;const{vnode:R}=M;Ov(M,Z,!1),V&&(R.el=V);const K=!V&&M.subTree.el;B(M,R,v(V||M.subTree.el),V?null:g(M.subTree),T,s,W),K&&(R.placeholder=null,C(K)),dp(M,R.el),z&&--T.deps===0&&T.resolve()})},unmount(M,B){T.isUnmounted=!0,T.activeBranch&&m(T.activeBranch,n,M,B),T.pendingBranch&&m(T.pendingBranch,n,M,B)}};return T}function Mx(e,t,n,r,o,i,s,a,l){const u=t.suspense=Mw(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 Lx(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=Lw(r?n.default:n),e.ssFallback=r?Lw(n.fallback):Qt(Tr)}function Lw(e){let t;if(Jt(e)){const n=vl&&e._c;n&&(e._d=!1,ye()),e=e(),n&&(e._d=!0,t=Co,Ow())}return jt(e)&&(e=_x(e)),e=ni(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function Dw(e,t){t&&t.pendingBranch?jt(e)?t.effects.push(...e):t.effects.push(e):rf(e)}function gu(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,dp(r,o))}function Dx(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function ye(e=!1){ku.push(Co=e?null:[])}function Ow(){ku.pop(),Co=ku[ku.length-1]||null}function ff(e,t=!1){vl+=e,e<0&&Co&&t&&(Co.hasOnce=!0)}function Pw(e){return e.dynamicChildren=vl>0?Co||sc:null,Ow(),vl>0&&Co&&Co.push(e),e}function De(e,t,n,r,o,i){return Pw(He(e,t,n,r,o,i,!0))}function cn(e,t,n,r,o){return Pw(Qt(e,t,n,r,o,!0))}function _a(e){return e?e.__v_isVNode===!0:!1}function is(e,t){return e.type===t.type&&e.key===t.key}function Ox(e){}function He(e,t=null,n=null,r=0,o=null,i=e===qt?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&sy(t),ref:t&&kf(t),scopeId:gf,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:so};return a?(Dv(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Kn(n)?8:16),vl>0&&!s&&Co&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&Co.push(l),l}function Px(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===Qv)&&(e=Tr),_a(e)){const a=Ds(e,t,!0);return n&&Dv(a,n),vl>0&&!i&&Co&&(a.shapeFlag&6?Co[Co.indexOf(e)]=a:Co.push(a)),a.patchFlag=-2,a}if(zx(e)&&(e=e.__vccOpts),t){t=Fw(t);let{class:a,style:l}=t;a&&!Kn(a)&&(t.class=tn(a)),Nn(l)&&(Yd(l)&&!jt(l)&&(l=$n({},l)),t.style=wn(l))}const s=Kn(e)?1:Cf(e)?128:Vv(e)?64:Nn(e)?4:Jt(e)?2:0;return He(e,t,n,r,o,s,i,!0)}function Fw(e){return e?Yd(e)||ny(e)?$n({},e):e:null}function Ds(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,u=t?Os(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?jt(i)?i.concat(kf(t)):[i,kf(t)]:kf(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!==qt?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&&Ds(e.ssContent),ssFallback:e.ssFallback&&Ds(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Sa(d,l.clone(d)),d}function ss(e=" ",t=0){return Qt(Ea,null,e,t)}function Fx(e,t){const n=Qt(gl,null,e);return n.staticCount=t,n}function vt(e="",t=!1){return t?(ye(),cn(Tr,null,e)):Qt(Tr,null,e)}function ni(e){return e==null||typeof e=="boolean"?Qt(Tr):jt(e)?Qt(qt,null,e.slice()):_a(e)?Aa(e):Qt(Ea,null,String(e))}function Aa(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ds(e)}function Dv(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(jt(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=so:o===3&&so&&(so.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Jt(t)?(t={default:t,_ctx:so},n=32):(t=String(t),r&64?(n=16,t=[ss(t)]):n=8);e.children=t,e.shapeFlag|=n}function Os(...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=tn([t.class,r.class]));else if(o==="style")t.style=wn([t.style,r.style]);else if(iu(o)){const i=t[o],s=r[o];s&&i!==s&&!(jt(i)&&i.includes(s))?t[o]=i?[].concat(i,s):s:s==null&&i==null&&!Vd(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function ri(e,t,n,r=null){zi(e,t,7,[n,r])}function Nw(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||vC,i={uid:yC++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Zh(!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:Sw(r,o),emitsOptions:bw(r,o),emit:null,emitted:null,propsDefaults:On,inheritAttrs:r.inheritAttrs,ctx:On,data:On,props:On,attrs:On,slots:On,refs:On,setupState:On,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=Sx.bind(null,i),e.ce&&e.ce(i),i}function Bw(e){return e.vnode.shapeFlag&4}function zw(e,t=!1,n=!1){t&&Su(t);const{props:r,children:o}=e.vnode,i=Bw(e);Ix(e,r,i,t),pC(e,o,n||t);const s=i?Nx(e,t):void 0;return t&&Su(!1),s}function Nx(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,bp);const{setup:r}=n;if(r){ga();const o=e.setupContext=r.length>1?Vw(e):null,i=yc(e),s=fu(r,e,0,[e.props,o]),a=$h(s);if(va(),i(),(a||e.sp)&&!Ps(e)&&Cv(e),a){if(s.then(_u,_u),t)return s.then(l=>{Ov(e,l,t)}).catch(l=>{dc(l,e,0)});e.asyncDep=s}else Ov(e,s,t)}else jw(e,t)}function Ov(e,t,n){Jt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Nn(t)&&(e.setupState=iv(t)),jw(e,n)}function Bx(e){Ap=e,ay=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,sC))}}function jw(e,t,n){const r=e.type;if(!e.render){if(!t&&Ap&&!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=$n($n({isCustomElement:i,delimiters:a},s),l);r.render=Ap(o,u)}}e.render=r.render||vi,ay&&ay(e)}{const o=yc(e);ga();try{vx(e)}finally{va(),o()}}}function Vw(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,wC),slots:e.slots,emit:e.emit,expose:t}}function hf(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(iv($r(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Cu)return Cu[n](e)},has(t,n){return n in t||n in Cu}})):e.proxy}function Pv(e,t=!0){return Jt(e)?e.displayName||e.name:e.name||t&&e.__name}function zx(e){return Jt(e)&&"__vccOpts"in e}function zr(e,t,n){try{ff(-1);const r=arguments.length;return r===2?Nn(t)&&!jt(t)?_a(t)?Qt(e,null,[t]):Qt(e,t):Qt(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&_a(n)&&(n=[n]),Qt(e,t,n))}finally{ff(1)}}function jx(){return;function e(t,n,r){const o=t[r];if(jt(o)&&o.includes(n)||Nn(o)&&n in o||t.extends&&e(t.extends,n,r)||t.mixins&&t.mixins.some(i=>e(i,n,r)))return!0}}function Vx(e,t,n,r){const o=n[r];if(o&&Uw(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function Uw(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(oo(n[r],t[r]))return!1;return vl>0&&Co&&Co.push(e),!0}var Fv,Hw,$w,Po,as,pc,Ia,mc,Nv,pf,vu,yu,mf,so,gf,Gw,Bv,zv,fl,jv,Vv,hl,Ww,Uv,Hv,hp,Kw,pl,ls,bu,yi,pp,$v,qw,Gv,vf,Wv,gc,Yw,Xw,yf,vc,Kv,Zw,Qw,Jw,eC,tC,nC,rC,Ps,wu,oC,Fs,qv,Bn,mp,bf,ar,wf,Yv,Xv,Zv,gp,iC,Qv,vp,Cu,yp,bp,sC,wp,aC,lC,ml,Jv,cC,uC,dC,ey,ty,ny,fC,Cp,kp,hC,ry,oy,iy,pC,mC,jr,Cf,Sp,gC,qt,Ea,Tr,gl,ku,Co,vl,sy,kf,Qt,vC,yC,ao,hr,_p,Su,yc,_u,yl,Ap,ay,bC,wC,Se,ly,CC,kC,SC,_C,AC,Ux,Hx,$x,IC=Er((()=>{zT(),Xg(),Fv=[],Hw={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"},$w={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"},Po=[],as=-1,pc=[],Ia=null,mc=0,Nv=Promise.resolve(),pf=null,vu=e=>e.id==null?e.flags&2?-1:1/0:e.id,mf=[],so=null,gf=null,Gw=e=>io,Bv=Symbol.for("v-scx"),zv=()=>{{const e=dl(Bv);return e}},fl=new WeakMap,jv=Symbol("_vte"),Vv=e=>e.__isTeleport,hl=e=>e&&(e.disabled||e.disabled===""),Ww=e=>e&&(e.defer||e.defer===""),Uv=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Hv=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,hp=(e,t)=>{const n=e&&e.to;return Kn(n)?t?t(n):null:n},Kw={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,u){const{mc:d,pc:f,pbc:p,o:{insert:m,querySelector:g,createText:v,createComment:C}}=u,w=hl(t.props);let{dynamicChildren:_}=t;const y=(M,B,W)=>{M.shapeFlag&16&&d(M.children,B,W,o,i,s,a,l)},k=(M=t)=>{const B=hl(M.props),W=M.target=hp(M.props,g),z=yv(W,M,v,m);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),B||(y(M,W,z),af(M,!1)))},T=M=>{const B=()=>{fl.get(M)===B&&(fl.delete(M),hl(M.props)&&(y(M,n,M.anchor),af(M,!0)),k(M))};fl.set(M,B),jr(B,i)};if(e==null){const M=t.el=v(""),B=t.anchor=v("");if(m(M,n,r),m(B,n,r),Ww(t.props)||i&&i.pendingBranch){T(t);return}w&&(y(t,n,B),af(t,!0)),k()}else{t.el=e.el;const M=t.anchor=e.anchor,B=fl.get(e);if(B){B.flags|=8,fl.delete(e),T(t);return}t.targetStart=e.targetStart;const W=t.target=e.target,z=t.targetAnchor=e.targetAnchor,V=hl(e.props),Z=V?n:W,R=V?M:z;if(s==="svg"||Uv(W)?s="svg":(s==="mathml"||Hv(W))&&(s="mathml"),_?(p(e.dynamicChildren,_,Z,o,i,s,a),Lv(e,t,!0)):l||f(e,t,Z,R,o,i,s,a,!1),w)V?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):np(t,n,M,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const K=t.target=hp(t.props,g);K&&np(t,K,null,u,0)}else V&&np(t,W,z,u,1);af(t,w)}},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 m=i||!hl(p);const g=fl.get(e);if(g&&(g.flags|=8,fl.delete(e),m=!1),f&&(o(u),o(d)),i&&o(l),s&16)for(let v=0;v<a.length;v++){const C=a[v];r(C,t,n,m,!!C.dynamicChildren)}},move:np,hydrate:XT},pl=Kw,ls=Symbol("_leaveCb"),bu=Symbol("_enterCb"),yi=[Function,Array],pp={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:yi,onEnter:yi,onAfterEnter:yi,onEnterCancelled:yi,onBeforeLeave:yi,onLeave:yi,onAfterLeave:yi,onLeaveCancelled:yi,onBeforeAppear:yi,onAppear:yi,onAfterAppear:yi,onAppearCancelled:yi},$v=e=>{const t=e.subTree;return t.component?$v(t.component):t},qw={name:"BaseTransition",props:pp,setup(e,{slots:t}){const n=hr(),r=bv();return()=>{const o=t.default&&rp(t.default(),!0);if(!o||!o.length)return;const i=tw(o),s=yn(e),{mode:a}=s;if(r.isLeaving)return wv(i);const l=rw(i);if(!l)return wv(i);let u=hu(l,s,r,n,f=>u=f);l.type!==Tr&&Sa(l,u);let d=n.subTree&&rw(n.subTree);if(d&&d.type!==Tr&&!is(d,l)&&$v(n).type!==Tr){let f=hu(d,s,r,n);if(Sa(d,f),a==="out-in"&&l.type!==Tr)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!==Tr?f.delayLeave=(p,m,g)=>{const v=nw(r,d);v[String(d.key)]=d,p[ls]=()=>{m(),p[ls]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{g(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return i}}},Gv=qw,vf=new WeakMap,Wv=!1,gc=()=>{Wv||(console.error("Hydration completed but contains mismatches."),Wv=!0)},Yw=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",Xw=e=>e.namespaceURI.includes("MathML"),yf=e=>{if(e.nodeType===1){if(Yw(e))return"svg";if(Xw(e))return"mathml"}},vc=e=>e.nodeType===8,Kv="data-allow-mismatch",Zw={0:"text",1:"children",2:"class",3:"style",4:"attribute"},Qw=Kd().requestIdleCallback||(e=>setTimeout(e,1)),Jw=Kd().cancelIdleCallback||(e=>clearTimeout(e)),eC=(e=1e4)=>t=>{const n=Qw(t,{timeout:e});return()=>Jw(n)},tC=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(ex(o))return t(),r.disconnect(),!1;r.observe(o)}}),()=>r.disconnect()},nC=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},rC=(e=[])=>(t,n)=>{Kn(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},Ps=e=>!!e.type.__asyncLoader,wu=e=>e.type.__isKeepAlive,oC={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=hr(),r=n.ctx;if(!r.renderer)return()=>{const _=t.default&&t.default();return _&&_.length===1?_[0]:_};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=(_,y,k,T,M)=>{const B=_.component;u(_,y,k,0,a),l(B.vnode,_,y,k,B,a,T,_.slotScopeIds,M),jr(()=>{B.isDeactivated=!1,B.a&&cc(B.a);const W=_.props&&_.props.onVnodeMounted;W&&ri(W,B.parent,_)},a)},r.deactivate=_=>{const y=_.component;fp(y.m),fp(y.a),u(_,p,null,1,a),jr(()=>{y.da&&cc(y.da);const k=_.props&&_.props.onVnodeUnmounted;k&&ri(k,y.parent,_),y.isDeactivated=!0},a)};function m(_){_v(_),d(_,n,a,!0)}function g(_){o.forEach((y,k)=>{const T=Pv(Ps(y)?y.type.__asyncResolved||{}:y.type);T&&!_(T)&&v(k)})}function v(_){const y=o.get(_);y&&(!s||!is(y,s))?m(y):s&&_v(s),o.delete(_),i.delete(_)}Vt(()=>[e.include,e.exclude],([_,y])=>{_&&g(k=>lf(_,k)),y&&g(k=>!lf(y,k))},{flush:"post",deep:!0});let C=null;const w=()=>{C!=null&&(Cf(n.subTree.type)?jr(()=>{o.set(C,sp(n.subTree))},n.subTree.suspense):o.set(C,sp(n.subTree)))};return Bn(w),bf(w),ar(()=>{o.forEach(_=>{const{subTree:y,suspense:k}=n,T=sp(y);if(_.type===T.type&&_.key===T.key){_v(T);const M=T.component.da;M&&jr(M,k);return}m(_)})}),()=>{if(C=null,!t.default)return s=null;const _=t.default(),y=_[0];if(_.length>1)return s=null,_;if(!_a(y)||!(y.shapeFlag&4)&&!(y.shapeFlag&128))return s=null,y;let k=sp(y);if(k.type===Tr)return s=null,k;const T=k.type,M=Pv(Ps(k)?k.type.__asyncResolved||{}:T),{include:B,exclude:W,max:z}=e;if(B&&(!M||!lf(B,M))||W&&M&&lf(W,M))return k.shapeFlag&=-257,s=k,y;const V=k.key==null?T:k.key,Z=o.get(V);return k.el&&(k=Ds(k),y.shapeFlag&128&&(y.ssContent=k)),C=V,Z?(k.el=Z.el,k.component=Z.component,k.transition&&Sa(k,k.transition),k.shapeFlag|=512,i.delete(V),i.add(V)):(i.add(V),z&&i.size>parseInt(z,10)&&v(i.values().next().value)),k.shapeFlag|=256,s=k,Cf(y.type)?y:k}}},Fs=e=>(t,n=ao)=>{(!yl||e==="sp")&&ap(e,(...r)=>t(...r),n)},qv=Fs("bm"),Bn=Fs("m"),mp=Fs("bu"),bf=Fs("u"),ar=Fs("bum"),wf=Fs("um"),Yv=Fs("sp"),Xv=Fs("rtg"),Zv=Fs("rtc"),gp="components",iC="directives",Qv=Symbol.for("v-ndc"),vp=e=>e?Bw(e)?hf(e):vp(e.parent):null,Cu=$n(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=>vp(e.parent),$root:e=>vp(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=>YT.bind(e)}),yp=(e,t)=>e!==On&&!e.__isScriptSetup&&Un(e,t),bp={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(yp(r,t))return s[t]=1,r[t];if(o!==On&&Un(o,t))return s[t]=2,o[t];if(Un(i,t))return s[t]=3,i[t];if(n!==On&&Un(n,t))return s[t]=4,n[t];wp&&(s[t]=0)}}const u=Cu[t];let d,f;if(u)return t==="$attrs"&&Do(e.attrs,"get",""),u(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==On&&Un(n,t))return s[t]=4,n[t];if(f=l.config.globalProperties,Un(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return yp(o,t)?(o[t]=n,!0):r!==On&&Un(r,t)?(r[t]=n,!0):Un(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!==On&&a[0]!=="$"&&Un(e,a)||yp(t,a)||Un(i,a)||Un(r,a)||Un(Cu,a)||Un(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Un(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},sC=$n({},bp,{get(e,t){if(t!==Symbol.unscopables)return bp.get(e,t,e)},has(e,t){return t[0]!=="_"&&!l1(t)}}),wp=!0,aC={data:gw,props:vw,emits:vw,methods:uf,computed:uf,beforeCreate:Wo,created:Wo,beforeMount:Wo,mounted:Wo,beforeUpdate:Wo,updated:Wo,beforeDestroy:Wo,beforeUnmount:Wo,destroyed:Wo,unmounted:Wo,activated:Wo,deactivated:Wo,errorCaptured:Wo,serverPrefetch:Wo,components:uf,directives:uf,watch:wx,provide:gw,inject:bx},lC=0,ml=null,Jv=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Nr(t)}Modifiers`]||e[`${Go(t)}Modifiers`],cC=new WeakMap,uC=e=>{let t;for(const n in e)(n==="class"||n==="style"||iu(n))&&((t||(t={}))[n]=e[n]);return t},dC=(e,t)=>{const n={};for(const r in e)(!Vd(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},ey={},ty=()=>Object.create(ey),ny=e=>Object.getPrototypeOf(e)===ey,fC=new WeakMap,Cp=e=>e==="_"||e==="_ctx"||e==="$stable",kp=e=>jt(e)?e.map(ni):[ni(e)],hC=(e,t,n)=>{if(t._n)return t;const r=io((...o)=>kp(t(...o)),n);return r._c=!1,r},ry=(e,t,n)=>{const r=e._ctx;for(const o in e){if(Cp(o))continue;const i=e[o];if(Jt(i))t[o]=hC(o,i,r);else if(i!=null){const s=kp(i);t[o]=()=>s}}},oy=(e,t)=>{const n=kp(t);e.slots.default=()=>n},iy=(e,t,n)=>{for(const r in t)(n||!Cp(r))&&(e[r]=t[r])},pC=(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)},mC=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=On;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)!Cp(a)&&s[a]==null&&delete o[a]},jr=Dw,Cf=e=>e.__isSuspense,Sp=0,gC={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,u){if(e==null)xx(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}Rx(e,t,n,r,o,s,a,l,u)}},hydrate:Mx,normalize:Lx},qt=Symbol.for("v-fgt"),Ea=Symbol.for("v-txt"),Tr=Symbol.for("v-cmt"),gl=Symbol.for("v-stc"),ku=[],Co=null,vl=1,sy=({key:e})=>e??null,kf=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Kn(e)||sr(e)||Jt(e)?{i:so,r:e,k:t,f:!!n}:e:null),Qt=Px,vC=yw(),yC=0,ao=null,hr=()=>ao||so;{const e=Kd(),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)}};_p=t("__VUE_INSTANCE_SETTERS__",n=>ao=n),Su=t("__VUE_SSR_SETTERS__",n=>yl=n)}yc=e=>{const t=ao;return _p(e),e.scope.on(),()=>{e.scope.off(),_p(t)}},_u=()=>{ao&&ao.scope.off(),_p(null)},yl=!1,bC=()=>!Ap,wC={get(e,t){return Do(e,"get",""),e[t]}},Se=(e,t)=>FT(e,t,yl),ly="3.5.32",CC=vi,kC=$w,SC=yu,_C=X1,AC={createComponentInstance:Nw,setupComponent:zw,renderComponentRoot:up,setCurrentRenderingInstance:of,isVNode:_a,normalizeVNode:ni,getComponentPublicInstance:hf,ensureValidVNode:Ev,pushWarningContext:jT,popWarningContext:VT},Ux=null,Hx=null,$x=null}));function EC(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:m=`${n}-leave-to`}=e,g=Gx(o),v=g&&g[0],C=g&&g[1],{onBeforeEnter:w,onEnter:_,onEnterCancelled:y,onLeave:k,onLeaveCancelled:T,onBeforeAppear:M=w,onAppear:B=_,onAppearCancelled:W=y}=t,z=(R,K,x,G)=>{R._enterCancelled=G,bl(R,K?d:a),bl(R,K?u:s),x&&x()},V=(R,K)=>{R._isLeaving=!1,bl(R,f),bl(R,m),bl(R,p),K&&K()},Z=R=>(K,x)=>{const G=R?B:_,H=()=>z(K,R,x);wl(G,[K,H]),TC(()=>{bl(K,R?l:i),Ns(K,R?d:a),yy(G)||xC(K,r,v,H)})};return $n(t,{onBeforeEnter(R){wl(w,[R]),Ns(R,i),Ns(R,s)},onBeforeAppear(R){wl(M,[R]),Ns(R,l),Ns(R,u)},onEnter:Z(!1),onAppear:Z(!0),onLeave(R,K){R._isLeaving=!0;const x=()=>V(R,K);Ns(R,f),R._enterCancelled?(Ns(R,p),uy(R)):(uy(R),Ns(R,p)),TC(()=>{R._isLeaving&&(bl(R,f),Ns(R,m),yy(k)||xC(R,r,C,x))}),wl(k,[R,x])},onEnterCancelled(R){z(R,!1,void 0,!0),wl(y,[R])},onAppearCancelled(R){z(R,!0,void 0,!0),wl(W,[R])},onLeaveCancelled(R){V(R),wl(T,[R])}})}function Gx(e){if(e==null)return null;if(Nn(e))return[cy(e.enter),cy(e.leave)];{const t=cy(e);return[t,t]}}function cy(e){return Wd(e)}function Ns(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[bc]||(e[bc]=new Set)).add(t)}function bl(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[bc];n&&(n.delete(t),n.size||(e[bc]=void 0))}function TC(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function xC(e,t,n,r){const o=e._endId=++ZC,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=RC(e,t);if(!s)return r();const u=s+"end";let d=0;const f=()=>{e.removeEventListener(u,p),i()},p=m=>{m.target===e&&++d>=l&&f()};setTimeout(()=>{d<l&&f()},a+1),e.addEventListener(u,p)}function RC(e,t){const n=window.getComputedStyle(e),r=g=>(n[g]||"").split(", "),o=r(`${xa}Delay`),i=r(`${xa}Duration`),s=MC(o,i),a=r(`${Iu}Delay`),l=r(`${Iu}Duration`),u=MC(a,l);let d=null,f=0,p=0;t===xa?s>0&&(d=xa,f=s,p=i.length):t===Iu?u>0&&(d=Iu,f=u,p=l.length):(f=Math.max(s,u),d=f>0?s>u?xa:Iu:null,p=d?d===xa?i.length:l.length:0);const m=d===xa&&/\b(?:transform|all)(?:,|$)/.test(r(`${xa}Property`).toString());return{type:d,timeout:f,propCount:p,hasTransform:m}}function MC(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>LC(n)+LC(e[r])))}function LC(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function uy(e){return(e?e.ownerDocument:document).body.offsetHeight}function Wx(e,t,n){const r=e[bc];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function Sf(e,t){e.style.display=t?e[_f]:"none",e[by]=!t}function Kx(){wy.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function qx(e){const t=hr();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>Ip(i,o))},r=()=>{const o=e(t.proxy);t.ce?Ip(t.ce,o):dy(t.subTree,o),n(o)};mp(()=>{rf(r)}),Bn(()=>{Vt(r,vi,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),wf(()=>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)Ip(e.el,t);else if(e.type===qt)e.children.forEach(n=>dy(n,t));else if(e.type===gl){let{el:n,anchor:r}=e;for(;n&&(Ip(n,t),n!==r);)n=n.nextSibling}}function Ip(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=kT(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[Cy]=r}}function Yx(e,t,n){const r=e.style,o=Kn(n);let i=!1;if(n&&!o){if(t)if(Kn(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&Ep(r,a,"")}else for(const s in t)n[s]==null&&Ep(r,s,"");for(const s in n)s==="display"&&(i=!0),Ep(r,s,n[s])}else if(o){if(t!==n){const s=r[Cy];s&&(n+=";"+s),r.cssText=n,i=QC.test(n)}}else t&&e.removeAttribute("style");_f in e&&(e[_f]=i?r.display:"",e[by]&&(r.display="none"))}function Ep(e,t,n){if(jt(n))n.forEach(r=>Ep(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=Xx(e,t);ky.test(n)?e.setProperty(Go(r),n.replace(ky,""),"important"):e[r]=n}}function Xx(e,t){const n=Mp[t];if(n)return n;let r=Nr(t);if(r!=="filter"&&r in e)return Mp[t]=r;r=su(r);for(let o=0;o<Sy.length;o++){const i=Sy[o]+r;if(i in e)return Mp[t]=i}return t}function DC(e,t,n,r,o,i=f1(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(_y,t.slice(6,t.length)):e.setAttributeNS(_y,t,n):n==null||i&&!t1(n)?e.removeAttribute(t):e.setAttribute(t,i?"":ei(n)?String(n):n)}function OC(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=t1(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 Ta(e,t,n,r){e.addEventListener(t,n,r)}function Zx(e,t,n,r){e.removeEventListener(t,n,r)}function Qx(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]=Jx(t);r?Ta(e,a,i[t]=e5(r,o),l):s&&(Zx(e,a,s,l),i[t]=void 0)}}function Jx(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):Go(e.slice(2)),t]}function e5(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;zi(t5(r,n.value),t,5,[r])};return n.value=e,n.attached=ek(),n}function t5(e,t){if(jt(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 n5(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ey(t)&&Jt(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)&&Kn(n)?!1:t in e}function r5(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 PC(e,t,n){let r=fc(e,t);Ud(r)&&(r=$n({},r,t));class o extends Ry{constructor(s){super(r,s,n)}}return o.def=r,o}function FC(e){const t=hr(),n=t&&t.ce;return n||null}function o5(){const e=FC();return e&&e.shadowRoot}function i5(e="$style"){{const t=hr();if(!t)return On;const n=t.type.__cssModules;if(!n)return On;const r=n[e];return r||On}}function s5(e){const t=e.el;t[Af]&&t[Af](),t[Dy]&&t[Dy]()}function a5(e){Ly.set(e,NC(e.el))}function l5(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 NC(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function c5(e,t,n){const r=e.cloneNode(),o=e[bc];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}=RC(r);return i.removeChild(r),s}function u5(e){e.target.composing=!0}function BC(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function zC(e,t,n){return t&&(e=e.trim()),n&&(e=Gd(e)),e}function jC(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(jt(t))o=Uh(t,r.props.value)>-1;else if(ll(t))o=t.has(r.props.value);else{if(t===n)return;o=ma(t,UC(e,!0))}e.checked!==o&&(e.checked=o)}function VC(e,t){const n=e.multiple,r=jt(t);if(!(n&&!r&&!ll(t))){for(let o=0,i=e.options.length;o<i;o++){const s=e.options[o],a=Au(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(u=>String(u)===String(a)):s.selected=Uh(t,a)>-1}else s.selected=t.has(a);else if(ma(Au(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Au(e){return"_value"in e?e._value:e.value}function UC(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function HC(e,t){switch(e){case"SELECT":return Oy;case"TEXTAREA":return ji;default:switch(t){case"checkbox":return Dp;case"radio":return Op;default:return ji}}}function Tp(e,t,n,r,o){const i=HC(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function d5(){ji.getSSRProps=({value:e})=>({value:e}),Op.getSSRProps=({value:e},t)=>{if(t.props&&ma(t.props.value,e))return{checked:!0}},Dp.getSSRProps=({value:e},t)=>{if(jt(e)){if(t.props&&Uh(e,t.props.value)>-1)return{checked:!0}}else if(ll(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=HC(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function $C(){return If||(If=Aw(Fy))}function GC(){return If=Ny?If:Iw(Fy),Ny=!0,If}function WC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function KC(e){return Kn(e)?document.querySelector(e):e}var xp,fy,hy,qC,YC,Bs,py,my,xa,Iu,bc,gy,vy,XC,Rp,wl,yy,ZC,_f,by,wy,Cy,QC,ky,Sy,Mp,_y,Ay,Iy,Lp,JC,ek,Ey,Ty,xy,tk,nk,Ry,My,Ly,Af,Dy,rk,ok,Ra,bi,ji,Dp,Op,Oy,Py,ik,sk,en,ak,oi,Fy,If,Ny,By,lk,wc,zy,jy,ck,f5=Er((()=>{if(IC(),IC(),Xg(),xp=void 0,fy=typeof window<"u"&&window.trustedTypes,fy)try{xp=fy.createPolicy("vue",{createHTML:e=>e})}catch{}hy=xp?e=>xp.createHTML(e):e=>e,qC="http://www.w3.org/2000/svg",YC="http://www.w3.org/1998/Math/MathML",Bs=typeof document<"u"?document:null,py=Bs&&Bs.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"?Bs.createElementNS(qC,e):t==="mathml"?Bs.createElementNS(YC,e):n?Bs.createElement(e,{is:n}):Bs.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Bs.createTextNode(e),createComment:e=>Bs.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Bs.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]}},xa="transition",Iu="animation",bc=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=$n({},pp,gy),XC=e=>(e.displayName="Transition",e.props=vy,e),Rp=XC((e,{slots:t})=>zr(Gv,EC(e),t)),wl=(e,t=[])=>{jt(e)?e.forEach(n=>n(...t)):e&&e(...t)},yy=e=>e?jt(e)?e.some(t=>t.length>1):e.length>1:!1,ZC=0,_f=Symbol("_vod"),by=Symbol("_vsh"),wy={name:"show",beforeMount(e,{value:t},{transition:n}){e[_f]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Sf(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),Sf(e,!0),r.enter(e)):r.leave(e,()=>{Sf(e,!1)}):Sf(e,t))},beforeUnmount(e,{value:t}){Sf(e,t)}},Cy=Symbol(""),QC=/(?:^|;)\s*display\s*:/,ky=/\s*!important$/,Sy=["Webkit","Moz","ms"],Mp={},_y="http://www.w3.org/1999/xlink",Ay=Symbol("_vei"),Iy=/(?:Once|Passive|Capture)$/,Lp=0,JC=Promise.resolve(),ek=()=>Lp||(JC.then(()=>Lp=0),Lp=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"?Wx(e,r,s):t==="style"?Yx(e,n,r):iu(t)?Vd(t)||Qx(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):n5(e,t,r,s))?(OC(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&DC(e,t,r,s,i,t!=="value")):e._isVueCE&&(r5(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Kn(r)))?OC(e,Nr(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),DC(e,t,r,s))},xy={},tk=((e,t)=>PC(e,t,zy)),nk=typeof HTMLElement<"u"?HTMLElement:class{},Ry=class GE extends nk{constructor(t,n={},r=wc){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!==wc?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow($n({},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 GE){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&&!jt(i))for(const l in i){const u=i[l];(u===Number||u&&u.type===Number)&&(l in this._props&&(this._props[l]=Wd(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)Un(this,r)||Object.defineProperty(this,r,{get:()=>Qe(n[r])})}_resolveProps(t){const{props:n}=t,r=jt(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=Wd(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(Go(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(Go(t),n+""):n||this.removeAttribute(Go(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=Qt(this._def,$n(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,Ud(s[0])?$n({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),Go(i)!==i&&o(Go(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,Af=Symbol("_moveCb"),Dy=Symbol("_enterCb"),rk=e=>(delete e.props.mode,e),ok=rk({name:"TransitionGroup",props:$n({},vy,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=hr(),r=bv();let o,i;return bf(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!c5(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(s5),o.forEach(a5);const a=o.filter(l5);uy(n.vnode.el),a.forEach(l=>{const u=l.el,d=u.style;Ns(u,s),d.transform=d.webkitTransform=d.transitionDuration="";const f=u[Af]=p=>{p&&p.target!==u||(!p||p.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",f),u[Af]=null,bl(u,s))};u.addEventListener("transitionend",f)}),o=[]}),()=>{const s=yn(e),a=EC(s);let l=s.tag||qt;if(o=[],i)for(let u=0;u<i.length;u++){const d=i[u];d.el&&d.el instanceof Element&&(o.push(d),Sa(d,hu(d,a,r,n)),My.set(d,NC(d.el)))}i=t.default?rp(t.default()):[];for(let u=0;u<i.length;u++){const d=i[u];d.key!=null&&Sa(d,hu(d,a,r,n))}return Qt(l,null,i)}}}),Ra=e=>{const t=e.props["onUpdate:modelValue"]||!1;return jt(t)?n=>cc(t,n):t},bi=Symbol("_assign"),ji={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[bi]=Ra(o);const i=r||o.props&&o.props.type==="number";Ta(e,t?"change":"input",s=>{s.target.composing||e[bi](zC(e.value,n,i))}),(n||i)&&Ta(e,"change",()=>{e.value=zC(e.value,n,i)}),t||(Ta(e,"compositionstart",u5),Ta(e,"compositionend",BC),Ta(e,"change",BC))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[bi]=Ra(s),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?Gd(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)}},Dp={deep:!0,created(e,t,n){e[bi]=Ra(n),Ta(e,"change",()=>{const r=e._modelValue,o=Au(e),i=e.checked,s=e[bi];if(jt(r)){const a=Uh(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(ll(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(UC(e,i))})},mounted:jC,beforeUpdate(e,t,n){e[bi]=Ra(n),jC(e,t,n)}},Op={created(e,{value:t},n){e.checked=ma(t,n.props.value),e[bi]=Ra(n),Ta(e,"change",()=>{e[bi](Au(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[bi]=Ra(r),t!==n&&(e.checked=ma(t,r.props.value))}},Oy={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=ll(t);Ta(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?Gd(Au(s)):Au(s));e[bi](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,St(()=>{e._assigning=!1})}),e[bi]=Ra(r)},mounted(e,{value:t}){VC(e,t)},beforeUpdate(e,t,n){e[bi]=Ra(n)},updated(e,{value:t}){e._assigning||VC(e,t)}},Py={created(e,t,n){Tp(e,t,n,null,"created")},mounted(e,t,n){Tp(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){Tp(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){Tp(e,t,n,r,"updated")}},ik=["ctrl","shift","alt","meta"],sk={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)=>ik.some(n=>e[`${n}Key`]&&!t.includes(n))},en=(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=sk[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},ak={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},oi=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=Go(o.key);if(t.some(s=>s===i||ak[s]===i))return e(o)}))},Fy=$n({patchProp:Ty},my),Ny=!1,By=((...e)=>{$C().render(...e)}),lk=((...e)=>{GC().hydrate(...e)}),wc=((...e)=>{const t=$C().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=KC(r);if(!o)return;const i=t._component;!Jt(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,WC(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),zy=((...e)=>{const t=GC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=KC(r);if(o)return n(o,!0,WC(o))},t}),jy=!1,ck=()=>{jy||(jy=!0,d5(),Kx())}})),h5=Nd({BaseTransition:()=>Gv,BaseTransitionPropsValidators:()=>pp,Comment:()=>Tr,DeprecationTypes:()=>null,EffectScope:()=>Zh,ErrorCodes:()=>Hw,ErrorTypeStrings:()=>kC,Fragment:()=>qt,KeepAlive:()=>oC,ReactiveEffect:()=>cu,Static:()=>gl,Suspense:()=>gC,Teleport:()=>pl,Text:()=>Ea,TrackOpTypes:()=>G1,Transition:()=>Rp,TransitionGroup:()=>ok,TriggerOpTypes:()=>W1,VueElement:()=>Ry,assertNumber:()=>UT,callWithAsyncErrorHandling:()=>zi,callWithErrorHandling:()=>fu,camelize:()=>Nr,capitalize:()=>su,cloneVNode:()=>Ds,compatUtils:()=>null,compile:()=>uk,computed:()=>Se,createApp:()=>wc,createBlock:()=>cn,createCommentVNode:()=>vt,createElementBlock:()=>De,createElementVNode:()=>He,createHydrationRenderer:()=>Iw,createPropsRestProxy:()=>mx,createRenderer:()=>Aw,createSSRApp:()=>zy,createSlots:()=>ox,createStaticVNode:()=>Fx,createTextVNode:()=>ss,createVNode:()=>Qt,customRef:()=>S1,defineAsyncComponent:()=>sw,defineComponent:()=>fc,defineCustomElement:()=>PC,defineEmits:()=>ax,defineExpose:()=>lx,defineModel:()=>dx,defineOptions:()=>cx,defineProps:()=>sx,defineSSRCustomElement:()=>tk,defineSlots:()=>ux,devtools:()=>SC,effect:()=>AT,effectScope:()=>Zg,getCurrentInstance:()=>hr,getCurrentScope:()=>Qg,getCurrentWatcher:()=>NT,getTransitionRawChildren:()=>rp,guardReactiveProps:()=>Fw,h:()=>zr,handleError:()=>dc,hasInjectionContext:()=>Q1,hydrate:()=>lk,hydrateOnIdle:()=>eC,hydrateOnInteraction:()=>rC,hydrateOnMediaQuery:()=>nC,hydrateOnVisible:()=>tC,initCustomFormatter:()=>jx,initDirectivesForSSR:()=>ck,inject:()=>dl,isMemoSame:()=>Uw,isProxy:()=>Yd,isReactive:()=>Fi,isReadonly:()=>Ms,isRef:()=>sr,isRuntimeOnly:()=>bC,isShallow:()=>ti,isVNode:()=>_a,markRaw:()=>$r,mergeDefaults:()=>hx,mergeModels:()=>px,mergeProps:()=>Os,nextTick:()=>St,nodeOps:()=>my,normalizeClass:()=>tn,normalizeProps:()=>Ug,normalizeStyle:()=>wn,onActivated:()=>kv,onBeforeMount:()=>qv,onBeforeUnmount:()=>ar,onBeforeUpdate:()=>mp,onDeactivated:()=>Sv,onErrorCaptured:()=>lw,onMounted:()=>Bn,onRenderTracked:()=>Zv,onRenderTriggered:()=>Xv,onScopeDispose:()=>h1,onServerPrefetch:()=>Yv,onUnmounted:()=>wf,onUpdated:()=>bf,onWatcherCleanup:()=>I1,openBlock:()=>ye,patchProp:()=>Ty,popScopeId:()=>WT,provide:()=>Z1,proxyRefs:()=>iv,pushScopeId:()=>GT,queuePostFlushCb:()=>rf,reactive:()=>Zr,readonly:()=>Yh,ref:()=>re,registerRuntimeCompiler:()=>Bx,render:()=>By,renderList:()=>nr,renderSlot:()=>mu,resolveComponent:()=>rx,resolveDirective:()=>cw,resolveDynamicComponent:()=>Av,resolveFilter:()=>null,resolveTransitionHooks:()=>hu,setBlockTracking:()=>ff,setDevtoolsHook:()=>_C,setTransitionHooks:()=>Sa,shallowReactive:()=>C1,shallowReadonly:()=>DT,shallowRef:()=>Br,ssrContextKey:()=>Bv,ssrUtils:()=>AC,stop:()=>IT,toDisplayString:()=>$t,toHandlerKey:()=>au,toHandlers:()=>ix,toRaw:()=>yn,toRef:()=>sv,toRefs:()=>_1,toValue:()=>PT,transformVNodeArgs:()=>Ox,triggerRef:()=>OT,unref:()=>Qe,useAttrs:()=>fw,useCssModule:()=>i5,useCssVars:()=>qx,useHost:()=>FC,useId:()=>ZT,useModel:()=>kx,useSSRContext:()=>zv,useShadowRoot:()=>o5,useSlots:()=>dw,useTemplateRef:()=>QT,useTransitionState:()=>bv,vModelCheckbox:()=>Dp,vModelDynamic:()=>Py,vModelRadio:()=>Op,vModelSelect:()=>Oy,vModelText:()=>ji,vShow:()=>wy,version:()=>ly,warn:()=>CC,watch:()=>Vt,watchEffect:()=>KT,watchPostEffect:()=>qT,watchSyncEffect:()=>J1,withAsyncContext:()=>gx,withCtx:()=>io,withDefaults:()=>fx,withDirectives:()=>ka,withKeys:()=>oi,withMemo:()=>Vx,withModifiers:()=>en,withScopeId:()=>Gw}),uk,Bt=Er((()=>{f5(),uk=()=>{}})),p5=Y2(((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 m=o[u]={exports:{}};r[u][0].call(m.exports,function(g){var v=r[u][1][g];return s(v||g)},m,m.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,m,g,v,C=[],w=0,_=l.length,y=_,k=i.getTypeOf(l)!=="string";w<l.length;)y=_-w,f=k?(u=l[w++],d=w<_?l[w++]:0,w<_?l[w++]:0):(u=l.charCodeAt(w++),d=w<_?l.charCodeAt(w++):0,w<_?l.charCodeAt(w++):0),p=u>>2,m=(3&u)<<4|d>>4,g=1<y?(15&d)<<2|f>>6:64,v=2<y?63&f:64,C.push(a.charAt(p)+a.charAt(m)+a.charAt(g)+a.charAt(v));return C.join("")},o.decode=function(l){var u,d,f,p,m,g,v=0,C=0,w="data:";if(l.substr(0,w.length)===w)throw new Error("Invalid base64 input, it looks like a data url.");var _,y=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&y--,l.charAt(l.length-2)===a.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(_=s.uint8array?new Uint8Array(0|y):new Array(0|y);v<l.length;)u=a.indexOf(l.charAt(v++))<<2|(p=a.indexOf(l.charAt(v++)))>>4,d=(15&p)<<4|(m=a.indexOf(l.charAt(v++)))>>2,f=(3&m)<<6|(g=a.indexOf(l.charAt(v++))),_[C++]=u,m!==64&&(_[C++]=d),g!==64&&(_[C++]=f);return _}},{"./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,m,g){this.compressedSize=d,this.uncompressedSize=f,this.crc32=p,this.compression=m,this.compressedContent=g}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 m=s,g=p+f;u^=-1;for(var v=p;v<g;v++)u=u>>>8^m[255&(u^d[v])];return-1^u})(0|l,a,a.length,0):(function(u,d,f,p){var m=s,g=p+f;u^=-1;for(var v=p;v<g;v++)u=u>>>8^m[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(m,g){var v,C="";for(v=0;v<g;v++)C+=String.fromCharCode(255&m),m>>>=8;return C}function s(m,g,v,C,w,_){var y,k,T=m.file,M=m.compression,B=_!==u.utf8encode,W=a.transformTo("string",_(T.name)),z=a.transformTo("string",u.utf8encode(T.name)),V=T.comment,Z=a.transformTo("string",_(V)),R=a.transformTo("string",u.utf8encode(V)),K=z.length!==T.name.length,x=R.length!==V.length,G="",H="",J="",Q=T.dir,X=T.date,Te={crc32:0,compressedSize:0,uncompressedSize:0};g&&!v||(Te.crc32=m.crc32,Te.compressedSize=m.compressedSize,Te.uncompressedSize=m.uncompressedSize);var de=0;g&&(de|=8),B||!K&&!x||(de|=2048);var ge=0,ve=0;Q&&(ge|=16),w==="UNIX"?(ve=798,ge|=(function(Be,tt){var ut=Be;return Be||(ut=tt?16893:33204),(65535&ut)<<16})(T.unixPermissions,Q)):(ve=20,ge|=(function(Be){return 63&(Be||0)})(T.dosPermissions)),y=X.getUTCHours(),y<<=6,y|=X.getUTCMinutes(),y<<=5,y|=X.getUTCSeconds()/2,k=X.getUTCFullYear()-1980,k<<=4,k|=X.getUTCMonth()+1,k<<=5,k|=X.getUTCDate(),K&&(H=i(1,1)+i(d(W),4)+z,G+="up"+i(H.length,2)+H),x&&(J=i(1,1)+i(d(Z),4)+R,G+="uc"+i(J.length,2)+J);var Re="";return Re+=`
4
- \0`,Re+=i(de,2),Re+=M.magic,Re+=i(y,2),Re+=i(k,2),Re+=i(Te.crc32,4),Re+=i(Te.compressedSize,4),Re+=i(Te.uncompressedSize,4),Re+=i(W.length,2),Re+=i(G.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Re+W+G,dirRecord:f.CENTRAL_FILE_HEADER+i(ve,2)+Re+i(Z.length,2)+"\0\0\0\0"+i(ge,4)+i(C,4)+W+G+Z}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(m,g,v,C){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=v,this.encodeFileName=C,this.streamFiles=m,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(m){var g=m.meta.percent||0,v=this.entriesCount,C=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,l.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:v?(g+100*(v-C-1))/v:100}}))},p.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var g=this.streamFiles&&!m.file.dir;if(g){var v=s(m,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(m){this.accumulate=!1;var g=this.streamFiles&&!m.file.dir,v=s(m,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),g)this.push({data:(function(C){return f.DATA_DESCRIPTOR+i(C.crc32,4)+i(C.compressedSize,4)+i(C.uncompressedSize,4)})(m),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 m=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var v=this.bytesWritten-m,C=(function(w,_,y,k,T){var M=a.transformTo("string",T(k));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(_,4)+i(y,4)+i(M.length,2)+M})(this.dirRecords.length,v,m,this.zipComment,this.encodeFileName);this.push({data:C,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(m){this._sources.push(m);var g=this;return m.on("data",function(v){g.processChunk(v)}),m.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),m.on("error",function(v){g.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(m){var g=this._sources;if(!l.prototype.error.call(this,m))return!1;for(var v=0;v<g.length;v++)try{g[v].error(m)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var m=this._sources,g=0;g<m.length;g++)m[g].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,m){f++;var g=(function(_,y){var k=_||y,T=i[k];if(!T)throw new Error(k+" is not a valid compression method !");return T})(m.options.compression,l.compression),v=m.options.compressionOptions||l.compressionOptions||{},C=m.dir,w=m.date;m._compressWorker(g,v).withStreamInfo("file",{name:p,dir:C,date:w,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.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(m,g){var v=p.decompressed.getContentWorker().pipe(new u);v.on("error",function(C){g(C)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):m()}).resume()})}r.exports=function(p,m){var g=this;return m=i.extend(m||{},{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,m.optimizedBinaryString,m.base64).then(function(v){var C=new l(m);return C.load(v),C}).then(function(v){var C=[s.Promise.resolve(v)],w=v.files;if(m.checkCRC32)for(var _=0;_<w.length;_++)C.push(f(w[_]));return s.Promise.all(C)}).then(function(v){for(var C=v.shift(),w=C.files,_=0;_<w.length;_++){var y=w[_],k=y.fileNameStr,T=i.resolve(y.fileNameStr);g.file(T,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:m.createFolders}),y.dir||(g.file(T).unsafeOriginalName=k)}return C.zipComment.length&&(g.comment=C.zipComment),g})}},{"./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(k,T,M){var B,W=a.getTypeOf(T),z=a.extend(M||{},d);z.date=z.date||new Date,z.compression!==null&&(z.compression=z.compression.toUpperCase()),typeof z.unixPermissions=="string"&&(z.unixPermissions=parseInt(z.unixPermissions,8)),z.unixPermissions&&16384&z.unixPermissions&&(z.dir=!0),z.dosPermissions&&16&z.dosPermissions&&(z.dir=!0),z.dir&&(k=w(k)),z.createFolders&&(B=C(k))&&_.call(this,B,!0);var V=W==="string"&&z.binary===!1&&z.base64===!1;M&&M.binary!==void 0||(z.binary=!V),(T instanceof f&&T.uncompressedSize===0||z.dir||!T||T.length===0)&&(z.base64=!1,z.binary=!0,T="",z.compression="STORE",W="string");var Z=null;Z=T instanceof f||T instanceof l?T:g.isNode&&g.isStream(T)?new v(k,T):a.prepareContent(k,T,z.binary,z.optimizedBinaryString,z.base64);var R=new p(k,Z,z);this.files[k]=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"),m=n("./generate"),g=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),C=function(k){k.slice(-1)==="/"&&(k=k.substring(0,k.length-1));var T=k.lastIndexOf("/");return 0<T?k.substring(0,T):""},w=function(k){return k.slice(-1)!=="/"&&(k+="/"),k},_=function(k,T){return T=T!==void 0?T:d.createFolders,k=w(k),this.files[k]||i.call(this,k,null,{dir:!0,createFolders:T}),this.files[k]};function y(k){return Object.prototype.toString.call(k)==="[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(k){var T,M,B;for(T in this.files)B=this.files[T],(M=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&k(M,B)},filter:function(k){var T=[];return this.forEach(function(M,B){k(M,B)&&T.push(B)}),T},file:function(k,T,M){if(arguments.length!==1)return k=this.root+k,i.call(this,k,T,M),this;if(y(k)){var B=k;return this.filter(function(z,V){return!V.dir&&B.test(z)})}var W=this.files[this.root+k];return W&&!W.dir?W:null},folder:function(k){if(!k)return this;if(y(k))return this.filter(function(W,z){return z.dir&&k.test(W)});var T=this.root+k,M=_.call(this,T),B=this.clone();return B.root=M.name,B},remove:function(k){k=this.root+k;var T=this.files[k];if(T||(k.slice(-1)!=="/"&&(k+="/"),T=this.files[k]),T&&!T.dir)delete this.files[k];else for(var M=this.filter(function(W,z){return z.name.slice(0,k.length)===k}),B=0;B<M.length;B++)delete this.files[M[B].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(k){var T,M={};try{if((M=a.extend(k||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=M.type.toLowerCase(),M.compression=M.compression.toUpperCase(),M.type==="binarystring"&&(M.type="string"),!M.type)throw new Error("No output type specified.");a.checkSupport(M.type),M.platform!=="darwin"&&M.platform!=="freebsd"&&M.platform!=="linux"&&M.platform!=="sunos"||(M.platform="UNIX"),M.platform==="win32"&&(M.platform="DOS");var B=M.comment||this.comment||"";T=m.generateWorker(this,M,B)}catch(W){(T=new l("error")).error(W)}return new u(T,M.type||"string",M.mimeType)},generateAsync:function(k,T){return this.generateInternalStream(k).accumulate(T)},generateNodeStream:function(k,T){return(k=k||{}).type||(k.type="nodebuffer"),this.generateInternalStream(k).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(g,v){return new d.Promise(function(C,w){var _=[],y=g._internalType,k=g._outputType,T=g._mimeType;g.on("data",function(M,B){_.push(M),v&&v(B)}).on("error",function(M){_=[],w(M)}).on("end",function(){try{C((function(M,B,W){switch(M){case"blob":return i.newBlob(i.transformTo("arraybuffer",B),W);case"base64":return l.encode(B);default:return i.transformTo(M,B)}})(k,(function(M,B){var W,z=0,V=null,Z=0;for(W=0;W<B.length;W++)Z+=B[W].length;switch(M){case"string":return B.join("");case"array":return Array.prototype.concat.apply([],B);case"uint8array":for(V=new Uint8Array(Z),W=0;W<B.length;W++)V.set(B[W],z),z+=B[W].length;return V;case"nodebuffer":return Buffer.concat(B);default:throw new Error("concat : unsupported type '"+M+"'")}})(y,_),T))}catch(M){w(M)}_=[]}).resume()})}function m(g,v,C){var w=v;switch(v){case"blob":case"arraybuffer":w="uint8array";break;case"base64":w="string"}try{this._internalType=w,this._outputType=v,this._mimeType=C,i.checkSupport(w),this._worker=g.pipe(new s(w)),g.lock()}catch(_){this._worker=new a("error"),this._worker.error(_)}}m.prototype={accumulate:function(g){return p(this,g)},on:function(g,v){var C=this;return g==="data"?this._worker.on(g,function(w){v.call(C,w.data,w.meta)}):this._worker.on(g,function(){i.delay(v,arguments,C)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){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"},g)}},r.exports=m},{"../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(m){return s.nodebuffer?a.newBufferFrom(m,"utf-8"):(function(g){var v,C,w,_,y,k=g.length,T=0;for(_=0;_<k;_++)(64512&(C=g.charCodeAt(_)))==55296&&_+1<k&&(64512&(w=g.charCodeAt(_+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),_++),T+=C<128?1:C<2048?2:C<65536?3:4;for(v=s.uint8array?new Uint8Array(T):new Array(T),_=y=0;y<T;_++)(64512&(C=g.charCodeAt(_)))==55296&&_+1<k&&(64512&(w=g.charCodeAt(_+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),_++),C<128?v[y++]=C:(C<2048?v[y++]=192|C>>>6:(C<65536?v[y++]=224|C>>>12:(v[y++]=240|C>>>18,v[y++]=128|C>>>12&63),v[y++]=128|C>>>6&63),v[y++]=128|63&C);return v})(m)},o.utf8decode=function(m){return s.nodebuffer?i.transformTo("nodebuffer",m).toString("utf-8"):(function(g){var v,C,w,_,y=g.length,k=new Array(2*y);for(v=C=0;v<y;)if((w=g[v++])<128)k[C++]=w;else if(4<(_=u[w]))k[C++]=65533,v+=_-1;else{for(w&=_===2?31:_===3?15:7;1<_&&v<y;)w=w<<6|63&g[v++],_--;1<_?k[C++]=65533:w<65536?k[C++]=w:(w-=65536,k[C++]=55296|w>>10&1023,k[C++]=56320|1023&w)}return k.length!==C&&(k.subarray?k=k.subarray(0,C):k.length=C),i.applyFromCharCode(k)})(m=i.transformTo(s.uint8array?"uint8array":"array",m))},i.inherits(f,l),f.prototype.processChunk=function(m){var g=i.transformTo(s.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=g;(g=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),g.set(v,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var C=(function(_,y){var k;for((y=y||_.length)>_.length&&(y=_.length),k=y-1;0<=k&&(192&_[k])==128;)k--;return k<0||k===0?y:k+u[_[k]]>y?k:y})(g),w=g;C!==g.length&&(s.uint8array?(w=g.subarray(0,C),this.leftOver=g.subarray(C,g.length)):(w=g.slice(0,C),this.leftOver=g.slice(C,g.length))),this.push({data:o.utf8decode(w),meta:m.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(m){this.push({data:o.utf8encode(m.data),meta:m.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,C){for(var w=0;w<v.length;++w)C[w]=255&v.charCodeAt(w);return C}n("setimmediate"),o.newBlob=function(v,C){o.checkSupport("blob");try{return new Blob([v],{type:C})}catch{try{var w=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return w.append(v),w.getBlob(C)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(v,C,w){var _=[],y=0,k=v.length;if(k<=w)return String.fromCharCode.apply(null,v);for(;y<k;)C==="array"||C==="nodebuffer"?_.push(String.fromCharCode.apply(null,v.slice(y,Math.min(y+w,k)))):_.push(String.fromCharCode.apply(null,v.subarray(y,Math.min(y+w,k)))),y+=w;return _.join("")},stringifyByChar:function(v){for(var C="",w=0;w<v.length;w++)C+=String.fromCharCode(v[w]);return C},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 C=65536,w=o.getTypeOf(v),_=!0;if(w==="uint8array"?_=f.applyCanBeUsed.uint8array:w==="nodebuffer"&&(_=f.applyCanBeUsed.nodebuffer),_)for(;1<C;)try{return f.stringifyByChunk(v,w,C)}catch{C=Math.floor(C/2)}return f.stringifyByChar(v)}function m(v,C){for(var w=0;w<v.length;w++)C[w]=v[w];return C}o.applyFromCharCode=p;var g={};g.string={string:u,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return g.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},g.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)}},g.arraybuffer={string:function(v){return p(new Uint8Array(v))},array:function(v){return m(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))}},g.uint8array={string:p,array:function(v){return m(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return a.newBufferFrom(v)}},g.nodebuffer={string:p,array:function(v){return m(v,new Array(v.length))},arraybuffer:function(v){return g.nodebuffer.uint8array(v).buffer},uint8array:function(v){return m(v,new Uint8Array(v.length))},nodebuffer:u},o.transformTo=function(v,C){return C=C||"",v?(o.checkSupport(v),g[o.getTypeOf(C)][v](C)):C},o.resolve=function(v){for(var C=v.split("/"),w=[],_=0;_<C.length;_++){var y=C[_];y==="."||y===""&&_!==0&&_!==C.length-1||(y===".."?w.pop():w.push(y))}return w.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 C,w,_="";for(w=0;w<(v||"").length;w++)_+="\\x"+((C=v.charCodeAt(w))<16?"0":"")+C.toString(16).toUpperCase();return _},o.delay=function(v,C,w){setImmediate(function(){v.apply(w||null,C||[])})},o.inherits=function(v,C){function w(){}w.prototype=C.prototype,v.prototype=new w},o.extend=function(){var v,C,w={};for(v=0;v<arguments.length;v++)for(C in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],C)&&w[C]===void 0&&(w[C]=arguments[v][C]);return w},o.prepareContent=function(v,C,w,_,y){return l.Promise.resolve(C).then(function(k){return i.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,M){var B=new FileReader;B.onload=function(W){T(W.target.result)},B.onerror=function(W){M(W.target.error)},B.readAsArrayBuffer(k)}):k}).then(function(k){var T=o.getTypeOf(k);return T?(T==="arraybuffer"?k=o.transformTo("uint8array",k):T==="string"&&(y?k=s.decode(k):w&&_!==!0&&(k=(function(M){return d(M,i.uint8array?new Uint8Array(M.length):new Array(M.length))})(k))),k):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 m=this.reader.index;this.reader.setIndex(f);var g=this.reader.readString(4)===p;return this.reader.setIndex(m),g},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",m=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(m)},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,m,g=this.zip64EndOfCentralSize-44;0<g;)f=this.reader.readInt(2),p=this.reader.readInt(4),m=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:m}},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 m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var g=p-m;if(0<g)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" 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(m,g){this.options=m,this.loadOptions=g}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(m){var g,v;if(m.skip(22),this.fileNameLength=m.readInt(2),v=m.readInt(2),this.fileName=m.readData(this.fileNameLength),m.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((g=(function(C){for(var w in d)if(Object.prototype.hasOwnProperty.call(d,w)&&d[w].magic===C)return d[w];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,g,m.readData(this.compressedSize))},readCentralPart:function(m){this.versionMadeBy=m.readInt(2),m.skip(2),this.bitFlag=m.readInt(2),this.compressionMethod=m.readString(2),this.date=m.readDate(),this.crc32=m.readInt(4),this.compressedSize=m.readInt(4),this.uncompressedSize=m.readInt(4);var g=m.readInt(2);if(this.extraFieldsLength=m.readInt(2),this.fileCommentLength=m.readInt(2),this.diskNumberStart=m.readInt(2),this.internalFileAttributes=m.readInt(2),this.externalFileAttributes=m.readInt(4),this.localHeaderOffset=m.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");m.skip(g),this.readExtraFields(m),this.parseZIP64ExtraField(m),this.fileComment=m.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var m=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var g,v,C,w=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4<w;)g=m.readInt(2),v=m.readInt(2),C=m.readData(v),this.extraFields[g]={id:g,length:v,value:C};m.setIndex(w)},handleUTF8:function(){var m=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var v=s.transformTo(m,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var C=this.findExtraFieldUnicodeComment();if(C!==null)this.fileCommentStr=C;else{var w=s.transformTo(m,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var m=this.extraFields[28789];if(m){var g=i(m.value);return g.readInt(1)!==1||l(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(m.length-5))}return null},findExtraFieldUnicodeComment:function(){var m=this.extraFields[25461];if(m){var g=i(m.value);return g.readInt(1)!==1||l(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(m.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(g,v,C){this.name=g,this.dir=C.dir,this.date=C.date,this.comment=C.comment,this.unixPermissions=C.unixPermissions,this.dosPermissions=C.dosPermissions,this._data=v,this._dataBinary=C.binary,this.options={compression:C.compression,compressionOptions:C.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(g){var v=null,C="string";try{if(!g)throw new Error("No output type specified.");var w=(C=g.toLowerCase())==="string"||C==="text";C!=="binarystring"&&C!=="text"||(C="string"),v=this._decompressWorker();var _=!this._dataBinary;_&&!w&&(v=v.pipe(new l.Utf8EncodeWorker)),!_&&w&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(y){(v=new d("error")).error(y)}return new s(v,C,"")},async:function(g,v){return this.internalStream(g).accumulate(v)},nodeStream:function(g,v){return this.internalStream(g||"nodebuffer").toNodejsStream(v)},_compressWorker:function(g,v){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var C=this._decompressWorker();return this._dataBinary||(C=C.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(C,g,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.")},m=0;m<f.length;m++)i.prototype[f[m]]=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(g),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(){g(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(g,0)};else{var p=new i.MessageChannel;p.port1.onmessage=g,s=function(){p.port2.postMessage(0)}}var m=[];function g(){var v,C;a=!0;for(var w=m.length;w;){for(C=m,m=[],v=-1;++v<w;)C[v]();w=m.length}a=!1}r.exports=function(v){m.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(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,w!==s&&v(this,w)}function p(w,_,y){this.promise=w,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function m(w,_,y){i(function(){var k;try{k=_(y)}catch(T){return a.reject(w,T)}k===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,k)})}function g(w){var _=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof _=="function")return function(){_.apply(w,arguments)}}function v(w,_){var y=!1;function k(B){y||(y=!0,a.reject(w,B))}function T(B){y||(y=!0,a.resolve(w,B))}var M=C(function(){_(T,k)});M.status==="error"&&k(M.value)}function C(w,_){var y={};try{y.value=w(_),y.status="success"}catch(k){y.status="error",y.value=k}return y}(r.exports=f).prototype.finally=function(w){if(typeof w!="function")return this;var _=this.constructor;return this.then(function(y){return _.resolve(w()).then(function(){return y})},function(y){return _.resolve(w()).then(function(){throw y})})},f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,_){if(typeof w!="function"&&this.state===u||typeof _!="function"&&this.state===l)return this;var y=new this.constructor(s);return this.state!==d?m(y,this.state===u?w:_,this.outcome):this.queue.push(new p(y,w,_)),y},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){m(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){m(this.promise,this.onRejected,w)},a.resolve=function(w,_){var y=C(g,_);if(y.status==="error")return a.reject(w,y.value);var k=y.value;if(k)v(w,k);else{w.state=u,w.outcome=_;for(var T=-1,M=w.queue.length;++T<M;)w.queue[T].callFulfilled(_)}return w},a.reject=function(w,_){w.state=l,w.outcome=_;for(var y=-1,k=w.queue.length;++y<k;)w.queue[y].callRejected(_);return w},f.resolve=function(w){return w instanceof this?w:a.resolve(new this(s),w)},f.reject=function(w){var _=new this(s);return a.reject(_,w)},f.all=function(w){var _=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=w.length,k=!1;if(!y)return this.resolve([]);for(var T=new Array(y),M=0,B=-1,W=new this(s);++B<y;)z(w[B],B);return W;function z(V,Z){_.resolve(V).then(function(R){T[Z]=R,++M!==y||k||(k=!0,a.resolve(W,T))},function(R){k||(k=!0,a.reject(W,R))})}},f.race=function(w){var _=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=w.length,k=!1;if(!y)return this.resolve([]);for(var T=-1,M=new this(s);++T<y;)B=w[T],_.resolve(B).then(function(W){k||(k=!0,a.resolve(M,W))},function(W){k||(k=!0,a.reject(M,W))});var B;return M}},{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,m=0,g=8;function v(w){if(!(this instanceof v))return new v(w);this.options=s.assign({level:p,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},w||{});var _=this.options;_.raw&&0<_.windowBits?_.windowBits=-_.windowBits:_.gzip&&0<_.windowBits&&_.windowBits<16&&(_.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var y=i.deflateInit2(this.strm,_.level,_.method,_.windowBits,_.memLevel,_.strategy);if(y!==f)throw new Error(l[y]);if(_.header&&i.deflateSetHeader(this.strm,_.header),_.dictionary){var k;if(k=typeof _.dictionary=="string"?a.string2buf(_.dictionary):d.call(_.dictionary)==="[object ArrayBuffer]"?new Uint8Array(_.dictionary):_.dictionary,(y=i.deflateSetDictionary(this.strm,k))!==f)throw new Error(l[y]);this._dict_set=!0}}function C(w,_){var y=new v(_);if(y.push(w,!0),y.err)throw y.msg||l[y.err];return y.result}v.prototype.push=function(w,_){var y,k,T=this.strm,M=this.options.chunkSize;if(this.ended)return!1;k=_===~~_?_:_===!0?4:0,typeof w=="string"?T.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?T.input=new Uint8Array(w):T.input=w,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new s.Buf8(M),T.next_out=0,T.avail_out=M),(y=i.deflate(T,k))!==1&&y!==f)return this.onEnd(y),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||k!==4&&k!==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)&&y!==1);return k===4?(y=i.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===f):k!==2||(this.onEnd(f),!(T.avail_out=0))},v.prototype.onData=function(w){this.chunks.push(w)},v.prototype.onEnd=function(w){w===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg},o.Deflate=v,o.deflate=C,o.deflateRaw=function(w,_){return(_=_||{}).raw=!0,C(w,_)},o.gzip=function(w,_){return(_=_||{}).gzip=!0,C(w,_)}},{"./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 m(v){if(!(this instanceof m))return new m(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var C=this.options;C.raw&&0<=C.windowBits&&C.windowBits<16&&(C.windowBits=-C.windowBits,C.windowBits===0&&(C.windowBits=-15)),!(0<=C.windowBits&&C.windowBits<16)||v&&v.windowBits||(C.windowBits+=32),15<C.windowBits&&C.windowBits<48&&(15&C.windowBits)==0&&(C.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var w=i.inflateInit2(this.strm,C.windowBits);if(w!==l.Z_OK)throw new Error(u[w]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function g(v,C){var w=new m(C);if(w.push(v,!0),w.err)throw w.msg||u[w.err];return w.result}m.prototype.push=function(v,C){var w,_,y,k,T,M,B=this.strm,W=this.options.chunkSize,z=this.options.dictionary,V=!1;if(this.ended)return!1;_=C===~~C?C:C===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?B.input=a.binstring2buf(v):p.call(v)==="[object ArrayBuffer]"?B.input=new Uint8Array(v):B.input=v,B.next_in=0,B.avail_in=B.input.length;do{if(B.avail_out===0&&(B.output=new s.Buf8(W),B.next_out=0,B.avail_out=W),(w=i.inflate(B,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&z&&(M=typeof z=="string"?a.string2buf(z):p.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,w=i.inflateSetDictionary(this.strm,M)),w===l.Z_BUF_ERROR&&V===!0&&(w=l.Z_OK,V=!1),w!==l.Z_STREAM_END&&w!==l.Z_OK)return this.onEnd(w),!(this.ended=!0);B.next_out&&(B.avail_out!==0&&w!==l.Z_STREAM_END&&(B.avail_in!==0||_!==l.Z_FINISH&&_!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=a.utf8border(B.output,B.next_out),k=B.next_out-y,T=a.buf2string(B.output,y),B.next_out=k,B.avail_out=W-k,k&&s.arraySet(B.output,B.output,y,k,0),this.onData(T)):this.onData(s.shrinkBuf(B.output,B.next_out)))),B.avail_in===0&&B.avail_out===0&&(V=!0)}while((0<B.avail_in||B.avail_out===0)&&w!==l.Z_STREAM_END);return w===l.Z_STREAM_END&&(_=l.Z_FINISH),_===l.Z_FINISH?(w=i.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===l.Z_OK):_!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(B.avail_out=0))},m.prototype.onData=function(v){this.chunks.push(v)},m.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=m,o.inflate=g,o.inflateRaw=function(v,C){return(C=C||{}).raw=!0,g(v,C)},o.ungzip=g},{"./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 m=0;m<f;m++)l[p+m]=u[d+m]},flattenChunks:function(l){var u,d,f,p,m,g;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(g=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)m=l[u],g.set(m,p),p+=m.length;return g}},a={arraySet:function(l,u,d,f,p){for(var m=0;m<f;m++)l[p+m]=u[d+m]},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 m="",g=0;g<p;g++)m+=String.fromCharCode(f[g]);return m}l[254]=l[254]=1,o.string2buf=function(f){var p,m,g,v,C,w=f.length,_=0;for(v=0;v<w;v++)(64512&(m=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(g=f.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),v++),_+=m<128?1:m<2048?2:m<65536?3:4;for(p=new i.Buf8(_),v=C=0;C<_;v++)(64512&(m=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(g=f.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),v++),m<128?p[C++]=m:(m<2048?p[C++]=192|m>>>6:(m<65536?p[C++]=224|m>>>12:(p[C++]=240|m>>>18,p[C++]=128|m>>>12&63),p[C++]=128|m>>>6&63),p[C++]=128|63&m);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),m=0,g=p.length;m<g;m++)p[m]=f.charCodeAt(m);return p},o.buf2string=function(f,p){var m,g,v,C,w=p||f.length,_=new Array(2*w);for(m=g=0;m<w;)if((v=f[m++])<128)_[g++]=v;else if(4<(C=l[v]))_[g++]=65533,m+=C-1;else{for(v&=C===2?31:C===3?15:7;1<C&&m<w;)v=v<<6|63&f[m++],C--;1<C?_[g++]=65533:v<65536?_[g++]=v:(v-=65536,_[g++]=55296|v>>10&1023,_[g++]=56320|1023&v)}return d(_,g)},o.utf8border=function(f,p){var m;for((p=p||f.length)>f.length&&(p=f.length),m=p-1;0<=m&&(192&f[m])==128;)m--;return m<0||m===0?p:m+l[f[m]]>p?m: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,m=0,g=-2,v=-1,C=4,w=2,_=8,y=9,k=286,T=30,M=19,B=2*k+1,W=15,z=3,V=258,Z=V+z+1,R=42,K=113,x=1,G=2,H=3,J=4;function Q(I,ae){return I.msg=d[ae],ae}function X(I){return(I<<1)-(4<I?9:0)}function Te(I){for(var ae=I.length;0<=--ae;)I[ae]=0}function de(I){var ae=I.state,N=ae.pending;N>I.avail_out&&(N=I.avail_out),N!==0&&(s.arraySet(I.output,ae.pending_buf,ae.pending_out,N,I.next_out),I.next_out+=N,ae.pending_out+=N,I.total_out+=N,I.avail_out-=N,ae.pending-=N,ae.pending===0&&(ae.pending_out=0))}function ge(I,ae){a._tr_flush_block(I,0<=I.block_start?I.block_start:-1,I.strstart-I.block_start,ae),I.block_start=I.strstart,de(I.strm)}function ve(I,ae){I.pending_buf[I.pending++]=ae}function Re(I,ae){I.pending_buf[I.pending++]=ae>>>8&255,I.pending_buf[I.pending++]=255&ae}function Be(I,ae){var N,Y,U=I.max_chain_length,ie=I.strstart,be=I.prev_length,L=I.nice_match,F=I.strstart>I.w_size-Z?I.strstart-(I.w_size-Z):0,fe=I.window,Ce=I.w_mask,_e=I.prev,Pe=I.strstart+V,We=fe[ie+be-1],it=fe[ie+be];I.prev_length>=I.good_match&&(U>>=2),L>I.lookahead&&(L=I.lookahead);do if(fe[(N=ae)+be]===it&&fe[N+be-1]===We&&fe[N]===fe[ie]&&fe[++N]===fe[ie+1]){ie+=2,N++;do;while(fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&ie<Pe);if(Y=V-(Pe-ie),ie=Pe-V,be<Y){if(I.match_start=ae,L<=(be=Y))break;We=fe[ie+be-1],it=fe[ie+be]}}while((ae=_e[ae&Ce])>F&&--U!=0);return be<=I.lookahead?be:I.lookahead}function tt(I){var ae,N,Y,U,ie,be,L,F,fe,Ce,_e=I.w_size;do{if(U=I.window_size-I.lookahead-I.strstart,I.strstart>=_e+(_e-Z)){for(s.arraySet(I.window,I.window,_e,_e,0),I.match_start-=_e,I.strstart-=_e,I.block_start-=_e,ae=N=I.hash_size;Y=I.head[--ae],I.head[ae]=_e<=Y?Y-_e:0,--N;);for(ae=N=_e;Y=I.prev[--ae],I.prev[ae]=_e<=Y?Y-_e:0,--N;);U+=_e}if(I.strm.avail_in===0)break;if(be=I.strm,L=I.window,F=I.strstart+I.lookahead,fe=U,Ce=void 0,Ce=be.avail_in,fe<Ce&&(Ce=fe),N=Ce===0?0:(be.avail_in-=Ce,s.arraySet(L,be.input,be.next_in,Ce,F),be.state.wrap===1?be.adler=l(be.adler,L,Ce,F):be.state.wrap===2&&(be.adler=u(be.adler,L,Ce,F)),be.next_in+=Ce,be.total_in+=Ce,Ce),I.lookahead+=N,I.lookahead+I.insert>=z)for(ie=I.strstart-I.insert,I.ins_h=I.window[ie],I.ins_h=(I.ins_h<<I.hash_shift^I.window[ie+1])&I.hash_mask;I.insert&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[ie+z-1])&I.hash_mask,I.prev[ie&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=ie,ie++,I.insert--,!(I.lookahead+I.insert<z)););}while(I.lookahead<Z&&I.strm.avail_in!==0)}function ut(I,ae){for(var N,Y;;){if(I.lookahead<Z){if(tt(I),I.lookahead<Z&&ae===f)return x;if(I.lookahead===0)break}if(N=0,I.lookahead>=z&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+z-1])&I.hash_mask,N=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),N!==0&&I.strstart-N<=I.w_size-Z&&(I.match_length=Be(I,N)),I.match_length>=z)if(Y=a._tr_tally(I,I.strstart-I.match_start,I.match_length-z),I.lookahead-=I.match_length,I.match_length<=I.max_lazy_match&&I.lookahead>=z){for(I.match_length--;I.strstart++,I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+z-1])&I.hash_mask,N=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 Y=a._tr_tally(I,0,I.window[I.strstart]),I.lookahead--,I.strstart++;if(Y&&(ge(I,!1),I.strm.avail_out===0))return x}return I.insert=I.strstart<z-1?I.strstart:z-1,ae===p?(ge(I,!0),I.strm.avail_out===0?H:J):I.last_lit&&(ge(I,!1),I.strm.avail_out===0)?x:G}function dt(I,ae){for(var N,Y,U;;){if(I.lookahead<Z){if(tt(I),I.lookahead<Z&&ae===f)return x;if(I.lookahead===0)break}if(N=0,I.lookahead>=z&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+z-1])&I.hash_mask,N=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=z-1,N!==0&&I.prev_length<I.max_lazy_match&&I.strstart-N<=I.w_size-Z&&(I.match_length=Be(I,N),I.match_length<=5&&(I.strategy===1||I.match_length===z&&4096<I.strstart-I.match_start)&&(I.match_length=z-1)),I.prev_length>=z&&I.match_length<=I.prev_length){for(U=I.strstart+I.lookahead-z,Y=a._tr_tally(I,I.strstart-1-I.prev_match,I.prev_length-z),I.lookahead-=I.prev_length-1,I.prev_length-=2;++I.strstart<=U&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+z-1])&I.hash_mask,N=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=z-1,I.strstart++,Y&&(ge(I,!1),I.strm.avail_out===0))return x}else if(I.match_available){if((Y=a._tr_tally(I,0,I.window[I.strstart-1]))&&ge(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&&(Y=a._tr_tally(I,0,I.window[I.strstart-1]),I.match_available=0),I.insert=I.strstart<z-1?I.strstart:z-1,ae===p?(ge(I,!0),I.strm.avail_out===0?H:J):I.last_lit&&(ge(I,!1),I.strm.avail_out===0)?x:G}function _t(I,ae,N,Y,U){this.good_length=I,this.max_lazy=ae,this.nice_length=N,this.max_chain=Y,this.func=U}function se(){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=_,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*B),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*M+1)),Te(this.dyn_ltree),Te(this.dyn_dtree),Te(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*k+1),Te(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*k+1),Te(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 ke(I){var ae;return I&&I.state?(I.total_in=I.total_out=0,I.data_type=w,(ae=I.state).pending=0,ae.pending_out=0,ae.wrap<0&&(ae.wrap=-ae.wrap),ae.status=ae.wrap?R:K,I.adler=ae.wrap===2?0:1,ae.last_flush=f,a._tr_init(ae),m):Q(I,g)}function Ue(I){var ae=ke(I);return ae===m&&(function(N){N.window_size=2*N.w_size,Te(N.head),N.max_lazy_match=i[N.level].max_lazy,N.good_match=i[N.level].good_length,N.nice_match=i[N.level].nice_length,N.max_chain_length=i[N.level].max_chain,N.strstart=0,N.block_start=0,N.lookahead=0,N.insert=0,N.match_length=N.prev_length=z-1,N.match_available=0,N.ins_h=0})(I.state),ae}function ne(I,ae,N,Y,U,ie){if(!I)return g;var be=1;if(ae===v&&(ae=6),Y<0?(be=0,Y=-Y):15<Y&&(be=2,Y-=16),U<1||y<U||N!==_||Y<8||15<Y||ae<0||9<ae||ie<0||C<ie)return Q(I,g);Y===8&&(Y=9);var L=new se;return(I.state=L).strm=I,L.wrap=be,L.gzhead=null,L.w_bits=Y,L.w_size=1<<L.w_bits,L.w_mask=L.w_size-1,L.hash_bits=U+7,L.hash_size=1<<L.hash_bits,L.hash_mask=L.hash_size-1,L.hash_shift=~~((L.hash_bits+z-1)/z),L.window=new s.Buf8(2*L.w_size),L.head=new s.Buf16(L.hash_size),L.prev=new s.Buf16(L.w_size),L.lit_bufsize=1<<U+6,L.pending_buf_size=4*L.lit_bufsize,L.pending_buf=new s.Buf8(L.pending_buf_size),L.d_buf=1*L.lit_bufsize,L.l_buf=3*L.lit_bufsize,L.level=ae,L.strategy=ie,L.method=N,Ue(I)}i=[new _t(0,0,0,0,function(I,ae){var N=65535;for(N>I.pending_buf_size-5&&(N=I.pending_buf_size-5);;){if(I.lookahead<=1){if(tt(I),I.lookahead===0&&ae===f)return x;if(I.lookahead===0)break}I.strstart+=I.lookahead,I.lookahead=0;var Y=I.block_start+N;if((I.strstart===0||I.strstart>=Y)&&(I.lookahead=I.strstart-Y,I.strstart=Y,ge(I,!1),I.strm.avail_out===0)||I.strstart-I.block_start>=I.w_size-Z&&(ge(I,!1),I.strm.avail_out===0))return x}return I.insert=0,ae===p?(ge(I,!0),I.strm.avail_out===0?H:J):(I.strstart>I.block_start&&(ge(I,!1),I.strm.avail_out),x)}),new _t(4,4,8,4,ut),new _t(4,5,16,8,ut),new _t(4,6,32,32,ut),new _t(4,4,16,16,dt),new _t(8,16,32,32,dt),new _t(8,16,128,128,dt),new _t(8,32,128,256,dt),new _t(32,128,258,1024,dt),new _t(32,258,258,4096,dt)],o.deflateInit=function(I,ae){return ne(I,ae,_,15,8,0)},o.deflateInit2=ne,o.deflateReset=Ue,o.deflateResetKeep=ke,o.deflateSetHeader=function(I,ae){return I&&I.state?I.state.wrap!==2?g:(I.state.gzhead=ae,m):g},o.deflate=function(I,ae){var N,Y,U,ie;if(!I||!I.state||5<ae||ae<0)return I?Q(I,g):g;if(Y=I.state,!I.output||!I.input&&I.avail_in!==0||Y.status===666&&ae!==p)return Q(I,I.avail_out===0?-5:g);if(Y.strm=I,N=Y.last_flush,Y.last_flush=ae,Y.status===R)if(Y.wrap===2)I.adler=0,ve(Y,31),ve(Y,139),ve(Y,8),Y.gzhead?(ve(Y,(Y.gzhead.text?1:0)+(Y.gzhead.hcrc?2:0)+(Y.gzhead.extra?4:0)+(Y.gzhead.name?8:0)+(Y.gzhead.comment?16:0)),ve(Y,255&Y.gzhead.time),ve(Y,Y.gzhead.time>>8&255),ve(Y,Y.gzhead.time>>16&255),ve(Y,Y.gzhead.time>>24&255),ve(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ve(Y,255&Y.gzhead.os),Y.gzhead.extra&&Y.gzhead.extra.length&&(ve(Y,255&Y.gzhead.extra.length),ve(Y,Y.gzhead.extra.length>>8&255)),Y.gzhead.hcrc&&(I.adler=u(I.adler,Y.pending_buf,Y.pending,0)),Y.gzindex=0,Y.status=69):(ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ve(Y,3),Y.status=K);else{var be=_+(Y.w_bits-8<<4)<<8;be|=(2<=Y.strategy||Y.level<2?0:Y.level<6?1:Y.level===6?2:3)<<6,Y.strstart!==0&&(be|=32),be+=31-be%31,Y.status=K,Re(Y,be),Y.strstart!==0&&(Re(Y,I.adler>>>16),Re(Y,65535&I.adler)),I.adler=1}if(Y.status===69)if(Y.gzhead.extra){for(U=Y.pending;Y.gzindex<(65535&Y.gzhead.extra.length)&&(Y.pending!==Y.pending_buf_size||(Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),de(I),U=Y.pending,Y.pending!==Y.pending_buf_size));)ve(Y,255&Y.gzhead.extra[Y.gzindex]),Y.gzindex++;Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),Y.gzindex===Y.gzhead.extra.length&&(Y.gzindex=0,Y.status=73)}else Y.status=73;if(Y.status===73)if(Y.gzhead.name){U=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),de(I),U=Y.pending,Y.pending===Y.pending_buf_size)){ie=1;break}ie=Y.gzindex<Y.gzhead.name.length?255&Y.gzhead.name.charCodeAt(Y.gzindex++):0,ve(Y,ie)}while(ie!==0);Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),ie===0&&(Y.gzindex=0,Y.status=91)}else Y.status=91;if(Y.status===91)if(Y.gzhead.comment){U=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),de(I),U=Y.pending,Y.pending===Y.pending_buf_size)){ie=1;break}ie=Y.gzindex<Y.gzhead.comment.length?255&Y.gzhead.comment.charCodeAt(Y.gzindex++):0,ve(Y,ie)}while(ie!==0);Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),ie===0&&(Y.status=103)}else Y.status=103;if(Y.status===103&&(Y.gzhead.hcrc?(Y.pending+2>Y.pending_buf_size&&de(I),Y.pending+2<=Y.pending_buf_size&&(ve(Y,255&I.adler),ve(Y,I.adler>>8&255),I.adler=0,Y.status=K)):Y.status=K),Y.pending!==0){if(de(I),I.avail_out===0)return Y.last_flush=-1,m}else if(I.avail_in===0&&X(ae)<=X(N)&&ae!==p)return Q(I,-5);if(Y.status===666&&I.avail_in!==0)return Q(I,-5);if(I.avail_in!==0||Y.lookahead!==0||ae!==f&&Y.status!==666){var L=Y.strategy===2?(function(F,fe){for(var Ce;;){if(F.lookahead===0&&(tt(F),F.lookahead===0)){if(fe===f)return x;break}if(F.match_length=0,Ce=a._tr_tally(F,0,F.window[F.strstart]),F.lookahead--,F.strstart++,Ce&&(ge(F,!1),F.strm.avail_out===0))return x}return F.insert=0,fe===p?(ge(F,!0),F.strm.avail_out===0?H:J):F.last_lit&&(ge(F,!1),F.strm.avail_out===0)?x:G})(Y,ae):Y.strategy===3?(function(F,fe){for(var Ce,_e,Pe,We,it=F.window;;){if(F.lookahead<=V){if(tt(F),F.lookahead<=V&&fe===f)return x;if(F.lookahead===0)break}if(F.match_length=0,F.lookahead>=z&&0<F.strstart&&(_e=it[Pe=F.strstart-1])===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]){We=F.strstart+V;do;while(_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&Pe<We);F.match_length=V-(We-Pe),F.match_length>F.lookahead&&(F.match_length=F.lookahead)}if(F.match_length>=z?(Ce=a._tr_tally(F,1,F.match_length-z),F.lookahead-=F.match_length,F.strstart+=F.match_length,F.match_length=0):(Ce=a._tr_tally(F,0,F.window[F.strstart]),F.lookahead--,F.strstart++),Ce&&(ge(F,!1),F.strm.avail_out===0))return x}return F.insert=0,fe===p?(ge(F,!0),F.strm.avail_out===0?H:J):F.last_lit&&(ge(F,!1),F.strm.avail_out===0)?x:G})(Y,ae):i[Y.level].func(Y,ae);if(L!==H&&L!==J||(Y.status=666),L===x||L===H)return I.avail_out===0&&(Y.last_flush=-1),m;if(L===G&&(ae===1?a._tr_align(Y):ae!==5&&(a._tr_stored_block(Y,0,0,!1),ae===3&&(Te(Y.head),Y.lookahead===0&&(Y.strstart=0,Y.block_start=0,Y.insert=0))),de(I),I.avail_out===0))return Y.last_flush=-1,m}return ae!==p?m:Y.wrap<=0?1:(Y.wrap===2?(ve(Y,255&I.adler),ve(Y,I.adler>>8&255),ve(Y,I.adler>>16&255),ve(Y,I.adler>>24&255),ve(Y,255&I.total_in),ve(Y,I.total_in>>8&255),ve(Y,I.total_in>>16&255),ve(Y,I.total_in>>24&255)):(Re(Y,I.adler>>>16),Re(Y,65535&I.adler)),de(I),0<Y.wrap&&(Y.wrap=-Y.wrap),Y.pending!==0?m:1)},o.deflateEnd=function(I){var ae;return I&&I.state?(ae=I.state.status)!==R&&ae!==69&&ae!==73&&ae!==91&&ae!==103&&ae!==K&&ae!==666?Q(I,g):(I.state=null,ae===K?Q(I,-3):m):g},o.deflateSetDictionary=function(I,ae){var N,Y,U,ie,be,L,F,fe,Ce=ae.length;if(!I||!I.state||(ie=(N=I.state).wrap)===2||ie===1&&N.status!==R||N.lookahead)return g;for(ie===1&&(I.adler=l(I.adler,ae,Ce,0)),N.wrap=0,Ce>=N.w_size&&(ie===0&&(Te(N.head),N.strstart=0,N.block_start=0,N.insert=0),fe=new s.Buf8(N.w_size),s.arraySet(fe,ae,Ce-N.w_size,N.w_size,0),ae=fe,Ce=N.w_size),be=I.avail_in,L=I.next_in,F=I.input,I.avail_in=Ce,I.next_in=0,I.input=ae,tt(N);N.lookahead>=z;){for(Y=N.strstart,U=N.lookahead-(z-1);N.ins_h=(N.ins_h<<N.hash_shift^N.window[Y+z-1])&N.hash_mask,N.prev[Y&N.w_mask]=N.head[N.ins_h],N.head[N.ins_h]=Y,Y++,--U;);N.strstart=Y,N.lookahead=z-1,tt(N)}return N.strstart+=N.lookahead,N.block_start=N.strstart,N.insert=N.lookahead,N.lookahead=0,N.match_length=N.prev_length=z-1,N.match_available=0,I.next_in=L,I.input=F,I.avail_in=be,N.wrap=ie,m},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,m,g,v,C,w,_,y,k,T,M,B,W,z,V,Z,R,K,x=i.input,G;u=l+(i.avail_in-5),d=i.next_out,G=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),m=a.dmax,g=a.wsize,v=a.whave,C=a.wnext,w=a.window,_=a.hold,y=a.bits,k=a.lencode,T=a.distcode,M=(1<<a.lenbits)-1,B=(1<<a.distbits)-1;e:do{y<15&&(_+=x[l++]<<y,y+=8,_+=x[l++]<<y,y+=8),W=k[_&M];t:for(;;){if(_>>>=z=W>>>24,y-=z,(z=W>>>16&255)===0)G[d++]=65535&W;else{if(!(16&z)){if((64&z)==0){W=k[(65535&W)+(_&(1<<z)-1)];continue t}if(32&z){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}V=65535&W,(z&=15)&&(y<z&&(_+=x[l++]<<y,y+=8),V+=_&(1<<z)-1,_>>>=z,y-=z),y<15&&(_+=x[l++]<<y,y+=8,_+=x[l++]<<y,y+=8),W=T[_&B];n:for(;;){if(_>>>=z=W>>>24,y-=z,!(16&(z=W>>>16&255))){if((64&z)==0){W=T[(65535&W)+(_&(1<<z)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(Z=65535&W,y<(z&=15)&&(_+=x[l++]<<y,(y+=8)<z&&(_+=x[l++]<<y,y+=8)),m<(Z+=_&(1<<z)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(_>>>=z,y-=z,(z=d-f)<Z){if(v<(z=Z-z)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(K=w,(R=0)===C){if(R+=g-z,z<V){for(V-=z;G[d++]=w[R++],--z;);R=d-Z,K=G}}else if(C<z){if(R+=g+C-z,(z-=C)<V){for(V-=z;G[d++]=w[R++],--z;);if(R=0,C<V){for(V-=z=C;G[d++]=w[R++],--z;);R=d-Z,K=G}}}else if(R+=C-z,z<V){for(V-=z;G[d++]=w[R++],--z;);R=d-Z,K=G}for(;2<V;)G[d++]=K[R++],G[d++]=K[R++],G[d++]=K[R++],V-=3;V&&(G[d++]=K[R++],1<V&&(G[d++]=K[R++]))}else{for(R=d-Z;G[d++]=G[R++],G[d++]=G[R++],G[d++]=G[R++],2<(V-=3););V&&(G[d++]=G[R++],1<V&&(G[d++]=G[R++]))}break}}break}}while(l<u&&d<p);l-=V=y>>3,_&=(1<<(y-=V<<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=_,a.bits=y}},{}],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,m=-2,g=1,v=852,C=592;function w(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function _(){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 y(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=g,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(C),K.sane=1,K.back=-1,p):m}function k(R){var K;return R&&R.state?((K=R.state).wsize=0,K.whave=0,K.wnext=0,y(R)):m}function T(R,K){var x,G;return R&&R.state?(G=R.state,K<0?(x=0,K=-K):(x=1+(K>>4),K<48&&(K&=15)),K&&(K<8||15<K)?m:(G.window!==null&&G.wbits!==K&&(G.window=null),G.wrap=x,G.wbits=K,k(R))):m}function M(R,K){var x,G;return R?(G=new _,(R.state=G).window=null,(x=T(R,K))!==p&&(R.state=null),x):m}var B,W,z=!0;function V(R){if(z){var K;for(B=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,B,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}),z=!1}R.lencode=B,R.lenbits=9,R.distcode=W,R.distbits=5}function Z(R,K,x,G){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)),G>=J.wsize?(i.arraySet(J.window,K,x-J.wsize,J.wsize,0),J.wnext=0,J.whave=J.wsize):(G<(H=J.wsize-J.wnext)&&(H=G),i.arraySet(J.window,K,x-G,H,J.wnext),(G-=H)?(i.arraySet(J.window,K,x-G,G,0),J.wnext=G,J.whave=J.wsize):(J.wnext+=H,J.wnext===J.wsize&&(J.wnext=0),J.whave<J.wsize&&(J.whave+=H))),0}o.inflateReset=k,o.inflateReset2=T,o.inflateResetKeep=y,o.inflateInit=function(R){return M(R,15)},o.inflateInit2=M,o.inflate=function(R,K){var x,G,H,J,Q,X,Te,de,ge,ve,Re,Be,tt,ut,dt,_t,se,ke,Ue,ne,I,ae,N,Y,U=0,ie=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 m;(x=R.state).mode===12&&(x.mode=13),Q=R.next_out,H=R.output,Te=R.avail_out,J=R.next_in,G=R.input,X=R.avail_in,de=x.hold,ge=x.bits,ve=X,Re=Te,ae=p;e:for(;;)switch(x.mode){case g:if(x.wrap===0){x.mode=13;break}for(;ge<16;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(2&x.wrap&&de===35615){ie[x.check=0]=255&de,ie[1]=de>>>8&255,x.check=a(x.check,ie,2,0),ge=de=0,x.mode=2;break}if(x.flags=0,x.head&&(x.head.done=!1),!(1&x.wrap)||(((255&de)<<8)+(de>>8))%31){R.msg="incorrect header check",x.mode=30;break}if((15&de)!=8){R.msg="unknown compression method",x.mode=30;break}if(ge-=4,I=8+(15&(de>>>=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&de?10:12,ge=de=0;break;case 2:for(;ge<16;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(x.flags=de,(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=de>>8&1),512&x.flags&&(ie[0]=255&de,ie[1]=de>>>8&255,x.check=a(x.check,ie,2,0)),ge=de=0,x.mode=3;case 3:for(;ge<32;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.head&&(x.head.time=de),512&x.flags&&(ie[0]=255&de,ie[1]=de>>>8&255,ie[2]=de>>>16&255,ie[3]=de>>>24&255,x.check=a(x.check,ie,4,0)),ge=de=0,x.mode=4;case 4:for(;ge<16;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.head&&(x.head.xflags=255&de,x.head.os=de>>8),512&x.flags&&(ie[0]=255&de,ie[1]=de>>>8&255,x.check=a(x.check,ie,2,0)),ge=de=0,x.mode=5;case 5:if(1024&x.flags){for(;ge<16;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.length=de,x.head&&(x.head.extra_len=de),512&x.flags&&(ie[0]=255&de,ie[1]=de>>>8&255,x.check=a(x.check,ie,2,0)),ge=de=0}else x.head&&(x.head.extra=null);x.mode=6;case 6:if(1024&x.flags&&(X<(Be=x.length)&&(Be=X),Be&&(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,G,J,Be,I)),512&x.flags&&(x.check=a(x.check,G,Be,J)),X-=Be,J+=Be,x.length-=Be),x.length))break e;x.length=0,x.mode=7;case 7:if(2048&x.flags){if(X===0)break e;for(Be=0;I=G[J+Be++],x.head&&I&&x.length<65536&&(x.head.name+=String.fromCharCode(I)),I&&Be<X;);if(512&x.flags&&(x.check=a(x.check,G,Be,J)),X-=Be,J+=Be,I)break e}else x.head&&(x.head.name=null);x.length=0,x.mode=8;case 8:if(4096&x.flags){if(X===0)break e;for(Be=0;I=G[J+Be++],x.head&&I&&x.length<65536&&(x.head.comment+=String.fromCharCode(I)),I&&Be<X;);if(512&x.flags&&(x.check=a(x.check,G,Be,J)),X-=Be,J+=Be,I)break e}else x.head&&(x.head.comment=null);x.mode=9;case 9:if(512&x.flags){for(;ge<16;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(de!==(65535&x.check)){R.msg="header crc mismatch",x.mode=30;break}ge=de=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(;ge<32;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}R.adler=x.check=w(de),ge=de=0,x.mode=11;case 11:if(x.havedict===0)return R.next_out=Q,R.avail_out=Te,R.next_in=J,R.avail_in=X,x.hold=de,x.bits=ge,2;R.adler=x.check=1,x.mode=12;case 12:if(K===5||K===6)break e;case 13:if(x.last){de>>>=7&ge,ge-=7&ge,x.mode=27;break}for(;ge<3;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}switch(x.last=1&de,ge-=1,3&(de>>>=1)){case 0:x.mode=14;break;case 1:if(V(x),x.mode=20,K!==6)break;de>>>=2,ge-=2;break e;case 2:x.mode=17;break;case 3:R.msg="invalid block type",x.mode=30}de>>>=2,ge-=2;break;case 14:for(de>>>=7&ge,ge-=7&ge;ge<32;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if((65535&de)!=(de>>>16^65535)){R.msg="invalid stored block lengths",x.mode=30;break}if(x.length=65535&de,ge=de=0,x.mode=15,K===6)break e;case 15:x.mode=16;case 16:if(Be=x.length){if(X<Be&&(Be=X),Te<Be&&(Be=Te),Be===0)break e;i.arraySet(H,G,J,Be,Q),X-=Be,J+=Be,Te-=Be,Q+=Be,x.length-=Be;break}x.mode=12;break;case 17:for(;ge<14;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(x.nlen=257+(31&de),de>>>=5,ge-=5,x.ndist=1+(31&de),de>>>=5,ge-=5,x.ncode=4+(15&de),de>>>=4,ge-=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(;ge<3;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.lens[be[x.have++]]=7&de,de>>>=3,ge-=3}for(;x.have<19;)x.lens[be[x.have++]]=0;if(x.lencode=x.lendyn,x.lenbits=7,N={bits:x.lenbits},ae=u(0,x.lens,0,19,x.lencode,0,x.work,N),x.lenbits=N.bits,ae){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(;_t=(U=x.lencode[de&(1<<x.lenbits)-1])>>>16&255,se=65535&U,!((dt=U>>>24)<=ge);){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(se<16)de>>>=dt,ge-=dt,x.lens[x.have++]=se;else{if(se===16){for(Y=dt+2;ge<Y;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(de>>>=dt,ge-=dt,x.have===0){R.msg="invalid bit length repeat",x.mode=30;break}I=x.lens[x.have-1],Be=3+(3&de),de>>>=2,ge-=2}else if(se===17){for(Y=dt+3;ge<Y;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}ge-=dt,I=0,Be=3+(7&(de>>>=dt)),de>>>=3,ge-=3}else{for(Y=dt+7;ge<Y;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}ge-=dt,I=0,Be=11+(127&(de>>>=dt)),de>>>=7,ge-=7}if(x.have+Be>x.nlen+x.ndist){R.msg="invalid bit length repeat",x.mode=30;break}for(;Be--;)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,N={bits:x.lenbits},ae=u(d,x.lens,0,x.nlen,x.lencode,0,x.work,N),x.lenbits=N.bits,ae){R.msg="invalid literal/lengths set",x.mode=30;break}if(x.distbits=6,x.distcode=x.distdyn,N={bits:x.distbits},ae=u(f,x.lens,x.nlen,x.ndist,x.distcode,0,x.work,N),x.distbits=N.bits,ae){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<=X&&258<=Te){R.next_out=Q,R.avail_out=Te,R.next_in=J,R.avail_in=X,x.hold=de,x.bits=ge,l(R,Re),Q=R.next_out,H=R.output,Te=R.avail_out,J=R.next_in,G=R.input,X=R.avail_in,de=x.hold,ge=x.bits,x.mode===12&&(x.back=-1);break}for(x.back=0;_t=(U=x.lencode[de&(1<<x.lenbits)-1])>>>16&255,se=65535&U,!((dt=U>>>24)<=ge);){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(_t&&(240&_t)==0){for(ke=dt,Ue=_t,ne=se;_t=(U=x.lencode[ne+((de&(1<<ke+Ue)-1)>>ke)])>>>16&255,se=65535&U,!(ke+(dt=U>>>24)<=ge);){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}de>>>=ke,ge-=ke,x.back+=ke}if(de>>>=dt,ge-=dt,x.back+=dt,x.length=se,_t===0){x.mode=26;break}if(32&_t){x.back=-1,x.mode=12;break}if(64&_t){R.msg="invalid literal/length code",x.mode=30;break}x.extra=15&_t,x.mode=22;case 22:if(x.extra){for(Y=x.extra;ge<Y;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.length+=de&(1<<x.extra)-1,de>>>=x.extra,ge-=x.extra,x.back+=x.extra}x.was=x.length,x.mode=23;case 23:for(;_t=(U=x.distcode[de&(1<<x.distbits)-1])>>>16&255,se=65535&U,!((dt=U>>>24)<=ge);){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if((240&_t)==0){for(ke=dt,Ue=_t,ne=se;_t=(U=x.distcode[ne+((de&(1<<ke+Ue)-1)>>ke)])>>>16&255,se=65535&U,!(ke+(dt=U>>>24)<=ge);){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}de>>>=ke,ge-=ke,x.back+=ke}if(de>>>=dt,ge-=dt,x.back+=dt,64&_t){R.msg="invalid distance code",x.mode=30;break}x.offset=se,x.extra=15&_t,x.mode=24;case 24:if(x.extra){for(Y=x.extra;ge<Y;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.offset+=de&(1<<x.extra)-1,de>>>=x.extra,ge-=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(Te===0)break e;if(Be=Re-Te,x.offset>Be){if((Be=x.offset-Be)>x.whave&&x.sane){R.msg="invalid distance too far back",x.mode=30;break}tt=Be>x.wnext?(Be-=x.wnext,x.wsize-Be):x.wnext-Be,Be>x.length&&(Be=x.length),ut=x.window}else ut=H,tt=Q-x.offset,Be=x.length;for(Te<Be&&(Be=Te),Te-=Be,x.length-=Be;H[Q++]=ut[tt++],--Be;);x.length===0&&(x.mode=21);break;case 26:if(Te===0)break e;H[Q++]=x.length,Te--,x.mode=21;break;case 27:if(x.wrap){for(;ge<32;){if(X===0)break e;X--,de|=G[J++]<<ge,ge+=8}if(Re-=Te,R.total_out+=Re,x.total+=Re,Re&&(R.adler=x.check=x.flags?a(x.check,H,Re,Q-Re):s(x.check,H,Re,Q-Re)),Re=Te,(x.flags?de:w(de))!==x.check){R.msg="incorrect data check",x.mode=30;break}ge=de=0}x.mode=28;case 28:if(x.wrap&&x.flags){for(;ge<32;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(de!==(4294967295&x.total)){R.msg="incorrect length check",x.mode=30;break}ge=de=0}x.mode=29;case 29:ae=1;break e;case 30:ae=-3;break e;case 31:return-4;default:return m}return R.next_out=Q,R.avail_out=Te,R.next_in=J,R.avail_in=X,x.hold=de,x.bits=ge,(x.wsize||Re!==R.avail_out&&x.mode<30&&(x.mode<27||K!==4))&&Z(R,R.output,R.next_out,Re-R.avail_out)?(x.mode=31,-4):(ve-=R.avail_in,Re-=R.avail_out,R.total_in+=ve,R.total_out+=Re,x.total+=Re,x.wrap&&Re&&(R.adler=x.check=x.flags?a(x.check,H,Re,R.next_out-Re):s(x.check,H,Re,R.next_out-Re)),R.data_type=x.bits+(x.last?64:0)+(x.mode===12?128:0)+(x.mode===20||x.mode===15?256:0),(ve==0&&Re===0||K===4)&&ae===p&&(ae=-5),ae)},o.inflateEnd=function(R){if(!R||!R.state)return m;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?m:((x.head=K).done=!1,p):m},o.inflateSetDictionary=function(R,K){var x,G=K.length;return R&&R.state?(x=R.state).wrap!==0&&x.mode!==11?m:x.mode===11&&s(1,K,G,0)!==x.check?-3:Z(R,K,G,G)?(x.mode=31,-4):(x.havedict=1,p):m},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,m,g,v,C,w){var _,y,k,T,M,B,W,z,V,Z=w.bits,R=0,K=0,x=0,G=0,H=0,J=0,Q=0,X=0,Te=0,de=0,ge=null,ve=0,Re=new i.Buf16(16),Be=new i.Buf16(16),tt=null,ut=0;for(R=0;R<=15;R++)Re[R]=0;for(K=0;K<m;K++)Re[f[p+K]]++;for(H=Z,G=15;1<=G&&Re[G]===0;G--);if(G<H&&(H=G),G===0)return g[v++]=20971520,g[v++]=20971520,w.bits=1,0;for(x=1;x<G&&Re[x]===0;x++);for(H<x&&(H=x),R=X=1;R<=15;R++)if(X<<=1,(X-=Re[R])<0)return-1;if(0<X&&(d===0||G!==1))return-1;for(Be[1]=0,R=1;R<15;R++)Be[R+1]=Be[R]+Re[R];for(K=0;K<m;K++)f[p+K]!==0&&(C[Be[f[p+K]]++]=K);if(B=d===0?(ge=tt=C,19):d===1?(ge=s,ve-=257,tt=a,ut-=257,256):(ge=l,tt=u,-1),R=x,M=v,Q=K=de=0,k=-1,T=(Te=1<<(J=H))-1,d===1&&852<Te||d===2&&592<Te)return 1;for(;;){for(W=R-Q,V=C[K]<B?(z=0,C[K]):C[K]>B?(z=tt[ut+C[K]],ge[ve+C[K]]):(z=96,0),_=1<<R-Q,x=y=1<<J;g[M+(de>>Q)+(y-=_)]=W<<24|z<<16|V|0,y!==0;);for(_=1<<R-1;de&_;)_>>=1;if(_!==0?(de&=_-1,de+=_):de=0,K++,--Re[R]==0){if(R===G)break;R=f[p+C[K]]}if(H<R&&(de&T)!==k){for(Q===0&&(Q=H),M+=x,X=1<<(J=R-Q);J+Q<G&&!((X-=Re[J+Q])<=0);)J++,X<<=1;if(Te+=1<<J,d===1&&852<Te||d===2&&592<Te)return 1;g[k=de&T]=H<<24|J<<16|M-v|0}}return de!==0&&(g[M+de]=R-Q<<24|4194304),w.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(U){for(var ie=U.length;0<=--ie;)U[ie]=0}var u=0,d=29,f=256,p=f+1+d,m=30,g=19,v=2*p+1,C=15,w=16,_=7,y=256,k=16,T=17,M=18,B=[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],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],V=[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*m);l(R);var K=new Array(512);l(K);var x=new Array(256);l(x);var G=new Array(d);l(G);var H,J,Q,X=new Array(m);function Te(U,ie,be,L,F){this.static_tree=U,this.extra_bits=ie,this.extra_base=be,this.elems=L,this.max_length=F,this.has_stree=U&&U.length}function de(U,ie){this.dyn_tree=U,this.max_code=0,this.stat_desc=ie}function ge(U){return U<256?K[U]:K[256+(U>>>7)]}function ve(U,ie){U.pending_buf[U.pending++]=255&ie,U.pending_buf[U.pending++]=ie>>>8&255}function Re(U,ie,be){U.bi_valid>w-be?(U.bi_buf|=ie<<U.bi_valid&65535,ve(U,U.bi_buf),U.bi_buf=ie>>w-U.bi_valid,U.bi_valid+=be-w):(U.bi_buf|=ie<<U.bi_valid&65535,U.bi_valid+=be)}function Be(U,ie,be){Re(U,be[2*ie],be[2*ie+1])}function tt(U,ie){for(var be=0;be|=1&U,U>>>=1,be<<=1,0<--ie;);return be>>>1}function ut(U,ie,be){var L,F,fe=new Array(C+1),Ce=0;for(L=1;L<=C;L++)fe[L]=Ce=Ce+be[L-1]<<1;for(F=0;F<=ie;F++){var _e=U[2*F+1];_e!==0&&(U[2*F]=tt(fe[_e]++,_e))}}function dt(U){var ie;for(ie=0;ie<p;ie++)U.dyn_ltree[2*ie]=0;for(ie=0;ie<m;ie++)U.dyn_dtree[2*ie]=0;for(ie=0;ie<g;ie++)U.bl_tree[2*ie]=0;U.dyn_ltree[2*y]=1,U.opt_len=U.static_len=0,U.last_lit=U.matches=0}function _t(U){8<U.bi_valid?ve(U,U.bi_buf):0<U.bi_valid&&(U.pending_buf[U.pending++]=U.bi_buf),U.bi_buf=0,U.bi_valid=0}function se(U,ie,be,L){var F=2*ie,fe=2*be;return U[F]<U[fe]||U[F]===U[fe]&&L[ie]<=L[be]}function ke(U,ie,be){for(var L=U.heap[be],F=be<<1;F<=U.heap_len&&(F<U.heap_len&&se(ie,U.heap[F+1],U.heap[F],U.depth)&&F++,!se(ie,L,U.heap[F],U.depth));)U.heap[be]=U.heap[F],be=F,F<<=1;U.heap[be]=L}function Ue(U,ie,be){var L,F,fe,Ce,_e=0;if(U.last_lit!==0)for(;L=U.pending_buf[U.d_buf+2*_e]<<8|U.pending_buf[U.d_buf+2*_e+1],F=U.pending_buf[U.l_buf+_e],_e++,L===0?Be(U,F,ie):(Be(U,(fe=x[F])+f+1,ie),(Ce=B[fe])!==0&&Re(U,F-=G[fe],Ce),Be(U,fe=ge(--L),be),(Ce=W[fe])!==0&&Re(U,L-=X[fe],Ce)),_e<U.last_lit;);Be(U,y,ie)}function ne(U,ie){var be,L,F,fe=ie.dyn_tree,Ce=ie.stat_desc.static_tree,_e=ie.stat_desc.has_stree,Pe=ie.stat_desc.elems,We=-1;for(U.heap_len=0,U.heap_max=v,be=0;be<Pe;be++)fe[2*be]!==0?(U.heap[++U.heap_len]=We=be,U.depth[be]=0):fe[2*be+1]=0;for(;U.heap_len<2;)fe[2*(F=U.heap[++U.heap_len]=We<2?++We:0)]=1,U.depth[F]=0,U.opt_len--,_e&&(U.static_len-=Ce[2*F+1]);for(ie.max_code=We,be=U.heap_len>>1;1<=be;be--)ke(U,fe,be);for(F=Pe;be=U.heap[1],U.heap[1]=U.heap[U.heap_len--],ke(U,fe,1),L=U.heap[1],U.heap[--U.heap_max]=be,U.heap[--U.heap_max]=L,fe[2*F]=fe[2*be]+fe[2*L],U.depth[F]=(U.depth[be]>=U.depth[L]?U.depth[be]:U.depth[L])+1,fe[2*be+1]=fe[2*L+1]=F,U.heap[1]=F++,ke(U,fe,1),2<=U.heap_len;);U.heap[--U.heap_max]=U.heap[1],(function(it,ht){var Lt,Tt,Yt,Fe,rn,Dn,Kt=ht.dyn_tree,Rn=ht.max_code,Lr=ht.stat_desc.static_tree,yr=ht.stat_desc.has_stree,Dr=ht.stat_desc.extra_bits,at=ht.stat_desc.extra_base,Ct=ht.stat_desc.max_length,zt=0;for(Fe=0;Fe<=C;Fe++)it.bl_count[Fe]=0;for(Kt[2*it.heap[it.heap_max]+1]=0,Lt=it.heap_max+1;Lt<v;Lt++)Ct<(Fe=Kt[2*Kt[2*(Tt=it.heap[Lt])+1]+1]+1)&&(Fe=Ct,zt++),Kt[2*Tt+1]=Fe,Rn<Tt||(it.bl_count[Fe]++,rn=0,at<=Tt&&(rn=Dr[Tt-at]),Dn=Kt[2*Tt],it.opt_len+=Dn*(Fe+rn),yr&&(it.static_len+=Dn*(Lr[2*Tt+1]+rn)));if(zt!==0){do{for(Fe=Ct-1;it.bl_count[Fe]===0;)Fe--;it.bl_count[Fe]--,it.bl_count[Fe+1]+=2,it.bl_count[Ct]--,zt-=2}while(0<zt);for(Fe=Ct;Fe!==0;Fe--)for(Tt=it.bl_count[Fe];Tt!==0;)Rn<(Yt=it.heap[--Lt])||(Kt[2*Yt+1]!==Fe&&(it.opt_len+=(Fe-Kt[2*Yt+1])*Kt[2*Yt],Kt[2*Yt+1]=Fe),Tt--)}})(U,ie),ut(fe,We,U.bl_count)}function I(U,ie,be){var L,F,fe=-1,Ce=ie[1],_e=0,Pe=7,We=4;for(Ce===0&&(Pe=138,We=3),ie[2*(be+1)+1]=65535,L=0;L<=be;L++)F=Ce,Ce=ie[2*(L+1)+1],++_e<Pe&&F===Ce||(_e<We?U.bl_tree[2*F]+=_e:F!==0?(F!==fe&&U.bl_tree[2*F]++,U.bl_tree[2*k]++):_e<=10?U.bl_tree[2*T]++:U.bl_tree[2*M]++,fe=F,We=(_e=0)===Ce?(Pe=138,3):F===Ce?(Pe=6,3):(Pe=7,4))}function ae(U,ie,be){var L,F,fe=-1,Ce=ie[1],_e=0,Pe=7,We=4;for(Ce===0&&(Pe=138,We=3),L=0;L<=be;L++)if(F=Ce,Ce=ie[2*(L+1)+1],!(++_e<Pe&&F===Ce)){if(_e<We)for(;Be(U,F,U.bl_tree),--_e!=0;);else F!==0?(F!==fe&&(Be(U,F,U.bl_tree),_e--),Be(U,k,U.bl_tree),Re(U,_e-3,2)):_e<=10?(Be(U,T,U.bl_tree),Re(U,_e-3,3)):(Be(U,M,U.bl_tree),Re(U,_e-11,7));fe=F,We=(_e=0)===Ce?(Pe=138,3):F===Ce?(Pe=6,3):(Pe=7,4)}}l(X);var N=!1;function Y(U,ie,be,L){Re(U,(u<<1)+(L?1:0),3),(function(F,fe,Ce,_e){_t(F),_e&&(ve(F,Ce),ve(F,~Ce)),i.arraySet(F.pending_buf,F.window,fe,Ce,F.pending),F.pending+=Ce})(U,ie,be,!0)}o._tr_init=function(U){N||((function(){var ie,be,L,F,fe,Ce=new Array(C+1);for(F=L=0;F<d-1;F++)for(G[F]=L,ie=0;ie<1<<B[F];ie++)x[L++]=F;for(x[L-1]=F,F=fe=0;F<16;F++)for(X[F]=fe,ie=0;ie<1<<W[F];ie++)K[fe++]=F;for(fe>>=7;F<m;F++)for(X[F]=fe<<7,ie=0;ie<1<<W[F]-7;ie++)K[256+fe++]=F;for(be=0;be<=C;be++)Ce[be]=0;for(ie=0;ie<=143;)Z[2*ie+1]=8,ie++,Ce[8]++;for(;ie<=255;)Z[2*ie+1]=9,ie++,Ce[9]++;for(;ie<=279;)Z[2*ie+1]=7,ie++,Ce[7]++;for(;ie<=287;)Z[2*ie+1]=8,ie++,Ce[8]++;for(ut(Z,p+1,Ce),ie=0;ie<m;ie++)R[2*ie+1]=5,R[2*ie]=tt(ie,5);H=new Te(Z,B,f+1,p,C),J=new Te(R,W,0,m,C),Q=new Te(new Array(0),z,0,g,_)})(),N=!0),U.l_desc=new de(U.dyn_ltree,H),U.d_desc=new de(U.dyn_dtree,J),U.bl_desc=new de(U.bl_tree,Q),U.bi_buf=0,U.bi_valid=0,dt(U)},o._tr_stored_block=Y,o._tr_flush_block=function(U,ie,be,L){var F,fe,Ce=0;0<U.level?(U.strm.data_type===2&&(U.strm.data_type=(function(_e){var Pe,We=4093624447;for(Pe=0;Pe<=31;Pe++,We>>>=1)if(1&We&&_e.dyn_ltree[2*Pe]!==0)return s;if(_e.dyn_ltree[18]!==0||_e.dyn_ltree[20]!==0||_e.dyn_ltree[26]!==0)return a;for(Pe=32;Pe<f;Pe++)if(_e.dyn_ltree[2*Pe]!==0)return a;return s})(U)),ne(U,U.l_desc),ne(U,U.d_desc),Ce=(function(_e){var Pe;for(I(_e,_e.dyn_ltree,_e.l_desc.max_code),I(_e,_e.dyn_dtree,_e.d_desc.max_code),ne(_e,_e.bl_desc),Pe=g-1;3<=Pe&&_e.bl_tree[2*V[Pe]+1]===0;Pe--);return _e.opt_len+=3*(Pe+1)+5+5+4,Pe})(U),F=U.opt_len+3+7>>>3,(fe=U.static_len+3+7>>>3)<=F&&(F=fe)):F=fe=be+5,be+4<=F&&ie!==-1?Y(U,ie,be,L):U.strategy===4||fe===F?(Re(U,2+(L?1:0),3),Ue(U,Z,R)):(Re(U,4+(L?1:0),3),(function(_e,Pe,We,it){var ht;for(Re(_e,Pe-257,5),Re(_e,We-1,5),Re(_e,it-4,4),ht=0;ht<it;ht++)Re(_e,_e.bl_tree[2*V[ht]+1],3);ae(_e,_e.dyn_ltree,Pe-1),ae(_e,_e.dyn_dtree,We-1)})(U,U.l_desc.max_code+1,U.d_desc.max_code+1,Ce+1),Ue(U,U.dyn_ltree,U.dyn_dtree)),dt(U),L&&_t(U)},o._tr_tally=function(U,ie,be){return U.pending_buf[U.d_buf+2*U.last_lit]=ie>>>8&255,U.pending_buf[U.d_buf+2*U.last_lit+1]=255&ie,U.pending_buf[U.l_buf+U.last_lit]=255&be,U.last_lit++,ie===0?U.dyn_ltree[2*be]++:(U.matches++,ie--,U.dyn_ltree[2*(x[be]+f+1)]++,U.dyn_dtree[2*ge(ie)]++),U.last_lit===U.lit_bufsize-1},o._tr_align=function(U){Re(U,2,3),Be(U,y,Z),(function(ie){ie.bi_valid===16?(ve(ie,ie.bi_buf),ie.bi_buf=0,ie.bi_valid=0):8<=ie.bi_valid&&(ie.pending_buf[ie.pending++]=255&ie.bi_buf,ie.bi_buf>>=8,ie.bi_valid-=8)})(U)}},{"../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,m={},g=!1,v=s.document,C=Object.getPrototypeOf&&Object.getPrototypeOf(s);C=C&&C.setTimeout?C:s,l={}.toString.call(s.process)==="[object process]"?function(k){process.nextTick(function(){_(k)})}:(function(){if(s.postMessage&&!s.importScripts){var k=!0,T=s.onmessage;return s.onmessage=function(){k=!1},s.postMessage("","*"),s.onmessage=T,k}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",y,!1):s.attachEvent("onmessage",y),function(k){s.postMessage(f+k,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(k){_(k.data)},function(k){d.port2.postMessage(k)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(k){var T=v.createElement("script");T.onreadystatechange=function(){_(k),T.onreadystatechange=null,u.removeChild(T),T=null},u.appendChild(T)}):function(k){setTimeout(_,0,k)},C.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var T=new Array(arguments.length-1),M=0;M<T.length;M++)T[M]=arguments[M+1];return m[p]={callback:k,args:T},l(p),p++},C.clearImmediate=w}function w(k){delete m[k]}function _(k){if(g)setTimeout(_,0,k);else{var T=m[k];if(T){g=!0;try{(function(M){var B=M.callback,W=M.args;switch(W.length){case 0:B();break;case 1:B(W[0]);break;case 2:B(W[0],W[1]);break;case 3:B(W[0],W[1],W[2]);break;default:B.apply(a,W)}})(T)}finally{w(k),g=!1}}}}function y(k){k.source===s&&typeof k.data=="string"&&k.data.indexOf(f)===0&&_(+k.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)})})),pr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Ma="application/pdf",Eu="text/html",m5={docx:pr,pdf:Ma,html:Eu},Pp={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"};Bt();var g5=X2(p5(),1),v5=e=>typeof e!="string"?"":e.trim(),Vy=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Fp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Cc=e=>{const t=e??{},n=v5(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}},dk=({current:e,other:t})=>{const n=Cc(e),r=Cc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Tu=({actor:e,fallbackKey:t=""})=>{const n=Cc(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 y5(e){return typeof e.captureStackTrace=="function"}var Np=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",y5(Error)&&Error.captureStackTrace(this,this.constructor)}},b5=class extends Np{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},w5=class extends Np{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 b5(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 w5(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 Np?r:new Np("Failed to create file object",r)}};function C5(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 Bp=new WeakMap;function fk(e){return e.ownerDocument??document}function hk(e,t){const n=Bp.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Bp.delete(t))}function pk(e,t){const n=fk(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&hk(e,e.__clickOutsideDocument);let r=Bp.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},Bp.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var Hy={mounted(e,t){pk(e,t)},updated(e,t){pk(e,t)},unmounted(e){hk(e,e.__clickOutsideDocument??fk(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function k5(e){return e[1].user!==void 0}var S5=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(k5).filter(([r,o])=>{const i=Tu({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Tu({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}})},_5=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},A5="https://ingest.superdoc.dev/v1/collect",tW="community-and-eval-agplv3";function I5(){try{return"2.18.1-next.3"}catch{return"unknown"}}var E5=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||A5,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=I5()}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{}}},zp={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"},nW=[zp.INLINE_SDT_LABEL,zp.BLOCK_SDT_LABEL],mk={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"},T5=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"}}},rW=`.${zp.BLOCK_SDT}[${mk.SDT_ID}]`,oW=`[${mk.DRAGGABLE}="true"]`,x5=typeof window<"u",gk,Ef=e=>gk=e,vk=Symbol();function $y(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Tf;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Tf||(Tf={}));var yk=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 R5(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(){M5(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function bk(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function jp(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 Vp=typeof navigator=="object"?navigator:{userAgent:""},wk=/Macintosh/.test(Vp.userAgent)&&/AppleWebKit/.test(Vp.userAgent)&&!/Safari/.test(Vp.userAgent),M5=x5?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!wk?L5:"msSaveOrOpenBlob"in Vp?D5:O5:()=>{};function L5(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?bk(r.href)?Gy(e,t,n):(r.target="_blank",jp(r)):jp(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){jp(r)},0))}function D5(e,t="download",n){if(typeof e=="string")if(bk(e))Gy(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){jp(r)})}else navigator.msSaveOrOpenBlob(R5(e,n),t)}function O5(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(yk.HTMLElement))||"safari"in yk,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||wk)&&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:iW}=Object;function P5(){const e=Zg(!0),t=e.run(()=>re({}));let n=[],r=[];const o=$r({install(i){Ef(o),o._a=i,i.provide(vk,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 Ck=()=>{};function kk(e,t,n,r=Ck){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&Qg()&&h1(o),o}function xu(e,...t){e.forEach(n=>{n(...t)})}var F5=e=>e(),Sk=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)&&!sr(r)&&!Fi(r)?e[n]=Ky(o,r):e[n]=r}return e}var N5=Symbol();function B5(e){return!$y(e)||!Object.prototype.hasOwnProperty.call(e,N5)}var{assign:Cl}=Object;function z5(e){return!!(sr(e)&&e.effect)}function j5(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=_1(n.state.value[e]);return Cl(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=$r(Se(()=>{Ef(n);const m=n._s.get(e);return s[p].call(m,m)})),f),{}))}return l=_k(e,u,t,n,r,!0),l}function _k(e,t,n={},r,o,i){let s;const a=Cl({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,m;const g=r.state.value[e];!i&&!g&&(r.state.value[e]={});let v;function C(M){let B;u=d=!1,typeof M=="function"?(M(r.state.value[e]),B={type:Tf.patchFunction,storeId:e,events:m}):(Ky(r.state.value[e],M),B={type:Tf.patchObject,payload:M,storeId:e,events:m});const W=v=Symbol();St().then(()=>{v===W&&(u=!0)}),d=!0,xu(f,B,r.state.value[e])}const w=i?function(){const{state:B}=n,W=B?B():{};this.$patch(z=>{Cl(z,W)})}:Ck;function _(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const y=(M,B="")=>{if(Sk in M)return M[Wy]=B,M;const W=function(){Ef(r);const z=Array.from(arguments),V=new Set,Z=new Set;function R(G){V.add(G)}function K(G){Z.add(G)}xu(p,{args:z,name:W[Wy],store:k,after:R,onError:K});let x;try{x=M.apply(this&&this.$id===e?this:k,z)}catch(G){throw xu(Z,G),G}return x instanceof Promise?x.then(G=>(xu(V,G),G)).catch(G=>(xu(Z,G),Promise.reject(G))):(xu(V,x),x)};return W[Sk]=!0,W[Wy]=B,W},k=Zr({_p:r,$id:e,$onAction:kk.bind(null,p),$patch:C,$reset:w,$subscribe(M,B={}){const W=kk(f,M,B.detached,()=>z()),z=s.run(()=>Vt(()=>r.state.value[e],V=>{(B.flush==="sync"?d:u)&&M({storeId:e,type:Tf.direct,events:m},V)},Cl({},l,B)));return W},$dispose:_});r._s.set(e,k);const T=(r._a&&r._a.runWithContext||F5)(()=>r._e.run(()=>(s=Zg()).run(()=>t({action:y}))));for(const M in T){const B=T[M];sr(B)&&!z5(B)||Fi(B)?i||(g&&B5(B)&&(sr(B)?B.value=g[M]:Ky(B,g[M])),r.state.value[e][M]=B):typeof B=="function"&&(T[M]=y(B,M),a.actions[M]=B)}return Cl(k,T),Cl(yn(k),T),Object.defineProperty(k,"$state",{get:()=>r.state.value[e],set:M=>{C(B=>{Cl(B,M)})}}),r._p.forEach(M=>{Cl(k,s.run(()=>M({store:k,app:r._a,pinia:r,options:a})))}),g&&i&&n.hydrate&&n.hydrate(k.$state,g),u=!0,d=!0,k}function Ak(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=Q1();return s=s||(l?dl(vk,null):null),s&&Ef(s),s=gk,s._s.has(e)||(o?_k(e,t,r,s):j5(e,r,s)),s._s.get(e)}return i.$id=e,i}function zs(e){const t=yn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=Se({get:()=>e[r],set(i){e[r]=i}}):(sr(o)||Fi(o))&&(n[r]=sv(e,r))}return n}function Ik(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function Ek(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 kc(e){return typeof e=="string"&&e.length>0?e:null}function V5(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 U5(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 H5(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 $5(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function Up(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 G5(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function W5(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 Tk(e,t){const n=kc(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=V5(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: ${Ek(r)}).`};const i=H5(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?kc(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 K5(e){const t=kc(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty v2Collaboration.adapterId."};const n=kc(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:kc(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 q5(e,t){const n=kc(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=kc(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=U5(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 xk(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=Ik(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=W5(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",f=Ek(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=$5(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=G5(s);return l===null||l==="y-websocket"?Up(Tk("y-websocket",s),a):l==="hocuspocus"?Up(Tk("hocuspocus",s),a):l==="liveblocks"?Up(q5(s,o),a):l==="extension"?Up(K5(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 xf=(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?xf(e.originFileObj,e.name||t):e.file?xf(e.file,e.name||t):e.raw?xf(e.raw,e.name||t):null},Rk=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,Y5=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,kl=e=>{if(ArrayBuffer.isView(e))return Y5?.call(e)==="Uint8Array";if(!Rk)return!1;try{return Rk.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 pr:return pr;case"pdf":case Ma:return Ma;case"html":case Eu:return Eu;default:return e}},Hp=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?pr:t.endsWith(".pdf")?Ma:t.endsWith(".html")||t.endsWith(".htm")?Eu:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},X5=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",Z5="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:Ik(e)}}if(kl(e))return{type:pr,data:Xy(e),name:"document.docx"};const t=xf(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=Hp(n),i=o||Hp(r),s=t.type.toLowerCase()===Z5,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(kl(e.data)){const r=Qy(e.type||Hp(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||X5(r)}}const n=xf(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?Qy(e.type):"",o=r||n.type||Hp(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};Bt();function Q5(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?Zr({...t}):re(t),i=re(null);return Vt(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function J5(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}=Q5(e,i,re([])),l=re(e.itemtype),u=re(e.itemfieldtype),d=e,f=Zr({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=re(e.logicrules),m=re(!1),g=Zr({}),v={SELECT:t6,IMAGEINPUT:e6,CHECKBOXINPUT:n6};return l.value in v&&Object.assign(g,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:m,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...g}}function e6(e){return{fontfamily:re(e.fontfamily),iteminputtype:re(e.iteminputtype)}}function t6(e){return{options:re(e.itemoptions)}}function n6(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 js=()=>new Map,e0=e=>{const t=js();return e.forEach((n,r)=>{t.set(r,n)}),t},Ru=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},r6=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},o6=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Mu=()=>new Set,t0=e=>e[e.length-1],Lu=Array.from,n0=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},Mk=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},i6=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},$p=Array.isArray,s6=class{constructor(){this._observers=js()}on(e,t){return Ru(this._observers,e,Mu).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 Lu((this._observers.get(e)||js()).values()).forEach(n=>n(...t))}destroy(){this._observers=js()}},La=Math.floor,Gp=Math.abs,Lk=(e,t)=>e<t?e:t,Du=(e,t)=>e>t?e:t,sW=Number.isNaN,a6=e=>e!==0?e<0:1/e<0,aW=1,lW=2,cW=4,uW=8,dW=32,fW=64,hW=128,l6=1<<17,c6=1<<18,u6=1<<19,d6=1<<20,f6=1<<21,h6=1<<22,p6=1<<23,m6=1<<24,g6=1<<25,v6=1<<26,y6=1<<27,b6=1<<28,w6=1<<29,C6=1<<30,pW=31,mW=63,gW=127,vW=l6-1,yW=c6-1,bW=u6-1,wW=d6-1,CW=f6-1,kW=h6-1,SW=p6-1,_W=m6-1,AW=g6-1,IW=v6-1,EW=y6-1,TW=b6-1,xW=w6-1,RW=C6-1,MW=2147483647,Dk=Number.MAX_SAFE_INTEGER,Ok=Number.MIN_SAFE_INTEGER,k6=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&La(e)===e),LW=Number.isNaN,DW=Number.parseInt,Pk=String.fromCharCode,OW=String.fromCodePoint,PW=Pk(65535),S6=e=>e.toLowerCase(),_6=/^\s*/g,A6=e=>e.replace(_6,""),I6=/([A-Z])/g,Fk=(e,t)=>A6(e.replace(I6,n=>`${t}${S6(n)}`)),E6=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},Rf=typeof TextEncoder<"u"?new TextEncoder:null,T6=e=>Rf.encode(e),x6=Rf?T6:E6,r0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});r0&&r0.decode(new Uint8Array).length===1&&(r0=null);var R6=(e,t)=>i6(t,()=>e).join(""),Mf=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},o0=()=>new Mf,M6=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},Da=e=>{const t=new Uint8Array(M6(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},L6=(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(Du(n,t)*2),e.cpos=0)},lo=(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=lo,qn=(e,t)=>{for(;t>127;)lo(e,128|127&t),t=La(t/128);lo(e,127&t)},s0=(e,t)=>{const n=a6(t);for(n&&(t=-t),lo(e,(t>63?128:0)|(n?64:0)|63&t),t=La(t/64);t>0;)lo(e,(t>127?128:0)|127&t),t=La(t/128)},a0=new Uint8Array(3e4),D6=a0.length/3,O6=(e,t)=>{if(t.length<D6){const n=Rf.encodeInto(t,a0).written||0;qn(e,n);for(let r=0;r<n;r++)lo(e,a0[r])}else wi(e,x6(t))},P6=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;qn(e,r);for(let o=0;o<r;o++)lo(e,n.codePointAt(o))},Ou=Rf&&Rf.encodeInto?O6:P6,l0=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=Lk(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(Du(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},wi=(e,t)=>{qn(e,t.byteLength),l0(e,t)},c0=(e,t)=>{L6(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},F6=(e,t)=>c0(e,4).setFloat32(0,t,!1),N6=(e,t)=>c0(e,8).setFloat64(0,t,!1),B6=(e,t)=>c0(e,8).setBigInt64(0,t,!1),Nk=new DataView(new ArrayBuffer(4)),z6=e=>(Nk.setFloat32(0,e),Nk.getFloat32(0)===e),Lf=(e,t)=>{switch(typeof t){case"string":lo(e,119),Ou(e,t);break;case"number":k6(t)&&Gp(t)<=2147483647?(lo(e,125),s0(e,t)):z6(t)?(lo(e,124),F6(e,t)):(lo(e,123),N6(e,t));break;case"bigint":lo(e,122),B6(e,t);break;case"object":if(t===null)lo(e,126);else if($p(t)){lo(e,117),qn(e,t.length);for(let n=0;n<t.length;n++)Lf(e,t[n])}else if(t instanceof Uint8Array)lo(e,116),wi(e,t);else{lo(e,118);const n=Object.keys(t);qn(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];Ou(e,o),Lf(e,t[o])}}break;case"boolean":lo(e,t?120:121);break;default:lo(e,127)}},Bk=class extends Mf{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&qn(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},zk=e=>{e.count>0&&(s0(e.encoder,e.count===1?e.s:-e.s),e.count>1&&qn(e.encoder,e.count-2))},Wp=class{constructor(){this.encoder=new Mf,this.s=0,this.count=0}write(e){this.s===e?this.count++:(zk(this),this.count=1,this.s=e)}toUint8Array(){return zk(this),Da(this.encoder)}},jk=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);s0(e.encoder,t),e.count>1&&qn(e.encoder,e.count-2)}},u0=class{constructor(){this.encoder=new Mf,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(jk(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return jk(this),Da(this.encoder)}},j6=class{constructor(){this.sarr=[],this.s="",this.lensE=new Wp}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 Mf;return this.sarr.push(this.s),this.s="",Ou(e,this.sarr.join("")),l0(e,this.lensE.toUint8Array()),Da(e)}},Sl=e=>new Error(e),cs=()=>{throw Sl("Method unimplemented")},Oa=()=>{throw Sl("Unexpected case")},FW=crypto.subtle,V6=crypto.getRandomValues.bind(crypto),Vk=()=>V6(new Uint32Array(1))[0],U6="10000000-1000-4000-8000-100000000000",H6=()=>U6.replace(/[018]/g,e=>(e^Vk()&15>>e/4).toString(16)),$6=Date.now,Uk=e=>new Promise(e),NW=Promise.all.bind(Promise),Hk=e=>e===void 0?null:e,G6=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},$k=new G6,W6=!0;try{typeof localStorage<"u"&&localStorage&&($k=localStorage,W6=!1)}catch{}var K6=$k,Df=Symbol("Equality"),Gk=(e,t)=>e===t||!!e?.[Df]?.(t)||!1,q6=e=>typeof e=="object",Y6=Object.assign,X6=Object.keys,Z6=(e,t)=>{for(const n in e)t(e[n],n)},Kp=e=>X6(e).length,Q6=e=>{for(const t in e)return!1;return!0},Of=(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),J6=(e,t)=>e===t||Kp(e)===Kp(t)&&Of(e,(n,r)=>(n!==void 0||d0(t,r))&&Gk(t[r],n)),e8=Object.freeze,Wk=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&Wk(e[t])}return e8(e)},f0=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&f0(e,t,n+1)}},qp=(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[Df]!=null)return e[Df](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)||!qp(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Kp(e)!==Kp(t))return!1;for(const n in e)if(!d0(e,n)||!qp(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(!qp(e[n],t[n]))return!1;break;default:return!1}return!0},t8=(e,t)=>t.includes(e),Pf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",BW=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,Vs,n8=[],r8=()=>{if(Vs===void 0)if(Pf){Vs=js();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&Vs.set(t,""),t=r):t!==null?(Vs.set(t,r),t=null):n8.push(r)}t!==null&&Vs.set(t,"")}else typeof location=="object"?(Vs=js(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");Vs.set(`--${Fk(t,"-")}`,n),Vs.set(`-${Fk(t,"-")}`,n)}})):Vs=js();return Vs},h0=e=>r8().has(e),Yp=e=>Hk(Pf?process.env[e.toUpperCase().replaceAll("-","_")]:K6.getItem(e)),Kk=e=>h0("--"+e)||Yp(e)!==null,o8=Kk("production"),i8=Pf&&t8(process.env.FORCE_COLOR,["true","1","2"]),s8=i8||!h0("--no-colors")&&!Kk("no-color")&&(!Pf||process.stdout.isTTY)&&(!Pf||h0("--color")||Yp("COLORTERM")!==null||(Yp("TERM")||"").includes("color")),a8=class{constructor(e,t){this.left=e,this.right=t}},Pa=(e,t)=>new a8(e,t),qk=e=>e.next()>=.5,p0=(e,t,n)=>La(e.next()*(n+1-t)+t),Yk=(e,t,n)=>La(e.next()*(n+1-t)+t),m0=(e,t,n)=>Yk(e,t,n),l8=e=>Pk(m0(e,97,122)),c8=(e,t=0,n=20)=>{const r=m0(e,t,n);let o="";for(let i=0;i<r;i++)o+=l8(e);return o},g0=(e,t)=>t[m0(e,0,t.length-1)],u8=Symbol("0schema"),d8=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(R6(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
4
+ \0`,Re+=i(de,2),Re+=M.magic,Re+=i(y,2),Re+=i(k,2),Re+=i(Te.crc32,4),Re+=i(Te.compressedSize,4),Re+=i(Te.uncompressedSize,4),Re+=i(W.length,2),Re+=i(G.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Re+W+G,dirRecord:f.CENTRAL_FILE_HEADER+i(ve,2)+Re+i(Z.length,2)+"\0\0\0\0"+i(ge,4)+i(C,4)+W+G+Z}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(m,g,v,C){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=v,this.encodeFileName=C,this.streamFiles=m,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(m){var g=m.meta.percent||0,v=this.entriesCount,C=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,l.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:v?(g+100*(v-C-1))/v:100}}))},p.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var g=this.streamFiles&&!m.file.dir;if(g){var v=s(m,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(m){this.accumulate=!1;var g=this.streamFiles&&!m.file.dir,v=s(m,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),g)this.push({data:(function(C){return f.DATA_DESCRIPTOR+i(C.crc32,4)+i(C.compressedSize,4)+i(C.uncompressedSize,4)})(m),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 m=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var v=this.bytesWritten-m,C=(function(w,_,y,k,T){var M=a.transformTo("string",T(k));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(_,4)+i(y,4)+i(M.length,2)+M})(this.dirRecords.length,v,m,this.zipComment,this.encodeFileName);this.push({data:C,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(m){this._sources.push(m);var g=this;return m.on("data",function(v){g.processChunk(v)}),m.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),m.on("error",function(v){g.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(m){var g=this._sources;if(!l.prototype.error.call(this,m))return!1;for(var v=0;v<g.length;v++)try{g[v].error(m)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var m=this._sources,g=0;g<m.length;g++)m[g].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,m){f++;var g=(function(_,y){var k=_||y,T=i[k];if(!T)throw new Error(k+" is not a valid compression method !");return T})(m.options.compression,l.compression),v=m.options.compressionOptions||l.compressionOptions||{},C=m.dir,w=m.date;m._compressWorker(g,v).withStreamInfo("file",{name:p,dir:C,date:w,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.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(m,g){var v=p.decompressed.getContentWorker().pipe(new u);v.on("error",function(C){g(C)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):m()}).resume()})}r.exports=function(p,m){var g=this;return m=i.extend(m||{},{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,m.optimizedBinaryString,m.base64).then(function(v){var C=new l(m);return C.load(v),C}).then(function(v){var C=[s.Promise.resolve(v)],w=v.files;if(m.checkCRC32)for(var _=0;_<w.length;_++)C.push(f(w[_]));return s.Promise.all(C)}).then(function(v){for(var C=v.shift(),w=C.files,_=0;_<w.length;_++){var y=w[_],k=y.fileNameStr,T=i.resolve(y.fileNameStr);g.file(T,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:m.createFolders}),y.dir||(g.file(T).unsafeOriginalName=k)}return C.zipComment.length&&(g.comment=C.zipComment),g})}},{"./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(k,T,M){var B,W=a.getTypeOf(T),z=a.extend(M||{},d);z.date=z.date||new Date,z.compression!==null&&(z.compression=z.compression.toUpperCase()),typeof z.unixPermissions=="string"&&(z.unixPermissions=parseInt(z.unixPermissions,8)),z.unixPermissions&&16384&z.unixPermissions&&(z.dir=!0),z.dosPermissions&&16&z.dosPermissions&&(z.dir=!0),z.dir&&(k=w(k)),z.createFolders&&(B=C(k))&&_.call(this,B,!0);var V=W==="string"&&z.binary===!1&&z.base64===!1;M&&M.binary!==void 0||(z.binary=!V),(T instanceof f&&T.uncompressedSize===0||z.dir||!T||T.length===0)&&(z.base64=!1,z.binary=!0,T="",z.compression="STORE",W="string");var Z=null;Z=T instanceof f||T instanceof l?T:g.isNode&&g.isStream(T)?new v(k,T):a.prepareContent(k,T,z.binary,z.optimizedBinaryString,z.base64);var R=new p(k,Z,z);this.files[k]=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"),m=n("./generate"),g=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),C=function(k){k.slice(-1)==="/"&&(k=k.substring(0,k.length-1));var T=k.lastIndexOf("/");return 0<T?k.substring(0,T):""},w=function(k){return k.slice(-1)!=="/"&&(k+="/"),k},_=function(k,T){return T=T!==void 0?T:d.createFolders,k=w(k),this.files[k]||i.call(this,k,null,{dir:!0,createFolders:T}),this.files[k]};function y(k){return Object.prototype.toString.call(k)==="[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(k){var T,M,B;for(T in this.files)B=this.files[T],(M=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&k(M,B)},filter:function(k){var T=[];return this.forEach(function(M,B){k(M,B)&&T.push(B)}),T},file:function(k,T,M){if(arguments.length!==1)return k=this.root+k,i.call(this,k,T,M),this;if(y(k)){var B=k;return this.filter(function(z,V){return!V.dir&&B.test(z)})}var W=this.files[this.root+k];return W&&!W.dir?W:null},folder:function(k){if(!k)return this;if(y(k))return this.filter(function(W,z){return z.dir&&k.test(W)});var T=this.root+k,M=_.call(this,T),B=this.clone();return B.root=M.name,B},remove:function(k){k=this.root+k;var T=this.files[k];if(T||(k.slice(-1)!=="/"&&(k+="/"),T=this.files[k]),T&&!T.dir)delete this.files[k];else for(var M=this.filter(function(W,z){return z.name.slice(0,k.length)===k}),B=0;B<M.length;B++)delete this.files[M[B].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(k){var T,M={};try{if((M=a.extend(k||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=M.type.toLowerCase(),M.compression=M.compression.toUpperCase(),M.type==="binarystring"&&(M.type="string"),!M.type)throw new Error("No output type specified.");a.checkSupport(M.type),M.platform!=="darwin"&&M.platform!=="freebsd"&&M.platform!=="linux"&&M.platform!=="sunos"||(M.platform="UNIX"),M.platform==="win32"&&(M.platform="DOS");var B=M.comment||this.comment||"";T=m.generateWorker(this,M,B)}catch(W){(T=new l("error")).error(W)}return new u(T,M.type||"string",M.mimeType)},generateAsync:function(k,T){return this.generateInternalStream(k).accumulate(T)},generateNodeStream:function(k,T){return(k=k||{}).type||(k.type="nodebuffer"),this.generateInternalStream(k).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(g,v){return new d.Promise(function(C,w){var _=[],y=g._internalType,k=g._outputType,T=g._mimeType;g.on("data",function(M,B){_.push(M),v&&v(B)}).on("error",function(M){_=[],w(M)}).on("end",function(){try{C((function(M,B,W){switch(M){case"blob":return i.newBlob(i.transformTo("arraybuffer",B),W);case"base64":return l.encode(B);default:return i.transformTo(M,B)}})(k,(function(M,B){var W,z=0,V=null,Z=0;for(W=0;W<B.length;W++)Z+=B[W].length;switch(M){case"string":return B.join("");case"array":return Array.prototype.concat.apply([],B);case"uint8array":for(V=new Uint8Array(Z),W=0;W<B.length;W++)V.set(B[W],z),z+=B[W].length;return V;case"nodebuffer":return Buffer.concat(B);default:throw new Error("concat : unsupported type '"+M+"'")}})(y,_),T))}catch(M){w(M)}_=[]}).resume()})}function m(g,v,C){var w=v;switch(v){case"blob":case"arraybuffer":w="uint8array";break;case"base64":w="string"}try{this._internalType=w,this._outputType=v,this._mimeType=C,i.checkSupport(w),this._worker=g.pipe(new s(w)),g.lock()}catch(_){this._worker=new a("error"),this._worker.error(_)}}m.prototype={accumulate:function(g){return p(this,g)},on:function(g,v){var C=this;return g==="data"?this._worker.on(g,function(w){v.call(C,w.data,w.meta)}):this._worker.on(g,function(){i.delay(v,arguments,C)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){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"},g)}},r.exports=m},{"../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(m){return s.nodebuffer?a.newBufferFrom(m,"utf-8"):(function(g){var v,C,w,_,y,k=g.length,T=0;for(_=0;_<k;_++)(64512&(C=g.charCodeAt(_)))==55296&&_+1<k&&(64512&(w=g.charCodeAt(_+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),_++),T+=C<128?1:C<2048?2:C<65536?3:4;for(v=s.uint8array?new Uint8Array(T):new Array(T),_=y=0;y<T;_++)(64512&(C=g.charCodeAt(_)))==55296&&_+1<k&&(64512&(w=g.charCodeAt(_+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),_++),C<128?v[y++]=C:(C<2048?v[y++]=192|C>>>6:(C<65536?v[y++]=224|C>>>12:(v[y++]=240|C>>>18,v[y++]=128|C>>>12&63),v[y++]=128|C>>>6&63),v[y++]=128|63&C);return v})(m)},o.utf8decode=function(m){return s.nodebuffer?i.transformTo("nodebuffer",m).toString("utf-8"):(function(g){var v,C,w,_,y=g.length,k=new Array(2*y);for(v=C=0;v<y;)if((w=g[v++])<128)k[C++]=w;else if(4<(_=u[w]))k[C++]=65533,v+=_-1;else{for(w&=_===2?31:_===3?15:7;1<_&&v<y;)w=w<<6|63&g[v++],_--;1<_?k[C++]=65533:w<65536?k[C++]=w:(w-=65536,k[C++]=55296|w>>10&1023,k[C++]=56320|1023&w)}return k.length!==C&&(k.subarray?k=k.subarray(0,C):k.length=C),i.applyFromCharCode(k)})(m=i.transformTo(s.uint8array?"uint8array":"array",m))},i.inherits(f,l),f.prototype.processChunk=function(m){var g=i.transformTo(s.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=g;(g=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),g.set(v,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var C=(function(_,y){var k;for((y=y||_.length)>_.length&&(y=_.length),k=y-1;0<=k&&(192&_[k])==128;)k--;return k<0||k===0?y:k+u[_[k]]>y?k:y})(g),w=g;C!==g.length&&(s.uint8array?(w=g.subarray(0,C),this.leftOver=g.subarray(C,g.length)):(w=g.slice(0,C),this.leftOver=g.slice(C,g.length))),this.push({data:o.utf8decode(w),meta:m.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(m){this.push({data:o.utf8encode(m.data),meta:m.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,C){for(var w=0;w<v.length;++w)C[w]=255&v.charCodeAt(w);return C}n("setimmediate"),o.newBlob=function(v,C){o.checkSupport("blob");try{return new Blob([v],{type:C})}catch{try{var w=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return w.append(v),w.getBlob(C)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(v,C,w){var _=[],y=0,k=v.length;if(k<=w)return String.fromCharCode.apply(null,v);for(;y<k;)C==="array"||C==="nodebuffer"?_.push(String.fromCharCode.apply(null,v.slice(y,Math.min(y+w,k)))):_.push(String.fromCharCode.apply(null,v.subarray(y,Math.min(y+w,k)))),y+=w;return _.join("")},stringifyByChar:function(v){for(var C="",w=0;w<v.length;w++)C+=String.fromCharCode(v[w]);return C},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 C=65536,w=o.getTypeOf(v),_=!0;if(w==="uint8array"?_=f.applyCanBeUsed.uint8array:w==="nodebuffer"&&(_=f.applyCanBeUsed.nodebuffer),_)for(;1<C;)try{return f.stringifyByChunk(v,w,C)}catch{C=Math.floor(C/2)}return f.stringifyByChar(v)}function m(v,C){for(var w=0;w<v.length;w++)C[w]=v[w];return C}o.applyFromCharCode=p;var g={};g.string={string:u,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return g.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},g.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)}},g.arraybuffer={string:function(v){return p(new Uint8Array(v))},array:function(v){return m(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))}},g.uint8array={string:p,array:function(v){return m(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return a.newBufferFrom(v)}},g.nodebuffer={string:p,array:function(v){return m(v,new Array(v.length))},arraybuffer:function(v){return g.nodebuffer.uint8array(v).buffer},uint8array:function(v){return m(v,new Uint8Array(v.length))},nodebuffer:u},o.transformTo=function(v,C){return C=C||"",v?(o.checkSupport(v),g[o.getTypeOf(C)][v](C)):C},o.resolve=function(v){for(var C=v.split("/"),w=[],_=0;_<C.length;_++){var y=C[_];y==="."||y===""&&_!==0&&_!==C.length-1||(y===".."?w.pop():w.push(y))}return w.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 C,w,_="";for(w=0;w<(v||"").length;w++)_+="\\x"+((C=v.charCodeAt(w))<16?"0":"")+C.toString(16).toUpperCase();return _},o.delay=function(v,C,w){setImmediate(function(){v.apply(w||null,C||[])})},o.inherits=function(v,C){function w(){}w.prototype=C.prototype,v.prototype=new w},o.extend=function(){var v,C,w={};for(v=0;v<arguments.length;v++)for(C in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],C)&&w[C]===void 0&&(w[C]=arguments[v][C]);return w},o.prepareContent=function(v,C,w,_,y){return l.Promise.resolve(C).then(function(k){return i.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,M){var B=new FileReader;B.onload=function(W){T(W.target.result)},B.onerror=function(W){M(W.target.error)},B.readAsArrayBuffer(k)}):k}).then(function(k){var T=o.getTypeOf(k);return T?(T==="arraybuffer"?k=o.transformTo("uint8array",k):T==="string"&&(y?k=s.decode(k):w&&_!==!0&&(k=(function(M){return d(M,i.uint8array?new Uint8Array(M.length):new Array(M.length))})(k))),k):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 m=this.reader.index;this.reader.setIndex(f);var g=this.reader.readString(4)===p;return this.reader.setIndex(m),g},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",m=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(m)},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,m,g=this.zip64EndOfCentralSize-44;0<g;)f=this.reader.readInt(2),p=this.reader.readInt(4),m=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:m}},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 m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var g=p-m;if(0<g)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" 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(m,g){this.options=m,this.loadOptions=g}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(m){var g,v;if(m.skip(22),this.fileNameLength=m.readInt(2),v=m.readInt(2),this.fileName=m.readData(this.fileNameLength),m.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((g=(function(C){for(var w in d)if(Object.prototype.hasOwnProperty.call(d,w)&&d[w].magic===C)return d[w];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,g,m.readData(this.compressedSize))},readCentralPart:function(m){this.versionMadeBy=m.readInt(2),m.skip(2),this.bitFlag=m.readInt(2),this.compressionMethod=m.readString(2),this.date=m.readDate(),this.crc32=m.readInt(4),this.compressedSize=m.readInt(4),this.uncompressedSize=m.readInt(4);var g=m.readInt(2);if(this.extraFieldsLength=m.readInt(2),this.fileCommentLength=m.readInt(2),this.diskNumberStart=m.readInt(2),this.internalFileAttributes=m.readInt(2),this.externalFileAttributes=m.readInt(4),this.localHeaderOffset=m.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");m.skip(g),this.readExtraFields(m),this.parseZIP64ExtraField(m),this.fileComment=m.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var m=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var g,v,C,w=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4<w;)g=m.readInt(2),v=m.readInt(2),C=m.readData(v),this.extraFields[g]={id:g,length:v,value:C};m.setIndex(w)},handleUTF8:function(){var m=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var v=s.transformTo(m,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var C=this.findExtraFieldUnicodeComment();if(C!==null)this.fileCommentStr=C;else{var w=s.transformTo(m,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var m=this.extraFields[28789];if(m){var g=i(m.value);return g.readInt(1)!==1||l(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(m.length-5))}return null},findExtraFieldUnicodeComment:function(){var m=this.extraFields[25461];if(m){var g=i(m.value);return g.readInt(1)!==1||l(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(m.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(g,v,C){this.name=g,this.dir=C.dir,this.date=C.date,this.comment=C.comment,this.unixPermissions=C.unixPermissions,this.dosPermissions=C.dosPermissions,this._data=v,this._dataBinary=C.binary,this.options={compression:C.compression,compressionOptions:C.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(g){var v=null,C="string";try{if(!g)throw new Error("No output type specified.");var w=(C=g.toLowerCase())==="string"||C==="text";C!=="binarystring"&&C!=="text"||(C="string"),v=this._decompressWorker();var _=!this._dataBinary;_&&!w&&(v=v.pipe(new l.Utf8EncodeWorker)),!_&&w&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(y){(v=new d("error")).error(y)}return new s(v,C,"")},async:function(g,v){return this.internalStream(g).accumulate(v)},nodeStream:function(g,v){return this.internalStream(g||"nodebuffer").toNodejsStream(v)},_compressWorker:function(g,v){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var C=this._decompressWorker();return this._dataBinary||(C=C.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(C,g,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.")},m=0;m<f.length;m++)i.prototype[f[m]]=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(g),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(){g(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(g,0)};else{var p=new i.MessageChannel;p.port1.onmessage=g,s=function(){p.port2.postMessage(0)}}var m=[];function g(){var v,C;a=!0;for(var w=m.length;w;){for(C=m,m=[],v=-1;++v<w;)C[v]();w=m.length}a=!1}r.exports=function(v){m.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(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,w!==s&&v(this,w)}function p(w,_,y){this.promise=w,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function m(w,_,y){i(function(){var k;try{k=_(y)}catch(T){return a.reject(w,T)}k===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,k)})}function g(w){var _=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof _=="function")return function(){_.apply(w,arguments)}}function v(w,_){var y=!1;function k(B){y||(y=!0,a.reject(w,B))}function T(B){y||(y=!0,a.resolve(w,B))}var M=C(function(){_(T,k)});M.status==="error"&&k(M.value)}function C(w,_){var y={};try{y.value=w(_),y.status="success"}catch(k){y.status="error",y.value=k}return y}(r.exports=f).prototype.finally=function(w){if(typeof w!="function")return this;var _=this.constructor;return this.then(function(y){return _.resolve(w()).then(function(){return y})},function(y){return _.resolve(w()).then(function(){throw y})})},f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,_){if(typeof w!="function"&&this.state===u||typeof _!="function"&&this.state===l)return this;var y=new this.constructor(s);return this.state!==d?m(y,this.state===u?w:_,this.outcome):this.queue.push(new p(y,w,_)),y},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){m(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){m(this.promise,this.onRejected,w)},a.resolve=function(w,_){var y=C(g,_);if(y.status==="error")return a.reject(w,y.value);var k=y.value;if(k)v(w,k);else{w.state=u,w.outcome=_;for(var T=-1,M=w.queue.length;++T<M;)w.queue[T].callFulfilled(_)}return w},a.reject=function(w,_){w.state=l,w.outcome=_;for(var y=-1,k=w.queue.length;++y<k;)w.queue[y].callRejected(_);return w},f.resolve=function(w){return w instanceof this?w:a.resolve(new this(s),w)},f.reject=function(w){var _=new this(s);return a.reject(_,w)},f.all=function(w){var _=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=w.length,k=!1;if(!y)return this.resolve([]);for(var T=new Array(y),M=0,B=-1,W=new this(s);++B<y;)z(w[B],B);return W;function z(V,Z){_.resolve(V).then(function(R){T[Z]=R,++M!==y||k||(k=!0,a.resolve(W,T))},function(R){k||(k=!0,a.reject(W,R))})}},f.race=function(w){var _=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=w.length,k=!1;if(!y)return this.resolve([]);for(var T=-1,M=new this(s);++T<y;)B=w[T],_.resolve(B).then(function(W){k||(k=!0,a.resolve(M,W))},function(W){k||(k=!0,a.reject(M,W))});var B;return M}},{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,m=0,g=8;function v(w){if(!(this instanceof v))return new v(w);this.options=s.assign({level:p,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},w||{});var _=this.options;_.raw&&0<_.windowBits?_.windowBits=-_.windowBits:_.gzip&&0<_.windowBits&&_.windowBits<16&&(_.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var y=i.deflateInit2(this.strm,_.level,_.method,_.windowBits,_.memLevel,_.strategy);if(y!==f)throw new Error(l[y]);if(_.header&&i.deflateSetHeader(this.strm,_.header),_.dictionary){var k;if(k=typeof _.dictionary=="string"?a.string2buf(_.dictionary):d.call(_.dictionary)==="[object ArrayBuffer]"?new Uint8Array(_.dictionary):_.dictionary,(y=i.deflateSetDictionary(this.strm,k))!==f)throw new Error(l[y]);this._dict_set=!0}}function C(w,_){var y=new v(_);if(y.push(w,!0),y.err)throw y.msg||l[y.err];return y.result}v.prototype.push=function(w,_){var y,k,T=this.strm,M=this.options.chunkSize;if(this.ended)return!1;k=_===~~_?_:_===!0?4:0,typeof w=="string"?T.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?T.input=new Uint8Array(w):T.input=w,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new s.Buf8(M),T.next_out=0,T.avail_out=M),(y=i.deflate(T,k))!==1&&y!==f)return this.onEnd(y),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||k!==4&&k!==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)&&y!==1);return k===4?(y=i.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===f):k!==2||(this.onEnd(f),!(T.avail_out=0))},v.prototype.onData=function(w){this.chunks.push(w)},v.prototype.onEnd=function(w){w===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg},o.Deflate=v,o.deflate=C,o.deflateRaw=function(w,_){return(_=_||{}).raw=!0,C(w,_)},o.gzip=function(w,_){return(_=_||{}).gzip=!0,C(w,_)}},{"./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 m(v){if(!(this instanceof m))return new m(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var C=this.options;C.raw&&0<=C.windowBits&&C.windowBits<16&&(C.windowBits=-C.windowBits,C.windowBits===0&&(C.windowBits=-15)),!(0<=C.windowBits&&C.windowBits<16)||v&&v.windowBits||(C.windowBits+=32),15<C.windowBits&&C.windowBits<48&&(15&C.windowBits)==0&&(C.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var w=i.inflateInit2(this.strm,C.windowBits);if(w!==l.Z_OK)throw new Error(u[w]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function g(v,C){var w=new m(C);if(w.push(v,!0),w.err)throw w.msg||u[w.err];return w.result}m.prototype.push=function(v,C){var w,_,y,k,T,M,B=this.strm,W=this.options.chunkSize,z=this.options.dictionary,V=!1;if(this.ended)return!1;_=C===~~C?C:C===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?B.input=a.binstring2buf(v):p.call(v)==="[object ArrayBuffer]"?B.input=new Uint8Array(v):B.input=v,B.next_in=0,B.avail_in=B.input.length;do{if(B.avail_out===0&&(B.output=new s.Buf8(W),B.next_out=0,B.avail_out=W),(w=i.inflate(B,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&z&&(M=typeof z=="string"?a.string2buf(z):p.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,w=i.inflateSetDictionary(this.strm,M)),w===l.Z_BUF_ERROR&&V===!0&&(w=l.Z_OK,V=!1),w!==l.Z_STREAM_END&&w!==l.Z_OK)return this.onEnd(w),!(this.ended=!0);B.next_out&&(B.avail_out!==0&&w!==l.Z_STREAM_END&&(B.avail_in!==0||_!==l.Z_FINISH&&_!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=a.utf8border(B.output,B.next_out),k=B.next_out-y,T=a.buf2string(B.output,y),B.next_out=k,B.avail_out=W-k,k&&s.arraySet(B.output,B.output,y,k,0),this.onData(T)):this.onData(s.shrinkBuf(B.output,B.next_out)))),B.avail_in===0&&B.avail_out===0&&(V=!0)}while((0<B.avail_in||B.avail_out===0)&&w!==l.Z_STREAM_END);return w===l.Z_STREAM_END&&(_=l.Z_FINISH),_===l.Z_FINISH?(w=i.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===l.Z_OK):_!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(B.avail_out=0))},m.prototype.onData=function(v){this.chunks.push(v)},m.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=m,o.inflate=g,o.inflateRaw=function(v,C){return(C=C||{}).raw=!0,g(v,C)},o.ungzip=g},{"./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 m=0;m<f;m++)l[p+m]=u[d+m]},flattenChunks:function(l){var u,d,f,p,m,g;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(g=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)m=l[u],g.set(m,p),p+=m.length;return g}},a={arraySet:function(l,u,d,f,p){for(var m=0;m<f;m++)l[p+m]=u[d+m]},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 m="",g=0;g<p;g++)m+=String.fromCharCode(f[g]);return m}l[254]=l[254]=1,o.string2buf=function(f){var p,m,g,v,C,w=f.length,_=0;for(v=0;v<w;v++)(64512&(m=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(g=f.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),v++),_+=m<128?1:m<2048?2:m<65536?3:4;for(p=new i.Buf8(_),v=C=0;C<_;v++)(64512&(m=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(g=f.charCodeAt(v+1)))==56320&&(m=65536+(m-55296<<10)+(g-56320),v++),m<128?p[C++]=m:(m<2048?p[C++]=192|m>>>6:(m<65536?p[C++]=224|m>>>12:(p[C++]=240|m>>>18,p[C++]=128|m>>>12&63),p[C++]=128|m>>>6&63),p[C++]=128|63&m);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),m=0,g=p.length;m<g;m++)p[m]=f.charCodeAt(m);return p},o.buf2string=function(f,p){var m,g,v,C,w=p||f.length,_=new Array(2*w);for(m=g=0;m<w;)if((v=f[m++])<128)_[g++]=v;else if(4<(C=l[v]))_[g++]=65533,m+=C-1;else{for(v&=C===2?31:C===3?15:7;1<C&&m<w;)v=v<<6|63&f[m++],C--;1<C?_[g++]=65533:v<65536?_[g++]=v:(v-=65536,_[g++]=55296|v>>10&1023,_[g++]=56320|1023&v)}return d(_,g)},o.utf8border=function(f,p){var m;for((p=p||f.length)>f.length&&(p=f.length),m=p-1;0<=m&&(192&f[m])==128;)m--;return m<0||m===0?p:m+l[f[m]]>p?m: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,m=0,g=-2,v=-1,C=4,w=2,_=8,y=9,k=286,T=30,M=19,B=2*k+1,W=15,z=3,V=258,Z=V+z+1,R=42,K=113,x=1,G=2,H=3,J=4;function Q(I,ae){return I.msg=d[ae],ae}function X(I){return(I<<1)-(4<I?9:0)}function Te(I){for(var ae=I.length;0<=--ae;)I[ae]=0}function de(I){var ae=I.state,N=ae.pending;N>I.avail_out&&(N=I.avail_out),N!==0&&(s.arraySet(I.output,ae.pending_buf,ae.pending_out,N,I.next_out),I.next_out+=N,ae.pending_out+=N,I.total_out+=N,I.avail_out-=N,ae.pending-=N,ae.pending===0&&(ae.pending_out=0))}function ge(I,ae){a._tr_flush_block(I,0<=I.block_start?I.block_start:-1,I.strstart-I.block_start,ae),I.block_start=I.strstart,de(I.strm)}function ve(I,ae){I.pending_buf[I.pending++]=ae}function Re(I,ae){I.pending_buf[I.pending++]=ae>>>8&255,I.pending_buf[I.pending++]=255&ae}function Be(I,ae){var N,Y,U=I.max_chain_length,ie=I.strstart,be=I.prev_length,L=I.nice_match,F=I.strstart>I.w_size-Z?I.strstart-(I.w_size-Z):0,fe=I.window,Ce=I.w_mask,_e=I.prev,Pe=I.strstart+V,We=fe[ie+be-1],it=fe[ie+be];I.prev_length>=I.good_match&&(U>>=2),L>I.lookahead&&(L=I.lookahead);do if(fe[(N=ae)+be]===it&&fe[N+be-1]===We&&fe[N]===fe[ie]&&fe[++N]===fe[ie+1]){ie+=2,N++;do;while(fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&fe[++ie]===fe[++N]&&ie<Pe);if(Y=V-(Pe-ie),ie=Pe-V,be<Y){if(I.match_start=ae,L<=(be=Y))break;We=fe[ie+be-1],it=fe[ie+be]}}while((ae=_e[ae&Ce])>F&&--U!=0);return be<=I.lookahead?be:I.lookahead}function tt(I){var ae,N,Y,U,ie,be,L,F,fe,Ce,_e=I.w_size;do{if(U=I.window_size-I.lookahead-I.strstart,I.strstart>=_e+(_e-Z)){for(s.arraySet(I.window,I.window,_e,_e,0),I.match_start-=_e,I.strstart-=_e,I.block_start-=_e,ae=N=I.hash_size;Y=I.head[--ae],I.head[ae]=_e<=Y?Y-_e:0,--N;);for(ae=N=_e;Y=I.prev[--ae],I.prev[ae]=_e<=Y?Y-_e:0,--N;);U+=_e}if(I.strm.avail_in===0)break;if(be=I.strm,L=I.window,F=I.strstart+I.lookahead,fe=U,Ce=void 0,Ce=be.avail_in,fe<Ce&&(Ce=fe),N=Ce===0?0:(be.avail_in-=Ce,s.arraySet(L,be.input,be.next_in,Ce,F),be.state.wrap===1?be.adler=l(be.adler,L,Ce,F):be.state.wrap===2&&(be.adler=u(be.adler,L,Ce,F)),be.next_in+=Ce,be.total_in+=Ce,Ce),I.lookahead+=N,I.lookahead+I.insert>=z)for(ie=I.strstart-I.insert,I.ins_h=I.window[ie],I.ins_h=(I.ins_h<<I.hash_shift^I.window[ie+1])&I.hash_mask;I.insert&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[ie+z-1])&I.hash_mask,I.prev[ie&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=ie,ie++,I.insert--,!(I.lookahead+I.insert<z)););}while(I.lookahead<Z&&I.strm.avail_in!==0)}function ut(I,ae){for(var N,Y;;){if(I.lookahead<Z){if(tt(I),I.lookahead<Z&&ae===f)return x;if(I.lookahead===0)break}if(N=0,I.lookahead>=z&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+z-1])&I.hash_mask,N=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),N!==0&&I.strstart-N<=I.w_size-Z&&(I.match_length=Be(I,N)),I.match_length>=z)if(Y=a._tr_tally(I,I.strstart-I.match_start,I.match_length-z),I.lookahead-=I.match_length,I.match_length<=I.max_lazy_match&&I.lookahead>=z){for(I.match_length--;I.strstart++,I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+z-1])&I.hash_mask,N=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 Y=a._tr_tally(I,0,I.window[I.strstart]),I.lookahead--,I.strstart++;if(Y&&(ge(I,!1),I.strm.avail_out===0))return x}return I.insert=I.strstart<z-1?I.strstart:z-1,ae===p?(ge(I,!0),I.strm.avail_out===0?H:J):I.last_lit&&(ge(I,!1),I.strm.avail_out===0)?x:G}function dt(I,ae){for(var N,Y,U;;){if(I.lookahead<Z){if(tt(I),I.lookahead<Z&&ae===f)return x;if(I.lookahead===0)break}if(N=0,I.lookahead>=z&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+z-1])&I.hash_mask,N=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=z-1,N!==0&&I.prev_length<I.max_lazy_match&&I.strstart-N<=I.w_size-Z&&(I.match_length=Be(I,N),I.match_length<=5&&(I.strategy===1||I.match_length===z&&4096<I.strstart-I.match_start)&&(I.match_length=z-1)),I.prev_length>=z&&I.match_length<=I.prev_length){for(U=I.strstart+I.lookahead-z,Y=a._tr_tally(I,I.strstart-1-I.prev_match,I.prev_length-z),I.lookahead-=I.prev_length-1,I.prev_length-=2;++I.strstart<=U&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+z-1])&I.hash_mask,N=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=z-1,I.strstart++,Y&&(ge(I,!1),I.strm.avail_out===0))return x}else if(I.match_available){if((Y=a._tr_tally(I,0,I.window[I.strstart-1]))&&ge(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&&(Y=a._tr_tally(I,0,I.window[I.strstart-1]),I.match_available=0),I.insert=I.strstart<z-1?I.strstart:z-1,ae===p?(ge(I,!0),I.strm.avail_out===0?H:J):I.last_lit&&(ge(I,!1),I.strm.avail_out===0)?x:G}function _t(I,ae,N,Y,U){this.good_length=I,this.max_lazy=ae,this.nice_length=N,this.max_chain=Y,this.func=U}function se(){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=_,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*B),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*M+1)),Te(this.dyn_ltree),Te(this.dyn_dtree),Te(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*k+1),Te(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*k+1),Te(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 ke(I){var ae;return I&&I.state?(I.total_in=I.total_out=0,I.data_type=w,(ae=I.state).pending=0,ae.pending_out=0,ae.wrap<0&&(ae.wrap=-ae.wrap),ae.status=ae.wrap?R:K,I.adler=ae.wrap===2?0:1,ae.last_flush=f,a._tr_init(ae),m):Q(I,g)}function Ue(I){var ae=ke(I);return ae===m&&(function(N){N.window_size=2*N.w_size,Te(N.head),N.max_lazy_match=i[N.level].max_lazy,N.good_match=i[N.level].good_length,N.nice_match=i[N.level].nice_length,N.max_chain_length=i[N.level].max_chain,N.strstart=0,N.block_start=0,N.lookahead=0,N.insert=0,N.match_length=N.prev_length=z-1,N.match_available=0,N.ins_h=0})(I.state),ae}function ne(I,ae,N,Y,U,ie){if(!I)return g;var be=1;if(ae===v&&(ae=6),Y<0?(be=0,Y=-Y):15<Y&&(be=2,Y-=16),U<1||y<U||N!==_||Y<8||15<Y||ae<0||9<ae||ie<0||C<ie)return Q(I,g);Y===8&&(Y=9);var L=new se;return(I.state=L).strm=I,L.wrap=be,L.gzhead=null,L.w_bits=Y,L.w_size=1<<L.w_bits,L.w_mask=L.w_size-1,L.hash_bits=U+7,L.hash_size=1<<L.hash_bits,L.hash_mask=L.hash_size-1,L.hash_shift=~~((L.hash_bits+z-1)/z),L.window=new s.Buf8(2*L.w_size),L.head=new s.Buf16(L.hash_size),L.prev=new s.Buf16(L.w_size),L.lit_bufsize=1<<U+6,L.pending_buf_size=4*L.lit_bufsize,L.pending_buf=new s.Buf8(L.pending_buf_size),L.d_buf=1*L.lit_bufsize,L.l_buf=3*L.lit_bufsize,L.level=ae,L.strategy=ie,L.method=N,Ue(I)}i=[new _t(0,0,0,0,function(I,ae){var N=65535;for(N>I.pending_buf_size-5&&(N=I.pending_buf_size-5);;){if(I.lookahead<=1){if(tt(I),I.lookahead===0&&ae===f)return x;if(I.lookahead===0)break}I.strstart+=I.lookahead,I.lookahead=0;var Y=I.block_start+N;if((I.strstart===0||I.strstart>=Y)&&(I.lookahead=I.strstart-Y,I.strstart=Y,ge(I,!1),I.strm.avail_out===0)||I.strstart-I.block_start>=I.w_size-Z&&(ge(I,!1),I.strm.avail_out===0))return x}return I.insert=0,ae===p?(ge(I,!0),I.strm.avail_out===0?H:J):(I.strstart>I.block_start&&(ge(I,!1),I.strm.avail_out),x)}),new _t(4,4,8,4,ut),new _t(4,5,16,8,ut),new _t(4,6,32,32,ut),new _t(4,4,16,16,dt),new _t(8,16,32,32,dt),new _t(8,16,128,128,dt),new _t(8,32,128,256,dt),new _t(32,128,258,1024,dt),new _t(32,258,258,4096,dt)],o.deflateInit=function(I,ae){return ne(I,ae,_,15,8,0)},o.deflateInit2=ne,o.deflateReset=Ue,o.deflateResetKeep=ke,o.deflateSetHeader=function(I,ae){return I&&I.state?I.state.wrap!==2?g:(I.state.gzhead=ae,m):g},o.deflate=function(I,ae){var N,Y,U,ie;if(!I||!I.state||5<ae||ae<0)return I?Q(I,g):g;if(Y=I.state,!I.output||!I.input&&I.avail_in!==0||Y.status===666&&ae!==p)return Q(I,I.avail_out===0?-5:g);if(Y.strm=I,N=Y.last_flush,Y.last_flush=ae,Y.status===R)if(Y.wrap===2)I.adler=0,ve(Y,31),ve(Y,139),ve(Y,8),Y.gzhead?(ve(Y,(Y.gzhead.text?1:0)+(Y.gzhead.hcrc?2:0)+(Y.gzhead.extra?4:0)+(Y.gzhead.name?8:0)+(Y.gzhead.comment?16:0)),ve(Y,255&Y.gzhead.time),ve(Y,Y.gzhead.time>>8&255),ve(Y,Y.gzhead.time>>16&255),ve(Y,Y.gzhead.time>>24&255),ve(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ve(Y,255&Y.gzhead.os),Y.gzhead.extra&&Y.gzhead.extra.length&&(ve(Y,255&Y.gzhead.extra.length),ve(Y,Y.gzhead.extra.length>>8&255)),Y.gzhead.hcrc&&(I.adler=u(I.adler,Y.pending_buf,Y.pending,0)),Y.gzindex=0,Y.status=69):(ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ve(Y,3),Y.status=K);else{var be=_+(Y.w_bits-8<<4)<<8;be|=(2<=Y.strategy||Y.level<2?0:Y.level<6?1:Y.level===6?2:3)<<6,Y.strstart!==0&&(be|=32),be+=31-be%31,Y.status=K,Re(Y,be),Y.strstart!==0&&(Re(Y,I.adler>>>16),Re(Y,65535&I.adler)),I.adler=1}if(Y.status===69)if(Y.gzhead.extra){for(U=Y.pending;Y.gzindex<(65535&Y.gzhead.extra.length)&&(Y.pending!==Y.pending_buf_size||(Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),de(I),U=Y.pending,Y.pending!==Y.pending_buf_size));)ve(Y,255&Y.gzhead.extra[Y.gzindex]),Y.gzindex++;Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),Y.gzindex===Y.gzhead.extra.length&&(Y.gzindex=0,Y.status=73)}else Y.status=73;if(Y.status===73)if(Y.gzhead.name){U=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),de(I),U=Y.pending,Y.pending===Y.pending_buf_size)){ie=1;break}ie=Y.gzindex<Y.gzhead.name.length?255&Y.gzhead.name.charCodeAt(Y.gzindex++):0,ve(Y,ie)}while(ie!==0);Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),ie===0&&(Y.gzindex=0,Y.status=91)}else Y.status=91;if(Y.status===91)if(Y.gzhead.comment){U=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),de(I),U=Y.pending,Y.pending===Y.pending_buf_size)){ie=1;break}ie=Y.gzindex<Y.gzhead.comment.length?255&Y.gzhead.comment.charCodeAt(Y.gzindex++):0,ve(Y,ie)}while(ie!==0);Y.gzhead.hcrc&&Y.pending>U&&(I.adler=u(I.adler,Y.pending_buf,Y.pending-U,U)),ie===0&&(Y.status=103)}else Y.status=103;if(Y.status===103&&(Y.gzhead.hcrc?(Y.pending+2>Y.pending_buf_size&&de(I),Y.pending+2<=Y.pending_buf_size&&(ve(Y,255&I.adler),ve(Y,I.adler>>8&255),I.adler=0,Y.status=K)):Y.status=K),Y.pending!==0){if(de(I),I.avail_out===0)return Y.last_flush=-1,m}else if(I.avail_in===0&&X(ae)<=X(N)&&ae!==p)return Q(I,-5);if(Y.status===666&&I.avail_in!==0)return Q(I,-5);if(I.avail_in!==0||Y.lookahead!==0||ae!==f&&Y.status!==666){var L=Y.strategy===2?(function(F,fe){for(var Ce;;){if(F.lookahead===0&&(tt(F),F.lookahead===0)){if(fe===f)return x;break}if(F.match_length=0,Ce=a._tr_tally(F,0,F.window[F.strstart]),F.lookahead--,F.strstart++,Ce&&(ge(F,!1),F.strm.avail_out===0))return x}return F.insert=0,fe===p?(ge(F,!0),F.strm.avail_out===0?H:J):F.last_lit&&(ge(F,!1),F.strm.avail_out===0)?x:G})(Y,ae):Y.strategy===3?(function(F,fe){for(var Ce,_e,Pe,We,it=F.window;;){if(F.lookahead<=V){if(tt(F),F.lookahead<=V&&fe===f)return x;if(F.lookahead===0)break}if(F.match_length=0,F.lookahead>=z&&0<F.strstart&&(_e=it[Pe=F.strstart-1])===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]){We=F.strstart+V;do;while(_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&_e===it[++Pe]&&Pe<We);F.match_length=V-(We-Pe),F.match_length>F.lookahead&&(F.match_length=F.lookahead)}if(F.match_length>=z?(Ce=a._tr_tally(F,1,F.match_length-z),F.lookahead-=F.match_length,F.strstart+=F.match_length,F.match_length=0):(Ce=a._tr_tally(F,0,F.window[F.strstart]),F.lookahead--,F.strstart++),Ce&&(ge(F,!1),F.strm.avail_out===0))return x}return F.insert=0,fe===p?(ge(F,!0),F.strm.avail_out===0?H:J):F.last_lit&&(ge(F,!1),F.strm.avail_out===0)?x:G})(Y,ae):i[Y.level].func(Y,ae);if(L!==H&&L!==J||(Y.status=666),L===x||L===H)return I.avail_out===0&&(Y.last_flush=-1),m;if(L===G&&(ae===1?a._tr_align(Y):ae!==5&&(a._tr_stored_block(Y,0,0,!1),ae===3&&(Te(Y.head),Y.lookahead===0&&(Y.strstart=0,Y.block_start=0,Y.insert=0))),de(I),I.avail_out===0))return Y.last_flush=-1,m}return ae!==p?m:Y.wrap<=0?1:(Y.wrap===2?(ve(Y,255&I.adler),ve(Y,I.adler>>8&255),ve(Y,I.adler>>16&255),ve(Y,I.adler>>24&255),ve(Y,255&I.total_in),ve(Y,I.total_in>>8&255),ve(Y,I.total_in>>16&255),ve(Y,I.total_in>>24&255)):(Re(Y,I.adler>>>16),Re(Y,65535&I.adler)),de(I),0<Y.wrap&&(Y.wrap=-Y.wrap),Y.pending!==0?m:1)},o.deflateEnd=function(I){var ae;return I&&I.state?(ae=I.state.status)!==R&&ae!==69&&ae!==73&&ae!==91&&ae!==103&&ae!==K&&ae!==666?Q(I,g):(I.state=null,ae===K?Q(I,-3):m):g},o.deflateSetDictionary=function(I,ae){var N,Y,U,ie,be,L,F,fe,Ce=ae.length;if(!I||!I.state||(ie=(N=I.state).wrap)===2||ie===1&&N.status!==R||N.lookahead)return g;for(ie===1&&(I.adler=l(I.adler,ae,Ce,0)),N.wrap=0,Ce>=N.w_size&&(ie===0&&(Te(N.head),N.strstart=0,N.block_start=0,N.insert=0),fe=new s.Buf8(N.w_size),s.arraySet(fe,ae,Ce-N.w_size,N.w_size,0),ae=fe,Ce=N.w_size),be=I.avail_in,L=I.next_in,F=I.input,I.avail_in=Ce,I.next_in=0,I.input=ae,tt(N);N.lookahead>=z;){for(Y=N.strstart,U=N.lookahead-(z-1);N.ins_h=(N.ins_h<<N.hash_shift^N.window[Y+z-1])&N.hash_mask,N.prev[Y&N.w_mask]=N.head[N.ins_h],N.head[N.ins_h]=Y,Y++,--U;);N.strstart=Y,N.lookahead=z-1,tt(N)}return N.strstart+=N.lookahead,N.block_start=N.strstart,N.insert=N.lookahead,N.lookahead=0,N.match_length=N.prev_length=z-1,N.match_available=0,I.next_in=L,I.input=F,I.avail_in=be,N.wrap=ie,m},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,m,g,v,C,w,_,y,k,T,M,B,W,z,V,Z,R,K,x=i.input,G;u=l+(i.avail_in-5),d=i.next_out,G=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),m=a.dmax,g=a.wsize,v=a.whave,C=a.wnext,w=a.window,_=a.hold,y=a.bits,k=a.lencode,T=a.distcode,M=(1<<a.lenbits)-1,B=(1<<a.distbits)-1;e:do{y<15&&(_+=x[l++]<<y,y+=8,_+=x[l++]<<y,y+=8),W=k[_&M];t:for(;;){if(_>>>=z=W>>>24,y-=z,(z=W>>>16&255)===0)G[d++]=65535&W;else{if(!(16&z)){if((64&z)==0){W=k[(65535&W)+(_&(1<<z)-1)];continue t}if(32&z){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}V=65535&W,(z&=15)&&(y<z&&(_+=x[l++]<<y,y+=8),V+=_&(1<<z)-1,_>>>=z,y-=z),y<15&&(_+=x[l++]<<y,y+=8,_+=x[l++]<<y,y+=8),W=T[_&B];n:for(;;){if(_>>>=z=W>>>24,y-=z,!(16&(z=W>>>16&255))){if((64&z)==0){W=T[(65535&W)+(_&(1<<z)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(Z=65535&W,y<(z&=15)&&(_+=x[l++]<<y,(y+=8)<z&&(_+=x[l++]<<y,y+=8)),m<(Z+=_&(1<<z)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(_>>>=z,y-=z,(z=d-f)<Z){if(v<(z=Z-z)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(K=w,(R=0)===C){if(R+=g-z,z<V){for(V-=z;G[d++]=w[R++],--z;);R=d-Z,K=G}}else if(C<z){if(R+=g+C-z,(z-=C)<V){for(V-=z;G[d++]=w[R++],--z;);if(R=0,C<V){for(V-=z=C;G[d++]=w[R++],--z;);R=d-Z,K=G}}}else if(R+=C-z,z<V){for(V-=z;G[d++]=w[R++],--z;);R=d-Z,K=G}for(;2<V;)G[d++]=K[R++],G[d++]=K[R++],G[d++]=K[R++],V-=3;V&&(G[d++]=K[R++],1<V&&(G[d++]=K[R++]))}else{for(R=d-Z;G[d++]=G[R++],G[d++]=G[R++],G[d++]=G[R++],2<(V-=3););V&&(G[d++]=G[R++],1<V&&(G[d++]=G[R++]))}break}}break}}while(l<u&&d<p);l-=V=y>>3,_&=(1<<(y-=V<<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=_,a.bits=y}},{}],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,m=-2,g=1,v=852,C=592;function w(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function _(){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 y(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=g,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(C),K.sane=1,K.back=-1,p):m}function k(R){var K;return R&&R.state?((K=R.state).wsize=0,K.whave=0,K.wnext=0,y(R)):m}function T(R,K){var x,G;return R&&R.state?(G=R.state,K<0?(x=0,K=-K):(x=1+(K>>4),K<48&&(K&=15)),K&&(K<8||15<K)?m:(G.window!==null&&G.wbits!==K&&(G.window=null),G.wrap=x,G.wbits=K,k(R))):m}function M(R,K){var x,G;return R?(G=new _,(R.state=G).window=null,(x=T(R,K))!==p&&(R.state=null),x):m}var B,W,z=!0;function V(R){if(z){var K;for(B=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,B,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}),z=!1}R.lencode=B,R.lenbits=9,R.distcode=W,R.distbits=5}function Z(R,K,x,G){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)),G>=J.wsize?(i.arraySet(J.window,K,x-J.wsize,J.wsize,0),J.wnext=0,J.whave=J.wsize):(G<(H=J.wsize-J.wnext)&&(H=G),i.arraySet(J.window,K,x-G,H,J.wnext),(G-=H)?(i.arraySet(J.window,K,x-G,G,0),J.wnext=G,J.whave=J.wsize):(J.wnext+=H,J.wnext===J.wsize&&(J.wnext=0),J.whave<J.wsize&&(J.whave+=H))),0}o.inflateReset=k,o.inflateReset2=T,o.inflateResetKeep=y,o.inflateInit=function(R){return M(R,15)},o.inflateInit2=M,o.inflate=function(R,K){var x,G,H,J,Q,X,Te,de,ge,ve,Re,Be,tt,ut,dt,_t,se,ke,Ue,ne,I,ae,N,Y,U=0,ie=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 m;(x=R.state).mode===12&&(x.mode=13),Q=R.next_out,H=R.output,Te=R.avail_out,J=R.next_in,G=R.input,X=R.avail_in,de=x.hold,ge=x.bits,ve=X,Re=Te,ae=p;e:for(;;)switch(x.mode){case g:if(x.wrap===0){x.mode=13;break}for(;ge<16;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(2&x.wrap&&de===35615){ie[x.check=0]=255&de,ie[1]=de>>>8&255,x.check=a(x.check,ie,2,0),ge=de=0,x.mode=2;break}if(x.flags=0,x.head&&(x.head.done=!1),!(1&x.wrap)||(((255&de)<<8)+(de>>8))%31){R.msg="incorrect header check",x.mode=30;break}if((15&de)!=8){R.msg="unknown compression method",x.mode=30;break}if(ge-=4,I=8+(15&(de>>>=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&de?10:12,ge=de=0;break;case 2:for(;ge<16;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(x.flags=de,(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=de>>8&1),512&x.flags&&(ie[0]=255&de,ie[1]=de>>>8&255,x.check=a(x.check,ie,2,0)),ge=de=0,x.mode=3;case 3:for(;ge<32;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.head&&(x.head.time=de),512&x.flags&&(ie[0]=255&de,ie[1]=de>>>8&255,ie[2]=de>>>16&255,ie[3]=de>>>24&255,x.check=a(x.check,ie,4,0)),ge=de=0,x.mode=4;case 4:for(;ge<16;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.head&&(x.head.xflags=255&de,x.head.os=de>>8),512&x.flags&&(ie[0]=255&de,ie[1]=de>>>8&255,x.check=a(x.check,ie,2,0)),ge=de=0,x.mode=5;case 5:if(1024&x.flags){for(;ge<16;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.length=de,x.head&&(x.head.extra_len=de),512&x.flags&&(ie[0]=255&de,ie[1]=de>>>8&255,x.check=a(x.check,ie,2,0)),ge=de=0}else x.head&&(x.head.extra=null);x.mode=6;case 6:if(1024&x.flags&&(X<(Be=x.length)&&(Be=X),Be&&(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,G,J,Be,I)),512&x.flags&&(x.check=a(x.check,G,Be,J)),X-=Be,J+=Be,x.length-=Be),x.length))break e;x.length=0,x.mode=7;case 7:if(2048&x.flags){if(X===0)break e;for(Be=0;I=G[J+Be++],x.head&&I&&x.length<65536&&(x.head.name+=String.fromCharCode(I)),I&&Be<X;);if(512&x.flags&&(x.check=a(x.check,G,Be,J)),X-=Be,J+=Be,I)break e}else x.head&&(x.head.name=null);x.length=0,x.mode=8;case 8:if(4096&x.flags){if(X===0)break e;for(Be=0;I=G[J+Be++],x.head&&I&&x.length<65536&&(x.head.comment+=String.fromCharCode(I)),I&&Be<X;);if(512&x.flags&&(x.check=a(x.check,G,Be,J)),X-=Be,J+=Be,I)break e}else x.head&&(x.head.comment=null);x.mode=9;case 9:if(512&x.flags){for(;ge<16;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(de!==(65535&x.check)){R.msg="header crc mismatch",x.mode=30;break}ge=de=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(;ge<32;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}R.adler=x.check=w(de),ge=de=0,x.mode=11;case 11:if(x.havedict===0)return R.next_out=Q,R.avail_out=Te,R.next_in=J,R.avail_in=X,x.hold=de,x.bits=ge,2;R.adler=x.check=1,x.mode=12;case 12:if(K===5||K===6)break e;case 13:if(x.last){de>>>=7&ge,ge-=7&ge,x.mode=27;break}for(;ge<3;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}switch(x.last=1&de,ge-=1,3&(de>>>=1)){case 0:x.mode=14;break;case 1:if(V(x),x.mode=20,K!==6)break;de>>>=2,ge-=2;break e;case 2:x.mode=17;break;case 3:R.msg="invalid block type",x.mode=30}de>>>=2,ge-=2;break;case 14:for(de>>>=7&ge,ge-=7&ge;ge<32;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if((65535&de)!=(de>>>16^65535)){R.msg="invalid stored block lengths",x.mode=30;break}if(x.length=65535&de,ge=de=0,x.mode=15,K===6)break e;case 15:x.mode=16;case 16:if(Be=x.length){if(X<Be&&(Be=X),Te<Be&&(Be=Te),Be===0)break e;i.arraySet(H,G,J,Be,Q),X-=Be,J+=Be,Te-=Be,Q+=Be,x.length-=Be;break}x.mode=12;break;case 17:for(;ge<14;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(x.nlen=257+(31&de),de>>>=5,ge-=5,x.ndist=1+(31&de),de>>>=5,ge-=5,x.ncode=4+(15&de),de>>>=4,ge-=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(;ge<3;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.lens[be[x.have++]]=7&de,de>>>=3,ge-=3}for(;x.have<19;)x.lens[be[x.have++]]=0;if(x.lencode=x.lendyn,x.lenbits=7,N={bits:x.lenbits},ae=u(0,x.lens,0,19,x.lencode,0,x.work,N),x.lenbits=N.bits,ae){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(;_t=(U=x.lencode[de&(1<<x.lenbits)-1])>>>16&255,se=65535&U,!((dt=U>>>24)<=ge);){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(se<16)de>>>=dt,ge-=dt,x.lens[x.have++]=se;else{if(se===16){for(Y=dt+2;ge<Y;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(de>>>=dt,ge-=dt,x.have===0){R.msg="invalid bit length repeat",x.mode=30;break}I=x.lens[x.have-1],Be=3+(3&de),de>>>=2,ge-=2}else if(se===17){for(Y=dt+3;ge<Y;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}ge-=dt,I=0,Be=3+(7&(de>>>=dt)),de>>>=3,ge-=3}else{for(Y=dt+7;ge<Y;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}ge-=dt,I=0,Be=11+(127&(de>>>=dt)),de>>>=7,ge-=7}if(x.have+Be>x.nlen+x.ndist){R.msg="invalid bit length repeat",x.mode=30;break}for(;Be--;)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,N={bits:x.lenbits},ae=u(d,x.lens,0,x.nlen,x.lencode,0,x.work,N),x.lenbits=N.bits,ae){R.msg="invalid literal/lengths set",x.mode=30;break}if(x.distbits=6,x.distcode=x.distdyn,N={bits:x.distbits},ae=u(f,x.lens,x.nlen,x.ndist,x.distcode,0,x.work,N),x.distbits=N.bits,ae){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<=X&&258<=Te){R.next_out=Q,R.avail_out=Te,R.next_in=J,R.avail_in=X,x.hold=de,x.bits=ge,l(R,Re),Q=R.next_out,H=R.output,Te=R.avail_out,J=R.next_in,G=R.input,X=R.avail_in,de=x.hold,ge=x.bits,x.mode===12&&(x.back=-1);break}for(x.back=0;_t=(U=x.lencode[de&(1<<x.lenbits)-1])>>>16&255,se=65535&U,!((dt=U>>>24)<=ge);){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(_t&&(240&_t)==0){for(ke=dt,Ue=_t,ne=se;_t=(U=x.lencode[ne+((de&(1<<ke+Ue)-1)>>ke)])>>>16&255,se=65535&U,!(ke+(dt=U>>>24)<=ge);){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}de>>>=ke,ge-=ke,x.back+=ke}if(de>>>=dt,ge-=dt,x.back+=dt,x.length=se,_t===0){x.mode=26;break}if(32&_t){x.back=-1,x.mode=12;break}if(64&_t){R.msg="invalid literal/length code",x.mode=30;break}x.extra=15&_t,x.mode=22;case 22:if(x.extra){for(Y=x.extra;ge<Y;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.length+=de&(1<<x.extra)-1,de>>>=x.extra,ge-=x.extra,x.back+=x.extra}x.was=x.length,x.mode=23;case 23:for(;_t=(U=x.distcode[de&(1<<x.distbits)-1])>>>16&255,se=65535&U,!((dt=U>>>24)<=ge);){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if((240&_t)==0){for(ke=dt,Ue=_t,ne=se;_t=(U=x.distcode[ne+((de&(1<<ke+Ue)-1)>>ke)])>>>16&255,se=65535&U,!(ke+(dt=U>>>24)<=ge);){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}de>>>=ke,ge-=ke,x.back+=ke}if(de>>>=dt,ge-=dt,x.back+=dt,64&_t){R.msg="invalid distance code",x.mode=30;break}x.offset=se,x.extra=15&_t,x.mode=24;case 24:if(x.extra){for(Y=x.extra;ge<Y;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}x.offset+=de&(1<<x.extra)-1,de>>>=x.extra,ge-=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(Te===0)break e;if(Be=Re-Te,x.offset>Be){if((Be=x.offset-Be)>x.whave&&x.sane){R.msg="invalid distance too far back",x.mode=30;break}tt=Be>x.wnext?(Be-=x.wnext,x.wsize-Be):x.wnext-Be,Be>x.length&&(Be=x.length),ut=x.window}else ut=H,tt=Q-x.offset,Be=x.length;for(Te<Be&&(Be=Te),Te-=Be,x.length-=Be;H[Q++]=ut[tt++],--Be;);x.length===0&&(x.mode=21);break;case 26:if(Te===0)break e;H[Q++]=x.length,Te--,x.mode=21;break;case 27:if(x.wrap){for(;ge<32;){if(X===0)break e;X--,de|=G[J++]<<ge,ge+=8}if(Re-=Te,R.total_out+=Re,x.total+=Re,Re&&(R.adler=x.check=x.flags?a(x.check,H,Re,Q-Re):s(x.check,H,Re,Q-Re)),Re=Te,(x.flags?de:w(de))!==x.check){R.msg="incorrect data check",x.mode=30;break}ge=de=0}x.mode=28;case 28:if(x.wrap&&x.flags){for(;ge<32;){if(X===0)break e;X--,de+=G[J++]<<ge,ge+=8}if(de!==(4294967295&x.total)){R.msg="incorrect length check",x.mode=30;break}ge=de=0}x.mode=29;case 29:ae=1;break e;case 30:ae=-3;break e;case 31:return-4;default:return m}return R.next_out=Q,R.avail_out=Te,R.next_in=J,R.avail_in=X,x.hold=de,x.bits=ge,(x.wsize||Re!==R.avail_out&&x.mode<30&&(x.mode<27||K!==4))&&Z(R,R.output,R.next_out,Re-R.avail_out)?(x.mode=31,-4):(ve-=R.avail_in,Re-=R.avail_out,R.total_in+=ve,R.total_out+=Re,x.total+=Re,x.wrap&&Re&&(R.adler=x.check=x.flags?a(x.check,H,Re,R.next_out-Re):s(x.check,H,Re,R.next_out-Re)),R.data_type=x.bits+(x.last?64:0)+(x.mode===12?128:0)+(x.mode===20||x.mode===15?256:0),(ve==0&&Re===0||K===4)&&ae===p&&(ae=-5),ae)},o.inflateEnd=function(R){if(!R||!R.state)return m;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?m:((x.head=K).done=!1,p):m},o.inflateSetDictionary=function(R,K){var x,G=K.length;return R&&R.state?(x=R.state).wrap!==0&&x.mode!==11?m:x.mode===11&&s(1,K,G,0)!==x.check?-3:Z(R,K,G,G)?(x.mode=31,-4):(x.havedict=1,p):m},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,m,g,v,C,w){var _,y,k,T,M,B,W,z,V,Z=w.bits,R=0,K=0,x=0,G=0,H=0,J=0,Q=0,X=0,Te=0,de=0,ge=null,ve=0,Re=new i.Buf16(16),Be=new i.Buf16(16),tt=null,ut=0;for(R=0;R<=15;R++)Re[R]=0;for(K=0;K<m;K++)Re[f[p+K]]++;for(H=Z,G=15;1<=G&&Re[G]===0;G--);if(G<H&&(H=G),G===0)return g[v++]=20971520,g[v++]=20971520,w.bits=1,0;for(x=1;x<G&&Re[x]===0;x++);for(H<x&&(H=x),R=X=1;R<=15;R++)if(X<<=1,(X-=Re[R])<0)return-1;if(0<X&&(d===0||G!==1))return-1;for(Be[1]=0,R=1;R<15;R++)Be[R+1]=Be[R]+Re[R];for(K=0;K<m;K++)f[p+K]!==0&&(C[Be[f[p+K]]++]=K);if(B=d===0?(ge=tt=C,19):d===1?(ge=s,ve-=257,tt=a,ut-=257,256):(ge=l,tt=u,-1),R=x,M=v,Q=K=de=0,k=-1,T=(Te=1<<(J=H))-1,d===1&&852<Te||d===2&&592<Te)return 1;for(;;){for(W=R-Q,V=C[K]<B?(z=0,C[K]):C[K]>B?(z=tt[ut+C[K]],ge[ve+C[K]]):(z=96,0),_=1<<R-Q,x=y=1<<J;g[M+(de>>Q)+(y-=_)]=W<<24|z<<16|V|0,y!==0;);for(_=1<<R-1;de&_;)_>>=1;if(_!==0?(de&=_-1,de+=_):de=0,K++,--Re[R]==0){if(R===G)break;R=f[p+C[K]]}if(H<R&&(de&T)!==k){for(Q===0&&(Q=H),M+=x,X=1<<(J=R-Q);J+Q<G&&!((X-=Re[J+Q])<=0);)J++,X<<=1;if(Te+=1<<J,d===1&&852<Te||d===2&&592<Te)return 1;g[k=de&T]=H<<24|J<<16|M-v|0}}return de!==0&&(g[M+de]=R-Q<<24|4194304),w.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(U){for(var ie=U.length;0<=--ie;)U[ie]=0}var u=0,d=29,f=256,p=f+1+d,m=30,g=19,v=2*p+1,C=15,w=16,_=7,y=256,k=16,T=17,M=18,B=[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],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],V=[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*m);l(R);var K=new Array(512);l(K);var x=new Array(256);l(x);var G=new Array(d);l(G);var H,J,Q,X=new Array(m);function Te(U,ie,be,L,F){this.static_tree=U,this.extra_bits=ie,this.extra_base=be,this.elems=L,this.max_length=F,this.has_stree=U&&U.length}function de(U,ie){this.dyn_tree=U,this.max_code=0,this.stat_desc=ie}function ge(U){return U<256?K[U]:K[256+(U>>>7)]}function ve(U,ie){U.pending_buf[U.pending++]=255&ie,U.pending_buf[U.pending++]=ie>>>8&255}function Re(U,ie,be){U.bi_valid>w-be?(U.bi_buf|=ie<<U.bi_valid&65535,ve(U,U.bi_buf),U.bi_buf=ie>>w-U.bi_valid,U.bi_valid+=be-w):(U.bi_buf|=ie<<U.bi_valid&65535,U.bi_valid+=be)}function Be(U,ie,be){Re(U,be[2*ie],be[2*ie+1])}function tt(U,ie){for(var be=0;be|=1&U,U>>>=1,be<<=1,0<--ie;);return be>>>1}function ut(U,ie,be){var L,F,fe=new Array(C+1),Ce=0;for(L=1;L<=C;L++)fe[L]=Ce=Ce+be[L-1]<<1;for(F=0;F<=ie;F++){var _e=U[2*F+1];_e!==0&&(U[2*F]=tt(fe[_e]++,_e))}}function dt(U){var ie;for(ie=0;ie<p;ie++)U.dyn_ltree[2*ie]=0;for(ie=0;ie<m;ie++)U.dyn_dtree[2*ie]=0;for(ie=0;ie<g;ie++)U.bl_tree[2*ie]=0;U.dyn_ltree[2*y]=1,U.opt_len=U.static_len=0,U.last_lit=U.matches=0}function _t(U){8<U.bi_valid?ve(U,U.bi_buf):0<U.bi_valid&&(U.pending_buf[U.pending++]=U.bi_buf),U.bi_buf=0,U.bi_valid=0}function se(U,ie,be,L){var F=2*ie,fe=2*be;return U[F]<U[fe]||U[F]===U[fe]&&L[ie]<=L[be]}function ke(U,ie,be){for(var L=U.heap[be],F=be<<1;F<=U.heap_len&&(F<U.heap_len&&se(ie,U.heap[F+1],U.heap[F],U.depth)&&F++,!se(ie,L,U.heap[F],U.depth));)U.heap[be]=U.heap[F],be=F,F<<=1;U.heap[be]=L}function Ue(U,ie,be){var L,F,fe,Ce,_e=0;if(U.last_lit!==0)for(;L=U.pending_buf[U.d_buf+2*_e]<<8|U.pending_buf[U.d_buf+2*_e+1],F=U.pending_buf[U.l_buf+_e],_e++,L===0?Be(U,F,ie):(Be(U,(fe=x[F])+f+1,ie),(Ce=B[fe])!==0&&Re(U,F-=G[fe],Ce),Be(U,fe=ge(--L),be),(Ce=W[fe])!==0&&Re(U,L-=X[fe],Ce)),_e<U.last_lit;);Be(U,y,ie)}function ne(U,ie){var be,L,F,fe=ie.dyn_tree,Ce=ie.stat_desc.static_tree,_e=ie.stat_desc.has_stree,Pe=ie.stat_desc.elems,We=-1;for(U.heap_len=0,U.heap_max=v,be=0;be<Pe;be++)fe[2*be]!==0?(U.heap[++U.heap_len]=We=be,U.depth[be]=0):fe[2*be+1]=0;for(;U.heap_len<2;)fe[2*(F=U.heap[++U.heap_len]=We<2?++We:0)]=1,U.depth[F]=0,U.opt_len--,_e&&(U.static_len-=Ce[2*F+1]);for(ie.max_code=We,be=U.heap_len>>1;1<=be;be--)ke(U,fe,be);for(F=Pe;be=U.heap[1],U.heap[1]=U.heap[U.heap_len--],ke(U,fe,1),L=U.heap[1],U.heap[--U.heap_max]=be,U.heap[--U.heap_max]=L,fe[2*F]=fe[2*be]+fe[2*L],U.depth[F]=(U.depth[be]>=U.depth[L]?U.depth[be]:U.depth[L])+1,fe[2*be+1]=fe[2*L+1]=F,U.heap[1]=F++,ke(U,fe,1),2<=U.heap_len;);U.heap[--U.heap_max]=U.heap[1],(function(it,ht){var Lt,Tt,Yt,Fe,rn,Dn,Kt=ht.dyn_tree,Rn=ht.max_code,Lr=ht.stat_desc.static_tree,yr=ht.stat_desc.has_stree,Dr=ht.stat_desc.extra_bits,at=ht.stat_desc.extra_base,Ct=ht.stat_desc.max_length,zt=0;for(Fe=0;Fe<=C;Fe++)it.bl_count[Fe]=0;for(Kt[2*it.heap[it.heap_max]+1]=0,Lt=it.heap_max+1;Lt<v;Lt++)Ct<(Fe=Kt[2*Kt[2*(Tt=it.heap[Lt])+1]+1]+1)&&(Fe=Ct,zt++),Kt[2*Tt+1]=Fe,Rn<Tt||(it.bl_count[Fe]++,rn=0,at<=Tt&&(rn=Dr[Tt-at]),Dn=Kt[2*Tt],it.opt_len+=Dn*(Fe+rn),yr&&(it.static_len+=Dn*(Lr[2*Tt+1]+rn)));if(zt!==0){do{for(Fe=Ct-1;it.bl_count[Fe]===0;)Fe--;it.bl_count[Fe]--,it.bl_count[Fe+1]+=2,it.bl_count[Ct]--,zt-=2}while(0<zt);for(Fe=Ct;Fe!==0;Fe--)for(Tt=it.bl_count[Fe];Tt!==0;)Rn<(Yt=it.heap[--Lt])||(Kt[2*Yt+1]!==Fe&&(it.opt_len+=(Fe-Kt[2*Yt+1])*Kt[2*Yt],Kt[2*Yt+1]=Fe),Tt--)}})(U,ie),ut(fe,We,U.bl_count)}function I(U,ie,be){var L,F,fe=-1,Ce=ie[1],_e=0,Pe=7,We=4;for(Ce===0&&(Pe=138,We=3),ie[2*(be+1)+1]=65535,L=0;L<=be;L++)F=Ce,Ce=ie[2*(L+1)+1],++_e<Pe&&F===Ce||(_e<We?U.bl_tree[2*F]+=_e:F!==0?(F!==fe&&U.bl_tree[2*F]++,U.bl_tree[2*k]++):_e<=10?U.bl_tree[2*T]++:U.bl_tree[2*M]++,fe=F,We=(_e=0)===Ce?(Pe=138,3):F===Ce?(Pe=6,3):(Pe=7,4))}function ae(U,ie,be){var L,F,fe=-1,Ce=ie[1],_e=0,Pe=7,We=4;for(Ce===0&&(Pe=138,We=3),L=0;L<=be;L++)if(F=Ce,Ce=ie[2*(L+1)+1],!(++_e<Pe&&F===Ce)){if(_e<We)for(;Be(U,F,U.bl_tree),--_e!=0;);else F!==0?(F!==fe&&(Be(U,F,U.bl_tree),_e--),Be(U,k,U.bl_tree),Re(U,_e-3,2)):_e<=10?(Be(U,T,U.bl_tree),Re(U,_e-3,3)):(Be(U,M,U.bl_tree),Re(U,_e-11,7));fe=F,We=(_e=0)===Ce?(Pe=138,3):F===Ce?(Pe=6,3):(Pe=7,4)}}l(X);var N=!1;function Y(U,ie,be,L){Re(U,(u<<1)+(L?1:0),3),(function(F,fe,Ce,_e){_t(F),_e&&(ve(F,Ce),ve(F,~Ce)),i.arraySet(F.pending_buf,F.window,fe,Ce,F.pending),F.pending+=Ce})(U,ie,be,!0)}o._tr_init=function(U){N||((function(){var ie,be,L,F,fe,Ce=new Array(C+1);for(F=L=0;F<d-1;F++)for(G[F]=L,ie=0;ie<1<<B[F];ie++)x[L++]=F;for(x[L-1]=F,F=fe=0;F<16;F++)for(X[F]=fe,ie=0;ie<1<<W[F];ie++)K[fe++]=F;for(fe>>=7;F<m;F++)for(X[F]=fe<<7,ie=0;ie<1<<W[F]-7;ie++)K[256+fe++]=F;for(be=0;be<=C;be++)Ce[be]=0;for(ie=0;ie<=143;)Z[2*ie+1]=8,ie++,Ce[8]++;for(;ie<=255;)Z[2*ie+1]=9,ie++,Ce[9]++;for(;ie<=279;)Z[2*ie+1]=7,ie++,Ce[7]++;for(;ie<=287;)Z[2*ie+1]=8,ie++,Ce[8]++;for(ut(Z,p+1,Ce),ie=0;ie<m;ie++)R[2*ie+1]=5,R[2*ie]=tt(ie,5);H=new Te(Z,B,f+1,p,C),J=new Te(R,W,0,m,C),Q=new Te(new Array(0),z,0,g,_)})(),N=!0),U.l_desc=new de(U.dyn_ltree,H),U.d_desc=new de(U.dyn_dtree,J),U.bl_desc=new de(U.bl_tree,Q),U.bi_buf=0,U.bi_valid=0,dt(U)},o._tr_stored_block=Y,o._tr_flush_block=function(U,ie,be,L){var F,fe,Ce=0;0<U.level?(U.strm.data_type===2&&(U.strm.data_type=(function(_e){var Pe,We=4093624447;for(Pe=0;Pe<=31;Pe++,We>>>=1)if(1&We&&_e.dyn_ltree[2*Pe]!==0)return s;if(_e.dyn_ltree[18]!==0||_e.dyn_ltree[20]!==0||_e.dyn_ltree[26]!==0)return a;for(Pe=32;Pe<f;Pe++)if(_e.dyn_ltree[2*Pe]!==0)return a;return s})(U)),ne(U,U.l_desc),ne(U,U.d_desc),Ce=(function(_e){var Pe;for(I(_e,_e.dyn_ltree,_e.l_desc.max_code),I(_e,_e.dyn_dtree,_e.d_desc.max_code),ne(_e,_e.bl_desc),Pe=g-1;3<=Pe&&_e.bl_tree[2*V[Pe]+1]===0;Pe--);return _e.opt_len+=3*(Pe+1)+5+5+4,Pe})(U),F=U.opt_len+3+7>>>3,(fe=U.static_len+3+7>>>3)<=F&&(F=fe)):F=fe=be+5,be+4<=F&&ie!==-1?Y(U,ie,be,L):U.strategy===4||fe===F?(Re(U,2+(L?1:0),3),Ue(U,Z,R)):(Re(U,4+(L?1:0),3),(function(_e,Pe,We,it){var ht;for(Re(_e,Pe-257,5),Re(_e,We-1,5),Re(_e,it-4,4),ht=0;ht<it;ht++)Re(_e,_e.bl_tree[2*V[ht]+1],3);ae(_e,_e.dyn_ltree,Pe-1),ae(_e,_e.dyn_dtree,We-1)})(U,U.l_desc.max_code+1,U.d_desc.max_code+1,Ce+1),Ue(U,U.dyn_ltree,U.dyn_dtree)),dt(U),L&&_t(U)},o._tr_tally=function(U,ie,be){return U.pending_buf[U.d_buf+2*U.last_lit]=ie>>>8&255,U.pending_buf[U.d_buf+2*U.last_lit+1]=255&ie,U.pending_buf[U.l_buf+U.last_lit]=255&be,U.last_lit++,ie===0?U.dyn_ltree[2*be]++:(U.matches++,ie--,U.dyn_ltree[2*(x[be]+f+1)]++,U.dyn_dtree[2*ge(ie)]++),U.last_lit===U.lit_bufsize-1},o._tr_align=function(U){Re(U,2,3),Be(U,y,Z),(function(ie){ie.bi_valid===16?(ve(ie,ie.bi_buf),ie.bi_buf=0,ie.bi_valid=0):8<=ie.bi_valid&&(ie.pending_buf[ie.pending++]=255&ie.bi_buf,ie.bi_buf>>=8,ie.bi_valid-=8)})(U)}},{"../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,m={},g=!1,v=s.document,C=Object.getPrototypeOf&&Object.getPrototypeOf(s);C=C&&C.setTimeout?C:s,l={}.toString.call(s.process)==="[object process]"?function(k){process.nextTick(function(){_(k)})}:(function(){if(s.postMessage&&!s.importScripts){var k=!0,T=s.onmessage;return s.onmessage=function(){k=!1},s.postMessage("","*"),s.onmessage=T,k}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",y,!1):s.attachEvent("onmessage",y),function(k){s.postMessage(f+k,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(k){_(k.data)},function(k){d.port2.postMessage(k)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(k){var T=v.createElement("script");T.onreadystatechange=function(){_(k),T.onreadystatechange=null,u.removeChild(T),T=null},u.appendChild(T)}):function(k){setTimeout(_,0,k)},C.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var T=new Array(arguments.length-1),M=0;M<T.length;M++)T[M]=arguments[M+1];return m[p]={callback:k,args:T},l(p),p++},C.clearImmediate=w}function w(k){delete m[k]}function _(k){if(g)setTimeout(_,0,k);else{var T=m[k];if(T){g=!0;try{(function(M){var B=M.callback,W=M.args;switch(W.length){case 0:B();break;case 1:B(W[0]);break;case 2:B(W[0],W[1]);break;case 3:B(W[0],W[1],W[2]);break;default:B.apply(a,W)}})(T)}finally{w(k),g=!1}}}}function y(k){k.source===s&&typeof k.data=="string"&&k.data.indexOf(f)===0&&_(+k.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)})})),pr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Ma="application/pdf",Eu="text/html",m5={docx:pr,pdf:Ma,html:Eu},Pp={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"};Bt();var g5=X2(p5(),1),v5=e=>typeof e!="string"?"":e.trim(),Vy=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Fp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Cc=e=>{const t=e??{},n=v5(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}},dk=({current:e,other:t})=>{const n=Cc(e),r=Cc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Tu=({actor:e,fallbackKey:t=""})=>{const n=Cc(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 y5(e){return typeof e.captureStackTrace=="function"}var Np=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",y5(Error)&&Error.captureStackTrace(this,this.constructor)}},b5=class extends Np{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},w5=class extends Np{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 b5(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 w5(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 Np?r:new Np("Failed to create file object",r)}};function C5(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 Bp=new WeakMap;function fk(e){return e.ownerDocument??document}function hk(e,t){const n=Bp.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Bp.delete(t))}function pk(e,t){const n=fk(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&hk(e,e.__clickOutsideDocument);let r=Bp.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},Bp.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var Hy={mounted(e,t){pk(e,t)},updated(e,t){pk(e,t)},unmounted(e){hk(e,e.__clickOutsideDocument??fk(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function k5(e){return e[1].user!==void 0}var S5=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(k5).filter(([r,o])=>{const i=Tu({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Tu({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}})},_5=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},A5="https://ingest.superdoc.dev/v1/collect",tW="community-and-eval-agplv3";function I5(){try{return"2.18.1-next.4"}catch{return"unknown"}}var E5=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||A5,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=I5()}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{}}},zp={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"},nW=[zp.INLINE_SDT_LABEL,zp.BLOCK_SDT_LABEL],mk={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"},T5=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"}}},rW=`.${zp.BLOCK_SDT}[${mk.SDT_ID}]`,oW=`[${mk.DRAGGABLE}="true"]`,x5=typeof window<"u",gk,Ef=e=>gk=e,vk=Symbol();function $y(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Tf;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Tf||(Tf={}));var yk=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 R5(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(){M5(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function bk(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function jp(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 Vp=typeof navigator=="object"?navigator:{userAgent:""},wk=/Macintosh/.test(Vp.userAgent)&&/AppleWebKit/.test(Vp.userAgent)&&!/Safari/.test(Vp.userAgent),M5=x5?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!wk?L5:"msSaveOrOpenBlob"in Vp?D5:O5:()=>{};function L5(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?bk(r.href)?Gy(e,t,n):(r.target="_blank",jp(r)):jp(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){jp(r)},0))}function D5(e,t="download",n){if(typeof e=="string")if(bk(e))Gy(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){jp(r)})}else navigator.msSaveOrOpenBlob(R5(e,n),t)}function O5(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(yk.HTMLElement))||"safari"in yk,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||wk)&&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:iW}=Object;function P5(){const e=Zg(!0),t=e.run(()=>re({}));let n=[],r=[];const o=$r({install(i){Ef(o),o._a=i,i.provide(vk,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 Ck=()=>{};function kk(e,t,n,r=Ck){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&Qg()&&h1(o),o}function xu(e,...t){e.forEach(n=>{n(...t)})}var F5=e=>e(),Sk=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)&&!sr(r)&&!Fi(r)?e[n]=Ky(o,r):e[n]=r}return e}var N5=Symbol();function B5(e){return!$y(e)||!Object.prototype.hasOwnProperty.call(e,N5)}var{assign:Cl}=Object;function z5(e){return!!(sr(e)&&e.effect)}function j5(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=_1(n.state.value[e]);return Cl(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=$r(Se(()=>{Ef(n);const m=n._s.get(e);return s[p].call(m,m)})),f),{}))}return l=_k(e,u,t,n,r,!0),l}function _k(e,t,n={},r,o,i){let s;const a=Cl({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,m;const g=r.state.value[e];!i&&!g&&(r.state.value[e]={});let v;function C(M){let B;u=d=!1,typeof M=="function"?(M(r.state.value[e]),B={type:Tf.patchFunction,storeId:e,events:m}):(Ky(r.state.value[e],M),B={type:Tf.patchObject,payload:M,storeId:e,events:m});const W=v=Symbol();St().then(()=>{v===W&&(u=!0)}),d=!0,xu(f,B,r.state.value[e])}const w=i?function(){const{state:B}=n,W=B?B():{};this.$patch(z=>{Cl(z,W)})}:Ck;function _(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const y=(M,B="")=>{if(Sk in M)return M[Wy]=B,M;const W=function(){Ef(r);const z=Array.from(arguments),V=new Set,Z=new Set;function R(G){V.add(G)}function K(G){Z.add(G)}xu(p,{args:z,name:W[Wy],store:k,after:R,onError:K});let x;try{x=M.apply(this&&this.$id===e?this:k,z)}catch(G){throw xu(Z,G),G}return x instanceof Promise?x.then(G=>(xu(V,G),G)).catch(G=>(xu(Z,G),Promise.reject(G))):(xu(V,x),x)};return W[Sk]=!0,W[Wy]=B,W},k=Zr({_p:r,$id:e,$onAction:kk.bind(null,p),$patch:C,$reset:w,$subscribe(M,B={}){const W=kk(f,M,B.detached,()=>z()),z=s.run(()=>Vt(()=>r.state.value[e],V=>{(B.flush==="sync"?d:u)&&M({storeId:e,type:Tf.direct,events:m},V)},Cl({},l,B)));return W},$dispose:_});r._s.set(e,k);const T=(r._a&&r._a.runWithContext||F5)(()=>r._e.run(()=>(s=Zg()).run(()=>t({action:y}))));for(const M in T){const B=T[M];sr(B)&&!z5(B)||Fi(B)?i||(g&&B5(B)&&(sr(B)?B.value=g[M]:Ky(B,g[M])),r.state.value[e][M]=B):typeof B=="function"&&(T[M]=y(B,M),a.actions[M]=B)}return Cl(k,T),Cl(yn(k),T),Object.defineProperty(k,"$state",{get:()=>r.state.value[e],set:M=>{C(B=>{Cl(B,M)})}}),r._p.forEach(M=>{Cl(k,s.run(()=>M({store:k,app:r._a,pinia:r,options:a})))}),g&&i&&n.hydrate&&n.hydrate(k.$state,g),u=!0,d=!0,k}function Ak(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=Q1();return s=s||(l?dl(vk,null):null),s&&Ef(s),s=gk,s._s.has(e)||(o?_k(e,t,r,s):j5(e,r,s)),s._s.get(e)}return i.$id=e,i}function zs(e){const t=yn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=Se({get:()=>e[r],set(i){e[r]=i}}):(sr(o)||Fi(o))&&(n[r]=sv(e,r))}return n}function Ik(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function Ek(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 kc(e){return typeof e=="string"&&e.length>0?e:null}function V5(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 U5(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 H5(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 $5(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function Up(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 G5(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function W5(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 Tk(e,t){const n=kc(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=V5(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: ${Ek(r)}).`};const i=H5(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?kc(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 K5(e){const t=kc(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty v2Collaboration.adapterId."};const n=kc(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:kc(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 q5(e,t){const n=kc(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=kc(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=U5(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 xk(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=Ik(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=W5(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",f=Ek(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=$5(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=G5(s);return l===null||l==="y-websocket"?Up(Tk("y-websocket",s),a):l==="hocuspocus"?Up(Tk("hocuspocus",s),a):l==="liveblocks"?Up(q5(s,o),a):l==="extension"?Up(K5(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 xf=(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?xf(e.originFileObj,e.name||t):e.file?xf(e.file,e.name||t):e.raw?xf(e.raw,e.name||t):null},Rk=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,Y5=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,kl=e=>{if(ArrayBuffer.isView(e))return Y5?.call(e)==="Uint8Array";if(!Rk)return!1;try{return Rk.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 pr:return pr;case"pdf":case Ma:return Ma;case"html":case Eu:return Eu;default:return e}},Hp=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?pr:t.endsWith(".pdf")?Ma:t.endsWith(".html")||t.endsWith(".htm")?Eu:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},X5=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",Z5="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:Ik(e)}}if(kl(e))return{type:pr,data:Xy(e),name:"document.docx"};const t=xf(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=Hp(n),i=o||Hp(r),s=t.type.toLowerCase()===Z5,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(kl(e.data)){const r=Qy(e.type||Hp(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||X5(r)}}const n=xf(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?Qy(e.type):"",o=r||n.type||Hp(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};Bt();function Q5(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?Zr({...t}):re(t),i=re(null);return Vt(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function J5(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}=Q5(e,i,re([])),l=re(e.itemtype),u=re(e.itemfieldtype),d=e,f=Zr({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=re(e.logicrules),m=re(!1),g=Zr({}),v={SELECT:t6,IMAGEINPUT:e6,CHECKBOXINPUT:n6};return l.value in v&&Object.assign(g,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:m,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...g}}function e6(e){return{fontfamily:re(e.fontfamily),iteminputtype:re(e.iteminputtype)}}function t6(e){return{options:re(e.itemoptions)}}function n6(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 js=()=>new Map,e0=e=>{const t=js();return e.forEach((n,r)=>{t.set(r,n)}),t},Ru=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},r6=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},o6=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Mu=()=>new Set,t0=e=>e[e.length-1],Lu=Array.from,n0=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},Mk=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},i6=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},$p=Array.isArray,s6=class{constructor(){this._observers=js()}on(e,t){return Ru(this._observers,e,Mu).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 Lu((this._observers.get(e)||js()).values()).forEach(n=>n(...t))}destroy(){this._observers=js()}},La=Math.floor,Gp=Math.abs,Lk=(e,t)=>e<t?e:t,Du=(e,t)=>e>t?e:t,sW=Number.isNaN,a6=e=>e!==0?e<0:1/e<0,aW=1,lW=2,cW=4,uW=8,dW=32,fW=64,hW=128,l6=1<<17,c6=1<<18,u6=1<<19,d6=1<<20,f6=1<<21,h6=1<<22,p6=1<<23,m6=1<<24,g6=1<<25,v6=1<<26,y6=1<<27,b6=1<<28,w6=1<<29,C6=1<<30,pW=31,mW=63,gW=127,vW=l6-1,yW=c6-1,bW=u6-1,wW=d6-1,CW=f6-1,kW=h6-1,SW=p6-1,_W=m6-1,AW=g6-1,IW=v6-1,EW=y6-1,TW=b6-1,xW=w6-1,RW=C6-1,MW=2147483647,Dk=Number.MAX_SAFE_INTEGER,Ok=Number.MIN_SAFE_INTEGER,k6=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&La(e)===e),LW=Number.isNaN,DW=Number.parseInt,Pk=String.fromCharCode,OW=String.fromCodePoint,PW=Pk(65535),S6=e=>e.toLowerCase(),_6=/^\s*/g,A6=e=>e.replace(_6,""),I6=/([A-Z])/g,Fk=(e,t)=>A6(e.replace(I6,n=>`${t}${S6(n)}`)),E6=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},Rf=typeof TextEncoder<"u"?new TextEncoder:null,T6=e=>Rf.encode(e),x6=Rf?T6:E6,r0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});r0&&r0.decode(new Uint8Array).length===1&&(r0=null);var R6=(e,t)=>i6(t,()=>e).join(""),Mf=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},o0=()=>new Mf,M6=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},Da=e=>{const t=new Uint8Array(M6(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},L6=(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(Du(n,t)*2),e.cpos=0)},lo=(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=lo,qn=(e,t)=>{for(;t>127;)lo(e,128|127&t),t=La(t/128);lo(e,127&t)},s0=(e,t)=>{const n=a6(t);for(n&&(t=-t),lo(e,(t>63?128:0)|(n?64:0)|63&t),t=La(t/64);t>0;)lo(e,(t>127?128:0)|127&t),t=La(t/128)},a0=new Uint8Array(3e4),D6=a0.length/3,O6=(e,t)=>{if(t.length<D6){const n=Rf.encodeInto(t,a0).written||0;qn(e,n);for(let r=0;r<n;r++)lo(e,a0[r])}else wi(e,x6(t))},P6=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;qn(e,r);for(let o=0;o<r;o++)lo(e,n.codePointAt(o))},Ou=Rf&&Rf.encodeInto?O6:P6,l0=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=Lk(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(Du(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},wi=(e,t)=>{qn(e,t.byteLength),l0(e,t)},c0=(e,t)=>{L6(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},F6=(e,t)=>c0(e,4).setFloat32(0,t,!1),N6=(e,t)=>c0(e,8).setFloat64(0,t,!1),B6=(e,t)=>c0(e,8).setBigInt64(0,t,!1),Nk=new DataView(new ArrayBuffer(4)),z6=e=>(Nk.setFloat32(0,e),Nk.getFloat32(0)===e),Lf=(e,t)=>{switch(typeof t){case"string":lo(e,119),Ou(e,t);break;case"number":k6(t)&&Gp(t)<=2147483647?(lo(e,125),s0(e,t)):z6(t)?(lo(e,124),F6(e,t)):(lo(e,123),N6(e,t));break;case"bigint":lo(e,122),B6(e,t);break;case"object":if(t===null)lo(e,126);else if($p(t)){lo(e,117),qn(e,t.length);for(let n=0;n<t.length;n++)Lf(e,t[n])}else if(t instanceof Uint8Array)lo(e,116),wi(e,t);else{lo(e,118);const n=Object.keys(t);qn(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];Ou(e,o),Lf(e,t[o])}}break;case"boolean":lo(e,t?120:121);break;default:lo(e,127)}},Bk=class extends Mf{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&qn(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},zk=e=>{e.count>0&&(s0(e.encoder,e.count===1?e.s:-e.s),e.count>1&&qn(e.encoder,e.count-2))},Wp=class{constructor(){this.encoder=new Mf,this.s=0,this.count=0}write(e){this.s===e?this.count++:(zk(this),this.count=1,this.s=e)}toUint8Array(){return zk(this),Da(this.encoder)}},jk=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);s0(e.encoder,t),e.count>1&&qn(e.encoder,e.count-2)}},u0=class{constructor(){this.encoder=new Mf,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(jk(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return jk(this),Da(this.encoder)}},j6=class{constructor(){this.sarr=[],this.s="",this.lensE=new Wp}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 Mf;return this.sarr.push(this.s),this.s="",Ou(e,this.sarr.join("")),l0(e,this.lensE.toUint8Array()),Da(e)}},Sl=e=>new Error(e),cs=()=>{throw Sl("Method unimplemented")},Oa=()=>{throw Sl("Unexpected case")},FW=crypto.subtle,V6=crypto.getRandomValues.bind(crypto),Vk=()=>V6(new Uint32Array(1))[0],U6="10000000-1000-4000-8000-100000000000",H6=()=>U6.replace(/[018]/g,e=>(e^Vk()&15>>e/4).toString(16)),$6=Date.now,Uk=e=>new Promise(e),NW=Promise.all.bind(Promise),Hk=e=>e===void 0?null:e,G6=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},$k=new G6,W6=!0;try{typeof localStorage<"u"&&localStorage&&($k=localStorage,W6=!1)}catch{}var K6=$k,Df=Symbol("Equality"),Gk=(e,t)=>e===t||!!e?.[Df]?.(t)||!1,q6=e=>typeof e=="object",Y6=Object.assign,X6=Object.keys,Z6=(e,t)=>{for(const n in e)t(e[n],n)},Kp=e=>X6(e).length,Q6=e=>{for(const t in e)return!1;return!0},Of=(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),J6=(e,t)=>e===t||Kp(e)===Kp(t)&&Of(e,(n,r)=>(n!==void 0||d0(t,r))&&Gk(t[r],n)),e8=Object.freeze,Wk=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&Wk(e[t])}return e8(e)},f0=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&f0(e,t,n+1)}},qp=(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[Df]!=null)return e[Df](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)||!qp(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Kp(e)!==Kp(t))return!1;for(const n in e)if(!d0(e,n)||!qp(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(!qp(e[n],t[n]))return!1;break;default:return!1}return!0},t8=(e,t)=>t.includes(e),Pf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",BW=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,Vs,n8=[],r8=()=>{if(Vs===void 0)if(Pf){Vs=js();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&Vs.set(t,""),t=r):t!==null?(Vs.set(t,r),t=null):n8.push(r)}t!==null&&Vs.set(t,"")}else typeof location=="object"?(Vs=js(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");Vs.set(`--${Fk(t,"-")}`,n),Vs.set(`-${Fk(t,"-")}`,n)}})):Vs=js();return Vs},h0=e=>r8().has(e),Yp=e=>Hk(Pf?process.env[e.toUpperCase().replaceAll("-","_")]:K6.getItem(e)),Kk=e=>h0("--"+e)||Yp(e)!==null,o8=Kk("production"),i8=Pf&&t8(process.env.FORCE_COLOR,["true","1","2"]),s8=i8||!h0("--no-colors")&&!Kk("no-color")&&(!Pf||process.stdout.isTTY)&&(!Pf||h0("--color")||Yp("COLORTERM")!==null||(Yp("TERM")||"").includes("color")),a8=class{constructor(e,t){this.left=e,this.right=t}},Pa=(e,t)=>new a8(e,t),qk=e=>e.next()>=.5,p0=(e,t,n)=>La(e.next()*(n+1-t)+t),Yk=(e,t,n)=>La(e.next()*(n+1-t)+t),m0=(e,t,n)=>Yk(e,t,n),l8=e=>Pk(m0(e,97,122)),c8=(e,t=0,n=20)=>{const r=m0(e,t,n);let o="";for(let i=0;i<r;i++)o+=l8(e);return o},g0=(e,t)=>t[m0(e,0,t.length-1)],u8=Symbol("0schema"),d8=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(R6(" ",(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[Df]?Gk(e,t):$p(e)?n0(e,n=>Mk(t,r=>v0(n,r))):q6(e)?Of(e,(n,r)=>v0(n,t[r])):!1,Ko=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&&qp(this.shape,e.shape)}[u8](){return!0}[Df](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){cs()}get nullable(){return Pu(this,tm)}get optional(){return new Qk(this)}cast(e){return f3(e,this),e}expect(e){return f3(e,this),e}},y0=class extends Ko{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}},Gr=(e,t=null)=>new y0(e,t),zW=Gr(y0),b0=class extends Ko{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}},co=e=>new b0(e),jW=Gr(b0),Xp=class extends Ko{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}},Zp=(...e)=>new Xp(e),Xk=Gr(Xp),f8=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),Zk=e=>{if(Nu.check(e))return[f8(e)];if(Xk.check(e))return e.shape.map(t=>t+"");if(c3.check(e))return["[+-]?\\d+.?\\d*"];if(u3.check(e))return[".*"];if(Qp.check(e))return e.shape.map(Zk).flat(1);Oa()},h8=class extends Ko{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(Zk).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}},VW=Gr(h8),p8=Symbol("optional"),Qk=class extends Ko{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[p8](){return!0}},m8=Gr(Qk),Jk=class extends Ko{check(e,t){return t?.extend(null,"never",typeof e),!1}},UW=new Jk,HW=Gr(Jk),e3=class WE extends Ko{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new WE(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):Of(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})}},g8=e=>new e3(e),v8=Gr(e3),y8=co(e=>e!=null&&(e.constructor===Object||e.constructor==null)),t3=class extends Ko{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&Of(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)})}},n3=(e,t)=>new t3(e,t),b8=Gr(t3),r3=class extends Ko{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&Of(this.shape,(n,r)=>{const o=n.check(e[r],t);return!o&&t?.extend(r.toString(),"Tuple",typeof n),o})}},w8=(...e)=>new r3(e),$W=Gr(r3),o3=class extends Ko{constructor(e){super(),this.shape=e.length===1?e[0]:new w0(e)}check(e,t){const n=$p(e)&&n0(e,r=>this.shape.check(r));return!n&&t?.extend(null,"Array",""),n}},i3=(...e)=>new o3(e),C8=Gr(o3),k8=co(e=>$p(e)),s3=class extends Ko{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}},S8=(e,t=null)=>new s3(e,t),GW=Gr(s3),_8=S8(Ko),A8=class extends Ko{constructor(e){super(),this.len=e.length-1,this.args=w8(...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}},I8=Gr(A8),E8=co(e=>typeof e=="function"),T8=class extends Ko{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}},WW=Gr(T8,e=>e.shape.length>0),w0=class extends Ko{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const n=Mk(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),n}},Pu=(...e)=>e.findIndex(t=>Qp.check(t))>=0?Pu(...e.map(t=>Ff(t)).map(t=>Qp.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new w0(e),Qp=Gr(w0),a3=()=>!0,Jp=co(a3),x8=Gr(b0,e=>e.shape===a3),C0=co(e=>typeof e=="bigint"),R8=co(e=>e===C0),l3=co(e=>typeof e=="symbol"),KW=co(e=>e===l3),Fu=co(e=>typeof e=="number"),c3=co(e=>e===Fu),Nu=co(e=>typeof e=="string"),u3=co(e=>e===Nu),em=co(e=>typeof e=="boolean"),M8=co(e=>e===em),d3=Zp(void 0),qW=Gr(Xp,e=>e.shape.length===1&&e.shape[0]===void 0),YW=Zp(void 0),tm=Zp(null),L8=Gr(Xp,e=>e.shape.length===1&&e.shape[0]===null),XW=Gr(Uint8Array),ZW=Gr(y0,e=>e.shape===Uint8Array),D8=Pu(Fu,Nu,tm,d3,C0,em,l3),QW=(()=>{const e=i3(Jp),t=n3(Nu,Jp),n=Pu(Fu,Nu,tm,em,e,t);return e.shape=n,t.shape.values=n,n})(),Ff=e=>{if(_8.check(e))return e;if(y8.check(e)){const t={};for(const n in e)t[n]=Ff(e[n]);return g8(t)}else{if(k8.check(e))return Pu(...e.map(Ff));if(D8.check(e))return Zp(e);if(E8.check(e))return Gr(e)}Oa()},f3=o8?()=>{}:(e,t)=>{const n=new d8;if(!t.check(e,n))throw Sl(`Expected value to be of type ${t.constructor.name}.
6
6
  ${n.toString()}`)},O8=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Ff(e),h:t}),this}else(e){return this.if(Jp,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 Sl("Unhandled pattern")}}},P8=e=>new O8(e),h3=P8(Jp).if(c3,(e,t)=>p0(t,Ok,Dk)).if(u3,(e,t)=>c8(t)).if(M8,(e,t)=>qk(t)).if(R8,(e,t)=>BigInt(p0(t,Ok,Dk))).if(Qp,(e,t)=>Bu(t,g0(t,e.shape))).if(v8,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(m8.check(o)){if(qk(t))continue;o=o.shape}n[r]=h3(o,t)}return n}).if(C8,(e,t)=>{const n=[],r=Yk(t,0,42);for(let o=0;o<r;o++)n.push(Bu(t,e.shape));return n}).if(Xk,(e,t)=>g0(t,e.shape)).if(L8,(e,t)=>null).if(I8,(e,t)=>{const n=Bu(t,e.res);return()=>n}).if(x8,(e,t)=>Bu(t,g0(t,[Fu,Nu,tm,d3,C0,em,i3(Fu),n3(Pu("a","b","c"),Fu)]))).if(b8,(e,t)=>{const n={},r=p0(t,0,3);for(let o=0;o<r;o++){const i=Bu(t,e.shape.keys);n[i]=Bu(t,e.shape.values)}return n}).done(),Bu=(e,t)=>h3(Ff(t),e),Sc=typeof document<"u"?document:{},JW=co(e=>e.nodeType===j8),eK=typeof DOMParser<"u"?new DOMParser:null,tK=co(e=>e.nodeType===N8),nK=co(e=>e.nodeType===B8),F8=e=>r6(e,(t,n)=>`${n}:${t};`).join(""),N8=Sc.ELEMENT_NODE,B8=Sc.TEXT_NODE,rK=Sc.CDATA_SECTION_NODE,oK=Sc.COMMENT_NODE,z8=Sc.DOCUMENT_NODE,iK=Sc.DOCUMENT_TYPE_NODE,j8=Sc.DOCUMENT_FRAGMENT_NODE,sK=co(e=>e.nodeType===z8),Fa=Symbol,p3=Fa(),m3=Fa(),V8=Fa(),U8=Fa(),H8=Fa(),g3=Fa(),$8=Fa(),k0=Fa(),G8=Fa(),W8=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},aK=$6(),K8={[p3]:Pa("font-weight","bold"),[m3]:Pa("font-weight","normal"),[V8]:Pa("color","blue"),[H8]:Pa("color","green"),[U8]:Pa("color","grey"),[g3]:Pa("color","red"),[$8]:Pa("color","purple"),[k0]:Pa("color","orange"),[G8]:Pa("color","black")},q8=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=js();let o=[],i=0;for(;i<e.length;i++){const s=e[i],a=K8[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=F8(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},v3=s8?q8:W8,Y8=(...e)=>{console.log(...v3(e)),y3.forEach(t=>t.print(e))},X8=(...e)=>{console.warn(...v3(e)),e.unshift(k0),y3.forEach(t=>t.print(e))},y3=Mu(),b3=e=>({[Symbol.iterator](){return this},next:e}),Z8=(e,t)=>b3(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),S0=(e,t)=>b3(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),w3=class{constructor(e,t){this.clock=e,this.len=t}},C3=class{constructor(){this.clients=new Map}},k3=(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])D3(e,i,u.clock,u.len,n)}}),Q8=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=La((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},S3=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&Q8(n,t.clock)!==null},_3=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 w3(o.clock,Du(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},A3=(e,t,n,r)=>{Ru(e.clients,t,()=>[]).push(new w3(n,r))},J8=()=>new C3,eR=(e,t)=>{qn(e.restEncoder,t.clients.size),Lu(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),qn(e.restEncoder,n);const o=r.length;qn(e.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},I3=Vk,_0=class KE extends s6{constructor({guid:t=H6(),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=I3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new fR,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=Uk(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>Uk(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&&lr(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Lu(this.subdocs).map(t=>t.guid))}transact(t,n=null){return lr(this,t,n)}get(t,n=ko){const r=Ru(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==ko&&o!==n)if(o===ko){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,IR)}getText(t=""){return this.get(t,LR)}getMap(t=""){return this.get(t,L0)}getXmlElement(t=""){return this.get(t,nS)}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,Lu(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new KE({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,lr(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()}},tR=class{constructor(){this.restEncoder=o0()}toUint8Array(){return Da(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){qn(this.restEncoder,e)}writeDsLen(e){qn(this.restEncoder,e)}},nR=class extends tR{writeLeftID(e){qn(this.restEncoder,e.client),qn(this.restEncoder,e.clock)}writeRightID(e){qn(this.restEncoder,e.client),qn(this.restEncoder,e.clock)}writeClient(e){qn(this.restEncoder,e)}writeInfo(e){i0(this.restEncoder,e)}writeString(e){Ou(this.restEncoder,e)}writeParentInfo(e){qn(this.restEncoder,e?1:0)}writeTypeRef(e){qn(this.restEncoder,e)}writeLen(e){qn(this.restEncoder,e)}writeAny(e){Lf(this.restEncoder,e)}writeBuf(e){wi(this.restEncoder,e)}writeJSON(e){Ou(this.restEncoder,JSON.stringify(e))}writeKey(e){Ou(this.restEncoder,e)}},rR=class{constructor(){this.restEncoder=o0(),this.dsCurrVal=0}toUint8Array(){return Da(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,qn(this.restEncoder,t)}writeDsLen(e){e===0&&Oa(),qn(this.restEncoder,e-1),this.dsCurrVal+=e}},oR=class extends rR{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new u0,this.clientEncoder=new Wp,this.leftClockEncoder=new u0,this.rightClockEncoder=new u0,this.infoEncoder=new Bk(i0),this.stringEncoder=new j6,this.parentInfoEncoder=new Bk(i0),this.typeRefEncoder=new Wp,this.lenEncoder=new Wp}toUint8Array(){const e=o0();return qn(e,0),wi(e,this.keyClockEncoder.toUint8Array()),wi(e,this.clientEncoder.toUint8Array()),wi(e,this.leftClockEncoder.toUint8Array()),wi(e,this.rightClockEncoder.toUint8Array()),wi(e,Da(this.infoEncoder)),wi(e,this.stringEncoder.toUint8Array()),wi(e,Da(this.parentInfoEncoder)),wi(e,this.typeRefEncoder.toUint8Array()),wi(e,this.lenEncoder.toUint8Array()),l0(e,Da(this.restEncoder)),Da(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){Lf(this.restEncoder,e)}writeBuf(e){wi(this.restEncoder,e)}writeJSON(e){Lf(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)}},iR=(e,t,n,r)=>{r=Du(r,t[0].id.clock);const o=Na(t,r);qn(e.restEncoder,t.length-o),e.writeClient(n),qn(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)},sR=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{ii(t,i)>o&&r.set(i,o)}),I0(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),qn(e.restEncoder,r.size),Lu(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{iR(e,t.clients.get(o),o,i)})},aR=(e,t)=>sR(e,t.doc.store,t.beforeState),lR=class{constructor(){this.l=[]}},E3=()=>new lR,T3=(e,t)=>e.l.push(t),x3=(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.")},R3=(e,t,n)=>f0(e.l,[t,n]),nm=class{constructor(e,t){this.client=e,this.clock=t}},rm=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,xr=(e,t)=>new nm(e,t),cR=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw Oa()},uR=class{constructor(e,t){this.ds=e,this.sv=t}},dR=(e,t)=>new uR(e,t),lK=dR(J8(),new Map),zu=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!S3(t.ds,e.id),A0=(e,t)=>{const n=Ru(e.meta,A0,Mu),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<ii(r,i)&&_l(e,xr(i,o))}),k3(e,t.ds,o=>{}),n.add(t))},fR=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},ii=(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},M3=(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 Oa()}n.push(t)},Na=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=La(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=La((n+r)/2)}throw Oa()},hR=(e,t)=>{const n=e.clients.get(t.client);return n[Na(n,t.clock)]},E0=hR,T0=(e,t,n)=>{const r=Na(t,n),o=t[r];return o.id.clock<n&&o instanceof Ci?(t.splice(r+1,0,sS(e,o,n-o.id.clock)),r+1):r},_l=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[T0(e,n,t.clock)]},L3=(e,t,n)=>{const r=t.clients.get(n.client),o=Na(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Il&&r.splice(o+1,0,sS(e,i,n.clock-i.id.clock+1)),i},pR=(e,t,n)=>{const r=e.clients.get(t.id.client);r[Na(r,t.id.clock)]=n},D3=(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)},mR=class{constructor(e,t,n){this.doc=e,this.deleteSet=new C3,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}},O3=(e,t)=>t.deleteSet.clients.size===0&&!o6(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(_3(t.deleteSet),aR(e,t),eR(e,t.deleteSet),!0),P3=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&Ru(e.changed,t,Mu).add(n)},om=(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 Ci&&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},gR=(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=Na(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 Ci&&f.deleted&&!f.keep&&n(f)&&f.gc(t,!1)}}}},vR=(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=Lk(o.length-1,1+Na(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+om(o,l)}})},F3=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{_3(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(()=>{R3(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&RR(n)})}),f0(a,[])}finally{r.gc&&gR(i,o,r.gcFilter),vR(i,o),n.afterState.forEach((d,f)=>{const p=n.beforeState.get(f)||0;if(p!==d){const m=o.clients.get(f),g=Du(Na(m,p),1);for(let v=m.length-1;v>=g;)v-=1+om(m,v)}});for(let d=s.length-1;d>=0;d--){const{client:f,clock:p}=s[d].id,m=o.clients.get(f),g=Na(m,p);g+1<m.length&&om(m,g+1)>1||g>0&&om(m,g)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(Y8(k0,p3,"[yjs] ",m3,g3,"Changed the client-id because another client seems to be using it."),r.clientID=I3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new nR;O3(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new oR;O3(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])):F3(e,t+1)}}},lr=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new mR(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&&F3(o,0)}}return s},N3="You must not compute changes after the event-handler fired.",im=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=yR(this.currentTarget,this.target))}deletes(e){return S3(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Sl(N3);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 Sl(N3);const t=this.target,n=Mu(),r=Mu(),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}},yR=(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},Fo=()=>{X8("Invalid access: Add Yjs type to a document before reading data.")},B3=80,x0=0,bR=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=x0++}},wR=e=>{e.timestamp=x0++},z3=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=x0++},CR=(e,t,n)=>{if(e.length>=B3){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return z3(r,t,n),r}else{const r=new bR(t,n);return e.push(r),r}},sm=(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)=>Gp(t-i.index)<Gp(t-s.index)?i:s);let r=e._start,o=0;for(n!==null&&(r=n.p,o=n.index,wR(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&&Gp(n.index-o)<r.parent.length/B3?(z3(n,r,o),n):CR(e._searchMarker,r,o)},Nf=(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=Du(t,o.index+n))}},am=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;Ru(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;R3(r._eH,n,t)},ko=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=E3(),this._dEH=E3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw cs()}clone(){throw cs()}_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){T3(this._eH,e)}observeDeep(e){T3(this._dEH,e)}unobserve(e){x3(this._eH,e)}unobserveDeep(e){x3(this._dEH,e)}toJSON(){}},j3=(e,t,n)=>{e.doc??Fo(),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},V3=e=>{e.doc??Fo();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},Bf=(e,t)=>{let n=0,r=e._start;for(e.doc??Fo();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}},U3=(e,t)=>{const n=[];return Bf(e,(r,o)=>{n.push(t(r,o,e))}),n},kR=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}}}},H3=(e,t)=>{e.doc??Fo();const n=sm(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}},lm=(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 Ci(xr(s,ii(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 Ci(xr(s,ii(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new oS(new Uint8Array(f))),o.integrate(e,0);break;case _0:o=new Ci(xr(s,ii(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new iS(f)),o.integrate(e,0);break;default:if(f instanceof ko)o=new Ci(xr(s,ii(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Uu(f)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},$3=()=>Sl("Length exceeded!"),G3=(e,t,n,r)=>{if(n>t._length)throw $3();if(n===0)return t._searchMarker&&Nf(t._searchMarker,n,r.length),lm(e,t,null,r);const o=n,i=sm(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&&_l(e,xr(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&Nf(t._searchMarker,o,r.length),lm(e,t,s,r)},SR=(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 lm(e,t,r,n)},W3=(e,t,n,r)=>{if(r===0)return;const o=n,i=r,s=sm(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&&_l(e,xr(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&_l(e,xr(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw $3();t._searchMarker&&Nf(t._searchMarker,o,-i+r)},cm=(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 oS(r);break;case _0:a=new iS(r);break;default:if(r instanceof ko)a=new Uu(r);else throw new Error("Unexpected content type")}new Ci(xr(s,ii(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},M0=(e,t)=>{e.doc??Fo();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},K3=e=>{const t={};return e.doc??Fo(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},q3=(e,t)=>{e.doc??Fo();const n=e._map.get(t);return n!==void 0&&!n.deleted},_R=(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&&zu(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},um=e=>(e.doc??Fo(),Z8(e._map.entries(),t=>!t[1].deleted)),AR=class extends im{},IR=class zg extends ko{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 ko?n.clone():n)),t}get length(){return this.doc??Fo(),this._length}_callObserver(t,n){super._callObserver(t,n),am(this,t,new AR(this,t))}insert(t,n){this.doc!==null?lr(this.doc,r=>{G3(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?lr(this.doc,n=>{SR(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?lr(this.doc,r=>{W3(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return H3(this,t)}toArray(){return V3(this)}slice(t=0,n=this.length){return j3(this,t,n)}toJSON(){return this.map(t=>t instanceof ko?t.toJSON():t)}map(t){return U3(this,t)}forEach(t){Bf(this,t)}[Symbol.iterator](){return kR(this)}_write(t){t.writeTypeRef(BR)}},ER=class extends im{constructor(e,t,n){super(e,t),this.keysChanged=n}},L0=class V2 extends ko{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 V2}clone(){const t=new V2;return this.forEach((n,r)=>{t.set(r,n instanceof ko?n.clone():n)}),t}_callObserver(t,n){am(this,t,new ER(this,t,n))}toJSON(){this.doc??Fo();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof ko?o.toJSON():o}}),t}get size(){return[...um(this)].length}keys(){return S0(um(this),t=>t[0])}values(){return S0(um(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return S0(um(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??Fo(),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?lr(this.doc,n=>{cm(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?lr(this.doc,r=>{R0(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return M0(this,t)}has(t){return q3(this,t)}clear(){this.doc!==null?lr(this.doc,t=>{this.forEach(function(n,r,o){cm(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(zR)}},Al=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&J6(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&&Oa(),this.right.content.constructor===No?this.right.deleted||ju(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},Y3=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===No?t.right.deleted||ju(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&_l(e,xr(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},dm=(e,t,n,r)=>{const o=new Map,i=r?sm(t,n):null;if(i){const s=new D0(i.p.left,i.p,i.index,o);return Y3(e,s,n-i.index)}else{const s=new D0(null,t._start,0,o);return Y3(e,s,n)}},X3=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===No&&Al(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 Ci(xr(i,ii(o.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,new No(a,s));d.integrate(e,0),n.right=d,n.forward()})},ju=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},Z3=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===No&&Al(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},Q3=(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(!Al(u,l)){s.set(a,u);const{left:d,right:f}=n;n.right=new Ci(xr(i,ii(o.store,i)),d,d&&d.lastId,f,f&&f.id,t,null,new No(a,l)),n.right.integrate(e,0),n.forward()}}return s},O0=(e,t,n,r,o)=>{n.currentAttributes.forEach((p,m)=>{o[m]===void 0&&(o[m]=null)});const i=e.doc,s=i.clientID;Z3(n,o);const a=Q3(e,t,n,o),l=r.constructor===String?new Vu(r):r instanceof ko?new Uu(r):new fm(r);let{left:u,right:d,index:f}=n;t._searchMarker&&Nf(t._searchMarker,n.index,l.getLength()),d=new Ci(xr(s,ii(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(),X3(e,t,n,a)},J3=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;Z3(n,o);const a=Q3(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===No));){if(!n.right.deleted)switch(n.right.content.constructor){case No:{const{key:l,value:u}=n.right.content,d=o[l];if(d!==void 0){if(Al(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&&_l(e,xr(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 Ci(xr(s,ii(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new Vu(l)),n.right.integrate(e,0),n.forward()}X3(e,t,n,a)},eS=(e,t,n,r,o)=>{let i=t;const s=js();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===No){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===No){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&&ju(o,u)}}t=t.right}return a},TR=(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===No){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},xR=e=>{let t=0;return lr(e.doc,n=>{let r=e._start,o=e._start,i=js();const s=e0(i);for(;o;)o.deleted===!1&&(o.content.constructor===No?ju(s,o.content):(t+=eS(n,r,o,i,s),i=e0(s),r=o)),o=o.right}),t},RR=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&&D3(e,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===No&&s.constructor!==Il&&t.add(s.parent)})}lr(n,r=>{k3(e,e.deleteSet,o=>{if(o instanceof Il||!o.parent._hasFormatting||t.has(o.parent))return;const i=o.parent;o.content.constructor===No?t.add(i):TR(r,o)});for(const o of t)xR(o)})},tS=(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 Uu:case fm:case Vu:n<t.right.length&&_l(e,xr(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&eS(e,i,t.right,o,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&Nf(s._searchMarker,t.index,-r+n),t},MR=class extends im{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=[];lr(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((m,g)=>{m!==null&&(p.attributes[g]=m)}))),l="";break;case"retain":u>0&&(p={retain:u},Q6(a)||(p.attributes=Y6({},a))),u=0;break}p&&t.push(p),s=null}};for(;i!==null;){switch(i.content.constructor){case Uu:case fm: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 Vu: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 No:{const{key:p,value:m}=i.content;if(this.adds(i)){if(!this.deletes(i)){const g=r.get(p)??null;Al(g,m)?m!==null&&i.delete(n):(s==="retain"&&f(),Al(m,o.get(p)??null)?delete a[p]:a[p]=m)}}else if(this.deletes(i)){o.set(p,m);const g=r.get(p)??null;Al(g,m)||(s==="retain"&&f(),a[p]=g)}else if(!i.deleted){o.set(p,m);const g=a[p];g!==void 0&&(Al(g,m)?g!==null&&i.delete(n):(s==="retain"&&f(),m===null?delete a[p]:a[p]=m))}i.deleted||(s==="insert"&&f(),ju(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}},LR=class U2 extends ko{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Fo(),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 U2}clone(){const t=new U2;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new MR(this,t,n);am(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??Fo();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===Vu&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?lr(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)===`
@@ -99,10 +99,10 @@ js: import "konva/skia-backend";
99
99
  `,v4=()=>{if(typeof document>"u")throw new Error(HB)},ps=class eT{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 eT(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}},$B="[object Array]",GB="[object Number]",WB="[object String]",KB="[object Boolean]",qB=Math.PI/180,YB=180/Math.PI,nh="#",XB="",ZB="0",QB="Konva warning: ",y4="Konva error: ",JB="rgb(",Nb={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]},ez=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Bm=[],rh=null,tz=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)===$B},_isNumber(e){return Object.prototype.toString.call(e)===GB&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===WB},_isBoolean(e){return Object.prototype.toString.call(e)===KB},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){Bm.push(e),Bm.length===1&&tz(function(){const t=Bm;Bm=[],t.forEach(function(n){n()})})},createCanvasElement(){v4();const e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return v4(),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(nh,XB);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=ZB+e;return nh+e},isCanvasFarblingActive(){if(rh!==null)return rh;if(typeof document>"u")return rh=!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 rh=r,this.releaseCanvas(e),rh},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),nh+this._rgbToHex(e,t,n)},getSnappedHexColor(e){const t=this._hexToRgb(e);return nh+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 Nb?(t=Nb[e],{r:t[0],g:t[1],b:t[2]}):e[0]===nh?this._hexToRgb(e.substring(1)):e.substr(0,4)===JB?(t=ez.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=Nb[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*qB},radToDeg(e){return e*YB},_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 At.angleDeg?Oe.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw new Error(y4+e)},error(e){console.error(y4+e)},warn(e){At.showWarnings&&console.warn(QB+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){At.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 m;typeof o=="number"?m=o:m=i<o.length?o[i]:0,m=r*Math.cos(Math.PI/n)*Math.min(1,m/r*2);const g={x:u.x/f,y:u.y/f},v={x:d.x/p,y:d.y/p},C={x:a.x-g.x*m,y:a.y-g.y*m},w={x:a.x+v.x*m,y:a.y+v.y*m};i===0?e.moveTo(C.x,C.y):e.lineTo(C.x,C.y),e.arcTo(a.x,a.y,w.x,w.y,m)}}};function nz(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 b4=",",rz="(",oz=")",iz="([",sz="])",az=";",lz="()",cz="=",w4=["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"],uz=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],dz=100,zm=null;function C4(){if(zm!==null)return zm;try{const e=Oe.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(zm=!1,!1)}catch{return zm=!1,!1}}var jm=class{constructor(e){this.canvas=e,At.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+=lz:Oe._isArray(l[0])?o+=iz+l.join(b4)+sz:(t&&(l=l.map(u=>typeof u=="number"?Math.floor(u):u)),o+=rz+l.join(b4)+oz)):(o+=s.property,e||(o+=cz+s.val)),o+=az;return o}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=dz&&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=w4.length,n=this.setAttr,r,o;const i=function(s){let a=e[s],l;e[s]=function(){return o=nz(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(w4[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)}};uz.forEach(function(e){Object.defineProperty(jm.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var fz=class extends jm{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)}},hz=class extends jm{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()}}},Vm;function pz(){if(Vm)return Vm;const e=Oe.createCanvasElement(),t=e.getContext("2d");return Vm=(function(){return(At._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),Oe.releaseCanvas(e),Vm}var Bb=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const t=(e||{}).pixelRatio||At.pixelRatio||pz();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."),""}}}},Ol=class extends Bb{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new fz(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},zb=class extends Bb{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new hz(this),this.setSize(e.width,e.height)}},zn={get isDragging(){let e=!1;return zn._dragElements.forEach(t=>{t.dragStatus==="dragging"&&(e=!0)}),e},justDragged:!1,get node(){let e;return zn._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];zn._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=[];zn._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")&&(zn.justDragged=!0,At._mouseListenClick=!1,At._touchListenClick=!1,At._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof At.Stage&&n.node;i&&t.indexOf(i)===-1&&t.push(i)}),t.forEach(n=>{n.draw()})},_endDragAfter(e){zn._dragElements.forEach((t,n)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),t.dragStatus!=="dragging"&&zn._dragElements.delete(n)})}};At.isBrowser&&(window.addEventListener("mouseup",zn._endDragBefore,!0),window.addEventListener("touchend",zn._endDragBefore,!0),window.addEventListener("touchcancel",zn._endDragBefore,!0),window.addEventListener("mousemove",zn._drag),window.addEventListener("touchmove",zn._drag),window.addEventListener("mouseup",zn._endDragAfter,!1),window.addEventListener("touchend",zn._endDragAfter,!1),window.addEventListener("touchcancel",zn._endDragAfter,!1));function Pl(e){return Oe._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||Oe._isBoolean(e)?e:Object.prototype.toString.call(e)}function k4(e){return e>255?255:e<0?0:Math.round(e)}function wt(){if(At.isUnminified)return function(e,t){return Oe._isNumber(e)||Oe.warn(Pl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function Um(e){if(At.isUnminified)return function(t,n){let r=Oe._isNumber(t),o=Oe._isArray(t)&&t.length==e;return!r&&!o&&Oe.warn(Pl(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function jb(){if(At.isUnminified)return function(e,t){return Oe._isNumber(e)||e==="auto"||Oe.warn(Pl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function Lc(){if(At.isUnminified)return function(e,t){return Oe._isString(e)||Oe.warn(Pl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function S4(){if(At.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(Pl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function mz(){if(At.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(Pl(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function ms(){if(At.isUnminified)return function(e,t){return e===!0||e===!1||Oe.warn(Pl(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function gz(e){if(At.isUnminified)return function(t,n){return t==null||Oe.isObject(t)||Oe.warn(Pl(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var oh="get",ih="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=oh+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=ih+Oe._capitalize(t);e.prototype[o]||me.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){const o=ih+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=oh+s(t),l=ih+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=gz(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=ih+n,o=oh+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=oh+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=oh+Oe._capitalize(n),s=ih+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 vz(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=At.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=At.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=At.Filters;l&&l.Contrast&&l.Contrast.call(this,s)}}case"grayscale":return function(i){const s=At.Filters;s&&s.Grayscale&&s.Grayscale.call(this,i)};case"sepia":return function(i){const s=At.Filters;s&&s.Sepia&&s.Sepia.call(this,i)};case"invert":return function(i){const s=At.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 Hm="absoluteOpacity",_4="allEventListeners",$a="absoluteTransform",A4="absoluteScale",Dc="canvas",yz="Change",bz="children",wz="konva",Vb="listening",Cz="mouseenter",kz="mouseleave",Sz="pointerenter",_z="pointerleave",Az="touchenter",Iz="touchleave",I4="set",E4="Shape",$m=" ",T4="stage",Fl="transform",Ez="Stage",Ub="visible",Tz=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join($m),xz=1,Et=class jh{constructor(t){this._id=xz++,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===Fl||t===$a)&&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===Fl||t===$a)&&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($m);this.on(o,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Dc)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===$a&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Dc)){const{scene:t,filter:n,hit:r}=this._cache.get(Dc);Oe.releaseCanvas(t._canvas,n._canvas,r._canvas),this._cache.delete(Dc)}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,m=Math.abs(Math.round(r.y)-l)>.5?1:0;o+=u*2+p,i+=u*2+m,a-=u,l-=u;const g=new Ol({pixelRatio:s,width:o,height:i}),v=new Ol({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),C=new zb({pixelRatio:f,width:o,height:i}),w=g.getContext(),_=C.getContext(),y=new Ol({width:g.width/g.pixelRatio+Math.abs(a),height:g.height/g.pixelRatio+Math.abs(l),pixelRatio:g.pixelRatio}),k=y.getContext();return C.isCache=!0,g.isCache=!0,this._cache.delete(Dc),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(g.getContext()._context.imageSmoothingEnabled=!1,v.getContext()._context.imageSmoothingEnabled=!1),w.save(),_.save(),k.save(),w.translate(-a,-l),_.translate(-a,-l),k.translate(-a,-l),y.x=a,y.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Hm),this._clearSelfAndDescendantCache(A4),this.drawScene(g,this,y),this.drawHit(C,this),this._isUnderCache=!1,w.restore(),_.restore(),d&&(w.save(),w.beginPath(),w.rect(0,0,o,i),w.closePath(),w.setAttr("strokeStyle","red"),w.setAttr("lineWidth",5),w.stroke(),w.restore()),Oe.releaseCanvas(y._canvas),this._cache.set(Dc,{scene:g,filter:v,hit:C,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Dc)}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"&&C4(),typeof t[p]!="string"||!C4()){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=vz(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(_4),t.length===3)return this._delegate.apply(this,t);const o=n.split($m);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($m),o=r.length,i,s,a,l,u,d;if(this._cache&&this._cache.delete(_4),!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(),zn._dragElements.delete(this._id),zn._dragElements.forEach((t,n)=>{this.isAncestorOf(t.node)&&zn._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache($a),this._clearSelfAndDescendantCache(Hm),this._clearSelfAndDescendantCache(A4),this._clearSelfAndDescendantCache(T4),this._clearSelfAndDescendantCache(Ub),this._clearSelfAndDescendantCache(Vb)}_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!==bz&&(r=I4+Oe._capitalize(n),Oe._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(Vb,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(Ub,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;zn._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(o=!0)});const i=!n&&!At.hitOnDragEnabled&&(o||At.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!==E4&&(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!==Ez&&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(Fl),this._clearSelfAndDescendantCache($a)),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 ps,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(Fl);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(Fl),this._clearSelfAndDescendantCache($a),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(Hm,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(T4,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($a,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let n;if(t)return n=new ps,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($a)||new ps,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(Fl,this._getTransform)}_getTransform(){var t,n;const r=this._cache.get(Fl)||new ps;r.reset();const o=this.x(),i=this.y(),s=At.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(wz)<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 Ol({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 Ol({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():At.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+yz,{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[I4+Oe._capitalize(t)];return Oe._isFunction(r)?r.call(this,n):this._setAttr(t,n),this}_requestDraw(){if(At.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===E4&&(n.target=this);const o=[Cz,kz,Sz,_z,Az,Iz];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=jh.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,jh.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;zn._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){zn._dragElements.has(this._id)||this._createDragElement(t);const r=zn._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=zn._dragElements.get(this._id);n&&(n.dragStatus="stopped"),zn._endDragBefore(t),zn._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=zn._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||At.dragButtons.indexOf(t.evt.button)>=0)||this.isDragging())return;let n=!1;zn._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=zn._dragElements.get(this._id),n=t&&t.dragStatus==="dragging",r=t&&t.dragStatus==="ready";n?this.stopDrag():r&&zn._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=jh.prototype.getClassName.call(t),o=t.children,i,s,a;n&&(t.attrs.container=n),At[r]||(Oe.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=At[r];if(i=new l(t.attrs),o)for(s=o.length,a=0;a<s;a++)i.add(jh._createNode(o[a]));return i}};Et.protoListenerMap=new Map,Et.prototype.nodeType="Node",Et.prototype._attrsAffectingSize=[],Et.prototype.eventListeners={},Et.prototype.on(Tz,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(Fl),this._clearSelfAndDescendantCache($a)}),Et.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(Ub)}),Et.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(Vb)}),Et.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(Hm)});var Xn=me.addGetterSetter;Xn(Et,"zIndex"),Xn(Et,"absolutePosition"),Xn(Et,"position"),Xn(Et,"x",0,wt()),Xn(Et,"y",0,wt()),Xn(Et,"globalCompositeOperation","source-over",Lc()),Xn(Et,"opacity",1,wt()),Xn(Et,"name","",Lc()),Xn(Et,"id","",Lc()),Xn(Et,"rotation",0,wt()),me.addComponentsGetterSetter(Et,"scale",["x","y"]),Xn(Et,"scaleX",1,wt()),Xn(Et,"scaleY",1,wt()),me.addComponentsGetterSetter(Et,"skew",["x","y"]),Xn(Et,"skewX",0,wt()),Xn(Et,"skewY",0,wt()),me.addComponentsGetterSetter(Et,"offset",["x","y"]),Xn(Et,"offsetX",0,wt()),Xn(Et,"offsetY",0,wt()),Xn(Et,"dragDistance",void 0,wt()),Xn(Et,"width",0,wt()),Xn(Et,"height",0,wt()),Xn(Et,"listening",!0,ms()),Xn(Et,"preventDefault",!0,ms()),Xn(Et,"filters",void 0,function(e){return this._filterUpToDate=!1,e}),Xn(Et,"visible",!0,ms()),Xn(Et,"transformsEnabled","all",Lc()),Xn(Et,"size"),Xn(Et,"dragBoundFunc"),Xn(Et,"draggable",!1,ms()),me.backCompat(Et,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var _i=class extends Et{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=Et.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=Et.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 m=p.getMatrix();i.transform(m[0],m[1],m[2],m[3],m[4],m[5]),i.beginPath();let g;if(l)g=l.call(this,i,this);else{const v=this.clipX(),C=this.clipY();i.rect(v||0,C||0,s,a)}i.clip.apply(i,g),m=p.copy().invert().getMatrix(),i.transform(m[0],m[1],m[2],m[3],m[4],m[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 m=p.getClientRect({relativeTo:u,skipShadow:e.skipShadow,skipStroke:e.skipStroke});m.width===0&&m.height===0||(o===void 0?(o=m.x,i=m.y,s=m.x+m.width,a=m.y+m.height):(o=Math.min(o,m.x),i=Math.min(i,m.y),s=Math.max(s,m.x+m.width),a=Math.max(a,m.y+m.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(_i,"clip",["x","y","width","height"]),me.addGetterSetter(_i,"clipX",void 0,wt()),me.addGetterSetter(_i,"clipY",void 0,wt()),me.addGetterSetter(_i,"clipWidth",void 0,wt()),me.addGetterSetter(_i,"clipHeight",void 0,wt()),me.addGetterSetter(_i,"clipFunc");var sh=new Map,x4=At._global.PointerEvent!==void 0;function Hb(e){return sh.get(e)}function $b(e){return{evt:e,pointerId:e.pointerId}}function R4(e,t){return sh.get(e)===t}function M4(e,t){ah(e),t.getStage()&&(sh.set(e,t),x4&&t._fire("gotpointercapture",$b(new PointerEvent("gotpointercapture"))))}function ah(e,t){const n=sh.get(e);if(!n)return;const r=n.getStage();r&&r.content,sh.delete(e),x4&&n._fire("lostpointercapture",$b(new PointerEvent("lostpointercapture")))}var Rz="Stage",Mz="string",L4="px",Lz="mouseout",D4="mouseleave",O4="mouseover",P4="mouseenter",F4="mousemove",N4="mousedown",B4="mouseup",lh="pointermove",ch="pointerdown",id="pointerup",uh="pointercancel",Dz="lostpointercapture",Gm="pointerout",dh="pointerleave",Wm="pointerover",Km="pointerenter",Gb="contextmenu",z4="touchstart",j4="touchend",V4="touchmove",U4="touchcancel",Wb="wheel",Oz=5,Pz=[[P4,"_pointerenter"],[N4,"_pointerdown"],[F4,"_pointermove"],[B4,"_pointerup"],[D4,"_pointerleave"],[z4,"_pointerdown"],[V4,"_pointermove"],[j4,"_pointerup"],[U4,"_pointercancel"],[O4,"_pointerover"],[Wb,"_wheel"],[Gb,"_contextmenu"],[ch,"_pointerdown"],[lh,"_pointermove"],[id,"_pointerup"],[uh,"_pointercancel"],[dh,"_pointerleave"],[Dz,"_lostpointercapture"]],Kb={mouse:{[Gm]:Lz,[dh]:D4,[Wm]:O4,[Km]:P4,[lh]:F4,[ch]:N4,[id]:B4,[uh]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[Gm]:"touchout",[dh]:"touchleave",[Wm]:"touchover",[Km]:"touchenter",[lh]:V4,[ch]:z4,[id]:j4,[uh]:U4,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[Gm]:Gm,[dh]:dh,[Wm]:Wm,[Km]:Km,[lh]:lh,[ch]:ch,[id]:id,[uh]:uh,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},fh=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",sd=e=>{const t=fh(e);if(t==="pointer")return At.pointerEventsEnabled&&Kb.pointer;if(t==="touch")return Kb.touch;if(t==="mouse")return Kb.mouse};function H4(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&Oe.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var Fz="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);",hh=[],qm=class extends _i{constructor(e){super(H4(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),hh.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{H4(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===Mz){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"),_i.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&Oe._isInDocument(e)&&this.container().removeChild(e);const t=hh.indexOf(this);return t>-1&&hh.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(Fz),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 Ol({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+L4,this.content.style.height=t+L4),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>Oz&&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(),At.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return R4(e,this)}setPointerCapture(e){M4(e,this)}releaseCapture(e){ah(e,this)}getLayers(){return this.children}_bindContentEvents(){At.isBrowser&&Pz.forEach(([e,t])=>{this.content.addEventListener(e,n=>{this[t](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=sd(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=sd(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=sd(e.type),n=fh(e.type);if(!t)return;this.setPointersPositions(e);const r=this._getTargetShape(n),o=!(At.isDragging()||At.isTransforming())||At.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=sd(e.type),n=fh(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(o=>{const i=this.getIntersection(o);if(zn.justDragged=!1,At["_"+n+"ListenClick"]=!0,!i||!i.isListening()){this[n+"ClickStartShape"]=void 0;return}At.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=sd(e.type),n=fh(e.type);if(!t)return;const r=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(At.isDragging()&&zn.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(At.isDragging()||At.isTransforming())||At.hitOnDragEnabled))return;const o={};let i=!1;const s=this._getTargetShape(n);this._changedPointerPositions.forEach(a=>{const l=Hb(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=sd(e.type),n=fh(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=Hb(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;At["_"+n+"InDblClickWindow"]?(f=!0,clearTimeout(this[n+"DblTimeout"])):zn.justDragged||(At["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){At["_"+n+"InDblClickWindow"]=!1},At.dblClickWindow),l&&l.isListening()?(s=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,{...d}),At["_"+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),At["_"+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}),At["_"+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(Gb,{evt:e}):this._fire(Gb,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(Wb,{evt:e}):this._fire(Wb,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=Hb(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(id,$b(e)),ah(e.pointerId)}_lostpointercapture(e){ah(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 Ol({width:this.width(),height:this.height()}),this.bufferHitCanvas=new zb({pixelRatio:1,width:this.width(),height:this.height()}),!At.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}};qm.prototype.nodeType=Rz,wr(qm),me.addGetterSetter(qm,"container"),At.isBrowser&&document.addEventListener("visibilitychange",()=>{hh.forEach(e=>{e.batchDraw()})});var $4="hasShadow",G4="shadowRGBA",W4="patternImage",K4="linearGradient",q4="radialGradient",Ym;function qb(){return Ym||(Ym=Oe.createCanvasElement().getContext("2d"),Ym)}var ph={};function Nz(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function Bz(e){e.stroke()}function zz(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function jz(e){e.stroke()}function Vz(){this._clearCache($4)}function Uz(){this._clearCache(G4)}function Hz(){this._clearCache(W4)}function $z(){this._clearCache(K4)}function Gz(){this._clearCache(q4)}var gt=class extends Et{constructor(e){super(e);let t,n=0;for(;t=Oe.getHitColor(),!(t&&!(t in ph));)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,ph[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($4,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(W4,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=qb().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new ps;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(At.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(K4,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=qb(),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(q4,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const t=qb(),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(G4,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 Et.prototype.destroy.call(this),delete ph[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),m=l+Math.abs(f),g=u&&this.shadowBlur()||0,v={width:p+g*2,height:m+g*2,x:-(s/2+g)+Math.min(d,0)+i.x,y:-(s/2+g)+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 m=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/m,d.height/m)}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 R4(e,this)}setPointerCapture(e){M4(e,this)}releaseCapture(e){ah(e,this)}};gt.prototype._fillFunc=Nz,gt.prototype._strokeFunc=Bz,gt.prototype._fillFuncHit=zz,gt.prototype._strokeFuncHit=jz,gt.prototype._centroid=!1,gt.prototype.nodeType="Shape",wr(gt),gt.prototype.eventListeners={},gt.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",Vz),gt.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",Uz),gt.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",Hz),gt.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",$z),gt.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",Gz),me.addGetterSetter(gt,"stroke",void 0,S4()),me.addGetterSetter(gt,"strokeWidth",2,wt()),me.addGetterSetter(gt,"fillAfterStrokeEnabled",!1),me.addGetterSetter(gt,"hitStrokeWidth","auto",jb()),me.addGetterSetter(gt,"strokeHitEnabled",!0,ms()),me.addGetterSetter(gt,"perfectDrawEnabled",!0,ms()),me.addGetterSetter(gt,"shadowForStrokeEnabled",!0,ms()),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,Lc()),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,S4()),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,Lc()),me.backCompat(gt,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var Wz="beforeDraw",Kz="draw",Y4=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],qz=Y4.length,Oc=class extends _i{constructor(e){super(e),this.canvas=new Ol,this.hitCanvas=new zb({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(){Et.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(!Et.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(Et.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(Et.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 Et.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(),Et.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<qz;r++){const o=Y4[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=ph[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(Wz,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),_i.prototype.drawScene.call(this,o,t,n),this._fire(Kz,{node:this}),this}drawHit(e,t){const n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),_i.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()}};Oc.prototype.nodeType="Layer",wr(Oc),me.addGetterSetter(Oc,"imageSmoothingEnabled",!0),me.addGetterSetter(Oc,"clearBeforeDraw",!0),me.addGetterSetter(Oc,"hitGraphEnabled",!0,ms());var Yb=class extends Oc{constructor(e){super(e),this.listening(!1),Oe.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};Yb.prototype.nodeType="FastLayer",wr(Yb);var ad=class extends _i{_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Oe.throw("You may only add groups and shapes to groups.")}};ad.prototype.nodeType="Group",wr(ad);var Xb=(function(){return Mc.performance&&Mc.performance.now?function(){return Mc.performance.now()}:function(){return new Date().getTime()}})(),ld=class Fd{constructor(t,n){this.id=Fd.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Xb(),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=Fd.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=Xb(),Fd._addAnimation(this),this}stop(){return Fd._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(Xb());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=Fd;t.animations.length?(t._runFrames(),Oe.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Oe.requestAnimFrame(this._animationLoop))}};ld.animations=[],ld.animIdCounter=0,ld.animRunning=!1;var Yz={node:1,duration:1,easing:1,onFinish:1,yoyo:1},Xz=1,X4=2,Z4=3,Q4=["fill","stroke","shadowColor"],Zz=0,Qz=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=X4,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=Z4,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===X4?this.setTime(e):this.state===Z4&&this.setTime(this.duration-e)}pause(){this.state=Xz,this.fire("onPause")}getTimer(){return new Date().getTime()}},Xm=class Fr{constructor(t){const n=this,r=t.node,o=r._id,i=t.easing||mh.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=Zz++;const u=r.getLayer()||(r instanceof At.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 ld(function(){n.tween.onEnterFrame()},u),this.tween=new Qz(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)Yz[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 m=Oe.colorToRGBA(f[p]);u=Oe.colorToRGBA(n[p]),f[p]=m,i.push({r:u.r-m.r,g:u.g-m.g,b:u.b-m.b,a:u.a-m.a})}else for(let p=0;p<s;p++)i.push(n[p]-f[p]);else Q4.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 Q4.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])}};Xm.attrs={},Xm.tweens={},Et.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new Xm(e).play()};var mh={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-mh.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?mh.BounceEaseIn(e*2,0,n,r)*.5+t:mh.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}},J4=Oe._assign(At,{Util:Oe,Transform:ps,Node:Et,Container:_i,Stage:qm,stages:hh,Layer:Oc,FastLayer:Yb,Group:ad,DD:zn,Shape:gt,shapes:ph,Animation:ld,Tween:Xm,Easings:mh,Context:jm,Canvas:Bb}),Ga=class extends gt{_sceneFunc(e){const t=At.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=At.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}}};Ga.prototype._centroid=!0,Ga.prototype.className="Arc",Ga.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],wr(Ga),me.addGetterSetter(Ga,"innerRadius",0,wt()),me.addGetterSetter(Ga,"outerRadius",0,wt()),me.addGetterSetter(Ga,"angle",0,wt()),me.addGetterSetter(Ga,"clockwise",!1,ms());function Zb(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 eI(e,t){const n=e.length,r=[];for(let o=2;o<n-2;o+=2){const i=Zb(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 Jz(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 Wa=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():eI(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),t=e.length,n=this.tension(),r=Zb(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),o=Zb(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),i=eI(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],...Jz(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}}};Wa.prototype.className="Line",Wa.prototype._attrsAffectingSize=["points","bezier","tension"],wr(Wa),me.addGetterSetter(Wa,"closed",!1),me.addGetterSetter(Wa,"bezier",!1),me.addGetterSetter(Wa,"tension",0,wt()),me.addGetterSetter(Wa,"points",[],mz());var ej=[[],[],[-.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]],tj=[[],[],[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]],nj=[[1],[1,1],[1,2,1],[1,3,3,1]],tI=(e,t,n)=>{let r,o;const s=n/2;r=0;for(let a=0;a<20;a++)o=s*ej[20][a]+s,r+=tj[20][a]*rj(e,t,o);return s*r},nI=(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,m=f-d*d,g=p*p+m>0?Math.sqrt(p*p+m):0,v=d*d+m>0?Math.sqrt(d*d+m):0,C=d+Math.sqrt(d*d+m)!==0?m*Math.log(Math.abs((p+g)/(d+v))):0;return Math.sqrt(a)/2*(p*g-d*v+C)};function rj(e,t,n){const r=Qb(1,n,e),o=Qb(1,n,t),i=r*r+o*o;return Math.sqrt(i)}var Qb=(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+=nj[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 Qb(e-1,t,o)}},rI=(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 gi extends gt{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=gi.parsePathData(this.data()),this.pathLength=gi.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],m=s[6],g=s[7],v=u>d?u:d,C=u>d?1:u/d,w=u>d?d/u:1;t.translate(a,l),t.rotate(m),t.scale(C,w),t.arc(0,0,v,f,f+p,1-g),t.scale(1/C,1/w),t.rotate(-m),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 m=u-p;m>f;m-=p){const g=gi.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],m,0);t.push(g.x,g.y)}else for(let m=u+p;m<f;m+=p){const g=gi.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],m,0);t.push(g.x,g.y)}}else if(l.command==="C")for(let u=0;u<=1;u+=.01){const d=gi.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 gi.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 gi.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return gi.getPointOnCubicBezier(rI(t,gi.getPathLength(n),v=>tI([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 gi.getPointOnQuadraticBezier(rI(t,gi.getPathLength(n),v=>nI([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],m=a[6];let g=a[4];return g+=p*t/s.pathLength,gi.getPointOnEllipticalArc(l,u,d,f,g,m)}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),m=n+p*(o-n),g=r+p*(i-r),v=this.getLineLength(s,a,m,g),C=Math.sqrt(t*t-v*v),w=Math.sqrt(C*C/(1+u*u))*(o<n?-1:1),_=u*w;return{x:m+w,y:g+_}}static getPointOnCubicBezier(t,n,r,o,i,s,a,l,u){function d(g){return g*g*g}function f(g){return 3*g*g*(1-g)}function p(g){return 3*g*(1-g)*(1-g)}function m(g){return(1-g)*(1-g)*(1-g)}return{x:l*d(t)+s*f(t)+o*p(t)+n*m(t),y:u*d(t)+a*f(t)+i*p(t)+r*m(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],m=p.charAt(0);for(p=p.slice(1),s.length=0;d=u.exec(p);)s.push(d[0]);let g=[],v=m==="A"||m==="a"?0:-1;for(let C=0,w=s.length;C<w;C++){const _=s[C];if(_==="00"){g.push(0,0),v>=0&&(v+=2,v>=7&&(v-=7));continue}if(v>=0){if(v===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(_)){g.push(parseInt(_[0],10)),g.push(parseInt(_[1],10)),g.push(parseFloat(_.slice(2))),v+=3,v>=7&&(v-=7);continue}if(_==="11"||_==="10"||_==="01"){g.push(parseInt(_[0],10)),g.push(parseInt(_[1],10)),v+=2,v>=7&&(v-=7);continue}if(_==="0"||_==="1"){g.push(parseInt(_,10)),v+=1,v>=7&&(v-=7);continue}}else if(v===4){if(/^[01]\d+(?:\.\d+)?$/.test(_)){g.push(parseInt(_[0],10)),g.push(parseFloat(_.slice(1))),v+=2,v>=7&&(v-=7);continue}if(_==="0"||_==="1"){g.push(parseInt(_,10)),v+=1,v>=7&&(v-=7);continue}}const y=parseFloat(_);isNaN(y)?g.push(0):g.push(y),v+=1,v>=7&&(v-=7)}else{const y=parseFloat(_);isNaN(y)?g.push(0):g.push(y)}}for(;g.length>0&&!isNaN(g[0]);){let C="",w=[];const _=a,y=l;let k,T,M,B,W,z,V,Z,R,K;switch(m){case"l":a+=g.shift(),l+=g.shift(),C="L",w.push(a,l);break;case"L":a=g.shift(),l=g.shift(),w.push(a,l);break;case"m":const x=g.shift(),G=g.shift();if(a+=x,l+=G,C="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]+G;break}}w.push(a,l),m="l";break;case"M":a=g.shift(),l=g.shift(),C="M",w.push(a,l),m="L";break;case"h":a+=g.shift(),C="L",w.push(a,l);break;case"H":a=g.shift(),C="L",w.push(a,l);break;case"v":l+=g.shift(),C="L",w.push(a,l);break;case"V":l=g.shift(),C="L",w.push(a,l);break;case"C":w.push(g.shift(),g.shift(),g.shift(),g.shift()),a=g.shift(),l=g.shift(),w.push(a,l);break;case"c":w.push(a+g.shift(),l+g.shift(),a+g.shift(),l+g.shift()),a+=g.shift(),l+=g.shift(),C="C",w.push(a,l);break;case"S":T=a,M=l,k=i[i.length-1],k.command==="C"&&(T=a+(a-k.points[2]),M=l+(l-k.points[3])),w.push(T,M,g.shift(),g.shift()),a=g.shift(),l=g.shift(),C="C",w.push(a,l);break;case"s":T=a,M=l,k=i[i.length-1],k.command==="C"&&(T=a+(a-k.points[2]),M=l+(l-k.points[3])),w.push(T,M,a+g.shift(),l+g.shift()),a+=g.shift(),l+=g.shift(),C="C",w.push(a,l);break;case"Q":w.push(g.shift(),g.shift()),a=g.shift(),l=g.shift(),w.push(a,l);break;case"q":w.push(a+g.shift(),l+g.shift()),a+=g.shift(),l+=g.shift(),C="Q",w.push(a,l);break;case"T":T=a,M=l,k=i[i.length-1],k.command==="Q"&&(T=a+(a-k.points[0]),M=l+(l-k.points[1])),a=g.shift(),l=g.shift(),C="Q",w.push(T,M,a,l);break;case"t":T=a,M=l,k=i[i.length-1],k.command==="Q"&&(T=a+(a-k.points[0]),M=l+(l-k.points[1])),a+=g.shift(),l+=g.shift(),C="Q",w.push(T,M,a,l);break;case"A":B=g.shift(),W=g.shift(),z=g.shift(),V=g.shift(),Z=g.shift(),R=a,K=l,a=g.shift(),l=g.shift(),C="A",w=this.convertEndpointToCenterParameterization(R,K,a,l,V,Z,B,W,z);break;case"a":B=g.shift(),W=g.shift(),z=g.shift(),V=g.shift(),Z=g.shift(),R=a,K=l,a+=g.shift(),l+=g.shift(),C="A",w=this.convertEndpointToCenterParameterization(R,K,a,l,V,Z,B,W,z);break}i.push({command:C||m,points:w,start:{x:_,y},pathLength:this.calcLength(_,y,C||m,w)})}(m==="z"||m==="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=gi;switch(r){case"L":return u.getLineLength(t,n,o[0],o[1]);case"C":return tI([t,o[0],o[2],o[4]],[n,o[1],o[3],o[5]],1);case"Q":return nI([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 m=Math.PI/180;if(Math.abs(d-p)<m&&(m=Math.abs(d-p)),s=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],d,0),f<0)for(l=d-m;l>p;l-=m)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+m;l<p;l+=m)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,m=f*f/(a*a)+p*p/(l*l);m>1&&(a*=Math.sqrt(m),l*=Math.sqrt(m));let g=Math.sqrt((a*a*(l*l)-a*a*(p*p)-l*l*(f*f))/(a*a*(p*p)+l*l*(f*f)));i===s&&(g*=-1),isNaN(g)&&(g=0);const v=g*a*p/l,C=g*-l*f/a,w=(t+r)/2+Math.cos(d)*v-Math.sin(d)*C,_=(n+o)/2+Math.sin(d)*v+Math.cos(d)*C,y=function(V){return Math.sqrt(V[0]*V[0]+V[1]*V[1])},k=function(V,Z){return(V[0]*Z[0]+V[1]*Z[1])/(y(V)*y(Z))},T=function(V,Z){return(V[0]*Z[1]<V[1]*Z[0]?-1:1)*Math.acos(k(V,Z))},M=T([1,0],[(f-v)/a,(p-C)/l]),B=[(f-v)/a,(p-C)/l],W=[(-1*f-v)/a,(-1*p-C)/l];let z=T(B,W);return k(B,W)<=-1&&(z=Math.PI),k(B,W)>=1&&(z=0),s===0&&z>0&&(z=z-2*Math.PI),s===1&&z<0&&(z=z+2*Math.PI),[w,_,a,l,M,z,d,s]}};Ui.prototype.className="Path",Ui.prototype._attrsAffectingSize=["data"],wr(Ui),me.addGetterSetter(Ui,"data");var Pc=class extends Wa{_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),m=Ui.getPointOnQuadraticBezier(Math.min(1,1-i/p),f[0],f[1],f[2],f[3],f[4],f[5]);a=n[s-2]-m.x,l=n[s-1]-m.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}}};Pc.prototype.className="Arrow",wr(Pc),me.addGetterSetter(Pc,"pointerLength",10,wt()),me.addGetterSetter(Pc,"pointerWidth",10,wt()),me.addGetterSetter(Pc,"pointerAtBeginning",!1),me.addGetterSetter(Pc,"pointerAtEnding",!0);var cd=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)}};cd.prototype._centroid=!0,cd.prototype.className="Circle",cd.prototype._attrsAffectingSize=["radius"],wr(cd),me.addGetterSetter(cd,"radius",0,wt());var Nl=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)}};Nl.prototype.className="Ellipse",Nl.prototype._centroid=!0,Nl.prototype._attrsAffectingSize=["radiusX","radiusY"],wr(Nl),me.addComponentsGetterSetter(Nl,"radius",["x","y"]),me.addGetterSetter(Nl,"radiusX",0,wt()),me.addGetterSetter(Nl,"radiusY",0,wt());var gs=class tT 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 tT({image:o}))},o.onerror=r,o.crossOrigin="Anonymous",o.src=t}};gs.prototype.className="Image",gs.prototype._attrsAffectingSize=["image"],wr(gs),me.addGetterSetter(gs,"cornerRadius",0,Um(4)),me.addGetterSetter(gs,"image"),me.addComponentsGetterSetter(gs,"crop",["x","y","width","height"]),me.addGetterSetter(gs,"cropX",0,wt()),me.addGetterSetter(gs,"cropY",0,wt()),me.addGetterSetter(gs,"cropWidth",0,wt()),me.addGetterSetter(gs,"cropHeight",0,wt());var oI=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],oj="Change.konva",ij="none",Jb="up",e2="right",t2="down",n2="left",sj=oI.length,r2=class extends ad{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<sj;n++)e.on(oI[n]+oj,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 e2:s=n+i,a=r/2;break;case t2:s=n/2,a=r+l;break;case n2: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})}}};r2.prototype.className="Label",wr(r2);var Fc=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===e2&&(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===t2&&(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===n2&&(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===t2?s+=r:o===n2?(e-=n*1.5,i+=n):o===e2&&(i+=n*1.5),{x:e,y:t,width:i,height:s}}};Fc.prototype.className="Tag",wr(Fc),me.addGetterSetter(Fc,"pointerDirection",ij),me.addGetterSetter(Fc,"pointerWidth",0,wt()),me.addGetterSetter(Fc,"pointerHeight",0,wt()),me.addGetterSetter(Fc,"cornerRadius",0,Um(4));var gh=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)}};gh.prototype.className="Rect",wr(gh),me.addGetterSetter(gh,"cornerRadius",0,Um(4));var Bl=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)}};Bl.prototype.className="RegularPolygon",Bl.prototype._centroid=!0,Bl.prototype._attrsAffectingSize=["radius"],wr(Bl),me.addGetterSetter(Bl,"radius",0,wt()),me.addGetterSetter(Bl,"sides",0,wt()),me.addGetterSetter(Bl,"cornerRadius",0,Um(4));var iI=Math.PI*2,Nc=class extends gt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,iI,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),iI,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)}};Nc.prototype.className="Ring",Nc.prototype._centroid=!0,Nc.prototype._attrsAffectingSize=["innerRadius","outerRadius"],wr(Nc),me.addGetterSetter(Nc,"innerRadius",0,wt()),me.addGetterSetter(Nc,"outerRadius",0,wt());var Zs=class extends gt{constructor(e){super(e),this._updated=!0,this.anim=new ld(()=>{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)}};Zs.prototype.className="Sprite",wr(Zs),me.addGetterSetter(Zs,"animation"),me.addGetterSetter(Zs,"animations"),me.addGetterSetter(Zs,"frameOffsets"),me.addGetterSetter(Zs,"image"),me.addGetterSetter(Zs,"frameIndex",0,wt()),me.addGetterSetter(Zs,"frameRate",17,wt()),me.backCompat(Zs,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var zl=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)}};zl.prototype.className="Star",zl.prototype._centroid=!0,zl.prototype._attrsAffectingSize=["innerRadius","outerRadius"],wr(zl),me.addGetterSetter(zl,"numPoints",5,wt()),me.addGetterSetter(zl,"innerRadius",0,wt()),me.addGetterSetter(zl,"outerRadius",0,wt());function jl(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 ud="auto",aj="center",sI="inherit",vh="justify",lj="Change.konva",aI="2d",lI="-",cI="left",cj="text",uj="Text",dj="top",fj="bottom",uI="middle",dI="normal",hj="px ",Zm=" ",pj="right",fI="rtl",mj="word",gj="char",hI="none",o2="…",pI=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],vj=pI.length,yh=null;function yj(){if(yh!==null)return yh;yh=!1;try{const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext(aI);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){yh=!0;break}}}catch{}return yh}function bj(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 Qm;function i2(){return Qm||(Qm=Oe.createCanvasElement().getContext(aI),Qm)}function wj(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Cj(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function kj(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}var or=class extends gt{constructor(e){super(kj(e)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<vj;t++)this.on(pI[t]+lj,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(),m=this.letterSpacing(),g=this.charRenderFunc(),v=this.fill(),C=this.textDecoration(),w=this.underlineOffset(),_=C.indexOf("underline")!==-1,y=C.indexOf("line-through")!==-1,k;u=u===sI?e.direction:u;let T=a/2,M=uI;if(!At.legacyTextRendering){const B=this.measureSize("M");M="alphabetic",T=(((t=B.fontBoundingBoxAscent)!==null&&t!==void 0?t:B.actualBoundingBoxAscent)-((n=B.fontBoundingBoxDescent)!==null&&n!==void 0?n:B.actualBoundingBoxDescent))/2+a/2}for(u===fI&&e.setAttr("direction",u),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",M),e.setAttr("textAlign",cI),l===uI?d=(this.getHeight()-o*a-i*2)/2:l===fj&&(d=this.getHeight()-o*a-i*2),e.translate(i,d+i),k=0;k<o;k++){let B=0,W=0;const z=r[k],V=z.text,Z=z.width,R=z.lastInParagraph;if(e.save(),f===pj?B+=p-Z-i*2:f===aj&&(B+=(p-Z-i*2)/2),_){e.save(),e.beginPath();const x=w??(At.legacyTextRendering?Math.round(s/2):Math.round(s/4)),G=B,H=T+W+x;e.moveTo(G,H);const J=f===vh&&!R?p-i*2:Z;e.lineTo(G+Math.round(J),H),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}const K=B;if(u!==fI&&(m!==0||f===vh||g)){const x=V.split(" ").length-1,G=jl(V);for(let H=0;H<G.length;H++){const J=G[H];if(J===" "&&!R&&f===vh&&(B+=(p-i*2-Z)/x),this._partialTextX=B,this._partialTextY=T+W,this._partialText=J,g){e.save();const Q=r.slice(0,k).reduce((X,Te)=>X+jl(Te.text).length,0);g({char:J,index:H+Q,x:B,y:T+W,lineIndex:k,column:H,isLastInLine:R,width:this.measureSize(J).width,context:e})}e.fillStrokeShape(this),g&&e.restore(),B+=this.measureSize(J).width+m}}else m!==0&&e.setAttr("letterSpacing",`${m}px`),this._partialTextX=B,this._partialTextY=T+W,this._partialText=V,e.fillStrokeShape(this);if(y){e.save(),e.beginPath();const x=At.legacyTextRendering?0:-Math.round(s/4),G=K;e.moveTo(G,T+W+x);const H=f===vh&&!R?p-i*2:Z;e.lineTo(G+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(cj,t),this}getWidth(){return this.attrs.width===ud||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===ud||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=i2(),m=this.fontSize(),g;p.save(),p.font=this._getContextFont(),g=p.measureText(e),p.restore();const v=m/100;return{actualBoundingBoxAscent:(t=g.actualBoundingBoxAscent)!==null&&t!==void 0?t:71.58203125*v,actualBoundingBoxDescent:(n=g.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(r=g.actualBoundingBoxLeft)!==null&&r!==void 0?r:-7.421875*v,actualBoundingBoxRight:(o=g.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*v,alphabeticBaseline:(i=g.alphabeticBaseline)!==null&&i!==void 0?i:0,emHeightAscent:(s=g.emHeightAscent)!==null&&s!==void 0?s:100*v,emHeightDescent:(a=g.emHeightDescent)!==null&&a!==void 0?a:-20*v,fontBoundingBoxAscent:(l=g.fontBoundingBoxAscent)!==null&&l!==void 0?l:91*v,fontBoundingBoxDescent:(u=g.fontBoundingBoxDescent)!==null&&u!==void 0?u:21*v,hangingBaseline:(d=g.hangingBaseline)!==null&&d!==void 0?d:72.80000305175781*v,ideographicBaseline:(f=g.ideographicBaseline)!==null&&f!==void 0?f:-21*v,width:g.width,height:m}}_getContextFont(){return this.fontStyle()+Zm+this.fontVariant()+Zm+(this.fontSize()+hj)+bj(this.fontFamily())}_addTextLine(e){this.align()===vh&&(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 i2().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!==ud&&o!==void 0,a=i!==ud&&i!==void 0,l=this.padding(),u=o-l*2,d=i-l*2,f=0,p=this.wrap(),m=p!==gj&&p!==hI,g=this.ellipsis();this.textArr=[],i2().font=this._getContextFont();const v=g?this._getTextWidth(o2):0;for(let C=0,w=e.length;C<w;++C){let _=e[C],y=this._getTextWidth(_);if(s&&y>u)for(;_.length>0;){let k=0,T=jl(_).length,M="",B=0;for(;k<T;){const W=k+T>>>1,z=jl(_).slice(0,W+1).join(""),V=this._getTextWidth(z);(g&&a&&f+r>d?V+v:V)<=u?(k=W+1,M=z,B=V):T=W}if(M){if(m){const W=jl(_),z=jl(M),V=W[z.length],Z=V===Zm||V===lI;let R;if(Z&&B<=u)R=z.length;else{const K=z.lastIndexOf(Zm),x=z.lastIndexOf(lI);R=Math.max(K,x)+1}R>0&&(k=R,M=W.slice(0,k).join(""),B=this._getTextWidth(M))}if(M=M.trimRight(),this._addTextLine(M),n=Math.max(n,B),f+=r,this._shouldHandleEllipsis(f)){this._tryToAddEllipsisToLastLine();break}if(_=jl(_).slice(k).join("").trimLeft(),_.length>0&&(y=this._getTextWidth(_),y<=u)){this._addTextLine(_),f+=r,n=Math.max(n,y);break}}else break}else this._addTextLine(_),f+=r,n=Math.max(n,y),this._shouldHandleEllipsis(f)&&C<w-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!==ud&&r!==void 0,i=r-this.padding()*2;return this.wrap()===hI||o&&e+n>i}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==ud&&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+o2)<n||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+o2))}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&&yj()?!0:super._useBufferCanvas()}};or.prototype._fillFunc=wj,or.prototype._strokeFunc=Cj,or.prototype.className=uj,or.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],wr(or),me.overWriteSetter(or,"width",jb()),me.overWriteSetter(or,"height",jb()),me.addGetterSetter(or,"direction",sI),me.addGetterSetter(or,"fontFamily","Arial"),me.addGetterSetter(or,"fontSize",12,wt()),me.addGetterSetter(or,"fontStyle",dI),me.addGetterSetter(or,"fontVariant",dI),me.addGetterSetter(or,"padding",0,wt()),me.addGetterSetter(or,"align",cI),me.addGetterSetter(or,"verticalAlign",dj),me.addGetterSetter(or,"lineHeight",1,wt()),me.addGetterSetter(or,"wrap",mj),me.addGetterSetter(or,"ellipsis",!1,ms()),me.addGetterSetter(or,"letterSpacing",0,wt()),me.addGetterSetter(or,"text","",Lc()),me.addGetterSetter(or,"textDecoration",""),me.addGetterSetter(or,"underlineOffset",void 0,wt()),me.addGetterSetter(or,"charRenderFunc",void 0);var Sj="",mI="normal";function gI(e){e.fillText(this.partialText,0,0)}function vI(e){e.strokeText(this.partialText,0,0)}var Qr=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 or.prototype.setText.call(this,e)}_getContextFont(){return or.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=jl(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 m=this._getPointAtLength(f);if(!m)return;const g=t[p].char;let v=t[p].width+i;if(g===" "&&s==="justify"){const M=this.text().split(" ").length-1;v+=(this.pathLength-u)/M}const C=f+v,w=this._getPointAtLength(C>this.pathLength&&C-this.pathLength<=l?this.pathLength:C);if(!w)return;const _=Ui.getLineLength(m.x,m.y,w.x,w.y);let y=0;if(a)try{y=a(t[p-1].char,g)*this.fontSize()}catch{y=0}m.x+=y,w.x+=y,this.textWidth+=y;const k=Ui.getPointOnLine(y+_/2,m.x,m.y,w.x,w.y),T=Math.atan2(w.y-m.y,w.x-m.x);this.glyphInfo.push({transposeX:k.x,transposeY:k.y,text:e[p],rotation:T,p0:m,p1:w,width:_}),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()}};Qr.prototype._fillFunc=gI,Qr.prototype._strokeFunc=vI,Qr.prototype._fillFuncHit=gI,Qr.prototype._strokeFuncHit=vI,Qr.prototype.className="TextPath",Qr.prototype._attrsAffectingSize=["text","fontSize","data"],wr(Qr),me.addGetterSetter(Qr,"data"),me.addGetterSetter(Qr,"fontFamily","Arial"),me.addGetterSetter(Qr,"fontSize",12,wt()),me.addGetterSetter(Qr,"fontStyle",mI),me.addGetterSetter(Qr,"align","left"),me.addGetterSetter(Qr,"letterSpacing",0,wt()),me.addGetterSetter(Qr,"textBaseline","middle"),me.addGetterSetter(Qr,"fontVariant",mI),me.addGetterSetter(Qr,"text",Sj),me.addGetterSetter(Qr,"textDecoration",""),me.addGetterSetter(Qr,"kerningFunc",void 0);var yI="tr-konva",_j=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(e=>e+`.${yI}`).join(" "),bI="nodesRect",Aj=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],Ij={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},Ej="ontouchstart"in At._global;function Tj(e,t,n){if(e==="rotater")return n;t+=Oe.degToRad(Ij[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 Jm=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function xj(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 wI(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 Rj(e,t){return wI(e,t,xj(e))}function Mj(e,t,n){let r=t;for(let o=0;o<e.length;o++){const i=At.getAngle(e[o]),s=Math.abs(i-t)%(Math.PI*2);Math.min(s,Math.PI*2-s)<n&&(r=i)}return r}var s2=0,Pn=class extends ad{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(_j,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 yI+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(Aj.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(bI),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(bI,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=(At.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return wI({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},-At.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 ps;t.rotate(-At.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:At.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(),Jm.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){const t=new gh({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:Ej?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=Tj(e,At.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,m=s/2;let g=1/0;f<0?g=Math.min(g,-m/f):f>0&&(g=Math.min(g,(s-m)/f)),d<0?g=Math.min(g,-p/d):d>0&&(g=Math.min(g,(i-p)/d));const v=p+d*g,C=m+f*g,w=Oe._sign(s),_=v+d*l*w,y=C+f*l*w;t.moveTo(v,C),t.lineTo(_,y)}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},s2++,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 w=this._getNodeRect();t=o.x()-w.width/2,n=-o.y()+w.height/2;const _=At.getAngle(this.rotateAnchorAngle());let y=Math.atan2(-n,t)+Math.PI/2-_;w.height<0&&(y-=Math.PI);const k=At.getAngle(this.rotation())+y,T=At.getAngle(this.rotationSnapTolerance()),M=Rj(w,Mj(this.rotationSnaps(),k,T)-w.rotation);this._fitNodesInto(M,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 w=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(w.x-o.x(),2)+Math.pow(w.y-o.y(),2));const _=this.findOne(".top-left").x()>w.x?-1:1,y=this.findOne(".top-left").y()>w.y?-1:1;t=r*this.cos*_,n=r*this.sin*y,this.findOne(".top-left").x(w.x-t),this.findOne(".top-left").y(w.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(f){const w=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()-w.x,2)+Math.pow(w.y-o.y(),2));const _=this.findOne(".top-right").x()<w.x?-1:1,y=this.findOne(".top-right").y()>w.y?-1:1;t=r*this.cos*_,n=r*this.sin*y,this.findOne(".top-right").x(w.x+t),this.findOne(".top-right").y(w.y-n)}var m=o.position();this.findOne(".top-left").y(m.y),this.findOne(".bottom-right").x(m.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 w=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(w.x-o.x(),2)+Math.pow(o.y()-w.y,2));const _=w.x<o.x()?-1:1,y=o.y()<w.y?-1:1;t=r*this.cos*_,n=r*this.sin*y,o.x(w.x-t),o.y(w.y+n)}m=o.position(),this.findOne(".top-left").x(m.x),this.findOne(".bottom-right").y(m.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(o.y());else if(this._movingAnchorName==="bottom-right"){if(f){const w=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()-w.x,2)+Math.pow(o.y()-w.y,2));const _=this.findOne(".bottom-right").x()<w.x?-1:1,y=this.findOne(".bottom-right").y()<w.y?-1:1;t=r*this.cos*_,n=r*this.sin*y,this.findOne(".bottom-right").x(w.x+t),this.findOne(".bottom-right").y(w.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(p=this.centeredScaling()||e.altKey,p){const w=this.findOne(".top-left"),_=this.findOne(".bottom-right"),y=w.x(),k=w.y(),T=this.getWidth()-_.x(),M=this.getHeight()-_.y();_.move({x:-y,y:-k}),w.move({x:T,y:M})}const g=this.findOne(".top-left").getAbsolutePosition();t=g.x,n=g.y;const v=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),C=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:v,height:C,rotation:At.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();s2--,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 ps;if(o.rotate(At.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 ps;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/i,n.height/i);const a=new ps,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 m=f.getParent().getAbsoluteTransform(),g=f.getTransform().copy();g.translate(f.offsetX(),f.offsetY());const v=new ps;v.multiply(m.copy().invert()).multiply(d).multiply(m).multiply(g);const C=v.decompose();f.setAttrs(C),(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),m=-Math.cos(f),g=n/2,v=r/2;let C=1/0;m<0?C=Math.min(C,-v/m):m>0&&(C=Math.min(C,(r-v)/m)),p<0?C=Math.min(C,-g/p):p>0&&(C=Math.min(C,(n-g)/p));const w=g+p*C,_=v+m*C,y=Oe._sign(r);this._batchChangeChild(".rotater",{x:w+p*d*y,y:_+m*d*y-s*m,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 k=this.anchorStyleFunc();k&&l.forEach(T=>{k(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=""),ad.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 Et.prototype.toObject.call(this)}clone(e){return Et.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Pn.isTransforming=()=>s2>0;function Lj(e){return e instanceof Array||Oe.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){Jm.indexOf(t)===-1&&Oe.warn("Unknown anchor name: "+t+". Available names are: "+Jm.join(", "))}),e||[]}Pn.prototype.className="Transformer",wr(Pn),me.addGetterSetter(Pn,"enabledAnchors",Jm,Lj),me.addGetterSetter(Pn,"flipEnabled",!0,ms()),me.addGetterSetter(Pn,"resizeEnabled",!0),me.addGetterSetter(Pn,"anchorSize",10,wt()),me.addGetterSetter(Pn,"rotateEnabled",!0),me.addGetterSetter(Pn,"rotateLineVisible",!0),me.addGetterSetter(Pn,"rotationSnaps",[]),me.addGetterSetter(Pn,"rotateAnchorOffset",50,wt()),me.addGetterSetter(Pn,"rotateAnchorAngle",0,wt()),me.addGetterSetter(Pn,"rotateAnchorCursor","crosshair"),me.addGetterSetter(Pn,"rotationSnapTolerance",5,wt()),me.addGetterSetter(Pn,"borderEnabled",!0),me.addGetterSetter(Pn,"anchorStroke","rgb(0, 161, 255)"),me.addGetterSetter(Pn,"anchorStrokeWidth",1,wt()),me.addGetterSetter(Pn,"anchorFill","white"),me.addGetterSetter(Pn,"anchorCornerRadius",0,wt()),me.addGetterSetter(Pn,"borderStroke","rgb(0, 161, 255)"),me.addGetterSetter(Pn,"borderStrokeWidth",1,wt()),me.addGetterSetter(Pn,"borderDash"),me.addGetterSetter(Pn,"keepRatio",!0),me.addGetterSetter(Pn,"shiftBehavior","default"),me.addGetterSetter(Pn,"centeredScaling",!1),me.addGetterSetter(Pn,"ignoreStroke",!1),me.addGetterSetter(Pn,"padding",0,wt()),me.addGetterSetter(Pn,"nodes"),me.addGetterSetter(Pn,"node"),me.addGetterSetter(Pn,"boundBoxFunc"),me.addGetterSetter(Pn,"anchorDragBoundFunc"),me.addGetterSetter(Pn,"anchorStyleFunc"),me.addGetterSetter(Pn,"shouldOverdrawWholeArea",!1),me.addGetterSetter(Pn,"useSingleNodeRotation",!0),me.backCompat(Pn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Ka=class extends gt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,At.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)}};Ka.prototype.className="Wedge",Ka.prototype._centroid=!0,Ka.prototype._attrsAffectingSize=["radius"],wr(Ka),me.addGetterSetter(Ka,"radius",0,wt()),me.addGetterSetter(Ka,"angle",0,wt()),me.addGetterSetter(Ka,"clockwise",!1),me.backCompat(Ka,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function CI(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var Dj=[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],Oj=[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 Pj(e,t){const n=e.data,r=e.width,o=e.height;let i,s,a,l,u,d,f,p,m,g,v,C,w,_,y,k,T,M,B,W;const z=t+t+1,V=r-1,Z=o-1,R=t+1,K=R*(R+1)/2,x=new CI,G=Dj[t],H=Oj[t];let J=null,Q=x,X=null,Te=null;for(let de=1;de<z;de++)Q=Q.next=new CI,de===R&&(J=Q);Q.next=x,a=s=0;for(let de=0;de<o;de++){C=w=_=y=l=u=d=f=0,p=R*(k=n[s]),m=R*(T=n[s+1]),g=R*(M=n[s+2]),v=R*(B=n[s+3]),l+=K*k,u+=K*T,d+=K*M,f+=K*B,Q=x;for(let ge=0;ge<R;ge++)Q.r=k,Q.g=T,Q.b=M,Q.a=B,Q=Q.next;for(let ge=1;ge<R;ge++)i=s+((V<ge?V:ge)<<2),l+=(Q.r=k=n[i])*(W=R-ge),u+=(Q.g=T=n[i+1])*W,d+=(Q.b=M=n[i+2])*W,f+=(Q.a=B=n[i+3])*W,C+=k,w+=T,_+=M,y+=B,Q=Q.next;X=x,Te=J;for(let ge=0;ge<r;ge++)n[s+3]=B=f*G>>H,B!==0?(B=255/B,n[s]=(l*G>>H)*B,n[s+1]=(u*G>>H)*B,n[s+2]=(d*G>>H)*B):n[s]=n[s+1]=n[s+2]=0,l-=p,u-=m,d-=g,f-=v,p-=X.r,m-=X.g,g-=X.b,v-=X.a,i=a+((i=ge+t+1)<V?i:V)<<2,C+=X.r=n[i],w+=X.g=n[i+1],_+=X.b=n[i+2],y+=X.a=n[i+3],l+=C,u+=w,d+=_,f+=y,X=X.next,p+=k=Te.r,m+=T=Te.g,g+=M=Te.b,v+=B=Te.a,C-=k,w-=T,_-=M,y-=B,Te=Te.next,s+=4;a+=r}for(let de=0;de<r;de++){w=_=y=C=u=d=f=l=0,s=de<<2,p=R*(k=n[s]),m=R*(T=n[s+1]),g=R*(M=n[s+2]),v=R*(B=n[s+3]),l+=K*k,u+=K*T,d+=K*M,f+=K*B,Q=x;for(let ve=0;ve<R;ve++)Q.r=k,Q.g=T,Q.b=M,Q.a=B,Q=Q.next;let ge=r;for(let ve=1;ve<=t;ve++)s=ge+de<<2,l+=(Q.r=k=n[s])*(W=R-ve),u+=(Q.g=T=n[s+1])*W,d+=(Q.b=M=n[s+2])*W,f+=(Q.a=B=n[s+3])*W,C+=k,w+=T,_+=M,y+=B,Q=Q.next,ve<Z&&(ge+=r);s=de,X=x,Te=J;for(let ve=0;ve<o;ve++)i=s<<2,n[i+3]=B=f*G>>H,B>0?(B=255/B,n[i]=(l*G>>H)*B,n[i+1]=(u*G>>H)*B,n[i+2]=(d*G>>H)*B):n[i]=n[i+1]=n[i+2]=0,l-=p,u-=m,d-=g,f-=v,p-=X.r,m-=X.g,g-=X.b,v-=X.a,i=de+((i=ve+R)<Z?i:Z)*r<<2,l+=C+=X.r=n[i],u+=w+=X.g=n[i+1],d+=_+=X.b=n[i+2],f+=y+=X.a=n[i+3],X=X.next,p+=k=Te.r,m+=T=Te.g,g+=M=Te.b,v+=B=Te.a,C-=k,w-=T,_-=M,y-=B,Te=Te.next,s+=r}}var Fj=function(t){const n=Math.round(this.blurRadius());n>0&&Pj(t,n)};me.addGetterSetter(Et,"blurRadius",0,wt(),me.afterSetFilter);var Nj=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(Et,"brightness",0,wt(),me.afterSetFilter);var Bj=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)},zj=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(Et,"contrast",0,wt(),me.afterSetFilter);var jj=function(e){var t,n,r,o,i,s,a,l,u;const d=e.data,f=e.width,p=e.height,m=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)),g=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,C=!!((u=(l=this.embossBlend)===null||l===void 0?void 0:l.call(this))!==null&&u!==void 0&&u),w=m*10,_=g*255,y=v*Math.PI/180,k=Math.cos(y),T=Math.sin(y),M=128/1020*w,B=new Uint8ClampedArray(d),W=new Float32Array(f*p);for(let K=0,x=0;x<d.length;x+=4,K++)W[K]=.2126*B[x]+.7152*B[x+1]+.0722*B[x+2];const z=[-1,0,1,-2,0,2,-1,0,1],V=[-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 G=K*f+x;let H=0,J=0;H+=W[G+Z[0]]*z[0],J+=W[G+Z[0]]*V[0],H+=W[G+Z[1]]*z[1],J+=W[G+Z[1]]*V[1],H+=W[G+Z[2]]*z[2],J+=W[G+Z[2]]*V[2],H+=W[G+Z[3]]*z[3],J+=W[G+Z[3]]*V[3],H+=W[G+Z[5]]*z[5],J+=W[G+Z[5]]*V[5],H+=W[G+Z[6]]*z[6],J+=W[G+Z[6]]*V[6],H+=W[G+Z[7]]*z[7],J+=W[G+Z[7]]*V[7],H+=W[G+Z[8]]*z[8],J+=W[G+Z[8]]*V[8];const Q=R(_+(k*H+T*J)*M),X=G*4;if(C){const Te=Q-_;d[X]=R(B[X]+Te),d[X+1]=R(B[X+1]+Te),d[X+2]=R(B[X+2]+Te),d[X+3]=B[X+3]}else d[X]=d[X+1]=d[X+2]=Q,d[X+3]=B[X+3]}for(let K=0;K<f;K++){let x=K*4,G=((p-1)*f+K)*4;d[x]=B[x],d[x+1]=B[x+1],d[x+2]=B[x+2],d[x+3]=B[x+3],d[G]=B[G],d[G+1]=B[G+1],d[G+2]=B[G+2],d[G+3]=B[G+3]}for(let K=1;K<p-1;K++){let x=K*f*4,G=(K*f+(f-1))*4;d[x]=B[x],d[x+1]=B[x+1],d[x+2]=B[x+2],d[x+3]=B[x+3],d[G]=B[G],d[G+1]=B[G+1],d[G+2]=B[G+2],d[G+3]=B[G+3]}return e};me.addGetterSetter(Et,"embossStrength",.5,wt(),me.afterSetFilter),me.addGetterSetter(Et,"embossWhiteLevel",.5,wt(),me.afterSetFilter),me.addGetterSetter(Et,"embossDirection","top-left",void 0,me.afterSetFilter),me.addGetterSetter(Et,"embossBlend",!1,void 0,me.afterSetFilter);function a2(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 Vj=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 y=0;y<n;y+=4)i=t[y+0],i<r?r=i:i>o&&(o=i),l=t[y+1],l<s?s=l:l>a&&(a=l),f=t[y+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 m,g,v,C,w,_;if(p>0)m=o+p*(255-o),g=r-p*(r-0),v=a+p*(255-a),C=s-p*(s-0),w=d+p*(255-d),_=u-p*(u-0);else{const y=(o+r)*.5;m=o+p*(o-y),g=r+p*(r-y);const k=(a+s)*.5;v=a+p*(a-k),C=s+p*(s-k);const T=(d+u)*.5;w=d+p*(d-T),_=u+p*(u-T)}for(let y=0;y<n;y+=4)t[y+0]=a2(t[y+0],r,o,g,m),t[y+1]=a2(t[y+1],s,a,C,v),t[y+2]=a2(t[y+2],u,d,_,w)};me.addGetterSetter(Et,"enhance",0,wt(),me.afterSetFilter);var Uj=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(Et,"hue",0,wt(),me.afterSetFilter),me.addGetterSetter(Et,"saturation",0,wt(),me.afterSetFilter),me.addGetterSetter(Et,"luminance",0,wt(),me.afterSetFilter);var Hj=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,m=.587*r+.413*a+.035*l,g=.114*r-.114*a+.293*l,v=.299*r-.3*a+1.25*l,C=.587*r-.586*a-1.05*l,w=.114*r+.886*a-.2*l;let _,y,k,T;for(let M=0;M<n;M+=4)_=t[M+0],y=t[M+1],k=t[M+2],T=t[M+3],t[M+0]=u*_+d*y+f*k+s,t[M+1]=p*_+m*y+g*k+s,t[M+2]=v*_+C*y+w*k+s,t[M+3]=T},$j=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,m=.114*r-.114*s+.293*a,g=.299*r-.3*s+1.25*a,v=.587*r-.586*s-1.05*a,C=.114*r+.886*s-.2*a;for(let w=0;w<n;w+=4){const _=t[w+0],y=t[w+1],k=t[w+2],T=t[w+3];t[w+0]=l*_+u*y+d*k,t[w+1]=f*_+p*y+m*k,t[w+2]=g*_+v*y+C*k,t[w+3]=T}};me.addGetterSetter(Et,"hue",0,wt(),me.afterSetFilter),me.addGetterSetter(Et,"saturation",0,wt(),me.afterSetFilter),me.addGetterSetter(Et,"value",0,wt(),me.afterSetFilter);var Gj=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]},Wj=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 m=s,g=i,v=360/g*Math.PI/180;for(let C=0;C<g;C+=1){const w=Math.sin(C*v),_=Math.cos(C*v);for(let y=0;y<m;y+=1){d=Math.floor(a+u*y/m*_),f=Math.floor(l+u*y/m*w);let k=(f*i+d)*4;const T=r[k+0],M=r[k+1],B=r[k+2],W=r[k+3];k=(C+y*i)*4,o[k+0]=T,o[k+1]=M,o[k+2]=B,o[k+3]=W}}},Kj=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 m=s,g=i,v=n.polarRotation||0;let C,w;for(d=0;d<i;d+=1)for(f=0;f<s;f+=1){const _=d-a,y=f-l,k=Math.sqrt(_*_+y*y)*m/u;let T=(Math.atan2(y,_)*180/Math.PI+360+v)%360;T=T*g/360,C=Math.floor(T),w=Math.floor(k);let M=(w*i+C)*4;const B=r[M+0],W=r[M+1],z=r[M+2],V=r[M+3];M=(f*i+d)*4,o[M+0]=B,o[M+1]=W,o[M+2]=z,o[M+3]=V}},qj=function(e){const t=e.width,n=e.height;let r,o,i,s,a,l,u,d,f,p,m=Math.round(this.kaleidoscopePower());const g=Math.round(this.kaleidoscopeAngle()),v=Math.floor(t*(g%360)/360);if(m<1)return;const C=Oe.createCanvasElement();C.width=t,C.height=n;const w=C.getContext("2d").getImageData(0,0,t,n);Oe.releaseCanvas(C),Wj(e,w,{polarCenterX:t/2,polarCenterY:n/2});let _=t/Math.pow(2,m);for(;_<=8;)_=_*2,m-=1;_=Math.ceil(_);let y=_,k=0,T=y,M=1;for(v+_>t&&(k=y,T=0,M=-1),o=0;o<n;o+=1)for(r=k;r!==T;r+=M)i=Math.round(r+v)%t,f=(t*o+i)*4,a=w.data[f+0],l=w.data[f+1],u=w.data[f+2],d=w.data[f+3],p=(t*o+r)*4,w.data[p+0]=a,w.data[p+1]=l,w.data[p+2]=u,w.data[p+3]=d;for(o=0;o<n;o+=1)for(y=Math.floor(_),s=0;s<m;s+=1){for(r=0;r<y+1;r+=1)f=(t*o+r)*4,a=w.data[f+0],l=w.data[f+1],u=w.data[f+2],d=w.data[f+3],p=(t*o+y*2-r-1)*4,w.data[p+0]=a,w.data[p+1]=l,w.data[p+2]=u,w.data[p+3]=d;y*=2}Kj(w,e,{polarRotation:0})};me.addGetterSetter(Et,"kaleidoscopePower",2,wt(),me.afterSetFilter),me.addGetterSetter(Et,"kaleidoscopeAngle",0,wt(),me.afterSetFilter);function eg(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 bh(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 Yj(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 Xj(e,t){const n=eg(e,0,0),r=eg(e,e.width-1,0),o=eg(e,0,e.height-1),i=eg(e,e.width-1,e.height-1),s=t||10;if(bh(n,r)<s&&bh(r,i)<s&&bh(i,o)<s&&bh(o,n)<s){const a=Yj([r,n,i,o]),l=[];for(let u=0;u<e.width*e.height;u++)l[u]=bh(a,[e.data[u*4],e.data[u*4+1],e.data[u*4+2]])<s?0:255;return l}}function Zj(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function Qj(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 m=a+f-i,g=l+p-i;if(m>=0&&m<n&&g>=0&&g<t){const v=m*t+g,C=r[f*o+p];d+=e[v]*C}}s[u]=d===2040?255:0}return s}function Jj(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 m=a+f-i,g=l+p-i;if(m>=0&&m<n&&g>=0&&g<t){const v=m*t+g,C=r[f*o+p];d+=e[v]*C}}s[u]=d>=1020?255:0}return s}function eV(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 m=a+f-i,g=l+p-i;if(m>=0&&m<n&&g>=0&&g<t){const v=m*t+g,C=r[f*o+p];d+=e[v]*C}}s[u]=d}return s}var tV=function(e){let t=Xj(e,this.threshold());return t&&(t=Qj(t,e.width,e.height),t=Jj(t,e.width,e.height),t=eV(t,e.width,e.height),Zj(e,t)),e};me.addGetterSetter(Et,"threshold",0,wt(),me.afterSetFilter);var nV=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(Et,"noise",.2,wt(),me.afterSetFilter);var rV=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 m=a*t,g=m+t,v=l*t,C=v+t;let w=0;for(let _=m;_<g;_+=1)if(!(_>=n))for(let y=v;y<C;y+=1){if(y>=r)continue;const k=(n*y+_)*4;u+=s[k+0],d+=s[k+1],f+=s[k+2],p+=s[k+3],w+=1}u=u/w,d=d/w,f=f/w,p=p/w;for(let _=m;_<g;_+=1)if(!(_>=n))for(let y=v;y<C;y+=1){if(y>=r)continue;const k=(n*y+_)*4;s[k+0]=u,s[k+1]=d,s[k+2]=f,s[k+3]=p}}};me.addGetterSetter(Et,"pixelSize",8,wt(),me.afterSetFilter);var oV=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(Et,"levels",.5,wt(),me.afterSetFilter);var iV=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(Et,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(Et,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(Et,"blue",0,k4,me.afterSetFilter);var sV=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(Et,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(Et,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(Et,"blue",0,k4,me.afterSetFilter),me.addGetterSetter(Et,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var aV=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)}},lV=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},cV=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(Et,"threshold",.5,wt(),me.afterSetFilter);var uV=J4.Util._assign(J4,{Arc:Ga,Arrow:Pc,Circle:cd,Ellipse:Nl,Image:gs,Label:r2,Tag:Fc,Line:Wa,Path:Ui,Rect:gh,RegularPolygon:Bl,Ring:Nc,Sprite:Zs,Star:zl,Text:or,TextPath:Qr,Transformer:Pn,Wedge:Ka,Filters:{Blur:Fj,Brightness:Bj,Brighten:Nj,Contrast:zj,Emboss:jj,Enhance:Vj,Grayscale:Uj,HSL:Hj,HSV:$j,Invert:Gj,Kaleidoscope:qj,Mask:tV,Noise:nV,Pixelate:rV,Posterize:oV,RGB:iV,RGBA:sV,Sepia:aV,Solarize:lV,Threshold:cV}}),dV=uV;Bt();var fV=["dialog","floating"],kI=["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"];function hV(e){if(!e||typeof e!="object")throw new Error("SurfaceManager: request must be a non-null object.");if(!fV.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&&!kI.includes(e.floating.placement))throw new Error(`SurfaceManager: floating.placement must be one of ${kI.join(", ")}, got "${e.floating.placement}".`)}var pV=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.#c(e);hV(e);const t=this.#u(e),{component:n,props:r,render:o}=this.#f(t);let i,s=!1;const a=new Promise(m=>{i=g=>s?!1:(s=!0,m(g),!0)});let l;const u=m=>{i({status:"submitted",data:m})&&this.#i(l)},d=m=>{i({status:"closed",reason:m})&&this.#i(l)};l={id:t.id,mode:t.mode,request:t,component:n,props:r,render:o,resolve:u,close:d,settle:m=>i(m),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:m=>this.#o(l,m),result:a}}close(e,t){if(e!=null){const o=this.#a(e);o&&this.#o(o,t);return}const n=this.activeDialog.value;if(n&&!n.settled){this.#o(n,t);return}const r=this.activeFloating.value;r&&!r.settled&&this.#o(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"})}#o(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}}#f(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.`)}#c(e){return{id:e?.id??`surface-${this.#n++}`,mode:e?.mode??"dialog",close:()=>{},result:Promise.resolve({status:"destroyed"})}}},mV="https://docs.superdoc.dev/guides/migration/document-api",SI=new Set;function gV(e,t){SI.has(e)||(SI.add(e),console.warn(t))}var vV={state:"editor.state",view:"editor.view",schema:"editor.schema",commands:"editor.commands",chain:"editor.chain()",can:"editor.can()",dispatch:"editor.dispatch()"},_I=Symbol.for("superdoc:rawEditor"),AI=new WeakMap;function II(e){return!e||e[_I]?e:new Proxy(e,{get(t,n){if(n===_I)return t;const r=vV[n];r&&gV(`deprecated:${String(n)}`,`[SuperDoc] ${r} is deprecated and will be removed in a future version. Use the Document API (editor.doc) instead. See ${mV}`);const o=Reflect.get(t,n,t);if(typeof o=="function"){let i=AI.get(t);return i||(i=new Map,AI.set(t,i)),i.has(n)||i.set(n,o.bind(t)),i.get(n)}return o}})}var EI=["review","original","final","off"],yV=["original","markup","final"],bV=["paired","independent"],TI=Symbol.for("@superdoc/trackChanges:normalized"),xI=new Set;function l2(e,t){xI.has(e)||(xI.add(e),console.warn(`[SuperDoc] ${e} is deprecated β€” use ${t} instead.`))}function RI(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n}function wV(e,t,n){return typeof e=="string"&&EI.includes(e)?e:typeof t=="string"&&EI.includes(t)?t:n}function CV(e){return typeof e!="string"||!yV.includes(e)?null:e}function kV(e){return e==="markup"?"review":e}function SV(e){return typeof e=="string"&&bV.includes(e)?e:null}function _V(e){return e==="grouped"?"paired":e==="separate"?"independent":null}function AV(e){return e==="paired"?"grouped":"separate"}function vs(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function c2(e){const t=e[TI]===!0,n=vs(e.viewing),r=CV(n?.trackedChanges);vs(e.modules)||(e.modules={});const o=vs(e.trackChanges),i=vs(e.modules.trackChanges),s=vs(e.layoutEngineOptions?.trackedChanges);t||(o&&Object.prototype.hasOwnProperty.call(o,"visible")&&l2("config.trackChanges.visible","config.viewing.trackedChanges"),i&&l2("config.modules.trackChanges","config.trackChanges for behavior and config.viewing.trackedChanges for viewing projection"),s&&l2("config.layoutEngineOptions.trackedChanges","config.viewing.trackedChanges for display and config.trackChanges.enabled for behavior"));const a=r?r==="markup":RI(o?.visible,i?.visible,!1),l=RI(o?.enabled,i?.enabled,typeof s?.enabled=="boolean"?s.enabled:!0),u=_V(o?.replacementMode)??SV(i?.replacements)??"paired",d=vs(o?.authorColors)??vs(i?.authorColors),f=d||void 0,p=vs(o?.semanticColors)??vs(i?.semanticColors),m=p||void 0,g=e.documentMode==="viewing",v=g?a?"review":"original":"review",C=r?g?kV(r):"review":wV(i?.mode,s?.mode,v),w={visible:a,mode:C,enabled:l,replacements:u};return f&&(w.authorColors=f),m&&(w.semanticColors=m),e.modules.trackChanges=w,e.trackChanges={visible:a,enabled:l,replacementMode:AV(u)},f&&(e.trackChanges.authorColors=f),m&&(e.trackChanges.semanticColors=m),vs(e.layoutEngineOptions)||(e.layoutEngineOptions={}),e.layoutEngineOptions.trackedChanges={mode:C,enabled:l},typeof n?.comments=="boolean"&&(vs(e.comments)||(e.comments={}),e.comments.visible=n.comments),Object.defineProperty(e,TI,{value:!0,writable:!0,configurable:!0,enumerable:!1}),w}var u2=Object.freeze({id:null,name:"Default SuperDoc user",email:null});function IV(e){return!e||typeof e!="object"?{...u2}:{...u2,...e}}var tg=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"}),MI=Object.freeze({toolbar:!0,comments:!0,contextMenu:!0,loading:!0,search:!1,linkPopover:!1,ruler:!1,contentControls:!0}),EV=Object.freeze(["left","center","right"]),TV=Object.freeze({compact:32,default:80,wide:120}),MK=Object.freeze(Object.keys(MI)),Wr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function LI(e,t){const n=e?.[t];return n===!1?!1:n===void 0?MI[t]:!0}function xV(e,t){const n=e?.[t];return Wr(n)?n:{}}var DI=Object.freeze(["level","readOnly","allowResolve","permissionResolver"]);function RV(e){if(!DI.some(n=>n in e))return e;const t={...e};for(const n of DI)delete t[n];return t}function OI(e){const t={...e},n=Dl(e.sections,e.customItems),r=Dl(e.defaultItems,e.includeDefaultItems);return delete t.customItems,delete t.includeDefaultItems,qo(t,{sections:n,defaultItems:r})}var PI=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 MV(e){return Wr(e)?Object.fromEntries(Object.entries(e).filter(([t,n])=>PI[t]!==void 0&&n!==void 0).map(([t,n])=>[PI[t],n])):{}}function FI(e){const t={...e};return delete t.strings,delete t.replaceControls,delete t.includeTrackedDeletions,qo(t,MV(e.strings),{replaceEnabled:Dl(e.replaceControls,e.replaceEnabled),includeDeletedText:Dl(e.includeTrackedDeletions,e.includeDeletedText)})}var LV=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"}),DV=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 ng(e,t){return t[e]??e}function d2(e,t){if(!Wr(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])=>[ng(i,t),s]))}function NI(e){return Array.isArray(e)?e.map(t=>ng(t,tg)):e}function BI(e){return Wr(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,NI(n)])):e}function OV(e,t){if(!Wr(e)||!Array.isArray(t))return e;const n={...e};for(const r of t){if(!Wr(r))continue;const o=r.region??"center";n[o]===void 0&&(n[o]=[])}return n}var PV=Object.freeze({"formatting-marks":"right","table-of-contents":"center"});function FV(e,t){if(!Wr(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=>ng(o,tg)));for(const o of t){const i=ng(o,tg);if(r.has(i))continue;const s=PV[o];s&&(Array.isArray(n[s])||(n[s]=[]),n[s].push(o),r.add(i))}return n}function zI(e,t){return OV(FV(e,t.includeItems),t.customItems)}function NV(e){return Array.isArray(e)?e.map(t=>{if(!Wr(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 BV(e){return Array.isArray(e)?e.map(t=>{if(!Wr(t)||typeof t.id!="string")return t;const n=t.size??"default",r=t.type==="separator"?void 0:TV[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=>Wr(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 zV(e){const t={...e},n=Dl(e.items,Wr(e.groups)?e.groups:void 0),r=Wr(e.items)&&Object.keys(e.items).length===0?{center:[]}:n,o=zI(r,e),i=o===void 0?e.groups:BI(o),s=d2(e.icons,LV),a=qo(d2(e.texts,{}),d2(e.strings,DV)),l=Array.isArray(e.includeItems)?new Set(e.includeItems):null,u=Wr(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,qo(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:NV(e.fontOptions),customButtons:e.customItems===void 0?e.customButtons:BV(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 jI(e={}){const t=e.ui,n=t===!1,r=Wr(t)?t:void 0,o=K=>!n&&LI(r,K),i=K=>n?!1:r?.[K]===void 0?void 0:LI(r,K),s=K=>n?{}:xV(r,K),a=n||i("ruler")===!1,l=n||i("linkPopover")===!1,u=l?void 0:Dl(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"),m=zV(p),g=Wr(p.items),v=e.modules?.toolbar,C=Wr(v)?v:{},w=e.modules?.contextMenu??e.modules?.slashMenu,_=Wr(w)?w:{},y=e.modules?.surfaces?.findReplace,k=FI(Wr(y)?y:{}),T=Wr(C.groups)?BI(zI(C.groups,p)):C.groups,M=[m.groups,T],B=M.find(Wr),W=M.find(Array.isArray),z=g?Object.keys(m.groups??{}):Dl(W,C.toolbarGroups,e.toolbarGroups),V=Array.isArray(z)?z:null,Z=(K,x)=>Object.prototype.hasOwnProperty.call(K,x),R=B&&V?Object.fromEntries([...V.filter(K=>Z(B,K)),...Object.keys(B).filter(K=>!EV.includes(K))].map(K=>[K,B[K]])):B;return{enabled:!n,toolbar:{enabled:o("toolbar"),container:n?null:Dl(m.container,C.selector,e.toolbar)??null,options:n?{}:{...qo(C,m),groups:R,toolbarGroups:z,icons:qo(e.toolbarIcons,C.icons,m.icons),texts:qo(e.toolbarTexts,C.texts,m.texts)}},comments:{enabled:i("comments")??(!n&&e.modules?.comments!==!1),options:n?{}:E_(RV(s("comments")))},contextMenu:{enabled:i("contextMenu")??(!n&&e.disableContextMenu!==!0),suppressed:n||i("contextMenu")===!1,options:n?{}:qo(OI(_),OI(s("contextMenu")))},loading:{enabled:o("loading")},search:{enabled:i("search")??(!n&&!!e.modules?.surfaces?.findReplace),options:n?{}:qo(k,FI(s("search")))},linkPopover:{enabled:typeof u=="function",suppressed:l,options:qo(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?qo({chrome:f},s("contentControls")):{chrome:"none"}}}}var rg=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),jV=e=>e==="read"||e==="write"||e==="resolve";function VI(e={}){const t=rg(e.interaction)?e.interaction:{},n=rg(t.comments)?t.comments:{},r=rg(t.trackedChanges)?t.trackedChanges:{},o=rg(e.modules?.comments)?e.modules.comments:{},i=(n.readOnly??o.readOnly??!1)===!0,s=(n.allowResolve??o.allowResolve??!0)!==!1,a=jV(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 UI=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function HI(e={}){const t=UI(e.surfaces)?e.surfaces:{},n=UI(e.modules?.surfaces)?e.modules.surfaces:{},r=t.resolver===void 0?n.resolver:t.resolver;return{resolver:typeof r=="function"?r:null,dialog:qo(n.dialog,t.dialog),floating:qo(n.floating,t.floating)}}var VV="https://docs.superdoc.dev/editor/fonts/";function UV(e){return e==="localhost"||e.endsWith(".localhost")||e==="0.0.0.0"||e==="::1"||e==="[::1]"||e.startsWith("127.")}function HV(e,t,n=typeof window>"u"?"":window.location.hostname){if(!UV(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: ${VV}`)}var $V=class{#e=new Map;#n=new Map;#t=null;#o=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(`[${Om}]`);if(!n)return null;const r=n.getAttribute(Om),o=r?this.get(r):null;return o&&o.root===n?o:null}subscribe(e){return this.#o.add(e),()=>{this.#o.delete(e)}}clear(){this.#e.clear(),this.#n.clear(),this.#t=null,this.#o.clear()}#i(e){for(const t of Array.from(this.#o))try{t(e)}catch{}}},GV=["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"],$I=[{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:GV,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"}],GI=new Map($I.map(e=>[e.name,e])),WV=$I.map(e=>e.name);function f2(e){return GI.get(e)??null}function KV(e){const t=GI.get(e);return t?.disposition==="controller-routed"?t.commandId:null}var qV=".png,.jpg,.jpeg,image/png,image/jpeg",WI=new Set(["image/png","image/jpeg","image/jpg"]),YV=/\.(png|jpe?g)$/i;function XV(e){if(!e)return!1;const t=typeof e.type=="string"?e.type.toLowerCase():"";return t?WI.has(t):YV.test(String(e.name??""))}function KI(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(ZV(String(r.result),e)),r.onerror=()=>n(r.error??new Error("image-read-failed")),r.readAsDataURL(e)})}function ZV(e,t){const n=/^data:([^;,]*);base64,/.exec(e);if(!n)return e;const r=n[1].toLowerCase();if(WI.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 QV(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:JV(n,e)}return KI(e)}async function JV(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 KI(o?Object.assign(r,{name:o}):r)}function eU({ownerDocument:e=document,onPick:t,onError:n}={}){const r=e.createElement("input");return r.type="file",r.accept=qV,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(!XV(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 tU=(e,t)=>{let n=e.replace(/[^0-9.]/g,"");return n=parseFloat(n),isNaN(n)&&(n=t),n=parseFloat(n),n},nU=(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};Bt(),bn();var rU={class:"sd-toolbar-icon"},oU=["innerHTML"],iU={__name:"ToolbarButtonIcon",props:{name:{type:String,required:!0},color:{type:String,default:null},icon:{type:String,default:null}},setup(e){const t=e,n=Se(()=>{if(t.name==="color")return{backgroundColor:t.color||"#111111"};if(t.name==="highlight")return{backgroundColor:t.color||"#D6D6D6"}}),r=Se(()=>["color","highlight"].includes(t.name));return(o,i)=>(ye(),De("div",rU,[He("div",{class:tn(["sd-toolbar-icon__icon",[`sd-toolbar-icon__icon--${t.name}`]]),innerHTML:e.icon},null,10,oU),r.value?(ye(),De("div",{key:0,class:"color-bar",style:wn(n.value)},null,4)):vt("",!0)]))}},qI=pn(iU,[["__scopeId","data-v-d7d79424"]]);Bt(),bn();var sU=["role","aria-label","aria-disabled"],aU=["data-item"],lU=["data-item"],cU={key:1,class:"sd-button-label"},uU=["data-item","aria-label"],dU=["innerHTML"],fU={key:2},hU=["onKeydown","id"],pU=["placeholder","onKeydown","id","data-item"],mU=["data-item","innerHTML"],gU={"aria-live":"polite",class:"sd-visually-hidden"},vU={__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}=hr(),o=e,{name:i,active:s,icon:a,label:l,hideLabel:u,iconColor:d,hasCaret:f,splitButton:p,disabled:m,expand:g,inlineTextInputVisible:v,hasInlineTextInput:C,minWidth:w,style:_,attributes:y}=o.toolbarItem,k=Se(()=>!!p?.value&&!!f?.value),T=Se(()=>i?.value??""),M=re(""),B=re(null),{isHighContrastMode:W}=fs();Vt(()=>l?.value,Re=>{document.activeElement!==B.value&&(M.value=Re==null?"":String(Re))},{immediate:!0});const z=()=>{C&&St(()=>{B.value?.focus(),B.value?.select()}),n("buttonClick")},V=Re=>{m?.value||(Re?.stopPropagation(),n("mainClick"))},Z=()=>{k.value||z()},R=Re=>{if(k.value){V(Re);return}z()},K=Re=>{o.allowEnterPropagation||Re.stopPropagation(),R(Re)},x=Re=>{const Be=o.toolbarItem?.nestedOptions?.value??[],tt=Re.trim();if(!tt)return"";const ut=Be.find(dt=>typeof dt?.label=="string"&&dt.label.toLowerCase()===tt.toLowerCase());return ut?.label?ut.label:Be.find(dt=>typeof dt?.label=="string"&&dt.label.toLowerCase().startsWith(tt.toLowerCase()))?.label??tt},G=()=>{const Re=String(M.value??"").trim();let Be=Re;if(T.value==="fontSize"){const tt=Number.parseFloat(Re);Be=Re.match(/^\d+(\.5)?$/)?Re:Number.isFinite(tt)?Math.floor(tt).toString():""}else T.value==="fontFamily"&&(Be=x(Re));return Be?(n("textSubmit",Be),M.value=Be,!0):!1},H=Re=>{const Be=Re?.currentTarget;Be instanceof HTMLInputElement&&(Be.focus({preventScroll:!0}),Be.select())},J=Re=>{requestAnimationFrame(()=>{const Be=document.getElementById(`inlineTextInput-${Re}`);Be instanceof HTMLInputElement&&(Be.focus({preventScroll:!0}),Be.select())})},Q=()=>{const Re=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Re instanceof HTMLElement?(Re.focus({preventScroll:!0}),!0):!1},X=()=>{const Re=r?.$toolbar?.pendingSelectionCapture,Be=()=>{Re&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Re)};if(Q()){Be();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Be())},Te=()=>{G()&&X()},de=Re=>{if(G(),Re.shiftKey){T.value==="fontSize"&&(Re.preventDefault(),St(()=>J("fontFamily")));return}if(Re.preventDefault(),T.value==="fontFamily"){St(()=>J("fontSize"));return}T.value==="fontSize"&&St(X)},ge=Se(()=>_.value?_.value:{minWidth:o.minWidth}),ve=Se(()=>g?.value?rr.dropdownCaretUp:rr.dropdownCaretDown);return(Re,Be)=>(ye(),De("div",{class:tn(["sd-toolbar-item",Qe(y).className]),style:wn(ge.value),role:e.isOverflowItem?"menuitem":"button","aria-label":Qe(y).ariaLabel,"aria-disabled":Qe(m)?"true":void 0,"data-sd-part":"toolbar-item",onClick:Z,onKeydown:Be[9]||(Be[9]=oi(tt=>K(tt),["enter"])),tabindex:"0"},[He("div",{class:tn(["sd-toolbar-button",{"sd-active":Qe(s),"sd-disabled":Qe(m),narrow:e.isNarrow,wide:e.isWide,split:k.value,"has-inline-text-input":Qe(C),"high-contrast":Qe(W)}]),"data-item":`btn-${Qe(i)||""}`},[k.value?(ye(),De("div",{key:0,class:"sd-toolbar-button__main","data-item":`btn-${Qe(i)||""}-main`,onClick:Be[0]||(Be[0]=tt=>V(tt))},[Qe(a)?(ye(),cn(qI,{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",cU,$t(Qe(l)),1)):vt("",!0)],8,lU)):vt("",!0),k.value?(ye(),De("div",{key:1,class:"sd-toolbar-button__caret","data-item":`btn-${Qe(i)||""}-caret`,"aria-label":`${Qe(y).ariaLabel} options`,role:"button"},[He("div",{class:"sd-dropdown-caret",innerHTML:ve.value,style:wn({opacity:Qe(m)?.6:1})},null,12,dU)],8,uU)):(ye(),De(qt,{key:2},[Qe(a)?(ye(),cn(qI,{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:tn(["sd-button-label",{"sd-visually-hidden":Qe(v)&&T.value==="fontFamily"}])},$t(Qe(l)),3)):vt("",!0),Qe(v)?(ye(),De("span",fU,[Qe(i)==="fontSize"?ka((ye(),De("input",{key:0,"onUpdate:modelValue":Be[1]||(Be[1]=tt=>M.value=tt),onKeydown:[oi(en(Te,["stop","prevent"]),["enter"]),Be[2]||(Be[2]=oi(tt=>de(tt),["tab"]))],onClick:Be[3]||(Be[3]=en(tt=>H(tt),["stop"])),onFocus:Be[4]||(Be[4]=tt=>H(tt)),type:"text",class:tn(["button-text-input button-text-input--font-size",{"high-contrast":Qe(W)}]),id:"inlineTextInput-"+Qe(i),autocomplete:"off",ref_key:"inlineInput",ref:B},null,42,hU)),[[ji,M.value]]):ka((ye(),De("input",{key:1,"onUpdate:modelValue":Be[5]||(Be[5]=tt=>M.value=tt),placeholder:Qe(l),onKeydown:[oi(en(Te,["stop","prevent"]),["enter"]),Be[6]||(Be[6]=oi(tt=>de(tt),["tab"]))],onClick:Be[7]||(Be[7]=en(tt=>H(tt),["stop"])),onFocus:Be[8]||(Be[8]=tt=>H(tt)),type:"text",class:tn(["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:B},null,42,pU)),[[ji,M.value]])])):vt("",!0),Qe(f)?(ye(),De("div",{key:3,class:"sd-dropdown-caret","data-item":`btn-${Qe(i)||""}-toggle`,innerHTML:ve.value,style:wn({opacity:Qe(m)?.6:1})},null,12,mU)):vt("",!0)],64)),He("div",gU,$t(`${Qe(y).ariaLabel} ${Qe(s)?"selected":"unset"}`),1)],10,aU)],46,sU))}},h2=pn(vU,[["__scopeId","data-v-22817fa7"]]);Bt(),bn();var yU={class:"toolbar-separator",role:"separator","aria-label":"Toolbar separator"},bU={__name:"ToolbarSeparator",props:{active:{type:Boolean,default:!1}},emits:["command"],setup(e,{emit:t}){const{isHighContrastMode:n}=fs(),r=()=>n.value?"#000":"var(--sd-ui-border, #dbdbdb)";return(o,i)=>(ye(),De("div",yU,[He("div",{class:"separator-inner",style:wn({backgroundColor:r()})},null,4)]))}},wU=pn(bU,[["__scopeId","data-v-cb82253a"]]);Bt(),bn();var CU={class:"toolbar-dropdown"},kU=["onClick"],SU={key:0,class:"toolbar-dropdown-option__icon"},_U={class:"toolbar-dropdown-option__label"},og='button, [href], input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])',AU={__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=dw(),i=re(null),s=re(null),a=re({top:"0px",left:"0px",maxHeight:"none"}),l=re([]),u=re(-1),d=Se(()=>!!n.show),f=re(document.fullscreenElement),p=Se(()=>d.value&&f.value?f.value:document.body),m=Se(()=>n.options.some(se=>se?.type==="render")),g=Se(()=>!!o.menu),v=Se(()=>typeof n.menuProps!="function"?{}:n.menuProps()||{}),C=Se(()=>{const{class:se,style:ke,...Ue}=v.value;return Ue}),w=Se(()=>["toolbar-dropdown-menu",v.value.class,{"toolbar-dropdown-menu--render-only":g.value||n.options.length>0&&n.options.every(se=>se&&se.type==="render")}]),_=Se(()=>{const se=v.value.style||{};return{...n.contentStyle,...se}}),y=Se(()=>({..._.value,position:"fixed",top:a.value.top,left:a.value.left,maxHeight:a.value.maxHeight,zIndex:2e3})),k=se=>{r("update:show",se)},T=()=>{d.value&&k(!1)},M=()=>{if(!i.value)return;const se=i.value.getBoundingClientRect(),ke=s.value,Ue=ke?.offsetWidth??0,ne=ke?.scrollHeight??ke?.offsetHeight??0,I=window.innerWidth||document.documentElement.clientWidth||0,ae=window.innerHeight||document.documentElement.clientHeight||0,N=8,Y=4,U=se.bottom+Y,ie=se.top-Y,be=Math.max(0,ae-U-N),L=Math.max(0,ie-N),F=be<ne&&L>be,fe=F?L:be,Ce=F?Math.max(N,ie-(ne?Math.min(ne,fe):fe)):U;let _e=se.left;n.placement==="bottom-end"&&(_e=se.right-Ue);const Pe=Math.max(N,I-Ue-N);_e=Math.min(Math.max(N,_e),Pe),a.value={top:`${Ce}px`,left:`${_e}px`,maxHeight:`${fe}px`}},B=async()=>{f.value=document.fullscreenElement,d.value&&(await St(),M())},W=()=>{n.disabled||k(!d.value)},z=se=>typeof n.nodeProps!="function"?{}:n.nodeProps(se)||{},V=se=>{se?.disabled||se?.type!=="render"&&(r("select",se?.key,se),T())},Z=se=>se?.type==="render",R=se=>!se?.disabled&&se?.type!=="render",K=se=>typeof se?.icon=="function"||!!se?.icon,x=se=>typeof se?.icon=="function"?se.icon(se):se?.icon||null,G=se=>se?typeof se=="string"?se.split(/\s+/).includes("sd-selected"):Array.isArray(se)?se.some(G):typeof se=="object"?!!se["sd-selected"]:!1:!1,H=se=>G(se?.props?.class)||G(se?.class),J=()=>n.options.map((se,ke)=>R(se)?ke:-1).filter(se=>se>=0),Q=()=>{const se=n.options.findIndex(ke=>R(ke)&&H(ke));return se>=0?se:J()[0]??-1},X=(se,ke)=>{if(!se){delete l.value[ke];return}l.value[ke]=se},Te=()=>{l.value.forEach((ke,Ue)=>{ke&&ke.setAttribute("tabindex",Ue===u.value?"0":"-1")});const se=l.value[u.value];se&&typeof se.focus=="function"&&(se.focus(),se.scrollIntoView?.({block:"nearest",inline:"nearest"}))},de=se=>{const ke=J();if(!ke.length){u.value=-1;return}const Ue=ke.indexOf(u.value);if(Ue<0){u.value=se>0?ke[0]:ke[ke.length-1];return}const ne=(Ue+se+ke.length)%ke.length;u.value=ke[ne]},ge=()=>{let se=n.options[u.value];if(!R(se)){const ke=J()[0];se=ke===void 0?null:n.options[ke]}se&&V(se)},ve=fc({name:"ToolbarDropdownRenderOption",props:{option:{type:Object,required:!0}},setup(se){return()=>typeof se.option.render!="function"?null:se.option.render()}}),Re=fc({name:"ToolbarDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(se){return()=>{const ke=x(se.option);return typeof ke=="string"?zr("span",{innerHTML:ke}):ke}}}),Be=se=>{if(!d.value)return;const ke=se.target;if(!(ke instanceof Element))return;const Ue=i.value?.contains(ke),ne=s.value?.contains(ke);Ue||ne||n.hasOpenChild&&ke.closest('[data-sd-part="dropdown-menu"]')||T()},tt=re(null),ut=()=>{const se=i.value,ke=document.activeElement;if(se&&ke instanceof HTMLElement&&se.contains(ke)){tt.value=ke;return}tt.value=se?.matches?.(og)?se:se?.querySelector(og)},dt=()=>{const se=tt.value;if(se instanceof HTMLElement&&document.contains(se)){se.focus();return}const ke=i.value;if(!ke)return;const Ue=ke.matches?.(og)?ke:ke.querySelector(og);if(Ue instanceof HTMLElement){Ue.focus();return}ke.setAttribute("tabindex","-1"),ke.focus()},_t=se=>{if(!d.value)return;const{key:ke}=se;if(["Escape","ArrowDown","ArrowUp","Enter"].includes(ke)){if(ke==="Escape"){if(!n.closeOnEscape)return;se.preventDefault(),T(),St(()=>{requestAnimationFrame(dt)});return}if(!(m.value||g.value)){if(se.preventDefault(),ke==="ArrowDown"){de(1),Te();return}if(ke==="ArrowUp"){de(-1),Te();return}ke==="Enter"&&ge()}}};return Vt(d,async se=>{if(!se){u.value=-1,l.value=[];return}ut(),await St(),M(),!(m.value||g.value)&&(u.value=Q(),await St(),Te())},{immediate:!0}),Vt(d,se=>{se?(document.addEventListener("pointerdown",Be,!0),document.addEventListener("keydown",_t,!0),window.addEventListener("resize",M),window.addEventListener("scroll",M,!0)):(document.removeEventListener("pointerdown",Be,!0),document.removeEventListener("keydown",_t,!0),window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0))},{immediate:!0}),Bn(()=>{document.addEventListener("fullscreenchange",B)}),ar(()=>{document.removeEventListener("fullscreenchange",B),document.removeEventListener("pointerdown",Be,!0),document.removeEventListener("keydown",_t,!0),window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0)}),(se,ke)=>(ye(),De("div",CU,[He("div",{ref_key:"triggerRef",ref:i,class:"toolbar-dropdown-trigger","data-sd-part":"dropdown-trigger",onClick:W},[mu(se.$slots,"trigger",{},void 0,!0)],512),(ye(),cn(pl,{to:p.value},[Qt(Rp,{name:"fade-in-scale-up-transition"},{default:io(()=>[d.value?(ye(),De("div",Os({key:0,ref_key:"menuRef",ref:s,"data-sd-part":"dropdown-menu",class:w.value,style:y.value},C.value),[g.value?mu(se.$slots,"menu",{key:0},void 0,!0):vt("",!0),(ye(!0),De(qt,null,nr(g.value?[]:e.options,(Ue,ne)=>(ye(),De("div",Os({key:Ue.key,ref_for:!0,ref:I=>X(I,ne),class:["toolbar-dropdown-option",[Ue.class,Ue.props?.class,{"sd-disabled":Ue.disabled,"sd-render":Z(Ue)}]],tabindex:"-1",onClick:I=>V(Ue)},{ref_for:!0},{...Ue.props,...z(Ue)}),[Z(Ue)?(ye(),cn(Qe(ve),{key:0,option:Ue},null,8,["option"])):(ye(),De(qt,{key:1},[K(Ue)?(ye(),De("span",SU,[Qt(Qe(Re),{option:Ue},null,8,["option"])])):vt("",!0),He("span",_U,$t(Ue.label),1)],64))],16,kU))),128))],16)):vt("",!0)]),_:3})],8,["to"]))]))}},YI=pn(AU,[["__scopeId","data-v-764d5fd7"]]),XI=e=>{const t=e?.target;t instanceof Element&&(t.closest('input, textarea, [contenteditable="true"]')||e.preventDefault())},Bc=(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})};Bt(),bn();var IU={__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=Se(()=>r.toolbarItem.expand.value),i=Se(()=>r.overflowItems.some(u=>u.type==="dropdown"&&Qe(u.expand))),s=Se(()=>({...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(),cn(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:io(()=>[Qt(h2,{"toolbar-item":s.value},null,8,["toolbar-item"])]),menu:io(()=>[Qt(ag,{class:"superdoc-toolbar-overflow","toolbar-items":e.overflowItems,"ui-font-family":r.uiFontFamily,"from-overflow":"",onMousedown:Qe(XI),onCommand:l},null,8,["toolbar-items","ui-font-family","onMousedown"])]),_:1},8,["close-on-escape","has-open-child","content-style","show"]))}},EU=pn(IU,[["__scopeId","data-v-5f8ee279"]]),ZI=e=>String(e??"").trim().toLowerCase(),ig=(e,t)=>{const n=ZI(e);if(!n)return-1;for(let r=0;r<t.length;r+=1)if(ZI(t[r]).startsWith(n))return r;return-1},TU=(e,t,{autocomplete:n=!0}={})=>{const r=String(e??""),o=ig(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}},xU=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},RU=e=>e<=31||e===127,MU=e=>e===32||e===160||e===65279,LU=e=>Array.from(String(e)).filter(t=>!RU(t.charCodeAt(0))).join(""),DU=e=>{let t="",n=!1;for(const r of String(e)){if(MU(r.charCodeAt(0))){n=t.length>0;continue}n&&(t+=" "),n=!1,t+=r}return t},OU=e=>{const t=String(e??"").split(",")[0]??"",n=LU(t);return DU(xU(n)).trim()},PU=1,FU=1638,NU=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<PU?"":String(Math.min(r,FU))};Bt(),bn();var BU=["data-item"],zU=["id","value","disabled","aria-label","aria-expanded","aria-controls","aria-activedescendant","data-item"],jU=["data-item","aria-label","disabled"],VU=["innerHTML"],UU=["id","aria-label"],HU=["id","aria-selected","aria-label","onMousedown","onMouseenter"],$U={class:"toolbar-dropdown-option__label"},GU={class:"sd-button-label sd-font-combobox__legacy-label","aria-hidden":"true"},WU={__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}=fs(),i=re(null),s=re(null),a=re(null),l=re([]),u=re(!1),d=re(!1),f=re(-1),p=re(""),m=re(""),g=re(!1),v=re({top:"0px",left:"0px",minWidth:"0px",maxHeight:"none"}),C=Se(()=>n.item.nestedOptions?.value??[]),w=Se(()=>C.value.map(L=>String(L?.label??""))),_=Se(()=>String(n.item.label?.value??"")),y=Se(()=>!!n.item.disabled?.value),k=Se(()=>String(n.item.name?.value??"")),T=Se(()=>n.item.attributes?.value?.ariaLabel??"Font family"),M=Se(()=>u.value?m.value:_.value),B=Se(()=>`sd-${k.value||"combobox"}-listbox-${n.item.id?.value??"default"}`),W=L=>`${B.value}-option-${L}`,z=Se(()=>d.value&&f.value>=0?W(f.value):void 0),V=Se(()=>d.value?rr.dropdownCaretUp:rr.dropdownCaretDown),Z=L=>{const F=String(L??"").trim().toLowerCase();return C.value.find(fe=>String(fe?.label??"").trim().toLowerCase()===F)?.props?.style?.fontFamily||L||n.uiFontFamily},R=Se(()=>n.showPreview?{fontFamily:Z(u.value?m.value:_.value)}:{fontFamily:n.uiFontFamily}),K=()=>{const L=n.item.selectedValue?.value;if(L){const F=C.value.findIndex(fe=>fe?.key===L);if(F>=0)return F}return w.value.findIndex(F=>F.toLowerCase()===_.value.toLowerCase())},x=(L,F)=>{const fe=i.value;if(!(!fe||typeof fe.setSelectionRange!="function"))try{fe.setSelectionRange(L,F)}catch{}},G=()=>{l.value[f.value]?.scrollIntoView?.({block:"nearest",inline:"nearest"})},H=()=>{l.value[f.value]?.focus?.()},J=()=>{const L=s.value;if(!L)return;const F=L.getBoundingClientRect(),fe=a.value,Ce=fe?.scrollHeight??fe?.offsetHeight??0,_e=window.innerHeight||document.documentElement.clientHeight||0,Pe=window.innerWidth||document.documentElement.clientWidth||0,We=8,it=4,ht=F.bottom+it,Lt=F.top-it,Tt=Math.max(0,_e-ht-We),Yt=Math.max(0,Lt-We),Fe=Tt<Ce&&Yt>Tt,rn=Fe?Yt:Tt,Dn=Fe?Math.max(We,Lt-(Ce?Math.min(Ce,rn):rn)):ht,Kt=Math.min(Math.max(We,F.left),Math.max(We,Pe-F.width-We));v.value={top:`${Dn}px`,left:`${Kt}px`,minWidth:`${F.width}px`,maxHeight:`${rn}px`}},Q=Se(()=>({position:"fixed",top:v.value.top,left:v.value.left,minWidth:v.value.minWidth,maxHeight:v.value.maxHeight,fontFamily:n.uiFontFamily,zIndex:2e3})),X=L=>{n.item.expand&&typeof n.item.expand=="object"&&"value"in n.item.expand&&(n.item.expand.value=L)},Te=(L,{focusInput:F=!1,focusOption:fe=!1}={})=>{if(y.value||!C.value.length){X(!1);return}d.value=!0,X(!0),f.value=L??-1,F&&(u.value=!0,m.value=_.value,i.value?.focus()),St(()=>{J(),G(),fe&&H()})},de=({syncItem:L=!0}={})=>{d.value=!1,f.value=-1,L&&X(!1)},ge=()=>{de(),u.value=!1,p.value="",m.value=_.value},ve=()=>{y.value||(d.value||r("item-clicked"),u.value=!0,p.value="",m.value=_.value,St(()=>x(0,m.value.length)))},Re=L=>{if(y.value)return;const F=document.activeElement===i.value;if(r("item-clicked"),u.value=!0,F||(p.value="",m.value=_.value,L.preventDefault(),i.value?.focus({preventScroll:!0}),x(0,_.value.length)),!d.value){const fe=K();Te(fe>=0?fe:0)}},Be=L=>{const F=L.relatedTarget;F instanceof Node&&s.value?.contains(F)||F instanceof Node&&a.value?.contains(F)||ge()},tt=L=>{if(g.value)return;const F=L.target,fe=F.value,Ce=typeof F.selectionStart=="number"?F.selectionStart:fe.length,_e=typeof F.selectionEnd=="number"?F.selectionEnd:Ce,Pe=typeof L.inputType=="string"&&L.inputType.startsWith("delete"),We=Ce===fe.length&&_e===fe.length;p.value=fe;const it=TU(fe,w.value,{autocomplete:!Pe&&We});m.value=it.display,F.value=it.display,it.display===fe&&!We?x(Ce,_e):x(it.selectionStart,it.selectionEnd),d.value&&(f.value=it.matchIndex,St(G))},ut=L=>{g.value=!1,tt(L)},dt=L=>{if(!C.value.length)return;const F=C.value.length,fe=f.value<0?L>0?-1:0:f.value;f.value=(fe+L+F)%F,St(G)},_t=(L,F)=>{r("item-clicked"),r("command",{item:n.item,argument:L,option:F}),F&&(n.item.selectedValue.value=F.key)},se=L=>{L&&(_t(L.value??L.label,L),u.value=!1,p.value="",m.value=L.label,de())},ke=()=>{if(d.value&&f.value>=0)return se(C.value[f.value]),!0;const L=ig(p.value,w.value);if(L>=0)return se(C.value[L]),!0;const F=n.normalizeValue(p.value);return F?(_t(F,null),u.value=!1,p.value="",m.value=F,de(),!0):!1},Ue=L=>{if(!(L.isComposing||g.value||L.keyCode===229)&&!(L.ctrlKey||L.metaKey||L.altKey))switch(L.key){case"ArrowDown":if(L.preventDefault(),d.value)H();else{const F=ig(p.value,w.value),fe=F>=0?F:K();Te(fe>=0?fe:0,{focusOption:!0})}break;case"ArrowUp":if(L.preventDefault(),d.value)H();else{const F=ig(p.value,w.value),fe=F>=0?F:K();Te(fe>=0?fe:C.value.length-1,{focusOption:!0})}break;case"Enter":L.preventDefault(),ke()&&r("editor-handoff"),i.value?.blur();break;case"Tab":L.preventDefault(),ke(),de(),i.value?.blur(),r("tab-out",L);break;case"Escape":L.preventDefault(),ge(),St(()=>i.value?.focus());break;default:break}},ne=L=>{if(L.preventDefault(),!y.value)if(r("item-clicked"),d.value)de(),i.value?.focus();else{const F=K();Te(F>=0?F:0,{focusOption:!0})}},I=(L,F)=>{L.preventDefault(),se(F),r("editor-handoff"),i.value?.blur()},ae=L=>{f.value=L},N=L=>{if(!(L.ctrlKey||L.metaKey||L.altKey))switch(L.key){case"ArrowDown":L.preventDefault(),dt(1),H();break;case"ArrowUp":L.preventDefault(),dt(-1),H();break;case"Enter":L.preventDefault(),f.value>=0&&(se(C.value[f.value]),r("editor-handoff"));break;case"Escape":L.preventDefault(),ge(),St(()=>i.value?.focus());break;case"Tab":L.preventDefault(),f.value>=0?se(C.value[f.value]):de(),r("tab-out",{shiftKey:L.shiftKey,target:i.value});break;default:break}},Y=L=>{if(!d.value)return;const F=L.target;F instanceof Element&&(s.value?.contains(F)||a.value?.contains(F)||ge())};Vt(d,L=>{L?(document.addEventListener("pointerdown",Y,!0),window.addEventListener("resize",J),window.addEventListener("scroll",J,!0)):(document.removeEventListener("pointerdown",Y,!0),window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0),l.value=[])},{immediate:!0}),ar(()=>{document.removeEventListener("pointerdown",Y,!0),window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0)});const U=(L,F)=>{if(!L){delete l.value[F];return}l.value[F]=L},ie=L=>L===f.value,be=L=>L?.key&&L.key===n.item.selectedValue?.value;return Vt(_,L=>{u.value||(m.value=L)}),Vt(()=>!!n.item.expand?.value,L=>{if(L&&!d.value){const F=K();Te(F>=0?F:0,{focusInput:!0});return}!L&&d.value&&de({syncItem:!1})}),(L,F)=>(ye(),De("div",{ref_key:"rootRef",ref:s,class:tn(["sd-font-combobox sd-toolbar-split-field",{"sd-disabled":y.value,"high-contrast":Qe(o)}]),style:wn(n.item.style?.value),"data-item":`btn-${k.value}`},[He("span",{class:"sd-font-combobox__field sd-toolbar-split-field__main",onMousedown:Re},[He("input",{ref_key:"inputRef",ref:i,id:`inlineTextInput-${k.value}`,class:"button-text-input sd-font-combobox__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:"false",value:M.value,style:wn(R.value),disabled:y.value,"aria-label":T.value,"aria-expanded":d.value?"true":"false","aria-controls":B.value,"aria-activedescendant":z.value,"aria-haspopup":"listbox","aria-autocomplete":"both","data-item":`btn-${k.value}-input`,onFocus:ve,onBlur:Be,onInput:tt,onKeydown:Ue,onCompositionstart:F[0]||(F[0]=fe=>g.value=!0),onCompositionend:ut},null,44,zU)],32),He("button",{type:"button",class:"sd-font-combobox__caret sd-toolbar-split-field__caret","data-item":`btn-${k.value}-toggle`,tabindex:"-1","aria-label":`${T.value} options`,disabled:y.value,onMousedown:ne},[He("span",{class:"sd-dropdown-caret",innerHTML:V.value},null,8,VU)],40,jU),(ye(),cn(pl,{to:"body"},[d.value?(ye(),De("div",{key:0,ref_key:"popupRef",ref:a,role:"listbox",id:B.value,"aria-label":T.value,class:tn(["sd-font-combobox__listbox",{"high-contrast":Qe(o)}]),style:wn(Q.value)},[(ye(!0),De(qt,null,nr(C.value,(fe,Ce)=>(ye(),De("div",Os({key:fe.key,ref_for:!0,ref:_e=>U(_e,Ce),id:W(Ce),role:"option",tabindex:"-1",class:["toolbar-dropdown-option sd-font-combobox__option",{"sd-active":ie(Ce),"sd-selected":be(fe)}],"aria-selected":be(fe)?"true":"false","aria-label":`${T.value} - ${fe.label}`},{ref_for:!0},fe.props,{onMousedown:_e=>I(_e,fe),onMouseenter:_e=>ae(Ce),onKeydown:N}),[He("span",$U,$t(fe.label),1)],16,HU))),128))],14,UU)):vt("",!0)])),He("span",GU,$t(_.value),1)],14,BU))}},QI=pn(WU,[["__scopeId","data-v-53e0af20"]]);Bt();var KU={__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(),cn(QI,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!0,"normalize-value":Qe(OU),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"]))}};Bt();var qU={__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(),cn(QI,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!1,"normalize-value":Qe(NU),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"]))}};Bt(),bn();var YU=["data-placement"],XU=2500,ZU=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=fw(),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=Se(()=>["sd-tooltip-content",n.class]),p=Se(()=>({...t.contentStyle,...n.style||{},position:"fixed",top:s.value.top,left:s.value.left,zIndex:2100})),m=()=>{l&&(window.clearTimeout(l),l=null)},g=()=>{u&&(window.clearTimeout(u),u=null)},v=()=>{d&&(window.clearTimeout(d),d=null)},C=()=>{v(),d=window.setTimeout(()=>{d=null,k()},XU)},w=(R,K)=>{const x=window.getComputedStyle(R),G=parseFloat(x[K]);return Number.isFinite(G)?x.boxSizing==="border-box"?G:(K==="width"?["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"]:["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"]).reduce((H,J)=>H+(parseFloat(x[J])||0),G):K==="width"?R.offsetWidth:R.offsetHeight},_=()=>{if(!o.value||!i.value)return;const R=o.value.getBoundingClientRect(),K=w(i.value,"width"),x=w(i.value,"height"),G=window.innerWidth||document.documentElement.clientWidth||0,H=document.documentElement.clientHeight||window.innerHeight||0,J=8,Q=10;let X=R.left+R.width/2-K/2;X=Math.max(J,Math.min(X,G-K-J));const Te=R.top-x-Q,de=R.bottom+Q,ge=Te>=J,ve=de+x<=H-J,Re=R.top-Q,Be=H-R.bottom-Q;ge?a.value="top":ve?a.value="bottom":a.value=Re>=Be?"top":"bottom";const tt=a.value==="top"?Te:de,ut=Math.min(J,Math.max(0,H-x)),dt=Math.max(ut,H-x-J);s.value={top:`${Math.max(ut,Math.min(tt,dt))}px`,left:`${X}px`}},y=async()=>{t.disabled||(m(),g(),!r.value&&(r.value=!0,C(),await St(),_()))},k=()=>{g(),m(),v(),r.value&&(r.value=!1)},T=()=>{if(m(),g(),!r.value){if(t.delay===0){y();return}u=window.setTimeout(()=>{u=null,y()},t.delay)}},M=()=>{if(g(),m(),!!r.value){if(t.duration===0){k();return}l=window.setTimeout(()=>{l=null,k()},t.duration)}},B=()=>{t.trigger==="hover"&&T()},W=()=>{t.trigger==="hover"&&M()},z=()=>{g(),m()},V=()=>{M()},Z=R=>{R.key==="Escape"&&k()};return Vt(()=>t.disabled,R=>{R&&k()}),Vt(r,R=>{R?(window.addEventListener("resize",_),window.addEventListener("scroll",_,!0),document.addEventListener("keydown",Z,!0)):(window.removeEventListener("resize",_),window.removeEventListener("scroll",_,!0),document.removeEventListener("keydown",Z,!0))}),ar(()=>{g(),m(),v(),window.removeEventListener("resize",_),window.removeEventListener("scroll",_,!0),document.removeEventListener("keydown",Z,!0)}),(R,K)=>(ye(),De(qt,null,[He("span",{ref_key:"triggerRef",ref:o,class:"sd-tooltip-trigger",onMouseenter:B,onMouseleave:W,onFocusin:B,onFocusout:W},[mu(R.$slots,"trigger",{},void 0,!0)],544),(ye(),cn(pl,{to:"body"},[Qt(Rp,{name:"fade-in-scale-up-transition"},{default:io(()=>[r.value&&!e.disabled?(ye(),De("div",{key:0,ref_key:"contentRef",ref:i,class:tn(f.value),style:wn(p.value),"data-placement":a.value,onMouseenter:z,onMouseleave:V},[K[0]||(K[0]=He("span",{class:"sd-tooltip-arrow","aria-hidden":"true"},null,-1)),mu(R.$slots,"default",{},void 0,!0)],46,YU)):vt("",!0)]),_:3})]))],64))}}),sg=pn(ZU,[["__scopeId","data-v-88d296cd"]]);Bt(),bn();var QU=["onKeydown","tabindex","data-item-id"],JU={key:0},eH={key:0},tH={key:0},nH={key:0},rH={key:0},oH={__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}=hr(),o=re([]),i=re(null),s=e,a=re(null),{isHighContrastMode:l}=fs(),u=window.matchMedia("(max-width: 768px)").matches,d=Se(()=>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=se=>se.type==="button",p=se=>se.type==="dropdown",m=se=>se.type==="dropdown"&&se.name?.value==="fontFamily",g=se=>se.type==="dropdown"&&se.name?.value==="fontSize",v=se=>se.type==="separator",C=se=>se.type==="overflow",w=se=>!!se.nestedOptions?.value?.length,_=se=>{if(!se)return!1;const ke=se.expand;return typeof ke=="object"&&ke!==null&&"value"in ke?!!ke.value:!!ke},y=(se,ke)=>{se?.expand&&(se.expand.value=ke)},k=(se,ke=void 0)=>{if(se.disabled.value)return;if(C(se)){const ne=!_(se);ne&&B(),y(se,ne),a.value=ne?se:null,n("item-clicked");return}if(p(se))return;a.value&&p(a.value)&&_(a.value)&&B(),n("item-clicked");const Ue=ke!==void 0?ke:se.argument?.value;n("command",Ue===void 0?{item:se}:{item:se,argument:Ue})},T=(se,ke)=>{se.disabled.value||(a.value=null,n("command",{item:se,argument:ke}))},M=se=>{if(se.disabled.value)return;B();const ke=se.splitButtonCommand,Ue=se.command,ne=ke||Ue;if(!ne)return;const I={...se,command:ne};n("item-clicked"),n("command",{item:I})},B=()=>{const se=r?.$toolbar?.toolbarItems||[],ke=r?.$toolbar?.overflowItems||[],Ue=[...se,...ke];(Ue.length?Ue:s.toolbarItems).forEach(ne=>{const I=C(ne)&&!s.fromOverflow;(p(ne)||I)&&y(ne,!1)}),a.value=null},W=(se,ke)=>{B();const Ue=se.dropdownValueKey.value?ke[se.dropdownValueKey.value]:ke.label;n("command",{item:se,argument:Ue,option:ke}),se.selectedValue.value=ke.key,se.restoreEditorFocus&&Bc(r?.$toolbar)},z=se=>{n("command",se)},V=()=>{B(),n("item-clicked")},Z=()=>{const se=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return se instanceof HTMLElement?(se.focus({preventScroll:!0}),!0):!1},R=()=>{const se=r?.$toolbar?.pendingSelectionCapture,ke=()=>{se&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(se)};if(Z()){ke();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),ke())},K=se=>!(se instanceof HTMLElement)||se.classList.contains("sd-disabled")?null:se.querySelector("input:not([disabled]), textarea:not([disabled]), select:not([disabled])")||se.querySelector('button:not([disabled]), [role="button"]:not(.sd-disabled), [tabindex]:not([tabindex="-1"])'),x=(se,ke)=>{const Ue=se?.target?.closest?.(".sd-toolbar-item-ctn");if(!(Ue instanceof HTMLElement))return!1;let ne=ke>0?Ue.nextElementSibling:Ue.previousElementSibling;for(;ne;){const I=K(ne);if(I instanceof HTMLElement)return Ue.setAttribute("tabindex","-1"),ne.setAttribute("tabindex","0"),I.focus(),!0;ne=ke>0?ne.nextElementSibling:ne.previousElementSibling}return!1},G=se=>{B();const ke=se?.shiftKey?-1:1;x(se,ke)||R()},H=se=>{if(B(),se?.shiftKey){x(se,-1)||R();return}R()},J=()=>{R()},Q=se=>se.nestedOptions?.value?.length?se.nestedOptions.value.map(ke=>{const Ue=ke?.type!=="render"&&se.selectedValue.value===ke.key;return{...ke,props:{...ke.props,class:Ue?"sd-selected":""}}}):[],X=(se,ke)=>({role:"menuitem","aria-label":`${ke.attributes.value.ariaLabel} - ${se.label}`}),Te=se=>{const ke=se.target,Ue=se.target.closest(".sd-toolbar-item-ctn").nextElementSibling;Ue&&(ke.setAttribute("tabindex","-1"),Ue.setAttribute("tabindex","0"),Ue.focus())},de=se=>{const ke=se.target,Ue=se.target.closest(".sd-toolbar-item-ctn").previousElementSibling;Ue&&(ke.setAttribute("tabindex","-1"),Ue.setAttribute("tabindex","0"),Ue.focus())},ge=se=>{const ke=se.target.closest(".button-group").nextElementSibling;if(ke)ke.setAttribute("tabindex","0"),ke.focus();else{const Ue=document.querySelector(".ProseMirror");Ue&&Ue.focus()}},ve=se=>{const ke=se.target.closest(".button-group").previousElementSibling;ke&&(ke.setAttribute("tabindex","0"),ke.focus())},Re=se=>{if(!se.disabled.value){if(p(se)){ut(!_(se),se);return}k(se)}},Be=(se,ke)=>{const Ue=se.target.nodeName==="INPUT"||se.target.nodeName==="TEXTAREA",ne=ke.name.value==="fontSize"||ke.name.value==="fontFamily";if(!(Ue&&ne)&&["Enter"," ","Spacebar","Escape","ArrowRight","ArrowLeft","Tab"].includes(se.key))switch(se.preventDefault(),se.key){case"Enter":case" ":case"Spacebar":Re(ke);break;case"Escape":B();break;case"ArrowRight":B(),Te(se);break;case"ArrowLeft":B(),de(se);break;case"Tab":se.shiftKey?ve(se):ge(se);break;default:break}},tt=se=>{const ke=o.value.find(Ue=>!Ue.classList.contains("sd-disabled"));ke&&(ke.setAttribute("tabindex","0"),ke.focus())},ut=(se,ke)=>{if(n("item-clicked"),!se){B(),n("dropdown-update-show",!1);return}B(),a.value=ke,y(ke,!0),n("dropdown-update-show",!0)},dt=se=>{if(!a.value)return;const ke=se.target;ke instanceof Element&&(ke.closest('[data-sd-part="dropdown-menu"]')||i.value?.contains(ke)||B())};return Vt(()=>_(a.value),se=>{se?document.addEventListener("pointerdown",dt,!0):document.removeEventListener("pointerdown",dt,!0)},{immediate:!0}),ar(()=>{document.removeEventListener("pointerdown",dt,!0)}),(se,ke)=>(ye(),De("div",{style:wn(d.value),class:"button-group",role:"group",onFocus:tt,ref_key:"buttonGroupRef",ref:i},[(ye(!0),De(qt,null,nr(e.toolbarItems,(Ue,ne)=>(ye(),De("div",{key:Ue.id.value,class:tn([{narrow:Ue.isNarrow.value,wide:Ue.isWide.value,"sd-disabled":Ue.disabled.value},"sd-toolbar-item-ctn"]),onKeydown:I=>Be(I,Ue),ref_for:!0,ref_key:"toolbarItemRefs",ref:o,tabindex:ne===0?0:-1,"data-item-id":Ue.id.value},[v(Ue)?(ye(),cn(wU,{key:0,style:{width:"20px"}})):vt("",!0),m(Ue)&&w(Ue)?(ye(),cn(sg,{key:1,trigger:"hover",disabled:!Ue.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:io(()=>[Qt(KU,{item:Ue,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:z,onItemClicked:V,onTabOut:ke[0]||(ke[0]=I=>G(I)),onEditorHandoff:J},null,8,["item","ui-font-family"])]),default:io(()=>[He("div",null,[ss($t(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),De("span",JU,"(disabled)")):vt("",!0)])]),_:2},1032,["disabled","content-style"])):g(Ue)&&w(Ue)?(ye(),cn(sg,{key:2,trigger:"hover",disabled:!Ue.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:io(()=>[Qt(qU,{item:Ue,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:z,onItemClicked:V,onTabOut:ke[1]||(ke[1]=I=>H(I)),onEditorHandoff:J},null,8,["item","ui-font-family"])]),default:io(()=>[He("div",null,[ss($t(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),De("span",eH,"(disabled)")):vt("",!0)])]),_:2},1032,["disabled","content-style"])):p(Ue)&&Ue.nestedOptions?.value?.length?(ye(),cn(YI,{key:3,options:Q(Ue),disabled:Ue.disabled.value,show:_(Ue),"content-style":{fontFamily:s.uiFontFamily},placement:"bottom-start",class:"sd-toolbar-button sd-editor-toolbar-dropdown",onSelect:(I,ae)=>W(Ue,ae),"onUpdate:show":I=>ut(I,Ue),style:wn(Ue.dropdownStyles.value),"menu-props":()=>({role:"menu",style:{fontFamily:s.uiFontFamily},class:["sd-toolbar-dropdown-menu",{"high-contrast":Qe(l)}]}),"node-props":I=>X(I,Ue)},{trigger:io(()=>[Qt(sg,{trigger:"hover",disabled:!Ue.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:io(()=>[Qt(h2,{"toolbar-item":Ue,disabled:Ue.disabled.value,"allow-enter-propagation":!0,onTextSubmit:I=>T(Ue,I),onMainClick:I=>M(Ue)},null,8,["toolbar-item","disabled","onTextSubmit","onMainClick"])]),default:io(()=>[He("div",null,[ss($t(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),De("span",tH,"(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(),cn(sg,{key:4,trigger:"hover",class:"sd-editor-toolbar-tooltip","content-style":{fontFamily:s.uiFontFamily}},{trigger:io(()=>[Qt(h2,{"toolbar-item":Ue,"is-overflow-item":e.fromOverflow,onTextSubmit:I=>T(Ue,I),onButtonClick:I=>k(Ue)},null,8,["toolbar-item","is-overflow-item","onTextSubmit","onButtonClick"])]),default:io(()=>[Ue.tooltip?(ye(),De("div",nH,[ss($t(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),De("span",rH,"(disabled)")):vt("",!0)])):vt("",!0)]),_:2},1032,["content-style"])):vt("",!0),C(Ue)&&e.overflowItems.length?(ye(),cn(EU,{key:5,"toolbar-item":Ue,"ui-font-family":s.uiFontFamily,onButtonClick:I=>k(Ue),"overflow-items":e.overflowItems,onClose:B,onCommand:ke[2]||(ke[2]=I=>n("command",I))},null,8,["toolbar-item","ui-font-family","onButtonClick","overflow-items"])):vt("",!0)],42,QU))),128))],36))}},ag=pn(oH,[["__scopeId","data-v-8d7a9de1"]]),iH=[["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"]],sH=iH.map(([e,t])=>({label:e,key:e,props:{style:{fontFamily:`${e}, ${t}`},"data-item":"btn-fontFamily-option"}}));function aH(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 lH=[{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"}}],wh={sm:768,md:1024,lg:1280,xl:1410},p2={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"},JI={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"},eE=Object.values(JI),LK=[...new Set([...Object.values(p2),...eE])],cH=new Set(["link"]),DK=new Set(Object.keys(p2).filter(e=>!cH.has(e)));Bt(),bn();var uH="Arial, Helvetica, sans-serif",dH={__name:"Toolbar",emits:["command","toggle","select"],setup(e,{emit:t}){const{proxy:n}=hr();let r=re(1);const o=re(0),i=re(!1);let s=null,a=null;const l=Se(()=>{const W=n?.$toolbar?.config?.uiDisplayFallbackFont;return typeof W=="string"&&W.trim()?W.trim():uH}),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(z=>!f.includes(z.name.value))),m=()=>{i.value=n.$toolbar.getAvailableWidth()<=wh.lg},v=nU(async()=>{await n.$toolbar.onToolbarResize(),m(),r.value+=1},300),C=()=>{r.value+=1},w=()=>{o.value+=1};function _(){window.removeEventListener("resize",v),n.$toolbar.off?.("toolbar-items-changed",C),n.$toolbar.off?.("toolbar-state-change",w),s?.disconnect(),s=null}function y(){_(),window.addEventListener("resize",v),n.$toolbar.on?.("toolbar-items-changed",C),n.$toolbar.on?.("toolbar-state-change",w),typeof ResizeObserver<"u"&&n.$toolbar.config?.responsiveToContainer&&n.$toolbar.toolbarContainer&&(s=new ResizeObserver(()=>{v()}),s.observe(n.$toolbar.toolbarContainer)),m()}Bn(y),kv(y),Sv(_),ar(_);const k=()=>{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:z,option:V})=>{M(),n.$toolbar.emitCommand({item:W,argument:z,option:V})},M=()=>{const W=n.$toolbar.activeEditor;if(!W)return;const z=n.$toolbar.pendingSelectionCapture??a;if(z&&typeof n.$toolbar.ui?.selection?.restore=="function"){n.$toolbar.ui.selection.restore(z);return}W.commands?.restoreSelection?.()},B=W=>{k(),XI(W)};return(W,z)=>(ye(),De("div",{class:"superdoc-toolbar",key:Qe(r),role:"toolbar","aria-label":"Toolbar","data-sd-part":"toolbar","data-editor-ui-surface":"",onMousedown:B},[Qe(u)?(ye(),cn(ag,{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),Qt(ag,{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(),cn(ag,{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))}},fH=pn(dH,[["__scopeId","data-v-ed19716b"]]),hH=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"}}};Bt();var Ln=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(al()),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),m=re(!1),g=re(e.style),v=re(e.isNarrow),C=re(e.isWide),w=re(e.minWidth),_=re(e.layoutWidth),y=re(e.suppressActiveHighlight||!1),k=re(e.argument),T=re(null),M=re(null),B=re(e.iconColor),W=re(e.hasCaret),z=re(!!e.splitButton),V=e.splitButtonCommand,Z=!!e.restoreEditorFocus,R=re(e.dropdownStyles),K=re(e.tooltip),x=re(e.tooltipVisible),G=re(e.tooltipTimeout),H=re(e.defaultLabel),J=re(e.label),Q=re(e.hideLabel),X=re(e.inlineTextInputVisible),Te=re(e.hasInlineTextInput),de=re(e.markName),ge=re(e.labelAttr),ve=re(e.selectedValue),Re=re(e.dropdownValueKey),Be=re(e.inputRef||null),tt=re([]);if(e.options){if(!Array.isArray(e.options))throw new Error("Invalid toolbar item options - "+e.options);let ae=0;for(let N=0;N<e.options.length;N+=1){const Y=e.options[N];(!Y||typeof Y!="object")&&(ae+=1)}if(ae)throw new Error(`Toolbar item options must all be objects - ${e.name}. ${ae} row(s) are not, so this item is skipped.`);tt.value?.push(...e.options)}const ut=(ae={},...N)=>{ke(ae,...N),!y.value&&(p.value=!0)},dt=()=>{Ue(),p.value=!1},_t=ae=>{f.value=ae},se=()=>{f.value=d},ke=e.onActivate||(()=>null),Ue=e.onDeactivate||(()=>null),ne=()=>{const ae={};return Object.keys(I).forEach(N=>{I[N].value!==void 0&&(ae[N]=I[N].value)}),ae},I={id:t,name:r,type:n,command:o,noArgumentCommand:i,icon:s,tooltip:K,group:a,attributes:u,disabled:f,active:p,expand:m,nestedOptions:tt,style:g,isNarrow:v,isWide:C,minWidth:w,layoutWidth:_,argument:k,parentItem:M,iconColor:B,hasCaret:W,splitButton:z,splitButtonCommand:V,dropdownStyles:R,tooltipVisible:x,tooltipTimeout:G,defaultLabel:H,label:J,hideLabel:Q,inlineTextInputVisible:X,hasInlineTextInput:Te,restoreEditorFocus:Z,markName:de,labelAttr:ge,childItem:T,allowWithoutEditor:l,dropdownValueKey:Re,selectedValue:ve,inputRef:Be};return{...I,initiallyDisabled:d,unref:ne,activate:ut,deactivate:dt,setDisabled:_t,resetDisabled:se,onActivate:ke,onDeactivate:Ue}};Bt(),bn();var pH=["onClick","innerHTML","aria-label","onKeydown"],mH={__name:"AlignmentButtons",emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=fs(),r=t,o=re([]),i=[{key:"left",ariaLabel:"Align left",icon:rr.alignLeft},{key:"center",ariaLabel:"Align center",icon:rr.alignCenter},{key:"right",ariaLabel:"Align right",icon:rr.alignRight},{key:"justify",ariaLabel:"Justify",icon:rr.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 Bn(()=>{const d=o.value[0];d&&(d.setAttribute("tabindex","0"),d.focus())}),(d,f)=>(ye(),De("div",{class:tn(["alignment-buttons",{"high-contrast":Qe(n)}])},[(ye(),De(qt,null,nr(i,(p,m)=>He("div",{key:p.key,class:"sd-button-icon",onClick:g=>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:en(g=>u(g,m),["prevent"])},null,40,pH)),64))],2))}},gH=pn(mH,[["__scopeId","data-v-13e5f7a4"]]);Bt(),bn();var vH=["onClick","innerHTML","aria-label","onKeydown"],yH={__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}=fs(),r=t,o=e,i=re([]),s=Se(()=>({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 Bn(()=>{const f=i.value[0];f&&(f.setAttribute("tabindex","0"),f.focus())}),(f,p)=>(ye(),De("div",{class:tn(["style-buttons-list",{"high-contrast":Qe(n)}])},[(ye(!0),De(qt,null,nr(o.buttons,(m,g)=>(ye(),De("div",{key:m.key,class:tn(["sd-button-icon",{"sd-selected":o.selectedStyle===m.key}]),style:wn(s.value),onClick:v=>a(m.key),innerHTML:m.icon,role:"menuitem","aria-label":m.ariaLabel,ref_for:!0,ref_key:"buttonRefs",ref:i,onKeydown:en(v=>d(v,g),["prevent"])},null,46,vH))),128))],2))}},tE=pn(yH,[["__scopeId","data-v-44f37ff6"]]),bH=[{key:"disc",icon:rr.bulletListDisc,ariaLabel:"Opaque circle"},{key:"circle",icon:rr.bulletListCircle,ariaLabel:"Outline circle"},{key:"square",icon:rr.bulletListSquare,ariaLabel:"Opaque square"}],wH=[{key:"decimal",icon:rr.numberedListDecimal,ariaLabel:"1. 2. 3."},{key:"decimal-paren",icon:rr.numberedListDecimalParen,ariaLabel:"1) 2) 3)"},{key:"upper-roman",icon:rr.numberedListUpperRoman,ariaLabel:"I. II. III."},{key:"lower-roman",icon:rr.numberedListLowerRoman,ariaLabel:"i. ii. iii."},{key:"upper-alpha",icon:rr.numberedListUpperAlpha,ariaLabel:"A. B. C."},{key:"upper-alpha-paren",icon:rr.numberedListUpperAlphaParen,ariaLabel:"A) B) C)"},{key:"lower-alpha",icon:rr.numberedListLowerAlpha,ariaLabel:"a. b. c."},{key:"lower-alpha-paren",icon:rr.numberedListLowerAlphaParen,ariaLabel:"a) b) c)"}];Bt(),bn();var CH=["onClick","onKeydown"],kH={class:"document-mode-column icon-column"},SH=["innerHTML"],_H={class:"document-mode-column text-column"},AH={class:"document-mode-type"},IH={class:"document-mode-description"},EH={__name:"DocumentMode",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=re([]),{isHighContrastMode:o}=fs(),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 Bn(()=>{r.value[0].setAttribute("tabindex","0"),r.value[0].focus()}),(d,f)=>(ye(),De("div",{class:tn(["document-mode",{"high-contrast":Qe(o)}])},[(ye(!0),De(qt,null,nr(e.options,(p,m)=>(ye(),De("div",{class:tn(["sd-option-item",{"sd-disabled":p.disabled}]),onClick:g=>s(p),"data-item":"btn-documentMode-option",role:"menuitem",ref_for:!0,ref_key:"documentModeRefs",ref:r,onKeydown:en(g=>u(g,m),["prevent"])},[He("div",kH,[He("div",{class:"icon-column__icon",innerHTML:p.icon},null,8,SH)]),He("div",_H,[He("div",AH,$t(p.label),1),He("div",IH,$t(p.description),1)])],42,CH))),256))],2))}},TH=pn(EH,[["__scopeId","data-v-bee14d7a"]]);Bt(),bn();var xH={class:"linked-style-buttons","data-editor-ui-surface":""},RH=["onClick","onKeydown","aria-label"],MH={__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 m=r.value[p+1];m.setAttribute("tabindex","0"),m.focus()},a=p=>{if(p===0)return;const m=r.value[p-1];m.setAttribute("tabindex","0"),m.focus()},l=(p,m,g)=>{switch(p.key){case"ArrowDown":s(m);break;case"ArrowUp":a(m);break;case"Enter":p.preventDefault(),i(g);break;default:break}},u=p=>p?.name??p?.id??"",d=p=>{const m=p?.preview?.css;return m&&typeof m=="object"?m:void 0},f=()=>{r.value[0]&&(r.value[0].setAttribute("tabindex","0"),r.value[0].focus())};return Bn(f),Vt(()=>o.styles.length,async(p,m)=>{p===0||m!==0||(await St(),f())}),(p,m)=>(ye(),De("div",xH,[(ye(!0),De(qt,null,nr(o.styles,(g,v)=>(ye(),De("div",{key:g.id??v,class:tn(["style-item",{selected:e.selectedOption===g.id}]),onClick:C=>i(g),onKeydown:C=>l(C,v,g),"aria-label":`Linked style - ${g.id??u(g)}`,ref_for:!0,ref_key:"styleRefs",ref:r},[He("div",{class:"style-name","data-item":"btn-linkedStyles-option",style:wn(d(g))},$t(u(g)),5)],42,RH))),128))]))}},LH=pn(MH,[["__scopeId","data-v-74c8924b"]]);Bt(),bn();var DH=["placeholder"],OH={class:"sd-ai-writer__footer"},PH={key:0,class:"sd-ai-writer__error",role:"alert"},FH=["disabled"],NH="https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights",BH="You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.",zH={__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=Se(()=>t.selectedText?"Insert prompt to update text":"Insert prompt to generate text"),a=Se(()=>n.value.trim().length>0&&!r.value);Bn(()=>{St(()=>{i.value?.focus()})});function l(g){if(typeof g=="string")return g;if(!g||typeof g!="object")return"";const v=g.custom_prompt;if(Array.isArray(v)){const C=v[0];if(C&&typeof C.value=="string")return C.value}return v&&typeof v=="object"&&typeof v.value=="string"?v.value:typeof g.value=="string"?g.value:typeof g.text=="string"?g.text:""}async function u(g){const v={"Content-Type":"application/json"};t.apiKey&&(v["x-api-key"]=t.apiKey);const C=t.selectedText.trim(),w=C?`Rewrite the following text: "${C}" using these instructions: ${g}`:`Generate text based on the following prompt: ${g}`,_=await fetch(t.endpoint||NH,{method:"POST",headers:v,body:JSON.stringify({stream:!1,context:BH,insights:[{type:"custom_prompt",name:C?"text_rewrite":"text_generation",message:w,format:[{value:""}]}]})});if(!_.ok){const k=await _.text().catch(()=>"");throw new Error(k||`AI request failed with ${_.status}`)}const y=l((_.headers.get("content-type")||"").includes("application/json")?await _.json():await _.text()).trim();if(!y)throw new Error("AI returned no text.");return y}function d(g){return!g||typeof g!="object"?!0:!(g.success===!1||g.ok===!1)}function f(g){const v=t.doc;if(!v)throw new Error("Document API is unavailable.");t.restoreSelection?.();let C=null,w=!1;if(t.selectedText&&t.target&&typeof v.replace=="function"?(C=v.replace({target:t.target,text:g}),w=!0):t.target&&typeof v.insert=="function"?(C=v.insert({target:t.target,value:g,type:"text"}),w=!0):typeof v.insert=="function"&&(C=v.insert({value:g,type:"text"}),w=!0),!w)throw new Error("Document text insertion is unavailable.");if(!d(C))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(g){o.value=g instanceof Error?g.message:String(g)}finally{r.value=!1}}}function m(g){g.key!=="Enter"||g.shiftKey||(g.preventDefault(),p())}return(g,v)=>(ye(),De("form",{class:"sd-ai-writer","data-item":"ai-writer",onSubmit:en(p,["prevent"])},[ka(He("textarea",{ref_key:"textareaRef",ref:i,"onUpdate:modelValue":v[0]||(v[0]=C=>n.value=C),class:"sd-ai-writer__input",placeholder:s.value,rows:"4",onKeydown:m},null,40,DH),[[ji,n.value]]),He("div",OH,[o.value?(ye(),De("p",PH,$t(o.value),1)):vt("",!0),He("button",{class:"sd-ai-writer__submit",type:"submit",disabled:!a.value},$t(r.value?"Generating":"Generate"),9,FH)])],32))}},jH=pn(zH,[["__scopeId","data-v-67f6c6f7"]]);Bt(),bn();var VH=["aria-label","onClick","onKeydown"],UH=["innerHTML"],HH=["innerHTML"],lg=7,$H={__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=Se(()=>g=>r.activeColor.value?r.activeColor.value.toUpperCase()===g.value:!1),i=(g,v)=>v===5||["#FFFFFF","#FAFF09"].includes(g)?{color:"#000"}:{color:"#FFF"},s=g=>{n("select",g.value)},a=re([]),l=re([]);Bn(()=>{if(!r.icons.every(v=>Array.isArray(v)))throw new Error("icon props must be 2d array");const g=l.value[0];g&&(g.setAttribute("tabindex","0"),g.focus({preventScroll:!0}))});const u=(g,v)=>{const C=lg*g+v+1,w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},d=(g,v)=>{const C=lg*g+v-1,w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},f=(g,v)=>{const C=v+lg*(g+1),w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},p=(g,v)=>{const C=v+lg*(g-1),w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},m=(g,v,C,w)=>{switch(g.key){case"ArrowRight":u(v,C);break;case"ArrowLeft":d(v,C);break;case"ArrowDown":f(v,C);break;case"ArrowUp":p(v,C);break;case"Enter":s(w);break;case"Escape":n("clickoutside");break;default:break}};return(g,v)=>(ye(!0),De(qt,null,nr(e.icons,(C,w)=>(ye(),De("div",{class:"sd-option-row",key:w,role:"group",ref_for:!0,ref_key:"rowRefs",ref:a},[(ye(!0),De(qt,null,nr(C,(_,y)=>(ye(),De("div",{class:"sd-option",key:y,"aria-label":_.label,role:"menuitem",ref_for:!0,ref_key:"iconRefs",ref:l,onClick:en(k=>s(_),["stop","prevent"]),onKeydown:en(k=>m(k,w,y,_),["prevent"])},[He("div",{class:"sd-option__icon",innerHTML:_.icon,style:wn(_.style)},null,12,UH),o.value(_)?(ye(),De("div",{key:0,class:"sd-option__check",innerHTML:Qe(rr).colorOptionCheck,style:wn(i(_.value,y))},null,12,HH)):vt("",!0)],40,VH))),128))]))),128))}},nE=pn($H,[["__scopeId","data-v-05eb02fc"]]),GH=`<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
  `;Bt(),bn();var WH={class:"options-grid-wrap"},KH=["innerHTML"],qH={class:"option-grid-ctn"},YH={__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",WH,[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(GH),class:"none-icon"},null,8,KH),i[1]||(i[1]=ss(" None ",-1))])):vt("",!0),He("div",qH,[Qt(nE,{icons:e.icons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"]),e.customIcons.flat().length?(ye(),De(qt,{key:0},[i[2]||(i[2]=He("span",{class:"option-grid-ctn__subtitle"},"Custom colors",-1)),Qt(nE,{icons:e.customIcons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"])],64)):vt("",!0)])]))}},XH=pn(YH,[["__scopeId","data-v-52b0283a"]]);Bt();var ZH=e=>{e.expand.value=!1},Wt=(e,t=null)=>({label:t,icon:rr.colorOption,value:e,style:{color:e,boxShadow:"0 0 5px 1px rgba(0, 0, 0, 0.1)",borderRadius:"50%"}}),m2=(e,t,n=[],r=!1)=>{const o=i=>{t.iconColor.value=i,e.emitCommand({item:t,argument:i}),ZH(t),Bc(e)};return zr("div",{},[zr(XH,{icons:QH,customIcons:n,activeColor:t.iconColor,hasNoneIcon:r,onSelect:o})])},QH=[[Wt("#111111","black"),Wt("#333333","dark gray"),Wt("#5C5C5C","medium gray"),Wt("#858585","light gray"),Wt("#ADADAD","very light gray"),Wt("#D6D6D6","transparent gray"),Wt("#FFFFFF","white")],[Wt("#860028","dark red"),Wt("#D2003F","red"),Wt("#DB3365","coral red"),Wt("#E4668C","light red"),Wt("#ED99B2","pale pink"),Wt("#F6CCD9","transparent pink"),Wt("#FF004D","bright pink")],[Wt("#83015E","dark purple"),Wt("#CD0194","purple"),Wt("#D734A9","orchid"),Wt("#E167BF","light purple"),Wt("#EB99D4","lavender"),Wt("#F5CCEA","transparent pink"),Wt("#FF00A8","neon pink")],[Wt("#8E220A","maroon"),Wt("#DD340F","red-orange"),Wt("#E45C3F","burnt orange"),Wt("#EB856F","peach"),Wt("#F1AE9F","pale peach"),Wt("#F8D6CF","transparent peach"),Wt("#FF7A00","orange")],[Wt("#947D02","olive"),Wt("#E7C302","mustard yellow"),Wt("#ECCF35","yellow"),Wt("#F1DB67","light yellow"),Wt("#F5E79A","very pale yellow"),Wt("#FAF3CC","transparent yellow"),Wt("#FAFF09","neon yellow")],[Wt("#055432","forest green"),Wt("#07834F","green"),Wt("#399C72","medium green"),Wt("#6AB595","light green"),Wt("#9CCDB9","mint"),Wt("#CDE6DC","transparent mint"),Wt("#05F38F","bright teal")],[Wt("#063E7E","navy blue"),Wt("#0A60C5","blue"),Wt("#3B80D1","sky blue"),Wt("#6CA0DC","cornflower blue"),Wt("#9DBFE8","light blue"),Wt("#CEDFF3","very light blue"),Wt("#21c8ce","cyan")],[Wt("#3E027A","deep purple"),Wt("#6103BF","indigo"),Wt("#8136CC","violet"),Wt("#A068D9","lavender pink"),Wt("#C09AE6","light lilac"),Wt("#DFCDF2","transparent lilac"),Wt("#A91DFF","neon purple")]];Bt(),bn();var JH=["data-cols","data-rows","onKeydown","onClick"],e$=["aria-valuetext"],cg=5,t$={__name:"TableGrid",emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=re(0),o=re(0),{isHighContrastMode:i}=fs(),s=re([]),a=f=>{let p=f.target;if(p.dataset.grid)return;let m=[...p.parentElement.querySelectorAll("[data-item]")],g=parseInt(p.dataset.cols,10),v=parseInt(p.dataset.rows,10);l(m,g,v)},l=(f,p,m)=>{o.value=p,r.value=m;for(let g=0;g<f.length;g++){let v=f[g],C=parseInt(v.dataset.cols,10),w=parseInt(v.dataset.rows,10);C<=p&&w<=m?v.classList.add("sd-selected"):v.classList.remove("sd-selected")}},u=({cols:f,rows:p})=>{n("select",{cols:f,rows:p})},d=(f,p,m)=>{let g=p-1,v=m-1;switch(f.key){case"ArrowRight":{if(g>=4)return;const C=v*cg;s.value[C+g+1].setAttribute("tabindex","0"),s.value[C+g+1].focus(),l(s.value,p+1,m);break}case"ArrowLeft":{if(g<=0)return;const C=v*cg;s.value[C+g-1].setAttribute("tabindex","0"),s.value[C+g-1].focus(),l(s.value,p-1,m);break}case"ArrowDown":{if(v>=4)return;const C=(v+1)*cg;s.value[C+g].setAttribute("tabindex","0"),s.value[C+g].focus(),l(s.value,p,m+1);break}case"ArrowUp":{if(v<=0)return;const C=(v-1)*cg;s.value[C+g].setAttribute("tabindex","0"),s.value[C+g].focus(),l(s.value,p,m-1);break}case"Enter":u({cols:p,rows:m});break;default:break}};return Bn(()=>{s.value[0].setAttribute("tabindex","0"),s.value[0].focus(),l(s.value,1,1)}),(f,p)=>(ye(),De("div",{class:tn(["toolbar-table-grid-wrapper",{"high-contrast":Qe(i)}])},[He("div",{class:"toolbar-table-grid",onMouseover:a,"data-grid":"true"},[(ye(),De(qt,null,nr(5,m=>(ye(),De(qt,{key:m},[(ye(),De(qt,null,nr(5,g=>He("div",{class:"toolbar-table-grid__item",key:`${m}_${g}`,"data-cols":g,"data-rows":m,"data-item":"true",ref_for:!0,ref_key:"tableGridItems",ref:s,onKeydown:en(v=>d(v,g,m),["prevent"]),onClick:en(v=>u({cols:g,rows:m}),["stop","prevent"])},null,40,JH)),64))],64))),64))],32),He("div",{class:"toolbar-table-grid-value","aria-valuetext":`${r.value} x ${o.value}`},$t(r.value)+" x "+$t(o.value),9,e$)],2))}},n$=pn(t$,[["__scopeId","data-v-b87d6ca2"]]);Bt(),bn();var r$={class:"toolbar-table-actions"},o$=["onClick","data-item","ariaLabel"],i$={class:"toolbar-table-actions__icon"},s$=["innerHTML"],a$={class:"toolbar-table-actions__label"},l$={__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",r$,[(ye(!0),De(qt,null,nr(e.options,s=>(ye(),De("div",{class:tn(["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",i$,[He("div",{class:"toolbar-table-actions__icon-wrapper",innerHTML:s.icon},null,8,s$)]),He("div",a$,$t(s.label),1)],10,o$))),256))]))}},c$=pn(l$,[["__scopeId","data-v-0cdad084"]]),u$=`<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
- `;Bt();var Qs=e=>{e.expand.value=!1},g2=(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 v2(e,t){const n={...e};return t?n.href=t:delete n.href,n}function rE(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 d$(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function oE(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function f$(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function h$(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var p$=({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=Ln({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),p=(r??sH).map(hH),m=Ln({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:at}={},Ct=!1)=>{if(Ct){m.label.value="",m.selectedValue.value="";return}if(!at)return;at=at.split(",")[0];const zt=on=>on.value??on.label,Ut=p.find(on=>zt(on)===m.defaultLabel.value),Cn=p.find(on=>zt(on)===at);Cn?(m.label.value=Cn.label,m.selectedValue.value=Cn.key):Ut?(m.label.value=at,m.selectedValue.value=Ut.key):(m.label.value=at,m.selectedValue.value="")},onDeactivate:()=>{const at=p.find(Ct=>(Ct.value??Ct.label)===m.defaultLabel.value);m.label.value=at?.label??m.defaultLabel.value,m.selectedValue.value=at?.key??""}}),g=Ln({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(g)}]});function v(at){const Ct=oE(e),zt=Ct?.selectionTarget??rE(Ct?.target),Ut=Ct?.empty?"":d$(Ct),Cn=h$(e),on=()=>Qs(at),Mn=()=>{const an=e.pendingSelectionCapture;an&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(an)};return zr("div",{},[zr(jH,{handleClose:on,selectedText:Ut,target:zt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:Cn?.apiKey||e.config?.aiApiKey||"",endpoint:Cn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:Mn})])}const C=lH,w=Ln({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:C,onActivate:({fontSize:at},Ct=!1)=>{if(Ct){w.label.value="",w.selectedValue.value="";return}const zt=C.find(Mn=>Mn.label===String(w.defaultLabel.value));if(!at){w.label.value=w.defaultLabel.value,zt?w.selectedValue.value=zt.key:w.selectedValue.value="";return}let Ut=tU(at,12);Ut<8&&(Ut=8),Ut>96&&(Ut=96);let Cn=String(Ut);const on=C.find(Mn=>Mn.label===Cn||Mn.key===Cn);on?w.selectedValue.value=on.key:w.selectedValue.value="",w.label.value=Cn},onDeactivate:()=>{w.label.value=w.defaultLabel.value;const at=C.find(Ct=>Ct.label===String(w.defaultLabel.value));at?w.selectedValue.value=at.key:w.selectedValue.value=""}}),_=()=>Ln({type:"separator",name:"separator",isNarrow:!0}),y=Ln({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),k=Ln({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),T=Ln({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),M=Ln({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:()=>m2(e,M,[],!0)}],onActivate:({color:at})=>{M.iconColor.value=at||""},onDeactivate:()=>M.iconColor.value=""}),B=Ln({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:()=>m2(e,B)}],onActivate:({color:at})=>{B.iconColor.value=at},onDeactivate:()=>B.iconColor.value="#000"}),W=Ln({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),z=Ln({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>V(z)}],onActivate:({href:at})=>{z.attributes.value=v2(z.attributes.value,at)},onDeactivate:()=>{z.attributes.value=v2(z.attributes.value,null),z.expand.value=!1}});function V(at){const Ct=oE(e),zt=Ct?.selectionTarget??rE(Ct?.target),Ut=()=>{const Cn=e.pendingSelectionCapture;Cn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Cn)};return zr("div",{},[zr(SA,{ui:e.ui,linkItem:at,textTarget:zt,restoreSelection:Ut,closePopover:()=>{Qs(at),Bc(e)},goToAnchor:()=>{Qs(at);const Cn=at.attributes.value?.href;if(!Cn)return;const on=Cn.slice(1),Mn=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${on}']`);Mn&&_A(Mn)}})])}const Z=Ln({type:"options",name:"linkInput",command:"toggleLink",active:!1});z.childItem=Z,Z.parentItem=z;const R=Ln({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),K=Ln({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),x=Ln({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:()=>G(x)}]});function G(at){return zr("div",{},[zr(n$,{onSelect:zt=>{e.emitCommand({item:at,argument:zt}),Qs(at),Bc(e)}})])}const H=Ln({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(at){return zr(c$,{options:J,onSelect:Ct=>{Qs(at);const{command:zt}=Ct;e.emitCommand({item:at,argument:{command:zt}}),Bc(e)}})}const X=Ln({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(gH,{onSelect:Ct=>{Qs(X);const zt={...X,command:"setTextAlign"};zt.command="setTextAlign",e.emitCommand({item:zt,argument:Ct}),Te(X,Ct),Bc(e)}})]),key:"alignment"}],onActivate:({textAlign:at})=>{Te(X,at)},onDeactivate:()=>{Te(X,"left")}}),Te=(at,Ct)=>{let zt=Ct==="both"?"justify":Ct,Ut={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},Cn=Ut[zt]??Ut.left;at.icon.value=Cn},de=Ln({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 at=Ct=>{Qs(de);const zt={...de,command:"toggleBulletListStyle"};e.emitCommand({item:zt,argument:Ct})};return zr(tE,{buttons:bH,iconSize:25,selectedStyle:de.selectedValue.value,onSelect:at})}}]}),ge=Ln({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 at=Ct=>{Qs(ge);const zt={...ge,command:"toggleOrderedListStyle"};e.emitCommand({item:zt,argument:Ct})};return zr(tE,{buttons:wH,iconSize:30,selectedStyle:ge.selectedValue.value,onSelect:at})}}]}),ve=Ln({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Re=Ln({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Be=Ln({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),tt=Ln({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:at})=>{at&&(tt.label.value=at)}}),ut=Ln({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:at})=>{at&&(ut.label.value=at)}}),dt=Ln({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),_t=Ln({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),se=Ln({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),ke=Ln({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Ue=Ln({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),ne=Ln({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),I=(at,Ct)=>at==="editor"?Ct:at==="suggester"?Ct.filter(zt=>zt.value==="suggesting"):Ct.filter(zt=>zt.value==="viewing"),ae=at=>at==="editor"?"Editing":at==="suggester"?"Suggesting":"Viewing",N=Ln({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:ae(s),label:ae(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:()=>U(N)}]}),Y=[{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 U(at){return zr(TH,{options:I(s,Y),onSelect:Ct=>{const zt=e.superdoc?.activeEditor??e.activeEditor;Qs(at);const{label:Ut,icon:Cn,value:on}=Ct;N.label.value=Ut,N.icon.value=Cn,e.emitCommand({item:N,argument:on}),Bc(e,zt)}})}const ie=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"],L=Ln({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),F=Ln({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),fe=Ln({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 at=zt=>{Qs(fe);const Ut=typeof zt=="string"?zt:zt?.id??null;if(!Ut)return;const Cn={...fe,command:"setLinkedStyle"};e.emitCommand({item:Cn,argument:Ut})},Ct=e.getActiveLinkedStyleId?.()??null;return zr("div",{},[zr(LH,{styles:e.getLinkedStyleOptions?.()??[],onSelect:at,selectedOption:Ct})])}}],onActivate:({styleId:at,styleName:Ct})=>{const zt=Ct||at;fe.label.value=at&&at!=="Normal"?String(zt):n.formatText,fe.disabled.value=!1},onDeactivate:()=>{fe.disabled.value=!0,fe.label.value=n.formatText}}),Ce=(at,Ct)=>{if(Ct.value==at)return zr("div",{innerHTML:u$,class:"dropdown-select-icon"})},_e=Ln({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(at=>({label:at.toFixed(2),key:at,icon:()=>Ce(at,_e.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),Pe=20,We=32,it=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],ht=["zoom","fontFamily","fontSize","redo"],Lt=i<=wh.lg,Tt=e.config?.showFormattingMarksButton===!0,Yt=e.config?.showTableOfContentsButton===!0;Lt&&(N.attributes.value={...N.attributes.value,className:`${N.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),Lt&&(fe.attributes.value={...fe.attributes.value,className:`${fe.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Fe=[dt,_t,se,ke,W,tt,m,_(),w,_(),f,y,k,T,B,M,_(),z,R,...Yt?[K]:[],x,H,_(),X,de,ge,ve,Re,_e,_(),fe,_(),L,ut,...Tt?[F]:[],ne,Ue,...f$(e)?[g]:[],Be,N,...d];if(i<=wh.md&&o&&(Fe=Fe.filter(at=>at.type!=="separator")),e.config.mode!=="docx"){const at=Fe.findIndex(zt=>zt.name.value==="linkedStyles");Fe.splice(at-1,2);const Ct=["ruler","zoom","undo","redo"];Fe=Fe.filter(zt=>!Ct.includes(zt.name.value))}const rn=[];a||(s==="viewer"&&rn.push(se,ke),Fe=Fe.filter(at=>!rn.includes(at))),l&&(Fe=Fe.filter(at=>at.name.value==="overflow"||at.isCustomToolbarItem||l.has(at.name.value))),u?.size&&(Fe=Fe.filter(at=>!u.has(at.name.value)));const Dn=at=>be.includes(at.name.value),Kt=Fe.find(at=>at.name.value==="overflow"),Rn=Fe.filter(at=>at!==Kt),Lr=at=>{const Ct=[],zt=[],Ut=Rn.filter(Dn).reduce((on,Mn)=>on+g2(Mn,ie),0);let Cn=We+Ut+(at&&Kt?g2(Kt,ie):0);return Rn.forEach((on,Mn)=>{const an=g2(on,ie);if(on.type==="separator"&&Rn[Mn-1]?.name.value==="linkedStyles"&&Ct.includes(Rn[Mn-1])){Ct.push(on);return}if(i<wh.xl+Pe&&it.includes(on.name.value)&&o){Ct.push(on);return}if(i<wh.sm&&ht.includes(on.name.value)&&o){Ct.push(on);return}if(Dn(on)){zt.push(on);return}Cn+an<=i||!o?(zt.push(on),Cn+=an):Ct.push(on)}),{visibleItems:zt,overflowItems:Ct}};let{visibleItems:yr,overflowItems:Dr}=Lr(!1);if(o&&Kt&&Dr.some(at=>at.type!=="separator")){({visibleItems:yr,overflowItems:Dr}=Lr(!0));const at=Fe.indexOf(Kt),Ct=yr.findIndex(zt=>Fe.indexOf(zt)>at);Ct===-1?yr.push(Kt):yr.splice(Ct,0,Kt)}return{defaultItems:yr,overflowItems:Dr.filter(at=>at.type!=="separator")}},iE={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"},m$=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Bt();function sE(e){return KV(e)??p2[e]??null}function ug(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=r.firstParty?s_(e,t,n):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 g$=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),v$=new Set(["list","numberedlist"]);function y$(e,t){if(e==="fontFamily"||e==="fontSize"||v$.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!g$.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function aE(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function b$(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var w$=new Set([...WV,...Object.keys(tg),"ai","overflow","tableOfContents"]),C$=class extends jg.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...rr},texts:{...iE},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={...rr,...e.icons},this.config.texts={...iE,...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=m$(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.#c(),this.#i(),this._lastFontOptionsSignature=this.#r(),!this.toolbarContainer){this.updateToolbarState();return}this.app=wc(fH),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.#m(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#w():this.#y()}))}#o(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#y();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.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),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}#f(e){return e||aH(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#c(){const e=this.getAvailableWidth(),t=new Map(this.#s().filter(C=>C.isCustomToolbarItem&&C.type==="dropdown").map(C=>[C.name.value,C.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(C=>C)):null,o=new Set(this.config.excludeItems),i=this.config.customButtons||[],s=new Set(w$),a=i.map((C,w)=>{try{if(C?.name&&s.has(C.name))throw new Error(`Toolbar item name "${C.name}" is already taken by another item, so this entry is skipped.`);const _=this.#d(C);return t.has(_.name.value)&&(_.selectedValue.value=t.get(_.name.value)),s.add(_.name?.value),_}catch(_){const y=`${C?.name??`<unnamed@${w}>`}::${_?.message??String(_)}`;return this._reportedInvalidCustomItems.has(y)||(this._reportedInvalidCustomItems.add(y),this.#v(_,C?.name??null)),null}}).filter(Boolean),l=n?new Set(Object.keys(this.config.groups)):null,u=l?a.filter(C=>l.has(C.group?.value||"center")):a,{defaultItems:d,overflowItems:f}=p$({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#f(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(C=>C.name.value),...f.map(C=>C.name.value)];if(n){const C=Object.values(this.config.groups).flatMap(_=>_),w=a.filter(_=>l.has(_.group?.value||"center")).map(_=>_.name.value);p=[...new Set([...C,...w])]}const m=f.filter(C=>p.includes(C.name.value)&&!o.has(C.name.value)),g=m.length?[...p,"overflow"]:p,v=d.filter(C=>g.includes(C.name.value)).filter(C=>!o.has(C.name.value));if(n)for(const[C,w]of Object.entries(this.config.groups))for(const _ of v)w.includes(_.name.value)&&(_.group.value=C);this.toolbarItems=v,this.overflowItems=m}#d(e){const t=Ln({...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.#v(l,e.name),!1)):a}catch(a){return this.#v(a,e.name),!1}}});this._customCommandRegs.set(r,o)}}return t}#p(){this.#c(),this.emit("toolbar-items-changed")}#r(){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.#m(),this._linkedStyleOptions.value}#m(){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.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#c(),this.updateToolbarState()};#_(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}#g(){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)}#b(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>m2(this,e,[],!0)};e.nestedOptions.value=[t]}#A(e){return!!e?.active&&e?.value==null}#T(e){return!!e&&e.disabled===!1&&e.value==null}#I(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=eE.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(f2(t)?.disposition==="host-routed")return e.setDisabled(!this.#k(t)),this.#_(t)?e.activate():e.deactivate(),!0;const n=sE(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];y$(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.#g()},link:()=>{e.active.value=!!r?.active,e.attributes.value=v2(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#T(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#A(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.#g(),this.#b();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#F(),this.#s().forEach(n=>{const r=n.isCustomToolbarItem&&typeof n.command=="string";(n.allowWithoutEditor?.value||r)&&this.#I(n)})):this.#s().forEach(n=>{n.resetDisabled(),this.#I(n)});const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#F(){this.#s().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#x(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}#D(e,t){const n=e?.name?.value;if(!n)return!1;const r={firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:i=>this.#v(i,n)};if(n==="image"&&t==null)return this.#O();if(n==="tableActions"){const i=JI[t?.command];return i?ug(this.ui,i,void 0,r):!1}if(f2(n)?.disposition==="unsupported")return!0;const o=sE(n);return o?ug(this.ui,o,t,r):!1}#O(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=eU({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await QV(e,this.superdoc?.config?.handleImageUpload);ug(this.ui,"image",{src:t},{firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:n=>this.#v(n,"image")})},onError:e=>this.#v(e,"image")})),this.#e.open()),!0}#w(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{aE(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!aE(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}b$(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)}}#y(){this.#n&&(this.#n(),this.#n=null)}#v(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(f2(r)?.disposition==="host-routed"){this.#x(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.#v(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!ug(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#v(s,r),reportUnhandled:!0}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#D(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#v(s,r)}}}destroy(){this.#y(),this.#e?.destroy(),this.#e=null,this.#a(),this.#o(),this.app?.unmount(),this.app=null,this.toolbar=null}};function k$(e){return new C$(e)}Bt();var S$=['[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(", "),_$=800,lE=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,cE=e=>{if(!lE)return!1;try{return lE.call(e),!0}catch{return!1}};function A$(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 I$=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"]),E$=["original","markup","final"],T$=["review","original","final","off"];function uE(e){return E$.includes(e)}function x$(e){return e==="markup"?"review":e}function dE(e){return T$.includes(e)}function R$(e){const t=e.modules?.trackChanges?.mode;if(dE(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return dE(n)?n:null}function dg(e,t){const n=e.viewing,r=uE(n?.trackedChanges)?n.trackedChanges:null,o=r?x$(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 M$(e,t){const n=new g5.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function y2(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function fE(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function L$(e,t){if(!e)return()=>{};if(y2(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=()=>{fE(e),s()},l=u=>{u!==!1&&(u===!0||y2(e))&&(fE(e),s())};return n("synced",a),n("sync",l),y2(e)&&s(),i}function D$(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(S$));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(zp.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 O$(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function hE(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 pE(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function P$(e,t){switch(e.state){case"failed":return"failed";case"degraded":return e.detail==="reconnecting"?"reconnecting":"lost";case"synced":return t?"recovered":"initial";default:return t?"reconnecting":"initial"}}function Yo(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function mE(e){return typeof e=="string"&&e.length>0?e:null}function gE(e){return e?Yo(e)?mE(e.documentId??e.options?.documentId??null):mE(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function F$(e){if(!e||Yo(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function ys(e){if(!e)return null;if(Yo(e))return e.fonts??null;const t=F$(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 fg=class extends jg.default{static{this.allowedTypes=[pr,Ma,Eu]}#e;#n;#t;#o;#i;#a;#u;#f;#c;#d;#p;#r;#s;#m;#_;#k;#g;#b;#A;#T;#I;#F;#x;#D;#O;#w;#y;get uiConfig(){return this.#y}#v;get interactionConfig(){return this.#v}#N;get surfacesConfig(){return this.#N}#E;#h;#R;#M;#L;constructor(e){if(super(),this.#e=!1,this.#t=!1,this.#o=null,this.#i=null,this.#a=null,this.#u=null,this.#f=null,this.#c=null,this.#d=!1,this.#p=null,this.#r=null,this.#s=null,this.#m=null,this.#_=!1,this.#k=!1,this.#g=null,this.#b=null,this.#A=!1,this.#T=null,this.#I=null,this.#F=n=>{this.listenerCount("content-control:active-change")>0&&(this.#A||(this.#T=n.pointerId),this.#A=!0,this.#g="pointer",this.#b=null)},this.#x=n=>{n.pointerId===this.#T&&(this.#A=!1,this.#T=null,this.#g??="pointer",this.#g==="pointer"&&(this.#b=Date.now()+_$))},this.#D=n=>{this.listenerCount("content-control:active-change")>0&&!A$(n)&&(this.#g="keyboard",this.#b=null)},this.#O=n=>{this.#X(n)},this.#w=null,this.#y=jI({}),this.#v=VI({}),this.#N=HI({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#h=new $V,this.#R=null,this.#M=!1,this.#L=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...u2},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.#ne=new WeakSet,this.#re=new WeakMap,this.#oe=null,this.#K=null,this.#j=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=fT(this,e,()=>this.version,t),this.#E=new pV({getModuleConfig:()=>this.#N}),this.#s=t,t.addEventListener("pointerdown",this.#F,!0),t.ownerDocument.addEventListener("pointerup",this.#x,!0),t.ownerDocument.addEventListener("pointercancel",this.#x,!0),t.addEventListener("keydown",this.#D,!0),t.addEventListener("click",this.#O,!0),this.#l("content-control:active-change",e.onContentControlActiveChange),this.#S(e,t),this.#k=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#X(e){const t=this.#s;if(!t)return;const n=D$(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=hE(O$(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#S(e,t){this.#L=R$(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),c2(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.#Ue(),this.config.user=IV(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=E_(this.config.modules.comments),this.#y=jI(this.config),this.#v=VI(this.config),this.#N=HI(this.config),this.config.disableContextMenu=!this.#y.contextMenu.enabled,this.config.rulers=this.#y.ruler.enabled,this.#y.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#y.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&(i.readOnly=this.#v.comments.readOnly,i.allowResolve=this.#v.comments.allowResolve)}if(this.config.colors=_5(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.18.1-next.3",this.#ie("πŸ¦‹ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||al(),this.colors=this.config.colors??[],this.#Z(),await $7(),this.#e)return;if(await this.#ee(this.config.modules),this.#e){this.#we();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.#R||(this.#R=this.#h.subscribe(i=>{this.#$e(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.#r=o,this.#J(),this.#V(),this.#Ge(),this.#P()}#P(){if(this.#Q(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#r)}#V(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new jB({Renderer:dV,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#C("requiredNumberOfEditors").documents.filter(e=>e.type===pr).length}get ui(){return this.#w||(this.#w=KD({superdoc:this}),this.#e&&this.#w.destroy()),this.#U(),this.#w}get diagnostics(){return this.#n}emit(e,...t){return(e==="exception"||e==="document-replaced"||e==="ready"||e==="active-editor-change"||e==="collaboration-ready"||e==="collaboration-connection-change"||e==="locked")&&zd(this,e,()=>t[0]),super.emit(e,...t)}on(e,t,n){return super.on(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#B(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#B(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#B(),this}#B(){this.listenerCount("content-control:active-change")>0||(this.#m?.(),this.#m=null,this.#I=null,this.#g=null,this.#b=null,this.#A=!1,this.#T=null)}#U(){if(this.#m||this.#_||!this.#w||this.#e||this.listenerCount("content-control:active-change")===0)return;let e=null,t=[],n=null,r=null,o=!0;this.#_=!0;try{n=this.#w.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=pE(s);if(!a)return;this.#g==="pointer"&&this.#b!==null&&Date.now()>this.#b&&(this.#g=null,this.#b=null);const l=this.#g??(this.#A?"pointer":null),u=this.activeEditor;(l||this.#I?.editor!==u||this.#I.key!==a)&&(this.#I={editor:u,key:a,source:l??"keyboard"}),this.#g=null,this.#b=null}),r=this.#w.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>hE(s.items.find(C=>C.id===v)));if(l.some(v=>v===null))return;const u=l,d=a===e,f=u.length===t.length&&u.every((v,C)=>v.id===t[C]?.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 m=pE(this.#w.selection.getSnapshot()),g=this.#I;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:m&&g?.editor===a&&g.key===m?g.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#m=i}catch(i){throw n?.(),r?.(),i}finally{this.#_=!1}}get state(){return{documents:this.#C("state").documents.map(e=>kl(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}#Z(){const e=this.config.document,t=!!e&&typeof e=="object"&&(kl(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:al(),...o}]}else n&&(this.config.documents=[{id:al(),type:pr,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||al()}}))}#Q(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=EB({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.#E),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&&x7(this),this.#le()}#l(e,t){t&&this.on(e,t)}#J(){this.#l("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#l("editorCreate",this.config.onEditorCreate),this.#l("editorDestroy",this.config.onEditorDestroy),this.#l("source:complete",this.config.onSourceComplete),this.#l("source:signals-complete",this.config.onSourceSignalsComplete),this.#l("ready",this.config.onReady),this.#l("comments-update",this.config.onCommentsUpdate),this.#l("content-control:click",this.config.onContentControlClick),this.#l("awareness-update",this.config.onAwarenessUpdate),this.#l("locked",this.config.onLocked),this.#l("pdf:document-ready",this.config.onPdfDocumentReady),this.#l("sidebar-toggle",this.config.onSidebarToggle),this.#l("collaboration-ready",this.config.onCollaborationReady),this.#l("collaboration-connection-change",this.config.onCollaborationConnectionChange),this.on("collaboration-ready",e=>this.#ke(e?.editor??null)),this.#l("editor-update",this.config.onEditorUpdate),this.#l("tracked-changes:bulk-decision",this.config.onTrackedChangesBulkDecision),this.on("content-error",this.onContentError),this.#l("exception",this.config.onException),this.#l("list-definitions-change",this.config.onListDefinitionsChange),this.#l("pagination-update",this.config.onPaginationUpdate),this.#l("fonts-resolved",this.config.onFontsResolved),this.#l("fonts-changed",this.config.onFontsChanged),this.#l("zoomChange",this.config.onZoomChange),this.#l("viewport-change",this.config.onViewportChange),this.#l("page-margins-change",this.config.onPageMarginsChange)}async#ee({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:al(),type:pr,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}#ce(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=$r(e),this.provider=$r(t),this.#Ee();const n=this.config;this._cleanupAwareness=_7(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#Ce(){this.#p=null,this.#te(),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})}#te(){if(this.#a){try{this.#a()}catch{}this.#a=null}if(this.#u){try{this.#u()}catch{}this.#u=null}if(this.#f){try{this.#f()}catch{}this.#f=null}}#ke(e){this.#te(),Yo(e)&&(this.#_e(e),this.#Ae(e),this.#Se(e))}#Se(e){const t=e.connection;if(!t||typeof t.subscribe!="function")return;const{documentId:n}=t;this.#c?.documentId!==n&&(this.#c=null,this.#d=!1);const r=o=>{if(this.#e)return;const i=this.#c;if(i&&i.state===o.state&&i.detail===(o.detail??null))return;const s={documentId:n,state:o.state,previousState:i?.state??null,kind:P$(o,this.#d),detail:o.detail??null,superdoc:this};this.#c=s,o.state==="synced"&&(this.#d=!0),this.emit("collaboration-connection-change",s)};try{const o=t.getSnapshot?.();o&&r(o),this.#f=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 connection bridge failed to subscribe",o)}}getCollaborationConnectionState(){return this.#c}#_e(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=FB(()=>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.#a=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#Ae(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#H(!!r.isLocked,this.#ue(r.lockedBy??null))};try{if(this.#p&&typeof t.setLocked=="function"){const o=this.#p;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#p=null}const r=t.getSnapshot?.();r&&n(r),this.#u=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#ue(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#Ie(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#H(e,t){this.isLocked===e&&this.#Ie(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#ie("πŸ¦‹ [superdoc] Locking superdoc:",e,t,`
102
+ `;Bt();var Qs=e=>{e.expand.value=!1},g2=(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 v2(e,t){const n={...e};return t?n.href=t:delete n.href,n}function rE(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 d$(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function oE(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function f$(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function h$(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var p$=({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=Ln({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),p=(r??sH).map(hH),m=Ln({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:at}={},Ct=!1)=>{if(Ct){m.label.value="",m.selectedValue.value="";return}if(!at)return;at=at.split(",")[0];const zt=on=>on.value??on.label,Ut=p.find(on=>zt(on)===m.defaultLabel.value),Cn=p.find(on=>zt(on)===at);Cn?(m.label.value=Cn.label,m.selectedValue.value=Cn.key):Ut?(m.label.value=at,m.selectedValue.value=Ut.key):(m.label.value=at,m.selectedValue.value="")},onDeactivate:()=>{const at=p.find(Ct=>(Ct.value??Ct.label)===m.defaultLabel.value);m.label.value=at?.label??m.defaultLabel.value,m.selectedValue.value=at?.key??""}}),g=Ln({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(g)}]});function v(at){const Ct=oE(e),zt=Ct?.selectionTarget??rE(Ct?.target),Ut=Ct?.empty?"":d$(Ct),Cn=h$(e),on=()=>Qs(at),Mn=()=>{const an=e.pendingSelectionCapture;an&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(an)};return zr("div",{},[zr(jH,{handleClose:on,selectedText:Ut,target:zt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:Cn?.apiKey||e.config?.aiApiKey||"",endpoint:Cn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:Mn})])}const C=lH,w=Ln({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:C,onActivate:({fontSize:at},Ct=!1)=>{if(Ct){w.label.value="",w.selectedValue.value="";return}const zt=C.find(Mn=>Mn.label===String(w.defaultLabel.value));if(!at){w.label.value=w.defaultLabel.value,zt?w.selectedValue.value=zt.key:w.selectedValue.value="";return}let Ut=tU(at,12);Ut<8&&(Ut=8),Ut>96&&(Ut=96);let Cn=String(Ut);const on=C.find(Mn=>Mn.label===Cn||Mn.key===Cn);on?w.selectedValue.value=on.key:w.selectedValue.value="",w.label.value=Cn},onDeactivate:()=>{w.label.value=w.defaultLabel.value;const at=C.find(Ct=>Ct.label===String(w.defaultLabel.value));at?w.selectedValue.value=at.key:w.selectedValue.value=""}}),_=()=>Ln({type:"separator",name:"separator",isNarrow:!0}),y=Ln({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),k=Ln({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),T=Ln({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),M=Ln({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:()=>m2(e,M,[],!0)}],onActivate:({color:at})=>{M.iconColor.value=at||""},onDeactivate:()=>M.iconColor.value=""}),B=Ln({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:()=>m2(e,B)}],onActivate:({color:at})=>{B.iconColor.value=at},onDeactivate:()=>B.iconColor.value="#000"}),W=Ln({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),z=Ln({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>V(z)}],onActivate:({href:at})=>{z.attributes.value=v2(z.attributes.value,at)},onDeactivate:()=>{z.attributes.value=v2(z.attributes.value,null),z.expand.value=!1}});function V(at){const Ct=oE(e),zt=Ct?.selectionTarget??rE(Ct?.target),Ut=()=>{const Cn=e.pendingSelectionCapture;Cn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Cn)};return zr("div",{},[zr(SA,{ui:e.ui,linkItem:at,textTarget:zt,restoreSelection:Ut,closePopover:()=>{Qs(at),Bc(e)},goToAnchor:()=>{Qs(at);const Cn=at.attributes.value?.href;if(!Cn)return;const on=Cn.slice(1),Mn=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${on}']`);Mn&&_A(Mn)}})])}const Z=Ln({type:"options",name:"linkInput",command:"toggleLink",active:!1});z.childItem=Z,Z.parentItem=z;const R=Ln({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),K=Ln({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),x=Ln({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:()=>G(x)}]});function G(at){return zr("div",{},[zr(n$,{onSelect:zt=>{e.emitCommand({item:at,argument:zt}),Qs(at),Bc(e)}})])}const H=Ln({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(at){return zr(c$,{options:J,onSelect:Ct=>{Qs(at);const{command:zt}=Ct;e.emitCommand({item:at,argument:{command:zt}}),Bc(e)}})}const X=Ln({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(gH,{onSelect:Ct=>{Qs(X);const zt={...X,command:"setTextAlign"};zt.command="setTextAlign",e.emitCommand({item:zt,argument:Ct}),Te(X,Ct),Bc(e)}})]),key:"alignment"}],onActivate:({textAlign:at})=>{Te(X,at)},onDeactivate:()=>{Te(X,"left")}}),Te=(at,Ct)=>{let zt=Ct==="both"?"justify":Ct,Ut={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},Cn=Ut[zt]??Ut.left;at.icon.value=Cn},de=Ln({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 at=Ct=>{Qs(de);const zt={...de,command:"toggleBulletListStyle"};e.emitCommand({item:zt,argument:Ct})};return zr(tE,{buttons:bH,iconSize:25,selectedStyle:de.selectedValue.value,onSelect:at})}}]}),ge=Ln({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 at=Ct=>{Qs(ge);const zt={...ge,command:"toggleOrderedListStyle"};e.emitCommand({item:zt,argument:Ct})};return zr(tE,{buttons:wH,iconSize:30,selectedStyle:ge.selectedValue.value,onSelect:at})}}]}),ve=Ln({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Re=Ln({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Be=Ln({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),tt=Ln({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:at})=>{at&&(tt.label.value=at)}}),ut=Ln({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:at})=>{at&&(ut.label.value=at)}}),dt=Ln({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),_t=Ln({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),se=Ln({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),ke=Ln({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Ue=Ln({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),ne=Ln({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),I=(at,Ct)=>at==="editor"?Ct:at==="suggester"?Ct.filter(zt=>zt.value==="suggesting"):Ct.filter(zt=>zt.value==="viewing"),ae=at=>at==="editor"?"Editing":at==="suggester"?"Suggesting":"Viewing",N=Ln({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:ae(s),label:ae(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:()=>U(N)}]}),Y=[{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 U(at){return zr(TH,{options:I(s,Y),onSelect:Ct=>{const zt=e.superdoc?.activeEditor??e.activeEditor;Qs(at);const{label:Ut,icon:Cn,value:on}=Ct;N.label.value=Ut,N.icon.value=Cn,e.emitCommand({item:N,argument:on}),Bc(e,zt)}})}const ie=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"],L=Ln({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),F=Ln({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),fe=Ln({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 at=zt=>{Qs(fe);const Ut=typeof zt=="string"?zt:zt?.id??null;if(!Ut)return;const Cn={...fe,command:"setLinkedStyle"};e.emitCommand({item:Cn,argument:Ut})},Ct=e.getActiveLinkedStyleId?.()??null;return zr("div",{},[zr(LH,{styles:e.getLinkedStyleOptions?.()??[],onSelect:at,selectedOption:Ct})])}}],onActivate:({styleId:at,styleName:Ct})=>{const zt=Ct||at;fe.label.value=at&&at!=="Normal"?String(zt):n.formatText,fe.disabled.value=!1},onDeactivate:()=>{fe.disabled.value=!0,fe.label.value=n.formatText}}),Ce=(at,Ct)=>{if(Ct.value==at)return zr("div",{innerHTML:u$,class:"dropdown-select-icon"})},_e=Ln({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(at=>({label:at.toFixed(2),key:at,icon:()=>Ce(at,_e.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),Pe=20,We=32,it=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],ht=["zoom","fontFamily","fontSize","redo"],Lt=i<=wh.lg,Tt=e.config?.showFormattingMarksButton===!0,Yt=e.config?.showTableOfContentsButton===!0;Lt&&(N.attributes.value={...N.attributes.value,className:`${N.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),Lt&&(fe.attributes.value={...fe.attributes.value,className:`${fe.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Fe=[dt,_t,se,ke,W,tt,m,_(),w,_(),f,y,k,T,B,M,_(),z,R,...Yt?[K]:[],x,H,_(),X,de,ge,ve,Re,_e,_(),fe,_(),L,ut,...Tt?[F]:[],ne,Ue,...f$(e)?[g]:[],Be,N,...d];if(i<=wh.md&&o&&(Fe=Fe.filter(at=>at.type!=="separator")),e.config.mode!=="docx"){const at=Fe.findIndex(zt=>zt.name.value==="linkedStyles");Fe.splice(at-1,2);const Ct=["ruler","zoom","undo","redo"];Fe=Fe.filter(zt=>!Ct.includes(zt.name.value))}const rn=[];a||(s==="viewer"&&rn.push(se,ke),Fe=Fe.filter(at=>!rn.includes(at))),l&&(Fe=Fe.filter(at=>at.name.value==="overflow"||at.isCustomToolbarItem||l.has(at.name.value))),u?.size&&(Fe=Fe.filter(at=>!u.has(at.name.value)));const Dn=at=>be.includes(at.name.value),Kt=Fe.find(at=>at.name.value==="overflow"),Rn=Fe.filter(at=>at!==Kt),Lr=at=>{const Ct=[],zt=[],Ut=Rn.filter(Dn).reduce((on,Mn)=>on+g2(Mn,ie),0);let Cn=We+Ut+(at&&Kt?g2(Kt,ie):0);return Rn.forEach((on,Mn)=>{const an=g2(on,ie);if(on.type==="separator"&&Rn[Mn-1]?.name.value==="linkedStyles"&&Ct.includes(Rn[Mn-1])){Ct.push(on);return}if(i<wh.xl+Pe&&it.includes(on.name.value)&&o){Ct.push(on);return}if(i<wh.sm&&ht.includes(on.name.value)&&o){Ct.push(on);return}if(Dn(on)){zt.push(on);return}Cn+an<=i||!o?(zt.push(on),Cn+=an):Ct.push(on)}),{visibleItems:zt,overflowItems:Ct}};let{visibleItems:yr,overflowItems:Dr}=Lr(!1);if(o&&Kt&&Dr.some(at=>at.type!=="separator")){({visibleItems:yr,overflowItems:Dr}=Lr(!0));const at=Fe.indexOf(Kt),Ct=yr.findIndex(zt=>Fe.indexOf(zt)>at);Ct===-1?yr.push(Kt):yr.splice(Ct,0,Kt)}return{defaultItems:yr,overflowItems:Dr.filter(at=>at.type!=="separator")}},iE={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"},m$=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Bt();function sE(e){return KV(e)??p2[e]??null}function ug(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=r.firstParty?s_(e,t,n):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 g$=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),v$=new Set(["list","numberedlist"]);function y$(e,t){if(e==="fontFamily"||e==="fontSize"||v$.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!g$.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function aE(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function b$(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var w$=new Set([...WV,...Object.keys(tg),"ai","overflow","tableOfContents"]),C$=class extends jg.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...rr},texts:{...iE},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={...rr,...e.icons},this.config.texts={...iE,...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=m$(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.#c(),this.#i(),this._lastFontOptionsSignature=this.#r(),!this.toolbarContainer){this.updateToolbarState();return}this.app=wc(fH),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.#m(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#w():this.#y()}))}#o(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#y();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.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),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}#f(e){return e||aH(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#c(){const e=this.getAvailableWidth(),t=new Map(this.#s().filter(C=>C.isCustomToolbarItem&&C.type==="dropdown").map(C=>[C.name.value,C.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(C=>C)):null,o=new Set(this.config.excludeItems),i=this.config.customButtons||[],s=new Set(w$),a=i.map((C,w)=>{try{if(C?.name&&s.has(C.name))throw new Error(`Toolbar item name "${C.name}" is already taken by another item, so this entry is skipped.`);const _=this.#d(C);return t.has(_.name.value)&&(_.selectedValue.value=t.get(_.name.value)),s.add(_.name?.value),_}catch(_){const y=`${C?.name??`<unnamed@${w}>`}::${_?.message??String(_)}`;return this._reportedInvalidCustomItems.has(y)||(this._reportedInvalidCustomItems.add(y),this.#v(_,C?.name??null)),null}}).filter(Boolean),l=n?new Set(Object.keys(this.config.groups)):null,u=l?a.filter(C=>l.has(C.group?.value||"center")):a,{defaultItems:d,overflowItems:f}=p$({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#f(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(C=>C.name.value),...f.map(C=>C.name.value)];if(n){const C=Object.values(this.config.groups).flatMap(_=>_),w=a.filter(_=>l.has(_.group?.value||"center")).map(_=>_.name.value);p=[...new Set([...C,...w])]}const m=f.filter(C=>p.includes(C.name.value)&&!o.has(C.name.value)),g=m.length?[...p,"overflow"]:p,v=d.filter(C=>g.includes(C.name.value)).filter(C=>!o.has(C.name.value));if(n)for(const[C,w]of Object.entries(this.config.groups))for(const _ of v)w.includes(_.name.value)&&(_.group.value=C);this.toolbarItems=v,this.overflowItems=m}#d(e){const t=Ln({...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.#v(l,e.name),!1)):a}catch(a){return this.#v(a,e.name),!1}}});this._customCommandRegs.set(r,o)}}return t}#p(){this.#c(),this.emit("toolbar-items-changed")}#r(){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.#m(),this._linkedStyleOptions.value}#m(){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.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#c(),this.updateToolbarState()};#_(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}#g(){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)}#b(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>m2(this,e,[],!0)};e.nestedOptions.value=[t]}#A(e){return!!e?.active&&e?.value==null}#T(e){return!!e&&e.disabled===!1&&e.value==null}#I(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=eE.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(f2(t)?.disposition==="host-routed")return e.setDisabled(!this.#k(t)),this.#_(t)?e.activate():e.deactivate(),!0;const n=sE(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];y$(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.#g()},link:()=>{e.active.value=!!r?.active,e.attributes.value=v2(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#T(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#A(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.#g(),this.#b();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#F(),this.#s().forEach(n=>{const r=n.isCustomToolbarItem&&typeof n.command=="string";(n.allowWithoutEditor?.value||r)&&this.#I(n)})):this.#s().forEach(n=>{n.resetDisabled(),this.#I(n)});const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#F(){this.#s().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#x(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}#D(e,t){const n=e?.name?.value;if(!n)return!1;const r={firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:i=>this.#v(i,n)};if(n==="image"&&t==null)return this.#O();if(n==="tableActions"){const i=JI[t?.command];return i?ug(this.ui,i,void 0,r):!1}if(f2(n)?.disposition==="unsupported")return!0;const o=sE(n);return o?ug(this.ui,o,t,r):!1}#O(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=eU({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await QV(e,this.superdoc?.config?.handleImageUpload);ug(this.ui,"image",{src:t},{firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:n=>this.#v(n,"image")})},onError:e=>this.#v(e,"image")})),this.#e.open()),!0}#w(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{aE(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!aE(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}b$(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)}}#y(){this.#n&&(this.#n(),this.#n=null)}#v(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(f2(r)?.disposition==="host-routed"){this.#x(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.#v(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!ug(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#v(s,r),reportUnhandled:!0}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#D(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#v(s,r)}}}destroy(){this.#y(),this.#e?.destroy(),this.#e=null,this.#a(),this.#o(),this.app?.unmount(),this.app=null,this.toolbar=null}};function k$(e){return new C$(e)}Bt();var S$=['[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(", "),_$=800,lE=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,cE=e=>{if(!lE)return!1;try{return lE.call(e),!0}catch{return!1}};function A$(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 I$=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"]),E$=["original","markup","final"],T$=["review","original","final","off"];function uE(e){return E$.includes(e)}function x$(e){return e==="markup"?"review":e}function dE(e){return T$.includes(e)}function R$(e){const t=e.modules?.trackChanges?.mode;if(dE(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return dE(n)?n:null}function dg(e,t){const n=e.viewing,r=uE(n?.trackedChanges)?n.trackedChanges:null,o=r?x$(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 M$(e,t){const n=new g5.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function y2(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function fE(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function L$(e,t){if(!e)return()=>{};if(y2(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=()=>{fE(e),s()},l=u=>{u!==!1&&(u===!0||y2(e))&&(fE(e),s())};return n("synced",a),n("sync",l),y2(e)&&s(),i}function D$(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(S$));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(zp.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 O$(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function hE(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 pE(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function P$(e,t){switch(e.state){case"failed":return"failed";case"degraded":return e.detail==="reconnecting"?"reconnecting":"lost";case"synced":return t?"recovered":"initial";default:return t?"reconnecting":"initial"}}function Yo(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function mE(e){return typeof e=="string"&&e.length>0?e:null}function gE(e){return e?Yo(e)?mE(e.documentId??e.options?.documentId??null):mE(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function F$(e){if(!e||Yo(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function ys(e){if(!e)return null;if(Yo(e))return e.fonts??null;const t=F$(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 fg=class extends jg.default{static{this.allowedTypes=[pr,Ma,Eu]}#e;#n;#t;#o;#i;#a;#u;#f;#c;#d;#p;#r;#s;#m;#_;#k;#g;#b;#A;#T;#I;#F;#x;#D;#O;#w;#y;get uiConfig(){return this.#y}#v;get interactionConfig(){return this.#v}#N;get surfacesConfig(){return this.#N}#E;#h;#R;#M;#L;constructor(e){if(super(),this.#e=!1,this.#t=!1,this.#o=null,this.#i=null,this.#a=null,this.#u=null,this.#f=null,this.#c=null,this.#d=!1,this.#p=null,this.#r=null,this.#s=null,this.#m=null,this.#_=!1,this.#k=!1,this.#g=null,this.#b=null,this.#A=!1,this.#T=null,this.#I=null,this.#F=n=>{this.listenerCount("content-control:active-change")>0&&(this.#A||(this.#T=n.pointerId),this.#A=!0,this.#g="pointer",this.#b=null)},this.#x=n=>{n.pointerId===this.#T&&(this.#A=!1,this.#T=null,this.#g??="pointer",this.#g==="pointer"&&(this.#b=Date.now()+_$))},this.#D=n=>{this.listenerCount("content-control:active-change")>0&&!A$(n)&&(this.#g="keyboard",this.#b=null)},this.#O=n=>{this.#X(n)},this.#w=null,this.#y=jI({}),this.#v=VI({}),this.#N=HI({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#h=new $V,this.#R=null,this.#M=!1,this.#L=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...u2},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.#ne=new WeakSet,this.#re=new WeakMap,this.#oe=null,this.#K=null,this.#j=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=fT(this,e,()=>this.version,t),this.#E=new pV({getModuleConfig:()=>this.#N}),this.#s=t,t.addEventListener("pointerdown",this.#F,!0),t.ownerDocument.addEventListener("pointerup",this.#x,!0),t.ownerDocument.addEventListener("pointercancel",this.#x,!0),t.addEventListener("keydown",this.#D,!0),t.addEventListener("click",this.#O,!0),this.#l("content-control:active-change",e.onContentControlActiveChange),this.#S(e,t),this.#k=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#X(e){const t=this.#s;if(!t)return;const n=D$(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=hE(O$(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#S(e,t){this.#L=R$(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),c2(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.#Ue(),this.config.user=IV(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=E_(this.config.modules.comments),this.#y=jI(this.config),this.#v=VI(this.config),this.#N=HI(this.config),this.config.disableContextMenu=!this.#y.contextMenu.enabled,this.config.rulers=this.#y.ruler.enabled,this.#y.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#y.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&(i.readOnly=this.#v.comments.readOnly,i.allowResolve=this.#v.comments.allowResolve)}if(this.config.colors=_5(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.18.1-next.4",this.#ie("πŸ¦‹ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||al(),this.colors=this.config.colors??[],this.#Z(),await $7(),this.#e)return;if(await this.#ee(this.config.modules),this.#e){this.#we();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.#R||(this.#R=this.#h.subscribe(i=>{this.#$e(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.#r=o,this.#J(),this.#V(),this.#Ge(),this.#P()}#P(){if(this.#Q(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#r)}#V(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new jB({Renderer:dV,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#C("requiredNumberOfEditors").documents.filter(e=>e.type===pr).length}get ui(){return this.#w||(this.#w=KD({superdoc:this}),this.#e&&this.#w.destroy()),this.#U(),this.#w}get diagnostics(){return this.#n}emit(e,...t){return(e==="exception"||e==="document-replaced"||e==="ready"||e==="active-editor-change"||e==="collaboration-ready"||e==="collaboration-connection-change"||e==="locked")&&zd(this,e,()=>t[0]),super.emit(e,...t)}on(e,t,n){return super.on(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#B(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#B(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#B(),this}#B(){this.listenerCount("content-control:active-change")>0||(this.#m?.(),this.#m=null,this.#I=null,this.#g=null,this.#b=null,this.#A=!1,this.#T=null)}#U(){if(this.#m||this.#_||!this.#w||this.#e||this.listenerCount("content-control:active-change")===0)return;let e=null,t=[],n=null,r=null,o=!0;this.#_=!0;try{n=this.#w.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=pE(s);if(!a)return;this.#g==="pointer"&&this.#b!==null&&Date.now()>this.#b&&(this.#g=null,this.#b=null);const l=this.#g??(this.#A?"pointer":null),u=this.activeEditor;(l||this.#I?.editor!==u||this.#I.key!==a)&&(this.#I={editor:u,key:a,source:l??"keyboard"}),this.#g=null,this.#b=null}),r=this.#w.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>hE(s.items.find(C=>C.id===v)));if(l.some(v=>v===null))return;const u=l,d=a===e,f=u.length===t.length&&u.every((v,C)=>v.id===t[C]?.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 m=pE(this.#w.selection.getSnapshot()),g=this.#I;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:m&&g?.editor===a&&g.key===m?g.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#m=i}catch(i){throw n?.(),r?.(),i}finally{this.#_=!1}}get state(){return{documents:this.#C("state").documents.map(e=>kl(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}#Z(){const e=this.config.document,t=!!e&&typeof e=="object"&&(kl(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:al(),...o}]}else n&&(this.config.documents=[{id:al(),type:pr,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||al()}}))}#Q(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=EB({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.#E),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&&x7(this),this.#le()}#l(e,t){t&&this.on(e,t)}#J(){this.#l("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#l("editorCreate",this.config.onEditorCreate),this.#l("editorDestroy",this.config.onEditorDestroy),this.#l("source:complete",this.config.onSourceComplete),this.#l("source:signals-complete",this.config.onSourceSignalsComplete),this.#l("ready",this.config.onReady),this.#l("comments-update",this.config.onCommentsUpdate),this.#l("content-control:click",this.config.onContentControlClick),this.#l("awareness-update",this.config.onAwarenessUpdate),this.#l("locked",this.config.onLocked),this.#l("pdf:document-ready",this.config.onPdfDocumentReady),this.#l("sidebar-toggle",this.config.onSidebarToggle),this.#l("collaboration-ready",this.config.onCollaborationReady),this.#l("collaboration-connection-change",this.config.onCollaborationConnectionChange),this.on("collaboration-ready",e=>this.#ke(e?.editor??null)),this.#l("editor-update",this.config.onEditorUpdate),this.#l("tracked-changes:bulk-decision",this.config.onTrackedChangesBulkDecision),this.on("content-error",this.onContentError),this.#l("exception",this.config.onException),this.#l("list-definitions-change",this.config.onListDefinitionsChange),this.#l("pagination-update",this.config.onPaginationUpdate),this.#l("fonts-resolved",this.config.onFontsResolved),this.#l("fonts-changed",this.config.onFontsChanged),this.#l("zoomChange",this.config.onZoomChange),this.#l("viewport-change",this.config.onViewportChange),this.#l("page-margins-change",this.config.onPageMarginsChange)}async#ee({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:al(),type:pr,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}#ce(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=$r(e),this.provider=$r(t),this.#Ee();const n=this.config;this._cleanupAwareness=_7(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#Ce(){this.#p=null,this.#te(),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})}#te(){if(this.#a){try{this.#a()}catch{}this.#a=null}if(this.#u){try{this.#u()}catch{}this.#u=null}if(this.#f){try{this.#f()}catch{}this.#f=null}}#ke(e){this.#te(),Yo(e)&&(this.#_e(e),this.#Ae(e),this.#Se(e))}#Se(e){const t=e.connection;if(!t||typeof t.subscribe!="function")return;const{documentId:n}=t;this.#c?.documentId!==n&&(this.#c=null,this.#d=!1);const r=o=>{if(this.#e)return;const i=this.#c;if(i&&i.state===o.state&&i.detail===(o.detail??null))return;const s={documentId:n,state:o.state,previousState:i?.state??null,kind:P$(o,this.#d),detail:o.detail??null,superdoc:this};this.#c=s,o.state==="synced"&&(this.#d=!0),this.emit("collaboration-connection-change",s)};try{const o=t.getSnapshot?.();o&&r(o),this.#f=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 connection bridge failed to subscribe",o)}}getCollaborationConnectionState(){return this.#c}#_e(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=FB(()=>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.#a=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#Ae(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#H(!!r.isLocked,this.#ue(r.lockedBy??null))};try{if(this.#p&&typeof t.setLocked=="function"){const o=this.#p;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#p=null}const r=t.getSnapshot?.();r&&n(r),this.#u=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#ue(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#Ie(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#H(e,t){this.isLocked===e&&this.#Ie(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#ie("πŸ¦‹ [superdoc] Locking superdoc:",e,t,`
103
103
 
104
104
 
105
105
  `),this.emit("locked",{isLocked:e,lockedBy:t}))}#Ee(){const e=this.config.user;if(!e||e.color)return;const t=this.colors.length>0?this.colors:I$,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){if(this.#o){const{target:r}=this.#he(e);if(this.#Te(r,this.#o.target))return this.#o.promise;throw Object.assign(new Error("SuperDoc: a different collaboration target is already upgrading"),{code:"collaboration-upgrade-target-conflict"})}const{target:t}=this.#Be(e);this.#t=!0;const n=(async()=>{try{const r=await this.#Ne(),o=this.#Re(),i=this.#xe();this.#Le();try{this.#p=i;const s=await this.#Pe(t,r);this.#Fe(s,t),this.#p=null;const a=this.activeEditor?.options?.documentId,l=s.configDoc.v2Collaboration?.documentId;if(typeof a!="string"||a!==s.configDoc.id||typeof l!="string"||l!==t.documentId)throw new Error("SuperDoc: collaboration upgrade did not attach the expected room and document");return{roomId:l,documentId:a}}catch(s){throw this.#Me(o),s}}finally{this.#i=null,this.#t=!1,this.#o=null}})();return this.#o={target:t,promise:n},n}#Te(e,t){if(e.token!==t.token)return!1;const n=new WeakMap,r=(o,i)=>{if(Object.is(o,i))return!0;if(!o||!i||typeof o!="object"||typeof i!="object"||Object.getPrototypeOf(o)!==Object.getPrototypeOf(i))return!1;if(n.has(o))return n.get(o)===i;if(n.set(o,i),o instanceof Date&&i instanceof Date)return o.getTime()===i.getTime();if(o instanceof RegExp&&i instanceof RegExp)return o.source===i.source&&o.flags===i.flags;if(o instanceof ArrayBuffer&&i instanceof ArrayBuffer)return r(Array.from(new Uint8Array(o)),Array.from(new Uint8Array(i)));if(ArrayBuffer.isView(o)&&ArrayBuffer.isView(i))return o.constructor===i.constructor&&r(Array.from(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)),Array.from(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)));if(o instanceof Map&&i instanceof Map)return o.size===i.size&&r(Array.from(o.entries()),Array.from(i.entries()));if(o instanceof Set&&i instanceof Set)return o.size===i.size&&r(Array.from(o.values()),Array.from(i.values()));if(Array.isArray(o)&&Array.isArray(i))return o.length===i.length&&o.every((l,u)=>r(l,i[u]));if(Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null)return!1;const s=Object.keys(o).sort(),a=Object.keys(i).sort();return s.length===a.length&&s.every((l,u)=>l===a[u]&&r(o[l],i[l]))};return r({...e,token:void 0},{...t,token:void 0})}#xe(){return{isLocked:this.isLocked,lockedBy:this.lockedBy?{...this.lockedBy}:null}}#Re(){const e=this.config.documents.find(r=>r.type===pr),t=this.superdocStore?.documents.find(r=>r.id===e.id)??null,n=t?yn(t):null;return{isCollaborative:this.isCollaborative,configV2Collaboration:e.v2Collaboration??null,configData:e.data,storeDoc:t,storeV2Collaboration:this.#Oe(n),storeData:t?.data}}#Me(e){this.#p=null;const t=this.config.documents.find(n=>n.type===pr);t.v2Collaboration=e.configV2Collaboration,t.data=e.configData,this.isCollaborative=e.isCollaborative,e.storeDoc&&(e.storeDoc.data=e.storeData,this.#G(e.storeDoc,e.storeV2Collaboration))}#Le(){if(this.#e)throw new Error("SuperDoc: instance was destroyed during upgrade")}#C(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}#Ke(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}#$(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`)}#De(e,t){const n=this.superdocStore?.documents;if(Array.isArray(n))for(const r of n){const o=yn(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)}}#Oe(e){if(!e)return null;const t=e.v2Collaboration;return t&&typeof t=="object"&&"value"in t?t.value:t??null}#G(e,t){const n=yn(e).v2Collaboration;if(n&&typeof n=="object"&&"value"in n){n.value=t;return}e.v2Collaboration=t}#de(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#Pe(e,t){const n=this.config.documents.find(s=>s.type===pr),r=this.#C("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(!Yo(o)||typeof o.upgradeToCollaboration!="function")throw new Error("SuperDoc: live v2 editor cannot attach collaboration in place");const i=this.#de({...e,roomMode:"create"});return n.v2Collaboration=i,this.#G(r,i),this.isCollaborative=!0,await o.upgradeToCollaboration(t,i),n.data=t,r.data=t,{configDoc:n,storeDoc:r}}#Fe(e,t){const n=this.#de({...t,roomMode:"join"});e.configDoc.v2Collaboration=n,this.#G(e.storeDoc,n)}async#Ne(){const e=this.activeEditor;if(Yo(e)&&typeof e.save=="function"){const r=await e.save();return this.#z(r)}const t=this.config.documents.find(r=>r.type===pr),n=(this.superdocStore?.documents.find(r=>r.id===t.id)??null)?.data??t.data;if(n instanceof Blob)return n;if(kl(n))return this.#z(n);throw new Error("SuperDoc: upgradeToCollaboration() requires a live v2 editor save or DOCX Blob source")}#z(e){if(e instanceof Blob)return e;if(kl(e))return Zy(e,pr);throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#fe(e,t){const n=gE(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.#z(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.#G(s,i))}#qe(){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}#Ye(){this.#Ce(),this.#De(null,null)}#Xe(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.#i=()=>{i(),r(void 0)},typeof n.on=="function"?n.on("collaborationReady",a):(i(),r(void 0))})}#Ze(e){return new Promise((n,r)=>{let o,i=!1,s=()=>{};const a=()=>{i=!0,clearTimeout(o),s()};s=L$(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.#i=()=>{i||(a(),r(new Error("SuperDoc: instance was destroyed during upgrade")))}})}#Be(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(o=>o.type===pr);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(!Yo(this.#je()))throw new Error("SuperDoc: upgradeToCollaboration() requires a ready v2 DOCX editor");const r=n[0].id;if(typeof r!="string"||r.length===0)throw new Error("SuperDoc: source document is missing its mounted document identity");return this.#he(e)}#he(e){const t=this.config,n=t.documents.find(a=>a.type===pr),r=t.modules?.collaboration,o=e.ydoc||e.provider?{ydoc:e.ydoc,provider:e.provider}:r?{...r}:null,i=e.v2Collaboration??this.#ze(n.v2Collaboration)??r?.v2Collaboration??r?.v2??null,s=xk({collaboration:e.collaboration,v2Collaboration:i,legacyCollaboration:o,documentType:pr,documentCount:t.documents.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!s.ok)throw new Error(`SuperDoc: upgradeToCollaboration() ${s.reason}: ${s.message}`);return{target:{...s.target,roomMode:"create"}}}#ze(e){return e&&typeof e=="object"&&"value"in e?e.value:e}#je(){const e=this.config.documents.find(n=>n.type===pr),t=this.#C("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.#$("addSharedUser");const t=Tu({actor:e});t&&this.users.some(n=>Tu({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#$("removeSharedUser");const t=typeof e=="string"?Vy(e):"",n=typeof e=="string"?`email:${t}`:Tu({actor:e});this.users=this.users.filter(r=>{const o=Tu({actor:r});return n?o!==n:t?Vy(r.email)!==t:!0})}onContentError({error:e,editor:t}){const n=t.options?.documentId,r=this.#C("onContentError").documents.find(a=>a.id===n),o=typeof r?.id=="string"?r.id:typeof n=="string"?n:"",i=r?.data,s=cE(i)?i:kl(i)?this.#z(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:II(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#Ve(e),this.emit("editorCreate",{editor:II(e)})}broadcastSourceComplete(){this.emit("source:complete")}broadcastSourceSignalsComplete(){this.emit("source:signals-complete")}#ne;#re;#Ve(e){if(!e||typeof e.on!="function"||this.#ne.has(e))return;this.#ne.add(e),e.on("fonts-changed",n=>{this.#pe(e)&&this.#W(e,n)});const t=(e.documentRenderer??e.presentationEditor)?.getLastFontsChangedPayload?.();t&&this.#pe(e)&&this.#W(e,t)}#pe(e){return!this.activeEditor||e===this.activeEditor}#oe;#W(e,t){if(this.#oe=t,e.editorVersion===2){let n=this.#re.get(e);n||(n=new Set,this.#re.set(e,n)),HV(t.missingFonts,n)}this.emit("fonts-changed",t)}broadcastEditorDestroy(){this.emit("editorDestroy")}broadcastSidebarToggle(e){this.emit("sidebar-toggle",e)}#Ue(){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()`.")}#ie(...e){(console.debug?console.debug:console.log)("πŸ¦‹ πŸ¦Έβ€β™€οΈ [superdoc]",...e)}#K;get fonts(){return this.#K||(this.#K={getReport:()=>ys(this.activeEditor)?.getReport()??[],getMissingFonts:()=>ys(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>ys(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>ys(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>ys(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?ys(t)?.getLastFontsChangedPayload?.()??null:this.#oe??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=ys(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=ys(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=ys(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=ys(this.activeEditor);if(!t)throw new Error("superdoc.fonts.preload requires an active editor");return t.preload(e)}}),this.#K}#q(){const e=this.activeEditor!==null;this.#me(),this.activeEditor=null,this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null),e&&this.emit("active-editor-change")}#j;#me(){if(this.#j){try{this.#j()}catch{}this.#j=null}}#He(e){this.#me();const t=ys(e);if(!e||!t?.onChanged)return;const n=t.getLastFontsChangedPayload?.();n&&this.#W(e,n),this.#j=t.onChanged(r=>this.#W(e,r))}#$e(e,t){this.#M=!0;try{if(e===null){this.#q();return}this.#h.get(e)?.kind==="v2"&&Yo(t)?this.#ge(t):this.#q()}finally{this.#M=!1}}#ge(e){if(Yo(e)){!this.#M&&this.#h.getActive()&&this.#h.setActive(null,"set-active-v2-facade");const t=this.activeEditor;this.activeEditor=e,this.#He(e),this.toolbar?.setActiveEditor?.(e),t!==this.activeEditor&&this.emit("active-editor-change");return}this.#q()}setActiveEditor(e){this.#ge(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.#h.register(e)}unregisterEditorRuntime(e){return this.#h.unregister(e)}getActiveRuntime(){return this.#h.getActive()}setActiveRuntime(e,t){this.#h.setActive(e,t)}resolveRuntimeFromEventTarget(e){return this.#h.resolveFromEventTarget(e)}activateRuntimeFromEventTarget(e,t){const n=this.#h.resolveFromEventTarget(e);return n?(this.#h.setActive(n.id,t),!0):!1}toggleRuler(){const e=this.#C("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 ja(e,t,n,{superdoc:this,currentUser:this.config.user,comment:i??null,trackedChange:o??null})}#Ge(){const e=this.config.modules?.toolbar,t=e&&typeof e=="object"?e:{},n=this.#y.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=k$({...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 v9(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.#y.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.#$("setDocumentMode");const t=e.toLowerCase(),n=this.config.role==="viewer"?"viewing":this.config.role==="suggester"&&t==="editing"?"suggesting":t;this.config.documentMode=n,c2(this.config),this.#le();const r={viewing:()=>this.#ae(),editing:()=>this.#We(),suggesting:()=>this.#ye()};r[n]&&(r[n](),this.emit("document-mode-change",{documentMode:n}))}#se(e,t){const n=typeof e.id=="string"&&e.id.length>0?e.id:null;if(n){const i=this.#h.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.#Y(e)}#ve(){return typeof this.config.trackChanges?.enabled=="boolean"?this.config.trackChanges.enabled:typeof this.config.modules?.trackChanges?.enabled=="boolean"?this.config.modules.trackChanges.enabled:!0}#Y(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.#h.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.#$("setViewingOptions");const t=dg(this.config,this.#L),n={...this.config.viewing},r=typeof e.comments=="boolean",o=uE(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&&c2(this.config),this.#le(),this.config.documentMode==="viewing")){const i=dg(this.config,this.#L),s=t.comments||t.trackChangesVisible,a=i.comments||i.trackChangesVisible;this.#ae({updateTrackedChangesProjection:o,updateCommentVisibility:s!==a})}}#We(){if(this.config.role!=="editor")return this.#ye();const e=this.#C("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#Y({mode:"review",enabled:this.#ve()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#se(t,"editing")})}#ye(){if(!["editor","suggester"].includes(this.config.role??""))return this.#ae();const e=this.#C("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#Y({mode:"review",enabled:this.#ve()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#se(t,"suggesting")})}#ae(e={}){const t=this.#C("setDocumentMode");this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null);const n=dg(this.config,this.#L),r=n.comments,o=n.trackChangesVisible;e.updateTrackedChangesProjection!==!1&&this.#Y({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.#se(i,"viewing")})}#le(){const e=dg(this.config,this.#L),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=YS(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(Yo(t)&&typeof t.lock?.setLocked=="function"){t.lock.setLocked(e,e?{...this.user}:null);const n=t.lock.getSnapshot?.();n&&this.#H(!!n.isLocked,this.#ue(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.#H(e,e?this.user:null)}getHTML(e={}){const t=[];return this.#C("getHTML").documents.forEach(n=>{const r=n.getEditor?.();r&&t.push(r)}),t.map(n=>n.getHTML(e))}lockSuperdoc(e=!1,t=null){this.#H(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=p4(n||this.config.title),u=await this.exportEditorsToDOCX({commentsType:t,isFinalDoc:i,fieldsHighlightColor:a}),d=[...r],f=[...o];if(e.includes("docx")&&u.forEach(m=>{d.push(m),f.push(`${l}.docx`)}),d.length===1)return s?h4(d[0],l,e[0]):d[0];const p=await M$(d,f);return s?h4(p,l,"zip"):p}async replaceFile(e){return(await this.#be(e)).raw}async replaceDocument(e){const{raw:t,confirmed:n}=await this.#be(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#be(e){const t=this.activeEditor;if(Yo(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.#fe(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),{raw:r,confirmed:i}}const n=t&&!Yo(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.#fe(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.#C("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=()=>cE(d.data)?d.data.type&&d.data.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?null:d.data:kl(d.data)?this.#z(d.data):null;if(!f||typeof f.exportDocx!="function")return p();const m=f.editorVersion===2;try{const g=await f.exportDocx(m?{isFinalDoc:t,commentsType:e,fieldsHighlightColor:n}:{isFinalDoc:t,comments:s(),commentsType:e,fieldsHighlightColor:n});if(g)return g}catch(g){if((!g||typeof g!="object"||!a.has(g))&&(this.emit("exception",{error:g,document:d}),this.emit("exception",FN(g,{documentId:d.id,editor:null}))),m)throw g}return p()});return(await Promise.all(u)).filter(d=>d!=null)}finally{this.off("exception",l)}}async save(){const e=this.#C("save").documents;await Promise.all(e.map(async t=>{if(t.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return;const n=t.getEditor?.();if(!Yo(n)||typeof n.save!="function")throw new Error(`SuperDoc: save is unavailable for document "${t.id}"`);await n.save()}))}#we(){this.#p=null,this.#te(),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.#E.open(e)}closeSurface(e){this.#E.close(e)}async removeDocument(e){const t=typeof e=="string"?e:String(e??"");if(!t)return!1;const n=this.#C("removeDocument"),r=this.activeEditor,o=gE(r);for(const i of this.#h.getAllByDocumentId(t))this.#h.unregister(i.id);return o===t&&r!==null&&this.#q(),n.removeDocument(t)?(await St(),!0):!1}destroy(){pT(this),this.#e=!0,this.#s?.removeEventListener("click",this.#O,!0),this.#s?.removeEventListener("pointerdown",this.#F,!0),this.#s?.ownerDocument.removeEventListener("pointerup",this.#x,!0),this.#s?.ownerDocument.removeEventListener("pointercancel",this.#x,!0),this.#s?.removeEventListener("keydown",this.#D,!0),this.#s=null,this.#m?.(),this.#m=null,this.#i&&(this.#i(),this.#i=null),this.#E&&this.#E.destroy(),this.toolbar?.destroy?.(),this.commentsList?.close(),this.commentsList=null,this.app&&(this.#ie("[superdoc] Unmounting app"),this.superdocStore?.reset(),this.app.unmount(),this.removeAllListeners(),delete this.app.config.globalProperties.$config,delete this.app.config.globalProperties.$superdoc),this.#w?.destroy(),this.#we(),this.#R?.(),this.#R=null,this.#h.clear(),this.#r&&(this.#r.remove(),this.#r=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?Yo(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#C("focus").documents.find(n=>{const r=n.getEditor?.();return r?(Yo(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};Bt();var vE="__SUPERDOC_V2_BROWSER_RUNTIME__";function N$(e=globalThis){const t=e[vE];return t&&typeof t=="object"?t:null}function B$(e={},t=globalThis){const n=N$(t)??{},r={...n,...e,vue:e.vue??n.vue??h5};return t[vE]=r,r}B$();var z$={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"},j$=0;function yE(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-${++j$}`}`,l=[];if(i)for(const[u,d]of Object.entries(i)){if(d==null)continue;const f=z$[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 V$(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 U$(e){const{className:t,css:n}=yE(e);return V$(t,n),t}function H$(e){return yE(e)}function $$(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 G$=Nd({BlankDOCX:()=>_S,DOCX:()=>pr,HTML:()=>Eu,PDF:()=>Ma,SuperDoc:()=>fg,buildTheme:()=>H$,compareVersions:()=>C5,createTheme:()=>U$,defineSuperDocExtension:()=>$$,getFileObject:()=>Uy}),W$="SUPERDOC_ENGINE_CDN_BASE_URL",bE=Symbol.for("superdoc.docx-engine.cdn-load-state"),hg="superdocDocxEngineStatus";function K$(e,t,n=null){const r=e?.[W$],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return q$(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 q$(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 Y$({engineVersion:e,buildBaseUrl:t}){U7(()=>{const n=K$(globalThis,e,t),r=globalThis[bE],o=r instanceof Map?r:new Map;if(globalThis[bE]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),X$(`${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 X$(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[hg]==="loaded")return Promise.resolve();const r=n?.dataset[hg]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(m,g)=>{a||(a=!0,l?.disconnect(),s.dataset[hg]=m,g())},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[hg]="loading",document.head.appendChild(s))})}Y$({engineVersion:"0.17.1-next.3",buildBaseUrl:null});for(const[e,t]of Object.entries(G$))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(fg,e)||(fg[e]=t);var Z$=fg;return Z$})();
108
+ }`:""}}function V$(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 U$(e){const{className:t,css:n}=yE(e);return V$(t,n),t}function H$(e){return yE(e)}function $$(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 G$=Nd({BlankDOCX:()=>_S,DOCX:()=>pr,HTML:()=>Eu,PDF:()=>Ma,SuperDoc:()=>fg,buildTheme:()=>H$,compareVersions:()=>C5,createTheme:()=>U$,defineSuperDocExtension:()=>$$,getFileObject:()=>Uy}),W$="SUPERDOC_ENGINE_CDN_BASE_URL",bE=Symbol.for("superdoc.docx-engine.cdn-load-state"),hg="superdocDocxEngineStatus";function K$(e,t,n=null){const r=e?.[W$],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return q$(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 q$(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 Y$({engineVersion:e,buildBaseUrl:t}){U7(()=>{const n=K$(globalThis,e,t),r=globalThis[bE],o=r instanceof Map?r:new Map;if(globalThis[bE]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),X$(`${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 X$(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[hg]==="loaded")return Promise.resolve();const r=n?.dataset[hg]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(m,g)=>{a||(a=!0,l?.disconnect(),s.dataset[hg]=m,g())},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[hg]="loading",document.head.appendChild(s))})}Y$({engineVersion:"0.17.1-next.4",buildBaseUrl:null});for(const[e,t]of Object.entries(G$))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(fg,e)||(fg[e]=t);var Z$=fg;return Z$})();