superdoc 2.25.0-next.13 β†’ 2.25.0-next.14

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 sx=Object.create,op=Object.defineProperty,ax=Object.getOwnPropertyDescriptor,lx=Object.getOwnPropertyNames,cx=Object.getPrototypeOf,ux=Object.prototype.hasOwnProperty,Fr=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}},T2=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Xd=(e,t)=>{let n={};for(var r in e)op(n,r,{get:e[r],enumerable:!0});return t||op(n,Symbol.toStringTag,{value:"Module"}),n},dx=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=lx(t),i=0,s=o.length,a;i<s;i++)a=o[i],!ux.call(e,a)&&a!==n&&op(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=ax(t,a))||r.enumerable});return e},x2=(e,t,n)=>(n=e!=null?sx(cx(e)):{},dx(t||!e||!e.__esModule?op(n,"default",{value:e,enumerable:!0}):n,e)),fx=new Set(["documentId","actionId","commandId","operation","source","origin","phase","kind","status","success","changed","reason","code","direction","outcome","receipt","result","failure","rejection","txId","documentEpoch","commitSequence","targetCommitSequence","paintedCommitSequence","renderInputEpoch","paintedRenderInputEpoch","health","selection","selectionBefore","selectionAfter","snapshot","target","start","end","anchor","focus","story","storyType","storyId","refId","noteId","textboxId","position","offset","unit","value","blockId","blockOffset","fragmentId","pageIndex","layoutEpoch","revision","sourceCommit","selectionLineageId","selectionIntentSequence","intentSequence","intentId","authoringMode","editableCommandKind","inputKind","visualIntent","preEdit","postEdit","fallback","selectionRevision","timing","selectionTargetMs","textReplaceMs","postEditSelectionMs","totalMs","inputAtMs","dispatchAtMs","committedAtMs","durationMs","elapsedMs","affectedStories","tableId","cellId","contentControlId","outsideContentControl","trackedBlockOffset","projectionBlockId","geometryBlockId","geometryBlockOffset","geometryTrackedBlockOffset","lineAffinity","inlineAffinity","stability","nativeId","paraId","partId","partRevision","storyRevision","pathFingerprint","path","index","name","id","range","hasRangeSelection","inputType","dataLength","isComposing","repeat","altKey","ctrlKey","metaKey","shiftKey","key","button","buttons","pointerType","clickCount","x","y","selector","domPath","scrollLeft","scrollTop","command","segments","nodeId","byteSpan","sdtId","controlId","scope","coordinateSpace","contentControlIds","scrollAncestors","layoutBlockRef","contextSource"]),hx=new Set(["text","data","message","errorMessage","quotedText"]),px=["keydown","keyup","beforeinput","pointerdown","pointermove","pointerup","click","dblclick","mousedown","mouseup","scroll","compositionstart","compositionend","paste","cut","drop","dragstart"],mx=new Set(["Alt","AltGraph","CapsLock","Control","Meta","NumLock","ScrollLock","Shift","Enter","Tab","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","End","Home","PageDown","PageUp","Backspace","Delete","Insert","Escape","ContextMenu","Pause","Dead","Process","Unidentified"]),gx=0;function wu(e,t){return e&&typeof e=="object"?Object.getOwnPropertyDescriptor(e,t)?.value:void 0}function R2(e,t,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=n?e:t}var vx=class{constructor(e,t){this.root=e,this.version=t,this.session=null,this.events=[],this.startMs=0,this.maxEvents=2e4,this.maxBytes=8388608,this.closed=!1,this.pendingIntents=new Set,this.heldKeys=new Set,this.heldButtons=new Set,this.cleanups=[];const n=this;this.api=Object.freeze({get active(){return n.active},start:r=>this.start(r),stop:()=>this.stop(),getSnapshot:()=>this.snapshot()})}attachInputs(){const e=this.root.ownerDocument.defaultView;if(!e)throw new Error("Workflow recording requires a browser window.");try{for(const t of px){const n=r=>{if(!(!this.active||!r.isTrusted))try{r.target instanceof e.Node&&this.root.contains(r.target)?this.input(r):(r.type==="keyup"?this.heldKeys.delete(r.key):r.type==="pointerup"&&this.heldButtons.delete(r.button))&&this.unsupported("input-released-outside-mount")}catch{this.fail("capture-failure")}};e.addEventListener(t,n,!0),this.cleanups.push(()=>e.removeEventListener(t,n,!0))}}catch(t){throw this.detachInputs(),t}}detachInputs(){const e=this.cleanups;this.cleanups=[];for(const t of e)try{t()}catch{}}get active(){return this.session?.status==="recording"}start(e={}){if(this.closed)throw new Error("Cannot record a destroyed SuperDoc instance.");if(this.active)throw new Error("Stop the active workflow recording first.");this.maxEvents=R2(wu(e,"maxEvents"),2e4,1e5),this.maxBytes=R2(wu(e,"maxBytes"),8388608,67108864);const t=this.root.ownerDocument.defaultView;this.events=[],this.pendingIntents.clear(),this.startMs=t.performance.now(),this.session={schemaVersion:1,sessionId:`workflow-${Date.now()}-${++gx}`,version:this.version(),status:"recording",startedAt:Date.now(),durationMs:0,timeOrigin:t.performance.timeOrigin,startTimeMs:this.startMs,captureContent:wu(e,"captureContent")===!0,viewport:{width:t.innerWidth,height:t.innerHeight,devicePixelRatio:t.devicePixelRatio},retainedBytes:0,replayUnsupportedReasons:[],pendingIntentIds:[]};try{this.attachInputs(),this.observe("workflow:started",()=>({scrollTop:this.root.scrollTop,scrollLeft:this.root.scrollLeft}))}catch{this.fail("capture-failure")}return this.snapshot()}observe(e,t){if(this.active)try{let n=4096;const r=(s,a=0)=>{if(--n<0||a>14)throw new Error("payload-limit");if(s===null||typeof s=="boolean")return s;if(typeof s=="number")return Number.isFinite(s)?s:void 0;if(typeof s=="string"){if(s.length>32768)throw new Error("payload-limit");return s}if(!s||typeof s!="object")return;if(Array.isArray(s)){if(s.length>256)throw new Error("payload-limit");return Array.from({length:s.length},(u,d)=>r(wu(s,String(d)),a+1)??null)}const l={};for(const u of fx){const d=wu(s,u);u==="value"&&typeof d=="string"&&!this.session.captureContent||d!==void 0&&(l[u]=r(d,a+1))}if(this.session.captureContent)for(const u of hx){const d=wu(s,u);d!==void 0&&(l[u]=r(d,a+1))}return l},o={sequence:this.events.length+1,atMs:this.root.ownerDocument.defaultView.performance.now()-this.startMs,type:e,data:r(t())??{}},i=JSON.stringify(o);if(this.events.length>=this.maxEvents||this.session.retainedBytes+i.length*2>this.maxBytes){this.fail("capture-limit");return}if(this.events.push(i),this.session.retainedBytes+=i.length*2,e==="interaction:intent"){const s=`${o.data.documentId??""}/${o.data.selectionLineageId}/${o.data.intentSequence}`;(o.data.phase==="enqueued"||o.data.phase==="executing")&&this.pendingIntents.add(s),(o.data.phase==="settled"||o.data.phase==="failed")&&this.pendingIntents.delete(s)}}catch{this.fail("capture-failure")}}unsupported(e){this.session.replayUnsupportedReasons.includes(e)||this.session.replayUnsupportedReasons.push(e)}fail(e){if(this.session){this.unsupported(e);try{this.session.durationMs=this.root.ownerDocument.defaultView.performance.now()-this.startMs}catch{}this.session.status="incomplete",this.clearHeldInput(),this.detachInputs()}}input(e){if(!(!this.active||!e.isTrusted))try{const t=e.target instanceof this.root.ownerDocument.defaultView.Element?e.target:this.root,n=e;if(e.type==="pointermove"&&n.buttons===0)return;let r=t,o=null;for(;r&&r!==this.root;){for(const l of["data-layout-fragment-id","data-layout-block-ref","data-page-index","data-item","data-testid","aria-label"]){const u=r.getAttribute(l);if(u){o=`[${l}=${JSON.stringify(u)}]`;break}}if(o)break;r=r.parentElement}if(!o&&t!==this.root){const l=[];for(r=t;r&&r!==this.root;){const u=r.parentElement;if(!u)break;l.unshift(`:nth-child(${Array.prototype.indexOf.call(u.children,r)+1})`),r=u}r===this.root&&(o=`:scope > ${l.join(" > ")}`),r=t}const i=e,s={selector:o};if(e.type.startsWith("pointer")||["mousedown","mouseup","click","dblclick"].includes(e.type)){const l=[];let u=r??this.root;for(;u&&u!==this.root;){const p=u.parentElement;if(!p)break;l.unshift(`:nth-child(${Array.prototype.indexOf.call(p.children,u)+1})`),u=p}u===this.root&&l.length&&(s.domPath=`:scope > ${l.join(" > ")}`);const d=new Set;for(let p=t;p&&p!==this.root;p=p.parentElement){for(const[m,v]of[["data-source-node-id","blockId"],["data-layout-fragment-id","fragmentId"],["data-layout-block-ref","layoutBlockRef"],["data-layout-story","storyId"],["data-page-index","pageIndex"]]){const C=p.getAttribute(m);C&&s[v]==null&&(s[v]=v==="pageIndex"?Number(C):C)}const g=p.getAttribute("data-sdt-id")??p.getAttribute("data-sdt-container-id");g&&d.add(g),p.classList.contains("superdoc-table-fragment")&&s.tableId==null&&(s.tableId=p.getAttribute("data-layout-block-ref"))}s.contentControlIds=[...d],s.contextSource="painted-pointer",s.fragmentId&&s.pageIndex!=null&&(s.selector=`[data-page-index="${s.pageIndex}"] ${o}`);const f=[];for(let p=t;p;p=p.parentElement){const g=this.root.ownerDocument.defaultView.getComputedStyle(p),m=p===this.root||/auto|scroll/.test(`${g.overflowX} ${g.overflowY}`);if(p.scrollLeft||p.scrollTop||m&&(p.scrollWidth>p.clientWidth||p.scrollHeight>p.clientHeight)){const v=[];let C=p;for(;C&&C!==this.root;){const w=C.parentElement;if(!w)break;v.unshift(`:nth-child(${Array.prototype.indexOf.call(w.children,C)+1})`),C=w}C===this.root&&f.push({selector:p===this.root?null:`:scope > ${v.join(" > ")}`,scrollLeft:p.scrollLeft,scrollTop:p.scrollTop})}if(p===this.root)break;if(f.length>=32)throw new Error("scroll-ancestor-limit")}s.scrollAncestors=f}const a={target:s,inputAtMs:e.timeStamp>this.root.ownerDocument.defaultView.performance.timeOrigin?e.timeStamp-this.root.ownerDocument.defaultView.performance.timeOrigin:e.timeStamp,altKey:i.altKey,ctrlKey:i.ctrlKey,metaKey:i.metaKey,shiftKey:i.shiftKey};if(e.type==="keydown"||e.type==="keyup"){const l=i.key;e.type==="keydown"?this.heldKeys.add(l):this.heldKeys.delete(l);const u=mx.has(l)||/^F(?:[1-9]|1\d|2[0-4])$/.test(l);a.key=!u&&!this.session.captureContent?void 0:l,a.repeat=i.repeat,a.isComposing=i.isComposing,!u&&!this.session.captureContent&&this.unsupported("content-redacted"),(i.isComposing||l==="Dead"||l==="Process")&&this.unsupported("ime")}else if(e.type.startsWith("pointer")||["mousedown","mouseup","click","dblclick"].includes(e.type)){const l=(r??this.root).getBoundingClientRect();e.type==="pointerdown"&&this.heldButtons.add(n.button),e.type==="pointerup"&&this.heldButtons.delete(n.button),Object.assign(a,{button:n.button,buttons:n.buttons,pointerType:n.pointerType??"mouse",clickCount:n.detail,x:n.clientX-l.left,y:n.clientY-l.top}),n.pointerType&&n.pointerType!=="mouse"&&this.unsupported("non-mouse-pointer"),o||this.unsupported("unresolved-pointer-target")}else if(e.type==="scroll")Object.assign(a,{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t!==this.root&&!o&&this.unsupported("unresolved-scroll-target");else{const l=e;Object.assign(a,{inputType:l.inputType,dataLength:l.data?.length,...this.session.captureContent?{data:l.data}:{}}),l.data&&!this.session.captureContent&&this.unsupported("content-redacted"),["paste","cut","drop","dragstart","compositionstart","compositionend"].includes(e.type)&&this.unsupported(e.type),e.type==="beforeinput"&&l.inputType!=="insertText"&&!l.inputType?.startsWith("delete")&&this.unsupported(`beforeinput:${l.inputType}`)}this.observe(`browser:${e.type}`,()=>a)}catch{this.fail("capture-failure")}}clearHeldInput(){this.heldKeys.clear(),this.heldButtons.clear()}stop(){return this.active&&((this.heldKeys.size||this.heldButtons.size)&&this.unsupported("held-input-at-stop"),this.session.durationMs=this.root.ownerDocument.defaultView.performance.now()-this.startMs,this.session.status="stopped",this.clearHeldInput()),this.detachInputs(),this.snapshot()}snapshot(){return this.session?{...this.session,viewport:{...this.session.viewport},durationMs:this.active?this.root.ownerDocument.defaultView.performance.now()-this.startMs:this.session.durationMs,replayUnsupportedReasons:[...this.session.replayUnsupportedReasons],events:this.events.map(e=>JSON.parse(e)),pendingIntentIds:[...this.pendingIntents]}:null}close(){this.active&&this.fail("instance-destroyed"),this.closed=!0,this.detachInputs()}};function M2(e){try{return ys(ys(ys(e,"diagnostics"),"recording"),"enabled")===!0}catch{return!1}}var Cu=new WeakMap,yx=0,L2=["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"],bx=["text","data","message","errorMessage","quotedText","value"];function ys(e,t){if(!(!e||typeof e!="object"))return Object.getOwnPropertyDescriptor(e,t)?.value}function P2(e,t,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=n?e:t}var wx=class{constructor(e,t,n){if(this.version=t,this.sessionId=`interaction-${++yx}`,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=[],M2(e))try{this.workflow=new vx(n,t)}catch{}const r=ys(ys(e,"diagnostics"),"history");this.enabled=ys(r,"enabled")!==!1,this.captureContent=ys(r,"captureContent")===!0,this.maxEvents=P2(ys(r,"maxEvents"),500,1e4),this.maxBytes=P2(ys(r,"maxBytes"),1048576,16777216)}record(e,t){if(this.workflow?.observe(e,t),!(!this.enabled||this.closed))try{let n=!1,r=128;const o=(l,u=0)=>{if(--r<0||u>5){n=!0;return}if(l===null||typeof l=="boolean")return l;if(typeof l=="number")return Number.isFinite(l)?l:void 0;if(typeof l=="string")return l.length>512&&(n=!0),l.slice(0,512);if(!l||typeof l!="object")return;if(Array.isArray(l)){const f=Math.min(l.length,16);l.length>f&&(n=!0);const p=[];for(let g=0;g<f&&r>0;g++)p.push(o(ys(l,String(g)),u+1)??null);return p}const d={};for(const f of this.captureContent?[...L2,...bx]:L2){if(r<=0){n=!0;break}const p=ys(l,f);if(p===void 0)continue;const g=o(p,u+1);g!==void 0&&(d[f]=g)}return d},i=o(t())??{};if(e==="selection:changed"){const l=JSON.stringify(i);if(l===this.lastSelection)return;this.lastSelection=l}else this.lastSelection=void 0;const s={sequence:++this.sequence,observedAt:Date.now(),type:e,data:i,truncated:n};let a=JSON.stringify(s);if(a.length*2>Math.min(8192,this.maxBytes)&&(s.data={},s.truncated=!0,a=JSON.stringify(s)),s.truncated&&this.truncated++,a.length*2>this.maxBytes){this.evicted++;return}for(;this.count&&(this.count>=this.maxEvents||this.bytes+a.length*2>this.maxBytes);){const l=this.slots[this.head];this.bytes-=l.length*2,this.slots[this.head]=void 0,this.head=(this.head+1)%this.maxEvents,this.count--,this.evicted++}this.slots[(this.head+this.count)%this.maxEvents]=a,this.count++,this.bytes+=a.length*2}catch{this.failures++}}action(){return(this.enabled||this.workflow?.active)&&!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.workflow?.close(),this.closed=!0;for(const e of this.cleanups)try{e()}catch{this.failures++}this.cleanups=[]}},D2=()=>({schemaVersion:1,sessionId:"unavailable",version:"unknown",enabled:!1,events:[],retainedBytes:0,evictedEvents:0,truncatedEvents:0,captureFailures:1}),Cx=Object.freeze({getSnapshot:D2,clear(){}});function kx(e,t,n,r){try{const o=new wx(t,n,r);Cu.set(e,o),o.attach(r);const i=Object.freeze({...o.workflow?{recording:o.workflow.api}:{},getSnapshot:()=>{try{return o.snapshot()}catch{return D2()}},clear:()=>{try{o.clear()}catch{}}});return o.record("instance:created",()=>({})),i}catch{return Cx}}function Zd(e,t,n){try{e&&Cu.get(e)?.record(t,n)}catch{}}function Sx(e,t,n){try{const r=Cu.get(e),o=r?.action();return o&&r?.record(t,()=>({...n(),actionId:o})),o}catch{return}}function _x(e){try{Cu.get(e)?.close(),Cu.delete(e)}catch{}}function Ax(e){return Cu.get(e)?.workflow?.api}var Ix=T2(((e,t)=>{var n=Object.prototype.hasOwnProperty,r="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(r=!1));function i(u,d,f){this.fn=u,this.context=d,this.once=f||!1}function s(u,d,f,p,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var m=new i(f,p||u,g),v=r?r+d:d;return u._events[v]?u._events[v].fn?u._events[v]=[u._events[v],m]:u._events[v].push(m):(u._events[v]=m,u._eventsCount++),u}function a(u,d){--u._eventsCount===0?u._events=new o:delete u._events[d]}function l(){this._events=new o,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],f,p;if(this._eventsCount===0)return d;for(p in f=this._events)n.call(f,p)&&d.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},l.prototype.listeners=function(d){var f=r?r+d:d,p=this._events[f];if(!p)return[];if(p.fn)return[p.fn];for(var g=0,m=p.length,v=new Array(m);g<m;g++)v[g]=p[g].fn;return v},l.prototype.listenerCount=function(d){var f=r?r+d:d,p=this._events[f];return p?p.fn?1:p.length:0},l.prototype.emit=function(d,f,p,g,m,v){var C=r?r+d:d;if(!this._events[C])return!1;var w=this._events[C],_=arguments.length,b,S;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,g),!0;case 5:return w.fn.call(w.context,f,p,g,m),!0;case 6:return w.fn.call(w.context,f,p,g,m,v),!0}for(S=1,b=new Array(_-1);S<_;S++)b[S-1]=arguments[S];w.fn.apply(w.context,b)}else{var x=w.length,L;for(S=0;S<x;S++)switch(w[S].once&&this.removeListener(d,w[S].fn,void 0,!0),_){case 1:w[S].fn.call(w[S].context);break;case 2:w[S].fn.call(w[S].context,f);break;case 3:w[S].fn.call(w[S].context,f,p);break;case 4:w[S].fn.call(w[S].context,f,p,g);break;default:if(!b)for(L=1,b=new Array(_-1);L<_;L++)b[L-1]=arguments[L];w[S].fn.apply(w[S].context,b)}}return!0},l.prototype.on=function(d,f,p){return s(this,d,f,p,!1)},l.prototype.once=function(d,f,p){return s(this,d,f,p,!0)},l.prototype.removeListener=function(d,f,p,g){var m=r?r+d:d;if(!this._events[m])return this;if(!f)return a(this,m),this;var v=this._events[m];if(v.fn)v.fn===f&&(!g||v.once)&&(!p||v.context===p)&&a(this,m);else{for(var C=0,w=[],_=v.length;C<_;C++)(v[C].fn!==f||g&&!v[C].once||p&&v[C].context!==p)&&w.push(v[C]);w.length?this._events[m]=w.length===1?w[0]:w:a(this,m)}return this},l.prototype.removeAllListeners=function(d){var f;return d?(f=r?r+d:d,this._events[f]&&a(this,f)):(this._events=new o,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,typeof t<"u"&&(t.exports=l)})),pv=x2(Ix(),1),xo=[];for(let e=0;e<256;++e)xo.push((e+256).toString(16).slice(1));function Ex(e,t=0){return(xo[e[t+0]]+xo[e[t+1]]+xo[e[t+2]]+xo[e[t+3]]+"-"+xo[e[t+4]]+xo[e[t+5]]+"-"+xo[e[t+6]]+xo[e[t+7]]+"-"+xo[e[t+8]]+xo[e[t+9]]+"-"+xo[e[t+10]]+xo[e[t+11]]+xo[e[t+12]]+xo[e[t+13]]+xo[e[t+14]]+xo[e[t+15]]).toLowerCase()}var mv,Tx=new Uint8Array(16);function xx(){if(!mv){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");mv=crypto.getRandomValues.bind(crypto)}return mv(Tx)}var Rx=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),O2={randomUUID:Rx};function Sa(e,t,n){if(O2.randomUUID&&!t&&!e)return O2.randomUUID();e=e||{};const r=e.random??e.rng?.()??xx();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 Ex(r)}function Qd(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}function Rn(e){if(Gt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=ar(r)?Mx(r):Rn(r);if(o)for(const i in o)t[i]=o[i]}return t}else if(ar(e)||$n(e))return e}function Mx(e){const t={};return e.replace(W2,"").split(H2).forEach(n=>{if(n){const r=n.split(G2);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function on(e){let t="";if(ar(e))t=e;else if(Gt(e))for(let n=0;n<e.length;n++){const r=on(e[n]);r&&(t+=r+" ")}else if($n(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function gv(e){if(!e)return null;let{class:t,style:n}=e;return t&&!ar(t)&&(e.class=on(t)),n&&(e.style=Rn(n)),e}function F2(e){return!!e||e===""}function Lx(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=_a(e[r],t[r]);return n}function _a(e,t){if(e===t)return!0;let n=yv(e),r=yv(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=vi(e),r=vi(t),n||r)return e===t;if(n=Gt(e),r=Gt(t),n||r)return n&&r?Lx(e,t):!1;if(n=$n(e),r=$n(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||!_a(e[o],t[o]))return!1}}return String(e)===String(t)}function ip(e,t){return e.findIndex(n=>_a(n,t))}function Px(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:(typeof e!="number"||Number.isFinite(e),String(e))}var Bn,bc,Ti,vv,ku,Jd,er,sp,N2,qn,Gt,wc,yl,yv,B2,un,ar,vi,$n,ap,bv,Cc,z2,ef,tf,bl,nf,j2,Wr,V2,ti,Su,_u,mo,kc,wv,rf,of,U2,sf,$2,H2,G2,W2,Cv,K2,Dx,kv,Et,Sv,lp,_v=Fr((()=>{Bn={},bc=[],Ti=()=>{},vv=()=>!1,ku=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Jd=e=>e.startsWith("onUpdate:"),er=Object.assign,sp=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},N2=Object.prototype.hasOwnProperty,qn=(e,t)=>N2.call(e,t),Gt=Array.isArray,wc=e=>Cc(e)==="[object Map]",yl=e=>Cc(e)==="[object Set]",yv=e=>Cc(e)==="[object Date]",B2=e=>Cc(e)==="[object RegExp]",un=e=>typeof e=="function",ar=e=>typeof e=="string",vi=e=>typeof e=="symbol",$n=e=>e!==null&&typeof e=="object",ap=e=>($n(e)||un(e))&&un(e.then)&&un(e.catch),bv=Object.prototype.toString,Cc=e=>bv.call(e),z2=e=>Cc(e).slice(8,-1),ef=e=>Cc(e)==="[object Object]",tf=e=>ar(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,bl=Qd(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),nf=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},j2=/-\w/g,Wr=nf(e=>e.replace(j2,t=>t.slice(1).toUpperCase())),V2=/\B([A-Z])/g,ti=nf(e=>e.replace(V2,"-$1").toLowerCase()),Su=nf(e=>e.charAt(0).toUpperCase()+e.slice(1)),_u=nf(e=>e?`on${Su(e)}`:""),mo=(e,t)=>!Object.is(e,t),kc=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},wv=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},rf=e=>{const t=parseFloat(e);return isNaN(t)?e:t},of=e=>{const t=ar(e)?Number(e):NaN;return isNaN(t)?e:t},sf=()=>U2||(U2=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),$2=Qd("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"),H2=/;(?![^(]*\))/g,G2=/:([^]+)/,W2=/\/\*[^]*?\*\//g,Cv="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",K2=Qd(Cv),Dx=Qd(Cv+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),kv=e=>!!(e&&e.__v_isRef===!0),Et=e=>ar(e)?e:e==null?"":Gt(e)||$n(e)&&(e.toString===bv||!un(e.toString))?kv(e)?Et(e.value):JSON.stringify(e,Sv,2):String(e),Sv=(e,t)=>kv(t)?Sv(e,t.value):wc(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],i)=>(n[lp(r,i)+" =>"]=o,n),{})}:yl(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>lp(n))}:vi(t)?lp(t):$n(t)&&!Gt(t)&&!ef(t)?String(t):t,lp=(e,t="")=>{var n;return vi(e)?`Symbol(${(n=e.description)!=null?n:t})`:e}}));function Av(e){return new pp(e)}function Iv(){return Ho}function q2(e,t=!1){Ho&&Ho.cleanups.push(e)}function Y2(e,t=!1){if(e.flags|=8,t){e.next=uf,uf=e;return}e.next=cf,cf=e}function Ev(){Ov++}function Tv(){if(--Ov>0)return;if(uf){let t=uf;for(uf=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;cf;){let t=cf;for(cf=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 X2(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Z2(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),Rv(r),Ox(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function xv(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Q2(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Q2(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Eu)||(e.globalVersion=Eu,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!xv(e))))return;e.flags|=2;const t=e.dep,n=fr,r=Ji;fr=e,Ji=!0;try{X2(e);const o=e.fn(e._value);(t.version===0||mo(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{fr=n,Ji=r,Z2(e),e.flags&=-3}}function Rv(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)Rv(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Ox(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function Fx(e,t){e.effect instanceof Iu&&(e=e.effect.fn);const n=new Iu(e);t&&er(n,t);try{n.run()}catch(o){throw n.stop(),o}const r=n.run.bind(n);return r.effect=n,r}function Nx(e){e.effect.stop()}function Aa(){Fv.push(Ji),Ji=!1}function Ia(){const e=Fv.pop();Ji=e===void 0?!0:e}function J2(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=fr;fr=void 0;try{t()}finally{fr=n}}}function ew(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)ew(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}function $o(e,t,n){if(Ji&&fr){let r=ff.get(e);r||ff.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new df),o.map=r,o.key=n),o.track()}}function Ea(e,t,n,r,o,i){const s=ff.get(e);if(!s){Eu++;return}const a=l=>{l&&l.trigger()};if(Ev(),t==="clear")s.forEach(a);else{const l=Gt(e),u=l&&tf(n);if(l&&n==="length"){const d=Number(r);s.forEach((f,p)=>{(p==="length"||p===Tu||!vi(p)&&p>=d)&&a(f)})}else switch((n!==void 0||s.has(void 0))&&a(s.get(n)),u&&a(s.get(Tu)),t){case"add":l?u&&a(s.get("length")):(a(s.get(wl)),wc(e)&&a(s.get(gp)));break;case"delete":l||(a(s.get(wl)),wc(e)&&a(s.get(gp)));break;case"set":wc(e)&&a(s.get(wl));break}}Tv()}function Bx(e,t){const n=ff.get(e);return n&&n.get(t)}function Au(e){const t=En(e);return t===e?t:($o(t,"iterate",Tu),bi(e)?t:t.map(es))}function cp(e){return $o(e=En(e),"iterate",Tu),e}function Us(e,t){return $s(e)?Sc(yi(e)?es(t):t):es(t)}function Mv(e,t,n){const r=cp(e),o=r[t]();return r!==e&&!bi(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}function Ta(e,t,n,r,o,i){const s=cp(e),a=s!==e&&!bi(e),l=s[t];if(l!==uw[t]){const f=l.apply(e,i);return a?es(f):f}let u=n;s!==e&&(a?u=function(f,p){return n.call(this,Us(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 tw(e,t,n,r){const o=cp(e),i=o!==e&&!bi(e);let s=n,a=!1;o!==e&&(i?(a=r.length===0,s=function(u,d,f){return a&&(a=!1,u=Us(e,u)),n.call(this,u,Us(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?Us(e,l):l}function Lv(e,t,n){const r=En(e);$o(r,"iterate",Tu);const o=r[t](...n);return(o===-1||o===!1)&&lf(n[0])?(n[0]=En(n[0]),r[t](...n)):o}function af(e,t,n=[]){Aa(),Ev();const r=En(e)[t].apply(e,n);return Tv(),Ia(),r}function zx(e){vi(e)||(e=String(e));const t=En(this);return $o(t,"has",e),t.hasOwnProperty(e)}function jx(e,t,n){return function(...r){const o=this.__v_raw,i=En(o),s=wc(i),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,u=o[e](...r),d=n?vp:t?Sc:es;return!t&&$o(i,"iterate",l?gp:wl),er(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 up(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Vx(e,t){const n={get(r){const o=this.__v_raw,i=En(o),s=En(r);e||(mo(r,s)&&$o(i,"get",r),$o(i,"get",s));const{has:a}=hf(i),l=t?vp:e?Sc:es;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&&$o(En(r),"iterate",wl),r.size},has(r){const o=this.__v_raw,i=En(o),s=En(r);return e||(mo(r,s)&&$o(i,"has",r),$o(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=En(s),l=t?vp:e?Sc:es;return!e&&$o(a,"iterate",wl),s.forEach((u,d)=>r.call(o,l(u),l(d),i))}};return er(n,e?{add:up("add"),set:up("set"),delete:up("delete"),clear:up("clear")}:{add(r){const o=En(this),i=hf(o),s=En(r),a=!t&&!bi(r)&&!$s(r)?s:r;return i.has.call(o,a)||mo(r,a)&&i.has.call(o,r)||mo(s,a)&&i.has.call(o,s)||(o.add(a),Ea(o,"add",a,a)),this},set(r,o){!t&&!bi(o)&&!$s(o)&&(o=En(o));const i=En(this),{has:s,get:a}=hf(i);let l=s.call(i,r);l||(r=En(r),l=s.call(i,r));const u=a.call(i,r);return i.set(r,o),l?mo(o,u)&&Ea(i,"set",r,o,u):Ea(i,"add",r,o),this},delete(r){const o=En(this),{has:i,get:s}=hf(o);let a=i.call(o,r);a||(r=En(r),a=i.call(o,r));const l=s?s.call(o,r):void 0,u=o.delete(r);return a&&Ea(o,"delete",r,void 0,l),u},clear(){const r=En(this),o=r.size!==0,i=void 0,s=r.clear();return o&&Ea(r,"clear",void 0,void 0,i),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=jx(r,e,t)}),n}function dp(e,t){const n=Vx(e,t);return(r,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(qn(n,o)&&o in r?n:r,o,i)}function Ux(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function $x(e){return e.__v_skip||!Object.isExtensible(e)?0:Ux(z2(e))}function io(e){return $s(e)?e:hp(e,!1,fw,gw,Vv)}function nw(e){return hp(e,!1,pw,vw,Uv)}function fp(e){return hp(e,!0,hw,yw,$v)}function Hx(e){return hp(e,!0,mw,bw,Hv)}function hp(e,t,n,r,o){if(!$n(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=$x(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 yi(e){return $s(e)?yi(e.__v_raw):!!(e&&e.__v_isReactive)}function $s(e){return!!(e&&e.__v_isReadonly)}function bi(e){return!!(e&&e.__v_isShallow)}function lf(e){return e?!!e.__v_raw:!1}function En(e){const t=e&&e.__v_raw;return t?En(t):e}function Qr(e){return!qn(e,"__v_skip")&&Object.isExtensible(e)&&wv(e,"__v_skip",!0),e}function vr(e){return e?e.__v_isRef===!0:!1}function ne(e){return rw(e,!1)}function Mr(e){return rw(e,!0)}function rw(e,t){return vr(e)?e:new ww(e,t)}function Gx(e){e.dep&&e.dep.trigger()}function Ye(e){return vr(e)?e.value:e}function Wx(e){return un(e)?e():Ye(e)}function Pv(e){return yi(e)?e:new Proxy(e,Cw)}function ow(e){return new kw(e)}function iw(e){const t=Gt(e)?new Array(e.length):{};for(const n in e)t[n]=sw(e,n);return t}function Dv(e,t,n){return vr(e)?e:un(e)?new _w(e):$n(e)&&arguments.length>1?sw(e,t,n):ne(e)}function sw(e,t,n){return new Sw(e,t,n)}function Kx(e,t,n=!1){let r,o;return un(e)?r=e:(r=e.get,o=e.set),new Aw(r,o,n)}function qx(){return Ra}function aw(e,t=!1,n=Ra){if(n){let r=mf.get(n);r||mf.set(n,r=[]),r.push(e)}}function Yx(e,t,n=Bn){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,u=S=>o?S:bi(S)||o===!1||o===0?xa(S,1):xa(S);let d,f,p,g,m=!1,v=!1;if(vr(e)?(f=()=>e.value,m=bi(e)):yi(e)?(f=()=>u(e),m=!0):Gt(e)?(v=!0,m=e.some(S=>yi(S)||bi(S)),f=()=>e.map(S=>{if(vr(S))return S.value;if(yi(S))return u(S);if(un(S))return l?l(S,2):S()})):un(e)?t?f=l?()=>l(e,2):e:f=()=>{if(p){Aa();try{p()}finally{Ia()}}const S=Ra;Ra=d;try{return l?l(e,3,[g]):e(g)}finally{Ra=S}}:f=Ti,t&&o){const S=f,x=o===!0?1/0:o;f=()=>xa(S(),x)}const C=Iv(),w=()=>{d.stop(),C&&C.active&&sp(C.effects,d)};if(i&&t){const S=t;t=(...x)=>{S(...x),w()}}let _=v?new Array(e.length).fill(pf):pf;const b=S=>{if(!(!(d.flags&1)||!d.dirty&&!S))if(t){const x=d.run();if(o||m||(v?x.some((L,B)=>mo(L,_[B])):mo(x,_))){p&&p();const L=Ra;Ra=d;try{const B=[x,_===pf?void 0:v&&_[0]===pf?[]:_,g];_=x,l?l(t,3,B):t(...B)}finally{Ra=L}}}else d.run()};return a&&a(b),d=new Iu(f),d.scheduler=s?()=>s(b,!1):b,g=S=>aw(S,!1,d),p=d.onStop=()=>{const S=mf.get(d);if(S){if(l)l(S,4);else for(const x of S)x();mf.delete(d)}},t?r?b(!0):_=d.run():s?s(b.bind(null,!0),!0):d.run(),w.pause=d.pause.bind(d),w.resume=d.resume.bind(d),w.stop=w,w}function xa(e,t=1/0,n){if(t<=0||!$n(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,vr(e))xa(e.value,t,n);else if(Gt(e))for(let r=0;r<e.length;r++)xa(e[r],t,n);else if(yl(e)||wc(e))e.forEach(r=>{xa(r,t,n)});else if(ef(e)){for(const r in e)xa(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&xa(e[r],t,n)}return e}var Ho,pp,fr,mp,Iu,Ov,cf,uf,Ji,Fv,Eu,lw,df,ff,wl,gp,Tu,cw,uw,dw,Nv,Bv,zv,jv,fw,hw,pw,mw,vp,hf,gw,vw,yw,bw,Vv,Uv,$v,Hv,es,Sc,ww,Cw,kw,Sw,_w,Aw,Iw,Ew,pf,mf,Ra,Xx=Fr((()=>{_v(),pp=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=Ho,!e&&Ho&&(this.index=(Ho.scopes||(Ho.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=Ho;try{return Ho=this,e()}finally{Ho=t}}}on(){++this._on===1&&(this.prevScope=Ho,Ho=this)}off(){this._on>0&&--this._on===0&&(Ho=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}}},mp=new WeakSet,Iu=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,Ho&&Ho.active&&Ho.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,mp.has(this)&&(mp.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Y2(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,J2(this),X2(this);const e=fr,t=Ji;fr=this,Ji=!0;try{return this.fn()}finally{Z2(this),fr=e,Ji=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Rv(e);this.deps=this.depsTail=void 0,J2(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?mp.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){xv(this)&&this.run()}get dirty(){return xv(this)}},Ov=0,Ji=!0,Fv=[],Eu=0,lw=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}},df=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(!fr||!Ji||fr===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==fr)t=this.activeLink=new lw(fr,this),fr.deps?(t.prevDep=fr.depsTail,fr.depsTail.nextDep=t,fr.depsTail=t):fr.deps=fr.depsTail=t,ew(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=fr.depsTail,t.nextDep=void 0,fr.depsTail.nextDep=t,fr.depsTail=t,fr.deps===t&&(fr.deps=n)}return t}trigger(e){this.version++,Eu++,this.notify(e)}notify(e){Ev();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Tv()}}},ff=new WeakMap,wl=Symbol(""),gp=Symbol(""),Tu=Symbol(""),cw={__proto__:null,[Symbol.iterator](){return Mv(this,Symbol.iterator,e=>Us(this,e))},concat(...e){return Au(this).concat(...e.map(t=>Gt(t)?Au(t):t))},entries(){return Mv(this,"entries",e=>(e[1]=Us(this,e[1]),e))},every(e,t){return Ta(this,"every",e,t,void 0,arguments)},filter(e,t){return Ta(this,"filter",e,t,n=>n.map(r=>Us(this,r)),arguments)},find(e,t){return Ta(this,"find",e,t,n=>Us(this,n),arguments)},findIndex(e,t){return Ta(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Ta(this,"findLast",e,t,n=>Us(this,n),arguments)},findLastIndex(e,t){return Ta(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Ta(this,"forEach",e,t,void 0,arguments)},includes(...e){return Lv(this,"includes",e)},indexOf(...e){return Lv(this,"indexOf",e)},join(e){return Au(this).join(e)},lastIndexOf(...e){return Lv(this,"lastIndexOf",e)},map(e,t){return Ta(this,"map",e,t,void 0,arguments)},pop(){return af(this,"pop")},push(...e){return af(this,"push",e)},reduce(e,...t){return tw(this,"reduce",e,t)},reduceRight(e,...t){return tw(this,"reduceRight",e,t)},shift(){return af(this,"shift")},some(e,t){return Ta(this,"some",e,t,void 0,arguments)},splice(...e){return af(this,"splice",e)},toReversed(){return Au(this).toReversed()},toSorted(e){return Au(this).toSorted(e)},toSpliced(...e){return Au(this).toSpliced(...e)},unshift(...e){return af(this,"unshift",e)},values(){return Mv(this,"values",e=>Us(this,e))}},uw=Array.prototype,dw=Qd("__proto__,__v_isRef,__isVue"),Nv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(vi)),Bv=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?Hv:$v:o?Uv:Vv).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=Gt(e);if(!r){let a;if(i&&(a=cw[t]))return a;if(t==="hasOwnProperty")return zx}const s=Reflect.get(e,t,vr(e)?e:n);if((vi(t)?Nv.has(t):dw(t))||(r||$o(e,"get",t),o))return s;if(vr(s)){const a=i&&tf(t)?s:s.value;return r&&$n(a)?fp(a):a}return $n(s)?r?fp(s):io(s):s}},zv=class extends Bv{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t];const i=Gt(e)&&tf(t);if(!this._isShallow){const l=$s(o);if(!bi(n)&&!$s(n)&&(o=En(o),n=En(n)),!i&&vr(o)&&!vr(n))return l||(o.value=n),!0}const s=i?Number(t)<e.length:qn(e,t),a=Reflect.set(e,t,n,vr(e)?e:r);return e===En(r)&&(s?mo(n,o)&&Ea(e,"set",t,n,o):Ea(e,"add",t,n)),a}deleteProperty(e,t){const n=qn(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&Ea(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return(!vi(t)||!Nv.has(t))&&$o(e,"has",t),n}ownKeys(e){return $o(e,"iterate",Gt(e)?"length":wl),Reflect.ownKeys(e)}},jv=class extends Bv{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},fw=new zv,hw=new jv,pw=new zv(!0),mw=new jv(!0),vp=e=>e,hf=e=>Reflect.getPrototypeOf(e),gw={get:dp(!1,!1)},vw={get:dp(!1,!0)},yw={get:dp(!0,!1)},bw={get:dp(!0,!0)},Vv=new WeakMap,Uv=new WeakMap,$v=new WeakMap,Hv=new WeakMap,es=e=>$n(e)?io(e):e,Sc=e=>$n(e)?fp(e):e,ww=class{constructor(e,t){this.dep=new df,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:En(e),this._value=t?e:es(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||bi(e)||$s(e);e=n?e:En(e),mo(e,t)&&(this._rawValue=e,this._value=n?e:es(e),this.dep.trigger())}},Cw={get:(e,t,n)=>t==="__v_raw"?e:Ye(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return vr(o)&&!vr(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}},kw=class{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new df,{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)}},Sw=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=vi(t)?t:String(t),this._raw=En(e);let r=!0,o=e;if(!Gt(e)||vi(this._key)||!tf(this._key))do r=!lf(o)||bi(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=Ye(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&vr(this._raw[this._key])){const t=this._object[this._key];if(vr(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return Bx(this._raw,this._key)}},_w=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()}},Aw=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new df(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Eu-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&fr!==this)return Y2(this,!0),!0}get value(){const e=this.dep.track();return Q2(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},Iw={GET:"get",HAS:"has",ITERATE:"iterate"},Ew={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},pf={},mf=new WeakMap,Ra=void 0}));function Zx(e){dy.push(e)}function Qx(){dy.pop()}function Jx(e,t){}function xu(e,t,n,r){try{return r?e(...r):e()}catch(o){_c(o,t,n)}}function ts(e,t,n,r){if(un(e)){const o=xu(e,t,n,r);return o&&ap(o)&&o.catch(i=>{_c(i,t,n)}),o}if(Gt(e)){const o=[];for(let i=0;i<e.length;i++)o.push(ts(e[i],t,n,r));return o}}function _c(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Bn;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){Aa(),xu(i,null,10,[e,l,u]),Ia();return}}e5(e,n,o,r,s)}function e5(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}function _t(e){const t=If||fy;return e?t.then(this?e.bind(this):e):t}function t5(e){let t=ws+1,n=Go.length;for(;t<n;){const r=t+n>>>1,o=Go[r],i=Du(o);i<e||i===e&&o.flags&2?t=r+1:n=r}return t}function Gv(e){if(!(e.flags&1)){const t=Du(e),n=Go[Go.length-1];!n||!(e.flags&2)&&t>=Du(n)?Go.push(e):Go.splice(t5(t),0,e),e.flags|=1,Tw()}}function Tw(){If||(If=fy.then(Rw))}function gf(e){Gt(e)?Ic.push(...e):Da&&e.id===-1?Da.splice(Ec+1,0,e):e.flags&1||(Ic.push(e),e.flags|=1),Tw()}function xw(e,t,n=ws+1){for(;n<Go.length;n++){const r=Go[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Go.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function yp(e){if(Ic.length){const t=[...new Set(Ic)].sort((n,r)=>Du(n)-Du(r));if(Ic.length=0,Da){Da.push(...t);return}for(Da=t,Ec=0;Ec<Da.length;Ec++){const n=Da[Ec];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Da=null,Ec=0}}function Rw(e){try{for(ws=0;ws<Go.length;ws++){const t=Go[ws];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),xu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ws<Go.length;ws++){const t=Go[ws];t&&(t.flags&=-2)}ws=-1,Go.length=0,yp(e),If=null,(Go.length||Ic.length)&&Rw(e)}}function Mw(e,t){var n,r;Ou=e,Ou?(Ou.enabled=!0,Ef.forEach(({event:o,args:i})=>Ou.emit(o,...i)),Ef=[]):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=>{Mw(o,t)}),setTimeout(()=>{Ou||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,Ef=[])},3e3)):Ef=[]}function vf(e){const t=vo;return vo=e,Tf=e&&e.type.__scopeId||null,t}function n5(e){Tf=e}function r5(){Tf=null}function go(e,t=vo,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&_f(-1);const i=vf(t);let s;try{s=e(...o)}finally{vf(i),r._d&&_f(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function xi(e,t){if(vo===null)return e;const n=Af(vo),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,s,a,l=Bn]=t[o];i&&(un(i)&&(i={mounted:i,updated:i}),i.deep&&xa(s),r.push({dir:i,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function Hs(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&&(Aa(),ts(l,n,8,[e.el,a,e,t]),Ia())}}function Wv(e,t){if(yo){let n=yo.provides;const r=yo.parent&&yo.parent.provides;r===n&&(n=yo.provides=Object.create(r)),n[e]=t}}function Gs(e,t,n=!1){const r=Sr();if(r||Al){let o=Al?Al._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&&un(t)?t.call(r&&r.proxy):t}}function Lw(){return!!(Sr()||Al)}function o5(e,t){return yf(e,null,t)}function i5(e,t){return yf(e,null,{flush:"post"})}function Pw(e,t){return yf(e,null,{flush:"sync"})}function $t(e,t,n){return yf(e,t,n)}function yf(e,t,n=Bn){const{immediate:r,deep:o,flush:i,once:s}=n,a=er({},n),l=t&&r||!t&&i!=="post";let u;if(Tl){if(i==="sync"){const g=py();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!l){const g=()=>{};return g.stop=Ti,g.resume=Ti,g.pause=Ti,g}}const d=yo;a.call=(g,m,v)=>ts(g,d,m,v);let f=!1;i==="post"?a.scheduler=g=>{Kr(g,d&&d.suspense)}:i!=="sync"&&(f=!0,a.scheduler=(g,m)=>{m?g():Gv(g)}),a.augmentJob=g=>{t&&(g.flags|=4),f&&(g.flags|=2,d&&(g.id=d.uid,g.i=d))};const p=Yx(e,t,a);return Tl&&(u?u.push(p):l&&p()),p}function s5(e,t,n){const r=this.proxy,o=ar(e)?e.includes(".")?Dw(r,e):()=>r[e]:e.bind(r,r);let i;un(t)?i=t:(i=t.handler,n=t);const s=Rc(this),a=yf(o,i.bind(r),n);return s(),a}function Dw(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 bp(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||Sl(d))&&l&16)for(let p=0;p<u.length;p++)o(u[p],t,n,2);f&&r(a,t,n)}function a5(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 g(C,w){w.anchor=f(s(C),w,a(C),n,r,o,i)}const m=t.target=Rp(t.props,l),v=Sl(t.props);if(m){const C=m._lpa||m.firstChild;t.shapeFlag&16&&(v?(g(e,t),p(m,C),t.targetAnchor||Kv(m,t,d,u,a(e)===m?e:null)):(t.anchor=s(e),p(m,C),t.targetAnchor||Kv(m,t,d,u),f(C&&s(C),t,m,n,r,o,i))),bf(t,v)}else v&&t.shapeFlag&16&&(g(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}function bf(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 Kv(e,t,n,r,o=null){const i=t.targetStart=n(""),s=t.targetAnchor=n("");return i[my]=s,e&&(r(i,e,o),r(s,e,o)),s}function qv(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return jn(()=>{e.isMounted=!0}),lr(()=>{e.isUnmounting=!0}),e}function Ow(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Br){t=n;break}}return t}function Fw(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 Ru(e,t,n,r,o){const{appear:i,mode:s,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:d,onEnterCancelled:f,onBeforeLeave:p,onLeave:g,onAfterLeave:m,onLeaveCancelled:v,onBeforeAppear:C,onAppear:w,onAfterAppear:_,onAppearCancelled:b}=t,S=String(e.key),x=Fw(n,e),L=(F,P)=>{F&&ts(F,r,9,P)},B=(F,P)=>{const U=P[1];L(F,P),Gt(F)?F.every(T=>T.length<=1)&&U():F.length<=1&&U()},q={mode:s,persisted:a,beforeEnter(F){let P=l;if(!n.isMounted)if(i)P=C||l;else return;F[Cs]&&F[Cs](!0);const U=x[S];U&&bs(e,U)&&U.el[Cs]&&U.el[Cs](),L(P,[F])},enter(F){if(x[S]===e)return;let P=u,U=d,T=f;if(!n.isMounted)if(i)P=w||u,U=_||d,T=b||f;else return;let V=!1;F[Fu]=$=>{V||(V=!0,$?L(T,[F]):L(U,[F]),q.delayedLeave&&q.delayedLeave(),F[Fu]=void 0)};const R=F[Fu].bind(null,!1);P?B(P,[F,R]):R()},leave(F,P){const U=String(e.key);if(F[Fu]&&F[Fu](!0),n.isUnmounting)return P();L(p,[F]);let T=!1;F[Cs]=R=>{T||(T=!0,P(),R?L(v,[F]):L(m,[F]),F[Cs]=void 0,x[U]===e&&delete x[U])};const V=F[Cs].bind(null,!1);x[U]=e,g?B(g,[F,V]):V()},clone(F){const P=Ru(F,t,n,r,o);return o&&o(P),P}};return q}function Yv(e){if(Nu(e))return e=Ws(e),e.children=null,e}function Nw(e){if(!Nu(e))return gy(e.type)&&e.children?Ow(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&&un(n.default))return n.default()}}function Ma(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Ma(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 wp(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===Vt?(s.patchFlag&128&&o++,r=r.concat(wp(s.children,t,a))):(t||s.type!==Br)&&r.push(a!=null?Ws(s,{key:a}):s)}if(o>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function Cl(e,t){return un(e)?er({name:e.name},t,{setup:e}):e}function l5(){const e=Sr();return e?(e.appContext.config.idPrefix||"v")+"-"+e.ids[0]+e.ids[1]++:""}function Xv(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function c5(e){const t=Sr(),n=Mr(null);if(t){const r=t.refs===Bn?t.refs={}:t.refs;Object.defineProperty(r,e,{enumerable:!0,get:()=>n.value,set:o=>n.value=o})}return n}function Bw(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}function Mu(e,t,n,r,o=!1){if(Gt(e)){e.forEach((v,C)=>Mu(v,t&&(Gt(t)?t[C]:t),n,r,o));return}if(qs(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Mu(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?Af(r.component):r.el,s=o?null:i,{i:a,r:l}=e,u=t&&t.r,d=a.refs===Bn?a.refs={}:a.refs,f=a.setupState,p=En(f),g=f===Bn?vv:v=>Bw(d,v)?!1:qn(p,v),m=(v,C)=>!(C&&Bw(d,C));if(u!=null&&u!==l){if(zw(t),ar(u))d[u]=null,g(u)&&(f[u]=null);else if(vr(u)){const v=t;m(u,v.k)&&(u.value=null),v.k&&(d[v.k]=null)}}if(un(l))xu(l,a,12,[s,d]);else{const v=ar(l),C=vr(l);if(v||C){const w=()=>{if(e.f){const _=v?g(l)?f[l]:d[l]:m(l)||!e.k?l.value:d[e.k];if(o)Gt(_)&&sp(_,i);else if(Gt(_))_.includes(i)||_.push(i);else if(v)d[l]=[i],g(l)&&(f[l]=d[l]);else{const b=[i];m(l,e.k)&&(l.value=b),e.k&&(d[e.k]=b)}}else v?(d[l]=s,g(l)&&(f[l]=s)):C&&(m(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const _=()=>{w(),xf.delete(e)};_.id=-1,xf.set(e,_),Kr(_,n)}else zw(e),w()}}}function zw(e){const t=xf.get(e);t&&(t.flags|=8,xf.delete(e))}function u5(e){const{mt:t,p:n,o:{patchProp:r,createText:o,nextSibling:i,parentNode:s,remove:a,insert:l,createComment:u}}=e,d=(b,S)=>{if(!S.hasChildNodes()){n(null,b,S),yp(),S._vnode=b;return}f(S.firstChild,b,null,null,null),yp(),S._vnode=b},f=(b,S,x,L,B,q=!1)=>{q=q||!!S.dynamicChildren;const F=xc(b)&&b.data==="[",P=()=>v(b,S,x,L,B,F),{type:U,ref:T,shapeFlag:V,patchFlag:R}=S;let $=b.nodeType;S.el=b,R===-2&&(q=!1,S.dynamicChildren=null);let se=null;switch(U){case Oa:$!==3?S.children===""?(l(S.el=o(""),s(b),b),se=b):se=P():(b.data!==S.children&&(Tc(),b.data=S.children),se=i(b));break;case Br:_(b)?(se=i(b),w(S.el=b.content.firstChild,b,x)):$!==8||F?se=P():se=i(b);break;case Il:if(F&&(b=i(b),$=b.nodeType),$===1||$===3){se=b;const X=!S.children.length;for(let J=0;J<S.staticCount;J++)X&&(S.children+=se.nodeType===1?se.outerHTML:se.data),J===S.staticCount-1&&(S.anchor=se),se=i(se);return F?i(se):se}else P();break;case Vt:F?se=m(b,S,x,L,B,q):se=P();break;default:if(V&1)($!==1||S.type.toLowerCase()!==b.tagName.toLowerCase())&&!_(b)?se=P():se=p(b,S,x,L,B,q);else if(V&6){S.slotScopeIds=B;const X=s(b);if(F?se=C(b):xc(b)&&b.data==="teleport start"?se=C(b,b.data,"teleport end"):se=i(b),t(S,X,null,x,L,Rf(X),q),qs(S)&&!S.type.__asyncResolved){let J;F?(J=sn(Vt),J.anchor=se?se.previousSibling:X.lastChild):J=b.nodeType===3?Ri(""):sn("div"),J.el=b,S.component.subTree=J}}else V&64?$!==8?se=P():se=S.type.hydrate(b,S,x,L,B,q,e,g):V&128&&(se=S.type.hydrate(b,S,x,L,Rf(s(b)),B,q,e,f))}return T!=null&&Mu(T,null,L,S),se},p=(b,S,x,L,B,q)=>{q=q||!!S.dynamicChildren;const{type:F,props:P,patchFlag:U,shapeFlag:T,dirs:V,transition:R}=S,$=F==="input"||F==="option";if($||U!==-1){V&&Hs(S,null,x,"created");let se=!1;if(_(b)){se=lC(null,R)&&x&&x.vnode.props&&x.vnode.props.appear;const J=b.content.firstChild;if(se){const W=J.getAttribute("class");W&&(J.$cls=W),R.beforeEnter(J)}w(J,b,x),S.el=b=J}if(T&16&&!(P&&(P.innerHTML||P.textContent))){let J=g(b.firstChild,S,b,x,L,B,q);for(;J;){Cp(b,1)||Tc();const W=J;J=J.nextSibling,a(W)}}else if(T&8){let J=S.children;J[0]===`
2
2
  `&&(b.tagName==="PRE"||b.tagName==="TEXTAREA")&&(J=J.slice(1));const{textContent:W}=b;W!==J&&W!==J.replace(/\r\n|\r/g,`
3
3
  `)&&(Cp(b,0)||Tc(),b.textContent=S.children)}if(P){if($||!q||U&48){const J=b.tagName.includes("-");for(const W in P)($&&(W.endsWith("value")||W==="indeterminate")||ku(W)&&!bl(W)||W[0]==="."||J&&!bl(W))&&r(b,W,null,P[W],void 0,x)}else if(P.onClick)r(b,"onClick",null,P.onClick,void 0,x);else if(U&4&&yi(P.style))for(const J in P.style)P.style[J]}let X;(X=P&&P.onVnodeBeforeMount)&&Ci(X,x,S),V&&Hs(S,null,x,"beforeMount"),((X=P&&P.onVnodeMounted)||V||se)&&hC(()=>{X&&Ci(X,x,S),se&&R.enter(b),V&&Hs(S,null,x,"mounted")},L)}return b.nextSibling},g=(b,S,x,L,B,q,F)=>{F=F||!!S.dynamicChildren;const P=S.children,U=P.length;for(let T=0;T<U;T++){const V=F?P[T]:P[T]=wi(P[T]),R=V.type===Oa;b?(R&&!F&&T+1<U&&wi(P[T+1]).type===Oa&&(l(o(b.data.slice(V.children.length)),x,i(b)),b.data=V.children),b=f(b,V,L,B,q,F)):R&&!V.children?l(V.el=o(""),x):(Cp(x,1)||Tc(),n(null,V,x,null,L,B,Rf(x),q))}return b},m=(b,S,x,L,B,q)=>{const{slotScopeIds:F}=S;F&&(B=B?B.concat(F):F);const P=s(b),U=g(i(b),S,P,x,L,B,q);return U&&xc(U)&&U.data==="]"?i(S.anchor=U):(Tc(),l(S.anchor=u("]"),P,U),U)},v=(b,S,x,L,B,q)=>{if(Cp(b.parentElement,1)||Tc(),S.el=null,q){const U=C(b);for(;;){const T=i(b);if(T&&T!==U)a(T);else break}}const F=i(b),P=s(b);return a(b),n(null,S,P,F,x,L,Rf(P),B),x&&(x.vnode.el=S.el,Tp(x,S.el)),F},C=(b,S="[",x="]")=>{let L=0;for(;b;)if(b=i(b),b&&xc(b)&&(b.data===S&&L++,b.data===x)){if(L===0)return i(b);L--}return b},w=(b,S,x)=>{const L=S.parentNode;L&&L.replaceChild(b,S);let B=x;for(;B;)B.vnode.el===S&&(B.vnode.el=B.subTree.el=b),B=B.parent},_=b=>b.nodeType===1&&b.tagName==="TEMPLATE";return[d,f]}function Cp(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(ky);)e=e.parentElement;const n=e&&e.getAttribute(ky);if(n==null)return!1;if(n==="")return!0;{const r=n.split(",");return t===0&&r.includes("children")?!0:r.includes(LC[t])}}function d5(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 f5(e,t){if(xc(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(xc(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function jw(e){un(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:i,timeout:s,suspensible:a=!0,onError:l}=e;let u=null,d,f=0;const p=()=>(f++,u=null,g()),g=()=>{let m;return u||(m=u=t().catch(v=>{if(v=v instanceof Error?v:new Error(String(v)),l)return new Promise((C,w)=>{l(v,()=>C(p()),()=>w(v),f+1)});throw v}).then(v=>m!==u&&u?u:(v&&(v.__esModule||v[Symbol.toStringTag]==="Module")&&(v=v.default),d=v,v)))};return Cl({name:"AsyncComponentWrapper",__asyncLoader:g,__asyncHydrate(m,v,C){let w=!1;(v.bu||(v.bu=[])).push(()=>w=!0);const _=()=>{w||C()},b=i?()=>{const S=i(_,x=>f5(m,x));S&&(v.bum||(v.bum=[])).push(S)}:_;d?b():g().then(()=>!v.isUnmounted&&b())},get __asyncResolved(){return d},setup(){const m=yo;if(Xv(m),d)return()=>kp(d,m);const v=b=>{u=null,_c(b,m,13,!r)};if(a&&m.suspense||Tl)return g().then(b=>()=>kp(b,m)).catch(b=>(v(b),()=>r?sn(r,{error:b}):null));const C=ne(!1),w=ne(),_=ne(!!o);return o&&setTimeout(()=>{_.value=!1},o),s!=null&&setTimeout(()=>{if(!C.value&&!w.value){const b=new Error(`Async component timed out after ${s}ms.`);v(b),w.value=b}},s),g().then(()=>{C.value=!0,m.parent&&Nu(m.parent.vnode)&&m.parent.update()}).catch(b=>{v(b),w.value=b}),()=>{if(C.value&&d)return kp(d,m);if(w.value&&r)return sn(r,{error:w.value});if(n&&!_.value)return kp(n,m)}}})}function kp(e,t){const{ref:n,props:r,children:o,ce:i}=t.vnode,s=sn(e,r,o);return s.ref=n,s.ce=i,delete t.vnode.ce,s}function wf(e,t){return Gt(e)?e.some(n=>wf(n,t)):ar(e)?e.split(",").includes(t):B2(e)?(e.lastIndex=0,e.test(t)):!1}function Zv(e,t){Vw(e,"a",t)}function Qv(e,t){Vw(e,"da",t)}function Vw(e,t,n=yo){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(_p(t,r,n),n){let o=n.parent;for(;o&&o.parent;)Nu(o.parent.vnode)&&h5(r,t,n,o),o=o.parent}}function h5(e,t,n,r){const o=_p(t,e,r,!0);Lf(()=>{sp(r[t],o)},n)}function Jv(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function Sp(e){return e.shapeFlag&128?e.ssContent:e}function _p(e,t,n=yo,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{Aa();const a=Rc(n),l=ts(t,n,e,s);return a(),Ia(),l});return r?o.unshift(i):o.push(i),i}}function Uw(e,t=yo){_p("ec",e,t)}function p5(e,t){return ty(Pp,e,!0,t)||e}function ey(e){return ar(e)?ty(Pp,e,!1)||e:e||Ey}function $w(e){return ty(jC,e)}function ty(e,t,n=!0,r=!1){const o=vo||yo;if(o){const i=o.type;if(e===Pp){const a=uy(i,!1);if(a&&(a===t||a===Wr(t)||a===Su(Wr(t))))return i}const s=Hw(o[e]||i[e],t)||Hw(o.appContext[e],t);return!s&&r?i:s}}function Hw(e,t){return e&&(e[t]||e[Wr(t)]||e[Su(Wr(t))])}function Fn(e,t,n,r){let o;const i=n&&n[r],s=Gt(e);if(s||ar(e)){const a=s&&yi(e);let l=!1,u=!1;a&&(l=!bi(e),u=$s(e),e=cp(e)),o=new Array(e.length);for(let d=0,f=e.length;d<f;d++)o[d]=t(l?u?Sc(es(e[d])):es(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($n(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 m5(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(Gt(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 Lu(e,t,n={},r,o){if(vo.ce||vo.parent&&qs(vo.parent)&&vo.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),ve(),mn(Vt,null,[sn("slot",n,r&&r())],u?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),ve();const s=i&&ny(i(n)),a=n.key||s&&s.key,l=mn(Vt,{key:(a&&!vi(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 ny(e){return e.some(t=>La(t)?!(t.type===Br||t.type===Vt&&!ny(t.children)):!0)?e:null}function g5(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:_u(r)]=e[r];return n}function v5(){return null}function y5(){return null}function b5(e){}function w5(e){}function C5(){return null}function k5(){}function S5(e,t){return null}function Gw(){return Kw("useSlots").slots}function Ww(){return Kw("useAttrs").attrs}function Kw(e){const t=Sr();return t.setupContext||(t.setupContext=kC(t))}function Cf(e){return Gt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function _5(e,t){const n=Cf(e);for(const r in t){if(r.startsWith("__skip"))continue;let o=n[r];o?Gt(o)||un(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 A5(e,t){return!e||!t?e||t:Gt(e)&&Gt(t)?e.concat(t):er({},Cf(e),Cf(t))}function I5(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function E5(e){const t=Sr(),n=Tl;let r=e();Vu(),n&&ju(!1);const o=()=>{Rc(t),n&&ju(!0)},i=()=>{Sr()!==t&&t.scope.off(),Vu(),n&&ju(!1)};return ap(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function T5(e){const t=ry(e),n=e.proxy,r=e.ctx;Np=!1,t.beforeCreate&&qw(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:u,created:d,beforeMount:f,mounted:p,beforeUpdate:g,updated:m,activated:v,deactivated:C,beforeDestroy:w,beforeUnmount:_,destroyed:b,unmounted:S,render:x,renderTracked:L,renderTriggered:B,errorCaptured:q,serverPrefetch:F,expose:P,inheritAttrs:U,components:T,directives:V,filters:R}=t;if(u&&x5(u,r,null),s)for(const X in s){const J=s[X];un(J)&&(r[X]=J.bind(n))}if(o){const X=o.call(n,n);$n(X)&&(e.data=io(X))}if(Np=!0,i)for(const X in i){const J=i[X],W=un(J)?J.bind(n,n):un(J.get)?J.get.bind(n,n):Ti,Te=!un(J)&&un(J.set)?J.set.bind(n):Ti,ge=Ce({get:W,set:Te});Object.defineProperty(r,X,{enumerable:!0,configurable:!0,get:()=>ge.value,set:he=>ge.value=he})}if(a)for(const X in a)Yw(a[X],r,n,X);if(l){const X=un(l)?l.call(n):l;Reflect.ownKeys(X).forEach(J=>{Wv(J,X[J])})}d&&qw(d,e,"c");function se(X,J){Gt(J)?J.forEach(W=>X(W.bind(n))):J&&X(J.bind(n))}if(se(Sy,f),se(jn,p),se(Lp,g),se(Mf,m),se(Zv,v),se(Qv,C),se(Uw,q),se(Iy,L),se(Ay,B),se(lr,_),se(Lf,S),se(_y,F),Gt(P))if(P.length){const X=e.exposed||(e.exposed={});P.forEach(J=>{Object.defineProperty(X,J,{get:()=>n[J],set:W=>n[J]=W,enumerable:!0})})}else e.exposed||(e.exposed={});x&&e.render===Ti&&(e.render=x),U!=null&&(e.inheritAttrs=U),T&&(e.components=T),V&&(e.directives=V),F&&Xv(e)}function x5(e,t,n=Ti){Gt(e)&&(e=oy(e));for(const r in e){const o=e[r];let i;$n(o)?"default"in o?i=Gs(o.from||r,o.default,!0):i=Gs(o.from||r):i=Gs(o),vr(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function qw(e,t,n){ts(Gt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Yw(e,t,n,r){let o=r.includes(".")?Dw(n,r):()=>n[r];if(ar(e)){const i=t[e];un(i)&&$t(o,i)}else if(un(e))$t(o,e.bind(n));else if($n(e))if(Gt(e))e.forEach(i=>Yw(i,t,n,r));else{const i=un(e.handler)?e.handler.bind(n):t[e.handler];un(i)&&$t(o,i,e)}}function ry(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=>Ap(l,u,s,!0)),Ap(l,t,s)),$n(t)&&i.set(t,l),l}function Ap(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&Ap(e,i,n,!0),o&&o.forEach(s=>Ap(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=UC[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function Xw(e,t){return t?e?function(){return er(un(e)?e.call(this,this):e,un(t)?t.call(this,this):t)}:t:e}function R5(e,t){return kf(oy(e),oy(t))}function oy(e){if(Gt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function ni(e,t){return e?[...new Set([].concat(e,t))]:t}function kf(e,t){return e?er(Object.create(null),e,t):t}function Zw(e,t){return e?Gt(e)&&Gt(t)?[...new Set([...e,...t])]:er(Object.create(null),Cf(e),Cf(t??{})):t}function M5(e,t){if(!e)return t;if(!t)return e;const n=er(Object.create(null),e);for(const r in t)n[r]=ni(e[r],t[r]);return n}function Qw(){return{app:null,config:{isNativeTag:vv,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 L5(e,t){return function(r,o=null){un(r)||(r=er({},r)),o!=null&&!$n(o)&&(o=null);const i=Qw(),s=new WeakSet,a=[];let l=!1;const u=i.app={_uid:$C++,_component:r,_props:o,_container:null,_context:i,_instance:null,version:Ny,get config(){return i.config},set config(d){},use(d,...f){return s.has(d)||(d&&un(d.install)?(s.add(d),d.install(u,...f)):un(d)&&(s.add(d),d(u,...f))),u},mixin(d){return i.mixins.includes(d)||i.mixins.push(d),u},component(d,f){return f?(i.components[d]=f,u):i.components[d]},directive(d,f){return f?(i.directives[d]=f,u):i.directives[d]},mount(d,f,p){if(!l){const g=u._ceVNode||sn(r,o);return g.appContext=i,p===!0?p="svg":p===!1&&(p=void 0),f&&t?t(g,d):e(g,d,p),l=!0,u._container=d,d.__vue_app__=u,Af(g.component)}},onUnmount(d){a.push(d)},unmount(){l&&(ts(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=Al;Al=u;try{return d()}finally{Al=f}}};return u}}function P5(e,t,n=Bn){const r=Sr(),o=Wr(t),i=ti(t),s=Ty(e,o),a=ow((l,u)=>{let d,f=Bn,p;return Pw(()=>{const g=e[o];mo(d,g)&&(d=g,u())}),{get(){return l(),n.get?n.get(d):d},set(g){const m=n.set?n.set(g):g;if(!mo(m,d)&&!(f!==Bn&&mo(g,f)))return;const v=r.vnode.props;v&&(t in v||o in v||i in v)&&(`onUpdate:${t}`in v||`onUpdate:${o}`in v||`onUpdate:${i}`in v)||(d=g,u()),r.emit(`update:${t}`,m),mo(g,m)&&mo(g,f)&&!mo(m,p)&&u(),f=g,p=m}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||Bn:a,done:!1}:{done:!0}}}},a}function D5(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Bn;let o=n;const i=t.startsWith("update:"),s=i&&Ty(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>ar(d)?d.trim():d)),s.number&&(o=n.map(rf)));let a,l=r[a=_u(t)]||r[a=_u(Wr(t))];!l&&i&&(l=r[a=_u(ti(t))]),l&&ts(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,ts(u,e,6,o)}}function Jw(e,t,n=!1){const r=n?HC:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const i=e.emits;let s={},a=!1;if(!un(e)){const l=u=>{const d=Jw(u,t,!0);d&&(a=!0,er(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?($n(e)&&r.set(e,null),null):(Gt(i)?i.forEach(l=>s[l]=null):er(s,i),$n(e)&&r.set(e,s),s)}function Ip(e,t){return!e||!ku(t)?!1:(t=t.slice(2).replace(/Once$/,""),qn(e,t[0].toLowerCase()+t.slice(1))||qn(e,ti(t))||qn(e,t))}function Ep(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:u,renderCache:d,props:f,data:p,setupState:g,ctx:m,inheritAttrs:v}=e,C=vf(e);let w,_;try{if(n.shapeFlag&4){const S=o||r,x=S;w=wi(u.call(x,S,d,f,g,p,m)),_=a}else{const S=t;w=wi(S.length>1?S(f,{attrs:a,slots:s,emit:l}):S(f,null)),_=t.props?a:GC(a)}}catch(S){zu.length=0,_c(S,e,1),w=sn(Br)}let b=w;if(_&&v!==!1){const S=Object.keys(_),{shapeFlag:x}=b;S.length&&x&7&&(i&&S.some(Jd)&&(_=WC(_,i)),b=Ws(b,_,!1,!0))}return n.dirs&&(b=Ws(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&Ma(b,n.transition),w=b,vf(C),w}function O5(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(La(o)){if(o.type!==Br||o.children==="v-if"){if(n)return;n=o}}else return}return n}function F5(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?eC(r,s,u):!!s;if(l&8){const d=t.dynamicProps;for(let f=0;f<d.length;f++){const p=d[f];if(tC(s,r,p)&&!Ip(u,p))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?eC(r,s,u):!0:!!s;return!1}function eC(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(tC(t,e,i)&&!Ip(n,i))return!0}return!1}function tC(e,t,n){const r=e[n],o=t[n];return n==="style"&&$n(r)&&$n(o)?!_a(r,o):r!==o}function Tp({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 N5(e,t,n,r=!1){const o={},i=Ry();e.propsDefaults=Object.create(null),nC(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:nw(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function B5(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=En(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(Ip(e.emitsOptions,p))continue;const g=t[p];if(l)if(qn(i,p))g!==i[p]&&(i[p]=g,u=!0);else{const m=Wr(p);o[m]=iy(l,a,m,g,e,!1)}else g!==i[p]&&(i[p]=g,u=!0)}}}else{nC(e,t,o,i)&&(u=!0);let d;for(const f in a)(!t||!qn(t,f)&&((d=ti(f))===f||!qn(t,d)))&&(l?n&&(n[f]!==void 0||n[d]!==void 0)&&(o[f]=iy(l,a,f,void 0,e,!0)):delete o[f]);if(i!==a)for(const f in i)(!t||!qn(t,f))&&(delete i[f],u=!0)}u&&Ea(e.attrs,"set","")}function nC(e,t,n,r){const[o,i]=e.propsOptions;let s=!1,a;if(t)for(let l in t){if(bl(l))continue;const u=t[l];let d;o&&qn(o,d=Wr(l))?!i||!i.includes(d)?n[d]=u:(a||(a={}))[d]=u:Ip(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(i){const l=En(n),u=a||Bn;for(let d=0;d<i.length;d++){const f=i[d];n[f]=iy(o,l,f,u[f],e,!qn(u,f))}}return s}function iy(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=qn(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&un(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const d=Rc(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===ti(n))&&(r=!0))}return r}function rC(e,t,n=!1){const r=n?KC:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(!un(e)){const d=f=>{l=!0;const[p,g]=rC(f,t,!0);er(s,p),g&&a.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!i&&!l)return $n(e)&&r.set(e,bc),bc;if(Gt(i))for(let d=0;d<i.length;d++){const f=Wr(i[d]);oC(f)&&(s[f]=Bn)}else if(i)for(const d in i){const f=Wr(d);if(oC(f)){const p=i[d],g=s[f]=Gt(p)||un(p)?{type:p}:er({},p),m=g.type;let v=!1,C=!0;if(Gt(m))for(let w=0;w<m.length;++w){const _=m[w],b=un(_)&&_.name;if(b==="Boolean"){v=!0;break}else b==="String"&&(C=!1)}else v=un(m)&&m.name==="Boolean";g[0]=v,g[1]=C,(v||qn(g,"default"))&&a.push(f)}}const u=[s,a];return $n(e)&&r.set(e,u),u}function oC(e){return e[0]!=="$"&&!bl(e)}function iC(e){return aC(e)}function sC(e){return aC(e,u5)}function aC(e,t){const n=sf();n.__VUE__=!0;const{insert:r,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:u,setElementText:d,parentNode:f,nextSibling:p,setScopeId:g=Ti,insertStaticContent:m}=e,v=(H,A,oe,j=null,Q=null,G=null,pe=void 0,ke=null,te=!!A.dynamicChildren)=>{if(H===A)return;H&&!bs(H,A)&&(j=bt(H),he(H,Q,G,!0),H=null),A.patchFlag===-2&&(te=!1,A.dynamicChildren=null);const{type:N,ref:Y,shapeFlag:me}=A;switch(N){case Oa:C(H,A,oe,j);break;case Br:w(H,A,oe,j);break;case Il:H==null&&_(A,oe,j,pe);break;case Vt:T(H,A,oe,j,Q,G,pe,ke,te);break;default:me&1?x(H,A,oe,j,Q,G,pe,ke,te):me&6?V(H,A,oe,j,Q,G,pe,ke,te):(me&64||me&128)&&N.process(H,A,oe,j,Q,G,pe,ke,te,Le)}Y!=null&&Q?Mu(Y,H&&H.ref,G,A||H,!A):Y==null&&H&&H.ref!=null&&Mu(H.ref,null,G,H,!0)},C=(H,A,oe,j)=>{if(H==null)r(A.el=a(A.children),oe,j);else{const Q=A.el=H.el;A.children!==H.children&&u(Q,A.children)}},w=(H,A,oe,j)=>{H==null?r(A.el=l(A.children||""),oe,j):A.el=H.el},_=(H,A,oe,j)=>{[H.el,H.anchor]=m(H.children,A,oe,j,H.el,H.anchor)},b=({el:H,anchor:A},oe,j)=>{let Q;for(;H&&H!==A;)Q=p(H),r(H,oe,j),H=Q;r(A,oe,j)},S=({el:H,anchor:A})=>{let oe;for(;H&&H!==A;)oe=p(H),o(H),H=oe;o(A)},x=(H,A,oe,j,Q,G,pe,ke,te)=>{if(A.type==="svg"?pe="svg":A.type==="math"&&(pe="mathml"),H==null)L(A,oe,j,Q,G,pe,ke,te);else{const N=H.el&&H.el._isVueCE?H.el:null;try{N&&N._beginPatch(),F(H,A,Q,G,pe,ke,te)}finally{N&&N._endPatch()}}},L=(H,A,oe,j,Q,G,pe,ke)=>{let te,N;const{props:Y,shapeFlag:me,transition:Pe,dirs:_e}=H;if(te=H.el=s(H.type,G,Y&&Y.is,Y),me&8?d(te,H.children):me&16&&q(H.children,te,null,j,Q,sy(H,G),pe,ke),_e&&Hs(H,null,j,"created"),B(te,H,H.scopeId,pe,j),Y){for(const Xe in Y)Xe!=="value"&&!bl(Xe)&&i(te,Xe,null,Y[Xe],G,j);"value"in Y&&i(te,"value",null,Y.value,G),(N=Y.onVnodeBeforeMount)&&Ci(N,j,H)}_e&&Hs(H,null,j,"beforeMount");const it=lC(Q,Pe);it&&Pe.beforeEnter(te),r(te,A,oe),((N=Y&&Y.onVnodeMounted)||it||_e)&&Kr(()=>{N&&Ci(N,j,H),it&&Pe.enter(te),_e&&Hs(H,null,j,"mounted")},Q)},B=(H,A,oe,j,Q)=>{if(oe&&g(H,oe),j)for(let G=0;G<j.length;G++)g(H,j[G]);if(Q){let G=Q.subTree;if(A===G||Pf(G.type)&&(G.ssContent===A||G.ssFallback===A)){const pe=Q.vnode;B(H,pe,pe.scopeId,pe.slotScopeIds,Q.parent)}}},q=(H,A,oe,j,Q,G,pe,ke,te=0)=>{for(let N=te;N<H.length;N++){const Y=H[N]=ke?Pa(H[N]):wi(H[N]);v(null,Y,A,oe,j,Q,G,pe,ke)}},F=(H,A,oe,j,Q,G,pe)=>{const ke=A.el=H.el;let{patchFlag:te,dynamicChildren:N,dirs:Y}=A;te|=H.patchFlag&16;const me=H.props||Bn,Pe=A.props||Bn;let _e;if(oe&&Ac(oe,!1),(_e=Pe.onVnodeBeforeUpdate)&&Ci(_e,oe,A,H),Y&&Hs(A,H,oe,"beforeUpdate"),oe&&Ac(oe,!0),(me.innerHTML&&Pe.innerHTML==null||me.textContent&&Pe.textContent==null)&&d(ke,""),N?P(H.dynamicChildren,N,ke,oe,j,sy(A,Q),G):pe||J(H,A,ke,null,oe,j,sy(A,Q),G,!1),te>0){if(te&16)U(ke,me,Pe,oe,Q);else if(te&2&&me.class!==Pe.class&&i(ke,"class",null,Pe.class,Q),te&4&&i(ke,"style",me.style,Pe.style,Q),te&8){const it=A.dynamicProps;for(let Xe=0;Xe<it.length;Xe++){const at=it[Xe],Pt=me[at],Ft=Pe[at];(Ft!==Pt||at==="value")&&i(ke,at,Pt,Ft,Q,oe)}}te&1&&H.children!==A.children&&d(ke,A.children)}else!pe&&N==null&&U(ke,me,Pe,oe,Q);((_e=Pe.onVnodeUpdated)||Y)&&Kr(()=>{_e&&Ci(_e,oe,A,H),Y&&Hs(A,H,oe,"updated")},j)},P=(H,A,oe,j,Q,G,pe)=>{for(let ke=0;ke<A.length;ke++){const te=H[ke],N=A[ke],Y=te.el&&(te.type===Vt||!bs(te,N)||te.shapeFlag&198)?f(te.el):oe;v(te,N,Y,null,j,Q,G,pe,!0)}},U=(H,A,oe,j,Q)=>{if(A!==oe){if(A!==Bn)for(const G in A)!bl(G)&&!(G in oe)&&i(H,G,A[G],null,Q,j);for(const G in oe){if(bl(G))continue;const pe=oe[G],ke=A[G];pe!==ke&&G!=="value"&&i(H,G,ke,pe,Q,j)}"value"in oe&&i(H,"value",A.value,oe.value,Q)}},T=(H,A,oe,j,Q,G,pe,ke,te)=>{const N=A.el=H?H.el:a(""),Y=A.anchor=H?H.anchor:a("");let{patchFlag:me,dynamicChildren:Pe,slotScopeIds:_e}=A;_e&&(ke=ke?ke.concat(_e):_e),H==null?(r(N,oe,j),r(Y,oe,j),q(A.children||[],oe,Y,Q,G,pe,ke,te)):me>0&&me&64&&Pe&&H.dynamicChildren&&H.dynamicChildren.length===Pe.length?(P(H.dynamicChildren,Pe,oe,Q,G,pe,ke),(A.key!=null||Q&&A===Q.subTree)&&ay(H,A,!0)):J(H,A,oe,Y,Q,G,pe,ke,te)},V=(H,A,oe,j,Q,G,pe,ke,te)=>{A.slotScopeIds=ke,H==null?A.shapeFlag&512?Q.ctx.activate(A,oe,j,pe,te):R(A,oe,j,Q,G,pe,te):$(H,A,te)},R=(H,A,oe,j,Q,G,pe)=>{const ke=H.component=yC(H,j,Q);if(Nu(H)&&(ke.ctx.renderer=Le),wC(ke,!1,pe),ke.asyncDep){if(Q&&Q.registerDep(ke,se,pe),!H.el){const te=ke.subTree=sn(Br);w(null,te,A,oe),H.placeholder=te.el}}else se(ke,H,A,oe,Q,G,pe)},$=(H,A,oe)=>{const j=A.component=H.component;if(F5(H,A,oe))if(j.asyncDep&&!j.asyncResolved){X(j,A,oe);return}else j.next=A,j.update();else A.el=H.el,j.vnode=A},se=(H,A,oe,j,Q,G,pe)=>{const ke=()=>{if(H.isMounted){let{next:me,bu:Pe,u:_e,parent:it,vnode:Xe}=H;{const At=cC(H);if(At){me&&(me.el=Xe.el,X(H,me,pe)),At.asyncDep.then(()=>{Kr(()=>{H.isUnmounted||N()},Q)});return}}let at=me,Pt;Ac(H,!1),me?(me.el=Xe.el,X(H,me,pe)):me=Xe,Pe&&kc(Pe),(Pt=me.props&&me.props.onVnodeBeforeUpdate)&&Ci(Pt,it,me,Xe),Ac(H,!0);const Ft=Ep(H),Zt=H.subTree;H.subTree=Ft,v(Zt,Ft,f(Zt.el),bt(Zt),H,Q,G),me.el=Ft.el,at===null&&Tp(H,Ft.el),_e&&Kr(_e,Q),(Pt=me.props&&me.props.onVnodeUpdated)&&Kr(()=>Ci(Pt,it,me,Xe),Q)}else{let me;const{el:Pe,props:_e}=A,{bm:it,m:Xe,parent:at,root:Pt,type:Ft}=H,Zt=qs(A);if(Ac(H,!1),it&&kc(it),!Zt&&(me=_e&&_e.onVnodeBeforeMount)&&Ci(me,at,A),Ac(H,!0),Pe&&ce){const At=()=>{H.subTree=Ep(H),ce(Pe,H.subTree,H,Q,null)};Zt&&Ft.__asyncHydrate?Ft.__asyncHydrate(Pe,H,At):At()}else{Pt.ce&&Pt.ce._hasShadowRoot()&&Pt.ce._injectChildStyle(Ft,H.parent?H.parent.type:void 0);const At=H.subTree=Ep(H);v(null,At,oe,j,H,Q,G),A.el=At.el}if(Xe&&Kr(Xe,Q),!Zt&&(me=_e&&_e.onVnodeMounted)){const At=A;Kr(()=>Ci(me,at,At),Q)}(A.shapeFlag&256||at&&qs(at.vnode)&&at.vnode.shapeFlag&256)&&H.a&&Kr(H.a,Q),H.isMounted=!0,A=oe=j=null}};H.scope.on();const te=H.effect=new Iu(ke);H.scope.off();const N=H.update=te.run.bind(te),Y=H.job=te.runIfDirty.bind(te);Y.i=H,Y.id=H.uid,te.scheduler=()=>Gv(Y),Ac(H,!0),N()},X=(H,A,oe)=>{A.component=H;const j=H.vnode.props;H.vnode=A,H.next=null,B5(H,A.props,j,oe),XC(H,A.children,oe),Aa(),xw(H),Ia()},J=(H,A,oe,j,Q,G,pe,ke,te=!1)=>{const N=H&&H.children,Y=H?H.shapeFlag:0,me=A.children,{patchFlag:Pe,shapeFlag:_e}=A;if(Pe>0){if(Pe&128){Te(N,me,oe,j,Q,G,pe,ke,te);return}else if(Pe&256){W(N,me,oe,j,Q,G,pe,ke,te);return}}_e&8?(Y&16&&Je(N,Q,G),me!==N&&d(oe,me)):Y&16?_e&16?Te(N,me,oe,j,Q,G,pe,ke,te):Je(N,Q,G,!0):(Y&8&&d(oe,""),_e&16&&q(me,oe,j,Q,G,pe,ke,te))},W=(H,A,oe,j,Q,G,pe,ke,te)=>{H=H||bc,A=A||bc;const N=H.length,Y=A.length,me=Math.min(N,Y);let Pe;for(Pe=0;Pe<me;Pe++){const _e=A[Pe]=te?Pa(A[Pe]):wi(A[Pe]);v(H[Pe],_e,oe,null,Q,G,pe,ke,te)}N>Y?Je(H,Q,G,!0,!1,me):q(A,oe,j,Q,G,pe,ke,te,me)},Te=(H,A,oe,j,Q,G,pe,ke,te)=>{let N=0;const Y=A.length;let me=H.length-1,Pe=Y-1;for(;N<=me&&N<=Pe;){const _e=H[N],it=A[N]=te?Pa(A[N]):wi(A[N]);if(bs(_e,it))v(_e,it,oe,null,Q,G,pe,ke,te);else break;N++}for(;N<=me&&N<=Pe;){const _e=H[me],it=A[Pe]=te?Pa(A[Pe]):wi(A[Pe]);if(bs(_e,it))v(_e,it,oe,null,Q,G,pe,ke,te);else break;me--,Pe--}if(N>me){if(N<=Pe){const _e=Pe+1,it=_e<Y?A[_e].el:j;for(;N<=Pe;)v(null,A[N]=te?Pa(A[N]):wi(A[N]),oe,it,Q,G,pe,ke,te),N++}}else if(N>Pe)for(;N<=me;)he(H[N],Q,G,!0),N++;else{const _e=N,it=N,Xe=new Map;for(N=it;N<=Pe;N++){const Yt=A[N]=te?Pa(A[N]):wi(A[N]);Yt.key!=null&&Xe.set(Yt.key,N)}let at,Pt=0;const Ft=Pe-it+1;let Zt=!1,At=0;const ct=new Array(Ft);for(N=0;N<Ft;N++)ct[N]=0;for(N=_e;N<=me;N++){const Yt=H[N];if(Pt>=Ft){he(Yt,Q,G,!0);continue}let Ln;if(Yt.key!=null)Ln=Xe.get(Yt.key);else for(at=it;at<=Pe;at++)if(ct[at-it]===0&&bs(Yt,A[at])){Ln=at;break}Ln===void 0?he(Yt,Q,G,!0):(ct[Ln-it]=N+1,Ln>=At?At=Ln:Zt=!0,v(Yt,A[Ln],oe,null,Q,G,pe,ke,te),Pt++)}const tn=Zt?z5(ct):bc;for(at=tn.length-1,N=Ft-1;N>=0;N--){const Yt=it+N,Ln=A[Yt],Tn=A[Yt+1],jr=Yt+1<Y?Tn.el||uC(Tn):j;ct[N]===0?v(null,Ln,oe,jr,Q,G,pe,ke,te):Zt&&(at<0||N!==tn[at]?ge(Ln,oe,jr,2):at--)}}},ge=(H,A,oe,j,Q=null)=>{const{el:G,type:pe,transition:ke,children:te,shapeFlag:N}=H;if(N&6){ge(H.component.subTree,A,oe,j);return}if(N&128){H.suspense.move(A,oe,j);return}if(N&64){pe.move(H,A,oe,Le);return}if(pe===Vt){r(G,A,oe);for(let Y=0;Y<te.length;Y++)ge(te[Y],A,oe,j);r(H.anchor,A,oe);return}if(pe===Il){b(H,A,oe);return}if(j!==2&&N&1&&ke)if(j===0)ke.beforeEnter(G),r(G,A,oe),Kr(()=>ke.enter(G),Q);else{const{leave:Y,delayLeave:me,afterLeave:Pe}=ke,_e=()=>{H.ctx.isUnmounted?o(G):r(G,A,oe)},it=()=>{G._isLeaving&&G[Cs](!0),Y(G,()=>{_e(),Pe&&Pe()})};me?me(G,_e,it):it()}else r(G,A,oe)},he=(H,A,oe,j=!1,Q=!1)=>{const{type:G,props:pe,ref:ke,children:te,dynamicChildren:N,shapeFlag:Y,patchFlag:me,dirs:Pe,cacheIndex:_e,memo:it}=H;if(me===-2&&(Q=!1),ke!=null&&(Aa(),Mu(ke,null,oe,H,!0),Ia()),_e!=null&&(A.renderCache[_e]=void 0),Y&256){A.ctx.deactivate(H);return}const Xe=Y&1&&Pe,at=!qs(H);let Pt;if(at&&(Pt=pe&&pe.onVnodeBeforeUnmount)&&Ci(Pt,A,H),Y&6)je(H.component,oe,j);else{if(Y&128){H.suspense.unmount(oe,j);return}Xe&&Hs(H,null,A,"beforeUnmount"),Y&64?H.type.remove(H,A,oe,Le,j):N&&!N.hasOnce&&(G!==Vt||me>0&&me&64)?Je(N,A,oe,!1,!0):(G===Vt&&me&384||!Q&&Y&16)&&Je(te,A,oe),j&&ye(H)}const Ft=it!=null&&_e==null;(at&&(Pt=pe&&pe.onVnodeUnmounted)||Xe||Ft)&&Kr(()=>{Pt&&Ci(Pt,A,H),Xe&&Hs(H,null,A,"unmounted"),Ft&&(H.el=null)},oe)},ye=H=>{const{type:A,el:oe,anchor:j,transition:Q}=H;if(A===Vt){Re(oe,j);return}if(A===Il){S(H);return}const G=()=>{o(oe),Q&&!Q.persisted&&Q.afterLeave&&Q.afterLeave()};if(H.shapeFlag&1&&Q&&!Q.persisted){const{leave:pe,delayLeave:ke}=Q,te=()=>pe(oe,G);ke?ke(H.el,G,te):te()}else G()},Re=(H,A)=>{let oe;for(;H!==A;)oe=p(H),o(H),H=oe;o(A)},je=(H,A,oe)=>{const{bum:j,scope:Q,job:G,subTree:pe,um:ke,m:te,a:N}=H;xp(te),xp(N),j&&kc(j),Q.stop(),G&&(G.flags|=8,he(pe,H,A,oe)),ke&&Kr(ke,A),Kr(()=>{H.isUnmounted=!0},A)},Je=(H,A,oe,j=!1,Q=!1,G=0)=>{for(let pe=G;pe<H.length;pe++)he(H[pe],A,oe,j,Q)},bt=H=>{if(H.shapeFlag&6)return bt(H.component.subTree);if(H.shapeFlag&128)return H.suspense.next();const A=p(H.anchor||H.el),oe=A&&A[my];return oe?p(oe):A};let ft=!1;const Mt=(H,A,oe)=>{let j;H==null?A._vnode&&(he(A._vnode,null,null,!0),j=A._vnode.component):v(A._vnode||null,H,A,null,null,null,oe),A._vnode=H,ft||(ft=!0,xw(j),yp(),ft=!1)},Le={p:v,um:he,m:ge,r:ye,mt:R,mc:q,pc:J,pbc:P,n:bt,o:e};let Se,ce;return t&&([Se,ce]=t(Le)),{render:Mt,hydrate:Se,createApp:L5(Mt,Se)}}function sy({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 Ac({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function lC(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function ay(e,t,n=!1){const r=e.children,o=t.children;if(Gt(r)&&Gt(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]=Pa(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&ay(s,a)),a.type===Oa&&(a.patchFlag===-1&&(a=o[i]=Pa(a)),a.el=s.el),a.type===Br&&!a.el&&(a.el=s.el)}}function z5(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 cC(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:cC(t)}function xp(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function uC(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?uC(t.subTree):null}function Sf(e,t){const n=e.props&&e.props[t];un(n)&&n()}function j5(e,t,n,r,o,i,s,a,l){const{p:u,o:{createElement:d}}=l,f=d("div"),p=e.suspense=dC(e,o,r,t,f,n,i,s,a,l);u(null,p.pendingBranch=e.ssContent,f,null,r,p,i,s),p.deps>0?(Sf(e,"onPending"),Sf(e,"onFallback"),u(null,e.ssFallback,t,n,r,null,i,s),Pu(p,e.ssFallback)):p.resolve(!1,!0)}function V5(e,t,n,r,o,i,s,a,{p:l,um:u,o:{createElement:d}}){const f=t.suspense=e.suspense;f.vnode=t,t.el=e.el;const p=t.ssContent,g=t.ssFallback,{activeBranch:m,pendingBranch:v,isInFallback:C,isHydrating:w}=f;if(v)f.pendingBranch=p,bs(v,p)?(l(v,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():C&&(w||(l(m,g,n,r,o,null,i,s,a),Pu(f,g)))):(f.pendingId=jp++,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(m,g,n,r,o,null,i,s,a),Pu(f,g))):m&&bs(m,p)?(l(m,p,n,r,o,f,i,s,a),f.resolve(!0)):(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0&&f.resolve()));else if(m&&bs(m,p))l(m,p,n,r,o,f,i,s,a),Pu(f,p);else if(Sf(t,"onPending"),f.pendingBranch=p,p.shapeFlag&512?f.pendingId=p.component.suspenseId:f.pendingId=jp++,l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0)f.resolve();else{const{timeout:_,pendingId:b}=f;_>0?setTimeout(()=>{f.pendingId===b&&f.fallback(g)},_):_===0&&f.fallback(g)}}function dC(e,t,n,r,o,i,s,a,l,u,d=!1){const{p:f,m:p,um:g,n:m,o:{parentNode:v,remove:C}}=u;let w;const _=H5(e);_&&t&&t.pendingBranch&&(w=t.pendingId,t.deps++);const b=e.props?of(e.props.timeout):void 0,S=i,x={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:jp++,timeout:typeof b=="number"?b:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!d,isHydrating:d,isUnmounted:!1,effects:[],resolve(L=!1,B=!1){const{vnode:q,activeBranch:F,pendingBranch:P,pendingId:U,effects:T,parentComponent:V,container:R,isInFallback:$}=x;let se=!1;x.isHydrating?x.isHydrating=!1:L||(se=F&&P.transition&&P.transition.mode==="out-in",se&&(F.transition.afterLeave=()=>{U===x.pendingId&&(p(P,R,i===S?m(F):i,0),gf(T),$&&q.ssFallback&&(q.ssFallback.el=null))}),F&&!x.isFallbackMountPending&&(v(F.el)===R&&(i=m(F)),g(F,V,x,!0),!se&&$&&q.ssFallback&&Kr(()=>q.ssFallback.el=null,x)),se||p(P,R,i,0)),x.isFallbackMountPending=!1,Pu(x,P),x.pendingBranch=null,x.isInFallback=!1;let X=x.parent,J=!1;for(;X;){if(X.pendingBranch){X.effects.push(...T),J=!0;break}X=X.parent}!J&&!se&&gf(T),x.effects=[],_&&t&&t.pendingBranch&&w===t.pendingId&&(t.deps--,t.deps===0&&!B&&t.resolve()),Sf(q,"onResolve")},fallback(L){if(!x.pendingBranch)return;const{vnode:B,activeBranch:q,parentComponent:F,container:P,namespace:U}=x;Sf(B,"onFallback");const T=m(q),V=()=>{x.isFallbackMountPending=!1,x.isInFallback&&(f(null,L,P,T,F,null,U,a,l),Pu(x,L))},R=L.transition&&L.transition.mode==="out-in";R&&(x.isFallbackMountPending=!0,q.transition.afterLeave=V),x.isInFallback=!0,g(q,F,null,!0),R||V()},move(L,B,q){x.activeBranch&&p(x.activeBranch,L,B,q),x.container=L},next(){return x.activeBranch&&m(x.activeBranch)},registerDep(L,B,q){const F=!!x.pendingBranch;F&&x.deps++;const P=L.vnode.el;L.asyncDep.catch(U=>{_c(U,L,0)}).then(U=>{if(L.isUnmounted||x.isUnmounted||x.pendingId!==L.suspenseId)return;Vu(),L.asyncResolved=!0;const{vnode:T}=L;cy(L,U,!1),P&&(T.el=P);const V=!P&&L.subTree.el;B(L,T,v(P||L.subTree.el),P?null:m(L.subTree),x,s,q),V&&(T.placeholder=null,C(V)),Tp(L,T.el),F&&--x.deps===0&&x.resolve()})},unmount(L,B){x.isUnmounted=!0,x.activeBranch&&g(x.activeBranch,n,L,B),x.pendingBranch&&g(x.pendingBranch,n,L,B)}};return x}function U5(e,t,n,r,o,i,s,a,l){const u=t.suspense=dC(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 $5(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=fC(r?n.default:n),e.ssFallback=r?fC(n.fallback):sn(Br)}function fC(e){let t;if(un(e)){const n=El&&e._c;n&&(e._d=!1,ve()),e=e(),n&&(e._d=!0,t=Ro,pC())}return Gt(e)&&(e=O5(e)),e=wi(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function hC(e,t){t&&t.pendingBranch?Gt(e)?t.effects.push(...e):t.effects.push(e):gf(e)}function Pu(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,Tp(r,o))}function H5(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function ve(e=!1){zu.push(Ro=e?null:[])}function pC(){zu.pop(),Ro=zu[zu.length-1]||null}function _f(e,t=!1){El+=e,e<0&&Ro&&t&&(Ro.hasOnce=!0)}function mC(e){return e.dynamicChildren=El>0?Ro||bc:null,pC(),El>0&&Ro&&Ro.push(e),e}function we(e,t,n,r,o,i){return mC(de(e,t,n,r,o,i,!0))}function mn(e,t,n,r,o){return mC(sn(e,t,n,r,o,!0))}function La(e){return e?e.__v_isVNode===!0:!1}function bs(e,t){return e.type===t.type&&e.key===t.key}function G5(e){}function de(e,t=null,n=null,r=0,o=null,i=e===Vt?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Oy(t),ref:t&&Df(t),scopeId:Tf,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:vo};return a?(ly(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=ar(n)?8:16),El>0&&!s&&Ro&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&Ro.push(l),l}function W5(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===Ey)&&(e=Br),La(e)){const a=Ws(e,t,!0);return n&&ly(a,n),El>0&&!i&&Ro&&(a.shapeFlag&6?Ro[Ro.indexOf(e)]=a:Ro.push(a)),a.patchFlag=-2,a}if(Y5(e)&&(e=e.__vccOpts),t){t=gC(t);let{class:a,style:l}=t;a&&!ar(a)&&(t.class=on(a)),$n(l)&&(lf(l)&&!Gt(l)&&(l=er({},l)),t.style=Rn(l))}const s=ar(e)?1:Pf(e)?128:gy(e)?64:$n(e)?4:un(e)?2:0;return de(e,t,n,r,o,s,i,!0)}function gC(e){return e?lf(e)||My(e)?er({},e):e:null}function Ws(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,u=t?Ks(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&Oy(u),ref:t&&t.ref?n&&i?Gt(i)?i.concat(Df(t)):[i,Df(t)]:Df(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!==Vt?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&&Ws(e.ssContent),ssFallback:e.ssFallback&&Ws(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Ma(d,l.clone(d)),d}function Ri(e=" ",t=0){return sn(Oa,null,e,t)}function vC(e,t){const n=sn(Il,null,e);return n.staticCount=t,n}function dt(e="",t=!1){return t?(ve(),mn(Br,null,e)):sn(Br,null,e)}function wi(e){return e==null||typeof e=="boolean"?sn(Br):Gt(e)?sn(Vt,null,e.slice()):La(e)?Pa(e):sn(Oa,null,String(e))}function Pa(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ws(e)}function ly(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Gt(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),ly(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!My(t)?t._ctx=vo:o===3&&vo&&(vo.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else un(t)?(t={default:t,_ctx:vo},n=32):(t=String(t),r&64?(n=16,t=[Ri(t)]):n=8);e.children=t,e.shapeFlag|=n}function Ks(...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=on([t.class,r.class]));else if(o==="style")t.style=Rn([t.style,r.style]);else if(ku(o)){const i=t[o],s=r[o];s&&i!==s&&!(Gt(i)&&i.includes(s))?t[o]=i?[].concat(i,s):s:s==null&&i==null&&!Jd(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function Ci(e,t,n,r=null){ts(e,t,7,[n,r])}function yC(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||QC,i={uid:JC++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new pp(!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:rC(r,o),emitsOptions:Jw(r,o),emit:null,emitted:null,propsDefaults:Bn,inheritAttrs:r.inheritAttrs,ctx:Bn,data:Bn,props:Bn,attrs:Bn,slots:Bn,refs:Bn,setupState:Bn,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=D5.bind(null,i),e.ce&&e.ce(i),i}function bC(e){return e.vnode.shapeFlag&4}function wC(e,t=!1,n=!1){t&&ju(t);const{props:r,children:o}=e.vnode,i=bC(e);N5(e,r,i,t),YC(e,o,n||t);const s=i?K5(e,t):void 0;return t&&ju(!1),s}function K5(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Fp);const{setup:r}=n;if(r){Aa();const o=e.setupContext=r.length>1?kC(e):null,i=Rc(e),s=xu(r,e,0,[e.props,o]),a=ap(s);if(Ia(),i(),(a||e.sp)&&!qs(e)&&Xv(e),a){if(s.then(Vu,Vu),t)return s.then(l=>{cy(e,l,t)}).catch(l=>{_c(l,e,0)});e.asyncDep=s}else cy(e,s,t)}else CC(e,t)}function cy(e,t,n){un(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:$n(t)&&(e.setupState=Pv(t)),CC(e,n)}function q5(e){Up=e,Fy=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,VC))}}function CC(e,t,n){const r=e.type;if(!e.render){if(!t&&Up&&!r.render){const o=r.template||ry(e).template;if(o){const{isCustomElement:i,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:l}=r,u=er(er({isCustomElement:i,delimiters:a},s),l);r.render=Up(o,u)}}e.render=r.render||Ti,Fy&&Fy(e)}{const o=Rc(e);Aa();try{T5(e)}finally{Ia(),o()}}}function kC(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,tk),slots:e.slots,emit:e.emit,expose:t}}function Af(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Pv(Qr(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Bu)return Bu[n](e)},has(t,n){return n in t||n in Bu}})):e.proxy}function uy(e,t=!0){return un(e)?e.displayName||e.name:e.name||t&&e.__name}function Y5(e){return un(e)&&"__vccOpts"in e}function Nr(e,t,n){try{_f(-1);const r=arguments.length;return r===2?$n(t)&&!Gt(t)?La(t)?sn(e,null,[t]):sn(e,t):sn(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&La(n)&&(n=[n]),sn(e,t,n))}finally{_f(1)}}function X5(){return;function e(t,n,r){const o=t[r];if(Gt(o)&&o.includes(n)||$n(o)&&n in o||t.extends&&e(t.extends,n,r)||t.mixins&&t.mixins.some(i=>e(i,n,r)))return!0}}function Z5(e,t,n,r){const o=n[r];if(o&&SC(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function SC(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(mo(n[r],t[r]))return!1;return El>0&&Ro&&Ro.push(e),!0}var dy,_C,AC,Go,ws,Ic,Da,Ec,fy,If,Du,Ou,Ef,vo,Tf,IC,hy,py,kl,my,gy,Sl,EC,vy,yy,Rp,TC,_l,Cs,Fu,Mi,Mp,by,xC,wy,xf,Cy,Tc,RC,MC,Rf,xc,ky,LC,PC,DC,OC,FC,NC,BC,qs,Nu,zC,Ys,Sy,jn,Lp,Mf,lr,Lf,_y,Ay,Iy,Pp,jC,Ey,Dp,Bu,Op,Fp,VC,Np,UC,$C,Al,Ty,HC,GC,WC,xy,Ry,My,KC,Bp,zp,qC,Ly,Py,Dy,YC,XC,Kr,Pf,jp,ZC,Vt,Oa,Br,Il,zu,Ro,El,Oy,Df,sn,QC,JC,yo,Sr,Vp,ju,Rc,Vu,Tl,Up,Fy,ek,tk,Ce,Ny,nk,rk,ok,ik,sk,Q5,J5,e6,ak=Fr((()=>{Xx(),_v(),dy=[],_C={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"},AC={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"},Go=[],ws=-1,Ic=[],Da=null,Ec=0,fy=Promise.resolve(),If=null,Du=e=>e.id==null?e.flags&2?-1:1/0:e.id,Ef=[],vo=null,Tf=null,IC=e=>go,hy=Symbol.for("v-scx"),py=()=>{{const e=Gs(hy);return e}},kl=new WeakMap,my=Symbol("_vte"),gy=e=>e.__isTeleport,Sl=e=>e&&(e.disabled||e.disabled===""),EC=e=>e&&(e.defer||e.defer===""),vy=e=>typeof SVGElement<"u"&&e instanceof SVGElement,yy=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Rp=(e,t)=>{const n=e&&e.to;return ar(n)?t?t(n):null:n},TC={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,u){const{mc:d,pc:f,pbc:p,o:{insert:g,querySelector:m,createText:v,createComment:C}}=u,w=Sl(t.props);let{dynamicChildren:_}=t;const b=(L,B,q)=>{L.shapeFlag&16&&d(L.children,B,q,o,i,s,a,l)},S=(L=t)=>{const B=Sl(L.props),q=L.target=Rp(L.props,m),F=Kv(q,L,v,g);q&&(s!=="svg"&&vy(q)?s="svg":s!=="mathml"&&yy(q)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(q),B||(b(L,q,F),bf(L,!1)))},x=L=>{const B=()=>{kl.get(L)===B&&(kl.delete(L),Sl(L.props)&&(b(L,n,L.anchor),bf(L,!0)),S(L))};kl.set(L,B),Kr(B,i)};if(e==null){const L=t.el=v(""),B=t.anchor=v("");if(g(L,n,r),g(B,n,r),EC(t.props)||i&&i.pendingBranch){x(t);return}w&&(b(t,n,B),bf(t,!0)),S()}else{t.el=e.el;const L=t.anchor=e.anchor,B=kl.get(e);if(B){B.flags|=8,kl.delete(e),x(t);return}t.targetStart=e.targetStart;const q=t.target=e.target,F=t.targetAnchor=e.targetAnchor,P=Sl(e.props),U=P?n:q,T=P?L:F;if(s==="svg"||vy(q)?s="svg":(s==="mathml"||yy(q))&&(s="mathml"),_?(p(e.dynamicChildren,_,U,o,i,s,a),ay(e,t,!0)):l||f(e,t,U,T,o,i,s,a,!1),w)P?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):bp(t,n,L,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const V=t.target=Rp(t.props,m);V&&bp(t,V,null,u,0)}else P&&bp(t,q,F,u,1);bf(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 g=i||!Sl(p);const m=kl.get(e);if(m&&(m.flags|=8,kl.delete(e),g=!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,g,!!C.dynamicChildren)}},move:bp,hydrate:a5},_l=TC,Cs=Symbol("_leaveCb"),Fu=Symbol("_enterCb"),Mi=[Function,Array],Mp={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Mi,onEnter:Mi,onAfterEnter:Mi,onEnterCancelled:Mi,onBeforeLeave:Mi,onLeave:Mi,onAfterLeave:Mi,onLeaveCancelled:Mi,onBeforeAppear:Mi,onAppear:Mi,onAfterAppear:Mi,onAppearCancelled:Mi},by=e=>{const t=e.subTree;return t.component?by(t.component):t},xC={name:"BaseTransition",props:Mp,setup(e,{slots:t}){const n=Sr(),r=qv();return()=>{const o=t.default&&wp(t.default(),!0);if(!o||!o.length)return;const i=Ow(o),s=En(e),{mode:a}=s;if(r.isLeaving)return Yv(i);const l=Nw(i);if(!l)return Yv(i);let u=Ru(l,s,r,n,f=>u=f);l.type!==Br&&Ma(l,u);let d=n.subTree&&Nw(n.subTree);if(d&&d.type!==Br&&!bs(d,l)&&by(n).type!==Br){let f=Ru(d,s,r,n);if(Ma(d,f),a==="out-in"&&l.type!==Br)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,d=void 0},Yv(i);a==="in-out"&&l.type!==Br?f.delayLeave=(p,g,m)=>{const v=Fw(r,d);v[String(d.key)]=d,p[Cs]=()=>{g(),p[Cs]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{m(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return i}}},wy=xC,xf=new WeakMap,Cy=!1,Tc=()=>{Cy||(console.error("Hydration completed but contains mismatches."),Cy=!0)},RC=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",MC=e=>e.namespaceURI.includes("MathML"),Rf=e=>{if(e.nodeType===1){if(RC(e))return"svg";if(MC(e))return"mathml"}},xc=e=>e.nodeType===8,ky="data-allow-mismatch",LC={0:"text",1:"children",2:"class",3:"style",4:"attribute"},PC=sf().requestIdleCallback||(e=>setTimeout(e,1)),DC=sf().cancelIdleCallback||(e=>clearTimeout(e)),OC=(e=1e4)=>t=>{const n=PC(t,{timeout:e});return()=>DC(n)},FC=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(d5(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)}},BC=(e=[])=>(t,n)=>{ar(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},qs=e=>!!e.type.__asyncLoader,Nu=e=>e.type.__isKeepAlive,zC={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=Sr(),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=(_,b,S,x,L)=>{const B=_.component;u(_,b,S,0,a),l(B.vnode,_,b,S,B,a,x,_.slotScopeIds,L),Kr(()=>{B.isDeactivated=!1,B.a&&kc(B.a);const q=_.props&&_.props.onVnodeMounted;q&&Ci(q,B.parent,_)},a)},r.deactivate=_=>{const b=_.component;xp(b.m),xp(b.a),u(_,p,null,1,a),Kr(()=>{b.da&&kc(b.da);const S=_.props&&_.props.onVnodeUnmounted;S&&Ci(S,b.parent,_),b.isDeactivated=!0},a)};function g(_){Jv(_),d(_,n,a,!0)}function m(_){o.forEach((b,S)=>{const x=uy(qs(b)?b.type.__asyncResolved||{}:b.type);x&&!_(x)&&v(S)})}function v(_){const b=o.get(_);b&&(!s||!bs(b,s))?g(b):s&&Jv(s),o.delete(_),i.delete(_)}$t(()=>[e.include,e.exclude],([_,b])=>{_&&m(S=>wf(_,S)),b&&m(S=>!wf(b,S))},{flush:"post",deep:!0});let C=null;const w=()=>{C!=null&&(Pf(n.subTree.type)?Kr(()=>{o.set(C,Sp(n.subTree))},n.subTree.suspense):o.set(C,Sp(n.subTree)))};return jn(w),Mf(w),lr(()=>{o.forEach(_=>{const{subTree:b,suspense:S}=n,x=Sp(b);if(_.type===x.type&&_.key===x.key){Jv(x);const L=x.component.da;L&&Kr(L,S);return}g(_)})}),()=>{if(C=null,!t.default)return s=null;const _=t.default(),b=_[0];if(_.length>1)return s=null,_;if(!La(b)||!(b.shapeFlag&4)&&!(b.shapeFlag&128))return s=null,b;let S=Sp(b);if(S.type===Br)return s=null,S;const x=S.type,L=uy(qs(S)?S.type.__asyncResolved||{}:x),{include:B,exclude:q,max:F}=e;if(B&&(!L||!wf(B,L))||q&&L&&wf(q,L))return S.shapeFlag&=-257,s=S,b;const P=S.key==null?x:S.key,U=o.get(P);return S.el&&(S=Ws(S),b.shapeFlag&128&&(b.ssContent=S)),C=P,U?(S.el=U.el,S.component=U.component,S.transition&&Ma(S,S.transition),S.shapeFlag|=512,i.delete(P),i.add(P)):(i.add(P),F&&i.size>parseInt(F,10)&&v(i.values().next().value)),S.shapeFlag|=256,s=S,Pf(b.type)?b:S}}},Ys=e=>(t,n=yo)=>{(!Tl||e==="sp")&&_p(e,(...r)=>t(...r),n)},Sy=Ys("bm"),jn=Ys("m"),Lp=Ys("bu"),Mf=Ys("u"),lr=Ys("bum"),Lf=Ys("um"),_y=Ys("sp"),Ay=Ys("rtg"),Iy=Ys("rtc"),Pp="components",jC="directives",Ey=Symbol.for("v-ndc"),Dp=e=>e?bC(e)?Af(e):Dp(e.parent):null,Bu=er(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=>Dp(e.parent),$root:e=>Dp(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>ry(e),$forceUpdate:e=>e.f||(e.f=()=>{Gv(e.update)}),$nextTick:e=>e.n||(e.n=_t.bind(e.proxy)),$watch:e=>s5.bind(e)}),Op=(e,t)=>e!==Bn&&!e.__isScriptSetup&&qn(e,t),Fp={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(Op(r,t))return s[t]=1,r[t];if(o!==Bn&&qn(o,t))return s[t]=2,o[t];if(qn(i,t))return s[t]=3,i[t];if(n!==Bn&&qn(n,t))return s[t]=4,n[t];Np&&(s[t]=0)}}const u=Bu[t];let d,f;if(u)return t==="$attrs"&&$o(e.attrs,"get",""),u(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==Bn&&qn(n,t))return s[t]=4,n[t];if(f=l.config.globalProperties,qn(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return Op(o,t)?(o[t]=n,!0):r!==Bn&&qn(r,t)?(r[t]=n,!0):qn(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!==Bn&&a[0]!=="$"&&qn(e,a)||Op(t,a)||qn(i,a)||qn(r,a)||qn(Bu,a)||qn(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:qn(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},VC=er({},Fp,{get(e,t){if(t!==Symbol.unscopables)return Fp.get(e,t,e)},has(e,t){return t[0]!=="_"&&!$2(t)}}),Np=!0,UC={data:Xw,props:Zw,emits:Zw,methods:kf,computed:kf,beforeCreate:ni,created:ni,beforeMount:ni,mounted:ni,beforeUpdate:ni,updated:ni,beforeDestroy:ni,beforeUnmount:ni,destroyed:ni,unmounted:ni,activated:ni,deactivated:ni,errorCaptured:ni,serverPrefetch:ni,components:kf,directives:kf,watch:M5,provide:Xw,inject:R5},$C=0,Al=null,Ty=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Wr(t)}Modifiers`]||e[`${ti(t)}Modifiers`],HC=new WeakMap,GC=e=>{let t;for(const n in e)(n==="class"||n==="style"||ku(n))&&((t||(t={}))[n]=e[n]);return t},WC=(e,t)=>{const n={};for(const r in e)(!Jd(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},xy={},Ry=()=>Object.create(xy),My=e=>Object.getPrototypeOf(e)===xy,KC=new WeakMap,Bp=e=>e==="_"||e==="_ctx"||e==="$stable",zp=e=>Gt(e)?e.map(wi):[wi(e)],qC=(e,t,n)=>{if(t._n)return t;const r=go((...o)=>zp(t(...o)),n);return r._c=!1,r},Ly=(e,t,n)=>{const r=e._ctx;for(const o in e){if(Bp(o))continue;const i=e[o];if(un(i))t[o]=qC(o,i,r);else if(i!=null){const s=zp(i);t[o]=()=>s}}},Py=(e,t)=>{const n=zp(t);e.slots.default=()=>n},Dy=(e,t,n)=>{for(const r in t)(n||!Bp(r))&&(e[r]=t[r])},YC=(e,t,n)=>{const r=e.slots=Ry();if(e.vnode.shapeFlag&32){const o=t._;o?(Dy(r,t,n),n&&wv(r,"_",o,!0)):Ly(t,r)}else t&&Py(e,t)},XC=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=Bn;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Dy(o,t,n):(i=!t.$stable,Ly(t,o)),s=t}else t&&(Py(e,t),s={default:1});if(i)for(const a in o)!Bp(a)&&s[a]==null&&delete o[a]},Kr=hC,Pf=e=>e.__isSuspense,jp=0,ZC={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,u){if(e==null)j5(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}V5(e,t,n,r,o,s,a,l,u)}},hydrate:U5,normalize:$5},Vt=Symbol.for("v-fgt"),Oa=Symbol.for("v-txt"),Br=Symbol.for("v-cmt"),Il=Symbol.for("v-stc"),zu=[],Ro=null,El=1,Oy=({key:e})=>e??null,Df=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?ar(e)||vr(e)||un(e)?{i:vo,r:e,k:t,f:!!n}:e:null),sn=W5,QC=Qw(),JC=0,yo=null,Sr=()=>yo||vo;{const e=sf(),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)}};Vp=t("__VUE_INSTANCE_SETTERS__",n=>yo=n),ju=t("__VUE_SSR_SETTERS__",n=>Tl=n)}Rc=e=>{const t=yo;return Vp(e),e.scope.on(),()=>{e.scope.off(),Vp(t)}},Vu=()=>{yo&&yo.scope.off(),Vp(null)},Tl=!1,ek=()=>!Up,tk={get(e,t){return $o(e,"get",""),e[t]}},Ce=(e,t)=>Kx(e,t,Tl),Ny="3.5.32",nk=Ti,rk=AC,ok=Ou,ik=Mw,sk={createComponentInstance:yC,setupComponent:wC,renderComponentRoot:Ep,setCurrentRenderingInstance:vf,isVNode:La,normalizeVNode:wi,getComponentPublicInstance:Af,ensureValidVNode:ny,pushWarningContext:Zx,popWarningContext:Qx},Q5=null,J5=null,e6=null}));function lk(e){const t={};for(const T in e)T in Gy||(t[T]=e[T]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:i=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:u=s,appearToClass:d=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,m=t6(o),v=m&&m[0],C=m&&m[1],{onBeforeEnter:w,onEnter:_,onEnterCancelled:b,onLeave:S,onLeaveCancelled:x,onBeforeAppear:L=w,onAppear:B=_,onAppearCancelled:q=b}=t,F=(T,V,R,$)=>{T._enterCancelled=$,xl(T,V?d:a),xl(T,V?u:s),R&&R()},P=(T,V)=>{T._isLeaving=!1,xl(T,f),xl(T,g),xl(T,p),V&&V()},U=T=>(V,R)=>{const $=T?B:_,se=()=>F(V,T,R);Rl($,[V,se]),ck(()=>{xl(V,T?l:i),Xs(V,T?d:a),Ky($)||uk(V,r,v,se)})};return er(t,{onBeforeEnter(T){Rl(w,[T]),Xs(T,i),Xs(T,s)},onBeforeAppear(T){Rl(L,[T]),Xs(T,l),Xs(T,u)},onEnter:U(!1),onAppear:U(!0),onLeave(T,V){T._isLeaving=!0;const R=()=>P(T,V);Xs(T,f),T._enterCancelled?(Xs(T,p),zy(T)):(zy(T),Xs(T,p)),ck(()=>{T._isLeaving&&(xl(T,f),Xs(T,g),Ky(S)||uk(T,r,C,R))}),Rl(S,[T,R])},onEnterCancelled(T){F(T,!1,void 0,!0),Rl(b,[T])},onAppearCancelled(T){F(T,!0,void 0,!0),Rl(q,[T])},onLeaveCancelled(T){P(T),Rl(x,[T])}})}function t6(e){if(e==null)return null;if($n(e))return[By(e.enter),By(e.leave)];{const t=By(e);return[t,t]}}function By(e){return of(e)}function Xs(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Mc]||(e[Mc]=new Set)).add(t)}function xl(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Mc];n&&(n.delete(t),n.size||(e[Mc]=void 0))}function ck(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function uk(e,t,n,r){const o=e._endId=++Lk,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=dk(e,t);if(!s)return r();const u=s+"end";let d=0;const f=()=>{e.removeEventListener(u,p),i()},p=g=>{g.target===e&&++d>=l&&f()};setTimeout(()=>{d<l&&f()},a+1),e.addEventListener(u,p)}function dk(e,t){const n=window.getComputedStyle(e),r=m=>(n[m]||"").split(", "),o=r(`${Na}Delay`),i=r(`${Na}Duration`),s=fk(o,i),a=r(`${$u}Delay`),l=r(`${$u}Duration`),u=fk(a,l);let d=null,f=0,p=0;t===Na?s>0&&(d=Na,f=s,p=i.length):t===$u?u>0&&(d=$u,f=u,p=l.length):(f=Math.max(s,u),d=f>0?s>u?Na:$u:null,p=d?d===Na?i.length:l.length:0);const g=d===Na&&/\b(?:transform|all)(?:,|$)/.test(r(`${Na}Property`).toString());return{type:d,timeout:f,propCount:p,hasTransform:g}}function fk(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>hk(n)+hk(e[r])))}function hk(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function zy(e){return(e?e.ownerDocument:document).body.offsetHeight}function n6(e,t,n){const r=e[Mc];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function Of(e,t){e.style.display=t?e[Ff]:"none",e[qy]=!t}function r6(){Yy.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function o6(e){const t=Sr();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>$p(i,o))},r=()=>{const o=e(t.proxy);t.ce?$p(t.ce,o):jy(t.subTree,o),n(o)};Lp(()=>{gf(r)}),jn(()=>{$t(r,Ti,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),Lf(()=>o.disconnect())})}function jy(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{jy(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)$p(e.el,t);else if(e.type===Vt)e.children.forEach(n=>jy(n,t));else if(e.type===Il){let{el:n,anchor:r}=e;for(;n&&($p(n,t),n!==r);)n=n.nextSibling}}function $p(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=Px(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[Xy]=r}}function i6(e,t,n){const r=e.style,o=ar(n);let i=!1;if(n&&!o){if(t)if(ar(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&Hp(r,a,"")}else for(const s in t)n[s]==null&&Hp(r,s,"");for(const s in n)s==="display"&&(i=!0),Hp(r,s,n[s])}else if(o){if(t!==n){const s=r[Xy];s&&(n+=";"+s),r.cssText=n,i=Pk.test(n)}}else t&&e.removeAttribute("style");Ff in e&&(e[Ff]=i?r.display:"",e[qy]&&(r.display="none"))}function Hp(e,t,n){if(Gt(n))n.forEach(r=>Hp(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=s6(e,t);Zy.test(n)?e.setProperty(ti(r),n.replace(Zy,""),"important"):e[r]=n}}function s6(e,t){const n=qp[t];if(n)return n;let r=Wr(t);if(r!=="filter"&&r in e)return qp[t]=r;r=Su(r);for(let o=0;o<Qy.length;o++){const i=Qy[o]+r;if(i in e)return qp[t]=i}return t}function pk(e,t,n,r,o,i=K2(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Jy,t.slice(6,t.length)):e.setAttributeNS(Jy,t,n):n==null||i&&!F2(n)?e.removeAttribute(t):e.setAttribute(t,i?"":vi(n)?String(n):n)}function mk(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Uy(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=F2(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 Fa(e,t,n,r){e.addEventListener(t,n,r)}function a6(e,t,n,r){e.removeEventListener(t,n,r)}function l6(e,t,n,r,o=null){const i=e[eb]||(e[eb]={}),s=i[t];if(r&&s)s.value=r;else{const[a,l]=c6(t);r?Fa(e,a,i[t]=u6(r,o),l):s&&(a6(e,a,s,l),i[t]=void 0)}}function c6(e){let t;if(tb.test(e)){t={};let n;for(;n=e.match(tb);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):ti(e.slice(2)),t]}function u6(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;ts(d6(r,n.value),t,5,[r])};return n.value=e,n.attached=Ok(),n}function d6(e,t){if(Gt(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 f6(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&nb(t)&&un(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 nb(t)&&ar(n)?!1:t in e}function h6(e,t){const n=e._def.props;if(!n)return!1;const r=Wr(t);return Array.isArray(n)?n.some(o=>Wr(o)===r):Object.keys(n).some(o=>Wr(o)===r)}function gk(e,t,n){let r=Cl(e,t);ef(r)&&(r=er({},r,t));class o extends ib{constructor(s){super(r,s,n)}}return o.def=r,o}function vk(e){const t=Sr(),n=t&&t.ce;return n||null}function p6(){const e=vk();return e&&e.shadowRoot}function m6(e="$style"){{const t=Sr();if(!t)return Bn;const n=t.type.__cssModules;if(!n)return Bn;const r=n[e];return r||Bn}}function g6(e){const t=e.el;t[Nf]&&t[Nf](),t[lb]&&t[lb]()}function v6(e){ab.set(e,yk(e.el))}function y6(e){const t=sb.get(e),n=ab.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 yk(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function b6(e,t,n){const r=e.cloneNode(),o=e[Mc];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}=dk(r);return i.removeChild(r),s}function w6(e){e.target.composing=!0}function bk(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function wk(e,t,n){return t&&(e=e.trim()),n&&(e=rf(e)),e}function Ck(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(Gt(t))o=ip(t,r.props.value)>-1;else if(yl(t))o=t.has(r.props.value);else{if(t===n)return;o=_a(t,Sk(e,!0))}e.checked!==o&&(e.checked=o)}function kk(e,t){const n=e.multiple,r=Gt(t);if(!(n&&!r&&!yl(t))){for(let o=0,i=e.options.length;o<i;o++){const s=e.options[o],a=Uu(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(u=>String(u)===String(a)):s.selected=ip(t,a)>-1}else s.selected=t.has(a);else if(_a(Uu(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Uu(e){return"_value"in e?e._value:e.value}function Sk(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function _k(e,t){switch(e){case"SELECT":return Zp;case"TEXTAREA":return Pi;default:switch(t){case"checkbox":return Hu;case"radio":return Xp;default:return Pi}}}function Gp(e,t,n,r,o){const i=_k(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function C6(){Pi.getSSRProps=({value:e})=>({value:e}),Xp.getSSRProps=({value:e},t)=>{if(t.props&&_a(t.props.value,e))return{checked:!0}},Hu.getSSRProps=({value:e},t)=>{if(Gt(e)){if(t.props&&ip(e,t.props.value)>-1)return{checked:!0}}else if(yl(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},cb.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=_k(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function Ak(){return Bf||(Bf=iC(ub))}function Ik(){return Bf=db?Bf:sC(ub),db=!0,Bf}function Ek(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Tk(e){return ar(e)?document.querySelector(e):e}var Wp,Vy,Uy,xk,Rk,Zs,$y,Hy,Na,$u,Mc,Gy,Wy,Mk,Kp,Rl,Ky,Lk,Ff,qy,Yy,Xy,Pk,Zy,Qy,qp,Jy,eb,tb,Yp,Dk,Ok,nb,rb,ob,Fk,Nk,ib,sb,ab,Nf,lb,Bk,zk,Ba,Li,Pi,Hu,Xp,Zp,cb,jk,Vk,an,Uk,ri,ub,Bf,db,fb,$k,Lc,hb,pb,Hk,k6=Fr((()=>{if(ak(),ak(),_v(),Wp=void 0,Vy=typeof window<"u"&&window.trustedTypes,Vy)try{Wp=Vy.createPolicy("vue",{createHTML:e=>e})}catch{}Uy=Wp?e=>Wp.createHTML(e):e=>e,xk="http://www.w3.org/2000/svg",Rk="http://www.w3.org/1998/Math/MathML",Zs=typeof document<"u"?document:null,$y=Zs&&Zs.createElement("template"),Hy={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"?Zs.createElementNS(xk,e):t==="mathml"?Zs.createElementNS(Rk,e):n?Zs.createElement(e,{is:n}):Zs.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Zs.createTextNode(e),createComment:e=>Zs.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Zs.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{$y.innerHTML=Uy(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=$y.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]}},Na="transition",$u="animation",Mc=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},Wy=er({},Mp,Gy),Mk=e=>(e.displayName="Transition",e.props=Wy,e),Kp=Mk((e,{slots:t})=>Nr(wy,lk(e),t)),Rl=(e,t=[])=>{Gt(e)?e.forEach(n=>n(...t)):e&&e(...t)},Ky=e=>e?Gt(e)?e.some(t=>t.length>1):e.length>1:!1,Lk=0,Ff=Symbol("_vod"),qy=Symbol("_vsh"),Yy={name:"show",beforeMount(e,{value:t},{transition:n}){e[Ff]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Of(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),Of(e,!0),r.enter(e)):r.leave(e,()=>{Of(e,!1)}):Of(e,t))},beforeUnmount(e,{value:t}){Of(e,t)}},Xy=Symbol(""),Pk=/(?:^|;)\s*display\s*:/,Zy=/\s*!important$/,Qy=["Webkit","Moz","ms"],qp={},Jy="http://www.w3.org/1999/xlink",eb=Symbol("_vei"),tb=/(?:Once|Passive|Capture)$/,Yp=0,Dk=Promise.resolve(),Ok=()=>Yp||(Dk.then(()=>Yp=0),Yp=Date.now()),nb=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,rb=(e,t,n,r,o,i)=>{const s=o==="svg";t==="class"?n6(e,r,s):t==="style"?i6(e,n,r):ku(t)?Jd(t)||l6(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):f6(e,t,r,s))?(mk(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&pk(e,t,r,s,i,t!=="value")):e._isVueCE&&(h6(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!ar(r)))?mk(e,Wr(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),pk(e,t,r,s))},ob={},Fk=((e,t)=>gk(e,t,hb)),Nk=typeof HTMLElement<"u"?HTMLElement:class{},ib=class YT extends Nk{constructor(t,n={},r=Lc){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!==Lc?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(er({},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 YT){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,_t(()=>{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&&!Gt(i))for(const l in i){const u=i[l];(u===Number||u&&u.type===Number)&&(l in this._props&&(this._props[l]=of(this._props[l])),(a||(a=Object.create(null)))[Wr(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)qn(this,r)||Object.defineProperty(this,r,{get:()=>Ye(n[r])})}_resolveProps(t){const{props:n}=t,r=Gt(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(Wr))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):ob;const o=Wr(t);n&&this._numberProps&&this._numberProps[o]&&(r=of(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===ob?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(ti(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(ti(t),n+""):n||this.removeAttribute(ti(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),fb(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=sn(this._def,er(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,ef(s[0])?er({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),ti(i)!==i&&o(ti(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){}},sb=new WeakMap,ab=new WeakMap,Nf=Symbol("_moveCb"),lb=Symbol("_enterCb"),Bk=e=>(delete e.props.mode,e),zk=Bk({name:"TransitionGroup",props:er({},Wy,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=Sr(),r=qv();let o,i;return Mf(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!b6(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(g6),o.forEach(v6);const a=o.filter(y6);zy(n.vnode.el),a.forEach(l=>{const u=l.el,d=u.style;Xs(u,s),d.transform=d.webkitTransform=d.transitionDuration="";const f=u[Nf]=p=>{p&&p.target!==u||(!p||p.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",f),u[Nf]=null,xl(u,s))};u.addEventListener("transitionend",f)}),o=[]}),()=>{const s=En(e),a=lk(s);let l=s.tag||Vt;if(o=[],i)for(let u=0;u<i.length;u++){const d=i[u];d.el&&d.el instanceof Element&&(o.push(d),Ma(d,Ru(d,a,r,n)),sb.set(d,yk(d.el)))}i=t.default?wp(t.default()):[];for(let u=0;u<i.length;u++){const d=i[u];d.key!=null&&Ma(d,Ru(d,a,r,n))}return sn(l,null,i)}}}),Ba=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Gt(t)?n=>kc(t,n):t},Li=Symbol("_assign"),Pi={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[Li]=Ba(o);const i=r||o.props&&o.props.type==="number";Fa(e,t?"change":"input",s=>{s.target.composing||e[Li](wk(e.value,n,i))}),(n||i)&&Fa(e,"change",()=>{e.value=wk(e.value,n,i)}),t||(Fa(e,"compositionstart",w6),Fa(e,"compositionend",bk),Fa(e,"change",bk))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[Li]=Ba(s),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?rf(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)}},Hu={deep:!0,created(e,t,n){e[Li]=Ba(n),Fa(e,"change",()=>{const r=e._modelValue,o=Uu(e),i=e.checked,s=e[Li];if(Gt(r)){const a=ip(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(yl(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(Sk(e,i))})},mounted:Ck,beforeUpdate(e,t,n){e[Li]=Ba(n),Ck(e,t,n)}},Xp={created(e,{value:t},n){e.checked=_a(t,n.props.value),e[Li]=Ba(n),Fa(e,"change",()=>{e[Li](Uu(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Li]=Ba(r),t!==n&&(e.checked=_a(t,r.props.value))}},Zp={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=yl(t);Fa(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?rf(Uu(s)):Uu(s));e[Li](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,_t(()=>{e._assigning=!1})}),e[Li]=Ba(r)},mounted(e,{value:t}){kk(e,t)},beforeUpdate(e,t,n){e[Li]=Ba(n)},updated(e,{value:t}){e._assigning||kk(e,t)}},cb={created(e,t,n){Gp(e,t,n,null,"created")},mounted(e,t,n){Gp(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){Gp(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){Gp(e,t,n,r,"updated")}},jk=["ctrl","shift","alt","meta"],Vk={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)=>jk.some(n=>e[`${n}Key`]&&!t.includes(n))},an=(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=Vk[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},Uk={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},ri=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=ti(o.key);if(t.some(s=>s===i||Uk[s]===i))return e(o)}))},ub=er({patchProp:rb},Hy),db=!1,fb=((...e)=>{Ak().render(...e)}),$k=((...e)=>{Ik().hydrate(...e)}),Lc=((...e)=>{const t=Ak().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=Tk(r);if(!o)return;const i=t._component;!un(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,Ek(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),hb=((...e)=>{const t=Ik().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=Tk(r);if(o)return n(o,!0,Ek(o))},t}),pb=!1,Hk=()=>{pb||(pb=!0,C6(),r6())}})),S6=Xd({BaseTransition:()=>wy,BaseTransitionPropsValidators:()=>Mp,Comment:()=>Br,DeprecationTypes:()=>null,EffectScope:()=>pp,ErrorCodes:()=>_C,ErrorTypeStrings:()=>rk,Fragment:()=>Vt,KeepAlive:()=>zC,ReactiveEffect:()=>Iu,Static:()=>Il,Suspense:()=>ZC,Teleport:()=>_l,Text:()=>Oa,TrackOpTypes:()=>Iw,Transition:()=>Kp,TransitionGroup:()=>zk,TriggerOpTypes:()=>Ew,VueElement:()=>ib,assertNumber:()=>Jx,callWithAsyncErrorHandling:()=>ts,callWithErrorHandling:()=>xu,camelize:()=>Wr,capitalize:()=>Su,cloneVNode:()=>Ws,compatUtils:()=>null,compile:()=>Gk,computed:()=>Ce,createApp:()=>Lc,createBlock:()=>mn,createCommentVNode:()=>dt,createElementBlock:()=>we,createElementVNode:()=>de,createHydrationRenderer:()=>sC,createPropsRestProxy:()=>I5,createRenderer:()=>iC,createSSRApp:()=>hb,createSlots:()=>m5,createStaticVNode:()=>vC,createTextVNode:()=>Ri,createVNode:()=>sn,customRef:()=>ow,defineAsyncComponent:()=>jw,defineComponent:()=>Cl,defineCustomElement:()=>gk,defineEmits:()=>y5,defineExpose:()=>b5,defineModel:()=>k5,defineOptions:()=>w5,defineProps:()=>v5,defineSSRCustomElement:()=>Fk,defineSlots:()=>C5,devtools:()=>ok,effect:()=>Fx,effectScope:()=>Av,getCurrentInstance:()=>Sr,getCurrentScope:()=>Iv,getCurrentWatcher:()=>qx,getTransitionRawChildren:()=>wp,guardReactiveProps:()=>gC,h:()=>Nr,handleError:()=>_c,hasInjectionContext:()=>Lw,hydrate:()=>$k,hydrateOnIdle:()=>OC,hydrateOnInteraction:()=>BC,hydrateOnMediaQuery:()=>NC,hydrateOnVisible:()=>FC,initCustomFormatter:()=>X5,initDirectivesForSSR:()=>Hk,inject:()=>Gs,isMemoSame:()=>SC,isProxy:()=>lf,isReactive:()=>yi,isReadonly:()=>$s,isRef:()=>vr,isRuntimeOnly:()=>ek,isShallow:()=>bi,isVNode:()=>La,markRaw:()=>Qr,mergeDefaults:()=>_5,mergeModels:()=>A5,mergeProps:()=>Ks,nextTick:()=>_t,nodeOps:()=>Hy,normalizeClass:()=>on,normalizeProps:()=>gv,normalizeStyle:()=>Rn,onActivated:()=>Zv,onBeforeMount:()=>Sy,onBeforeUnmount:()=>lr,onBeforeUpdate:()=>Lp,onDeactivated:()=>Qv,onErrorCaptured:()=>Uw,onMounted:()=>jn,onRenderTracked:()=>Iy,onRenderTriggered:()=>Ay,onScopeDispose:()=>q2,onServerPrefetch:()=>_y,onUnmounted:()=>Lf,onUpdated:()=>Mf,onWatcherCleanup:()=>aw,openBlock:()=>ve,patchProp:()=>rb,popScopeId:()=>r5,provide:()=>Wv,proxyRefs:()=>Pv,pushScopeId:()=>n5,queuePostFlushCb:()=>gf,reactive:()=>io,readonly:()=>fp,ref:()=>ne,registerRuntimeCompiler:()=>q5,render:()=>fb,renderList:()=>Fn,renderSlot:()=>Lu,resolveComponent:()=>p5,resolveDirective:()=>$w,resolveDynamicComponent:()=>ey,resolveFilter:()=>null,resolveTransitionHooks:()=>Ru,setBlockTracking:()=>_f,setDevtoolsHook:()=>ik,setTransitionHooks:()=>Ma,shallowReactive:()=>nw,shallowReadonly:()=>Hx,shallowRef:()=>Mr,ssrContextKey:()=>hy,ssrUtils:()=>sk,stop:()=>Nx,toDisplayString:()=>Et,toHandlerKey:()=>_u,toHandlers:()=>g5,toRaw:()=>En,toRef:()=>Dv,toRefs:()=>iw,toValue:()=>Wx,transformVNodeArgs:()=>G5,triggerRef:()=>Gx,unref:()=>Ye,useAttrs:()=>Ww,useCssModule:()=>m6,useCssVars:()=>o6,useHost:()=>vk,useId:()=>l5,useModel:()=>P5,useSSRContext:()=>py,useShadowRoot:()=>p6,useSlots:()=>Gw,useTemplateRef:()=>c5,useTransitionState:()=>qv,vModelCheckbox:()=>Hu,vModelDynamic:()=>cb,vModelRadio:()=>Xp,vModelSelect:()=>Zp,vModelText:()=>Pi,vShow:()=>Yy,version:()=>Ny,warn:()=>nk,watch:()=>$t,watchEffect:()=>o5,watchPostEffect:()=>i5,watchSyncEffect:()=>Pw,withAsyncContext:()=>E5,withCtx:()=>go,withDefaults:()=>S5,withDirectives:()=>xi,withKeys:()=>ri,withMemo:()=>Z5,withModifiers:()=>an,withScopeId:()=>IC}),Gk,Bt=Fr((()=>{k6(),Gk=()=>{}})),_6=T2(((e,t)=>{(function(n){typeof e=="object"&&typeof t<"u"?t.exports=n():typeof define=="function"&&define.amd?define([],n):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=n()})(function(){return(function n(r,o,i){function s(u,d){if(!o[u]){if(!r[u]){var f=typeof require=="function"&&require;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var g=o[u]={exports:{}};r[u][0].call(g.exports,function(m){var v=r[u][1][m];return s(v||m)},g,g.exports,n,r,o,i)}return o[u].exports}for(var a=typeof require=="function"&&require,l=0;l<i.length;l++)s(i[l]);return s})({1:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var u,d,f,p,g,m,v,C=[],w=0,_=l.length,b=_,S=i.getTypeOf(l)!=="string";w<l.length;)b=_-w,f=S?(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,g=(3&u)<<4|d>>4,m=1<b?(15&d)<<2|f>>6:64,v=2<b?63&f:64,C.push(a.charAt(p)+a.charAt(g)+a.charAt(m)+a.charAt(v));return C.join("")},o.decode=function(l){var u,d,f,p,g,m,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 _,b=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&b--,l.charAt(l.length-2)===a.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(_=s.uint8array?new Uint8Array(0|b):new Array(0|b);v<l.length;)u=a.indexOf(l.charAt(v++))<<2|(p=a.indexOf(l.charAt(v++)))>>4,d=(15&p)<<4|(g=a.indexOf(l.charAt(v++)))>>2,f=(3&g)<<6|(m=a.indexOf(l.charAt(v++))),_[C++]=u,g!==64&&(_[C++]=d),m!==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,g,m){this.compressedSize=d,this.uncompressedSize=f,this.crc32=p,this.compression=g,this.compressedContent=m}u.prototype={getContentWorker:function(){var d=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,p){return d.pipe(new a).pipe(new l("uncompressedSize")).pipe(f.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",f)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){"use strict";var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){"use strict";var i=n("./utils"),s=(function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l})();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?(function(u,d,f,p){var g=s,m=p+f;u^=-1;for(var v=p;v<m;v++)u=u>>>8^g[255&(u^d[v])];return-1^u})(0|l,a,a.length,0):(function(u,d,f,p){var g=s,m=p+f;u^=-1;for(var v=p;v<m;v++)u=u>>>8^g[255&(u^d.charCodeAt(v))];return-1^u})(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){"use strict";o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){"use strict";var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=i?"uint8array":"array";function d(f,p){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(d,l),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},d.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(p){f.push({data:p,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){"use strict";function i(g,m){var v,C="";for(v=0;v<m;v++)C+=String.fromCharCode(255&g),g>>>=8;return C}function s(g,m,v,C,w,_){var b,S,x=g.file,L=g.compression,B=_!==u.utf8encode,q=a.transformTo("string",_(x.name)),F=a.transformTo("string",u.utf8encode(x.name)),P=x.comment,U=a.transformTo("string",_(P)),T=a.transformTo("string",u.utf8encode(P)),V=F.length!==x.name.length,R=T.length!==P.length,$="",se="",X="",J=x.dir,W=x.date,Te={crc32:0,compressedSize:0,uncompressedSize:0};m&&!v||(Te.crc32=g.crc32,Te.compressedSize=g.compressedSize,Te.uncompressedSize=g.uncompressedSize);var ge=0;m&&(ge|=8),B||!V&&!R||(ge|=2048);var he=0,ye=0;J&&(he|=16),w==="UNIX"?(ye=798,he|=(function(je,Je){var bt=je;return je||(bt=Je?16893:33204),(65535&bt)<<16})(x.unixPermissions,J)):(ye=20,he|=(function(je){return 63&(je||0)})(x.dosPermissions)),b=W.getUTCHours(),b<<=6,b|=W.getUTCMinutes(),b<<=5,b|=W.getUTCSeconds()/2,S=W.getUTCFullYear()-1980,S<<=4,S|=W.getUTCMonth()+1,S<<=5,S|=W.getUTCDate(),V&&(se=i(1,1)+i(d(q),4)+F,$+="up"+i(se.length,2)+se),R&&(X=i(1,1)+i(d(U),4)+T,$+="uc"+i(X.length,2)+X);var Re="";return Re+=`
4
- \0`,Re+=i(ge,2),Re+=L.magic,Re+=i(b,2),Re+=i(S,2),Re+=i(Te.crc32,4),Re+=i(Te.compressedSize,4),Re+=i(Te.uncompressedSize,4),Re+=i(q.length,2),Re+=i($.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Re+q+$,dirRecord:f.CENTRAL_FILE_HEADER+i(ye,2)+Re+i(U.length,2)+"\0\0\0\0"+i(he,4)+i(C,4)+q+$+U}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(g,m,v,C){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=v,this.encodeFileName=C,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(g){var m=g.meta.percent||0,v=this.entriesCount,C=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:v?(m+100*(v-C-1))/v:100}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(C){return f.DATA_DESCRIPTOR+i(C.crc32,4)+i(C.compressedSize,4)+i(C.uncompressedSize,4)})(g),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,C=(function(w,_,b,S,x){var L=a.transformTo("string",x(S));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(_,4)+i(b,4)+i(L.length,2)+L})(this.dirRecords.length,v,g,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(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var d=new s(l.streamFiles,u,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var m=(function(_,b){var S=_||b,x=i[S];if(!x)throw new Error(S+" is not a valid compression method !");return x})(g.options.compression,l.compression),v=g.options.compressionOptions||l.compressionOptions||{},C=g.dir,w=g.date;g._compressWorker(m,v).withStreamInfo("file",{name:p,dir:C,date:w,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,m){var v=p.decompressed.getContentWorker().pipe(new u);v.on("error",function(C){m(C)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(v){var C=new l(g);return C.load(v),C}).then(function(v){var C=[s.Promise.resolve(v)],w=v.files;if(g.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 b=w[_],S=b.fileNameStr,x=i.resolve(b.fileNameStr);m.file(x,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:g.createFolders}),b.dir||(m.file(x).unsafeOriginalName=S)}return C.zipComment.length&&(m.comment=C.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,p){d.push(f)||d._helper.pause(),u&&u(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(S,x,L){var B,q=a.getTypeOf(x),F=a.extend(L||{},d);F.date=F.date||new Date,F.compression!==null&&(F.compression=F.compression.toUpperCase()),typeof F.unixPermissions=="string"&&(F.unixPermissions=parseInt(F.unixPermissions,8)),F.unixPermissions&&16384&F.unixPermissions&&(F.dir=!0),F.dosPermissions&&16&F.dosPermissions&&(F.dir=!0),F.dir&&(S=w(S)),F.createFolders&&(B=C(S))&&_.call(this,B,!0);var P=q==="string"&&F.binary===!1&&F.base64===!1;L&&L.binary!==void 0||(F.binary=!P),(x instanceof f&&x.uncompressedSize===0||F.dir||!x||x.length===0)&&(F.base64=!1,F.binary=!0,x="",F.compression="STORE",q="string");var U=null;U=x instanceof f||x instanceof l?x:m.isNode&&m.isStream(x)?new v(S,x):a.prepareContent(S,x,F.binary,F.optimizedBinaryString,F.base64);var T=new p(S,U,F);this.files[S]=T}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),C=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var x=S.lastIndexOf("/");return 0<x?S.substring(0,x):""},w=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},_=function(S,x){return x=x!==void 0?x:d.createFolders,S=w(S),this.files[S]||i.call(this,S,null,{dir:!0,createFolders:x}),this.files[S]};function b(S){return Object.prototype.toString.call(S)==="[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(S){var x,L,B;for(x in this.files)B=this.files[x],(L=x.slice(this.root.length,x.length))&&x.slice(0,this.root.length)===this.root&&S(L,B)},filter:function(S){var x=[];return this.forEach(function(L,B){S(L,B)&&x.push(B)}),x},file:function(S,x,L){if(arguments.length!==1)return S=this.root+S,i.call(this,S,x,L),this;if(b(S)){var B=S;return this.filter(function(F,P){return!P.dir&&B.test(F)})}var q=this.files[this.root+S];return q&&!q.dir?q:null},folder:function(S){if(!S)return this;if(b(S))return this.filter(function(q,F){return F.dir&&S.test(q)});var x=this.root+S,L=_.call(this,x),B=this.clone();return B.root=L.name,B},remove:function(S){S=this.root+S;var x=this.files[S];if(x||(S.slice(-1)!=="/"&&(S+="/"),x=this.files[S]),x&&!x.dir)delete this.files[S];else for(var L=this.filter(function(q,F){return F.name.slice(0,S.length)===S}),B=0;B<L.length;B++)delete this.files[L[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(S){var x,L={};try{if((L=a.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=L.type.toLowerCase(),L.compression=L.compression.toUpperCase(),L.type==="binarystring"&&(L.type="string"),!L.type)throw new Error("No output type specified.");a.checkSupport(L.type),L.platform!=="darwin"&&L.platform!=="freebsd"&&L.platform!=="linux"&&L.platform!=="sunos"||(L.platform="UNIX"),L.platform==="win32"&&(L.platform="DOS");var B=L.comment||this.comment||"";x=g.generateWorker(this,L,B)}catch(q){(x=new l("error")).error(q)}return new u(x,L.type||"string",L.mimeType)},generateAsync:function(S,x){return this.generateInternalStream(S).accumulate(x)},generateNodeStream:function(S,x){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(x)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){"use strict";r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(f):s.uint8array?new d(i.transformTo("uint8array",f)):new a(i.transformTo("array",f)):new l(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(m,v){return new d.Promise(function(C,w){var _=[],b=m._internalType,S=m._outputType,x=m._mimeType;m.on("data",function(L,B){_.push(L),v&&v(B)}).on("error",function(L){_=[],w(L)}).on("end",function(){try{C((function(L,B,q){switch(L){case"blob":return i.newBlob(i.transformTo("arraybuffer",B),q);case"base64":return l.encode(B);default:return i.transformTo(L,B)}})(S,(function(L,B){var q,F=0,P=null,U=0;for(q=0;q<B.length;q++)U+=B[q].length;switch(L){case"string":return B.join("");case"array":return Array.prototype.concat.apply([],B);case"uint8array":for(P=new Uint8Array(U),q=0;q<B.length;q++)P.set(B[q],F),F+=B[q].length;return P;case"nodebuffer":return Buffer.concat(B);default:throw new Error("concat : unsupported type '"+L+"'")}})(b,_),x))}catch(L){w(L)}_=[]}).resume()})}function g(m,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=m.pipe(new s(w)),m.lock()}catch(_){this._worker=new a("error"),this._worker.error(_)}}g.prototype={accumulate:function(m){return p(this,m)},on:function(m,v){var C=this;return m==="data"?this._worker.on(m,function(w){v.call(C,w.data,w.meta)}):this._worker.on(m,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(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},m)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,C,w,_,b,S=m.length,x=0;for(_=0;_<S;_++)(64512&(C=m.charCodeAt(_)))==55296&&_+1<S&&(64512&(w=m.charCodeAt(_+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),_++),x+=C<128?1:C<2048?2:C<65536?3:4;for(v=s.uint8array?new Uint8Array(x):new Array(x),_=b=0;b<x;_++)(64512&(C=m.charCodeAt(_)))==55296&&_+1<S&&(64512&(w=m.charCodeAt(_+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),_++),C<128?v[b++]=C:(C<2048?v[b++]=192|C>>>6:(C<65536?v[b++]=224|C>>>12:(v[b++]=240|C>>>18,v[b++]=128|C>>>12&63),v[b++]=128|C>>>6&63),v[b++]=128|63&C);return v})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(m){var v,C,w,_,b=m.length,S=new Array(2*b);for(v=C=0;v<b;)if((w=m[v++])<128)S[C++]=w;else if(4<(_=u[w]))S[C++]=65533,v+=_-1;else{for(w&=_===2?31:_===3?15:7;1<_&&v<b;)w=w<<6|63&m[v++],_--;1<_?S[C++]=65533:w<65536?S[C++]=w:(w-=65536,S[C++]=55296|w>>10&1023,S[C++]=56320|1023&w)}return S.length!==C&&(S.subarray?S=S.subarray(0,C):S.length=C),i.applyFromCharCode(S)})(g=i.transformTo(s.uint8array?"uint8array":"array",g))},i.inherits(f,l),f.prototype.processChunk=function(g){var m=i.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=m;(m=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),m.set(v,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var C=(function(_,b){var S;for((b=b||_.length)>_.length&&(b=_.length),S=b-1;0<=S&&(192&_[S])==128;)S--;return S<0||S===0?b:S+u[_[S]]>b?S:b})(m),w=m;C!==m.length&&(s.uint8array?(w=m.subarray(0,C),this.leftOver=m.subarray(C,m.length)):(w=m.slice(0,C),this.leftOver=m.slice(C,m.length))),this.push({data:o.utf8decode(w),meta:g.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(v){return v}function d(v,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 _=[],b=0,S=v.length;if(S<=w)return String.fromCharCode.apply(null,v);for(;b<S;)C==="array"||C==="nodebuffer"?_.push(String.fromCharCode.apply(null,v.slice(b,Math.min(b+w,S)))):_.push(String.fromCharCode.apply(null,v.subarray(b,Math.min(b+w,S)))),b+=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 g(v,C){for(var w=0;w<v.length;w++)C[w]=v[w];return C}o.applyFromCharCode=p;var m={};m.string={string:u,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return m.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},m.array={string:p,array:u,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(v)}},m.arraybuffer={string:function(v){return p(new Uint8Array(v))},array:function(v){return g(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:u,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(new Uint8Array(v))}},m.uint8array={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return a.newBufferFrom(v)}},m.nodebuffer={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer:u},o.transformTo=function(v,C){return C=C||"",v?(o.checkSupport(v),m[o.getTypeOf(C)][v](C)):C},o.resolve=function(v){for(var C=v.split("/"),w=[],_=0;_<C.length;_++){var b=C[_];b==="."||b===""&&_!==0&&_!==C.length-1||(b===".."?w.pop():w.push(b))}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,_,b){return l.Promise.resolve(C).then(function(S){return i.blob&&(S instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(S))!==-1)&&typeof FileReader<"u"?new l.Promise(function(x,L){var B=new FileReader;B.onload=function(q){x(q.target.result)},B.onerror=function(q){L(q.target.error)},B.readAsArrayBuffer(S)}):S}).then(function(S){var x=o.getTypeOf(S);return x?(x==="arraybuffer"?S=o.transformTo("uint8array",S):x==="string"&&(b?S=s.decode(S):w&&_!==!0&&(S=(function(L){return d(L,i.uint8array?new Uint8Array(L.length):new Array(L.length))})(S))),S):l.Promise.reject(new Error("Can't read the data of '"+v+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===p;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=p-g;if(0<m)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,m){this.options=g,this.loadOptions=m}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(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,m,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var m=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(m),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var m,v,C,w=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<w;)m=g.readInt(2),v=g.readInt(2),C=g.readData(v),this.extraFields[m]={id:m,length:v,value:C};g.setIndex(w)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var v=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var C=this.findExtraFieldUnicodeComment();if(C!==null)this.fileCommentStr=C;else{var w=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,C){this.name=m,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(m){var v=null,C="string";try{if(!m)throw new Error("No output type specified.");var w=(C=m.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(b){(v=new d("error")).error(b)}return new s(v,C,"")},async:function(m,v){return this.internalStream(m).accumulate(v)},nodeStream:function(m,v){return this.internalStream(m||"nodebuffer").toNodejsStream(v)},_compressWorker:function(m,v){if(this._data instanceof u&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var C=this._decompressWorker();return this._dataBinary||(C=C.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(C,m,v)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,d=new l(m),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(m,0)};else{var p=new i.MessageChannel;p.port1.onmessage=m,s=function(){p.port2.postMessage(0)}}var g=[];function m(){var v,C;a=!0;for(var w=g.length;w;){for(C=g,g=[],v=-1;++v<w;)C[v]();w=g.length}a=!1}r.exports=function(v){g.push(v)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(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,_,b){this.promise=w,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function g(w,_,b){i(function(){var S;try{S=_(b)}catch(x){return a.reject(w,x)}S===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,S)})}function m(w){var _=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof _=="function")return function(){_.apply(w,arguments)}}function v(w,_){var b=!1;function S(B){b||(b=!0,a.reject(w,B))}function x(B){b||(b=!0,a.resolve(w,B))}var L=C(function(){_(x,S)});L.status==="error"&&S(L.value)}function C(w,_){var b={};try{b.value=w(_),b.status="success"}catch(S){b.status="error",b.value=S}return b}(r.exports=f).prototype.finally=function(w){if(typeof w!="function")return this;var _=this.constructor;return this.then(function(b){return _.resolve(w()).then(function(){return b})},function(b){return _.resolve(w()).then(function(){throw b})})},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 b=new this.constructor(s);return this.state!==d?g(b,this.state===u?w:_,this.outcome):this.queue.push(new p(b,w,_)),b},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){g(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){g(this.promise,this.onRejected,w)},a.resolve=function(w,_){var b=C(m,_);if(b.status==="error")return a.reject(w,b.value);var S=b.value;if(S)v(w,S);else{w.state=u,w.outcome=_;for(var x=-1,L=w.queue.length;++x<L;)w.queue[x].callFulfilled(_)}return w},a.reject=function(w,_){w.state=l,w.outcome=_;for(var b=-1,S=w.queue.length;++b<S;)w.queue[b].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 b=w.length,S=!1;if(!b)return this.resolve([]);for(var x=new Array(b),L=0,B=-1,q=new this(s);++B<b;)F(w[B],B);return q;function F(P,U){_.resolve(P).then(function(T){x[U]=T,++L!==b||S||(S=!0,a.resolve(q,x))},function(T){S||(S=!0,a.reject(q,T))})}},f.race=function(w){var _=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=w.length,S=!1;if(!b)return this.resolve([]);for(var x=-1,L=new this(s);++x<b;)B=w[x],_.resolve(B).then(function(q){S||(S=!0,a.resolve(L,q))},function(q){S||(S=!0,a.reject(L,q))});var B;return L}},{immediate:36}],38:[function(n,r,o){"use strict";var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){"use strict";var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,p=-1,g=0,m=8;function v(w){if(!(this instanceof v))return new v(w);this.options=s.assign({level:p,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,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 b=i.deflateInit2(this.strm,_.level,_.method,_.windowBits,_.memLevel,_.strategy);if(b!==f)throw new Error(l[b]);if(_.header&&i.deflateSetHeader(this.strm,_.header),_.dictionary){var S;if(S=typeof _.dictionary=="string"?a.string2buf(_.dictionary):d.call(_.dictionary)==="[object ArrayBuffer]"?new Uint8Array(_.dictionary):_.dictionary,(b=i.deflateSetDictionary(this.strm,S))!==f)throw new Error(l[b]);this._dict_set=!0}}function C(w,_){var b=new v(_);if(b.push(w,!0),b.err)throw b.msg||l[b.err];return b.result}v.prototype.push=function(w,_){var b,S,x=this.strm,L=this.options.chunkSize;if(this.ended)return!1;S=_===~~_?_:_===!0?4:0,typeof w=="string"?x.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?x.input=new Uint8Array(w):x.input=w,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new s.Buf8(L),x.next_out=0,x.avail_out=L),(b=i.deflate(x,S))!==1&&b!==f)return this.onEnd(b),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||S!==4&&S!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(x.output,x.next_out))):this.onData(s.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&b!==1);return S===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===f):S!==2||(this.onEnd(f),!(x.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 g(v){if(!(this instanceof g))return new g(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 m(v,C){var w=new g(C);if(w.push(v,!0),w.err)throw w.msg||u[w.err];return w.result}g.prototype.push=function(v,C){var w,_,b,S,x,L,B=this.strm,q=this.options.chunkSize,F=this.options.dictionary,P=!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(q),B.next_out=0,B.avail_out=q),(w=i.inflate(B,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&F&&(L=typeof F=="string"?a.string2buf(F):p.call(F)==="[object ArrayBuffer]"?new Uint8Array(F):F,w=i.inflateSetDictionary(this.strm,L)),w===l.Z_BUF_ERROR&&P===!0&&(w=l.Z_OK,P=!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"?(b=a.utf8border(B.output,B.next_out),S=B.next_out-b,x=a.buf2string(B.output,b),B.next_out=S,B.avail_out=q-S,S&&s.arraySet(B.output,B.output,b,S,0),this.onData(x)):this.onData(s.shrinkBuf(B.output,B.next_out)))),B.avail_in===0&&B.avail_out===0&&(P=!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))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Inflate=g,o.inflate=m,o.inflateRaw=function(v,C){return(C=C||{}).raw=!0,m(v,C)},o.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(l[f]=d[f])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,d,f,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){var u,d,f,p,g,m;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(m=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)g=l[u],m.set(g,p),p+=g.length;return m}},a={arraySet:function(l,u,d,f,p){for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",m=0;m<p;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,m,v,C,w=f.length,_=0;for(v=0;v<w;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),_+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(_),v=C=0;C<_;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),g<128?p[C++]=g:(g<2048?p[C++]=192|g>>>6:(g<65536?p[C++]=224|g>>>12:(p[C++]=240|g>>>18,p[C++]=128|g>>>12&63),p[C++]=128|g>>>6&63),p[C++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,m=p.length;g<m;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,m,v,C,w=p||f.length,_=new Array(2*w);for(g=m=0;g<w;)if((v=f[g++])<128)_[m++]=v;else if(4<(C=l[v]))_[m++]=65533,g+=C-1;else{for(v&=C===2?31:C===3?15:7;1<C&&g<w;)v=v<<6|63&f[g++],C--;1<C?_[m++]=65533:v<65536?_[m++]=v:(v-=65536,_[m++]=55296|v>>10&1023,_[m++]=56320|1023&v)}return d(_,m)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var d=i,f=u+l;s^=-1;for(var p=u;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,m=-2,v=-1,C=4,w=2,_=8,b=9,S=286,x=30,L=19,B=2*S+1,q=15,F=3,P=258,U=P+F+1,T=42,V=113,R=1,$=2,se=3,X=4;function J(A,oe){return A.msg=d[oe],oe}function W(A){return(A<<1)-(4<A?9:0)}function Te(A){for(var oe=A.length;0<=--oe;)A[oe]=0}function ge(A){var oe=A.state,j=oe.pending;j>A.avail_out&&(j=A.avail_out),j!==0&&(s.arraySet(A.output,oe.pending_buf,oe.pending_out,j,A.next_out),A.next_out+=j,oe.pending_out+=j,A.total_out+=j,A.avail_out-=j,oe.pending-=j,oe.pending===0&&(oe.pending_out=0))}function he(A,oe){a._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,oe),A.block_start=A.strstart,ge(A.strm)}function ye(A,oe){A.pending_buf[A.pending++]=oe}function Re(A,oe){A.pending_buf[A.pending++]=oe>>>8&255,A.pending_buf[A.pending++]=255&oe}function je(A,oe){var j,Q,G=A.max_chain_length,pe=A.strstart,ke=A.prev_length,te=A.nice_match,N=A.strstart>A.w_size-U?A.strstart-(A.w_size-U):0,Y=A.window,me=A.w_mask,Pe=A.prev,_e=A.strstart+P,it=Y[pe+ke-1],Xe=Y[pe+ke];A.prev_length>=A.good_match&&(G>>=2),te>A.lookahead&&(te=A.lookahead);do if(Y[(j=oe)+ke]===Xe&&Y[j+ke-1]===it&&Y[j]===Y[pe]&&Y[++j]===Y[pe+1]){pe+=2,j++;do;while(Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&pe<_e);if(Q=P-(_e-pe),pe=_e-P,ke<Q){if(A.match_start=oe,te<=(ke=Q))break;it=Y[pe+ke-1],Xe=Y[pe+ke]}}while((oe=Pe[oe&me])>N&&--G!=0);return ke<=A.lookahead?ke:A.lookahead}function Je(A){var oe,j,Q,G,pe,ke,te,N,Y,me,Pe=A.w_size;do{if(G=A.window_size-A.lookahead-A.strstart,A.strstart>=Pe+(Pe-U)){for(s.arraySet(A.window,A.window,Pe,Pe,0),A.match_start-=Pe,A.strstart-=Pe,A.block_start-=Pe,oe=j=A.hash_size;Q=A.head[--oe],A.head[oe]=Pe<=Q?Q-Pe:0,--j;);for(oe=j=Pe;Q=A.prev[--oe],A.prev[oe]=Pe<=Q?Q-Pe:0,--j;);G+=Pe}if(A.strm.avail_in===0)break;if(ke=A.strm,te=A.window,N=A.strstart+A.lookahead,Y=G,me=void 0,me=ke.avail_in,Y<me&&(me=Y),j=me===0?0:(ke.avail_in-=me,s.arraySet(te,ke.input,ke.next_in,me,N),ke.state.wrap===1?ke.adler=l(ke.adler,te,me,N):ke.state.wrap===2&&(ke.adler=u(ke.adler,te,me,N)),ke.next_in+=me,ke.total_in+=me,me),A.lookahead+=j,A.lookahead+A.insert>=F)for(pe=A.strstart-A.insert,A.ins_h=A.window[pe],A.ins_h=(A.ins_h<<A.hash_shift^A.window[pe+1])&A.hash_mask;A.insert&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[pe+F-1])&A.hash_mask,A.prev[pe&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=pe,pe++,A.insert--,!(A.lookahead+A.insert<F)););}while(A.lookahead<U&&A.strm.avail_in!==0)}function bt(A,oe){for(var j,Q;;){if(A.lookahead<U){if(Je(A),A.lookahead<U&&oe===f)return R;if(A.lookahead===0)break}if(j=0,A.lookahead>=F&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,j=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),j!==0&&A.strstart-j<=A.w_size-U&&(A.match_length=je(A,j)),A.match_length>=F)if(Q=a._tr_tally(A,A.strstart-A.match_start,A.match_length-F),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=F){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,j=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart,--A.match_length!=0;);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+1])&A.hash_mask;else Q=a._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(Q&&(he(A,!1),A.strm.avail_out===0))return R}return A.insert=A.strstart<F-1?A.strstart:F-1,oe===p?(he(A,!0),A.strm.avail_out===0?se:X):A.last_lit&&(he(A,!1),A.strm.avail_out===0)?R:$}function ft(A,oe){for(var j,Q,G;;){if(A.lookahead<U){if(Je(A),A.lookahead<U&&oe===f)return R;if(A.lookahead===0)break}if(j=0,A.lookahead>=F&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,j=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=F-1,j!==0&&A.prev_length<A.max_lazy_match&&A.strstart-j<=A.w_size-U&&(A.match_length=je(A,j),A.match_length<=5&&(A.strategy===1||A.match_length===F&&4096<A.strstart-A.match_start)&&(A.match_length=F-1)),A.prev_length>=F&&A.match_length<=A.prev_length){for(G=A.strstart+A.lookahead-F,Q=a._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-F),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=G&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,j=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),--A.prev_length!=0;);if(A.match_available=0,A.match_length=F-1,A.strstart++,Q&&(he(A,!1),A.strm.avail_out===0))return R}else if(A.match_available){if((Q=a._tr_tally(A,0,A.window[A.strstart-1]))&&he(A,!1),A.strstart++,A.lookahead--,A.strm.avail_out===0)return R}else A.match_available=1,A.strstart++,A.lookahead--}return A.match_available&&(Q=a._tr_tally(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<F-1?A.strstart:F-1,oe===p?(he(A,!0),A.strm.avail_out===0?se:X):A.last_lit&&(he(A,!1),A.strm.avail_out===0)?R:$}function Mt(A,oe,j,Q,G){this.good_length=A,this.max_lazy=oe,this.nice_length=j,this.max_chain=Q,this.func=G}function Le(){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*x+1)),this.bl_tree=new s.Buf16(2*(2*L+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(q+1),this.heap=new s.Buf16(2*S+1),Te(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*S+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 Se(A){var oe;return A&&A.state?(A.total_in=A.total_out=0,A.data_type=w,(oe=A.state).pending=0,oe.pending_out=0,oe.wrap<0&&(oe.wrap=-oe.wrap),oe.status=oe.wrap?T:V,A.adler=oe.wrap===2?0:1,oe.last_flush=f,a._tr_init(oe),g):J(A,m)}function ce(A){var oe=Se(A);return oe===g&&(function(j){j.window_size=2*j.w_size,Te(j.head),j.max_lazy_match=i[j.level].max_lazy,j.good_match=i[j.level].good_length,j.nice_match=i[j.level].nice_length,j.max_chain_length=i[j.level].max_chain,j.strstart=0,j.block_start=0,j.lookahead=0,j.insert=0,j.match_length=j.prev_length=F-1,j.match_available=0,j.ins_h=0})(A.state),oe}function H(A,oe,j,Q,G,pe){if(!A)return m;var ke=1;if(oe===v&&(oe=6),Q<0?(ke=0,Q=-Q):15<Q&&(ke=2,Q-=16),G<1||b<G||j!==_||Q<8||15<Q||oe<0||9<oe||pe<0||C<pe)return J(A,m);Q===8&&(Q=9);var te=new Le;return(A.state=te).strm=A,te.wrap=ke,te.gzhead=null,te.w_bits=Q,te.w_size=1<<te.w_bits,te.w_mask=te.w_size-1,te.hash_bits=G+7,te.hash_size=1<<te.hash_bits,te.hash_mask=te.hash_size-1,te.hash_shift=~~((te.hash_bits+F-1)/F),te.window=new s.Buf8(2*te.w_size),te.head=new s.Buf16(te.hash_size),te.prev=new s.Buf16(te.w_size),te.lit_bufsize=1<<G+6,te.pending_buf_size=4*te.lit_bufsize,te.pending_buf=new s.Buf8(te.pending_buf_size),te.d_buf=1*te.lit_bufsize,te.l_buf=3*te.lit_bufsize,te.level=oe,te.strategy=pe,te.method=j,ce(A)}i=[new Mt(0,0,0,0,function(A,oe){var j=65535;for(j>A.pending_buf_size-5&&(j=A.pending_buf_size-5);;){if(A.lookahead<=1){if(Je(A),A.lookahead===0&&oe===f)return R;if(A.lookahead===0)break}A.strstart+=A.lookahead,A.lookahead=0;var Q=A.block_start+j;if((A.strstart===0||A.strstart>=Q)&&(A.lookahead=A.strstart-Q,A.strstart=Q,he(A,!1),A.strm.avail_out===0)||A.strstart-A.block_start>=A.w_size-U&&(he(A,!1),A.strm.avail_out===0))return R}return A.insert=0,oe===p?(he(A,!0),A.strm.avail_out===0?se:X):(A.strstart>A.block_start&&(he(A,!1),A.strm.avail_out),R)}),new Mt(4,4,8,4,bt),new Mt(4,5,16,8,bt),new Mt(4,6,32,32,bt),new Mt(4,4,16,16,ft),new Mt(8,16,32,32,ft),new Mt(8,16,128,128,ft),new Mt(8,32,128,256,ft),new Mt(32,128,258,1024,ft),new Mt(32,258,258,4096,ft)],o.deflateInit=function(A,oe){return H(A,oe,_,15,8,0)},o.deflateInit2=H,o.deflateReset=ce,o.deflateResetKeep=Se,o.deflateSetHeader=function(A,oe){return A&&A.state?A.state.wrap!==2?m:(A.state.gzhead=oe,g):m},o.deflate=function(A,oe){var j,Q,G,pe;if(!A||!A.state||5<oe||oe<0)return A?J(A,m):m;if(Q=A.state,!A.output||!A.input&&A.avail_in!==0||Q.status===666&&oe!==p)return J(A,A.avail_out===0?-5:m);if(Q.strm=A,j=Q.last_flush,Q.last_flush=oe,Q.status===T)if(Q.wrap===2)A.adler=0,ye(Q,31),ye(Q,139),ye(Q,8),Q.gzhead?(ye(Q,(Q.gzhead.text?1:0)+(Q.gzhead.hcrc?2:0)+(Q.gzhead.extra?4:0)+(Q.gzhead.name?8:0)+(Q.gzhead.comment?16:0)),ye(Q,255&Q.gzhead.time),ye(Q,Q.gzhead.time>>8&255),ye(Q,Q.gzhead.time>>16&255),ye(Q,Q.gzhead.time>>24&255),ye(Q,Q.level===9?2:2<=Q.strategy||Q.level<2?4:0),ye(Q,255&Q.gzhead.os),Q.gzhead.extra&&Q.gzhead.extra.length&&(ye(Q,255&Q.gzhead.extra.length),ye(Q,Q.gzhead.extra.length>>8&255)),Q.gzhead.hcrc&&(A.adler=u(A.adler,Q.pending_buf,Q.pending,0)),Q.gzindex=0,Q.status=69):(ye(Q,0),ye(Q,0),ye(Q,0),ye(Q,0),ye(Q,0),ye(Q,Q.level===9?2:2<=Q.strategy||Q.level<2?4:0),ye(Q,3),Q.status=V);else{var ke=_+(Q.w_bits-8<<4)<<8;ke|=(2<=Q.strategy||Q.level<2?0:Q.level<6?1:Q.level===6?2:3)<<6,Q.strstart!==0&&(ke|=32),ke+=31-ke%31,Q.status=V,Re(Q,ke),Q.strstart!==0&&(Re(Q,A.adler>>>16),Re(Q,65535&A.adler)),A.adler=1}if(Q.status===69)if(Q.gzhead.extra){for(G=Q.pending;Q.gzindex<(65535&Q.gzhead.extra.length)&&(Q.pending!==Q.pending_buf_size||(Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),ge(A),G=Q.pending,Q.pending!==Q.pending_buf_size));)ye(Q,255&Q.gzhead.extra[Q.gzindex]),Q.gzindex++;Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),Q.gzindex===Q.gzhead.extra.length&&(Q.gzindex=0,Q.status=73)}else Q.status=73;if(Q.status===73)if(Q.gzhead.name){G=Q.pending;do{if(Q.pending===Q.pending_buf_size&&(Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),ge(A),G=Q.pending,Q.pending===Q.pending_buf_size)){pe=1;break}pe=Q.gzindex<Q.gzhead.name.length?255&Q.gzhead.name.charCodeAt(Q.gzindex++):0,ye(Q,pe)}while(pe!==0);Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),pe===0&&(Q.gzindex=0,Q.status=91)}else Q.status=91;if(Q.status===91)if(Q.gzhead.comment){G=Q.pending;do{if(Q.pending===Q.pending_buf_size&&(Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),ge(A),G=Q.pending,Q.pending===Q.pending_buf_size)){pe=1;break}pe=Q.gzindex<Q.gzhead.comment.length?255&Q.gzhead.comment.charCodeAt(Q.gzindex++):0,ye(Q,pe)}while(pe!==0);Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),pe===0&&(Q.status=103)}else Q.status=103;if(Q.status===103&&(Q.gzhead.hcrc?(Q.pending+2>Q.pending_buf_size&&ge(A),Q.pending+2<=Q.pending_buf_size&&(ye(Q,255&A.adler),ye(Q,A.adler>>8&255),A.adler=0,Q.status=V)):Q.status=V),Q.pending!==0){if(ge(A),A.avail_out===0)return Q.last_flush=-1,g}else if(A.avail_in===0&&W(oe)<=W(j)&&oe!==p)return J(A,-5);if(Q.status===666&&A.avail_in!==0)return J(A,-5);if(A.avail_in!==0||Q.lookahead!==0||oe!==f&&Q.status!==666){var te=Q.strategy===2?(function(N,Y){for(var me;;){if(N.lookahead===0&&(Je(N),N.lookahead===0)){if(Y===f)return R;break}if(N.match_length=0,me=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++,me&&(he(N,!1),N.strm.avail_out===0))return R}return N.insert=0,Y===p?(he(N,!0),N.strm.avail_out===0?se:X):N.last_lit&&(he(N,!1),N.strm.avail_out===0)?R:$})(Q,oe):Q.strategy===3?(function(N,Y){for(var me,Pe,_e,it,Xe=N.window;;){if(N.lookahead<=P){if(Je(N),N.lookahead<=P&&Y===f)return R;if(N.lookahead===0)break}if(N.match_length=0,N.lookahead>=F&&0<N.strstart&&(Pe=Xe[_e=N.strstart-1])===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]){it=N.strstart+P;do;while(Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&_e<it);N.match_length=P-(it-_e),N.match_length>N.lookahead&&(N.match_length=N.lookahead)}if(N.match_length>=F?(me=a._tr_tally(N,1,N.match_length-F),N.lookahead-=N.match_length,N.strstart+=N.match_length,N.match_length=0):(me=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++),me&&(he(N,!1),N.strm.avail_out===0))return R}return N.insert=0,Y===p?(he(N,!0),N.strm.avail_out===0?se:X):N.last_lit&&(he(N,!1),N.strm.avail_out===0)?R:$})(Q,oe):i[Q.level].func(Q,oe);if(te!==se&&te!==X||(Q.status=666),te===R||te===se)return A.avail_out===0&&(Q.last_flush=-1),g;if(te===$&&(oe===1?a._tr_align(Q):oe!==5&&(a._tr_stored_block(Q,0,0,!1),oe===3&&(Te(Q.head),Q.lookahead===0&&(Q.strstart=0,Q.block_start=0,Q.insert=0))),ge(A),A.avail_out===0))return Q.last_flush=-1,g}return oe!==p?g:Q.wrap<=0?1:(Q.wrap===2?(ye(Q,255&A.adler),ye(Q,A.adler>>8&255),ye(Q,A.adler>>16&255),ye(Q,A.adler>>24&255),ye(Q,255&A.total_in),ye(Q,A.total_in>>8&255),ye(Q,A.total_in>>16&255),ye(Q,A.total_in>>24&255)):(Re(Q,A.adler>>>16),Re(Q,65535&A.adler)),ge(A),0<Q.wrap&&(Q.wrap=-Q.wrap),Q.pending!==0?g:1)},o.deflateEnd=function(A){var oe;return A&&A.state?(oe=A.state.status)!==T&&oe!==69&&oe!==73&&oe!==91&&oe!==103&&oe!==V&&oe!==666?J(A,m):(A.state=null,oe===V?J(A,-3):g):m},o.deflateSetDictionary=function(A,oe){var j,Q,G,pe,ke,te,N,Y,me=oe.length;if(!A||!A.state||(pe=(j=A.state).wrap)===2||pe===1&&j.status!==T||j.lookahead)return m;for(pe===1&&(A.adler=l(A.adler,oe,me,0)),j.wrap=0,me>=j.w_size&&(pe===0&&(Te(j.head),j.strstart=0,j.block_start=0,j.insert=0),Y=new s.Buf8(j.w_size),s.arraySet(Y,oe,me-j.w_size,j.w_size,0),oe=Y,me=j.w_size),ke=A.avail_in,te=A.next_in,N=A.input,A.avail_in=me,A.next_in=0,A.input=oe,Je(j);j.lookahead>=F;){for(Q=j.strstart,G=j.lookahead-(F-1);j.ins_h=(j.ins_h<<j.hash_shift^j.window[Q+F-1])&j.hash_mask,j.prev[Q&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=Q,Q++,--G;);j.strstart=Q,j.lookahead=F-1,Je(j)}return j.strstart+=j.lookahead,j.block_start=j.strstart,j.insert=j.lookahead,j.lookahead=0,j.match_length=j.prev_length=F-1,j.match_available=0,A.next_in=te,A.input=N,A.avail_in=ke,j.wrap=pe,g},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,d,f,p,g,m,v,C,w,_,b,S,x,L,B,q,F,P,U,T,V,R=i.input,$;u=l+(i.avail_in-5),d=i.next_out,$=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),g=a.dmax,m=a.wsize,v=a.whave,C=a.wnext,w=a.window,_=a.hold,b=a.bits,S=a.lencode,x=a.distcode,L=(1<<a.lenbits)-1,B=(1<<a.distbits)-1;e:do{b<15&&(_+=R[l++]<<b,b+=8,_+=R[l++]<<b,b+=8),q=S[_&L];t:for(;;){if(_>>>=F=q>>>24,b-=F,(F=q>>>16&255)===0)$[d++]=65535&q;else{if(!(16&F)){if((64&F)==0){q=S[(65535&q)+(_&(1<<F)-1)];continue t}if(32&F){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}P=65535&q,(F&=15)&&(b<F&&(_+=R[l++]<<b,b+=8),P+=_&(1<<F)-1,_>>>=F,b-=F),b<15&&(_+=R[l++]<<b,b+=8,_+=R[l++]<<b,b+=8),q=x[_&B];n:for(;;){if(_>>>=F=q>>>24,b-=F,!(16&(F=q>>>16&255))){if((64&F)==0){q=x[(65535&q)+(_&(1<<F)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(U=65535&q,b<(F&=15)&&(_+=R[l++]<<b,(b+=8)<F&&(_+=R[l++]<<b,b+=8)),g<(U+=_&(1<<F)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(_>>>=F,b-=F,(F=d-f)<U){if(v<(F=U-F)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(V=w,(T=0)===C){if(T+=m-F,F<P){for(P-=F;$[d++]=w[T++],--F;);T=d-U,V=$}}else if(C<F){if(T+=m+C-F,(F-=C)<P){for(P-=F;$[d++]=w[T++],--F;);if(T=0,C<P){for(P-=F=C;$[d++]=w[T++],--F;);T=d-U,V=$}}}else if(T+=C-F,F<P){for(P-=F;$[d++]=w[T++],--F;);T=d-U,V=$}for(;2<P;)$[d++]=V[T++],$[d++]=V[T++],$[d++]=V[T++],P-=3;P&&($[d++]=V[T++],1<P&&($[d++]=V[T++]))}else{for(T=d-U;$[d++]=$[T++],$[d++]=$[T++],$[d++]=$[T++],2<(P-=3););P&&($[d++]=$[T++],1<P&&($[d++]=$[T++]))}break}}break}}while(l<u&&d<p);l-=P=b>>3,_&=(1<<(b-=P<<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=b}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),u=n("./inftrees"),d=1,f=2,p=0,g=-2,m=1,v=852,C=592;function w(T){return(T>>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<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 b(T){var V;return T&&T.state?(V=T.state,T.total_in=T.total_out=V.total=0,T.msg="",V.wrap&&(T.adler=1&V.wrap),V.mode=m,V.last=0,V.havedict=0,V.dmax=32768,V.head=null,V.hold=0,V.bits=0,V.lencode=V.lendyn=new i.Buf32(v),V.distcode=V.distdyn=new i.Buf32(C),V.sane=1,V.back=-1,p):g}function S(T){var V;return T&&T.state?((V=T.state).wsize=0,V.whave=0,V.wnext=0,b(T)):g}function x(T,V){var R,$;return T&&T.state?($=T.state,V<0?(R=0,V=-V):(R=1+(V>>4),V<48&&(V&=15)),V&&(V<8||15<V)?g:($.window!==null&&$.wbits!==V&&($.window=null),$.wrap=R,$.wbits=V,S(T))):g}function L(T,V){var R,$;return T?($=new _,(T.state=$).window=null,(R=x(T,V))!==p&&(T.state=null),R):g}var B,q,F=!0;function P(T){if(F){var V;for(B=new i.Buf32(512),q=new i.Buf32(32),V=0;V<144;)T.lens[V++]=8;for(;V<256;)T.lens[V++]=9;for(;V<280;)T.lens[V++]=7;for(;V<288;)T.lens[V++]=8;for(u(d,T.lens,0,288,B,0,T.work,{bits:9}),V=0;V<32;)T.lens[V++]=5;u(f,T.lens,0,32,q,0,T.work,{bits:5}),F=!1}T.lencode=B,T.lenbits=9,T.distcode=q,T.distbits=5}function U(T,V,R,$){var se,X=T.state;return X.window===null&&(X.wsize=1<<X.wbits,X.wnext=0,X.whave=0,X.window=new i.Buf8(X.wsize)),$>=X.wsize?(i.arraySet(X.window,V,R-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize):($<(se=X.wsize-X.wnext)&&(se=$),i.arraySet(X.window,V,R-$,se,X.wnext),($-=se)?(i.arraySet(X.window,V,R-$,$,0),X.wnext=$,X.whave=X.wsize):(X.wnext+=se,X.wnext===X.wsize&&(X.wnext=0),X.whave<X.wsize&&(X.whave+=se))),0}o.inflateReset=S,o.inflateReset2=x,o.inflateResetKeep=b,o.inflateInit=function(T){return L(T,15)},o.inflateInit2=L,o.inflate=function(T,V){var R,$,se,X,J,W,Te,ge,he,ye,Re,je,Je,bt,ft,Mt,Le,Se,ce,H,A,oe,j,Q,G=0,pe=new i.Buf8(4),ke=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!T||!T.state||!T.output||!T.input&&T.avail_in!==0)return g;(R=T.state).mode===12&&(R.mode=13),J=T.next_out,se=T.output,Te=T.avail_out,X=T.next_in,$=T.input,W=T.avail_in,ge=R.hold,he=R.bits,ye=W,Re=Te,oe=p;e:for(;;)switch(R.mode){case m:if(R.wrap===0){R.mode=13;break}for(;he<16;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(2&R.wrap&&ge===35615){pe[R.check=0]=255&ge,pe[1]=ge>>>8&255,R.check=a(R.check,pe,2,0),he=ge=0,R.mode=2;break}if(R.flags=0,R.head&&(R.head.done=!1),!(1&R.wrap)||(((255&ge)<<8)+(ge>>8))%31){T.msg="incorrect header check",R.mode=30;break}if((15&ge)!=8){T.msg="unknown compression method",R.mode=30;break}if(he-=4,A=8+(15&(ge>>>=4)),R.wbits===0)R.wbits=A;else if(A>R.wbits){T.msg="invalid window size",R.mode=30;break}R.dmax=1<<A,T.adler=R.check=1,R.mode=512&ge?10:12,he=ge=0;break;case 2:for(;he<16;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(R.flags=ge,(255&R.flags)!=8){T.msg="unknown compression method",R.mode=30;break}if(57344&R.flags){T.msg="unknown header flags set",R.mode=30;break}R.head&&(R.head.text=ge>>8&1),512&R.flags&&(pe[0]=255&ge,pe[1]=ge>>>8&255,R.check=a(R.check,pe,2,0)),he=ge=0,R.mode=3;case 3:for(;he<32;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.head&&(R.head.time=ge),512&R.flags&&(pe[0]=255&ge,pe[1]=ge>>>8&255,pe[2]=ge>>>16&255,pe[3]=ge>>>24&255,R.check=a(R.check,pe,4,0)),he=ge=0,R.mode=4;case 4:for(;he<16;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.head&&(R.head.xflags=255&ge,R.head.os=ge>>8),512&R.flags&&(pe[0]=255&ge,pe[1]=ge>>>8&255,R.check=a(R.check,pe,2,0)),he=ge=0,R.mode=5;case 5:if(1024&R.flags){for(;he<16;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.length=ge,R.head&&(R.head.extra_len=ge),512&R.flags&&(pe[0]=255&ge,pe[1]=ge>>>8&255,R.check=a(R.check,pe,2,0)),he=ge=0}else R.head&&(R.head.extra=null);R.mode=6;case 6:if(1024&R.flags&&(W<(je=R.length)&&(je=W),je&&(R.head&&(A=R.head.extra_len-R.length,R.head.extra||(R.head.extra=new Array(R.head.extra_len)),i.arraySet(R.head.extra,$,X,je,A)),512&R.flags&&(R.check=a(R.check,$,je,X)),W-=je,X+=je,R.length-=je),R.length))break e;R.length=0,R.mode=7;case 7:if(2048&R.flags){if(W===0)break e;for(je=0;A=$[X+je++],R.head&&A&&R.length<65536&&(R.head.name+=String.fromCharCode(A)),A&&je<W;);if(512&R.flags&&(R.check=a(R.check,$,je,X)),W-=je,X+=je,A)break e}else R.head&&(R.head.name=null);R.length=0,R.mode=8;case 8:if(4096&R.flags){if(W===0)break e;for(je=0;A=$[X+je++],R.head&&A&&R.length<65536&&(R.head.comment+=String.fromCharCode(A)),A&&je<W;);if(512&R.flags&&(R.check=a(R.check,$,je,X)),W-=je,X+=je,A)break e}else R.head&&(R.head.comment=null);R.mode=9;case 9:if(512&R.flags){for(;he<16;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(ge!==(65535&R.check)){T.msg="header crc mismatch",R.mode=30;break}he=ge=0}R.head&&(R.head.hcrc=R.flags>>9&1,R.head.done=!0),T.adler=R.check=0,R.mode=12;break;case 10:for(;he<32;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}T.adler=R.check=w(ge),he=ge=0,R.mode=11;case 11:if(R.havedict===0)return T.next_out=J,T.avail_out=Te,T.next_in=X,T.avail_in=W,R.hold=ge,R.bits=he,2;T.adler=R.check=1,R.mode=12;case 12:if(V===5||V===6)break e;case 13:if(R.last){ge>>>=7&he,he-=7&he,R.mode=27;break}for(;he<3;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}switch(R.last=1&ge,he-=1,3&(ge>>>=1)){case 0:R.mode=14;break;case 1:if(P(R),R.mode=20,V!==6)break;ge>>>=2,he-=2;break e;case 2:R.mode=17;break;case 3:T.msg="invalid block type",R.mode=30}ge>>>=2,he-=2;break;case 14:for(ge>>>=7&he,he-=7&he;he<32;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if((65535&ge)!=(ge>>>16^65535)){T.msg="invalid stored block lengths",R.mode=30;break}if(R.length=65535&ge,he=ge=0,R.mode=15,V===6)break e;case 15:R.mode=16;case 16:if(je=R.length){if(W<je&&(je=W),Te<je&&(je=Te),je===0)break e;i.arraySet(se,$,X,je,J),W-=je,X+=je,Te-=je,J+=je,R.length-=je;break}R.mode=12;break;case 17:for(;he<14;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(R.nlen=257+(31&ge),ge>>>=5,he-=5,R.ndist=1+(31&ge),ge>>>=5,he-=5,R.ncode=4+(15&ge),ge>>>=4,he-=4,286<R.nlen||30<R.ndist){T.msg="too many length or distance symbols",R.mode=30;break}R.have=0,R.mode=18;case 18:for(;R.have<R.ncode;){for(;he<3;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.lens[ke[R.have++]]=7&ge,ge>>>=3,he-=3}for(;R.have<19;)R.lens[ke[R.have++]]=0;if(R.lencode=R.lendyn,R.lenbits=7,j={bits:R.lenbits},oe=u(0,R.lens,0,19,R.lencode,0,R.work,j),R.lenbits=j.bits,oe){T.msg="invalid code lengths set",R.mode=30;break}R.have=0,R.mode=19;case 19:for(;R.have<R.nlen+R.ndist;){for(;Mt=(G=R.lencode[ge&(1<<R.lenbits)-1])>>>16&255,Le=65535&G,!((ft=G>>>24)<=he);){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(Le<16)ge>>>=ft,he-=ft,R.lens[R.have++]=Le;else{if(Le===16){for(Q=ft+2;he<Q;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(ge>>>=ft,he-=ft,R.have===0){T.msg="invalid bit length repeat",R.mode=30;break}A=R.lens[R.have-1],je=3+(3&ge),ge>>>=2,he-=2}else if(Le===17){for(Q=ft+3;he<Q;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}he-=ft,A=0,je=3+(7&(ge>>>=ft)),ge>>>=3,he-=3}else{for(Q=ft+7;he<Q;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}he-=ft,A=0,je=11+(127&(ge>>>=ft)),ge>>>=7,he-=7}if(R.have+je>R.nlen+R.ndist){T.msg="invalid bit length repeat",R.mode=30;break}for(;je--;)R.lens[R.have++]=A}}if(R.mode===30)break;if(R.lens[256]===0){T.msg="invalid code -- missing end-of-block",R.mode=30;break}if(R.lenbits=9,j={bits:R.lenbits},oe=u(d,R.lens,0,R.nlen,R.lencode,0,R.work,j),R.lenbits=j.bits,oe){T.msg="invalid literal/lengths set",R.mode=30;break}if(R.distbits=6,R.distcode=R.distdyn,j={bits:R.distbits},oe=u(f,R.lens,R.nlen,R.ndist,R.distcode,0,R.work,j),R.distbits=j.bits,oe){T.msg="invalid distances set",R.mode=30;break}if(R.mode=20,V===6)break e;case 20:R.mode=21;case 21:if(6<=W&&258<=Te){T.next_out=J,T.avail_out=Te,T.next_in=X,T.avail_in=W,R.hold=ge,R.bits=he,l(T,Re),J=T.next_out,se=T.output,Te=T.avail_out,X=T.next_in,$=T.input,W=T.avail_in,ge=R.hold,he=R.bits,R.mode===12&&(R.back=-1);break}for(R.back=0;Mt=(G=R.lencode[ge&(1<<R.lenbits)-1])>>>16&255,Le=65535&G,!((ft=G>>>24)<=he);){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(Mt&&(240&Mt)==0){for(Se=ft,ce=Mt,H=Le;Mt=(G=R.lencode[H+((ge&(1<<Se+ce)-1)>>Se)])>>>16&255,Le=65535&G,!(Se+(ft=G>>>24)<=he);){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}ge>>>=Se,he-=Se,R.back+=Se}if(ge>>>=ft,he-=ft,R.back+=ft,R.length=Le,Mt===0){R.mode=26;break}if(32&Mt){R.back=-1,R.mode=12;break}if(64&Mt){T.msg="invalid literal/length code",R.mode=30;break}R.extra=15&Mt,R.mode=22;case 22:if(R.extra){for(Q=R.extra;he<Q;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.length+=ge&(1<<R.extra)-1,ge>>>=R.extra,he-=R.extra,R.back+=R.extra}R.was=R.length,R.mode=23;case 23:for(;Mt=(G=R.distcode[ge&(1<<R.distbits)-1])>>>16&255,Le=65535&G,!((ft=G>>>24)<=he);){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if((240&Mt)==0){for(Se=ft,ce=Mt,H=Le;Mt=(G=R.distcode[H+((ge&(1<<Se+ce)-1)>>Se)])>>>16&255,Le=65535&G,!(Se+(ft=G>>>24)<=he);){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}ge>>>=Se,he-=Se,R.back+=Se}if(ge>>>=ft,he-=ft,R.back+=ft,64&Mt){T.msg="invalid distance code",R.mode=30;break}R.offset=Le,R.extra=15&Mt,R.mode=24;case 24:if(R.extra){for(Q=R.extra;he<Q;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.offset+=ge&(1<<R.extra)-1,ge>>>=R.extra,he-=R.extra,R.back+=R.extra}if(R.offset>R.dmax){T.msg="invalid distance too far back",R.mode=30;break}R.mode=25;case 25:if(Te===0)break e;if(je=Re-Te,R.offset>je){if((je=R.offset-je)>R.whave&&R.sane){T.msg="invalid distance too far back",R.mode=30;break}Je=je>R.wnext?(je-=R.wnext,R.wsize-je):R.wnext-je,je>R.length&&(je=R.length),bt=R.window}else bt=se,Je=J-R.offset,je=R.length;for(Te<je&&(je=Te),Te-=je,R.length-=je;se[J++]=bt[Je++],--je;);R.length===0&&(R.mode=21);break;case 26:if(Te===0)break e;se[J++]=R.length,Te--,R.mode=21;break;case 27:if(R.wrap){for(;he<32;){if(W===0)break e;W--,ge|=$[X++]<<he,he+=8}if(Re-=Te,T.total_out+=Re,R.total+=Re,Re&&(T.adler=R.check=R.flags?a(R.check,se,Re,J-Re):s(R.check,se,Re,J-Re)),Re=Te,(R.flags?ge:w(ge))!==R.check){T.msg="incorrect data check",R.mode=30;break}he=ge=0}R.mode=28;case 28:if(R.wrap&&R.flags){for(;he<32;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(ge!==(4294967295&R.total)){T.msg="incorrect length check",R.mode=30;break}he=ge=0}R.mode=29;case 29:oe=1;break e;case 30:oe=-3;break e;case 31:return-4;default:return g}return T.next_out=J,T.avail_out=Te,T.next_in=X,T.avail_in=W,R.hold=ge,R.bits=he,(R.wsize||Re!==T.avail_out&&R.mode<30&&(R.mode<27||V!==4))&&U(T,T.output,T.next_out,Re-T.avail_out)?(R.mode=31,-4):(ye-=T.avail_in,Re-=T.avail_out,T.total_in+=ye,T.total_out+=Re,R.total+=Re,R.wrap&&Re&&(T.adler=R.check=R.flags?a(R.check,se,Re,T.next_out-Re):s(R.check,se,Re,T.next_out-Re)),T.data_type=R.bits+(R.last?64:0)+(R.mode===12?128:0)+(R.mode===20||R.mode===15?256:0),(ye==0&&Re===0||V===4)&&oe===p&&(oe=-5),oe)},o.inflateEnd=function(T){if(!T||!T.state)return g;var V=T.state;return V.window&&(V.window=null),T.state=null,p},o.inflateGetHeader=function(T,V){var R;return T&&T.state?(2&(R=T.state).wrap)==0?g:((R.head=V).done=!1,p):g},o.inflateSetDictionary=function(T,V){var R,$=V.length;return T&&T.state?(R=T.state).wrap!==0&&R.mode!==11?g:R.mode===11&&s(1,V,$,0)!==R.check?-3:U(T,V,$,$)?(R.mode=31,-4):(R.havedict=1,p):g},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,p,g,m,v,C,w){var _,b,S,x,L,B,q,F,P,U=w.bits,T=0,V=0,R=0,$=0,se=0,X=0,J=0,W=0,Te=0,ge=0,he=null,ye=0,Re=new i.Buf16(16),je=new i.Buf16(16),Je=null,bt=0;for(T=0;T<=15;T++)Re[T]=0;for(V=0;V<g;V++)Re[f[p+V]]++;for(se=U,$=15;1<=$&&Re[$]===0;$--);if($<se&&(se=$),$===0)return m[v++]=20971520,m[v++]=20971520,w.bits=1,0;for(R=1;R<$&&Re[R]===0;R++);for(se<R&&(se=R),T=W=1;T<=15;T++)if(W<<=1,(W-=Re[T])<0)return-1;if(0<W&&(d===0||$!==1))return-1;for(je[1]=0,T=1;T<15;T++)je[T+1]=je[T]+Re[T];for(V=0;V<g;V++)f[p+V]!==0&&(C[je[f[p+V]]++]=V);if(B=d===0?(he=Je=C,19):d===1?(he=s,ye-=257,Je=a,bt-=257,256):(he=l,Je=u,-1),T=R,L=v,J=V=ge=0,S=-1,x=(Te=1<<(X=se))-1,d===1&&852<Te||d===2&&592<Te)return 1;for(;;){for(q=T-J,P=C[V]<B?(F=0,C[V]):C[V]>B?(F=Je[bt+C[V]],he[ye+C[V]]):(F=96,0),_=1<<T-J,R=b=1<<X;m[L+(ge>>J)+(b-=_)]=q<<24|F<<16|P|0,b!==0;);for(_=1<<T-1;ge&_;)_>>=1;if(_!==0?(ge&=_-1,ge+=_):ge=0,V++,--Re[T]==0){if(T===$)break;T=f[p+C[V]]}if(se<T&&(ge&x)!==S){for(J===0&&(J=se),L+=R,W=1<<(X=T-J);X+J<$&&!((W-=Re[X+J])<=0);)X++,W<<=1;if(Te+=1<<X,d===1&&852<Te||d===2&&592<Te)return 1;m[S=ge&x]=se<<24|X<<16|L-v|0}}return ge!==0&&(m[L+ge]=T-J<<24|4194304),w.bits=se,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(G){for(var pe=G.length;0<=--pe;)G[pe]=0}var u=0,d=29,f=256,p=f+1+d,g=30,m=19,v=2*p+1,C=15,w=16,_=7,b=256,S=16,x=17,L=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],q=[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],F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],U=new Array(2*(p+2));l(U);var T=new Array(2*g);l(T);var V=new Array(512);l(V);var R=new Array(256);l(R);var $=new Array(d);l($);var se,X,J,W=new Array(g);function Te(G,pe,ke,te,N){this.static_tree=G,this.extra_bits=pe,this.extra_base=ke,this.elems=te,this.max_length=N,this.has_stree=G&&G.length}function ge(G,pe){this.dyn_tree=G,this.max_code=0,this.stat_desc=pe}function he(G){return G<256?V[G]:V[256+(G>>>7)]}function ye(G,pe){G.pending_buf[G.pending++]=255&pe,G.pending_buf[G.pending++]=pe>>>8&255}function Re(G,pe,ke){G.bi_valid>w-ke?(G.bi_buf|=pe<<G.bi_valid&65535,ye(G,G.bi_buf),G.bi_buf=pe>>w-G.bi_valid,G.bi_valid+=ke-w):(G.bi_buf|=pe<<G.bi_valid&65535,G.bi_valid+=ke)}function je(G,pe,ke){Re(G,ke[2*pe],ke[2*pe+1])}function Je(G,pe){for(var ke=0;ke|=1&G,G>>>=1,ke<<=1,0<--pe;);return ke>>>1}function bt(G,pe,ke){var te,N,Y=new Array(C+1),me=0;for(te=1;te<=C;te++)Y[te]=me=me+ke[te-1]<<1;for(N=0;N<=pe;N++){var Pe=G[2*N+1];Pe!==0&&(G[2*N]=Je(Y[Pe]++,Pe))}}function ft(G){var pe;for(pe=0;pe<p;pe++)G.dyn_ltree[2*pe]=0;for(pe=0;pe<g;pe++)G.dyn_dtree[2*pe]=0;for(pe=0;pe<m;pe++)G.bl_tree[2*pe]=0;G.dyn_ltree[2*b]=1,G.opt_len=G.static_len=0,G.last_lit=G.matches=0}function Mt(G){8<G.bi_valid?ye(G,G.bi_buf):0<G.bi_valid&&(G.pending_buf[G.pending++]=G.bi_buf),G.bi_buf=0,G.bi_valid=0}function Le(G,pe,ke,te){var N=2*pe,Y=2*ke;return G[N]<G[Y]||G[N]===G[Y]&&te[pe]<=te[ke]}function Se(G,pe,ke){for(var te=G.heap[ke],N=ke<<1;N<=G.heap_len&&(N<G.heap_len&&Le(pe,G.heap[N+1],G.heap[N],G.depth)&&N++,!Le(pe,te,G.heap[N],G.depth));)G.heap[ke]=G.heap[N],ke=N,N<<=1;G.heap[ke]=te}function ce(G,pe,ke){var te,N,Y,me,Pe=0;if(G.last_lit!==0)for(;te=G.pending_buf[G.d_buf+2*Pe]<<8|G.pending_buf[G.d_buf+2*Pe+1],N=G.pending_buf[G.l_buf+Pe],Pe++,te===0?je(G,N,pe):(je(G,(Y=R[N])+f+1,pe),(me=B[Y])!==0&&Re(G,N-=$[Y],me),je(G,Y=he(--te),ke),(me=q[Y])!==0&&Re(G,te-=W[Y],me)),Pe<G.last_lit;);je(G,b,pe)}function H(G,pe){var ke,te,N,Y=pe.dyn_tree,me=pe.stat_desc.static_tree,Pe=pe.stat_desc.has_stree,_e=pe.stat_desc.elems,it=-1;for(G.heap_len=0,G.heap_max=v,ke=0;ke<_e;ke++)Y[2*ke]!==0?(G.heap[++G.heap_len]=it=ke,G.depth[ke]=0):Y[2*ke+1]=0;for(;G.heap_len<2;)Y[2*(N=G.heap[++G.heap_len]=it<2?++it:0)]=1,G.depth[N]=0,G.opt_len--,Pe&&(G.static_len-=me[2*N+1]);for(pe.max_code=it,ke=G.heap_len>>1;1<=ke;ke--)Se(G,Y,ke);for(N=_e;ke=G.heap[1],G.heap[1]=G.heap[G.heap_len--],Se(G,Y,1),te=G.heap[1],G.heap[--G.heap_max]=ke,G.heap[--G.heap_max]=te,Y[2*N]=Y[2*ke]+Y[2*te],G.depth[N]=(G.depth[ke]>=G.depth[te]?G.depth[ke]:G.depth[te])+1,Y[2*ke+1]=Y[2*te+1]=N,G.heap[1]=N++,Se(G,Y,1),2<=G.heap_len;);G.heap[--G.heap_max]=G.heap[1],(function(Xe,at){var Pt,Ft,Zt,At,ct,tn,Yt=at.dyn_tree,Ln=at.max_code,Tn=at.stat_desc.static_tree,jr=at.stat_desc.has_stree,no=at.stat_desc.extra_bits,Yr=at.stat_desc.extra_base,_n=at.stat_desc.max_length,nr=0;for(At=0;At<=C;At++)Xe.bl_count[At]=0;for(Yt[2*Xe.heap[Xe.heap_max]+1]=0,Pt=Xe.heap_max+1;Pt<v;Pt++)_n<(At=Yt[2*Yt[2*(Ft=Xe.heap[Pt])+1]+1]+1)&&(At=_n,nr++),Yt[2*Ft+1]=At,Ln<Ft||(Xe.bl_count[At]++,ct=0,Yr<=Ft&&(ct=no[Ft-Yr]),tn=Yt[2*Ft],Xe.opt_len+=tn*(At+ct),jr&&(Xe.static_len+=tn*(Tn[2*Ft+1]+ct)));if(nr!==0){do{for(At=_n-1;Xe.bl_count[At]===0;)At--;Xe.bl_count[At]--,Xe.bl_count[At+1]+=2,Xe.bl_count[_n]--,nr-=2}while(0<nr);for(At=_n;At!==0;At--)for(Ft=Xe.bl_count[At];Ft!==0;)Ln<(Zt=Xe.heap[--Pt])||(Yt[2*Zt+1]!==At&&(Xe.opt_len+=(At-Yt[2*Zt+1])*Yt[2*Zt],Yt[2*Zt+1]=At),Ft--)}})(G,pe),bt(Y,it,G.bl_count)}function A(G,pe,ke){var te,N,Y=-1,me=pe[1],Pe=0,_e=7,it=4;for(me===0&&(_e=138,it=3),pe[2*(ke+1)+1]=65535,te=0;te<=ke;te++)N=me,me=pe[2*(te+1)+1],++Pe<_e&&N===me||(Pe<it?G.bl_tree[2*N]+=Pe:N!==0?(N!==Y&&G.bl_tree[2*N]++,G.bl_tree[2*S]++):Pe<=10?G.bl_tree[2*x]++:G.bl_tree[2*L]++,Y=N,it=(Pe=0)===me?(_e=138,3):N===me?(_e=6,3):(_e=7,4))}function oe(G,pe,ke){var te,N,Y=-1,me=pe[1],Pe=0,_e=7,it=4;for(me===0&&(_e=138,it=3),te=0;te<=ke;te++)if(N=me,me=pe[2*(te+1)+1],!(++Pe<_e&&N===me)){if(Pe<it)for(;je(G,N,G.bl_tree),--Pe!=0;);else N!==0?(N!==Y&&(je(G,N,G.bl_tree),Pe--),je(G,S,G.bl_tree),Re(G,Pe-3,2)):Pe<=10?(je(G,x,G.bl_tree),Re(G,Pe-3,3)):(je(G,L,G.bl_tree),Re(G,Pe-11,7));Y=N,it=(Pe=0)===me?(_e=138,3):N===me?(_e=6,3):(_e=7,4)}}l(W);var j=!1;function Q(G,pe,ke,te){Re(G,(u<<1)+(te?1:0),3),(function(N,Y,me,Pe){Mt(N),Pe&&(ye(N,me),ye(N,~me)),i.arraySet(N.pending_buf,N.window,Y,me,N.pending),N.pending+=me})(G,pe,ke,!0)}o._tr_init=function(G){j||((function(){var pe,ke,te,N,Y,me=new Array(C+1);for(N=te=0;N<d-1;N++)for($[N]=te,pe=0;pe<1<<B[N];pe++)R[te++]=N;for(R[te-1]=N,N=Y=0;N<16;N++)for(W[N]=Y,pe=0;pe<1<<q[N];pe++)V[Y++]=N;for(Y>>=7;N<g;N++)for(W[N]=Y<<7,pe=0;pe<1<<q[N]-7;pe++)V[256+Y++]=N;for(ke=0;ke<=C;ke++)me[ke]=0;for(pe=0;pe<=143;)U[2*pe+1]=8,pe++,me[8]++;for(;pe<=255;)U[2*pe+1]=9,pe++,me[9]++;for(;pe<=279;)U[2*pe+1]=7,pe++,me[7]++;for(;pe<=287;)U[2*pe+1]=8,pe++,me[8]++;for(bt(U,p+1,me),pe=0;pe<g;pe++)T[2*pe+1]=5,T[2*pe]=Je(pe,5);se=new Te(U,B,f+1,p,C),X=new Te(T,q,0,g,C),J=new Te(new Array(0),F,0,m,_)})(),j=!0),G.l_desc=new ge(G.dyn_ltree,se),G.d_desc=new ge(G.dyn_dtree,X),G.bl_desc=new ge(G.bl_tree,J),G.bi_buf=0,G.bi_valid=0,ft(G)},o._tr_stored_block=Q,o._tr_flush_block=function(G,pe,ke,te){var N,Y,me=0;0<G.level?(G.strm.data_type===2&&(G.strm.data_type=(function(Pe){var _e,it=4093624447;for(_e=0;_e<=31;_e++,it>>>=1)if(1&it&&Pe.dyn_ltree[2*_e]!==0)return s;if(Pe.dyn_ltree[18]!==0||Pe.dyn_ltree[20]!==0||Pe.dyn_ltree[26]!==0)return a;for(_e=32;_e<f;_e++)if(Pe.dyn_ltree[2*_e]!==0)return a;return s})(G)),H(G,G.l_desc),H(G,G.d_desc),me=(function(Pe){var _e;for(A(Pe,Pe.dyn_ltree,Pe.l_desc.max_code),A(Pe,Pe.dyn_dtree,Pe.d_desc.max_code),H(Pe,Pe.bl_desc),_e=m-1;3<=_e&&Pe.bl_tree[2*P[_e]+1]===0;_e--);return Pe.opt_len+=3*(_e+1)+5+5+4,_e})(G),N=G.opt_len+3+7>>>3,(Y=G.static_len+3+7>>>3)<=N&&(N=Y)):N=Y=ke+5,ke+4<=N&&pe!==-1?Q(G,pe,ke,te):G.strategy===4||Y===N?(Re(G,2+(te?1:0),3),ce(G,U,T)):(Re(G,4+(te?1:0),3),(function(Pe,_e,it,Xe){var at;for(Re(Pe,_e-257,5),Re(Pe,it-1,5),Re(Pe,Xe-4,4),at=0;at<Xe;at++)Re(Pe,Pe.bl_tree[2*P[at]+1],3);oe(Pe,Pe.dyn_ltree,_e-1),oe(Pe,Pe.dyn_dtree,it-1)})(G,G.l_desc.max_code+1,G.d_desc.max_code+1,me+1),ce(G,G.dyn_ltree,G.dyn_dtree)),ft(G),te&&Mt(G)},o._tr_tally=function(G,pe,ke){return G.pending_buf[G.d_buf+2*G.last_lit]=pe>>>8&255,G.pending_buf[G.d_buf+2*G.last_lit+1]=255&pe,G.pending_buf[G.l_buf+G.last_lit]=255&ke,G.last_lit++,pe===0?G.dyn_ltree[2*ke]++:(G.matches++,pe--,G.dyn_ltree[2*(R[ke]+f+1)]++,G.dyn_dtree[2*he(pe)]++),G.last_lit===G.lit_bufsize-1},o._tr_align=function(G){Re(G,2,3),je(G,b,U),(function(pe){pe.bi_valid===16?(ye(pe,pe.bi_buf),pe.bi_buf=0,pe.bi_valid=0):8<=pe.bi_valid&&(pe.pending_buf[pe.pending++]=255&pe.bi_buf,pe.bi_buf>>=8,pe.bi_valid-=8)})(G)}},{"../utils/common":41}],53:[function(n,r,o){"use strict";r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){"use strict";if(!s.setImmediate){var l,u,d,f,p=1,g={},m=!1,v=s.document,C=Object.getPrototypeOf&&Object.getPrototypeOf(s);C=C&&C.setTimeout?C:s,l={}.toString.call(s.process)==="[object process]"?function(S){process.nextTick(function(){_(S)})}:(function(){if(s.postMessage&&!s.importScripts){var S=!0,x=s.onmessage;return s.onmessage=function(){S=!1},s.postMessage("","*"),s.onmessage=x,S}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",b,!1):s.attachEvent("onmessage",b),function(S){s.postMessage(f+S,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(S){_(S.data)},function(S){d.port2.postMessage(S)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(S){var x=v.createElement("script");x.onreadystatechange=function(){_(S),x.onreadystatechange=null,u.removeChild(x),x=null},u.appendChild(x)}):function(S){setTimeout(_,0,S)},C.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var x=new Array(arguments.length-1),L=0;L<x.length;L++)x[L]=arguments[L+1];return g[p]={callback:S,args:x},l(p),p++},C.clearImmediate=w}function w(S){delete g[S]}function _(S){if(m)setTimeout(_,0,S);else{var x=g[S];if(x){m=!0;try{(function(L){var B=L.callback,q=L.args;switch(q.length){case 0:B();break;case 1:B(q[0]);break;case 2:B(q[0],q[1]);break;case 3:B(q[0],q[1],q[2]);break;default:B.apply(a,q)}})(x)}finally{w(S),m=!1}}}}function b(S){S.source===s&&typeof S.data=="string"&&S.data.indexOf(f)===0&&_(+S.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)})})),_r="application/vnd.openxmlformats-officedocument.wordprocessingml.document",za="application/pdf",Gu="text/html",A6={docx:_r,pdf:za,html:Gu},Qp={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 I6=x2(_6(),1),E6=e=>typeof e!="string"?"":e.trim(),mb=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Jp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Pc=e=>{const t=e??{},n=E6(t.id),r=mb(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},Wk=({current:e,other:t})=>{const n=Pc(e),r=Pc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Wu=({actor:e,fallbackKey:t=""})=>{const n=Pc(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 T6(e){return typeof e.captureStackTrace=="function"}var em=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",T6(Error)&&Error.captureStackTrace(this,this.constructor)}},x6=class extends em{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},R6=class extends em{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},gb=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new x6(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 R6(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 em?r:new em("Failed to create file object",r)}};function M6(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 tm=new WeakMap;function Kk(e){return e.ownerDocument??document}function qk(e,t){const n=tm.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),tm.delete(t))}function Yk(e,t){const n=Kk(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&qk(e,e.__clickOutsideDocument);let r=tm.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},tm.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var vb={mounted(e,t){Yk(e,t)},updated(e,t){Yk(e,t)},unmounted(e){qk(e,e.__clickOutsideDocument??Kk(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function L6(e){return e[1].user!==void 0}var P6=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(L6).filter(([r,o])=>{const i=Wu({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Wu({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}})},D6="https://ingest.superdoc.dev/v1/collect",VY="community-and-eval-agplv3";function O6(){try{return"2.25.0-next.13"}catch{return"unknown"}}var F6=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||D6,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=O6()}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{}}},nm={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"},UY=[nm.INLINE_SDT_LABEL,nm.BLOCK_SDT_LABEL],Xk={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"},N6=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"}}},$Y=`.${nm.BLOCK_SDT}[${Xk.SDT_ID}]`,HY=`[${Xk.DRAGGABLE}="true"]`,B6=typeof window<"u",Zk,zf=e=>Zk=e,Qk=Symbol();function yb(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var jf;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(jf||(jf={}));var Jk=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 z6(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 bb(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){j6(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function eS(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function rm(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 om=typeof navigator=="object"?navigator:{userAgent:""},tS=/Macintosh/.test(om.userAgent)&&/AppleWebKit/.test(om.userAgent)&&!/Safari/.test(om.userAgent),j6=B6?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!tS?V6:"msSaveOrOpenBlob"in om?U6:$6:()=>{};function V6(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?eS(r.href)?bb(e,t,n):(r.target="_blank",rm(r)):rm(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){rm(r)},0))}function U6(e,t="download",n){if(typeof e=="string")if(eS(e))bb(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){rm(r)})}else navigator.msSaveOrOpenBlob(z6(e,n),t)}function $6(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return bb(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(Jk.HTMLElement))||"safari"in Jk,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||tS)&&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:GY}=Object;function H6(){const e=Av(!0),t=e.run(()=>ne({}));let n=[],r=[];const o=Qr({install(i){zf(o),o._a=i,i.provide(Qk,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 nS=()=>{};function rS(e,t,n,r=nS){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&Iv()&&q2(o),o}function Ku(e,...t){e.forEach(n=>{n(...t)})}var G6=e=>e(),oS=Symbol(),wb=Symbol();function Cb(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];yb(o)&&yb(r)&&e.hasOwnProperty(n)&&!vr(r)&&!yi(r)?e[n]=Cb(o,r):e[n]=r}return e}var W6=Symbol();function K6(e){return!yb(e)||!Object.prototype.hasOwnProperty.call(e,W6)}var{assign:Ml}=Object;function q6(e){return!!(vr(e)&&e.effect)}function Y6(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=iw(n.state.value[e]);return Ml(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=Qr(Ce(()=>{zf(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=iS(e,u,t,n,r,!0),l}function iS(e,t,n={},r,o,i){let s;const a=Ml({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function C(L){let B;u=d=!1,typeof L=="function"?(L(r.state.value[e]),B={type:jf.patchFunction,storeId:e,events:g}):(Cb(r.state.value[e],L),B={type:jf.patchObject,payload:L,storeId:e,events:g});const q=v=Symbol();_t().then(()=>{v===q&&(u=!0)}),d=!0,Ku(f,B,r.state.value[e])}const w=i?function(){const{state:B}=n,q=B?B():{};this.$patch(F=>{Ml(F,q)})}:nS;function _(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const b=(L,B="")=>{if(oS in L)return L[wb]=B,L;const q=function(){zf(r);const F=Array.from(arguments),P=new Set,U=new Set;function T($){P.add($)}function V($){U.add($)}Ku(p,{args:F,name:q[wb],store:S,after:T,onError:V});let R;try{R=L.apply(this&&this.$id===e?this:S,F)}catch($){throw Ku(U,$),$}return R instanceof Promise?R.then($=>(Ku(P,$),$)).catch($=>(Ku(U,$),Promise.reject($))):(Ku(P,R),R)};return q[oS]=!0,q[wb]=B,q},S=io({_p:r,$id:e,$onAction:rS.bind(null,p),$patch:C,$reset:w,$subscribe(L,B={}){const q=rS(f,L,B.detached,()=>F()),F=s.run(()=>$t(()=>r.state.value[e],P=>{(B.flush==="sync"?d:u)&&L({storeId:e,type:jf.direct,events:g},P)},Ml({},l,B)));return q},$dispose:_});r._s.set(e,S);const x=(r._a&&r._a.runWithContext||G6)(()=>r._e.run(()=>(s=Av()).run(()=>t({action:b}))));for(const L in x){const B=x[L];vr(B)&&!q6(B)||yi(B)?i||(m&&K6(B)&&(vr(B)?B.value=m[L]:Cb(B,m[L])),r.state.value[e][L]=B):typeof B=="function"&&(x[L]=b(B,L),a.actions[L]=B)}return Ml(S,x),Ml(En(S),x),Object.defineProperty(S,"$state",{get:()=>r.state.value[e],set:L=>{C(B=>{Ml(B,L)})}}),r._p.forEach(L=>{Ml(S,s.run(()=>L({store:S,app:r._a,pinia:r,options:a})))}),m&&i&&n.hydrate&&n.hydrate(S.$state,m),u=!0,d=!0,S}function sS(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=Lw();return s=s||(l?Gs(Qk,null):null),s&&zf(s),s=Zk,s._s.has(e)||(o?iS(e,t,r,s):Y6(e,r,s)),s._s.get(e)}return i.$id=e,i}function Qs(e){const t=En(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=Ce({get:()=>e[r],set(i){e[r]=i}}):(vr(o)||yi(o))&&(n[r]=Dv(e,r))}return n}function aS(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function lS(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 Dc(e){return typeof e=="string"&&e.length>0?e:null}function X6(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 Z6(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 Q6(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 kb(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function J6(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function im(e,t){return!e.ok||t===void 0?e:{ok:!0,target:{...e.target,syncTimeoutMs:t}}}function Sb(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function e8(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function t8(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 cS(e,t){const n=Dc(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=X6(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: ${lS(r)}).`};const i=Q6(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?Dc(t.token):null,a=kb(t.roomMode);return a?{ok:!0,target:{providerFamily:e,documentId:n,roomMode:a,serverUrl:o,...i?{params:i}:{},...s?{token:s}:{}}}:Sb()}function n8(e){const t=Dc(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.adapterId."};const n=Dc(e.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.documentId."};const r=kb(e.roomMode);if(!r)return Sb();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:Dc(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 r8(e,t){const n=Dc(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=Dc(e.publicApiKey),o=kb(e.roomMode);if(!o)return Sb();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=Z6(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 uS(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=aS(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=t8(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",f=lS(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=J6(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=e8(s);return l===null||l==="y-websocket"?im(cS("y-websocket",s),a):l==="hocuspocus"?im(cS("hocuspocus",s),a):l==="liveblocks"?im(r8(s,o),a):l==="extension"?im(n8(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 Vf=(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?Vf(e.originFileObj,e.name||t):e.file?Vf(e.file,e.name||t):e.raw?Vf(e.raw,e.name||t):null},dS=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,o8=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,Ll=e=>{if(ArrayBuffer.isView(e))return o8?.call(e)==="Uint8Array";if(!dS)return!1;try{return dS.call(e),!0}catch{return!1}},_b=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},Ab=(e,t)=>new Blob([_b(e)],{type:t}),Ib=e=>{switch(e.toLowerCase()){case"docx":case _r:return _r;case"pdf":case za:return za;case"html":case Gu:return Gu;default:return e}},sm=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?_r:t.endsWith(".pdf")?za:t.endsWith(".html")||t.endsWith(".htm")?Gu:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},i8=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",s8="application/octet-stream",Eb=e=>{if(e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"collaboration")){const n={...e};delete n.collaboration,e={...n,v2Collaboration:aS(e)}}if(Ll(e))return{type:_r,data:_b(e),name:"document.docx"};const t=Vf(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=sm(n),i=o||sm(r),s=t.type.toLowerCase()===s8,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(Ll(e.data)){const r=Ib(e.type||sm(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?_b(e.data):Ab(e.data,r),name:e.name||i8(r)}}const n=Vf(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?Ib(e.type):"",o=r||n.type||sm(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=Ib(e.type);if(n!==e.type)return{...e,type:n}}return e};Bt();function a8(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?io({...t}):ne(t),i=ne(null);return $t(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function l8(e){const t=ne(e.itemid),n=ne(e.itemicon),r=ne(e.itemiconpack),o=ne(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=a8(e,i,ne([])),l=ne(e.itemtype),u=ne(e.itemfieldtype),d=e,f=io({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=ne(e.logicrules),g=ne(!1),m=io({}),v={SELECT:u8,IMAGEINPUT:c8,CHECKBOXINPUT:d8};return l.value in v&&Object.assign(m,v[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:ne(e.itemformat),logicRules:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function c8(e){return{fontfamily:ne(e.fontfamily),iteminputtype:ne(e.iteminputtype)}}function u8(e){return{options:ne(e.itemoptions)}}function d8(e){const t=ne(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,Tb=e=>{const t=Js();return e.forEach((n,r)=>{t.set(r,n)}),t},qu=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},f8=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},h8=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Yu=()=>new Set,xb=e=>e[e.length-1],Xu=Array.from,Rb=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},fS=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},p8=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},am=Array.isArray,m8=class{constructor(){this._observers=Js()}on(e,t){return qu(this._observers,e,Yu).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 Xu((this._observers.get(e)||Js()).values()).forEach(n=>n(...t))}destroy(){this._observers=Js()}},ja=Math.floor,lm=Math.abs,hS=(e,t)=>e<t?e:t,Zu=(e,t)=>e>t?e:t,WY=Number.isNaN,g8=e=>e!==0?e<0:1/e<0,KY=1,qY=2,YY=4,XY=8,ZY=32,QY=64,JY=128,v8=1<<17,y8=1<<18,b8=1<<19,w8=1<<20,C8=1<<21,k8=1<<22,S8=1<<23,_8=1<<24,A8=1<<25,I8=1<<26,E8=1<<27,T8=1<<28,x8=1<<29,R8=1<<30,eX=31,tX=63,nX=127,rX=v8-1,oX=y8-1,iX=b8-1,sX=w8-1,aX=C8-1,lX=k8-1,cX=S8-1,uX=_8-1,dX=A8-1,fX=I8-1,hX=E8-1,pX=T8-1,mX=x8-1,gX=R8-1,vX=2147483647,pS=Number.MAX_SAFE_INTEGER,mS=Number.MIN_SAFE_INTEGER,M8=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&ja(e)===e),yX=Number.isNaN,bX=Number.parseInt,gS=String.fromCharCode,wX=String.fromCodePoint,CX=gS(65535),L8=e=>e.toLowerCase(),P8=/^\s*/g,D8=e=>e.replace(P8,""),O8=/([A-Z])/g,vS=(e,t)=>D8(e.replace(O8,n=>`${t}${L8(n)}`)),F8=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},Uf=typeof TextEncoder<"u"?new TextEncoder:null,N8=e=>Uf.encode(e),B8=Uf?N8:F8,Mb=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Mb&&Mb.decode(new Uint8Array).length===1&&(Mb=null);var z8=(e,t)=>p8(t,()=>e).join(""),$f=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Lb=()=>new $f,j8=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},Va=e=>{const t=new Uint8Array(j8(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},V8=(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(Zu(n,t)*2),e.cpos=0)},bo=(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},Pb=bo,cr=(e,t)=>{for(;t>127;)bo(e,128|127&t),t=ja(t/128);bo(e,127&t)},Db=(e,t)=>{const n=g8(t);for(n&&(t=-t),bo(e,(t>63?128:0)|(n?64:0)|63&t),t=ja(t/64);t>0;)bo(e,(t>127?128:0)|127&t),t=ja(t/128)},Ob=new Uint8Array(3e4),U8=Ob.length/3,$8=(e,t)=>{if(t.length<U8){const n=Uf.encodeInto(t,Ob).written||0;cr(e,n);for(let r=0;r<n;r++)bo(e,Ob[r])}else Di(e,B8(t))},H8=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;cr(e,r);for(let o=0;o<r;o++)bo(e,n.codePointAt(o))},Qu=Uf&&Uf.encodeInto?$8:H8,Fb=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=hS(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(Zu(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},Di=(e,t)=>{cr(e,t.byteLength),Fb(e,t)},Nb=(e,t)=>{V8(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},G8=(e,t)=>Nb(e,4).setFloat32(0,t,!1),W8=(e,t)=>Nb(e,8).setFloat64(0,t,!1),K8=(e,t)=>Nb(e,8).setBigInt64(0,t,!1),yS=new DataView(new ArrayBuffer(4)),q8=e=>(yS.setFloat32(0,e),yS.getFloat32(0)===e),Hf=(e,t)=>{switch(typeof t){case"string":bo(e,119),Qu(e,t);break;case"number":M8(t)&&lm(t)<=2147483647?(bo(e,125),Db(e,t)):q8(t)?(bo(e,124),G8(e,t)):(bo(e,123),W8(e,t));break;case"bigint":bo(e,122),K8(e,t);break;case"object":if(t===null)bo(e,126);else if(am(t)){bo(e,117),cr(e,t.length);for(let n=0;n<t.length;n++)Hf(e,t[n])}else if(t instanceof Uint8Array)bo(e,116),Di(e,t);else{bo(e,118);const n=Object.keys(t);cr(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];Qu(e,o),Hf(e,t[o])}}break;case"boolean":bo(e,t?120:121);break;default:bo(e,127)}},bS=class extends $f{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&cr(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},wS=e=>{e.count>0&&(Db(e.encoder,e.count===1?e.s:-e.s),e.count>1&&cr(e.encoder,e.count-2))},cm=class{constructor(){this.encoder=new $f,this.s=0,this.count=0}write(e){this.s===e?this.count++:(wS(this),this.count=1,this.s=e)}toUint8Array(){return wS(this),Va(this.encoder)}},CS=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Db(e.encoder,t),e.count>1&&cr(e.encoder,e.count-2)}},Bb=class{constructor(){this.encoder=new $f,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(CS(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return CS(this),Va(this.encoder)}},Y8=class{constructor(){this.sarr=[],this.s="",this.lensE=new cm}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 $f;return this.sarr.push(this.s),this.s="",Qu(e,this.sarr.join("")),Fb(e,this.lensE.toUint8Array()),Va(e)}},Pl=e=>new Error(e),ks=()=>{throw Pl("Method unimplemented")},Ua=()=>{throw Pl("Unexpected case")},kX=crypto.subtle,X8=crypto.getRandomValues.bind(crypto),kS=()=>X8(new Uint32Array(1))[0],Z8="10000000-1000-4000-8000-100000000000",Q8=()=>Z8.replace(/[018]/g,e=>(e^kS()&15>>e/4).toString(16)),J8=Date.now,SS=e=>new Promise(e),SX=Promise.all.bind(Promise),_S=e=>e===void 0?null:e,eR=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},AS=new eR,tR=!0;try{typeof localStorage<"u"&&localStorage&&(AS=localStorage,tR=!1)}catch{}var nR=AS,Gf=Symbol("Equality"),IS=(e,t)=>e===t||!!e?.[Gf]?.(t)||!1,rR=e=>typeof e=="object",oR=Object.assign,iR=Object.keys,sR=(e,t)=>{for(const n in e)t(e[n],n)},um=e=>iR(e).length,aR=e=>{for(const t in e)return!1;return!0},Wf=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},zb=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),lR=(e,t)=>e===t||um(e)===um(t)&&Wf(e,(n,r)=>(n!==void 0||zb(t,r))&&IS(t[r],n)),cR=Object.freeze,ES=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&ES(e[t])}return cR(e)},jb=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&jb(e,t,n+1)}},dm=(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[Gf]!=null)return e[Gf](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)||!dm(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(um(e)!==um(t))return!1;for(const n in e)if(!zb(e,n)||!dm(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(!dm(e[n],t[n]))return!1;break;default:return!1}return!0},uR=(e,t)=>t.includes(e),Kf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",_X=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,ea,dR=[],fR=()=>{if(ea===void 0)if(Kf){ea=Js();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&ea.set(t,""),t=r):t!==null?(ea.set(t,r),t=null):dR.push(r)}t!==null&&ea.set(t,"")}else typeof location=="object"?(ea=Js(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");ea.set(`--${vS(t,"-")}`,n),ea.set(`-${vS(t,"-")}`,n)}})):ea=Js();return ea},Vb=e=>fR().has(e),fm=e=>_S(Kf?process.env[e.toUpperCase().replaceAll("-","_")]:nR.getItem(e)),TS=e=>Vb("--"+e)||fm(e)!==null,hR=TS("production"),pR=Kf&&uR(process.env.FORCE_COLOR,["true","1","2"]),mR=pR||!Vb("--no-colors")&&!TS("no-color")&&(!Kf||process.stdout.isTTY)&&(!Kf||Vb("--color")||fm("COLORTERM")!==null||(fm("TERM")||"").includes("color")),gR=class{constructor(e,t){this.left=e,this.right=t}},$a=(e,t)=>new gR(e,t),xS=e=>e.next()>=.5,Ub=(e,t,n)=>ja(e.next()*(n+1-t)+t),RS=(e,t,n)=>ja(e.next()*(n+1-t)+t),$b=(e,t,n)=>RS(e,t,n),vR=e=>gS($b(e,97,122)),yR=(e,t=0,n=20)=>{const r=$b(e,t,n);let o="";for(let i=0;i<r;i++)o+=vR(e);return o},Hb=(e,t)=>t[$b(e,0,t.length-1)],bR=Symbol("0schema"),wR=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(z8(" ",(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(ge,2),Re+=L.magic,Re+=i(b,2),Re+=i(S,2),Re+=i(Te.crc32,4),Re+=i(Te.compressedSize,4),Re+=i(Te.uncompressedSize,4),Re+=i(q.length,2),Re+=i($.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Re+q+$,dirRecord:f.CENTRAL_FILE_HEADER+i(ye,2)+Re+i(U.length,2)+"\0\0\0\0"+i(he,4)+i(C,4)+q+$+U}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(g,m,v,C){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=v,this.encodeFileName=C,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(g){var m=g.meta.percent||0,v=this.entriesCount,C=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:v?(m+100*(v-C-1))/v:100}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(C){return f.DATA_DESCRIPTOR+i(C.crc32,4)+i(C.compressedSize,4)+i(C.uncompressedSize,4)})(g),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,C=(function(w,_,b,S,x){var L=a.transformTo("string",x(S));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(_,4)+i(b,4)+i(L.length,2)+L})(this.dirRecords.length,v,g,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(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var d=new s(l.streamFiles,u,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var m=(function(_,b){var S=_||b,x=i[S];if(!x)throw new Error(S+" is not a valid compression method !");return x})(g.options.compression,l.compression),v=g.options.compressionOptions||l.compressionOptions||{},C=g.dir,w=g.date;g._compressWorker(m,v).withStreamInfo("file",{name:p,dir:C,date:w,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,m){var v=p.decompressed.getContentWorker().pipe(new u);v.on("error",function(C){m(C)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(v){var C=new l(g);return C.load(v),C}).then(function(v){var C=[s.Promise.resolve(v)],w=v.files;if(g.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 b=w[_],S=b.fileNameStr,x=i.resolve(b.fileNameStr);m.file(x,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:g.createFolders}),b.dir||(m.file(x).unsafeOriginalName=S)}return C.zipComment.length&&(m.comment=C.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,p){d.push(f)||d._helper.pause(),u&&u(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(S,x,L){var B,q=a.getTypeOf(x),F=a.extend(L||{},d);F.date=F.date||new Date,F.compression!==null&&(F.compression=F.compression.toUpperCase()),typeof F.unixPermissions=="string"&&(F.unixPermissions=parseInt(F.unixPermissions,8)),F.unixPermissions&&16384&F.unixPermissions&&(F.dir=!0),F.dosPermissions&&16&F.dosPermissions&&(F.dir=!0),F.dir&&(S=w(S)),F.createFolders&&(B=C(S))&&_.call(this,B,!0);var P=q==="string"&&F.binary===!1&&F.base64===!1;L&&L.binary!==void 0||(F.binary=!P),(x instanceof f&&x.uncompressedSize===0||F.dir||!x||x.length===0)&&(F.base64=!1,F.binary=!0,x="",F.compression="STORE",q="string");var U=null;U=x instanceof f||x instanceof l?x:m.isNode&&m.isStream(x)?new v(S,x):a.prepareContent(S,x,F.binary,F.optimizedBinaryString,F.base64);var T=new p(S,U,F);this.files[S]=T}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),C=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var x=S.lastIndexOf("/");return 0<x?S.substring(0,x):""},w=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},_=function(S,x){return x=x!==void 0?x:d.createFolders,S=w(S),this.files[S]||i.call(this,S,null,{dir:!0,createFolders:x}),this.files[S]};function b(S){return Object.prototype.toString.call(S)==="[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(S){var x,L,B;for(x in this.files)B=this.files[x],(L=x.slice(this.root.length,x.length))&&x.slice(0,this.root.length)===this.root&&S(L,B)},filter:function(S){var x=[];return this.forEach(function(L,B){S(L,B)&&x.push(B)}),x},file:function(S,x,L){if(arguments.length!==1)return S=this.root+S,i.call(this,S,x,L),this;if(b(S)){var B=S;return this.filter(function(F,P){return!P.dir&&B.test(F)})}var q=this.files[this.root+S];return q&&!q.dir?q:null},folder:function(S){if(!S)return this;if(b(S))return this.filter(function(q,F){return F.dir&&S.test(q)});var x=this.root+S,L=_.call(this,x),B=this.clone();return B.root=L.name,B},remove:function(S){S=this.root+S;var x=this.files[S];if(x||(S.slice(-1)!=="/"&&(S+="/"),x=this.files[S]),x&&!x.dir)delete this.files[S];else for(var L=this.filter(function(q,F){return F.name.slice(0,S.length)===S}),B=0;B<L.length;B++)delete this.files[L[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(S){var x,L={};try{if((L=a.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=L.type.toLowerCase(),L.compression=L.compression.toUpperCase(),L.type==="binarystring"&&(L.type="string"),!L.type)throw new Error("No output type specified.");a.checkSupport(L.type),L.platform!=="darwin"&&L.platform!=="freebsd"&&L.platform!=="linux"&&L.platform!=="sunos"||(L.platform="UNIX"),L.platform==="win32"&&(L.platform="DOS");var B=L.comment||this.comment||"";x=g.generateWorker(this,L,B)}catch(q){(x=new l("error")).error(q)}return new u(x,L.type||"string",L.mimeType)},generateAsync:function(S,x){return this.generateInternalStream(S).accumulate(x)},generateNodeStream:function(S,x){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(x)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){"use strict";r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(f):s.uint8array?new d(i.transformTo("uint8array",f)):new a(i.transformTo("array",f)):new l(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(m,v){return new d.Promise(function(C,w){var _=[],b=m._internalType,S=m._outputType,x=m._mimeType;m.on("data",function(L,B){_.push(L),v&&v(B)}).on("error",function(L){_=[],w(L)}).on("end",function(){try{C((function(L,B,q){switch(L){case"blob":return i.newBlob(i.transformTo("arraybuffer",B),q);case"base64":return l.encode(B);default:return i.transformTo(L,B)}})(S,(function(L,B){var q,F=0,P=null,U=0;for(q=0;q<B.length;q++)U+=B[q].length;switch(L){case"string":return B.join("");case"array":return Array.prototype.concat.apply([],B);case"uint8array":for(P=new Uint8Array(U),q=0;q<B.length;q++)P.set(B[q],F),F+=B[q].length;return P;case"nodebuffer":return Buffer.concat(B);default:throw new Error("concat : unsupported type '"+L+"'")}})(b,_),x))}catch(L){w(L)}_=[]}).resume()})}function g(m,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=m.pipe(new s(w)),m.lock()}catch(_){this._worker=new a("error"),this._worker.error(_)}}g.prototype={accumulate:function(m){return p(this,m)},on:function(m,v){var C=this;return m==="data"?this._worker.on(m,function(w){v.call(C,w.data,w.meta)}):this._worker.on(m,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(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},m)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,C,w,_,b,S=m.length,x=0;for(_=0;_<S;_++)(64512&(C=m.charCodeAt(_)))==55296&&_+1<S&&(64512&(w=m.charCodeAt(_+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),_++),x+=C<128?1:C<2048?2:C<65536?3:4;for(v=s.uint8array?new Uint8Array(x):new Array(x),_=b=0;b<x;_++)(64512&(C=m.charCodeAt(_)))==55296&&_+1<S&&(64512&(w=m.charCodeAt(_+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),_++),C<128?v[b++]=C:(C<2048?v[b++]=192|C>>>6:(C<65536?v[b++]=224|C>>>12:(v[b++]=240|C>>>18,v[b++]=128|C>>>12&63),v[b++]=128|C>>>6&63),v[b++]=128|63&C);return v})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(m){var v,C,w,_,b=m.length,S=new Array(2*b);for(v=C=0;v<b;)if((w=m[v++])<128)S[C++]=w;else if(4<(_=u[w]))S[C++]=65533,v+=_-1;else{for(w&=_===2?31:_===3?15:7;1<_&&v<b;)w=w<<6|63&m[v++],_--;1<_?S[C++]=65533:w<65536?S[C++]=w:(w-=65536,S[C++]=55296|w>>10&1023,S[C++]=56320|1023&w)}return S.length!==C&&(S.subarray?S=S.subarray(0,C):S.length=C),i.applyFromCharCode(S)})(g=i.transformTo(s.uint8array?"uint8array":"array",g))},i.inherits(f,l),f.prototype.processChunk=function(g){var m=i.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=m;(m=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),m.set(v,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var C=(function(_,b){var S;for((b=b||_.length)>_.length&&(b=_.length),S=b-1;0<=S&&(192&_[S])==128;)S--;return S<0||S===0?b:S+u[_[S]]>b?S:b})(m),w=m;C!==m.length&&(s.uint8array?(w=m.subarray(0,C),this.leftOver=m.subarray(C,m.length)):(w=m.slice(0,C),this.leftOver=m.slice(C,m.length))),this.push({data:o.utf8decode(w),meta:g.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(v){return v}function d(v,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 _=[],b=0,S=v.length;if(S<=w)return String.fromCharCode.apply(null,v);for(;b<S;)C==="array"||C==="nodebuffer"?_.push(String.fromCharCode.apply(null,v.slice(b,Math.min(b+w,S)))):_.push(String.fromCharCode.apply(null,v.subarray(b,Math.min(b+w,S)))),b+=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 g(v,C){for(var w=0;w<v.length;w++)C[w]=v[w];return C}o.applyFromCharCode=p;var m={};m.string={string:u,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return m.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},m.array={string:p,array:u,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(v)}},m.arraybuffer={string:function(v){return p(new Uint8Array(v))},array:function(v){return g(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:u,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(new Uint8Array(v))}},m.uint8array={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return a.newBufferFrom(v)}},m.nodebuffer={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer:u},o.transformTo=function(v,C){return C=C||"",v?(o.checkSupport(v),m[o.getTypeOf(C)][v](C)):C},o.resolve=function(v){for(var C=v.split("/"),w=[],_=0;_<C.length;_++){var b=C[_];b==="."||b===""&&_!==0&&_!==C.length-1||(b===".."?w.pop():w.push(b))}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,_,b){return l.Promise.resolve(C).then(function(S){return i.blob&&(S instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(S))!==-1)&&typeof FileReader<"u"?new l.Promise(function(x,L){var B=new FileReader;B.onload=function(q){x(q.target.result)},B.onerror=function(q){L(q.target.error)},B.readAsArrayBuffer(S)}):S}).then(function(S){var x=o.getTypeOf(S);return x?(x==="arraybuffer"?S=o.transformTo("uint8array",S):x==="string"&&(b?S=s.decode(S):w&&_!==!0&&(S=(function(L){return d(L,i.uint8array?new Uint8Array(L.length):new Array(L.length))})(S))),S):l.Promise.reject(new Error("Can't read the data of '"+v+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===p;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=p-g;if(0<m)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,m){this.options=g,this.loadOptions=m}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(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,m,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var m=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(m),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var m,v,C,w=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<w;)m=g.readInt(2),v=g.readInt(2),C=g.readData(v),this.extraFields[m]={id:m,length:v,value:C};g.setIndex(w)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var v=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var C=this.findExtraFieldUnicodeComment();if(C!==null)this.fileCommentStr=C;else{var w=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,C){this.name=m,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(m){var v=null,C="string";try{if(!m)throw new Error("No output type specified.");var w=(C=m.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(b){(v=new d("error")).error(b)}return new s(v,C,"")},async:function(m,v){return this.internalStream(m).accumulate(v)},nodeStream:function(m,v){return this.internalStream(m||"nodebuffer").toNodejsStream(v)},_compressWorker:function(m,v){if(this._data instanceof u&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var C=this._decompressWorker();return this._dataBinary||(C=C.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(C,m,v)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,d=new l(m),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(m,0)};else{var p=new i.MessageChannel;p.port1.onmessage=m,s=function(){p.port2.postMessage(0)}}var g=[];function m(){var v,C;a=!0;for(var w=g.length;w;){for(C=g,g=[],v=-1;++v<w;)C[v]();w=g.length}a=!1}r.exports=function(v){g.push(v)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(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,_,b){this.promise=w,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function g(w,_,b){i(function(){var S;try{S=_(b)}catch(x){return a.reject(w,x)}S===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,S)})}function m(w){var _=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof _=="function")return function(){_.apply(w,arguments)}}function v(w,_){var b=!1;function S(B){b||(b=!0,a.reject(w,B))}function x(B){b||(b=!0,a.resolve(w,B))}var L=C(function(){_(x,S)});L.status==="error"&&S(L.value)}function C(w,_){var b={};try{b.value=w(_),b.status="success"}catch(S){b.status="error",b.value=S}return b}(r.exports=f).prototype.finally=function(w){if(typeof w!="function")return this;var _=this.constructor;return this.then(function(b){return _.resolve(w()).then(function(){return b})},function(b){return _.resolve(w()).then(function(){throw b})})},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 b=new this.constructor(s);return this.state!==d?g(b,this.state===u?w:_,this.outcome):this.queue.push(new p(b,w,_)),b},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){g(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){g(this.promise,this.onRejected,w)},a.resolve=function(w,_){var b=C(m,_);if(b.status==="error")return a.reject(w,b.value);var S=b.value;if(S)v(w,S);else{w.state=u,w.outcome=_;for(var x=-1,L=w.queue.length;++x<L;)w.queue[x].callFulfilled(_)}return w},a.reject=function(w,_){w.state=l,w.outcome=_;for(var b=-1,S=w.queue.length;++b<S;)w.queue[b].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 b=w.length,S=!1;if(!b)return this.resolve([]);for(var x=new Array(b),L=0,B=-1,q=new this(s);++B<b;)F(w[B],B);return q;function F(P,U){_.resolve(P).then(function(T){x[U]=T,++L!==b||S||(S=!0,a.resolve(q,x))},function(T){S||(S=!0,a.reject(q,T))})}},f.race=function(w){var _=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=w.length,S=!1;if(!b)return this.resolve([]);for(var x=-1,L=new this(s);++x<b;)B=w[x],_.resolve(B).then(function(q){S||(S=!0,a.resolve(L,q))},function(q){S||(S=!0,a.reject(L,q))});var B;return L}},{immediate:36}],38:[function(n,r,o){"use strict";var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){"use strict";var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,p=-1,g=0,m=8;function v(w){if(!(this instanceof v))return new v(w);this.options=s.assign({level:p,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,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 b=i.deflateInit2(this.strm,_.level,_.method,_.windowBits,_.memLevel,_.strategy);if(b!==f)throw new Error(l[b]);if(_.header&&i.deflateSetHeader(this.strm,_.header),_.dictionary){var S;if(S=typeof _.dictionary=="string"?a.string2buf(_.dictionary):d.call(_.dictionary)==="[object ArrayBuffer]"?new Uint8Array(_.dictionary):_.dictionary,(b=i.deflateSetDictionary(this.strm,S))!==f)throw new Error(l[b]);this._dict_set=!0}}function C(w,_){var b=new v(_);if(b.push(w,!0),b.err)throw b.msg||l[b.err];return b.result}v.prototype.push=function(w,_){var b,S,x=this.strm,L=this.options.chunkSize;if(this.ended)return!1;S=_===~~_?_:_===!0?4:0,typeof w=="string"?x.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?x.input=new Uint8Array(w):x.input=w,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new s.Buf8(L),x.next_out=0,x.avail_out=L),(b=i.deflate(x,S))!==1&&b!==f)return this.onEnd(b),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||S!==4&&S!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(x.output,x.next_out))):this.onData(s.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&b!==1);return S===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===f):S!==2||(this.onEnd(f),!(x.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 g(v){if(!(this instanceof g))return new g(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 m(v,C){var w=new g(C);if(w.push(v,!0),w.err)throw w.msg||u[w.err];return w.result}g.prototype.push=function(v,C){var w,_,b,S,x,L,B=this.strm,q=this.options.chunkSize,F=this.options.dictionary,P=!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(q),B.next_out=0,B.avail_out=q),(w=i.inflate(B,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&F&&(L=typeof F=="string"?a.string2buf(F):p.call(F)==="[object ArrayBuffer]"?new Uint8Array(F):F,w=i.inflateSetDictionary(this.strm,L)),w===l.Z_BUF_ERROR&&P===!0&&(w=l.Z_OK,P=!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"?(b=a.utf8border(B.output,B.next_out),S=B.next_out-b,x=a.buf2string(B.output,b),B.next_out=S,B.avail_out=q-S,S&&s.arraySet(B.output,B.output,b,S,0),this.onData(x)):this.onData(s.shrinkBuf(B.output,B.next_out)))),B.avail_in===0&&B.avail_out===0&&(P=!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))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Inflate=g,o.inflate=m,o.inflateRaw=function(v,C){return(C=C||{}).raw=!0,m(v,C)},o.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(l[f]=d[f])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,d,f,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){var u,d,f,p,g,m;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(m=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)g=l[u],m.set(g,p),p+=g.length;return m}},a={arraySet:function(l,u,d,f,p){for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",m=0;m<p;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,m,v,C,w=f.length,_=0;for(v=0;v<w;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),_+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(_),v=C=0;C<_;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),g<128?p[C++]=g:(g<2048?p[C++]=192|g>>>6:(g<65536?p[C++]=224|g>>>12:(p[C++]=240|g>>>18,p[C++]=128|g>>>12&63),p[C++]=128|g>>>6&63),p[C++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,m=p.length;g<m;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,m,v,C,w=p||f.length,_=new Array(2*w);for(g=m=0;g<w;)if((v=f[g++])<128)_[m++]=v;else if(4<(C=l[v]))_[m++]=65533,g+=C-1;else{for(v&=C===2?31:C===3?15:7;1<C&&g<w;)v=v<<6|63&f[g++],C--;1<C?_[m++]=65533:v<65536?_[m++]=v:(v-=65536,_[m++]=55296|v>>10&1023,_[m++]=56320|1023&v)}return d(_,m)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var d=i,f=u+l;s^=-1;for(var p=u;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,m=-2,v=-1,C=4,w=2,_=8,b=9,S=286,x=30,L=19,B=2*S+1,q=15,F=3,P=258,U=P+F+1,T=42,V=113,R=1,$=2,se=3,X=4;function J(A,oe){return A.msg=d[oe],oe}function W(A){return(A<<1)-(4<A?9:0)}function Te(A){for(var oe=A.length;0<=--oe;)A[oe]=0}function ge(A){var oe=A.state,j=oe.pending;j>A.avail_out&&(j=A.avail_out),j!==0&&(s.arraySet(A.output,oe.pending_buf,oe.pending_out,j,A.next_out),A.next_out+=j,oe.pending_out+=j,A.total_out+=j,A.avail_out-=j,oe.pending-=j,oe.pending===0&&(oe.pending_out=0))}function he(A,oe){a._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,oe),A.block_start=A.strstart,ge(A.strm)}function ye(A,oe){A.pending_buf[A.pending++]=oe}function Re(A,oe){A.pending_buf[A.pending++]=oe>>>8&255,A.pending_buf[A.pending++]=255&oe}function je(A,oe){var j,Q,G=A.max_chain_length,pe=A.strstart,ke=A.prev_length,te=A.nice_match,N=A.strstart>A.w_size-U?A.strstart-(A.w_size-U):0,Y=A.window,me=A.w_mask,Pe=A.prev,_e=A.strstart+P,it=Y[pe+ke-1],Xe=Y[pe+ke];A.prev_length>=A.good_match&&(G>>=2),te>A.lookahead&&(te=A.lookahead);do if(Y[(j=oe)+ke]===Xe&&Y[j+ke-1]===it&&Y[j]===Y[pe]&&Y[++j]===Y[pe+1]){pe+=2,j++;do;while(Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&Y[++pe]===Y[++j]&&pe<_e);if(Q=P-(_e-pe),pe=_e-P,ke<Q){if(A.match_start=oe,te<=(ke=Q))break;it=Y[pe+ke-1],Xe=Y[pe+ke]}}while((oe=Pe[oe&me])>N&&--G!=0);return ke<=A.lookahead?ke:A.lookahead}function Je(A){var oe,j,Q,G,pe,ke,te,N,Y,me,Pe=A.w_size;do{if(G=A.window_size-A.lookahead-A.strstart,A.strstart>=Pe+(Pe-U)){for(s.arraySet(A.window,A.window,Pe,Pe,0),A.match_start-=Pe,A.strstart-=Pe,A.block_start-=Pe,oe=j=A.hash_size;Q=A.head[--oe],A.head[oe]=Pe<=Q?Q-Pe:0,--j;);for(oe=j=Pe;Q=A.prev[--oe],A.prev[oe]=Pe<=Q?Q-Pe:0,--j;);G+=Pe}if(A.strm.avail_in===0)break;if(ke=A.strm,te=A.window,N=A.strstart+A.lookahead,Y=G,me=void 0,me=ke.avail_in,Y<me&&(me=Y),j=me===0?0:(ke.avail_in-=me,s.arraySet(te,ke.input,ke.next_in,me,N),ke.state.wrap===1?ke.adler=l(ke.adler,te,me,N):ke.state.wrap===2&&(ke.adler=u(ke.adler,te,me,N)),ke.next_in+=me,ke.total_in+=me,me),A.lookahead+=j,A.lookahead+A.insert>=F)for(pe=A.strstart-A.insert,A.ins_h=A.window[pe],A.ins_h=(A.ins_h<<A.hash_shift^A.window[pe+1])&A.hash_mask;A.insert&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[pe+F-1])&A.hash_mask,A.prev[pe&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=pe,pe++,A.insert--,!(A.lookahead+A.insert<F)););}while(A.lookahead<U&&A.strm.avail_in!==0)}function bt(A,oe){for(var j,Q;;){if(A.lookahead<U){if(Je(A),A.lookahead<U&&oe===f)return R;if(A.lookahead===0)break}if(j=0,A.lookahead>=F&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,j=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),j!==0&&A.strstart-j<=A.w_size-U&&(A.match_length=je(A,j)),A.match_length>=F)if(Q=a._tr_tally(A,A.strstart-A.match_start,A.match_length-F),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=F){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,j=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart,--A.match_length!=0;);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+1])&A.hash_mask;else Q=a._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(Q&&(he(A,!1),A.strm.avail_out===0))return R}return A.insert=A.strstart<F-1?A.strstart:F-1,oe===p?(he(A,!0),A.strm.avail_out===0?se:X):A.last_lit&&(he(A,!1),A.strm.avail_out===0)?R:$}function ft(A,oe){for(var j,Q,G;;){if(A.lookahead<U){if(Je(A),A.lookahead<U&&oe===f)return R;if(A.lookahead===0)break}if(j=0,A.lookahead>=F&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,j=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=F-1,j!==0&&A.prev_length<A.max_lazy_match&&A.strstart-j<=A.w_size-U&&(A.match_length=je(A,j),A.match_length<=5&&(A.strategy===1||A.match_length===F&&4096<A.strstart-A.match_start)&&(A.match_length=F-1)),A.prev_length>=F&&A.match_length<=A.prev_length){for(G=A.strstart+A.lookahead-F,Q=a._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-F),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=G&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,j=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),--A.prev_length!=0;);if(A.match_available=0,A.match_length=F-1,A.strstart++,Q&&(he(A,!1),A.strm.avail_out===0))return R}else if(A.match_available){if((Q=a._tr_tally(A,0,A.window[A.strstart-1]))&&he(A,!1),A.strstart++,A.lookahead--,A.strm.avail_out===0)return R}else A.match_available=1,A.strstart++,A.lookahead--}return A.match_available&&(Q=a._tr_tally(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<F-1?A.strstart:F-1,oe===p?(he(A,!0),A.strm.avail_out===0?se:X):A.last_lit&&(he(A,!1),A.strm.avail_out===0)?R:$}function Mt(A,oe,j,Q,G){this.good_length=A,this.max_lazy=oe,this.nice_length=j,this.max_chain=Q,this.func=G}function Le(){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*x+1)),this.bl_tree=new s.Buf16(2*(2*L+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(q+1),this.heap=new s.Buf16(2*S+1),Te(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*S+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 Se(A){var oe;return A&&A.state?(A.total_in=A.total_out=0,A.data_type=w,(oe=A.state).pending=0,oe.pending_out=0,oe.wrap<0&&(oe.wrap=-oe.wrap),oe.status=oe.wrap?T:V,A.adler=oe.wrap===2?0:1,oe.last_flush=f,a._tr_init(oe),g):J(A,m)}function ce(A){var oe=Se(A);return oe===g&&(function(j){j.window_size=2*j.w_size,Te(j.head),j.max_lazy_match=i[j.level].max_lazy,j.good_match=i[j.level].good_length,j.nice_match=i[j.level].nice_length,j.max_chain_length=i[j.level].max_chain,j.strstart=0,j.block_start=0,j.lookahead=0,j.insert=0,j.match_length=j.prev_length=F-1,j.match_available=0,j.ins_h=0})(A.state),oe}function H(A,oe,j,Q,G,pe){if(!A)return m;var ke=1;if(oe===v&&(oe=6),Q<0?(ke=0,Q=-Q):15<Q&&(ke=2,Q-=16),G<1||b<G||j!==_||Q<8||15<Q||oe<0||9<oe||pe<0||C<pe)return J(A,m);Q===8&&(Q=9);var te=new Le;return(A.state=te).strm=A,te.wrap=ke,te.gzhead=null,te.w_bits=Q,te.w_size=1<<te.w_bits,te.w_mask=te.w_size-1,te.hash_bits=G+7,te.hash_size=1<<te.hash_bits,te.hash_mask=te.hash_size-1,te.hash_shift=~~((te.hash_bits+F-1)/F),te.window=new s.Buf8(2*te.w_size),te.head=new s.Buf16(te.hash_size),te.prev=new s.Buf16(te.w_size),te.lit_bufsize=1<<G+6,te.pending_buf_size=4*te.lit_bufsize,te.pending_buf=new s.Buf8(te.pending_buf_size),te.d_buf=1*te.lit_bufsize,te.l_buf=3*te.lit_bufsize,te.level=oe,te.strategy=pe,te.method=j,ce(A)}i=[new Mt(0,0,0,0,function(A,oe){var j=65535;for(j>A.pending_buf_size-5&&(j=A.pending_buf_size-5);;){if(A.lookahead<=1){if(Je(A),A.lookahead===0&&oe===f)return R;if(A.lookahead===0)break}A.strstart+=A.lookahead,A.lookahead=0;var Q=A.block_start+j;if((A.strstart===0||A.strstart>=Q)&&(A.lookahead=A.strstart-Q,A.strstart=Q,he(A,!1),A.strm.avail_out===0)||A.strstart-A.block_start>=A.w_size-U&&(he(A,!1),A.strm.avail_out===0))return R}return A.insert=0,oe===p?(he(A,!0),A.strm.avail_out===0?se:X):(A.strstart>A.block_start&&(he(A,!1),A.strm.avail_out),R)}),new Mt(4,4,8,4,bt),new Mt(4,5,16,8,bt),new Mt(4,6,32,32,bt),new Mt(4,4,16,16,ft),new Mt(8,16,32,32,ft),new Mt(8,16,128,128,ft),new Mt(8,32,128,256,ft),new Mt(32,128,258,1024,ft),new Mt(32,258,258,4096,ft)],o.deflateInit=function(A,oe){return H(A,oe,_,15,8,0)},o.deflateInit2=H,o.deflateReset=ce,o.deflateResetKeep=Se,o.deflateSetHeader=function(A,oe){return A&&A.state?A.state.wrap!==2?m:(A.state.gzhead=oe,g):m},o.deflate=function(A,oe){var j,Q,G,pe;if(!A||!A.state||5<oe||oe<0)return A?J(A,m):m;if(Q=A.state,!A.output||!A.input&&A.avail_in!==0||Q.status===666&&oe!==p)return J(A,A.avail_out===0?-5:m);if(Q.strm=A,j=Q.last_flush,Q.last_flush=oe,Q.status===T)if(Q.wrap===2)A.adler=0,ye(Q,31),ye(Q,139),ye(Q,8),Q.gzhead?(ye(Q,(Q.gzhead.text?1:0)+(Q.gzhead.hcrc?2:0)+(Q.gzhead.extra?4:0)+(Q.gzhead.name?8:0)+(Q.gzhead.comment?16:0)),ye(Q,255&Q.gzhead.time),ye(Q,Q.gzhead.time>>8&255),ye(Q,Q.gzhead.time>>16&255),ye(Q,Q.gzhead.time>>24&255),ye(Q,Q.level===9?2:2<=Q.strategy||Q.level<2?4:0),ye(Q,255&Q.gzhead.os),Q.gzhead.extra&&Q.gzhead.extra.length&&(ye(Q,255&Q.gzhead.extra.length),ye(Q,Q.gzhead.extra.length>>8&255)),Q.gzhead.hcrc&&(A.adler=u(A.adler,Q.pending_buf,Q.pending,0)),Q.gzindex=0,Q.status=69):(ye(Q,0),ye(Q,0),ye(Q,0),ye(Q,0),ye(Q,0),ye(Q,Q.level===9?2:2<=Q.strategy||Q.level<2?4:0),ye(Q,3),Q.status=V);else{var ke=_+(Q.w_bits-8<<4)<<8;ke|=(2<=Q.strategy||Q.level<2?0:Q.level<6?1:Q.level===6?2:3)<<6,Q.strstart!==0&&(ke|=32),ke+=31-ke%31,Q.status=V,Re(Q,ke),Q.strstart!==0&&(Re(Q,A.adler>>>16),Re(Q,65535&A.adler)),A.adler=1}if(Q.status===69)if(Q.gzhead.extra){for(G=Q.pending;Q.gzindex<(65535&Q.gzhead.extra.length)&&(Q.pending!==Q.pending_buf_size||(Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),ge(A),G=Q.pending,Q.pending!==Q.pending_buf_size));)ye(Q,255&Q.gzhead.extra[Q.gzindex]),Q.gzindex++;Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),Q.gzindex===Q.gzhead.extra.length&&(Q.gzindex=0,Q.status=73)}else Q.status=73;if(Q.status===73)if(Q.gzhead.name){G=Q.pending;do{if(Q.pending===Q.pending_buf_size&&(Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),ge(A),G=Q.pending,Q.pending===Q.pending_buf_size)){pe=1;break}pe=Q.gzindex<Q.gzhead.name.length?255&Q.gzhead.name.charCodeAt(Q.gzindex++):0,ye(Q,pe)}while(pe!==0);Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),pe===0&&(Q.gzindex=0,Q.status=91)}else Q.status=91;if(Q.status===91)if(Q.gzhead.comment){G=Q.pending;do{if(Q.pending===Q.pending_buf_size&&(Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),ge(A),G=Q.pending,Q.pending===Q.pending_buf_size)){pe=1;break}pe=Q.gzindex<Q.gzhead.comment.length?255&Q.gzhead.comment.charCodeAt(Q.gzindex++):0,ye(Q,pe)}while(pe!==0);Q.gzhead.hcrc&&Q.pending>G&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-G,G)),pe===0&&(Q.status=103)}else Q.status=103;if(Q.status===103&&(Q.gzhead.hcrc?(Q.pending+2>Q.pending_buf_size&&ge(A),Q.pending+2<=Q.pending_buf_size&&(ye(Q,255&A.adler),ye(Q,A.adler>>8&255),A.adler=0,Q.status=V)):Q.status=V),Q.pending!==0){if(ge(A),A.avail_out===0)return Q.last_flush=-1,g}else if(A.avail_in===0&&W(oe)<=W(j)&&oe!==p)return J(A,-5);if(Q.status===666&&A.avail_in!==0)return J(A,-5);if(A.avail_in!==0||Q.lookahead!==0||oe!==f&&Q.status!==666){var te=Q.strategy===2?(function(N,Y){for(var me;;){if(N.lookahead===0&&(Je(N),N.lookahead===0)){if(Y===f)return R;break}if(N.match_length=0,me=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++,me&&(he(N,!1),N.strm.avail_out===0))return R}return N.insert=0,Y===p?(he(N,!0),N.strm.avail_out===0?se:X):N.last_lit&&(he(N,!1),N.strm.avail_out===0)?R:$})(Q,oe):Q.strategy===3?(function(N,Y){for(var me,Pe,_e,it,Xe=N.window;;){if(N.lookahead<=P){if(Je(N),N.lookahead<=P&&Y===f)return R;if(N.lookahead===0)break}if(N.match_length=0,N.lookahead>=F&&0<N.strstart&&(Pe=Xe[_e=N.strstart-1])===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]){it=N.strstart+P;do;while(Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&Pe===Xe[++_e]&&_e<it);N.match_length=P-(it-_e),N.match_length>N.lookahead&&(N.match_length=N.lookahead)}if(N.match_length>=F?(me=a._tr_tally(N,1,N.match_length-F),N.lookahead-=N.match_length,N.strstart+=N.match_length,N.match_length=0):(me=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++),me&&(he(N,!1),N.strm.avail_out===0))return R}return N.insert=0,Y===p?(he(N,!0),N.strm.avail_out===0?se:X):N.last_lit&&(he(N,!1),N.strm.avail_out===0)?R:$})(Q,oe):i[Q.level].func(Q,oe);if(te!==se&&te!==X||(Q.status=666),te===R||te===se)return A.avail_out===0&&(Q.last_flush=-1),g;if(te===$&&(oe===1?a._tr_align(Q):oe!==5&&(a._tr_stored_block(Q,0,0,!1),oe===3&&(Te(Q.head),Q.lookahead===0&&(Q.strstart=0,Q.block_start=0,Q.insert=0))),ge(A),A.avail_out===0))return Q.last_flush=-1,g}return oe!==p?g:Q.wrap<=0?1:(Q.wrap===2?(ye(Q,255&A.adler),ye(Q,A.adler>>8&255),ye(Q,A.adler>>16&255),ye(Q,A.adler>>24&255),ye(Q,255&A.total_in),ye(Q,A.total_in>>8&255),ye(Q,A.total_in>>16&255),ye(Q,A.total_in>>24&255)):(Re(Q,A.adler>>>16),Re(Q,65535&A.adler)),ge(A),0<Q.wrap&&(Q.wrap=-Q.wrap),Q.pending!==0?g:1)},o.deflateEnd=function(A){var oe;return A&&A.state?(oe=A.state.status)!==T&&oe!==69&&oe!==73&&oe!==91&&oe!==103&&oe!==V&&oe!==666?J(A,m):(A.state=null,oe===V?J(A,-3):g):m},o.deflateSetDictionary=function(A,oe){var j,Q,G,pe,ke,te,N,Y,me=oe.length;if(!A||!A.state||(pe=(j=A.state).wrap)===2||pe===1&&j.status!==T||j.lookahead)return m;for(pe===1&&(A.adler=l(A.adler,oe,me,0)),j.wrap=0,me>=j.w_size&&(pe===0&&(Te(j.head),j.strstart=0,j.block_start=0,j.insert=0),Y=new s.Buf8(j.w_size),s.arraySet(Y,oe,me-j.w_size,j.w_size,0),oe=Y,me=j.w_size),ke=A.avail_in,te=A.next_in,N=A.input,A.avail_in=me,A.next_in=0,A.input=oe,Je(j);j.lookahead>=F;){for(Q=j.strstart,G=j.lookahead-(F-1);j.ins_h=(j.ins_h<<j.hash_shift^j.window[Q+F-1])&j.hash_mask,j.prev[Q&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=Q,Q++,--G;);j.strstart=Q,j.lookahead=F-1,Je(j)}return j.strstart+=j.lookahead,j.block_start=j.strstart,j.insert=j.lookahead,j.lookahead=0,j.match_length=j.prev_length=F-1,j.match_available=0,A.next_in=te,A.input=N,A.avail_in=ke,j.wrap=pe,g},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,d,f,p,g,m,v,C,w,_,b,S,x,L,B,q,F,P,U,T,V,R=i.input,$;u=l+(i.avail_in-5),d=i.next_out,$=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),g=a.dmax,m=a.wsize,v=a.whave,C=a.wnext,w=a.window,_=a.hold,b=a.bits,S=a.lencode,x=a.distcode,L=(1<<a.lenbits)-1,B=(1<<a.distbits)-1;e:do{b<15&&(_+=R[l++]<<b,b+=8,_+=R[l++]<<b,b+=8),q=S[_&L];t:for(;;){if(_>>>=F=q>>>24,b-=F,(F=q>>>16&255)===0)$[d++]=65535&q;else{if(!(16&F)){if((64&F)==0){q=S[(65535&q)+(_&(1<<F)-1)];continue t}if(32&F){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}P=65535&q,(F&=15)&&(b<F&&(_+=R[l++]<<b,b+=8),P+=_&(1<<F)-1,_>>>=F,b-=F),b<15&&(_+=R[l++]<<b,b+=8,_+=R[l++]<<b,b+=8),q=x[_&B];n:for(;;){if(_>>>=F=q>>>24,b-=F,!(16&(F=q>>>16&255))){if((64&F)==0){q=x[(65535&q)+(_&(1<<F)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(U=65535&q,b<(F&=15)&&(_+=R[l++]<<b,(b+=8)<F&&(_+=R[l++]<<b,b+=8)),g<(U+=_&(1<<F)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(_>>>=F,b-=F,(F=d-f)<U){if(v<(F=U-F)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(V=w,(T=0)===C){if(T+=m-F,F<P){for(P-=F;$[d++]=w[T++],--F;);T=d-U,V=$}}else if(C<F){if(T+=m+C-F,(F-=C)<P){for(P-=F;$[d++]=w[T++],--F;);if(T=0,C<P){for(P-=F=C;$[d++]=w[T++],--F;);T=d-U,V=$}}}else if(T+=C-F,F<P){for(P-=F;$[d++]=w[T++],--F;);T=d-U,V=$}for(;2<P;)$[d++]=V[T++],$[d++]=V[T++],$[d++]=V[T++],P-=3;P&&($[d++]=V[T++],1<P&&($[d++]=V[T++]))}else{for(T=d-U;$[d++]=$[T++],$[d++]=$[T++],$[d++]=$[T++],2<(P-=3););P&&($[d++]=$[T++],1<P&&($[d++]=$[T++]))}break}}break}}while(l<u&&d<p);l-=P=b>>3,_&=(1<<(b-=P<<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=b}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),u=n("./inftrees"),d=1,f=2,p=0,g=-2,m=1,v=852,C=592;function w(T){return(T>>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<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 b(T){var V;return T&&T.state?(V=T.state,T.total_in=T.total_out=V.total=0,T.msg="",V.wrap&&(T.adler=1&V.wrap),V.mode=m,V.last=0,V.havedict=0,V.dmax=32768,V.head=null,V.hold=0,V.bits=0,V.lencode=V.lendyn=new i.Buf32(v),V.distcode=V.distdyn=new i.Buf32(C),V.sane=1,V.back=-1,p):g}function S(T){var V;return T&&T.state?((V=T.state).wsize=0,V.whave=0,V.wnext=0,b(T)):g}function x(T,V){var R,$;return T&&T.state?($=T.state,V<0?(R=0,V=-V):(R=1+(V>>4),V<48&&(V&=15)),V&&(V<8||15<V)?g:($.window!==null&&$.wbits!==V&&($.window=null),$.wrap=R,$.wbits=V,S(T))):g}function L(T,V){var R,$;return T?($=new _,(T.state=$).window=null,(R=x(T,V))!==p&&(T.state=null),R):g}var B,q,F=!0;function P(T){if(F){var V;for(B=new i.Buf32(512),q=new i.Buf32(32),V=0;V<144;)T.lens[V++]=8;for(;V<256;)T.lens[V++]=9;for(;V<280;)T.lens[V++]=7;for(;V<288;)T.lens[V++]=8;for(u(d,T.lens,0,288,B,0,T.work,{bits:9}),V=0;V<32;)T.lens[V++]=5;u(f,T.lens,0,32,q,0,T.work,{bits:5}),F=!1}T.lencode=B,T.lenbits=9,T.distcode=q,T.distbits=5}function U(T,V,R,$){var se,X=T.state;return X.window===null&&(X.wsize=1<<X.wbits,X.wnext=0,X.whave=0,X.window=new i.Buf8(X.wsize)),$>=X.wsize?(i.arraySet(X.window,V,R-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize):($<(se=X.wsize-X.wnext)&&(se=$),i.arraySet(X.window,V,R-$,se,X.wnext),($-=se)?(i.arraySet(X.window,V,R-$,$,0),X.wnext=$,X.whave=X.wsize):(X.wnext+=se,X.wnext===X.wsize&&(X.wnext=0),X.whave<X.wsize&&(X.whave+=se))),0}o.inflateReset=S,o.inflateReset2=x,o.inflateResetKeep=b,o.inflateInit=function(T){return L(T,15)},o.inflateInit2=L,o.inflate=function(T,V){var R,$,se,X,J,W,Te,ge,he,ye,Re,je,Je,bt,ft,Mt,Le,Se,ce,H,A,oe,j,Q,G=0,pe=new i.Buf8(4),ke=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!T||!T.state||!T.output||!T.input&&T.avail_in!==0)return g;(R=T.state).mode===12&&(R.mode=13),J=T.next_out,se=T.output,Te=T.avail_out,X=T.next_in,$=T.input,W=T.avail_in,ge=R.hold,he=R.bits,ye=W,Re=Te,oe=p;e:for(;;)switch(R.mode){case m:if(R.wrap===0){R.mode=13;break}for(;he<16;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(2&R.wrap&&ge===35615){pe[R.check=0]=255&ge,pe[1]=ge>>>8&255,R.check=a(R.check,pe,2,0),he=ge=0,R.mode=2;break}if(R.flags=0,R.head&&(R.head.done=!1),!(1&R.wrap)||(((255&ge)<<8)+(ge>>8))%31){T.msg="incorrect header check",R.mode=30;break}if((15&ge)!=8){T.msg="unknown compression method",R.mode=30;break}if(he-=4,A=8+(15&(ge>>>=4)),R.wbits===0)R.wbits=A;else if(A>R.wbits){T.msg="invalid window size",R.mode=30;break}R.dmax=1<<A,T.adler=R.check=1,R.mode=512&ge?10:12,he=ge=0;break;case 2:for(;he<16;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(R.flags=ge,(255&R.flags)!=8){T.msg="unknown compression method",R.mode=30;break}if(57344&R.flags){T.msg="unknown header flags set",R.mode=30;break}R.head&&(R.head.text=ge>>8&1),512&R.flags&&(pe[0]=255&ge,pe[1]=ge>>>8&255,R.check=a(R.check,pe,2,0)),he=ge=0,R.mode=3;case 3:for(;he<32;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.head&&(R.head.time=ge),512&R.flags&&(pe[0]=255&ge,pe[1]=ge>>>8&255,pe[2]=ge>>>16&255,pe[3]=ge>>>24&255,R.check=a(R.check,pe,4,0)),he=ge=0,R.mode=4;case 4:for(;he<16;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.head&&(R.head.xflags=255&ge,R.head.os=ge>>8),512&R.flags&&(pe[0]=255&ge,pe[1]=ge>>>8&255,R.check=a(R.check,pe,2,0)),he=ge=0,R.mode=5;case 5:if(1024&R.flags){for(;he<16;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.length=ge,R.head&&(R.head.extra_len=ge),512&R.flags&&(pe[0]=255&ge,pe[1]=ge>>>8&255,R.check=a(R.check,pe,2,0)),he=ge=0}else R.head&&(R.head.extra=null);R.mode=6;case 6:if(1024&R.flags&&(W<(je=R.length)&&(je=W),je&&(R.head&&(A=R.head.extra_len-R.length,R.head.extra||(R.head.extra=new Array(R.head.extra_len)),i.arraySet(R.head.extra,$,X,je,A)),512&R.flags&&(R.check=a(R.check,$,je,X)),W-=je,X+=je,R.length-=je),R.length))break e;R.length=0,R.mode=7;case 7:if(2048&R.flags){if(W===0)break e;for(je=0;A=$[X+je++],R.head&&A&&R.length<65536&&(R.head.name+=String.fromCharCode(A)),A&&je<W;);if(512&R.flags&&(R.check=a(R.check,$,je,X)),W-=je,X+=je,A)break e}else R.head&&(R.head.name=null);R.length=0,R.mode=8;case 8:if(4096&R.flags){if(W===0)break e;for(je=0;A=$[X+je++],R.head&&A&&R.length<65536&&(R.head.comment+=String.fromCharCode(A)),A&&je<W;);if(512&R.flags&&(R.check=a(R.check,$,je,X)),W-=je,X+=je,A)break e}else R.head&&(R.head.comment=null);R.mode=9;case 9:if(512&R.flags){for(;he<16;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(ge!==(65535&R.check)){T.msg="header crc mismatch",R.mode=30;break}he=ge=0}R.head&&(R.head.hcrc=R.flags>>9&1,R.head.done=!0),T.adler=R.check=0,R.mode=12;break;case 10:for(;he<32;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}T.adler=R.check=w(ge),he=ge=0,R.mode=11;case 11:if(R.havedict===0)return T.next_out=J,T.avail_out=Te,T.next_in=X,T.avail_in=W,R.hold=ge,R.bits=he,2;T.adler=R.check=1,R.mode=12;case 12:if(V===5||V===6)break e;case 13:if(R.last){ge>>>=7&he,he-=7&he,R.mode=27;break}for(;he<3;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}switch(R.last=1&ge,he-=1,3&(ge>>>=1)){case 0:R.mode=14;break;case 1:if(P(R),R.mode=20,V!==6)break;ge>>>=2,he-=2;break e;case 2:R.mode=17;break;case 3:T.msg="invalid block type",R.mode=30}ge>>>=2,he-=2;break;case 14:for(ge>>>=7&he,he-=7&he;he<32;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if((65535&ge)!=(ge>>>16^65535)){T.msg="invalid stored block lengths",R.mode=30;break}if(R.length=65535&ge,he=ge=0,R.mode=15,V===6)break e;case 15:R.mode=16;case 16:if(je=R.length){if(W<je&&(je=W),Te<je&&(je=Te),je===0)break e;i.arraySet(se,$,X,je,J),W-=je,X+=je,Te-=je,J+=je,R.length-=je;break}R.mode=12;break;case 17:for(;he<14;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(R.nlen=257+(31&ge),ge>>>=5,he-=5,R.ndist=1+(31&ge),ge>>>=5,he-=5,R.ncode=4+(15&ge),ge>>>=4,he-=4,286<R.nlen||30<R.ndist){T.msg="too many length or distance symbols",R.mode=30;break}R.have=0,R.mode=18;case 18:for(;R.have<R.ncode;){for(;he<3;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.lens[ke[R.have++]]=7&ge,ge>>>=3,he-=3}for(;R.have<19;)R.lens[ke[R.have++]]=0;if(R.lencode=R.lendyn,R.lenbits=7,j={bits:R.lenbits},oe=u(0,R.lens,0,19,R.lencode,0,R.work,j),R.lenbits=j.bits,oe){T.msg="invalid code lengths set",R.mode=30;break}R.have=0,R.mode=19;case 19:for(;R.have<R.nlen+R.ndist;){for(;Mt=(G=R.lencode[ge&(1<<R.lenbits)-1])>>>16&255,Le=65535&G,!((ft=G>>>24)<=he);){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(Le<16)ge>>>=ft,he-=ft,R.lens[R.have++]=Le;else{if(Le===16){for(Q=ft+2;he<Q;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(ge>>>=ft,he-=ft,R.have===0){T.msg="invalid bit length repeat",R.mode=30;break}A=R.lens[R.have-1],je=3+(3&ge),ge>>>=2,he-=2}else if(Le===17){for(Q=ft+3;he<Q;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}he-=ft,A=0,je=3+(7&(ge>>>=ft)),ge>>>=3,he-=3}else{for(Q=ft+7;he<Q;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}he-=ft,A=0,je=11+(127&(ge>>>=ft)),ge>>>=7,he-=7}if(R.have+je>R.nlen+R.ndist){T.msg="invalid bit length repeat",R.mode=30;break}for(;je--;)R.lens[R.have++]=A}}if(R.mode===30)break;if(R.lens[256]===0){T.msg="invalid code -- missing end-of-block",R.mode=30;break}if(R.lenbits=9,j={bits:R.lenbits},oe=u(d,R.lens,0,R.nlen,R.lencode,0,R.work,j),R.lenbits=j.bits,oe){T.msg="invalid literal/lengths set",R.mode=30;break}if(R.distbits=6,R.distcode=R.distdyn,j={bits:R.distbits},oe=u(f,R.lens,R.nlen,R.ndist,R.distcode,0,R.work,j),R.distbits=j.bits,oe){T.msg="invalid distances set",R.mode=30;break}if(R.mode=20,V===6)break e;case 20:R.mode=21;case 21:if(6<=W&&258<=Te){T.next_out=J,T.avail_out=Te,T.next_in=X,T.avail_in=W,R.hold=ge,R.bits=he,l(T,Re),J=T.next_out,se=T.output,Te=T.avail_out,X=T.next_in,$=T.input,W=T.avail_in,ge=R.hold,he=R.bits,R.mode===12&&(R.back=-1);break}for(R.back=0;Mt=(G=R.lencode[ge&(1<<R.lenbits)-1])>>>16&255,Le=65535&G,!((ft=G>>>24)<=he);){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(Mt&&(240&Mt)==0){for(Se=ft,ce=Mt,H=Le;Mt=(G=R.lencode[H+((ge&(1<<Se+ce)-1)>>Se)])>>>16&255,Le=65535&G,!(Se+(ft=G>>>24)<=he);){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}ge>>>=Se,he-=Se,R.back+=Se}if(ge>>>=ft,he-=ft,R.back+=ft,R.length=Le,Mt===0){R.mode=26;break}if(32&Mt){R.back=-1,R.mode=12;break}if(64&Mt){T.msg="invalid literal/length code",R.mode=30;break}R.extra=15&Mt,R.mode=22;case 22:if(R.extra){for(Q=R.extra;he<Q;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.length+=ge&(1<<R.extra)-1,ge>>>=R.extra,he-=R.extra,R.back+=R.extra}R.was=R.length,R.mode=23;case 23:for(;Mt=(G=R.distcode[ge&(1<<R.distbits)-1])>>>16&255,Le=65535&G,!((ft=G>>>24)<=he);){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if((240&Mt)==0){for(Se=ft,ce=Mt,H=Le;Mt=(G=R.distcode[H+((ge&(1<<Se+ce)-1)>>Se)])>>>16&255,Le=65535&G,!(Se+(ft=G>>>24)<=he);){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}ge>>>=Se,he-=Se,R.back+=Se}if(ge>>>=ft,he-=ft,R.back+=ft,64&Mt){T.msg="invalid distance code",R.mode=30;break}R.offset=Le,R.extra=15&Mt,R.mode=24;case 24:if(R.extra){for(Q=R.extra;he<Q;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}R.offset+=ge&(1<<R.extra)-1,ge>>>=R.extra,he-=R.extra,R.back+=R.extra}if(R.offset>R.dmax){T.msg="invalid distance too far back",R.mode=30;break}R.mode=25;case 25:if(Te===0)break e;if(je=Re-Te,R.offset>je){if((je=R.offset-je)>R.whave&&R.sane){T.msg="invalid distance too far back",R.mode=30;break}Je=je>R.wnext?(je-=R.wnext,R.wsize-je):R.wnext-je,je>R.length&&(je=R.length),bt=R.window}else bt=se,Je=J-R.offset,je=R.length;for(Te<je&&(je=Te),Te-=je,R.length-=je;se[J++]=bt[Je++],--je;);R.length===0&&(R.mode=21);break;case 26:if(Te===0)break e;se[J++]=R.length,Te--,R.mode=21;break;case 27:if(R.wrap){for(;he<32;){if(W===0)break e;W--,ge|=$[X++]<<he,he+=8}if(Re-=Te,T.total_out+=Re,R.total+=Re,Re&&(T.adler=R.check=R.flags?a(R.check,se,Re,J-Re):s(R.check,se,Re,J-Re)),Re=Te,(R.flags?ge:w(ge))!==R.check){T.msg="incorrect data check",R.mode=30;break}he=ge=0}R.mode=28;case 28:if(R.wrap&&R.flags){for(;he<32;){if(W===0)break e;W--,ge+=$[X++]<<he,he+=8}if(ge!==(4294967295&R.total)){T.msg="incorrect length check",R.mode=30;break}he=ge=0}R.mode=29;case 29:oe=1;break e;case 30:oe=-3;break e;case 31:return-4;default:return g}return T.next_out=J,T.avail_out=Te,T.next_in=X,T.avail_in=W,R.hold=ge,R.bits=he,(R.wsize||Re!==T.avail_out&&R.mode<30&&(R.mode<27||V!==4))&&U(T,T.output,T.next_out,Re-T.avail_out)?(R.mode=31,-4):(ye-=T.avail_in,Re-=T.avail_out,T.total_in+=ye,T.total_out+=Re,R.total+=Re,R.wrap&&Re&&(T.adler=R.check=R.flags?a(R.check,se,Re,T.next_out-Re):s(R.check,se,Re,T.next_out-Re)),T.data_type=R.bits+(R.last?64:0)+(R.mode===12?128:0)+(R.mode===20||R.mode===15?256:0),(ye==0&&Re===0||V===4)&&oe===p&&(oe=-5),oe)},o.inflateEnd=function(T){if(!T||!T.state)return g;var V=T.state;return V.window&&(V.window=null),T.state=null,p},o.inflateGetHeader=function(T,V){var R;return T&&T.state?(2&(R=T.state).wrap)==0?g:((R.head=V).done=!1,p):g},o.inflateSetDictionary=function(T,V){var R,$=V.length;return T&&T.state?(R=T.state).wrap!==0&&R.mode!==11?g:R.mode===11&&s(1,V,$,0)!==R.check?-3:U(T,V,$,$)?(R.mode=31,-4):(R.havedict=1,p):g},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,p,g,m,v,C,w){var _,b,S,x,L,B,q,F,P,U=w.bits,T=0,V=0,R=0,$=0,se=0,X=0,J=0,W=0,Te=0,ge=0,he=null,ye=0,Re=new i.Buf16(16),je=new i.Buf16(16),Je=null,bt=0;for(T=0;T<=15;T++)Re[T]=0;for(V=0;V<g;V++)Re[f[p+V]]++;for(se=U,$=15;1<=$&&Re[$]===0;$--);if($<se&&(se=$),$===0)return m[v++]=20971520,m[v++]=20971520,w.bits=1,0;for(R=1;R<$&&Re[R]===0;R++);for(se<R&&(se=R),T=W=1;T<=15;T++)if(W<<=1,(W-=Re[T])<0)return-1;if(0<W&&(d===0||$!==1))return-1;for(je[1]=0,T=1;T<15;T++)je[T+1]=je[T]+Re[T];for(V=0;V<g;V++)f[p+V]!==0&&(C[je[f[p+V]]++]=V);if(B=d===0?(he=Je=C,19):d===1?(he=s,ye-=257,Je=a,bt-=257,256):(he=l,Je=u,-1),T=R,L=v,J=V=ge=0,S=-1,x=(Te=1<<(X=se))-1,d===1&&852<Te||d===2&&592<Te)return 1;for(;;){for(q=T-J,P=C[V]<B?(F=0,C[V]):C[V]>B?(F=Je[bt+C[V]],he[ye+C[V]]):(F=96,0),_=1<<T-J,R=b=1<<X;m[L+(ge>>J)+(b-=_)]=q<<24|F<<16|P|0,b!==0;);for(_=1<<T-1;ge&_;)_>>=1;if(_!==0?(ge&=_-1,ge+=_):ge=0,V++,--Re[T]==0){if(T===$)break;T=f[p+C[V]]}if(se<T&&(ge&x)!==S){for(J===0&&(J=se),L+=R,W=1<<(X=T-J);X+J<$&&!((W-=Re[X+J])<=0);)X++,W<<=1;if(Te+=1<<X,d===1&&852<Te||d===2&&592<Te)return 1;m[S=ge&x]=se<<24|X<<16|L-v|0}}return ge!==0&&(m[L+ge]=T-J<<24|4194304),w.bits=se,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(G){for(var pe=G.length;0<=--pe;)G[pe]=0}var u=0,d=29,f=256,p=f+1+d,g=30,m=19,v=2*p+1,C=15,w=16,_=7,b=256,S=16,x=17,L=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],q=[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],F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],P=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],U=new Array(2*(p+2));l(U);var T=new Array(2*g);l(T);var V=new Array(512);l(V);var R=new Array(256);l(R);var $=new Array(d);l($);var se,X,J,W=new Array(g);function Te(G,pe,ke,te,N){this.static_tree=G,this.extra_bits=pe,this.extra_base=ke,this.elems=te,this.max_length=N,this.has_stree=G&&G.length}function ge(G,pe){this.dyn_tree=G,this.max_code=0,this.stat_desc=pe}function he(G){return G<256?V[G]:V[256+(G>>>7)]}function ye(G,pe){G.pending_buf[G.pending++]=255&pe,G.pending_buf[G.pending++]=pe>>>8&255}function Re(G,pe,ke){G.bi_valid>w-ke?(G.bi_buf|=pe<<G.bi_valid&65535,ye(G,G.bi_buf),G.bi_buf=pe>>w-G.bi_valid,G.bi_valid+=ke-w):(G.bi_buf|=pe<<G.bi_valid&65535,G.bi_valid+=ke)}function je(G,pe,ke){Re(G,ke[2*pe],ke[2*pe+1])}function Je(G,pe){for(var ke=0;ke|=1&G,G>>>=1,ke<<=1,0<--pe;);return ke>>>1}function bt(G,pe,ke){var te,N,Y=new Array(C+1),me=0;for(te=1;te<=C;te++)Y[te]=me=me+ke[te-1]<<1;for(N=0;N<=pe;N++){var Pe=G[2*N+1];Pe!==0&&(G[2*N]=Je(Y[Pe]++,Pe))}}function ft(G){var pe;for(pe=0;pe<p;pe++)G.dyn_ltree[2*pe]=0;for(pe=0;pe<g;pe++)G.dyn_dtree[2*pe]=0;for(pe=0;pe<m;pe++)G.bl_tree[2*pe]=0;G.dyn_ltree[2*b]=1,G.opt_len=G.static_len=0,G.last_lit=G.matches=0}function Mt(G){8<G.bi_valid?ye(G,G.bi_buf):0<G.bi_valid&&(G.pending_buf[G.pending++]=G.bi_buf),G.bi_buf=0,G.bi_valid=0}function Le(G,pe,ke,te){var N=2*pe,Y=2*ke;return G[N]<G[Y]||G[N]===G[Y]&&te[pe]<=te[ke]}function Se(G,pe,ke){for(var te=G.heap[ke],N=ke<<1;N<=G.heap_len&&(N<G.heap_len&&Le(pe,G.heap[N+1],G.heap[N],G.depth)&&N++,!Le(pe,te,G.heap[N],G.depth));)G.heap[ke]=G.heap[N],ke=N,N<<=1;G.heap[ke]=te}function ce(G,pe,ke){var te,N,Y,me,Pe=0;if(G.last_lit!==0)for(;te=G.pending_buf[G.d_buf+2*Pe]<<8|G.pending_buf[G.d_buf+2*Pe+1],N=G.pending_buf[G.l_buf+Pe],Pe++,te===0?je(G,N,pe):(je(G,(Y=R[N])+f+1,pe),(me=B[Y])!==0&&Re(G,N-=$[Y],me),je(G,Y=he(--te),ke),(me=q[Y])!==0&&Re(G,te-=W[Y],me)),Pe<G.last_lit;);je(G,b,pe)}function H(G,pe){var ke,te,N,Y=pe.dyn_tree,me=pe.stat_desc.static_tree,Pe=pe.stat_desc.has_stree,_e=pe.stat_desc.elems,it=-1;for(G.heap_len=0,G.heap_max=v,ke=0;ke<_e;ke++)Y[2*ke]!==0?(G.heap[++G.heap_len]=it=ke,G.depth[ke]=0):Y[2*ke+1]=0;for(;G.heap_len<2;)Y[2*(N=G.heap[++G.heap_len]=it<2?++it:0)]=1,G.depth[N]=0,G.opt_len--,Pe&&(G.static_len-=me[2*N+1]);for(pe.max_code=it,ke=G.heap_len>>1;1<=ke;ke--)Se(G,Y,ke);for(N=_e;ke=G.heap[1],G.heap[1]=G.heap[G.heap_len--],Se(G,Y,1),te=G.heap[1],G.heap[--G.heap_max]=ke,G.heap[--G.heap_max]=te,Y[2*N]=Y[2*ke]+Y[2*te],G.depth[N]=(G.depth[ke]>=G.depth[te]?G.depth[ke]:G.depth[te])+1,Y[2*ke+1]=Y[2*te+1]=N,G.heap[1]=N++,Se(G,Y,1),2<=G.heap_len;);G.heap[--G.heap_max]=G.heap[1],(function(Xe,at){var Pt,Ft,Zt,At,ct,tn,Yt=at.dyn_tree,Ln=at.max_code,Tn=at.stat_desc.static_tree,jr=at.stat_desc.has_stree,no=at.stat_desc.extra_bits,Yr=at.stat_desc.extra_base,_n=at.stat_desc.max_length,nr=0;for(At=0;At<=C;At++)Xe.bl_count[At]=0;for(Yt[2*Xe.heap[Xe.heap_max]+1]=0,Pt=Xe.heap_max+1;Pt<v;Pt++)_n<(At=Yt[2*Yt[2*(Ft=Xe.heap[Pt])+1]+1]+1)&&(At=_n,nr++),Yt[2*Ft+1]=At,Ln<Ft||(Xe.bl_count[At]++,ct=0,Yr<=Ft&&(ct=no[Ft-Yr]),tn=Yt[2*Ft],Xe.opt_len+=tn*(At+ct),jr&&(Xe.static_len+=tn*(Tn[2*Ft+1]+ct)));if(nr!==0){do{for(At=_n-1;Xe.bl_count[At]===0;)At--;Xe.bl_count[At]--,Xe.bl_count[At+1]+=2,Xe.bl_count[_n]--,nr-=2}while(0<nr);for(At=_n;At!==0;At--)for(Ft=Xe.bl_count[At];Ft!==0;)Ln<(Zt=Xe.heap[--Pt])||(Yt[2*Zt+1]!==At&&(Xe.opt_len+=(At-Yt[2*Zt+1])*Yt[2*Zt],Yt[2*Zt+1]=At),Ft--)}})(G,pe),bt(Y,it,G.bl_count)}function A(G,pe,ke){var te,N,Y=-1,me=pe[1],Pe=0,_e=7,it=4;for(me===0&&(_e=138,it=3),pe[2*(ke+1)+1]=65535,te=0;te<=ke;te++)N=me,me=pe[2*(te+1)+1],++Pe<_e&&N===me||(Pe<it?G.bl_tree[2*N]+=Pe:N!==0?(N!==Y&&G.bl_tree[2*N]++,G.bl_tree[2*S]++):Pe<=10?G.bl_tree[2*x]++:G.bl_tree[2*L]++,Y=N,it=(Pe=0)===me?(_e=138,3):N===me?(_e=6,3):(_e=7,4))}function oe(G,pe,ke){var te,N,Y=-1,me=pe[1],Pe=0,_e=7,it=4;for(me===0&&(_e=138,it=3),te=0;te<=ke;te++)if(N=me,me=pe[2*(te+1)+1],!(++Pe<_e&&N===me)){if(Pe<it)for(;je(G,N,G.bl_tree),--Pe!=0;);else N!==0?(N!==Y&&(je(G,N,G.bl_tree),Pe--),je(G,S,G.bl_tree),Re(G,Pe-3,2)):Pe<=10?(je(G,x,G.bl_tree),Re(G,Pe-3,3)):(je(G,L,G.bl_tree),Re(G,Pe-11,7));Y=N,it=(Pe=0)===me?(_e=138,3):N===me?(_e=6,3):(_e=7,4)}}l(W);var j=!1;function Q(G,pe,ke,te){Re(G,(u<<1)+(te?1:0),3),(function(N,Y,me,Pe){Mt(N),Pe&&(ye(N,me),ye(N,~me)),i.arraySet(N.pending_buf,N.window,Y,me,N.pending),N.pending+=me})(G,pe,ke,!0)}o._tr_init=function(G){j||((function(){var pe,ke,te,N,Y,me=new Array(C+1);for(N=te=0;N<d-1;N++)for($[N]=te,pe=0;pe<1<<B[N];pe++)R[te++]=N;for(R[te-1]=N,N=Y=0;N<16;N++)for(W[N]=Y,pe=0;pe<1<<q[N];pe++)V[Y++]=N;for(Y>>=7;N<g;N++)for(W[N]=Y<<7,pe=0;pe<1<<q[N]-7;pe++)V[256+Y++]=N;for(ke=0;ke<=C;ke++)me[ke]=0;for(pe=0;pe<=143;)U[2*pe+1]=8,pe++,me[8]++;for(;pe<=255;)U[2*pe+1]=9,pe++,me[9]++;for(;pe<=279;)U[2*pe+1]=7,pe++,me[7]++;for(;pe<=287;)U[2*pe+1]=8,pe++,me[8]++;for(bt(U,p+1,me),pe=0;pe<g;pe++)T[2*pe+1]=5,T[2*pe]=Je(pe,5);se=new Te(U,B,f+1,p,C),X=new Te(T,q,0,g,C),J=new Te(new Array(0),F,0,m,_)})(),j=!0),G.l_desc=new ge(G.dyn_ltree,se),G.d_desc=new ge(G.dyn_dtree,X),G.bl_desc=new ge(G.bl_tree,J),G.bi_buf=0,G.bi_valid=0,ft(G)},o._tr_stored_block=Q,o._tr_flush_block=function(G,pe,ke,te){var N,Y,me=0;0<G.level?(G.strm.data_type===2&&(G.strm.data_type=(function(Pe){var _e,it=4093624447;for(_e=0;_e<=31;_e++,it>>>=1)if(1&it&&Pe.dyn_ltree[2*_e]!==0)return s;if(Pe.dyn_ltree[18]!==0||Pe.dyn_ltree[20]!==0||Pe.dyn_ltree[26]!==0)return a;for(_e=32;_e<f;_e++)if(Pe.dyn_ltree[2*_e]!==0)return a;return s})(G)),H(G,G.l_desc),H(G,G.d_desc),me=(function(Pe){var _e;for(A(Pe,Pe.dyn_ltree,Pe.l_desc.max_code),A(Pe,Pe.dyn_dtree,Pe.d_desc.max_code),H(Pe,Pe.bl_desc),_e=m-1;3<=_e&&Pe.bl_tree[2*P[_e]+1]===0;_e--);return Pe.opt_len+=3*(_e+1)+5+5+4,_e})(G),N=G.opt_len+3+7>>>3,(Y=G.static_len+3+7>>>3)<=N&&(N=Y)):N=Y=ke+5,ke+4<=N&&pe!==-1?Q(G,pe,ke,te):G.strategy===4||Y===N?(Re(G,2+(te?1:0),3),ce(G,U,T)):(Re(G,4+(te?1:0),3),(function(Pe,_e,it,Xe){var at;for(Re(Pe,_e-257,5),Re(Pe,it-1,5),Re(Pe,Xe-4,4),at=0;at<Xe;at++)Re(Pe,Pe.bl_tree[2*P[at]+1],3);oe(Pe,Pe.dyn_ltree,_e-1),oe(Pe,Pe.dyn_dtree,it-1)})(G,G.l_desc.max_code+1,G.d_desc.max_code+1,me+1),ce(G,G.dyn_ltree,G.dyn_dtree)),ft(G),te&&Mt(G)},o._tr_tally=function(G,pe,ke){return G.pending_buf[G.d_buf+2*G.last_lit]=pe>>>8&255,G.pending_buf[G.d_buf+2*G.last_lit+1]=255&pe,G.pending_buf[G.l_buf+G.last_lit]=255&ke,G.last_lit++,pe===0?G.dyn_ltree[2*ke]++:(G.matches++,pe--,G.dyn_ltree[2*(R[ke]+f+1)]++,G.dyn_dtree[2*he(pe)]++),G.last_lit===G.lit_bufsize-1},o._tr_align=function(G){Re(G,2,3),je(G,b,U),(function(pe){pe.bi_valid===16?(ye(pe,pe.bi_buf),pe.bi_buf=0,pe.bi_valid=0):8<=pe.bi_valid&&(pe.pending_buf[pe.pending++]=255&pe.bi_buf,pe.bi_buf>>=8,pe.bi_valid-=8)})(G)}},{"../utils/common":41}],53:[function(n,r,o){"use strict";r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){"use strict";if(!s.setImmediate){var l,u,d,f,p=1,g={},m=!1,v=s.document,C=Object.getPrototypeOf&&Object.getPrototypeOf(s);C=C&&C.setTimeout?C:s,l={}.toString.call(s.process)==="[object process]"?function(S){process.nextTick(function(){_(S)})}:(function(){if(s.postMessage&&!s.importScripts){var S=!0,x=s.onmessage;return s.onmessage=function(){S=!1},s.postMessage("","*"),s.onmessage=x,S}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",b,!1):s.attachEvent("onmessage",b),function(S){s.postMessage(f+S,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(S){_(S.data)},function(S){d.port2.postMessage(S)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(S){var x=v.createElement("script");x.onreadystatechange=function(){_(S),x.onreadystatechange=null,u.removeChild(x),x=null},u.appendChild(x)}):function(S){setTimeout(_,0,S)},C.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var x=new Array(arguments.length-1),L=0;L<x.length;L++)x[L]=arguments[L+1];return g[p]={callback:S,args:x},l(p),p++},C.clearImmediate=w}function w(S){delete g[S]}function _(S){if(m)setTimeout(_,0,S);else{var x=g[S];if(x){m=!0;try{(function(L){var B=L.callback,q=L.args;switch(q.length){case 0:B();break;case 1:B(q[0]);break;case 2:B(q[0],q[1]);break;case 3:B(q[0],q[1],q[2]);break;default:B.apply(a,q)}})(x)}finally{w(S),m=!1}}}}function b(S){S.source===s&&typeof S.data=="string"&&S.data.indexOf(f)===0&&_(+S.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)})})),_r="application/vnd.openxmlformats-officedocument.wordprocessingml.document",za="application/pdf",Gu="text/html",A6={docx:_r,pdf:za,html:Gu},Qp={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 I6=x2(_6(),1),E6=e=>typeof e!="string"?"":e.trim(),mb=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Jp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Pc=e=>{const t=e??{},n=E6(t.id),r=mb(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},Wk=({current:e,other:t})=>{const n=Pc(e),r=Pc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Wu=({actor:e,fallbackKey:t=""})=>{const n=Pc(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 T6(e){return typeof e.captureStackTrace=="function"}var em=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",T6(Error)&&Error.captureStackTrace(this,this.constructor)}},x6=class extends em{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},R6=class extends em{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},gb=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new x6(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 R6(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 em?r:new em("Failed to create file object",r)}};function M6(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 tm=new WeakMap;function Kk(e){return e.ownerDocument??document}function qk(e,t){const n=tm.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),tm.delete(t))}function Yk(e,t){const n=Kk(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&qk(e,e.__clickOutsideDocument);let r=tm.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},tm.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var vb={mounted(e,t){Yk(e,t)},updated(e,t){Yk(e,t)},unmounted(e){qk(e,e.__clickOutsideDocument??Kk(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function L6(e){return e[1].user!==void 0}var P6=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(L6).filter(([r,o])=>{const i=Wu({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Wu({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}})},D6="https://ingest.superdoc.dev/v1/collect",VY="community-and-eval-agplv3";function O6(){try{return"2.25.0-next.14"}catch{return"unknown"}}var F6=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||D6,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=O6()}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{}}},nm={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"},UY=[nm.INLINE_SDT_LABEL,nm.BLOCK_SDT_LABEL],Xk={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"},N6=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"}}},$Y=`.${nm.BLOCK_SDT}[${Xk.SDT_ID}]`,HY=`[${Xk.DRAGGABLE}="true"]`,B6=typeof window<"u",Zk,zf=e=>Zk=e,Qk=Symbol();function yb(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var jf;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(jf||(jf={}));var Jk=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 z6(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 bb(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){j6(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function eS(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function rm(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 om=typeof navigator=="object"?navigator:{userAgent:""},tS=/Macintosh/.test(om.userAgent)&&/AppleWebKit/.test(om.userAgent)&&!/Safari/.test(om.userAgent),j6=B6?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!tS?V6:"msSaveOrOpenBlob"in om?U6:$6:()=>{};function V6(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?eS(r.href)?bb(e,t,n):(r.target="_blank",rm(r)):rm(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){rm(r)},0))}function U6(e,t="download",n){if(typeof e=="string")if(eS(e))bb(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){rm(r)})}else navigator.msSaveOrOpenBlob(z6(e,n),t)}function $6(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return bb(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(Jk.HTMLElement))||"safari"in Jk,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||tS)&&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:GY}=Object;function H6(){const e=Av(!0),t=e.run(()=>ne({}));let n=[],r=[];const o=Qr({install(i){zf(o),o._a=i,i.provide(Qk,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 nS=()=>{};function rS(e,t,n,r=nS){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&Iv()&&q2(o),o}function Ku(e,...t){e.forEach(n=>{n(...t)})}var G6=e=>e(),oS=Symbol(),wb=Symbol();function Cb(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];yb(o)&&yb(r)&&e.hasOwnProperty(n)&&!vr(r)&&!yi(r)?e[n]=Cb(o,r):e[n]=r}return e}var W6=Symbol();function K6(e){return!yb(e)||!Object.prototype.hasOwnProperty.call(e,W6)}var{assign:Ml}=Object;function q6(e){return!!(vr(e)&&e.effect)}function Y6(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=iw(n.state.value[e]);return Ml(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=Qr(Ce(()=>{zf(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=iS(e,u,t,n,r,!0),l}function iS(e,t,n={},r,o,i){let s;const a=Ml({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function C(L){let B;u=d=!1,typeof L=="function"?(L(r.state.value[e]),B={type:jf.patchFunction,storeId:e,events:g}):(Cb(r.state.value[e],L),B={type:jf.patchObject,payload:L,storeId:e,events:g});const q=v=Symbol();_t().then(()=>{v===q&&(u=!0)}),d=!0,Ku(f,B,r.state.value[e])}const w=i?function(){const{state:B}=n,q=B?B():{};this.$patch(F=>{Ml(F,q)})}:nS;function _(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const b=(L,B="")=>{if(oS in L)return L[wb]=B,L;const q=function(){zf(r);const F=Array.from(arguments),P=new Set,U=new Set;function T($){P.add($)}function V($){U.add($)}Ku(p,{args:F,name:q[wb],store:S,after:T,onError:V});let R;try{R=L.apply(this&&this.$id===e?this:S,F)}catch($){throw Ku(U,$),$}return R instanceof Promise?R.then($=>(Ku(P,$),$)).catch($=>(Ku(U,$),Promise.reject($))):(Ku(P,R),R)};return q[oS]=!0,q[wb]=B,q},S=io({_p:r,$id:e,$onAction:rS.bind(null,p),$patch:C,$reset:w,$subscribe(L,B={}){const q=rS(f,L,B.detached,()=>F()),F=s.run(()=>$t(()=>r.state.value[e],P=>{(B.flush==="sync"?d:u)&&L({storeId:e,type:jf.direct,events:g},P)},Ml({},l,B)));return q},$dispose:_});r._s.set(e,S);const x=(r._a&&r._a.runWithContext||G6)(()=>r._e.run(()=>(s=Av()).run(()=>t({action:b}))));for(const L in x){const B=x[L];vr(B)&&!q6(B)||yi(B)?i||(m&&K6(B)&&(vr(B)?B.value=m[L]:Cb(B,m[L])),r.state.value[e][L]=B):typeof B=="function"&&(x[L]=b(B,L),a.actions[L]=B)}return Ml(S,x),Ml(En(S),x),Object.defineProperty(S,"$state",{get:()=>r.state.value[e],set:L=>{C(B=>{Ml(B,L)})}}),r._p.forEach(L=>{Ml(S,s.run(()=>L({store:S,app:r._a,pinia:r,options:a})))}),m&&i&&n.hydrate&&n.hydrate(S.$state,m),u=!0,d=!0,S}function sS(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=Lw();return s=s||(l?Gs(Qk,null):null),s&&zf(s),s=Zk,s._s.has(e)||(o?iS(e,t,r,s):Y6(e,r,s)),s._s.get(e)}return i.$id=e,i}function Qs(e){const t=En(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=Ce({get:()=>e[r],set(i){e[r]=i}}):(vr(o)||yi(o))&&(n[r]=Dv(e,r))}return n}function aS(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function lS(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 Dc(e){return typeof e=="string"&&e.length>0?e:null}function X6(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 Z6(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 Q6(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 kb(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function J6(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function im(e,t){return!e.ok||t===void 0?e:{ok:!0,target:{...e.target,syncTimeoutMs:t}}}function Sb(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function e8(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function t8(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 cS(e,t){const n=Dc(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=X6(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: ${lS(r)}).`};const i=Q6(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?Dc(t.token):null,a=kb(t.roomMode);return a?{ok:!0,target:{providerFamily:e,documentId:n,roomMode:a,serverUrl:o,...i?{params:i}:{},...s?{token:s}:{}}}:Sb()}function n8(e){const t=Dc(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.adapterId."};const n=Dc(e.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.documentId."};const r=kb(e.roomMode);if(!r)return Sb();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:Dc(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 r8(e,t){const n=Dc(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=Dc(e.publicApiKey),o=kb(e.roomMode);if(!o)return Sb();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=Z6(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 uS(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=aS(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=t8(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",f=lS(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=J6(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=e8(s);return l===null||l==="y-websocket"?im(cS("y-websocket",s),a):l==="hocuspocus"?im(cS("hocuspocus",s),a):l==="liveblocks"?im(r8(s,o),a):l==="extension"?im(n8(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 Vf=(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?Vf(e.originFileObj,e.name||t):e.file?Vf(e.file,e.name||t):e.raw?Vf(e.raw,e.name||t):null},dS=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,o8=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,Ll=e=>{if(ArrayBuffer.isView(e))return o8?.call(e)==="Uint8Array";if(!dS)return!1;try{return dS.call(e),!0}catch{return!1}},_b=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},Ab=(e,t)=>new Blob([_b(e)],{type:t}),Ib=e=>{switch(e.toLowerCase()){case"docx":case _r:return _r;case"pdf":case za:return za;case"html":case Gu:return Gu;default:return e}},sm=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?_r:t.endsWith(".pdf")?za:t.endsWith(".html")||t.endsWith(".htm")?Gu:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},i8=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",s8="application/octet-stream",Eb=e=>{if(e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"collaboration")){const n={...e};delete n.collaboration,e={...n,v2Collaboration:aS(e)}}if(Ll(e))return{type:_r,data:_b(e),name:"document.docx"};const t=Vf(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=sm(n),i=o||sm(r),s=t.type.toLowerCase()===s8,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(Ll(e.data)){const r=Ib(e.type||sm(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?_b(e.data):Ab(e.data,r),name:e.name||i8(r)}}const n=Vf(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?Ib(e.type):"",o=r||n.type||sm(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=Ib(e.type);if(n!==e.type)return{...e,type:n}}return e};Bt();function a8(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?io({...t}):ne(t),i=ne(null);return $t(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function l8(e){const t=ne(e.itemid),n=ne(e.itemicon),r=ne(e.itemiconpack),o=ne(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=a8(e,i,ne([])),l=ne(e.itemtype),u=ne(e.itemfieldtype),d=e,f=io({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=ne(e.logicrules),g=ne(!1),m=io({}),v={SELECT:u8,IMAGEINPUT:c8,CHECKBOXINPUT:d8};return l.value in v&&Object.assign(m,v[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:ne(e.itemformat),logicRules:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function c8(e){return{fontfamily:ne(e.fontfamily),iteminputtype:ne(e.iteminputtype)}}function u8(e){return{options:ne(e.itemoptions)}}function d8(e){const t=ne(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,Tb=e=>{const t=Js();return e.forEach((n,r)=>{t.set(r,n)}),t},qu=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},f8=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},h8=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Yu=()=>new Set,xb=e=>e[e.length-1],Xu=Array.from,Rb=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},fS=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},p8=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},am=Array.isArray,m8=class{constructor(){this._observers=Js()}on(e,t){return qu(this._observers,e,Yu).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 Xu((this._observers.get(e)||Js()).values()).forEach(n=>n(...t))}destroy(){this._observers=Js()}},ja=Math.floor,lm=Math.abs,hS=(e,t)=>e<t?e:t,Zu=(e,t)=>e>t?e:t,WY=Number.isNaN,g8=e=>e!==0?e<0:1/e<0,KY=1,qY=2,YY=4,XY=8,ZY=32,QY=64,JY=128,v8=1<<17,y8=1<<18,b8=1<<19,w8=1<<20,C8=1<<21,k8=1<<22,S8=1<<23,_8=1<<24,A8=1<<25,I8=1<<26,E8=1<<27,T8=1<<28,x8=1<<29,R8=1<<30,eX=31,tX=63,nX=127,rX=v8-1,oX=y8-1,iX=b8-1,sX=w8-1,aX=C8-1,lX=k8-1,cX=S8-1,uX=_8-1,dX=A8-1,fX=I8-1,hX=E8-1,pX=T8-1,mX=x8-1,gX=R8-1,vX=2147483647,pS=Number.MAX_SAFE_INTEGER,mS=Number.MIN_SAFE_INTEGER,M8=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&ja(e)===e),yX=Number.isNaN,bX=Number.parseInt,gS=String.fromCharCode,wX=String.fromCodePoint,CX=gS(65535),L8=e=>e.toLowerCase(),P8=/^\s*/g,D8=e=>e.replace(P8,""),O8=/([A-Z])/g,vS=(e,t)=>D8(e.replace(O8,n=>`${t}${L8(n)}`)),F8=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},Uf=typeof TextEncoder<"u"?new TextEncoder:null,N8=e=>Uf.encode(e),B8=Uf?N8:F8,Mb=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Mb&&Mb.decode(new Uint8Array).length===1&&(Mb=null);var z8=(e,t)=>p8(t,()=>e).join(""),$f=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Lb=()=>new $f,j8=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},Va=e=>{const t=new Uint8Array(j8(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},V8=(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(Zu(n,t)*2),e.cpos=0)},bo=(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},Pb=bo,cr=(e,t)=>{for(;t>127;)bo(e,128|127&t),t=ja(t/128);bo(e,127&t)},Db=(e,t)=>{const n=g8(t);for(n&&(t=-t),bo(e,(t>63?128:0)|(n?64:0)|63&t),t=ja(t/64);t>0;)bo(e,(t>127?128:0)|127&t),t=ja(t/128)},Ob=new Uint8Array(3e4),U8=Ob.length/3,$8=(e,t)=>{if(t.length<U8){const n=Uf.encodeInto(t,Ob).written||0;cr(e,n);for(let r=0;r<n;r++)bo(e,Ob[r])}else Di(e,B8(t))},H8=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;cr(e,r);for(let o=0;o<r;o++)bo(e,n.codePointAt(o))},Qu=Uf&&Uf.encodeInto?$8:H8,Fb=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=hS(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(Zu(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},Di=(e,t)=>{cr(e,t.byteLength),Fb(e,t)},Nb=(e,t)=>{V8(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},G8=(e,t)=>Nb(e,4).setFloat32(0,t,!1),W8=(e,t)=>Nb(e,8).setFloat64(0,t,!1),K8=(e,t)=>Nb(e,8).setBigInt64(0,t,!1),yS=new DataView(new ArrayBuffer(4)),q8=e=>(yS.setFloat32(0,e),yS.getFloat32(0)===e),Hf=(e,t)=>{switch(typeof t){case"string":bo(e,119),Qu(e,t);break;case"number":M8(t)&&lm(t)<=2147483647?(bo(e,125),Db(e,t)):q8(t)?(bo(e,124),G8(e,t)):(bo(e,123),W8(e,t));break;case"bigint":bo(e,122),K8(e,t);break;case"object":if(t===null)bo(e,126);else if(am(t)){bo(e,117),cr(e,t.length);for(let n=0;n<t.length;n++)Hf(e,t[n])}else if(t instanceof Uint8Array)bo(e,116),Di(e,t);else{bo(e,118);const n=Object.keys(t);cr(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];Qu(e,o),Hf(e,t[o])}}break;case"boolean":bo(e,t?120:121);break;default:bo(e,127)}},bS=class extends $f{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&cr(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},wS=e=>{e.count>0&&(Db(e.encoder,e.count===1?e.s:-e.s),e.count>1&&cr(e.encoder,e.count-2))},cm=class{constructor(){this.encoder=new $f,this.s=0,this.count=0}write(e){this.s===e?this.count++:(wS(this),this.count=1,this.s=e)}toUint8Array(){return wS(this),Va(this.encoder)}},CS=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Db(e.encoder,t),e.count>1&&cr(e.encoder,e.count-2)}},Bb=class{constructor(){this.encoder=new $f,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(CS(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return CS(this),Va(this.encoder)}},Y8=class{constructor(){this.sarr=[],this.s="",this.lensE=new cm}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 $f;return this.sarr.push(this.s),this.s="",Qu(e,this.sarr.join("")),Fb(e,this.lensE.toUint8Array()),Va(e)}},Pl=e=>new Error(e),ks=()=>{throw Pl("Method unimplemented")},Ua=()=>{throw Pl("Unexpected case")},kX=crypto.subtle,X8=crypto.getRandomValues.bind(crypto),kS=()=>X8(new Uint32Array(1))[0],Z8="10000000-1000-4000-8000-100000000000",Q8=()=>Z8.replace(/[018]/g,e=>(e^kS()&15>>e/4).toString(16)),J8=Date.now,SS=e=>new Promise(e),SX=Promise.all.bind(Promise),_S=e=>e===void 0?null:e,eR=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},AS=new eR,tR=!0;try{typeof localStorage<"u"&&localStorage&&(AS=localStorage,tR=!1)}catch{}var nR=AS,Gf=Symbol("Equality"),IS=(e,t)=>e===t||!!e?.[Gf]?.(t)||!1,rR=e=>typeof e=="object",oR=Object.assign,iR=Object.keys,sR=(e,t)=>{for(const n in e)t(e[n],n)},um=e=>iR(e).length,aR=e=>{for(const t in e)return!1;return!0},Wf=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},zb=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),lR=(e,t)=>e===t||um(e)===um(t)&&Wf(e,(n,r)=>(n!==void 0||zb(t,r))&&IS(t[r],n)),cR=Object.freeze,ES=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&ES(e[t])}return cR(e)},jb=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&jb(e,t,n+1)}},dm=(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[Gf]!=null)return e[Gf](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)||!dm(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(um(e)!==um(t))return!1;for(const n in e)if(!zb(e,n)||!dm(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(!dm(e[n],t[n]))return!1;break;default:return!1}return!0},uR=(e,t)=>t.includes(e),Kf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",_X=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,ea,dR=[],fR=()=>{if(ea===void 0)if(Kf){ea=Js();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&ea.set(t,""),t=r):t!==null?(ea.set(t,r),t=null):dR.push(r)}t!==null&&ea.set(t,"")}else typeof location=="object"?(ea=Js(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");ea.set(`--${vS(t,"-")}`,n),ea.set(`-${vS(t,"-")}`,n)}})):ea=Js();return ea},Vb=e=>fR().has(e),fm=e=>_S(Kf?process.env[e.toUpperCase().replaceAll("-","_")]:nR.getItem(e)),TS=e=>Vb("--"+e)||fm(e)!==null,hR=TS("production"),pR=Kf&&uR(process.env.FORCE_COLOR,["true","1","2"]),mR=pR||!Vb("--no-colors")&&!TS("no-color")&&(!Kf||process.stdout.isTTY)&&(!Kf||Vb("--color")||fm("COLORTERM")!==null||(fm("TERM")||"").includes("color")),gR=class{constructor(e,t){this.left=e,this.right=t}},$a=(e,t)=>new gR(e,t),xS=e=>e.next()>=.5,Ub=(e,t,n)=>ja(e.next()*(n+1-t)+t),RS=(e,t,n)=>ja(e.next()*(n+1-t)+t),$b=(e,t,n)=>RS(e,t,n),vR=e=>gS($b(e,97,122)),yR=(e,t=0,n=20)=>{const r=$b(e,t,n);let o="";for(let i=0;i<r;i++)o+=vR(e);return o},Hb=(e,t)=>t[$b(e,0,t.length-1)],bR=Symbol("0schema"),wR=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(z8(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
5
5
  `)}},Gb=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[Gf]?IS(e,t):am(e)?Rb(e,n=>fS(t,r=>Gb(n,r))):rR(e)?Wf(e,(n,r)=>Gb(n,t[r])):!1,oi=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),Gb(t,n)}equals(e){return this.constructor===e.constructor&&dm(this.shape,e.shape)}[bR](){return!0}[Gf](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){ks()}get nullable(){return Ju(this,ym)}get optional(){return new PS(this)}cast(e){return KS(e,this),e}expect(e){return KS(e,this),e}},Wb=class extends oi{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}},Jr=(e,t=null)=>new Wb(e,t),AX=Jr(Wb),Kb=class extends oi{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}},wo=e=>new Kb(e),IX=Jr(Kb),hm=class extends oi{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}},pm=(...e)=>new hm(e),MS=Jr(hm),CR=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),LS=e=>{if(td.check(e))return[CR(e)];if(MS.check(e))return e.shape.map(t=>t+"");if(HS.check(e))return["[+-]?\\d+.?\\d*"];if(GS.check(e))return[".*"];if(mm.check(e))return e.shape.map(LS).flat(1);Ua()},kR=class extends oi{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(LS).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}},EX=Jr(kR),SR=Symbol("optional"),PS=class extends oi{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[SR](){return!0}},_R=Jr(PS),DS=class extends oi{check(e,t){return t?.extend(null,"never",typeof e),!1}},TX=new DS,xX=Jr(DS),OS=class XT extends oi{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new XT(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):Wf(this.shape,(r,o)=>{const i=this._isPartial&&!zb(t,o)||r.check(t[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof t[o],"Object property does not match"),i})}},AR=e=>new OS(e),IR=Jr(OS),ER=wo(e=>e!=null&&(e.constructor===Object||e.constructor==null)),FS=class extends oi{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&Wf(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)})}},NS=(e,t)=>new FS(e,t),TR=Jr(FS),BS=class extends oi{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&Wf(this.shape,(n,r)=>{const o=n.check(e[r],t);return!o&&t?.extend(r.toString(),"Tuple",typeof n),o})}},xR=(...e)=>new BS(e),RX=Jr(BS),zS=class extends oi{constructor(e){super(),this.shape=e.length===1?e[0]:new qb(e)}check(e,t){const n=am(e)&&Rb(e,r=>this.shape.check(r));return!n&&t?.extend(null,"Array",""),n}},jS=(...e)=>new zS(e),RR=Jr(zS),MR=wo(e=>am(e)),VS=class extends oi{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}},LR=(e,t=null)=>new VS(e,t),MX=Jr(VS),PR=LR(oi),DR=class extends oi{constructor(e){super(),this.len=e.length-1,this.args=xR(...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}},OR=Jr(DR),FR=wo(e=>typeof e=="function"),NR=class extends oi{constructor(e){super(),this.shape=e}check(e,t){const n=Rb(this.shape,r=>r.check(e,t));return!n&&t?.extend(null,"Intersectinon",typeof e),n}},LX=Jr(NR,e=>e.shape.length>0),qb=class extends oi{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const n=fS(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),n}},Ju=(...e)=>e.findIndex(t=>mm.check(t))>=0?Ju(...e.map(t=>qf(t)).map(t=>mm.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new qb(e),mm=Jr(qb),US=()=>!0,gm=wo(US),BR=Jr(Kb,e=>e.shape===US),Yb=wo(e=>typeof e=="bigint"),zR=wo(e=>e===Yb),$S=wo(e=>typeof e=="symbol"),PX=wo(e=>e===$S),ed=wo(e=>typeof e=="number"),HS=wo(e=>e===ed),td=wo(e=>typeof e=="string"),GS=wo(e=>e===td),vm=wo(e=>typeof e=="boolean"),jR=wo(e=>e===vm),WS=pm(void 0),DX=Jr(hm,e=>e.shape.length===1&&e.shape[0]===void 0),OX=pm(void 0),ym=pm(null),VR=Jr(hm,e=>e.shape.length===1&&e.shape[0]===null),FX=Jr(Uint8Array),NX=Jr(Wb,e=>e.shape===Uint8Array),UR=Ju(ed,td,ym,WS,Yb,vm,$S),BX=(()=>{const e=jS(gm),t=NS(td,gm),n=Ju(ed,td,ym,vm,e,t);return e.shape=n,t.shape.values=n,n})(),qf=e=>{if(PR.check(e))return e;if(ER.check(e)){const t={};for(const n in e)t[n]=qf(e[n]);return AR(t)}else{if(MR.check(e))return Ju(...e.map(qf));if(UR.check(e))return pm(e);if(FR.check(e))return Jr(e)}Ua()},KS=hR?()=>{}:(e,t)=>{const n=new wR;if(!t.check(e,n))throw Pl(`Expected value to be of type ${t.constructor.name}.
6
6
  ${n.toString()}`)},$R=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:qf(e),h:t}),this}else(e){return this.if(gm,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 Pl("Unhandled pattern")}}},HR=e=>new $R(e),qS=HR(gm).if(HS,(e,t)=>Ub(t,mS,pS)).if(GS,(e,t)=>yR(t)).if(jR,(e,t)=>xS(t)).if(zR,(e,t)=>BigInt(Ub(t,mS,pS))).if(mm,(e,t)=>nd(t,Hb(t,e.shape))).if(IR,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(_R.check(o)){if(xS(t))continue;o=o.shape}n[r]=qS(o,t)}return n}).if(RR,(e,t)=>{const n=[],r=RS(t,0,42);for(let o=0;o<r;o++)n.push(nd(t,e.shape));return n}).if(MS,(e,t)=>Hb(t,e.shape)).if(VR,(e,t)=>null).if(OR,(e,t)=>{const n=nd(t,e.res);return()=>n}).if(BR,(e,t)=>nd(t,Hb(t,[ed,td,ym,WS,Yb,vm,jS(ed),NS(Ju("a","b","c"),ed)]))).if(TR,(e,t)=>{const n={},r=Ub(t,0,3);for(let o=0;o<r;o++){const i=nd(t,e.shape.keys);n[i]=nd(t,e.shape.values)}return n}).done(),nd=(e,t)=>qS(qf(t),e),Oc=typeof document<"u"?document:{},zX=wo(e=>e.nodeType===YR),jX=typeof DOMParser<"u"?new DOMParser:null,VX=wo(e=>e.nodeType===WR),UX=wo(e=>e.nodeType===KR),GR=e=>f8(e,(t,n)=>`${n}:${t};`).join(""),WR=Oc.ELEMENT_NODE,KR=Oc.TEXT_NODE,$X=Oc.CDATA_SECTION_NODE,HX=Oc.COMMENT_NODE,qR=Oc.DOCUMENT_NODE,GX=Oc.DOCUMENT_TYPE_NODE,YR=Oc.DOCUMENT_FRAGMENT_NODE,WX=wo(e=>e.nodeType===qR),Ha=Symbol,YS=Ha(),XS=Ha(),XR=Ha(),ZR=Ha(),QR=Ha(),ZS=Ha(),JR=Ha(),Xb=Ha(),e7=Ha(),t7=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},KX=J8(),n7={[YS]:$a("font-weight","bold"),[XS]:$a("font-weight","normal"),[XR]:$a("color","blue"),[QR]:$a("color","green"),[ZR]:$a("color","grey"),[ZS]:$a("color","red"),[JR]:$a("color","purple"),[Xb]:$a("color","orange"),[e7]:$a("color","black")},r7=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=n7[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=GR(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},QS=mR?r7:t7,o7=(...e)=>{console.log(...QS(e)),JS.forEach(t=>t.print(e))},i7=(...e)=>{console.warn(...QS(e)),e.unshift(Xb),JS.forEach(t=>t.print(e))},JS=Yu(),e3=e=>({[Symbol.iterator](){return this},next:e}),s7=(e,t)=>e3(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),Zb=(e,t)=>e3(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),t3=class{constructor(e,t){this.clock=e,this.len=t}},n3=class{constructor(){this.clients=new Map}},r3=(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])p3(e,i,u.clock,u.len,n)}}),a7=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=ja((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},o3=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&a7(n,t.clock)!==null},i3=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 t3(o.clock,Zu(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},s3=(e,t,n,r)=>{qu(e.clients,t,()=>[]).push(new t3(n,r))},l7=()=>new n3,c7=(e,t)=>{cr(e.restEncoder,t.clients.size),Xu(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),cr(e.restEncoder,n);const o=r.length;cr(e.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},a3=kS,Qb=class ZT extends m8{constructor({guid:t=Q8(),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=a3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new C7,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=SS(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>SS(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&&yr(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Xu(this.subdocs).map(t=>t.guid))}transact(t,n=null){return yr(this,t,n)}get(t,n=Mo){const r=qu(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==Mo&&o!==n)if(o===Mo){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,O7)}getText(t=""){return this.get(t,V7)}getMap(t=""){return this.get(t,s0)}getXmlElement(t=""){return this.get(t,N3)}getXmlFragment(t=""){return this.get(t,u0)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,Xu(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new ZT({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,yr(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()}},u7=class{constructor(){this.restEncoder=Lb()}toUint8Array(){return Va(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){cr(this.restEncoder,e)}writeDsLen(e){cr(this.restEncoder,e)}},d7=class extends u7{writeLeftID(e){cr(this.restEncoder,e.client),cr(this.restEncoder,e.clock)}writeRightID(e){cr(this.restEncoder,e.client),cr(this.restEncoder,e.clock)}writeClient(e){cr(this.restEncoder,e)}writeInfo(e){Pb(this.restEncoder,e)}writeString(e){Qu(this.restEncoder,e)}writeParentInfo(e){cr(this.restEncoder,e?1:0)}writeTypeRef(e){cr(this.restEncoder,e)}writeLen(e){cr(this.restEncoder,e)}writeAny(e){Hf(this.restEncoder,e)}writeBuf(e){Di(this.restEncoder,e)}writeJSON(e){Qu(this.restEncoder,JSON.stringify(e))}writeKey(e){Qu(this.restEncoder,e)}},f7=class{constructor(){this.restEncoder=Lb(),this.dsCurrVal=0}toUint8Array(){return Va(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,cr(this.restEncoder,t)}writeDsLen(e){e===0&&Ua(),cr(this.restEncoder,e-1),this.dsCurrVal+=e}},h7=class extends f7{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Bb,this.clientEncoder=new cm,this.leftClockEncoder=new Bb,this.rightClockEncoder=new Bb,this.infoEncoder=new bS(Pb),this.stringEncoder=new Y8,this.parentInfoEncoder=new bS(Pb),this.typeRefEncoder=new cm,this.lenEncoder=new cm}toUint8Array(){const e=Lb();return cr(e,0),Di(e,this.keyClockEncoder.toUint8Array()),Di(e,this.clientEncoder.toUint8Array()),Di(e,this.leftClockEncoder.toUint8Array()),Di(e,this.rightClockEncoder.toUint8Array()),Di(e,Va(this.infoEncoder)),Di(e,this.stringEncoder.toUint8Array()),Di(e,Va(this.parentInfoEncoder)),Di(e,this.typeRefEncoder.toUint8Array()),Di(e,this.lenEncoder.toUint8Array()),Fb(e,Va(this.restEncoder)),Va(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){Hf(this.restEncoder,e)}writeBuf(e){Di(this.restEncoder,e)}writeJSON(e){Hf(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)}},p7=(e,t,n,r)=>{r=Zu(r,t[0].id.clock);const o=Ga(t,r);cr(e.restEncoder,t.length-o),e.writeClient(n),cr(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)},m7=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{ki(t,i)>o&&r.set(i,o)}),e0(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),cr(e.restEncoder,r.size),Xu(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{p7(e,t.clients.get(o),o,i)})},g7=(e,t)=>m7(e,t.doc.store,t.beforeState),v7=class{constructor(){this.l=[]}},l3=()=>new v7,c3=(e,t)=>e.l.push(t),u3=(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.")},d3=(e,t,n)=>jb(e.l,[t,n]),bm=class{constructor(e,t){this.client=e,this.clock=t}},wm=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,zr=(e,t)=>new bm(e,t),y7=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw Ua()},b7=class{constructor(e,t){this.ds=e,this.sv=t}},w7=(e,t)=>new b7(e,t),qX=w7(l7(),new Map),rd=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!o3(t.ds,e.id),Jb=(e,t)=>{const n=qu(e.meta,Jb,Yu),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<ki(r,i)&&Dl(e,zr(i,o))}),r3(e,t.ds,o=>{}),n.add(t))},C7=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},e0=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},ki=(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},f3=(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 Ua()}n.push(t)},Ga=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=ja(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=ja((n+r)/2)}throw Ua()},k7=(e,t)=>{const n=e.clients.get(t.client);return n[Ga(n,t.clock)]},t0=k7,n0=(e,t,n)=>{const r=Ga(t,n),o=t[r];return o.id.clock<n&&o instanceof Oi?(t.splice(r+1,0,V3(e,o,n-o.id.clock)),r+1):r},Dl=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[n0(e,n,t.clock)]},h3=(e,t,n)=>{const r=t.clients.get(n.client),o=Ga(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Fl&&r.splice(o+1,0,V3(e,i,n.clock-i.id.clock+1)),i},S7=(e,t,n)=>{const r=e.clients.get(t.id.client);r[Ga(r,t.id.clock)]=n},p3=(e,t,n,r,o)=>{if(r===0)return;const i=n+r;let s=n0(e,t,n),a;do a=t[s++],i<a.id.clock+a.length&&n0(e,t,i),o(a);while(s<t.length&&t[s].id.clock<i)},_7=class{constructor(e,t,n){this.doc=e,this.deleteSet=new n3,this.beforeState=e0(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}},m3=(e,t)=>t.deleteSet.clients.size===0&&!h8(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(i3(t.deleteSet),g7(e,t),c7(e,t.deleteSet),!0),g3=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&qu(e.changed,t,Yu).add(n)},Cm=(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 Oi&&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},A7=(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=Ga(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 Oi&&f.deleted&&!f.keep&&n(f)&&f.gc(t,!1)}}}},I7=(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=hS(o.length-1,1+Ga(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+Cm(o,l)}})},v3=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{i3(i),n.afterState=e0(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(()=>{d3(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&z7(n)})}),jb(a,[])}finally{r.gc&&A7(i,o,r.gcFilter),I7(i,o),n.afterState.forEach((d,f)=>{const p=n.beforeState.get(f)||0;if(p!==d){const g=o.clients.get(f),m=Zu(Ga(g,p),1);for(let v=g.length-1;v>=m;)v-=1+Cm(g,v)}});for(let d=s.length-1;d>=0;d--){const{client:f,clock:p}=s[d].id,g=o.clients.get(f),m=Ga(g,p);m+1<g.length&&Cm(g,m+1)>1||m>0&&Cm(g,m)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(o7(Xb,YS,"[yjs] ",XS,ZS,"Changed the client-id because another client seems to be using it."),r.clientID=a3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new d7;m3(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new h7;m3(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])):v3(e,t+1)}}},yr=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new _7(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&&v3(o,0)}}return s},y3="You must not compute changes after the event-handler fired.",km=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=E7(this.currentTarget,this.target))}deletes(e){return o3(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Pl(y3);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=xb(s.content.getContent());else return;else s!==null&&this.deletes(s)?(o="update",i=xb(s.content.getContent())):(o="add",i=void 0)}else if(this.deletes(r))o="delete",i=xb(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 Pl(y3);const t=this.target,n=Yu(),r=Yu(),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}},E7=(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},Wo=()=>{i7("Invalid access: Add Yjs type to a document before reading data.")},b3=80,r0=0,T7=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=r0++}},x7=e=>{e.timestamp=r0++},w3=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=r0++},R7=(e,t,n)=>{if(e.length>=b3){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return w3(r,t,n),r}else{const r=new T7(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)=>lm(t-i.index)<lm(t-s.index)?i:s);let r=e._start,o=0;for(n!==null&&(r=n.p,o=n.index,x7(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&&lm(n.index-o)<r.parent.length/b3?(w3(n,r,o),n):R7(e._searchMarker,r,o)},Yf=(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=Zu(t,o.index+n))}},_m=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;qu(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;d3(r._eH,n,t)},Mo=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=l3(),this._dEH=l3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw ks()}clone(){throw ks()}_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){c3(this._eH,e)}observeDeep(e){c3(this._dEH,e)}unobserve(e){u3(this._eH,e)}unobserveDeep(e){u3(this._dEH,e)}toJSON(){}},C3=(e,t,n)=>{e.doc??Wo(),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},k3=e=>{e.doc??Wo();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},Xf=(e,t)=>{let n=0,r=e._start;for(e.doc??Wo();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}},S3=(e,t)=>{const n=[];return Xf(e,(r,o)=>{n.push(t(r,o,e))}),n},M7=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}}}},_3=(e,t)=>{e.doc??Wo();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}},Am=(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 Oi(zr(s,ki(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new d0(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 Oi(zr(s,ki(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new z3(new Uint8Array(f))),o.integrate(e,0);break;case Qb:o=new Oi(zr(s,ki(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new j3(f)),o.integrate(e,0);break;default:if(f instanceof Mo)o=new Oi(zr(s,ki(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new sd(f)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},A3=()=>Pl("Length exceeded!"),I3=(e,t,n,r)=>{if(n>t._length)throw A3();if(n===0)return t._searchMarker&&Yf(t._searchMarker,n,r.length),Am(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&&Dl(e,zr(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&Yf(t._searchMarker,o,r.length),Am(e,t,s,r)},L7=(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 Am(e,t,r,n)},E3=(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&&Dl(e,zr(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Dl(e,zr(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw A3();t._searchMarker&&Yf(t._searchMarker,o,-i+r)},Im=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},o0=(e,t,n,r)=>{const o=t._map.get(n)||null,i=e.doc,s=i.clientID;let a;if(r==null)a=new d0([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new d0([r]);break;case Uint8Array:a=new z3(r);break;case Qb:a=new j3(r);break;default:if(r instanceof Mo)a=new sd(r);else throw new Error("Unexpected content type")}new Oi(zr(s,ki(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},i0=(e,t)=>{e.doc??Wo();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},T3=e=>{const t={};return e.doc??Wo(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},x3=(e,t)=>{e.doc??Wo();const n=e._map.get(t);return n!==void 0&&!n.deleted},P7=(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&&rd(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},Em=e=>(e.doc??Wo(),s7(e._map.entries(),t=>!t[1].deleted)),D7=class extends km{},O7=class hv extends Mo{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new hv;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new hv}clone(){const t=new hv;return t.insert(0,this.toArray().map(n=>n instanceof Mo?n.clone():n)),t}get length(){return this.doc??Wo(),this._length}_callObserver(t,n){super._callObserver(t,n),_m(this,t,new D7(this,t))}insert(t,n){this.doc!==null?yr(this.doc,r=>{I3(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?yr(this.doc,n=>{L7(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?yr(this.doc,r=>{E3(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return _3(this,t)}toArray(){return k3(this)}slice(t=0,n=this.length){return C3(this,t,n)}toJSON(){return this.map(t=>t instanceof Mo?t.toJSON():t)}map(t){return S3(this,t)}forEach(t){Xf(this,t)}[Symbol.iterator](){return M7(this)}_write(t){t.writeTypeRef(K7)}},F7=class extends km{constructor(e,t,n){super(e,t),this.keysChanged=n}},s0=class w2 extends Mo{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 w2}clone(){const t=new w2;return this.forEach((n,r)=>{t.set(r,n instanceof Mo?n.clone():n)}),t}_callObserver(t,n){_m(this,t,new F7(this,t,n))}toJSON(){this.doc??Wo();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof Mo?o.toJSON():o}}),t}get size(){return[...Em(this)].length}keys(){return Zb(Em(this),t=>t[0])}values(){return Zb(Em(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return Zb(Em(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??Wo(),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?yr(this.doc,n=>{Im(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?yr(this.doc,r=>{o0(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return i0(this,t)}has(t){return x3(this,t)}clear(){this.doc!==null?yr(this.doc,t=>{this.forEach(function(n,r,o){Im(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(q7)}},Ol=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&lR(e,t),a0=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){this.right===null&&Ua(),this.right.content.constructor===Ko?this.right.deleted||od(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},R3=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===Ko?t.right.deleted||od(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&Dl(e,zr(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},Tm=(e,t,n,r)=>{const o=new Map,i=r?Sm(t,n):null;if(i){const s=new a0(i.p.left,i.p,i.index,o);return R3(e,s,n-i.index)}else{const s=new a0(null,t._start,0,o);return R3(e,s,n)}},M3=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Ko&&Ol(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 Oi(zr(i,ki(o.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,new Ko(a,s));d.integrate(e,0),n.right=d,n.forward()})},od=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},L3=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===Ko&&Ol(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},P3=(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(!Ol(u,l)){s.set(a,u);const{left:d,right:f}=n;n.right=new Oi(zr(i,ki(o.store,i)),d,d&&d.lastId,f,f&&f.id,t,null,new Ko(a,l)),n.right.integrate(e,0),n.forward()}}return s},l0=(e,t,n,r,o)=>{n.currentAttributes.forEach((p,g)=>{o[g]===void 0&&(o[g]=null)});const i=e.doc,s=i.clientID;L3(n,o);const a=P3(e,t,n,o),l=r.constructor===String?new id(r):r instanceof Mo?new sd(r):new xm(r);let{left:u,right:d,index:f}=n;t._searchMarker&&Yf(t._searchMarker,n.index,l.getLength()),d=new Oi(zr(s,ki(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(),M3(e,t,n,a)},D3=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;L3(n,o);const a=P3(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Ko));){if(!n.right.deleted)switch(n.right.content.constructor){case Ko:{const{key:l,value:u}=n.right.content,d=o[l];if(d!==void 0){if(Ol(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&&Dl(e,zr(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 Oi(zr(s,ki(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new id(l)),n.right.integrate(e,0),n.forward()}M3(e,t,n,a)},O3=(e,t,n,r,o)=>{let i=t;const s=Js();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===Ko){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===Ko){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&&od(o,u)}}t=t.right}return a},N7=(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===Ko){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},B7=e=>{let t=0;return yr(e.doc,n=>{let r=e._start,o=e._start,i=Js();const s=Tb(i);for(;o;)o.deleted===!1&&(o.content.constructor===Ko?od(s,o.content):(t+=O3(n,r,o,i,s),i=Tb(s),r=o)),o=o.right}),t},z7=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&&p3(e,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===Ko&&s.constructor!==Fl&&t.add(s.parent)})}yr(n,r=>{r3(e,e.deleteSet,o=>{if(o instanceof Fl||!o.parent._hasFormatting||t.has(o.parent))return;const i=o.parent;o.content.constructor===Ko?t.add(i):N7(r,o)});for(const o of t)B7(o)})},F3=(e,t,n)=>{const r=n,o=Tb(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case sd:case xm:case id:n<t.right.length&&Dl(e,zr(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&O3(e,i,t.right,o,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&Yf(s._searchMarker,t.index,-r+n),t},j7=class extends km{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=[];yr(e,n=>{const r=new Map,o=new Map;let i=this.target._start,s=null;const a={};let l="",u=0,d=0;const f=()=>{if(s!==null){let p=null;switch(s){case"delete":d>0&&(p={delete:d}),d=0;break;case"insert":(typeof l=="object"||l.length>0)&&(p={insert:l},r.size>0&&(p.attributes={},r.forEach((g,m)=>{g!==null&&(p.attributes[m]=g)}))),l="";break;case"retain":u>0&&(p={retain:u},aR(a)||(p.attributes=oR({},a))),u=0;break}p&&t.push(p),s=null}};for(;i!==null;){switch(i.content.constructor){case sd:case xm: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 id: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 Ko:{const{key:p,value:g}=i.content;if(this.adds(i)){if(!this.deletes(i)){const m=r.get(p)??null;Ol(m,g)?g!==null&&i.delete(n):(s==="retain"&&f(),Ol(g,o.get(p)??null)?delete a[p]:a[p]=g)}}else if(this.deletes(i)){o.set(p,g);const m=r.get(p)??null;Ol(m,g)||(s==="retain"&&f(),a[p]=m)}else if(!i.deleted){o.set(p,g);const m=a[p];m!==void 0&&(Ol(m,g)?m!==null&&i.delete(n):(s==="retain"&&f(),g===null?delete a[p]:a[p]=g))}i.deleted||(s==="insert"&&f(),od(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}},V7=class C2 extends Mo{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Wo(),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 C2}clone(){const t=new C2;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new j7(this,t,n);_m(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??Wo();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===id&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?yr(this.doc,r=>{const o=new a0(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)===`
@@ -104,10 +104,10 @@ js: import "konva/skia-backend";
104
104
  `,wI=()=>{if(typeof document>"u")throw new Error(ZV)},Is=class ox{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 ox(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=Be._getRotation(l.rotation),l}},QV="[object Array]",JV="[object Number]",eU="[object String]",tU="[object Boolean]",nU=Math.PI/180,rU=180/Math.PI,hh="#",oU="",iU="0",sU="Konva warning: ",CI="Konva error: ",aU="rgb(",g1={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]},lU=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,og=[],ph=null,cU=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(e){setTimeout(e,16)},Be={_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)===QV},_isNumber(e){return Object.prototype.toString.call(e)===JV&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===eU},_isBoolean(e){return Object.prototype.toString.call(e)===tU},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){og.push(e),og.length===1&&cU(function(){const t=og;og=[],t.forEach(function(n){n()})})},createCanvasElement(){wI();const e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return wI(),document.createElement("img")},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){const n=Be.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(hh,oU);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=iU+e;return hh+e},isCanvasFarblingActive(){if(ph!==null)return ph;if(typeof document>"u")return ph=!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 ph=r,this.releaseCanvas(e),ph},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),hh+this._rgbToHex(e,t,n)},getSnappedHexColor(e){const t=this._hexToRgb(e);return hh+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 g1?(t=g1[e],{r:t[0],g:t[1],b:t[2]}):e[0]===hh?this._hexToRgb(e.substring(1)):e.substr(0,4)===aU?(t=lU.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",Be._namedColorToRBA(e)||Be._hex3ColorToRGBA(e)||Be._hex4ColorToRGBA(e)||Be._hex6ColorToRGBA(e)||Be._hex8ColorToRGBA(e)||Be._rgbColorToRGBA(e)||Be._rgbaColorToRGBA(e)||Be._hslColorToRGBA(e)},_namedColorToRBA(e){const t=g1[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*nU},radToDeg(e){return e*rU},_degToRad(e){return Be.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),Be.degToRad(e)},_radToDeg(e){return Be.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),Be.radToDeg(e)},_getRotation(e){return xt.angleDeg?Be.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw new Error(CI+e)},error(e){console.error(CI+e)},warn(e){xt.showWarnings&&console.warn(sU+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=Be.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=Be._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=Be._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||Be._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(Be._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){xt.releaseCanvasOnDestroy&&e.forEach(t=>{t.width=0,t.height=0})},drawRoundedRectPath(e,t,n,r){let o=t<0?t:0,i=n<0?n:0;t=Math.abs(t),n=Math.abs(n);let s=0,a=0,l=0,u=0;typeof r=="number"?s=a=l=u=Math.min(r,t/2,n/2):(s=Math.min(r[0]||0,t/2,n/2),a=Math.min(r[1]||0,t/2,n/2),u=Math.min(r[2]||0,t/2,n/2),l=Math.min(r[3]||0,t/2,n/2)),e.moveTo(o+s,i),e.lineTo(o+t-a,i),e.arc(o+t-a,i+a,a,Math.PI*3/2,0,!1),e.lineTo(o+t,i+n-u),e.arc(o+t-u,i+n-u,u,0,Math.PI/2,!1),e.lineTo(o+l,i+n),e.arc(o+l,i+n-l,l,Math.PI/2,Math.PI,!1),e.lineTo(o,i+s),e.arc(o+s,i+s,s,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,t,n,r,o){r=Math.abs(r);for(let i=0;i<n;i++){const s=t[(i-1+n)%n],a=t[i],l=t[(i+1)%n],u={x:a.x-s.x,y:a.y-s.y},d={x:l.x-a.x,y:l.y-a.y},f=Math.hypot(u.x,u.y),p=Math.hypot(d.x,d.y);let g;typeof o=="number"?g=o:g=i<o.length?o[i]:0,g=r*Math.cos(Math.PI/n)*Math.min(1,g/r*2);const m={x:u.x/f,y:u.y/f},v={x:d.x/p,y:d.y/p},C={x:a.x-m.x*g,y:a.y-m.y*g},w={x:a.x+v.x*g,y:a.y+v.y*g};i===0?e.moveTo(C.x,C.y):e.lineTo(C.x,C.y),e.arcTo(a.x,a.y,w.x,w.y,g)}}};function uU(e){const t=[],n=e.length,r=Be;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 kI=",",dU="(",fU=")",hU="([",pU="])",mU=";",gU="()",vU="=",SI=["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"],yU=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],bU=100,ig=null;function _I(){if(ig!==null)return ig;try{const e=Be.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(ig=!1,!1)}catch{return ig=!1,!1}}var sg=class{constructor(e){this.canvas=e,xt.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+=gU:Be._isArray(l[0])?o+=hU+l.join(kI)+pU:(t&&(l=l.map(u=>typeof u=="number"?Math.floor(u):u)),o+=dU+l.join(kI)+fU)):(o+=s.property,e||(o+=vU+s.val)),o+=mU;return o}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=bU&&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=SI.length,n=this.setAttr,r,o;const i=function(s){let a=e[s],l;e[s]=function(){return o=uU(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(SI[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)}};yU.forEach(function(e){Object.defineProperty(sg.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var wU=class extends sg{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)}},CU=class extends sg{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()}}},ag;function kU(){if(ag)return ag;const e=Be.createCanvasElement(),t=e.getContext("2d");return ag=(function(){return(xt._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),Be.releaseCanvas(e),ag}var v1=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const t=(e||{}).pixelRatio||xt.pixelRatio||kU();this.pixelRatio=t,this._canvas=Be.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 Be.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}},Wl=class extends v1{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new wU(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},y1=class extends v1{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new CU(this),this.setSize(e.width,e.height)}},Hn={get isDragging(){let e=!1;return Hn._dragElements.forEach(t=>{t.dragStatus==="dragging"&&(e=!0)}),e},justDragged:!1,get node(){let e;return Hn._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];Hn._dragElements.forEach((n,r)=>{const{node:o}=n,i=o.getStage();i.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=Be._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=[];Hn._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")&&(Hn.justDragged=!0,xt._mouseListenClick=!1,xt._touchListenClick=!1,xt._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof xt.Stage&&n.node;i&&t.indexOf(i)===-1&&t.push(i)}),t.forEach(n=>{n.draw()})},_endDragAfter(e){Hn._dragElements.forEach((t,n)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),t.dragStatus!=="dragging"&&Hn._dragElements.delete(n)})}};xt.isBrowser&&(window.addEventListener("mouseup",Hn._endDragBefore,!0),window.addEventListener("touchend",Hn._endDragBefore,!0),window.addEventListener("touchcancel",Hn._endDragBefore,!0),window.addEventListener("mousemove",Hn._drag),window.addEventListener("touchmove",Hn._drag),window.addEventListener("mouseup",Hn._endDragAfter,!1),window.addEventListener("touchend",Hn._endDragAfter,!1),window.addEventListener("touchcancel",Hn._endDragAfter,!1));function Kl(e){return Be._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||Be._isBoolean(e)?e:Object.prototype.toString.call(e)}function AI(e){return e>255?255:e<0?0:Math.round(e)}function It(){if(xt.isUnminified)return function(e,t){return Be._isNumber(e)||Be.warn(Kl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function lg(e){if(xt.isUnminified)return function(t,n){let r=Be._isNumber(t),o=Be._isArray(t)&&t.length==e;return!r&&!o&&Be.warn(Kl(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function b1(){if(xt.isUnminified)return function(e,t){return Be._isNumber(e)||e==="auto"||Be.warn(Kl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function Gc(){if(xt.isUnminified)return function(e,t){return Be._isString(e)||Be.warn(Kl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function II(){if(xt.isUnminified)return function(e,t){const n=Be._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||Be.warn(Kl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function SU(){if(xt.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(Be._isArray(e)?e.forEach(function(r){Be._isNumber(r)||Be.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):Be.warn(Kl(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function Es(){if(xt.isUnminified)return function(e,t){return e===!0||e===!1||Be.warn(Kl(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function _U(e){if(xt.isUnminified)return function(t,n){return t==null||Be.isObject(t)||Be.warn(Kl(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var mh="get",gh="set",be={addGetterSetter(e,t,n,r,o){be.addGetter(e,t,n),be.addSetter(e,t,r,o),be.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){const r=mh+Be._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=gh+Be._capitalize(t);e.prototype[o]||be.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){const o=gh+Be._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=Be._capitalize,a=mh+s(t),l=gh+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=_U(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},be.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){const n=Be._capitalize(t),r=gh+n,o=mh+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(e,t,n,r){Be.error("Adding deprecated "+t);const o=mh+Be._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){Be.error(i);const s=this.attrs[t];return s===void 0?n:s},be.addSetter(e,t,r,function(){Be.error(i)}),be.addOverloadedGetterSetter(e,t)},backCompat(e,t){Be.each(t,function(n,r){const o=e.prototype[r],i=mh+Be._capitalize(n),s=gh+Be._capitalize(n);function a(){o.apply(this,arguments),Be.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 AU(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=xt.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=xt.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=xt.Filters;l&&l.Contrast&&l.Contrast.call(this,s)}}case"grayscale":return function(i){const s=xt.Filters;s&&s.Grayscale&&s.Grayscale.call(this,i)};case"sepia":return function(i){const s=xt.Filters;s&&s.Sepia&&s.Sepia.call(this,i)};case"invert":return function(i){const s=xt.Filters;s&&s.Invert&&s.Invert.call(this,i)};default:Be.warn(`CSS filter "${r}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var cg="absoluteOpacity",EI="allEventListeners",Qa="absoluteTransform",TI="absoluteScale",Wc="canvas",IU="Change",EU="children",TU="konva",w1="listening",xU="mouseenter",RU="mouseleave",MU="pointerenter",LU="pointerleave",PU="touchenter",DU="touchleave",xI="set",RI="Shape",ug=" ",MI="stage",ql="transform",OU="Stage",C1="visible",FU=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(ug),NU=1,Rt=class rp{constructor(t){this._id=NU++,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===ql||t===Qa)&&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===ql||t===Qa)&&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(ug);this.on(o,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Wc)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===Qa&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Wc)){const{scene:t,filter:n,hit:r}=this._cache.get(Wc);Be.releaseCanvas(t._canvas,n._canvas,r._canvas),this._cache.delete(Wc)}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){Be.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const p=Math.abs(Math.round(r.x)-a)>.5?1:0,g=Math.abs(Math.round(r.y)-l)>.5?1:0;o+=u*2+p,i+=u*2+g,a-=u,l-=u;const m=new Wl({pixelRatio:s,width:o,height:i}),v=new Wl({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),C=new y1({pixelRatio:f,width:o,height:i}),w=m.getContext(),_=C.getContext(),b=new Wl({width:m.width/m.pixelRatio+Math.abs(a),height:m.height/m.pixelRatio+Math.abs(l),pixelRatio:m.pixelRatio}),S=b.getContext();return C.isCache=!0,m.isCache=!0,this._cache.delete(Wc),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(m.getContext()._context.imageSmoothingEnabled=!1,v.getContext()._context.imageSmoothingEnabled=!1),w.save(),_.save(),S.save(),w.translate(-a,-l),_.translate(-a,-l),S.translate(-a,-l),b.x=a,b.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(cg),this._clearSelfAndDescendantCache(TI),this.drawScene(m,this,b),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()),Be.releaseCanvas(b._canvas),this._cache.set(Wc,{scene:m,filter:v,hit:C,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Wc)}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"&&_I(),typeof t[p]!="string"||!_I()){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=AU(u)),u.call(this,a),i.putImageData(a,0,0)}catch(p){Be.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(EI),t.length===3)return this._delegate.apply(this,t);const o=n.split(ug);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(ug),o=r.length,i,s,a,l,u,d;if(this._cache&&this._cache.delete(EI),!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=Be.cloneObject(i),i.currentTarget=s[a],r.call(s[a],i)}),this}remove(){return this.isDragging()&&this.stopDrag(),Hn._dragElements.delete(this._id),Hn._dragElements.forEach((t,n)=>{this.isAncestorOf(t.node)&&Hn._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Qa),this._clearSelfAndDescendantCache(cg),this._clearSelfAndDescendantCache(TI),this._clearSelfAndDescendantCache(MI),this._clearSelfAndDescendantCache(C1),this._clearSelfAndDescendantCache(w1)}_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"+Be._capitalize(t);return Be._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!==EU&&(r=xI+Be._capitalize(n),Be._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(w1,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(C1,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;Hn._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(o=!0)});const i=!n&&!xt.hitOnDragEnabled&&(o||xt.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!==RI&&(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!==OU&&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(ql),this._clearSelfAndDescendantCache(Qa)),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 Is,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(ql);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(ql),this._clearSelfAndDescendantCache(Qa),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 Be.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 Be.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 Be.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 Be.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 Be.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Be.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(cg,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=Be.isObject(r)&&!Be._isPlainObject(r)&&!Be._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 Be._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],Be.isValidSelector(i)||(Be.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Be.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Be.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(MI,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(Qa,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let n;if(t)return n=new Is,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(Qa)||new Is,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(ql,this._getTransform)}_getTransform(){var t,n;const r=this._cache.get(ql)||new Is;r.reset();const o=this.x(),i=this.y(),s=xt.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=Be.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(TU)<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 Wl({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 Wl({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,Be._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():xt.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+IU,{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[xI+Be._capitalize(t)];return Be._isFunction(r)?r.call(this,n):this._setAttr(t,n),this}_requestDraw(){if(xt.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,n){const r=this.attrs[t];r===n&&!Be.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===RI&&(n.target=this);const o=[xU,RU,MU,LU,PU,DU];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=rp.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,rp.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;Hn._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){Hn._dragElements.has(this._id)||this._createDragElement(t);const r=Hn._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:Be.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=Hn._dragElements.get(this._id);n&&(n.dragStatus="stopped"),Hn._endDragBefore(t),Hn._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=Hn._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||xt.dragButtons.indexOf(t.evt.button)>=0)||this.isDragging())return;let n=!1;Hn._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=Hn._dragElements.get(this._id),n=t&&t.dragStatus==="dragging",r=t&&t.dragStatus==="ready";n?this.stopDrag():r&&Hn._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 Be.haveIntersection(r,this.getClientRect())}static create(t,n){return Be._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){let r=rp.prototype.getClassName.call(t),o=t.children,i,s,a;n&&(t.attrs.container=n),xt[r]||(Be.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=xt[r];if(i=new l(t.attrs),o)for(s=o.length,a=0;a<s;a++)i.add(rp._createNode(o[a]));return i}};Rt.protoListenerMap=new Map,Rt.prototype.nodeType="Node",Rt.prototype._attrsAffectingSize=[],Rt.prototype.eventListeners={},Rt.prototype.on(FU,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(ql),this._clearSelfAndDescendantCache(Qa)}),Rt.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(C1)}),Rt.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(w1)}),Rt.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(cg)});var ur=be.addGetterSetter;ur(Rt,"zIndex"),ur(Rt,"absolutePosition"),ur(Rt,"position"),ur(Rt,"x",0,It()),ur(Rt,"y",0,It()),ur(Rt,"globalCompositeOperation","source-over",Gc()),ur(Rt,"opacity",1,It()),ur(Rt,"name","",Gc()),ur(Rt,"id","",Gc()),ur(Rt,"rotation",0,It()),be.addComponentsGetterSetter(Rt,"scale",["x","y"]),ur(Rt,"scaleX",1,It()),ur(Rt,"scaleY",1,It()),be.addComponentsGetterSetter(Rt,"skew",["x","y"]),ur(Rt,"skewX",0,It()),ur(Rt,"skewY",0,It()),be.addComponentsGetterSetter(Rt,"offset",["x","y"]),ur(Rt,"offsetX",0,It()),ur(Rt,"offsetY",0,It()),ur(Rt,"dragDistance",void 0,It()),ur(Rt,"width",0,It()),ur(Rt,"height",0,It()),ur(Rt,"listening",!0,Es()),ur(Rt,"preventDefault",!0,Es()),ur(Rt,"filters",void 0,function(e){return this._filterUpToDate=!1,e}),ur(Rt,"visible",!0,Es()),ur(Rt,"transformsEnabled","all",Gc()),ur(Rt,"size"),ur(Rt,"dragBoundFunc"),ur(Rt,"draggable",!1,Es()),be.backCompat(Rt,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Bi=class extends Rt{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=Rt.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=Rt.prototype.clone.call(this,e);return this.getChildren().forEach(function(n){t.add(n.clone())}),t}getAllIntersections(e){const t=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),!this.isCached()&&((t=this.children)===null||t===void 0||t.forEach(function(n){n._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(t,n){t.index=n}),this._requestDraw()}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas(),i=o&&o.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=o&&o.isCache;if(!this.isVisible()&&!l)return this;if(a){i.save();const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(i),i.restore()}else this._drawChildren("drawScene",o,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;const n=this.getLayer(),r=e||n&&n.hitCanvas,o=r&&r.getContext(),i=this._getCanvasCache();if(i&&i.hit){o.save();const s=this.getAbsoluteTransform(t).getMatrix();o.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n,r){var o;const i=t&&t.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=typeof s=="number"&&typeof a=="number"||l,d=n===this;if(u){i.save();const p=this.getAbsoluteTransform(n);let g=p.getMatrix();i.transform(g[0],g[1],g[2],g[3],g[4],g[5]),i.beginPath();let m;if(l)m=l.call(this,i,this);else{const v=this.clipX(),C=this.clipY();i.rect(v||0,C||0,s,a)}i.clip.apply(i,m),g=p.copy().invert().getMatrix(),i.transform(g[0],g[1],g[2],g[3],g[4],g[5])}const f=!d&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";f&&(i.save(),i._applyGlobalCompositeOperation(this)),(o=this.children)===null||o===void 0||o.forEach(function(p){p[e](t,n,r)}),f&&i.restore(),u&&i.restore()}getClientRect(e={}){var t;const n=e.skipTransform,r=e.relativeTo;let o,i,s,a,l={x:1/0,y:1/0,width:0,height:0};const u=this;(t=this.children)===null||t===void 0||t.forEach(function(p){if(!p.visible())return;const g=p.getClientRect({relativeTo:u,skipShadow:e.skipShadow,skipStroke:e.skipStroke});g.width===0&&g.height===0||(o===void 0?(o=g.x,i=g.y,s=g.x+g.width,a=g.y+g.height):(o=Math.min(o,g.x),i=Math.min(i,g.y),s=Math.max(s,g.x+g.width),a=Math.max(a,g.y+g.height)))});const d=this.find("Shape");let f=!1;for(let p=0;p<d.length;p++)if(d[p]._isVisible(this)){f=!0;break}return f&&o!==void 0?l={x:o,y:i,width:s-o,height:a-i}:l={x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,r)}};be.addComponentsGetterSetter(Bi,"clip",["x","y","width","height"]),be.addGetterSetter(Bi,"clipX",void 0,It()),be.addGetterSetter(Bi,"clipY",void 0,It()),be.addGetterSetter(Bi,"clipWidth",void 0,It()),be.addGetterSetter(Bi,"clipHeight",void 0,It()),be.addGetterSetter(Bi,"clipFunc");var vh=new Map,LI=xt._global.PointerEvent!==void 0;function k1(e){return vh.get(e)}function S1(e){return{evt:e,pointerId:e.pointerId}}function PI(e,t){return vh.get(e)===t}function DI(e,t){yh(e),t.getStage()&&(vh.set(e,t),LI&&t._fire("gotpointercapture",S1(new PointerEvent("gotpointercapture"))))}function yh(e,t){const n=vh.get(e);if(!n)return;const r=n.getStage();r&&r.content,vh.delete(e),LI&&n._fire("lostpointercapture",S1(new PointerEvent("lostpointercapture")))}var BU="Stage",zU="string",OI="px",jU="mouseout",FI="mouseleave",NI="mouseover",BI="mouseenter",zI="mousemove",jI="mousedown",VI="mouseup",bh="pointermove",wh="pointerdown",Sd="pointerup",Ch="pointercancel",VU="lostpointercapture",dg="pointerout",kh="pointerleave",fg="pointerover",hg="pointerenter",_1="contextmenu",UI="touchstart",$I="touchend",HI="touchmove",GI="touchcancel",A1="wheel",UU=5,$U=[[BI,"_pointerenter"],[jI,"_pointerdown"],[zI,"_pointermove"],[VI,"_pointerup"],[FI,"_pointerleave"],[UI,"_pointerdown"],[HI,"_pointermove"],[$I,"_pointerup"],[GI,"_pointercancel"],[NI,"_pointerover"],[A1,"_wheel"],[_1,"_contextmenu"],[wh,"_pointerdown"],[bh,"_pointermove"],[Sd,"_pointerup"],[Ch,"_pointercancel"],[kh,"_pointerleave"],[VU,"_lostpointercapture"]],I1={mouse:{[dg]:jU,[kh]:FI,[fg]:NI,[hg]:BI,[bh]:zI,[wh]:jI,[Sd]:VI,[Ch]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[dg]:"touchout",[kh]:"touchleave",[fg]:"touchover",[hg]:"touchenter",[bh]:HI,[wh]:UI,[Sd]:$I,[Ch]:GI,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[dg]:dg,[kh]:kh,[fg]:fg,[hg]:hg,[bh]:bh,[wh]:wh,[Sd]:Sd,[Ch]:Ch,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Sh=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",_d=e=>{const t=Sh(e);if(t==="pointer")return xt.pointerEventsEnabled&&I1.pointer;if(t==="touch")return I1.touch;if(t==="mouse")return I1.mouse};function WI(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&Be.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var HU="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);",_h=[],pg=class extends Bi{constructor(e){super(WI(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),_h.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{WI(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t=e.getType()==="Layer",n=e.getType()==="FastLayer";t||n||Be.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===zU){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"),Bi.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&Be._isInDocument(e)&&this.container().removeChild(e);const t=_h.indexOf(this);return t>-1&&_h.splice(t,1),Be.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}:(Be.warn(HU),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 Wl({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+OI,this.content.style.height=t+OI),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>UU&&Be.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(),xt.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return PI(e,this)}setPointerCapture(e){DI(e,this)}releaseCapture(e){yh(e,this)}getLayers(){return this.children}_bindContentEvents(){xt.isBrowser&&$U.forEach(([e,t])=>{this.content.addEventListener(e,n=>{this[t](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=_d(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=_d(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=_d(e.type),n=Sh(e.type);if(!t)return;this.setPointersPositions(e);const r=this._getTargetShape(n),o=!(xt.isDragging()||xt.isTransforming())||xt.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=_d(e.type),n=Sh(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(o=>{const i=this.getIntersection(o);if(Hn.justDragged=!1,xt["_"+n+"ListenClick"]=!0,!i||!i.isListening()){this[n+"ClickStartShape"]=void 0;return}xt.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=_d(e.type),n=Sh(e.type);if(!t)return;const r=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(xt.isDragging()&&Hn.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(xt.isDragging()||xt.isTransforming())||xt.hitOnDragEnabled))return;const o={};let i=!1;const s=this._getTargetShape(n);this._changedPointerPositions.forEach(a=>{const l=k1(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=_d(e.type),n=Sh(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=k1(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;xt["_"+n+"InDblClickWindow"]?(f=!0,clearTimeout(this[n+"DblTimeout"])):Hn.justDragged||(xt["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){xt["_"+n+"InDblClickWindow"]=!1},xt.dblClickWindow),l&&l.isListening()?(s=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,{...d}),xt["_"+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),xt["_"+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}),xt["_"+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(_1,{evt:e}):this._fire(_1,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(A1,{evt:e}):this._fire(A1,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=k1(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(Sd,S1(e)),yh(e.pointerId)}_lostpointercapture(e){yh(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:Be._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:Be._getFirstPointerId(e)}])}_setPointerPosition(e){Be.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 Wl({width:this.width(),height:this.height()}),this.bufferHitCanvas=new y1({pixelRatio:1,width:this.width(),height:this.height()}),!xt.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 Be.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}};pg.prototype.nodeType=BU,Lr(pg),be.addGetterSetter(pg,"container"),xt.isBrowser&&document.addEventListener("visibilitychange",()=>{_h.forEach(e=>{e.batchDraw()})});var KI="hasShadow",qI="shadowRGBA",YI="patternImage",XI="linearGradient",ZI="radialGradient",mg;function E1(){return mg||(mg=Be.createCanvasElement().getContext("2d"),mg)}var Ah={};function GU(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function WU(e){e.stroke()}function KU(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function qU(e){e.stroke()}function YU(){this._clearCache(KI)}function XU(){this._clearCache(qI)}function ZU(){this._clearCache(YI)}function QU(){this._clearCache(XI)}function JU(){this._clearCache(ZI)}var St=class extends Rt{constructor(e){super(e);let t,n=0;for(;t=Be.getHitColor(),!(t&&!(t in Ah));)if(n++,n>=1e4){Be.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=Be.getRandomColor();break}this.colorKey=t,Ah[t]=this}getContext(){return Be.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Be.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(KI,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(YI,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=E1().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new Is;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(xt.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(XI,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=E1(),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(ZI,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const t=E1(),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(qI,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=Be.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 Rt.prototype.destroy.call(this),delete Ah[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){Be.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}const r=e.skipTransform,o=e.relativeTo||t&&this.getStage()||void 0,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,a=i.width+s,l=i.height+s,u=!e.skipShadow&&this.hasShadow(),d=u?this.shadowOffsetX():0,f=u?this.shadowOffsetY():0,p=a+Math.abs(d),g=l+Math.abs(f),m=u&&this.shadowBlur()||0,v={width:p+m*2,height:g+m*2,x:-(s/2+m)+Math.min(d,0)+i.x,y:-(s/2+m)+Math.min(f,0)+i.y};return r?v:this._transformedRect(v,o)}drawScene(e,t,n){const r=this.getLayer(),o=(e||r.getCanvas()).getContext(),i=this._getCanvasCache(),s=this.getSceneFunc(),a=this.hasShadow();let l;const u=t===this;if(!this.isVisible()&&!u)return this;if(i){o.save();const d=this.getAbsoluteTransform(t).getMatrix();return o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),this._useBufferCanvas()){l=this.getStage();const d=n||l.bufferCanvas,f=d.getContext();n?(f.save(),f.setTransform(1,0,0,1,0,0),f.clearRect(0,0,d.width,d.height),f.restore()):f.clear(),f.save(),f._applyLineJoin(this),f._applyMiterLimit(this);const p=this.getAbsoluteTransform(t).getMatrix();f.transform(p[0],p[1],p[2],p[3],p[4],p[5]),s.call(this,f,this),f.restore();const g=d.pixelRatio;a&&o._applyShadow(this),u||(o._applyOpacity(this),o._applyGlobalCompositeOperation(this)),o.drawImage(d._canvas,d.x||0,d.y||0,d.width/g,d.height/g)}else{if(o._applyLineJoin(this),o._applyMiterLimit(this),!u){const d=this.getAbsoluteTransform(t).getMatrix();o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}a&&o._applyShadow(this),s.call(this,o,this)}return o.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;const r=this.getLayer(),o=e||r.hitCanvas,i=o&&o.getContext(),s=this.hitFunc()||this.sceneFunc(),a=this._getCanvasCache(),l=a&&a.hit;if(this.colorKey||Be.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=Be._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){Be.error("Unable to draw hit graph from cached scene canvas. "+a.message)}return this}hasPointerCapture(e){return PI(e,this)}setPointerCapture(e){DI(e,this)}releaseCapture(e){yh(e,this)}};St.prototype._fillFunc=GU,St.prototype._strokeFunc=WU,St.prototype._fillFuncHit=KU,St.prototype._strokeFuncHit=qU,St.prototype._centroid=!1,St.prototype.nodeType="Shape",Lr(St),St.prototype.eventListeners={},St.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",YU),St.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",XU),St.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",ZU),St.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",QU),St.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",JU),be.addGetterSetter(St,"stroke",void 0,II()),be.addGetterSetter(St,"strokeWidth",2,It()),be.addGetterSetter(St,"fillAfterStrokeEnabled",!1),be.addGetterSetter(St,"hitStrokeWidth","auto",b1()),be.addGetterSetter(St,"strokeHitEnabled",!0,Es()),be.addGetterSetter(St,"perfectDrawEnabled",!0,Es()),be.addGetterSetter(St,"shadowForStrokeEnabled",!0,Es()),be.addGetterSetter(St,"lineJoin"),be.addGetterSetter(St,"lineCap"),be.addGetterSetter(St,"miterLimit"),be.addGetterSetter(St,"sceneFunc"),be.addGetterSetter(St,"hitFunc"),be.addGetterSetter(St,"dash"),be.addGetterSetter(St,"dashOffset",0,It()),be.addGetterSetter(St,"shadowColor",void 0,Gc()),be.addGetterSetter(St,"shadowBlur",0,It()),be.addGetterSetter(St,"shadowOpacity",1,It()),be.addComponentsGetterSetter(St,"shadowOffset",["x","y"]),be.addGetterSetter(St,"shadowOffsetX",0,It()),be.addGetterSetter(St,"shadowOffsetY",0,It()),be.addGetterSetter(St,"fillPatternImage"),be.addGetterSetter(St,"fill",void 0,II()),be.addGetterSetter(St,"fillPatternX",0,It()),be.addGetterSetter(St,"fillPatternY",0,It()),be.addGetterSetter(St,"fillLinearGradientColorStops"),be.addGetterSetter(St,"strokeLinearGradientColorStops"),be.addGetterSetter(St,"fillRadialGradientStartRadius",0),be.addGetterSetter(St,"fillRadialGradientEndRadius",0),be.addGetterSetter(St,"fillRadialGradientColorStops"),be.addGetterSetter(St,"fillPatternRepeat","repeat"),be.addGetterSetter(St,"fillEnabled",!0),be.addGetterSetter(St,"strokeEnabled",!0),be.addGetterSetter(St,"shadowEnabled",!0),be.addGetterSetter(St,"dashEnabled",!0),be.addGetterSetter(St,"strokeScaleEnabled",!0),be.addGetterSetter(St,"fillPriority","color"),be.addComponentsGetterSetter(St,"fillPatternOffset",["x","y"]),be.addGetterSetter(St,"fillPatternOffsetX",0,It()),be.addGetterSetter(St,"fillPatternOffsetY",0,It()),be.addComponentsGetterSetter(St,"fillPatternScale",["x","y"]),be.addGetterSetter(St,"fillPatternScaleX",1,It()),be.addGetterSetter(St,"fillPatternScaleY",1,It()),be.addComponentsGetterSetter(St,"fillLinearGradientStartPoint",["x","y"]),be.addComponentsGetterSetter(St,"strokeLinearGradientStartPoint",["x","y"]),be.addGetterSetter(St,"fillLinearGradientStartPointX",0),be.addGetterSetter(St,"strokeLinearGradientStartPointX",0),be.addGetterSetter(St,"fillLinearGradientStartPointY",0),be.addGetterSetter(St,"strokeLinearGradientStartPointY",0),be.addComponentsGetterSetter(St,"fillLinearGradientEndPoint",["x","y"]),be.addComponentsGetterSetter(St,"strokeLinearGradientEndPoint",["x","y"]),be.addGetterSetter(St,"fillLinearGradientEndPointX",0),be.addGetterSetter(St,"strokeLinearGradientEndPointX",0),be.addGetterSetter(St,"fillLinearGradientEndPointY",0),be.addGetterSetter(St,"strokeLinearGradientEndPointY",0),be.addComponentsGetterSetter(St,"fillRadialGradientStartPoint",["x","y"]),be.addGetterSetter(St,"fillRadialGradientStartPointX",0),be.addGetterSetter(St,"fillRadialGradientStartPointY",0),be.addComponentsGetterSetter(St,"fillRadialGradientEndPoint",["x","y"]),be.addGetterSetter(St,"fillRadialGradientEndPointX",0),be.addGetterSetter(St,"fillRadialGradientEndPointY",0),be.addGetterSetter(St,"fillPatternRotation",0),be.addGetterSetter(St,"fillRule",void 0,Gc()),be.backCompat(St,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var e$="beforeDraw",t$="draw",QI=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],n$=QI.length,Kc=class extends Bi{constructor(e){super(e),this.canvas=new Wl,this.hitCanvas=new y1({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(){Rt.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(!Rt.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(Rt.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(Rt.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 Rt.prototype.remove.call(this),e&&e.parentNode&&Be._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"&&Be.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(),Rt.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(){Be.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Be.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Be.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<n$;r++){const o=QI[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=Ah[Be.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(e$,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),Bi.prototype.drawScene.call(this,o,t,n),this._fire(t$,{node:this}),this}drawHit(e,t){const n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Bi.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Be.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Be.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 Be.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Kc.prototype.nodeType="Layer",Lr(Kc),be.addGetterSetter(Kc,"imageSmoothingEnabled",!0),be.addGetterSetter(Kc,"clearBeforeDraw",!0),be.addGetterSetter(Kc,"hitGraphEnabled",!0,Es());var T1=class extends Kc{constructor(e){super(e),this.listening(!1),Be.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};T1.prototype.nodeType="FastLayer",Lr(T1);var Ad=class extends Bi{_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Be.throw("You may only add groups and shapes to groups.")}};Ad.prototype.nodeType="Group",Lr(Ad);var x1=(function(){return Hc.performance&&Hc.performance.now?function(){return Hc.performance.now()}:function(){return new Date().getTime()}})(),Id=class Yd{constructor(t,n){this.id=Yd.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:x1(),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=Yd.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=x1(),Yd._addAnimation(this),this}stop(){return Yd._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(x1());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=Yd;t.animations.length?(t._runFrames(),Be.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Be.requestAnimFrame(this._animationLoop))}};Id.animations=[],Id.animIdCounter=0,Id.animRunning=!1;var r$={node:1,duration:1,easing:1,onFinish:1,yoyo:1},o$=1,JI=2,eE=3,tE=["fill","stroke","shadowColor"],i$=0,s$=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=JI,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=eE,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===JI?this.setTime(e):this.state===eE&&this.setTime(this.duration-e)}pause(){this.state=o$,this.fire("onPause")}getTimer(){return new Date().getTime()}},gg=class Gr{constructor(t){const n=this,r=t.node,o=r._id,i=t.easing||Ih.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=i$++;const u=r.getLayer()||(r instanceof xt.Stage?r.getLayers():null);u||Be.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Id(function(){n.tween.onEnterFrame()},u),this.tween=new s$(l,function(d){n._tweenFunc(d)},i,0,1,a*1e3,s),this._addListeners(),Gr.attrs[o]||(Gr.attrs[o]={}),Gr.attrs[o][this._id]||(Gr.attrs[o][this._id]={}),Gr.tweens[o]||(Gr.tweens[o]={});for(l in t)r$[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=Gr.tweens[o][t];d&&delete Gr.attrs[o][d][t];let f=r.getAttr(t);if(Be._isArray(n))if(i=[],s=Math.max(n.length,f.length),t==="points"&&n.length!==f.length&&(n.length>f.length?(l=f,f=Be._prepareArrayForTween(f,n,r.closed())):(a=n,n=Be._prepareArrayForTween(n,f,r.closed()))),t.indexOf("fill")===0)for(let p=0;p<s;p++)if(p%2===0)i.push(n[p]-f[p]);else{const g=Be.colorToRGBA(f[p]);u=Be.colorToRGBA(n[p]),f[p]=g,i.push({r:u.r-g.r,g:u.g-g.g,b:u.b-g.b,a:u.a-g.a})}else for(let p=0;p<s;p++)i.push(n[p]-f[p]);else tE.indexOf(t)!==-1?(f=Be.colorToRGBA(f),u=Be.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;Gr.attrs[o][this._id][t]={start:f,diff:i,end:n,trueEnd:a,trueStart:l},Gr.tweens[o][t]=this._id}_tweenFunc(t){const n=this.node,r=Gr.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,Be._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 tE.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=Gr.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=Gr.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=Gr.tweens[t];this.pause(),this.anim&&this.anim.stop();for(const o in r)delete Gr.tweens[t][o];delete Gr.attrs[t][n],Gr.tweens[t]&&(Object.keys(Gr.tweens[t]).length===0&&delete Gr.tweens[t],Object.keys(Gr.attrs[t]).length===0&&delete Gr.attrs[t])}};gg.attrs={},gg.tweens={},Rt.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new gg(e).play()};var Ih={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-Ih.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?Ih.BounceEaseIn(e*2,0,n,r)*.5+t:Ih.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}},nE=Be._assign(xt,{Util:Be,Transform:Is,Node:Rt,Container:Bi,Stage:pg,stages:_h,Layer:Kc,FastLayer:T1,Group:Ad,DD:Hn,Shape:St,shapes:Ah,Animation:Id,Tween:gg,Easings:Ih,Context:sg,Canvas:v1}),Ja=class extends St{_sceneFunc(e){const t=xt.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=xt.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}}};Ja.prototype._centroid=!0,Ja.prototype.className="Arc",Ja.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],Lr(Ja),be.addGetterSetter(Ja,"innerRadius",0,It()),be.addGetterSetter(Ja,"outerRadius",0,It()),be.addGetterSetter(Ja,"angle",0,It()),be.addGetterSetter(Ja,"clockwise",!1,Es());function R1(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 rE(e,t){const n=e.length,r=[];for(let o=2;o<n-2;o+=2){const i=R1(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 a$(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 el=class extends St{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():rE(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),t=e.length,n=this.tension(),r=R1(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),o=R1(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),i=rE(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],...a$(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}}};el.prototype.className="Line",el.prototype._attrsAffectingSize=["points","bezier","tension"],Lr(el),be.addGetterSetter(el,"closed",!1),be.addGetterSetter(el,"bezier",!1),be.addGetterSetter(el,"tension",0,It()),be.addGetterSetter(el,"points",[],SU());var l$=[[],[],[-.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]],c$=[[],[],[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]],u$=[[1],[1,1],[1,2,1],[1,3,3,1]],oE=(e,t,n)=>{let r,o;const s=n/2;r=0;for(let a=0;a<20;a++)o=s*l$[20][a]+s,r+=c$[20][a]*d$(e,t,o);return s*r},iE=(e,t,n)=>{n===void 0&&(n=1);const r=e[0]-2*e[1]+e[2],o=t[0]-2*t[1]+t[2],i=2*e[1]-2*e[0],s=2*t[1]-2*t[0],a=4*(r*r+o*o),l=4*(r*i+o*s),u=i*i+s*s;if(a===0)return n*Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(t[2]-t[0],2));const d=l/(2*a),f=u/a,p=n+d,g=f-d*d,m=p*p+g>0?Math.sqrt(p*p+g):0,v=d*d+g>0?Math.sqrt(d*d+g):0,C=d+Math.sqrt(d*d+g)!==0?g*Math.log(Math.abs((p+m)/(d+v))):0;return Math.sqrt(a)/2*(p*m-d*v+C)};function d$(e,t,n){const r=M1(1,n,e),o=M1(1,n,t),i=r*r+o*o;return Math.sqrt(i)}var M1=(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+=u$[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 M1(e-1,t,o)}},sE=(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},is=class Ei extends St{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Ei.parsePathData(this.data()),this.pathLength=Ei.getPathLength(this.dataArray)}_sceneFunc(t){const n=this.dataArray;t.beginPath();let r=!1;for(let o=0;o<n.length;o++){const i=n[o].command,s=n[o].points;switch(i){case"L":t.lineTo(s[0],s[1]);break;case"M":t.moveTo(s[0],s[1]);break;case"C":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"Q":t.quadraticCurveTo(s[0],s[1],s[2],s[3]);break;case"A":const a=s[0],l=s[1],u=s[2],d=s[3],f=s[4],p=s[5],g=s[6],m=s[7],v=u>d?u:d,C=u>d?1:u/d,w=u>d?d/u:1;t.translate(a,l),t.rotate(g),t.scale(C,w),t.arc(0,0,v,f,f+p,1-m),t.scale(1/C,1/w),t.rotate(-g),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(l){if(l.command==="A"){const u=l.points[4],d=l.points[5],f=l.points[4]+d;let p=Math.PI/180;if(Math.abs(u-f)<p&&(p=Math.abs(u-f)),d<0)for(let g=u-p;g>f;g-=p){const m=Ei.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(m.x,m.y)}else for(let g=u+p;g<f;g+=p){const m=Ei.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(m.x,m.y)}}else if(l.command==="C")for(let u=0;u<=1;u+=.01){const d=Ei.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 Ei.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 Ei.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return Ei.getPointOnCubicBezier(sE(t,Ei.getPathLength(n),v=>oE([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 Ei.getPointOnQuadraticBezier(sE(t,Ei.getPathLength(n),v=>iE([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":const l=a[0],u=a[1],d=a[2],f=a[3],p=a[5],g=a[6];let m=a[4];return m+=p*t/s.pathLength,Ei.getPointOnEllipticalArc(l,u,d,f,m,g)}return null}static getPointOnLine(t,n,r,o,i,s,a){s=s??n,a=a??r;const l=this.getLineLength(n,r,o,i);if(l<1e-10)return{x:n,y:r};if(o===n)return{x:s,y:a+(i>r?t:-t)};const u=(i-r)/(o-n),d=Math.sqrt(t*t/(1+u*u))*(o<n?-1:1),f=u*d;if(Math.abs(a-r-u*(s-n))<1e-10)return{x:s+d,y:a+f};const p=((s-n)*(o-n)+(a-r)*(i-r))/(l*l),g=n+p*(o-n),m=r+p*(i-r),v=this.getLineLength(s,a,g,m),C=Math.sqrt(t*t-v*v),w=Math.sqrt(C*C/(1+u*u))*(o<n?-1:1),_=u*w;return{x:g+w,y:m+_}}static getPointOnCubicBezier(t,n,r,o,i,s,a,l,u){function d(m){return m*m*m}function f(m){return 3*m*m*(1-m)}function p(m){return 3*m*(1-m)*(1-m)}function g(m){return(1-m)*(1-m)*(1-m)}return{x:l*d(t)+s*f(t)+o*p(t)+n*g(t),y:u*d(t)+a*f(t)+i*p(t)+r*g(t)}}static getPointOnQuadraticBezier(t,n,r,o,i,s,a){function l(f){return f*f}function u(f){return 2*f*(1-f)}function d(f){return(1-f)*(1-f)}return{x:s*l(t)+o*u(t)+n*d(t),y:a*l(t)+i*u(t)+r*d(t)}}static getPointOnEllipticalArc(t,n,r,o,i,s){const a=Math.cos(s),l=Math.sin(s),u={x:r*Math.cos(i),y:o*Math.sin(i)};return{x:t+(u.x*a-u.y*l),y:n+(u.x*l+u.y*a)}}static parsePathData(t){if(!t)return[];let n=t;const r=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let f=0;f<r.length;f++)n=n.replace(new RegExp(r[f],"g"),"|"+r[f]);const o=n.split("|"),i=[],s=[];let a=0,l=0;const u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let d;for(let f=1;f<o.length;f++){let p=o[f],g=p.charAt(0);for(p=p.slice(1),s.length=0;d=u.exec(p);)s.push(d[0]);let m=[],v=g==="A"||g==="a"?0:-1;for(let C=0,w=s.length;C<w;C++){const _=s[C];if(_==="00"){m.push(0,0),v>=0&&(v+=2,v>=7&&(v-=7));continue}if(v>=0){if(v===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(_)){m.push(parseInt(_[0],10)),m.push(parseInt(_[1],10)),m.push(parseFloat(_.slice(2))),v+=3,v>=7&&(v-=7);continue}if(_==="11"||_==="10"||_==="01"){m.push(parseInt(_[0],10)),m.push(parseInt(_[1],10)),v+=2,v>=7&&(v-=7);continue}if(_==="0"||_==="1"){m.push(parseInt(_,10)),v+=1,v>=7&&(v-=7);continue}}else if(v===4){if(/^[01]\d+(?:\.\d+)?$/.test(_)){m.push(parseInt(_[0],10)),m.push(parseFloat(_.slice(1))),v+=2,v>=7&&(v-=7);continue}if(_==="0"||_==="1"){m.push(parseInt(_,10)),v+=1,v>=7&&(v-=7);continue}}const b=parseFloat(_);isNaN(b)?m.push(0):m.push(b),v+=1,v>=7&&(v-=7)}else{const b=parseFloat(_);isNaN(b)?m.push(0):m.push(b)}}for(;m.length>0&&!isNaN(m[0]);){let C="",w=[];const _=a,b=l;let S,x,L,B,q,F,P,U,T,V;switch(g){case"l":a+=m.shift(),l+=m.shift(),C="L",w.push(a,l);break;case"L":a=m.shift(),l=m.shift(),w.push(a,l);break;case"m":const R=m.shift(),$=m.shift();if(a+=R,l+=$,C="M",i.length>2&&i[i.length-1].command==="z"){for(let se=i.length-2;se>=0;se--)if(i[se].command==="M"){a=i[se].points[0]+R,l=i[se].points[1]+$;break}}w.push(a,l),g="l";break;case"M":a=m.shift(),l=m.shift(),C="M",w.push(a,l),g="L";break;case"h":a+=m.shift(),C="L",w.push(a,l);break;case"H":a=m.shift(),C="L",w.push(a,l);break;case"v":l+=m.shift(),C="L",w.push(a,l);break;case"V":l=m.shift(),C="L",w.push(a,l);break;case"C":w.push(m.shift(),m.shift(),m.shift(),m.shift()),a=m.shift(),l=m.shift(),w.push(a,l);break;case"c":w.push(a+m.shift(),l+m.shift(),a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),C="C",w.push(a,l);break;case"S":x=a,L=l,S=i[i.length-1],S.command==="C"&&(x=a+(a-S.points[2]),L=l+(l-S.points[3])),w.push(x,L,m.shift(),m.shift()),a=m.shift(),l=m.shift(),C="C",w.push(a,l);break;case"s":x=a,L=l,S=i[i.length-1],S.command==="C"&&(x=a+(a-S.points[2]),L=l+(l-S.points[3])),w.push(x,L,a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),C="C",w.push(a,l);break;case"Q":w.push(m.shift(),m.shift()),a=m.shift(),l=m.shift(),w.push(a,l);break;case"q":w.push(a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),C="Q",w.push(a,l);break;case"T":x=a,L=l,S=i[i.length-1],S.command==="Q"&&(x=a+(a-S.points[0]),L=l+(l-S.points[1])),a=m.shift(),l=m.shift(),C="Q",w.push(x,L,a,l);break;case"t":x=a,L=l,S=i[i.length-1],S.command==="Q"&&(x=a+(a-S.points[0]),L=l+(l-S.points[1])),a+=m.shift(),l+=m.shift(),C="Q",w.push(x,L,a,l);break;case"A":B=m.shift(),q=m.shift(),F=m.shift(),P=m.shift(),U=m.shift(),T=a,V=l,a=m.shift(),l=m.shift(),C="A",w=this.convertEndpointToCenterParameterization(T,V,a,l,P,U,B,q,F);break;case"a":B=m.shift(),q=m.shift(),F=m.shift(),P=m.shift(),U=m.shift(),T=a,V=l,a+=m.shift(),l+=m.shift(),C="A",w=this.convertEndpointToCenterParameterization(T,V,a,l,P,U,B,q,F);break}i.push({command:C||g,points:w,start:{x:_,y:b},pathLength:this.calcLength(_,b,C||g,w)})}(g==="z"||g==="Z")&&i.push({command:"z",points:[],start:void 0,pathLength:0})}return i}static calcLength(t,n,r,o){let i,s,a,l;const u=Ei;switch(r){case"L":return u.getLineLength(t,n,o[0],o[1]);case"C":return oE([t,o[0],o[2],o[4]],[n,o[1],o[3],o[5]],1);case"Q":return iE([t,o[0],o[2]],[n,o[1],o[3]],1);case"A":i=0;const d=o[4],f=o[5],p=o[4]+f;let g=Math.PI/180;if(Math.abs(d-p)<g&&(g=Math.abs(d-p)),s=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],d,0),f<0)for(l=d-g;l>p;l-=g)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=d+g;l<p;l+=g)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;return a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],p,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),i}return 0}static convertEndpointToCenterParameterization(t,n,r,o,i,s,a,l,u){const d=u*(Math.PI/180),f=Math.cos(d)*(t-r)/2+Math.sin(d)*(n-o)/2,p=-1*Math.sin(d)*(t-r)/2+Math.cos(d)*(n-o)/2,g=f*f/(a*a)+p*p/(l*l);g>1&&(a*=Math.sqrt(g),l*=Math.sqrt(g));let m=Math.sqrt((a*a*(l*l)-a*a*(p*p)-l*l*(f*f))/(a*a*(p*p)+l*l*(f*f)));i===s&&(m*=-1),isNaN(m)&&(m=0);const v=m*a*p/l,C=m*-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,b=function(P){return Math.sqrt(P[0]*P[0]+P[1]*P[1])},S=function(P,U){return(P[0]*U[0]+P[1]*U[1])/(b(P)*b(U))},x=function(P,U){return(P[0]*U[1]<P[1]*U[0]?-1:1)*Math.acos(S(P,U))},L=x([1,0],[(f-v)/a,(p-C)/l]),B=[(f-v)/a,(p-C)/l],q=[(-1*f-v)/a,(-1*p-C)/l];let F=x(B,q);return S(B,q)<=-1&&(F=Math.PI),S(B,q)>=1&&(F=0),s===0&&F>0&&(F=F-2*Math.PI),s===1&&F<0&&(F=F+2*Math.PI),[w,_,a,l,L,F,d,s]}};is.prototype.className="Path",is.prototype._attrsAffectingSize=["data"],Lr(is),be.addGetterSetter(is,"data");var qc=class extends el{_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=is.calcLength(r[r.length-4],r[r.length-3],"C",f),g=is.getPointOnQuadraticBezier(Math.min(1,1-i/p),f[0],f[1],f[2],f[3],f[4],f[5]);a=n[s-2]-g.x,l=n[s-1]-g.y}else a=n[s-2]-n[s-4],l=n[s-1]-n[s-3];const u=(Math.atan2(l,a)+t)%t,d=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(u),e.moveTo(0,0),e.lineTo(-i,d/2),e.lineTo(-i,-d/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),o?(a=(r[0]+r[2])/2-n[0],l=(r[1]+r[3])/2-n[1]):(a=n[2]-n[0],l=n[3]-n[1]),e.rotate((Math.atan2(-l,-a)+t)%t),e.moveTo(0,0),e.lineTo(-i,d/2),e.lineTo(-i,-d/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x,y:e.y-t,width:e.width,height:e.height+t*2}}};qc.prototype.className="Arrow",Lr(qc),be.addGetterSetter(qc,"pointerLength",10,It()),be.addGetterSetter(qc,"pointerWidth",10,It()),be.addGetterSetter(qc,"pointerAtBeginning",!1),be.addGetterSetter(qc,"pointerAtEnding",!0);var Ed=class extends St{_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)}};Ed.prototype._centroid=!0,Ed.prototype.className="Circle",Ed.prototype._attrsAffectingSize=["radius"],Lr(Ed),be.addGetterSetter(Ed,"radius",0,It());var Yl=class extends St{_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)}};Yl.prototype.className="Ellipse",Yl.prototype._centroid=!0,Yl.prototype._attrsAffectingSize=["radiusX","radiusY"],Lr(Yl),be.addComponentsGetterSetter(Yl,"radius",["x","y"]),be.addGetterSetter(Yl,"radiusX",0,It()),be.addGetterSetter(Yl,"radiusY",0,It());var Ts=class ix extends St{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?Be.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?Be.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=Be.createImageElement();o.onload=function(){n(new ix({image:o}))},o.onerror=r,o.crossOrigin="Anonymous",o.src=t}};Ts.prototype.className="Image",Ts.prototype._attrsAffectingSize=["image"],Lr(Ts),be.addGetterSetter(Ts,"cornerRadius",0,lg(4)),be.addGetterSetter(Ts,"image"),be.addComponentsGetterSetter(Ts,"crop",["x","y","width","height"]),be.addGetterSetter(Ts,"cropX",0,It()),be.addGetterSetter(Ts,"cropY",0,It()),be.addGetterSetter(Ts,"cropWidth",0,It()),be.addGetterSetter(Ts,"cropHeight",0,It());var aE=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],f$="Change.konva",h$="none",L1="up",P1="right",D1="down",O1="left",p$=aE.length,F1=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<p$;n++)e.on(aE[n]+f$,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 L1:s=n/2,a=-1*l;break;case P1:s=n+i,a=r/2;break;case D1:s=n/2,a=r+l;break;case O1: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})}}};F1.prototype.className="Label",Lr(F1);var Yc=class extends St{_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===L1&&(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===P1&&(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===D1&&(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===O1&&(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===L1?(t-=r,s+=r):o===D1?s+=r:o===O1?(e-=n*1.5,i+=n):o===P1&&(i+=n*1.5),{x:e,y:t,width:i,height:s}}};Yc.prototype.className="Tag",Lr(Yc),be.addGetterSetter(Yc,"pointerDirection",h$),be.addGetterSetter(Yc,"pointerWidth",0,It()),be.addGetterSetter(Yc,"pointerHeight",0,It()),be.addGetterSetter(Yc,"cornerRadius",0,lg(4));var Eh=class extends St{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?Be.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};Eh.prototype.className="Rect",Lr(Eh),be.addGetterSetter(Eh,"cornerRadius",0,lg(4));var Xl=class extends St{_sceneFunc(e){const t=this._getPoints(),n=this.radius(),r=this.sides(),o=this.cornerRadius();if(e.beginPath(),o)Be.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)}};Xl.prototype.className="RegularPolygon",Xl.prototype._centroid=!0,Xl.prototype._attrsAffectingSize=["radius"],Lr(Xl),be.addGetterSetter(Xl,"radius",0,It()),be.addGetterSetter(Xl,"sides",0,It()),be.addGetterSetter(Xl,"cornerRadius",0,lg(4));var lE=Math.PI*2,Xc=class extends St{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,lE,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),lE,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)}};Xc.prototype.className="Ring",Xc.prototype._centroid=!0,Xc.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Lr(Xc),be.addGetterSetter(Xc,"innerRadius",0,It()),be.addGetterSetter(Xc,"outerRadius",0,It());var la=class extends St{constructor(e){super(e),this._updated=!0,this.anim=new Id(()=>{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)}};la.prototype.className="Sprite",Lr(la),be.addGetterSetter(la,"animation"),be.addGetterSetter(la,"animations"),be.addGetterSetter(la,"frameOffsets"),be.addGetterSetter(la,"image"),be.addGetterSetter(la,"frameIndex",0,It()),be.addGetterSetter(la,"frameRate",17,It()),be.backCompat(la,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Zl=class extends St{_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"],Lr(Zl),be.addGetterSetter(Zl,"numPoints",5,It()),be.addGetterSetter(Zl,"innerRadius",0,It()),be.addGetterSetter(Zl,"outerRadius",0,It());function Ql(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 Td="auto",m$="center",cE="inherit",Th="justify",g$="Change.konva",uE="2d",dE="-",fE="left",v$="text",y$="Text",b$="top",w$="bottom",hE="middle",pE="normal",C$="px ",vg=" ",k$="right",mE="rtl",S$="word",_$="char",gE="none",N1="…",vE=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],A$=vE.length,xh=null;function I$(){if(xh!==null)return xh;xh=!1;try{const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext(uE);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){xh=!0;break}}}catch{}return xh}function E$(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 yg;function B1(){return yg||(yg=Be.createCanvasElement().getContext(uE),yg)}function T$(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function x$(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function R$(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}var pr=class extends St{constructor(e){super(R$(e)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<A$;t++)this.on(vE[t]+g$,this._setTextData);this._setTextData()}_sceneFunc(e){var t,n;const r=this.textArr,o=r.length;if(!this.text())return;let i=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,l=this.verticalAlign(),u=this.direction(),d=0,f=this.align(),p=this.getWidth(),g=this.letterSpacing(),m=this.charRenderFunc(),v=this.fill(),C=this.textDecoration(),w=this.underlineOffset(),_=C.indexOf("underline")!==-1,b=C.indexOf("line-through")!==-1,S;u=u===cE?e.direction:u;let x=a/2,L=hE;if(!xt.legacyTextRendering){const B=this.measureSize("M");L="alphabetic",x=(((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===mE&&e.setAttr("direction",u),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",L),e.setAttr("textAlign",fE),l===hE?d=(this.getHeight()-o*a-i*2)/2:l===w$&&(d=this.getHeight()-o*a-i*2),e.translate(i,d+i),S=0;S<o;S++){let B=0,q=0;const F=r[S],P=F.text,U=F.width,T=F.lastInParagraph;if(e.save(),f===k$?B+=p-U-i*2:f===m$&&(B+=(p-U-i*2)/2),_){e.save(),e.beginPath();const R=w??(xt.legacyTextRendering?Math.round(s/2):Math.round(s/4)),$=B,se=x+q+R;e.moveTo($,se);const X=f===Th&&!T?p-i*2:U;e.lineTo($+Math.round(X),se),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}const V=B;if(u!==mE&&(g!==0||f===Th||m)){const R=P.split(" ").length-1,$=Ql(P);for(let se=0;se<$.length;se++){const X=$[se];if(X===" "&&!T&&f===Th&&(B+=(p-i*2-U)/R),this._partialTextX=B,this._partialTextY=x+q,this._partialText=X,m){e.save();const J=r.slice(0,S).reduce((W,Te)=>W+Ql(Te.text).length,0);m({char:X,index:se+J,x:B,y:x+q,lineIndex:S,column:se,isLastInLine:T,width:this.measureSize(X).width,context:e})}e.fillStrokeShape(this),m&&e.restore(),B+=this.measureSize(X).width+g}}else g!==0&&e.setAttr("letterSpacing",`${g}px`),this._partialTextX=B,this._partialTextY=x+q,this._partialText=P,e.fillStrokeShape(this);if(b){e.save(),e.beginPath();const R=xt.legacyTextRendering?0:-Math.round(s/4),$=V;e.moveTo($,x+q+R);const se=f===Th&&!T?p-i*2:U;e.lineTo($+Math.round(se),x+q+R),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}e.restore(),o>1&&(x+=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=Be._isString(e)?e:e==null?"":e+"";return this._setAttr(v$,t),this}getWidth(){return this.attrs.width===Td||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Td||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Be.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=B1(),g=this.fontSize(),m;p.save(),p.font=this._getContextFont(),m=p.measureText(e),p.restore();const v=g/100;return{actualBoundingBoxAscent:(t=m.actualBoundingBoxAscent)!==null&&t!==void 0?t:71.58203125*v,actualBoundingBoxDescent:(n=m.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(r=m.actualBoundingBoxLeft)!==null&&r!==void 0?r:-7.421875*v,actualBoundingBoxRight:(o=m.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*v,alphabeticBaseline:(i=m.alphabeticBaseline)!==null&&i!==void 0?i:0,emHeightAscent:(s=m.emHeightAscent)!==null&&s!==void 0?s:100*v,emHeightDescent:(a=m.emHeightDescent)!==null&&a!==void 0?a:-20*v,fontBoundingBoxAscent:(l=m.fontBoundingBoxAscent)!==null&&l!==void 0?l:91*v,fontBoundingBoxDescent:(u=m.fontBoundingBoxDescent)!==null&&u!==void 0?u:21*v,hangingBaseline:(d=m.hangingBaseline)!==null&&d!==void 0?d:72.80000305175781*v,ideographicBaseline:(f=m.ideographicBaseline)!==null&&f!==void 0?f:-21*v,width:m.width,height:g}}_getContextFont(){return this.fontStyle()+vg+this.fontVariant()+vg+(this.fontSize()+C$)+E$(this.fontFamily())}_addTextLine(e){this.align()===Th&&(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 B1().measureText(e).width+t*n}_setTextData(){let e=this.text().split(`
105
105
  `),t=+this.fontSize(),n=0,r=this.lineHeight()*t,o=this.attrs.width,i=this.attrs.height,s=o!==Td&&o!==void 0,a=i!==Td&&i!==void 0,l=this.padding(),u=o-l*2,d=i-l*2,f=0,p=this.wrap(),g=p!==_$&&p!==gE,m=this.ellipsis();this.textArr=[],B1().font=this._getContextFont();const v=m?this._getTextWidth(N1):0;for(let C=0,w=e.length;C<w;++C){let _=e[C],b=this._getTextWidth(_);if(s&&b>u)for(;_.length>0;){let S=0,x=Ql(_).length,L="",B=0;for(;S<x;){const q=S+x>>>1,F=Ql(_).slice(0,q+1).join(""),P=this._getTextWidth(F);(m&&a&&f+r>d?P+v:P)<=u?(S=q+1,L=F,B=P):x=q}if(L){if(g){const q=Ql(_),F=Ql(L),P=q[F.length],U=P===vg||P===dE;let T;if(U&&B<=u)T=F.length;else{const V=F.lastIndexOf(vg),R=F.lastIndexOf(dE);T=Math.max(V,R)+1}T>0&&(S=T,L=q.slice(0,S).join(""),B=this._getTextWidth(L))}if(L=L.trimRight(),this._addTextLine(L),n=Math.max(n,B),f+=r,this._shouldHandleEllipsis(f)){this._tryToAddEllipsisToLastLine();break}if(_=Ql(_).slice(S).join("").trimLeft(),_.length>0&&(b=this._getTextWidth(_),b<=u)){this._addTextLine(_),f+=r,n=Math.max(n,b);break}}else break}else this._addTextLine(_),f+=r,n=Math.max(n,b),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!==Td&&r!==void 0,i=r-this.padding()*2;return this.wrap()===gE||o&&e+n>i}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==Td&&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+N1)<n||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+N1))}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&&I$()?!0:super._useBufferCanvas()}};pr.prototype._fillFunc=T$,pr.prototype._strokeFunc=x$,pr.prototype.className=y$,pr.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],Lr(pr),be.overWriteSetter(pr,"width",b1()),be.overWriteSetter(pr,"height",b1()),be.addGetterSetter(pr,"direction",cE),be.addGetterSetter(pr,"fontFamily","Arial"),be.addGetterSetter(pr,"fontSize",12,It()),be.addGetterSetter(pr,"fontStyle",pE),be.addGetterSetter(pr,"fontVariant",pE),be.addGetterSetter(pr,"padding",0,It()),be.addGetterSetter(pr,"align",fE),be.addGetterSetter(pr,"verticalAlign",b$),be.addGetterSetter(pr,"lineHeight",1,It()),be.addGetterSetter(pr,"wrap",S$),be.addGetterSetter(pr,"ellipsis",!1,Es()),be.addGetterSetter(pr,"letterSpacing",0,It()),be.addGetterSetter(pr,"text","",Gc()),be.addGetterSetter(pr,"textDecoration",""),be.addGetterSetter(pr,"underlineOffset",void 0,It()),be.addGetterSetter(pr,"charRenderFunc",void 0);var M$="",yE="normal";function bE(e){e.fillText(this.partialText,0,0)}function wE(e){e.strokeText(this.partialText,0,0)}var so=class extends St{constructor(e){super(e),this.dummyCanvas=Be.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 is.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:is.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=is.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 Be.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return pr.prototype.setText.call(this,e)}_getContextFont(){return pr.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=Ql(this.text()),t=[];let n=0;for(let p=0;p<e.length;p++)t.push({char:e[p],width:this._getTextSize(e[p]).width}),n+=t[p].width;const{width:r,height:o}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=o,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),s=this.align(),a=this.kerningFunc(),l=Math.max(0,n-r),u=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let d=0;s==="center"&&(d=Math.max(0,this.pathLength/2-u/2)),s==="right"&&(d=Math.max(0,this.pathLength-u));let f=d;for(let p=0;p<t.length;p++){const g=this._getPointAtLength(f);if(!g)return;const m=t[p].char;let v=t[p].width+i;if(m===" "&&s==="justify"){const L=this.text().split(" ").length-1;v+=(this.pathLength-u)/L}const C=f+v,w=this._getPointAtLength(C>this.pathLength&&C-this.pathLength<=l?this.pathLength:C);if(!w)return;const _=is.getLineLength(g.x,g.y,w.x,w.y);let b=0;if(a)try{b=a(t[p-1].char,m)*this.fontSize()}catch{b=0}g.x+=b,w.x+=b,this.textWidth+=b;const S=is.getPointOnLine(b+_/2,g.x,g.y,w.x,w.y),x=Math.atan2(w.y-g.y,w.x-g.x);this.glyphInfo.push({transposeX:S.x,transposeY:S.y,text:e[p],rotation:x,p0:g,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 Be.releaseCanvas(this.dummyCanvas),super.destroy()}};so.prototype._fillFunc=bE,so.prototype._strokeFunc=wE,so.prototype._fillFuncHit=bE,so.prototype._strokeFuncHit=wE,so.prototype.className="TextPath",so.prototype._attrsAffectingSize=["text","fontSize","data"],Lr(so),be.addGetterSetter(so,"data"),be.addGetterSetter(so,"fontFamily","Arial"),be.addGetterSetter(so,"fontSize",12,It()),be.addGetterSetter(so,"fontStyle",yE),be.addGetterSetter(so,"align","left"),be.addGetterSetter(so,"letterSpacing",0,It()),be.addGetterSetter(so,"textBaseline","middle"),be.addGetterSetter(so,"fontVariant",yE),be.addGetterSetter(so,"text",M$),be.addGetterSetter(so,"textDecoration",""),be.addGetterSetter(so,"kerningFunc",void 0);var CE="tr-konva",L$=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(e=>e+`.${CE}`).join(" "),kE="nodesRect",P$=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],D$={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},O$="ontouchstart"in xt._global;function F$(e,t,n){if(e==="rotater")return n;t+=Be.degToRad(D$[e]||0);const r=(Be.radToDeg(t)%360+360)%360;return Be._inRange(r,337.5,360)||Be._inRange(r,0,22.5)?"ns-resize":Be._inRange(r,22.5,67.5)?"nesw-resize":Be._inRange(r,67.5,112.5)?"ew-resize":Be._inRange(r,112.5,157.5)?"nwse-resize":Be._inRange(r,157.5,202.5)?"ns-resize":Be._inRange(r,202.5,247.5)?"nesw-resize":Be._inRange(r,247.5,292.5)?"ew-resize":Be._inRange(r,292.5,337.5)?"nwse-resize":(Be.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var bg=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function N$(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 SE(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 B$(e,t){return SE(e,t,N$(e))}function z$(e,t,n){let r=t;for(let o=0;o<e.length;o++){const i=xt.getAngle(e[o]),s=Math.abs(i-t)%(Math.PI*2);Math.min(s,Math.PI*2-s)<n&&(r=i)}return r}var z1=0,zn=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(L$,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Be.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 CE+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const t=e.filter(n=>n.isAncestorOf(this)?(Be.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(P$.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(kE),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(kE,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=(xt.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return SE({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},-xt.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 Is;t.rotate(-xt.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:xt.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(),bg.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){const t=new Eh({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:O$?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=F$(e,xt.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 St({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=Be.degToRad(a),d=Math.sin(u),f=-Math.cos(u),p=i/2,g=s/2;let m=1/0;f<0?m=Math.min(m,-g/f):f>0&&(m=Math.min(m,(s-g)/f)),d<0?m=Math.min(m,-p/d):d>0&&(m=Math.min(m,(i-p)/d));const v=p+d*m,C=g+f*m,w=Be._sign(s),_=v+d*l*w,b=C+f*l*w;t.moveTo(v,C),t.lineTo(_,b)}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},z1++,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 _=xt.getAngle(this.rotateAnchorAngle());let b=Math.atan2(-n,t)+Math.PI/2-_;w.height<0&&(b-=Math.PI);const S=xt.getAngle(this.rotation())+b,x=xt.getAngle(this.rotationSnapTolerance()),L=B$(w,z$(this.rotationSnaps(),S,x)-w.rotation);this._fitNodesInto(L,e);return}const d=this.shiftBehavior();let f;d==="inverted"?f=this.keepRatio()&&!e.shiftKey:d==="none"?f=this.keepRatio():f=this.keepRatio()||e.shiftKey;let p=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(f){const 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,b=this.findOne(".top-left").y()>w.y?-1:1;t=r*this.cos*_,n=r*this.sin*b,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,b=this.findOne(".top-right").y()>w.y?-1:1;t=r*this.cos*_,n=r*this.sin*b,this.findOne(".top-right").x(w.x+t),this.findOne(".top-right").y(w.y-n)}var g=o.position();this.findOne(".top-left").y(g.y),this.findOne(".bottom-right").x(g.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(f){const 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,b=o.y()<w.y?-1:1;t=r*this.cos*_,n=r*this.sin*b,o.x(w.x-t),o.y(w.y+n)}g=o.position(),this.findOne(".top-left").x(g.x),this.findOne(".bottom-right").y(g.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(o.y());else if(this._movingAnchorName==="bottom-right"){if(f){const 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,b=this.findOne(".bottom-right").y()<w.y?-1:1;t=r*this.cos*_,n=r*this.sin*b,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"),b=w.x(),S=w.y(),x=this.getWidth()-_.x(),L=this.getHeight()-_.y();_.move({x:-b,y:-S}),w.move({x,y:L})}const m=this.findOne(".top-left").getAbsolutePosition();t=m.x,n=m.y;const v=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),C=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:v,height:C,rotation:xt.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();z1--,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(Be._inRange(e.width,-this.padding()*2-r,r)){this.update();return}if(Be._inRange(e.height,-this.padding()*2-r,r)){this.update();return}const o=new Is;if(o.rotate(xt.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:Be.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,s=new Is;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/i,n.height/i);const a=new Is,l=e.width/i,u=e.height/i;this.flipEnabled()===!1?(a.translate(e.x,e.y),a.rotate(e.rotation),a.translate(e.width<0?e.width:0,e.height<0?e.height:0),a.scale(Math.abs(l),Math.abs(u))):(a.translate(e.x,e.y),a.rotate(e.rotation),a.scale(l,u));const d=a.multiply(s.invert());this._nodes.forEach(f=>{var p;if(!f.getStage())return;const g=f.getParent().getAbsoluteTransform(),m=f.getTransform().copy();m.translate(f.offsetX(),f.offsetY());const v=new Is;v.multiply(g.copy().invert()).multiply(d).multiply(g).multiply(m);const C=v.decompose();f.setAttrs(C),(p=f.getLayer())===null||p===void 0||p.batchDraw()}),this.rotation(Be._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(Be._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(x=>{x.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=Be.degToRad(u),p=Math.sin(f),g=-Math.cos(f),m=n/2,v=r/2;let C=1/0;g<0?C=Math.min(C,-v/g):g>0&&(C=Math.min(C,(r-v)/g)),p<0?C=Math.min(C,-m/p):p>0&&(C=Math.min(C,(n-m)/p));const w=m+p*C,_=v+g*C,b=Be._sign(r);this._batchChangeChild(".rotater",{x:w+p*d*b,y:_+g*d*b-s*g,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(x=>x.draggable()),x:0,y:0});const S=this.anchorStyleFunc();S&&l.forEach(x=>{S(x)}),(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?(Be.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this):super.add(...e)}toObject(){return Rt.prototype.toObject.call(this)}clone(e){return Rt.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};zn.isTransforming=()=>z1>0;function j$(e){return e instanceof Array||Be.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){bg.indexOf(t)===-1&&Be.warn("Unknown anchor name: "+t+". Available names are: "+bg.join(", "))}),e||[]}zn.prototype.className="Transformer",Lr(zn),be.addGetterSetter(zn,"enabledAnchors",bg,j$),be.addGetterSetter(zn,"flipEnabled",!0,Es()),be.addGetterSetter(zn,"resizeEnabled",!0),be.addGetterSetter(zn,"anchorSize",10,It()),be.addGetterSetter(zn,"rotateEnabled",!0),be.addGetterSetter(zn,"rotateLineVisible",!0),be.addGetterSetter(zn,"rotationSnaps",[]),be.addGetterSetter(zn,"rotateAnchorOffset",50,It()),be.addGetterSetter(zn,"rotateAnchorAngle",0,It()),be.addGetterSetter(zn,"rotateAnchorCursor","crosshair"),be.addGetterSetter(zn,"rotationSnapTolerance",5,It()),be.addGetterSetter(zn,"borderEnabled",!0),be.addGetterSetter(zn,"anchorStroke","rgb(0, 161, 255)"),be.addGetterSetter(zn,"anchorStrokeWidth",1,It()),be.addGetterSetter(zn,"anchorFill","white"),be.addGetterSetter(zn,"anchorCornerRadius",0,It()),be.addGetterSetter(zn,"borderStroke","rgb(0, 161, 255)"),be.addGetterSetter(zn,"borderStrokeWidth",1,It()),be.addGetterSetter(zn,"borderDash"),be.addGetterSetter(zn,"keepRatio",!0),be.addGetterSetter(zn,"shiftBehavior","default"),be.addGetterSetter(zn,"centeredScaling",!1),be.addGetterSetter(zn,"ignoreStroke",!1),be.addGetterSetter(zn,"padding",0,It()),be.addGetterSetter(zn,"nodes"),be.addGetterSetter(zn,"node"),be.addGetterSetter(zn,"boundBoxFunc"),be.addGetterSetter(zn,"anchorDragBoundFunc"),be.addGetterSetter(zn,"anchorStyleFunc"),be.addGetterSetter(zn,"shouldOverdrawWholeArea",!1),be.addGetterSetter(zn,"useSingleNodeRotation",!0),be.backCompat(zn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var tl=class extends St{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,xt.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)}};tl.prototype.className="Wedge",tl.prototype._centroid=!0,tl.prototype._attrsAffectingSize=["radius"],Lr(tl),be.addGetterSetter(tl,"radius",0,It()),be.addGetterSetter(tl,"angle",0,It()),be.addGetterSetter(tl,"clockwise",!1),be.backCompat(tl,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function _E(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var V$=[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],U$=[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 $$(e,t){const n=e.data,r=e.width,o=e.height;let i,s,a,l,u,d,f,p,g,m,v,C,w,_,b,S,x,L,B,q;const F=t+t+1,P=r-1,U=o-1,T=t+1,V=T*(T+1)/2,R=new _E,$=V$[t],se=U$[t];let X=null,J=R,W=null,Te=null;for(let ge=1;ge<F;ge++)J=J.next=new _E,ge===T&&(X=J);J.next=R,a=s=0;for(let ge=0;ge<o;ge++){C=w=_=b=l=u=d=f=0,p=T*(S=n[s]),g=T*(x=n[s+1]),m=T*(L=n[s+2]),v=T*(B=n[s+3]),l+=V*S,u+=V*x,d+=V*L,f+=V*B,J=R;for(let he=0;he<T;he++)J.r=S,J.g=x,J.b=L,J.a=B,J=J.next;for(let he=1;he<T;he++)i=s+((P<he?P:he)<<2),l+=(J.r=S=n[i])*(q=T-he),u+=(J.g=x=n[i+1])*q,d+=(J.b=L=n[i+2])*q,f+=(J.a=B=n[i+3])*q,C+=S,w+=x,_+=L,b+=B,J=J.next;W=R,Te=X;for(let he=0;he<r;he++)n[s+3]=B=f*$>>se,B!==0?(B=255/B,n[s]=(l*$>>se)*B,n[s+1]=(u*$>>se)*B,n[s+2]=(d*$>>se)*B):n[s]=n[s+1]=n[s+2]=0,l-=p,u-=g,d-=m,f-=v,p-=W.r,g-=W.g,m-=W.b,v-=W.a,i=a+((i=he+t+1)<P?i:P)<<2,C+=W.r=n[i],w+=W.g=n[i+1],_+=W.b=n[i+2],b+=W.a=n[i+3],l+=C,u+=w,d+=_,f+=b,W=W.next,p+=S=Te.r,g+=x=Te.g,m+=L=Te.b,v+=B=Te.a,C-=S,w-=x,_-=L,b-=B,Te=Te.next,s+=4;a+=r}for(let ge=0;ge<r;ge++){w=_=b=C=u=d=f=l=0,s=ge<<2,p=T*(S=n[s]),g=T*(x=n[s+1]),m=T*(L=n[s+2]),v=T*(B=n[s+3]),l+=V*S,u+=V*x,d+=V*L,f+=V*B,J=R;for(let ye=0;ye<T;ye++)J.r=S,J.g=x,J.b=L,J.a=B,J=J.next;let he=r;for(let ye=1;ye<=t;ye++)s=he+ge<<2,l+=(J.r=S=n[s])*(q=T-ye),u+=(J.g=x=n[s+1])*q,d+=(J.b=L=n[s+2])*q,f+=(J.a=B=n[s+3])*q,C+=S,w+=x,_+=L,b+=B,J=J.next,ye<U&&(he+=r);s=ge,W=R,Te=X;for(let ye=0;ye<o;ye++)i=s<<2,n[i+3]=B=f*$>>se,B>0?(B=255/B,n[i]=(l*$>>se)*B,n[i+1]=(u*$>>se)*B,n[i+2]=(d*$>>se)*B):n[i]=n[i+1]=n[i+2]=0,l-=p,u-=g,d-=m,f-=v,p-=W.r,g-=W.g,m-=W.b,v-=W.a,i=ge+((i=ye+T)<U?i:U)*r<<2,l+=C+=W.r=n[i],u+=w+=W.g=n[i+1],d+=_+=W.b=n[i+2],f+=b+=W.a=n[i+3],W=W.next,p+=S=Te.r,g+=x=Te.g,m+=L=Te.b,v+=B=Te.a,C-=S,w-=x,_-=L,b-=B,Te=Te.next,s+=r}}var H$=function(t){const n=Math.round(this.blurRadius());n>0&&$$(t,n)};be.addGetterSetter(Rt,"blurRadius",0,It(),be.afterSetFilter);var G$=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};be.addGetterSetter(Rt,"brightness",0,It(),be.afterSetFilter);var W$=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)},K$=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};be.addGetterSetter(Rt,"contrast",0,It(),be.afterSetFilter);var q$=function(e){var t,n,r,o,i,s,a,l,u;const d=e.data,f=e.width,p=e.height,g=Math.min(1,Math.max(0,(n=(t=this.embossStrength)===null||t===void 0?void 0:t.call(this))!==null&&n!==void 0?n:.5)),m=Math.min(1,Math.max(0,(o=(r=this.embossWhiteLevel)===null||r===void 0?void 0:r.call(this))!==null&&o!==void 0?o:.5)),v=(a={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(s=(i=this.embossDirection)===null||i===void 0?void 0:i.call(this))!==null&&s!==void 0?s:"top-left"])!==null&&a!==void 0?a:315,C=!!((u=(l=this.embossBlend)===null||l===void 0?void 0:l.call(this))!==null&&u!==void 0&&u),w=g*10,_=m*255,b=v*Math.PI/180,S=Math.cos(b),x=Math.sin(b),L=128/1020*w,B=new Uint8ClampedArray(d),q=new Float32Array(f*p);for(let V=0,R=0;R<d.length;R+=4,V++)q[V]=.2126*B[R]+.7152*B[R+1]+.0722*B[R+2];const F=[-1,0,1,-2,0,2,-1,0,1],P=[-1,-2,-1,0,0,0,1,2,1],U=[-f-1,-f,-f+1,-1,0,1,f-1,f,f+1],T=V=>V<0?0:V>255?255:V;for(let V=1;V<p-1;V++)for(let R=1;R<f-1;R++){const $=V*f+R;let se=0,X=0;se+=q[$+U[0]]*F[0],X+=q[$+U[0]]*P[0],se+=q[$+U[1]]*F[1],X+=q[$+U[1]]*P[1],se+=q[$+U[2]]*F[2],X+=q[$+U[2]]*P[2],se+=q[$+U[3]]*F[3],X+=q[$+U[3]]*P[3],se+=q[$+U[5]]*F[5],X+=q[$+U[5]]*P[5],se+=q[$+U[6]]*F[6],X+=q[$+U[6]]*P[6],se+=q[$+U[7]]*F[7],X+=q[$+U[7]]*P[7],se+=q[$+U[8]]*F[8],X+=q[$+U[8]]*P[8];const J=T(_+(S*se+x*X)*L),W=$*4;if(C){const Te=J-_;d[W]=T(B[W]+Te),d[W+1]=T(B[W+1]+Te),d[W+2]=T(B[W+2]+Te),d[W+3]=B[W+3]}else d[W]=d[W+1]=d[W+2]=J,d[W+3]=B[W+3]}for(let V=0;V<f;V++){let R=V*4,$=((p-1)*f+V)*4;d[R]=B[R],d[R+1]=B[R+1],d[R+2]=B[R+2],d[R+3]=B[R+3],d[$]=B[$],d[$+1]=B[$+1],d[$+2]=B[$+2],d[$+3]=B[$+3]}for(let V=1;V<p-1;V++){let R=V*f*4,$=(V*f+(f-1))*4;d[R]=B[R],d[R+1]=B[R+1],d[R+2]=B[R+2],d[R+3]=B[R+3],d[$]=B[$],d[$+1]=B[$+1],d[$+2]=B[$+2],d[$+3]=B[$+3]}return e};be.addGetterSetter(Rt,"embossStrength",.5,It(),be.afterSetFilter),be.addGetterSetter(Rt,"embossWhiteLevel",.5,It(),be.afterSetFilter),be.addGetterSetter(Rt,"embossDirection","top-left",void 0,be.afterSetFilter),be.addGetterSetter(Rt,"embossBlend",!1,void 0,be.afterSetFilter);function j1(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 Y$=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 b=0;b<n;b+=4)i=t[b+0],i<r?r=i:i>o&&(o=i),l=t[b+1],l<s?s=l:l>a&&(a=l),f=t[b+2],f<u?u=f:f>d&&(d=f);o===r&&(o=255,r=0),a===s&&(a=255,s=0),d===u&&(d=255,u=0);let g,m,v,C,w,_;if(p>0)g=o+p*(255-o),m=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 b=(o+r)*.5;g=o+p*(o-b),m=r+p*(r-b);const S=(a+s)*.5;v=a+p*(a-S),C=s+p*(s-S);const x=(d+u)*.5;w=d+p*(d-x),_=u+p*(u-x)}for(let b=0;b<n;b+=4)t[b+0]=j1(t[b+0],r,o,m,g),t[b+1]=j1(t[b+1],s,a,C,v),t[b+2]=j1(t[b+2],u,d,_,w)};be.addGetterSetter(Rt,"enhance",0,It(),be.afterSetFilter);var X$=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}};be.addGetterSetter(Rt,"hue",0,It(),be.afterSetFilter),be.addGetterSetter(Rt,"saturation",0,It(),be.afterSetFilter),be.addGetterSetter(Rt,"luminance",0,It(),be.afterSetFilter);var Z$=function(e){const t=e.data,n=t.length,r=1,o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=this.luminance()*127,a=r*o*Math.cos(i*Math.PI/180),l=r*o*Math.sin(i*Math.PI/180),u=.299*r+.701*a+.167*l,d=.587*r-.587*a+.33*l,f=.114*r-.114*a-.497*l,p=.299*r-.299*a-.328*l,g=.587*r+.413*a+.035*l,m=.114*r-.114*a+.293*l,v=.299*r-.3*a+1.25*l,C=.587*r-.586*a-1.05*l,w=.114*r+.886*a-.2*l;let _,b,S,x;for(let L=0;L<n;L+=4)_=t[L+0],b=t[L+1],S=t[L+2],x=t[L+3],t[L+0]=u*_+d*b+f*S+s,t[L+1]=p*_+g*b+m*S+s,t[L+2]=v*_+C*b+w*S+s,t[L+3]=x},Q$=function(e){const t=e.data,n=t.length,r=Math.pow(2,this.value()),o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=r*o*Math.cos(i*Math.PI/180),a=r*o*Math.sin(i*Math.PI/180),l=.299*r+.701*s+.167*a,u=.587*r-.587*s+.33*a,d=.114*r-.114*s-.497*a,f=.299*r-.299*s-.328*a,p=.587*r+.413*s+.035*a,g=.114*r-.114*s+.293*a,m=.299*r-.3*s+1.25*a,v=.587*r-.586*s-1.05*a,C=.114*r+.886*s-.2*a;for(let w=0;w<n;w+=4){const _=t[w+0],b=t[w+1],S=t[w+2],x=t[w+3];t[w+0]=l*_+u*b+d*S,t[w+1]=f*_+p*b+g*S,t[w+2]=m*_+v*b+C*S,t[w+3]=x}};be.addGetterSetter(Rt,"hue",0,It(),be.afterSetFilter),be.addGetterSetter(Rt,"saturation",0,It(),be.afterSetFilter),be.addGetterSetter(Rt,"value",0,It(),be.afterSetFilter);var J$=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]},eH=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const p=Math.sqrt(d*d+f*f);u=p>u?p:u;const g=s,m=i,v=360/m*Math.PI/180;for(let C=0;C<m;C+=1){const w=Math.sin(C*v),_=Math.cos(C*v);for(let b=0;b<g;b+=1){d=Math.floor(a+u*b/g*_),f=Math.floor(l+u*b/g*w);let S=(f*i+d)*4;const x=r[S+0],L=r[S+1],B=r[S+2],q=r[S+3];S=(C+b*i)*4,o[S+0]=x,o[S+1]=L,o[S+2]=B,o[S+3]=q}}},tH=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const p=Math.sqrt(d*d+f*f);u=p>u?p:u;const g=s,m=i,v=n.polarRotation||0;let C,w;for(d=0;d<i;d+=1)for(f=0;f<s;f+=1){const _=d-a,b=f-l,S=Math.sqrt(_*_+b*b)*g/u;let x=(Math.atan2(b,_)*180/Math.PI+360+v)%360;x=x*m/360,C=Math.floor(x),w=Math.floor(S);let L=(w*i+C)*4;const B=r[L+0],q=r[L+1],F=r[L+2],P=r[L+3];L=(f*i+d)*4,o[L+0]=B,o[L+1]=q,o[L+2]=F,o[L+3]=P}},nH=function(e){const t=e.width,n=e.height;let r,o,i,s,a,l,u,d,f,p,g=Math.round(this.kaleidoscopePower());const m=Math.round(this.kaleidoscopeAngle()),v=Math.floor(t*(m%360)/360);if(g<1)return;const C=Be.createCanvasElement();C.width=t,C.height=n;const w=C.getContext("2d").getImageData(0,0,t,n);Be.releaseCanvas(C),eH(e,w,{polarCenterX:t/2,polarCenterY:n/2});let _=t/Math.pow(2,g);for(;_<=8;)_=_*2,g-=1;_=Math.ceil(_);let b=_,S=0,x=b,L=1;for(v+_>t&&(S=b,x=0,L=-1),o=0;o<n;o+=1)for(r=S;r!==x;r+=L)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(b=Math.floor(_),s=0;s<g;s+=1){for(r=0;r<b+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+b*2-r-1)*4,w.data[p+0]=a,w.data[p+1]=l,w.data[p+2]=u,w.data[p+3]=d;b*=2}tH(w,e,{polarRotation:0})};be.addGetterSetter(Rt,"kaleidoscopePower",2,It(),be.afterSetFilter),be.addGetterSetter(Rt,"kaleidoscopeAngle",0,It(),be.afterSetFilter);function wg(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 Rh(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 rH(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 oH(e,t){const n=wg(e,0,0),r=wg(e,e.width-1,0),o=wg(e,0,e.height-1),i=wg(e,e.width-1,e.height-1),s=t||10;if(Rh(n,r)<s&&Rh(r,i)<s&&Rh(i,o)<s&&Rh(o,n)<s){const a=rH([r,n,i,o]),l=[];for(let u=0;u<e.width*e.height;u++)l[u]=Rh(a,[e.data[u*4],e.data[u*4+1],e.data[u*4+2]])<s?0:255;return l}}function iH(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function sH(e,t,n){const r=[1,1,1,1,0,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,C=r[f*o+p];d+=e[v]*C}}s[u]=d===2040?255:0}return s}function aH(e,t,n){const r=[1,1,1,1,1,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,C=r[f*o+p];d+=e[v]*C}}s[u]=d>=1020?255:0}return s}function lH(e,t,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,C=r[f*o+p];d+=e[v]*C}}s[u]=d}return s}var cH=function(e){let t=oH(e,this.threshold());return t&&(t=sH(t,e.width,e.height),t=aH(t,e.width,e.height),t=lH(t,e.width,e.height),iH(e,t)),e};be.addGetterSetter(Rt,"threshold",0,It(),be.afterSetFilter);var uH=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()};be.addGetterSetter(Rt,"noise",.2,It(),be.afterSetFilter);var dH=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){Be.error("pixelSize value can not be <= 0");return}for(let a=0;a<o;a+=1)for(let l=0;l<i;l+=1){let u=0,d=0,f=0,p=0;const g=a*t,m=g+t,v=l*t,C=v+t;let w=0;for(let _=g;_<m;_+=1)if(!(_>=n))for(let b=v;b<C;b+=1){if(b>=r)continue;const S=(n*b+_)*4;u+=s[S+0],d+=s[S+1],f+=s[S+2],p+=s[S+3],w+=1}u=u/w,d=d/w,f=f/w,p=p/w;for(let _=g;_<m;_+=1)if(!(_>=n))for(let b=v;b<C;b+=1){if(b>=r)continue;const S=(n*b+_)*4;s[S+0]=u,s[S+1]=d,s[S+2]=f,s[S+3]=p}}};be.addGetterSetter(Rt,"pixelSize",8,It(),be.afterSetFilter);var fH=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};be.addGetterSetter(Rt,"levels",.5,It(),be.afterSetFilter);var hH=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]}};be.addGetterSetter(Rt,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),be.addGetterSetter(Rt,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),be.addGetterSetter(Rt,"blue",0,AI,be.afterSetFilter);var pH=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}};be.addGetterSetter(Rt,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),be.addGetterSetter(Rt,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),be.addGetterSetter(Rt,"blue",0,AI,be.afterSetFilter),be.addGetterSetter(Rt,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var mH=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)}},gH=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},vH=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};be.addGetterSetter(Rt,"threshold",.5,It(),be.afterSetFilter);var yH=nE.Util._assign(nE,{Arc:Ja,Arrow:qc,Circle:Ed,Ellipse:Yl,Image:Ts,Label:F1,Tag:Yc,Line:el,Path:is,Rect:Eh,RegularPolygon:Xl,Ring:Xc,Sprite:la,Star:Zl,Text:pr,TextPath:so,Transformer:zn,Wedge:tl,Filters:{Blur:H$,Brightness:W$,Brighten:G$,Contrast:K$,Emboss:q$,Enhance:Y$,Grayscale:X$,HSL:Z$,HSV:Q$,Invert:J$,Kaleidoscope:nH,Mask:cH,Noise:uH,Pixelate:dH,Posterize:fH,RGB:hH,RGBA:pH,Sepia:mH,Solarize:gH,Threshold:vH}}),bH=yH;Bt();var wH=["dialog","floating"],AE=["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"];function CH(e){if(!e||typeof e!="object")throw new Error("SurfaceManager: request must be a non-null object.");if(!wH.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&&!AE.includes(e.floating.placement))throw new Error(`SurfaceManager: floating.placement must be one of ${AE.join(", ")}, got "${e.floating.placement}".`)}var kH=class{activeDialog=Mr(null);activeFloating=Mr(null);#e=!1;#n=1;#t;constructor({getModuleConfig:e}){this.#t=e}open(e){if(this.#e)return this.#c(e);CH(e);const t=this.#d(e),{component:n,props:r,render:o}=this.#h(t);let i,s=!1;const a=new Promise(g=>{i=m=>s?!1:(s=!0,g(m),!0)});let l;const u=g=>{i({status:"submitted",data:g})&&this.#i(l)},d=g=>{i({status:"closed",reason:g})&&this.#i(l)};l={id:t.id,mode:t.mode,request:t,component:n,props:r,render:o,resolve:u,close:d,settle:g=>i(g),get settled(){return s}};const f=t.mode==="dialog"?"activeDialog":"activeFloating",p=this[f].value;return p&&!p.settled&&p.settle({status:"replaced",replacedBy:t.id}),this[f].value=l,{id:t.id,mode:t.mode,close:g=>this.#o(l,g),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}#d(e){const t=e.id??`surface-${this.#n++}`,n=this.#t()??{},r=e.mode==="dialog"?n.dialog:n.floating,o=e.mode==="dialog"?{maxWidth:r?.maxWidth,...e.dialog}:e.dialog,i=e.mode==="floating"?{placement:r?.placement??"top-right",width:r?.width,maxWidth:r?.maxWidth,maxHeight:r?.maxHeight,autoFocus:r?.autoFocus??!0,closeOnOutsidePointerDown:r?.closeOnOutsidePointerDown??!1,...e.floating}:e.floating;return{...e,id:t,closeOnEscape:e.closeOnEscape??r?.closeOnEscape??!0,closeOnBackdrop:e.mode==="dialog"?e.closeOnBackdrop??r?.closeOnBackdrop??!0:!1,dialog:o,floating:i}}#h(e){if("component"in e&&e.component!=null)return{component:e.component,props:e.props};if("render"in e&&typeof e.render=="function")return{render:e.render};const t=this.#t()?.resolver;if(typeof t=="function"){const n=t(e);if(n!=null){if(n.type==="none")throw new Error(`SurfaceManager: resolver explicitly suppressed surface for kind "${e.kind}".`);if(n.type==="custom")return{component:n.component,props:n.props};if(n.type==="external")return{render:n.render}}}throw new Error(`SurfaceManager: no renderer resolved for kind "${e.kind}". Provide a resolver via surfaces.resolver, or use a direct-render request.`)}#c(e){return{id:e?.id??`surface-${this.#n++}`,mode:e?.mode??"dialog",close:()=>{},result:Promise.resolve({status:"destroyed"})}}},SH="https://docs.superdoc.dev/guides/migration/document-api",IE=new Set;function _H(e,t){IE.has(e)||(IE.add(e),console.warn(t))}var AH={state:"editor.state",view:"editor.view",schema:"editor.schema",commands:"editor.commands",chain:"editor.chain()",can:"editor.can()",dispatch:"editor.dispatch()"},EE=Symbol.for("superdoc:rawEditor"),TE=new WeakMap;function xE(e){return!e||e[EE]?e:new Proxy(e,{get(t,n){if(n===EE)return t;const r=AH[n];r&&_H(`deprecated:${String(n)}`,`[SuperDoc] ${r} is deprecated and will be removed in a future version. Use the Document API (editor.doc) instead. See ${SH}`);const o=Reflect.get(t,n,t);if(typeof o=="function"){let i=TE.get(t);return i||(i=new Map,TE.set(t,i)),i.has(n)||i.set(n,o.bind(t)),i.get(n)}return o}})}var RE=["review","original","final","off"],IH=["original","markup","final"],EH=["paired","independent"],ME=Symbol.for("@superdoc/trackChanges:normalized"),LE=new Set;function V1(e,t){LE.has(e)||(LE.add(e),console.warn(`[SuperDoc] ${e} is deprecated β€” use ${t} instead.`))}function PE(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n}function TH(e,t,n){return typeof e=="string"&&RE.includes(e)?e:typeof t=="string"&&RE.includes(t)?t:n}function xH(e){return typeof e!="string"||!IH.includes(e)?null:e}function RH(e){return e==="markup"?"review":e}function MH(e){return typeof e=="string"&&EH.includes(e)?e:null}function LH(e){return e==="grouped"?"paired":e==="separate"?"independent":null}function PH(e){return e==="paired"?"grouped":"separate"}function xs(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function U1(e){const t=e[ME]===!0,n=xs(e.viewing),r=xH(n?.trackedChanges);xs(e.modules)||(e.modules={});const o=xs(e.trackChanges),i=xs(e.modules.trackChanges),s=xs(e.layoutEngineOptions?.trackedChanges);t||(o&&Object.prototype.hasOwnProperty.call(o,"visible")&&V1("config.trackChanges.visible","config.viewing.trackedChanges"),i&&V1("config.modules.trackChanges","config.trackChanges for behavior and config.viewing.trackedChanges for viewing projection"),s&&V1("config.layoutEngineOptions.trackedChanges","config.viewing.trackedChanges for display and config.trackChanges.enabled for behavior"));const a=r?r==="markup":PE(o?.visible,i?.visible,!1),l=PE(o?.enabled,i?.enabled,typeof s?.enabled=="boolean"?s.enabled:!0),u=LH(o?.replacementMode)??MH(i?.replacements)??"paired",d=xs(o?.authorColors)??xs(i?.authorColors),f=d||void 0,p=xs(o?.semanticColors)??xs(i?.semanticColors),g=p||void 0,m=e.documentMode==="viewing",v=m?a?"review":"original":"review",C=r?m?RH(r):"review":TH(i?.mode,s?.mode,v),w={visible:a,mode:C,enabled:l,replacements:u};return f&&(w.authorColors=f),g&&(w.semanticColors=g),e.modules.trackChanges=w,e.trackChanges={visible:a,enabled:l,replacementMode:PH(u)},f&&(e.trackChanges.authorColors=f),g&&(e.trackChanges.semanticColors=g),xs(e.layoutEngineOptions)||(e.layoutEngineOptions={}),e.layoutEngineOptions.trackedChanges={mode:C,enabled:l},typeof n?.comments=="boolean"&&(xs(e.comments)||(e.comments={}),e.comments.visible=n.comments),Object.defineProperty(e,ME,{value:!0,writable:!0,configurable:!0,enumerable:!1}),w}var $1=Object.freeze({id:null,name:"Default SuperDoc user",email:null});function DH(e){return!e||typeof e!="object"?{...$1}:{...$1,...e}}var Cg=Object.freeze({"font-family":"fontFamily","font-size":"fontSize",strikethrough:"strike","highlight-color":"highlight","text-color":"color","table-of-contents":"tableOfContents","page-number":"pageNumber","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"}),DE=Object.freeze({toolbar:!0,comments:!0,contextMenu:!0,loading:!0,search:!1,linkPopover:!1,ruler:!1,contentControls:!0}),OH=Object.freeze(["left","center","right"]),FH=Object.freeze({compact:32,default:80,wide:120}),vZ=Object.freeze(Object.keys(DE)),to=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function OE(e,t){const n=e?.[t];return n===!1?!1:n===void 0?DE[t]:!0}function NH(e,t){const n=e?.[t];return to(n)?n:{}}var FE=Object.freeze(["level","readOnly","allowResolve","permissionResolver"]);function BH(e){if(!FE.some(n=>n in e))return e;const t={...e};for(const n of FE)delete t[n];return t}function NE(e){const t={...e},n=Gl(e.sections,e.customItems),r=Gl(e.defaultItems,e.includeDefaultItems);return delete t.customItems,delete t.includeDefaultItems,ii(t,{sections:n,defaultItems:r})}var BE=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 zH(e){return to(e)?Object.fromEntries(Object.entries(e).filter(([t,n])=>BE[t]!==void 0&&n!==void 0).map(([t,n])=>[BE[t],n])):{}}function zE(e){const t={...e};return delete t.strings,delete t.replaceControls,delete t.includeTrackedDeletions,ii(t,zH(e.strings),{replaceEnabled:Gl(e.replaceControls,e.replaceEnabled),includeDeletedText:Gl(e.includeTrackedDeletions,e.includeDeletedText)})}var jH=Object.freeze({"text-color":"color","table-of-contents":"tableOfContents","page-number":"pageNumber","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"}),VH=Object.freeze({"font-family":"fontFamily","font-size":"fontSize","highlight-color":"highlight","text-color":"color","table-of-contents":"tableOfContents","page-number":"pageNumber","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 kg(e,t){return t[e]??e}function H1(e,t){if(!to(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])=>[kg(i,t),s]))}function jE(e){return Array.isArray(e)?e.map(t=>kg(t,Cg)):e}function VE(e){return to(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,jE(n)])):e}function UH(e,t){if(!to(e)||!Array.isArray(t))return e;const n={...e};for(const r of t){if(!to(r))continue;const o=r.region??"center";n[o]===void 0&&(n[o]=[])}return n}var $H=Object.freeze({watermark:"center","page-number":"center","formatting-marks":"right","table-of-contents":"center"});function HH(e,t){if(!to(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=>kg(o,Cg)));for(const o of t){const i=kg(o,Cg);if(r.has(i))continue;const s=$H[o];s&&(Array.isArray(n[s])||(n[s]=[]),n[s].push(o),r.add(i))}return n}function UE(e,t){return UH(HH(e,t.includeItems),t.customItems)}function GH(e){return Array.isArray(e)?e.map(t=>{if(!to(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 WH(e){return Array.isArray(e)?e.map(t=>{if(!to(t)||typeof t.id!="string")return t;const n=t.size??"default",r=t.type==="separator"?void 0:FH[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=>to(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 KH(e){const t={...e},n=Gl(e.items,to(e.groups)?e.groups:void 0),r=to(e.items)&&Object.keys(e.items).length===0?{center:[]}:n,o=UE(r,e),i=o===void 0?e.groups:VE(o),s=H1(e.icons,jH),a=ii(H1(e.texts,{}),H1(e.strings,VH)),l=Array.isArray(e.includeItems)?new Set(e.includeItems):null,u=to(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,ii(t,{groups:i,excludeItems:jE(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:GH(e.fontOptions),customButtons:e.customItems===void 0?e.customButtons:WH(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"),showWatermarkButton:u.has("watermark")||l?.has("watermark")||!1,showPageNumberButton:u.has("page-number")||l?.has("page-number")||!1})}function $E(e={}){const t=e.ui,n=t===!1,r=to(t)?t:void 0,o=V=>!n&&OE(r,V),i=V=>n?!1:r?.[V]===void 0?void 0:OE(r,V),s=V=>n?{}:NH(r,V),a=n||i("ruler")===!1,l=n||i("linkPopover")===!1,u=l?void 0:Gl(s("linkPopover").popoverResolver,e.modules?.links?.popoverResolver),d=i("contentControls")??(!n&&e.modules?.contentControls?.chrome!=="none"),f=e.modules?.contentControls?.chrome==="none"?void 0:e.modules?.contentControls?.chrome,p=s("toolbar"),g=KH(p),m=to(p.items),v=e.modules?.toolbar,C=to(v)?v:{},w=e.modules?.contextMenu??e.modules?.slashMenu,_=to(w)?w:{},b=e.modules?.surfaces?.findReplace,S=zE(to(b)?b:{}),x=to(C.groups)?VE(UE(C.groups,p)):C.groups,L=[g.groups,x],B=L.find(to),q=L.find(Array.isArray),F=m?Object.keys(g.groups??{}):Gl(q,C.toolbarGroups,e.toolbarGroups),P=Array.isArray(F)?F:null,U=(V,R)=>Object.prototype.hasOwnProperty.call(V,R),T=B&&P?Object.fromEntries([...P.filter(V=>U(B,V)),...Object.keys(B).filter(V=>!OH.includes(V))].map(V=>[V,B[V]])):B;return{enabled:!n,toolbar:{enabled:o("toolbar"),container:n?null:Gl(g.container,C.selector,e.toolbar)??null,options:n?{}:{...ii(C,g),groups:T,toolbarGroups:F,icons:ii(e.toolbarIcons,C.icons,g.icons),texts:ii(e.toolbarTexts,C.texts,g.texts)}},comments:{enabled:i("comments")??(!n&&e.modules?.comments!==!1),options:n?{}:xA(BH(s("comments")))},contextMenu:{enabled:i("contextMenu")??(!n&&e.disableContextMenu!==!0),suppressed:n||i("contextMenu")===!1,options:n?{}:ii(NE(_),NE(s("contextMenu")))},loading:{enabled:o("loading")},search:{enabled:i("search")??(!n&&!!e.modules?.surfaces?.findReplace),options:n?{}:ii(S,zE(s("search")))},linkPopover:{enabled:typeof u=="function",suppressed:l,options:ii(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?ii({chrome:f},s("contentControls")):{chrome:"none"}}}}var Sg=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),qH=e=>e==="read"||e==="write"||e==="resolve";function HE(e={}){const t=Sg(e.interaction)?e.interaction:{},n=Sg(t.comments)?t.comments:{},r=Sg(t.trackedChanges)?t.trackedChanges:{},o=Sg(e.modules?.comments)?e.modules.comments:{},i=(n.readOnly??o.readOnly??!1)===!0,s=(n.allowResolve??o.allowResolve??!0)!==!1,a=qH(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 GE=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function WE(e={}){const t=GE(e.surfaces)?e.surfaces:{},n=GE(e.modules?.surfaces)?e.modules.surfaces:{},r=t.resolver===void 0?n.resolver:t.resolver;return{resolver:typeof r=="function"?r:null,dialog:ii(n.dialog,t.dialog),floating:ii(n.floating,t.floating)}}var YH="https://docs.superdoc.dev/editor/fonts/";function XH(e){return e==="localhost"||e.endsWith(".localhost")||e==="0.0.0.0"||e==="::1"||e==="[::1]"||e.startsWith("127.")}function ZH(e,t,n=typeof window>"u"?"":window.location.hostname){if(!XH(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: ${YH}`)}var QH=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(`[${eg}]`);if(!n)return null;const r=n.getAttribute(eg),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{}}},JH=["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"],KE=[{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:"watermark",commandId:null,instanceMethod:"ui.watermark.open",disposition:"host-routed",group:"center",note:"opens the shared Watermark dialog through superdoc.ui.watermark.open; the workflow owns scope, edit permissions, and apply"},{name:"pageNumber",commandId:"page-numbers-apply",instanceMethod:null,disposition:"controller-routed",group:"center",note:"opens the Page number popover: adds or changes the caret section numbers (position, first page, style, start) through page-numbers-apply, removes them through page-numbers-remove, or inserts at a header/footer cursor through page-number-insert"},{name:"table",commandId:"table-insert",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"tableActions",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"center",memberCommandIds:JH,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"}],qE=new Map(KE.map(e=>[e.name,e])),eG=KE.map(e=>e.name);function G1(e){return qE.get(e)??null}function tG(e){const t=qE.get(e);return t?.disposition==="controller-routed"?t.commandId:null}var nG=(e,t)=>{let n=e.replace(/[^0-9.]/g,"");return n=parseFloat(n),isNaN(n)&&(n=t),n=parseFloat(n),n},rG=(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 oG={class:"sd-toolbar-icon"},iG=["innerHTML"],sG={__name:"ToolbarButtonIcon",props:{name:{type:String,required:!0},color:{type:String,default:null},icon:{type:String,default:null}},setup(e){const t=e,n=Ce(()=>{if(t.name==="color")return{backgroundColor:t.color||"#111111"};if(t.name==="highlight")return{backgroundColor:t.color||"#D6D6D6"}}),r=Ce(()=>["color","highlight"].includes(t.name));return(o,i)=>(ve(),we("div",oG,[de("div",{class:on(["sd-toolbar-icon__icon",[`sd-toolbar-icon__icon--${t.name}`]]),innerHTML:e.icon},null,10,iG),r.value?(ve(),we("div",{key:0,class:"color-bar",style:Rn(n.value)},null,4)):dt("",!0)]))}},YE=gn(sG,[["__scopeId","data-v-65ecd5b1"]]);Bt(),bn();var aG=["role","aria-label","aria-disabled"],lG=["data-item"],cG=["data-item"],uG={key:1,class:"sd-button-label"},dG=["data-item","aria-label"],fG=["innerHTML"],hG={key:2},pG=["onKeydown","id"],mG=["placeholder","onKeydown","id","data-item"],gG=["data-item","innerHTML"],vG={"aria-live":"polite",class:"sd-visually-hidden"},yG={__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}=Sr(),o=e,{name:i,active:s,icon:a,label:l,hideLabel:u,iconColor:d,hasCaret:f,splitButton:p,disabled:g,expand:m,inlineTextInputVisible:v,hasInlineTextInput:C,minWidth:w,style:_,attributes:b}=o.toolbarItem,S=Ce(()=>!!p?.value&&!!f?.value),x=Ce(()=>i?.value??""),L=ne(""),B=ne(null),{isHighContrastMode:q}=rs();$t(()=>l?.value,Re=>{document.activeElement!==B.value&&(L.value=Re==null?"":String(Re))},{immediate:!0});const F=()=>{C&&_t(()=>{B.value?.focus(),B.value?.select()}),n("buttonClick")},P=Re=>{g?.value||(Re?.stopPropagation(),n("mainClick"))},U=()=>{S.value||F()},T=Re=>{if(S.value){P(Re);return}F()},V=Re=>{Re.preventDefault(),o.allowEnterPropagation||Re.stopPropagation(),T(Re)},R=Re=>{const je=o.toolbarItem?.nestedOptions?.value??[],Je=Re.trim();if(!Je)return"";const bt=je.find(ft=>typeof ft?.label=="string"&&ft.label.toLowerCase()===Je.toLowerCase());return bt?.label?bt.label:je.find(ft=>typeof ft?.label=="string"&&ft.label.toLowerCase().startsWith(Je.toLowerCase()))?.label??Je},$=()=>{const Re=String(L.value??"").trim();let je=Re;if(x.value==="fontSize"){const Je=Number.parseFloat(Re);je=Re.match(/^\d+(\.5)?$/)?Re:Number.isFinite(Je)?Math.floor(Je).toString():""}else x.value==="fontFamily"&&(je=R(Re));return je?(n("textSubmit",je),L.value=je,!0):!1},se=Re=>{const je=Re?.currentTarget;je instanceof HTMLInputElement&&(je.focus({preventScroll:!0}),je.select())},X=Re=>{requestAnimationFrame(()=>{const je=document.getElementById(`inlineTextInput-${Re}`);je instanceof HTMLInputElement&&(je.focus({preventScroll:!0}),je.select())})},J=()=>{const Re=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Re instanceof HTMLElement?(Re.focus({preventScroll:!0}),!0):!1},W=()=>{const Re=r?.$toolbar?.pendingSelectionCapture,je=()=>{Re&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Re)};if(J()){je();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),je())},Te=()=>{$()&&W()},ge=Re=>{if($(),Re.shiftKey){x.value==="fontSize"&&(Re.preventDefault(),_t(()=>X("fontFamily")));return}if(Re.preventDefault(),x.value==="fontFamily"){_t(()=>X("fontSize"));return}x.value==="fontSize"&&_t(W)},he=Ce(()=>_.value?_.value:{minWidth:o.minWidth}),ye=Ce(()=>m?.value?hr.dropdownCaretUp:hr.dropdownCaretDown);return(Re,je)=>(ve(),we("div",{class:on(["sd-toolbar-item",Ye(b).className]),style:Rn(he.value),role:e.isOverflowItem?"menuitem":"button","aria-label":Ye(b).ariaLabel,"aria-disabled":Ye(g)?"true":void 0,"data-sd-part":"toolbar-item",onClick:U,onKeydown:je[9]||(je[9]=ri(Je=>V(Je),["enter"])),tabindex:"0"},[de("div",{class:on(["sd-toolbar-button",{"sd-active":Ye(s),"sd-disabled":Ye(g),narrow:e.isNarrow,wide:e.isWide,split:S.value,"has-inline-text-input":Ye(C),"high-contrast":Ye(q)}]),"data-item":`btn-${Ye(i)||""}`},[S.value?(ve(),we("div",{key:0,class:"sd-toolbar-button__main","data-item":`btn-${Ye(i)||""}-main`,onClick:je[0]||(je[0]=Je=>P(Je))},[Ye(a)?(ve(),mn(YE,{key:0,color:Ye(d),class:"sd-toolbar-icon",icon:Ye(a),name:Ye(i)},null,8,["color","icon","name"])):dt("",!0),Ye(l)&&!Ye(u)&&!Ye(v)?(ve(),we("div",uG,Et(Ye(l)),1)):dt("",!0)],8,cG)):dt("",!0),S.value?(ve(),we("div",{key:1,class:"sd-toolbar-button__caret","data-item":`btn-${Ye(i)||""}-caret`,"aria-label":`${Ye(b).ariaLabel} options`,role:"button"},[de("div",{class:"sd-dropdown-caret",innerHTML:ye.value,style:Rn({opacity:Ye(g)?.6:1})},null,12,fG)],8,dG)):(ve(),we(Vt,{key:2},[Ye(a)?(ve(),mn(YE,{key:0,color:Ye(d),class:"sd-toolbar-icon",icon:Ye(a),name:Ye(i)},null,8,["color","icon","name"])):dt("",!0),Ye(l)&&!Ye(u)&&(!Ye(v)||x.value==="fontFamily")?(ve(),we("div",{key:1,class:on(["sd-button-label",{"sd-visually-hidden":Ye(v)&&x.value==="fontFamily"}])},Et(Ye(l)),3)):dt("",!0),Ye(v)?(ve(),we("span",hG,[Ye(i)==="fontSize"?xi((ve(),we("input",{key:0,"onUpdate:modelValue":je[1]||(je[1]=Je=>L.value=Je),onKeydown:[ri(an(Te,["stop","prevent"]),["enter"]),je[2]||(je[2]=ri(Je=>ge(Je),["tab"]))],onClick:je[3]||(je[3]=an(Je=>se(Je),["stop"])),onFocus:je[4]||(je[4]=Je=>se(Je)),type:"text",class:on(["button-text-input button-text-input--font-size",{"high-contrast":Ye(q)}]),id:"inlineTextInput-"+Ye(i),autocomplete:"off",ref_key:"inlineInput",ref:B},null,42,pG)),[[Pi,L.value]]):xi((ve(),we("input",{key:1,"onUpdate:modelValue":je[5]||(je[5]=Je=>L.value=Je),placeholder:Ye(l),onKeydown:[ri(an(Te,["stop","prevent"]),["enter"]),je[6]||(je[6]=ri(Je=>ge(Je),["tab"]))],onClick:je[7]||(je[7]=an(Je=>se(Je),["stop"])),onFocus:je[8]||(je[8]=Je=>se(Je)),type:"text",class:on(["button-text-input",{"button-text-input--font-family":x.value==="fontFamily","high-contrast":Ye(q)}]),id:"inlineTextInput-"+Ye(i),"data-item":x.value==="fontFamily"?`btn-${Ye(i)}-input`:void 0,autocomplete:"off",ref_key:"inlineInput",ref:B},null,42,mG)),[[Pi,L.value]])])):dt("",!0),Ye(f)?(ve(),we("div",{key:3,class:"sd-dropdown-caret","data-item":`btn-${Ye(i)||""}-toggle`,innerHTML:ye.value,style:Rn({opacity:Ye(g)?.6:1})},null,12,gG)):dt("",!0)],64)),de("div",vG,Et(`${Ye(b).ariaLabel} ${Ye(s)?"selected":"unset"}`),1)],10,lG)],46,aG))}},W1=gn(yG,[["__scopeId","data-v-96796456"]]);Bt(),bn();var bG={class:"toolbar-separator",role:"separator","aria-label":"Toolbar separator"},wG={__name:"ToolbarSeparator",props:{active:{type:Boolean,default:!1}},emits:["command"],setup(e,{emit:t}){const{isHighContrastMode:n}=rs(),r=()=>n.value?"#000":"var(--sd-ui-border, #dbdbdb)";return(o,i)=>(ve(),we("div",bG,[de("div",{class:"separator-inner",style:Rn({backgroundColor:r()})},null,4)]))}},CG=gn(wG,[["__scopeId","data-v-cb82253a"]]);Bt(),bn();var kG={class:"toolbar-dropdown"},SG=["data-superdoc-ui-owner"],_G=["onClick"],AG={key:0,class:"toolbar-dropdown-option__icon"},IG={class:"toolbar-dropdown-option__label"},_g='button, [href], input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])',EG={__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,{expose:t,emit:n}){const r=e,o=n,i=Gw(),s=Gs("sdToolbarOwnerId",null),a=ne(null),l=ne(null),u=ne({top:"0px",left:"0px",maxHeight:"none"}),d=ne([]),f=ne(-1),p=Ce(()=>!!r.show),g=ne(document.fullscreenElement),m=Ce(()=>p.value&&g.value?g.value:document.body),v=Ce(()=>r.options.some(ce=>ce?.type==="render")),C=Ce(()=>!!i.menu),w=Ce(()=>typeof r.menuProps!="function"?{}:r.menuProps()||{}),_=Ce(()=>{const{class:ce,style:H,...A}=w.value;return A}),b=Ce(()=>["toolbar-dropdown-menu",w.value.class,{"toolbar-dropdown-menu--render-only":C.value||r.options.length>0&&r.options.every(ce=>ce&&ce.type==="render")}]),S=Ce(()=>{const ce=w.value.style||{};return{...r.contentStyle,...ce}}),x=Ce(()=>({...S.value,position:"fixed",top:u.value.top,left:u.value.left,maxHeight:u.value.maxHeight,zIndex:2e3})),L=ce=>{o("update:show",ce)},B=()=>{p.value&&L(!1)},q=()=>{if(!a.value)return;const ce=a.value.getBoundingClientRect(),H=l.value,A=H?.offsetWidth??0,oe=H?.scrollHeight??H?.offsetHeight??0,j=window.innerWidth||document.documentElement.clientWidth||0,Q=window.innerHeight||document.documentElement.clientHeight||0,G=8,pe=4,ke=ce.bottom+pe,te=ce.top-pe,N=Math.max(0,Q-ke-G),Y=Math.max(0,te-G),me=N<oe&&Y>N,Pe=me?Y:N,_e=me?Math.max(G,te-(oe?Math.min(oe,Pe):Pe)):ke;let it=ce.left;r.placement==="bottom-end"&&(it=ce.right-A);const Xe=Math.max(G,j-A-G);it=Math.min(Math.max(G,it),Xe),u.value={top:`${_e}px`,left:`${it}px`,maxHeight:`${Pe}px`}},F=async()=>{g.value=document.fullscreenElement,p.value&&(await _t(),q())},P=()=>{r.disabled||L(!p.value)},U=ce=>typeof r.nodeProps!="function"?{}:r.nodeProps(ce)||{},T=ce=>{ce?.disabled||ce?.type!=="render"&&(o("select",ce?.key,ce),B())},V=ce=>ce?.type==="render",R=ce=>!ce?.disabled&&ce?.type!=="render",$=ce=>typeof ce?.icon=="function"||!!ce?.icon,se=ce=>typeof ce?.icon=="function"?ce.icon(ce):ce?.icon||null,X=ce=>ce?typeof ce=="string"?ce.split(/\s+/).includes("sd-selected"):Array.isArray(ce)?ce.some(X):typeof ce=="object"?!!ce["sd-selected"]:!1:!1,J=ce=>X(ce?.props?.class)||X(ce?.class),W=()=>r.options.map((ce,H)=>R(ce)?H:-1).filter(ce=>ce>=0),Te=()=>{const ce=r.options.findIndex(H=>R(H)&&J(H));return ce>=0?ce:W()[0]??-1},ge=(ce,H)=>{if(!ce){delete d.value[H];return}d.value[H]=ce},he=()=>{d.value.forEach((H,A)=>{H&&H.setAttribute("tabindex",A===f.value?"0":"-1")});const ce=d.value[f.value];ce&&typeof ce.focus=="function"&&(ce.focus(),ce.scrollIntoView?.({block:"nearest",inline:"nearest"}))},ye=ce=>{const H=W();if(!H.length){f.value=-1;return}const A=H.indexOf(f.value);if(A<0){f.value=ce>0?H[0]:H[H.length-1];return}const oe=(A+ce+H.length)%H.length;f.value=H[oe]},Re=()=>{let ce=r.options[f.value];if(!R(ce)){const H=W()[0];ce=H===void 0?null:r.options[H]}ce&&T(ce)},je=Cl({name:"ToolbarDropdownRenderOption",props:{option:{type:Object,required:!0}},setup(ce){return()=>typeof ce.option.render!="function"?null:ce.option.render()}}),Je=Cl({name:"ToolbarDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(ce){return()=>{const H=se(ce.option);return typeof H=="string"?Nr("span",{innerHTML:H}):H}}}),bt=ce=>{if(!p.value)return;const H=ce.target;if(!(H instanceof Element))return;const A=a.value?.contains(H),oe=l.value?.contains(H);A||oe||r.hasOpenChild&&H.closest('[data-sd-part="dropdown-menu"]')||B()},ft=ne(null),Mt=()=>{const ce=a.value,H=document.activeElement;if(ce&&H instanceof HTMLElement&&ce.contains(H)){ft.value=H;return}ft.value=ce?.matches?.(_g)?ce:ce?.querySelector(_g)},Le=()=>{const ce=ft.value;if(ce instanceof HTMLElement&&document.contains(ce)){ce.focus();return}const H=a.value;if(!H)return;const A=H.matches?.(_g)?H:H.querySelector(_g);if(A instanceof HTMLElement){A.focus();return}H.setAttribute("tabindex","-1"),H.focus()};t({focusTrigger:Le});const Se=ce=>{if(!p.value)return;const{key:H}=ce;if(["Escape","ArrowDown","ArrowUp","Enter"].includes(H)){if(H==="Escape"){if(!r.closeOnEscape)return;ce.preventDefault(),B(),_t(()=>{requestAnimationFrame(Le)});return}if(!(v.value||C.value)){if(ce.preventDefault(),H==="ArrowDown"){ye(1),he();return}if(H==="ArrowUp"){ye(-1),he();return}H==="Enter"&&Re()}}};return $t(p,async ce=>{if(!ce){f.value=-1,d.value=[];return}Mt(),await _t(),q(),!(v.value||C.value)&&(f.value=Te(),await _t(),he())},{immediate:!0}),$t(p,ce=>{ce?(document.addEventListener("pointerdown",bt,!0),document.addEventListener("keydown",Se,!0),window.addEventListener("resize",q),window.addEventListener("scroll",q,!0)):(document.removeEventListener("pointerdown",bt,!0),document.removeEventListener("keydown",Se,!0),window.removeEventListener("resize",q),window.removeEventListener("scroll",q,!0))},{immediate:!0}),jn(()=>{document.addEventListener("fullscreenchange",F)}),lr(()=>{document.removeEventListener("fullscreenchange",F),document.removeEventListener("pointerdown",bt,!0),document.removeEventListener("keydown",Se,!0),window.removeEventListener("resize",q),window.removeEventListener("scroll",q,!0)}),(ce,H)=>(ve(),we("div",kG,[de("div",{ref_key:"triggerRef",ref:a,class:"toolbar-dropdown-trigger","data-sd-part":"dropdown-trigger",onClick:P},[Lu(ce.$slots,"trigger",{},void 0,!0)],512),(ve(),mn(_l,{to:m.value},[sn(Kp,{name:"fade-in-scale-up-transition"},{default:go(()=>[p.value?(ve(),we("div",Ks({key:0,ref_key:"menuRef",ref:l,"data-sd-part":"dropdown-menu",class:b.value,style:x.value},_.value,{"data-superdoc-ui-owner":Ye(s)}),[C.value?Lu(ce.$slots,"menu",{key:0},void 0,!0):dt("",!0),(ve(!0),we(Vt,null,Fn(C.value?[]:e.options,(A,oe)=>(ve(),we("div",Ks({key:A.key,ref_for:!0,ref:j=>ge(j,oe),class:["toolbar-dropdown-option",[A.class,A.props?.class,{"sd-disabled":A.disabled,"sd-render":V(A)}]],tabindex:"-1",onClick:j=>T(A)},{ref_for:!0},{...A.props,...U(A)}),[V(A)?(ve(),mn(Ye(je),{key:0,option:A},null,8,["option"])):(ve(),we(Vt,{key:1},[$(A)?(ve(),we("span",AG,[sn(Ye(Je),{option:A},null,8,["option"])])):dt("",!0),de("span",IG,Et(A.label),1)],64))],16,_G))),128))],16,SG)):dt("",!0)]),_:3})],8,["to"]))]))}},XE=gn(EG,[["__scopeId","data-v-e6f71d76"]]),ZE=e=>{const t=e?.target;t instanceof Element&&(t.closest('input, textarea, [contenteditable="true"]')||e.preventDefault())},Jl=(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 TG={__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=ne(null),i=Ce(()=>r.toolbarItem.expand.value),s=Ce(()=>r.overflowItems.some(d=>d.type==="dropdown"&&Ye(d.expand))),a=Ce(()=>({...r.toolbarItem,active:i.value})),l=d=>{if(d!==i.value){if(d){n("buttonClick",r.toolbarItem);return}n("close")}},u=({item:d,argument:f,option:p})=>{d.name.value==="watermark"&&(n("close"),o.value?.focusTrigger()),n("command",{item:d,argument:f,option:p})};return(d,f)=>(ve(),mn(XE,{ref_key:"dropdown",ref:o,class:"overflow-menu","close-on-escape":!s.value,"has-open-child":s.value,"content-style":{width:"200px",padding:"4px 8px",fontFamily:r.uiFontFamily},options:[],placement:"bottom-end",show:i.value,"onUpdate:show":l,"menu-props":()=>({role:"group",class:["overflow-menu_items","sd-toolbar-overflow-menu"]})},{trigger:go(()=>[sn(W1,{"toolbar-item":a.value,"allow-enter-propagation":!0},null,8,["toolbar-item"])]),menu:go(()=>[sn(Eg,{class:"superdoc-toolbar-overflow","toolbar-items":e.overflowItems,"ui-font-family":r.uiFontFamily,"from-overflow":"",onMousedown:Ye(ZE),onCommand:u},null,8,["toolbar-items","ui-font-family","onMousedown"])]),_:1},8,["close-on-escape","has-open-child","content-style","show"]))}},xG=gn(TG,[["__scopeId","data-v-1227fcf9"]]),QE=e=>String(e??"").trim().toLowerCase(),Ag=(e,t)=>{const n=QE(e);if(!n)return-1;for(let r=0;r<t.length;r+=1)if(QE(t[r]).startsWith(n))return r;return-1},RG=(e,t,{autocomplete:n=!0}={})=>{const r=String(e??""),o=Ag(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}},MG=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},LG=e=>e<=31||e===127,PG=e=>e===32||e===160||e===65279,DG=e=>Array.from(String(e)).filter(t=>!LG(t.charCodeAt(0))).join(""),OG=e=>{let t="",n=!1;for(const r of String(e)){if(PG(r.charCodeAt(0))){n=t.length>0;continue}n&&(t+=" "),n=!1,t+=r}return t},FG=e=>{const t=String(e??"").split(",")[0]??"",n=DG(t);return OG(MG(n)).trim()},NG=1,BG=1638,zG=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<NG?"":String(Math.min(r,BG))};Bt(),bn();var jG=["data-item"],VG=["id","value","disabled","aria-label","aria-expanded","aria-controls","aria-activedescendant","data-item"],UG=["data-item","aria-label","disabled"],$G=["innerHTML"],HG=["data-superdoc-ui-owner","id","aria-label"],GG=["id","aria-selected","aria-label","onMousedown","onMouseenter"],WG={class:"toolbar-dropdown-option__label"},KG={class:"sd-button-label sd-font-combobox__legacy-label","aria-hidden":"true"},qG={__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}=rs(),i=Gs("sdToolbarOwnerId",null),s=ne(null),a=ne(null),l=ne(null),u=ne([]),d=ne(!1),f=ne(!1),p=ne(-1),g=ne(""),m=ne(""),v=ne(!1),C=ne({top:"0px",left:"0px",minWidth:"0px",maxHeight:"none"}),w=Ce(()=>n.item.nestedOptions?.value??[]),_=Ce(()=>w.value.map(N=>String(N?.label??""))),b=Ce(()=>String(n.item.label?.value??"")),S=Ce(()=>!!n.item.disabled?.value),x=Ce(()=>String(n.item.name?.value??"")),L=Ce(()=>n.item.attributes?.value?.ariaLabel??"Font family"),B=Ce(()=>d.value?m.value:b.value),q=Ce(()=>`sd-${x.value||"combobox"}-listbox-${n.item.id?.value??"default"}`),F=N=>`${q.value}-option-${N}`,P=Ce(()=>f.value&&p.value>=0?F(p.value):void 0),U=Ce(()=>f.value?hr.dropdownCaretUp:hr.dropdownCaretDown),T=N=>{const Y=String(N??"").trim().toLowerCase();return w.value.find(me=>String(me?.label??"").trim().toLowerCase()===Y)?.props?.style?.fontFamily||N||n.uiFontFamily},V=Ce(()=>n.showPreview?{fontFamily:T(d.value?m.value:b.value)}:{fontFamily:n.uiFontFamily}),R=()=>{const N=n.item.selectedValue?.value;if(N){const Y=w.value.findIndex(me=>me?.key===N);if(Y>=0)return Y}return _.value.findIndex(Y=>Y.toLowerCase()===b.value.toLowerCase())},$=(N,Y)=>{const me=s.value;if(!(!me||typeof me.setSelectionRange!="function"))try{me.setSelectionRange(N,Y)}catch{}},se=()=>{u.value[p.value]?.scrollIntoView?.({block:"nearest",inline:"nearest"})},X=()=>{u.value[p.value]?.focus?.()},J=()=>{const N=a.value;if(!N)return;const Y=N.getBoundingClientRect(),me=l.value,Pe=me?.scrollHeight??me?.offsetHeight??0,_e=window.innerHeight||document.documentElement.clientHeight||0,it=window.innerWidth||document.documentElement.clientWidth||0,Xe=8,at=4,Pt=Y.bottom+at,Ft=Y.top-at,Zt=Math.max(0,_e-Pt-Xe),At=Math.max(0,Ft-Xe),ct=Zt<Pe&&At>Zt,tn=ct?At:Zt,Yt=ct?Math.max(Xe,Ft-(Pe?Math.min(Pe,tn):tn)):Pt,Ln=Math.min(Math.max(Xe,Y.left),Math.max(Xe,it-Y.width-Xe));C.value={top:`${Yt}px`,left:`${Ln}px`,minWidth:`${Y.width}px`,maxHeight:`${tn}px`}},W=Ce(()=>({position:"fixed",top:C.value.top,left:C.value.left,minWidth:C.value.minWidth,maxHeight:C.value.maxHeight,fontFamily:n.uiFontFamily,zIndex:2e3})),Te=N=>{n.item.expand&&typeof n.item.expand=="object"&&"value"in n.item.expand&&(n.item.expand.value=N)},ge=(N,{focusInput:Y=!1,focusOption:me=!1}={})=>{if(S.value||!w.value.length){Te(!1);return}f.value=!0,Te(!0),p.value=N??-1,Y&&(d.value=!0,m.value=b.value,s.value?.focus()),_t(()=>{J(),se(),me&&X()})},he=({syncItem:N=!0}={})=>{f.value=!1,p.value=-1,N&&Te(!1)},ye=()=>{he(),d.value=!1,g.value="",m.value=b.value},Re=()=>{S.value||(f.value||r("item-clicked"),d.value=!0,g.value="",m.value=b.value,_t(()=>$(0,m.value.length)))},je=N=>{if(S.value)return;const Y=document.activeElement===s.value;if(r("item-clicked"),d.value=!0,Y||(g.value="",m.value=b.value,N.preventDefault(),s.value?.focus({preventScroll:!0}),$(0,b.value.length)),!f.value){const me=R();ge(me>=0?me:0)}},Je=N=>{const Y=N.relatedTarget;Y instanceof Node&&a.value?.contains(Y)||Y instanceof Node&&l.value?.contains(Y)||ye()},bt=N=>{if(v.value)return;const Y=N.target,me=Y.value,Pe=typeof Y.selectionStart=="number"?Y.selectionStart:me.length,_e=typeof Y.selectionEnd=="number"?Y.selectionEnd:Pe,it=typeof N.inputType=="string"&&N.inputType.startsWith("delete"),Xe=Pe===me.length&&_e===me.length;g.value=me;const at=RG(me,_.value,{autocomplete:!it&&Xe});m.value=at.display,Y.value=at.display,at.display===me&&!Xe?$(Pe,_e):$(at.selectionStart,at.selectionEnd),f.value&&(p.value=at.matchIndex,_t(se))},ft=N=>{v.value=!1,bt(N)},Mt=N=>{if(!w.value.length)return;const Y=w.value.length,me=p.value<0?N>0?-1:0:p.value;p.value=(me+N+Y)%Y,_t(se)},Le=(N,Y)=>{r("item-clicked"),r("command",{item:n.item,argument:N,option:Y}),Y&&(n.item.selectedValue.value=Y.key)},Se=N=>{N&&(Le(N.value??N.label,N),d.value=!1,g.value="",m.value=N.label,he())},ce=()=>{if(f.value&&p.value>=0)return Se(w.value[p.value]),!0;const N=Ag(g.value,_.value);if(N>=0)return Se(w.value[N]),!0;const Y=n.normalizeValue(g.value);return Y?(Le(Y,null),d.value=!1,g.value="",m.value=Y,he(),!0):!1},H=N=>{if(!(N.isComposing||v.value||N.keyCode===229)&&!(N.ctrlKey||N.metaKey||N.altKey))switch(N.key){case"ArrowDown":if(N.preventDefault(),f.value)X();else{const Y=Ag(g.value,_.value),me=Y>=0?Y:R();ge(me>=0?me:0,{focusOption:!0})}break;case"ArrowUp":if(N.preventDefault(),f.value)X();else{const Y=Ag(g.value,_.value),me=Y>=0?Y:R();ge(me>=0?me:w.value.length-1,{focusOption:!0})}break;case"Enter":N.preventDefault(),ce()&&r("editor-handoff"),s.value?.blur();break;case"Tab":N.preventDefault(),ce(),he(),s.value?.blur(),r("tab-out",N);break;case"Escape":N.preventDefault(),ye(),_t(()=>s.value?.focus());break;default:break}},A=N=>{if(N.preventDefault(),!S.value)if(r("item-clicked"),f.value)he(),s.value?.focus();else{const Y=R();ge(Y>=0?Y:0,{focusOption:!0})}},oe=(N,Y)=>{N.preventDefault(),Se(Y),r("editor-handoff"),s.value?.blur()},j=N=>{p.value=N},Q=N=>{if(!(N.ctrlKey||N.metaKey||N.altKey))switch(N.key){case"ArrowDown":N.preventDefault(),Mt(1),X();break;case"ArrowUp":N.preventDefault(),Mt(-1),X();break;case"Enter":N.preventDefault(),p.value>=0&&(Se(w.value[p.value]),r("editor-handoff"));break;case"Escape":N.preventDefault(),ye(),_t(()=>s.value?.focus());break;case"Tab":N.preventDefault(),p.value>=0?Se(w.value[p.value]):he(),r("tab-out",{shiftKey:N.shiftKey,target:s.value});break;default:break}},G=N=>{if(!f.value)return;const Y=N.target;Y instanceof Element&&(a.value?.contains(Y)||l.value?.contains(Y)||ye())};$t(f,N=>{N?(document.addEventListener("pointerdown",G,!0),window.addEventListener("resize",J),window.addEventListener("scroll",J,!0)):(document.removeEventListener("pointerdown",G,!0),window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0),u.value=[])},{immediate:!0}),lr(()=>{document.removeEventListener("pointerdown",G,!0),window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0)});const pe=(N,Y)=>{if(!N){delete u.value[Y];return}u.value[Y]=N},ke=N=>N===p.value,te=N=>N?.key&&N.key===n.item.selectedValue?.value;return $t(b,N=>{d.value||(m.value=N)}),$t(()=>!!n.item.expand?.value,N=>{if(N&&!f.value){const Y=R();ge(Y>=0?Y:0,{focusInput:!0});return}!N&&f.value&&he({syncItem:!1})}),(N,Y)=>(ve(),we("div",{ref_key:"rootRef",ref:a,class:on(["sd-font-combobox sd-toolbar-split-field",{"sd-disabled":S.value,"high-contrast":Ye(o)}]),style:Rn(n.item.style?.value),"data-item":`btn-${x.value}`},[de("span",{class:"sd-font-combobox__field sd-toolbar-split-field__main",onMousedown:je},[de("input",{ref_key:"inputRef",ref:s,id:`inlineTextInput-${x.value}`,class:"button-text-input sd-font-combobox__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:"false",value:B.value,style:Rn(V.value),disabled:S.value,"aria-label":L.value,"aria-expanded":f.value?"true":"false","aria-controls":q.value,"aria-activedescendant":P.value,"aria-haspopup":"listbox","aria-autocomplete":"both","data-item":`btn-${x.value}-input`,onFocus:Re,onBlur:Je,onInput:bt,onKeydown:H,onCompositionstart:Y[0]||(Y[0]=me=>v.value=!0),onCompositionend:ft},null,44,VG)],32),de("button",{type:"button",class:"sd-font-combobox__caret sd-toolbar-split-field__caret","data-item":`btn-${x.value}-toggle`,tabindex:"-1","aria-label":`${L.value} options`,disabled:S.value,onMousedown:A},[de("span",{class:"sd-dropdown-caret",innerHTML:U.value},null,8,$G)],40,UG),(ve(),mn(_l,{to:"body"},[f.value?(ve(),we("div",{key:0,ref_key:"popupRef",ref:l,role:"listbox","data-sd-part":"dropdown-menu","data-superdoc-ui-owner":Ye(i),id:q.value,"aria-label":L.value,class:on(["sd-font-combobox__listbox",{"high-contrast":Ye(o)}]),style:Rn(W.value)},[(ve(!0),we(Vt,null,Fn(w.value,(me,Pe)=>(ve(),we("div",Ks({key:me.key,ref_for:!0,ref:_e=>pe(_e,Pe),id:F(Pe),role:"option",tabindex:"-1",class:["toolbar-dropdown-option sd-font-combobox__option",{"sd-active":ke(Pe),"sd-selected":te(me)}],"aria-selected":te(me)?"true":"false","aria-label":`${L.value} - ${me.label}`},{ref_for:!0},me.props,{onMousedown:_e=>oe(_e,me),onMouseenter:_e=>j(Pe),onKeydown:Q}),[de("span",WG,Et(me.label),1)],16,GG))),128))],14,HG)):dt("",!0)])),de("span",KG,Et(b.value),1)],14,jG))}},JE=gn(qG,[["__scopeId","data-v-eb442535"]]);Bt();var YG={__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)=>(ve(),mn(JE,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!0,"normalize-value":Ye(FG),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 XG={__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)=>(ve(),mn(JE,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!1,"normalize-value":Ye(zG),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 ZG=2500,QG=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=Ww(),r=ne(!1),o=ne(null),i=ne(null),s=ne({top:"0px",left:"0px",below:!1});let a=null,l=null,u=null;const d=Ce(()=>["sd-tooltip-content",s.value.below&&"sd-tooltip-below",n.class]),f=Ce(()=>({...t.contentStyle,...n.style||{},position:"fixed",top:s.value.top,left:s.value.left,zIndex:2100,transformOrigin:s.value.below?"top center":"bottom center"})),p=()=>{a&&(window.clearTimeout(a),a=null)},g=()=>{l&&(window.clearTimeout(l),l=null)},m=()=>{u&&(window.clearTimeout(u),u=null)},v=()=>{m(),u=window.setTimeout(()=>{u=null,_()},ZG)},C=()=>{if(!o.value||!i.value)return;const U=o.value.getBoundingClientRect(),T=i.value.offsetWidth,V=i.value.offsetHeight,R=window.innerWidth||document.documentElement.clientWidth||0,$=window.innerHeight||document.documentElement.clientHeight||0,se=8;let X=U.left+U.width/2-T/2;X=Math.max(se,Math.min(X,R-T-se));const J=U.top-V-10,W=J<se,Te=W?U.bottom+10:J,ge=Math.max(se,Math.min(Te,$-V-se));s.value={top:`${ge}px`,left:`${X}px`,below:W}},w=async()=>{t.disabled||(p(),g(),!r.value&&(r.value=!0,v(),await _t(),C()))},_=()=>{g(),p(),m(),r.value&&(r.value=!1)},b=()=>{if(p(),g(),!r.value){if(t.delay===0){w();return}l=window.setTimeout(()=>{l=null,w()},t.delay)}},S=()=>{if(g(),p(),!!r.value){if(t.duration===0){_();return}a=window.setTimeout(()=>{a=null,_()},t.duration)}},x=()=>{t.trigger==="hover"&&b()},L=()=>{t.trigger==="hover"&&S()},B=()=>{g(),p()},q=()=>{S()},F=U=>{U.key==="Escape"&&_()},P=U=>{(U.key==="Enter"||U.key===" ")&&_()};return $t(()=>t.disabled,U=>{U&&_()}),$t(r,U=>{U?(window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),document.addEventListener("keydown",F,!0)):(window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0),document.removeEventListener("keydown",F,!0))}),lr(()=>{g(),p(),m(),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0),document.removeEventListener("keydown",F,!0)}),(U,T)=>(ve(),we(Vt,null,[de("span",{ref_key:"triggerRef",ref:o,class:"sd-tooltip-trigger",onMouseenter:x,onMouseleave:L,onFocusin:x,onFocusout:L,onClickCapture:_,onKeydownCapture:P},[Lu(U.$slots,"trigger",{},void 0,!0)],544),(ve(),mn(_l,{to:"body"},[sn(Kp,{name:"fade-in-scale-up-transition",css:r.value},{default:go(()=>[r.value&&!e.disabled?(ve(),we("div",{key:0,ref_key:"contentRef",ref:i,class:on(d.value),style:Rn(f.value),onMouseenter:B,onMouseleave:q},[T[0]||(T[0]=de("span",{class:"sd-tooltip-arrow","aria-hidden":"true"},null,-1)),Lu(U.$slots,"default",{},void 0,!0)],38)):dt("",!0)]),_:3},8,["css"])]))],64))}}),Ig=gn(QG,[["__scopeId","data-v-71c6de4c"]]);Bt(),bn();var JG=["onKeydown","tabindex","data-item-id"],eW={key:0},tW={key:0},nW={key:0},rW={key:0},oW={key:0},iW={__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}=Sr(),o=ne([]),i=ne(null),s=e,a=ne(null),{isHighContrastMode:l}=rs(),u=window.matchMedia("(max-width: 768px)").matches,d=Ce(()=>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=Le=>Le.type==="button",p=Le=>Le.type==="dropdown",g=Le=>Le.type==="dropdown"&&Le.name?.value==="fontFamily",m=Le=>Le.type==="dropdown"&&Le.name?.value==="fontSize",v=Le=>Le.type==="separator",C=Le=>Le.type==="overflow",w=Le=>!!Le.nestedOptions?.value?.length,_=Le=>{if(!Le)return!1;const Se=Le.expand;return typeof Se=="object"&&Se!==null&&"value"in Se?!!Se.value:!!Se},b=(Le,Se)=>{Le?.expand&&(Le.expand.value=Se)},S=(Le,Se=void 0)=>{if(Le.disabled.value)return;if(C(Le)){const H=!_(Le);H&&B(),b(Le,H),a.value=H?Le:null,n("item-clicked");return}if(p(Le))return;a.value&&p(a.value)&&_(a.value)&&B(),n("item-clicked");const ce=Se!==void 0?Se:Le.argument?.value;n("command",ce===void 0?{item:Le}:{item:Le,argument:ce})},x=(Le,Se)=>{Le.disabled.value||(a.value=null,n("command",{item:Le,argument:Se}))},L=Le=>{if(Le.disabled.value)return;B();const Se=Le.splitButtonCommand,ce=Le.command,H=Se||ce;if(!H)return;const A={...Le,command:H};n("item-clicked"),n("command",{item:A})},B=()=>{const Le=r?.$toolbar?.toolbarItems||[],Se=r?.$toolbar?.overflowItems||[],ce=[...Le,...Se];(ce.length?ce:s.toolbarItems).forEach(H=>{const A=C(H)&&!s.fromOverflow;(p(H)||A)&&b(H,!1)}),a.value=null},q=(Le,Se)=>{B();const ce=Le.dropdownValueKey.value?Se[Le.dropdownValueKey.value]:Se.label;n("command",{item:Le,argument:ce,option:Se}),Le.selectedValue.value=Se.key,Le.restoreEditorFocus&&Jl(r?.$toolbar)},F=Le=>{n("command",Le)},P=()=>{B(),n("item-clicked")},U=()=>{const Le=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Le instanceof HTMLElement?(Le.focus({preventScroll:!0}),!0):!1},T=()=>{const Le=r?.$toolbar?.pendingSelectionCapture,Se=()=>{Le&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Le)};if(U()){Se();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Se())},V=Le=>!(Le instanceof HTMLElement)||Le.classList.contains("sd-disabled")?null:Le.querySelector("input:not([disabled]), textarea:not([disabled]), select:not([disabled])")||Le.querySelector('button:not([disabled]), [role="button"]:not(.sd-disabled), [tabindex]:not([tabindex="-1"])'),R=(Le,Se)=>{const ce=Le?.target?.closest?.(".sd-toolbar-item-ctn");if(!(ce instanceof HTMLElement))return!1;let H=Se>0?ce.nextElementSibling:ce.previousElementSibling;for(;H;){const A=V(H);if(A instanceof HTMLElement)return ce.setAttribute("tabindex","-1"),H.setAttribute("tabindex","0"),A.focus(),!0;H=Se>0?H.nextElementSibling:H.previousElementSibling}return!1},$=Le=>{B();const Se=Le?.shiftKey?-1:1;R(Le,Se)||T()},se=Le=>{if(B(),Le?.shiftKey){R(Le,-1)||T();return}T()},X=()=>{T()},J=Le=>Le.nestedOptions?.value?.length?Le.nestedOptions.value.map(Se=>{const ce=Se?.type!=="render"&&Le.selectedValue.value===Se.key;return{...Se,props:{...Se.props,class:ce?"sd-selected":""}}}):[],W=(Le,Se)=>({role:"menuitem","aria-label":`${Se.attributes.value.ariaLabel} - ${Le.label}`}),Te=Le=>{const Se=Le.target,ce=Le.target.closest(".sd-toolbar-item-ctn").nextElementSibling;ce&&(Se.setAttribute("tabindex","-1"),ce.setAttribute("tabindex","0"),ce.focus())},ge=Le=>{const Se=Le.target,ce=Le.target.closest(".sd-toolbar-item-ctn").previousElementSibling;ce&&(Se.setAttribute("tabindex","-1"),ce.setAttribute("tabindex","0"),ce.focus())},he=Le=>{const Se=Le.target.closest(".button-group").nextElementSibling;if(Se)Se.setAttribute("tabindex","0"),Se.focus();else{const ce=document.querySelector(".ProseMirror");ce&&ce.focus()}},ye=Le=>{const Se=Le.target.closest(".button-group").previousElementSibling;Se&&(Se.setAttribute("tabindex","0"),Se.focus())},Re=Le=>{if(!Le.disabled.value){if(p(Le)){bt(!_(Le),Le);return}S(Le)}},je=(Le,Se)=>{const ce=Le.target.nodeName==="INPUT"||Le.target.nodeName==="TEXTAREA",H=Se.name.value==="fontSize"||Se.name.value==="fontFamily";if(!(ce&&H)&&["Enter"," ","Spacebar","Escape","ArrowRight","ArrowLeft","Tab"].includes(Le.key))switch(Le.preventDefault(),Le.key){case"Enter":case" ":case"Spacebar":Re(Se);break;case"Escape":B();break;case"ArrowRight":B(),Te(Le);break;case"ArrowLeft":B(),ge(Le);break;case"Tab":Le.shiftKey?ye(Le):he(Le);break;default:break}},Je=Le=>{const Se=o.value.find(ce=>!ce.classList.contains("sd-disabled"));Se&&(Se.setAttribute("tabindex","0"),Se.focus())},bt=(Le,Se)=>{if(n("item-clicked"),!Le){B(),n("dropdown-update-show",!1);return}B(),a.value=Se,b(Se,!0),n("dropdown-update-show",!0)},ft=Le=>{if(!a.value)return;const Se=Le.target;Se instanceof Element&&(Se.closest('[data-sd-part="dropdown-menu"]')||i.value?.contains(Se)||B())};return $t(()=>_(a.value),Le=>{Le?document.addEventListener("pointerdown",ft,!0):document.removeEventListener("pointerdown",ft,!0)},{immediate:!0}),lr(()=>{document.removeEventListener("pointerdown",ft,!0)}),(Le,Se)=>(ve(),we("div",{style:Rn(d.value),class:"button-group",role:"group",onFocus:Je,ref_key:"buttonGroupRef",ref:i},[(ve(!0),we(Vt,null,Fn(e.toolbarItems,(ce,H)=>(ve(),we("div",{key:ce.id.value,class:on([{narrow:ce.isNarrow.value,wide:ce.isWide.value,"sd-disabled":ce.disabled.value},"sd-toolbar-item-ctn"]),onKeydown:A=>je(A,ce),ref_for:!0,ref_key:"toolbarItemRefs",ref:o,tabindex:H===0?0:-1,"data-item-id":ce.id.value},[v(ce)?(ve(),mn(CG,{key:0,style:{width:"20px"}})):dt("",!0),g(ce)&&w(ce)?(ve(),mn(Ig,{key:1,trigger:"hover",disabled:!ce.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:go(()=>[sn(YG,{item:ce,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:F,onItemClicked:P,onTabOut:Se[0]||(Se[0]=A=>$(A)),onEditorHandoff:X},null,8,["item","ui-font-family"])]),default:go(()=>[de("div",null,[Ri(Et(ce.tooltip)+" ",1),ce.disabled.value?(ve(),we("span",eW,"(disabled)")):dt("",!0)])]),_:2},1032,["disabled","content-style"])):m(ce)&&w(ce)?(ve(),mn(Ig,{key:2,trigger:"hover",disabled:!ce.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:go(()=>[sn(XG,{item:ce,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:F,onItemClicked:P,onTabOut:Se[1]||(Se[1]=A=>se(A)),onEditorHandoff:X},null,8,["item","ui-font-family"])]),default:go(()=>[de("div",null,[Ri(Et(ce.tooltip)+" ",1),ce.disabled.value?(ve(),we("span",tW,"(disabled)")):dt("",!0)])]),_:2},1032,["disabled","content-style"])):p(ce)&&ce.nestedOptions?.value?.length?(ve(),mn(XE,{key:3,options:J(ce),disabled:ce.disabled.value,show:_(ce),"content-style":{fontFamily:s.uiFontFamily},placement:"bottom-start",class:"sd-toolbar-button sd-editor-toolbar-dropdown",onSelect:(A,oe)=>q(ce,oe),"onUpdate:show":A=>bt(A,ce),style:Rn(ce.dropdownStyles.value),"menu-props":()=>({role:"menu",style:{fontFamily:s.uiFontFamily},class:["sd-toolbar-dropdown-menu",{"high-contrast":Ye(l)}]}),"node-props":A=>W(A,ce)},{trigger:go(()=>[sn(Ig,{trigger:"hover",disabled:!ce.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:go(()=>[sn(W1,{"toolbar-item":ce,disabled:ce.disabled.value,"allow-enter-propagation":!0,onTextSubmit:A=>x(ce,A),onMainClick:A=>L(ce)},null,8,["toolbar-item","disabled","onTextSubmit","onMainClick"])]),default:go(()=>[de("div",null,[Ri(Et(ce.tooltip)+" ",1),ce.disabled.value?(ve(),we("span",nW,"(disabled)")):dt("",!0)])]),_:2},1032,["disabled","content-style"])]),_:2},1032,["options","disabled","show","content-style","onSelect","onUpdate:show","style","menu-props","node-props"])):f(ce)?(ve(),mn(Ig,{key:4,trigger:"hover",class:"sd-editor-toolbar-tooltip","content-style":{fontFamily:s.uiFontFamily}},{trigger:go(()=>[sn(W1,{"toolbar-item":ce,"is-overflow-item":e.fromOverflow,onTextSubmit:A=>x(ce,A),onButtonClick:A=>S(ce)},null,8,["toolbar-item","is-overflow-item","onTextSubmit","onButtonClick"])]),default:go(()=>[ce.tooltip?(ve(),we("div",rW,[Ri(Et(ce.tooltip)+" ",1),ce.disabled.value?(ve(),we("span",oW,"(disabled)")):dt("",!0)])):dt("",!0)]),_:2},1032,["content-style"])):dt("",!0),C(ce)&&e.overflowItems.length?(ve(),mn(xG,{key:5,"toolbar-item":ce,"ui-font-family":s.uiFontFamily,onButtonClick:A=>S(ce),"overflow-items":e.overflowItems,onClose:B,onCommand:Se[2]||(Se[2]=A=>n("command",A))},null,8,["toolbar-item","ui-font-family","onButtonClick","overflow-items"])):dt("",!0)],42,JG))),128))],36))}},Eg=gn(iW,[["__scopeId","data-v-8d7a9de1"]]),sW=[["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"]],aW=sW.map(([e,t])=>({label:e,key:e,props:{style:{fontFamily:`${e}, ${t}`},"data-item":"btn-fontFamily-option"}}));function lW(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 cW=[{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"}}],Mh={sm:768,md:1024,lg:1280,xl:1410},K1={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"},eT={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"},tT=Object.values(eT),yZ=[...new Set([...Object.values(K1),...tT])],uW=new Set(["link"]),bZ=new Set(Object.keys(K1).filter(e=>!uW.has(e)));Bt(),bn();var dW=["data-superdoc-ui-owner"],fW="Arial, Helvetica, sans-serif",hW={__name:"Toolbar",emits:["command","toggle","select"],setup(e,{emit:t}){const{proxy:n}=Sr();Wv("sdToolbarOwnerId",r1(n.$toolbar.superdoc));let r=ne(1);const o=ne(null),i=ne(0),s=ne(!1);let a=null,l=null,u=n.$toolbar.getAvailableWidth();const d=Ce(()=>{const U=n?.$toolbar?.config?.uiDisplayFallbackFont;return typeof U=="string"&&U.trim()?U.trim():fW}),f=n.$toolbar.config?.toolbarGroups?.includes("left"),p=n.$toolbar.config?.toolbarGroups?.includes("right"),g=U=>(i.value,n.$toolbar.getToolbarItemByGroup(U)),m=()=>{s.value=n.$toolbar.getAvailableWidth()<=Mh.lg},v=()=>{const U=o.value,T=U?.ownerDocument,V=T?.activeElement;if(!U?.contains(V))return null;const R=V.closest('[data-sd-part="toolbar-item"]')??V.querySelector('[data-sd-part="toolbar-item"]');if(!R||V!==R&&!V.contains(R))return null;const $=R.querySelector("[data-item]")?.getAttribute("data-item");return $?()=>{const se=o.value;if(!se?.isConnected||V.isConnected||T.activeElement!==T.body)return;const X=[...se.querySelectorAll("[data-item]")];for(const J of[$,"btn-overflow"]){const W=X.find(Te=>Te.getAttribute("data-item")===J)?.closest('[data-sd-part="toolbar-item"]');if(W&&W.getAttribute("aria-disabled")!=="true"){W.focus({preventScroll:!0});return}}}:null},C=async U=>{r.value+=1,await _t(),U?.()},_=rG(async()=>{const U=n.$toolbar.getAvailableWidth();if(U===u)return;u=U;const T=v();await n.$toolbar.onToolbarResize(),m(),await C(T)},300),b=()=>{const U=v();u=n.$toolbar.getAvailableWidth(),m(),C(U)},S=()=>{i.value+=1};function x(){_.cancel(),window.removeEventListener("resize",_),n.$toolbar.off?.("toolbar-items-changed",b),n.$toolbar.off?.("toolbar-state-change",S),a?.disconnect(),a=null}function L(){x(),window.addEventListener("resize",_),n.$toolbar.on?.("toolbar-items-changed",b),n.$toolbar.on?.("toolbar-state-change",S),typeof ResizeObserver<"u"&&n.$toolbar.config?.responsiveToContainer&&n.$toolbar.toolbarContainer&&(a=new ResizeObserver(()=>{_()}),a.observe(n.$toolbar.toolbarContainer)),m()}jn(L),Zv(L),Qv(x),lr(x);const B=()=>{if(!n.$toolbar.activeEditor){l=null,n.$toolbar.pendingSelectionCapture=null;return}l=n.$toolbar.ui?.selection?.capture?.()??null,n.$toolbar.pendingSelectionCapture=l},q=({item:U,argument:T,option:V})=>{F(),n.$toolbar.emitCommand({item:U,argument:T,option:V})},F=()=>{const U=n.$toolbar.activeEditor;if(!U)return;const T=n.$toolbar.pendingSelectionCapture??l;if(T&&typeof n.$toolbar.ui?.selection?.restore=="function"){n.$toolbar.ui.selection.restore(T);return}U.commands?.restoreSelection?.()},P=U=>{B(),ZE(U)};return(U,T)=>(ve(),we("div",{class:"superdoc-toolbar",ref_key:"toolbarRoot",ref:o,key:Ye(r),role:"toolbar","aria-label":"Toolbar","data-sd-part":"toolbar","data-editor-ui-surface":"","data-superdoc-ui-owner":Ye(r1)(Ye(n).$toolbar.superdoc),onMousedown:P},[Ye(f)?(ve(),mn(Eg,{key:0,tabindex:"0","toolbar-items":g("left"),"overflow-items":Ye(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"left",onCommand:q,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):dt("",!0),sn(Eg,{tabindex:"0","toolbar-items":g("center"),"overflow-items":Ye(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"center",onCommand:q},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"]),Ye(p)?(ve(),mn(Eg,{key:1,tabindex:"0","toolbar-items":g("right"),"overflow-items":Ye(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"right",onCommand:q,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):dt("",!0)],40,dW))}},pW=gn(hW,[["__scopeId","data-v-0790fc37"]]),mW=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 Pn=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=ne(Sa()),n=e.type,r=ne(e.name),o=e.command,i=e.noArgumentCommand,s=ne(e.icon),a=ne(e.group||"center"),l=ne(e.allowWithoutEditor),u=ne(e.attributes||{}),d=!!e.disabled,f=ne(e.disabled),p=ne(!1),g=ne(!1),m=ne(e.style),v=ne(e.isNarrow),C=ne(e.isWide),w=ne(e.minWidth),_=ne(e.layoutWidth),b=ne(e.suppressActiveHighlight||!1),S=ne(e.argument),x=ne(null),L=ne(null),B=ne(e.iconColor),q=ne(e.hasCaret),F=ne(!!e.splitButton),P=e.splitButtonCommand,U=!!e.restoreEditorFocus,T=ne(e.dropdownStyles),V=ne(e.tooltip),R=ne(e.tooltipVisible),$=ne(e.tooltipTimeout),se=ne(e.defaultLabel),X=ne(e.label),J=ne(e.hideLabel),W=ne(e.inlineTextInputVisible),Te=ne(e.hasInlineTextInput),ge=ne(e.markName),he=ne(e.labelAttr),ye=ne(e.selectedValue),Re=ne(e.dropdownValueKey),je=ne(e.inputRef||null),Je=ne([]);if(e.options){if(!Array.isArray(e.options))throw new Error("Invalid toolbar item options - "+e.options);let oe=0;for(let j=0;j<e.options.length;j+=1){const Q=e.options[j];(!Q||typeof Q!="object")&&(oe+=1)}if(oe)throw new Error(`Toolbar item options must all be objects - ${e.name}. ${oe} row(s) are not, so this item is skipped.`);Je.value?.push(...e.options)}const bt=(oe={},...j)=>{Se(oe,...j),!b.value&&(p.value=!0)},ft=()=>{ce(),p.value=!1},Mt=oe=>{f.value=oe},Le=()=>{f.value=d},Se=e.onActivate||(()=>null),ce=e.onDeactivate||(()=>null),H=()=>{const oe={};return Object.keys(A).forEach(j=>{A[j].value!==void 0&&(oe[j]=A[j].value)}),oe},A={id:t,name:r,type:n,command:o,noArgumentCommand:i,icon:s,tooltip:V,group:a,attributes:u,disabled:f,active:p,expand:g,nestedOptions:Je,style:m,isNarrow:v,isWide:C,minWidth:w,layoutWidth:_,argument:S,parentItem:L,iconColor:B,hasCaret:q,splitButton:F,splitButtonCommand:P,dropdownStyles:T,tooltipVisible:R,tooltipTimeout:$,defaultLabel:se,label:X,hideLabel:J,inlineTextInputVisible:W,hasInlineTextInput:Te,restoreEditorFocus:U,markName:ge,labelAttr:he,childItem:x,allowWithoutEditor:l,dropdownValueKey:Re,selectedValue:ye,inputRef:je};return{...A,initiallyDisabled:d,unref:H,activate:bt,deactivate:ft,setDisabled:Mt,resetDisabled:Le,onActivate:Se,onDeactivate:ce}};Bt(),bn();var gW=["onClick","innerHTML","aria-label","onKeydown"],vW={__name:"AlignmentButtons",emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=rs(),r=t,o=ne([]),i=[{key:"left",ariaLabel:"Align left",icon:hr.alignLeft},{key:"center",ariaLabel:"Align center",icon:hr.alignCenter},{key:"right",ariaLabel:"Align right",icon:hr.alignRight},{key:"justify",ariaLabel:"Justify",icon:hr.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 jn(()=>{const d=o.value[0];d&&(d.setAttribute("tabindex","0"),d.focus())}),(d,f)=>(ve(),we("div",{class:on(["alignment-buttons",{"high-contrast":Ye(n)}])},[(ve(),we(Vt,null,Fn(i,(p,g)=>de("div",{key:p.key,class:"sd-button-icon",onClick:m=>s(p.key),innerHTML:p.icon,"data-item":"btn-textAlign-option",role:"menuitem","aria-label":p.ariaLabel,ref_for:!0,ref_key:"alignmentButtonsRefs",ref:o,onKeydown:an(m=>u(m,g),["prevent"])},null,40,gW)),64))],2))}},yW=gn(vW,[["__scopeId","data-v-13e5f7a4"]]);Bt(),bn();var bW=["onClick","innerHTML","aria-label","onKeydown"],wW={__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}=rs(),r=t,o=e,i=ne([]),s=Ce(()=>({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 jn(()=>{const f=i.value[0];f&&(f.setAttribute("tabindex","0"),f.focus())}),(f,p)=>(ve(),we("div",{class:on(["style-buttons-list",{"high-contrast":Ye(n)}])},[(ve(!0),we(Vt,null,Fn(o.buttons,(g,m)=>(ve(),we("div",{key:g.key,class:on(["sd-button-icon",{"sd-selected":o.selectedStyle===g.key}]),style:Rn(s.value),onClick:v=>a(g.key),innerHTML:g.icon,role:"menuitem","aria-label":g.ariaLabel,ref_for:!0,ref_key:"buttonRefs",ref:i,onKeydown:an(v=>d(v,m),["prevent"])},null,46,bW))),128))],2))}},nT=gn(wW,[["__scopeId","data-v-44f37ff6"]]),CW=[{key:"disc",icon:hr.bulletListDisc,ariaLabel:"Opaque circle"},{key:"circle",icon:hr.bulletListCircle,ariaLabel:"Outline circle"},{key:"square",icon:hr.bulletListSquare,ariaLabel:"Opaque square"}],kW=[{key:"decimal",icon:hr.numberedListDecimal,ariaLabel:"1. 2. 3."},{key:"decimal-paren",icon:hr.numberedListDecimalParen,ariaLabel:"1) 2) 3)"},{key:"upper-roman",icon:hr.numberedListUpperRoman,ariaLabel:"I. II. III."},{key:"lower-roman",icon:hr.numberedListLowerRoman,ariaLabel:"i. ii. iii."},{key:"upper-alpha",icon:hr.numberedListUpperAlpha,ariaLabel:"A. B. C."},{key:"upper-alpha-paren",icon:hr.numberedListUpperAlphaParen,ariaLabel:"A) B) C)"},{key:"lower-alpha",icon:hr.numberedListLowerAlpha,ariaLabel:"a. b. c."},{key:"lower-alpha-paren",icon:hr.numberedListLowerAlphaParen,ariaLabel:"a) b) c)"}];Bt(),bn();var SW=["onClick","onKeydown"],_W={class:"document-mode-column icon-column"},AW=["innerHTML"],IW={class:"document-mode-column text-column"},EW={class:"document-mode-type"},TW={class:"document-mode-description"},xW={__name:"DocumentMode",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=ne([]),{isHighContrastMode:o}=rs(),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 jn(()=>{r.value[0].setAttribute("tabindex","0"),r.value[0].focus()}),(d,f)=>(ve(),we("div",{class:on(["document-mode",{"high-contrast":Ye(o)}])},[(ve(!0),we(Vt,null,Fn(e.options,(p,g)=>(ve(),we("div",{class:on(["sd-option-item",{"sd-disabled":p.disabled}]),onClick:m=>s(p),"data-item":"btn-documentMode-option",role:"menuitem",ref_for:!0,ref_key:"documentModeRefs",ref:r,onKeydown:an(m=>u(m,g),["prevent"])},[de("div",_W,[de("div",{class:"icon-column__icon",innerHTML:p.icon},null,8,AW)]),de("div",IW,[de("div",EW,Et(p.label),1),de("div",TW,Et(p.description),1)])],42,SW))),256))],2))}},RW=gn(xW,[["__scopeId","data-v-bee14d7a"]]);Bt(),bn();var MW={class:"linked-style-buttons","data-editor-ui-surface":""},LW=["onClick","onKeydown","aria-label"],PW={__name:"LinkedStyle",props:{styles:{type:Array,default:()=>[]},selectedOption:{type:String,default:null}},emits:["select"],setup(e,{emit:t}){const n=t,r=ne([]),o=e,i=p=>{n("select",p)},s=p=>{if(p===r.value.length-1)return;const g=r.value[p+1];g.setAttribute("tabindex","0"),g.focus()},a=p=>{if(p===0)return;const g=r.value[p-1];g.setAttribute("tabindex","0"),g.focus()},l=(p,g,m)=>{switch(p.key){case"ArrowDown":s(g);break;case"ArrowUp":a(g);break;case"Enter":p.preventDefault(),i(m);break;default:break}},u=p=>p?.name??p?.id??"",d=p=>{const g=p?.preview?.css;return g&&typeof g=="object"?g:void 0},f=()=>{r.value[0]&&(r.value[0].setAttribute("tabindex","0"),r.value[0].focus())};return jn(f),$t(()=>o.styles.length,async(p,g)=>{p===0||g!==0||(await _t(),f())}),(p,g)=>(ve(),we("div",MW,[(ve(!0),we(Vt,null,Fn(o.styles,(m,v)=>(ve(),we("div",{key:m.id??v,class:on(["style-item",{selected:e.selectedOption===m.id}]),onClick:C=>i(m),onKeydown:C=>l(C,v,m),"aria-label":`Linked style - ${m.id??u(m)}`,ref_for:!0,ref_key:"styleRefs",ref:r},[de("div",{class:"style-name","data-item":"btn-linkedStyles-option",style:Rn(d(m))},Et(u(m)),5)],42,LW))),128))]))}},DW=gn(PW,[["__scopeId","data-v-74c8924b"]]);Bt(),bn();var OW=["placeholder"],FW={class:"sd-ai-writer__footer"},NW={key:0,class:"sd-ai-writer__error",role:"alert"},BW=["disabled"],zW="https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights",jW="You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.",VW={__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=ne(""),r=ne(!1),o=ne(""),i=ne(null),s=Ce(()=>t.selectedText?"Insert prompt to update text":"Insert prompt to generate text"),a=Ce(()=>n.value.trim().length>0&&!r.value);jn(()=>{_t(()=>{i.value?.focus()})});function l(m){if(typeof m=="string")return m;if(!m||typeof m!="object")return"";const v=m.custom_prompt;if(Array.isArray(v)){const C=v[0];if(C&&typeof C.value=="string")return C.value}return v&&typeof v=="object"&&typeof v.value=="string"?v.value:typeof m.value=="string"?m.value:typeof m.text=="string"?m.text:""}async function u(m){const v={"Content-Type":"application/json"};t.apiKey&&(v["x-api-key"]=t.apiKey);const C=t.selectedText.trim(),w=C?`Rewrite the following text: "${C}" using these instructions: ${m}`:`Generate text based on the following prompt: ${m}`,_=await fetch(t.endpoint||zW,{method:"POST",headers:v,body:JSON.stringify({stream:!1,context:jW,insights:[{type:"custom_prompt",name:C?"text_rewrite":"text_generation",message:w,format:[{value:""}]}]})});if(!_.ok){const S=await _.text().catch(()=>"");throw new Error(S||`AI request failed with ${_.status}`)}const b=l((_.headers.get("content-type")||"").includes("application/json")?await _.json():await _.text()).trim();if(!b)throw new Error("AI returned no text.");return b}function d(m){return!m||typeof m!="object"?!0:!(m.success===!1||m.ok===!1)}function f(m){const v=t.doc;if(!v)throw new Error("Document API is unavailable.");t.restoreSelection?.();let C=null,w=!1;if(t.selectedText&&t.target&&typeof v.replace=="function"?(C=v.replace({target:t.target,text:m}),w=!0):t.target&&typeof v.insert=="function"?(C=v.insert({target:t.target,value:m,type:"text"}),w=!0):typeof v.insert=="function"&&(C=v.insert({value:m,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(m){o.value=m instanceof Error?m.message:String(m)}finally{r.value=!1}}}function g(m){m.key!=="Enter"||m.shiftKey||(m.preventDefault(),p())}return(m,v)=>(ve(),we("form",{class:"sd-ai-writer","data-item":"ai-writer",onSubmit:an(p,["prevent"])},[xi(de("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:g},null,40,OW),[[Pi,n.value]]),de("div",FW,[o.value?(ve(),we("p",NW,Et(o.value),1)):dt("",!0),de("button",{class:"sd-ai-writer__submit",type:"submit",disabled:!a.value},Et(r.value?"Generating":"Generate"),9,BW)])],32))}},UW=gn(VW,[["__scopeId","data-v-67f6c6f7"]]);Bt(),bn();var $W=["aria-label","onClick","onKeydown"],HW=["innerHTML"],GW=["innerHTML"],Tg=7,WW={__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=Ce(()=>m=>r.activeColor.value?r.activeColor.value.toUpperCase()===m.value:!1),i=(m,v)=>v===5||["#FFFFFF","#FAFF09"].includes(m)?{color:"#000"}:{color:"#FFF"},s=m=>{n("select",m.value)},a=ne([]),l=ne([]);jn(()=>{if(!r.icons.every(v=>Array.isArray(v)))throw new Error("icon props must be 2d array");const m=l.value[0];m&&(m.setAttribute("tabindex","0"),m.focus({preventScroll:!0}))});const u=(m,v)=>{const C=Tg*m+v+1,w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},d=(m,v)=>{const C=Tg*m+v-1,w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},f=(m,v)=>{const C=v+Tg*(m+1),w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},p=(m,v)=>{const C=v+Tg*(m-1),w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},g=(m,v,C,w)=>{switch(m.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(m,v)=>(ve(!0),we(Vt,null,Fn(e.icons,(C,w)=>(ve(),we("div",{class:"sd-option-row",key:w,role:"group",ref_for:!0,ref_key:"rowRefs",ref:a},[(ve(!0),we(Vt,null,Fn(C,(_,b)=>(ve(),we("div",{class:"sd-option",key:b,"aria-label":_.label,role:"menuitem",ref_for:!0,ref_key:"iconRefs",ref:l,onClick:an(S=>s(_),["stop","prevent"]),onKeydown:an(S=>g(S,w,b,_),["prevent"])},[de("div",{class:"sd-option__icon",innerHTML:_.icon,style:Rn(_.style)},null,12,HW),o.value(_)?(ve(),we("div",{key:0,class:"sd-option__check",innerHTML:Ye(hr).colorOptionCheck,style:Rn(i(_.value,b))},null,12,GW)):dt("",!0)],40,$W))),128))]))),128))}},rT=gn(WW,[["__scopeId","data-v-05eb02fc"]]),KW=`<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>
106
106
  `;Bt(),bn();var qW={class:"options-grid-wrap"},YW=["innerHTML"],XW={class:"option-grid-ctn"},ZW={__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)=>(ve(),we("div",qW,[e.hasNoneIcon?(ve(),we("div",{key:0,class:"none-option",role:"menuitem","aria-label":"Clear color selection",onClick:i[0]||(i[0]=s=>r("none"))},[de("span",{innerHTML:Ye(KW),class:"none-icon"},null,8,YW),i[1]||(i[1]=Ri(" None ",-1))])):dt("",!0),de("div",XW,[sn(rT,{icons:e.icons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"]),e.customIcons.flat().length?(ve(),we(Vt,{key:0},[i[2]||(i[2]=de("span",{class:"option-grid-ctn__subtitle"},"Custom colors",-1)),sn(rT,{icons:e.customIcons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"])],64)):dt("",!0)])]))}},QW=gn(ZW,[["__scopeId","data-v-52b0283a"]]);Bt();var JW=e=>{e.expand.value=!1},Jt=(e,t=null)=>({label:t,icon:hr.colorOption,value:e,style:{color:e,boxShadow:"0 0 5px 1px rgba(0, 0, 0, 0.1)",borderRadius:"50%"}}),q1=(e,t,n=[],r=!1)=>{const o=i=>{t.iconColor.value=i,e.emitCommand({item:t,argument:i}),JW(t),Jl(e)};return Nr("div",{},[Nr(QW,{icons:eK,customIcons:n,activeColor:t.iconColor,hasNoneIcon:r,onSelect:o})])},eK=[[Jt("#111111","black"),Jt("#333333","dark gray"),Jt("#5C5C5C","medium gray"),Jt("#858585","light gray"),Jt("#ADADAD","very light gray"),Jt("#D6D6D6","transparent gray"),Jt("#FFFFFF","white")],[Jt("#860028","dark red"),Jt("#D2003F","red"),Jt("#DB3365","coral red"),Jt("#E4668C","light red"),Jt("#ED99B2","pale pink"),Jt("#F6CCD9","transparent pink"),Jt("#FF004D","bright pink")],[Jt("#83015E","dark purple"),Jt("#CD0194","purple"),Jt("#D734A9","orchid"),Jt("#E167BF","light purple"),Jt("#EB99D4","lavender"),Jt("#F5CCEA","transparent pink"),Jt("#FF00A8","neon pink")],[Jt("#8E220A","maroon"),Jt("#DD340F","red-orange"),Jt("#E45C3F","burnt orange"),Jt("#EB856F","peach"),Jt("#F1AE9F","pale peach"),Jt("#F8D6CF","transparent peach"),Jt("#FF7A00","orange")],[Jt("#947D02","olive"),Jt("#E7C302","mustard yellow"),Jt("#ECCF35","yellow"),Jt("#F1DB67","light yellow"),Jt("#F5E79A","very pale yellow"),Jt("#FAF3CC","transparent yellow"),Jt("#FAFF09","neon yellow")],[Jt("#055432","forest green"),Jt("#07834F","green"),Jt("#399C72","medium green"),Jt("#6AB595","light green"),Jt("#9CCDB9","mint"),Jt("#CDE6DC","transparent mint"),Jt("#05F38F","bright teal")],[Jt("#063E7E","navy blue"),Jt("#0A60C5","blue"),Jt("#3B80D1","sky blue"),Jt("#6CA0DC","cornflower blue"),Jt("#9DBFE8","light blue"),Jt("#CEDFF3","very light blue"),Jt("#21c8ce","cyan")],[Jt("#3E027A","deep purple"),Jt("#6103BF","indigo"),Jt("#8136CC","violet"),Jt("#A068D9","lavender pink"),Jt("#C09AE6","light lilac"),Jt("#DFCDF2","transparent lilac"),Jt("#A91DFF","neon purple")]];Bt(),bn();var tK=["data-cols","data-rows","onKeydown","onClick"],nK=["aria-valuetext"],xg=5,rK={__name:"TableGrid",emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=ne(0),o=ne(0),{isHighContrastMode:i}=rs(),s=ne([]),a=f=>{let p=f.target;if(p.dataset.grid)return;let g=[...p.parentElement.querySelectorAll("[data-item]")],m=parseInt(p.dataset.cols,10),v=parseInt(p.dataset.rows,10);l(g,m,v)},l=(f,p,g)=>{o.value=p,r.value=g;for(let m=0;m<f.length;m++){let v=f[m],C=parseInt(v.dataset.cols,10),w=parseInt(v.dataset.rows,10);C<=p&&w<=g?v.classList.add("sd-selected"):v.classList.remove("sd-selected")}},u=({cols:f,rows:p})=>{n("select",{cols:f,rows:p})},d=(f,p,g)=>{let m=p-1,v=g-1;switch(f.key){case"ArrowRight":{if(m>=4)return;const C=v*xg;s.value[C+m+1].setAttribute("tabindex","0"),s.value[C+m+1].focus(),l(s.value,p+1,g);break}case"ArrowLeft":{if(m<=0)return;const C=v*xg;s.value[C+m-1].setAttribute("tabindex","0"),s.value[C+m-1].focus(),l(s.value,p-1,g);break}case"ArrowDown":{if(v>=4)return;const C=(v+1)*xg;s.value[C+m].setAttribute("tabindex","0"),s.value[C+m].focus(),l(s.value,p,g+1);break}case"ArrowUp":{if(v<=0)return;const C=(v-1)*xg;s.value[C+m].setAttribute("tabindex","0"),s.value[C+m].focus(),l(s.value,p,g-1);break}case"Enter":u({cols:p,rows:g});break;default:break}};return jn(()=>{s.value[0].setAttribute("tabindex","0"),s.value[0].focus(),l(s.value,1,1)}),(f,p)=>(ve(),we("div",{class:on(["toolbar-table-grid-wrapper",{"high-contrast":Ye(i)}])},[de("div",{class:"toolbar-table-grid",onMouseover:a,"data-grid":"true"},[(ve(),we(Vt,null,Fn(5,g=>(ve(),we(Vt,{key:g},[(ve(),we(Vt,null,Fn(5,m=>de("div",{class:"toolbar-table-grid__item",key:`${g}_${m}`,"data-cols":m,"data-rows":g,"data-item":"true",ref_for:!0,ref_key:"tableGridItems",ref:s,onKeydown:an(v=>d(v,m,g),["prevent"]),onClick:an(v=>u({cols:m,rows:g}),["stop","prevent"])},null,40,tK)),64))],64))),64))],32),de("div",{class:"toolbar-table-grid-value","aria-valuetext":`${r.value} x ${o.value}`},Et(r.value)+" x "+Et(o.value),9,nK)],2))}},oK=gn(rK,[["__scopeId","data-v-b87d6ca2"]]);Bt(),bn();var iK={class:"toolbar-table-actions"},sK=["onClick","data-item","ariaLabel"],aK={class:"toolbar-table-actions__icon"},lK=["innerHTML"],cK={class:"toolbar-table-actions__label"},uK={__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)=>(ve(),we("div",iK,[(ve(!0),we(Vt,null,Fn(e.options,s=>(ve(),we("div",{class:on(["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"},[de("div",aK,[de("div",{class:"toolbar-table-actions__icon-wrapper",innerHTML:s.icon},null,8,lK)]),de("div",cK,Et(s.label),1)],10,sK))),256))]))}},dK=gn(uK,[["__scopeId","data-v-0cdad084"]]);Bt(),bn();var fK=["aria-busy"],hK=["aria-disabled"],pK={class:"sd-page-number-menu__row-label","aria-hidden":"true"},mK=["aria-checked","aria-label","title","tabindex","data-position","data-alignment","onClick"],gK={class:"sd-page-number-menu__page",viewBox:"0 0 36 46","aria-hidden":"true",focusable:"false"},vK=["x","y"],yK={class:"sd-page-number-menu__check"},bK=["disabled"],wK={class:"sd-page-number-menu__format"},CK={class:"sd-page-number-menu__field"},kK=["disabled"],SK=["value"],_K={class:"sd-page-number-menu__start"},AK={class:"sd-page-number-menu__check"},IK=["disabled"],EK=["disabled","onKeydown"],TK={key:0,class:"sd-page-number-menu__error",role:"alert"},xK={key:1,class:"sd-page-number-menu__note",role:"status"},RK={class:"sd-page-number-menu__actions"},MK=["disabled"],LK=["disabled"],PK=["disabled"],DK={class:"sd-page-number-menu__cursor-text"},OK={__name:"PageNumberMenu",props:{pageNumbersState:{type:Object,default:null},atCursorState:{type:Object,default:null},suggesting:{type:Boolean,default:!1},inHeaderFooter:{type:Boolean,default:!1},loadCurrent:{type:Function,default:null},applyPageNumbers:{type:Function,required:!0},removePageNumbers:{type:Function,required:!0},insertAtCursor:{type:Function,required:!0},close:{type:Function,required:!0},initialChoice:{type:Object,default:null}},setup(e){const t=e,n=[{value:"top",label:"Top of page",kind:"header"},{value:"bottom",label:"Bottom of page",kind:"footer"}],r=[{value:"left",label:"left"},{value:"center",label:"center"},{value:"right",label:"right"}],o=n.flatMap(Se=>r.map(ce=>({position:Se.value,alignment:ce.value,label:`${Se.label}, ${ce.label}`}))),i=[{value:"decimal",label:"1, 2, 3"},{value:"lowerLetter",label:"a, b, c"},{value:"upperLetter",label:"A, B, C"},{value:"lowerRoman",label:"i, ii, iii"},{value:"upperRoman",label:"I, II, III"},{value:"numberInDash",label:"- 1 -, - 2 -"}],s=[{value:"hebrew1",label:"א, Χ‘, Χ’"},{value:"hebrew2",label:"א, Χ‘, Χ’ (alphabet)"}],a={left:6,center:14,right:22},l={top:4,bottom:37},{isHighContrastMode:u}=rs(),d=t.initialChoice??{},f=ne(d.position==="top"?"top":"bottom"),p=ne(r.some(Se=>Se.value===d.alignment)?d.alignment:"right"),g=ne(d.showOnFirstPage!==!1),m=ne("decimal"),v=ne(!1),C=ne(1),w=ne(null),_=ne(typeof t.loadCurrent=="function");let b=Promise.resolve();const S=ne(!1),x=ne(!1),L=ne(""),B=ne([]),q=Ce(()=>t.pageNumbersState?.enabled===!0),F=Ce(()=>t.atCursorState?.enabled===!0),P=Ce(()=>(w.value?.placements?.length??0)>0),U=Ce(()=>s.some(Se=>Se.value===m.value)?[...i,...s]:i),T=Ce(()=>o.findIndex(Se=>Se.position===f.value&&Se.alignment===p.value)),V=Ce(()=>{if(T.value>=0)return T.value;const Se=n.findIndex(ce=>ce.value===f.value);return Math.max(0,Se)*r.length}),R=Ce(()=>P.value?"Apply":"Add page numbers"),$=Ce(()=>q.value?"":t.suggesting?"Page numbers can’t be changed as a suggestion. Switch to Editing to change them.":"Page numbers can’t be changed right now."),se=Ce(()=>F.value?"In the header or footer you’re editing":t.inHeaderFooter?"Place the cursor without selecting text":"Click into a header or footer first"),X=Ce(()=>{const Se=typeof navigator>"u"?"":navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad/i.test(Se)?"βŒ₯β‡§βŒ˜P":"Ctrl+Alt+Shift+P"});function J(Se){return Se.position===f.value&&Se.alignment===p.value}function W(){S.value=!0,L.value=""}function Te(Se,{focus:ce=!1}={}){f.value=Se.position,p.value=Se.alignment,W(),ce&&_t(()=>B.value[o.indexOf(Se)]?.focus())}function ge(Se){const ce=V.value,H=Math.floor(ce/r.length),A=ce%r.length,oe={ArrowLeft:[H,Math.max(0,A-1)],ArrowRight:[H,Math.min(r.length-1,A+1)],ArrowUp:[Math.max(0,H-1),A],ArrowDown:[Math.min(n.length-1,H+1),A],Home:[H,0],End:[H,r.length-1]}[Se.key];return oe?(Se.preventDefault(),Te(o[oe[0]*r.length+oe[1]],{focus:!0}),!0):!1}function he(Se){ge(Se)||(Se.key==="Enter"?(Se.preventDefault(),ft()):Se.key===" "&&Se.preventDefault())}function ye(Se){if(w.value=Se&&Array.isArray(Se.placements)?Se:null,!w.value||S.value)return;const ce=w.value.placements.find(H=>H.kind==="footer"&&H.alignment)??w.value.placements.find(H=>H.alignment)??w.value.placements[0];ce&&(f.value=ce.kind==="header"?"top":"bottom",p.value=ce.alignment??null,g.value=w.value.showOnFirstPage!==!1),m.value=w.value.format??"decimal",v.value=typeof w.value.start=="number",C.value=typeof w.value.start=="number"?w.value.start:1,_t(()=>B.value[V.value]?.focus({preventScroll:!0}))}function Re(){const Se=w.value,ce=f.value==="top"?"header":"footer",H=Se?.placements?.find(j=>j.kind===ce)??null,A={position:f.value};p.value&&(!H||H.alignment!==p.value)&&(A.alignment=p.value),(!P.value||g.value!==(Se?.showOnFirstPage!==!1))&&(A.showOnFirstPage=g.value),m.value!==(Se?.format??"decimal")&&(A.format=m.value);const oe=v.value?je():null;return oe!==(Se?.start??null)&&(A.start=oe),A}function je(){const Se=Math.floor(Number(C.value));return Number.isFinite(Se)&&Se>=0?Se:1}function Je(Se,ce){const H=Se?.failure?.details;return H?.reason==="page-number-has-content"?`A page number shares its line with other text. Edit the ${H.kind==="header"?"header":"footer"} directly to change it.`:H?.reason==="page-number-exists"?"This section already has page numbers.":ce==="remove"?"Page numbers couldn’t be removed. Try again.":P.value?"Page numbers couldn’t be changed. Try again.":"Page numbers couldn’t be added. Try again."}async function bt(Se,ce){if(!(!q.value||x.value)){x.value=!0,L.value="";try{await b;const{execute:H,outcome:A}=ce(),oe=await H();if(oe===!0||oe?.success===!0){t.close(A);return}L.value=Je(oe,Se)}catch{L.value=Je(null,Se)}finally{x.value=!1}}}function ft(){return bt("apply",()=>{const Se=Re();return{execute:()=>t.applyPageNumbers(Se),outcome:{action:"apply",choice:{position:f.value,alignment:p.value,showOnFirstPage:g.value}}}})}function Mt(){return bt("remove",()=>({execute:()=>t.removePageNumbers(),outcome:{action:"remove",kinds:(w.value?.placements??[]).map(Se=>Se.kind)}}))}function Le(){if(!F.value||x.value)return;x.value=!0;let Se;try{Se=t.insertAtCursor()}catch{Se=void 0}t.close({action:"cursor"}),Promise.resolve(Se).catch(()=>{})}return jn(()=>{_t(()=>B.value[V.value]?.focus({preventScroll:!0})),typeof t.loadCurrent=="function"&&(b=Promise.resolve().then(()=>t.loadCurrent()).then(ye,()=>ye(null)).finally(()=>{_.value=!1}))}),(Se,ce)=>(ve(),we("div",{class:on(["sd-page-number-menu",{"high-contrast":Ye(u)}]),role:"group","aria-labelledby":"sd-page-number-menu-title","aria-busy":_.value||void 0,"data-sd-page-number-menu":""},[ce[9]||(ce[9]=de("div",{id:"sd-page-number-menu-title",class:"sd-page-number-menu__title"},"Page numbers",-1)),de("div",{class:"sd-page-number-menu__grid",role:"radiogroup","aria-label":"Position","aria-disabled":!q.value||void 0},[(ve(),we(Vt,null,Fn(n,(H,A)=>(ve(),we(Vt,{key:H.value},[de("div",pK,Et(H.label),1),(ve(!0),we(Vt,null,Fn(Ye(o).slice(A*3,A*3+3),oe=>(ve(),we("button",{key:`${oe.position}-${oe.alignment}`,ref_for:!0,ref:j=>B.value[Ye(o).indexOf(oe)]=j,type:"button",role:"radio",class:on(["sd-page-number-menu__tile",{"is-selected":J(oe)}]),"aria-checked":J(oe),"aria-label":oe.label,title:oe.label,tabindex:Ye(o).indexOf(oe)===V.value?0:-1,"data-position":oe.position,"data-alignment":oe.alignment,onClick:j=>Te(oe),onDblclick:ft,onKeydown:he},[(ve(),we("svg",gK,[ce[4]||(ce[4]=vC('<rect class="sd-page-number-menu__sheet" x="0.75" y="0.75" width="34.5" height="44.5" rx="2.5" data-v-30327fd0></rect><rect class="sd-page-number-menu__line" x="7" y="14" width="22" height="2" rx="1" data-v-30327fd0></rect><rect class="sd-page-number-menu__line" x="7" y="19" width="18" height="2" rx="1" data-v-30327fd0></rect><rect class="sd-page-number-menu__line" x="7" y="24" width="22" height="2" rx="1" data-v-30327fd0></rect><rect class="sd-page-number-menu__line" x="7" y="29" width="14" height="2" rx="1" data-v-30327fd0></rect>',5)),de("rect",{class:"sd-page-number-menu__chip",x:a[oe.alignment],y:l[oe.position],width:"8",height:"5",rx:"1.5"},null,8,vK)]))],42,mK))),128))],64))),64))],8,hK),de("label",yK,[xi(de("input",{"onUpdate:modelValue":ce[0]||(ce[0]=H=>g.value=H),type:"checkbox",disabled:!q.value,"data-sd-page-number-first-page":"",onChange:W},null,40,bK),[[Hu,g.value]]),ce[5]||(ce[5]=de("span",null,"Show on first page",-1))]),de("div",wK,[de("label",CK,[ce[6]||(ce[6]=de("span",null,"Format",-1)),xi(de("select",{"onUpdate:modelValue":ce[1]||(ce[1]=H=>m.value=H),disabled:!q.value,"data-sd-page-number-format":"",onChange:W},[(ve(!0),we(Vt,null,Fn(U.value,H=>(ve(),we("option",{key:H.value,value:H.value},Et(H.label),9,SK))),128))],40,kK),[[Zp,m.value]])]),de("div",_K,[de("label",AK,[xi(de("input",{"onUpdate:modelValue":ce[2]||(ce[2]=H=>v.value=H),type:"checkbox",disabled:!q.value,"data-sd-page-number-restart":"",onChange:W},null,40,IK),[[Hu,v.value]]),ce[7]||(ce[7]=de("span",null,"Start at",-1))]),xi(de("input",{"onUpdate:modelValue":ce[3]||(ce[3]=H=>C.value=H),type:"number",min:"0",step:"1",inputmode:"numeric","aria-label":"First page number",disabled:!q.value||!v.value,"data-sd-page-number-start":"",onInput:W,onKeydown:ri(an(ft,["prevent"]),["enter"])},null,40,EK),[[Pi,C.value,void 0,{number:!0}]])])]),L.value?(ve(),we("p",TK,Et(L.value),1)):$.value?(ve(),we("p",xK,Et($.value),1)):dt("",!0),de("div",RK,[P.value?(ve(),we("button",{key:0,type:"button",class:"sd-page-number-menu__remove",disabled:!q.value||x.value,"aria-label":"Remove page numbers","data-sd-page-number-remove":"",onClick:Mt}," Remove ",8,MK)):dt("",!0),de("button",{type:"button",class:"sd-page-number-menu__add",disabled:!q.value||x.value,"data-sd-page-number-add":"",onClick:ft},Et(R.value),9,LK)]),ce[10]||(ce[10]=de("div",{class:"sd-page-number-menu__divider",role:"separator"},null,-1)),de("button",{type:"button",class:"sd-page-number-menu__cursor",disabled:!F.value||x.value,"data-sd-page-number-at-cursor":"",onClick:Le},[de("span",DK,[ce[8]||(ce[8]=de("span",null,"Insert at cursor",-1)),de("small",null,Et(se.value),1)]),de("kbd",null,Et(X.value),1)],8,PK)],10,fK))}},FK=gn(OK,[["__scopeId","data-v-30327fd0"]]),Y1="sd-page-number-flash",NK=1400,oT=e=>new Promise(t=>{typeof e?.requestAnimationFrame=="function"?e.requestAnimationFrame(()=>t()):setTimeout(t,16)});async function iT(e,t){const n=e?.ownerDocument?.defaultView;if(!e||!n)return;await oT(n),await oT(n);const r=n.innerHeight,o=[...e.querySelectorAll(`[data-sd-headerfooter-kind="${t}"]`)].filter(i=>{const s=i.getBoundingClientRect();return s.height>0&&s.bottom>0&&s.top<r});for(const i of o)i.classList.remove(Y1),i.classList.add(Y1),n.setTimeout(()=>i.classList.remove(Y1),NK)}var BK=`<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>
107
- `;Bt();var ss=e=>{e.expand.value=!1},X1=(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")},zK=e=>{const t=[];for(const n of e){if(n.type==="separator"){const r=t[t.length-1];if(!r||r.type==="separator")continue}t.push(n)}for(;t.length&&t[t.length-1].type==="separator";)t.pop();return t},sT=e=>{const t=new Map;for(const r of e){const o=r.group?.value||"center";t.has(o)||t.set(o,[]),t.get(o).push(r)}const n=new Set;for(const r of t.values())for(const o of zK(r))n.add(o);return e.filter(r=>n.has(r))},jK=e=>{const t=e.find(o=>o.type==="overflow"),n=e.filter(o=>o!==t),r=new Set(sT(n));return e.filter(o=>o===t||r.has(o))};function Z1(e,t){const n={...e};return t?n.href=t:delete n.href,n}function aT(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 VK(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function Q1(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function UK(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function $K(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var HK=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,configuredItemOrder:u,excludedItemNames:d,additionalItems:f=[]}={})=>{const p=Pn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),g=(r??aW).map(mW),m=Pn({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:g,onActivate:({fontFamily:ut}={},lt=!1)=>{if(lt){m.label.value="",m.selectedValue.value="";return}if(!ut)return;ut=ut.split(",")[0];const Dt=zt=>zt.value??zt.label,ln=g.find(zt=>Dt(zt)===m.defaultLabel.value),Dn=g.find(zt=>Dt(zt)===ut);Dn?(m.label.value=Dn.label,m.selectedValue.value=Dn.key):ln?(m.label.value=ut,m.selectedValue.value=ln.key):(m.label.value=ut,m.selectedValue.value="")},onDeactivate:()=>{const ut=g.find(lt=>(lt.value??lt.label)===m.defaultLabel.value);m.label.value=ut?.label??m.defaultLabel.value,m.selectedValue.value=ut?.key??""}}),v=Pn({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:()=>C(v)}]});function C(ut){const lt=Q1(e),Dt=lt?.selectionTarget??aT(lt?.target),ln=lt?.empty?"":VK(lt),Dn=$K(e),zt=()=>ss(ut),wn=()=>{const Vn=e.pendingSelectionCapture;Vn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Vn)};return Nr("div",{},[Nr(UW,{handleClose:zt,selectedText:ln,target:Dt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:Dn?.apiKey||e.config?.aiApiKey||"",endpoint:Dn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:wn})])}const w=cW,_=Pn({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:w,onActivate:({fontSize:ut},lt=!1)=>{if(lt){_.label.value="",_.selectedValue.value="";return}const Dt=w.find(wn=>wn.label===String(_.defaultLabel.value));if(!ut){_.label.value=_.defaultLabel.value,Dt?_.selectedValue.value=Dt.key:_.selectedValue.value="";return}let ln=nG(ut,12);ln<8&&(ln=8),ln>96&&(ln=96);let Dn=String(ln);const zt=w.find(wn=>wn.label===Dn||wn.key===Dn);zt?_.selectedValue.value=zt.key:_.selectedValue.value="",_.label.value=Dn},onDeactivate:()=>{_.label.value=_.defaultLabel.value;const ut=w.find(lt=>lt.label===String(_.defaultLabel.value));ut?_.selectedValue.value=ut.key:_.selectedValue.value=""}}),b=()=>Pn({type:"separator",name:"separator",isNarrow:!0}),S=Pn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),x=Pn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),L=Pn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),B=Pn({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:()=>q1(e,B,[],!0)}],onActivate:({color:ut})=>{B.iconColor.value=ut||""},onDeactivate:()=>B.iconColor.value=""}),q=Pn({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:()=>q1(e,q)}],onActivate:({color:ut})=>{q.iconColor.value=ut},onDeactivate:()=>q.iconColor.value="#000"}),F=Pn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),P=Pn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>U(P)}],onActivate:({href:ut})=>{P.attributes.value=Z1(P.attributes.value,ut)},onDeactivate:()=>{P.attributes.value=Z1(P.attributes.value,null),P.expand.value=!1}});function U(ut){const lt=e.pendingSelectionCapture,Dt=Q1(e),ln=Dt?.quotedText&&JSON.stringify(Dt.selectionTarget??Dt.target)!==JSON.stringify(lt?.selectionTarget??lt?.target)?Dt:lt??Dt,Dn=ln?.selectionTarget??aT(ln?.target)??ln?.target,zt=()=>{ln===lt&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(lt)};return Nr("div",{},[Nr(A4,{ui:e.ui,linkItem:ut,textTarget:Dn,selectedText:ln?.quotedText??null,restoreSelection:zt,closePopover:()=>{ss(ut),Jl(e)},goToAnchor:()=>{ss(ut);const wn=ut.attributes.value?.href;if(!wn)return;const Vn=wn.slice(1),Tr=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${Vn}']`);Tr&&I4(Tr)}})])}const T=Pn({type:"options",name:"linkInput",command:"toggleLink",active:!1});P.childItem=T,T.parentItem=P;const V=Pn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),R=Pn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),$=Pn({type:"button",name:"watermark",icon:t.watermark,tooltip:n.watermark,allowWithoutEditor:!0,disabled:!0,attributes:{ariaLabel:n.watermark}}),se=Pn({type:"dropdown",name:"pageNumber",icon:t.pageNumber,hideLabel:!0,tooltip:n.pageNumber,disabled:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:n.pageNumber},options:[{key:"pageNumber",type:"render",label:"Page number options",render:()=>J(se)}]});let X=null;function J(ut){const lt=e.ui,Dt=wn=>lt?.commands?.get?.(wn)?.getState?.()??null,ln=()=>{ss(ut),Le.expand.value&&ss(Le),Jl(e)},Dn=Q1(e),zt=Dn?.selectionTarget?.story??Dn?.selectionTarget?.start?.story??Dn?.target?.story??null;return Nr(FK,{pageNumbersState:Dt("page-numbers-apply"),atCursorState:Dt("page-number-insert"),inHeaderFooter:zt?.storyType==="headerFooterPart"||zt?.storyType==="headerFooterSlot",suggesting:lt?.document?.getSnapshot?.()?.mode==="suggesting",initialChoice:X,loadCurrent:()=>lt?lF(lt):Promise.resolve(null),applyPageNumbers:wn=>jc(lt,"page-numbers-apply",wn),removePageNumbers:()=>jc(lt,"page-numbers-remove"),insertAtCursor:()=>jc(lt,"page-number-insert"),close:wn=>{ln();const Vn=lt?.viewport?.getHost?.();if(wn?.action==="apply")X=wn.choice,iT(Vn,wn.choice.position==="top"?"header":"footer");else if(wn?.action==="remove")for(const Tr of new Set(wn.kinds))iT(Vn,Tr)}})}const W=Pn({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:()=>Te(W)}]});function Te(ut){return Nr("div",{},[Nr(oK,{onSelect:Dt=>{e.emitCommand({item:ut,argument:Dt}),ss(ut),Jl(e)}})])}const ge=Pn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>ye(ge)}]}),he=[{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 ye(ut){return Nr(dK,{options:he,onSelect:lt=>{ss(ut);const{command:Dt}=lt;e.emitCommand({item:ut,argument:{command:Dt}}),Jl(e)}})}const Re=Pn({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:()=>Nr("div",{},[Nr(yW,{onSelect:lt=>{ss(Re);const Dt={...Re,command:"setTextAlign"};Dt.command="setTextAlign",e.emitCommand({item:Dt,argument:lt}),je(Re,lt),Jl(e)}})]),key:"alignment"}],onActivate:({textAlign:ut})=>{je(Re,ut)},onDeactivate:()=>{je(Re,"left")}}),je=(ut,lt)=>{let Dt=lt==="both"?"justify":lt,ln={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},Dn=ln[Dt]??ln.left;ut.icon.value=Dn},Je=Pn({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 ut=lt=>{ss(Je);const Dt={...Je,command:"toggleBulletListStyle"};e.emitCommand({item:Dt,argument:lt})};return Nr(nT,{buttons:CW,iconSize:25,selectedStyle:Je.selectedValue.value,onSelect:ut})}}]}),bt=Pn({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 ut=lt=>{ss(bt);const Dt={...bt,command:"toggleOrderedListStyle"};e.emitCommand({item:Dt,argument:lt})};return Nr(nT,{buttons:kW,iconSize:30,selectedStyle:bt.selectedValue.value,onSelect:ut})}}]}),ft=Pn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Mt=Pn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Le=Pn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),Se=Pn({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:ut})=>{ut&&(Se.label.value=ut)}}),ce=Pn({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:ut})=>{ut&&(ce.label.value=ut)}}),H=Pn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),A=Pn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),oe=Pn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),j=Pn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Q=Pn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),G=Pn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),pe=(ut,lt)=>ut==="editor"?lt:ut==="suggester"?lt.filter(Dt=>Dt.value==="suggesting"):lt.filter(Dt=>Dt.value==="viewing"),ke=ut=>ut==="editor"?"Editing":ut==="suggester"?"Suggesting":"Viewing",te=Pn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:ke(s),label:ke(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:()=>Y(te)}]}),N=[{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 Y(ut){return Nr(RW,{options:pe(s,N),onSelect:lt=>{const Dt=e.superdoc?.activeEditor??e.activeEditor;ss(ut);const{label:ln,icon:Dn,value:zt}=lt;te.label.value=ln,te.icon.value=Dn,e.emitCommand({item:te,argument:zt}),Jl(e,Dt)}})}const me=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),Pe=["search","ruler","undo","overflow","documentMode"],_e=Pn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),it=Pn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),Xe=Pn({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 ut=Dt=>{ss(Xe);const ln=typeof Dt=="string"?Dt:Dt?.id??null;if(!ln)return;const Dn={...Xe,command:"setLinkedStyle"};e.emitCommand({item:Dn,argument:ln})},lt=e.getActiveLinkedStyleId?.()??null;return Nr("div",{},[Nr(DW,{styles:e.getLinkedStyleOptions?.()??[],onSelect:ut,selectedOption:lt})])}}],onActivate:({styleId:ut,styleName:lt})=>{const Dt=lt||ut;Xe.label.value=ut&&ut!=="Normal"?String(Dt):n.formatText,Xe.disabled.value=!1},onDeactivate:()=>{Xe.disabled.value=!0,Xe.label.value=n.formatText}}),at=(ut,lt)=>{if(lt.value==ut)return Nr("div",{innerHTML:BK,class:"dropdown-select-icon"})},Pt=Pn({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(ut=>({label:ut.toFixed(2),key:ut,icon:()=>at(ut,Pt.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),Ft=20,Zt=32,At=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],ct=["zoom","fontFamily","fontSize","redo"],tn=i<=Mh.lg,Yt=e.config?.showFormattingMarksButton===!0,Ln=e.config?.showTableOfContentsButton===!0;tn&&(te.attributes.value={...te.attributes.value,className:`${te.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),tn&&(Xe.attributes.value={...Xe.attributes.value,className:`${Xe.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Tn=[H,A,oe,j,F,Se,m,b(),_,b(),p,S,x,L,q,B,b(),P,V,...Ln?[R]:[],...e.config?.showWatermarkButton||l?.has("watermark")?[$]:[],...e.config?.showPageNumberButton||l?.has("pageNumber")?[se]:[],W,ge,b(),Re,Je,bt,ft,Mt,Pt,b(),Xe,b(),_e,ce,...Yt?[it]:[],G,Q,...UK(e)?[v]:[],Le,te,...f];if(i<=Mh.md&&o&&(Tn=Tn.filter(ut=>ut.type!=="separator")),e.config.mode!=="docx"){const ut=Tn.findIndex(Dt=>Dt.name.value==="linkedStyles");Tn.splice(ut-1,2);const lt=["ruler","zoom","undo","redo"];Tn=Tn.filter(Dt=>!lt.includes(Dt.name.value))}const jr=[];a||(s==="viewer"&&jr.push(oe,j),Tn=Tn.filter(ut=>!jr.includes(ut))),l&&(Tn=Tn.filter(ut=>ut.name.value==="overflow"||ut.isCustomToolbarItem||l.has(ut.name.value))),d?.size&&(Tn=Tn.filter(ut=>!d.has(ut.name.value))),Tn=jK(Tn);const no=ut=>Pe.includes(ut.name.value),Yr=Tn.find(ut=>ut.name.value==="overflow"),_n=Tn.filter(ut=>ut!==Yr);if(u){const ut=new Map(u.map((Dt,ln)=>[Dt,ln])),lt=Dt=>ut.get(Dt.name.value)??Number.MAX_SAFE_INTEGER;_n.sort((Dt,ln)=>lt(Dt)-lt(ln))}const nr=ut=>{const lt=[],Dt=[],ln=_n.filter(no).reduce((zt,wn)=>zt+X1(wn,me),0);let Dn=Zt+ln+(ut&&Yr?X1(Yr,me):0);return _n.forEach((zt,wn)=>{const Vn=X1(zt,me);if(zt.type==="separator"&&_n[wn-1]?.name.value==="linkedStyles"&&lt.includes(_n[wn-1])){lt.push(zt);return}if(i<Mh.xl+Ft&&At.includes(zt.name.value)&&o){lt.push(zt);return}if(i<Mh.sm&&ct.includes(zt.name.value)&&o){lt.push(zt);return}if(no(zt)){Dt.push(zt);return}Dn+Vn<=i||!o?(Dt.push(zt),Dn+=Vn):lt.push(zt)}),{visibleItems:Dt,overflowItems:lt}};let{visibleItems:mr,overflowItems:ao}=nr(!1);if(o&&Yr&&ao.some(ut=>ut.type!=="separator")){({visibleItems:mr,overflowItems:ao}=nr(!0));const ut=Tn.indexOf(Yr),lt=mr.findIndex(Dt=>Tn.indexOf(Dt)>ut);lt===-1?mr.push(Yr):mr.splice(lt,0,Yr)}return mr=sT(mr),{defaultItems:mr,overflowItems:ao.filter(ut=>ut.type!=="separator")}},lT={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",watermark:"Watermark",pageNumber:"Page number",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"},GK=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Bt();function cT(e){return tG(e)??K1[e]??null}function Rg(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?jc(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 WK=["page-numbers-apply","page-number-insert"],KK=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),qK=new Set(["list","numberedlist"]);function YK(e,t){if(e==="fontFamily"||e==="fontSize"||qK.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!KK.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function uT(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function XK(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var ZK=new Set([...eG,...Object.keys(Cg),"ai","overflow","tableOfContents"]),QK=class extends pv.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...hr},texts:{...lT},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],toolbarButtonsExclude:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1,showWatermarkButton:!1,showPageNumberButton:!1};toolbarItems=[];overflowItems=[];#e=null;#n=null;isDev=!1;role="editor";superdoc;toolbarContainer=null;toolbar=null;_detachFontsChanged=null;_linkedStyleOptions=Mr([]);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={...hr,...e.icons},this.config.texts={...lT,...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=GK(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.#d(),this.#c(),this.#i(),this._lastFontOptionsSignature=this.#r(),!this.toolbarContainer){this.updateToolbarState();return}this.app=Lc(pW),this.app.directive("click-outside",vb),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.#C():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}#d(){if(Array.isArray(this.config.groups)){this.config.toolbarGroups=this.config.groups,this.config.groups=null;return}this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length&&(this.config.toolbarGroups=Object.keys(this.config.groups))}getAvailableWidth(){const e=document.documentElement.clientWidth,t=this.toolbarContainer?.offsetWidth??0;return this.config.responsiveToContainer?t:e}#h(e){return e||lW(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??[],...this.config.toolbarButtonsExclude??[]]),i=this.config.customButtons||[],s=new Set(ZK),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.#f(C);return t.has(_.name.value)&&(_.selectedValue.value=t.get(_.name.value)),s.add(_.name?.value),_}catch(_){const b=`${C?.name??`<unnamed@${w}>`}::${_?.message??String(_)}`;return this._reportedInvalidCustomItems.has(b)||(this._reportedInvalidCustomItems.add(b),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;let d=null;if(n){const C=Object.values(this.config.groups).flatMap(_=>_),w=a.filter(_=>l.has(_.group?.value||"center")).map(_=>_.name.value);d=[...new Set([...C,...w])]}const{defaultItems:f,overflowItems:p}=HK({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#h(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev,configuredItemNames:r,configuredItemOrder:d,excludedItemNames:o,additionalItems:u});n||(d=[...f.map(C=>C.name.value),...p.map(C=>C.name.value)]);const g=p.filter(C=>d.includes(C.name.value)&&!o.has(C.name.value)),m=g.length?[...d,"overflow"]:d,v=f.filter(C=>m.includes(C.name.value)).filter(C=>!o.has(C.name.value));if(n){const C=new Map(d.map((x,L)=>[x,L])),w=x=>C.get(x.name.value)??Number.MAX_SAFE_INTEGER,_=v.find(x=>x.name.value==="overflow"),b=new Map(v.map((x,L)=>[x,L])),S=v.filter(x=>x!==_);if(S.sort((x,L)=>w(x)-w(L)),_){const x=b.get(_),L=S.findIndex(B=>b.get(B)>x);L===-1?S.push(_):S.splice(L,0,_)}v.splice(0,v.length,...S),g.sort((x,L)=>w(x)-w(L))}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=g}#f(e){const t=Pn({...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}#S(e){return e==="watermark"?this.ui?.document?.getSnapshot?.().ready===!0&&typeof this.ui?.watermark?.open=="function":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)}#w(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>q1(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=tT.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(t==="pageNumber"){const i=WK.map(a=>this.snapshot?.commands?.[a]),s=this.ui?.document?.getSnapshot?.()?.mode==="suggesting";return e.setDisabled(!s&&!i.some(a=>a&&!a.disabled)),!0}if(G1(t)?.disposition==="host-routed")return e.setDisabled(!this.#S(t)),this.#_(t)?e.activate():e.deactivate(),!0;const n=cT(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];YK(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=Z1(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.#w();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#O(),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)}),this.getToolbarItemByName("overflow")?.setDisabled(!this.overflowItems.some(n=>n.type!=="separator"&&!n.disabled.value));const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#O(){this.#s().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#x(e,t){const n=this.superdoc;if(e==="watermark"){if(!this.#S(e))return!1;const r=this.ui.watermark.open();if(!r.ok)throw new Error(`[superdoc toolbar] Watermark dialog unavailable: ${r.reason}`);return!0}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}#M(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.#L();if(n==="tableActions"){const i=eT[t?.command];return i?Rg(this.ui,i,void 0,r):!1}if(G1(n)?.disposition==="unsupported")return!0;const o=cT(n);return o?Rg(this.ui,o,t,r):!1}#L(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=KD({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await GD(e,this.superdoc?.config?.handleImageUpload);Rg(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}#C(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{uT(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!uT(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}XK(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(G1(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(!Rg(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.#M(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 JK(e){return new QK(e)}Bt();var eq=['[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(", "),tq=800,dT=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,fT=e=>{if(!dT)return!1;try{return dT.call(e),!0}catch{return!1}};function nq(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 rq=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"]),oq=["original","markup","final"],iq=["review","original","final","off"];function hT(e){return oq.includes(e)}function sq(e){return e==="markup"?"review":e}function pT(e){return iq.includes(e)}function aq(e){const t=e.modules?.trackChanges?.mode;if(pT(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return pT(n)?n:null}function Mg(e,t){const n=e.viewing,r=hT(n?.trackedChanges)?n.trackedChanges:null,o=r?sq(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 lq(e,t){const n=new I6.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function J1(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function mT(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function cq(e,t){if(!e)return()=>{};if(J1(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=()=>{mT(e),s()},l=u=>{u!==!1&&(u===!0||J1(e))&&(mT(e),s())};return n("synced",a),n("sync",l),J1(e)&&s(),i}function uq(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(eq));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(nm.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 dq(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function gT(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 vT(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function fq(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 si(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function yT(e){return typeof e=="string"&&e.length>0?e:null}function bT(e){return e?si(e)?yT(e.documentId??e.options?.documentId??null):yT(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function hq(e){if(!e||si(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function Rs(e){if(!e)return null;if(si(e))return e.fonts??null;const t=hq(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 Lh=class extends pv.default{static{this.allowedTypes=[_r,za,Gu]}#e;#n;#t;#o;#i;#a;#d;#h;#c;#f;#p;#r;#s;#m;#_;#S;#g;#w;#A;#T;#I;#O;#x;#M;#L;#C;#y;get uiConfig(){return this.#y}#v;get interactionConfig(){return this.#v}#F;get surfacesConfig(){return this.#F}#E;#N;#R;#u;#P;#B;#b;constructor(e){if(super(),this.#e=!1,this.#t=!1,this.#o=null,this.#i=null,this.#a=null,this.#d=null,this.#h=null,this.#c=null,this.#f=!1,this.#p=null,this.#r=null,this.#s=null,this.#m=null,this.#_=!1,this.#S=!1,this.#g=null,this.#w=null,this.#A=!1,this.#T=null,this.#I=null,this.#O=n=>{this.listenerCount("content-control:active-change")>0&&(this.#A||(this.#T=n.pointerId),this.#A=!0,this.#g="pointer",this.#w=null)},this.#x=n=>{n.pointerId===this.#T&&(this.#A=!1,this.#T=null,this.#g??="pointer",this.#g==="pointer"&&(this.#w=Date.now()+tq))},this.#M=n=>{this.listenerCount("content-control:active-change")>0&&!nq(n)&&(this.#g="keyboard",this.#w=null)},this.#L=n=>{this.#D(n)},this.#C=null,this.#y=$E({}),this.#v=HE({}),this.#F=WE({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#N=!1,this.#R=[],this.#u=new QH,this.#P=null,this.#B=!1,this.#b=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...$1},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.#re=new WeakSet,this.#oe=new WeakMap,this.#ie=null,this.#q=null,this.#V=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=kx(this,e,()=>this.version,t),this.#E=new kH({getModuleConfig:()=>this.#F}),this.#s=t,t.addEventListener("pointerdown",this.#O,!0),t.ownerDocument.addEventListener("pointerup",this.#x,!0),t.ownerDocument.addEventListener("pointercancel",this.#x,!0),t.addEventListener("keydown",this.#M,!0),t.addEventListener("click",this.#L,!0),this.#l("content-control:active-change",e.onContentControlActiveChange),this.#U(e,t),this.#S=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#D(e){const t=this.#s;if(!t)return;const n=uq(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=gT(dq(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#U(e,t){this.#b=aq(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),U1(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.#He(),this.config.user=DH(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=xA(this.config.modules.comments),this.#y=$E(this.config),this.#v=HE(this.config),this.#F=WE(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.userColorMap=new Map,this.colorIndex=0,this.version="2.25.0-next.13",this.#se("πŸ¦‹ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||Sa(),this.colors=this.config.colors??[],this.#de(),this.#J(),await JM(),this.#e)return;if(await this.#Se(this.config.modules),this.#e){this.#ke();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.#P||(this.#P=this.#u.subscribe(i=>{this.#We(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.#te(),this.#$(),this.#Ke(),this.#Z()}#Z(){if(this.#N=!1,this.#R=[],this.#ee(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#r)}#$(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new qV({Renderer:bH,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#k("requiredNumberOfEditors").documents.filter(e=>e.type===_r).length}get ui(){return this.#C||(this.#C=QF({superdoc:this}),this.#e&&this.#C.destroy()),this.#Q(),this.#C}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.#S&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#S&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#S&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#j(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#j(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#j(),this}#j(){this.listenerCount("content-control:active-change")>0||(this.#m?.(),this.#m=null,this.#I=null,this.#g=null,this.#w=null,this.#A=!1,this.#T=null)}#Q(){if(this.#m||this.#_||!this.#C||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.#C.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=vT(s);if(!a)return;this.#g==="pointer"&&this.#w!==null&&Date.now()>this.#w&&(this.#g=null,this.#w=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.#w=null}),r=this.#C.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>gT(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 g=vT(this.#C.selection.getSnapshot()),m=this.#I;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:g&&m?.editor===a&&m.key===g?m.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#m=i}catch(i){throw n?.(),r?.(),i}finally{this.#_=!1}}get state(){return{documents:this.#k("state").documents.map(e=>Ll(e.data)?{...e,data:Ab(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}#J(){const e=this.config.document,t=!!e&&typeof e=="object"&&(Ll(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=Eb(e);this.config.documents=[{id:Sa(),...o}]}else n&&(this.config.documents=[{id:Sa(),type:_r,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=Eb(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||Sa()}}))}#ee(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=OV({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&&BM(this),this.#ce()}#l(e,t){t&&this.on(e,t)}#te(){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.#Ae(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#Se({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:Sa(),type:_r,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}#Ye(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=Qr(e),this.provider=Qr(t),this.#de();const n=this.config;this._cleanupAwareness=PM(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#_e(){this.#p=null,this.#ne(),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})}#ne(){if(this.#a){try{this.#a()}catch{}this.#a=null}if(this.#d){try{this.#d()}catch{}this.#d=null}if(this.#h){try{this.#h()}catch{}this.#h=null}}#Ae(e){this.#ne(),si(e)&&(this.#Ee(e),this.#Te(e),this.#Ie(e))}#Ie(e){const t=e.connection;if(!t||typeof t.subscribe!="function")return;const{documentId:n}=t;this.#c?.documentId!==n&&(this.#c=null,this.#f=!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:fq(o,this.#f),detail:o.detail??null,superdoc:this};this.#c=s,o.state==="synced"&&(this.#f=!0),this.emit("collaboration-connection-change",s)};try{const o=t.getSnapshot?.();o&&r(o),this.#h=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 connection bridge failed to subscribe",o)}}getCollaborationConnectionState(){return this.#c}#Ee(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=HV(()=>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)}}#Te(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.#d=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}}#xe(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#H(e,t){this.isLocked===e&&this.#xe(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#se("πŸ¦‹ [superdoc] Locking superdoc:",e,t,`
107
+ `;Bt();var ss=e=>{e.expand.value=!1},X1=(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")},zK=e=>{const t=[];for(const n of e){if(n.type==="separator"){const r=t[t.length-1];if(!r||r.type==="separator")continue}t.push(n)}for(;t.length&&t[t.length-1].type==="separator";)t.pop();return t},sT=e=>{const t=new Map;for(const r of e){const o=r.group?.value||"center";t.has(o)||t.set(o,[]),t.get(o).push(r)}const n=new Set;for(const r of t.values())for(const o of zK(r))n.add(o);return e.filter(r=>n.has(r))},jK=e=>{const t=e.find(o=>o.type==="overflow"),n=e.filter(o=>o!==t),r=new Set(sT(n));return e.filter(o=>o===t||r.has(o))};function Z1(e,t){const n={...e};return t?n.href=t:delete n.href,n}function aT(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 VK(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function Q1(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function UK(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function $K(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var HK=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,configuredItemOrder:u,excludedItemNames:d,additionalItems:f=[]}={})=>{const p=Pn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),g=(r??aW).map(mW),m=Pn({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:g,onActivate:({fontFamily:ut}={},lt=!1)=>{if(lt){m.label.value="",m.selectedValue.value="";return}if(!ut)return;ut=ut.split(",")[0];const Dt=zt=>zt.value??zt.label,ln=g.find(zt=>Dt(zt)===m.defaultLabel.value),Dn=g.find(zt=>Dt(zt)===ut);Dn?(m.label.value=Dn.label,m.selectedValue.value=Dn.key):ln?(m.label.value=ut,m.selectedValue.value=ln.key):(m.label.value=ut,m.selectedValue.value="")},onDeactivate:()=>{const ut=g.find(lt=>(lt.value??lt.label)===m.defaultLabel.value);m.label.value=ut?.label??m.defaultLabel.value,m.selectedValue.value=ut?.key??""}}),v=Pn({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:()=>C(v)}]});function C(ut){const lt=Q1(e),Dt=lt?.selectionTarget??aT(lt?.target),ln=lt?.empty?"":VK(lt),Dn=$K(e),zt=()=>ss(ut),wn=()=>{const Vn=e.pendingSelectionCapture;Vn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Vn)};return Nr("div",{},[Nr(UW,{handleClose:zt,selectedText:ln,target:Dt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:Dn?.apiKey||e.config?.aiApiKey||"",endpoint:Dn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:wn})])}const w=cW,_=Pn({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:w,onActivate:({fontSize:ut},lt=!1)=>{if(lt){_.label.value="",_.selectedValue.value="";return}const Dt=w.find(wn=>wn.label===String(_.defaultLabel.value));if(!ut){_.label.value=_.defaultLabel.value,Dt?_.selectedValue.value=Dt.key:_.selectedValue.value="";return}let ln=nG(ut,12);ln<8&&(ln=8),ln>96&&(ln=96);let Dn=String(ln);const zt=w.find(wn=>wn.label===Dn||wn.key===Dn);zt?_.selectedValue.value=zt.key:_.selectedValue.value="",_.label.value=Dn},onDeactivate:()=>{_.label.value=_.defaultLabel.value;const ut=w.find(lt=>lt.label===String(_.defaultLabel.value));ut?_.selectedValue.value=ut.key:_.selectedValue.value=""}}),b=()=>Pn({type:"separator",name:"separator",isNarrow:!0}),S=Pn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),x=Pn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),L=Pn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),B=Pn({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:()=>q1(e,B,[],!0)}],onActivate:({color:ut})=>{B.iconColor.value=ut||""},onDeactivate:()=>B.iconColor.value=""}),q=Pn({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:()=>q1(e,q)}],onActivate:({color:ut})=>{q.iconColor.value=ut},onDeactivate:()=>q.iconColor.value="#000"}),F=Pn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),P=Pn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>U(P)}],onActivate:({href:ut})=>{P.attributes.value=Z1(P.attributes.value,ut)},onDeactivate:()=>{P.attributes.value=Z1(P.attributes.value,null),P.expand.value=!1}});function U(ut){const lt=e.pendingSelectionCapture,Dt=Q1(e),ln=Dt?.quotedText&&JSON.stringify(Dt.selectionTarget??Dt.target)!==JSON.stringify(lt?.selectionTarget??lt?.target)?Dt:lt??Dt,Dn=ln?.selectionTarget??aT(ln?.target)??ln?.target,zt=()=>{ln===lt&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(lt)};return Nr("div",{},[Nr(A4,{ui:e.ui,linkItem:ut,textTarget:Dn,selectedText:ln?.quotedText??null,restoreSelection:zt,closePopover:()=>{ss(ut),Jl(e)},goToAnchor:()=>{ss(ut);const wn=ut.attributes.value?.href;if(!wn)return;const Vn=wn.slice(1),Tr=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${Vn}']`);Tr&&I4(Tr)}})])}const T=Pn({type:"options",name:"linkInput",command:"toggleLink",active:!1});P.childItem=T,T.parentItem=P;const V=Pn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),R=Pn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),$=Pn({type:"button",name:"watermark",icon:t.watermark,tooltip:n.watermark,allowWithoutEditor:!0,disabled:!0,attributes:{ariaLabel:n.watermark}}),se=Pn({type:"dropdown",name:"pageNumber",icon:t.pageNumber,hideLabel:!0,tooltip:n.pageNumber,disabled:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:n.pageNumber},options:[{key:"pageNumber",type:"render",label:"Page number options",render:()=>J(se)}]});let X=null;function J(ut){const lt=e.ui,Dt=wn=>lt?.commands?.get?.(wn)?.getState?.()??null,ln=()=>{ss(ut),Le.expand.value&&ss(Le),Jl(e)},Dn=Q1(e),zt=Dn?.selectionTarget?.story??Dn?.selectionTarget?.start?.story??Dn?.target?.story??null;return Nr(FK,{pageNumbersState:Dt("page-numbers-apply"),atCursorState:Dt("page-number-insert"),inHeaderFooter:zt?.storyType==="headerFooterPart"||zt?.storyType==="headerFooterSlot",suggesting:lt?.document?.getSnapshot?.()?.mode==="suggesting",initialChoice:X,loadCurrent:()=>lt?lF(lt):Promise.resolve(null),applyPageNumbers:wn=>jc(lt,"page-numbers-apply",wn),removePageNumbers:()=>jc(lt,"page-numbers-remove"),insertAtCursor:()=>jc(lt,"page-number-insert"),close:wn=>{ln();const Vn=lt?.viewport?.getHost?.();if(wn?.action==="apply")X=wn.choice,iT(Vn,wn.choice.position==="top"?"header":"footer");else if(wn?.action==="remove")for(const Tr of new Set(wn.kinds))iT(Vn,Tr)}})}const W=Pn({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:()=>Te(W)}]});function Te(ut){return Nr("div",{},[Nr(oK,{onSelect:Dt=>{e.emitCommand({item:ut,argument:Dt}),ss(ut),Jl(e)}})])}const ge=Pn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>ye(ge)}]}),he=[{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 ye(ut){return Nr(dK,{options:he,onSelect:lt=>{ss(ut);const{command:Dt}=lt;e.emitCommand({item:ut,argument:{command:Dt}}),Jl(e)}})}const Re=Pn({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:()=>Nr("div",{},[Nr(yW,{onSelect:lt=>{ss(Re);const Dt={...Re,command:"setTextAlign"};Dt.command="setTextAlign",e.emitCommand({item:Dt,argument:lt}),je(Re,lt),Jl(e)}})]),key:"alignment"}],onActivate:({textAlign:ut})=>{je(Re,ut)},onDeactivate:()=>{je(Re,"left")}}),je=(ut,lt)=>{let Dt=lt==="both"?"justify":lt,ln={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},Dn=ln[Dt]??ln.left;ut.icon.value=Dn},Je=Pn({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 ut=lt=>{ss(Je);const Dt={...Je,command:"toggleBulletListStyle"};e.emitCommand({item:Dt,argument:lt})};return Nr(nT,{buttons:CW,iconSize:25,selectedStyle:Je.selectedValue.value,onSelect:ut})}}]}),bt=Pn({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 ut=lt=>{ss(bt);const Dt={...bt,command:"toggleOrderedListStyle"};e.emitCommand({item:Dt,argument:lt})};return Nr(nT,{buttons:kW,iconSize:30,selectedStyle:bt.selectedValue.value,onSelect:ut})}}]}),ft=Pn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Mt=Pn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Le=Pn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),Se=Pn({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:ut})=>{ut&&(Se.label.value=ut)}}),ce=Pn({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:ut})=>{ut&&(ce.label.value=ut)}}),H=Pn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),A=Pn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),oe=Pn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),j=Pn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Q=Pn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),G=Pn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),pe=(ut,lt)=>ut==="editor"?lt:ut==="suggester"?lt.filter(Dt=>Dt.value==="suggesting"):lt.filter(Dt=>Dt.value==="viewing"),ke=ut=>ut==="editor"?"Editing":ut==="suggester"?"Suggesting":"Viewing",te=Pn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:ke(s),label:ke(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:()=>Y(te)}]}),N=[{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 Y(ut){return Nr(RW,{options:pe(s,N),onSelect:lt=>{const Dt=e.superdoc?.activeEditor??e.activeEditor;ss(ut);const{label:ln,icon:Dn,value:zt}=lt;te.label.value=ln,te.icon.value=Dn,e.emitCommand({item:te,argument:zt}),Jl(e,Dt)}})}const me=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),Pe=["search","ruler","undo","overflow","documentMode"],_e=Pn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),it=Pn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),Xe=Pn({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 ut=Dt=>{ss(Xe);const ln=typeof Dt=="string"?Dt:Dt?.id??null;if(!ln)return;const Dn={...Xe,command:"setLinkedStyle"};e.emitCommand({item:Dn,argument:ln})},lt=e.getActiveLinkedStyleId?.()??null;return Nr("div",{},[Nr(DW,{styles:e.getLinkedStyleOptions?.()??[],onSelect:ut,selectedOption:lt})])}}],onActivate:({styleId:ut,styleName:lt})=>{const Dt=lt||ut;Xe.label.value=ut&&ut!=="Normal"?String(Dt):n.formatText,Xe.disabled.value=!1},onDeactivate:()=>{Xe.disabled.value=!0,Xe.label.value=n.formatText}}),at=(ut,lt)=>{if(lt.value==ut)return Nr("div",{innerHTML:BK,class:"dropdown-select-icon"})},Pt=Pn({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(ut=>({label:ut.toFixed(2),key:ut,icon:()=>at(ut,Pt.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),Ft=20,Zt=32,At=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],ct=["zoom","fontFamily","fontSize","redo"],tn=i<=Mh.lg,Yt=e.config?.showFormattingMarksButton===!0,Ln=e.config?.showTableOfContentsButton===!0;tn&&(te.attributes.value={...te.attributes.value,className:`${te.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),tn&&(Xe.attributes.value={...Xe.attributes.value,className:`${Xe.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Tn=[H,A,oe,j,F,Se,m,b(),_,b(),p,S,x,L,q,B,b(),P,V,...Ln?[R]:[],...e.config?.showWatermarkButton||l?.has("watermark")?[$]:[],...e.config?.showPageNumberButton||l?.has("pageNumber")?[se]:[],W,ge,b(),Re,Je,bt,ft,Mt,Pt,b(),Xe,b(),_e,ce,...Yt?[it]:[],G,Q,...UK(e)?[v]:[],Le,te,...f];if(i<=Mh.md&&o&&(Tn=Tn.filter(ut=>ut.type!=="separator")),e.config.mode!=="docx"){const ut=Tn.findIndex(Dt=>Dt.name.value==="linkedStyles");Tn.splice(ut-1,2);const lt=["ruler","zoom","undo","redo"];Tn=Tn.filter(Dt=>!lt.includes(Dt.name.value))}const jr=[];a||(s==="viewer"&&jr.push(oe,j),Tn=Tn.filter(ut=>!jr.includes(ut))),l&&(Tn=Tn.filter(ut=>ut.name.value==="overflow"||ut.isCustomToolbarItem||l.has(ut.name.value))),d?.size&&(Tn=Tn.filter(ut=>!d.has(ut.name.value))),Tn=jK(Tn);const no=ut=>Pe.includes(ut.name.value),Yr=Tn.find(ut=>ut.name.value==="overflow"),_n=Tn.filter(ut=>ut!==Yr);if(u){const ut=new Map(u.map((Dt,ln)=>[Dt,ln])),lt=Dt=>ut.get(Dt.name.value)??Number.MAX_SAFE_INTEGER;_n.sort((Dt,ln)=>lt(Dt)-lt(ln))}const nr=ut=>{const lt=[],Dt=[],ln=_n.filter(no).reduce((zt,wn)=>zt+X1(wn,me),0);let Dn=Zt+ln+(ut&&Yr?X1(Yr,me):0);return _n.forEach((zt,wn)=>{const Vn=X1(zt,me);if(zt.type==="separator"&&_n[wn-1]?.name.value==="linkedStyles"&&lt.includes(_n[wn-1])){lt.push(zt);return}if(i<Mh.xl+Ft&&At.includes(zt.name.value)&&o){lt.push(zt);return}if(i<Mh.sm&&ct.includes(zt.name.value)&&o){lt.push(zt);return}if(no(zt)){Dt.push(zt);return}Dn+Vn<=i||!o?(Dt.push(zt),Dn+=Vn):lt.push(zt)}),{visibleItems:Dt,overflowItems:lt}};let{visibleItems:mr,overflowItems:ao}=nr(!1);if(o&&Yr&&ao.some(ut=>ut.type!=="separator")){({visibleItems:mr,overflowItems:ao}=nr(!0));const ut=Tn.indexOf(Yr),lt=mr.findIndex(Dt=>Tn.indexOf(Dt)>ut);lt===-1?mr.push(Yr):mr.splice(lt,0,Yr)}return mr=sT(mr),{defaultItems:mr,overflowItems:ao.filter(ut=>ut.type!=="separator")}},lT={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",watermark:"Watermark",pageNumber:"Page number",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"},GK=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Bt();function cT(e){return tG(e)??K1[e]??null}function Rg(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?jc(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 WK=["page-numbers-apply","page-number-insert"],KK=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),qK=new Set(["list","numberedlist"]);function YK(e,t){if(e==="fontFamily"||e==="fontSize"||qK.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!KK.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function uT(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function XK(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var ZK=new Set([...eG,...Object.keys(Cg),"ai","overflow","tableOfContents"]),QK=class extends pv.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...hr},texts:{...lT},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],toolbarButtonsExclude:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1,showWatermarkButton:!1,showPageNumberButton:!1};toolbarItems=[];overflowItems=[];#e=null;#n=null;isDev=!1;role="editor";superdoc;toolbarContainer=null;toolbar=null;_detachFontsChanged=null;_linkedStyleOptions=Mr([]);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={...hr,...e.icons},this.config.texts={...lT,...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=GK(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.#d(),this.#c(),this.#i(),this._lastFontOptionsSignature=this.#r(),!this.toolbarContainer){this.updateToolbarState();return}this.app=Lc(pW),this.app.directive("click-outside",vb),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.#C():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}#d(){if(Array.isArray(this.config.groups)){this.config.toolbarGroups=this.config.groups,this.config.groups=null;return}this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length&&(this.config.toolbarGroups=Object.keys(this.config.groups))}getAvailableWidth(){const e=document.documentElement.clientWidth,t=this.toolbarContainer?.offsetWidth??0;return this.config.responsiveToContainer?t:e}#h(e){return e||lW(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??[],...this.config.toolbarButtonsExclude??[]]),i=this.config.customButtons||[],s=new Set(ZK),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.#f(C);return t.has(_.name.value)&&(_.selectedValue.value=t.get(_.name.value)),s.add(_.name?.value),_}catch(_){const b=`${C?.name??`<unnamed@${w}>`}::${_?.message??String(_)}`;return this._reportedInvalidCustomItems.has(b)||(this._reportedInvalidCustomItems.add(b),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;let d=null;if(n){const C=Object.values(this.config.groups).flatMap(_=>_),w=a.filter(_=>l.has(_.group?.value||"center")).map(_=>_.name.value);d=[...new Set([...C,...w])]}const{defaultItems:f,overflowItems:p}=HK({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#h(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev,configuredItemNames:r,configuredItemOrder:d,excludedItemNames:o,additionalItems:u});n||(d=[...f.map(C=>C.name.value),...p.map(C=>C.name.value)]);const g=p.filter(C=>d.includes(C.name.value)&&!o.has(C.name.value)),m=g.length?[...d,"overflow"]:d,v=f.filter(C=>m.includes(C.name.value)).filter(C=>!o.has(C.name.value));if(n){const C=new Map(d.map((x,L)=>[x,L])),w=x=>C.get(x.name.value)??Number.MAX_SAFE_INTEGER,_=v.find(x=>x.name.value==="overflow"),b=new Map(v.map((x,L)=>[x,L])),S=v.filter(x=>x!==_);if(S.sort((x,L)=>w(x)-w(L)),_){const x=b.get(_),L=S.findIndex(B=>b.get(B)>x);L===-1?S.push(_):S.splice(L,0,_)}v.splice(0,v.length,...S),g.sort((x,L)=>w(x)-w(L))}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=g}#f(e){const t=Pn({...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}#S(e){return e==="watermark"?this.ui?.document?.getSnapshot?.().ready===!0&&typeof this.ui?.watermark?.open=="function":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)}#w(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>q1(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=tT.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(t==="pageNumber"){const i=WK.map(a=>this.snapshot?.commands?.[a]),s=this.ui?.document?.getSnapshot?.()?.mode==="suggesting";return e.setDisabled(!s&&!i.some(a=>a&&!a.disabled)),!0}if(G1(t)?.disposition==="host-routed")return e.setDisabled(!this.#S(t)),this.#_(t)?e.activate():e.deactivate(),!0;const n=cT(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];YK(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=Z1(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.#w();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#O(),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)}),this.getToolbarItemByName("overflow")?.setDisabled(!this.overflowItems.some(n=>n.type!=="separator"&&!n.disabled.value));const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#O(){this.#s().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#x(e,t){const n=this.superdoc;if(e==="watermark"){if(!this.#S(e))return!1;const r=this.ui.watermark.open();if(!r.ok)throw new Error(`[superdoc toolbar] Watermark dialog unavailable: ${r.reason}`);return!0}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}#M(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.#L();if(n==="tableActions"){const i=eT[t?.command];return i?Rg(this.ui,i,void 0,r):!1}if(G1(n)?.disposition==="unsupported")return!0;const o=cT(n);return o?Rg(this.ui,o,t,r):!1}#L(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=KD({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await GD(e,this.superdoc?.config?.handleImageUpload);Rg(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}#C(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{uT(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!uT(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}XK(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(G1(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(!Rg(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.#M(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 JK(e){return new QK(e)}Bt();var eq=['[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(", "),tq=800,dT=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,fT=e=>{if(!dT)return!1;try{return dT.call(e),!0}catch{return!1}};function nq(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 rq=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"]),oq=["original","markup","final"],iq=["review","original","final","off"];function hT(e){return oq.includes(e)}function sq(e){return e==="markup"?"review":e}function pT(e){return iq.includes(e)}function aq(e){const t=e.modules?.trackChanges?.mode;if(pT(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return pT(n)?n:null}function Mg(e,t){const n=e.viewing,r=hT(n?.trackedChanges)?n.trackedChanges:null,o=r?sq(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 lq(e,t){const n=new I6.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function J1(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function mT(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function cq(e,t){if(!e)return()=>{};if(J1(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=()=>{mT(e),s()},l=u=>{u!==!1&&(u===!0||J1(e))&&(mT(e),s())};return n("synced",a),n("sync",l),J1(e)&&s(),i}function uq(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(eq));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(nm.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 dq(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function gT(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 vT(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function fq(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 si(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function yT(e){return typeof e=="string"&&e.length>0?e:null}function bT(e){return e?si(e)?yT(e.documentId??e.options?.documentId??null):yT(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function hq(e){if(!e||si(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function Rs(e){if(!e)return null;if(si(e))return e.fonts??null;const t=hq(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 Lh=class extends pv.default{static{this.allowedTypes=[_r,za,Gu]}#e;#n;#t;#o;#i;#a;#d;#h;#c;#f;#p;#r;#s;#m;#_;#S;#g;#w;#A;#T;#I;#O;#x;#M;#L;#C;#y;get uiConfig(){return this.#y}#v;get interactionConfig(){return this.#v}#F;get surfacesConfig(){return this.#F}#E;#N;#R;#u;#P;#B;#b;constructor(e){if(super(),this.#e=!1,this.#t=!1,this.#o=null,this.#i=null,this.#a=null,this.#d=null,this.#h=null,this.#c=null,this.#f=!1,this.#p=null,this.#r=null,this.#s=null,this.#m=null,this.#_=!1,this.#S=!1,this.#g=null,this.#w=null,this.#A=!1,this.#T=null,this.#I=null,this.#O=n=>{this.listenerCount("content-control:active-change")>0&&(this.#A||(this.#T=n.pointerId),this.#A=!0,this.#g="pointer",this.#w=null)},this.#x=n=>{n.pointerId===this.#T&&(this.#A=!1,this.#T=null,this.#g??="pointer",this.#g==="pointer"&&(this.#w=Date.now()+tq))},this.#M=n=>{this.listenerCount("content-control:active-change")>0&&!nq(n)&&(this.#g="keyboard",this.#w=null)},this.#L=n=>{this.#D(n)},this.#C=null,this.#y=$E({}),this.#v=HE({}),this.#F=WE({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#N=!1,this.#R=[],this.#u=new QH,this.#P=null,this.#B=!1,this.#b=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...$1},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.#re=new WeakSet,this.#oe=new WeakMap,this.#ie=null,this.#q=null,this.#V=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=kx(this,e,()=>this.version,t),this.#E=new kH({getModuleConfig:()=>this.#F}),this.#s=t,t.addEventListener("pointerdown",this.#O,!0),t.ownerDocument.addEventListener("pointerup",this.#x,!0),t.ownerDocument.addEventListener("pointercancel",this.#x,!0),t.addEventListener("keydown",this.#M,!0),t.addEventListener("click",this.#L,!0),this.#l("content-control:active-change",e.onContentControlActiveChange),this.#U(e,t),this.#S=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#D(e){const t=this.#s;if(!t)return;const n=uq(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=gT(dq(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#U(e,t){this.#b=aq(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),U1(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.#He(),this.config.user=DH(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=xA(this.config.modules.comments),this.#y=$E(this.config),this.#v=HE(this.config),this.#F=WE(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.userColorMap=new Map,this.colorIndex=0,this.version="2.25.0-next.14",this.#se("πŸ¦‹ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||Sa(),this.colors=this.config.colors??[],this.#de(),this.#J(),await JM(),this.#e)return;if(await this.#Se(this.config.modules),this.#e){this.#ke();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.#P||(this.#P=this.#u.subscribe(i=>{this.#We(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.#te(),this.#$(),this.#Ke(),this.#Z()}#Z(){if(this.#N=!1,this.#R=[],this.#ee(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#r)}#$(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new qV({Renderer:bH,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#k("requiredNumberOfEditors").documents.filter(e=>e.type===_r).length}get ui(){return this.#C||(this.#C=QF({superdoc:this}),this.#e&&this.#C.destroy()),this.#Q(),this.#C}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.#S&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#S&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#S&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#j(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#j(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#j(),this}#j(){this.listenerCount("content-control:active-change")>0||(this.#m?.(),this.#m=null,this.#I=null,this.#g=null,this.#w=null,this.#A=!1,this.#T=null)}#Q(){if(this.#m||this.#_||!this.#C||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.#C.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=vT(s);if(!a)return;this.#g==="pointer"&&this.#w!==null&&Date.now()>this.#w&&(this.#g=null,this.#w=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.#w=null}),r=this.#C.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>gT(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 g=vT(this.#C.selection.getSnapshot()),m=this.#I;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:g&&m?.editor===a&&m.key===g?m.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#m=i}catch(i){throw n?.(),r?.(),i}finally{this.#_=!1}}get state(){return{documents:this.#k("state").documents.map(e=>Ll(e.data)?{...e,data:Ab(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}#J(){const e=this.config.document,t=!!e&&typeof e=="object"&&(Ll(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=Eb(e);this.config.documents=[{id:Sa(),...o}]}else n&&(this.config.documents=[{id:Sa(),type:_r,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=Eb(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||Sa()}}))}#ee(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=OV({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&&BM(this),this.#ce()}#l(e,t){t&&this.on(e,t)}#te(){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.#Ae(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#Se({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:Sa(),type:_r,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}#Ye(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=Qr(e),this.provider=Qr(t),this.#de();const n=this.config;this._cleanupAwareness=PM(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#_e(){this.#p=null,this.#ne(),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})}#ne(){if(this.#a){try{this.#a()}catch{}this.#a=null}if(this.#d){try{this.#d()}catch{}this.#d=null}if(this.#h){try{this.#h()}catch{}this.#h=null}}#Ae(e){this.#ne(),si(e)&&(this.#Ee(e),this.#Te(e),this.#Ie(e))}#Ie(e){const t=e.connection;if(!t||typeof t.subscribe!="function")return;const{documentId:n}=t;this.#c?.documentId!==n&&(this.#c=null,this.#f=!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:fq(o,this.#f),detail:o.detail??null,superdoc:this};this.#c=s,o.state==="synced"&&(this.#f=!0),this.emit("collaboration-connection-change",s)};try{const o=t.getSnapshot?.();o&&r(o),this.#h=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 connection bridge failed to subscribe",o)}}getCollaborationConnectionState(){return this.#c}#Ee(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=HV(()=>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)}}#Te(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.#d=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}}#xe(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#H(e,t){this.isLocked===e&&this.#xe(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#se("πŸ¦‹ [superdoc] Locking superdoc:",e,t,`
108
108
 
109
109
 
110
110
  `),this.emit("locked",{isLocked:e,lockedBy:t}))}#de(){const e=this.config.user;if(!e||e.color)return;const t=this.colors.length>0?this.colors:rq,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.#pe(e);if(this.#Re(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.#je(e);this.#t=!0;const n=(async()=>{try{const r=await this.#ze(),o=this.#Le(),i=this.#Me();this.#De();try{this.#p=i;const s=await this.#Ne(t,r);this.#Be(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.#Pe(o),s}}finally{this.#i=null,this.#t=!1,this.#o=null}})();return this.#o={target:t,promise:n},n}#Re(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})}#Me(){return{isLocked:this.isLocked,lockedBy:this.lockedBy?{...this.lockedBy}:null}}#Le(){const e=this.config.documents.find(r=>r.type===_r),t=this.superdocStore?.documents.find(r=>r.id===e.id)??null,n=t?En(t):null;return{isCollaborative:this.isCollaborative,configV2Collaboration:e.v2Collaboration??null,configData:e.data,storeDoc:t,storeV2Collaboration:this.#Fe(n),storeData:t?.data}}#Pe(e){this.#p=null;const t=this.config.documents.find(n=>n.type===_r);t.v2Collaboration=e.configV2Collaboration,t.data=e.configData,this.isCollaborative=e.isCollaborative,e.storeDoc&&(e.storeDoc.data=e.storeData,this.#W(e.storeDoc,e.storeV2Collaboration))}#De(){if(this.#e)throw new Error("SuperDoc: instance was destroyed during upgrade")}#k(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}#Xe(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}#G(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`)}#Oe(e,t){const n=this.superdocStore?.documents;if(Array.isArray(n))for(const r of n){const o=En(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)}}#Fe(e){if(!e)return null;const t=e.v2Collaboration;return t&&typeof t=="object"&&"value"in t?t.value:t??null}#W(e,t){const n=En(e).v2Collaboration;if(n&&typeof n=="object"&&"value"in n){n.value=t;return}e.v2Collaboration=t}#fe(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#Ne(e,t){const n=this.config.documents.find(s=>s.type===_r),r=this.#k("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(!si(o)||typeof o.upgradeToCollaboration!="function")throw new Error("SuperDoc: live v2 editor cannot attach collaboration in place");const i=this.#fe({...e,roomMode:"create"});return n.v2Collaboration=i,this.#W(r,i),this.isCollaborative=!0,await o.upgradeToCollaboration(t,i),n.data=t,r.data=t,{configDoc:n,storeDoc:r}}#Be(e,t){const n=this.#fe({...t,roomMode:"join"});e.configDoc.v2Collaboration=n,this.#W(e.storeDoc,n)}async#ze(){const e=this.activeEditor;if(si(e)&&typeof e.save=="function"){const r=await e.save();return this.#z(r)}const t=this.config.documents.find(r=>r.type===_r),n=(this.superdocStore?.documents.find(r=>r.id===t.id)??null)?.data??t.data;if(n instanceof Blob)return n;if(Ll(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(Ll(e))return Ab(e,_r);throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#he(e,t){const n=bT(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.#W(s,i))}#Ze(){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}#Qe(){this.#_e(),this.#Oe(null,null)}#Je(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))})}#et(e){return new Promise((n,r)=>{let o,i=!1,s=()=>{};const a=()=>{i=!0,clearTimeout(o),s()};s=cq(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")))}})}#je(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===_r);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(!si(this.#Ue()))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.#pe(e)}#pe(e){const t=this.config,n=t.documents.find(a=>a.type===_r),r=t.modules?.collaboration,o=e.ydoc||e.provider?{ydoc:e.ydoc,provider:e.provider}:r?{...r}:null,i=e.v2Collaboration??this.#Ve(n.v2Collaboration)??r?.v2Collaboration??r?.v2??null,s=uS({collaboration:e.collaboration,v2Collaboration:i,legacyCollaboration:o,documentType:_r,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"}}}#Ve(e){return e&&typeof e=="object"&&"value"in e?e.value:e}#Ue(){const e=this.config.documents.find(n=>n.type===_r),t=this.#k("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.#G("addSharedUser");const t=Wu({actor:e});t&&this.users.some(n=>Wu({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#G("removeSharedUser");const t=typeof e=="string"?mb(e):"",n=typeof e=="string"?`email:${t}`:Wu({actor:e});this.users=this.users.filter(r=>{const o=Wu({actor:r});return n?o!==n:t?mb(r.email)!==t:!0})}onContentError({error:e,editor:t}){const n=t.options?.documentId,r=this.#k("onContentError").documents.find(a=>a.id===n),o=typeof r?.id=="string"?r.id:typeof n=="string"?n:"",i=r?.data,s=fT(i)?i:Ll(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(){if(!this.#e&&this.readyEditors===this.requiredNumberOfEditors){if(this.emit("ready",{superdoc:this}),this.#e)return;this.#N=!0;for(const e of this.#R.splice(0))this.emit(e)}}broadcastEditorBeforeCreate(e){this.emit("editorBeforeCreate",{editor:xE(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#$e(e),this.emit("editorCreate",{editor:xE(e)})}#me(e){if(!this.#e){if(!this.#N){this.#R.push(e);return}this.emit(e)}}broadcastSourceComplete(){this.#me("source:complete")}broadcastSourceSignalsComplete(){this.#me("source:signals-complete")}#re;#oe;#$e(e){if(!e||typeof e.on!="function"||this.#re.has(e))return;this.#re.add(e),e.on("fonts-changed",n=>{this.#ge(e)&&this.#K(e,n)});const t=(e.documentRenderer??e.presentationEditor)?.getLastFontsChangedPayload?.();t&&this.#ge(e)&&this.#K(e,t)}#ge(e){return!this.activeEditor||e===this.activeEditor}#ie;#K(e,t){if(this.#ie=t,e.editorVersion===2){let n=this.#oe.get(e);n||(n=new Set,this.#oe.set(e,n)),ZH(t.missingFonts,n)}this.emit("fonts-changed",t)}broadcastEditorDestroy(){this.emit("editorDestroy")}broadcastSidebarToggle(e){this.emit("sidebar-toggle",e)}#He(){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()`.")}#se(...e){(console.debug?console.debug:console.log)("πŸ¦‹ πŸ¦Έβ€β™€οΈ [superdoc]",...e)}#q;get fonts(){return this.#q||(this.#q={getReport:()=>Rs(this.activeEditor)?.getReport()??[],getMissingFonts:()=>Rs(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>Rs(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>Rs(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>Rs(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?Rs(t)?.getLastFontsChangedPayload?.()??null:this.#ie??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=Rs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=Rs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=Rs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=Rs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.preload requires an active editor");return t.preload(e)}}),this.#q}#Y(){const e=this.activeEditor!==null;this.#ve(),this.activeEditor=null,this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null),e&&this.emit("active-editor-change")}#V;#ve(){if(this.#V){try{this.#V()}catch{}this.#V=null}}#Ge(e){this.#ve();const t=Rs(e);if(!e||!t?.onChanged)return;const n=t.getLastFontsChangedPayload?.();n&&this.#K(e,n),this.#V=t.onChanged(r=>this.#K(e,r))}#We(e,t){this.#B=!0;try{if(e===null){this.#Y();return}this.#u.get(e)?.kind==="v2"&&si(t)?this.#ye(t):this.#Y()}finally{this.#B=!1}}#ye(e){if(si(e)){!this.#B&&this.#u.getActive()&&this.#u.setActive(null,"set-active-v2-facade");const t=this.activeEditor;this.activeEditor=e,this.#Ge(e),this.toolbar?.setActiveEditor?.(e),t!==this.activeEditor&&this.emit("active-editor-change");return}this.#Y()}setActiveEditor(e){this.#ye(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 collaboration (hocuspocus, y-websocket, liveblocks, and registered provider extensions) is wired through document.collaboration, including collaboration-ready, awareness-update, and locked event bridges; external { ydoc, provider } instances 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.#u.register(e);const t=this.config.layoutEngineOptions?.showFormattingMarks;typeof t=="boolean"&&e.setShowFormattingMarks(t)}unregisterEditorRuntime(e){return this.#u.unregister(e)}getActiveRuntime(){return this.#u.getActive()}setActiveRuntime(e,t){this.#u.setActive(e,t)}resolveRuntimeFromEventTarget(e){return this.#u.resolveFromEventTarget(e)}activateRuntimeFromEventTarget(e,t){const n=this.#u.resolveFromEventTarget(e);return n?(this.#u.setActive(n.id,t),!0):!1}toggleRuler(){const e=this.#k("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 qa(e,t,n,{superdoc:this,currentUser:this.config.user,comment:i??null,trackedChange:o??null})}#Ke(){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=JK({...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 OD(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=>{const o=typeof r.id=="string"?this.#u.getAllByDocumentId(r.id):[];if(o.length){for(const i of o)i.setShowFormattingMarks(t);return}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.#G("setDocumentMode");const t=e.toLowerCase(),n=this.config.role==="viewer"?"viewing":this.config.role==="suggester"&&t==="editing"?"suggesting":t;this.config.documentMode=n,U1(this.config),this.#ce();const r={viewing:()=>this.#le(),editing:()=>this.#qe(),suggesting:()=>this.#we()};r[n]&&(r[n](),this.emit("document-mode-change",{documentMode:n}))}#ae(e,t){const n=typeof e.id=="string"&&e.id.length>0?e.id:null;if(n){const i=this.#u.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.#X(e)}#be(){return typeof this.config.trackChanges?.enabled=="boolean"?this.config.trackChanges.enabled:typeof this.config.modules?.trackChanges?.enabled=="boolean"?this.config.modules.trackChanges.enabled:!0}#X(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.#u.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.#G("setViewingOptions");const t=Mg(this.config,this.#b),n={...this.config.viewing},r=typeof e.comments=="boolean",o=hT(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&&U1(this.config),this.#ce(),this.config.documentMode==="viewing")){const i=Mg(this.config,this.#b),s=t.comments||t.trackChangesVisible,a=i.comments||i.trackChangesVisible;this.#le({updateTrackedChangesProjection:o,updateCommentVisibility:s!==a})}}#qe(){if(this.config.role!=="editor")return this.#we();const e=this.#k("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#X({mode:"review",enabled:this.#be()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#ae(t,"editing")})}#we(){if(!["editor","suggester"].includes(this.config.role??""))return this.#le();const e=this.#k("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#X({mode:"review",enabled:this.#be()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#ae(t,"suggesting")})}#le(e={}){const t=this.#k("setDocumentMode");this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null);const n=Mg(this.config,this.#b),r=n.comments,o=n.trackChangesVisible;e.updateTrackedChangesProjection!==!1&&this.#X({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.#ae(i,"viewing")})}#ce(){const e=Mg(this.config,this.#b),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=D_(t.availableWidth,t.documentWidth,j0(this.config.zoom?.fitWidth));n!==null&&(this.superdocStore.activeZoom=n)}}this.emit("zoomChange",{zoom:this.getZoom(),mode:e})}}getZoomState(){const e=j0(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(si(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.#k("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=vI(n||this.config.title),u=await this.exportEditorsToDOCX({commentsType:t,isFinalDoc:i,fieldsHighlightColor:a}),d=[...r],f=[...o];if(e.includes("docx")&&u.forEach(g=>{d.push(g),f.push(`${l}.docx`)}),d.length===1)return s?gI(d[0],l,e[0]):d[0];const p=await lq(d,f);return s?gI(p,l,"zip"):p}async replaceFile(e){return(await this.#Ce(e)).raw}async replaceDocument(e){const{raw:t,confirmed:n}=await this.#Ce(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#Ce(e){const t=this.activeEditor;if(si(t)&&typeof t.replaceFile=="function"){const r=this.#z(e),o=await t.replaceFile(r),i=o&&typeof o=="object"?o.state:null,s=i===null||i==="review-ready"||i==="editing-ready";return s&&(this.#he(t,r),this.emit("document-replaced",{editor:t,host:t?.host})),{raw:o,confirmed:s}}const n=t&&!si(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.#he(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.#k("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=()=>fT(d.data)?d.data.type&&d.data.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?null:d.data:Ll(d.data)?this.#z(d.data):null;if(!f||typeof f.exportDocx!="function")return p();const g=f.editorVersion===2;try{const m=await f.exportDocx(g?{isFinalDoc:t,commentsType:e,fieldsHighlightColor:n}:{isFinalDoc:t,comments:s(),commentsType:e,fieldsHighlightColor:n});if(m)return m}catch(m){if((!m||typeof m!="object"||!a.has(m))&&(this.emit("exception",{error:m,document:d}),this.emit("exception",Hj(m,{documentId:d.id,editor:null}))),g)throw m}return p()});return(await Promise.all(u)).filter(d=>d!=null)}finally{this.off("exception",l)}}async save(){const e=this.#k("save").documents;await Promise.all(e.map(async t=>{if(t.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return;const n=t.getEditor?.();if(!si(n)||typeof n.save!="function")throw new Error(`SuperDoc: save is unavailable for document "${t.id}"`);await n.save()}))}#ke(){this.#p=null,this.#ne(),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.#k("removeDocument"),r=this.activeEditor,o=bT(r);for(const i of this.#u.getAllByDocumentId(t))this.#u.unregister(i.id);return o===t&&r!==null&&this.#Y(),n.removeDocument(t)?(await _t(),!0):!1}destroy(){_x(this),this.#e=!0,this.#R=[],this.#s?.removeEventListener("click",this.#L,!0),this.#s?.removeEventListener("pointerdown",this.#O,!0),this.#s?.ownerDocument.removeEventListener("pointerup",this.#x,!0),this.#s?.ownerDocument.removeEventListener("pointercancel",this.#x,!0),this.#s?.removeEventListener("keydown",this.#M,!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.#se("[superdoc] Unmounting app"),this.superdocStore?.reset(),this.app.unmount(),this.removeAllListeners(),delete this.app.config.globalProperties.$config,delete this.app.config.globalProperties.$superdoc),this.#C?.destroy(),this.#ke(),this.#P?.(),this.#P=null,this.#u.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?si(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#k("focus").documents.find(n=>{const r=n.getEditor?.();return r?(si(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};Object.defineProperty(Lh.prototype.canPerformPermission,Symbol.for("superdoc.internal.permission-method.builtin"),{value:!0}),Bt();var wT="__SUPERDOC_V2_BROWSER_RUNTIME__";function pq(e=globalThis){const t=e[wT];return t&&typeof t=="object"?t:null}function mq(e={},t=globalThis){const n=pq(t)??{},r={...n,...e,vue:e.vue??n.vue??S6};return t[wT]=r,r}mq();var gq={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"},vq=0;function CT(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-${++vq}`}`,l=[];if(i)for(const[u,d]of Object.entries(i)){if(d==null)continue;const f=gq[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} {
111
111
  ${l.join(`
112
112
  `)}
113
- }`:""}}function yq(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 bq(e){const{className:t,css:n}=CT(e);return yq(t,n),t}function wq(e){return CT(e)}function Cq(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 kq=Xd({BlankDOCX:()=>i_,DOCX:()=>_r,HTML:()=>Gu,PDF:()=>za,SuperDoc:()=>Lh,buildTheme:()=>wq,compareVersions:()=>M6,createTheme:()=>bq,defineSuperDocExtension:()=>Cq,getFileObject:()=>gb,listPermissionRangeEditors:()=>sF,resolvePermissionRangeEditor:()=>rA}),Sq="SUPERDOC_ENGINE_CDN_BASE_URL",kT=Symbol.for("superdoc.docx-engine.cdn-load-state"),Lg="superdocDocxEngineStatus";function _q(e,t,n=null){const r=e?.[Sq],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return Aq(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 Aq(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 Iq({engineVersion:e,buildBaseUrl:t}){ZM(()=>{const n=_q(globalThis,e,t),r=globalThis[kT],o=r instanceof Map?r:new Map;if(globalThis[kT]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),Eq(`${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 Eq(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[Lg]==="loaded")return Promise.resolve();const r=n?.dataset[Lg]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(g,m)=>{a||(a=!0,l?.disconnect(),s.dataset[Lg]=g,m())},d=()=>u("loaded",o),f=()=>u("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),p=()=>{s.isConnected||u("error",()=>i(new Error(`SuperDoc: DOCX Engine stylesheet was removed while loading from ${t}`)))};s.addEventListener("load",d,{once:!0}),s.addEventListener("error",f,{once:!0}),typeof globalThis.MutationObserver=="function"&&(l=new globalThis.MutationObserver(p),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[Lg]="loading",document.head.appendChild(s))})}Iq({engineVersion:"0.24.0-next.13",buildBaseUrl:null});for(const[e,t]of Object.entries(kq))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(Lh,e)||(Lh[e]=t);var Tq=Lh;return Tq})();
113
+ }`:""}}function yq(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 bq(e){const{className:t,css:n}=CT(e);return yq(t,n),t}function wq(e){return CT(e)}function Cq(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 kq=Xd({BlankDOCX:()=>i_,DOCX:()=>_r,HTML:()=>Gu,PDF:()=>za,SuperDoc:()=>Lh,buildTheme:()=>wq,compareVersions:()=>M6,createTheme:()=>bq,defineSuperDocExtension:()=>Cq,getFileObject:()=>gb,listPermissionRangeEditors:()=>sF,resolvePermissionRangeEditor:()=>rA}),Sq="SUPERDOC_ENGINE_CDN_BASE_URL",kT=Symbol.for("superdoc.docx-engine.cdn-load-state"),Lg="superdocDocxEngineStatus";function _q(e,t,n=null){const r=e?.[Sq],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return Aq(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 Aq(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 Iq({engineVersion:e,buildBaseUrl:t}){ZM(()=>{const n=_q(globalThis,e,t),r=globalThis[kT],o=r instanceof Map?r:new Map;if(globalThis[kT]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),Eq(`${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 Eq(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[Lg]==="loaded")return Promise.resolve();const r=n?.dataset[Lg]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(g,m)=>{a||(a=!0,l?.disconnect(),s.dataset[Lg]=g,m())},d=()=>u("loaded",o),f=()=>u("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),p=()=>{s.isConnected||u("error",()=>i(new Error(`SuperDoc: DOCX Engine stylesheet was removed while loading from ${t}`)))};s.addEventListener("load",d,{once:!0}),s.addEventListener("error",f,{once:!0}),typeof globalThis.MutationObserver=="function"&&(l=new globalThis.MutationObserver(p),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[Lg]="loading",document.head.appendChild(s))})}Iq({engineVersion:"0.24.0-next.14",buildBaseUrl:null});for(const[e,t]of Object.entries(kq))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(Lh,e)||(Lh[e]=t);var Tq=Lh;return Tq})();