@quoreadmin/ui 0.26.11 → 0.26.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/dist/index.umd.cjs +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -128,7 +128,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
128
128
|
`),position:m,pageIndex:y-1,rect:d.slice(0),rotation:f,id:h,deleted:!1}}const s=super.deserialize(t,r,i);return A(s,cr,t.fontSize),A(s,ii,se.makeHexColor(...t.color)),A(s,lr,x(a=Qe,i1,Bv).call(a,t.value)),s.annotationElementId=t.id||null,A(s,Iu,o),s}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const r=Qe._internalPadding*this.parentScale,i=this.getRect(r,r),o=je._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:g(this,ii)),s={annotationType:Ae.FREETEXT,color:o,fontSize:g(this,cr),value:x(this,py,VN).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?s:this.annotationElementId&&!x(this,my,jN).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(t){const r=super.renderAnnotationElement(t);if(this.deleted)return r;const{style:i}=r;i.fontSize=`calc(${g(this,cr)}px * var(--scale-factor))`,i.color=g(this,ii),r.replaceChildren();for(const s of g(this,lr).split(`
|
|
129
129
|
`)){const a=document.createElement("div");a.append(s?document.createTextNode(s):document.createElement("br")),r.append(a)}const o=Qe._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(o,o),popupContent:g(this,lr)}),r}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};ii=new WeakMap,lr=new WeakMap,r1=new WeakMap,f0=new WeakMap,cr=new WeakMap,Iu=new WeakMap,dy=new WeakSet,RN=function(t){const r=o=>{this.editorDiv.style.fontSize=`calc(${o}px * var(--scale-factor))`,this.translate(0,-(o-g(this,cr))*this.parentScale),A(this,cr,o),x(this,Ou,f5).call(this)},i=g(this,cr);this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},fy=new WeakSet,$N=function(t){const r=o=>{A(this,ii,this.editorDiv.style.color=o)},i=g(this,ii);this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},hy=new WeakSet,FN=function(){var r;const t=[];this.editorDiv.normalize();for(const i of this.editorDiv.childNodes)t.push(x(r=Qe,Du,h5).call(r,i));return t.join(`
|
|
130
130
|
`)},Ou=new WeakSet,f5=function(){const[t,r]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:o,div:s}=this,a=s.style.display,c=s.classList.contains("hidden");s.classList.remove("hidden"),s.style.display="hidden",o.div.append(this.div),i=s.getBoundingClientRect(),s.remove(),s.style.display=a,s.classList.toggle("hidden",c)}this.rotation%180==this.parentRotation%180?(this.width=i.width/t,this.height=i.height/r):(this.width=i.height/t,this.height=i.width/r),this.fixAndSetPosition()},Du=new WeakSet,h5=function(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(pm,"")},Nu=new WeakSet,p5=function(){if(this.editorDiv.replaceChildren(),g(this,lr))for(const t of g(this,lr).split(`
|
|
131
|
-
`)){const r=document.createElement("div");r.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(r)}},py=new WeakSet,VN=function(){return g(this,lr).replaceAll(" "," ")},i1=new WeakSet,Bv=function(t){return t.replaceAll(" "," ")},my=new WeakSet,jN=function(t){const{value:r,fontSize:i,color:o,pageIndex:s}=g(this,Iu);return this._hasBeenMoved||t.value!==r||t.fontSize!==i||t.color.some((a,c)=>a!==o[c])||t.pageIndex!==s},M(Qe,Du),M(Qe,i1),fe(Qe,"_freeTextDefaultContent",""),fe(Qe,"_internalPadding",0),fe(Qe,"_defaultColor",null),fe(Qe,"_defaultFontSize",10),fe(Qe,"_type","freetext"),fe(Qe,"_editorType",Ae.FREETEXT);let q4=Qe;class rE{constructor(e,t=0,r=0,i=!0){M(this,gy);M(this,Pu);M(this,yy);M(this,by);M(this,s1);M(this,o1,void 0);M(this,pa,[]);M(this,oi,[]);let o=1/0,s=-1/0,a=1/0,c=-1/0;const u=10**-4;for(const{x:b,y:w,width:v,height:k}of e){const C=Math.floor((b-t)/u)*u,T=Math.ceil((b+v+t)/u)*u,S=Math.floor((w-t)/u)*u,E=Math.ceil((w+k+t)/u)*u,O=[C,S,E,!0],I=[T,S,E,!1];g(this,pa).push(O,I),o=Math.min(o,C),s=Math.max(s,T),a=Math.min(a,S),c=Math.max(c,E)}const d=s-o+2*r,f=c-a+2*r,h=o-r,p=a-r,m=g(this,pa).at(i?-1:-2),y=[m[0],m[2]];for(const b of g(this,pa)){const[w,v,k]=b;b[0]=(w-h)/d,b[1]=(v-p)/f,b[2]=(k-p)/f}A(this,o1,{x:h,y:p,width:d,height:f,lastPoint:y})}getOutlines(){g(this,pa).sort((t,r)=>t[0]-r[0]||t[1]-r[1]||t[2]-r[2]);const e=[];for(const t of g(this,pa))t[3]?(e.push(...x(this,s1,Rv).call(this,t)),x(this,yy,HN).call(this,t)):(x(this,by,UN).call(this,t),e.push(...x(this,s1,Rv).call(this,t)));return x(this,gy,zN).call(this,e)}}o1=new WeakMap,pa=new WeakMap,oi=new WeakMap,gy=new WeakSet,zN=function(e){const t=[],r=new Set;for(const s of e){const[a,c,u]=s;t.push([a,c,s],[a,u,s])}t.sort((s,a)=>s[1]-a[1]||s[0]-a[0]);for(let s=0,a=t.length;s<a;s+=2){const c=t[s][2],u=t[s+1][2];c.push(u),u.push(c),r.add(c),r.add(u)}const i=[];let o;for(;r.size>0;){const s=r.values().next().value;let[a,c,u,d,f]=s;r.delete(s);let h=a,p=c;for(o=[a,u],i.push(o);;){let m;if(r.has(d))m=d;else{if(!r.has(f))break;m=f}r.delete(m),[a,c,u,d,f]=m,h!==a&&(o.push(h,p,a,p===c?c:u),h=a),p=p===c?u:c}o.push(h,p)}return new cW(i,g(this,o1))},Pu=new WeakSet,m5=function(e){const t=g(this,oi);let r=0,i=t.length-1;for(;r<=i;){const o=r+i>>1,s=t[o][0];if(s===e)return o;s<e?r=o+1:i=o-1}return i+1},yy=new WeakSet,HN=function([,e,t]){const r=x(this,Pu,m5).call(this,e);g(this,oi).splice(r,0,[e,t])},by=new WeakSet,UN=function([,e,t]){const r=x(this,Pu,m5).call(this,e);for(let i=r;i<g(this,oi).length;i++){const[o,s]=g(this,oi)[i];if(o!==e)break;if(o===e&&s===t){g(this,oi).splice(i,1);return}}for(let i=r-1;i>=0;i--){const[o,s]=g(this,oi)[i];if(o!==e)break;if(o===e&&s===t){g(this,oi).splice(i,1);return}}},s1=new WeakSet,Rv=function(e){const[t,r,i]=e,o=[[t,r,i]],s=x(this,Pu,m5).call(this,i);for(let a=0;a<s;a++){const[c,u]=g(this,oi)[a];for(let d=0,f=o.length;d<f;d++){const[,h,p]=o[d];if(!(u<=h||p<=c))if(h>=c)if(p>u)o[d][1]=u;else{if(f===1)return[];o.splice(d,1),d--,f--}else o[d][2]=c,p>u&&o.push([t,u,p])}}return o};class iE{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(e,t){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof G4}}class cW extends iE{constructor(t,r){super();M(this,a1,void 0);M(this,_u,void 0);A(this,_u,t),A(this,a1,r)}toSVGPath(){const t=[];for(const r of g(this,_u)){let[i,o]=r;t.push(`M${i} ${o}`);for(let s=2;s<r.length;s+=2){const a=r[s],c=r[s+1];a===i?(t.push(`V${c}`),o=c):c===o&&(t.push(`H${a}`),i=a)}t.push("Z")}return t.join(" ")}serialize([t,r,i,o],s){const a=[],c=i-t,u=o-r;for(const d of g(this,_u)){const f=new Array(d.length);for(let h=0;h<d.length;h+=2)f[h]=t+d[h]*c,f[h+1]=o-d[h+1]*u;a.push(f)}return a}get box(){return g(this,a1)}}a1=new WeakMap,_u=new WeakMap;const Fo=class Fo{constructor({x:e,y:t},r,i,o,s,a=0){M(this,d1);M(this,Hi,void 0);M(this,$o,[]);M(this,Lu,void 0);M(this,Bu,void 0);M(this,Ui,[]);M(this,Te,new Float64Array(18));M(this,h0,void 0);M(this,p0,void 0);M(this,l1,void 0);M(this,c1,void 0);M(this,Ru,void 0);M(this,$u,void 0);M(this,ma,[]);A(this,Hi,r),A(this,$u,o*i),A(this,Bu,s),g(this,Te).set([NaN,NaN,NaN,NaN,e,t],6),A(this,Lu,a),A(this,c1,g(Fo,u1)*i),A(this,l1,g(Fo,vy)*i),A(this,Ru,i),g(this,ma).push(e,t)}get free(){return!0}isEmpty(){return isNaN(g(this,Te)[8])}add({x:e,y:t}){var E;A(this,h0,e),A(this,p0,t);const[r,i,o,s]=g(this,Hi);let[a,c,u,d]=g(this,Te).subarray(8,12);const f=e-u,h=t-d,p=Math.hypot(f,h);if(p<g(this,l1))return!1;const m=p-g(this,c1),y=m/p,b=y*f,w=y*h;let v=a,k=c;a=u,c=d,u+=b,d+=w,(E=g(this,ma))==null||E.push(e,t);const C=b/m,T=-w/m*g(this,$u),S=C*g(this,$u);return g(this,Te).set(g(this,Te).subarray(2,8),0),g(this,Te).set([u+T,d+S],4),g(this,Te).set(g(this,Te).subarray(14,18),12),g(this,Te).set([u-T,d-S],16),isNaN(g(this,Te)[6])?(g(this,Ui).length===0&&(g(this,Te).set([a+T,c+S],2),g(this,Ui).push(NaN,NaN,NaN,NaN,(a+T-r)/o,(c+S-i)/s),g(this,Te).set([a-T,c-S],14),g(this,$o).push(NaN,NaN,NaN,NaN,(a-T-r)/o,(c-S-i)/s)),g(this,Te).set([v,k,a,c,u,d],6),!this.isEmpty()):(g(this,Te).set([v,k,a,c,u,d],6),Math.abs(Math.atan2(k-c,v-a)-Math.atan2(w,b))<Math.PI/2?([a,c,u,d]=g(this,Te).subarray(2,6),g(this,Ui).push(NaN,NaN,NaN,NaN,((a+u)/2-r)/o,((c+d)/2-i)/s),[a,c,v,k]=g(this,Te).subarray(14,18),g(this,$o).push(NaN,NaN,NaN,NaN,((v+a)/2-r)/o,((k+c)/2-i)/s),!0):([v,k,a,c,u,d]=g(this,Te).subarray(0,6),g(this,Ui).push(((v+5*a)/6-r)/o,((k+5*c)/6-i)/s,((5*a+u)/6-r)/o,((5*c+d)/6-i)/s,((a+u)/2-r)/o,((c+d)/2-i)/s),[u,d,a,c,v,k]=g(this,Te).subarray(12,18),g(this,$o).push(((v+5*a)/6-r)/o,((k+5*c)/6-i)/s,((5*a+u)/6-r)/o,((5*c+d)/6-i)/s,((a+u)/2-r)/o,((c+d)/2-i)/s),!0))}toSVGPath(){if(this.isEmpty())return"";const e=g(this,Ui),t=g(this,$o),r=g(this,Te).subarray(4,6),i=g(this,Te).subarray(16,18),[o,s,a,c]=g(this,Hi),[u,d,f,h]=x(this,d1,$v).call(this);if(isNaN(g(this,Te)[6])&&!this.isEmpty())return`M${(g(this,Te)[2]-o)/a} ${(g(this,Te)[3]-s)/c} L${(g(this,Te)[4]-o)/a} ${(g(this,Te)[5]-s)/c} L${u} ${d} L${f} ${h} L${(g(this,Te)[16]-o)/a} ${(g(this,Te)[17]-s)/c} L${(g(this,Te)[14]-o)/a} ${(g(this,Te)[15]-s)/c} Z`;const p=[];p.push(`M${e[4]} ${e[5]}`);for(let m=6;m<e.length;m+=6)isNaN(e[m])?p.push(`L${e[m+4]} ${e[m+5]}`):p.push(`C${e[m]} ${e[m+1]} ${e[m+2]} ${e[m+3]} ${e[m+4]} ${e[m+5]}`);p.push(`L${(r[0]-o)/a} ${(r[1]-s)/c} L${u} ${d} L${f} ${h} L${(i[0]-o)/a} ${(i[1]-s)/c}`);for(let m=t.length-6;m>=6;m-=6)isNaN(t[m])?p.push(`L${t[m+4]} ${t[m+5]}`):p.push(`C${t[m]} ${t[m+1]} ${t[m+2]} ${t[m+3]} ${t[m+4]} ${t[m+5]}`);return p.push(`L${t[4]} ${t[5]} Z`),p.join(" ")}getOutlines(){var w;const e=g(this,Ui),t=g(this,$o),r=g(this,Te),i=r.subarray(4,6),o=r.subarray(16,18),[s,a,c,u]=g(this,Hi),d=new Float64Array((((w=g(this,ma))==null?void 0:w.length)??0)+2);for(let v=0,k=d.length-2;v<k;v+=2)d[v]=(g(this,ma)[v]-s)/c,d[v+1]=(g(this,ma)[v+1]-a)/u;d[d.length-2]=(g(this,h0)-s)/c,d[d.length-1]=(g(this,p0)-a)/u;const[f,h,p,m]=x(this,d1,$v).call(this);if(isNaN(r[6])&&!this.isEmpty()){const v=new Float64Array(36);return v.set([NaN,NaN,NaN,NaN,(r[2]-s)/c,(r[3]-a)/u,NaN,NaN,NaN,NaN,(r[4]-s)/c,(r[5]-a)/u,NaN,NaN,NaN,NaN,f,h,NaN,NaN,NaN,NaN,p,m,NaN,NaN,NaN,NaN,(r[16]-s)/c,(r[17]-a)/u,NaN,NaN,NaN,NaN,(r[14]-s)/c,(r[15]-a)/u],0),new G4(v,d,g(this,Hi),g(this,Ru),g(this,Lu),g(this,Bu))}const y=new Float64Array(g(this,Ui).length+24+g(this,$o).length);let b=e.length;for(let v=0;v<b;v+=2)isNaN(e[v])?y[v]=y[v+1]=NaN:(y[v]=e[v],y[v+1]=e[v+1]);y.set([NaN,NaN,NaN,NaN,(i[0]-s)/c,(i[1]-a)/u,NaN,NaN,NaN,NaN,f,h,NaN,NaN,NaN,NaN,p,m,NaN,NaN,NaN,NaN,(o[0]-s)/c,(o[1]-a)/u],b),b+=24;for(let v=t.length-6;v>=6;v-=6)for(let k=0;k<6;k+=2)isNaN(t[v+k])?(y[b]=y[b+1]=NaN,b+=2):(y[b]=t[v+k],y[b+1]=t[v+k+1],b+=2);return y.set([NaN,NaN,NaN,NaN,t[4],t[5]],b),new G4(y,d,g(this,Hi),g(this,Ru),g(this,Lu),g(this,Bu))}};Hi=new WeakMap,$o=new WeakMap,Lu=new WeakMap,Bu=new WeakMap,Ui=new WeakMap,Te=new WeakMap,h0=new WeakMap,p0=new WeakMap,l1=new WeakMap,c1=new WeakMap,Ru=new WeakMap,$u=new WeakMap,ma=new WeakMap,u1=new WeakMap,wy=new WeakMap,vy=new WeakMap,d1=new WeakSet,$v=function(){const e=g(this,Te).subarray(4,6),t=g(this,Te).subarray(16,18),[r,i,o,s]=g(this,Hi);return[(g(this,h0)+(e[0]-t[0])/2-r)/o,(g(this,p0)+(e[1]-t[1])/2-i)/s,(g(this,h0)+(t[0]-e[0])/2-r)/o,(g(this,p0)+(t[1]-e[1])/2-i)/s]},M(Fo,u1,8),M(Fo,wy,2),M(Fo,vy,g(Fo,u1)+g(Fo,wy));let mm=Fo;class G4 extends iE{constructor(t,r,i,o,s,a){super();M(this,g0);M(this,y0);M(this,Cy);M(this,Fu,void 0);M(this,m0,null);M(this,Vo,void 0);M(this,f1,void 0);M(this,ur,void 0);M(this,h1,void 0);M(this,bt,void 0);A(this,bt,t),A(this,ur,r),A(this,Fu,i),A(this,h1,o),A(this,Vo,s),A(this,f1,a),x(this,Cy,ZN).call(this,a);const{x:c,y:u,width:d,height:f}=g(this,m0);for(let h=0,p=t.length;h<p;h+=2)t[h]=(t[h]-c)/d,t[h+1]=(t[h+1]-u)/f;for(let h=0,p=r.length;h<p;h+=2)r[h]=(r[h]-c)/d,r[h+1]=(r[h+1]-u)/f}toSVGPath(){const t=[`M${g(this,bt)[4]} ${g(this,bt)[5]}`];for(let r=6,i=g(this,bt).length;r<i;r+=6)isNaN(g(this,bt)[r])?t.push(`L${g(this,bt)[r+4]} ${g(this,bt)[r+5]}`):t.push(`C${g(this,bt)[r]} ${g(this,bt)[r+1]} ${g(this,bt)[r+2]} ${g(this,bt)[r+3]} ${g(this,bt)[r+4]} ${g(this,bt)[r+5]}`);return t.push("Z"),t.join(" ")}serialize([t,r,i,o],s){const a=i-t,c=o-r;let u,d;switch(s){case 0:u=x(this,g0,J1).call(this,g(this,bt),t,o,a,-c),d=x(this,g0,J1).call(this,g(this,ur),t,o,a,-c);break;case 90:u=x(this,y0,ep).call(this,g(this,bt),t,r,a,c),d=x(this,y0,ep).call(this,g(this,ur),t,r,a,c);break;case 180:u=x(this,g0,J1).call(this,g(this,bt),i,r,-a,c),d=x(this,g0,J1).call(this,g(this,ur),i,r,-a,c);break;case 270:u=x(this,y0,ep).call(this,g(this,bt),i,o,-a,-c),d=x(this,y0,ep).call(this,g(this,ur),i,o,-a,-c)}return{outline:Array.from(u),points:[Array.from(d)]}}get box(){return g(this,m0)}getNewOutline(t,r){const{x:i,y:o,width:s,height:a}=g(this,m0),[c,u,d,f]=g(this,Fu),h=s*d,p=a*f,m=i*d+c,y=o*f+u,b=new mm({x:g(this,ur)[0]*h+m,y:g(this,ur)[1]*p+y},g(this,Fu),g(this,h1),t,g(this,f1),r??g(this,Vo));for(let w=2;w<g(this,ur).length;w+=2)b.add({x:g(this,ur)[w]*h+m,y:g(this,ur)[w+1]*p+y});return b.getOutlines()}}Fu=new WeakMap,m0=new WeakMap,Vo=new WeakMap,f1=new WeakMap,ur=new WeakMap,h1=new WeakMap,bt=new WeakMap,g0=new WeakSet,J1=function(t,r,i,o,s){const a=new Float64Array(t.length);for(let c=0,u=t.length;c<u;c+=2)a[c]=r+t[c]*o,a[c+1]=i+t[c+1]*s;return a},y0=new WeakSet,ep=function(t,r,i,o,s){const a=new Float64Array(t.length);for(let c=0,u=t.length;c<u;c+=2)a[c]=r+t[c+1]*o,a[c+1]=i+t[c]*s;return a},Cy=new WeakSet,ZN=function(t){const r=g(this,bt);let i=r[4],o=r[5],s=i,a=o,c=i,u=o,d=i,f=o;const h=t?Math.max:Math.min;for(let w=6,v=r.length;w<v;w+=6){if(isNaN(r[w]))s=Math.min(s,r[w+4]),a=Math.min(a,r[w+5]),c=Math.max(c,r[w+4]),u=Math.max(u,r[w+5]),f<r[w+5]?(d=r[w+4],f=r[w+5]):f===r[w+5]&&(d=h(d,r[w+4]));else{const k=se.bezierBoundingBox(i,o,...r.slice(w,w+6));s=Math.min(s,k[0]),a=Math.min(a,k[1]),c=Math.max(c,k[2]),u=Math.max(u,k[3]),f<k[3]?(d=k[2],f=k[3]):f===k[3]&&(d=h(d,k[2]))}i=r[w+4],o=r[w+5]}const p=s-g(this,Vo),m=a-g(this,Vo),y=c-s+2*g(this,Vo),b=u-a+2*g(this,Vo);A(this,m0,{x:p,y:m,width:y,height:b,lastPoint:[d,f]})};const zo=class zo{constructor({editor:e=null,uiManager:t=null}){M(this,w1);M(this,v1);M(this,ky);M(this,jo);M(this,Sy);M(this,Zi);M(this,p1,x(this,ky,WN).bind(this));M(this,m1,x(this,Sy,KN).bind(this));M(this,si,null);M(this,b0,null);M(this,Vu,void 0);M(this,Dt,null);M(this,g1,!1);M(this,ju,!1);M(this,y1,null);M(this,b1,void 0);M(this,ai,null);M(this,zu,void 0);var r;e?(A(this,ju,!1),A(this,zu,de.HIGHLIGHT_COLOR),A(this,y1,e)):(A(this,ju,!0),A(this,zu,de.HIGHLIGHT_DEFAULT_COLOR)),A(this,ai,(e==null?void 0:e._uiManager)||t),A(this,b1,g(this,ai)._eventBus),A(this,Vu,(e==null?void 0:e.color)||((r=g(this,ai))==null?void 0:r.highlightColors.values().next().value)||"#FFFF98")}static get _keyboardManager(){return Ie(this,"_keyboardManager",new c2([[["Escape","mac+Escape"],zo.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],zo.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],zo.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],zo.prototype._moveToPrevious],[["Home","mac+Home"],zo.prototype._moveToBeginning],[["End","mac+End"],zo.prototype._moveToEnd]]))}renderButton(){const e=A(this,si,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.setAttribute("aria-haspopup",!0);const t=g(this,ai)._signal;e.addEventListener("click",x(this,jo,R0).bind(this),{signal:t}),e.addEventListener("keydown",g(this,p1),{signal:t});const r=A(this,b0,document.createElement("span"));return r.className="swatch",r.setAttribute("aria-hidden",!0),r.style.backgroundColor=g(this,Vu),e.append(r),e}renderMainDropdown(){const e=A(this,Dt,x(this,w1,Fv).call(this));return e.setAttribute("aria-orientation","horizontal"),e.setAttribute("aria-labelledby","highlightColorPickerLabel"),e}_colorSelectFromKeyboard(e){if(e.target===g(this,si)){x(this,jo,R0).call(this,e);return}const t=e.target.getAttribute("data-color");t&&x(this,v1,Vv).call(this,t,e)}_moveToNext(e){var t,r;g(this,Zi,Oa)?e.target!==g(this,si)?(t=e.target.nextSibling)==null||t.focus():(r=g(this,Dt).firstChild)==null||r.focus():x(this,jo,R0).call(this,e)}_moveToPrevious(e){var t,r;e.target!==((t=g(this,Dt))==null?void 0:t.firstChild)&&e.target!==g(this,si)?(g(this,Zi,Oa)||x(this,jo,R0).call(this,e),(r=e.target.previousSibling)==null||r.focus()):g(this,Zi,Oa)&&this._hideDropdownFromKeyboard()}_moveToBeginning(e){var t;g(this,Zi,Oa)?(t=g(this,Dt).firstChild)==null||t.focus():x(this,jo,R0).call(this,e)}_moveToEnd(e){var t;g(this,Zi,Oa)?(t=g(this,Dt).lastChild)==null||t.focus():x(this,jo,R0).call(this,e)}hideDropdown(){var e;(e=g(this,Dt))==null||e.classList.add("hidden"),window.removeEventListener("pointerdown",g(this,m1))}_hideDropdownFromKeyboard(){var e;g(this,ju)||(g(this,Zi,Oa)?(this.hideDropdown(),g(this,si).focus({preventScroll:!0,focusVisible:g(this,g1)})):(e=g(this,y1))==null||e.unselect())}updateColor(e){if(g(this,b0)&&(g(this,b0).style.backgroundColor=e),!g(this,Dt))return;const t=g(this,ai).highlightColors.values();for(const r of g(this,Dt).children)r.setAttribute("aria-selected",t.next().value===e)}destroy(){var e,t;(e=g(this,si))==null||e.remove(),A(this,si,null),A(this,b0,null),(t=g(this,Dt))==null||t.remove(),A(this,Dt,null)}};p1=new WeakMap,m1=new WeakMap,si=new WeakMap,b0=new WeakMap,Vu=new WeakMap,Dt=new WeakMap,g1=new WeakMap,ju=new WeakMap,y1=new WeakMap,b1=new WeakMap,ai=new WeakMap,zu=new WeakMap,w1=new WeakSet,Fv=function(){const e=document.createElement("div"),t=g(this,ai)._signal;e.addEventListener("contextmenu",br,{signal:t}),e.className="dropdown",e.role="listbox",e.setAttribute("aria-multiselectable",!1),e.setAttribute("aria-orientation","vertical"),e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[r,i]of g(this,ai).highlightColors){const o=document.createElement("button");o.tabIndex="0",o.role="option",o.setAttribute("data-color",i),o.title=r,o.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${r}`);const s=document.createElement("span");o.append(s),s.className="swatch",s.style.backgroundColor=i,o.setAttribute("aria-selected",i===g(this,Vu)),o.addEventListener("click",x(this,v1,Vv).bind(this,i),{signal:t}),e.append(o)}return e.addEventListener("keydown",g(this,p1),{signal:t}),e},v1=new WeakSet,Vv=function(e,t){t.stopPropagation(),g(this,b1).dispatch("switchannotationeditorparams",{source:this,type:g(this,zu),value:e})},ky=new WeakSet,WN=function(e){zo._keyboardManager.exec(this,e)},jo=new WeakSet,R0=function(e){if(g(this,Zi,Oa)){this.hideDropdown();return}if(A(this,g1,e.detail===0),window.addEventListener("pointerdown",g(this,m1),{signal:g(this,ai)._signal}),g(this,Dt)){g(this,Dt).classList.remove("hidden");return}const t=A(this,Dt,x(this,w1,Fv).call(this));g(this,si).append(t)},Sy=new WeakSet,KN=function(e){var t;(t=g(this,Dt))!=null&&t.contains(e.target)||this.hideDropdown()},Zi=new WeakSet,Oa=function(){return g(this,Dt)&&!g(this,Dt).classList.contains("hidden")};let gm=zo;const Pe=class Pe extends je{constructor(t){super({...t,name:"highlightEditor"});M(this,E1);M(this,A1);M(this,My);M(this,Ey);M(this,Ay);M(this,T1);M(this,k0);M(this,Ty);M(this,Ku);M(this,S0);M(this,xy);M(this,Iy);M(this,Hu,null);M(this,C1,0);M(this,ga,void 0);M(this,w0,null);M(this,Uu,null);M(this,_r,null);M(this,k1,null);M(this,S1,0);M(this,v0,null);M(this,li,null);M(this,En,null);M(this,dr,!1);M(this,Zu,null);M(this,C0,void 0);M(this,Nt,null);M(this,Wu,"");M(this,Wi,void 0);M(this,M1,"");this.color=t.color||Pe._defaultColor,A(this,Wi,t.thickness||Pe._defaultThickness),A(this,C0,t.opacity||Pe._defaultOpacity),A(this,ga,t.boxes||null),A(this,M1,t.methodOfCreation||""),A(this,Wu,t.text||""),this._isDraggable=!1,t.highlightId>-1?(A(this,dr,!0),x(this,A1,zv).call(this,t),x(this,k0,tp).call(this)):(A(this,Hu,t.anchorNode),A(this,C1,t.anchorOffset),A(this,k1,t.focusNode),A(this,S1,t.focusOffset),x(this,E1,jv).call(this),x(this,k0,tp).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const t=Pe.prototype;return Ie(this,"_keyboardManager",new c2([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:g(this,dr)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:g(this,Wi),methodOfCreation:g(this,M1)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,r){var i;je.initialize(t,r),Pe._defaultColor||(Pe._defaultColor=((i=r.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,r){switch(t){case de.HIGHLIGHT_DEFAULT_COLOR:Pe._defaultColor=r;break;case de.HIGHLIGHT_THICKNESS:Pe._defaultThickness=r}}translateInPage(t,r){}get toolbarPosition(){return g(this,Zu)}updateParams(t,r){switch(t){case de.HIGHLIGHT_COLOR:x(this,My,qN).call(this,r);break;case de.HIGHLIGHT_THICKNESS:x(this,Ey,GN).call(this,r)}}static get defaultPropertiesToUpdate(){return[[de.HIGHLIGHT_DEFAULT_COLOR,Pe._defaultColor],[de.HIGHLIGHT_THICKNESS,Pe._defaultThickness]]}get propertiesToUpdate(){return[[de.HIGHLIGHT_COLOR,this.color||Pe._defaultColor],[de.HIGHLIGHT_THICKNESS,g(this,Wi)||Pe._defaultThickness],[de.HIGHLIGHT_FREE,g(this,dr)]]}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(A(this,Uu,new gm({editor:this})),t.addColorPicker(g(this,Uu))),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(x(this,S0,np).call(this))}getBaseTranslation(){return[0,0]}getRect(t,r){return super.getRect(t,r,x(this,S0,np).call(this))}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){x(this,T1,Hv).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(x(this,k0,tp).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var i;let r=!1;this.parent&&!t?x(this,T1,Hv).call(this):t&&(x(this,k0,tp).call(this,t),r=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),r&&this.select()}rotate(t){var o,s,a;const{drawLayer:r}=this.parent;let i;g(this,dr)?(t=(t-this.rotation+360)%360,i=x(o=Pe,ya,pd).call(o,g(this,li).box,t)):i=x(s=Pe,ya,pd).call(s,this,t),r.rotate(g(this,En),t),r.rotate(g(this,Nt),t),r.updateBox(g(this,En),i),r.updateBox(g(this,Nt),x(a=Pe,ya,pd).call(a,g(this,_r).box,t))}render(){if(this.div)return this.div;const t=super.render();g(this,Wu)&&(t.setAttribute("aria-label",g(this,Wu)),t.setAttribute("role","mark")),g(this,dr)?t.classList.add("free"):this.div.addEventListener("keydown",x(this,Ty,QN).bind(this),{signal:this._uiManager._signal});const r=A(this,v0,document.createElement("div"));t.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",r.style.clipPath=g(this,w0);const[i,o]=this.parentDimensions;return this.setDims(this.width*i,this.height*o),am(this,g(this,v0),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(g(this,Nt),"hovered")}pointerleave(){this.parent.drawLayer.removeClass(g(this,Nt),"hovered")}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:x(this,Ku,g5).call(this,!0);break;case 1:case 3:x(this,Ku,g5).call(this,!1)}}select(){var t,r;super.select(),g(this,Nt)&&((t=this.parent)==null||t.drawLayer.removeClass(g(this,Nt),"hovered"),(r=this.parent)==null||r.drawLayer.addClass(g(this,Nt),"selected"))}unselect(){var t;super.unselect(),g(this,Nt)&&((t=this.parent)==null||t.drawLayer.removeClass(g(this,Nt),"selected"),g(this,dr)||x(this,Ku,g5).call(this,!1))}get _mustFixPosition(){return!g(this,dr)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(g(this,En),t),this.parent.drawLayer.show(g(this,Nt),t))}static startHighlighting(t,r,{target:i,x:o,y:s}){const{x:a,y:c,width:u,height:d}=i.getBoundingClientRect(),f=new AbortController,h=t.combinedSignal(f),p=m=>{f.abort(),x(this,Dy,tP).call(this,t,m)};window.addEventListener("blur",p,{signal:h}),window.addEventListener("pointerup",p,{signal:h}),window.addEventListener("pointerdown",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,passive:!1,signal:h}),window.addEventListener("contextmenu",br,{signal:h}),i.addEventListener("pointermove",x(this,Oy,eP).bind(this,t),{signal:h}),this._freeHighlight=new mm({x:o,y:s},[a,c,u,d],t.scale,this._defaultThickness/2,r,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static deserialize(t,r,i){var y;const o=super.deserialize(t,r,i),{rect:[s,a,c,u],color:d,quadPoints:f}=t;o.color=se.makeHexColor(...d),A(o,C0,t.opacity);const[h,p]=o.pageDimensions;o.width=(c-s)/h,o.height=(u-a)/p;const m=A(o,ga,[]);for(let b=0;b<f.length;b+=8)m.push({x:(f[4]-c)/h,y:(u-(1-f[b+5]))/p,width:(f[b+2]-f[b])/h,height:(f[b+5]-f[b+1])/p});return x(y=o,E1,jv).call(y),o}serialize(t=!1){if(this.isEmpty()||t)return null;const r=this.getRect(0,0),i=je._colorManager.convert(this.color);return{annotationType:Ae.HIGHLIGHT,color:i,opacity:g(this,C0),thickness:g(this,Wi),quadPoints:x(this,xy,XN).call(this),outlines:x(this,Iy,JN).call(this,r),pageIndex:this.pageIndex,rect:r,rotation:x(this,S0,np).call(this),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}};Hu=new WeakMap,C1=new WeakMap,ga=new WeakMap,w0=new WeakMap,Uu=new WeakMap,_r=new WeakMap,k1=new WeakMap,S1=new WeakMap,v0=new WeakMap,li=new WeakMap,En=new WeakMap,dr=new WeakMap,Zu=new WeakMap,C0=new WeakMap,Nt=new WeakMap,Wu=new WeakMap,Wi=new WeakMap,M1=new WeakMap,E1=new WeakSet,jv=function(){const t=new rE(g(this,ga),.001);A(this,li,t.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=g(this,li).box;const r=new rE(g(this,ga),.0025,.001,this._uiManager.direction==="ltr");A(this,_r,r.getOutlines());const{lastPoint:i}=g(this,_r).box;A(this,Zu,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},A1=new WeakSet,zv=function({highlightOutlines:t,highlightId:r,clipPathId:i}){var d,f;if(A(this,li,t),A(this,_r,t.getNewOutline(g(this,Wi)/2+1.5,.0025)),r>=0)A(this,En,r),A(this,w0,i),this.parent.drawLayer.finalizeLine(r,t),A(this,Nt,this.parent.drawLayer.highlightOutline(g(this,_r)));else if(this.parent){const h=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(g(this,En),t),this.parent.drawLayer.updateBox(g(this,En),x(d=Pe,ya,pd).call(d,g(this,li).box,(h-this.rotation+360)%360)),this.parent.drawLayer.updateLine(g(this,Nt),g(this,_r)),this.parent.drawLayer.updateBox(g(this,Nt),x(f=Pe,ya,pd).call(f,g(this,_r).box,h))}const{x:o,y:s,width:a,height:c}=t.box;switch(this.rotation){case 0:this.x=o,this.y=s,this.width=a,this.height=c;break;case 90:{const[h,p]=this.parentDimensions;this.x=s,this.y=1-o,this.width=a*p/h,this.height=c*h/p;break}case 180:this.x=1-o,this.y=1-s,this.width=a,this.height=c;break;case 270:{const[h,p]=this.parentDimensions;this.x=1-s,this.y=o,this.width=a*p/h,this.height=c*h/p;break}}const{lastPoint:u}=g(this,_r).box;A(this,Zu,[(u[0]-o)/a,(u[1]-s)/c])},My=new WeakSet,qN=function(t){const r=o=>{var s,a;this.color=o,(s=this.parent)==null||s.drawLayer.changeColor(g(this,En),o),(a=g(this,Uu))==null||a.updateColor(o)},i=this.color;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)},Ey=new WeakSet,GN=function(t){const r=g(this,Wi),i=o=>{A(this,Wi,o),x(this,Ay,YN).call(this,o)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)},Ay=new WeakSet,YN=function(t){if(!g(this,dr))return;x(this,A1,zv).call(this,{highlightOutlines:g(this,li).getNewOutline(t/2)}),this.fixAndSetPosition();const[r,i]=this.parentDimensions;this.setDims(this.width*r,this.height*i)},T1=new WeakSet,Hv=function(){g(this,En)!==null&&this.parent&&(this.parent.drawLayer.remove(g(this,En)),A(this,En,null),this.parent.drawLayer.remove(g(this,Nt)),A(this,Nt,null))},k0=new WeakSet,tp=function(t=this.parent){g(this,En)===null&&({id:qn(this,En)._,clipPathId:qn(this,w0)._}=t.drawLayer.highlight(g(this,li),this.color,g(this,C0)),A(this,Nt,t.drawLayer.highlightOutline(g(this,_r))),g(this,v0)&&(g(this,v0).style.clipPath=g(this,w0)))},ya=new WeakSet,pd=function({x:t,y:r,width:i,height:o},s){switch(s){case 90:return{x:1-r-o,y:t,width:o,height:i};case 180:return{x:1-t-i,y:1-r-o,width:i,height:o};case 270:return{x:r,y:1-t-i,width:o,height:i}}return{x:t,y:r,width:i,height:o}},Ty=new WeakSet,QN=function(t){Pe._keyboardManager.exec(this,t)},Ku=new WeakSet,g5=function(t){if(!g(this,Hu))return;const r=window.getSelection();t?r.setPosition(g(this,Hu),g(this,C1)):r.setPosition(g(this,k1),g(this,S1))},S0=new WeakSet,np=function(){return g(this,dr)?this.rotation:0},xy=new WeakSet,XN=function(){if(g(this,dr))return null;const[t,r]=this.pageDimensions,[i,o]=this.pageTranslation,s=g(this,ga),a=new Float32Array(8*s.length);let c=0;for(const{x:u,y:d,width:f,height:h}of s){const p=u*t+i,m=(1-d-h)*r+o;a[c]=a[c+4]=p,a[c+1]=a[c+3]=m,a[c+2]=a[c+6]=p+f*t,a[c+5]=a[c+7]=m+h*r,c+=8}return a},Iy=new WeakSet,JN=function(t){return g(this,li).serialize(t,x(this,S0,np).call(this))},Oy=new WeakSet,eP=function(t,r){this._freeHighlight.add(r)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},Dy=new WeakSet,tP=function(t,r){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(this._freeHighlightId):t.createAndAddNewEditor(r,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},M(Pe,ya),M(Pe,Oy),M(Pe,Dy),fe(Pe,"_defaultColor",null),fe(Pe,"_defaultOpacity",1),fe(Pe,"_defaultThickness",12),fe(Pe,"_l10nPromise"),fe(Pe,"_type","highlight"),fe(Pe,"_editorType",Ae.HIGHLIGHT),fe(Pe,"_freeHighlightId",-1),fe(Pe,"_freeHighlight",null),fe(Pe,"_freeHighlightClipId","");let ym=Pe;const Je=class Je extends je{constructor(t){super({...t,name:"inkEditor"});M(this,Ny);M(this,Py);M(this,_y);M(this,Ly);M(this,x1);M(this,By);M(this,I1);M(this,Ry);M(this,$y);M(this,Fy);M(this,Vy);M(this,jy);M(this,Zo);M(this,O1);M(this,D1);M(this,N1);M(this,Gu);M(this,Yu);M(this,wa);M(this,P1);M(this,Qu);M(this,Uy);M(this,L1);M(this,Xu);M(this,D0);M(this,M0,0);M(this,E0,0);M(this,Ki,null);M(this,Ho,new Path2D);M(this,Lr,!1);M(this,A0,null);M(this,T0,!1);M(this,x0,!1);M(this,Uo,null);M(this,qu,null);M(this,I0,0);M(this,O0,0);M(this,ba,null);this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(t,r){je.initialize(t,r)}static updateDefaultParams(t,r){switch(t){case de.INK_THICKNESS:Je._defaultThickness=r;break;case de.INK_COLOR:Je._defaultColor=r;break;case de.INK_OPACITY:Je._defaultOpacity=r/100}}updateParams(t,r){switch(t){case de.INK_THICKNESS:x(this,Ny,nP).call(this,r);break;case de.INK_COLOR:x(this,Py,rP).call(this,r);break;case de.INK_OPACITY:x(this,_y,iP).call(this,r)}}static get defaultPropertiesToUpdate(){return[[de.INK_THICKNESS,Je._defaultThickness],[de.INK_COLOR,Je._defaultColor||je._defaultLineColor],[de.INK_OPACITY,Math.round(100*Je._defaultOpacity)]]}get propertiesToUpdate(){return[[de.INK_THICKNESS,this.thickness||Je._defaultThickness],[de.INK_COLOR,this.color||Je._defaultColor||je._defaultLineColor],[de.INK_OPACITY,Math.round(100*(this.opacity??Je._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(x(this,Gu,y5).call(this),x(this,Yu,b5).call(this)),this.isAttachedToDOM||(this.parent.add(this),x(this,wa,md).call(this)),x(this,D0,rp).call(this)))}remove(){var t;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,g(this,Ki)&&(clearTimeout(g(this,Ki)),A(this,Ki,null)),(t=g(this,Uo))==null||t.disconnect(),A(this,Uo,null),super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&t===null&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,r]=this.parentDimensions,i=this.width*t,o=this.height*r;this.setDimensions(i,o)}enableEditMode(){!g(this,Lr)&&this.canvas!==null&&(super.enableEditMode(),this._isDraggable=!1,x(this,O1,Wv).call(this))}disableEditMode(){this.isInEditMode()&&this.canvas!==null&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),x(this,D1,Kv).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){g(this,Lr)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),A(this,Lr,!0),this.div.classList.add("disabled"),x(this,D0,rp).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){t.button===0&&this.isInEditMode()&&!g(this,Lr)&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),x(this,By,sP).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),x(this,I1,Zv).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),x(this,N1,qv).call(this,t)}canvasPointerleave(t){x(this,N1,qv).call(this,t)}get isResizable(){return!this.isEmpty()&&g(this,Lr)}render(){if(this.div)return this.div;let t,r;this.width&&(t=this.x,r=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,o,s,a]=x(this,Ly,oP).call(this);if(this.setAt(i,o,0,0),this.setDims(s,a),x(this,Gu,y5).call(this),this.width){const[c,u]=this.parentDimensions;this.setAspectRatio(this.width*c,this.height*u),this.setAt(t*c,r*u,this.width*c,this.height*u),A(this,x0,!0),x(this,wa,md).call(this),this.setDims(this.width*c,this.height*u),x(this,Zo,$0).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return x(this,Yu,b5).call(this),this.div}setDimensions(t,r){const i=Math.round(t),o=Math.round(r);if(g(this,I0)===i&&g(this,O0)===o)return;A(this,I0,i),A(this,O0,o),this.canvas.style.visibility="hidden";const[s,a]=this.parentDimensions;this.width=t/s,this.height=r/a,this.fixAndSetPosition(),g(this,Lr)&&x(this,P1,Gv).call(this,t,r),x(this,wa,md).call(this),x(this,Zo,$0).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(t,r,i){var b,w,v;if(t instanceof tE)return null;const o=super.deserialize(t,r,i);o.thickness=t.thickness,o.color=se.makeHexColor(...t.color),o.opacity=t.opacity;const[s,a]=o.pageDimensions,c=o.width*s,u=o.height*a,d=o.parentScale,f=t.thickness/2;A(o,Lr,!0),A(o,I0,Math.round(c)),A(o,O0,Math.round(u));const{paths:h,rect:p,rotation:m}=t;for(let{bezier:k}of h){k=x(b=Je,Hy,hP).call(b,k,p,m);const C=[];o.paths.push(C);let T=d*(k[0]-f),S=d*(k[1]-f);for(let O=2,I=k.length;O<I;O+=6){const P=d*(k[O]-f),D=d*(k[O+1]-f),L=d*(k[O+2]-f),B=d*(k[O+3]-f),F=d*(k[O+4]-f),R=d*(k[O+5]-f);C.push([[T,S],[P,D],[L,B],[F,R]]),T=F,S=R}const E=x(this,zy,fP).call(this,C);o.bezierPath2D.push(E)}const y=x(w=o,L1,Qv).call(w);return A(o,E0,Math.max(je.MIN_SIZE,y[2]-y[0])),A(o,M0,Math.max(je.MIN_SIZE,y[3]-y[1])),x(v=o,P1,Gv).call(v,c,u),o}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),r=je._colorManager.convert(this.ctx.strokeStyle);return{annotationType:Ae.INK,color:r,thickness:this.thickness,opacity:this.opacity,paths:x(this,Uy,pP).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};M0=new WeakMap,E0=new WeakMap,Ki=new WeakMap,Ho=new WeakMap,Lr=new WeakMap,A0=new WeakMap,T0=new WeakMap,x0=new WeakMap,Uo=new WeakMap,qu=new WeakMap,I0=new WeakMap,O0=new WeakMap,ba=new WeakMap,Ny=new WeakSet,nP=function(t){const r=o=>{this.thickness=o,x(this,D0,rp).call(this)},i=this.thickness;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},Py=new WeakSet,rP=function(t){const r=o=>{this.color=o,x(this,Zo,$0).call(this)},i=this.color;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},_y=new WeakSet,iP=function(t){const r=o=>{this.opacity=o,x(this,Zo,$0).call(this)};t/=100;const i=this.opacity;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Ly=new WeakSet,oP=function(){const{parentRotation:t,parentDimensions:[r,i]}=this;switch(t){case 90:return[0,i,i,r];case 180:return[r,i,r,i];case 270:return[r,0,i,r];default:return[0,0,r,i]}},x1=new WeakSet,Uv=function(){const{ctx:t,color:r,opacity:i,thickness:o,parentScale:s,scaleFactor:a}=this;t.lineWidth=o*s/a,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${r}${function(u){return Math.round(Math.min(255,Math.max(1,255*u))).toString(16).padStart(2,"0")}(i)}`},By=new WeakSet,sP=function(t,r){this.canvas.addEventListener("contextmenu",br,{signal:this._uiManager._signal}),x(this,D1,Kv).call(this),A(this,A0,new AbortController);const i=this._uiManager.combinedSignal(g(this,A0));this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:i}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:i}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:i}),this.isEditing=!0,g(this,x0)||(A(this,x0,!0),x(this,wa,md).call(this),this.thickness||(this.thickness=Je._defaultThickness),this.color||(this.color=Je._defaultColor||je._defaultLineColor),this.opacity??(this.opacity=Je._defaultOpacity)),this.currentPath.push([t,r]),A(this,T0,!1),x(this,x1,Uv).call(this),A(this,ba,()=>{x(this,Fy,cP).call(this),g(this,ba)&&window.requestAnimationFrame(g(this,ba))}),window.requestAnimationFrame(g(this,ba))},I1=new WeakSet,Zv=function(t,r){const[i,o]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&r===o)return;const s=this.currentPath;let a=g(this,Ho);s.push([t,r]),A(this,T0,!0),s.length<=2?(a.moveTo(...s[0]),a.lineTo(t,r)):(s.length===3&&(A(this,Ho,a=new Path2D),a.moveTo(...s[0])),x(this,Vy,uP).call(this,a,...s.at(-3),...s.at(-2),t,r))},Ry=new WeakSet,aP=function(){if(this.currentPath.length===0)return;const t=this.currentPath.at(-1);g(this,Ho).lineTo(...t)},$y=new WeakSet,lP=function(t,r){A(this,ba,null),t=Math.min(Math.max(t,0),this.canvas.width),r=Math.min(Math.max(r,0),this.canvas.height),x(this,I1,Zv).call(this,t,r),x(this,Ry,aP).call(this);let i;if(this.currentPath.length!==1)i=x(this,jy,dP).call(this);else{const a=[t,r];i=[[a,a.slice(),a.slice(),a]]}const o=g(this,Ho),s=this.currentPath;this.currentPath=[],A(this,Ho,new Path2D),this.addCommands({cmd:()=>{this.allRawPaths.push(s),this.paths.push(i),this.bezierPath2D.push(o),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(x(this,Gu,y5).call(this),x(this,Yu,b5).call(this)),x(this,D0,rp).call(this))},mustExec:!0})},Fy=new WeakSet,cP=function(){if(!g(this,T0))return;A(this,T0,!1),Math.ceil(this.thickness*this.parentScale);const t=this.currentPath.slice(-3),r=t.map(s=>s[0]),i=t.map(s=>s[1]),{ctx:o}=(Math.min(...r),Math.max(...r),Math.min(...i),Math.max(...i),this);o.save(),o.clearRect(0,0,this.canvas.width,this.canvas.height);for(const s of this.bezierPath2D)o.stroke(s);o.stroke(g(this,Ho)),o.restore()},Vy=new WeakSet,uP=function(t,r,i,o,s,a,c){const u=(r+o)/2,d=(i+s)/2,f=(o+a)/2,h=(s+c)/2;t.bezierCurveTo(u+2*(o-u)/3,d+2*(s-d)/3,f+2*(o-f)/3,h+2*(s-h)/3,f,h)},jy=new WeakSet,dP=function(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const r=[];let i,[o,s]=t[0];for(i=1;i<t.length-2;i++){const[p,m]=t[i],[y,b]=t[i+1],w=(p+y)/2,v=(m+b)/2,k=[o+2*(p-o)/3,s+2*(m-s)/3],C=[w+2*(p-w)/3,v+2*(m-v)/3];r.push([[o,s],k,C,[w,v]]),[o,s]=[w,v]}const[a,c]=t[i],[u,d]=t[i+1],f=[o+2*(a-o)/3,s+2*(c-s)/3],h=[u+2*(a-u)/3,d+2*(c-d)/3];return r.push([[o,s],f,h,[u,d]]),r},Zo=new WeakSet,$0=function(){if(this.isEmpty()){x(this,Qu,w5).call(this);return}x(this,x1,Uv).call(this);const{canvas:t,ctx:r}=this;r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,t.width,t.height),x(this,Qu,w5).call(this);for(const i of this.bezierPath2D)r.stroke(i)},O1=new WeakSet,Wv=function(){if(g(this,qu))return;A(this,qu,new AbortController);const t=this._uiManager.combinedSignal(g(this,qu));this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:t})},D1=new WeakSet,Kv=function(){var t;(t=this.pointerdownAC)==null||t.abort(),this.pointerdownAC=null},N1=new WeakSet,qv=function(t){var r;(r=g(this,A0))==null||r.abort(),A(this,A0,null),x(this,O1,Wv).call(this),g(this,Ki)&&clearTimeout(g(this,Ki)),A(this,Ki,setTimeout(()=>{A(this,Ki,null),this.canvas.removeEventListener("contextmenu",br)},10)),x(this,$y,lP).call(this,t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()},Gu=new WeakSet,y5=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},Yu=new WeakSet,b5=function(){A(this,Uo,new ResizeObserver(t=>{const r=t[0].contentRect;r.width&&r.height&&this.setDimensions(r.width,r.height)})),g(this,Uo).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;(t=g(this,Uo))==null||t.disconnect(),A(this,Uo,null)},{once:!0})},wa=new WeakSet,md=function(){if(!g(this,x0))return;const[t,r]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*r),x(this,Qu,w5).call(this)},P1=new WeakSet,Gv=function(t,r){const i=x(this,Xu,v5).call(this),o=(t-i)/g(this,E0),s=(r-i)/g(this,M0);this.scaleFactor=Math.min(o,s)},Qu=new WeakSet,w5=function(){const t=x(this,Xu,v5).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)},zy=new WeakSet,fP=function(t){const r=new Path2D;for(let i=0,o=t.length;i<o;i++){const[s,a,c,u]=t[i];i===0&&r.moveTo(...s),r.bezierCurveTo(a[0],a[1],c[0],c[1],u[0],u[1])}return r},_1=new WeakSet,Yv=function(t,r,i){const[o,s,a,c]=r;switch(i){case 0:for(let u=0,d=t.length;u<d;u+=2)t[u]+=o,t[u+1]=c-t[u+1];break;case 90:for(let u=0,d=t.length;u<d;u+=2){const f=t[u];t[u]=t[u+1]+o,t[u+1]=f+s}break;case 180:for(let u=0,d=t.length;u<d;u+=2)t[u]=a-t[u],t[u+1]+=s;break;case 270:for(let u=0,d=t.length;u<d;u+=2){const f=t[u];t[u]=a-t[u+1],t[u+1]=c-f}break;default:throw new Error("Invalid rotation")}return t},Hy=new WeakSet,hP=function(t,r,i){const[o,s,a,c]=r;switch(i){case 0:for(let u=0,d=t.length;u<d;u+=2)t[u]-=o,t[u+1]=c-t[u+1];break;case 90:for(let u=0,d=t.length;u<d;u+=2){const f=t[u];t[u]=t[u+1]-s,t[u+1]=f-o}break;case 180:for(let u=0,d=t.length;u<d;u+=2)t[u]=a-t[u],t[u+1]-=s;break;case 270:for(let u=0,d=t.length;u<d;u+=2){const f=t[u];t[u]=c-t[u+1],t[u+1]=a-f}break;default:throw new Error("Invalid rotation")}return t},Uy=new WeakSet,pP=function(t,r,i,o){var d,f;const s=[],a=this.thickness/2,c=t*r+a,u=t*i+a;for(const h of this.paths){const p=[],m=[];for(let y=0,b=h.length;y<b;y++){const[w,v,k,C]=h[y];if(w[0]===C[0]&&w[1]===C[1]&&b===1){const B=t*w[0]+c,F=t*w[1]+u;p.push(B,F),m.push(B,F);break}const T=t*w[0]+c,S=t*w[1]+u,E=t*v[0]+c,O=t*v[1]+u,I=t*k[0]+c,P=t*k[1]+u,D=t*C[0]+c,L=t*C[1]+u;y===0&&(p.push(T,S),m.push(T,S)),p.push(E,O,I,P,D,L),m.push(E,O),y===b-1&&m.push(D,L)}s.push({bezier:x(d=Je,_1,Yv).call(d,p,o,this.rotation),points:x(f=Je,_1,Yv).call(f,m,o,this.rotation)})}return s},L1=new WeakSet,Qv=function(){let t=1/0,r=-1/0,i=1/0,o=-1/0;for(const s of this.paths)for(const[a,c,u,d]of s){const f=se.bezierBoundingBox(...a,...c,...u,...d);t=Math.min(t,f[0]),i=Math.min(i,f[1]),r=Math.max(r,f[2]),o=Math.max(o,f[3])}return[t,i,r,o]},Xu=new WeakSet,v5=function(){return g(this,Lr)?Math.ceil(this.thickness*this.parentScale):0},D0=new WeakSet,rp=function(t=!1){if(this.isEmpty())return;if(!g(this,Lr)){x(this,Zo,$0).call(this);return}const r=x(this,L1,Qv).call(this),i=x(this,Xu,v5).call(this);A(this,E0,Math.max(je.MIN_SIZE,r[2]-r[0])),A(this,M0,Math.max(je.MIN_SIZE,r[3]-r[1]));const o=Math.ceil(i+g(this,E0)*this.scaleFactor),s=Math.ceil(i+g(this,M0)*this.scaleFactor),[a,c]=this.parentDimensions;this.width=o/a,this.height=s/c,this.setAspectRatio(o,s);const u=this.translationX,d=this.translationY;this.translationX=-r[0],this.translationY=-r[1],x(this,wa,md).call(this),x(this,Zo,$0).call(this),A(this,I0,o),A(this,O0,s),this.setDims(o,s);const f=t?i/this.scaleFactor/2:0;this.translate(u-this.translationX-f,d-this.translationY-f)},M(Je,zy),M(Je,_1),M(Je,Hy),fe(Je,"_defaultColor",null),fe(Je,"_defaultOpacity",1),fe(Je,"_defaultThickness",1),fe(Je,"_type","ink"),fe(Je,"_editorType",Ae.INK);let Y4=Je;const V1=class V1 extends je{constructor(t){super({...t,name:"stampEditor"});M(this,N0);M(this,P0);M(this,ed);M(this,R1);M(this,Zy);M(this,$1);M(this,F1);M(this,td);M(this,Wy);M(this,wt,null);M(this,rn,null);M(this,va,null);M(this,Wo,null);M(this,Ca,null);M(this,Ju,"");M(this,qi,null);M(this,Ko,null);M(this,Gi,null);M(this,Br,!1);M(this,B1,!1);A(this,Wo,t.bitmapUrl),A(this,Ca,t.bitmapFile)}static initialize(t,r){je.initialize(t,r)}static get supportedTypes(){return Ie(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(t=>`image/${t}`))}static get supportedTypesStr(){return Ie(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,r){r.pasteEditor(Ae.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const r=t.get("hasAltText");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}async mlGuessAltText(t=null,r=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:o,width:s,height:a}=t||this.copyCanvas(null,!0).imageData,c=await i.guess({name:"altText",request:{data:o,width:s,height:a,channels:o.length/(s*a)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const u=c.output;return await this.setGuessedAltText(u),r&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}remove(){var t,r;g(this,rn)&&(A(this,wt,null),this._uiManager.imageManager.deleteId(g(this,rn)),(t=g(this,qi))==null||t.remove(),A(this,qi,null),(r=g(this,Ko))==null||r.disconnect(),A(this,Ko,null),g(this,Gi)&&(clearTimeout(g(this,Gi)),A(this,Gi,null))),super.remove()}rebuild(){this.parent?(super.rebuild(),this.div!==null&&(g(this,rn)&&g(this,qi)===null&&x(this,ed,C5).call(this),this.isAttachedToDOM||this.parent.add(this))):g(this,rn)&&x(this,ed,C5).call(this)}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(g(this,va)||g(this,wt)||g(this,Wo)||g(this,Ca)||g(this,rn))}get isResizable(){return!0}render(){if(this.div)return this.div;let t,r;if(this.width&&(t=this.x,r=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),g(this,wt)?x(this,R1,Xv).call(this):x(this,ed,C5).call(this),this.width){const[i,o]=this.parentDimensions;this.setAt(t*i,r*o,this.width*i,this.height*o)}return this.div}copyCanvas(t,r=!1){var b;t||(t=224);const{width:i,height:o}=g(this,wt),s=document.createElement("canvas");let a=g(this,wt),c=i,u=o;if(i>t||o>t){const w=Math.min(t/i,t/o);c=Math.floor(i*w),u=Math.floor(o*w),g(this,Br)||(a=x(this,$1,Jv).call(this,c,u))}s.width=c,s.height=u;const d=s.getContext("2d");d.filter=this._uiManager.hcmFilter;let f="white",h="#cfcfd8";this._uiManager.hcmFilter!=="none"?h="black":(b=window.matchMedia)!=null&&b.call(window,"(prefers-color-scheme: dark)").matches&&(f="#8f8f9d",h="#42414d");const p=15,m=new OffscreenCanvas(30,30),y=m.getContext("2d");if(y.fillStyle=f,y.fillRect(0,0,30,30),y.fillStyle=h,y.fillRect(0,0,p,p),y.fillRect(p,p,p,p),d.fillStyle=d.createPattern(m,"repeat"),d.fillRect(0,0,c,u),r){const w=new OffscreenCanvas(c,u),v=w.getContext("2d",{willReadFrequently:!0});v.drawImage(a,0,0,a.width,a.height,0,0,c,u);const k=v.getImageData(0,0,c,u).data;return d.drawImage(w,0,0),{canvas:s,imageData:{width:c,height:u,data:k}}}return d.drawImage(a,0,0,a.width,a.height,0,0,c,u),{canvas:s,imageData:null}}getImageForAltText(){return g(this,qi)}static deserialize(t,r,i){if(t instanceof nE)return null;const o=super.deserialize(t,r,i),{rect:s,bitmapUrl:a,bitmapId:c,isSvg:u,accessibilityData:d}=t;c&&i.imageManager.isValidId(c)?A(o,rn,c):A(o,Wo,a),A(o,Br,u);const[f,h]=o.pageDimensions;return o.width=(s[2]-s[0])/f,o.height=(s[3]-s[1])/h,d&&(o.altTextData=d),o}serialize(t=!1,r=null){if(this.isEmpty())return null;const i={annotationType:Ae.STAMP,bitmapId:g(this,rn),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:g(this,Br),structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=x(this,td,k5).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i;const{decorative:o,altText:s}=this.serializeAltText(!1);if(!o&&s&&(i.accessibilityData={type:"Figure",alt:s}),r===null)return i;r.stamps||(r.stamps=new Map);const a=g(this,Br)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(r.stamps.has(g(this,rn))){if(g(this,Br)){const c=r.stamps.get(g(this,rn));a>c.area&&(c.area=a,c.serialized.bitmap.close(),c.serialized.bitmap=x(this,td,k5).call(this,!1))}}else r.stamps.set(g(this,rn),{area:a,serialized:i}),i.bitmap=x(this,td,k5).call(this,!1);return i}};wt=new WeakMap,rn=new WeakMap,va=new WeakMap,Wo=new WeakMap,Ca=new WeakMap,Ju=new WeakMap,qi=new WeakMap,Ko=new WeakMap,Gi=new WeakMap,Br=new WeakMap,B1=new WeakMap,N0=new WeakSet,ip=function(t,r=!1){t?(A(this,wt,t.bitmap),r||(A(this,rn,t.id),A(this,Br,t.isSvg)),t.file&&A(this,Ju,t.file.name),x(this,R1,Xv).call(this)):this.remove()},P0=new WeakSet,op=function(){if(A(this,va,null),this._uiManager.enableWaiting(!1),g(this,qi))if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&g(this,wt))this._editToolbar.hide(),this._uiManager.editAltText(this,!0);else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&g(this,wt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},ed=new WeakSet,C5=function(){if(g(this,rn)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(g(this,rn)).then(i=>x(this,N0,ip).call(this,i,!0)).finally(()=>x(this,P0,op).call(this));return}if(g(this,Wo)){const i=g(this,Wo);A(this,Wo,null),this._uiManager.enableWaiting(!0),A(this,va,this._uiManager.imageManager.getFromUrl(i).then(o=>x(this,N0,ip).call(this,o)).finally(()=>x(this,P0,op).call(this)));return}if(g(this,Ca)){const i=g(this,Ca);A(this,Ca,null),this._uiManager.enableWaiting(!0),A(this,va,this._uiManager.imageManager.getFromFile(i).then(o=>x(this,N0,ip).call(this,o)).finally(()=>x(this,P0,op).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=V1.supportedTypesStr;const r=this._uiManager._signal;A(this,va,new Promise(i=>{t.addEventListener("change",async()=>{if(t.files&&t.files.length!==0){this._uiManager.enableWaiting(!0);const o=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),x(this,N0,ip).call(this,o)}else this.remove();i()},{signal:r}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:r})}).finally(()=>x(this,P0,op).call(this))),t.click()},R1=new WeakSet,Xv=function(){const{div:t}=this;let{width:r,height:i}=g(this,wt);const[o,s]=this.pageDimensions,a=.75;if(this.width)r=this.width*o,i=this.height*s;else if(r>a*o||i>a*s){const f=Math.min(a*o/r,a*s/i);r*=f,i*=f}const[c,u]=this.parentDimensions;this.setDims(r*c/o,i*u/s),this._uiManager.enableWaiting(!1);const d=A(this,qi,document.createElement("canvas"));t.append(d),this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow||(t.hidden=!1),x(this,F1,e8).call(this,r,i),x(this,Wy,gP).call(this),g(this,B1)||(this.parent.addUndoableEditor(this),A(this,B1,!0)),this._reportTelemetry({action:"inserted_image"}),g(this,Ju)&&d.setAttribute("aria-label",g(this,Ju))},Zy=new WeakSet,mP=function(t,r){var s;const[i,o]=this.parentDimensions;this.width=t/i,this.height=r/o,this.setDims(t,r),(s=this._initialOptions)!=null&&s.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,g(this,Gi)!==null&&clearTimeout(g(this,Gi)),A(this,Gi,setTimeout(()=>{A(this,Gi,null),x(this,F1,e8).call(this,t,r)},200))},$1=new WeakSet,Jv=function(t,r){const{width:i,height:o}=g(this,wt);let s=i,a=o,c=g(this,wt);for(;s>2*t||a>2*r;){const u=s,d=a;s>2*t&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),a>2*r&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));const f=new OffscreenCanvas(s,a);f.getContext("2d").drawImage(c,0,0,u,d,0,0,s,a),c=f.transferToImageBitmap()}return c},F1=new WeakSet,e8=function(t,r){t=Math.ceil(t),r=Math.ceil(r);const i=g(this,qi);if(!i||i.width===t&&i.height===r)return;i.width=t,i.height=r;const o=g(this,Br)?g(this,wt):x(this,$1,Jv).call(this,t,r),s=i.getContext("2d");s.filter=this._uiManager.hcmFilter,s.drawImage(o,0,0,o.width,o.height,0,0,t,r)},td=new WeakSet,k5=function(t){if(t){if(g(this,Br)){const i=this._uiManager.imageManager.getSvgUrl(g(this,rn));if(i)return i}const r=document.createElement("canvas");return{width:r.width,height:r.height}=g(this,wt),r.getContext("2d").drawImage(g(this,wt),0,0),r.toDataURL()}if(g(this,Br)){const[r,i]=this.pageDimensions,o=Math.round(this.width*r*hs.PDF_TO_CSS_UNITS),s=Math.round(this.height*i*hs.PDF_TO_CSS_UNITS),a=new OffscreenCanvas(o,s);return a.getContext("2d").drawImage(g(this,wt),0,0,g(this,wt).width,g(this,wt).height,0,0,o,s),a.transferToImageBitmap()}return structuredClone(g(this,wt))},Wy=new WeakSet,gP=function(){this._uiManager._signal&&(A(this,Ko,new ResizeObserver(t=>{const r=t[0].contentRect;r.width&&r.height&&x(this,Zy,mP).call(this,r.width,r.height)})),g(this,Ko).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;(t=g(this,Ko))==null||t.disconnect(),A(this,Ko,null)},{once:!0}))},fe(V1,"_type","stamp"),fe(V1,"_editorType",Ae.STAMP);let Q4=V1;const ci=class ci{constructor({uiManager:e,pageIndex:t,div:r,accessibilityManager:i,annotationLayer:o,drawLayer:s,textLayer:a,viewport:c,l10n:u}){M(this,Ky);M(this,j1);M(this,z1);M(this,H1);M(this,od);M(this,_0,void 0);M(this,nd,!1);M(this,Yi,null);M(this,ka,null);M(this,qo,null);M(this,fr,new Map);M(this,Sa,!1);M(this,rd,!1);M(this,id,!1);M(this,An,null);M(this,Go,null);M(this,le,void 0);const d=[...g(ci,Ma).values()];if(!ci._initialized){ci._initialized=!0;for(const f of d)f.initialize(u,e)}e.registerEditorTypes(d),A(this,le,e),this.pageIndex=t,this.div=r,A(this,_0,i),A(this,Yi,o),this.viewport=c,A(this,An,a),this.drawLayer=s,g(this,le).addLayer(this)}get isEmpty(){return g(this,fr).size===0}get isInvisible(){return this.isEmpty&&g(this,le).getMode()===Ae.NONE}updateToolbar(e){g(this,le).updateToolbar(e)}updateMode(e=g(this,le).getMode()){switch(x(this,od,S5).call(this),e){case Ae.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Ae.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case Ae.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const r of g(ci,Ma).values())t.toggle(`${r._type}Editing`,e===r._editorType);this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=g(this,An))==null?void 0:t.div)}addInkEditorIfNeeded(e){if(g(this,le).getMode()===Ae.INK){if(!e){for(const t of g(this,fr).values())if(t.isEmpty()){t.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(e){g(this,le).setEditingState(e)}addCommands(e){g(this,le).addCommands(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=g(this,Yi))==null||t.div.classList.toggle("disabled",!e)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const r of g(this,fr).values())r.enableEditing(),r.show(!0),r.annotationElementId&&(g(this,le).removeChangedExistingAnnotation(r),e.add(r.annotationElementId));if(!g(this,Yi))return;const t=g(this,Yi).getEditableAnnotations();for(const r of t){if(r.hide(),g(this,le).isDeletedAnnotationElement(r.data.id)||e.has(r.data.id))continue;const i=this.deserialize(r);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){var i;A(this,id,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,t=new Map;for(const o of g(this,fr).values())o.disableEditing(),o.annotationElementId&&(o.serialize()===null?(t.set(o.annotationElementId,o),(i=this.getEditableAnnotation(o.annotationElementId))==null||i.show(),o.remove()):e.set(o.annotationElementId,o));if(g(this,Yi)){const o=g(this,Yi).getEditableAnnotations();for(const s of o){const{id:a}=s.data;if(g(this,le).isDeletedAnnotationElement(a))continue;let c=t.get(a);c?(c.resetAnnotationElement(s),c.show(!1),s.show()):(c=e.get(a),c&&(g(this,le).addChangedExistingAnnotation(c),c.renderAnnotationElement(s),c.show(!1)),s.show())}}x(this,od,S5).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:r}=this.div;for(const o of g(ci,Ma).values())r.remove(`${o._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),A(this,id,!1)}getEditableAnnotation(e){var t;return((t=g(this,Yi))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){g(this,le).getActive()!==e&&g(this,le).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=g(this,An))!=null&&e.div&&!g(this,Go)){A(this,Go,new AbortController);const t=g(this,le).combinedSignal(g(this,Go));g(this,An).div.addEventListener("pointerdown",x(this,Ky,yP).bind(this),{signal:t}),g(this,An).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=g(this,An))!=null&&e.div&&g(this,Go)&&(g(this,Go).abort(),A(this,Go,null),g(this,An).div.classList.remove("highlighting"))}enableClick(){if(g(this,ka))return;A(this,ka,new AbortController);const e=g(this,le).combinedSignal(g(this,ka));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:e})}disableClick(){var e;(e=g(this,ka))==null||e.abort(),A(this,ka,null)}attach(e){g(this,fr).set(e.id,e);const{annotationElementId:t}=e;t&&g(this,le).isDeletedAnnotationElement(t)&&g(this,le).removeDeletedAnnotationElement(e)}detach(e){var t;g(this,fr).delete(e.id),(t=g(this,_0))==null||t.removePointerInTextLayer(e.contentDiv),!g(this,id)&&e.annotationElementId&&g(this,le).addDeletedAnnotationElement(e)}remove(e){this.detach(e),g(this,le).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,g(this,rd)||this.addInkEditorIfNeeded(!1)}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(g(this,le).addDeletedAnnotationElement(e.annotationElementId),je.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(e.parent!==this||!e.isAttachedToDOM){if(this.changeParent(e),g(this,le).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),g(this,le).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var r;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!g(this,qo)&&(e._focusEventsAllowed=!1,A(this,qo,setTimeout(()=>{A(this,qo,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:g(this,le)._signal}),t.focus())},0))),e._structTreeParentId=(r=g(this,_0))==null?void 0:r.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return g(this,le).getId()}combinedSignal(e){return g(this,le).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=g(this,j1,t8))==null?void 0:e.canCreateNewEmptyEditor()}pasteEditor(e,t){g(this,le).updateToolbar(e),g(this,le).updateMode(e);const{offsetX:r,offsetY:i}=x(this,H1,r8).call(this),o=this.getNextId(),s=x(this,z1,n8).call(this,{parent:this,id:o,x:r,y:i,uiManager:g(this,le),isCentered:!0,...t});s&&this.add(s)}deserialize(e){var t;return((t=g(ci,Ma).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,g(this,le)))||null}createAndAddNewEditor(e,t,r={}){const i=this.getNextId(),o=x(this,z1,n8).call(this,{parent:this,id:i,x:e.offsetX,y:e.offsetY,uiManager:g(this,le),isCentered:t,...r});return o&&this.add(o),o}addNewEditor(){this.createAndAddNewEditor(x(this,H1,r8).call(this),!0)}setSelected(e){g(this,le).setSelected(e)}toggleSelected(e){g(this,le).toggleSelected(e)}isSelected(e){return g(this,le).isSelected(e)}unselect(e){g(this,le).unselect(e)}pointerup(e){const{isMac:t}=Bn.platform;!(e.button!==0||e.ctrlKey&&t)&&e.target===this.div&&g(this,Sa)&&(A(this,Sa,!1),g(this,nd)?g(this,le).getMode()!==Ae.STAMP?this.createAndAddNewEditor(e,!1):g(this,le).unselectAll():A(this,nd,!0))}pointerdown(e){if(g(this,le).getMode()===Ae.HIGHLIGHT&&this.enableTextSelection(),g(this,Sa)){A(this,Sa,!1);return}const{isMac:t}=Bn.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;A(this,Sa,!0);const r=g(this,le).getActive();A(this,nd,!r||r.isEmpty())}findNewParent(e,t,r){const i=g(this,le).findParent(t,r);return i===null||i===this?!1:(i.changeParent(e),!0)}destroy(){var e,t;((e=g(this,le).getActive())==null?void 0:e.parent)===this&&(g(this,le).commitOrRemove(),g(this,le).setActiveEditor(null)),g(this,qo)&&(clearTimeout(g(this,qo)),A(this,qo,null));for(const r of g(this,fr).values())(t=g(this,_0))==null||t.removePointerInTextLayer(r.contentDiv),r.setParent(null),r.isAttachedToDOM=!1,r.div.remove();this.div=null,g(this,fr).clear(),g(this,le).removeLayer(this)}render({viewport:e}){this.viewport=e,qa(this.div,e);for(const t of g(this,le).getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){g(this,le).commitOrRemove(),x(this,od,S5).call(this);const t=this.viewport.rotation,r=e.rotation;if(this.viewport=e,qa(this.div,{rotation:r}),t!==r)for(const i of g(this,fr).values())i.rotate(r);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return g(this,le).viewParameters.realScale}};_0=new WeakMap,nd=new WeakMap,Yi=new WeakMap,ka=new WeakMap,qo=new WeakMap,fr=new WeakMap,Sa=new WeakMap,rd=new WeakMap,id=new WeakMap,An=new WeakMap,Go=new WeakMap,le=new WeakMap,Ma=new WeakMap,Ky=new WeakSet,yP=function(e){g(this,le).unselectAll();const{target:t}=e;if(t===g(this,An).div||t.classList.contains("endOfContent")&&g(this,An).div.contains(t)){const{isMac:r}=Bn.platform;if(e.button!==0||e.ctrlKey&&r)return;g(this,le).showAllEditors("highlight",!0,!0),g(this,An).div.classList.add("free"),this.toggleDrawing(),ym.startHighlighting(this,g(this,le).direction==="ltr",e),g(this,An).div.addEventListener("pointerup",()=>{g(this,An).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:g(this,le)._signal}),e.preventDefault()}},j1=new WeakSet,t8=function(){return g(ci,Ma).get(g(this,le).getMode())},z1=new WeakSet,n8=function(e){const t=g(this,j1,t8);return t?new t.prototype.constructor(e):null},H1=new WeakSet,r8=function(){const{x:e,y:t,width:r,height:i}=this.div.getBoundingClientRect(),o=Math.max(0,e),s=Math.max(0,t),a=(o+Math.min(window.innerWidth,e+r))/2-e,c=(s+Math.min(window.innerHeight,t+i))/2-t,[u,d]=this.viewport.rotation%180==0?[a,c]:[c,a];return{offsetX:u,offsetY:d}},od=new WeakSet,S5=function(){A(this,rd,!0);for(const e of g(this,fr).values())e.isEmpty()&&e.remove();A(this,rd,!1)},fe(ci,"_initialized",!1),M(ci,Ma,new Map([q4,Y4,Q4,ym].map(e=>[e._editorType,e])));let X4=ci;const on=class on{constructor({pageIndex:e}){M(this,W1);M(this,qy);M(this,Qi,null);M(this,U1,0);M(this,Pt,new Map);M(this,Ea,new Map);this.pageIndex=e}setParent(e){if(g(this,Qi)){if(g(this,Qi)!==e){if(g(this,Pt).size>0)for(const t of g(this,Pt).values())t.remove(),e.append(t);A(this,Qi,e)}}else A(this,Qi,e)}static get _svgFactory(){return Ie(this,"_svgFactory",new A4)}highlight(e,t,r,i=!1){const o=qn(this,U1)._++,s=x(this,W1,o8).call(this,e.box);s.classList.add("highlight"),e.free&&s.classList.add("free");const a=on._svgFactory.createElement("defs");s.append(a);const c=on._svgFactory.createElement("path");a.append(c);const u=`path_p${this.pageIndex}_${o}`;c.setAttribute("id",u),c.setAttribute("d",e.toSVGPath()),i&&g(this,Ea).set(o,c);const d=x(this,qy,bP).call(this,a,u),f=on._svgFactory.createElement("use");return s.append(f),s.setAttribute("fill",t),s.setAttribute("fill-opacity",r),f.setAttribute("href",`#${u}`),g(this,Pt).set(o,s),{id:o,clipPathId:`url(#${d})`}}highlightOutline(e){const t=qn(this,U1)._++,r=x(this,W1,o8).call(this,e.box);r.classList.add("highlightOutline");const i=on._svgFactory.createElement("defs");r.append(i);const o=on._svgFactory.createElement("path");i.append(o);const s=`path_p${this.pageIndex}_${t}`;o.setAttribute("id",s),o.setAttribute("d",e.toSVGPath()),o.setAttribute("vector-effect","non-scaling-stroke");let a;if(e.free){r.classList.add("free");const d=on._svgFactory.createElement("mask");i.append(d),a=`mask_p${this.pageIndex}_${t}`,d.setAttribute("id",a),d.setAttribute("maskUnits","objectBoundingBox");const f=on._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const h=on._svgFactory.createElement("use");d.append(h),h.setAttribute("href",`#${s}`),h.setAttribute("stroke","none"),h.setAttribute("fill","black"),h.setAttribute("fill-rule","nonzero"),h.classList.add("mask")}const c=on._svgFactory.createElement("use");r.append(c),c.setAttribute("href",`#${s}`),a&&c.setAttribute("mask",`url(#${a})`);const u=c.cloneNode();return r.append(u),c.classList.add("mainOutline"),u.classList.add("secondaryOutline"),g(this,Pt).set(t,r),t}finalizeLine(e,t){const r=g(this,Ea).get(e);g(this,Ea).delete(e),this.updateBox(e,t.box),r.setAttribute("d",t.toSVGPath())}updateLine(e,t){g(this,Pt).get(e).firstChild.firstChild.setAttribute("d",t.toSVGPath())}removeFreeHighlight(e){this.remove(e),g(this,Ea).delete(e)}updatePath(e,t){g(this,Ea).get(e).setAttribute("d",t.toSVGPath())}updateBox(e,t){var r;x(r=on,Z1,i8).call(r,g(this,Pt).get(e),t)}show(e,t){g(this,Pt).get(e).classList.toggle("hidden",!t)}rotate(e,t){g(this,Pt).get(e).setAttribute("data-main-rotation",t)}changeColor(e,t){g(this,Pt).get(e).setAttribute("fill",t)}changeOpacity(e,t){g(this,Pt).get(e).setAttribute("fill-opacity",t)}addClass(e,t){g(this,Pt).get(e).classList.add(t)}removeClass(e,t){g(this,Pt).get(e).classList.remove(t)}remove(e){g(this,Qi)!==null&&(g(this,Pt).get(e).remove(),g(this,Pt).delete(e))}destroy(){A(this,Qi,null);for(const e of g(this,Pt).values())e.remove();g(this,Pt).clear()}};Qi=new WeakMap,U1=new WeakMap,Pt=new WeakMap,Ea=new WeakMap,Z1=new WeakSet,i8=function(e,{x:t=0,y:r=0,width:i=1,height:o=1}={}){const{style:s}=e;s.top=100*r+"%",s.left=100*t+"%",s.width=100*i+"%",s.height=100*o+"%"},W1=new WeakSet,o8=function(e){var r;const t=on._svgFactory.create(1,1,!0);return g(this,Qi).append(t),t.setAttribute("aria-hidden",!0),x(r=on,Z1,i8).call(r,t,e),t},qy=new WeakSet,bP=function(e,t){const r=on._svgFactory.createElement("clipPath");e.append(r);const i=`clip_${t}`;r.setAttribute("id",i),r.setAttribute("clipPathUnits","objectBoundingBox");const o=on._svgFactory.createElement("use");return r.append(o),o.setAttribute("href",`#${t}`),o.classList.add("clip"),i},M(on,Z1);let J4=on;pe.AbortException,pe.AnnotationEditorLayer,pe.AnnotationEditorParamsType,pe.AnnotationEditorType,pe.AnnotationEditorUIManager,pe.AnnotationLayer,pe.AnnotationMode,pe.CMapCompressionType,pe.ColorPicker,pe.DOMSVGFactory,pe.DrawLayer,pe.FeatureTest;var uW=pe.GlobalWorkerOptions;pe.ImageKind,pe.InvalidPDFException,pe.MissingPDFException,pe.OPS,pe.PDFDataRangeTransport,pe.PDFDateString,pe.PDFWorker,pe.PasswordResponses,pe.PermissionFlag,pe.PixelsPerInch,pe.RenderingCancelledException,pe.TextLayer,pe.UnexpectedResponseException,pe.Util,pe.VerbosityLevel,pe.XfaLayer,pe.build,pe.createValidAbsoluteUrl,pe.fetchData;var dW=pe.getDocument;pe.getFilenameFromUrl,pe.getPdfFilenameFromUrl,pe.getXfaPageViewport,pe.isDataScheme,pe.isPdfFile,pe.noContextMenu,pe.normalizeUnicode,pe.setLayerDimensions,pe.shadow;var fW=pe.version;const hW=l.defineComponent({name:"QModal",components:{QIcon:vp},props:{id:{type:String,default:"q-modal"},closeButtonClass:{type:String,default:""},containerClass:{type:String,default:"h-fit min-h-fit"},dismissible:{type:Boolean,default:!0},dismissibleOverlay:{type:Boolean,default:!0},dismissText:{type:String,default:""},overlay:{type:String,default:"white-transparent"},size:{type:String,default:"md"},showCancelLink:{type:Boolean,default:!1},hasBuildingBg:{type:Boolean,default:!1}},emits:["close"],setup(n,{emit:e}){l.provide("size",n.size);const t=()=>{n.dismissible&&e("close")};return l.onUnmounted(()=>{document.body.classList.remove("scroll-disabled")}),l.onMounted(()=>{document.body.classList.add("scroll-disabled")}),{onCloseModal:t}}});function pW(n,e,t,r,i,o){const s=l.resolveComponent("q-icon");return l.openBlock(),l.createElementBlock("div",{ref:"currentModal",class:l.normalizeClass(["q-modal",n.overlay]),onKeydown:e[3]||(e[3]=l.withKeys((...a)=>n.onCloseModal&&n.onCloseModal(...a),["escape"]))},[l.createElementVNode("div",l.mergeProps({class:"overlay"},{[l.toHandlerKey(n.dismissibleOverlay&&"click")]:e[0]||(e[0]=(...a)=>n.onCloseModal&&n.onCloseModal(...a))}),null,16),l.createElementVNode("div",{class:l.normalizeClass(["modal-container flex flex-col relative","modal-"+n.size,n.containerClass,{"building-background":n.hasBuildingBg}])},[n.dismissible?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["modal-close-button",n.closeButtonClass]),onClick:e[1]||(e[1]=(...a)=>n.onCloseModal&&n.onCloseModal(...a))},[l.createVNode(s,{icon:"close",type:"line",color:"gray-40"})],2)):l.createCommentVNode("",!0),l.renderSlot(n.$slots,"default",{},void 0,!0),n.showCancelLink?(l.openBlock(),l.createElementBlock("a",{key:1,class:"modal-close-link",href:"#",onClick:e[2]||(e[2]=l.withModifiers(a=>n.$emit("close"),["prevent"]))},l.toDisplayString(n.$t("HC_CANCEL")),1)):l.createCommentVNode("",!0)],2)],34)}const e6=ge(hW,[["render",pW],["__scopeId","data-v-8867a052"]]),mW=l.defineComponent({name:"QErrorModal",components:{QModal:e6},props:{toggle:{type:Boolean,default:!1,required:!0}},emits:["update:toggle"],setup(n,{emit:e}){return{toggleModal:l.computed({get:()=>n.toggle,set:r=>{e("update:toggle",r)}}),mq:_n}}}),gW={class:"flex flex-col gap-2 text-center"},yW={class:"text-lg font-bold text-inkwell-30 leading-6"},bW={class:"text-inkwell-0 mb-2 md:mb-6"};function wW(n,e,t,r,i,o){const s=l.resolveComponent("q-icon"),a=l.resolveComponent("q-button"),c=l.resolveComponent("q-modal-content"),u=l.resolveComponent("q-modal");return l.openBlock(),l.createBlock(l.Transition,{name:n.mq.md?"fade":"slide-up"},{default:l.withCtx(()=>[n.toggleModal?(l.openBlock(),l.createBlock(u,{key:0,id:"error-modal",dismissible:!1,overlay:n.mq.md?"white-transparent":"black-transparent",class:"!z-[170]","footer-class":"mt-2 md:mt-6",onClose:e[1]||(e[1]=d=>n.toggleModal=!1)},{default:l.withCtx(()=>[l.createVNode(c,null,{body:l.withCtx(()=>[l.createElementVNode("div",gW,[l.createVNode(s,{icon:"exclamation-circle",type:"outline",size:"xl",color:"red-30",class:"shrink-0 self-center mb-8"}),l.createElementVNode("h2",yW,[l.renderSlot(n.$slots,"headline",{},()=>[l.createTextVNode(l.toDisplayString(n.$t("HC_ERROR")),1)],!0)]),l.createElementVNode("p",bW,[l.renderSlot(n.$slots,"subtext",{},()=>[l.createTextVNode(l.toDisplayString(n.$t("HC_SORRY_UNEXPECTED_EXIT_MODAL")),1)],!0)])])]),footer:l.withCtx(()=>[l.createVNode(a,{class:l.normalizeClass([n.mq.md?"mx-3":"w-full"]),size:"lg",status:"secondary",onClick:e[0]||(e[0]=d=>n.toggleModal=!1)},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(n.$t("HC_EXIT")),1)]),_:1},8,["class"])]),_:3})]),_:3},8,["overlay"])):l.createCommentVNode("",!0)]),_:3},8,["name"])}const oE=ge(mW,[["render",wW],["__scopeId","data-v-72f5c09d"]]);uW.workerSrc=`https://cdn.jsdelivr.net/npm/pdfjs-dist@${fW}/legacy/build/pdf.worker.min.mjs`;const vW=l.defineComponent({name:"PdfViewer",components:{QErrorModal:oE},props:{url:{type:String,required:!0}},emits:["pdf-error"],setup(n,{emit:e}){let t=null;const r=2,i=16,o=l.ref([]),s=l.ref(!0),a=l.ref(!1),c=l.ref(0),u=async()=>{try{if(t=await dW(n.url).promise,!t)throw new Error("pdfDoc is null or undefined");c.value=t.numPages,s.value=!1,await l.nextTick(),o.value=Array.from(document.querySelectorAll(".pdf-pages canvas")),await d()}catch(h){a.value=!0,console.log(h),s.value=!1,e("pdf-error",!0)}},d=async()=>{try{for(let h=1;h<=c.value;h++)await f(h)}catch(h){console.log(h),a.value=!0,e("pdf-error",!0)}},f=async h=>{try{const p=await(t==null?void 0:t.getPage(h));if(!p)throw new Error(`Page ${h} does not exist in the PDF document`);const y=p.getViewport({scale:1}),b=o.value[h-1];if(!b)throw new Error(`Canvas for page ${h} does not exist`);const w=b.getContext("2d");if(!w)throw new Error(`Context for page ${h} does not exist`);b.height=y==null?void 0:y.height,b.width=y==null?void 0:y.width;const v={canvasContext:w,viewport:y};await(p==null?void 0:p.render(v))}catch(p){console.log(p),a.value=!0,e("pdf-error",!0)}};return l.onMounted(()=>{u()}),{skeletonColumns:r,skeletonRows:i,canvasRefs:o,loadingMeta:s,showErrorModal:a,totalPages:c,loadPDF:u,renderPage:f}}}),CW={class:"q-pdf-viewer"},kW={key:0},SW={key:1,class:"pdf-pages"};function MW(n,e,t,r,i,o){const s=l.resolveComponent("q-error-modal");return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",CW,[n.loadingMeta?(l.openBlock(),l.createElementBlock("div",kW,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.skeletonRows,a=>(l.openBlock(),l.createElementBlock("div",{key:a,class:"flex items-center p-4"},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.skeletonColumns,c=>(l.openBlock(),l.createElementBlock("div",{key:c,class:l.normalizeClass(["h-[1.5rem] border-white w-11/12",(a-1)%2?"bg-gray-10":"bg-gray-30",(a-1)%4||c===1?"animate-shimmer":"!hidden"])},null,2))),128))]))),128))])):(l.openBlock(),l.createElementBlock("div",SW,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.totalPages,a=>(l.openBlock(),l.createElementBlock("canvas",{key:a,class:"w-full"}))),128))]))]),n.showErrorModal?(l.openBlock(),l.createBlock(s,{key:0,toggle:n.showErrorModal,"onUpdate:toggle":[e[0]||(e[0]=a=>n.showErrorModal=a),e[1]||(e[1]=a=>n.showErrorModal=!1)]},null,8,["toggle"])):l.createCommentVNode("",!0)],64)}const sE=ge(vW,[["render",MW],["__scopeId","data-v-da5da0f5"]]),EW=l.defineComponent({name:"QTooltip",props:{id:{type:String,default:"tooltip"},color:{type:String,default:"inkwell-30"},disabled:{type:Boolean,default:!1},noWrap:{type:Boolean,default:!0},position:{type:String,default:"bottom"},relative:{type:Boolean,default:!1},tooltipClasses:{type:[String,Array,Object],default:""}}}),AW=["aria-describedby"],TW=["id"];function xW(n,e,t,r,i,o){return l.openBlock(),l.createElementBlock("div",{class:"tooltip-container","aria-describedby":n.id},[l.renderSlot(n.$slots,"trigger",{},void 0,!0),l.createElementVNode("div",{id:n.id,class:l.normalizeClass(["tooltip",n.color?"bg-"+n.color+" border-"+n.color:"",n.position,n.noWrap?"no-wrap":"",n.relative?"relative":"",n.disabled?"!hidden":"",n.tooltipClasses]),role:"tooltip"},[l.renderSlot(n.$slots,"content",{},void 0,!0)],10,TW)],8,AW)}const t6=ge(EW,[["render",xW],["__scopeId","data-v-ca6ae8fe"]]),aE=()=>{const n=l.ref(""),e=navigator.userAgent;return e.match("/Android|webOS|iPhone|iPod|BlackBerry/i")?n.value="mobile":e.match("/iPad|Tablet/i")||navigator.maxTouchPoints&&navigator.maxTouchPoints>=0&&!window.matchMedia("(pointer:fine)").matches?n.value="tablet":n.value="desktop",{deviceType:n}},IW=l.defineComponent({name:"ImageGallery",components:{Galleria:rM,QBadge:Da,QBottomSheet:G9,QMenu:m4,QPdfViewer:sE,QTooltip:t6},props:{files:{type:Array,default:()=>[]},thumbnailsVisible:{type:Number,default:4},showOnHover:{type:Boolean,default:!0},showThumbnails:{type:Boolean,default:!0},showRemove:{type:[Boolean,Number],default:!1},baseZIndex:{type:Number,default:1e3},wrap:{type:Boolean,default:!0}},emits:["update:model-value","update:activeIndex","click:file"],setup(n,{emit:e}){const{t}=us(),{deviceType:r}=aE(),i=[{text:t("HC_CANCEL")}],o=l.ref(null),s=l.computed(()=>{var Y;return(Y=o.value)==null?void 0:Y.offsetWidth}),a=l.ref(null),c=l.ref([]),u=l.ref(!1),d=l.ref(null),f=l.ref("0"),h=l.ref(1),p=l.ref(_n.md?1:.9),m=l.ref(0),y=l.ref(null),b=l.ref(),w=l.ref(!1),v=l.ref(!1),k=l.computed(()=>{if(y.value)return y.value&&"original"in y.value?{name:y.value.original.name,url:y.value.original.url,type:y.value.mimetype,extension:Z(y.value.original.url)}:{name:y.value.name,url:URL.createObjectURL(y.value),type:y.value.type,extension:Z(y.value.name)}}),C=l.computed(()=>[`z-[${n.baseZIndex+1}]`]),T=l.computed(()=>n.files.filter(Y=>Y.type.startsWith("image")&&!Y.type.includes("tif"))),S=l.computed(()=>["rounded-lg relative mx-auto object-cover grow-1 max-h-[78vh]",{animated:!N}]),E=l.computed(()=>["flex items-center gap-3",n.wrap?"flex-wrap":"flex-nowrap overflow-x-auto shrink-0",{"flex-nowrap overflow-x-auto":r.value!=="desktop"}]),O=l.computed(()=>[{text:t("HC_DELETE_ATTACHMENT"),classes:"!text-red-20",event:F}]),I=Y=>{const U=Y instanceof File?URL.createObjectURL(Y):Y.original.url;r.value==="desktop"?window.open(U,"_blank"):window.open(U,"_self")},P=Y=>{r.value==="desktop"?I(Y):(y.value=Y,v.value=!0)},D=Y=>{Y.event(),u.value=!1},L=(Y,U)=>{var z;const H=((z=U.type)==null?void 0:z.includes("image"))&&!U.type.includes("tif");!u.value&&H?B(Y,U):!u.value&&!H&&P(U)},B=(Y,U)=>{const H=W=>"original"in W&&"original"in U?W.original.url===(U==null?void 0:U.original.url):U instanceof File?W.name===(U==null?void 0:U.name):!1,z=T.value.findIndex(H);m.value=z!==-1?z:Y,w.value=!0},F=(Y=null)=>{u.value=!1,e("update:model-value",Y||d.value)},R=Y=>{const{keyCode:U}=Y;if(w.value)switch(U){case 37:m.value=m.value?m.value-1:T.value.length-1,e("update:activeIndex",m.value);break;case 39:m.value=m.value<T.value.length-1?m.value+1:0,e("update:activeIndex",m.value);break;case 27:w.value=!1;break}},{isSwiping:N,lengthX:G}=iL(a,{passive:!1,onSwipe(){const Y=Math.abs(G.value);s.value&&(h.value=1.1-Y/s.value,f.value=G.value<0?`${Y/4}px`:`-${Y/4}px`)},onSwipeEnd(){const Y=m.value<=0,U=m.value>=T.value.length-1,H=Math.abs(G.value);s.value&&H/s.value>=.5?(G.value<0?m.value=Y?T.value.length-1:m.value-1:m.value=U?0:m.value+1,f.value="0",h.value=1):(f.value="0",h.value=1)}}),Z=Y=>Y.substring(Y.lastIndexOf(".")),ee=(Y,U)=>{Y.preventDefault(),d.value=n.files[U],u.value=!0},me=()=>{u.value=!1,d.value=null},xe=()=>{r.value!=="desktop"&&c.value.forEach(Y=>{X_(Y,U=>{const H=c.value.indexOf(Y);ee(U,H)},{modifiers:{prevent:!0}})})};return l.onMounted(()=>{window.addEventListener("keyup",R),xe()}),l.onUpdated(()=>{xe()}),{menuActions:i,linkActions:O,deviceType:r,container:o,containerWidth:s,featuredPhoto:a,longPressRef:c,longPressedHook:u,isSwiping:N,lengthX:G,left:f,opacity:h,scale:p,showCarousel:w,showFileViewer:v,active:m,activeAttachment:y,hoveredIndex:b,closeIconClasses:C,itemClasses:S,images:T,normalizedAttachment:k,thumbnailContainerClasses:E,downloadDocument:I,getExtension:Z,onAttachmentClick:P,onClickMenuLink:D,onClickThumbnail:L,onOpenCarousel:B,onRemoveFile:F,onKeyboardNavigation:R,onLongPressCallbackHook:ee,resetHook:me,mq:_n}}}),OW={class:"q-image-gallery flex",ref:"container"},DW={ref:"featuredPhoto",class:"featured-image overflow-hidden flex max-w-screen relative h-full w-screen items-center"},NW=["src","alt"],PW=["src","alt"],_W=["onMouseover","onClick"],LW=["src","alt"],BW={key:1,class:"bg-gray-00 cursor-pointer p-3 h-16 max-w-[14rem] rounded-lg border border-gray-20 flex items-center"},RW={class:"grow text-ellipsis overflow-hidden"},$W={class:"text-inkwell-30 bold leading-normal text-nowrap text-ellipsis text-sm overflow-hidden -mt-1"},FW={class:"uppercase text-xxs"},VW={key:2,class:"image-overlay absolute top-0 left-0 w-full h-full cursor-pointer"},jW={key:1,width:"100%",height:"auto",controls:"",class:"bg-black"},zW=["src"],HW={class:"flex items-center flex-col p-12"},UW=["src"],ZW=["data","type"],WW={class:"flex items-center flex-col p-12"};function KW(n,e,t,r,i,o){const s=l.resolveComponent("q-icon"),a=l.resolveComponent("Galleria"),c=l.resolveComponent("q-badge"),u=l.resolveComponent("q-tooltip"),d=l.resolveComponent("q-menu"),f=l.resolveComponent("q-pdf-viewer"),h=l.resolveComponent("q-bottom-sheet");return l.openBlock(),l.createElementBlock("div",OW,[l.createVNode(a,{activeIndex:n.active,"onUpdate:activeIndex":e[0]||(e[0]=p=>n.active=p),visible:n.showCarousel,"onUpdate:visible":e[1]||(e[1]=p=>n.showCarousel=p),value:n.images,numVisible:n.thumbnailsVisible,circular:!0,fullScreen:!0,showItemNavigators:n.mq.md,showThumbnailNavigators:!0,showThumbnails:n.showThumbnails&&n.mq.md,showIndicators:!n.mq.md,containerStyle:[{height:"100vh"}],"base-z-index":n.baseZIndex},{closeicon:l.withCtx(()=>[l.createVNode(s,{class:l.normalizeClass(n.closeIconClasses),icon:"times-circle",type:"outline",size:"lg",color:"white"},null,8,["class"])]),item:l.withCtx(({item:p})=>[l.createElementVNode("div",DW,[l.createElementVNode("img",{src:(p==null?void 0:p.itemImageSrc)||(p==null?void 0:p.objectURL)||(p==null?void 0:p.original.url),alt:p==null?void 0:p.alt,class:l.normalizeClass(n.itemClasses),style:l.normalizeStyle([{left:n.left,opacity:n.opacity},`transform: scale(${n.scale})`])},null,14,NW)],512)]),thumbnail:l.withCtx(({item:p})=>[l.createElementVNode("img",{src:p.thumbnailImageSrc||(p==null?void 0:p.objectURL)||(p==null?void 0:p.thumbnail.url),alt:p.alt,class:"rounded-lg block min-h-24 min-w-24 max-w-24 max-h-24 object-cover"},null,8,PW)]),previousitemicon:l.withCtx(()=>[l.createVNode(s,{icon:"chevron-circle-left",type:"outline",size:"md",color:"white"})]),nextitemicon:l.withCtx(()=>[l.createVNode(s,{icon:"chevron-circle-right",type:"outline",size:"md",color:"white"})]),previousthumbnailicon:l.withCtx(()=>[n.images.length>n.thumbnailsVisible?(l.openBlock(),l.createBlock(s,{key:0,icon:"chevron-left",type:"line",size:"sm",color:"white"})):l.createCommentVNode("",!0)]),nextthumbnailicon:l.withCtx(()=>[n.images.length>n.thumbnailsVisible?(l.openBlock(),l.createBlock(s,{key:0,icon:"chevron-right",type:"line",size:"sm",color:"white"})):l.createCommentVNode("",!0)]),_:1},8,["activeIndex","visible","value","numVisible","showItemNavigators","showThumbnails","showIndicators","base-z-index"]),n.files?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(n.thumbnailContainerClasses)},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.files,(p,m)=>{var y;return l.openBlock(),l.createElementBlock("div",{ref_for:!0,ref:"longPressRef",key:p.name||((y=p.original)==null?void 0:y.name)||m,class:l.normalizeClass(["p-0 relative rounded-lg",{"shrink-0":n.deviceType!=="desktop"}]),onMouseover:b=>n.hoveredIndex=m,onMouseleave:e[2]||(e[2]=b=>n.hoveredIndex=null),onClick:b=>n.onClickThumbnail(m,p)},[l.createVNode(u,{position:"top"},{trigger:l.withCtx(()=>[p.type&&p.type.includes("image")&&!p.type.includes("tif")?(l.openBlock(),l.createElementBlock("img",{key:0,src:(p==null?void 0:p.thumbnailImageSrc)||(p==null?void 0:p.objectURL)||(p==null?void 0:p.thumbnail.url),alt:p==null?void 0:p.alt,class:"rounded-lg cursor-pointer w-16 h-16 object-cover bg-gray-0 border-gray-20 border"},null,8,LW)):(l.openBlock(),l.createElementBlock("div",BW,[l.createVNode(s,{icon:"file-document",size:"xl",color:"white",class:"mr-3 shrink-0 p-2 bg-green-20 rounded-lg h-full"}),l.createElementVNode("div",RW,[l.createElementVNode("div",$W,l.toDisplayString(p.name||p.original.name),1),l.createElementVNode("div",FW,l.toDisplayString((p.name||p.original.name).match(/([^.]+$)/)[0]),1)])])),n.deviceType!=="desktop"?(l.openBlock(),l.createElementBlock("div",VW)):l.createCommentVNode("",!0),n.showRemove&&n.showOnHover&&n.hoveredIndex===m&&n.deviceType==="desktop"?(l.openBlock(),l.createBlock(c,{key:3,color:"inkwell-30",shape:"circle",class:"cursor-pointer absolute -top-2 -right-2 shadow-solid z-10",onClick:l.withModifiers(b=>n.onRemoveFile(p),["stop"])},{icon:l.withCtx(()=>[l.createVNode(s,{icon:"close",size:"xs",type:"line",color:"white"})]),_:2},1032,["onClick"])):l.createCommentVNode("",!0)]),content:l.withCtx(()=>{var b;return[l.createTextVNode(l.toDisplayString(p.name||((b=p.original)==null?void 0:b.name)),1)]}),_:2},1024)],42,_W)}),128)),l.createVNode(l.Transition,{name:"fade"},{default:l.withCtx(()=>[n.longPressedHook?(l.openBlock(),l.createBlock(d,{key:0,modelValue:n.longPressedHook,"onUpdate:modelValue":e[3]||(e[3]=p=>n.longPressedHook=p),actions:n.menuActions,links:n.linkActions,"links-background":"light-gray","onClick:link":n.onClickMenuLink,"onClick:action":e[4]||(e[4]=p=>n.longPressedHook=!1)},null,8,["modelValue","actions","links","onClick:link"])):l.createCommentVNode("",!0)]),_:1})],2)):l.createCommentVNode("",!0),l.createVNode(l.Transition,{name:"slide-up-fade"},{default:l.withCtx(()=>[n.showFileViewer&&n.normalizedAttachment&&n.activeAttachment?(l.openBlock(),l.createBlock(h,{key:0,modelValue:n.showFileViewer,"onUpdate:modelValue":e[6]||(e[6]=p=>n.showFileViewer=p),"show-close-button":!1,"content-class":"p-0","header-class":"border-b border-solid border-gray-20","title-class":"min-w-0 truncate"},{header:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(n.normalizedAttachment.name),1)]),headerAction:l.withCtx(()=>[!n.normalizedAttachment.type.includes("video")&&n.normalizedAttachment.type!=="audio/mpeg"&&n.normalizedAttachment.type!=="application/pdf"?(l.openBlock(),l.createBlock(s,{key:0,icon:"arrow-to-bottom",type:"line",size:"md",color:"inkwell-40",class:"shrink-0 cursor-pointer",onClick:e[5]||(e[5]=p=>n.downloadDocument(n.activeAttachment))})):l.createCommentVNode("",!0)]),default:l.withCtx(()=>[n.normalizedAttachment.type==="application/pdf"?(l.openBlock(),l.createBlock(f,{key:0,url:n.normalizedAttachment.url},null,8,["url"])):n.normalizedAttachment.type.includes("video")?(l.openBlock(),l.createElementBlock("video",jW,[l.createElementVNode("source",{src:n.normalizedAttachment.url},null,8,zW),l.createElementVNode("div",HW,[l.createVNode(s,{icon:"file-document",size:"xl",color:"inkwell-30"}),l.createTextVNode(" "+l.toDisplayString(n.normalizedAttachment.extension),1)])])):n.normalizedAttachment.type==="audio/mpeg"?(l.openBlock(),l.createElementBlock("audio",{key:2,controls:"",src:n.normalizedAttachment.url,class:"mx-auto my-6"},null,8,UW)):(l.openBlock(),l.createElementBlock("object",{key:3,data:n.normalizedAttachment.url,type:n.normalizedAttachment.type,class:"w-full h-auto"},[l.createElementVNode("div",WW,[l.createVNode(s,{icon:"file-document",size:"xl",color:"inkwell-30"}),l.createTextVNode(" "+l.toDisplayString(n.normalizedAttachment.extension),1)])],8,ZW))]),_:1},8,["modelValue"])):l.createCommentVNode("",!0)]),_:1})],512)}const n6=ge(IW,[["render",KW],["__scopeId","data-v-b160168b"]]),qW=l.defineComponent({name:"QWarningModal",components:{QModal:e6},props:{toggle:{type:Boolean,default:!1,required:!0},action:{type:Function,default:()=>{}},processing:{type:Boolean,default:!1}},emits:["update:toggle","update:action"],setup(n,{emit:e}){return{toggleModal:l.computed({get:()=>n.toggle,set:r=>{e("update:toggle",r)}}),mq:_n}}}),GW={key:0,class:"flex flex-col gap-2 text-center"},YW={class:"text-lg font-bold text-inkwell-30 leading-6"},QW={class:"text-inkwell-0 mb-6"},XW={key:1,class:"flex flex-col gap-2 text-center"},JW={class:"text-[1.25rem] font-bold text-center text-inkwell-30"},eK={class:"text-sm text-center text-inkwell-0 mb-2"},tK={class:"flex flex-col items-center justify-center gap-3 md:gap-2"};function nK(n,e,t,r,i,o){const s=l.resolveComponent("q-button"),a=l.resolveComponent("q-modal-content"),c=l.resolveComponent("q-modal");return l.openBlock(),l.createBlock(l.Transition,{name:n.mq.md?"fade":"slide-up"},{default:l.withCtx(()=>[n.toggleModal?(l.openBlock(),l.createBlock(c,{key:0,class:"warning-modal !z-[170]",dismissible:!1,overlay:n.mq.md?"white-transparent":"black-transparent","container-class":"h-fit min-h-fit","footer-class":"mt-2 md:mt-6",onClose:e[1]||(e[1]=u=>n.toggleModal=!1)},{default:l.withCtx(()=>[l.createVNode(a,null,{body:l.withCtx(()=>[n.mq.md?(l.openBlock(),l.createElementBlock("div",GW,[l.createElementVNode("h2",YW,[l.renderSlot(n.$slots,"desktopHeader",{},void 0,!0)]),l.createElementVNode("p",QW,[l.renderSlot(n.$slots,"desktopMessage",{},void 0,!0)])])):(l.openBlock(),l.createElementBlock("div",XW,[l.createElementVNode("h2",JW,[l.renderSlot(n.$slots,"mobileHeader",{},void 0,!0)]),l.createElementVNode("p",eK,[l.renderSlot(n.$slots,"mobileMessage",{},void 0,!0)])]))]),footer:l.withCtx(()=>[l.createElementVNode("div",tK,[l.createVNode(s,{disabled:n.processing,loading:n.processing,class:l.normalizeClass([n.mq.md?"mx-2":"w-full"]),size:"lg",status:"danger",onClick:n.action},{default:l.withCtx(()=>[l.renderSlot(n.$slots,"buttonText",{},void 0,!0)]),_:3},8,["disabled","loading","class","onClick"]),l.createVNode(s,{class:l.normalizeClass([n.mq.md?"mx-2":"w-full"]),disabled:n.processing,status:n.mq.md?"link-secondary":"secondary",size:"lg",onClick:e[0]||(e[0]=u=>n.toggleModal=!1)},{default:l.withCtx(()=>[l.renderSlot(n.$slots,"cancelText",{},()=>[l.createTextVNode(l.toDisplayString(n.$t("HC_CANCEL")),1)],!0)]),_:3},8,["class","disabled","status"])])]),_:3})]),_:3},8,["overlay"])):l.createCommentVNode("",!0)]),_:3},8,["name"])}const lE=ge(qW,[["render",nK],["__scopeId","data-v-a8bfc627"]]),rK=l.defineComponent({name:"QPopover",props:{align:{type:String,default:"left"},hasCaret:{type:Boolean,default:!0},modelValue:{type:Boolean,default:!1},position:{type:String,default:"bottom"},reposition:{type:Boolean,default:!0},size:{type:String,default:"md"},trigger:{type:String,default:"click"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=l.ref(!1),r=l.ref(""),i=l.ref(null),o=l.computed(()=>t.value===!0&&n.reposition===!0?a(n.align):n.align),s=l.computed(()=>t.value===!0&&n.reposition===!0?c(n.position):n.position),a=b=>{if(!i.value||u(i.value.children[1]))return b;const w=i.value.children[0].getBoundingClientRect(),v=i.value.children[1].getBoundingClientRect();if(b==="left"||b==="right"||b==="center"){const k=w.left;return window.innerWidth-k<v.width?"right":"left"}else{const k=w.top;return window.innerHeight-k<v.height?"bottom":"top"}},c=b=>{if(!i.value||u(i.value.children[1]))return b;const w=i.value.children[0].getBoundingClientRect(),v=i.value.children[1].getBoundingClientRect();if(b==="top"||b==="bottom"){const k=w.top;return window.innerHeight-k<v.height?"top":"bottom"}else{const k=w.left;return window.innerWidth-k<v.width?"left":"right"}},u=b=>{const w=b.getBoundingClientRect();return w?w.top>=0&&w.left>=0&&w.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&w.right<=(window.innerWidth||document.documentElement.clientWidth):!1},d=()=>{(n.trigger==="click"||n.trigger==="both")&&e("update:modelValue",!n.modelValue)},f=()=>{n.trigger!=="click"&&e("update:modelValue",!1)},h=()=>{n.trigger!=="click"&&e("update:modelValue",!0)},p=()=>{var w;const b=(w=i.value)==null?void 0:w.children[0];if(b){const v=b.clientWidth,k=b.clientHeight;switch(o.value){case"left":r.value=`margin-left: ${v/2-10}px;`;break;case"right":r.value=`margin-right: ${v/2-10}px;`;break;case"top":r.value=`margin-top: ${k/2-10}px;`;break;case"bottom":r.value=`margin-bottom: ${k/2-10}px;`;break}}};F5(i,()=>{e("update:modelValue",!1)});function m(){t.value=!1}function y(){var b;t.value=!0,!u((b=i.value)==null?void 0:b.children[1])&&n.reposition===!0&&p()}return{entered:t,offsetStyle:r,popover:i,alignment:o,positioning:s,getAlignment:a,getPositioning:c,isElementInView:u,onAfterLeave:m,onClick:d,onClickOutside:F5,onEnter:y,onMouseLeave:f,onMouseOver:h}}});function iK(n,e,t,r,i,o){return l.openBlock(),l.createElementBlock("div",{ref:"popover",class:"popover-container",onMouseleave:e[0]||(e[0]=(...s)=>n.onMouseLeave&&n.onMouseLeave(...s))},[l.renderSlot(n.$slots,"trigger",{onClick:n.onClick,onMouseOver:n.onMouseOver},void 0,!0),l.createVNode(l.Transition,{name:"fade",onEnter:n.onEnter,onAfterLeave:n.onAfterLeave},{default:l.withCtx(()=>[n.modelValue?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["popover","popover-"+n.alignment,"popover-"+n.size,"popover-on-"+n.positioning,{"has-caret":n.hasCaret}]),style:l.normalizeStyle(n.offsetStyle)},[l.renderSlot(n.$slots,"content",{},void 0,!0)],6)):l.createCommentVNode("",!0)]),_:3},8,["onEnter","onAfterLeave"])],544)}const cE=ge(rK,[["render",iK],["__scopeId","data-v-86f2575d"]]);function Qt(n){this.content=n}Qt.prototype={constructor:Qt,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Qt(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Qt(t)},addToStart:function(n,e){return new Qt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Qt(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Qt(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Qt.from(n),n.size?new Qt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Qt.from(n),n.size?new Qt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Qt.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Qt.from=function(n){if(n instanceof Qt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Qt(e)};function uE(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=uE(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function dE(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),a=e.child(--o),c=s.nodeSize;if(s==a){t-=c,r-=c;continue}if(!s.sameMarkup(a))return{a:t,b:r};if(s.isText&&s.text!=a.text){let u=0,d=Math.min(s.text.length,a.text.length);for(;u<d&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,t--,r--;return{a:t,b:r}}if(s.content.size||a.content.size){let u=dE(s.content,a.content,t-1,r-1);if(u)return u}t-=c,r-=c}}class q{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let s=0,a=0;a<t;s++){let c=this.content[s],u=a+c.nodeSize;if(u>e&&r(c,i+a,o||null,s)!==!1&&c.content.size){let d=a+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,t-d),r,i+d)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",s=!0;return this.nodesBetween(e,t,(a,c)=>{let u=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=u},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new q(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,s=0;s<t;o++){let a=this.content[o],c=s+a.nodeSize;c>e&&((s<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,t-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,t-s-1))),r.push(a),i+=a.nodeSize),s=c}return new q(r,i)}cutByIndex(e,t){return e==t?q.empty:e==0&&t==this.content.length?this:new q(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new q(i,o)}addToStart(e){return new q([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new q(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return uE(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return dE(this,e,t,r)}findIndex(e,t=-1){if(e==0)return bm(0,e);if(e==this.size)return bm(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||t>0?bm(r+1,s):bm(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return q.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new q(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return q.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new q(t||e,r)}static from(e){if(!e)return q.empty;if(e instanceof q)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new q([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}q.empty=new q([],0);const r6={index:0,offset:0};function bm(n,e){return r6.index=n,r6.offset=e,r6}function wm(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!wm(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!wm(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let We=class s8{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&wm(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return s8.none;if(e instanceof s8)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};We.none=[];class vm extends Error{}class te{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=hE(this.content,e+this.openStart,t);return r&&new te(r,this.openStart,this.openEnd)}removeBetween(e,t){return new te(fE(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return te.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new te(q.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new te(e,r,i)}}te.empty=new te(q.empty,0,0);function fE(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:a}=n.findIndex(t);if(i==e||o.isText){if(a!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(fE(o.content,e-i-1,t-i-1)))}function hE(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=hE(s.content,e-o-1,t);return a&&n.replaceChild(i,s.copy(a))}function oK(n,e,t){if(t.openStart>n.depth)throw new vm("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new vm("Inconsistent open depths");return pE(n,e,t,0)}function pE(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=pE(n,e,t,r+1);return o.copy(o.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,a=s.content;return el(s,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=sK(t,n);return el(o,gE(n,s,a,e,r))}else return el(o,Cm(n,e,r))}function mE(n,e){if(!e.type.compatibleContent(n.type))throw new vm("Cannot join "+e.type.name+" onto "+n.type.name)}function i6(n,e,t){let r=n.node(t);return mE(r,e.node(t)),r}function Ja(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function b2(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Ja(n.nodeAfter,r),o++));for(let a=o;a<s;a++)Ja(i.child(a),r);e&&e.depth==t&&e.textOffset&&Ja(e.nodeBefore,r)}function el(n,e){return n.type.checkContent(e),n.copy(e)}function gE(n,e,t,r,i){let o=n.depth>i&&i6(n,e,i+1),s=r.depth>i&&i6(t,r,i+1),a=[];return b2(null,n,i,a),o&&s&&e.index(i)==t.index(i)?(mE(o,s),Ja(el(o,gE(n,e,t,r,i+1)),a)):(o&&Ja(el(o,Cm(n,e,i+1)),a),b2(e,t,i,a),s&&Ja(el(s,Cm(t,r,i+1)),a)),b2(r,null,i,a),new q(a)}function Cm(n,e,t){let r=[];if(b2(null,n,t,r),n.depth>t){let i=i6(n,e,t+1);Ja(el(i,Cm(n,e,t+1)),r)}return b2(e,null,t,r),new q(r)}function sK(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(q.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class w2{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return We.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new km(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let s=e;;){let{index:a,offset:c}=s.content.findIndex(o),u=o-c;if(r.push(s,a,i+c),!u||(s=s.child(a),s.isText))break;o=u-1,i+=c+1}return new w2(t,r,o)}static resolveCached(e,t){for(let i=0;i<o6.length;i++){let o=o6[i];if(o.pos==t&&o.doc==e)return o}let r=o6[s6]=w2.resolve(e,t);return s6=(s6+1)%aK,r}}let o6=[],s6=0,aK=12;class km{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const lK=Object.create(null);let tl=class a8{constructor(e,t,r,i=We.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||q.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&wm(this.attrs,t||e.defaultAttrs||lK)&&We.sameSet(this.marks,r||We.none)}copy(e=null){return e==this.content?this:new a8(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new a8(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return te.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),a=i.start(s),u=i.node(s).content.cut(i.pos-a,o.pos-a);return new te(u,i.depth-s,o.depth-s)}replace(e,t,r){return oK(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return w2.resolveCached(this,e)}resolveNoCache(e){return w2.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),yE(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=q.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let c=i;c<o;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=We.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!We.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=q.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};tl.prototype.text=void 0;class Sm extends tl{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):yE(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Sm(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Sm(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function yE(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class nl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new cK(e,t);if(r.next==null)return nl.empty;let i=bE(r);r.next&&r.err("Unexpected trailing text");let o=gK(mK(i));return yK(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(s,a){let c=s.matchFragment(e,r);if(c&&(!t||c.validEnd))return q.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:d,next:f}=s.next[u];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=o(f,a.concat(d));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:c}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||c.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
|
|
131
|
+
`)){const r=document.createElement("div");r.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(r)}},py=new WeakSet,VN=function(){return g(this,lr).replaceAll(" "," ")},i1=new WeakSet,Bv=function(t){return t.replaceAll(" "," ")},my=new WeakSet,jN=function(t){const{value:r,fontSize:i,color:o,pageIndex:s}=g(this,Iu);return this._hasBeenMoved||t.value!==r||t.fontSize!==i||t.color.some((a,c)=>a!==o[c])||t.pageIndex!==s},M(Qe,Du),M(Qe,i1),fe(Qe,"_freeTextDefaultContent",""),fe(Qe,"_internalPadding",0),fe(Qe,"_defaultColor",null),fe(Qe,"_defaultFontSize",10),fe(Qe,"_type","freetext"),fe(Qe,"_editorType",Ae.FREETEXT);let q4=Qe;class rE{constructor(e,t=0,r=0,i=!0){M(this,gy);M(this,Pu);M(this,yy);M(this,by);M(this,s1);M(this,o1,void 0);M(this,pa,[]);M(this,oi,[]);let o=1/0,s=-1/0,a=1/0,c=-1/0;const u=10**-4;for(const{x:b,y:w,width:v,height:k}of e){const C=Math.floor((b-t)/u)*u,T=Math.ceil((b+v+t)/u)*u,S=Math.floor((w-t)/u)*u,E=Math.ceil((w+k+t)/u)*u,O=[C,S,E,!0],I=[T,S,E,!1];g(this,pa).push(O,I),o=Math.min(o,C),s=Math.max(s,T),a=Math.min(a,S),c=Math.max(c,E)}const d=s-o+2*r,f=c-a+2*r,h=o-r,p=a-r,m=g(this,pa).at(i?-1:-2),y=[m[0],m[2]];for(const b of g(this,pa)){const[w,v,k]=b;b[0]=(w-h)/d,b[1]=(v-p)/f,b[2]=(k-p)/f}A(this,o1,{x:h,y:p,width:d,height:f,lastPoint:y})}getOutlines(){g(this,pa).sort((t,r)=>t[0]-r[0]||t[1]-r[1]||t[2]-r[2]);const e=[];for(const t of g(this,pa))t[3]?(e.push(...x(this,s1,Rv).call(this,t)),x(this,yy,HN).call(this,t)):(x(this,by,UN).call(this,t),e.push(...x(this,s1,Rv).call(this,t)));return x(this,gy,zN).call(this,e)}}o1=new WeakMap,pa=new WeakMap,oi=new WeakMap,gy=new WeakSet,zN=function(e){const t=[],r=new Set;for(const s of e){const[a,c,u]=s;t.push([a,c,s],[a,u,s])}t.sort((s,a)=>s[1]-a[1]||s[0]-a[0]);for(let s=0,a=t.length;s<a;s+=2){const c=t[s][2],u=t[s+1][2];c.push(u),u.push(c),r.add(c),r.add(u)}const i=[];let o;for(;r.size>0;){const s=r.values().next().value;let[a,c,u,d,f]=s;r.delete(s);let h=a,p=c;for(o=[a,u],i.push(o);;){let m;if(r.has(d))m=d;else{if(!r.has(f))break;m=f}r.delete(m),[a,c,u,d,f]=m,h!==a&&(o.push(h,p,a,p===c?c:u),h=a),p=p===c?u:c}o.push(h,p)}return new cW(i,g(this,o1))},Pu=new WeakSet,m5=function(e){const t=g(this,oi);let r=0,i=t.length-1;for(;r<=i;){const o=r+i>>1,s=t[o][0];if(s===e)return o;s<e?r=o+1:i=o-1}return i+1},yy=new WeakSet,HN=function([,e,t]){const r=x(this,Pu,m5).call(this,e);g(this,oi).splice(r,0,[e,t])},by=new WeakSet,UN=function([,e,t]){const r=x(this,Pu,m5).call(this,e);for(let i=r;i<g(this,oi).length;i++){const[o,s]=g(this,oi)[i];if(o!==e)break;if(o===e&&s===t){g(this,oi).splice(i,1);return}}for(let i=r-1;i>=0;i--){const[o,s]=g(this,oi)[i];if(o!==e)break;if(o===e&&s===t){g(this,oi).splice(i,1);return}}},s1=new WeakSet,Rv=function(e){const[t,r,i]=e,o=[[t,r,i]],s=x(this,Pu,m5).call(this,i);for(let a=0;a<s;a++){const[c,u]=g(this,oi)[a];for(let d=0,f=o.length;d<f;d++){const[,h,p]=o[d];if(!(u<=h||p<=c))if(h>=c)if(p>u)o[d][1]=u;else{if(f===1)return[];o.splice(d,1),d--,f--}else o[d][2]=c,p>u&&o.push([t,u,p])}}return o};class iE{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(e,t){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof G4}}class cW extends iE{constructor(t,r){super();M(this,a1,void 0);M(this,_u,void 0);A(this,_u,t),A(this,a1,r)}toSVGPath(){const t=[];for(const r of g(this,_u)){let[i,o]=r;t.push(`M${i} ${o}`);for(let s=2;s<r.length;s+=2){const a=r[s],c=r[s+1];a===i?(t.push(`V${c}`),o=c):c===o&&(t.push(`H${a}`),i=a)}t.push("Z")}return t.join(" ")}serialize([t,r,i,o],s){const a=[],c=i-t,u=o-r;for(const d of g(this,_u)){const f=new Array(d.length);for(let h=0;h<d.length;h+=2)f[h]=t+d[h]*c,f[h+1]=o-d[h+1]*u;a.push(f)}return a}get box(){return g(this,a1)}}a1=new WeakMap,_u=new WeakMap;const Fo=class Fo{constructor({x:e,y:t},r,i,o,s,a=0){M(this,d1);M(this,Hi,void 0);M(this,$o,[]);M(this,Lu,void 0);M(this,Bu,void 0);M(this,Ui,[]);M(this,Te,new Float64Array(18));M(this,h0,void 0);M(this,p0,void 0);M(this,l1,void 0);M(this,c1,void 0);M(this,Ru,void 0);M(this,$u,void 0);M(this,ma,[]);A(this,Hi,r),A(this,$u,o*i),A(this,Bu,s),g(this,Te).set([NaN,NaN,NaN,NaN,e,t],6),A(this,Lu,a),A(this,c1,g(Fo,u1)*i),A(this,l1,g(Fo,vy)*i),A(this,Ru,i),g(this,ma).push(e,t)}get free(){return!0}isEmpty(){return isNaN(g(this,Te)[8])}add({x:e,y:t}){var E;A(this,h0,e),A(this,p0,t);const[r,i,o,s]=g(this,Hi);let[a,c,u,d]=g(this,Te).subarray(8,12);const f=e-u,h=t-d,p=Math.hypot(f,h);if(p<g(this,l1))return!1;const m=p-g(this,c1),y=m/p,b=y*f,w=y*h;let v=a,k=c;a=u,c=d,u+=b,d+=w,(E=g(this,ma))==null||E.push(e,t);const C=b/m,T=-w/m*g(this,$u),S=C*g(this,$u);return g(this,Te).set(g(this,Te).subarray(2,8),0),g(this,Te).set([u+T,d+S],4),g(this,Te).set(g(this,Te).subarray(14,18),12),g(this,Te).set([u-T,d-S],16),isNaN(g(this,Te)[6])?(g(this,Ui).length===0&&(g(this,Te).set([a+T,c+S],2),g(this,Ui).push(NaN,NaN,NaN,NaN,(a+T-r)/o,(c+S-i)/s),g(this,Te).set([a-T,c-S],14),g(this,$o).push(NaN,NaN,NaN,NaN,(a-T-r)/o,(c-S-i)/s)),g(this,Te).set([v,k,a,c,u,d],6),!this.isEmpty()):(g(this,Te).set([v,k,a,c,u,d],6),Math.abs(Math.atan2(k-c,v-a)-Math.atan2(w,b))<Math.PI/2?([a,c,u,d]=g(this,Te).subarray(2,6),g(this,Ui).push(NaN,NaN,NaN,NaN,((a+u)/2-r)/o,((c+d)/2-i)/s),[a,c,v,k]=g(this,Te).subarray(14,18),g(this,$o).push(NaN,NaN,NaN,NaN,((v+a)/2-r)/o,((k+c)/2-i)/s),!0):([v,k,a,c,u,d]=g(this,Te).subarray(0,6),g(this,Ui).push(((v+5*a)/6-r)/o,((k+5*c)/6-i)/s,((5*a+u)/6-r)/o,((5*c+d)/6-i)/s,((a+u)/2-r)/o,((c+d)/2-i)/s),[u,d,a,c,v,k]=g(this,Te).subarray(12,18),g(this,$o).push(((v+5*a)/6-r)/o,((k+5*c)/6-i)/s,((5*a+u)/6-r)/o,((5*c+d)/6-i)/s,((a+u)/2-r)/o,((c+d)/2-i)/s),!0))}toSVGPath(){if(this.isEmpty())return"";const e=g(this,Ui),t=g(this,$o),r=g(this,Te).subarray(4,6),i=g(this,Te).subarray(16,18),[o,s,a,c]=g(this,Hi),[u,d,f,h]=x(this,d1,$v).call(this);if(isNaN(g(this,Te)[6])&&!this.isEmpty())return`M${(g(this,Te)[2]-o)/a} ${(g(this,Te)[3]-s)/c} L${(g(this,Te)[4]-o)/a} ${(g(this,Te)[5]-s)/c} L${u} ${d} L${f} ${h} L${(g(this,Te)[16]-o)/a} ${(g(this,Te)[17]-s)/c} L${(g(this,Te)[14]-o)/a} ${(g(this,Te)[15]-s)/c} Z`;const p=[];p.push(`M${e[4]} ${e[5]}`);for(let m=6;m<e.length;m+=6)isNaN(e[m])?p.push(`L${e[m+4]} ${e[m+5]}`):p.push(`C${e[m]} ${e[m+1]} ${e[m+2]} ${e[m+3]} ${e[m+4]} ${e[m+5]}`);p.push(`L${(r[0]-o)/a} ${(r[1]-s)/c} L${u} ${d} L${f} ${h} L${(i[0]-o)/a} ${(i[1]-s)/c}`);for(let m=t.length-6;m>=6;m-=6)isNaN(t[m])?p.push(`L${t[m+4]} ${t[m+5]}`):p.push(`C${t[m]} ${t[m+1]} ${t[m+2]} ${t[m+3]} ${t[m+4]} ${t[m+5]}`);return p.push(`L${t[4]} ${t[5]} Z`),p.join(" ")}getOutlines(){var w;const e=g(this,Ui),t=g(this,$o),r=g(this,Te),i=r.subarray(4,6),o=r.subarray(16,18),[s,a,c,u]=g(this,Hi),d=new Float64Array((((w=g(this,ma))==null?void 0:w.length)??0)+2);for(let v=0,k=d.length-2;v<k;v+=2)d[v]=(g(this,ma)[v]-s)/c,d[v+1]=(g(this,ma)[v+1]-a)/u;d[d.length-2]=(g(this,h0)-s)/c,d[d.length-1]=(g(this,p0)-a)/u;const[f,h,p,m]=x(this,d1,$v).call(this);if(isNaN(r[6])&&!this.isEmpty()){const v=new Float64Array(36);return v.set([NaN,NaN,NaN,NaN,(r[2]-s)/c,(r[3]-a)/u,NaN,NaN,NaN,NaN,(r[4]-s)/c,(r[5]-a)/u,NaN,NaN,NaN,NaN,f,h,NaN,NaN,NaN,NaN,p,m,NaN,NaN,NaN,NaN,(r[16]-s)/c,(r[17]-a)/u,NaN,NaN,NaN,NaN,(r[14]-s)/c,(r[15]-a)/u],0),new G4(v,d,g(this,Hi),g(this,Ru),g(this,Lu),g(this,Bu))}const y=new Float64Array(g(this,Ui).length+24+g(this,$o).length);let b=e.length;for(let v=0;v<b;v+=2)isNaN(e[v])?y[v]=y[v+1]=NaN:(y[v]=e[v],y[v+1]=e[v+1]);y.set([NaN,NaN,NaN,NaN,(i[0]-s)/c,(i[1]-a)/u,NaN,NaN,NaN,NaN,f,h,NaN,NaN,NaN,NaN,p,m,NaN,NaN,NaN,NaN,(o[0]-s)/c,(o[1]-a)/u],b),b+=24;for(let v=t.length-6;v>=6;v-=6)for(let k=0;k<6;k+=2)isNaN(t[v+k])?(y[b]=y[b+1]=NaN,b+=2):(y[b]=t[v+k],y[b+1]=t[v+k+1],b+=2);return y.set([NaN,NaN,NaN,NaN,t[4],t[5]],b),new G4(y,d,g(this,Hi),g(this,Ru),g(this,Lu),g(this,Bu))}};Hi=new WeakMap,$o=new WeakMap,Lu=new WeakMap,Bu=new WeakMap,Ui=new WeakMap,Te=new WeakMap,h0=new WeakMap,p0=new WeakMap,l1=new WeakMap,c1=new WeakMap,Ru=new WeakMap,$u=new WeakMap,ma=new WeakMap,u1=new WeakMap,wy=new WeakMap,vy=new WeakMap,d1=new WeakSet,$v=function(){const e=g(this,Te).subarray(4,6),t=g(this,Te).subarray(16,18),[r,i,o,s]=g(this,Hi);return[(g(this,h0)+(e[0]-t[0])/2-r)/o,(g(this,p0)+(e[1]-t[1])/2-i)/s,(g(this,h0)+(t[0]-e[0])/2-r)/o,(g(this,p0)+(t[1]-e[1])/2-i)/s]},M(Fo,u1,8),M(Fo,wy,2),M(Fo,vy,g(Fo,u1)+g(Fo,wy));let mm=Fo;class G4 extends iE{constructor(t,r,i,o,s,a){super();M(this,g0);M(this,y0);M(this,Cy);M(this,Fu,void 0);M(this,m0,null);M(this,Vo,void 0);M(this,f1,void 0);M(this,ur,void 0);M(this,h1,void 0);M(this,bt,void 0);A(this,bt,t),A(this,ur,r),A(this,Fu,i),A(this,h1,o),A(this,Vo,s),A(this,f1,a),x(this,Cy,ZN).call(this,a);const{x:c,y:u,width:d,height:f}=g(this,m0);for(let h=0,p=t.length;h<p;h+=2)t[h]=(t[h]-c)/d,t[h+1]=(t[h+1]-u)/f;for(let h=0,p=r.length;h<p;h+=2)r[h]=(r[h]-c)/d,r[h+1]=(r[h+1]-u)/f}toSVGPath(){const t=[`M${g(this,bt)[4]} ${g(this,bt)[5]}`];for(let r=6,i=g(this,bt).length;r<i;r+=6)isNaN(g(this,bt)[r])?t.push(`L${g(this,bt)[r+4]} ${g(this,bt)[r+5]}`):t.push(`C${g(this,bt)[r]} ${g(this,bt)[r+1]} ${g(this,bt)[r+2]} ${g(this,bt)[r+3]} ${g(this,bt)[r+4]} ${g(this,bt)[r+5]}`);return t.push("Z"),t.join(" ")}serialize([t,r,i,o],s){const a=i-t,c=o-r;let u,d;switch(s){case 0:u=x(this,g0,J1).call(this,g(this,bt),t,o,a,-c),d=x(this,g0,J1).call(this,g(this,ur),t,o,a,-c);break;case 90:u=x(this,y0,ep).call(this,g(this,bt),t,r,a,c),d=x(this,y0,ep).call(this,g(this,ur),t,r,a,c);break;case 180:u=x(this,g0,J1).call(this,g(this,bt),i,r,-a,c),d=x(this,g0,J1).call(this,g(this,ur),i,r,-a,c);break;case 270:u=x(this,y0,ep).call(this,g(this,bt),i,o,-a,-c),d=x(this,y0,ep).call(this,g(this,ur),i,o,-a,-c)}return{outline:Array.from(u),points:[Array.from(d)]}}get box(){return g(this,m0)}getNewOutline(t,r){const{x:i,y:o,width:s,height:a}=g(this,m0),[c,u,d,f]=g(this,Fu),h=s*d,p=a*f,m=i*d+c,y=o*f+u,b=new mm({x:g(this,ur)[0]*h+m,y:g(this,ur)[1]*p+y},g(this,Fu),g(this,h1),t,g(this,f1),r??g(this,Vo));for(let w=2;w<g(this,ur).length;w+=2)b.add({x:g(this,ur)[w]*h+m,y:g(this,ur)[w+1]*p+y});return b.getOutlines()}}Fu=new WeakMap,m0=new WeakMap,Vo=new WeakMap,f1=new WeakMap,ur=new WeakMap,h1=new WeakMap,bt=new WeakMap,g0=new WeakSet,J1=function(t,r,i,o,s){const a=new Float64Array(t.length);for(let c=0,u=t.length;c<u;c+=2)a[c]=r+t[c]*o,a[c+1]=i+t[c+1]*s;return a},y0=new WeakSet,ep=function(t,r,i,o,s){const a=new Float64Array(t.length);for(let c=0,u=t.length;c<u;c+=2)a[c]=r+t[c+1]*o,a[c+1]=i+t[c]*s;return a},Cy=new WeakSet,ZN=function(t){const r=g(this,bt);let i=r[4],o=r[5],s=i,a=o,c=i,u=o,d=i,f=o;const h=t?Math.max:Math.min;for(let w=6,v=r.length;w<v;w+=6){if(isNaN(r[w]))s=Math.min(s,r[w+4]),a=Math.min(a,r[w+5]),c=Math.max(c,r[w+4]),u=Math.max(u,r[w+5]),f<r[w+5]?(d=r[w+4],f=r[w+5]):f===r[w+5]&&(d=h(d,r[w+4]));else{const k=se.bezierBoundingBox(i,o,...r.slice(w,w+6));s=Math.min(s,k[0]),a=Math.min(a,k[1]),c=Math.max(c,k[2]),u=Math.max(u,k[3]),f<k[3]?(d=k[2],f=k[3]):f===k[3]&&(d=h(d,k[2]))}i=r[w+4],o=r[w+5]}const p=s-g(this,Vo),m=a-g(this,Vo),y=c-s+2*g(this,Vo),b=u-a+2*g(this,Vo);A(this,m0,{x:p,y:m,width:y,height:b,lastPoint:[d,f]})};const zo=class zo{constructor({editor:e=null,uiManager:t=null}){M(this,w1);M(this,v1);M(this,ky);M(this,jo);M(this,Sy);M(this,Zi);M(this,p1,x(this,ky,WN).bind(this));M(this,m1,x(this,Sy,KN).bind(this));M(this,si,null);M(this,b0,null);M(this,Vu,void 0);M(this,Dt,null);M(this,g1,!1);M(this,ju,!1);M(this,y1,null);M(this,b1,void 0);M(this,ai,null);M(this,zu,void 0);var r;e?(A(this,ju,!1),A(this,zu,de.HIGHLIGHT_COLOR),A(this,y1,e)):(A(this,ju,!0),A(this,zu,de.HIGHLIGHT_DEFAULT_COLOR)),A(this,ai,(e==null?void 0:e._uiManager)||t),A(this,b1,g(this,ai)._eventBus),A(this,Vu,(e==null?void 0:e.color)||((r=g(this,ai))==null?void 0:r.highlightColors.values().next().value)||"#FFFF98")}static get _keyboardManager(){return Ie(this,"_keyboardManager",new c2([[["Escape","mac+Escape"],zo.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],zo.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],zo.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],zo.prototype._moveToPrevious],[["Home","mac+Home"],zo.prototype._moveToBeginning],[["End","mac+End"],zo.prototype._moveToEnd]]))}renderButton(){const e=A(this,si,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.setAttribute("aria-haspopup",!0);const t=g(this,ai)._signal;e.addEventListener("click",x(this,jo,R0).bind(this),{signal:t}),e.addEventListener("keydown",g(this,p1),{signal:t});const r=A(this,b0,document.createElement("span"));return r.className="swatch",r.setAttribute("aria-hidden",!0),r.style.backgroundColor=g(this,Vu),e.append(r),e}renderMainDropdown(){const e=A(this,Dt,x(this,w1,Fv).call(this));return e.setAttribute("aria-orientation","horizontal"),e.setAttribute("aria-labelledby","highlightColorPickerLabel"),e}_colorSelectFromKeyboard(e){if(e.target===g(this,si)){x(this,jo,R0).call(this,e);return}const t=e.target.getAttribute("data-color");t&&x(this,v1,Vv).call(this,t,e)}_moveToNext(e){var t,r;g(this,Zi,Oa)?e.target!==g(this,si)?(t=e.target.nextSibling)==null||t.focus():(r=g(this,Dt).firstChild)==null||r.focus():x(this,jo,R0).call(this,e)}_moveToPrevious(e){var t,r;e.target!==((t=g(this,Dt))==null?void 0:t.firstChild)&&e.target!==g(this,si)?(g(this,Zi,Oa)||x(this,jo,R0).call(this,e),(r=e.target.previousSibling)==null||r.focus()):g(this,Zi,Oa)&&this._hideDropdownFromKeyboard()}_moveToBeginning(e){var t;g(this,Zi,Oa)?(t=g(this,Dt).firstChild)==null||t.focus():x(this,jo,R0).call(this,e)}_moveToEnd(e){var t;g(this,Zi,Oa)?(t=g(this,Dt).lastChild)==null||t.focus():x(this,jo,R0).call(this,e)}hideDropdown(){var e;(e=g(this,Dt))==null||e.classList.add("hidden"),window.removeEventListener("pointerdown",g(this,m1))}_hideDropdownFromKeyboard(){var e;g(this,ju)||(g(this,Zi,Oa)?(this.hideDropdown(),g(this,si).focus({preventScroll:!0,focusVisible:g(this,g1)})):(e=g(this,y1))==null||e.unselect())}updateColor(e){if(g(this,b0)&&(g(this,b0).style.backgroundColor=e),!g(this,Dt))return;const t=g(this,ai).highlightColors.values();for(const r of g(this,Dt).children)r.setAttribute("aria-selected",t.next().value===e)}destroy(){var e,t;(e=g(this,si))==null||e.remove(),A(this,si,null),A(this,b0,null),(t=g(this,Dt))==null||t.remove(),A(this,Dt,null)}};p1=new WeakMap,m1=new WeakMap,si=new WeakMap,b0=new WeakMap,Vu=new WeakMap,Dt=new WeakMap,g1=new WeakMap,ju=new WeakMap,y1=new WeakMap,b1=new WeakMap,ai=new WeakMap,zu=new WeakMap,w1=new WeakSet,Fv=function(){const e=document.createElement("div"),t=g(this,ai)._signal;e.addEventListener("contextmenu",br,{signal:t}),e.className="dropdown",e.role="listbox",e.setAttribute("aria-multiselectable",!1),e.setAttribute("aria-orientation","vertical"),e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[r,i]of g(this,ai).highlightColors){const o=document.createElement("button");o.tabIndex="0",o.role="option",o.setAttribute("data-color",i),o.title=r,o.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${r}`);const s=document.createElement("span");o.append(s),s.className="swatch",s.style.backgroundColor=i,o.setAttribute("aria-selected",i===g(this,Vu)),o.addEventListener("click",x(this,v1,Vv).bind(this,i),{signal:t}),e.append(o)}return e.addEventListener("keydown",g(this,p1),{signal:t}),e},v1=new WeakSet,Vv=function(e,t){t.stopPropagation(),g(this,b1).dispatch("switchannotationeditorparams",{source:this,type:g(this,zu),value:e})},ky=new WeakSet,WN=function(e){zo._keyboardManager.exec(this,e)},jo=new WeakSet,R0=function(e){if(g(this,Zi,Oa)){this.hideDropdown();return}if(A(this,g1,e.detail===0),window.addEventListener("pointerdown",g(this,m1),{signal:g(this,ai)._signal}),g(this,Dt)){g(this,Dt).classList.remove("hidden");return}const t=A(this,Dt,x(this,w1,Fv).call(this));g(this,si).append(t)},Sy=new WeakSet,KN=function(e){var t;(t=g(this,Dt))!=null&&t.contains(e.target)||this.hideDropdown()},Zi=new WeakSet,Oa=function(){return g(this,Dt)&&!g(this,Dt).classList.contains("hidden")};let gm=zo;const Pe=class Pe extends je{constructor(t){super({...t,name:"highlightEditor"});M(this,E1);M(this,A1);M(this,My);M(this,Ey);M(this,Ay);M(this,T1);M(this,k0);M(this,Ty);M(this,Ku);M(this,S0);M(this,xy);M(this,Iy);M(this,Hu,null);M(this,C1,0);M(this,ga,void 0);M(this,w0,null);M(this,Uu,null);M(this,_r,null);M(this,k1,null);M(this,S1,0);M(this,v0,null);M(this,li,null);M(this,En,null);M(this,dr,!1);M(this,Zu,null);M(this,C0,void 0);M(this,Nt,null);M(this,Wu,"");M(this,Wi,void 0);M(this,M1,"");this.color=t.color||Pe._defaultColor,A(this,Wi,t.thickness||Pe._defaultThickness),A(this,C0,t.opacity||Pe._defaultOpacity),A(this,ga,t.boxes||null),A(this,M1,t.methodOfCreation||""),A(this,Wu,t.text||""),this._isDraggable=!1,t.highlightId>-1?(A(this,dr,!0),x(this,A1,zv).call(this,t),x(this,k0,tp).call(this)):(A(this,Hu,t.anchorNode),A(this,C1,t.anchorOffset),A(this,k1,t.focusNode),A(this,S1,t.focusOffset),x(this,E1,jv).call(this),x(this,k0,tp).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const t=Pe.prototype;return Ie(this,"_keyboardManager",new c2([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:g(this,dr)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:g(this,Wi),methodOfCreation:g(this,M1)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,r){var i;je.initialize(t,r),Pe._defaultColor||(Pe._defaultColor=((i=r.highlightColors)==null?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,r){switch(t){case de.HIGHLIGHT_DEFAULT_COLOR:Pe._defaultColor=r;break;case de.HIGHLIGHT_THICKNESS:Pe._defaultThickness=r}}translateInPage(t,r){}get toolbarPosition(){return g(this,Zu)}updateParams(t,r){switch(t){case de.HIGHLIGHT_COLOR:x(this,My,qN).call(this,r);break;case de.HIGHLIGHT_THICKNESS:x(this,Ey,GN).call(this,r)}}static get defaultPropertiesToUpdate(){return[[de.HIGHLIGHT_DEFAULT_COLOR,Pe._defaultColor],[de.HIGHLIGHT_THICKNESS,Pe._defaultThickness]]}get propertiesToUpdate(){return[[de.HIGHLIGHT_COLOR,this.color||Pe._defaultColor],[de.HIGHLIGHT_THICKNESS,g(this,Wi)||Pe._defaultThickness],[de.HIGHLIGHT_FREE,g(this,dr)]]}async addEditToolbar(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(A(this,Uu,new gm({editor:this})),t.addColorPicker(g(this,Uu))),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(x(this,S0,np).call(this))}getBaseTranslation(){return[0,0]}getRect(t,r){return super.getRect(t,r,x(this,S0,np).call(this))}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){x(this,T1,Hv).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(x(this,k0,tp).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var i;let r=!1;this.parent&&!t?x(this,T1,Hv).call(this):t&&(x(this,k0,tp).call(this,t),r=!this.parent&&((i=this.div)==null?void 0:i.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),r&&this.select()}rotate(t){var o,s,a;const{drawLayer:r}=this.parent;let i;g(this,dr)?(t=(t-this.rotation+360)%360,i=x(o=Pe,ya,pd).call(o,g(this,li).box,t)):i=x(s=Pe,ya,pd).call(s,this,t),r.rotate(g(this,En),t),r.rotate(g(this,Nt),t),r.updateBox(g(this,En),i),r.updateBox(g(this,Nt),x(a=Pe,ya,pd).call(a,g(this,_r).box,t))}render(){if(this.div)return this.div;const t=super.render();g(this,Wu)&&(t.setAttribute("aria-label",g(this,Wu)),t.setAttribute("role","mark")),g(this,dr)?t.classList.add("free"):this.div.addEventListener("keydown",x(this,Ty,QN).bind(this),{signal:this._uiManager._signal});const r=A(this,v0,document.createElement("div"));t.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",r.style.clipPath=g(this,w0);const[i,o]=this.parentDimensions;return this.setDims(this.width*i,this.height*o),am(this,g(this,v0),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(g(this,Nt),"hovered")}pointerleave(){this.parent.drawLayer.removeClass(g(this,Nt),"hovered")}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:x(this,Ku,g5).call(this,!0);break;case 1:case 3:x(this,Ku,g5).call(this,!1)}}select(){var t,r;super.select(),g(this,Nt)&&((t=this.parent)==null||t.drawLayer.removeClass(g(this,Nt),"hovered"),(r=this.parent)==null||r.drawLayer.addClass(g(this,Nt),"selected"))}unselect(){var t;super.unselect(),g(this,Nt)&&((t=this.parent)==null||t.drawLayer.removeClass(g(this,Nt),"selected"),g(this,dr)||x(this,Ku,g5).call(this,!1))}get _mustFixPosition(){return!g(this,dr)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(g(this,En),t),this.parent.drawLayer.show(g(this,Nt),t))}static startHighlighting(t,r,{target:i,x:o,y:s}){const{x:a,y:c,width:u,height:d}=i.getBoundingClientRect(),f=new AbortController,h=t.combinedSignal(f),p=m=>{f.abort(),x(this,Dy,tP).call(this,t,m)};window.addEventListener("blur",p,{signal:h}),window.addEventListener("pointerup",p,{signal:h}),window.addEventListener("pointerdown",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,passive:!1,signal:h}),window.addEventListener("contextmenu",br,{signal:h}),i.addEventListener("pointermove",x(this,Oy,eP).bind(this,t),{signal:h}),this._freeHighlight=new mm({x:o,y:s},[a,c,u,d],t.scale,this._defaultThickness/2,r,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static deserialize(t,r,i){var y;const o=super.deserialize(t,r,i),{rect:[s,a,c,u],color:d,quadPoints:f}=t;o.color=se.makeHexColor(...d),A(o,C0,t.opacity);const[h,p]=o.pageDimensions;o.width=(c-s)/h,o.height=(u-a)/p;const m=A(o,ga,[]);for(let b=0;b<f.length;b+=8)m.push({x:(f[4]-c)/h,y:(u-(1-f[b+5]))/p,width:(f[b+2]-f[b])/h,height:(f[b+5]-f[b+1])/p});return x(y=o,E1,jv).call(y),o}serialize(t=!1){if(this.isEmpty()||t)return null;const r=this.getRect(0,0),i=je._colorManager.convert(this.color);return{annotationType:Ae.HIGHLIGHT,color:i,opacity:g(this,C0),thickness:g(this,Wi),quadPoints:x(this,xy,XN).call(this),outlines:x(this,Iy,JN).call(this,r),pageIndex:this.pageIndex,rect:r,rotation:x(this,S0,np).call(this),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}};Hu=new WeakMap,C1=new WeakMap,ga=new WeakMap,w0=new WeakMap,Uu=new WeakMap,_r=new WeakMap,k1=new WeakMap,S1=new WeakMap,v0=new WeakMap,li=new WeakMap,En=new WeakMap,dr=new WeakMap,Zu=new WeakMap,C0=new WeakMap,Nt=new WeakMap,Wu=new WeakMap,Wi=new WeakMap,M1=new WeakMap,E1=new WeakSet,jv=function(){const t=new rE(g(this,ga),.001);A(this,li,t.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=g(this,li).box;const r=new rE(g(this,ga),.0025,.001,this._uiManager.direction==="ltr");A(this,_r,r.getOutlines());const{lastPoint:i}=g(this,_r).box;A(this,Zu,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])},A1=new WeakSet,zv=function({highlightOutlines:t,highlightId:r,clipPathId:i}){var d,f;if(A(this,li,t),A(this,_r,t.getNewOutline(g(this,Wi)/2+1.5,.0025)),r>=0)A(this,En,r),A(this,w0,i),this.parent.drawLayer.finalizeLine(r,t),A(this,Nt,this.parent.drawLayer.highlightOutline(g(this,_r)));else if(this.parent){const h=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(g(this,En),t),this.parent.drawLayer.updateBox(g(this,En),x(d=Pe,ya,pd).call(d,g(this,li).box,(h-this.rotation+360)%360)),this.parent.drawLayer.updateLine(g(this,Nt),g(this,_r)),this.parent.drawLayer.updateBox(g(this,Nt),x(f=Pe,ya,pd).call(f,g(this,_r).box,h))}const{x:o,y:s,width:a,height:c}=t.box;switch(this.rotation){case 0:this.x=o,this.y=s,this.width=a,this.height=c;break;case 90:{const[h,p]=this.parentDimensions;this.x=s,this.y=1-o,this.width=a*p/h,this.height=c*h/p;break}case 180:this.x=1-o,this.y=1-s,this.width=a,this.height=c;break;case 270:{const[h,p]=this.parentDimensions;this.x=1-s,this.y=o,this.width=a*p/h,this.height=c*h/p;break}}const{lastPoint:u}=g(this,_r).box;A(this,Zu,[(u[0]-o)/a,(u[1]-s)/c])},My=new WeakSet,qN=function(t){const r=o=>{var s,a;this.color=o,(s=this.parent)==null||s.drawLayer.changeColor(g(this,En),o),(a=g(this,Uu))==null||a.updateColor(o)},i=this.color;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)},Ey=new WeakSet,GN=function(t){const r=g(this,Wi),i=o=>{A(this,Wi,o),x(this,Ay,YN).call(this,o)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)},Ay=new WeakSet,YN=function(t){if(!g(this,dr))return;x(this,A1,zv).call(this,{highlightOutlines:g(this,li).getNewOutline(t/2)}),this.fixAndSetPosition();const[r,i]=this.parentDimensions;this.setDims(this.width*r,this.height*i)},T1=new WeakSet,Hv=function(){g(this,En)!==null&&this.parent&&(this.parent.drawLayer.remove(g(this,En)),A(this,En,null),this.parent.drawLayer.remove(g(this,Nt)),A(this,Nt,null))},k0=new WeakSet,tp=function(t=this.parent){g(this,En)===null&&({id:qn(this,En)._,clipPathId:qn(this,w0)._}=t.drawLayer.highlight(g(this,li),this.color,g(this,C0)),A(this,Nt,t.drawLayer.highlightOutline(g(this,_r))),g(this,v0)&&(g(this,v0).style.clipPath=g(this,w0)))},ya=new WeakSet,pd=function({x:t,y:r,width:i,height:o},s){switch(s){case 90:return{x:1-r-o,y:t,width:o,height:i};case 180:return{x:1-t-i,y:1-r-o,width:i,height:o};case 270:return{x:r,y:1-t-i,width:o,height:i}}return{x:t,y:r,width:i,height:o}},Ty=new WeakSet,QN=function(t){Pe._keyboardManager.exec(this,t)},Ku=new WeakSet,g5=function(t){if(!g(this,Hu))return;const r=window.getSelection();t?r.setPosition(g(this,Hu),g(this,C1)):r.setPosition(g(this,k1),g(this,S1))},S0=new WeakSet,np=function(){return g(this,dr)?this.rotation:0},xy=new WeakSet,XN=function(){if(g(this,dr))return null;const[t,r]=this.pageDimensions,[i,o]=this.pageTranslation,s=g(this,ga),a=new Float32Array(8*s.length);let c=0;for(const{x:u,y:d,width:f,height:h}of s){const p=u*t+i,m=(1-d-h)*r+o;a[c]=a[c+4]=p,a[c+1]=a[c+3]=m,a[c+2]=a[c+6]=p+f*t,a[c+5]=a[c+7]=m+h*r,c+=8}return a},Iy=new WeakSet,JN=function(t){return g(this,li).serialize(t,x(this,S0,np).call(this))},Oy=new WeakSet,eP=function(t,r){this._freeHighlight.add(r)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},Dy=new WeakSet,tP=function(t,r){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(this._freeHighlightId):t.createAndAddNewEditor(r,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},M(Pe,ya),M(Pe,Oy),M(Pe,Dy),fe(Pe,"_defaultColor",null),fe(Pe,"_defaultOpacity",1),fe(Pe,"_defaultThickness",12),fe(Pe,"_l10nPromise"),fe(Pe,"_type","highlight"),fe(Pe,"_editorType",Ae.HIGHLIGHT),fe(Pe,"_freeHighlightId",-1),fe(Pe,"_freeHighlight",null),fe(Pe,"_freeHighlightClipId","");let ym=Pe;const Je=class Je extends je{constructor(t){super({...t,name:"inkEditor"});M(this,Ny);M(this,Py);M(this,_y);M(this,Ly);M(this,x1);M(this,By);M(this,I1);M(this,Ry);M(this,$y);M(this,Fy);M(this,Vy);M(this,jy);M(this,Zo);M(this,O1);M(this,D1);M(this,N1);M(this,Gu);M(this,Yu);M(this,wa);M(this,P1);M(this,Qu);M(this,Uy);M(this,L1);M(this,Xu);M(this,D0);M(this,M0,0);M(this,E0,0);M(this,Ki,null);M(this,Ho,new Path2D);M(this,Lr,!1);M(this,A0,null);M(this,T0,!1);M(this,x0,!1);M(this,Uo,null);M(this,qu,null);M(this,I0,0);M(this,O0,0);M(this,ba,null);this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(t,r){je.initialize(t,r)}static updateDefaultParams(t,r){switch(t){case de.INK_THICKNESS:Je._defaultThickness=r;break;case de.INK_COLOR:Je._defaultColor=r;break;case de.INK_OPACITY:Je._defaultOpacity=r/100}}updateParams(t,r){switch(t){case de.INK_THICKNESS:x(this,Ny,nP).call(this,r);break;case de.INK_COLOR:x(this,Py,rP).call(this,r);break;case de.INK_OPACITY:x(this,_y,iP).call(this,r)}}static get defaultPropertiesToUpdate(){return[[de.INK_THICKNESS,Je._defaultThickness],[de.INK_COLOR,Je._defaultColor||je._defaultLineColor],[de.INK_OPACITY,Math.round(100*Je._defaultOpacity)]]}get propertiesToUpdate(){return[[de.INK_THICKNESS,this.thickness||Je._defaultThickness],[de.INK_COLOR,this.color||Je._defaultColor||je._defaultLineColor],[de.INK_OPACITY,Math.round(100*(this.opacity??Je._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(x(this,Gu,y5).call(this),x(this,Yu,b5).call(this)),this.isAttachedToDOM||(this.parent.add(this),x(this,wa,md).call(this)),x(this,D0,rp).call(this)))}remove(){var t;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,g(this,Ki)&&(clearTimeout(g(this,Ki)),A(this,Ki,null)),(t=g(this,Uo))==null||t.disconnect(),A(this,Uo,null),super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&t===null&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,r]=this.parentDimensions,i=this.width*t,o=this.height*r;this.setDimensions(i,o)}enableEditMode(){!g(this,Lr)&&this.canvas!==null&&(super.enableEditMode(),this._isDraggable=!1,x(this,O1,Wv).call(this))}disableEditMode(){this.isInEditMode()&&this.canvas!==null&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),x(this,D1,Kv).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){g(this,Lr)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),A(this,Lr,!0),this.div.classList.add("disabled"),x(this,D0,rp).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){t.button===0&&this.isInEditMode()&&!g(this,Lr)&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),x(this,By,sP).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),x(this,I1,Zv).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),x(this,N1,qv).call(this,t)}canvasPointerleave(t){x(this,N1,qv).call(this,t)}get isResizable(){return!this.isEmpty()&&g(this,Lr)}render(){if(this.div)return this.div;let t,r;this.width&&(t=this.x,r=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,o,s,a]=x(this,Ly,oP).call(this);if(this.setAt(i,o,0,0),this.setDims(s,a),x(this,Gu,y5).call(this),this.width){const[c,u]=this.parentDimensions;this.setAspectRatio(this.width*c,this.height*u),this.setAt(t*c,r*u,this.width*c,this.height*u),A(this,x0,!0),x(this,wa,md).call(this),this.setDims(this.width*c,this.height*u),x(this,Zo,$0).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return x(this,Yu,b5).call(this),this.div}setDimensions(t,r){const i=Math.round(t),o=Math.round(r);if(g(this,I0)===i&&g(this,O0)===o)return;A(this,I0,i),A(this,O0,o),this.canvas.style.visibility="hidden";const[s,a]=this.parentDimensions;this.width=t/s,this.height=r/a,this.fixAndSetPosition(),g(this,Lr)&&x(this,P1,Gv).call(this,t,r),x(this,wa,md).call(this),x(this,Zo,$0).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(t,r,i){var b,w,v;if(t instanceof tE)return null;const o=super.deserialize(t,r,i);o.thickness=t.thickness,o.color=se.makeHexColor(...t.color),o.opacity=t.opacity;const[s,a]=o.pageDimensions,c=o.width*s,u=o.height*a,d=o.parentScale,f=t.thickness/2;A(o,Lr,!0),A(o,I0,Math.round(c)),A(o,O0,Math.round(u));const{paths:h,rect:p,rotation:m}=t;for(let{bezier:k}of h){k=x(b=Je,Hy,hP).call(b,k,p,m);const C=[];o.paths.push(C);let T=d*(k[0]-f),S=d*(k[1]-f);for(let O=2,I=k.length;O<I;O+=6){const P=d*(k[O]-f),D=d*(k[O+1]-f),L=d*(k[O+2]-f),B=d*(k[O+3]-f),F=d*(k[O+4]-f),R=d*(k[O+5]-f);C.push([[T,S],[P,D],[L,B],[F,R]]),T=F,S=R}const E=x(this,zy,fP).call(this,C);o.bezierPath2D.push(E)}const y=x(w=o,L1,Qv).call(w);return A(o,E0,Math.max(je.MIN_SIZE,y[2]-y[0])),A(o,M0,Math.max(je.MIN_SIZE,y[3]-y[1])),x(v=o,P1,Gv).call(v,c,u),o}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),r=je._colorManager.convert(this.ctx.strokeStyle);return{annotationType:Ae.INK,color:r,thickness:this.thickness,opacity:this.opacity,paths:x(this,Uy,pP).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};M0=new WeakMap,E0=new WeakMap,Ki=new WeakMap,Ho=new WeakMap,Lr=new WeakMap,A0=new WeakMap,T0=new WeakMap,x0=new WeakMap,Uo=new WeakMap,qu=new WeakMap,I0=new WeakMap,O0=new WeakMap,ba=new WeakMap,Ny=new WeakSet,nP=function(t){const r=o=>{this.thickness=o,x(this,D0,rp).call(this)},i=this.thickness;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},Py=new WeakSet,rP=function(t){const r=o=>{this.color=o,x(this,Zo,$0).call(this)},i=this.color;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},_y=new WeakSet,iP=function(t){const r=o=>{this.opacity=o,x(this,Zo,$0).call(this)};t/=100;const i=this.opacity;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:de.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Ly=new WeakSet,oP=function(){const{parentRotation:t,parentDimensions:[r,i]}=this;switch(t){case 90:return[0,i,i,r];case 180:return[r,i,r,i];case 270:return[r,0,i,r];default:return[0,0,r,i]}},x1=new WeakSet,Uv=function(){const{ctx:t,color:r,opacity:i,thickness:o,parentScale:s,scaleFactor:a}=this;t.lineWidth=o*s/a,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${r}${function(u){return Math.round(Math.min(255,Math.max(1,255*u))).toString(16).padStart(2,"0")}(i)}`},By=new WeakSet,sP=function(t,r){this.canvas.addEventListener("contextmenu",br,{signal:this._uiManager._signal}),x(this,D1,Kv).call(this),A(this,A0,new AbortController);const i=this._uiManager.combinedSignal(g(this,A0));this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:i}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:i}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:i}),this.isEditing=!0,g(this,x0)||(A(this,x0,!0),x(this,wa,md).call(this),this.thickness||(this.thickness=Je._defaultThickness),this.color||(this.color=Je._defaultColor||je._defaultLineColor),this.opacity??(this.opacity=Je._defaultOpacity)),this.currentPath.push([t,r]),A(this,T0,!1),x(this,x1,Uv).call(this),A(this,ba,()=>{x(this,Fy,cP).call(this),g(this,ba)&&window.requestAnimationFrame(g(this,ba))}),window.requestAnimationFrame(g(this,ba))},I1=new WeakSet,Zv=function(t,r){const[i,o]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&r===o)return;const s=this.currentPath;let a=g(this,Ho);s.push([t,r]),A(this,T0,!0),s.length<=2?(a.moveTo(...s[0]),a.lineTo(t,r)):(s.length===3&&(A(this,Ho,a=new Path2D),a.moveTo(...s[0])),x(this,Vy,uP).call(this,a,...s.at(-3),...s.at(-2),t,r))},Ry=new WeakSet,aP=function(){if(this.currentPath.length===0)return;const t=this.currentPath.at(-1);g(this,Ho).lineTo(...t)},$y=new WeakSet,lP=function(t,r){A(this,ba,null),t=Math.min(Math.max(t,0),this.canvas.width),r=Math.min(Math.max(r,0),this.canvas.height),x(this,I1,Zv).call(this,t,r),x(this,Ry,aP).call(this);let i;if(this.currentPath.length!==1)i=x(this,jy,dP).call(this);else{const a=[t,r];i=[[a,a.slice(),a.slice(),a]]}const o=g(this,Ho),s=this.currentPath;this.currentPath=[],A(this,Ho,new Path2D),this.addCommands({cmd:()=>{this.allRawPaths.push(s),this.paths.push(i),this.bezierPath2D.push(o),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(x(this,Gu,y5).call(this),x(this,Yu,b5).call(this)),x(this,D0,rp).call(this))},mustExec:!0})},Fy=new WeakSet,cP=function(){if(!g(this,T0))return;A(this,T0,!1),Math.ceil(this.thickness*this.parentScale);const t=this.currentPath.slice(-3),r=t.map(s=>s[0]),i=t.map(s=>s[1]),{ctx:o}=(Math.min(...r),Math.max(...r),Math.min(...i),Math.max(...i),this);o.save(),o.clearRect(0,0,this.canvas.width,this.canvas.height);for(const s of this.bezierPath2D)o.stroke(s);o.stroke(g(this,Ho)),o.restore()},Vy=new WeakSet,uP=function(t,r,i,o,s,a,c){const u=(r+o)/2,d=(i+s)/2,f=(o+a)/2,h=(s+c)/2;t.bezierCurveTo(u+2*(o-u)/3,d+2*(s-d)/3,f+2*(o-f)/3,h+2*(s-h)/3,f,h)},jy=new WeakSet,dP=function(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const r=[];let i,[o,s]=t[0];for(i=1;i<t.length-2;i++){const[p,m]=t[i],[y,b]=t[i+1],w=(p+y)/2,v=(m+b)/2,k=[o+2*(p-o)/3,s+2*(m-s)/3],C=[w+2*(p-w)/3,v+2*(m-v)/3];r.push([[o,s],k,C,[w,v]]),[o,s]=[w,v]}const[a,c]=t[i],[u,d]=t[i+1],f=[o+2*(a-o)/3,s+2*(c-s)/3],h=[u+2*(a-u)/3,d+2*(c-d)/3];return r.push([[o,s],f,h,[u,d]]),r},Zo=new WeakSet,$0=function(){if(this.isEmpty()){x(this,Qu,w5).call(this);return}x(this,x1,Uv).call(this);const{canvas:t,ctx:r}=this;r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,t.width,t.height),x(this,Qu,w5).call(this);for(const i of this.bezierPath2D)r.stroke(i)},O1=new WeakSet,Wv=function(){if(g(this,qu))return;A(this,qu,new AbortController);const t=this._uiManager.combinedSignal(g(this,qu));this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:t})},D1=new WeakSet,Kv=function(){var t;(t=this.pointerdownAC)==null||t.abort(),this.pointerdownAC=null},N1=new WeakSet,qv=function(t){var r;(r=g(this,A0))==null||r.abort(),A(this,A0,null),x(this,O1,Wv).call(this),g(this,Ki)&&clearTimeout(g(this,Ki)),A(this,Ki,setTimeout(()=>{A(this,Ki,null),this.canvas.removeEventListener("contextmenu",br)},10)),x(this,$y,lP).call(this,t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()},Gu=new WeakSet,y5=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},Yu=new WeakSet,b5=function(){A(this,Uo,new ResizeObserver(t=>{const r=t[0].contentRect;r.width&&r.height&&this.setDimensions(r.width,r.height)})),g(this,Uo).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;(t=g(this,Uo))==null||t.disconnect(),A(this,Uo,null)},{once:!0})},wa=new WeakSet,md=function(){if(!g(this,x0))return;const[t,r]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*r),x(this,Qu,w5).call(this)},P1=new WeakSet,Gv=function(t,r){const i=x(this,Xu,v5).call(this),o=(t-i)/g(this,E0),s=(r-i)/g(this,M0);this.scaleFactor=Math.min(o,s)},Qu=new WeakSet,w5=function(){const t=x(this,Xu,v5).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)},zy=new WeakSet,fP=function(t){const r=new Path2D;for(let i=0,o=t.length;i<o;i++){const[s,a,c,u]=t[i];i===0&&r.moveTo(...s),r.bezierCurveTo(a[0],a[1],c[0],c[1],u[0],u[1])}return r},_1=new WeakSet,Yv=function(t,r,i){const[o,s,a,c]=r;switch(i){case 0:for(let u=0,d=t.length;u<d;u+=2)t[u]+=o,t[u+1]=c-t[u+1];break;case 90:for(let u=0,d=t.length;u<d;u+=2){const f=t[u];t[u]=t[u+1]+o,t[u+1]=f+s}break;case 180:for(let u=0,d=t.length;u<d;u+=2)t[u]=a-t[u],t[u+1]+=s;break;case 270:for(let u=0,d=t.length;u<d;u+=2){const f=t[u];t[u]=a-t[u+1],t[u+1]=c-f}break;default:throw new Error("Invalid rotation")}return t},Hy=new WeakSet,hP=function(t,r,i){const[o,s,a,c]=r;switch(i){case 0:for(let u=0,d=t.length;u<d;u+=2)t[u]-=o,t[u+1]=c-t[u+1];break;case 90:for(let u=0,d=t.length;u<d;u+=2){const f=t[u];t[u]=t[u+1]-s,t[u+1]=f-o}break;case 180:for(let u=0,d=t.length;u<d;u+=2)t[u]=a-t[u],t[u+1]-=s;break;case 270:for(let u=0,d=t.length;u<d;u+=2){const f=t[u];t[u]=c-t[u+1],t[u+1]=a-f}break;default:throw new Error("Invalid rotation")}return t},Uy=new WeakSet,pP=function(t,r,i,o){var d,f;const s=[],a=this.thickness/2,c=t*r+a,u=t*i+a;for(const h of this.paths){const p=[],m=[];for(let y=0,b=h.length;y<b;y++){const[w,v,k,C]=h[y];if(w[0]===C[0]&&w[1]===C[1]&&b===1){const B=t*w[0]+c,F=t*w[1]+u;p.push(B,F),m.push(B,F);break}const T=t*w[0]+c,S=t*w[1]+u,E=t*v[0]+c,O=t*v[1]+u,I=t*k[0]+c,P=t*k[1]+u,D=t*C[0]+c,L=t*C[1]+u;y===0&&(p.push(T,S),m.push(T,S)),p.push(E,O,I,P,D,L),m.push(E,O),y===b-1&&m.push(D,L)}s.push({bezier:x(d=Je,_1,Yv).call(d,p,o,this.rotation),points:x(f=Je,_1,Yv).call(f,m,o,this.rotation)})}return s},L1=new WeakSet,Qv=function(){let t=1/0,r=-1/0,i=1/0,o=-1/0;for(const s of this.paths)for(const[a,c,u,d]of s){const f=se.bezierBoundingBox(...a,...c,...u,...d);t=Math.min(t,f[0]),i=Math.min(i,f[1]),r=Math.max(r,f[2]),o=Math.max(o,f[3])}return[t,i,r,o]},Xu=new WeakSet,v5=function(){return g(this,Lr)?Math.ceil(this.thickness*this.parentScale):0},D0=new WeakSet,rp=function(t=!1){if(this.isEmpty())return;if(!g(this,Lr)){x(this,Zo,$0).call(this);return}const r=x(this,L1,Qv).call(this),i=x(this,Xu,v5).call(this);A(this,E0,Math.max(je.MIN_SIZE,r[2]-r[0])),A(this,M0,Math.max(je.MIN_SIZE,r[3]-r[1]));const o=Math.ceil(i+g(this,E0)*this.scaleFactor),s=Math.ceil(i+g(this,M0)*this.scaleFactor),[a,c]=this.parentDimensions;this.width=o/a,this.height=s/c,this.setAspectRatio(o,s);const u=this.translationX,d=this.translationY;this.translationX=-r[0],this.translationY=-r[1],x(this,wa,md).call(this),x(this,Zo,$0).call(this),A(this,I0,o),A(this,O0,s),this.setDims(o,s);const f=t?i/this.scaleFactor/2:0;this.translate(u-this.translationX-f,d-this.translationY-f)},M(Je,zy),M(Je,_1),M(Je,Hy),fe(Je,"_defaultColor",null),fe(Je,"_defaultOpacity",1),fe(Je,"_defaultThickness",1),fe(Je,"_type","ink"),fe(Je,"_editorType",Ae.INK);let Y4=Je;const V1=class V1 extends je{constructor(t){super({...t,name:"stampEditor"});M(this,N0);M(this,P0);M(this,ed);M(this,R1);M(this,Zy);M(this,$1);M(this,F1);M(this,td);M(this,Wy);M(this,wt,null);M(this,rn,null);M(this,va,null);M(this,Wo,null);M(this,Ca,null);M(this,Ju,"");M(this,qi,null);M(this,Ko,null);M(this,Gi,null);M(this,Br,!1);M(this,B1,!1);A(this,Wo,t.bitmapUrl),A(this,Ca,t.bitmapFile)}static initialize(t,r){je.initialize(t,r)}static get supportedTypes(){return Ie(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(t=>`image/${t}`))}static get supportedTypesStr(){return Ie(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,r){r.pasteEditor(Ae.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const r=t.get("hasAltText");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}async mlGuessAltText(t=null,r=!0){if(this.hasAltTextData())return null;const{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!await i.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:o,width:s,height:a}=t||this.copyCanvas(null,!0).imageData,c=await i.guess({name:"altText",request:{data:o,width:s,height:a,channels:o.length/(s*a)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");const u=c.output;return await this.setGuessedAltText(u),r&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}remove(){var t,r;g(this,rn)&&(A(this,wt,null),this._uiManager.imageManager.deleteId(g(this,rn)),(t=g(this,qi))==null||t.remove(),A(this,qi,null),(r=g(this,Ko))==null||r.disconnect(),A(this,Ko,null),g(this,Gi)&&(clearTimeout(g(this,Gi)),A(this,Gi,null))),super.remove()}rebuild(){this.parent?(super.rebuild(),this.div!==null&&(g(this,rn)&&g(this,qi)===null&&x(this,ed,C5).call(this),this.isAttachedToDOM||this.parent.add(this))):g(this,rn)&&x(this,ed,C5).call(this)}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(g(this,va)||g(this,wt)||g(this,Wo)||g(this,Ca)||g(this,rn))}get isResizable(){return!0}render(){if(this.div)return this.div;let t,r;if(this.width&&(t=this.x,r=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),g(this,wt)?x(this,R1,Xv).call(this):x(this,ed,C5).call(this),this.width){const[i,o]=this.parentDimensions;this.setAt(t*i,r*o,this.width*i,this.height*o)}return this.div}copyCanvas(t,r=!1){var b;t||(t=224);const{width:i,height:o}=g(this,wt),s=document.createElement("canvas");let a=g(this,wt),c=i,u=o;if(i>t||o>t){const w=Math.min(t/i,t/o);c=Math.floor(i*w),u=Math.floor(o*w),g(this,Br)||(a=x(this,$1,Jv).call(this,c,u))}s.width=c,s.height=u;const d=s.getContext("2d");d.filter=this._uiManager.hcmFilter;let f="white",h="#cfcfd8";this._uiManager.hcmFilter!=="none"?h="black":(b=window.matchMedia)!=null&&b.call(window,"(prefers-color-scheme: dark)").matches&&(f="#8f8f9d",h="#42414d");const p=15,m=new OffscreenCanvas(30,30),y=m.getContext("2d");if(y.fillStyle=f,y.fillRect(0,0,30,30),y.fillStyle=h,y.fillRect(0,0,p,p),y.fillRect(p,p,p,p),d.fillStyle=d.createPattern(m,"repeat"),d.fillRect(0,0,c,u),r){const w=new OffscreenCanvas(c,u),v=w.getContext("2d",{willReadFrequently:!0});v.drawImage(a,0,0,a.width,a.height,0,0,c,u);const k=v.getImageData(0,0,c,u).data;return d.drawImage(w,0,0),{canvas:s,imageData:{width:c,height:u,data:k}}}return d.drawImage(a,0,0,a.width,a.height,0,0,c,u),{canvas:s,imageData:null}}getImageForAltText(){return g(this,qi)}static deserialize(t,r,i){if(t instanceof nE)return null;const o=super.deserialize(t,r,i),{rect:s,bitmapUrl:a,bitmapId:c,isSvg:u,accessibilityData:d}=t;c&&i.imageManager.isValidId(c)?A(o,rn,c):A(o,Wo,a),A(o,Br,u);const[f,h]=o.pageDimensions;return o.width=(s[2]-s[0])/f,o.height=(s[3]-s[1])/h,d&&(o.altTextData=d),o}serialize(t=!1,r=null){if(this.isEmpty())return null;const i={annotationType:Ae.STAMP,bitmapId:g(this,rn),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:g(this,Br),structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=x(this,td,k5).call(this,!0),i.accessibilityData=this.serializeAltText(!0),i;const{decorative:o,altText:s}=this.serializeAltText(!1);if(!o&&s&&(i.accessibilityData={type:"Figure",alt:s}),r===null)return i;r.stamps||(r.stamps=new Map);const a=g(this,Br)?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(r.stamps.has(g(this,rn))){if(g(this,Br)){const c=r.stamps.get(g(this,rn));a>c.area&&(c.area=a,c.serialized.bitmap.close(),c.serialized.bitmap=x(this,td,k5).call(this,!1))}}else r.stamps.set(g(this,rn),{area:a,serialized:i}),i.bitmap=x(this,td,k5).call(this,!1);return i}};wt=new WeakMap,rn=new WeakMap,va=new WeakMap,Wo=new WeakMap,Ca=new WeakMap,Ju=new WeakMap,qi=new WeakMap,Ko=new WeakMap,Gi=new WeakMap,Br=new WeakMap,B1=new WeakMap,N0=new WeakSet,ip=function(t,r=!1){t?(A(this,wt,t.bitmap),r||(A(this,rn,t.id),A(this,Br,t.isSvg)),t.file&&A(this,Ju,t.file.name),x(this,R1,Xv).call(this)):this.remove()},P0=new WeakSet,op=function(){if(A(this,va,null),this._uiManager.enableWaiting(!1),g(this,qi))if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&g(this,wt))this._editToolbar.hide(),this._uiManager.editAltText(this,!0);else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&g(this,wt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},ed=new WeakSet,C5=function(){if(g(this,rn)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(g(this,rn)).then(i=>x(this,N0,ip).call(this,i,!0)).finally(()=>x(this,P0,op).call(this));return}if(g(this,Wo)){const i=g(this,Wo);A(this,Wo,null),this._uiManager.enableWaiting(!0),A(this,va,this._uiManager.imageManager.getFromUrl(i).then(o=>x(this,N0,ip).call(this,o)).finally(()=>x(this,P0,op).call(this)));return}if(g(this,Ca)){const i=g(this,Ca);A(this,Ca,null),this._uiManager.enableWaiting(!0),A(this,va,this._uiManager.imageManager.getFromFile(i).then(o=>x(this,N0,ip).call(this,o)).finally(()=>x(this,P0,op).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=V1.supportedTypesStr;const r=this._uiManager._signal;A(this,va,new Promise(i=>{t.addEventListener("change",async()=>{if(t.files&&t.files.length!==0){this._uiManager.enableWaiting(!0);const o=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),x(this,N0,ip).call(this,o)}else this.remove();i()},{signal:r}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:r})}).finally(()=>x(this,P0,op).call(this))),t.click()},R1=new WeakSet,Xv=function(){const{div:t}=this;let{width:r,height:i}=g(this,wt);const[o,s]=this.pageDimensions,a=.75;if(this.width)r=this.width*o,i=this.height*s;else if(r>a*o||i>a*s){const f=Math.min(a*o/r,a*s/i);r*=f,i*=f}const[c,u]=this.parentDimensions;this.setDims(r*c/o,i*u/s),this._uiManager.enableWaiting(!1);const d=A(this,qi,document.createElement("canvas"));t.append(d),this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow||(t.hidden=!1),x(this,F1,e8).call(this,r,i),x(this,Wy,gP).call(this),g(this,B1)||(this.parent.addUndoableEditor(this),A(this,B1,!0)),this._reportTelemetry({action:"inserted_image"}),g(this,Ju)&&d.setAttribute("aria-label",g(this,Ju))},Zy=new WeakSet,mP=function(t,r){var s;const[i,o]=this.parentDimensions;this.width=t/i,this.height=r/o,this.setDims(t,r),(s=this._initialOptions)!=null&&s.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,g(this,Gi)!==null&&clearTimeout(g(this,Gi)),A(this,Gi,setTimeout(()=>{A(this,Gi,null),x(this,F1,e8).call(this,t,r)},200))},$1=new WeakSet,Jv=function(t,r){const{width:i,height:o}=g(this,wt);let s=i,a=o,c=g(this,wt);for(;s>2*t||a>2*r;){const u=s,d=a;s>2*t&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),a>2*r&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));const f=new OffscreenCanvas(s,a);f.getContext("2d").drawImage(c,0,0,u,d,0,0,s,a),c=f.transferToImageBitmap()}return c},F1=new WeakSet,e8=function(t,r){t=Math.ceil(t),r=Math.ceil(r);const i=g(this,qi);if(!i||i.width===t&&i.height===r)return;i.width=t,i.height=r;const o=g(this,Br)?g(this,wt):x(this,$1,Jv).call(this,t,r),s=i.getContext("2d");s.filter=this._uiManager.hcmFilter,s.drawImage(o,0,0,o.width,o.height,0,0,t,r)},td=new WeakSet,k5=function(t){if(t){if(g(this,Br)){const i=this._uiManager.imageManager.getSvgUrl(g(this,rn));if(i)return i}const r=document.createElement("canvas");return{width:r.width,height:r.height}=g(this,wt),r.getContext("2d").drawImage(g(this,wt),0,0),r.toDataURL()}if(g(this,Br)){const[r,i]=this.pageDimensions,o=Math.round(this.width*r*hs.PDF_TO_CSS_UNITS),s=Math.round(this.height*i*hs.PDF_TO_CSS_UNITS),a=new OffscreenCanvas(o,s);return a.getContext("2d").drawImage(g(this,wt),0,0,g(this,wt).width,g(this,wt).height,0,0,o,s),a.transferToImageBitmap()}return structuredClone(g(this,wt))},Wy=new WeakSet,gP=function(){this._uiManager._signal&&(A(this,Ko,new ResizeObserver(t=>{const r=t[0].contentRect;r.width&&r.height&&x(this,Zy,mP).call(this,r.width,r.height)})),g(this,Ko).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;(t=g(this,Ko))==null||t.disconnect(),A(this,Ko,null)},{once:!0}))},fe(V1,"_type","stamp"),fe(V1,"_editorType",Ae.STAMP);let Q4=V1;const ci=class ci{constructor({uiManager:e,pageIndex:t,div:r,accessibilityManager:i,annotationLayer:o,drawLayer:s,textLayer:a,viewport:c,l10n:u}){M(this,Ky);M(this,j1);M(this,z1);M(this,H1);M(this,od);M(this,_0,void 0);M(this,nd,!1);M(this,Yi,null);M(this,ka,null);M(this,qo,null);M(this,fr,new Map);M(this,Sa,!1);M(this,rd,!1);M(this,id,!1);M(this,An,null);M(this,Go,null);M(this,le,void 0);const d=[...g(ci,Ma).values()];if(!ci._initialized){ci._initialized=!0;for(const f of d)f.initialize(u,e)}e.registerEditorTypes(d),A(this,le,e),this.pageIndex=t,this.div=r,A(this,_0,i),A(this,Yi,o),this.viewport=c,A(this,An,a),this.drawLayer=s,g(this,le).addLayer(this)}get isEmpty(){return g(this,fr).size===0}get isInvisible(){return this.isEmpty&&g(this,le).getMode()===Ae.NONE}updateToolbar(e){g(this,le).updateToolbar(e)}updateMode(e=g(this,le).getMode()){switch(x(this,od,S5).call(this),e){case Ae.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Ae.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case Ae.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const r of g(ci,Ma).values())t.toggle(`${r._type}Editing`,e===r._editorType);this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=g(this,An))==null?void 0:t.div)}addInkEditorIfNeeded(e){if(g(this,le).getMode()===Ae.INK){if(!e){for(const t of g(this,fr).values())if(t.isEmpty()){t.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(e){g(this,le).setEditingState(e)}addCommands(e){g(this,le).addCommands(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=g(this,Yi))==null||t.div.classList.toggle("disabled",!e)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const r of g(this,fr).values())r.enableEditing(),r.show(!0),r.annotationElementId&&(g(this,le).removeChangedExistingAnnotation(r),e.add(r.annotationElementId));if(!g(this,Yi))return;const t=g(this,Yi).getEditableAnnotations();for(const r of t){if(r.hide(),g(this,le).isDeletedAnnotationElement(r.data.id)||e.has(r.data.id))continue;const i=this.deserialize(r);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){var i;A(this,id,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,t=new Map;for(const o of g(this,fr).values())o.disableEditing(),o.annotationElementId&&(o.serialize()===null?(t.set(o.annotationElementId,o),(i=this.getEditableAnnotation(o.annotationElementId))==null||i.show(),o.remove()):e.set(o.annotationElementId,o));if(g(this,Yi)){const o=g(this,Yi).getEditableAnnotations();for(const s of o){const{id:a}=s.data;if(g(this,le).isDeletedAnnotationElement(a))continue;let c=t.get(a);c?(c.resetAnnotationElement(s),c.show(!1),s.show()):(c=e.get(a),c&&(g(this,le).addChangedExistingAnnotation(c),c.renderAnnotationElement(s),c.show(!1)),s.show())}}x(this,od,S5).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:r}=this.div;for(const o of g(ci,Ma).values())r.remove(`${o._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),A(this,id,!1)}getEditableAnnotation(e){var t;return((t=g(this,Yi))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){g(this,le).getActive()!==e&&g(this,le).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=g(this,An))!=null&&e.div&&!g(this,Go)){A(this,Go,new AbortController);const t=g(this,le).combinedSignal(g(this,Go));g(this,An).div.addEventListener("pointerdown",x(this,Ky,yP).bind(this),{signal:t}),g(this,An).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=g(this,An))!=null&&e.div&&g(this,Go)&&(g(this,Go).abort(),A(this,Go,null),g(this,An).div.classList.remove("highlighting"))}enableClick(){if(g(this,ka))return;A(this,ka,new AbortController);const e=g(this,le).combinedSignal(g(this,ka));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:e})}disableClick(){var e;(e=g(this,ka))==null||e.abort(),A(this,ka,null)}attach(e){g(this,fr).set(e.id,e);const{annotationElementId:t}=e;t&&g(this,le).isDeletedAnnotationElement(t)&&g(this,le).removeDeletedAnnotationElement(e)}detach(e){var t;g(this,fr).delete(e.id),(t=g(this,_0))==null||t.removePointerInTextLayer(e.contentDiv),!g(this,id)&&e.annotationElementId&&g(this,le).addDeletedAnnotationElement(e)}remove(e){this.detach(e),g(this,le).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,g(this,rd)||this.addInkEditorIfNeeded(!1)}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(g(this,le).addDeletedAnnotationElement(e.annotationElementId),je.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(e.parent!==this||!e.isAttachedToDOM){if(this.changeParent(e),g(this,le).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),g(this,le).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var r;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!g(this,qo)&&(e._focusEventsAllowed=!1,A(this,qo,setTimeout(()=>{A(this,qo,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:g(this,le)._signal}),t.focus())},0))),e._structTreeParentId=(r=g(this,_0))==null?void 0:r.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return g(this,le).getId()}combinedSignal(e){return g(this,le).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=g(this,j1,t8))==null?void 0:e.canCreateNewEmptyEditor()}pasteEditor(e,t){g(this,le).updateToolbar(e),g(this,le).updateMode(e);const{offsetX:r,offsetY:i}=x(this,H1,r8).call(this),o=this.getNextId(),s=x(this,z1,n8).call(this,{parent:this,id:o,x:r,y:i,uiManager:g(this,le),isCentered:!0,...t});s&&this.add(s)}deserialize(e){var t;return((t=g(ci,Ma).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,g(this,le)))||null}createAndAddNewEditor(e,t,r={}){const i=this.getNextId(),o=x(this,z1,n8).call(this,{parent:this,id:i,x:e.offsetX,y:e.offsetY,uiManager:g(this,le),isCentered:t,...r});return o&&this.add(o),o}addNewEditor(){this.createAndAddNewEditor(x(this,H1,r8).call(this),!0)}setSelected(e){g(this,le).setSelected(e)}toggleSelected(e){g(this,le).toggleSelected(e)}isSelected(e){return g(this,le).isSelected(e)}unselect(e){g(this,le).unselect(e)}pointerup(e){const{isMac:t}=Bn.platform;!(e.button!==0||e.ctrlKey&&t)&&e.target===this.div&&g(this,Sa)&&(A(this,Sa,!1),g(this,nd)?g(this,le).getMode()!==Ae.STAMP?this.createAndAddNewEditor(e,!1):g(this,le).unselectAll():A(this,nd,!0))}pointerdown(e){if(g(this,le).getMode()===Ae.HIGHLIGHT&&this.enableTextSelection(),g(this,Sa)){A(this,Sa,!1);return}const{isMac:t}=Bn.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;A(this,Sa,!0);const r=g(this,le).getActive();A(this,nd,!r||r.isEmpty())}findNewParent(e,t,r){const i=g(this,le).findParent(t,r);return i===null||i===this?!1:(i.changeParent(e),!0)}destroy(){var e,t;((e=g(this,le).getActive())==null?void 0:e.parent)===this&&(g(this,le).commitOrRemove(),g(this,le).setActiveEditor(null)),g(this,qo)&&(clearTimeout(g(this,qo)),A(this,qo,null));for(const r of g(this,fr).values())(t=g(this,_0))==null||t.removePointerInTextLayer(r.contentDiv),r.setParent(null),r.isAttachedToDOM=!1,r.div.remove();this.div=null,g(this,fr).clear(),g(this,le).removeLayer(this)}render({viewport:e}){this.viewport=e,qa(this.div,e);for(const t of g(this,le).getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){g(this,le).commitOrRemove(),x(this,od,S5).call(this);const t=this.viewport.rotation,r=e.rotation;if(this.viewport=e,qa(this.div,{rotation:r}),t!==r)for(const i of g(this,fr).values())i.rotate(r);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return g(this,le).viewParameters.realScale}};_0=new WeakMap,nd=new WeakMap,Yi=new WeakMap,ka=new WeakMap,qo=new WeakMap,fr=new WeakMap,Sa=new WeakMap,rd=new WeakMap,id=new WeakMap,An=new WeakMap,Go=new WeakMap,le=new WeakMap,Ma=new WeakMap,Ky=new WeakSet,yP=function(e){g(this,le).unselectAll();const{target:t}=e;if(t===g(this,An).div||t.classList.contains("endOfContent")&&g(this,An).div.contains(t)){const{isMac:r}=Bn.platform;if(e.button!==0||e.ctrlKey&&r)return;g(this,le).showAllEditors("highlight",!0,!0),g(this,An).div.classList.add("free"),this.toggleDrawing(),ym.startHighlighting(this,g(this,le).direction==="ltr",e),g(this,An).div.addEventListener("pointerup",()=>{g(this,An).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:g(this,le)._signal}),e.preventDefault()}},j1=new WeakSet,t8=function(){return g(ci,Ma).get(g(this,le).getMode())},z1=new WeakSet,n8=function(e){const t=g(this,j1,t8);return t?new t.prototype.constructor(e):null},H1=new WeakSet,r8=function(){const{x:e,y:t,width:r,height:i}=this.div.getBoundingClientRect(),o=Math.max(0,e),s=Math.max(0,t),a=(o+Math.min(window.innerWidth,e+r))/2-e,c=(s+Math.min(window.innerHeight,t+i))/2-t,[u,d]=this.viewport.rotation%180==0?[a,c]:[c,a];return{offsetX:u,offsetY:d}},od=new WeakSet,S5=function(){A(this,rd,!0);for(const e of g(this,fr).values())e.isEmpty()&&e.remove();A(this,rd,!1)},fe(ci,"_initialized",!1),M(ci,Ma,new Map([q4,Y4,Q4,ym].map(e=>[e._editorType,e])));let X4=ci;const on=class on{constructor({pageIndex:e}){M(this,W1);M(this,qy);M(this,Qi,null);M(this,U1,0);M(this,Pt,new Map);M(this,Ea,new Map);this.pageIndex=e}setParent(e){if(g(this,Qi)){if(g(this,Qi)!==e){if(g(this,Pt).size>0)for(const t of g(this,Pt).values())t.remove(),e.append(t);A(this,Qi,e)}}else A(this,Qi,e)}static get _svgFactory(){return Ie(this,"_svgFactory",new A4)}highlight(e,t,r,i=!1){const o=qn(this,U1)._++,s=x(this,W1,o8).call(this,e.box);s.classList.add("highlight"),e.free&&s.classList.add("free");const a=on._svgFactory.createElement("defs");s.append(a);const c=on._svgFactory.createElement("path");a.append(c);const u=`path_p${this.pageIndex}_${o}`;c.setAttribute("id",u),c.setAttribute("d",e.toSVGPath()),i&&g(this,Ea).set(o,c);const d=x(this,qy,bP).call(this,a,u),f=on._svgFactory.createElement("use");return s.append(f),s.setAttribute("fill",t),s.setAttribute("fill-opacity",r),f.setAttribute("href",`#${u}`),g(this,Pt).set(o,s),{id:o,clipPathId:`url(#${d})`}}highlightOutline(e){const t=qn(this,U1)._++,r=x(this,W1,o8).call(this,e.box);r.classList.add("highlightOutline");const i=on._svgFactory.createElement("defs");r.append(i);const o=on._svgFactory.createElement("path");i.append(o);const s=`path_p${this.pageIndex}_${t}`;o.setAttribute("id",s),o.setAttribute("d",e.toSVGPath()),o.setAttribute("vector-effect","non-scaling-stroke");let a;if(e.free){r.classList.add("free");const d=on._svgFactory.createElement("mask");i.append(d),a=`mask_p${this.pageIndex}_${t}`,d.setAttribute("id",a),d.setAttribute("maskUnits","objectBoundingBox");const f=on._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");const h=on._svgFactory.createElement("use");d.append(h),h.setAttribute("href",`#${s}`),h.setAttribute("stroke","none"),h.setAttribute("fill","black"),h.setAttribute("fill-rule","nonzero"),h.classList.add("mask")}const c=on._svgFactory.createElement("use");r.append(c),c.setAttribute("href",`#${s}`),a&&c.setAttribute("mask",`url(#${a})`);const u=c.cloneNode();return r.append(u),c.classList.add("mainOutline"),u.classList.add("secondaryOutline"),g(this,Pt).set(t,r),t}finalizeLine(e,t){const r=g(this,Ea).get(e);g(this,Ea).delete(e),this.updateBox(e,t.box),r.setAttribute("d",t.toSVGPath())}updateLine(e,t){g(this,Pt).get(e).firstChild.firstChild.setAttribute("d",t.toSVGPath())}removeFreeHighlight(e){this.remove(e),g(this,Ea).delete(e)}updatePath(e,t){g(this,Ea).get(e).setAttribute("d",t.toSVGPath())}updateBox(e,t){var r;x(r=on,Z1,i8).call(r,g(this,Pt).get(e),t)}show(e,t){g(this,Pt).get(e).classList.toggle("hidden",!t)}rotate(e,t){g(this,Pt).get(e).setAttribute("data-main-rotation",t)}changeColor(e,t){g(this,Pt).get(e).setAttribute("fill",t)}changeOpacity(e,t){g(this,Pt).get(e).setAttribute("fill-opacity",t)}addClass(e,t){g(this,Pt).get(e).classList.add(t)}removeClass(e,t){g(this,Pt).get(e).classList.remove(t)}remove(e){g(this,Qi)!==null&&(g(this,Pt).get(e).remove(),g(this,Pt).delete(e))}destroy(){A(this,Qi,null);for(const e of g(this,Pt).values())e.remove();g(this,Pt).clear()}};Qi=new WeakMap,U1=new WeakMap,Pt=new WeakMap,Ea=new WeakMap,Z1=new WeakSet,i8=function(e,{x:t=0,y:r=0,width:i=1,height:o=1}={}){const{style:s}=e;s.top=100*r+"%",s.left=100*t+"%",s.width=100*i+"%",s.height=100*o+"%"},W1=new WeakSet,o8=function(e){var r;const t=on._svgFactory.create(1,1,!0);return g(this,Qi).append(t),t.setAttribute("aria-hidden",!0),x(r=on,Z1,i8).call(r,t,e),t},qy=new WeakSet,bP=function(e,t){const r=on._svgFactory.createElement("clipPath");e.append(r);const i=`clip_${t}`;r.setAttribute("id",i),r.setAttribute("clipPathUnits","objectBoundingBox");const o=on._svgFactory.createElement("use");return r.append(o),o.setAttribute("href",`#${t}`),o.classList.add("clip"),i},M(on,Z1);let J4=on;pe.AbortException,pe.AnnotationEditorLayer,pe.AnnotationEditorParamsType,pe.AnnotationEditorType,pe.AnnotationEditorUIManager,pe.AnnotationLayer,pe.AnnotationMode,pe.CMapCompressionType,pe.ColorPicker,pe.DOMSVGFactory,pe.DrawLayer,pe.FeatureTest;var uW=pe.GlobalWorkerOptions;pe.ImageKind,pe.InvalidPDFException,pe.MissingPDFException,pe.OPS,pe.PDFDataRangeTransport,pe.PDFDateString,pe.PDFWorker,pe.PasswordResponses,pe.PermissionFlag,pe.PixelsPerInch,pe.RenderingCancelledException,pe.TextLayer,pe.UnexpectedResponseException,pe.Util,pe.VerbosityLevel,pe.XfaLayer,pe.build,pe.createValidAbsoluteUrl,pe.fetchData;var dW=pe.getDocument;pe.getFilenameFromUrl,pe.getPdfFilenameFromUrl,pe.getXfaPageViewport,pe.isDataScheme,pe.isPdfFile,pe.noContextMenu,pe.normalizeUnicode,pe.setLayerDimensions,pe.shadow;var fW=pe.version;const hW=l.defineComponent({name:"QModal",components:{QIcon:vp},props:{id:{type:String,default:"q-modal"},closeButtonClass:{type:String,default:""},containerClass:{type:String,default:"h-fit min-h-fit"},dismissible:{type:Boolean,default:!0},dismissibleOverlay:{type:Boolean,default:!0},dismissText:{type:String,default:""},overlay:{type:String,default:"white-transparent"},size:{type:String,default:"md"},showCancelLink:{type:Boolean,default:!1},hasBuildingBg:{type:Boolean,default:!1}},emits:["close"],setup(n,{emit:e}){l.provide("size",n.size);const t=()=>{n.dismissible&&e("close")};return l.onUnmounted(()=>{document.body.classList.remove("scroll-disabled")}),l.onMounted(()=>{document.body.classList.add("scroll-disabled")}),{onCloseModal:t}}});function pW(n,e,t,r,i,o){const s=l.resolveComponent("q-icon");return l.openBlock(),l.createElementBlock("div",{ref:"currentModal",class:l.normalizeClass(["q-modal",n.overlay]),onKeydown:e[3]||(e[3]=l.withKeys((...a)=>n.onCloseModal&&n.onCloseModal(...a),["escape"]))},[l.createElementVNode("div",l.mergeProps({class:"overlay"},{[l.toHandlerKey(n.dismissibleOverlay&&"click")]:e[0]||(e[0]=(...a)=>n.onCloseModal&&n.onCloseModal(...a))}),null,16),l.createElementVNode("div",{class:l.normalizeClass(["modal-container flex flex-col relative","modal-"+n.size,n.containerClass,{"building-background":n.hasBuildingBg}])},[n.dismissible?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["modal-close-button",n.closeButtonClass]),onClick:e[1]||(e[1]=(...a)=>n.onCloseModal&&n.onCloseModal(...a))},[l.createVNode(s,{icon:"close",type:"line",color:"gray-40"})],2)):l.createCommentVNode("",!0),l.renderSlot(n.$slots,"default",{},void 0,!0),n.showCancelLink?(l.openBlock(),l.createElementBlock("a",{key:1,class:"modal-close-link",href:"#",onClick:e[2]||(e[2]=l.withModifiers(a=>n.$emit("close"),["prevent"]))},l.toDisplayString(n.$t("HC_CANCEL")),1)):l.createCommentVNode("",!0)],2)],34)}const e6=ge(hW,[["render",pW],["__scopeId","data-v-8867a052"]]),mW=l.defineComponent({name:"QErrorModal",components:{QModal:e6},props:{toggle:{type:Boolean,default:!1,required:!0}},emits:["update:toggle"],setup(n,{emit:e}){return{toggleModal:l.computed({get:()=>n.toggle,set:r=>{e("update:toggle",r)}}),mq:_n}}}),gW={class:"flex flex-col gap-2 text-center"},yW={class:"text-lg font-bold text-inkwell-30 leading-6"},bW={class:"text-inkwell-0 mb-2 md:mb-6"};function wW(n,e,t,r,i,o){const s=l.resolveComponent("q-icon"),a=l.resolveComponent("q-button"),c=l.resolveComponent("q-modal-content"),u=l.resolveComponent("q-modal");return l.openBlock(),l.createBlock(l.Transition,{name:n.mq.md?"fade":"slide-up"},{default:l.withCtx(()=>[n.toggleModal?(l.openBlock(),l.createBlock(u,{key:0,id:"error-modal",dismissible:!1,overlay:n.mq.md?"white-transparent":"black-transparent",class:"!z-[170]","footer-class":"mt-2 md:mt-6",onClose:e[1]||(e[1]=d=>n.toggleModal=!1)},{default:l.withCtx(()=>[l.createVNode(c,null,{body:l.withCtx(()=>[l.createElementVNode("div",gW,[l.createVNode(s,{icon:"exclamation-circle",type:"outline",size:"xl",color:"red-30",class:"shrink-0 self-center mb-8"}),l.createElementVNode("h2",yW,[l.renderSlot(n.$slots,"headline",{},()=>[l.createTextVNode(l.toDisplayString(n.$t("HC_ERROR")),1)],!0)]),l.createElementVNode("p",bW,[l.renderSlot(n.$slots,"subtext",{},()=>[l.createTextVNode(l.toDisplayString(n.$t("HC_SORRY_UNEXPECTED_EXIT_MODAL")),1)],!0)])])]),footer:l.withCtx(()=>[l.createVNode(a,{class:l.normalizeClass([n.mq.md?"mx-3":"w-full"]),size:"lg",status:"secondary",onClick:e[0]||(e[0]=d=>n.toggleModal=!1)},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(n.$t("HC_EXIT")),1)]),_:1},8,["class"])]),_:3})]),_:3},8,["overlay"])):l.createCommentVNode("",!0)]),_:3},8,["name"])}const oE=ge(mW,[["render",wW],["__scopeId","data-v-72f5c09d"]]);uW.workerSrc=`https://cdn.jsdelivr.net/npm/pdfjs-dist@${fW}/legacy/build/pdf.worker.min.mjs`;const vW=l.defineComponent({name:"PdfViewer",components:{QErrorModal:oE},props:{url:{type:String,required:!0}},emits:["pdf-error"],setup(n,{emit:e}){let t=null;const r=2,i=16,o=l.ref([]),s=l.ref(!0),a=l.ref(!1),c=l.ref(0),u=async()=>{try{if(t=await dW(n.url).promise,!t)throw new Error("pdfDoc is null or undefined");c.value=t.numPages,s.value=!1,await l.nextTick(),o.value=Array.from(document.querySelectorAll(".pdf-pages canvas")),await d()}catch(h){a.value=!0,console.log(h),s.value=!1,e("pdf-error",!0)}},d=async()=>{try{for(let h=1;h<=c.value;h++)await f(h)}catch(h){console.log(h),a.value=!0,e("pdf-error",!0)}},f=async h=>{try{const p=await(t==null?void 0:t.getPage(h));if(!p)throw new Error(`Page ${h} does not exist in the PDF document`);const y=p.getViewport({scale:1}),b=o.value[h-1];if(!b)throw new Error(`Canvas for page ${h} does not exist`);const w=b.getContext("2d");if(!w)throw new Error(`Context for page ${h} does not exist`);b.height=y==null?void 0:y.height,b.width=y==null?void 0:y.width;const v={canvasContext:w,viewport:y};await(p==null?void 0:p.render(v))}catch(p){console.log(p),a.value=!0,e("pdf-error",!0)}};return l.onMounted(()=>{u()}),{skeletonColumns:r,skeletonRows:i,canvasRefs:o,loadingMeta:s,showErrorModal:a,totalPages:c,loadPDF:u,renderPage:f}}}),CW={class:"q-pdf-viewer"},kW={key:0},SW={key:1,class:"pdf-pages"};function MW(n,e,t,r,i,o){const s=l.resolveComponent("q-error-modal");return l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",CW,[n.loadingMeta?(l.openBlock(),l.createElementBlock("div",kW,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.skeletonRows,a=>(l.openBlock(),l.createElementBlock("div",{key:a,class:"flex items-center p-4"},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.skeletonColumns,c=>(l.openBlock(),l.createElementBlock("div",{key:c,class:l.normalizeClass(["h-[1.5rem] border-white w-11/12",(a-1)%2?"bg-gray-10":"bg-gray-30",(a-1)%4||c===1?"animate-shimmer":"!hidden"])},null,2))),128))]))),128))])):(l.openBlock(),l.createElementBlock("div",SW,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.totalPages,a=>(l.openBlock(),l.createElementBlock("canvas",{key:a,class:"w-full"}))),128))]))]),n.showErrorModal?(l.openBlock(),l.createBlock(s,{key:0,toggle:n.showErrorModal,"onUpdate:toggle":[e[0]||(e[0]=a=>n.showErrorModal=a),e[1]||(e[1]=a=>n.showErrorModal=!1)]},null,8,["toggle"])):l.createCommentVNode("",!0)],64)}const sE=ge(vW,[["render",MW],["__scopeId","data-v-da5da0f5"]]),EW=l.defineComponent({name:"QTooltip",props:{id:{type:String,default:"tooltip"},color:{type:String,default:"inkwell-30"},disabled:{type:Boolean,default:!1},noWrap:{type:Boolean,default:!0},position:{type:String,default:"bottom"},relative:{type:Boolean,default:!1},tooltipClasses:{type:[String,Array,Object],default:""}}}),AW=["aria-describedby"],TW=["id"];function xW(n,e,t,r,i,o){return l.openBlock(),l.createElementBlock("div",{class:"tooltip-container","aria-describedby":n.id},[l.renderSlot(n.$slots,"trigger",{},void 0,!0),l.createElementVNode("div",{id:n.id,class:l.normalizeClass(["tooltip",n.color?"bg-"+n.color+" border-"+n.color:"",n.position,n.noWrap?"no-wrap":"",n.relative?"relative":"",n.disabled?"!hidden":"",n.tooltipClasses]),role:"tooltip"},[l.renderSlot(n.$slots,"content",{},void 0,!0)],10,TW)],8,AW)}const t6=ge(EW,[["render",xW],["__scopeId","data-v-ca6ae8fe"]]),aE=()=>{const n=l.ref(""),e=navigator.userAgent;return e.match("/Android|webOS|iPhone|iPod|BlackBerry/i")?n.value="mobile":e.match("/iPad|Tablet/i")||navigator.maxTouchPoints&&navigator.maxTouchPoints>=0&&!window.matchMedia("(pointer:fine)").matches?n.value="tablet":n.value="desktop",{deviceType:n}},IW=l.defineComponent({name:"ImageGallery",components:{Galleria:rM,QBadge:Da,QBottomSheet:G9,QMenu:m4,QPdfViewer:sE,QTooltip:t6},props:{files:{type:Array,default:()=>[]},thumbnailsVisible:{type:Number,default:4},showOnHover:{type:Boolean,default:!0},showThumbnails:{type:Boolean,default:!0},showRemove:{type:[Boolean,Number],default:!1},baseZIndex:{type:Number,default:1e3},wrap:{type:Boolean,default:!0}},emits:["update:model-value","update:activeIndex","click:file"],setup(n,{emit:e}){const{t}=us(),{deviceType:r}=aE(),i=[{text:t("HC_CANCEL")}],o=l.ref(null),s=l.computed(()=>{var Y;return(Y=o.value)==null?void 0:Y.offsetWidth}),a=l.ref(null),c=l.ref([]),u=l.ref(!1),d=l.ref(null),f=l.ref("0"),h=l.ref(1),p=l.ref(_n.md?1:.9),m=l.ref(0),y=l.ref(null),b=l.ref(),w=l.ref(!1),v=l.ref(!1),k=l.computed(()=>{if(y.value)return y.value&&"original"in y.value?{name:y.value.original.name,url:y.value.original.url,type:y.value.mimetype,extension:Z(y.value.original.url)}:{name:y.value.name,url:URL.createObjectURL(y.value),type:y.value.type,extension:Z(y.value.name)}}),C=l.computed(()=>[`z-[${n.baseZIndex+1}]`]),T=l.computed(()=>n.files.filter(Y=>Y.type.startsWith("image")&&!Y.type.includes("tif"))),S=l.computed(()=>["rounded-lg relative mx-auto object-cover grow-1 max-h-[74vh]",{animated:!N}]),E=l.computed(()=>["flex items-center gap-3",n.wrap?"flex-wrap":"flex-nowrap overflow-x-auto shrink-0",{"flex-nowrap overflow-x-auto":r.value!=="desktop"}]),O=l.computed(()=>[{text:t("HC_DELETE_ATTACHMENT"),classes:"!text-red-20",event:F}]),I=Y=>{const U=Y instanceof File?URL.createObjectURL(Y):Y.original.url;r.value==="desktop"?window.open(U,"_blank"):window.open(U,"_self")},P=Y=>{r.value==="desktop"?I(Y):(y.value=Y,v.value=!0)},D=Y=>{Y.event(),u.value=!1},L=(Y,U)=>{var z;const H=((z=U.type)==null?void 0:z.includes("image"))&&!U.type.includes("tif");!u.value&&H?B(Y,U):!u.value&&!H&&P(U)},B=(Y,U)=>{const H=W=>"original"in W&&"original"in U?W.original.url===(U==null?void 0:U.original.url):U instanceof File?W.name===(U==null?void 0:U.name):!1,z=T.value.findIndex(H);m.value=z!==-1?z:Y,w.value=!0},F=(Y=null)=>{u.value=!1,e("update:model-value",Y||d.value)},R=Y=>{const{keyCode:U}=Y;if(w.value)switch(U){case 37:m.value=m.value?m.value-1:T.value.length-1,e("update:activeIndex",m.value);break;case 39:m.value=m.value<T.value.length-1?m.value+1:0,e("update:activeIndex",m.value);break;case 27:w.value=!1;break}},{isSwiping:N,lengthX:G}=iL(a,{passive:!1,onSwipe(){const Y=Math.abs(G.value);s.value&&(h.value=1.1-Y/s.value,f.value=G.value<0?`${Y/4}px`:`-${Y/4}px`)},onSwipeEnd(){const Y=m.value<=0,U=m.value>=T.value.length-1,H=Math.abs(G.value);s.value&&H/s.value>=.5?(G.value<0?m.value=Y?T.value.length-1:m.value-1:m.value=U?0:m.value+1,f.value="0",h.value=1):(f.value="0",h.value=1)}}),Z=Y=>Y.substring(Y.lastIndexOf(".")),ee=(Y,U)=>{Y.preventDefault(),d.value=n.files[U],u.value=!0},me=()=>{u.value=!1,d.value=null},xe=()=>{r.value!=="desktop"&&c.value.forEach(Y=>{X_(Y,U=>{const H=c.value.indexOf(Y);ee(U,H)},{modifiers:{prevent:!0}})})};return l.onMounted(()=>{window.addEventListener("keyup",R),xe()}),l.onUpdated(()=>{xe()}),{menuActions:i,linkActions:O,deviceType:r,container:o,containerWidth:s,featuredPhoto:a,longPressRef:c,longPressedHook:u,isSwiping:N,lengthX:G,left:f,opacity:h,scale:p,showCarousel:w,showFileViewer:v,active:m,activeAttachment:y,hoveredIndex:b,closeIconClasses:C,itemClasses:S,images:T,normalizedAttachment:k,thumbnailContainerClasses:E,downloadDocument:I,getExtension:Z,onAttachmentClick:P,onClickMenuLink:D,onClickThumbnail:L,onOpenCarousel:B,onRemoveFile:F,onKeyboardNavigation:R,onLongPressCallbackHook:ee,resetHook:me,mq:_n}}}),OW={class:"q-image-gallery flex",ref:"container"},DW={ref:"featuredPhoto",class:"featured-image h-[80vh] overflow-hidden flex max-w-screen relative md:h-full w-screen items-center"},NW=["src","alt"],PW=["src","alt"],_W=["onMouseover","onClick"],LW=["src","alt"],BW={key:1,class:"bg-gray-00 cursor-pointer p-3 h-16 max-w-[14rem] rounded-lg border border-gray-20 flex items-center"},RW={class:"grow text-ellipsis overflow-hidden"},$W={class:"text-inkwell-30 bold leading-normal text-nowrap text-ellipsis text-sm overflow-hidden -mt-1"},FW={class:"uppercase text-xxs"},VW={key:2,class:"image-overlay absolute top-0 left-0 w-full h-full cursor-pointer"},jW={key:1,width:"100%",height:"auto",controls:"",class:"bg-black"},zW=["src"],HW={class:"flex items-center flex-col p-12"},UW=["src"],ZW=["data","type"],WW={class:"flex items-center flex-col p-12"};function KW(n,e,t,r,i,o){const s=l.resolveComponent("q-icon"),a=l.resolveComponent("Galleria"),c=l.resolveComponent("q-badge"),u=l.resolveComponent("q-tooltip"),d=l.resolveComponent("q-menu"),f=l.resolveComponent("q-pdf-viewer"),h=l.resolveComponent("q-bottom-sheet");return l.openBlock(),l.createElementBlock("div",OW,[l.createVNode(a,{activeIndex:n.active,"onUpdate:activeIndex":e[0]||(e[0]=p=>n.active=p),visible:n.showCarousel,"onUpdate:visible":e[1]||(e[1]=p=>n.showCarousel=p),value:n.images,numVisible:n.thumbnailsVisible,circular:!0,fullScreen:!0,showItemNavigators:n.mq.md,showThumbnailNavigators:!0,showThumbnails:n.showThumbnails&&n.mq.md,showIndicators:!n.mq.md,containerStyle:[{height:"100vh"}],"base-z-index":n.baseZIndex},{closeicon:l.withCtx(()=>[l.createVNode(s,{class:l.normalizeClass(n.closeIconClasses),icon:"times-circle",type:"outline",size:"lg",color:"white"},null,8,["class"])]),item:l.withCtx(({item:p})=>[l.createElementVNode("div",DW,[l.createElementVNode("img",{src:(p==null?void 0:p.itemImageSrc)||(p==null?void 0:p.objectURL)||(p==null?void 0:p.original.url),alt:p==null?void 0:p.alt,class:l.normalizeClass(n.itemClasses),style:l.normalizeStyle([{left:n.left,opacity:n.opacity},`transform: scale(${n.scale})`])},null,14,NW)],512)]),thumbnail:l.withCtx(({item:p})=>[l.createElementVNode("img",{src:p.thumbnailImageSrc||(p==null?void 0:p.objectURL)||(p==null?void 0:p.thumbnail.url),alt:p.alt,class:"rounded-lg block min-h-24 min-w-24 max-w-24 max-h-24 object-cover"},null,8,PW)]),previousitemicon:l.withCtx(()=>[l.createVNode(s,{icon:"chevron-circle-left",type:"outline",size:"md",color:"white"})]),nextitemicon:l.withCtx(()=>[l.createVNode(s,{icon:"chevron-circle-right",type:"outline",size:"md",color:"white"})]),previousthumbnailicon:l.withCtx(()=>[n.images.length>n.thumbnailsVisible?(l.openBlock(),l.createBlock(s,{key:0,icon:"chevron-left",type:"line",size:"sm",color:"white"})):l.createCommentVNode("",!0)]),nextthumbnailicon:l.withCtx(()=>[n.images.length>n.thumbnailsVisible?(l.openBlock(),l.createBlock(s,{key:0,icon:"chevron-right",type:"line",size:"sm",color:"white"})):l.createCommentVNode("",!0)]),_:1},8,["activeIndex","visible","value","numVisible","showItemNavigators","showThumbnails","showIndicators","base-z-index"]),n.files?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(n.thumbnailContainerClasses)},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.files,(p,m)=>{var y;return l.openBlock(),l.createElementBlock("div",{ref_for:!0,ref:"longPressRef",key:p.name||((y=p.original)==null?void 0:y.name)||m,class:l.normalizeClass(["p-0 relative rounded-lg",{"shrink-0":n.deviceType!=="desktop"}]),onMouseover:b=>n.hoveredIndex=m,onMouseleave:e[2]||(e[2]=b=>n.hoveredIndex=null),onClick:b=>n.onClickThumbnail(m,p)},[l.createVNode(u,{position:"top"},{trigger:l.withCtx(()=>[p.type&&p.type.includes("image")&&!p.type.includes("tif")?(l.openBlock(),l.createElementBlock("img",{key:0,src:(p==null?void 0:p.thumbnailImageSrc)||(p==null?void 0:p.objectURL)||(p==null?void 0:p.thumbnail.url),alt:p==null?void 0:p.alt,class:"rounded-lg cursor-pointer w-16 h-16 object-cover bg-gray-0 border-gray-20 border"},null,8,LW)):(l.openBlock(),l.createElementBlock("div",BW,[l.createVNode(s,{icon:"file-document",size:"xl",color:"white",class:"mr-3 shrink-0 p-2 bg-green-20 rounded-lg h-full"}),l.createElementVNode("div",RW,[l.createElementVNode("div",$W,l.toDisplayString(p.name||p.original.name),1),l.createElementVNode("div",FW,l.toDisplayString((p.name||p.original.name).match(/([^.]+$)/)[0]),1)])])),n.deviceType!=="desktop"?(l.openBlock(),l.createElementBlock("div",VW)):l.createCommentVNode("",!0),n.showRemove&&n.showOnHover&&n.hoveredIndex===m&&n.deviceType==="desktop"?(l.openBlock(),l.createBlock(c,{key:3,color:"inkwell-30",shape:"circle",class:"cursor-pointer absolute -top-2 -right-2 shadow-solid z-10",onClick:l.withModifiers(b=>n.onRemoveFile(p),["stop"])},{icon:l.withCtx(()=>[l.createVNode(s,{icon:"close",size:"xs",type:"line",color:"white"})]),_:2},1032,["onClick"])):l.createCommentVNode("",!0)]),content:l.withCtx(()=>{var b;return[l.createTextVNode(l.toDisplayString(p.name||((b=p.original)==null?void 0:b.name)),1)]}),_:2},1024)],42,_W)}),128)),l.createVNode(l.Transition,{name:"fade"},{default:l.withCtx(()=>[n.longPressedHook?(l.openBlock(),l.createBlock(d,{key:0,modelValue:n.longPressedHook,"onUpdate:modelValue":e[3]||(e[3]=p=>n.longPressedHook=p),actions:n.menuActions,links:n.linkActions,"links-background":"light-gray","onClick:link":n.onClickMenuLink,"onClick:action":e[4]||(e[4]=p=>n.longPressedHook=!1)},null,8,["modelValue","actions","links","onClick:link"])):l.createCommentVNode("",!0)]),_:1})],2)):l.createCommentVNode("",!0),l.createVNode(l.Transition,{name:"slide-up-fade"},{default:l.withCtx(()=>[n.showFileViewer&&n.normalizedAttachment&&n.activeAttachment?(l.openBlock(),l.createBlock(h,{key:0,modelValue:n.showFileViewer,"onUpdate:modelValue":e[6]||(e[6]=p=>n.showFileViewer=p),"show-close-button":!1,"content-class":"p-0","header-class":"border-b border-solid border-gray-20","title-class":"min-w-0 truncate"},{header:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(n.normalizedAttachment.name),1)]),headerAction:l.withCtx(()=>[!n.normalizedAttachment.type.includes("video")&&n.normalizedAttachment.type!=="audio/mpeg"&&n.normalizedAttachment.type!=="application/pdf"?(l.openBlock(),l.createBlock(s,{key:0,icon:"arrow-to-bottom",type:"line",size:"md",color:"inkwell-40",class:"shrink-0 cursor-pointer",onClick:e[5]||(e[5]=p=>n.downloadDocument(n.activeAttachment))})):l.createCommentVNode("",!0)]),default:l.withCtx(()=>[n.normalizedAttachment.type==="application/pdf"?(l.openBlock(),l.createBlock(f,{key:0,url:n.normalizedAttachment.url},null,8,["url"])):n.normalizedAttachment.type.includes("video")?(l.openBlock(),l.createElementBlock("video",jW,[l.createElementVNode("source",{src:n.normalizedAttachment.url},null,8,zW),l.createElementVNode("div",HW,[l.createVNode(s,{icon:"file-document",size:"xl",color:"inkwell-30"}),l.createTextVNode(" "+l.toDisplayString(n.normalizedAttachment.extension),1)])])):n.normalizedAttachment.type==="audio/mpeg"?(l.openBlock(),l.createElementBlock("audio",{key:2,controls:"",src:n.normalizedAttachment.url,class:"mx-auto my-6"},null,8,UW)):(l.openBlock(),l.createElementBlock("object",{key:3,data:n.normalizedAttachment.url,type:n.normalizedAttachment.type,class:"w-full h-auto"},[l.createElementVNode("div",WW,[l.createVNode(s,{icon:"file-document",size:"xl",color:"inkwell-30"}),l.createTextVNode(" "+l.toDisplayString(n.normalizedAttachment.extension),1)])],8,ZW))]),_:1},8,["modelValue"])):l.createCommentVNode("",!0)]),_:1})],512)}const n6=ge(IW,[["render",KW],["__scopeId","data-v-6415364f"]]),qW=l.defineComponent({name:"QWarningModal",components:{QModal:e6},props:{toggle:{type:Boolean,default:!1,required:!0},action:{type:Function,default:()=>{}},processing:{type:Boolean,default:!1}},emits:["update:toggle","update:action"],setup(n,{emit:e}){return{toggleModal:l.computed({get:()=>n.toggle,set:r=>{e("update:toggle",r)}}),mq:_n}}}),GW={key:0,class:"flex flex-col gap-2 text-center"},YW={class:"text-lg font-bold text-inkwell-30 leading-6"},QW={class:"text-inkwell-0 mb-6"},XW={key:1,class:"flex flex-col gap-2 text-center"},JW={class:"text-[1.25rem] font-bold text-center text-inkwell-30"},eK={class:"text-sm text-center text-inkwell-0 mb-2"},tK={class:"flex flex-col items-center justify-center gap-3 md:gap-2"};function nK(n,e,t,r,i,o){const s=l.resolveComponent("q-button"),a=l.resolveComponent("q-modal-content"),c=l.resolveComponent("q-modal");return l.openBlock(),l.createBlock(l.Transition,{name:n.mq.md?"fade":"slide-up"},{default:l.withCtx(()=>[n.toggleModal?(l.openBlock(),l.createBlock(c,{key:0,class:"warning-modal !z-[170]",dismissible:!1,overlay:n.mq.md?"white-transparent":"black-transparent","container-class":"h-fit min-h-fit","footer-class":"mt-2 md:mt-6",onClose:e[1]||(e[1]=u=>n.toggleModal=!1)},{default:l.withCtx(()=>[l.createVNode(a,null,{body:l.withCtx(()=>[n.mq.md?(l.openBlock(),l.createElementBlock("div",GW,[l.createElementVNode("h2",YW,[l.renderSlot(n.$slots,"desktopHeader",{},void 0,!0)]),l.createElementVNode("p",QW,[l.renderSlot(n.$slots,"desktopMessage",{},void 0,!0)])])):(l.openBlock(),l.createElementBlock("div",XW,[l.createElementVNode("h2",JW,[l.renderSlot(n.$slots,"mobileHeader",{},void 0,!0)]),l.createElementVNode("p",eK,[l.renderSlot(n.$slots,"mobileMessage",{},void 0,!0)])]))]),footer:l.withCtx(()=>[l.createElementVNode("div",tK,[l.createVNode(s,{disabled:n.processing,loading:n.processing,class:l.normalizeClass([n.mq.md?"mx-2":"w-full"]),size:"lg",status:"danger",onClick:n.action},{default:l.withCtx(()=>[l.renderSlot(n.$slots,"buttonText",{},void 0,!0)]),_:3},8,["disabled","loading","class","onClick"]),l.createVNode(s,{class:l.normalizeClass([n.mq.md?"mx-2":"w-full"]),disabled:n.processing,status:n.mq.md?"link-secondary":"secondary",size:"lg",onClick:e[0]||(e[0]=u=>n.toggleModal=!1)},{default:l.withCtx(()=>[l.renderSlot(n.$slots,"cancelText",{},()=>[l.createTextVNode(l.toDisplayString(n.$t("HC_CANCEL")),1)],!0)]),_:3},8,["class","disabled","status"])])]),_:3})]),_:3},8,["overlay"])):l.createCommentVNode("",!0)]),_:3},8,["name"])}const lE=ge(qW,[["render",nK],["__scopeId","data-v-a8bfc627"]]),rK=l.defineComponent({name:"QPopover",props:{align:{type:String,default:"left"},hasCaret:{type:Boolean,default:!0},modelValue:{type:Boolean,default:!1},position:{type:String,default:"bottom"},reposition:{type:Boolean,default:!0},size:{type:String,default:"md"},trigger:{type:String,default:"click"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=l.ref(!1),r=l.ref(""),i=l.ref(null),o=l.computed(()=>t.value===!0&&n.reposition===!0?a(n.align):n.align),s=l.computed(()=>t.value===!0&&n.reposition===!0?c(n.position):n.position),a=b=>{if(!i.value||u(i.value.children[1]))return b;const w=i.value.children[0].getBoundingClientRect(),v=i.value.children[1].getBoundingClientRect();if(b==="left"||b==="right"||b==="center"){const k=w.left;return window.innerWidth-k<v.width?"right":"left"}else{const k=w.top;return window.innerHeight-k<v.height?"bottom":"top"}},c=b=>{if(!i.value||u(i.value.children[1]))return b;const w=i.value.children[0].getBoundingClientRect(),v=i.value.children[1].getBoundingClientRect();if(b==="top"||b==="bottom"){const k=w.top;return window.innerHeight-k<v.height?"top":"bottom"}else{const k=w.left;return window.innerWidth-k<v.width?"left":"right"}},u=b=>{const w=b.getBoundingClientRect();return w?w.top>=0&&w.left>=0&&w.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&w.right<=(window.innerWidth||document.documentElement.clientWidth):!1},d=()=>{(n.trigger==="click"||n.trigger==="both")&&e("update:modelValue",!n.modelValue)},f=()=>{n.trigger!=="click"&&e("update:modelValue",!1)},h=()=>{n.trigger!=="click"&&e("update:modelValue",!0)},p=()=>{var w;const b=(w=i.value)==null?void 0:w.children[0];if(b){const v=b.clientWidth,k=b.clientHeight;switch(o.value){case"left":r.value=`margin-left: ${v/2-10}px;`;break;case"right":r.value=`margin-right: ${v/2-10}px;`;break;case"top":r.value=`margin-top: ${k/2-10}px;`;break;case"bottom":r.value=`margin-bottom: ${k/2-10}px;`;break}}};F5(i,()=>{e("update:modelValue",!1)});function m(){t.value=!1}function y(){var b;t.value=!0,!u((b=i.value)==null?void 0:b.children[1])&&n.reposition===!0&&p()}return{entered:t,offsetStyle:r,popover:i,alignment:o,positioning:s,getAlignment:a,getPositioning:c,isElementInView:u,onAfterLeave:m,onClick:d,onClickOutside:F5,onEnter:y,onMouseLeave:f,onMouseOver:h}}});function iK(n,e,t,r,i,o){return l.openBlock(),l.createElementBlock("div",{ref:"popover",class:"popover-container",onMouseleave:e[0]||(e[0]=(...s)=>n.onMouseLeave&&n.onMouseLeave(...s))},[l.renderSlot(n.$slots,"trigger",{onClick:n.onClick,onMouseOver:n.onMouseOver},void 0,!0),l.createVNode(l.Transition,{name:"fade",onEnter:n.onEnter,onAfterLeave:n.onAfterLeave},{default:l.withCtx(()=>[n.modelValue?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["popover","popover-"+n.alignment,"popover-"+n.size,"popover-on-"+n.positioning,{"has-caret":n.hasCaret}]),style:l.normalizeStyle(n.offsetStyle)},[l.renderSlot(n.$slots,"content",{},void 0,!0)],6)):l.createCommentVNode("",!0)]),_:3},8,["onEnter","onAfterLeave"])],544)}const cE=ge(rK,[["render",iK],["__scopeId","data-v-86f2575d"]]);function Qt(n){this.content=n}Qt.prototype={constructor:Qt,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(t||n,e):(o[i+1]=e,t&&(o[i]=t)),new Qt(o)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Qt(t)},addToStart:function(n,e){return new Qt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Qt(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,e,t),new Qt(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Qt.from(n),n.size?new Qt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Qt.from(n),n.size?new Qt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Qt.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Qt.from=function(n){if(n instanceof Qt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Qt(e)};function uE(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),o=e.child(r);if(i==o){t+=i.nodeSize;continue}if(!i.sameMarkup(o))return t;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)t++;return t}if(i.content.size||o.content.size){let s=uE(i.content,o.content,t+1);if(s!=null)return s}t+=i.nodeSize}}function dE(n,e,t,r){for(let i=n.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:t,b:r};let s=n.child(--i),a=e.child(--o),c=s.nodeSize;if(s==a){t-=c,r-=c;continue}if(!s.sameMarkup(a))return{a:t,b:r};if(s.isText&&s.text!=a.text){let u=0,d=Math.min(s.text.length,a.text.length);for(;u<d&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,t--,r--;return{a:t,b:r}}if(s.content.size||a.content.size){let u=dE(s.content,a.content,t-1,r-1);if(u)return u}t-=c,r-=c}}class q{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,o){for(let s=0,a=0;a<t;s++){let c=this.content[s],u=a+c.nodeSize;if(u>e&&r(c,i+a,o||null,s)!==!1&&c.content.size){let d=a+1;c.nodesBetween(Math.max(0,e-d),Math.min(c.content.size,t-d),r,i+d)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let o="",s=!0;return this.nodesBetween(e,t,(a,c)=>{let u=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=u},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new q(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let o=0,s=0;s<t;o++){let a=this.content[o],c=s+a.nodeSize;c>e&&((s<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,t-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,t-s-1))),r.push(a),i+=a.nodeSize),s=c}return new q(r,i)}cutByIndex(e,t){return e==t?q.empty:e==0&&t==this.content.length?this:new q(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),o=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new q(i,o)}addToStart(e){return new q([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new q(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let i=this.content[t];e(i,r,t),r+=i.nodeSize}}findDiffStart(e,t=0){return uE(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return dE(this,e,t,r)}findIndex(e,t=-1){if(e==0)return bm(0,e);if(e==this.size)return bm(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||t>0?bm(r+1,s):bm(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return q.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new q(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return q.empty;let t,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(t||(t=e.slice(0,i)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new q(t||e,r)}static from(e){if(!e)return q.empty;if(e instanceof q)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new q([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}q.empty=new q([],0);const r6={index:0,offset:0};function bm(n,e){return r6.index=n,r6.offset=e,r6}function wm(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!wm(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!wm(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let We=class s8{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&wm(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return s8.none;if(e instanceof s8)return[e];let t=e.slice();return t.sort((r,i)=>r.type.rank-i.type.rank),t}};We.none=[];class vm extends Error{}class te{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=hE(this.content,e+this.openStart,t);return r&&new te(r,this.openStart,this.openEnd)}removeBetween(e,t){return new te(fE(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return te.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new te(q.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(t||!o.type.spec.isolating);o=o.lastChild)i++;return new te(e,r,i)}}te.empty=new te(q.empty,0,0);function fE(n,e,t){let{index:r,offset:i}=n.findIndex(e),o=n.maybeChild(r),{index:s,offset:a}=n.findIndex(t);if(i==e||o.isText){if(a!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(fE(o.content,e-i-1,t-i-1)))}function hE(n,e,t,r){let{index:i,offset:o}=n.findIndex(e),s=n.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=hE(s.content,e-o-1,t);return a&&n.replaceChild(i,s.copy(a))}function oK(n,e,t){if(t.openStart>n.depth)throw new vm("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new vm("Inconsistent open depths");return pE(n,e,t,0)}function pE(n,e,t,r){let i=n.index(r),o=n.node(r);if(i==e.index(r)&&r<n.depth-t.openStart){let s=pE(n,e,t,r+1);return o.copy(o.content.replaceChild(i,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let s=n.parent,a=s.content;return el(s,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=sK(t,n);return el(o,gE(n,s,a,e,r))}else return el(o,Cm(n,e,r))}function mE(n,e){if(!e.type.compatibleContent(n.type))throw new vm("Cannot join "+e.type.name+" onto "+n.type.name)}function i6(n,e,t){let r=n.node(t);return mE(r,e.node(t)),r}function Ja(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function b2(n,e,t,r){let i=(e||n).node(t),o=0,s=e?e.index(t):i.childCount;n&&(o=n.index(t),n.depth>t?o++:n.textOffset&&(Ja(n.nodeAfter,r),o++));for(let a=o;a<s;a++)Ja(i.child(a),r);e&&e.depth==t&&e.textOffset&&Ja(e.nodeBefore,r)}function el(n,e){return n.type.checkContent(e),n.copy(e)}function gE(n,e,t,r,i){let o=n.depth>i&&i6(n,e,i+1),s=r.depth>i&&i6(t,r,i+1),a=[];return b2(null,n,i,a),o&&s&&e.index(i)==t.index(i)?(mE(o,s),Ja(el(o,gE(n,e,t,r,i+1)),a)):(o&&Ja(el(o,Cm(n,e,i+1)),a),b2(e,t,i,a),s&&Ja(el(s,Cm(t,r,i+1)),a)),b2(r,null,i,a),new q(a)}function Cm(n,e,t){let r=[];if(b2(null,n,t,r),n.depth>t){let i=i6(n,e,t+1);Ja(el(i,Cm(n,e,t+1)),r)}return b2(e,null,t,r),new q(r)}function sK(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let o=t-1;o>=0;o--)i=e.node(o).copy(q.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}class w2{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return We.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),i=e.maybeChild(t);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new km(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,o=t;for(let s=e;;){let{index:a,offset:c}=s.content.findIndex(o),u=o-c;if(r.push(s,a,i+c),!u||(s=s.child(a),s.isText))break;o=u-1,i+=c+1}return new w2(t,r,o)}static resolveCached(e,t){for(let i=0;i<o6.length;i++){let o=o6[i];if(o.pos==t&&o.doc==e)return o}let r=o6[s6]=w2.resolve(e,t);return s6=(s6+1)%aK,r}}let o6=[],s6=0,aK=12;class km{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const lK=Object.create(null);let tl=class a8{constructor(e,t,r,i=We.none){this.type=e,this.attrs=t,this.marks=i,this.content=r||q.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,i=0){this.content.nodesBetween(e,t,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,i){return this.content.textBetween(e,t,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&wm(this.attrs,t||e.defaultAttrs||lK)&&We.sameSet(this.marks,r||We.none)}copy(e=null){return e==this.content?this:new a8(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new a8(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return te.empty;let i=this.resolve(e),o=this.resolve(t),s=r?0:i.sharedDepth(t),a=i.start(s),u=i.node(s).content.cut(i.pos-a,o.pos-a);return new te(u,i.depth-s,o.depth-s)}replace(e,t,r){return oK(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let i=this.content.child(t-1);return{node:i,index:t-1,offset:r-i.nodeSize}}resolve(e){return w2.resolveCached(this,e)}resolveNoCache(e){return w2.resolve(this,e)}rangeHasMark(e,t,r){let i=!1;return t>e&&this.nodesBetween(e,t,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),yE(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=q.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let c=i;c<o;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=We.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!We.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=q.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,i,r)}};tl.prototype.text=void 0;class Sm extends tl{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):yE(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Sm(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Sm(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function yE(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class nl{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new cK(e,t);if(r.next==null)return nl.empty;let i=bE(r);r.next&&r.err("Unexpected trailing text");let o=gK(mK(i));return yK(o,r),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let i=this;for(let o=t;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let i=[this];function o(s,a){let c=s.matchFragment(e,r);if(c&&(!t||c.validEnd))return q.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:d,next:f}=s.next[u];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let h=o(f,a.concat(d));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:c}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!i.type||c.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&t(r.next[i].next)}return t(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
|
|
132
132
|
`)}}nl.empty=new nl(!0);class cK{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function bE(n){let e=[];do e.push(uK(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function uK(n){let e=[];do e.push(dK(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function dK(n){let e=pK(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=fK(n,e);else break;return e}function wE(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function fK(n,e){let t=wE(n),r=t;return n.eat(",")&&(n.next!="}"?r=wE(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function hK(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let o in t){let s=t[o];s.groups.indexOf(e)>-1&&i.push(s)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function pK(n){if(n.eat("(")){let e=bE(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=hK(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function mK(n){let e=[[]];return i(o(n,0),t()),e;function t(){return e.push([])-1}function r(s,a,c){let u={term:c,to:a};return e[s].push(u),u}function i(s,a){s.forEach(c=>c.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((c,u)=>c.concat(o(u,a)),[]);if(s.type=="seq")for(let c=0;;c++){let u=o(s.exprs[c],a);if(c==s.exprs.length-1)return u;i(u,a=t())}else if(s.type=="star"){let c=t();return r(a,c),i(o(s.expr,c),c),[r(c)]}else if(s.type=="plus"){let c=t();return i(o(s.expr,a),c),i(o(s.expr,c),c),[r(c)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let c=a;for(let u=0;u<s.min;u++){let d=t();i(o(s.expr,c),d),c=d}if(s.max==-1)i(o(s.expr,c),c);else for(let u=s.min;u<s.max;u++){let d=t();r(c,d),i(o(s.expr,c),d),c=d}return[r(c)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function vE(n,e){return e-n}function CE(n,e){let t=[];return r(e),t.sort(vE);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);t.push(i);for(let s=0;s<o.length;s++){let{term:a,to:c}=o[s];!a&&t.indexOf(c)==-1&&r(c)}}}function gK(n){let e=Object.create(null);return t(CE(n,0));function t(r){let i=[];r.forEach(s=>{n[s].forEach(({term:a,to:c})=>{if(!a)return;let u;for(let d=0;d<i.length;d++)i[d][0]==a&&(u=i[d][1]);CE(n,c).forEach(d=>{u||i.push([a,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let o=e[r.join(",")]=new nl(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(vE);o.next.push({type:i[s][0],next:e[a.join(",")]||t(a)})}return o}}function yK(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:c,next:u}=i.next[a];s.push(c.name),o&&!(c.isText||c.hasRequiredAttrs())&&(o=!1),r.indexOf(u)==-1&&r.push(u)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function kE(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function SE(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function ME(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new bK(n[t]);return e}let EE=class wP{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ME(r.attrs),this.defaultAttrs=kE(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==nl.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:SE(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new tl(this,this.computeAttrs(e),q.from(t),We.setFrom(r))}createChecked(e=null,t,r){return t=q.from(t),this.checkContent(t),new tl(this,this.computeAttrs(e),t,We.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=q.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(q.empty,!0);return o?new tl(this,e,t.append(o),We.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:We.none:e}static compile(e,t){let r=Object.create(null);e.forEach((o,s)=>r[o]=new wP(o,t,s));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class bK{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class Mm{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=ME(i.attrs),this.excluded=null;let o=kE(this.attrs);this.instance=o?new We(this,o):null}create(e=null){return!e&&this.instance?this.instance:new We(this,SE(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new Mm(o,i++,t,s)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class wK{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Qt.from(e.nodes),t.marks=Qt.from(e.marks||{}),this.nodes=EE.compile(this.spec.nodes,this),this.marks=Mm.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;o.contentMatch=r[s]||(r[s]=nl.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.markSet=a=="_"?null:a?AE(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:AE(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof EE){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Sm(r,r.defaultAttrs,e,We.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return tl.fromJSON(this,e)}markFromJSON(e){return We.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function AE(n,e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],o=n.marks[i],s=o;if(o)t.push(o);else for(let a in n.marks){let c=n.marks[a];(i=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&t.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}class nc{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new OE(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new OE(this,t,!0);return r.addAll(e,t.from,t.to),te.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(kK(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,t,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(s.getAttrs){let c=s.getAttrs(t);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let t=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<t.length;s++){let a=t[s];if((a.priority==null?50:a.priority)<o)break}t.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=DE(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=DE(s)),s.node||s.ignore||s.mark||(s.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new nc(e,nc.schemaRules(e)))}}const TE={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},vK={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},xE={ol:!0,ul:!0},Em=1,Am=2,v2=4;function IE(n,e,t){return e!=null?(e?Em:0)|(e==="full"?Am:0):n&&n.whitespace=="pre"?Em|Am:t&~v2}class Tm{constructor(e,t,r,i,o,s,a){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=a,this.content=[],this.activeMarks=We.none,this.stashMarks=[],this.match=s||(a&v2?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(q.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Em)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let t=q.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(q.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let i=r[t];(this.type?this.type.allowsMarkType(i.type):MK(i.type,e))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!TE.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class OE{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let i=t.topNode,o,s=IE(null,t.preserveWhitespace,0)|(r?v2:0);i?o=new Tm(i.type,i.attrs,We.none,We.none,!0,t.topMatch||i.type.contentMatch,s):r?o=new Tm(null,null,We.none,We.none,!0,null,s):o=new Tm(e.schema.topNodeType,null,We.none,We.none,!0,null,s),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,t){let r=e.getAttribute("style");if(!r)return t();let i=this.readStyles(SK(r));if(!i)return;let[o,s]=i,a=this.top;for(let c=0;c<s.length;c++)this.removePendingMark(s[c],a);for(let c=0;c<o.length;c++)this.addPendingMark(o[c]);t();for(let c=0;c<o.length;c++)this.removePendingMark(o[c],a);for(let c=0;c<s.length;c++)this.addPendingMark(s[c])}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&Am||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&Em)r.options&Am?t=t.replace(/\r\n?/g,`
|
|
133
133
|
`):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],o=e.previousSibling;(!i||o&&o.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),i;xE.hasOwnProperty(r)&&this.parser.normalizeLists&&CK(e);let o=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,t));if(o?o.ignore:vK.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(e=o.skip);let s,a=this.top,c=this.needsBlock;if(TE.hasOwnProperty(r))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),s=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}o&&o.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),s&&this.sync(a),this.needsBlock=c}else this.withStyleRules(e,()=>{this.addElementByRule(e,o,o.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
134
134
|
`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=We.none,r=We.none;for(let i=0;i<e.length;i+=2)for(let o=void 0;;){let s=this.parser.matchStyle(e[i],e[i+1],this,o);if(!s)break;if(s.ignore)return null;if(s.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(a=>{s.clearMark(a)&&(r=a.addToSet(r))}):t=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(t),s.consuming===!1)o=s;else break}return[t,r]}addElementByRule(e,t,r){let i,o,s;t.node?(o=this.parser.schema.nodes[t.node],o.isLeaf?this.insertNode(o.create(t.attrs))||this.leafFallback(e):i=this.enter(o,t.attrs||null,t.preserveWhitespace)):(s=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(s));let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c)}i&&this.sync(a)&&this.open--,s&&this.removePendingMark(s,a)}addAll(e,t,r){let i=t||0;for(let o=t?e.childNodes[t]:e.firstChild,s=r==null?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],s=o.findWrapping(e);if(s&&(!t||t.length>s.length)&&(t=s,r=o,!s.length)||o.solid)break}if(!t)return!1;this.sync(r);for(let i=0;i<t.length;i++)this.enterInner(t[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let i=0;i<e.marks.length;i++)(!t.type||t.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let i=this.findPlace(e.create(t));return i&&this.enterInner(e,t,!0,r),i}enterInner(e,t=null,r=!1,i){this.closeExtra();let o=this.top;o.applyPending(e),o.match=o.match&&o.match.matchType(e);let s=IE(e,i,o.options);o.options&v2&&o.content.length==0&&(s|=v2),this.nodes.push(new Tm(e,t,o.activeMarks,o.pendingMarks,r,null,s)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,c)=>{for(;a>=0;a--){let u=t[a];if(u==""){if(a==t.length-1||a==0)continue;for(;c>=o;c--)if(s(a-1,c))return!0;return!1}else{let d=c>0||c==0&&i?this.nodes[c].type:r&&c>=o?r.node(c-o).type:null;if(!d||d.name!=u&&d.groups.indexOf(u)==-1)return!1;c--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=EK(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(e)>-1)i.pendingMarks=e.removeFromSet(i.pendingMarks);else{i.activeMarks=e.removeFromSet(i.activeMarks);let s=i.popFromStashMark(e);s&&i.type&&i.type.allowsMarkType(s.type)&&(i.activeMarks=s.addToSet(i.activeMarks))}if(i==t)break}}}function CK(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&xE.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function kK(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function SK(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function DE(n){let e={};for(let t in n)e[t]=n[t];return e}function MK(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let o=[],s=a=>{o.push(a);for(let c=0;c<a.edgeCount;c++){let{type:u,next:d}=a.edge(c);if(u==e||o.indexOf(d)<0&&s(d))return!0}};if(s(i.contentMatch))return!0}}function EK(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class pi{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=a6(t).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,c=0;for(;a<o.length&&c<s.marks.length;){let u=s.marks[c];if(!this.marks[u.type.name]){c++;continue}if(!u.eq(o[a][0])||u.type.spec.spanning===!1)break;a++,c++}for(;a<o.length;)i=o.pop()[1];for(;c<s.marks.length;){let u=s.marks[c++],d=this.serializeMark(u,s.isInline,t);d&&(o.push([u,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(s,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:i}=pi.renderSpec(a6(t),this.nodes[e.type.name](e));if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&pi.renderSpec(a6(r),i(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],o=i.indexOf(" ");o>0&&(r=i.slice(0,o),i=i.slice(o+1));let s,a=r?e.createElementNS(r,i):e.createElement(i),c=t[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):a.setAttribute(d,c[d])}}for(let d=u;d<t.length;d++){let f=t[d];if(f===0){if(d<t.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=pi.renderSpec(e,f,r);if(a.appendChild(h),p){if(s)throw new RangeError("Multiple content holes");s=p}}}return{dom:a,contentDOM:s}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new pi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=NE(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return NE(e.marks)}}function NE(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function a6(n){return n.document||window.document}const PE=65535,_E=Math.pow(2,16);function AK(n,e){return n+e*_E}function LE(n){return n&PE}function TK(n){return(n-(n&PE))/_E}const BE=1,RE=2,xm=4,$E=8;class l6{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&$E)>0}get deletedBefore(){return(this.delInfo&(BE|xm))>0}get deletedAfter(){return(this.delInfo&(RE|xm))>0}get deletedAcross(){return(this.delInfo&xm)>0}}class Jn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Jn.empty)return Jn.empty}recover(e){let t=0,r=LE(e);if(!this.inverted)for(let i=0;i<r;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+t+TK(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?i:0);if(c>e)break;let u=this.ranges[a+o],d=this.ranges[a+s],f=c+u;if(e<=f){let h=u?e==c?-1:e==f?1:t:t,p=c+i+(h<0?0:d);if(r)return p;let m=e==(t<0?c:f)?null:AK(a/3,e-c),y=e==c?RE:e==f?BE:xm;return(t<0?e!=c:e!=f)&&(y|=$E),new l6(p,y,m)}i+=d-u}return r?e+i:new l6(e+i,0,null)}touches(e,t){let r=0,i=LE(t),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let u=this.ranges[a+o],d=c+u;if(e<=d&&a==i*3)return!0;r+=this.ranges[a+s]-u}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),c=s+(this.inverted?0:o),u=this.ranges[i+t],d=this.ranges[i+r];e(a,a+u,c,c+d),o+=d-u}}invert(){return new Jn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Jn.empty:new Jn(e<0?[0,-e,0]:[0,0,e])}}Jn.empty=new Jn([]);class rc{constructor(e=[],t,r=0,i=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=i}slice(e=0,t=this.maps.length){return new rc(this.maps,this.mirror,e,t)}copy(){return new rc(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let i=e.getMirror(t);this.appendMap(e.maps[t],i!=null&&i<t?r+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new rc;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],a=s.mapResult(e,t);if(a.recover!=null){let c=this.getMirror(o);if(c!=null&&c>o&&c<this.to){o=c,e=this.maps[c].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new l6(e,i,null)}}const c6=Object.create(null);class un{getMap(){return Jn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=c6[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in c6)throw new RangeError("Duplicate use of step JSON ID "+e);return c6[e]=t,t.prototype.jsonID=e,t}}class Mt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Mt(e,null)}static fail(e){return new Mt(null,e)}static fromReplace(e,t,r,i){try{return Mt.ok(e.replace(t,r,i))}catch(o){if(o instanceof vm)return Mt.fail(o.message);throw o}}}function u6(n,e,t){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(u6(o.content,e,o))),o.isInline&&(o=e(o,t,i)),r.push(o)}return q.fromArray(r)}class ys extends un{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new te(u6(t.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),t.openStart,t.openEnd);return Mt.fromReplace(e,this.from,this.to,o)}invert(){return new mi(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ys(t.pos,r.pos,this.mark)}merge(e){return e instanceof ys&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ys(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ys(t.from,t.to,e.markFromJSON(t.mark))}}un.jsonID("addMark",ys);class mi extends un{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new te(u6(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return Mt.fromReplace(e,this.from,this.to,r)}invert(){return new ys(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new mi(t.pos,r.pos,this.mark)}merge(e){return e instanceof mi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new mi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new mi(t.from,t.to,e.markFromJSON(t.mark))}}un.jsonID("removeMark",mi);class bs extends un{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Mt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Mt.fromReplace(e,this.pos,this.pos+1,new te(q.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(r))return new bs(this.pos,t.marks[i]);return new bs(this.pos,this.mark)}}return new ic(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new bs(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new bs(t.pos,e.markFromJSON(t.mark))}}un.jsonID("addNodeMark",bs);class ic extends un{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Mt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Mt.fromReplace(e,this.pos,this.pos+1,new te(q.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new bs(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ic(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ic(t.pos,e.markFromJSON(t.mark))}}un.jsonID("removeNodeMark",ic);class Lt extends un{constructor(e,t,r,i=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=i}apply(e){return this.structure&&d6(e,this.from,this.to)?Mt.fail("Structure replace would overwrite content"):Mt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Jn([this.from,this.to-this.from,this.slice.size])}invert(e){return new Lt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Lt(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Lt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?te.empty:new te(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Lt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?te.empty:new te(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Lt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Lt(t.from,t.to,te.fromJSON(e,t.slice),!!t.structure)}}un.jsonID("replace",Lt);class Bt extends un{constructor(e,t,r,i,o,s,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(d6(e,this.from,this.gapFrom)||d6(e,this.gapTo,this.to)))return Mt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Mt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Mt.fromReplace(e,this.from,this.to,r):Mt.fail("Content does not fit in gap")}getMap(){return new Jn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Bt(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=e.map(this.gapFrom,-1),o=e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||i<t.pos||o>r.pos?null:new Bt(t.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Bt(t.from,t.to,t.gapFrom,t.gapTo,te.fromJSON(e,t.slice),t.insert,!!t.structure)}}un.jsonID("replaceAround",Bt);function d6(n,e,t){let r=n.resolve(e),i=t-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function xK(n,e,t,r){let i=[],o=[],s,a;n.doc.nodesBetween(e,t,(c,u,d)=>{if(!c.isInline)return;let f=c.marks;if(!r.isInSet(f)&&d.type.allowsMarkType(r.type)){let h=Math.max(u,e),p=Math.min(u+c.nodeSize,t),m=r.addToSet(f);for(let y=0;y<f.length;y++)f[y].isInSet(m)||(s&&s.to==h&&s.mark.eq(f[y])?s.to=p:i.push(s=new mi(h,p,f[y])));a&&a.to==h?a.to=p:o.push(a=new ys(h,p,r))}}),i.forEach(c=>n.step(c)),o.forEach(c=>n.step(c))}function IK(n,e,t,r){let i=[],o=0;n.doc.nodesBetween(e,t,(s,a)=>{if(!s.isInline)return;o++;let c=null;if(r instanceof Mm){let u=s.marks,d;for(;d=r.isInSet(u);)(c||(c=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(s.marks)&&(c=[r]):c=s.marks;if(c&&c.length){let u=Math.min(a+s.nodeSize,t);for(let d=0;d<c.length;d++){let f=c[d],h;for(let p=0;p<i.length;p++){let m=i[p];m.step==o-1&&f.eq(i[p].style)&&(h=m)}h?(h.to=u,h.step=o):i.push({style:f,from:Math.max(a,e),to:u,step:o})}}}),i.forEach(s=>n.step(new mi(s.from,s.to,s.style)))}function OK(n,e,t,r=t.contentMatch){let i=n.doc.nodeAt(e),o=[],s=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=s+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new Lt(s,u,te.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new mi(s,u,c.marks[f]));if(c.isText&&!t.spec.code){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new te(q.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new Lt(s+f.index,s+f.index+f[0].length,p))}}s=u}if(!r.validEnd){let a=r.fillBefore(q.empty,!0);n.replace(s,s,new te(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function DK(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function oc(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,s,t))return r;if(r==0||i.type.spec.isolating||!DK(i,o,s))break}return null}function NK(n,e,t){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),c=s,u=a,d=q.empty,f=0;for(let m=o,y=!1;m>t;m--)y||r.index(m)>0?(y=!0,d=q.from(r.node(m).copy(d)),f++):c--;let h=q.empty,p=0;for(let m=o,y=!1;m>t;m--)y||i.after(m+1)<i.end(m)?(y=!0,h=q.from(i.node(m).copy(h)),p++):u++;n.step(new Bt(c,u,s,a,new te(d.append(h),f,p),d.size-f,!0))}function f6(n,e,t=null,r=n){let i=PK(n,e),o=i&&_K(r,e);return o?i.map(FE).concat({type:e,attrs:t}).concat(o.map(FE)):null}function FE(n){return{type:n,attrs:null}}function PK(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return t.canReplaceWith(r,i,s)?o:null}function _K(n,e){let{parent:t,startIndex:r,endIndex:i}=n,o=t.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let u=r;c&&u<i;u++)c=c.matchType(t.child(u).type);return!c||!c.validEnd?null:s}function LK(n,e,t){let r=q.empty;for(let s=t.length-1;s>=0;s--){if(r.size){let a=t[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=q.from(t[s].type.create(t[s].attrs,r))}let i=e.start,o=e.end;n.step(new Bt(i,o,i,o,new te(r,0,0),t.length,!0))}function BK(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(e,t,(s,a)=>{if(s.isTextblock&&!s.hasMarkup(r,i)&&RK(n.doc,n.mapping.slice(o).map(a),r)){n.clearIncompatible(n.mapping.slice(o).map(a,1),r);let c=n.mapping.slice(o),u=c.map(a,1),d=c.map(a+s.nodeSize,1);return n.step(new Bt(u,d,u+1,d-1,new te(q.from(r.create(i,null,s.marks)),0,0),1,!0)),!1}})}function RK(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function $K(n,e,t,r,i){let o=n.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");t||(t=o.type);let s=t.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(e,e+o.nodeSize,s);if(!t.validContent(o.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Bt(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new te(q.from(s),0,0),1,!0))}function sc(n,e,t=1,r){let i=n.resolve(e),o=i.depth-t,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,d=t-2;u>o;u--,d--){let f=i.node(u),h=i.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let y=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!y.type.validContent(p))return!1}let a=i.indexAfter(o),c=r&&r[0];return i.node(o).canReplaceWith(a,a,c?c.type:i.node(o+1).type)}function FK(n,e,t=1,r){let i=n.doc.resolve(e),o=q.empty,s=q.empty;for(let a=i.depth,c=i.depth-t,u=t-1;a>c;a--,u--){o=q.from(i.node(a).copy(o));let d=r&&r[u];s=q.from(d?d.type.create(d.attrs,s):i.node(a).copy(s))}n.step(new Lt(e,e,new te(o.append(s),t,t),!0))}function ws(n,e){let t=n.resolve(e),r=t.index();return VE(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function VE(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function Im(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):t>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&VE(o,s)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function VK(n,e,t){let r=new Lt(e-t,e+t,te.empty,!0);n.step(r)}function jK(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,t))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,t))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function jE(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let o=0;o<t.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(t.openStart==0&&t.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,c=r.index(s)+(a>0?1:0),u=r.node(s),d=!1;if(o==1)d=u.canReplace(c,c,i);else{let f=u.contentMatchAt(c).findWrapping(i.firstChild.type);d=f&&u.canReplaceWith(c,c,f[0])}if(d)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Om(n,e,t=e,r=te.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),o=n.resolve(t);return zE(i,o,r)?new Lt(e,t,r):new zK(i,o,r).fit()}function zE(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class zK{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=q.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=q.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let c=new te(o,s,a);return e>-1?new Bt(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new Lt(r.pos,i.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=t.firstChild;if(t.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}t=o.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=h6(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:u}=this.frontier[a],d,f=null;if(t==1&&(s?u.matchType(s.type)||(f=u.fillBefore(q.from(s),!1)):o&&c.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:f};if(t==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:d};if(o&&u.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=h6(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new te(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=h6(e,t);if(i.childCount<=1&&t>0){let o=e.size-t<=t+i.size;this.unplaced=new te(C2(e,t-1,1),t-1,o?t-1:r)}else this.unplaced=new te(C2(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let y=0;y<o.length;y++)this.openFrontierNode(o[y]);let s=this.unplaced,a=r?r.content:s.content,c=s.openStart-e,u=0,d=[],{match:f,type:h}=this.frontier[t];if(i){for(let y=0;y<i.childCount;y++)d.push(i.child(y));f=f.matchFragment(i)}let p=a.size+e-(s.content.size-s.openEnd);for(;u<a.childCount;){let y=a.child(u),b=f.matchType(y.type);if(!b)break;u++,(u>1||c==0||y.content.size)&&(f=b,d.push(HE(y.mark(h.allowedMarks(y.marks)),u==1?c:0,u==a.childCount?p:-1)))}let m=u==a.childCount;m||(p=-1),this.placed=k2(this.placed,t,q.from(d)),this.frontier[t].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,b=a;y<p;y++){let w=b.lastChild;this.frontier.push({type:w.type,match:w.contentMatchAt(w.childCount)}),b=w.content}this.unplaced=m?e==0?te.empty:new te(C2(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new te(C2(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!p6(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=p6(e,t,i,r,o);if(s){for(let a=t-1;a>=0;a--){let{match:c,type:u}=this.frontier[a],d=p6(e,a,u,c,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=k2(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=k2(this.placed,this.depth,q.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(q.empty,!0);t.childCount&&(this.placed=k2(this.placed,this.frontier.length,t))}}function C2(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(C2(n.firstChild.content,e-1,t)))}function k2(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(k2(n.lastChild.content,e-1,t)))}function h6(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function HE(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,HE(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(q.empty,!0)))),n.copy(r)}function p6(n,e,t,r,i){let o=n.node(e),s=i?n.indexAfter(e):n.index(e);if(s==o.childCount&&!t.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!HK(t,o.content,s)?a:null}function HK(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function UK(n){return n.spec.defining||n.spec.definingForContent}function ZK(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let i=n.doc.resolve(e),o=n.doc.resolve(t);if(zE(i,o,r))return n.step(new Lt(e,t,r));let s=ZE(i,n.doc.resolve(t));s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let h=i.depth,p=i.pos-1;h>0;h--,p--){let m=i.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(h)>-1?a=h:i.before(h)==p&&s.splice(1,0,-h)}let c=s.indexOf(a),u=[],d=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(u.push(m),p==r.openStart)break;h=m.content}for(let h=d-1;h>=0;h--){let p=u[h],m=UK(p.type);if(m&&!p.sameMarkup(i.node(Math.abs(a)-1)))d=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+d+1)%(r.openStart+1),m=u[p];if(m)for(let y=0;y<s.length;y++){let b=s[(y+c)%s.length],w=!0;b<0&&(w=!1,b=-b);let v=i.node(b-1),k=i.index(b-1);if(v.canReplaceWith(k,k,m.type,m.marks))return n.replace(i.before(b),w?o.after(b):t,new te(UE(r.content,0,r.openStart,p),p,r.openEnd))}}let f=n.steps.length;for(let h=s.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>f));h--){let p=s[h];p<0||(e=i.before(p),t=o.after(p))}}function UE(n,e,t,r,i){if(e<t){let o=n.firstChild;n=n.replaceChild(0,o.copy(UE(o.content,e+1,t,r,o)))}if(e>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(q.empty,!0))}return n}function WK(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=jK(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new te(q.from(r),0,0))}function KK(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),o=ZE(r,i);for(let s=0;s<o.length;s++){let a=o[s],c=s==o.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&t>r.end(s)&&i.end(s)-t!=i.depth-s)return n.delete(r.before(s),t);n.delete(e,t)}function ZE(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||e.end(i)>e.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&t.push(i)}return t}class ac extends un{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return Mt.fail("No node at attribute step's position");let r=Object.create(null);for(let o in t.attrs)r[o]=t.attrs[o];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return Mt.fromReplace(e,this.pos,this.pos+1,new te(q.from(i),0,t.isLeaf?0:1))}getMap(){return Jn.empty}invert(e){return new ac(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ac(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ac(t.pos,t.attr,t.value)}}un.jsonID("attr",ac);class S2 extends un{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return Mt.ok(r)}getMap(){return Jn.empty}invert(e){return new S2(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new S2(t.attr,t.value)}}un.jsonID("docAttr",S2);let lc=class extends Error{};lc=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},lc.prototype=Object.create(Error.prototype),lc.prototype.constructor=lc,lc.prototype.name="TransformError";class WE{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new rc}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new lc(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=te.empty){let i=Om(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new te(q.from(r),0,0))}delete(e,t){return this.replace(e,t,te.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return ZK(this,e,t,r),this}replaceRangeWith(e,t,r){return WK(this,e,t,r),this}deleteRange(e,t){return KK(this,e,t),this}lift(e,t){return NK(this,e,t),this}join(e,t=1){return VK(this,e,t),this}wrap(e,t){return LK(this,e,t),this}setBlockType(e,t=e,r,i=null){return BK(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return $K(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new ac(e,t,r)),this}setDocAttribute(e,t){return this.step(new S2(e,t)),this}addNodeMark(e,t){return this.step(new bs(e,t)),this}removeNodeMark(e,t){if(!(t instanceof We)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new ic(e,t)),this}split(e,t=1,r){return FK(this,e,t,r),this}addMark(e,t,r){return xK(this,e,t,r),this}removeMark(e,t,r){return IK(this,e,t,r),this}clearIncompatible(e,t,r){return OK(this,e,t,r),this}}const m6=Object.create(null);class Ce{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new qK(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=te.empty){let r=t.content.lastChild,i=null;for(let a=0;a<t.openEnd;a++)i=r,r=r.lastChild;let o=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:c,$to:u}=s[a],d=e.mapping.slice(o);e.replaceRange(d.map(c.pos),d.map(u.pos),a?te.empty:t),a==0&&GE(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],c=e.mapping.slice(r),u=c.map(s.pos),d=c.map(a.pos);o?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),GE(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let i=e.parent.inlineContent?new be(e):cc(e.node(0),e.parent,e.pos,e.index(),t,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let s=t<0?cc(e.node(0),e.node(o),e.before(o+1),e.index(o),t,r):cc(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,r);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Wr(e.node(0))}static atStart(e){return cc(e,e,0,0,1)||new Wr(e)}static atEnd(e){return cc(e,e,e.content.size,e.childCount,-1)||new Wr(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=m6[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in m6)throw new RangeError("Duplicate use of selection JSON ID "+e);return m6[e]=t,t.prototype.jsonID=e,t}getBookmark(){return be.between(this.$anchor,this.$head).getBookmark()}}Ce.prototype.visible=!0;class qK{constructor(e,t){this.$from=e,this.$to=t}}let KE=!1;function qE(n){!KE&&!n.parent.inlineContent&&(KE=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class be extends Ce{constructor(e,t=e){qE(e),qE(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Ce.near(r);let i=e.resolve(t.map(this.anchor));return new be(i.parent.inlineContent?i:r,r)}replace(e,t=te.empty){if(super.replace(e,t),t==te.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof be&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Dm(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new be(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let o=Ce.findFrom(t,r,!0)||Ce.findFrom(t,-r,!0);if(o)t=o.$head;else return Ce.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(Ce.findFrom(e,-r,!0)||Ce.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new be(e,t)}}Ce.jsonID("text",be);class Dm{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Dm(e.map(this.anchor),e.map(this.head))}resolve(e){return be.between(e.resolve(this.anchor),e.resolve(this.head))}}class ce extends Ce{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:i}=t.mapResult(this.anchor),o=e.resolve(i);return r?Ce.near(o):new ce(o)}content(){return new te(q.from(this.node),0,0)}eq(e){return e instanceof ce&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new g6(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ce(e.resolve(t.anchor))}static create(e,t){return new ce(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ce.prototype.visible=!1,Ce.jsonID("node",ce);class g6{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Dm(r,r):new g6(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&ce.isSelectable(r)?new ce(t):Ce.near(t)}}class Wr extends Ce{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=te.empty){if(t==te.empty){e.delete(0,e.doc.content.size);let r=Ce.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Wr(e)}map(e){return new Wr(e)}eq(e){return e instanceof Wr}getBookmark(){return GK}}Ce.jsonID("all",Wr);const GK={map(){return this},resolve(n){return new Wr(n)}};function cc(n,e,t,r,i,o=!1){if(e.inlineContent)return be.create(n,t);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let a=e.child(s);if(a.isAtom){if(!o&&ce.isSelectable(a))return ce.create(n,t-(i<0?a.nodeSize:0))}else{let c=cc(n,a,t+i,i<0?a.childCount:0,i,o);if(c)return c}t+=a.nodeSize*i}return null}function GE(n,e,t){let r=n.steps.length-1;if(r<e)return;let i=n.steps[r];if(!(i instanceof Lt||i instanceof Bt))return;let o=n.mapping.maps[r],s;o.forEach((a,c,u,d)=>{s==null&&(s=d)}),n.setSelection(Ce.near(n.doc.resolve(s),t))}const YE=1,Nm=2,QE=4;class YK extends WE{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|YE)&~Nm,this.storedMarks=null,this}get selectionSet(){return(this.updated&YE)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Nm,this}ensureMarks(e){return We.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Nm)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Nm,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||We.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(t);o=r==t?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,o)),this.selection.empty||this.setSelection(Ce.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=QE,this}get scrolledIntoView(){return(this.updated&QE)>0}}function XE(n,e){return!e||!n?n:n.bind(e)}class M2{constructor(e,t,r){this.name=e,this.init=XE(t.init,r),this.apply=XE(t.apply,r)}}const QK=[new M2("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new M2("selection",{init(n,e){return n.selection||Ce.atStart(e.doc)},apply(n){return n.selection}}),new M2("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new M2("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class y6{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=QK.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new M2(r.key,r.spec.state,r))})}}class uc{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let c=i?i[s].n:0,u=i?i[s].state:this,d=c<t.length&&a.spec.appendTransaction.call(a,c?t.slice(c):t,u,r);if(d&&r.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<s?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),o=!0}i&&(i[s]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new uc(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new YK(this)}static create(e){let t=new y6(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new uc(t);for(let i=0;i<t.fields.length;i++)r[t.fields[i].name]=t.fields[i].init(e,r);return r}reconfigure(e){let t=new y6(this.schema,e.plugins),r=t.fields,i=new uc(t);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new y6(e.schema,e.plugins),o=new uc(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=tl.fromJSON(e.schema,t.doc);else if(s.name=="selection")o.selection=Ce.fromJSON(o.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let c=r[a],u=c.spec.state;if(c.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){o[s.name]=u.fromJSON.call(c,e,t[a],o);return}}o[s.name]=s.init(e,o)}}),o}}function JE(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=JE(i,e,{})),t[r]=i}return t}class Rt{constructor(e){this.spec=e,this.props={},e.props&&JE(e.props,this,this.props),this.key=e.key?e.key.key:eA("plugin")}getState(e){return e[this.key]}}const b6=Object.create(null);function eA(n){return n in b6?n+"$"+ ++b6[n]:(b6[n]=0,n+"$")}class $n{constructor(e="key"){this.key=eA(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const vn=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},E2=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let tA=null;const fo=function(n,e,t){let r=tA||(tA=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},rl=function(n,e,t,r){return t&&(nA(n,e,t,r,-1)||nA(n,e,t,r,1))},XK=/^(img|br|input|textarea|hr)$/i;function nA(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:gi(n))){let o=n.parentNode;if(!o||o.nodeType!=1||w6(n)||XK.test(n.nodeName)||n.contentEditable=="false")return!1;e=vn(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?gi(n):0}else return!1}}function gi(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function JK(n,e,t){for(let r=e==0,i=e==gi(n);r||i;){if(n==t)return!0;let o=vn(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==gi(n)}}function w6(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Pm=function(n){return n.focusNode&&rl(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function il(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function eq(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function tq(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const yi=typeof navigator<"u"?navigator:null,rA=typeof document<"u"?document:null,vs=yi&&yi.userAgent||"",v6=/Edge\/(\d+)/.exec(vs),iA=/MSIE \d/.exec(vs),C6=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vs),Fn=!!(iA||C6||v6),Cs=iA?document.documentMode:C6?+C6[1]:v6?+v6[1]:0,Kr=!Fn&&/gecko\/(\d+)/i.test(vs);Kr&&+(/Firefox\/(\d+)/.exec(vs)||[0,0])[1];const k6=!Fn&&/Chrome\/(\d+)/.exec(vs),dn=!!k6,nq=k6?+k6[1]:0,Cn=!Fn&&!!yi&&/Apple Computer/.test(yi.vendor),dc=Cn&&(/Mobile\/\w+/.test(vs)||!!yi&&yi.maxTouchPoints>2),vr=dc||(yi?/Mac/.test(yi.platform):!1),rq=yi?/Win/.test(yi.platform):!1,qr=/Android \d/.test(vs),A2=!!rA&&"webkitFontSmoothing"in rA.documentElement.style,iq=A2?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function oq(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function ho(n,e){return typeof n=="number"?n:n[e]}function sq(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function oA(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=t||n.dom;s;s=E2(s)){if(s.nodeType!=1)continue;let a=s,c=a==o.body,u=c?oq(o):sq(a),d=0,f=0;if(e.top<u.top+ho(r,"top")?f=-(u.top-e.top+ho(i,"top")):e.bottom>u.bottom-ho(r,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+ho(i,"top")-u.top:e.bottom-u.bottom+ho(i,"bottom")),e.left<u.left+ho(r,"left")?d=-(u.left-e.left+ho(i,"left")):e.right>u.right-ho(r,"right")&&(d=e.right-u.right+ho(i,"right")),d||f)if(c)o.defaultView.scrollBy(d,f);else{let h=a.scrollLeft,p=a.scrollTop;f&&(a.scrollTop+=f),d&&(a.scrollLeft+=d);let m=a.scrollLeft-h,y=a.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}if(c||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function aq(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=n.root.elementFromPoint(o,s);if(!a||a==n.dom||!n.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=t-20){r=a,i=c.top;break}}return{refDOM:r,refTop:i,stack:sA(n.dom)}}function sA(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=E2(r));return e}function lq({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;aA(t,r==0?0:r-e)}function aA(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:i,left:o}=n[t];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let fc=null;function cq(n){if(n.setActive)return n.setActive();if(fc)return n.focus(fc);let e=sA(n);n.focus(fc==null?{get preventScroll(){return fc={preventScroll:!0},!0}}:void 0),fc||(fc=!1,aA(e,0))}function lA(n,e){let t,r=2e8,i,o=0,s=e.top,a=e.top,c,u;for(let d=n.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=fo(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=s&&m.bottom>=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let y=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(y<r){t=d,r=y,i=y&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&y&&(o=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(o=f+1)}}return!t&&c&&(t=c,i=u,r=0),t&&t.nodeType==3?uq(t,i):!t||r&&t.nodeType==1?{node:n,offset:o}:lA(t,i)}function uq(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i<t;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=ks(r,1);if(o.top!=o.bottom&&S6(e,o))return{node:n,offset:i+(e.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function S6(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function dq(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function fq(n,e,t){let{node:r,offset:i}=lA(e,t),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function hq(n,e,t,r){let i=-1;for(let o=e,s=!1;o!=n.dom;){let a=n.docView.nearestDesc(o,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent&&!s||!a.contentDOM)){let c=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&!s&&(s=!0,c.left>r.left||c.top>r.top?i=a.posBefore:(c.right<r.left||c.bottom<r.top)&&(i=a.posAfter)),!a.contentDOM&&i<0&&!a.node.isText)return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter}o=a.dom.parentNode}return i>-1?i:n.docView.posFromDOM(e,t,-1)}function cA(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let c=0;c<a.length;c++){let u=a[c];if(S6(e,u))return cA(s,e,u)}}if((o=(o+1)%r)==i)break}return n}function pq(n,e){let t=n.dom.ownerDocument,r,i=0,o=tq(t,e.left,e.top);o&&({node:r,offset:i}=o);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let u=n.dom.getBoundingClientRect();if(!S6(e,u)||(s=cA(n.dom,e,u),!s))return null}if(Cn)for(let u=s;r&&u;u=E2(u))u.draggable&&(r=void 0);if(s=dq(s,e),r){if(Kr&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let d=r.childNodes[i],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let u;A2&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=hq(n,r,i,e))}a==null&&(a=fq(n,s,e));let c=n.docView.nearestDesc(s,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function uA(n){return n.top<n.bottom||n.left<n.right}function ks(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(uA(r))return r}return Array.prototype.find.call(t,uA)||n.getBoundingClientRect()}const mq=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function dA(n,e,t){let{node:r,offset:i,atom:o}=n.docView.domFromPos(e,t<0?-1:1),s=A2||Kr;if(r.nodeType==3)if(s&&(mq.test(r.nodeValue)||(t<0?!i:i==r.nodeValue.length))){let c=ks(fo(r,i,i),t);if(Kr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=ks(fo(r,i-1,i-1),-1);if(u.top==c.top){let d=ks(fo(r,i,i+1),-1);if(d.top!=c.top)return T2(d,d.left<u.left)}}return c}else{let c=i,u=i,d=t<0?1:-1;return t<0&&!i?(u++,d=-1):t>=0&&i==r.nodeValue.length?(c--,d=1):t<0?c--:u++,T2(ks(fo(r,c,u),d),d<0)}if(!n.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(t<0||i==gi(r))){let c=r.childNodes[i-1];if(c.nodeType==1)return M6(c.getBoundingClientRect(),!1)}if(o==null&&i<gi(r)){let c=r.childNodes[i];if(c.nodeType==1)return M6(c.getBoundingClientRect(),!0)}return M6(r.getBoundingClientRect(),t>=0)}if(o==null&&i&&(t<0||i==gi(r))){let c=r.childNodes[i-1],u=c.nodeType==3?fo(c,gi(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(u)return T2(ks(u,1),!1)}if(o==null&&i<gi(r)){let c=r.childNodes[i];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let u=c?c.nodeType==3?fo(c,0,s?0:1):c.nodeType==1?c:null:null;if(u)return T2(ks(u,-1),!0)}return T2(ks(r.nodeType==3?fo(r):r,-t),t>=0)}function T2(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function M6(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function fA(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function gq(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return fA(n,e,()=>{let{node:o}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.contentDOM||a.dom;break}o=a.dom.parentNode}let s=dA(n,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let c;if(a.nodeType==1)c=a.getClientRects();else if(a.nodeType==3)c=fo(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<c.length;u++){let d=c[u];if(d.bottom>d.top+1&&(t=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const yq=/[\u0590-\u08ac]/;function bq(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=n.domSelection();return!yq.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?o:s:fA(n,e,()=>{let{focusNode:c,focusOffset:u,anchorNode:d,anchorOffset:f}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:y}=n.domSelectionRange(),b=m&&!p.contains(m.nodeType==1?m:m.parentNode)||c==m&&u==y;try{a.collapse(d,f),c&&(c!=d||u!=f)&&a.extend&&a.extend(c,u)}catch{}return h!=null&&(a.caretBidiLevel=h),b})}let hA=null,pA=null,mA=!1;function wq(n,e,t){return hA==e&&pA==t?mA:(hA=e,pA=t,mA=t=="up"||t=="down"?gq(n,e,t):bq(n,e,t))}const Cr=0,gA=1,ol=2,bi=3;class x2{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=Cr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let i=this.children[t];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,s;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>vn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!t||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return o}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let i=this.children[t],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>e||s instanceof wA){i=e-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof yA&&o.side>=0;r--);if(t<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&t&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,t):{node:this.contentDOM,offset:o?vn(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,t):{node:this.contentDOM,offset:o?vn(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let c=this.children[a],u=s+c.size;if(i==-1&&e<=u){let d=s+c.border;if(e>=d&&t<=u-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,d);e=s;for(let f=a;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=vn(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(u>t||a==this.children.length-1)){t=u;for(let d=a+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=vn(f.dom);break}t+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,i=!1){let o=Math.min(e,t),s=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],y=p+m.size;if(o>p&&s<y)return m.setSelection(e-p-m.border,t-p-m.border,r,i);p=y}let a=this.domFromPos(e,e?-1:1),c=t==e?a:this.domFromPos(t,t?-1:1),u=r.getSelection(),d=!1;if((Kr||Cn)&&e==t){let{node:h,offset:p}=a;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
|
|
@@ -472,4 +472,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
472
472
|
opacity: 1;
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
`},datatable:{root:({props:n})=>({class:["relative",{"flex flex-col":n.scrollable&&n.scrollHeight==="flex"},{"h-full":n.scrollable&&n.scrollHeight==="flex"}]}),loadingoverlay:{class:["absolute","top-0 left-0","z-20","flex items-center justify-center","w-full h-full","bg-surface-100/0 dark:bg-surface-800/0","transition duration-200"]},loadingicon:{class:"w-8 h-8 animate-spin hidden"},wrapper:({props:n})=>({class:[{relative:n.scrollable,"flex flex-col grow":n.scrollable&&n.scrollHeight==="flex"},{"h-full":n.scrollable&&n.scrollHeight==="flex"}]}),header:({props:n})=>({class:["font-bold",n.showGridlines?"border-x border-t border-b-0":"border-y border-x-0","p-4","bg-surface-50 dark:bg-surface-800","border-surface-200 dark:border-surface-700","text-surface-700 dark:text-white/80"]}),table:{class:"w-full border-spacing-0 border-separate"},thead:({context:n})=>({class:[{"bg-surface-50 z-40 sticky":n.scrollable}]}),tbody:({instance:n,context:e})=>({class:[{"sticky z-20":n.frozenRow&&e.scrollable}]}),tfoot:({context:n})=>({class:[{"bg-surface-50 bottom-0 z-0":n.scrollable}]}),footer:{class:["font-bold","border-t-0 border-b border-x-0","p-4","bg-surface-50 dark:bg-surface-800","border-surface-200 dark:border-surface-700","text-surface-700 dark:text-white/80"]},column:{headercell:({context:n,props:e})=>({class:["font-bold",{"sticky z-20 border-b":e.frozen||e.frozen===""},{relative:n.resizable},"text-left",{"first:border-l border-y border-r":n==null?void 0:n.showGridlines},"border-0 border-b border-solid",(n==null?void 0:n.size)==="small"?"p-2":(n==null?void 0:n.size)==="large"?"p-5":"p-4",(e.sortable===""||e.sortable)&&n.sorted?"bg-primary-50 text-primary-700":"bg-surface-50 text-surface-700",(e.sortable===""||e.sortable)&&n.sorted?"dark:text-white dark:bg-primary-400/30":"dark:text-white/80 dark:bg-surface-800","border-surface-200 dark:border-surface-700 ",{"hover:bg-surface-100 dark:hover:bg-surface-400/30":(e.sortable===""||e.sortable)&&!(n!=null&&n.sorted)},"focus-visible:outline-none focus-visible:outline-offset-0 focus-visible:ring focus-visible:ring-inset focus-visible:ring-primary-400/50 dark:focus-visible:ring-primary-300/50",{"transition duration-200":e.sortable===""||e.sortable},{"cursor-pointer":e.sortable===""||e.sortable},{"overflow-hidden space-nowrap border-y bg-clip-padding":n.resizable}]}),headercontent:{class:"flex items-center"},sort:({context:n})=>({class:[n.sorted?"text-primary-500":"text-surface-700",n.sorted?"dark:text-primary-400":"dark:text-white/80"]}),bodycell:({props:n,context:e,state:t,parent:r})=>({class:[{"sticky box-border border-b":r.instance.frozenRow},{"sticky box-border border-b":n.frozen||n.frozen===""},"text-left","border-0 border-b border-solid",{"first:border-l border-r border-b":e==null?void 0:e.showGridlines},{"bg-surface-0 dark:bg-surface-800":r.instance.frozenRow||n.frozen||n.frozen===""},{"p-2":(e==null?void 0:e.size)==="small"&&!t.d_editing},{"p-5":(e==null?void 0:e.size)==="large"&&!t.d_editing},{"p-4":(e==null?void 0:e.size)!=="large"&&(e==null?void 0:e.size)!=="small"&&!t.d_editing},{"py-[0.6rem] px-2":t.d_editing},"border-surface-200 dark:border-surface-700"]}),footercell:({context:n})=>({class:["font-bold","text-left","border-0 border-b border-solid",{"border-x border-y":n==null?void 0:n.showGridlines},(n==null?void 0:n.size)==="small"?"p-2":(n==null?void 0:n.size)==="large"?"p-5":"p-4","border-surface-200 dark:border-surface-700","text-surface-700 dark:text-white/80","bg-surface-50 dark:bg-surface-800"]}),sorticon:({context:n})=>({class:["ml-2",n.sorted?"text-primary-700 dark:text-white/80":"text-surface-700 dark:text-white/70"]}),sortbadge:{class:["flex items-center justify-center align-middle","rounded-full","w-[1.143rem] leading-[1.143rem]","ml-2","text-primary-700 dark:text-white","bg-primary-50 dark:bg-primary-400/30"]},columnfilter:{class:"inline-flex items-center ml-auto"},filteroverlay:{class:["absolute top-0 left-0","border-0 dark:border","rounded-md","shadow-md","min-w-[12.5rem]","bg-surface-0 dark:bg-surface-800","text-surface-800 dark:text-white/80","dark:border-surface-700"]},filtermatchmodedropdown:{root:({state:n})=>({class:["flex","relative","my-2","w-full","rounded-md","bg-surface-0 dark:bg-surface-900","border border-surface-300 dark:border-surface-700","text-surface-800 dark:text-white/80","placeholder:text-surface-400 dark:placeholder:text-surface-500","transition-all","duration-200","hover:border-primary-500 dark:hover:border-primary-300",{"outline-none outline-offset-0 ring ring-primary-400/50 dark:ring-primary-300/50":n.focused},"cursor-pointer","select-none"]})},filterrowitems:{class:"m-0 p-0 py-3 list-none"},filterrowitem:({context:n})=>({class:["font-normal","leading-none","relative","border-0","rounded-none","m-0","py-3 px-5",{"text-surface-700 dark:text-white/80":!(n!=null&&n.highlighted)},{"bg-surface-0 dark:bg-surface-800 text-surface-700 dark:text-white/80":!(n!=null&&n.highlighted)},{"bg-primary-100 dark:bg-primary-400/40 text-primary-700 dark:text-white/80":n==null?void 0:n.highlighted},{"bg-primary-50 dark:bg-primary-400/40 text-primary-700 dark:text-white/80":n==null?void 0:n.highlighted},{"hover:bg-surface-100 dark:hover:bg-surface-600/80":!(n!=null&&n.highlighted)},{"hover:text-surface-700 hover:bg-surface-100 dark:hover:text-white dark:hover:bg-surface-600/80":!(n!=null&&n.highlighted)},"focus-visible:outline-none focus-visible:outline-offset-0 focus-visible:ring focus-visible:ring-inset focus-visible:ring-primary-400/50 dark:focus-visible:ring-primary-300/50","transition-shadow","duration-200","cursor-pointer","overflow-hidden","whitespace-nowrap"]}),filteroperator:{class:["px-5 py-3","border-b border-solid","rounded-t-md","text-surface-700 dark:text-white/80","border-surface-200 dark:border-surface-800","bg-surface-0 dark:bg-surface-700"]},filteroperatordropdown:{root:({state:n})=>({class:["inline-flex","relative","w-full","rounded-md","bg-surface-0 dark:bg-surface-900","border border-surface-300 dark:border-surface-700","transition-all","duration-200","hover:border-primary-500 dark:hover:border-primary-300",{"outline-none outline-offset-0 ring ring-primary-400/50 dark:ring-primary-300/50":n.focused},"cursor-pointer","select-none"]}),input:({props:n})=>({class:["font-sans","leading-none","block","flex-auto","bg-transparent","border-0",{"text-surface-800 dark:text-white/80":n.modelValue,"text-surface-400 dark:text-surface-500":!n.modelValue},"placeholder:text-surface-400 dark:placeholder:text-surface-500","w-[1%]","p-3","rounded-none","transition","duration-200","focus:outline-none focus:shadow-none","relative","cursor-pointer","overflow-hidden overflow-ellipsis","whitespace-nowrap","appearance-none"]}),trigger:{class:["flex items-center justify-center","shrink-0","bg-transparent","text-surface-500","w-12","rounded-tr-md","rounded-br-md"]},panel:{class:["absolute top-0 left-0","border-0 dark:border","rounded-md","shadow-md","bg-surface-0 dark:bg-surface-800","text-surface-800 dark:text-white/80","dark:border-surface-700"]},item:({context:n})=>({class:["font-normal","leading-none","relative","border-0","rounded-none","m-0","py-3 px-5",{"text-surface-700 dark:text-white/80":!n.focused&&!n.selected},{"bg-surface-50 dark:bg-surface-600/60 text-surface-700 dark:text-white/80":n.focused&&!n.selected},{"bg-primary-100 dark:bg-primary-400/40 text-primary-700 dark:text-white/80":n.focused&&n.selected},{"bg-primary-50 dark:bg-primary-400/40 text-primary-700 dark:text-white/80":!n.focused&&n.selected},{"hover:bg-surface-100 dark:hover:bg-surface-600/80":!n.focused&&!n.selected},{"hover:text-surface-700 hover:bg-surface-100 dark:hover:text-white dark:hover:bg-surface-600/80":n.focused&&!n.selected},"transition-shadow","duration-200","cursor-pointer","overflow-hidden","whitespace-nowrap"]})},filterconstraint:{class:["py-3 px-5","border-b border-solid","border-surface-200 dark:border-surface-700"]},filteraddrule:{class:"py-3 px-5"},filteraddrulebutton:{root:{class:["relative","items-center inline-flex text-center align-bottom justify-center","text-sm py-2 px-3 w-full","rounded-md","bg-transparent border-transparent","text-primary-500 dark:text-primary-400","hover:bg-primary-300/20","transition duration-200 ease-in-out","cursor-pointer overflow-hidden select-none"]},label:{class:"flex-auto grow-0"},icon:{class:"mr-2"}},filterremovebutton:{root:{class:["relative","items-center inline-flex text-center align-bottom justify-center","text-sm py-2 px-3 w-full mt-2","rounded-md","bg-transparent border-transparent","text-red-500 dark:text-red-400","hover:bg-red-300/20","transition duration-200 ease-in-out","cursor-pointer overflow-hidden select-none"]},label:{class:"flex-auto grow-0"},icon:{class:"mr-2"}},filterbuttonbar:{class:["flex items-center justify-between","py-3 px-5"]},filterclearbutton:{root:{class:["relative","items-center inline-flex text-center align-bottom justify-center","text-sm py-2 px-3","rounded-md","text-primary-500 border border-primary-500","hover:bg-primary-300/20","transition duration-200 ease-in-out","cursor-pointer overflow-hidden select-none"]}},filterapplybutton:{root:{class:["relative","items-center inline-flex text-center align-bottom justify-center","text-sm py-2 px-3","rounded-md","text-white dark:text-surface-900","bg-primary-500 dark:bg-primary-400","hover:bg-primary-600 dark:hover:bg-primary-300 hover:border-primary-600 dark:hover:border-primary-300","transition duration-200 ease-in-out","cursor-pointer overflow-hidden select-none"]}},filtermenubutton:({context:n})=>({class:["relative","inline-flex items-center justify-center","w-8 h-8","ml-2","rounded-full",{"bg-primary-50 text-primary-700":n.active},"dark:text-white/70 dark:hover:text-white/80 dark:bg-surface-800","hover:text-surface-700 hover:bg-surface-300/20","focus:outline-none focus:outline-offset-0 focus:ring focus:ring-primary-400/50 dark:focus:ring-primary-300/50","transition duration-200","cursor-pointer no-underline overflow-hidden"]}),headerfilterclearbutton:({context:n})=>({class:["relative","inline-flex items-center justify-center","text-left","border-none","m-0 p-0 ml-2","bg-transparent","cursor-pointer no-underline overflow-hidden select-none",{invisible:!n.hidden}]}),rowtoggler:{class:["relative","inline-flex items-center justify-center","text-left","m-0 p-0","w-8 h-8","border-0 rounded-full","text-surface-500 dark:text-white/70","bg-transparent","focus-visible:outline-none focus-visible:outline-offset-0","focus-visible:ring focus-visible:ring-primary-400/50 dark:focus-visible:ring-primary-300/50","transition duration-200","overflow-hidden","cursor-pointer select-none"]},columnresizer:{class:["block","absolute top-0 right-0","w-2 h-full","m-0 p-0","border border-transparent","cursor-col-resize"]},rowreordericon:{class:"cursor-move"},roweditorinitbutton:{class:["relative","inline-flex items-center justify-center","text-left","w-8 h-8","border-0 rounded-full","text-surface-700 dark:text-white/70","border-transparent","focus:outline-none focus:outline-offset-0 focus:ring focus:ring-primary-400/50 dark:focus:ring-primary-300/50","hover:text-surface-700 hover:bg-surface-300/20","transition duration-200","overflow-hidden","cursor-pointer select-none"]},roweditorsavebutton:{class:["relative","inline-flex items-center justify-center","text-left","w-8 h-8","border-0 rounded-full","text-surface-700 dark:text-white/70","border-transparent","focus:outline-none focus:outline-offset-0 focus:ring focus:ring-primary-400/50 dark:focus:ring-primary-300/50","hover:text-surface-700 hover:bg-surface-300/20","transition duration-200","overflow-hidden","cursor-pointer select-none"]},roweditorcancelbutton:{class:["relative","inline-flex items-center justify-center","text-left","w-8 h-8","border-0 rounded-full","text-surface-700 dark:text-white/70","border-transparent","focus:outline-none focus:outline-offset-0 focus:ring focus:ring-primary-400/50 dark:focus:ring-primary-300/50","hover:text-surface-700 hover:bg-surface-300/20","transition duration-200","overflow-hidden","cursor-pointer select-none"]},radiobuttonwrapper:{class:["relative","inline-flex align-bottom","w-6 h-6","cursor-pointer select-none"]},radiobutton:({context:n})=>({class:["flex justify-center items-center","w-[1.571rem] h-[1.571rem]","border-2 rounded-full",{"text-surface-700 dark:text-white/80":!n.checked},{"bg-surface-0 dark:bg-surface-900":!n.checked},{"border-surface-300 dark:border-surface-700":!n.checked},{"border-primary-500 dark:border-primary-400":n.checked},{"bg-primary-500 dark:bg-primary-400":n.checked},{"hover:border-primary-500 dark:hover:border-primary-400":!n.disabled},{"outline-none outline-offset-0 ring ring-primary-400/50 ring-inset dark:ring-primary-300/50":n.focused},"transition duration-200 ease-in-out",{"cursor-default opacity-60":n.disabled}]}),radiobuttonicon:({context:n})=>({class:["block","rounded-full","w-3 h-3","bg-surface-0 dark:bg-surface-900","transition duration-200 transform",{"backface-hidden scale-10 invisible":n.checked===!1,"transform scale-100 visible":n.checked===!0}]}),headercheckboxwrapper:{class:["relative","inline-flex align-bottom","w-6 h-6","cursor-pointer select-none"]},headercheckbox:({context:n})=>({class:["flex items-center justify-center","border-2 rounded-lg","w-6 h-6","text-surface-600",{"border-surface-200 bg-surface-0 dark:border-surface-700 dark:bg-surface-900":!n.checked,"border-primary-500 bg-primary-500 dark:border-primary-400 dark:bg-primary-400":n.checked},"focus:outline-none focus:outline-offset-0",{"ring ring-primary-400/50 dark:ring-primary-300/50":n.focused},"transition-colors duration-200",{"cursor-default opacity-60":n.disabled}]}),headercheckboxicon:{class:["w-4 h-4","text-base leading-none","text-white dark:text-surface-900","transition-all duration-200"]},checkboxwrapper:{class:["relative","inline-flex align-bottom","w-6 h-6","cursor-pointer select-none"]},checkbox:({context:n})=>({class:["flex items-center justify-center","border-2 rounded-lg","w-6 h-6","text-surface-600",{"border-surface-200 bg-surface-0 dark:border-surface-700 dark:bg-surface-900":!n.checked,"border-primary-500 bg-primary-500 dark:border-primary-400 dark:bg-primary-400":n.checked},"focus:outline-none focus:outline-offset-0",{"ring ring-primary-400/50 dark:ring-primary-300/50":n.focused},"transition-colors duration-200",{"cursor-default opacity-60":n.disabled}]}),checkboxicon:{class:["w-4 h-4","text-base leading-none","text-white dark:text-surface-900","transition-all duration-200"]},transition:{enterFromClass:"opacity-0 scale-y-[0.8]",enterActiveClass:"transition-[transform,opacity] duration-[120ms] ease-[cubic-bezier(0,0,0.2,1)]",leaveActiveClass:"transition-opacity duration-100 ease-linear",leaveToClass:"opacity-0"}},bodyrow:({context:n,props:e})=>({class:["dark:text-white/80",{"bg-primary-50 text-primary-600 dark:bg-primary-400/30":n.selected},{"bg-surface-0 text-surface-600 dark:bg-surface-800":!n.selected},{"font-bold bg-surface-0 dark:bg-surface-800":e.frozenRow},{"odd:bg-surface-0 odd:text-surface-600 dark:odd:bg-surface-800 even:bg-surface-50 even:text-surface-600 dark:even:bg-surface-900/50":n.stripedRows},{"hover:bg-surface-300/20 hover:text-surface-600":e.selectionMode&&!n.selected},{"transition duration-200":e.selectionMode&&!n.selected||e.rowHover},{"cursor-pointer":e.selectionMode}]}),rowexpansion:{class:"bg-surface-0 dark:bg-surface-800 text-surface-600 dark:text-white/80"},rowgroupheader:{class:["sticky z-20","bg-surface-0 text-surface-600 dark:text-white/70","dark:bg-surface-800"]},rowgroupfooter:{class:["sticky z-20","bg-surface-0 text-surface-600 dark:text-white/70","dark:bg-surface-800"]},rowgrouptoggler:{class:["relative","inline-flex items-center justify-center","text-left","m-0 p-0","w-8 h-8","border-0 rounded-full","text-surface-500 dark:text-white/70","bg-transparent","focus-visible:outline-none focus-visible:outline-offset-0","focus-visible:ring focus-visible:ring-primary-400/50 dark:focus-visible:ring-primary-300/50","transition duration-200","overflow-hidden","cursor-pointer select-none"]},rowgrouptogglericon:{class:"inline-block w-4 h-4"},resizehelper:{class:"absolute hidden w-[2px] z-20 bg-primary-500 dark:bg-primary-400"}},selectbutton:{root:({props:n})=>({class:[{"opacity-60 select-none pointer-events-none cursor-default":n.disabled}]}),button:({context:n})=>({class:["relative","leading-normal text-base","inline-flex items-center align-bottom text-center","px-4 py-2","rounded-lg",{"bg-gray-0 text-gray-40":!n.active,"button-active bg-white text-inkwell-30":n.active},{"opacity-60 select-none pointer-events-none cursor-default":n.disabled},"transition duration-200","cursor-pointer select-none overflow-hidden"]}),label:{class:"font-bold"}},galleria:{content:({parent:n,props:e})=>({class:["flex",{"flex-col":e.fullScreen},{"flex-col":n.props.thumbnailsPosition==="top"||n.props.thumbnailsPosition==="bottom","flex-row":n.props.thumbnailsPosition==="right"||n.props.thumbnailsPosition==="left"}]}),itemwrapper:({parent:n,props:e})=>({class:["group","flex relative","mt-14 md:mt-20 min-h-[78vh]",{"grow shrink w-0 justify-center":e.fullScreen},{"flex-col":n.props.indicatorsPosition==="bottom"||n.props.indicatorsPosition==="top","flex-row items-center":n.props.indicatorsPosition==="left"||n.props.indicatorsPosition==="right"},{"order-2":n.props.thumbnailsPosition==="top"||n.props.thumbnailsPosition==="left","flex-row":n.props.thumbnailsPosition==="right"}]}),itemcontainer:({parent:n})=>({class:["flex w-full md:w-screen h-full relative grow items-center",{"order-1":n.props.indicatorsPosition==="bottom"||n.props.indicatorsPosition==="right","order-2":n.props.indicatorsPosition==="top"||n.props.indicatorsPosition==="left"}]}),item:{class:["flex justify-center items-center","h-full w-full","rounded-lg overflow-auto","md:max-w-[592px] mx-auto"]},thumbnailwrapper:({parent:n})=>({class:["flex flex-col shrink-0",{"order-1":n.props.thumbnailsPosition==="top"||n.props.thumbnailsPosition==="left"},"overflow-auto"]}),thumbnailcontainer:({parent:n})=>({class:["flex","p-4","bg-transparent","md:max-w-[592px] mx-auto",{"flex-row":n.props.thumbnailsPosition==="top"||n.props.thumbnailsPosition==="bottom","flex-col grow":n.props.thumbnailsPosition==="right"||n.props.thumbnailsPosition==="left"}]}),previousthumbnailbutton:{class:["self-center relative","flex shrink-0 justify-center items-center overflow-hidden","m-2 ml-0","bg-transparent text-white w-8 h-8 rounded-full transition duration-200 ease-in-out","hover:bg-surface-0/10 hover:text-white","focus:outline-none focus:outline-offset-0"]},thumbnailitemscontainer:{class:"overflow-hidden w-full md:w-[30rem]"},thumbnailitems:({parent:n})=>({class:["flex",{"flex-col h-full":n.props.thumbnailsPosition==="right"||n.props.thumbnailsPosition==="left"}]}),thumbnailitem:({parent:n})=>({class:["flex items-center justify-center","grow shrink-0",{"w-full md:w-[25%]":n.props.thumbnailsPosition==="top"||n.props.thumbnailsPosition==="bottom"},"overflow-auto","cursor-pointer","hover:opacity-100","hover:transition-opacity","hover:duration-300"]}),nextthumbnailbutton:{class:["self-center relative","flex shrink-0 justify-center items-center overflow-hidden","m-2 mr-0","bg-transparent text-white w-8 h-8 rounded-full transition duration-200 ease-in-out","hover:bg-surface-0/10 hover:text-white","focus:outline-none focus:outline-offset-0"]},indicators:({parent:n})=>({class:["flex items-center justify-center","p-4",{"order-2":n.props.indicatorsPosition=="bottom","order-1":n.props.indicatorsPosition=="top","order-1 flex-col":n.props.indicatorsPosition=="left","flex-col order-2":n.props.indicatorsPosition=="right"},{"absolute z-10 bg-black/50":n.props.showIndicatorsOnItem},{"bottom-0 left-0 w-full items-start":n.props.indicatorsPosition=="bottom"&&n.props.showIndicatorsOnItem,"top-0 left-0 w-full items-start":n.props.indicatorsPosition=="top"&&n.props.showIndicatorsOnItem,"left-0 top-0 h-full items-start":n.props.indicatorsPosition=="left"&&n.props.showIndicatorsOnItem,"right-0 top-0 h-full items-start":n.props.indicatorsPosition=="right"&&n.props.showIndicatorsOnItem}]}),indicator:({parent:n})=>({class:[{"mr-2":n.props.indicatorsPosition=="bottom"||n.props.indicatorsPosition=="top","mb-2":n.props.indicatorsPosition=="left"||n.props.indicatorsPosition=="right"}]}),indicatorbutton:({context:n})=>({class:["w-2 h-2","rounded-full transition duration-200","focus:outline-none focus:outline-offset-0",{"bg-inkwell-30 hover:bg-surface-300 dark:bg-surface-700 dark:hover:bg-surface-600":!n.highlighted},{"bg-white hover:bg-primary-600":n.highlighted}]}),mask:{class:["fixed top-0 left-0 w-full h-full","flex items-center justify-center","bg-inkwell-40/95","image-overlay"]},closebutton:{class:["!absolute top-0 right-0 z-[1001]","flex justify-center items-center overflow-hidden","m-2","text-white bg-transparent w-12 h-12 rounded-full transition duration-200 ease-in-out","focus:outline-none"]},closeicon:{class:"w-6 h-6"},previousitembutton:({parent:n})=>({class:["inline-flex justify-center items-center overflow-hidden","bg-transparent text-white w-16 h-16 transition duration-200 ease-in-out rounded-md",{"opacity-0 group-hover:opacity-100":n.props.showItemNavigatorsOnHover},"mx-2","top-1/2 mt-[-0.5rem] left-0",{"!absolute":n.props.showItemNavigators,"!fixed":!n.props.showItemNavigators},"hover:bg-surface-0/10 hover:text-white","focus:outline-none focus:outline-offset-0"]}),nextitembutton:({parent:n})=>({class:["inline-flex justify-center items-center overflow-hidden","bg-transparent text-white w-16 h-16 transition duration-200 ease-in-out rounded-md",{"opacity-0 group-hover:opacity-100":n.props.showItemNavigatorsOnHover},"mx-2","top-1/2 mt-[-0.5rem] right-0",{"!absolute":n.props.showItemNavigators,"!fixed":!n.props.showItemNavigators},"hover:bg-surface-0/10 hover:text-white","focus:outline-none focus:outline-offset-0"]}),caption:{class:["absolute bottom-0 left-0 w-full","bg-black/50 text-white p-4"]},transition:{enterFromClass:"opacity-0 scale-75",enterActiveClass:"transition-all duration-150 ease-in-out",leaveActiveClass:"transition-all duration-150 ease-in",leaveToClass:"opacity-0 scale-75"}},fileupload:{input:{class:"hidden"},buttonbar:{class:["flex","flex-wrap","bg-surface-50","dark:bg-surface-800","text-surface-700","dark:text-white/80","p-5","gap-2","border","border-solid","border-surface-200","dark:border-surface-700","border-b-0","rounded-tr-lg","rounded-tl-lg"]},chooseButton:{class:["relative","items-center inline-flex text-center align-bottom justify-center","px-4 py-3","rounded-md","leading-[normal]","font-bold","text-white dark:text-surface-900","bg-primary-500 dark:bg-primary-400","border-primary-500 dark:border-primary-400","hover:bg-primary-600 dark:hover:bg-primary-300","overflow-hidden","cursor-pointer"]},chooseIcon:{class:["mr-2","inline-block"]},chooseButtonLabel:{class:["flex-1","font-bold"]},uploadbutton:{icon:{class:"mr-2"}},cancelbutton:{icon:{class:"mr-2"}},content:{class:["relative","bg-surface-0","dark:bg-surface-900","text-surface-700","dark:text-white/80","p-8","border","border-surface-200","dark:border-surface-700","rounded-b-lg"]},file:{class:["flex","items-center","flex-wrap","p-4","mb-2","last:mb-0","border","border-surface-200","dark:border-surface-700","gap-2","rounded"]},thumbnail:{class:"shrink-0"},fileName:{class:"mb-2"},fileSize:{class:"mr-2"},uploadicon:{class:"mr-2"},progressbar:{root:{class:["overflow-hidden","absolute top-0 left-0","border-0","h-2","rounded-md","w-full","bg-surface-100 dark:bg-surface-700"]},value:{class:["absolute flex items-center justify-center overflow-hidden","bg-primary-500 dark:bg-primary-400","m-0","h-full w-0","border-0","transition-width duration-1000 ease-in-out"]}}}},Bf=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}));var Rf={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},K2e=/([astvzqmhlc])([^astvzqmhlc]*)/gi,q2e=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function G2e(n){const e=n.match(q2e);return e?e.map(Number):[]}function ZD(n){const e=[],t=String(n).trim();return t[0]!=="M"&&t[0]!=="m"||t.replace(K2e,(r,i,o)=>{const s=G2e(o);let a=i.toLowerCase(),c=i;if(a==="m"&&s.length>2&&(e.push([c,...s.splice(0,2)]),a="l",c=c==="m"?"l":"L"),s.length<Rf[a])return"";for(e.push([c,...s.splice(0,Rf[a])]);s.length>=Rf[a]&&s.length&&Rf[a];)e.push([c,...s.splice(0,Rf[a])]);return""}),e}function WD(n,e){const t=n.x*Math.cos(e)-n.y*Math.sin(e),r=n.y*Math.cos(e)+n.x*Math.sin(e);n.x=t,n.y=r}function Y2e(n,e,t){n.x+=e,n.y+=t}function KD(n,e){n.x*=e,n.y*=e}var f3=class c8{constructor(e){this.commands=[],e&&e instanceof c8?this.commands.push(...e.commands):e&&(this.commands=ZD(e))}addPath(e){e&&e instanceof c8&&this.commands.push(...e.commands)}moveTo(e,t){this.commands.push(["M",e,t])}lineTo(e,t){this.commands.push(["L",e,t])}arc(e,t,r,i,o,s){this.commands.push(["AC",e,t,r,i,o,!!s])}arcTo(e,t,r,i,o){this.commands.push(["AT",e,t,r,i,o])}ellipse(e,t,r,i,o,s,a,c){this.commands.push(["E",e,t,r,i,o,s,a,!!c])}closePath(){this.commands.push(["Z"])}bezierCurveTo(e,t,r,i,o,s){this.commands.push(["C",e,t,r,i,o,s])}quadraticCurveTo(e,t,r,i){this.commands.push(["Q",e,t,r,i])}rect(e,t,r,i){this.commands.push(["R",e,t,r,i])}roundRect(e,t,r,i,o){typeof o>"u"?this.commands.push(["RR",e,t,r,i,0]):this.commands.push(["RR",e,t,r,i,o])}};function $f(n,e){let t=0,r=0,i,o,s,a,c,u,d,f,h,p,m,y,b,w,v,k,C,T,S,E,O,I=null,P=null,D=null,L=null,B=null,F=null;n.beginPath();for(let R=0;R<e.length;++R){T=e[R][0],T!=="S"&&T!=="s"&&T!=="C"&&T!=="c"&&(I=null,P=null),T!=="T"&&T!=="t"&&T!=="Q"&&T!=="q"&&(D=null,L=null);let N;switch(T){case"m":case"M":N=e[R],T==="m"?(t+=N[1],r+=N[2]):(t=N[1],r=N[2]),(T==="M"||!B)&&(B={x:t,y:r}),n.moveTo(t,r);break;case"l":N=e[R],t+=N[1],r+=N[2],n.lineTo(t,r);break;case"L":N=e[R],t=N[1],r=N[2],n.lineTo(t,r);break;case"H":N=e[R],t=N[1],n.lineTo(t,r);break;case"h":N=e[R],t+=N[1],n.lineTo(t,r);break;case"V":N=e[R],r=N[1],n.lineTo(t,r);break;case"v":N=e[R],r+=N[1],n.lineTo(t,r);break;case"a":case"A":if(N=e[R],F===null)throw new Error("This should never happen");T==="a"?(t+=N[6],r+=N[7]):(t=N[6],r=N[7]),w=N[1],v=N[2],d=N[3]*Math.PI/180,s=!!N[4],a=!!N[5],c={x:t,y:r},u={x:(F.x-c.x)/2,y:(F.y-c.y)/2},WD(u,-d),f=u.x*u.x/(w*w)+u.y*u.y/(v*v),f>1&&(f=Math.sqrt(f),w*=f,v*=f),S={x:w*u.y/v,y:-(v*u.x)/w},h=w*w*v*v,p=w*w*u.y*u.y+v*v*u.x*u.x,a!==s?KD(S,Math.sqrt((h-p)/p)||0):KD(S,-Math.sqrt((h-p)/p)||0),o=Math.atan2((u.y-S.y)/v,(u.x-S.x)/w),i=Math.atan2(-(u.y+S.y)/v,-(u.x+S.x)/w),WD(S,d),Y2e(S,(c.x+F.x)/2,(c.y+F.y)/2),n.save(),n.translate(S.x,S.y),n.rotate(d),n.scale(w,v),n.arc(0,0,1,o,i,!a),n.restore();break;case"C":N=e[R],I=N[3],P=N[4],t=N[5],r=N[6],n.bezierCurveTo(N[1],N[2],I,P,t,r);break;case"c":N=e[R],n.bezierCurveTo(N[1]+t,N[2]+r,N[3]+t,N[4]+r,N[5]+t,N[6]+r),I=N[3]+t,P=N[4]+r,t+=N[5],r+=N[6];break;case"S":N=e[R],(I===null||P===null)&&(I=t,P=r),n.bezierCurveTo(2*t-I,2*r-P,N[1],N[2],N[3],N[4]),I=N[1],P=N[2],t=N[3],r=N[4];break;case"s":N=e[R],(I===null||P===null)&&(I=t,P=r),n.bezierCurveTo(2*t-I,2*r-P,N[1]+t,N[2]+r,N[3]+t,N[4]+r),I=N[1]+t,P=N[2]+r,t+=N[3],r+=N[4];break;case"Q":N=e[R],D=N[1],L=N[2],t=N[3],r=N[4],n.quadraticCurveTo(D,L,t,r);break;case"q":N=e[R],D=N[1]+t,L=N[2]+r,t+=N[3],r+=N[4],n.quadraticCurveTo(D,L,t,r);break;case"T":N=e[R],(D===null||L===null)&&(D=t,L=r),D=2*t-D,L=2*r-L,t=N[1],r=N[2],n.quadraticCurveTo(D,L,t,r);break;case"t":N=e[R],(D===null||L===null)&&(D=t,L=r),D=2*t-D,L=2*r-L,t+=N[1],r+=N[2],n.quadraticCurveTo(D,L,t,r);break;case"z":case"Z":B&&(t=B.x,r=B.y),B=null,n.closePath();break;case"AC":N=e[R],t=N[1],r=N[2],b=N[3],o=N[4],i=N[5],E=N[6],n.arc(t,r,b,o,i,E);break;case"AT":N=e[R],m=N[1],y=N[2],t=N[3],r=N[4],b=N[5],n.arcTo(m,y,t,r,b);break;case"E":N=e[R],t=N[1],r=N[2],w=N[3],v=N[4],d=N[5],o=N[6],i=N[7],E=N[8],n.save(),n.translate(t,r),n.rotate(d),n.scale(w,v),n.arc(0,0,1,o,i,E),n.restore();break;case"R":N=e[R],t=N[1],r=N[2],k=N[3],C=N[4],B={x:t,y:r},n.rect(t,r,k,C);break;case"RR":N=e[R],t=N[1],r=N[2],k=N[3],C=N[4],O=N[5],B={x:t,y:r},n.roundRect(t,r,k,C,O);break;default:throw new Error(`Invalid path command: ${T}`)}F?(F.x=t,F.y=r):F={x:t,y:r}}}function ev(n,e,t,r,i=0){if(typeof i=="number"&&(i=[i]),Array.isArray(i)){if(i.length===0||i.length>4)throw new RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': ${i.length} radii provided. Between one and four radii are necessary.`);i.forEach(d=>{if(d<0)throw new RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': Radius value ${d} is negative.`)})}else return;if(i.length===1&&i[0]===0){this.rect(n,e,t,r);return}const o=Math.min(t,r)/2,s=Math.min(o,i[0]);let a=s,c=s,u=s;i.length===2&&(a=Math.min(o,i[1]),u=a),i.length===3&&(a=Math.min(o,i[1]),u=a,c=Math.min(o,i[2])),i.length===4&&(a=Math.min(o,i[1]),c=Math.min(o,i[2]),u=Math.min(o,i[3])),this.moveTo(n,e+r-u),this.arcTo(n,e,n+s,e,s),this.arcTo(n+t,e,n+t,e+a,a),this.arcTo(n+t,e+r,n+t-c,e+r,c),this.arcTo(n,e+r,n,e+r-u,u),this.moveTo(n,e)}function Q2e(n){if(!n)return;const e=n.prototype.clip,t=n.prototype.fill,r=n.prototype.stroke,i=n.prototype.isPointInPath;n.prototype.clip=function(...s){if(s[0]instanceof f3){const c=s[0],u=s[1]||"nonzero";return $f(this,c.commands),e.apply(this,[u])}const a=s[0]||"nonzero";return e.apply(this,[a])},n.prototype.fill=function(...s){if(s[0]instanceof f3){const c=s[0],u=s[1]||"nonzero";return $f(this,c.commands),t.apply(this,[u])}const a=s[0]||"nonzero";return t.apply(this,[a])},n.prototype.stroke=function(s){s&&$f(this,s.commands),r.apply(this)},n.prototype.isPointInPath=function(...s){if(s[0]instanceof f3){const a=s[0],c=s[1],u=s[2],d=s[3]||"nonzero";return $f(this,a.commands),i.apply(this,[c,u,d])}return i.apply(this,s)}}function X2e(n){n&&!n.prototype.roundRect&&(n.prototype.roundRect=ev)}function J2e(n){n&&!n.prototype.roundRect&&(n.prototype.roundRect=ev)}const efe=Object.freeze(Object.defineProperty({__proto__:null,Path2D:f3,applyPath2DToCanvasRenderingContext:Q2e,applyRoundRectToCanvasRenderingContext2D:X2e,applyRoundRectToPath2D:J2e,buildPath:$f,parsePath:ZD,roundRect:ev},Symbol.toStringTag,{value:"Module"}));X.DateTimePlugin=F2e,X.PrimeVue=Z2e,X.PrimeVuePresets=W2e,X.QAccordion=SP,X.QAvatar=u8,X.QBadge=Da,X.QBanner=DP,X.QBottomSheet=G9,X.QButton=Y9,X.QButtonGroup=oF,X.QCheckbox=mF,X.QComment=_I,X.QCommentSection=loe,X.QCounter=hoe,X.QDatePicker=Qse,X.QDivider=tae,X.QErrorModal=oE,X.QFileUpload=PI,X.QFooterActions=oae,X.QFormGroup=fae,X.QGrid=Mae,X.QIcon=vp,X.QIconActionGroup=Dae,X.QImageGallery=n6,X.QInput=Lae,X.QList=ele,X.QMenu=m4,X.QModal=e6,X.QModalContent=ole,X.QPageHeading=cle,X.QPageNavigation=hle,X.QPdfViewer=sE,X.QPopover=cE,X.QSelect=Qle,X.QTable=S2e,X.QTag=A2e,X.QTextarea=N2e,X.QToast=$2e,X.QTooltip=t6,X.QWarningModal=lE,X.QWysiwyg=gw,X.filterData=Lw,X.mq=_n,X.useDeviceType=aE,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});
|
|
475
|
+
`},datatable:{root:({props:n})=>({class:["relative",{"flex flex-col":n.scrollable&&n.scrollHeight==="flex"},{"h-full":n.scrollable&&n.scrollHeight==="flex"}]}),loadingoverlay:{class:["absolute","top-0 left-0","z-20","flex items-center justify-center","w-full h-full","bg-surface-100/0 dark:bg-surface-800/0","transition duration-200"]},loadingicon:{class:"w-8 h-8 animate-spin hidden"},wrapper:({props:n})=>({class:[{relative:n.scrollable,"flex flex-col grow":n.scrollable&&n.scrollHeight==="flex"},{"h-full":n.scrollable&&n.scrollHeight==="flex"}]}),header:({props:n})=>({class:["font-bold",n.showGridlines?"border-x border-t border-b-0":"border-y border-x-0","p-4","bg-surface-50 dark:bg-surface-800","border-surface-200 dark:border-surface-700","text-surface-700 dark:text-white/80"]}),table:{class:"w-full border-spacing-0 border-separate"},thead:({context:n})=>({class:[{"bg-surface-50 z-40 sticky":n.scrollable}]}),tbody:({instance:n,context:e})=>({class:[{"sticky z-20":n.frozenRow&&e.scrollable}]}),tfoot:({context:n})=>({class:[{"bg-surface-50 bottom-0 z-0":n.scrollable}]}),footer:{class:["font-bold","border-t-0 border-b border-x-0","p-4","bg-surface-50 dark:bg-surface-800","border-surface-200 dark:border-surface-700","text-surface-700 dark:text-white/80"]},column:{headercell:({context:n,props:e})=>({class:["font-bold",{"sticky z-20 border-b":e.frozen||e.frozen===""},{relative:n.resizable},"text-left",{"first:border-l border-y border-r":n==null?void 0:n.showGridlines},"border-0 border-b border-solid",(n==null?void 0:n.size)==="small"?"p-2":(n==null?void 0:n.size)==="large"?"p-5":"p-4",(e.sortable===""||e.sortable)&&n.sorted?"bg-primary-50 text-primary-700":"bg-surface-50 text-surface-700",(e.sortable===""||e.sortable)&&n.sorted?"dark:text-white dark:bg-primary-400/30":"dark:text-white/80 dark:bg-surface-800","border-surface-200 dark:border-surface-700 ",{"hover:bg-surface-100 dark:hover:bg-surface-400/30":(e.sortable===""||e.sortable)&&!(n!=null&&n.sorted)},"focus-visible:outline-none focus-visible:outline-offset-0 focus-visible:ring focus-visible:ring-inset focus-visible:ring-primary-400/50 dark:focus-visible:ring-primary-300/50",{"transition duration-200":e.sortable===""||e.sortable},{"cursor-pointer":e.sortable===""||e.sortable},{"overflow-hidden space-nowrap border-y bg-clip-padding":n.resizable}]}),headercontent:{class:"flex items-center"},sort:({context:n})=>({class:[n.sorted?"text-primary-500":"text-surface-700",n.sorted?"dark:text-primary-400":"dark:text-white/80"]}),bodycell:({props:n,context:e,state:t,parent:r})=>({class:[{"sticky box-border border-b":r.instance.frozenRow},{"sticky box-border border-b":n.frozen||n.frozen===""},"text-left","border-0 border-b border-solid",{"first:border-l border-r border-b":e==null?void 0:e.showGridlines},{"bg-surface-0 dark:bg-surface-800":r.instance.frozenRow||n.frozen||n.frozen===""},{"p-2":(e==null?void 0:e.size)==="small"&&!t.d_editing},{"p-5":(e==null?void 0:e.size)==="large"&&!t.d_editing},{"p-4":(e==null?void 0:e.size)!=="large"&&(e==null?void 0:e.size)!=="small"&&!t.d_editing},{"py-[0.6rem] px-2":t.d_editing},"border-surface-200 dark:border-surface-700"]}),footercell:({context:n})=>({class:["font-bold","text-left","border-0 border-b border-solid",{"border-x border-y":n==null?void 0:n.showGridlines},(n==null?void 0:n.size)==="small"?"p-2":(n==null?void 0:n.size)==="large"?"p-5":"p-4","border-surface-200 dark:border-surface-700","text-surface-700 dark:text-white/80","bg-surface-50 dark:bg-surface-800"]}),sorticon:({context:n})=>({class:["ml-2",n.sorted?"text-primary-700 dark:text-white/80":"text-surface-700 dark:text-white/70"]}),sortbadge:{class:["flex items-center justify-center align-middle","rounded-full","w-[1.143rem] leading-[1.143rem]","ml-2","text-primary-700 dark:text-white","bg-primary-50 dark:bg-primary-400/30"]},columnfilter:{class:"inline-flex items-center ml-auto"},filteroverlay:{class:["absolute top-0 left-0","border-0 dark:border","rounded-md","shadow-md","min-w-[12.5rem]","bg-surface-0 dark:bg-surface-800","text-surface-800 dark:text-white/80","dark:border-surface-700"]},filtermatchmodedropdown:{root:({state:n})=>({class:["flex","relative","my-2","w-full","rounded-md","bg-surface-0 dark:bg-surface-900","border border-surface-300 dark:border-surface-700","text-surface-800 dark:text-white/80","placeholder:text-surface-400 dark:placeholder:text-surface-500","transition-all","duration-200","hover:border-primary-500 dark:hover:border-primary-300",{"outline-none outline-offset-0 ring ring-primary-400/50 dark:ring-primary-300/50":n.focused},"cursor-pointer","select-none"]})},filterrowitems:{class:"m-0 p-0 py-3 list-none"},filterrowitem:({context:n})=>({class:["font-normal","leading-none","relative","border-0","rounded-none","m-0","py-3 px-5",{"text-surface-700 dark:text-white/80":!(n!=null&&n.highlighted)},{"bg-surface-0 dark:bg-surface-800 text-surface-700 dark:text-white/80":!(n!=null&&n.highlighted)},{"bg-primary-100 dark:bg-primary-400/40 text-primary-700 dark:text-white/80":n==null?void 0:n.highlighted},{"bg-primary-50 dark:bg-primary-400/40 text-primary-700 dark:text-white/80":n==null?void 0:n.highlighted},{"hover:bg-surface-100 dark:hover:bg-surface-600/80":!(n!=null&&n.highlighted)},{"hover:text-surface-700 hover:bg-surface-100 dark:hover:text-white dark:hover:bg-surface-600/80":!(n!=null&&n.highlighted)},"focus-visible:outline-none focus-visible:outline-offset-0 focus-visible:ring focus-visible:ring-inset focus-visible:ring-primary-400/50 dark:focus-visible:ring-primary-300/50","transition-shadow","duration-200","cursor-pointer","overflow-hidden","whitespace-nowrap"]}),filteroperator:{class:["px-5 py-3","border-b border-solid","rounded-t-md","text-surface-700 dark:text-white/80","border-surface-200 dark:border-surface-800","bg-surface-0 dark:bg-surface-700"]},filteroperatordropdown:{root:({state:n})=>({class:["inline-flex","relative","w-full","rounded-md","bg-surface-0 dark:bg-surface-900","border border-surface-300 dark:border-surface-700","transition-all","duration-200","hover:border-primary-500 dark:hover:border-primary-300",{"outline-none outline-offset-0 ring ring-primary-400/50 dark:ring-primary-300/50":n.focused},"cursor-pointer","select-none"]}),input:({props:n})=>({class:["font-sans","leading-none","block","flex-auto","bg-transparent","border-0",{"text-surface-800 dark:text-white/80":n.modelValue,"text-surface-400 dark:text-surface-500":!n.modelValue},"placeholder:text-surface-400 dark:placeholder:text-surface-500","w-[1%]","p-3","rounded-none","transition","duration-200","focus:outline-none focus:shadow-none","relative","cursor-pointer","overflow-hidden overflow-ellipsis","whitespace-nowrap","appearance-none"]}),trigger:{class:["flex items-center justify-center","shrink-0","bg-transparent","text-surface-500","w-12","rounded-tr-md","rounded-br-md"]},panel:{class:["absolute top-0 left-0","border-0 dark:border","rounded-md","shadow-md","bg-surface-0 dark:bg-surface-800","text-surface-800 dark:text-white/80","dark:border-surface-700"]},item:({context:n})=>({class:["font-normal","leading-none","relative","border-0","rounded-none","m-0","py-3 px-5",{"text-surface-700 dark:text-white/80":!n.focused&&!n.selected},{"bg-surface-50 dark:bg-surface-600/60 text-surface-700 dark:text-white/80":n.focused&&!n.selected},{"bg-primary-100 dark:bg-primary-400/40 text-primary-700 dark:text-white/80":n.focused&&n.selected},{"bg-primary-50 dark:bg-primary-400/40 text-primary-700 dark:text-white/80":!n.focused&&n.selected},{"hover:bg-surface-100 dark:hover:bg-surface-600/80":!n.focused&&!n.selected},{"hover:text-surface-700 hover:bg-surface-100 dark:hover:text-white dark:hover:bg-surface-600/80":n.focused&&!n.selected},"transition-shadow","duration-200","cursor-pointer","overflow-hidden","whitespace-nowrap"]})},filterconstraint:{class:["py-3 px-5","border-b border-solid","border-surface-200 dark:border-surface-700"]},filteraddrule:{class:"py-3 px-5"},filteraddrulebutton:{root:{class:["relative","items-center inline-flex text-center align-bottom justify-center","text-sm py-2 px-3 w-full","rounded-md","bg-transparent border-transparent","text-primary-500 dark:text-primary-400","hover:bg-primary-300/20","transition duration-200 ease-in-out","cursor-pointer overflow-hidden select-none"]},label:{class:"flex-auto grow-0"},icon:{class:"mr-2"}},filterremovebutton:{root:{class:["relative","items-center inline-flex text-center align-bottom justify-center","text-sm py-2 px-3 w-full mt-2","rounded-md","bg-transparent border-transparent","text-red-500 dark:text-red-400","hover:bg-red-300/20","transition duration-200 ease-in-out","cursor-pointer overflow-hidden select-none"]},label:{class:"flex-auto grow-0"},icon:{class:"mr-2"}},filterbuttonbar:{class:["flex items-center justify-between","py-3 px-5"]},filterclearbutton:{root:{class:["relative","items-center inline-flex text-center align-bottom justify-center","text-sm py-2 px-3","rounded-md","text-primary-500 border border-primary-500","hover:bg-primary-300/20","transition duration-200 ease-in-out","cursor-pointer overflow-hidden select-none"]}},filterapplybutton:{root:{class:["relative","items-center inline-flex text-center align-bottom justify-center","text-sm py-2 px-3","rounded-md","text-white dark:text-surface-900","bg-primary-500 dark:bg-primary-400","hover:bg-primary-600 dark:hover:bg-primary-300 hover:border-primary-600 dark:hover:border-primary-300","transition duration-200 ease-in-out","cursor-pointer overflow-hidden select-none"]}},filtermenubutton:({context:n})=>({class:["relative","inline-flex items-center justify-center","w-8 h-8","ml-2","rounded-full",{"bg-primary-50 text-primary-700":n.active},"dark:text-white/70 dark:hover:text-white/80 dark:bg-surface-800","hover:text-surface-700 hover:bg-surface-300/20","focus:outline-none focus:outline-offset-0 focus:ring focus:ring-primary-400/50 dark:focus:ring-primary-300/50","transition duration-200","cursor-pointer no-underline overflow-hidden"]}),headerfilterclearbutton:({context:n})=>({class:["relative","inline-flex items-center justify-center","text-left","border-none","m-0 p-0 ml-2","bg-transparent","cursor-pointer no-underline overflow-hidden select-none",{invisible:!n.hidden}]}),rowtoggler:{class:["relative","inline-flex items-center justify-center","text-left","m-0 p-0","w-8 h-8","border-0 rounded-full","text-surface-500 dark:text-white/70","bg-transparent","focus-visible:outline-none focus-visible:outline-offset-0","focus-visible:ring focus-visible:ring-primary-400/50 dark:focus-visible:ring-primary-300/50","transition duration-200","overflow-hidden","cursor-pointer select-none"]},columnresizer:{class:["block","absolute top-0 right-0","w-2 h-full","m-0 p-0","border border-transparent","cursor-col-resize"]},rowreordericon:{class:"cursor-move"},roweditorinitbutton:{class:["relative","inline-flex items-center justify-center","text-left","w-8 h-8","border-0 rounded-full","text-surface-700 dark:text-white/70","border-transparent","focus:outline-none focus:outline-offset-0 focus:ring focus:ring-primary-400/50 dark:focus:ring-primary-300/50","hover:text-surface-700 hover:bg-surface-300/20","transition duration-200","overflow-hidden","cursor-pointer select-none"]},roweditorsavebutton:{class:["relative","inline-flex items-center justify-center","text-left","w-8 h-8","border-0 rounded-full","text-surface-700 dark:text-white/70","border-transparent","focus:outline-none focus:outline-offset-0 focus:ring focus:ring-primary-400/50 dark:focus:ring-primary-300/50","hover:text-surface-700 hover:bg-surface-300/20","transition duration-200","overflow-hidden","cursor-pointer select-none"]},roweditorcancelbutton:{class:["relative","inline-flex items-center justify-center","text-left","w-8 h-8","border-0 rounded-full","text-surface-700 dark:text-white/70","border-transparent","focus:outline-none focus:outline-offset-0 focus:ring focus:ring-primary-400/50 dark:focus:ring-primary-300/50","hover:text-surface-700 hover:bg-surface-300/20","transition duration-200","overflow-hidden","cursor-pointer select-none"]},radiobuttonwrapper:{class:["relative","inline-flex align-bottom","w-6 h-6","cursor-pointer select-none"]},radiobutton:({context:n})=>({class:["flex justify-center items-center","w-[1.571rem] h-[1.571rem]","border-2 rounded-full",{"text-surface-700 dark:text-white/80":!n.checked},{"bg-surface-0 dark:bg-surface-900":!n.checked},{"border-surface-300 dark:border-surface-700":!n.checked},{"border-primary-500 dark:border-primary-400":n.checked},{"bg-primary-500 dark:bg-primary-400":n.checked},{"hover:border-primary-500 dark:hover:border-primary-400":!n.disabled},{"outline-none outline-offset-0 ring ring-primary-400/50 ring-inset dark:ring-primary-300/50":n.focused},"transition duration-200 ease-in-out",{"cursor-default opacity-60":n.disabled}]}),radiobuttonicon:({context:n})=>({class:["block","rounded-full","w-3 h-3","bg-surface-0 dark:bg-surface-900","transition duration-200 transform",{"backface-hidden scale-10 invisible":n.checked===!1,"transform scale-100 visible":n.checked===!0}]}),headercheckboxwrapper:{class:["relative","inline-flex align-bottom","w-6 h-6","cursor-pointer select-none"]},headercheckbox:({context:n})=>({class:["flex items-center justify-center","border-2 rounded-lg","w-6 h-6","text-surface-600",{"border-surface-200 bg-surface-0 dark:border-surface-700 dark:bg-surface-900":!n.checked,"border-primary-500 bg-primary-500 dark:border-primary-400 dark:bg-primary-400":n.checked},"focus:outline-none focus:outline-offset-0",{"ring ring-primary-400/50 dark:ring-primary-300/50":n.focused},"transition-colors duration-200",{"cursor-default opacity-60":n.disabled}]}),headercheckboxicon:{class:["w-4 h-4","text-base leading-none","text-white dark:text-surface-900","transition-all duration-200"]},checkboxwrapper:{class:["relative","inline-flex align-bottom","w-6 h-6","cursor-pointer select-none"]},checkbox:({context:n})=>({class:["flex items-center justify-center","border-2 rounded-lg","w-6 h-6","text-surface-600",{"border-surface-200 bg-surface-0 dark:border-surface-700 dark:bg-surface-900":!n.checked,"border-primary-500 bg-primary-500 dark:border-primary-400 dark:bg-primary-400":n.checked},"focus:outline-none focus:outline-offset-0",{"ring ring-primary-400/50 dark:ring-primary-300/50":n.focused},"transition-colors duration-200",{"cursor-default opacity-60":n.disabled}]}),checkboxicon:{class:["w-4 h-4","text-base leading-none","text-white dark:text-surface-900","transition-all duration-200"]},transition:{enterFromClass:"opacity-0 scale-y-[0.8]",enterActiveClass:"transition-[transform,opacity] duration-[120ms] ease-[cubic-bezier(0,0,0.2,1)]",leaveActiveClass:"transition-opacity duration-100 ease-linear",leaveToClass:"opacity-0"}},bodyrow:({context:n,props:e})=>({class:["dark:text-white/80",{"bg-primary-50 text-primary-600 dark:bg-primary-400/30":n.selected},{"bg-surface-0 text-surface-600 dark:bg-surface-800":!n.selected},{"font-bold bg-surface-0 dark:bg-surface-800":e.frozenRow},{"odd:bg-surface-0 odd:text-surface-600 dark:odd:bg-surface-800 even:bg-surface-50 even:text-surface-600 dark:even:bg-surface-900/50":n.stripedRows},{"hover:bg-surface-300/20 hover:text-surface-600":e.selectionMode&&!n.selected},{"transition duration-200":e.selectionMode&&!n.selected||e.rowHover},{"cursor-pointer":e.selectionMode}]}),rowexpansion:{class:"bg-surface-0 dark:bg-surface-800 text-surface-600 dark:text-white/80"},rowgroupheader:{class:["sticky z-20","bg-surface-0 text-surface-600 dark:text-white/70","dark:bg-surface-800"]},rowgroupfooter:{class:["sticky z-20","bg-surface-0 text-surface-600 dark:text-white/70","dark:bg-surface-800"]},rowgrouptoggler:{class:["relative","inline-flex items-center justify-center","text-left","m-0 p-0","w-8 h-8","border-0 rounded-full","text-surface-500 dark:text-white/70","bg-transparent","focus-visible:outline-none focus-visible:outline-offset-0","focus-visible:ring focus-visible:ring-primary-400/50 dark:focus-visible:ring-primary-300/50","transition duration-200","overflow-hidden","cursor-pointer select-none"]},rowgrouptogglericon:{class:"inline-block w-4 h-4"},resizehelper:{class:"absolute hidden w-[2px] z-20 bg-primary-500 dark:bg-primary-400"}},selectbutton:{root:({props:n})=>({class:[{"opacity-60 select-none pointer-events-none cursor-default":n.disabled}]}),button:({context:n})=>({class:["relative","leading-normal text-base","inline-flex items-center align-bottom text-center","px-4 py-2","rounded-lg",{"bg-gray-0 text-gray-40":!n.active,"button-active bg-white text-inkwell-30":n.active},{"opacity-60 select-none pointer-events-none cursor-default":n.disabled},"transition duration-200","cursor-pointer select-none overflow-hidden"]}),label:{class:"font-bold"}},galleria:{content:({parent:n,props:e})=>({class:["flex",{"flex-col":e.fullScreen},{"flex-col":n.props.thumbnailsPosition==="top"||n.props.thumbnailsPosition==="bottom","flex-row":n.props.thumbnailsPosition==="right"||n.props.thumbnailsPosition==="left"}]}),itemwrapper:({parent:n,props:e})=>({class:["group","flex relative","mt-14 md:mt-20 min-h-[74vh]",{"grow shrink w-0 justify-center":e.fullScreen},{"flex-col":n.props.indicatorsPosition==="bottom"||n.props.indicatorsPosition==="top","flex-row items-center":n.props.indicatorsPosition==="left"||n.props.indicatorsPosition==="right"},{"order-2":n.props.thumbnailsPosition==="top"||n.props.thumbnailsPosition==="left","flex-row":n.props.thumbnailsPosition==="right"}]}),itemcontainer:({parent:n})=>({class:["flex w-full md:w-screen h-full relative grow items-center",{"order-1":n.props.indicatorsPosition==="bottom"||n.props.indicatorsPosition==="right","order-2":n.props.indicatorsPosition==="top"||n.props.indicatorsPosition==="left"}]}),item:{class:["flex justify-center items-center","h-full w-full","rounded-lg overflow-auto","md:max-w-[592px] mx-auto"]},thumbnailwrapper:({parent:n})=>({class:["flex flex-col shrink-0",{"order-1":n.props.thumbnailsPosition==="top"||n.props.thumbnailsPosition==="left"},"overflow-auto"]}),thumbnailcontainer:({parent:n})=>({class:["flex","p-4","bg-transparent","md:max-w-[592px] mx-auto",{"flex-row":n.props.thumbnailsPosition==="top"||n.props.thumbnailsPosition==="bottom","flex-col grow":n.props.thumbnailsPosition==="right"||n.props.thumbnailsPosition==="left"}]}),previousthumbnailbutton:{class:["self-center relative","flex shrink-0 justify-center items-center overflow-hidden","m-2 ml-0","bg-transparent text-white w-8 h-8 rounded-full transition duration-200 ease-in-out","hover:bg-surface-0/10 hover:text-white","focus:outline-none focus:outline-offset-0"]},thumbnailitemscontainer:{class:"overflow-hidden w-full md:w-[30rem]"},thumbnailitems:({parent:n})=>({class:["flex",{"flex-col h-full":n.props.thumbnailsPosition==="right"||n.props.thumbnailsPosition==="left"}]}),thumbnailitem:({parent:n})=>({class:["flex items-center justify-center","grow shrink-0",{"w-full md:w-[25%]":n.props.thumbnailsPosition==="top"||n.props.thumbnailsPosition==="bottom"},"overflow-auto","cursor-pointer","hover:opacity-100","hover:transition-opacity","hover:duration-300"]}),nextthumbnailbutton:{class:["self-center relative","flex shrink-0 justify-center items-center overflow-hidden","m-2 mr-0","bg-transparent text-white w-8 h-8 rounded-full transition duration-200 ease-in-out","hover:bg-surface-0/10 hover:text-white","focus:outline-none focus:outline-offset-0"]},indicators:({parent:n})=>({class:["flex items-center justify-center","p-4",{"order-2":n.props.indicatorsPosition=="bottom","order-1":n.props.indicatorsPosition=="top","order-1 flex-col":n.props.indicatorsPosition=="left","flex-col order-2":n.props.indicatorsPosition=="right"},{"absolute z-10 bg-black/50":n.props.showIndicatorsOnItem},{"bottom-0 left-0 w-full items-start":n.props.indicatorsPosition=="bottom"&&n.props.showIndicatorsOnItem,"top-0 left-0 w-full items-start":n.props.indicatorsPosition=="top"&&n.props.showIndicatorsOnItem,"left-0 top-0 h-full items-start":n.props.indicatorsPosition=="left"&&n.props.showIndicatorsOnItem,"right-0 top-0 h-full items-start":n.props.indicatorsPosition=="right"&&n.props.showIndicatorsOnItem}]}),indicator:({parent:n})=>({class:[{"mr-2":n.props.indicatorsPosition=="bottom"||n.props.indicatorsPosition=="top","mb-2":n.props.indicatorsPosition=="left"||n.props.indicatorsPosition=="right"}]}),indicatorbutton:({context:n})=>({class:["w-2 h-2","rounded-full transition duration-200","focus:outline-none focus:outline-offset-0",{"bg-inkwell-30 hover:bg-surface-300 dark:bg-surface-700 dark:hover:bg-surface-600":!n.highlighted},{"bg-white hover:bg-primary-600":n.highlighted}]}),mask:{class:["fixed top-0 left-0 w-full h-full","flex items-center justify-center","bg-inkwell-40/95","image-overlay"]},closebutton:{class:["!absolute top-0 right-0 z-[1001]","flex justify-center items-center overflow-hidden","m-2","text-white bg-transparent w-12 h-12 rounded-full transition duration-200 ease-in-out","focus:outline-none"]},closeicon:{class:"w-6 h-6"},previousitembutton:({parent:n})=>({class:["inline-flex justify-center items-center overflow-hidden","bg-transparent text-white w-16 h-16 transition duration-200 ease-in-out rounded-md",{"opacity-0 group-hover:opacity-100":n.props.showItemNavigatorsOnHover},"mx-2","top-1/2 mt-[-0.5rem] left-0",{"!absolute":n.props.showItemNavigators,"!fixed":!n.props.showItemNavigators},"hover:bg-surface-0/10 hover:text-white","focus:outline-none focus:outline-offset-0"]}),nextitembutton:({parent:n})=>({class:["inline-flex justify-center items-center overflow-hidden","bg-transparent text-white w-16 h-16 transition duration-200 ease-in-out rounded-md",{"opacity-0 group-hover:opacity-100":n.props.showItemNavigatorsOnHover},"mx-2","top-1/2 mt-[-0.5rem] right-0",{"!absolute":n.props.showItemNavigators,"!fixed":!n.props.showItemNavigators},"hover:bg-surface-0/10 hover:text-white","focus:outline-none focus:outline-offset-0"]}),caption:{class:["absolute bottom-0 left-0 w-full","bg-black/50 text-white p-4"]},transition:{enterFromClass:"opacity-0 scale-75",enterActiveClass:"transition-all duration-150 ease-in-out",leaveActiveClass:"transition-all duration-150 ease-in",leaveToClass:"opacity-0 scale-75"}},fileupload:{input:{class:"hidden"},buttonbar:{class:["flex","flex-wrap","bg-surface-50","dark:bg-surface-800","text-surface-700","dark:text-white/80","p-5","gap-2","border","border-solid","border-surface-200","dark:border-surface-700","border-b-0","rounded-tr-lg","rounded-tl-lg"]},chooseButton:{class:["relative","items-center inline-flex text-center align-bottom justify-center","px-4 py-3","rounded-md","leading-[normal]","font-bold","text-white dark:text-surface-900","bg-primary-500 dark:bg-primary-400","border-primary-500 dark:border-primary-400","hover:bg-primary-600 dark:hover:bg-primary-300","overflow-hidden","cursor-pointer"]},chooseIcon:{class:["mr-2","inline-block"]},chooseButtonLabel:{class:["flex-1","font-bold"]},uploadbutton:{icon:{class:"mr-2"}},cancelbutton:{icon:{class:"mr-2"}},content:{class:["relative","bg-surface-0","dark:bg-surface-900","text-surface-700","dark:text-white/80","p-8","border","border-surface-200","dark:border-surface-700","rounded-b-lg"]},file:{class:["flex","items-center","flex-wrap","p-4","mb-2","last:mb-0","border","border-surface-200","dark:border-surface-700","gap-2","rounded"]},thumbnail:{class:"shrink-0"},fileName:{class:"mb-2"},fileSize:{class:"mr-2"},uploadicon:{class:"mr-2"},progressbar:{root:{class:["overflow-hidden","absolute top-0 left-0","border-0","h-2","rounded-md","w-full","bg-surface-100 dark:bg-surface-700"]},value:{class:["absolute flex items-center justify-center overflow-hidden","bg-primary-500 dark:bg-primary-400","m-0","h-full w-0","border-0","transition-width duration-1000 ease-in-out"]}}}},Bf=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}));var Rf={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},K2e=/([astvzqmhlc])([^astvzqmhlc]*)/gi,q2e=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function G2e(n){const e=n.match(q2e);return e?e.map(Number):[]}function ZD(n){const e=[],t=String(n).trim();return t[0]!=="M"&&t[0]!=="m"||t.replace(K2e,(r,i,o)=>{const s=G2e(o);let a=i.toLowerCase(),c=i;if(a==="m"&&s.length>2&&(e.push([c,...s.splice(0,2)]),a="l",c=c==="m"?"l":"L"),s.length<Rf[a])return"";for(e.push([c,...s.splice(0,Rf[a])]);s.length>=Rf[a]&&s.length&&Rf[a];)e.push([c,...s.splice(0,Rf[a])]);return""}),e}function WD(n,e){const t=n.x*Math.cos(e)-n.y*Math.sin(e),r=n.y*Math.cos(e)+n.x*Math.sin(e);n.x=t,n.y=r}function Y2e(n,e,t){n.x+=e,n.y+=t}function KD(n,e){n.x*=e,n.y*=e}var f3=class c8{constructor(e){this.commands=[],e&&e instanceof c8?this.commands.push(...e.commands):e&&(this.commands=ZD(e))}addPath(e){e&&e instanceof c8&&this.commands.push(...e.commands)}moveTo(e,t){this.commands.push(["M",e,t])}lineTo(e,t){this.commands.push(["L",e,t])}arc(e,t,r,i,o,s){this.commands.push(["AC",e,t,r,i,o,!!s])}arcTo(e,t,r,i,o){this.commands.push(["AT",e,t,r,i,o])}ellipse(e,t,r,i,o,s,a,c){this.commands.push(["E",e,t,r,i,o,s,a,!!c])}closePath(){this.commands.push(["Z"])}bezierCurveTo(e,t,r,i,o,s){this.commands.push(["C",e,t,r,i,o,s])}quadraticCurveTo(e,t,r,i){this.commands.push(["Q",e,t,r,i])}rect(e,t,r,i){this.commands.push(["R",e,t,r,i])}roundRect(e,t,r,i,o){typeof o>"u"?this.commands.push(["RR",e,t,r,i,0]):this.commands.push(["RR",e,t,r,i,o])}};function $f(n,e){let t=0,r=0,i,o,s,a,c,u,d,f,h,p,m,y,b,w,v,k,C,T,S,E,O,I=null,P=null,D=null,L=null,B=null,F=null;n.beginPath();for(let R=0;R<e.length;++R){T=e[R][0],T!=="S"&&T!=="s"&&T!=="C"&&T!=="c"&&(I=null,P=null),T!=="T"&&T!=="t"&&T!=="Q"&&T!=="q"&&(D=null,L=null);let N;switch(T){case"m":case"M":N=e[R],T==="m"?(t+=N[1],r+=N[2]):(t=N[1],r=N[2]),(T==="M"||!B)&&(B={x:t,y:r}),n.moveTo(t,r);break;case"l":N=e[R],t+=N[1],r+=N[2],n.lineTo(t,r);break;case"L":N=e[R],t=N[1],r=N[2],n.lineTo(t,r);break;case"H":N=e[R],t=N[1],n.lineTo(t,r);break;case"h":N=e[R],t+=N[1],n.lineTo(t,r);break;case"V":N=e[R],r=N[1],n.lineTo(t,r);break;case"v":N=e[R],r+=N[1],n.lineTo(t,r);break;case"a":case"A":if(N=e[R],F===null)throw new Error("This should never happen");T==="a"?(t+=N[6],r+=N[7]):(t=N[6],r=N[7]),w=N[1],v=N[2],d=N[3]*Math.PI/180,s=!!N[4],a=!!N[5],c={x:t,y:r},u={x:(F.x-c.x)/2,y:(F.y-c.y)/2},WD(u,-d),f=u.x*u.x/(w*w)+u.y*u.y/(v*v),f>1&&(f=Math.sqrt(f),w*=f,v*=f),S={x:w*u.y/v,y:-(v*u.x)/w},h=w*w*v*v,p=w*w*u.y*u.y+v*v*u.x*u.x,a!==s?KD(S,Math.sqrt((h-p)/p)||0):KD(S,-Math.sqrt((h-p)/p)||0),o=Math.atan2((u.y-S.y)/v,(u.x-S.x)/w),i=Math.atan2(-(u.y+S.y)/v,-(u.x+S.x)/w),WD(S,d),Y2e(S,(c.x+F.x)/2,(c.y+F.y)/2),n.save(),n.translate(S.x,S.y),n.rotate(d),n.scale(w,v),n.arc(0,0,1,o,i,!a),n.restore();break;case"C":N=e[R],I=N[3],P=N[4],t=N[5],r=N[6],n.bezierCurveTo(N[1],N[2],I,P,t,r);break;case"c":N=e[R],n.bezierCurveTo(N[1]+t,N[2]+r,N[3]+t,N[4]+r,N[5]+t,N[6]+r),I=N[3]+t,P=N[4]+r,t+=N[5],r+=N[6];break;case"S":N=e[R],(I===null||P===null)&&(I=t,P=r),n.bezierCurveTo(2*t-I,2*r-P,N[1],N[2],N[3],N[4]),I=N[1],P=N[2],t=N[3],r=N[4];break;case"s":N=e[R],(I===null||P===null)&&(I=t,P=r),n.bezierCurveTo(2*t-I,2*r-P,N[1]+t,N[2]+r,N[3]+t,N[4]+r),I=N[1]+t,P=N[2]+r,t+=N[3],r+=N[4];break;case"Q":N=e[R],D=N[1],L=N[2],t=N[3],r=N[4],n.quadraticCurveTo(D,L,t,r);break;case"q":N=e[R],D=N[1]+t,L=N[2]+r,t+=N[3],r+=N[4],n.quadraticCurveTo(D,L,t,r);break;case"T":N=e[R],(D===null||L===null)&&(D=t,L=r),D=2*t-D,L=2*r-L,t=N[1],r=N[2],n.quadraticCurveTo(D,L,t,r);break;case"t":N=e[R],(D===null||L===null)&&(D=t,L=r),D=2*t-D,L=2*r-L,t+=N[1],r+=N[2],n.quadraticCurveTo(D,L,t,r);break;case"z":case"Z":B&&(t=B.x,r=B.y),B=null,n.closePath();break;case"AC":N=e[R],t=N[1],r=N[2],b=N[3],o=N[4],i=N[5],E=N[6],n.arc(t,r,b,o,i,E);break;case"AT":N=e[R],m=N[1],y=N[2],t=N[3],r=N[4],b=N[5],n.arcTo(m,y,t,r,b);break;case"E":N=e[R],t=N[1],r=N[2],w=N[3],v=N[4],d=N[5],o=N[6],i=N[7],E=N[8],n.save(),n.translate(t,r),n.rotate(d),n.scale(w,v),n.arc(0,0,1,o,i,E),n.restore();break;case"R":N=e[R],t=N[1],r=N[2],k=N[3],C=N[4],B={x:t,y:r},n.rect(t,r,k,C);break;case"RR":N=e[R],t=N[1],r=N[2],k=N[3],C=N[4],O=N[5],B={x:t,y:r},n.roundRect(t,r,k,C,O);break;default:throw new Error(`Invalid path command: ${T}`)}F?(F.x=t,F.y=r):F={x:t,y:r}}}function ev(n,e,t,r,i=0){if(typeof i=="number"&&(i=[i]),Array.isArray(i)){if(i.length===0||i.length>4)throw new RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': ${i.length} radii provided. Between one and four radii are necessary.`);i.forEach(d=>{if(d<0)throw new RangeError(`Failed to execute 'roundRect' on '${this.constructor.name}': Radius value ${d} is negative.`)})}else return;if(i.length===1&&i[0]===0){this.rect(n,e,t,r);return}const o=Math.min(t,r)/2,s=Math.min(o,i[0]);let a=s,c=s,u=s;i.length===2&&(a=Math.min(o,i[1]),u=a),i.length===3&&(a=Math.min(o,i[1]),u=a,c=Math.min(o,i[2])),i.length===4&&(a=Math.min(o,i[1]),c=Math.min(o,i[2]),u=Math.min(o,i[3])),this.moveTo(n,e+r-u),this.arcTo(n,e,n+s,e,s),this.arcTo(n+t,e,n+t,e+a,a),this.arcTo(n+t,e+r,n+t-c,e+r,c),this.arcTo(n,e+r,n,e+r-u,u),this.moveTo(n,e)}function Q2e(n){if(!n)return;const e=n.prototype.clip,t=n.prototype.fill,r=n.prototype.stroke,i=n.prototype.isPointInPath;n.prototype.clip=function(...s){if(s[0]instanceof f3){const c=s[0],u=s[1]||"nonzero";return $f(this,c.commands),e.apply(this,[u])}const a=s[0]||"nonzero";return e.apply(this,[a])},n.prototype.fill=function(...s){if(s[0]instanceof f3){const c=s[0],u=s[1]||"nonzero";return $f(this,c.commands),t.apply(this,[u])}const a=s[0]||"nonzero";return t.apply(this,[a])},n.prototype.stroke=function(s){s&&$f(this,s.commands),r.apply(this)},n.prototype.isPointInPath=function(...s){if(s[0]instanceof f3){const a=s[0],c=s[1],u=s[2],d=s[3]||"nonzero";return $f(this,a.commands),i.apply(this,[c,u,d])}return i.apply(this,s)}}function X2e(n){n&&!n.prototype.roundRect&&(n.prototype.roundRect=ev)}function J2e(n){n&&!n.prototype.roundRect&&(n.prototype.roundRect=ev)}const efe=Object.freeze(Object.defineProperty({__proto__:null,Path2D:f3,applyPath2DToCanvasRenderingContext:Q2e,applyRoundRectToCanvasRenderingContext2D:X2e,applyRoundRectToPath2D:J2e,buildPath:$f,parsePath:ZD,roundRect:ev},Symbol.toStringTag,{value:"Module"}));X.DateTimePlugin=F2e,X.PrimeVue=Z2e,X.PrimeVuePresets=W2e,X.QAccordion=SP,X.QAvatar=u8,X.QBadge=Da,X.QBanner=DP,X.QBottomSheet=G9,X.QButton=Y9,X.QButtonGroup=oF,X.QCheckbox=mF,X.QComment=_I,X.QCommentSection=loe,X.QCounter=hoe,X.QDatePicker=Qse,X.QDivider=tae,X.QErrorModal=oE,X.QFileUpload=PI,X.QFooterActions=oae,X.QFormGroup=fae,X.QGrid=Mae,X.QIcon=vp,X.QIconActionGroup=Dae,X.QImageGallery=n6,X.QInput=Lae,X.QList=ele,X.QMenu=m4,X.QModal=e6,X.QModalContent=ole,X.QPageHeading=cle,X.QPageNavigation=hle,X.QPdfViewer=sE,X.QPopover=cE,X.QSelect=Qle,X.QTable=S2e,X.QTag=A2e,X.QTextarea=N2e,X.QToast=$2e,X.QTooltip=t6,X.QWarningModal=lE,X.QWysiwyg=gw,X.filterData=Lw,X.mq=_n,X.useDeviceType=aE,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});
|