From e8423d098dc34273ebb5514b7015a44fd921c93c Mon Sep 17 00:00:00 2001
From: Sebastian Tschan d?(o.set(e=r),!1):(o.set(e=m(u(i/d))),!0)})),i.promise}return{set:r,update:(t,o)=>r(t(n,e),o),subscribe:o.subscribe}}function Bl(e,t,o,i){if("number"==typeof o){const n=i-o,r=(o-t)/(e.dt||1/60),a=(r+(e.opts.stiffness*n-e.opts.damping*r)*e.inv_mass)*e.dt;return Math.abs(a)${e.replace(/%/g,"%25").replace(/#/g,"%23").replace(/ /g," ").replace(/
`,{safariCacheKey:a})};const ri=e=>{const t={...e};return C(t)},ai=(e,t={})=>{const o=ut(e);let i,n;const r=t.width||t.rx,a=t.height||t.ry;if(r&&a)return Le(t);if(r||a){i=parseFloat(r||Number.MAX_SAFE_INTEGER),n=parseFloat(a||Number.MAX_SAFE_INTEGER);const e=Math.min(i,n);M(r)||M(a)?(i=e+"%",n=e*o+"%"):(i=e,n=e)}else{const e=10;i=e+"%",n=e*o+"%"}return{[(t.width?"width":t.rx?"rx":void 0)||"width"]:i,[(t.width?"height":t.rx?"ry":void 0)||"height"]:n}},si=(e,t={})=>{return{width:void 0,height:void 0,...t,aspectRatio:1,backgroundImage:(o=Lo(e),"data:image/svg+xml,"+o.replace("<","%3C").replace(">","%3E"))};var o},li=(e,t={})=>({backgroundColor:[0,0,0,0],...$i(t)?{}:{width:void 0,height:void 0,aspectRatio:void 0},...t,backgroundImage:M(e)?e:Fo(e)?URL.createObjectURL(e):e}),ci=(e,t)=>{let o;if(M(e)||Fo(e)){const i={...ai(t),backgroundSize:"contain"};o=Mo(e)?si(e,i):li(e,i)}else if(e.src){const i=ai(t,e.shape||e),n={...e.shape,...i};if(e.width&&e.height&&!To(n,"aspectRatio")){const e=Qi(i,"width",t),o=Qi(i,"height",t);n.aspectRatio=H(e,o)}n.backgroundSize||e.shape||e.width&&e.height||(n.backgroundSize="contain"),o=Mo(e.src)?si(e.src,n):li(e.src,n)}else e.shape&&(o=ri(e.shape));return To(o,"backgroundImage")&&(To(o,"backgroundColor")||(o.backgroundColor=[0,0,0,0]),To(o,"disableStyle")||(o.disableStyle=["cornerRadius","backgroundColor","strokeColor","strokeWidth"])),t?Ki(o,t):o},di=e=>ce(e.x1,e.y1),ui=e=>ce(e.x2,e.y2),hi=e=>To(e,"text"),pi=e=>hi(e)&&!(Mi(e)||To(e,"width")),mi=e=>hi(e)&&(Mi(e)||To(e,"width")),gi=e=>!hi(e)&&Ti(e),$i=e=>To(e,"rx"),fi=e=>To(e,"x1"),yi=e=>To(e,"points"),bi=e=>hi(e)&&e.isEditing,xi=e=>!To(e,"opacity")||e.opacity>0,vi=e=>e.isSelected,wi=e=>e.isEditing,Si=e=>e._isDraft,ki=e=>To(e,"width")&&To(e,"height"),Ci=e=>{const t=To(e,"right"),o=To(e,"bottom");return t||o},Mi=e=>(To(e,"x")||To(e,"left"))&&To(e,"right")||(To(e,"y")||To(e,"top"))&&To(e,"bottom"),Ti=e=>ki(e)||Mi(e),Pi=e=>(e._isDraft=!0,e),Ri=(e,t)=>!0!==e.disableStyle&&(!Po(e.disableStyle)||!t||!e.disableStyle.includes(t)),Ii=e=>!0!==e.disableSelect,Ai=e=>!0!==e.disableRemove,Ei=e=>!e.disableFlip&&(!Si(e)&&!Ci(e)&&(e=>To(e,"backgroundImage")||To(e,"text"))(e)),Li=(e,t)=>!!hi(e)&&(!0!==e.disableInput&&(T(e.disableInput)?e.disableInput(null!=t?t:e.text):t||!0)),Fi=(e,t)=>!0!==e.disableTextLayout&&(!Po(e.disableTextLayout)||!t||!e.disableTextLayout.includes(t)),zi=e=>!0!==e.disableManipulate&&!Si(e)&&!Ci(e),Bi=e=>zi(e)&&!0!==e.disableMove,Di=e=>(delete e.left,delete e.right,delete e.top,delete e.bottom,e),Oi=e=>(delete e.rotation,e),Wi=e=>(e.strokeWidth=e.strokeWidth||1,e.strokeColor=e.strokeColor||[0,0,0],e),_i=e=>(e.backgroundColor=e.backgroundColor?e.backgroundColor:e.strokeWidth||e.backgroundImage?void 0:[0,0,0],e),Vi=e=>{let t=e.text;t=t.replace(/&(#[0-9]+|[a-z]+);/gi,((e,t)=>`___${t}___`)),t=t.replace(/&/,"&"),e.text=t.replace(/___(#[0-9]+|[a-z]+)___/gi,((e,t)=>`&${t};`))},Ni=e=>(e.fontSize=e.fontSize||"4%",e.fontFamily=e.fontFamily||"sans-serif",e.fontWeight=e.fontWeight||"normal",e.fontStyle=e.fontStyle||"normal",e.fontVariant=e.fontVariant||"normal",e.lineHeight=e.lineHeight||"120%",e.color=e.color||[0,0,0],e.format="html"===e.format?"html":"text","html"===e.format?Vi(e):(e=>{Vi(e);let t=e.text;t=t.replace(//g,"<"),e.text=t})(e),pi(e)?Hi(e):ji(e)),Hi=e=>(!1!==e.disableNewline&&(delete e.textAlign,e.text=e.text.replace(/\n/g," ")),Di(e)),ji=e=>(e.textAlign=e.textAlign||"left",e),Ui=e=>((e=>{M(e.id)||(e.id=A()),To(e,"rotation")||(e.rotation=0),To(e,"opacity")||(e.opacity=1),To(e,"disableErase")||(e.disableErase=!0)})(e),hi(e)?Ni(e):gi(e)?(e=>{e.cornerRadius=e.cornerRadius||0,e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],_i(e)})(e):yi(e)?(e=>{Wi(e),Oi(e),To(e,"pathClose")||(e.disableResize=!0,To(e,"disableMove")||(e.disableMove=!0)),Di(e)})(e):fi(e)?(e=>{Wi(e),e.lineStart=e.lineStart||void 0,e.lineEnd=e.lineEnd||void 0,Oi(e),Di(e)})(e):$i(e)&&(e=>{e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],_i(e)})(e),e),Zi=e=>hi(e)?"text":gi(e)?"rectangle":yi(e)?"path":fi(e)?"line":$i(e)?"ellipse":void 0,Xi=(e,t)=>parseFloat(e)/100*t,Yi=new RegExp(/^x|left|right|^width|rx|fontSize|cornerRadius|strokeWidth/,"i"),qi=new RegExp(/^y|top|bottom|^height|ry/,"i"),Gi=(e,t)=>{Object.entries(e).map((([o,i])=>{e[o]=((e,t,{width:o,height:i})=>{if(Array.isArray(t))return t.map((e=>(S(e)&&Gi(e,{width:o,height:i}),e)));if("string"!=typeof t)return t;if(!t.endsWith("%"))return t;const n=parseFloat(t)/100;return Yi.test(e)?re(o*n,6):qi.test(e)?re(i*n,6):t})(o,i,t)}));const o=e.lineHeight;M(o)&&(e.lineHeight=Math.round(e.fontSize*(parseFloat(o)/100)))},Ki=(e,t)=>(Gi(e,t),rn(e,t),e),Ji=(e,t)=>{let o;return/^x|width|rx|fontSize|strokeWidth|cornerRadius/.test(e)?o=t.width:/^y|height|ry/.test(e)&&(o=t.height),o},Qi=(e,t,o)=>Array.isArray(e[t])?e[t].map((e=>Object.entries(e).reduce(((e,[t,i])=>(e[t]=M(i)?Xi(i,Ji(t,o)):i,e)),{}))):M(e[t])?Xi(e[t],Ji(t,o)):e[t],en=(e,t,o)=>t.reduce(((t,i)=>{const n=Qi(e,i,o);return t[i]=n,t}),{}),tn=(e,t,o)=>(Object.keys(t).forEach((i=>((e,t,o,i)=>{if(!M(e[t]))return e[t]=o,e;const n=Ji(t,i);return e[t]=void 0===n?o:zo(o,n),e})(e,i,t[i],o))),e),on=(e,t)=>{const o=e.filter((e=>e.x<0||e.y<0||e.x1<0||e.y1<0)).reduce(((e,t)=>{const[o,i,n,r]=(e=>{const t=Ke(),o=e.strokeWidth||0;if(gi(e))t.x=e.x-.5*o,t.y=e.y-.5*o,t.width=e.width+o,t.height=e.height+o;else if(fi(e)){const{x1:i,y1:n,x2:r,y2:a}=e,s=Math.abs(Math.min(i,r)),l=Math.abs(Math.max(i,r)),c=Math.abs(Math.min(n,a)),d=Math.abs(Math.min(n,a));t.x=s+.5*o,t.y=l+.5*o,t.width=l-s+o,t.height=d-c+o}else $i(e)&&(t.x=e.x-e.rx+.5*o,t.y=e.y-e.ry+.5*o,t.width=2*e.rx+o,t.height=2*e.ry+o);return t&&To(e,"rotation")&&mt(t,e.rotation),bt(t)})(t);return e.top=Math.min(o,e.top),e.left=Math.min(r,e.left),e.bottom=Math.max(n,e.bottom),e.right=Math.max(i,e.right),e}),{top:0,right:0,bottom:0,left:0});return o.right>0&&(o.right-=t.width),o.bottom>0&&(o.bottom-=t.height),o},nn=(e,t,o)=>{const i=ri(e);Ki(i,t);const n=o(i);return Array.isArray(n)?n:[n]},rn=(e,t)=>{if(To(e,"left")&&(e.x=e.left),To(e,"right")&&!M(e.right)){const o=t.width-e.right;To(e,"left")?(e.x=e.left,e.width=Math.max(0,o-e.left)):To(e,"width")&&(e.x=o-e.width)}if(To(e,"top")&&(e.y=e.top),To(e,"bottom")&&!M(e.bottom)){const o=t.height-e.bottom;To(e,"top")?(e.y=e.top,e.height=Math.max(0,o-e.top)):To(e,"height")&&(e.y=o-e.height)}return e},an=(e,t)=>(yi(e)&&e.points.filter((e=>Co(e.x))).forEach((e=>{e.x*=t,e.y*=t})),fi(e)&&Co(e.x1)&&(e.x1*=t,e.y1*=t,e.x2*=t,e.y2*=t),Co(e.x)&&Co(e.y)&&(e.x*=t,e.y*=t),Co(e.width)&&Co(e.height)&&(e.width*=t,e.height*=t),Co(e.rx)&&Co(e.ry)&&(e.rx*=t,e.ry*=t),(e=>Co(e.strokeWidth)&&e.strokeWidth>0)(e)&&(e.strokeWidth*=t),hi(e)&&(e._scale=t,Co(e.fontSize)&&(e.fontSize*=t),Co(e.lineHeight)&&(e.lineHeight*=t),Co(e.width)&&!Co(e.height)&&(e.width*=t)),To(e,"cornerRadius")&&Co(e.cornerRadius)&&(e.cornerRadius*=t),e),sn=e=>{if(e.x1)return Te(ce(e.x1,e.y1),ce(e.x2,e.y2))},ln=e=>{if(gi(e))return ce(e.x+.5*e.width,e.y+.5*e.height);if($i(e))return ce(e.x,e.y);if(e.text){if(mi(e)){const t=e.height||Xo(e.text,e).height;return ce(e.x+.5*e.width,e.y+.5*t)}const t=Xo(e.text,e);return ce(e.x+.5*t.width,e.y+.5*t.height)}return yi(e)?Re(e.points):fi(e)?Re([di(e),ui(e)]):void 0},cn=(e,t)=>{let o=!1;t.flipX&&e.flipX?o=!0:!t.flipX&&e.flipX?o=!1:t.flipX&&!e.flipX&&(o=!0);let i=!1;t.flipY&&e.flipY?i=!0:!t.flipY&&e.flipY?i=!1:t.flipY&&!e.flipY&&(i=!0);let n=-t.rotation;return!o&&!i||o&&i||(n=-n),{flipX:o,flipY:i,rotation:n}};var dn=e=>/canvas/i.test(e.nodeName),un=(e,t)=>new Promise(((o,i)=>{let n=e,r=!1;const a=()=>{r||(r=!0,T(t)&&Promise.resolve().then((()=>t(Oe(n.naturalWidth,n.naturalHeight)))))};if(n.src||(n=new Image,M(e)&&new URL(e,location.href).origin!==location.origin&&(n.crossOrigin="anonymous"),n.src=M(e)?e:URL.createObjectURL(e)),n.complete)return a(),o(n);T(t)&&Ht(n).then(a).catch(i),n.onload=()=>{a(),o(n)},n.onerror=i}));const hn=new Map([]),pn=(e,t={})=>new Promise(((o,i)=>{const{onMetadata:r=n,onLoad:a=o,onError:s=i,onComplete:l=n}=t;let c=hn.get(e);if(c||(c={loading:!1,complete:!1,error:!1,image:void 0,size:void 0,bus:Vo()},hn.set(e,c)),c.bus.sub("meta",r),c.bus.sub("load",a),c.bus.sub("error",s),c.bus.sub("complete",l),dn(e)){const t=e,o=t.cloneNode();c.complete=!0,c.image=o,c.size=De(t)}if(c.complete)return c.bus.pub("meta",{size:c.size}),c.error?c.bus.pub("error",c.error):c.bus.pub("load",c.image),c.bus.pub("complete"),void(c.bus=Vo());c.loading||(c.loading=!0,un(e,(e=>{c.size=e,c.bus.pub("meta",{size:e})})).then((e=>{c.image=e,c.bus.pub("load",e)})).catch((e=>{c.error=e,c.bus.pub("error",e)})).finally((()=>{c.complete=!0,c.loading=!1,c.bus.pub("complete"),c.bus=Vo()})))})),mn=(e,t,o,i)=>e.drawImage(t,o.x,o.x,o.width,o.height,i.x,i.y,i.width,i.height);var gn=async(e,t,o,i,n=mn)=>{e.save(),e.clip(),await n(e,t,o,i),e.restore()};const $n=(e,t,o,i,n)=>{const r=Ge(e);if(i){const e=vt(et(i),re);return e.x*=o.width,e.width*=o.width,e.y*=o.height,e.height*=o.height,{srcRect:e,destRect:r}}const a=it(0,0,o.width,o.height);if("contain"===t){const t=yt(e,ut(a));r.width=t.width,r.height=t.height,n?(r.x+=n.x,r.y+=n.y):(r.x+=t.x,r.y+=t.y)}else if("cover"===t){const e=ft(r,a.width/a.height);r.width=e.width,r.height=e.height,n?(r.x+=n.x,r.y+=n.y):(r.x+=e.x,r.y+=e.y)}else t?(r.width=t.width,r.height=t.height,n&&(r.x+=n.x,r.y+=n.y)):n&&(r.width=o.width,r.height=o.height,r.x+=n.x,r.y+=n.y);return{srcRect:a,destRect:r}},fn=(e,t)=>(t.cornerRadius>0?((e,t,o,i,n,r)=>{i<2*r&&(r=i/2),n<2*r&&(r=n/2),e.beginPath(),e.moveTo(t+r,o),e.arcTo(t+i,o,t+i,o+n,r),e.arcTo(t+i,o+n,t,o+n,r),e.arcTo(t,o+n,t,o,r),e.arcTo(t,o,t+i,o,r),e.closePath()})(e,t.x,t.y,t.width,t.height,t.cornerRadius):e.rect(t.x,t.y,t.width,t.height),e),yn=(e,t)=>(t.backgroundColor&&e.fill(),e),bn=(e,t)=>(t.strokeWidth&&e.stroke(),e);var xn=async(e,t,o={})=>{const{drawImage:i}=o;if(e.lineWidth=t.strokeWidth?t.strokeWidth:1,e.strokeStyle=t.strokeColor?Bo(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Bo(t.backgroundColor):"none",e.globalAlpha=t.opacity,t.backgroundImage){let o;o=dn(t.backgroundImage)?t.backgroundImage:await pn(t.backgroundImage),fn(e,t),yn(e,t);const{srcRect:n,destRect:r}=$n(t,t.backgroundSize,De(o),t.backgroundCorners,t.backgroundPosition);return await gn(e,o,n,r,i),bn(e,t),[]}return fn(e,t),yn(e,t),bn(e,t),[]},vn=async(e,t,o={})=>new Promise((async(i,n)=>{const{drawImage:r}=o;if(e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Bo(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Bo(t.backgroundColor):"none",e.globalAlpha=t.opacity,e.ellipse(t.x,t.y,t.rx,t.ry,0,0,2*Math.PI),t.backgroundColor&&e.fill(),t.backgroundImage){let o;try{o=await pn(t.backgroundImage)}catch(e){n(e)}const a=it(t.x-t.rx,t.y-t.ry,2*t.rx,2*t.ry),{srcRect:s,destRect:l}=$n(a,t.backgroundSize,De(o),t.backgroundCorners,t.backgroundPosition);await gn(e,o,s,l,r),t.strokeWidth&&e.stroke(),i([])}else t.strokeWidth&&e.stroke(),i([])})),wn=async(e,t,o)=>{const i=t.width&&t.height?Fe(t):Xo(t.text,t),n={x:t.x,y:t.y,width:i.width,height:i.height};if(xn(e,{...t,...n,options:o}),!t.text.length)return[];const{willRequest:r}=o,a=await ni(t.text,{...t,...n,imageWidth:n.width,imageHeight:n.height,willRequest:r});return e.drawImage(a,t.x-No,t.y,a.width,a.height),[]},Sn=async(e,t)=>new Promise((async o=>{e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Bo(t.strokeColor):"none",e.globalAlpha=t.opacity;let i=di(t),n=ui(t);e.moveTo(i.x,i.y),e.lineTo(n.x,n.y),t.strokeWidth&&e.stroke(),o([])})),kn=async(e,t)=>new Promise(((o,i)=>{e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Bo(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Bo(t.backgroundColor):"none",e.globalAlpha=t.opacity;const{points:n}=t;t.pathClose&&e.beginPath(),e.moveTo(n[0].x,n[0].y);const r=n.length;for(let t=1;t
|\n/g,"
")}<0&&e.reverse();const t=e.length,o=[...Array(t).keys()],i=[];let n,r,a,s,l,c,d,u,h,p,m,g,$=128;for(;o.length>3;){if($<=0)return[];for($--,n=0;n.5&&(f=(-r+Math.round(Math.random()*n))*(4*a)),m=Math.min(Math.max(0,g+$+f),y),l[g]=c[m],l[g+1]=c[m+1],l[g+2]=c[m+2],l[g+3]=c[m+3],g+=4;t(null,{data:l,width:o.width,height:o.height})};const Al=[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625];function El(e){return Math.sqrt(1- --e*e)}function Ll(e){return"[object Date]"===Object.prototype.toString.call(e)}function Fl(e,t){if(e===t||e!=e)return()=>e;const o=typeof e;if(o!==typeof t||Array.isArray(e)!==Array.isArray(t))throw new Error("Cannot interpolate values of different type");if(Array.isArray(e)){const o=t.map(((t,o)=>Fl(e[o],t)));return e=>o.map((t=>t(e)))}if("object"===o){if(!e||!t)throw new Error("Object cannot be null");if(Ll(e)&&Ll(t)){e=e.getTime();const o=(t=t.getTime())-e;return t=>new Date(e+t*o)}const o=Object.keys(t),i={};return o.forEach((o=>{i[o]=Fl(e[o],t[o])})),e=>{const t={};return o.forEach((o=>{t[o]=i[o](e)})),t}}if("number"===o){const o=t-e;return t=>e+t*o}throw new Error(`Cannot interpolate ${o} values`)}function zl(e,t={}){const o=va(e);let i,n=e;function r(r,a){if(null==e)return o.set(e=r),Promise.resolve();n=r;let s=i,l=!1,{delay:c=0,duration:d=400,easing:u=En,interpolate:h=Fl}=Ln(Ln({},t),a);if(0===d)return s&&(s.abort(),s=null),o.set(e=n),Promise.resolve();const p=Jn()+c;let m;return i=or((t=>{if(t
<\/div>$/,"
"):e).replace(/
<\/div>/g,"
").replace(/<\/div>/g,"").replace(/
");function bf(e){let t,o,i,n;return{c(){t=lr("pre"),$r(t,"class","PinturaContentEditable"),$r(t,"data-wrap-content",o=e[3]||e[4]?"wrap":"nowrap"),$r(t,"contenteditable",""),$r(t,"spellcheck",e[0]),$r(t,"autocorrect",e[1]),$r(t,"autocapitalize",e[2]),$r(t,"style",e[6])},m(o,r){ar(o,t,r),e[24](t),i||(n=[pr(t,"input",e[11]),pr(t,"compositionend",e[10]),pr(t,"paste",e[12]),pr(t,"keydown",e[8]),pr(t,"keyup",e[9]),pr(t,"blur",e[7])],i=!0)},p(e,i){24&i[0]&&o!==(o=e[3]||e[4]?"wrap":"nowrap")&&$r(t,"data-wrap-content",o),1&i[0]&&$r(t,"spellcheck",e[0]),2&i[0]&&$r(t,"autocorrect",e[1]),4&i[0]&&$r(t,"autocapitalize",e[2]),64&i[0]&&$r(t,"style",e[6])},i:An,o:An,d(o){o&&sr(t),e[24](null),i=!1,Bn(n)}}}function xf(e,t,o){let i,{spellcheck:r="false"}=t,{autocorrect:a="off"}=t,{autocapitalize:s="off"}=t,{wrapLines:l=!0}=t,{allowNewline:c=!0}=t,{textFormat:d="text"}=t,{formatInput:u=j}=t,{formatPaste:h=j}=t,{style:m}=t,{innerHTML:g}=t,{oninput:$=n}=t,{enableTextStyleShortcuts:f=!1}=t;const y=()=>{if(!x)return;const e=document.createRange();e.selectNodeContents(x);const t=T();t.removeAllRanges(),t.addRange(e)},b=Lr();let x;document.execCommand("defaultParagraphSeparator",!1,"br");const v=e=>e.replace(/<\/?(?:i|b|em|u|s|strike|strong|font)>/,"").replace(/style=".*?"/g,"").replace(/\n/gim,"
"),w=()=>{o(13,g=x.innerHTML);const e=yf(g);b("input",e),$(e),requestAnimationFrame((()=>x&&x.scrollTo(0,0)))},S=()=>{P(x);const e="html"===d?x.innerHTML:v(x.innerHTML);o(5,x.innerHTML=u(e),x),R(x),w()},k={b:"bold",i:"italic",u:"underline",s:"strikethrough"},C=e=>{const t=p("span");return t.dataset.bookmark=e,t},M=(e,t,o)=>{const i=C(o);if(e.nodeType===Node.TEXT_NODE){const n=e.textContent;if("start"===o){const o=ff(n.substr(0,t)),r=ff(n.substr(t));e.replaceWith(o,i,r)}else{const o=ff(n.substr(0,t)),r=ff(n.substr(t));e.replaceWith(o,i,r)}}else e.nodeType===Node.ELEMENT_NODE&&e.insertBefore(i,e.childNodes[t])},T=()=>{const e=x.getRootNode();return"getSelection"in e?e.getSelection():document.getSelection()},P=e=>{const t=T();if(!t.getRangeAt||!t.rangeCount)return;const o=t.getRangeAt(0),{startOffset:i,endOffset:n,startContainer:r,endContainer:a}=o;if(e.contains(o.startContainer)&&e.contains(o.endContainer))if(r.nodeType===Node.TEXT_NODE&&r===a){const e=r.textContent,t=e.substr(0,i),o=C("start"),a=n-i>0?e.substr(i,n):"",s=C("end"),l=e.substr(n);r.replaceWith(t,o,a,s,l)}else M(r,i,"start"),M(a,n+(r===a?1:0),"end")},R=e=>{const t=I(e,"start"),o=I(e,"end");if(!t||!o)return;const i=document.createRange();i.setStart(t,0),i.setEnd(o,0);const n=T();n.removeAllRanges(),n.addRange(i),t.remove(),o.remove()},I=(e,t)=>{const o=e.children;for(let e=0;e
")),kf=(e,t)=>M(e)?parseFloat(e)/100*t:e,Cf=(e,t)=>({x:zo(e.x,t.width),y:zo(e.y,t.height)});function Mf(e,t,o){const i=e.slice();return i[223]=t[o],i[225]=o,i}function Tf(e,t){let o,i,n,r,a,s,l,c,d,u,h,p=t[223].name+"";function m(){return t[151](t[225])}return n=new bm({props:{color:t[223].color}}),{key:e,first:null,c(){o=lr("li"),i=lr("button"),ma(n.$$.fragment),r=ur(),a=lr("span"),s=dr(p),c=ur(),$r(i,"class","PinturaShapeListItem"),$r(i,"type","button"),$r(i,"aria-label",l="Select shape "+t[223].name),this.first=o},m(e,t){ar(e,o,t),ir(o,i),ga(n,i,null),ir(i,r),ir(i,a),ir(a,s),ir(o,c),d=!0,u||(h=pr(i,"click",m),u=!0)},p(e,o){t=e;const r={};1048576&o[0]&&(r.color=t[223].color),n.$set(r),(!d||1048576&o[0])&&p!==(p=t[223].name+"")&&yr(s,p),(!d||1048576&o[0]&&l!==(l="Select shape "+t[223].name))&&$r(i,"aria-label",l)},i(e){d||(ia(n.$$.fragment,e),d=!0)},o(e){na(n.$$.fragment,e),d=!1},d(e){e&&sr(o),$a(n),u=!1,h()}}}function Pf(e){let t,o;return t=new df({props:{visible:!0,points:e[12],rotatorPoint:e[26],enableDragEdges:e[16],enableDragPoints:e[28],enableRotatePoints:e[14]}}),t.$on("resizestart",e[36]),t.$on("resizemove",e[37]),t.$on("resizeend",e[38]),t.$on("rotatestart",e[39]),t.$on("rotatemove",e[40]),t.$on("rotateend",e[41]),{c(){ma(t.$$.fragment)},m(e,i){ga(t,e,i),o=!0},p(e,o){const i={};4096&o[0]&&(i.points=e[12]),67108864&o[0]&&(i.rotatorPoint=e[26]),65536&o[0]&&(i.enableDragEdges=e[16]),268435456&o[0]&&(i.enableDragPoints=e[28]),16384&o[0]&&(i.enableRotatePoints=e[14]),t.$set(i)},i(e){o||(ia(t.$$.fragment,e),o=!0)},o(e){na(t.$$.fragment,e),o=!1},d(e){$a(t,e)}}}function Rf(e){let t,o,i,n;const r=[Af,If],a=[];function s(e,t){return"modal"===e[4]?0:"inline"===e[4]?1:-1}return~(t=s(e))&&(o=a[t]=r[t](e)),{c(){o&&o.c(),i=hr()},m(e,o){~t&&a[t].m(e,o),ar(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(ta(),na(a[l],1,1,(()=>{a[l]=null})),oa()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),ia(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(ia(o),n=!0)},o(e){na(o),n=!1},d(e){~t&&a[t].d(e),e&&sr(i)}}}function If(e){let t,o,i,n,r,a={formatInput:e[43],wrapLines:!!e[13].width,textFormat:e[13].format,enableTextStyleShortcuts:e[5],allowNewline:e[27],style:e[25]};return o=new vf({props:a}),e[154](o),o.$on("input",e[44]),o.$on("keyup",e[47]),o.$on("cancel",e[49]),o.$on("confirm",e[48]),{c(){t=lr("div"),ma(o.$$.fragment),$r(t,"class","PinturaInlineInput"),$r(t,"style",e[24])},m(a,s){ar(a,t,s),ga(o,t,null),i=!0,n||(r=pr(t,"focusout",e[155]),n=!0)},p(e,n){const r={};8192&n[0]&&(r.wrapLines=!!e[13].width),8192&n[0]&&(r.textFormat=e[13].format),32&n[0]&&(r.enableTextStyleShortcuts=e[5]),134217728&n[0]&&(r.allowNewline=e[27]),33554432&n[0]&&(r.style=e[25]),o.$set(r),(!i||16777216&n[0])&&$r(t,"style",e[24])},i(e){i||(ia(o.$$.fragment,e),i=!0)},o(e){na(o.$$.fragment,e),i=!1},d(i){i&&sr(t),e[154](null),$a(o),n=!1,r()}}}function Af(e){let t,o;return t=new $f({props:{panelOffset:e[2],onconfirm:e[48],oncancel:e[49],labelCancel:e[6].shapeLabelInputCancel,iconCancel:e[6].shapeIconInputCancel,labelConfirm:e[6].shapeLabelInputConfirm,iconConfirm:e[6].shapeIconInputConfirm,$$slots:{default:[Ef]},$$scope:{ctx:e}}}),{c(){ma(t.$$.fragment)},m(e,i){ga(t,e,i),o=!0},p(e,o){const i={};4&o[0]&&(i.panelOffset=e[2]),64&o[0]&&(i.labelCancel=e[6].shapeLabelInputCancel),64&o[0]&&(i.iconCancel=e[6].shapeIconInputCancel),64&o[0]&&(i.labelConfirm=e[6].shapeLabelInputConfirm),64&o[0]&&(i.iconConfirm=e[6].shapeIconInputConfirm),41943296&o[0]|512&o[7]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ia(t.$$.fragment,e),o=!0)},o(e){na(t.$$.fragment,e),o=!1},d(e){$a(t,e)}}}function Ef(e){let t,o,i;return{c(){t=lr("textarea"),$r(t,"spellcheck","false"),$r(t,"autocorrect","off"),$r(t,"autocapitalize","off"),$r(t,"style",e[25])},m(n,r){ar(n,t,r),e[152](t),br(t,e[23]),o||(i=[pr(t,"keydown",e[46]),pr(t,"keypress",e[45]),pr(t,"keyup",e[47]),pr(t,"input",e[44]),pr(t,"input",e[153])],o=!0)},p(e,o){33554432&o[0]&&$r(t,"style",e[25]),8388608&o[0]&&br(t,e[23])},d(n){n&&sr(t),e[152](null),o=!1,Bn(i)}}}function Lf(e){let t,o,i,n,r;return o=new ih({props:{items:e[21],key:e[10]}}),{c(){t=lr("div"),ma(o.$$.fragment),$r(t,"class","PinturaShapeControls"),$r(t,"style",e[22])},m(a,s){ar(a,t,s),ga(o,t,null),i=!0,n||(r=[pr(t,"measure",e[156]),Gn(Kl.call(null,t))],n=!0)},p(e,n){const r={};2097152&n[0]&&(r.items=e[21]),1024&n[0]&&(r.key=e[10]),o.$set(r),(!i||4194304&n[0])&&$r(t,"style",e[22])},i(e){i||(ia(o.$$.fragment,e),i=!0)},o(e){na(o.$$.fragment,e),i=!1},d(e){e&&sr(t),$a(o),n=!1,Bn(r)}}}function Ff(e){let t,o,i,r,a,s,l,c,d,u,h=[],p=new Map,m=e[20];const g=e=>e[223].id;for(let t=0;t
|
/g).join("\n").replace(/ /g,String.fromCharCode(160)).replace(/&/g,"&"):t;return pi(i)&&!1!==i.disableNewline?(e=>{const t=e.split(/[\n\r]/g);return t.length>1?t.map((e=>e.trim())).filter((e=>e.length)).join(" "):t[0]})(o):o},Lo=()=>{const e=Eo(Io),t=Li(i,e),o=!0===t?e:t;let n=C.x,r=C.y;if(!i.height){const e=mt({...P},i.rotation),t=Xo(o,l),a=mt({x:n,y:r,...t},i.rotation),[s,,c]=e,[d,,u]=a;let h=s,p=d;i.flipX&&(h=c,p=u);const m=ve(he(h),p);n+=m.x,r+=m.y}Xt(i,{x:M(k.x)?zo(n,we.width):n,y:M(k.y)?zo(r,we.height):r,text:o})},Fo=()=>{let e=a;a&&Nt(),Io&&Io.confirm&&Io.confirm(),Lo(),ao(i),e?Ve(i):Ne(i)},Do=()=>{a?Ht():(Xt(i,{text:k.text,x:k.x,y:k.y}),ao(i))},Oo=(e,t,{flipX:o,flipY:i,rotation:n},r="top left")=>{let a,s;const[l,c,d,u]=mt(e,n),[h,p,m,g]=mt(t,n);if("top center"===r){a=Re(i?[u,d]:[l,c]),s=Re(i?[g,m]:[h,p])}else"top right"===r&&!o||"top left"===r&&o?(a=i?d:c,s=i?m:p):(a=i?u:l,s=i?g:h);return ve(he(a),s)},Wo=(e,t,o)=>ce(M(e.x)?zo(t.x+o.x,we.width):t.x+o.x,M(e.y)?zo(t.y+o.y,we.height):t.y+o.y),_o={},Vo=()=>ro(i),No=()=>{const e=je(Xo(i.text,l),(e=>Math.ceil(e))),t=To(i,"height"),o=!t&&To(i,"width"),n=i.id;let r=_o[n];r||(_o[n]={},r=_o[n]);const a=e=>{const{width:t,...o}=l,n=Xo(i.text,o),r=Oo(it(l.x,l.y,e.width,e.height),it(l.x,l.y,n.width,n.height),l,"top "+i.textAlign),a=!1!==l.disableNewline;Zt(i,["width","height",a&&"textAlign"]),Xt(i,{...Wo(i,l,r)})},s=t=>{const o=Oe(r.width||l.width||e.width,e.height),n=r.textAlign||"left",a=Oo(it(l.x,l.y,t.width,t.height),it(l.x,l.y,o.width,o.height),l,"top "+n);Zt(i,["height"]),Xt(i,{...Wo(i,l,a),width:M(i.width)?zo(o.width,we.width):o.width,textAlign:n})},c=t=>{const o=Oe(r.width||e.width,r.height||e.height),n=r.textAlign||"left",a=Oo(it(l.x,l.y,t.width,t.height),it(l.x,l.y,o.width,o.height),l,"top "+n);Xt(i,{...Wo(i,l,a),width:M(i.width)?zo(o.width,we.width):o.width,height:M(i.width)?zo(o.height,we.height):o.height,textAlign:n})};if(t){r.textAlign=i.textAlign,r.width=l.width,r.height=l.height;const e=Oe(l.width,l.height);Fi(i,"auto-height")?s(e):Fi(i,"auto-width")&&a(e)}else if(o){r.textAlign=i.textAlign,r.width=l.width;const t=Oe(l.width,e.height);Fi(i,"auto-width")?a(t):Fi(i,"fixed-size")&&c(t)}else{r.textAlign=i.textAlign;const t=Oe(Math.ceil(e.width),Math.ceil(e.height));Fi(i,"fixed-size")?c(t):Fi(i,"auto-height")&&s(t)}},Ho=e=>{e.stopPropagation();const t=i.flipX||!1;Yt(i,"flipX",!t),Ne(i)},jo=e=>{e.stopPropagation();const t=i.flipY||!1;Yt(i,"flipY",!t),Ne(i)},Uo=e=>{Yt(i,"opacity",e)},Zo=e=>{Uo(e),Ne(i)},Yo=e=>{e.stopPropagation(),e.target.blur(),Qt()},qo=e=>{e.stopPropagation();oe.findIndex((e=>e===i))!==oe.length-1&&(o(0,oe=oe.filter((e=>e!==i)).concat([i])),Ne(i))},Go=e=>{e.stopPropagation(),Ko()},Ko=()=>{const e=ri(i);e.id=A();const t=ce(50,-50);if(To(e,"points")){const o=en(e,["points"],we);o.points.forEach((e=>{e.x+=t.x,e.y+=t.y})),tn(e,o,we)}else if(fi(e)){const o=en(e,["x1","y1","x2","y2"],we);o.x1+=t.x,o.y1+=t.y,o.x2+=t.x,o.y2+=t.y,tn(e,o,we)}else{const t=en(e,["x","y"],we);t.x+=50,t.y-=50,tn(e,t,we)}oe.push(e),Ve(e),io(e)},Jo=Dl(0,{stiffness:.2,damping:.7});let Qo;Vn(e,Jo,(e=>o(17,G=e)));const ei=(e,t)=>{const{disableTextLayout:o=[]}=t;return"height"in t?o.includes("auto-height")?e.shapeIconButtonTextLayoutAutoWidth:e.shapeIconButtonTextLayoutAutoHeight:"width"in t?o.includes("auto-width")?e.shapeIconButtonTextLayoutFixedSize:e.shapeIconButtonTextLayoutAutoWidth:o.includes("fixed-size")?e.shapeIconButtonTextLayoutAutoHeight:e.shapeIconButtonTextLayoutFixedSize},ti=(e,t)=>{const{disableTextLayout:o=[]}=t;return"height"in t?o.includes("auto-height")?e.shapeTitleButtonTextLayoutAutoWidth:e.shapeTitleButtonTextLayoutAutoHeight:"width"in t?o.includes("auto-width")?e.shapeTitleButtonTextLayoutFixedSize:e.shapeTitleButtonTextLayoutAutoWidth:o.includes("fixed-size")?e.shapeTitleButtonTextLayoutAutoHeight:e.shapeTitleButtonTextLayoutFixedSize};let oi=!1;let ii=le(),ni=void 0;const ai=e=>{qe(e),o(121,Co=e)};let si;Er((()=>{Po(),ko()}));return e.$$set=e=>{"uid"in e&&o(56,Q=e.uid),"ui"in e&&o(55,ee=e.ui),"disabled"in e&&o(1,te=e.disabled),"markup"in e&&o(0,oe=e.markup),"offset"in e&&o(2,ie=e.offset),"contextRotation"in e&&o(57,ne=e.contextRotation),"contextFlipX"in e&&o(58,ae=e.contextFlipX),"contextFlipY"in e&&o(59,de=e.contextFlipY),"contextZoom"in e&&o(60,ue=e.contextZoom),"active"in e&&o(61,pe=e.active),"opacity"in e&&o(62,ge=e.opacity),"parentRect"in e&&o(63,we=e.parentRect),"rootRect"in e&&o(3,Ce=e.rootRect),"utilRect"in e&&o(64,Pe=e.utilRect),"hoverColor"in e&&o(65,Ee=e.hoverColor),"textInputMode"in e&&o(4,Le=e.textInputMode),"oninteractionstart"in e&&o(66,ze=e.oninteractionstart),"oninteractionupdate"in e&&o(67,Be=e.oninteractionupdate),"oninteractionrelease"in e&&o(68,De=e.oninteractionrelease),"oninteractionend"in e&&o(69,We=e.oninteractionend),"oninteractioncancel"in e&&o(70,_e=e.oninteractioncancel),"onaddshape"in e&&o(71,Ve=e.onaddshape),"onupdateshape"in e&&o(72,Ne=e.onupdateshape),"onselectshape"in e&&o(73,He=e.onselectshape),"onremoveshape"in e&&o(74,Ze=e.onremoveshape),"ontapshape"in e&&o(75,Ye=e.ontapshape),"onhovershape"in e&&o(76,qe=e.onhovershape),"onhovercanvas"in e&&o(77,Ge=e.onhovercanvas),"ontapcanvas"in e&&o(78,Ke=e.ontapcanvas),"beforeSelectShape"in e&&o(79,Je=e.beforeSelectShape),"beforeDeselectShape"in e&&o(80,ot=e.beforeDeselectShape),"beforeRemoveShape"in e&&o(81,rt=e.beforeRemoveShape),"beforeUpdateShape"in e&&o(82,at=e.beforeUpdateShape),"willRenderShapeControls"in e&&o(83,st=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(84,lt=e.willRenderShapeTextControls),"willStartInteraction"in e&&o(85,ct=e.willStartInteraction),"mapEditorPointToImagePoint"in e&&o(86,dt=e.mapEditorPointToImagePoint),"mapImagePointToEditorPoint"in e&&o(87,ut=e.mapImagePointToEditorPoint),"eraseRadius"in e&&o(88,ht=e.eraseRadius),"selectRadius"in e&&o(89,pt=e.selectRadius),"enableButtonFlipVertical"in e&&o(90,gt=e.enableButtonFlipVertical),"enableTapToAddText"in e&&o(91,$t=e.enableTapToAddText),"enableTextStyleControls"in e&&o(5,ft=e.enableTextStyleControls),"locale"in e&&o(6,vt=e.locale)},e.$$.update=()=>{var t,n;3&e.$$.dirty[0]&&o(125,i=!te&&oe&&(Wt()||Gt())),2&e.$$.dirty[4]&&o(147,r=!!i),2&e.$$.dirty[4]&&o(139,a=i&&Si(i)),32770&e.$$.dirty[4]&&o(10,s=i&&!a?i.id:void 0),8&e.$$.dirty[0]|2&e.$$.dirty[2]|2&e.$$.dirty[4]&&o(13,l=Ce&&i&&Ki(ri(i),we)),32770&e.$$.dirty[4]&&o(123,c=!(!i||!a)),8192&e.$$.dirty[0]|1&e.$$.dirty[2]|2&e.$$.dirty[4]&&o(146,d=i&&ge&&wo(l)||[]),2&e.$$.dirty[4]&&o(148,u=i&&(zi(t=i)&&Bi(t)&&!0!==t.disableResize&&(ki(t)||mi(t)||$i(t)||fi(t)||yi(t)&&To(t,"pathClose")))&&!bi(i)),2&e.$$.dirty[4]&&o(14,h=i&&(e=>zi(e)&&!0!==e.disableRotate&&(ki(e)||To(e,"text")||$i(e)))(i)&&!bi(i)),16777218&e.$$.dirty[4]&&o(16,p=u&&To(i,"text")&&!i.height?[[1,2],[3,0]]:(!i||!fi(i)&&!yi(i))&&u),65536&e.$$.dirty[0]|16777218&e.$$.dirty[4]&&o(28,m=!!i&&(!Array.isArray(p)&&u)),4194306&e.$$.dirty[4]&&o(15,g=i&&d.length>1),33554432&e.$$.dirty[2]|4194304&e.$$.dirty[4]&&o(144,$=d.map(ut)),4&e.$$.dirty[0]|1048576&e.$$.dirty[4]&&o(12,f=$.map((e=>ce(e.x-ie.x,e.y-ie.y)))),8388610&e.$$.dirty[4]&&o(27,y=r&&(mi(i)?!To(i,"disableNewline")||!i.disableNewline:!1===i.disableNewline)),33554432&e.$$.dirty[2]|268435456&e.$$.dirty[3]&&(Co&&ut&&!vi(Co)&&Ii(Co)?(e=>{const t=wo(Ki(ri(e),we));if(!t)return;const i=t.map(ut),n=!!e.pathClose||!yi(e)&&!fi(e),r={id:"markup-hover",points:i.map((e=>ce(e.x+1,e.y+1))),strokeColor:[0,0,0,.1],strokeWidth:2,pathClose:n},a={id:"markup-hover",points:i,strokeColor:Ee,strokeWidth:2,pathClose:n},s=ee.filter((e=>"markup-hover"!==e.id));o(55,ee=[...s,r,a])})(Co):ko()),61440&e.$$.dirty[0]|1&e.$$.dirty[2]&&o(145,b=g&&h&&ge&&f&&(e=>{const t=So(e),o=ut({x:t.origin.x+t.dir.x,y:t.origin.y+t.dir.y});return{origin:ut(t.origin),position:o}})(l)),4&e.$$.dirty[0]|2097152&e.$$.dirty[4]&&o(26,x=b&&ce(b.position.x-ie.x,b.position.y-ie.y)),536870912&e.$$.dirty[3]|32770&e.$$.dirty[4]&&o(143,v=a&&yi(i)&&ni),1&e.$$.dirty[2]|1572866&e.$$.dirty[4]&&i&&$&&ge>0&&((e,t,i)=>{const n=yi(t),r=n&&To(t,"pathClose"),a=r&&(e=>e.strokeWidth&&((e,t)=>{const o=e.strokeColor;return!!o&&(3===o.length||o[3]>0)})(e))(t),s=Si(t),l=bi(t);if(s&&n&&!r)return;const c=[],u=[...$],h=u[u.length-1],p=u[0],m=(l?.05:.1)*e,g=(l?.5:1)*e,f=[0,0,0],y=[1,1,1],x=l?1:1.5;J.includes(16)&&h&&i&&kt(h,i);const v=(u.length&&r&&s&&i?Me(p,i):1/0)<=256,w=(u.length&&r&&s&&i?Me(h,i):1/0)<=256;!v&&i&&u.push(i);const S=u.length>1,k=!!t.pathClose||!yi(t)&&!fi(t)||u.length>2&&v;S&&c.push({id:Mo,points:u.map((e=>ce(e.x+1,e.y+1))),pathClose:k,strokeColor:f,strokeWidth:2,opacity:m}),r&&c.push(...u.map((e=>({id:Mo,...e,rx:2*x,ry:2*x,backgroundColor:f,opacity:m})))),b&&c.push({id:Mo,points:[ce(b.origin.x+1,b.origin.y+1),ce(b.position.x+1,b.position.y+1)],strokeColor:f,strokeWidth:2,opacity:m}),S&&c.push({id:Mo,points:u,pathClose:k,strokeColor:y,strokeWidth:x,backgroundColor:s&&t.backgroundColor&&t.backgroundColor[3]>0?t.backgroundColor:[0,0,0,0],opacity:g}),r&&c.push(...u.map((e=>({id:Mo,...e,rx:3*x,ry:3*x,backgroundColor:[.5,.5,.5],strokeWidth:x,strokeColor:y})))),r&&s&&$.length>=3&&c.push({...p,id:Mo,rx:x*(v?5:4),ry:x*(v?5:4),backgroundColor:v?Ee:[.5,.5,.5],strokeWidth:x,strokeColor:y}),r&&s&&a&&!v&&d.length>=2&&c.push({...h,id:Mo,rx:x*(w?5:4),ry:x*(w?5:4),backgroundColor:w?Ee:[.5,.5,.5],strokeWidth:x,strokeColor:y}),b&&c.push({id:Mo,points:[{x:b.origin.x,y:b.origin.y},{x:b.position.x,y:b.position.y}],strokeColor:y,strokeWidth:x,opacity:g}),o(55,ee=ee.filter((e=>e.id!==Mo)).concat(c))})(ge,i,v),2&e.$$.dirty[4]&&(i||Po()),1073741824&e.$$.dirty[1]&&(e=>{if(!e)return qt({_prerender:!1});const t=oe.find((e=>e.isEditing));t&&Xt(t,{_prerender:"inline"===Le})})(pe),272&e.$$.dirty[0]&&Io&&"inline"===Le&&Io.focus(),2&e.$$.dirty[4]&&o(142,w=i&&hi(i)),262146&e.$$.dirty[4]&&o(11,S=w&&!1!==Li(i)&&bi(i)),2048&e.$$.dirty[0]&&o(138,k=S?{...i}:void 0),2&e.$$.dirty[2]|16384&e.$$.dirty[4]&&o(140,C=k&&Ki({...k},we)),65536&e.$$.dirty[4]&&o(141,T=C&&Xo(C.text,C)),196608&e.$$.dirty[4]&&(P=C&&it(C.x,C.y,T.width,T.height)),2048&e.$$.dirty[0]|2&e.$$.dirty[4]&&o(23,R=S?i.text:""),10256&e.$$.dirty[0]&&o(25,I=S&&((e,t)=>{const{textAlign:o="left",fontFamily:i="sans-serif",fontWeight:n="normal",fontStyle:r="normal"}=e,a=e.fontSize,s="!important",l=`text-align:${o}${s};font-family:${i}${s};font-weight:${n}${s};font-style:${r}${s};`;if("modal"===t)return l;const c=Bo(e.color),d=e.lineHeight,u=.5*Math.max(0,a-d);return`--bottom-inset:${u}px;padding:${u}px 0 0${s};color:${c}${s};font-size:${a}px${s};line-height:${d}px${s};${l}`})(l,Le)),10244&e.$$.dirty[0]|603979776&e.$$.dirty[1]&&o(24,E=S&&((e,t,o,n)=>{let r,a;e.width&&e.height?(r=nt(e),a=Fe(e)):(a=Xo(i.text,l),a.width=l.width||a.width,r=ce(e.x+.5*a.width,e.y+.5*a.height));const s=Math.max(0,e.fontSize-e.lineHeight)+e.lineHeight,c=ut(r);let d=c.x-t.x-.5*a.width,u=c.y-t.y-.5*a.height,h=e.flipX,p=e.flipY,m=e.rotation;ae&&de?(h=!h,p=!p):ae?(h=!h,m=-m):de&&(p=!p,m=-m),m+=n;const g=o*(h?-1:1),$=o*(p?-1:1);return`--line-height:${s}px;width:${a.width}px;height:${a.height}px;transform:translate(${d}px,${u}px) rotate(${m}rad) scale(${g}, ${$})`})(l,ie,ue,ne)),2320&e.$$.dirty[0]&&S&&Io&&"inline"===Le&&Ao(R),1073741824&e.$$.dirty[3]|34&e.$$.dirty[4]&&o(129,L=i&&!c?i:L),32&e.$$.dirty[4]&&o(131,F=L&&Ei(L)),32&e.$$.dirty[4]&&o(126,z=L&&Fi(L)),32&e.$$.dirty[4]&&o(128,B=L&&(e=>!0!==e.disableDuplicate&&Bi(e))(L)),32&e.$$.dirty[4]&&o(127,D=L&&Ai(L)),32&e.$$.dirty[4]&&o(130,O=L&&(e=>!0!==e.disableReorder)(L)),32&e.$$.dirty[4]&&o(124,W=L&&!1!==Li(L)),32&e.$$.dirty[4]&&o(132,_=L&&To(L,"backgroundImage")&&Ri(L,"opacity")),2&e.$$.dirty[4]&&o(134,V=i&&"html"===i.format),1073741824&e.$$.dirty[3]|1026&e.$$.dirty[4]&&o(137,N=i&&(!c||V)),134217728&e.$$.dirty[3]|33562624&e.$$.dirty[4]&&Jo.set(N&&!xo?1:0,{hard:!1===K}),4096&e.$$.dirty[0]|12288&e.$$.dirty[4]&&o(136,H=N&&f.length?(n=et(f),be(ce(n.x+.5*n.width,n.y),Pd)):H),512&e.$$.dirty[0]|4&e.$$.dirty[2]|4096&e.$$.dirty[4]&&o(135,U=H&&Qo&&Pe&&(e=>{const t=Pe.x,o=Pe.y,i=t+Pe.width;let n=Math.max(e.x-.5*Qo.width,t),r=Math.max(e.y-Qo.height-16,o);return n+Qo.width>i&&(n=i-Qo.width),ce(n,r)})(H)),131072&e.$$.dirty[0]|2048&e.$$.dirty[4]&&o(22,Z=U&&`transform: translate(${U.x}px, ${U.y}px);opacity:${G}`),2048&e.$$.dirty[0]&&o(133,X=S?"text":"shape"),1089&e.$$.dirty[0]|274726912&e.$$.dirty[2]|2047&e.$$.dirty[4]&&o(21,Y="text"===X&<&&V?wh((()=>lt([["div","text-styles",{class:"PinturaShapeControlsGroup"},[...[["bold",{label:"B",style:"font-weight:900;",title:"Bold",shortcut:["CMD","B"]}],["italic",{label:"I",style:"font-family:Times New Roman;font-style:italic;",title:"Italic",shortcut:["CMD","I"]}],["underline",{label:"U",style:"text-decoration:underline;",title:"Underline",shortcut:["CMD","U"]}],["strikeThrough",{label:"S",style:"text-decoration:line-through;",title:"Strikethrough",shortcut:["CMD","S"]}]].map((([e,t])=>["Button","style-"+e,{onclick:()=>document.execCommand(e),...t,style:"font-size:1.25em;text-underline-offset:1px;text-decoration-thickness:1.5px;font-weight:400;"+t.style}]))]],["div","text-reset",{class:"PinturaShapeControlsGroup"},[["Button","style-reset",{onclick:()=>document.execCommand("removeFormat"),style:"font-weight:400;",label:'T×',title:"Remove styles"}]]]],s))):"shape"===X&&st&&s?wh((()=>st([_&&["div","alpha",{class:"PinturaShapeControlsGroup"},[["Slider","adjust-opacity",{onrelease:Zo,onchange:Uo,step:.01,value:To(i,"opacity")?i.opacity:1,label:(e,t,o)=>Math.round(e/o*100)+"%",min:0,max:1,direction:"x"}]]],["div","beta",{class:"PinturaShapeControlsGroup"},[F&&["Button","flip-horizontal",{onclick:Ho,label:vt.shapeTitleButtonFlipHorizontal,icon:vt.shapeIconButtonFlipHorizontal,hideLabel:!0}],F&>&&["Button","flip-vertical",{onclick:jo,label:vt.shapeTitleButtonFlipVertical,icon:vt.shapeIconButtonFlipVertical,hideLabel:!0}],O&&["Button","to-front",{onclick:qo,label:vt.shapeTitleButtonMoveToFront,icon:vt.shapeIconButtonMoveToFront,hideLabel:!0,disabled:oe[oe.length-1]===L}],B&&["Button","duplicate",{onclick:Go,label:vt.shapeTitleButtonDuplicate,icon:vt.shapeIconButtonDuplicate,shortcut:["CMD","D"],hideLabel:!0}],D&&["Button","remove",{onclick:Yo,label:vt.shapeTitleButtonRemove,icon:vt.shapeIconButtonRemove,shortcut:["Backspace"],hideLabel:!0}]].filter(Boolean)],W&&z&&["div","gamma",{class:"PinturaShapeControlsGroup"},[["Button","text-layout",{onclick:No,label:Xd(ti,vt,i),icon:Xd(ei,vt,i),hideLabel:!0}]]],W&&["div","delta",{class:"PinturaShapeControlsGroup"},[["Button","edit-text",{label:vt.shapeLabelInputText,onclick:Vo}]]]].filter(Boolean),s))):[]),65&e.$$.dirty[0]&&o(20,q=oe.filter(Ii).filter((e=>!Si(e))).map((e=>({id:e.id,color:hi(e)?e.color:fi(e)?e.strokeColor:e.backgroundColor,name:e.name||vt["shapeLabelTool"+Ea(Zi(e))]}))))},[oe,te,ie,Ce,Le,ft,vt,io,Io,Qo,s,S,f,l,h,g,p,G,oi,si,q,Y,Z,R,E,I,x,y,m,wt,Et,e=>{const{origin:t}=e.detail;$o=void 0,fo=void 0,yo=void 0,bo=!1,go=void 0,clearTimeout(mo),mo=setTimeout((()=>o(120,xo=!0)),250);const n=Wt();!n||yi(n)&&To(n,"pathClose")||Nt(),po=dt(he(t));const r=uo(po,pt,(e=>Ii(e))),a=r.length&&r.shift();if(i&&bi(i)&&Fo(),!a&&i&&bi(i)&&no(i),!ct(t))return;if(a&&vi(a))return bo=!0,$o=a,fo=ri($o),void(yo=Ki(ri($o),we));go=a||void 0;!ze(e)&&a&&(io(a),$o=a,fo=ri($o),yo=Ki(ri($o),we))},e=>{vo(),_e(e)},e=>{const{translation:t}=e.detail;if($o){if(!Bi($o))return;if(bi($o))return;return zt($o,yo,t)}Be(e)},e=>{vo(),$o?bi($o)?Do():e.detail.isTap&&bo&&hi($o)&&!1!==Li($o)&&ro($o):De(e)},e=>{const t=go&&e.detail.isTap;if(e.detail.isTap&&Ke({target:$o||go,position:po}),$o)return Ye($o),o=$o,i=fo,JSON.stringify(o)!==JSON.stringify(i)&&Ne($o),void($o=void 0);var o,i;const n=oo(),r=!n||ot(n,go||void 0);r&&to({storePrevious:!1}),We(e),r&&t&&io(go)},e=>{o(120,xo=!0),$o=i,yo=l},e=>{if(!$o)return void o(120,xo=!1);const{translation:t,indexes:i,shiftKey:n}=e.detail;((e,t,o,i,n)=>{if(fi(e)||yi(e)&&To(e,"pathClose")){const[n]=o,r=J.includes(16)?kt:(e,t)=>t;let a,s,l;if(fi(e))0===n?(a=()=>di(t),s=e=>r(ui(t),e),l=(e,t)=>{e.x1=t.x,e.y1=t.y}):1===n&&(a=()=>ui(t),s=e=>r(di(t),e),l=(e,t)=>{e.x2=t.x,e.y2=t.y});else{const e=t.points;a=()=>e[n],s=t=>{const o=e[of(n-1,e)],i=e[of(n+1,e)];r(o,t),r(i,t)},l=(e,t)=>e.points[n]=t}const c=Ft(a(),i);s(c),l(e,c)}else if(ki(e)||$i(e)||mi(e)){let r,a,s=!1;if($i(e))r=tt(t);else if(ki(e))r=Qe(t);else{s=!0,r=Qe(t);const e=Xo(t.text,t);r.height=e.height}e.aspectRatio?a=e.aspectRatio:n.shiftKey&&!s&&(a=r.width/r.height);const l=Qe(r),c=nt(l),d=e.rotation,u=xt(l),h=mt(l,d);if(1===o.length){let t=o[0];e.flipX&&(t=Bt[t]),e.flipY&&(t=Dt[t]);const[n,r,s,l]=u,p=ut(h[t]);xe(p,i);const m=dt(p),g=ce(m.x-h[t].x,m.y-h[t].y),$=me(he(g),-d),f=ce(u[t].x+$.x,u[t].y+$.y);let y;0===t&&(y=s),1===t&&(y=l),2===t&&(y=n),3===t&&(y=r);const b=et([y,f]);if(a){const{width:e,height:t}=yt(b,a),[o,i,n,r]=bt(b);b.width=e,b.height=t,f.y`,k=e=>W(Bt(e)),C=["src","alt","thumb","shape","id","mount","disabled"],T=e=>e.map((e=>(e=>Po(e)&&M(e[0])&&Po(e[1]))(e)?{...e[2],id:`${w}-${e[0].toLowerCase()}`,label:e[0],items:T(e[1])}:(e=>{let t,o,i,n,r,a,s,l=e;return M(e)?Mo(e)?(t=e,r=e,n=S(t,r)):(t=e,r=k(t),n=S(t,r)):(t=e.src,r=e.alt||(M(t)?k(t):M(e.thumb)?k(e.thumb):void 0),n=S(e.thumb||t,r),o=e.shape,a=e.mount,s=e.disabled,i=Object.keys(e).reduce(((t,o)=>(C.includes(o)||(t[o]=e[o]),t)),{})),{id:l,src:t,thumb:n,shape:o,shapeProps:i,alt:r,title:r,mount:a,disabled:s}})(e)));return e.$$set=e=>{"locale"in e&&o(14,p=e.locale),"presets"in e&&o(15,m=e.presets),"scrollElasticity"in e&&o(0,g=e.scrollElasticity),"enableSelectImage"in e&&o(16,$=e.enableSelectImage),"willRenderPresetToolbar"in e&&o(17,f=e.willRenderPresetToolbar),"onaddpreset"in e&&o(1,y=e.onaddpreset),"ongrabpreset"in e&&o(2,b=e.ongrabpreset),"ondragpreset"in e&&o(3,x=e.ondragpreset),"ondroppreset"in e&&o(4,v=e.ondroppreset)},e.$$.update=()=>{32768&e.$$.dirty&&o(7,i=T(m)),128&e.$$.dirty&&o(9,r=i.length),640&e.$$.dirty&&o(8,a=r&&i.some((e=>!!e.items))),384&e.$$.dirty&&o(5,s=a&&i),384&e.$$.dirty&&o(13,l=a&&i.reduce(((e,t)=>(e[t.id]=t,e)),{})),96&e.$$.dirty&&o(6,c=c||s&&(s.find((e=>!e.disabled))||{}).id),64&e.$$.dirty&&o(12,d={name:w,selected:c}),32&e.$$.dirty&&o(11,u=s&&s.map((e=>e.id))),212994&e.$$.dirty&&o(10,h=p&&f([$&&["Button","browse",{label:p.shapeLabelButtonSelectSticker,icon:p.shapeIconButtonSelectSticker,onclick:()=>{vh().then((e=>{e&&y(e)}))}}]]))},[g,y,b,x,v,s,c,i,a,r,h,u,d,l,p,m,$,f,({detail:e})=>o(6,c=e)]}class vy extends ya{constructor(e){super(),fa(this,e,xy,by,On,{locale:14,presets:15,scrollElasticity:0,enableSelectImage:16,willRenderPresetToolbar:17,onaddpreset:1,ongrabpreset:2,ondragpreset:3,ondroppreset:4})}}function wy(e){let t,o,i,n;const r=[{locale:e[4]},{uid:e[14]},{parentRect:e[29]},{rootRect:e[43]},{utilRect:e[30]},{offset:e[38]},{disabled:e[28]},{contextRotation:e[17]},{contextFlipX:e[18]},{contextFlipY:e[19]},{contextZoom:e[42]},{active:e[26]},{opacity:e[45]},{hoverColor:e[46]},{eraseRadius:e[37]},{selectRadius:e[6]},{enableButtonFlipVertical:e[9]},{mapEditorPointToImagePoint:e[15]},{mapImagePointToEditorPoint:e[16]},{enableTapToAddText:e[12]},{textInputMode:e[7]},{willStartInteraction:e[80]},{oninteractionstart:e[66]},{oninteractionupdate:e[67]},{oninteractionrelease:e[68]},{oninteractionend:e[70]},{oninteractioncancel:e[69]},{onhovershape:e[74]},{ontapcanvas:e[73]},{onaddshape:e[122]},{onselectshape:e[123]},{ontapshape:e[124]},{onupdateshape:e[125]},{onremoveshape:e[126]},e[32]];function a(t){e[128](t)}function s(t){e[129](t)}let l={};for(let e=0;e
`},R,"frame",m,$,a,s,l,d,function(t){Br.call(this,e,t)}]}var Qy={util:["frame",class extends ya{constructor(e){super(),fa(this,e,Jy,Ky,On,{name:16,isActive:0,stores:17,locale:1,frameStyles:18,frameOptions:2,markupEditorShapeStyleControls:3},null,[-1,-1])}get name(){return this.$$.ctx[16]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Gr()}get stores(){return this.$$.ctx[17]}set stores(e){this.$$set({stores:e}),Gr()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),Gr()}get frameStyles(){return this.$$.ctx[18]}set frameStyles(e){this.$$set({frameStyles:e}),Gr()}get frameOptions(){return this.$$.ctx[2]}set frameOptions(e){this.$$set({frameOptions:e}),Gr()}get markupEditorShapeStyleControls(){return this.$$.ctx[3]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),Gr()}},({duration:e})=>!e]};function eb(e){let t,o,i,n,r,a,s,l;return{c(){t=lr("div"),o=lr("input"),n=ur(),r=lr("label"),a=dr(e[1]),$r(o,"id",e[0]),$r(o,"type","number"),$r(o,"min","1"),$r(o,"inputmode","numeric"),$r(o,"pattern","[0-9]*"),$r(o,"data-state",e[3]),$r(o,"autocomplete","off"),$r(o,"placeholder",e[4]),o.value=i=void 0===e[5]?"":e[7](e[5]+""),$r(r,"for",e[0]),$r(r,"title",e[2]),$r(r,"aria-label",e[2]),$r(t,"class","PinturaInputDimension")},m(i,c){ar(i,t,c),ir(t,o),ir(t,n),ir(t,r),ir(r,a),s||(l=pr(o,"input",e[8]),s=!0)},p(e,[t]){1&t&&$r(o,"id",e[0]),8&t&&$r(o,"data-state",e[3]),16&t&&$r(o,"placeholder",e[4]),160&t&&i!==(i=void 0===e[5]?"":e[7](e[5]+""))&&o.value!==i&&(o.value=i),2&t&&yr(a,e[1]),1&t&&$r(r,"for",e[0]),4&t&&$r(r,"title",e[2]),4&t&&$r(r,"aria-label",e[2])},i:An,o:An,d(e){e&&sr(t),s=!1,l()}}}function tb(e,t,o){let{id:i}=t,{label:n}=t,{title:r}=t,{state:a}=t,{placeholder:s}=t,{value:l}=t,{onchange:c}=t,{format:d=(e=>e.replace(/\D/g,""))}=t;return e.$$set=e=>{"id"in e&&o(0,i=e.id),"label"in e&&o(1,n=e.label),"title"in e&&o(2,r=e.title),"state"in e&&o(3,a=e.state),"placeholder"in e&&o(4,s=e.placeholder),"value"in e&&o(5,l=e.value),"onchange"in e&&o(6,c=e.onchange),"format"in e&&o(7,d=e.format)},[i,n,r,a,s,l,c,d,e=>c(d(e.currentTarget.value))]}class ob extends ya{constructor(e){super(),fa(this,e,tb,eb,On,{id:0,label:1,title:2,state:3,placeholder:4,value:5,onchange:6,format:7})}}function ib(e){let t;return{c(){t=cr("g")},m(o,i){ar(o,t,i),t.innerHTML=e[2]},p(e,o){4&o&&(t.innerHTML=e[2])},d(e){e&&sr(t)}}}function nb(e){let t,o,i,n,r,a,s,l;return r=new Ic({props:{$$slots:{default:[ib]},$$scope:{ctx:e}}}),{c(){t=lr("div"),o=lr("input"),i=ur(),n=lr("label"),ma(r.$$.fragment),$r(o,"id",e[0]),$r(o,"class","implicit"),$r(o,"type","checkbox"),o.checked=e[1],$r(n,"for",e[0]),$r(n,"title",e[3])},m(c,d){ar(c,t,d),ir(t,o),ir(t,i),ir(t,n),ga(r,n,null),a=!0,s||(l=pr(o,"change",e[5]),s=!0)},p(e,[t]){(!a||1&t)&&$r(o,"id",e[0]),(!a||2&t)&&(o.checked=e[1]);const i={};68&t&&(i.$$scope={dirty:t,ctx:e}),r.$set(i),(!a||1&t)&&$r(n,"for",e[0]),(!a||8&t)&&$r(n,"title",e[3])},i(e){a||(ia(r.$$.fragment,e),a=!0)},o(e){na(r.$$.fragment,e),a=!1},d(e){e&&sr(t),$a(r),s=!1,l()}}}function rb(e,t,o){let{id:i}=t,{locked:n}=t,{icon:r}=t,{title:a}=t,{onchange:s}=t;return e.$$set=e=>{"id"in e&&o(0,i=e.id),"locked"in e&&o(1,n=e.locked),"icon"in e&&o(2,r=e.icon),"title"in e&&o(3,a=e.title),"onchange"in e&&o(4,s=e.onchange)},[i,n,r,a,s,e=>s(e.currentTarget.checked)]}class ab extends ya{constructor(e){super(),fa(this,e,rb,nb,On,{id:0,locked:1,icon:2,title:3,onchange:4})}}function sb(e){let t;return{c(){t=dr("Save")},m(e,o){ar(e,t,o)},d(e){e&&sr(t)}}}function lb(e){let t,o,i,n,r,a,s,l,c,d,u,h,p,m=e[1].resizeLabelFormCaption+"";return l=new ih({props:{items:e[4]}}),d=new Yc({props:{type:"submit",class:"implicit",$$slots:{default:[sb]},$$scope:{ctx:e}}}),{c(){t=lr("form"),o=lr("div"),i=lr("fieldset"),n=lr("legend"),r=dr(m),a=ur(),s=lr("div"),ma(l.$$.fragment),c=ur(),ma(d.$$.fragment),$r(n,"class","implicit"),$r(s,"class","PinturaFieldsetInner"),$r(o,"class","PinturaFormInner"),$r(t,"slot","footer"),$r(t,"style",e[3])},m(m,g){ar(m,t,g),ir(t,o),ir(o,i),ir(i,n),ir(n,r),ir(i,a),ir(i,s),ga(l,s,null),e[64](s),ir(o,c),ga(d,o,null),u=!0,h||(p=[pr(s,"focusin",e[15]),pr(s,"focusout",e[16]),pr(t,"submit",mr(e[17]))],h=!0)},p(e,o){(!u||2&o[0])&&m!==(m=e[1].resizeLabelFormCaption+"")&&yr(r,m);const i={};16&o[0]&&(i.items=e[4]),l.$set(i);const n={};4&o[3]&&(n.$$scope={dirty:o,ctx:e}),d.$set(n),(!u||8&o[0])&&$r(t,"style",e[3])},i(e){u||(ia(l.$$.fragment,e),ia(d.$$.fragment,e),u=!0)},o(e){na(l.$$.fragment,e),na(d.$$.fragment,e),u=!1},d(o){o&&sr(t),$a(l),e[64](null),$a(d),h=!1,Bn(p)}}}function cb(e){let t,o;return t=new Hg({props:{$$slots:{footer:[lb]},$$scope:{ctx:e}}}),t.$on("measure",e[65]),{c(){ma(t.$$.fragment)},m(e,i){ga(t,e,i),o=!0},p(e,o){const i={};30&o[0]|4&o[3]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ia(t.$$.fragment,e),o=!0)},o(e){na(t.$$.fragment,e),o=!1},d(e){$a(t,e)}}}function db(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,S,k,C,T,P,R,I,E,L,F,z=An,B=()=>(z(),z=Wn(O,(e=>o(48,p=e))),O);e.$$.on_destroy.push((()=>z()));const D=(e,t=0,o=9999)=>{if(M(e)&&!(e=e.replace(/\D/g,"")).length)return;const i=Math.round(e);return Number.isNaN(i)?void 0:Va(i,t,o)};let{isActive:O}=t;B();let{stores:W}=t,{locale:_={}}=t,{resizeMinSize:V=Oe(1,1)}=t,{resizeMaxSize:N=Oe(9999,9999)}=t,{resizeSizePresetOptions:U}=t,{resizeWidthPresetOptions:Z}=t,{resizeHeightPresetOptions:X}=t,{resizeWillRenderFooter:Y=j}=t;const q=Dl(0,{stiffness:.15,damping:.3});Vn(e,q,(e=>o(53,y=e)));const{animation:G,imageSize:K,imageCropRect:J,imageCropRectAspectRatio:Q,imageCropAspectRatio:ee,imageOutputSize:te,imageSelectionZoom:oe,imageSelectionPan:ie,history:ne,env:re,allowPan:ae,allowZoom:se,allowZoomControls:ce}=W;Vn(e,G,(e=>o(49,m=e))),Vn(e,K,(e=>o(72,E=e))),Vn(e,J,(e=>o(51,$=e))),Vn(e,Q,(e=>o(52,f=e))),Vn(e,ee,(e=>o(71,T=e))),Vn(e,te,(e=>o(60,C=e))),Vn(e,oe,(e=>o(73,L=e))),Vn(e,ie,(e=>o(74,F=e))),Vn(e,re,(e=>o(50,g=e)));const de=A();let ue,he,pe,me,ge,$e,fe=!1,ye=le();const be=(e,t,o,i,n)=>null!=e&&o!==t?e>=i[t]&&e<=n[t]?"valid":"invalid":"undetermined",xe=(e,t,o)=>Math.round(null!=e?e/t:o.height),ve=()=>{fe&&he&&pe&&("width"===me?o(38,pe=Math.round(he/f)):"height"===me?o(37,he=Math.round(pe*f)):("width"===ge?o(38,pe=Math.round(he/f)):"height"===ge&&o(37,he=Math.round(pe*f)),we()))},we=e=>{let t=D(he),i=D(pe),n=t,r=i,a=n&&r,s=e||f;if(!n&&!r)return;n&&!r?r=Math.round(n/s):r&&!n&&(n=Math.round(r*s)),s=e||a?H(n,r):f;let l=Oe(n,r);He(N,l)||(l=yt(N,s)),He(l,V)||(l=ft(V,s)),o(37,he=null!=t?Math.round(l.width):void 0),o(38,pe=null!=i?Math.round(l.height):void 0)},Se=()=>{we();const{width:e,height:t}=C||{};e===he&&t===pe||(he||pe?(he&&pe&&qn(ee,T=he/pe,T),qn(te,C=Oe(he,pe),C)):(qn(ee,T=E.width/E.height,T),qn(ee,T=void 0,T),qn(te,C=void 0,C)),ne.write())},ke=te.subscribe((e=>{if(!e)return o(37,he=void 0),void o(38,pe=void 0);o(37,he=e.width),o(38,pe=e.height),we()})),Ce=ee.subscribe((e=>{(he||pe)&&e&&(he&&pe&&H(he,pe)!==e?(o(38,pe=he/e),we(e)):we())})),Me=e=>M(e[0])?(e[1]=e[1].map(Me),e):Co(e)?[e,""+e]:e,Te=e=>{if(M(e[0]))return e[1]=e[1].map(Te),e;let[t,o]=e;if(Co(t)&&Co(o)){const[e,i]=[t,o];o=`${e} × ${i}`,t=[e,i]}return[t,o]},Pe=va();Vn(e,Pe,(e=>o(59,k=e)));const Re=va();Vn(e,Re,(e=>o(63,I=e)));const Ie=va();Vn(e,Ie,(e=>o(57,w=e)));const Ae=va();Vn(e,Ae,(e=>o(62,R=e)));const Ee=va();Vn(e,Ee,(e=>o(55,x=e)));const Le=va();Vn(e,Le,(e=>o(61,P=e)));const Fe=wa([te,Re],(([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex((([t])=>{if(!t&&!e)return!0;if(!t)return!1;const[o,i]=t;return e.width===o&&e.height===i}));o(i<0?0:i)}));Vn(e,Fe,(e=>o(58,S=e)));const ze=wa([te,Ae],(([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex((([t])=>!t&&!e||!!t&&e.width===t));o(i<0?0:i)}));Vn(e,ze,(e=>o(56,v=e)));const De=wa([te,Le],(([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex((([t])=>!t&&!e||!!t&&e.height===t));o(i<0?0:i)}));Vn(e,De,(e=>o(54,b=e)));let We=void 0,_e=void 0;const Ve=zr("redrawTrigger"),Ne=Dl(m?20:0);return Vn(e,Ne,(e=>o(47,h=e))),Er((()=>{ke(),Ce()})),e.$$set=e=>{"isActive"in e&&B(o(0,O=e.isActive)),"stores"in e&&o(29,W=e.stores),"locale"in e&&o(1,_=e.locale),"resizeMinSize"in e&&o(30,V=e.resizeMinSize),"resizeMaxSize"in e&&o(31,N=e.resizeMaxSize),"resizeSizePresetOptions"in e&&o(32,U=e.resizeSizePresetOptions),"resizeWidthPresetOptions"in e&&o(33,Z=e.resizeWidthPresetOptions),"resizeHeightPresetOptions"in e&&o(34,X=e.resizeHeightPresetOptions),"resizeWillRenderFooter"in e&&o(35,Y=e.resizeWillRenderFooter)},e.$$.update=()=>{var t;131072&e.$$.dirty[1]&&ae.set(!p),131072&e.$$.dirty[1]&&se.set(!p),131072&e.$$.dirty[1]&&ce.set(!p),268435458&e.$$.dirty[1]&&U&&(qn(Pe,k=U.map(Te),k),qn(Re,I=Ud(k),I)),268435456&e.$$.dirty[1]&&o(46,a=!!k),134217728&e.$$.dirty[1]|2&e.$$.dirty[2]&&o(45,i=S>-1&&I[S][1]),67108868&e.$$.dirty[1]&&Z&&(qn(Ie,w=Z.map(Me),w),qn(Ae,R=Ud(w),R)),67141632&e.$$.dirty[1]&&o(43,s=!a&&w),33554432&e.$$.dirty[1]|1&e.$$.dirty[2]&&o(44,n=v>-1&&R[v][1]),16777224&e.$$.dirty[1]&&X&&(qn(Ee,x=X.map(Me),x),qn(Le,P=Ud(x),P)),16809984&e.$$.dirty[1]&&o(42,l=!a&&x),1082130432&e.$$.dirty[1]&&o(41,r=b>-1&&P[b][1]),38912&e.$$.dirty[1]&&o(40,c=!a&&!s&&!l),1073741826&e.$$.dirty[0]|536412145&e.$$.dirty[1]&&o(4,d=Ve&&wh((()=>{return Y([a&&["Dropdown","size-presets",{label:i,options:k,onchange:e=>{return(t=e.value)&&!We&&(We={...$},_e=T),t?(qn(ee,T=H(t[0],t[1]),T),qn(te,C=Be(t),C)):(qn(J,$=We,$),qn(ee,T=_e,T),qn(te,C=void 0,C),We=void 0,_e=void 0),void ne.write();var t},selectedIndex:S}],s&&["Dropdown","width-presets",{label:n,options:w,onchange:e=>{o(37,he=e.value),Se()},selectedIndex:v}],s&&l&&["span","times",{class:"PinturaResizeLabel",innerHTML:"×"}],l&&["Dropdown","height-presets",{label:r,options:x,onchange:e=>{o(38,pe=e.value),Se()},selectedIndex:b}],c&&[ob,"width-input",{id:"width-"+de,title:_.resizeTitleInputWidth,label:_.resizeLabelInputWidth,placeholder:(e=D(pe),t=f,d=$,Math.round(null!=e?e*t:d.width)),value:he,state:be(D(he),"width",me,V,N),onchange:e=>{o(37,he=e),ve()}}],c&&[ab,"aspect-ratio-lock",{id:"aspect-ratio-lock-"+de,title:_.resizeTitleButtonMaintainAspectRatio,icon:M(_.resizeIconButtonMaintainAspectRatio)?_.resizeIconButtonMaintainAspectRatio:_.resizeIconButtonMaintainAspectRatio(fe,y),locked:fe,onchange:e=>{o(36,fe=e),ve()}}],c&&[ob,"height-input",{id:"height-"+de,title:_.resizeTitleInputHeight,label:_.resizeLabelInputHeight,placeholder:xe(D(he),f,$),value:pe,state:be(D(pe),"height",me,V,N),onchange:e=>{o(38,pe=e),ve()}}]].filter(Boolean),{...g},(()=>Ve.set({})));var e,t,d})).filter(Boolean)),32&e.$$.dirty[1]&&q.set(fe?1:0),256&e.$$.dirty[1]&&me&&(ge=me),131072&e.$$.dirty[1]&&p&&(ye=F,$e=L),537001984&e.$$.dirty[1]&&(p?(t=C,qn(ie,F=le(),F),qn(oe,L=t&&$?t.width/$.width||t.height/$.height:1,L)):(qn(ie,F=ye,F),qn(oe,L=$e,L))),393216&e.$$.dirty[1]&&m&&Ne.set(p?0:20),65536&e.$$.dirty[1]&&o(3,u=h?`transform: translateY(${h}px)`:void 0)},[O,_,ue,u,d,q,G,K,J,Q,ee,te,oe,ie,re,e=>{const t=e.target.id;/width/.test(t)?o(39,me="width"):/height/.test(t)?o(39,me="height"):/aspectRatio/i.test(t)?o(39,me="lock"):o(39,me=void 0)},e=>{ue.contains(e.relatedTarget)||Se(),o(39,me=void 0)},Se,Pe,Re,Ie,Ae,Ee,Le,Fe,ze,De,Ne,"resize",W,V,N,U,Z,X,Y,fe,he,pe,me,c,r,l,s,n,i,a,h,p,m,g,$,f,y,b,x,v,w,S,k,C,P,R,I,function(e){Or[e?"unshift":"push"]((()=>{ue=e,o(2,ue)}))},function(t){Br.call(this,e,t)}]}var ub={util:["resize",class extends ya{constructor(e){super(),fa(this,e,db,cb,On,{name:28,isActive:0,stores:29,locale:1,resizeMinSize:30,resizeMaxSize:31,resizeSizePresetOptions:32,resizeWidthPresetOptions:33,resizeHeightPresetOptions:34,resizeWillRenderFooter:35},null,[-1,-1,-1,-1])}get name(){return this.$$.ctx[28]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Gr()}get stores(){return this.$$.ctx[29]}set stores(e){this.$$set({stores:e}),Gr()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),Gr()}get resizeMinSize(){return this.$$.ctx[30]}set resizeMinSize(e){this.$$set({resizeMinSize:e}),Gr()}get resizeMaxSize(){return this.$$.ctx[31]}set resizeMaxSize(e){this.$$set({resizeMaxSize:e}),Gr()}get resizeSizePresetOptions(){return this.$$.ctx[32]}set resizeSizePresetOptions(e){this.$$set({resizeSizePresetOptions:e}),Gr()}get resizeWidthPresetOptions(){return this.$$.ctx[33]}set resizeWidthPresetOptions(e){this.$$set({resizeWidthPresetOptions:e}),Gr()}get resizeHeightPresetOptions(){return this.$$.ctx[34]}set resizeHeightPresetOptions(e){this.$$set({resizeHeightPresetOptions:e}),Gr()}get resizeWillRenderFooter(){return this.$$.ctx[35]}set resizeWillRenderFooter(e){this.$$set({resizeWillRenderFooter:e}),Gr()}},({duration:e})=>!e]};function hb(e){let t,o;return t=new By({props:{stores:e[3],locale:e[4],isActive:e[0],isActiveFraction:e[1],isVisible:e[2],mapScreenPointToImagePoint:e[9],mapImagePointToScreenPoint:e[8],utilKey:"redact",imageRotation:e[10],imageFlipX:e[7],imageFlipY:e[6],shapes:e[11],toolbar:["rect"],toolShapes:{rectangle:[{x:0,y:0,width:0,height:0}]},toolActive:"rectangle",parentRect:e[13],enablePresetDropImage:!1,enablePresetSelectImage:!1,willStartInteraction:e[5],hooks:{willRenderShapeControls:e[24]}}}),t.$on("measure",e[25]),{c(){ma(t.$$.fragment)},m(e,i){ga(t,e,i),o=!0},p(e,[o]){const i={};8&o&&(i.stores=e[3]),16&o&&(i.locale=e[4]),1&o&&(i.isActive=e[0]),2&o&&(i.isActiveFraction=e[1]),4&o&&(i.isVisible=e[2]),512&o&&(i.mapScreenPointToImagePoint=e[9]),256&o&&(i.mapImagePointToScreenPoint=e[8]),1024&o&&(i.imageRotation=e[10]),128&o&&(i.imageFlipX=e[7]),64&o&&(i.imageFlipY=e[6]),32&o&&(i.willStartInteraction=e[5]),t.$set(i)},i(e){o||(ia(t.$$.fragment,e),o=!0)},o(e){na(t.$$.fragment,e),o=!1},d(e){$a(t,e)}}}function pb(e,t,o){let i,n,r,a,s,l,c,d,u;let{isActive:h}=t,{isActiveFraction:p}=t,{isVisible:m}=t,{stores:g}=t,{locale:$={}}=t,{markupEditorWillStartInteraction:f}=t;const{imageRedaction:y,rootRect:b,imageSize:x,imageRotation:v,imageFlipX:w,imageFlipY:S,imageTransforms:k,imageTransformsInterpolated:C}=g;Vn(e,b,(e=>o(23,d=e))),Vn(e,x,(e=>o(22,c=e))),Vn(e,v,(e=>o(10,u=e))),Vn(e,w,(e=>o(7,a=e))),Vn(e,S,(e=>o(6,r=e))),Vn(e,k,(e=>o(21,l=e))),Vn(e,C,(e=>o(20,s=e)));return e.$$set=e=>{"isActive"in e&&o(0,h=e.isActive),"isActiveFraction"in e&&o(1,p=e.isActiveFraction),"isVisible"in e&&o(2,m=e.isVisible),"stores"in e&&o(3,g=e.stores),"locale"in e&&o(4,$=e.locale),"markupEditorWillStartInteraction"in e&&o(5,f=e.markupEditorWillStartInteraction)},e.$$.update=()=>{15728832&e.$$.dirty&&o(9,i=e=>Oy(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,r)),15728832&e.$$.dirty&&o(8,n=e=>Dy(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,r))},[h,p,m,g,$,f,r,a,n,i,u,y,b,x,v,w,S,k,C,"redact",s,l,c,d,e=>{const t=fp(e[0]);return Sp("to-front",t),e},function(t){Br.call(this,e,t)}]}var mb={util:["redact",class extends ya{constructor(e){super(),fa(this,e,pb,hb,On,{name:19,isActive:0,isActiveFraction:1,isVisible:2,stores:3,locale:4,markupEditorWillStartInteraction:5})}get name(){return this.$$.ctx[19]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Gr()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Gr()}get isVisible(){return this.$$.ctx[2]}set isVisible(e){this.$$set({isVisible:e}),Gr()}get stores(){return this.$$.ctx[3]}set stores(e){this.$$set({stores:e}),Gr()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),Gr()}get markupEditorWillStartInteraction(){return this.$$.ctx[5]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),Gr()}},({duration:e})=>!e]};function gb(e){let t,o,i=(T(e[31].label)?e[31].label(e[1]):e[31].label)+"";return{c(){t=lr("span"),o=dr(i)},m(e,i){ar(e,t,i),ir(t,o)},p(e,t){2&t[0]|1&t[1]&&i!==(i=(T(e[31].label)?e[31].label(e[1]):e[31].label)+"")&&yr(o,i)},d(e){e&&sr(t)}}}function $b(e){let t,o,i,n=(e[11](e[31].value)||"")+"",r=e[31].label&&gb(e);return{c(){t=lr("div"),o=new vr(!1),i=ur(),r&&r.c(),o.a=i,$r(t,"slot","option")},m(e,a){ar(e,t,a),o.m(n,t),ir(t,i),r&&r.m(t,null)},p(e,i){1&i[1]&&n!==(n=(e[11](e[31].value)||"")+"")&&o.p(n),e[31].label?r?r.p(e,i):(r=gb(e),r.c(),r.m(t,null)):r&&(r.d(1),r=null)},d(e){e&&sr(t),r&&r.d()}}}function fb(e){let t,o;return t=new vu({props:{locale:e[1],class:"PinturaControlList",layout:"row",options:e[2],selectedIndex:e[4],onchange:e[10],$$slots:{option:[$b,({option:e})=>({31:e}),({option:e})=>[0,e?1:0]]},$$scope:{ctx:e}}}),{c(){ma(t.$$.fragment)},m(e,i){ga(t,e,i),o=!0},p(e,o){const i={};2&o[0]&&(i.locale=e[1]),4&o[0]&&(i.options=e[2]),16&o[0]&&(i.selectedIndex=e[4]),2&o[0]|3&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ia(t.$$.fragment,e),o=!0)},o(e){na(t.$$.fragment,e),o=!1},d(e){$a(t,e)}}}function yb(e){let t,o,i;return o=new cd({props:{elasticity:e[5],$$slots:{default:[fb]},$$scope:{ctx:e}}}),{c(){t=lr("div"),ma(o.$$.fragment),$r(t,"slot","footer"),$r(t,"style",e[3])},m(e,n){ar(e,t,n),ga(o,t,null),i=!0},p(e,n){const r={};32&n[0]&&(r.elasticity=e[5]),22&n[0]|2&n[1]&&(r.$$scope={dirty:n,ctx:e}),o.$set(r),(!i||8&n[0])&&$r(t,"style",e[3])},i(e){i||(ia(o.$$.fragment,e),i=!0)},o(e){na(o.$$.fragment,e),i=!1},d(e){e&&sr(t),$a(o)}}}function bb(e){let t,o;return t=new Hg({props:{$$slots:{footer:[yb]},$$scope:{ctx:e}}}),t.$on("measure",e[22]),{c(){ma(t.$$.fragment)},m(e,i){ga(t,e,i),o=!0},p(e,o){const i={};62&o[0]|2&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ia(t.$$.fragment,e),o=!0)},o(e){na(t.$$.fragment,e),o=!1},d(e){$a(t,e)}}}function xb(e,t,o){let i,n,r,a,s,l,c,d,u,h,p=An,m=()=>(p(),p=Wn(g,(e=>o(17,l=e))),g);e.$$.on_destroy.push((()=>p()));let{isActive:g}=t;m();let{stores:$}=t,{locale:f={}}=t,{fillOptions:y=[]}=t;const b=e=>e.map((e=>(e=>Po(e)&&M(e[0])&&Po(e[1]))(e)?[e[0],b(e[1]),e[2]]:(e=>[Array.isArray(e)&&3===e.length?[...e,1]:e,void 0,{disabled:!1}])(e))),x=zr("elasticityMultiplier");Vn(e,x,(e=>o(21,h=e)));const{history:v,animation:w,scrollElasticity:S,imageBackgroundColor:k,imageBackgroundImage:C,allowPan:T,allowZoom:P,allowZoomControls:R}=$;Vn(e,w,(e=>o(18,c=e))),Vn(e,k,(e=>o(20,u=e))),Vn(e,C,(e=>o(19,d=e)));const I=Dl(c?20:0);return Vn(e,I,(e=>o(16,s=e))),e.$$set=e=>{"isActive"in e&&m(o(0,g=e.isActive)),"stores"in e&&o(14,$=e.stores),"locale"in e&&o(1,f=e.locale),"fillOptions"in e&&o(15,y=e.fillOptions)},e.$$.update=()=>{32768&e.$$.dirty[0]&&o(2,i=b(y)),131072&e.$$.dirty[0]&&T.set(l),131072&e.$$.dirty[0]&&P.set(l),131072&e.$$.dirty[0]&&R.set(l),2097152&e.$$.dirty[0]&&o(5,n=h*S),1572868&e.$$.dirty[0]&&o(4,r=i.findIndex((([e])=>d?e===d:Array.isArray(e)?Ua(e,u):void 0))||0),393216&e.$$.dirty[0]&&c&&I.set(l?0:20),65536&e.$$.dirty[0]&&o(3,a=s?`transform: translateY(${s}px)`:void 0)},[g,f,i,a,r,n,x,w,k,C,({value:e})=>{M(e)&&(qn(k,u=void 0,u),qn(C,d=e,d)),Po(e)&&(qn(k,u=e,u),qn(C,d=void 0,d)),v.write()},e=>{if(M(e))return`
`(err, imageData) => {\n(${t[o][0].toString()})(Object.assign({ imageData: imageData }, filterInstructions[${o}]), \n${t[o+1]?e(t,o+1):"done"})\n}`,t=`function (options, done) {\nconst filterInstructions = options.filterInstructions;\nconst imageData = options.imageData;\n(${e(x,0)})(null, imageData)\n}`,o=await L(t,[{imageData:b,filterInstructions:x.map((e=>e[1]))}],[b.data.buffer]);v=fo(o)}else v=b;return"canvas"===l?(y.putImageData(v,0,0),f):v})(e,{blurAmount:t,scrambleAmount:i,backgroundColor:n,...r,dataSizeScalar:o||r.dataSizeScalar})},dx=is,ux=()=>(()=>{const e=es.map(ts),t=Aa.map((([e])=>e)).filter((e=>!Qa.includes(e)));return e.concat(t)})().concat((ap=new Set(Tc(op).filter((e=>!np.includes(e)))),[...ap,...sp])),hx=jm,px=Nm,mx=Rg,gx={markupEditorToolbar:jm(),markupEditorToolStyles:Nm(),markupEditorShapeStyleControls:Rg()},$x=dp,fx=V$,yx=Y$,bx=tf,xx=Vy,vx=jy,wx=Xy,Sx=Qy,kx=mb,Cx=ub,Mx=vb,Tx=rm,Px=Np,Rx=gm,Ix=kb,Ax=Cb,Ex=Mb,Lx=Tb,Fx={filterLabel:"Filter",filterIcon:'