@pqina/pintura 8.97.0 → 8.97.2

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/pintura-umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Pintura v8.97.0 - Test version
2
+ * Pintura v8.97.2 - Test version
3
3
  * (c) 2018-2026 Pintura Labs B.V. - All Rights Reserved
4
4
  * License: https://pqina.nl/pintura/license/
5
5
  *
@@ -8,4 +8,4 @@
8
8
  */
9
9
  /* eslint-disable */
10
10
 
11
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pintura={})}(this,function(e){"use strict";const t=(e,t,o,i,n=!0)=>{const r=[];let a=t;const s=Math.min(e.byteLength,t+o-16);for(;a<s;a+=12){const t=a;e.getUint16(t,n)===i&&r.push(t)}return r};var o=(...e)=>{};const i=[{value:65504,name:"jfif",getTags:o},{value:65498,name:"sos",getTags:o},{value:65505,subvalue:17784,name:"exif",getTags:(e,o)=>{if(65505!==e.getUint16(o))return;const i=e.getUint16(o+2);if(o+=4,1165519206!==e.getUint32(o))return;o+=6;const n=e.getUint16(o);if(18761!==n&&19789!==n)return;const r=18761===n;return o+=2,42===e.getUint16(o,r)?(o+=e.getUint32(o+2,r),{read:n=>{const a=t(e,o,i,n,r);if(a.length)return e.getUint16(a[0]+8,r)},write:(n,a)=>{const s=t(e,o,i,n,r);return!!s.length&&(s.forEach(t=>e.setUint16(t+8,a,r)),!0)}}):void 0}},{value:65505,subvalue:26740,name:"xmp",getTags:o},{value:65506,subvalue:19792,name:"mpf",getTags:o},{value:65506,name:"app2",getTags:(e,t)=>{if(65506!==e.getUint16(t))return;const o=e.getUint16(t+2);if("ICC_PROFILE"!==(new TextDecoder).decode(e.buffer.slice(t+4,t+15)))return;function i(e){return String.fromCharCode(a.getUint8(e),a.getUint8(e+1),a.getUint8(e+2),a.getUint8(e+3))}function n(e,t,o){const{buffer:i}=a;let n,r;if("text"===e)n=t+8,r=t+o-7;else if("desc"===e){n=t+12,r=t+a.getUint32(t+8)+12}else{if("mluc"!==e)return;{const e=a.getUint32(t+20),o=a.getUint32(t+24);n=t+o,r=t+o+e}}return(new TextDecoder).decode(i.slice(n,r)).replace(/\u0000|\x00/g,"")}t+=18;const a=new DataView(e.buffer.slice(t,t+o)),s=a.getUint32(128),l=[];let c=132;for(let e=0;e<s;e++){const e=a.getUint32(c),t=a.getUint32(c+4);if(t>a.byteLength)break;const o=a.getUint32(c+8),s=i(t),d=n(s,t,o);if(e===r){l.push({address:e,offset:t,size:o,type:s,value:d});break}c+=12}return{read:e=>{const t=l.find(t=>t.address===e);return t?t.value:void 0},write:(e,t)=>{}}}}];const n=274,r=1684370275,a=e=>{if(!e)return;return(e=>{if(65496!==e.getUint16(0))return;const t=e.byteLength;let o,n,r=2;for(;r<t&&255===e.getUint8(r);){o=e.getUint16(r);const t=i.find(t=>t.value===o&&(!t.subvalue||t.subvalue===e.getUint16(r+2+2)));if(t){const{name:o,getTags:i}=t;if(n||(n={}),!n[o]){let t=r;n[o]={offset:r,size:e.getUint16(r+2),getTags:()=>i(e,t)}}}if(65498===o)break;r+=2+e.getUint16(r+2)}return n})(new DataView(e))},s=(e,t)=>{const o=a(e);if(o)return Object.entries(t).reduce((e,[t,i])=>{if(!o[t])return e;const n=o[t].getTags();if(!n)return e;for(const o of i){const i=n.read(o);e[t]={...e[t],[o]:i}}return e},{})},l="__pqina_webapi__";var c=e=>window[l]?window[l][e]:window[e];const d={ArrayBuffer:"readAsArrayBuffer"};var u=(e,t=o,i={})=>new Promise((o,n)=>{const{dataFormat:r=d.ArrayBuffer}=i,a=new(c("FileReader"));a.onload=()=>o(a.result),a.onerror=()=>n(a.error),a.onprogress=t,a[r](e)}),p=async(e,t,o=[0,e.size],i)=>{const n=await(async(e,t=[0,e.size],o)=>await u(e.slice(...t),o))(e,o,i);return s(n,t)};let h=null;var m=()=>(null===h&&(h="undefined"!=typeof window&&void 0!==window.document),h);let g=null;var $=()=>new Promise(e=>{if(null===g){const t="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=";let o=m()?new Image:{};return o.onload=()=>{g=1===o.naturalWidth,o=void 0,e(g)},void(o.src=t)}return e(g)}),f=(e,t)=>{const{colorSpace:o="srgb"}=t||{};return e.getContext("2d",{colorSpace:o}).getImageData(0,0,e.width,e.height)},y=e=>"string"==typeof e;function b(e,t){t.split(";").forEach(t=>{const[o,i]=t.split(":");if(!o.length||!i)return;const[n,r]=i.split("!important");e.style.setProperty(o,n,y(r)?"important":void 0)})}var x=(e,t,o=[])=>{const i=document.createElement(e),n=Object.getOwnPropertyDescriptors(i.__proto__);for(const e in t)"style"===e?b(i,t[e]):n[e]&&n[e].set||/textContent|innerHTML/.test(e)||"function"==typeof t[e]?i[e]=t[e]:i.setAttribute(e,t[e]);return o.forEach(e=>i.appendChild(e)),i};const v={1:()=>[1,0,0,1,0,0],2:e=>[-1,0,0,1,e,0],3:(e,t)=>[-1,0,0,-1,e,t],4:(e,t)=>[1,0,0,-1,0,t],5:()=>[0,1,1,0,0,0],6:(e,t)=>[0,1,-1,0,t,0],7:(e,t)=>[0,-1,-1,0,t,e],8:e=>[0,-1,1,0,0,e]};var S=e=>{e.width=1,e.height=1;const t=e.getContext("2d");t&&t.clearRect(0,0,1,1)},w=e=>"data"in e,k=e=>m()?RegExp(e).test(window.navigator.userAgent):void 0;let C=null;var T=()=>(null===C&&(C=k(/Android/)),C),M=(e,t)=>{const o=x("canvas",{width:e.width,height:e.height});return o.getContext("2d",t).drawImage(e,0,0),o},P=async(e,t=1)=>{const o=e instanceof ImageData&&e.colorSpace||"srgb",i=await $(),[n,r]=i||t<5?[e.width,e.height]:[e.height,e.width],a=x("canvas",{width:n,height:r}),s=a.getContext("2d",{willReadFrequently:!0,colorSpace:o});if(w(e)&&!i&&t>1){const t=x("canvas",{width:e.width,height:e.height});t.getContext("2d",{willReadFrequently:!0,colorSpace:o}).putImageData(e,0,0),e=t}if(!i&&t>1&&s.transform.apply(s,((e,t,o=-1)=>(-1===o&&(o=1),v[o](e,t)))(e.width,e.height,t)),w(e)){if(s.putImageData(e,0,0),T())return M(a)}else s.drawImage(e,0,0);return e instanceof HTMLCanvasElement&&S(e),a},R=async(e,t=1)=>1===t||await $()?e:f(await P(e,t)),I=e=>"object"==typeof e;const E=e=>e instanceof HTMLElement?e:I(e)?A(e):e,A=e=>{let t;return Array.isArray(e)?(t=[],e.forEach((e,o)=>{t[o]=E(e)})):(t={},null!==e&&Object.keys(e).forEach(o=>{const i=e[o];t[o]=E(i)})),t};var L=e=>"function"==typeof e,F=(e,t)=>{const{width:o,height:i,canvasMemoryLimit:n,contextOptions:r}=t||{};let a=o||e.naturalWidth,s=i||e.naturalHeight;a||s||(a=300,s=150);const l=a*s;if(n&&l>n){const e=Math.sqrt(n)/Math.sqrt(l);a=Math.floor(a*e),s=Math.floor(s*e)}const c=x("canvas");c.width=a,c.height=s;return c.getContext("2d",r).drawImage(e,0,0,a,s),c},z=async(e,t)=>{const o=x("img",{src:URL.createObjectURL(e)}),i=await((e,t)=>new Promise((o,i)=>{const n=()=>o(F(e,t));e.complete&&e.width?n():(e.onload=n,e.onerror=()=>i(new Error("Failed to load image")))}))(o,t);return URL.revokeObjectURL(o.src),i},D=()=>"createImageBitmap"in window,O=e=>/svg/.test(e.type),B=()=>Math.random().toString(36).substring(2,9);const W=new Map;var _=(e,t,o)=>new Promise((i,n)=>{const r=e.toString();let a=W.get(r);if(!a){const t=(e=>`function () {self.onmessage = function (message) {(${e.toString()}).apply(null, message.data.content.concat([function (err, response) {\n response = response || {};\n const transfer = 'data' in response ? [response.data.buffer] : 'width' in response ? [response] : [];\n return self.postMessage({ id: message.data.id, content: response, error: err }, transfer);\n}]))}}`)(e),o=URL.createObjectURL((e=>new Blob(["(","function"==typeof e?e.toString():e,")()"],{type:"application/javascript"}))(t)),i=new Map,n=new Worker(o);a={url:o,worker:n,messages:i,terminationTimeout:void 0,terminate:()=>{clearTimeout(a.terminationTimeout),a.worker.terminate(),URL.revokeObjectURL(o),W.delete(r)}},n.onmessage=function(e){const{id:t,content:o,error:n}=e.data;if(clearTimeout(a.terminationTimeout),a.terminationTimeout=setTimeout(()=>{i.size>0||a.terminate()},500),!i.has(t))return;const r=i.get(t);i.delete(t),null!=n?r.reject(n):r.resolve(o)},W.set(r,a)}const s=B();a.messages.set(s,{resolve:i,reject:n}),a.worker.postMessage({id:s,content:t},o)});let V=null;var N=()=>(null===V&&(V=k(/Firefox/)),V);const H=async(e,t)=>{const{canvasMemoryLimit:o,colorSpace:i}=t||{},n=await z(e,{colorSpace:i,canvasMemoryLimit:o,contextOptions:{willReadFrequently:!0,colorSpace:i}}),r=f(n,{colorSpace:i});return S(n),r};var j=async(e,t)=>{const{canvasMemoryLimit:o,colorSpace:i}=t||{},n=/p3/i.test(i)?"display-p3":"srgb";if(T()&&!N())return await H(e,{canvasMemoryLimit:o,colorSpace:n});let r;if(D()&&!O(e)&&"OffscreenCanvas"in window)try{r=await _((e,t,o,i)=>{createImageBitmap(e).then(e=>{let n=e.width,r=e.height;const a=n*r;if(t&&a>t){const e=Math.sqrt(t)/Math.sqrt(a);n=Math.floor(n*e),r=Math.floor(r*e)}const s=new OffscreenCanvas(n,r),l=s.getContext("2d",{colorSpace:o,willReadFrequently:!0});l.drawImage(e,0,0,n,r);const c=l.getImageData(0,0,s.width,s.height);i(null,c)}).catch(e=>{i(e)})},[e,o,n])}catch(e){}return r&&r.width?r:await H(e,{canvasMemoryLimit:o,colorSpace:n})},U=(e,t=void 0,o=void 0)=>new Promise((i,n)=>{try{e.toBlob(e=>{if(!e)return n(new Error("Failed to create blob"));i(e)},t,o)}catch(e){n(e)}}),G=async(e,t,o)=>{const i=await P(e),n=await U(i,t,o);return S(i),n};const Z={matroska:"mkv"};var X=e=>{const t=(e.match(/\/([a-z0-9]+)/)||[])[1];if(/^x/.test(t)){const[,t=""]=e.split("/x-");return Z[t]}return t},Y=e=>e.substring(0,e.lastIndexOf("."))||e;const q=/avif|bmp|gif|jpg|jpeg|jpe|jif|jfif|png|svg|tiff|webp/;var K=e=>{return e&&(t=(o=e,o.split(".").pop()).toLowerCase(),q.test(t)?"image/"+(/jfif|jif|jpe|jpg/.test(t)?"jpeg":"svg"===t?"svg+xml":t):"");var t,o},J=(e,t,o)=>{const i=(new Date).getTime(),n=e.type.length&&!/null|text/.test(e.type),r=n?e.type:o,a=((e,t)=>{const o=K(e);if(o===t)return e;const i=X(t)||o;return`${Y(e)}.${i}`})(t,r);try{return new(c("File"))([e],a,{lastModified:i,type:n?e.type:r})}catch(t){const o=n?e.slice():e.slice(0,e.size,r);return o.lastModified=i,o.name=a,o}},Q=(e,t)=>e/t,ee=e=>e;const te=Math.PI,oe=Math.PI/2,ie=oe/2;var ne=e=>{const t=Math.abs(e)%Math.PI;return t>ie&&t<Math.PI-ie};const re={Top:"t",Right:"r",Bottom:"b",Left:"l",TopLeft:"tl",TopRight:"tr",BottomRight:"br",BottomLeft:"bl"},{Top:ae,Right:se,Bottom:le,Left:ce,TopLeft:de,TopRight:ue,BottomRight:pe,BottomLeft:he}=re;var me={[ae]:[.5,0],[se]:[1,.5],[le]:[.5,1],[ce]:[0,.5],[de]:[0,0],[ue]:[1,0],[pe]:[1,1],[he]:[0,1]},ge=(e,t=12)=>parseFloat(e.toFixed(t));const $e=(e,t,o)=>o+(e-o)*t,fe=e=>({x:e.x+.5*e.width,y:e.y+.5*e.height,rx:.5*e.width,ry:.5*e.height}),ye=()=>be(0,0),be=(e,t)=>({x:e,y:t}),xe=e=>be(e.pageX,e.pageY),ve=e=>be(e.x,e.y),Se=e=>(e.x=-e.x,e.y=-e.y,e),we=(e,t,o=ye())=>{const i=Math.cos(t),n=Math.sin(t),r=e.x-o.x,a=e.y-o.y;return e.x=o.x+i*r-n*a,e.y=o.y+n*r+i*a,e},ke=e=>Math.sqrt(e.x*e.x+e.y*e.y),Ce=e=>{const t=Math.sqrt(e.x*e.x+e.y*e.y);return 0===t?ye():(e.x/=t,e.y/=t,e)},Te=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),Me=(e,t)=>e.x===t.x&&e.y===t.y,Pe=(e,t)=>(e.x=t(e.x),e.y=t(e.y),e),Re=(e,t)=>(e.x+=t.x,e.y+=t.y,e),Ie=(e,t)=>(e.x-=t.x,e.y-=t.y,e),Ee=(e,t)=>(e.x/=t,e.y/=t,e),Ae=(e,t)=>(e.x*=t,e.y*=t,e),Le=(e,t)=>e.x*t.x+e.y*t.y,Fe=(e,t)=>e.x*t.y-e.y*t.x,ze=(e,t=ye())=>{const o=e.x-t.x,i=e.y-t.y;return o*o+i*i},De=(e,t=ye())=>Math.sqrt(ze(e,t)),Oe=(e,t,o)=>(e.x=$e(e.x,t,o.x),e.y=$e(e.y,t,o.y),e),Be=e=>{let t=0,o=0;return e.forEach(e=>{t+=e.x,o+=e.y}),be(t/e.length,o/e.length)},We=(e,t,o,i,n)=>(e.forEach(e=>{e.x=t?i-(e.x-i):e.x,e.y=o?n-(e.y-n):e.y}),e),_e=(e,t,o,i)=>{const n=Math.sin(t),r=Math.cos(t);return e.forEach(e=>{e.x-=o,e.y-=i;const t=e.x*r-e.y*n,a=e.x*n+e.y*r;e.x=o+t,e.y=i+a}),e},Ve=(e,t)=>({width:e,height:t}),Ne=e=>Ve(e.width,e.height),He=e=>Ve(e.width,e.height),je=e=>Ve(e.width,e.height),Ue=e=>Ve(e[0],e[1]),Ge=e=>{return/img/i.test(e.nodeName)?(t=e).naturalWidth||t.naturalHeight?Ve(t.naturalWidth,t.naturalHeight):{width:300,height:150}:He(e);var t},Ze=(e,t)=>Ve(e,t),Xe=(e,t,o=ee)=>o(e.width)===o(t.width)&&o(e.height)===o(t.height),Ye=(e,t)=>(e.width*=t,e.height*=t,e),qe=e=>be(.5*e.width,.5*e.height),Ke=(e,t)=>{const o=Math.abs(t),i=Math.abs(Math.cos(o)),n=Math.abs(Math.sin(o)),r=i*e.width+n*e.height,a=n*e.width+i*e.height;return e.width=r,e.height=a,e},Je=(e,t)=>e.width>=t.width&&e.height>=t.height,Qe=(e,t)=>(e.width=t(e.width),e.height=t(e.height),e),et=(e,t)=>({start:e,end:t}),tt=e=>et(ve(e.start),ve(e.end)),ot=(e,t)=>{if(0===t)return e;const o=be(e.start.x-e.end.x,e.start.y-e.end.y),i=Ce(o),n=Ae(i,t);return e.start.x+=n.x,e.start.y+=n.y,e.end.x-=n.x,e.end.y-=n.y,e},it=[be(-1,-1),be(-1,1),be(1,1),be(1,-1)],nt=(e,t,o,i)=>({x:e,y:t,width:o,height:i}),rt=e=>nt(e.x,e.y,e.width,e.height),at=()=>nt(0,0,0,0),st=e=>nt(0,0,e.width,e.height),lt=e=>nt(e[3],e[0],e[1]-e[3],e[2]-e[0]),ct=e=>nt(e.x||0,e.y||0,e.width||0,e.height||0),dt=e=>{let t=e[0].x,o=e[0].x,i=e[0].y,n=e[0].y;return e.forEach(e=>{t=Math.min(t,e.x),o=Math.max(o,e.x),i=Math.min(i,e.y),n=Math.max(n,e.y)}),nt(t,i,o-t,n-i)},ut=e=>ht(e.x-e.rx,e.y-e.ry,2*e.rx,2*e.ry),pt=(e,t)=>nt(e.x-.5*t.width,e.y-.5*t.height,t.width,t.height),ht=(e,t,o,i)=>nt(e,t,o,i),mt=e=>be(e.x+.5*e.width,e.y+.5*e.height),gt=(e,t)=>(e.x+=t.x,e.y+=t.y,e),$t=(e,t,o)=>(o=o||mt(e),e.x=t*(e.x-o.x)+o.x,e.y=t*(e.y-o.y)+o.y,e.width=t*e.width,e.height=t*e.height,e),ft=(e,t,o,i)=>{const n=(i.x-e.x)/e.width,r=(i.y-e.y)/e.height;let a=Math.max(t.width,e.width),s=Math.max(t.height,e.height);return a=Math.min(o.width,a),s=Math.min(o.height,s),e.x=i.x-n*a,e.y=i.y-r*s,e.width=a,e.height=s,e},yt=(e,t)=>{const[o,i]=me[t],n=o*e.width,r=i*e.height;return be(e.x+n,e.y+r)},bt=(e,t)=>(e.x*=t,e.y*=t,e.width*=t,e.height*=t,e),xt=(e,t,o=ee)=>o(e.x)===o(t.x)&&o(e.y)===o(t.y)&&o(e.width)===o(t.width)&&o(e.height)===o(t.height),vt=e=>Q(e.width,e.height),St=(e,t,o,i,n)=>(e.x=t,e.y=o,e.width=i,e.height=n,e),wt=(e,t)=>(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e),kt=(e,t,o)=>(o||(o=mt(e)),It(e).map(e=>we(e,t,o))),Ct=(e,t)=>nt(.5*e.width-.5*t.width,.5*e.height-.5*t.height,t.width,t.height),Tt=(e,t)=>!(t.x<e.x)&&(!(t.y<e.y)&&(!(t.x>e.x+e.width)&&!(t.y>e.y+e.height))),Mt=(e,t,o=ye())=>{if(0===e.width||0===e.height)return at();const i=vt(e);t||(t=i);let n=e.width,r=e.height;return t>i?n=r*t:r=n/t,nt(o.x+.5*(e.width-n),o.y+.5*(e.height-r),n,r)},Pt=(e,t=vt(e),o=ye())=>{if(0===e.width||0===e.height)return at();let i=e.width,n=i/t;return n>e.height&&(n=e.height,i=n*t),nt(o.x+.5*(e.width-i),o.y+.5*(e.height-n),i,n)},Rt=e=>[Math.min(e.y,e.y+e.height),Math.max(e.x,e.x+e.width),Math.max(e.y,e.y+e.height),Math.min(e.x,e.x+e.width)],It=e=>[be(e.x,e.y),be(e.x+e.width,e.y),be(e.x+e.width,e.y+e.height),be(e.x,e.y+e.height)],Et=(e,t)=>{if(e)return e.x=t(e.x),e.y=t(e.y),e.width=t(e.width),e.height=t(e.height),e},At=(e,t,o=mt(e))=>It(e).map((e,i)=>{const n=it[i];return be($e(e.x,1+n.x*t.x,o.x),$e(e.y,1+n.y*t.y,o.y))}),Lt=e=>(e.x=0,e.y=0,e),Ft=e=>{const t=e[0],o=e[e.length-1];e=Me(t,o)?e:[...e,t];const i=t.x,n=t.y;let r,a,s,l=0,c=0,d=0,u=0;const p=e.length;for(;c<p;c++)r=e[c],a=e[c+1>p-1?0:c+1],s=(r.y-n)*(a.x-i)-(a.y-n)*(r.x-i),l+=s,d+=(r.x+a.x-2*i)*s,u+=(r.y+a.y-2*n)*s;return s=3*l,be(i+d/s,n+u/s)},zt=(e,t)=>Dt(e.start,e.end,t.start,t.end),Dt=(e,t,o,i)=>{const n=(i.y-o.y)*(t.x-e.x)-(i.x-o.x)*(t.y-e.y);if(0===n)return;const r=((i.x-o.x)*(e.y-o.y)-(i.y-o.y)*(e.x-o.x))/n,a=((t.x-e.x)*(e.y-o.y)-(t.y-e.y)*(e.x-o.x))/n;return r<0||r>1||a<0||a>1?void 0:be(e.x+r*(t.x-e.x),e.y+r*(t.y-e.y))},Ot=(e,t,{ignoreIdenticalLines:o=!1,breakOnIntersection:i=!1}={})=>{const n=t.length,r=[];for(let a=0;a<n-1;a++){if(o&&(Me(e.start,t[a])||Me(e.start,t[a+1])||Me(e.end,t[a])||Me(e.end,t[a+1])))continue;const n=Dt(e.start,e.end,t[a],t[a+1]);if(n){if(i)return[n];r.push(n)}}return r.length?r:void 0},Bt=(e,t)=>{let o=0,i=0,n=!1;const r=t.length;for(o=0,i=r-1;o<r;i=o++)t[o].y>e.y!=t[i].y>e.y&&e.x<(t[i].x-t[o].x)*(e.y-t[o].y)/(t[i].y-t[o].y)+t[o].x&&(n=!n);return n},Wt=(e,t,o,i)=>({x:(1-i)*(1-i)*e.x+2*(1-i)*i*t.x+i*i*o.x,y:(1-i)*(1-i)*e.y+2*(1-i)*i*t.y+i*i*o.y}),_t=(e,t,o,i,n)=>{const r=((e,t,o,i)=>{let n=(t.x-e.x)*i,r=(t.y-e.y)*i;return De(o,t)<De(t,e)&&(n*=.15,r*=.15),{x:t.x+n,y:t.y+r}})(e,t,o,n),a=[];for(let e=0;e<=i;e++){const n=e/i;a.push(Wt(t,r,o,n))}return a},Vt=e=>{const t=[];for(let o=0;o<e.length;o++){let i=o+1;i===e.length&&(i=0),t.push(et(ve(e[o]),ve(e[i])))}return t},Nt=(e,t=0)=>Vt(e).map(e=>ot(e,t)),Ht=(e,t,o,i=0,n=!1,r=!1,a=12)=>{const s=[];for(let i=0;i<a;i++)s.push(be(e.x+t*Math.cos(i*(2*Math.PI)/a),e.y+o*Math.sin(i*(2*Math.PI)/a)));return(n||r)&&We(s,n,r,e.x,e.y),i&&_e(s,i,e.x,e.y),s},jt=(e,t,o,i)=>{const n=be(e.x-o.x,e.y-o.y),r=be(i.x-o.x,i.y-o.y),a=Le(r,r);let s=Le(n,r)/a;s=s<0?0:s,s=s>1?1:s;const l=be(r.x*s+o.x-e.x,r.y*s+o.y-e.y);return Le(l,l)<=t*t},Ut=(e,t,o)=>{const i=o.length;for(let n=0;n<i-1;n++)if(jt(e,t,o[n],o[n+1]))return!0;return!1},Gt=(e,t,o)=>!!Bt(e,o)||(!!Ut(e,t,o)||jt(e,t,o[0],o[o.length-1])),Zt=(e,t,o,i,n)=>Gt(e,t,kt(o,i,n||mt(o)));var Xt=(e,t)=>{const o=st(e),i=mt(o),n=kt(o,t,i);return Lt(dt(n))},Yt=(e,t)=>e instanceof HTMLElement&&(!t||new RegExp(`^${t}$`,"i").test(e.nodeName)),qt=e=>e instanceof File,Kt=async(e,t,o)=>{const i=await U(e,t,o);return J(i,"canvas")},Jt=e=>e.split("/").pop().split(/\?|\#/).shift();const Qt=m()&&!!Node.prototype.replaceChildren?(e,t)=>e.replaceChildren(t):(e,t)=>{for(;e.lastChild;)e.removeChild(e.lastChild);void 0!==t&&e.append(t)},eo=m()&&x("div",{class:"PinturaMeasure",style:"position:absolute;left:0;top:0;width:99999px;height:0;pointer-events:none;contain:strict;margin:0;padding:0;"});let to;var oo=e=>(Qt(eo,e),eo.parentNode||document.body.append(eo),clearTimeout(to),to=setTimeout(()=>{eo.remove()},500),e);let io=null;var no=()=>(null===io&&(io=m()&&/^((?!chrome|android).)*(safari|iphone|ipad)/i.test(navigator.userAgent)),io),ro=e=>new Promise((t,o)=>{let i=!1;!e.parentNode&&no()&&(i=!0,e.style.cssText="position:absolute;visibility:hidden;pointer-events:none;left:0;top:0;width:0;height:0;",oo(e));let n=!1;const r=()=>{let o=e.naturalWidth,r=e.naturalHeight;if(!(o&&r)){if(!n)return;o=300,r=150}delete e.onload,i&&e.remove(),clearInterval(a),t({width:o,height:r})};e.onerror=e=>{clearInterval(a),o(e)},e.onload=()=>{n=!0,clearInterval(a),r()};const a=setInterval(r,1);r()}),ao=e=>new Promise((t,o)=>{const i=()=>{t({width:e.videoWidth,height:e.videoHeight})};if(e.readyState>=1)return i();e.onloadedmetadata=i,e.onerror=()=>o(e.error)}),so=e=>/^image/.test(e.type),lo=e=>new Promise(t=>{const o=y(e)?e:URL.createObjectURL(e),i=()=>{const e=new Image;e.src=o,t(e)};if(e instanceof Blob&&so(e))return i();const n=document.createElement("video");n.preload="metadata",n.onloadedmetadata=()=>t(n),n.onerror=i,n.src=o}),co=e=>"VIDEO"===e.nodeName,uo=async e=>{let t,o;t=e.src?e:await lo(e);try{o=co(t)?await ao(t):await ro(t)}finally{qt(e)&&URL.revokeObjectURL(t.src)}return o};var po=async e=>{const t=await uo(e),o=await(e=>new Promise((t,o)=>{if(e.complete)return t(e);e.onload=()=>t(e),e.onerror=()=>o(new Error("Failed to load image"))}))(e),i=x("canvas",t);i.getContext("2d",{willReadFrequently:!0}).drawImage(o,0,0);const n=await U(i);return J(n,Jt(o.src))},ho=(e=0,t=!0)=>new(c("ProgressEvent"))("progress",{loaded:100*e,total:100,lengthComputable:t}),mo=(e,t,o=e=>e)=>e.getAllResponseHeaders().indexOf(t)>=0?o(e.getResponseHeader(t)):void 0,go=e=>{if(!e)return null;const t=e.split(/filename=|filename\*=.+''/).splice(1).map(e=>e.trim().replace(/^["']|[;"']{0,2}$/g,"")).filter(e=>e.length);return t.length?decodeURI(t[t.length-1]):null};const $o="URL_REQUEST";class fo extends Error{constructor(e,t,o){super(e),this.name="EditorError",this.code=t,this.metadata=o}}var yo=(e,t)=>{const{headers:o={},credentials:i}=t||{};Object.entries(o).forEach(([t,o])=>e.setRequestHeader(t,o)),i&&(e.withCredentials="omit"!==i)},bo=(e,t,i)=>/^data:/.test(e)?(async(e,t="data-uri",i=o)=>{i(ho(0));const n=await fetch(e);i(ho(.33));const r=await n.blob();let a;so(r)||(a="image/"+(e.includes(",/9j/")?"jpeg":"png")),i(ho(.66));const s=J(r,t,a);return i(ho(1)),s})(e,void 0,t):((e,t,o)=>new Promise((i,n)=>{const r=()=>n(new fo("Error fetching image",$o,a)),a=new XMLHttpRequest;a.onprogress=t,a.onerror=r,a.onload=()=>{if(!a.response||a.status>=300||a.status<200)return r();const t=mo(a,"Content-Type"),o=mo(a,"Content-Disposition",go)||Jt(e);i(J(a.response,o,t||K(o)))};const{willRequest:s}=o;Promise.resolve(s&&s(e,{resourceType:"image"})).then(t=>{if(!1===t)return n("Image load rejected");a.open("GET",e,!0),yo(a,t),a.responseType="blob",a.send()}).catch(console.error)}))(e,t,i),xo=e=>e instanceof Blob&&!(e instanceof File),vo=e=>"close"in e,So=async(e,t,o)=>{if(qt(e)||xo(e))return e;if(y(e))return await bo(e,t,o);if(Yt(e,"canvas"))return await Kt(e);if(Yt(e,"img"))return await po(e);if(w(e)||vo(e))return await Kt(await P(e));throw new fo("Invalid image source","invalid-image-source")};let wo=null;var ko=()=>(null===wo&&(wo=m()&&/^mac/i.test(navigator.platform)),wo);let Co=null;var To=()=>(null===Co&&(Co=m()&&(k(/iPhone|iPad|iPod/)||ko()&&navigator.maxTouchPoints>=1)),Co),Mo=async(e,t=1)=>await $()||To()||t<5?e:Ze(e.height,e.width),Po=e=>/jpeg/.test(e.type),Ro=e=>{return"object"!=typeof(t=e)||t.constructor!=Object?e:JSON.stringify(e);var t},Io=(e,t=0,o)=>(0===t||(e.translate(o.x,o.y),e.rotate(t),e.translate(-o.x,-o.y)),e),Eo=(e,t,o)=>(e.scale(t,o),e),Ao=async(e,t={})=>{const{flipX:o,flipY:i,rotation:n,crop:r}=t,a=He(e),s=o||i,l=!!n,c=r&&(r.x||r.y||r.width||r.height),d=c&&xt(r,st(a)),u=c&&!d;if(!s&&!l&&!u)return e;const p={willReadFrequently:!0,colorSpace:e.colorSpace};let h,m=x("canvas",{width:e.width,height:e.height});if(m.getContext("2d",p).putImageData(e,0,0),s){const e=x("canvas",{width:m.width,height:m.height}).getContext("2d",p);Eo(e,o?-1:1,i?-1:1),e.drawImage(m,o?-m.width:0,i?-m.height:0),e.restore(),S(m),m=e.canvas}if(l){const e=Qe(je(dt(kt(ct(m),n))),Math.floor),t=x("canvas",{width:r.width,height:r.height}).getContext("2d",p);((e,t,o)=>{e.translate(t,o)})(t,-r.x,-r.y),Io(t,n,qe(e)),t.drawImage(m,.5*(e.width-m.width),.5*(e.height-m.height)),t.restore(),S(m),m=t.canvas}else if(u){return h=m.getContext("2d",p).getImageData(r.x,r.y,r.width,r.height),S(m),h}return h=m.getContext("2d",p).getImageData(0,0,m.width,m.height),S(m),h},Lo=(e,t)=>{const{imageData:o,width:i,height:n}=e,r=o.width,a=o.height,s=o.colorSpace,l=Math.round(i),c=Math.round(n),d=o.data,u=new Uint8ClampedArray(l*c*4),p=r/l,h=a/c,m=Math.ceil(.5*p),g=Math.ceil(.5*h);for(let e=0;e<c;e++)for(let t=0;t<l;t++){const o=4*(t+e*l);let i=0,n=0,a=0,s=0,c=0,$=0,f=0;const y=(e+.5)*h;for(let o=Math.floor(e*h);o<(e+1)*h;o++){const e=Math.abs(y-(o+.5))/g,l=(t+.5)*p,u=e*e;for(let e=Math.floor(t*p);e<(t+1)*p;e++){let t=Math.abs(l-(e+.5))/m;const p=Math.sqrt(u+t*t);if(p<-1||p>1)continue;if(i=2*p*p*p-3*p*p+1,i<=0)continue;t=4*(e+o*r);const h=d[t+3];f+=i*h,a+=i,h<255&&(i=i*h/250),s+=i*d[t],c+=i*d[t+1],$+=i*d[t+2],n+=i}}u[o]=s/n,u[o+1]=c/n,u[o+2]=$/n,u[o+3]=f/a}t(null,{data:u,width:l,height:c,colorSpace:s})},Fo=e=>{if(e instanceof ImageData)return e;let t;try{t=new ImageData(e.width,e.height,{colorSpace:e.colorSpace||"srgb"})}catch(o){t=x("canvas").getContext("2d").createImageData(e.width,e.height)}return t.data.set(e.data),t},zo=async(e,t={},o)=>{const{width:i,height:n,fit:r,upscale:a}=t;if(!i&&!n)return e;let s=i,l=n;if(i?n||(l=i):s=n,"force"!==r){const t=s/e.width,o=l/e.height;let c=1;if("cover"===r?c=Math.max(t,o):"contain"===r&&(c=Math.min(t,o)),c>1&&!1===a)return e;s=Math.round(e.width*c),l=Math.round(e.height*c),i&&n&&(Math.abs(s-i)<=1&&(s=i),Math.abs(l-n)<=1&&(l=n))}return s=Math.max(s,1),l=Math.max(l,1),e.width===s&&e.height===l?e:o?o(e,s,l):(e=await _(Lo,[{imageData:e,width:s,height:l}],[e.data.buffer]),Fo(e))},Do=(e,t)=>{const{imageData:o,matrix:i}=e;if(!i||20!==i.length)return t(null,o);const n=o.colorSpace,r=o.data,a=r.length,s=i[0],l=i[1],c=i[2],d=i[3],u=i[4],p=i[5],h=i[6],m=i[7],g=i[8],$=i[9],f=i[10],y=i[11],b=i[12],x=i[13],v=i[14],S=i[15],w=i[16],k=i[17],C=i[18],T=i[19];let M=0,P=0,R=0,I=0,E=0,A=0,L=0,F=0,z=0;const D=e=>Math.max(0,Math.min(255,255*e));for(;M<a;M+=4)P=r[M]/255,R=r[M+1]/255,I=r[M+2]/255,E=r[M+3]/255,E>0&&(P/=E,R/=E,I/=E),A=P*s+R*l+I*c+E*d+u,L=P*p+R*h+I*m+E*g+$,F=P*f+R*y+I*b+E*x+v,z=P*S+R*w+I*k+E*C+T,E>0?(P=A*E,R=L*E,I=F*E):(P=0,R=0,I=0),r[M]=D(A*z),r[M+1]=D(L*z),r[M+2]=D(F*z),r[M+3]=D(E);t(null,{data:r,width:o.width,height:o.height,colorSpace:n})},Oo=(e,t)=>{const{imageData:o,matrix:i}=e;if(!i)return t(null,o);let n=i.reduce((e,t)=>e+t);n=n<=0?1:n;const r=o.width,a=o.height,s=o.data,l=o.colorSpace;let c=0,d=0,u=0;const p=Math.round(Math.sqrt(i.length)),h=Math.floor(p/2);let m=0,g=0,$=0,f=0,y=0,b=0,x=0,v=0,S=0,w=0;const k=new Uint8ClampedArray(r*a*4);for(u=0;u<a;u++)for(d=0;d<r;d++){for(m=0,g=0,$=0,f=0,b=0;b<p;b++)for(y=0;y<p;y++)x=u+b-h,v=d+y-h,x<0&&(x=a-1),x>=a&&(x=0),v<0&&(v=r-1),v>=r&&(v=0),S=4*(x*r+v),w=i[b*p+y],m+=s[S]*w,g+=s[S+1]*w,$+=s[S+2]*w,f+=s[S+3]*w;k[c]=m/n,k[c+1]=g/n,k[c+2]=$/n,k[c+3]=f/n,c+=4}t(null,{data:k,width:r,height:a,colorSpace:l})},Bo=(e,t)=>{let{imageData:o,strength:i}=e;if(!i)return t(null,o);const n=o.colorSpace,r=o.width,a=o.height,s=o.data,l=(e,t)=>(c=e-S,d=t-w,Math.sqrt(c*c+d*d));let c,d,u,p,h,m,g,$,f,y,b,x=0,v=0,S=.5*r,w=.5*a,k=l(0,0);const C=(e,t,o,i)=>{m=t[e]/255,g=t[e+1]/255,$=t[e+2]/255,f=t[e+3]/255,y=1-i,b=y*f+i,o[e]=(y*f*m+i*u)/b*255,o[e+1]=(y*f*g+i*p)/b*255,o[e+2]=(y*f*$+i*h)/b*255,o[e+3]=255*b};for(i>0?(u=0,p=0,h=0):(i=Math.abs(i),u=1,p=1,h=1),v=0;v<a;v++)for(x=0;x<r;x++)C(4*(x+v*r),s,s,l(x,v)*i/k);t(null,{data:s,width:o.width,height:o.height,colorSpace:n})},Wo=(e,t)=>{const{imageData:o,level:i,monochrome:n=!1}=e;if(!i)return t(null,o);const r=o.colorSpace,a=o.data,s=a.length;let l,c,d,u=0;const p=()=>255*(2*Math.random()-1)*i,h=n?()=>{const e=p();return[e,e,e]}:()=>[p(),p(),p()];for(;u<s;u+=4)[l,c,d]=h(),a[u]=a[u]+l,a[u+1]=a[u+1]+c,a[u+2]=a[u+2]+d;t(null,{data:a,width:o.width,height:o.height,colorSpace:r})},_o=(e,t)=>{const{imageData:o,level:i}=e;if(!i)return t(null,o);const n=o.colorSpace,r=o.data,a=r.length;let s,l,c,d=0;for(;d<a;d+=4)s=r[d]/255,l=r[d+1]/255,c=r[d+2]/255,r[d]=255*Math.pow(s,i),r[d+1]=255*Math.pow(l,i),r[d+2]=255*Math.pow(c,i);t(null,{data:r,width:o.width,height:o.height,colorSpace:n})},Vo=async(e,t={})=>{const{colorMatrix:o,convolutionMatrix:i,gamma:n,noise:r,vignette:a}=t,s=[];if(i&&s.push([Oo,{matrix:i.clarity}]),n>0&&s.push([_o,{level:1/n}]),o&&!(e=>{const t=e.length;let o;const i=t>=20?6:t>=16?5:3;for(let n=0;n<t;n++){if(o=e[n],1===o&&n%i!==0)return!1;if(0!==o&&1!==o)return!1}return!0})(o)&&s.push([Do,{matrix:o}]),(r>0||r<0)&&s.push([Wo,{level:r}]),(a>0||a<0)&&s.push([Bo,{strength:a}]),!s.length)return e;const l=(e,t)=>`(err, imageData) => {\n (${e[t][0].toString()})(Object.assign({ imageData: imageData }, filterInstructions[${t}]), \n ${e[t+1]?l(e,t+1):"done"})\n }`,c=`function (options, done) {\n const filterInstructions = options.filterInstructions;\n const imageData = options.imageData;\n (${l(s,0)})(null, imageData)\n }`;return e=await _(c,[{imageData:e,filterInstructions:s.map(e=>e[1])}],[e.data.buffer]),Fo(e)},No=e=>"number"==typeof e,Ho=e=>y(e)&&null!==e.match(/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g),jo=(e,t)=>e.hasOwnProperty(t),Uo=e=>Array.isArray(e);let Go=64,Zo=102,Xo=112,Yo=!1;var qo=(e,t)=>(!Yo&&m()&&(/^win/i.test(navigator.platform)&&(Zo=103),(To()||ko())&&(Go=63.5,Zo=110,Xo=123),Yo=!0),`<svg${t?` aria-label="${t}"`:""} width="128" height="128" viewBox="0 0 128 128" preserveAspectRatio="xMinYMin meet" xmlns="http://www.w3.org/2000/svg"><text x="${Go}" y="${Zo}" alignment-baseline="text-top" dominant-baseline="text-top" text-anchor="middle" font-size="${Xo}px">${e}</text></svg>`),Ko=e=>e instanceof Blob,Jo=(e,t)=>e/t*100+"%",Qo=e=>`rgba(${Math.round(255*e[0])}, ${Math.round(255*e[1])}, ${Math.round(255*e[2])}, ${No(e[3])?e[3]:1})`,ei=e=>Object.values(e).join("_");const ti=async(e,t=0)=>{const o=x("canvas",{width:80,height:80}).getContext("2d");return await((e=0)=>new Promise(t=>{setTimeout(t,e)}))(t),o.drawImage(e,0,0,80,80),!((e=>!new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data.buffer).some(e=>0!==e))(o)&&t<=256)||await ti(e,t+16)},oi=new Map;var ii=e=>new Promise((t,o)=>{const i=new FileReader;i.onerror=()=>o(i.error),i.onload=()=>t(i.result),i.readAsDataURL(e)}),ni=()=>{let e=[];return{sub:(t,o)=>(e.push({event:t,callback:o}),()=>e=e.filter(e=>e.event!==t||e.callback!==o)),pub:(t,o)=>{e.filter(e=>e.event===t).forEach(e=>e.callback(o))}}};const ri=32,ai=({color:e=[0,0,0],fontSize:t=16,fontFamily:o="sans-serif",fontVariant:i="normal",fontWeight:n="normal",fontStyle:r="normal",textAlign:a="left",letterSpacing:s="normal",lineHeight:l=20},c=1)=>`font-size:${t*c}px;font-style:${r};font-weight:${n};font-family:${o};font-variant:${i};line-height:${l*c}px;text-align:${a};letter-spacing:${No(s)?s+"px":"normal"};color:${Qo(e)};`,si=(e,t,o=1)=>{const{width:i,height:n,disableNewline:r}=t,a=!i,s=!1===r?((e="")=>e.split("\n").length)(e):void 0,l=a?"auto":i*o+"px",c=n?n*o+"px":"auto",d=a?"normal":"break-word",u=a&&!s?"nowrap":"pre-line",p=(({fontSize:e=16,lineHeight:t=20}={})=>.5*Math.max(0,e-t))(t)*o;return`max-width:none;min-width:auto;width:${l};height:${c};margin-top:0;margin-bottom:0;padding-top:${p}px;word-break:${d};word-wrap:normal;white-space:${u};`},li=new Map,ci=e=>{const t=[];for(const o of Array.from(e.childNodes))o.nodeType===Node.TEXT_NODE?t.push(ui(o)):t.push(...ci(o));return t},di="pointer-events:none;visibility:hidden;position:absolute;left:0;top:0;",ui=e=>{const t=e.nodeValue;if(!t)return[];const o=t.length,i=document.createRange();i.selectNodeContents(e);const n=[];for(let r=0;r<o;r++){i.setStart(e,0),i.setEnd(e,r+1);const o=i.getClientRects().length-1,a=t.charAt(r);n[o]?n[o]+=a:n.push(a)}const r=i.getClientRects();return n.map((e,t)=>({rect:r[t],text:e}))},pi=new Map,hi=(e="",t)=>{const{width:o,height:i}=t;if(No(o)&&No(i))return Ze(o,i);let{fontSize:n=16,fontFamily:r,lineHeight:a=20,fontWeight:s,fontStyle:l,fontVariant:c,letterSpacing:d}=t;const u=ei({text:e,fontFamily:r,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:n,letterSpacing:d,lineHeight:a,width:o});let p=pi.get(u);if(p)return p;let h=1;n>1e3&&N()&&(h=n/1e3,n=1e3,a/=h);const m=oo(x("pre",{contenteditable:"true",spellcheck:"false",style:`${di}${ai({...t,fontSize:n,lineHeight:a})};${si(e,t)}"`,innerHTML:e})).getBoundingClientRect();return p=He(m),p=Qe(p,e=>e*h),o&&(p.width=o),pi.set(u,p),p},mi=e=>e.pathname.split("/").slice(0,-1).join("/"),gi=new Map,$i=(e,t)=>new Promise((o,i)=>{let n=gi.get(e);void 0===n&&(n=((e,t)=>{const{sub:o,pub:i}=ni();let n,r;return Promise.resolve(t&&t(e,{resourceType:"stylesheet"})).then(t=>{if(!1===t)return r="requestPrevented",i("error",r);const{headers:o,credentials:a}=t||{};fetch(e,{headers:o,credentials:a}).then(e=>e.text()).then(e=>{n=e,i("load",n)}).catch(e=>{r=e,i("error",r)})}),{sub:(e,t)=>"load"===e&&n?t(n):"error"===e&&r?t(r):void o(e,t)}})(e,t),gi.set(e,n)),n.sub("load",o),n.sub("error",i)}),fi=async(e,t,o)=>{let i;try{i=await $i(e,t)}catch(e){return[]}const n={innerHTML:i,id:B()};o&&(n.nonce=o);const r=x("style",n);document.head.append(r);const a=Array.from(document.styleSheets).find(e=>e.ownerNode.id===r.id);return r.remove(),Array.from(a.cssRules)},yi=new Map,bi=(e,t)=>!t||!e.href||e.href.startsWith("/")||e.href.startsWith("http")?e.href:t+"/"+e.href.replace(/^\.\//,""),xi=async(e,t,o)=>{if(yi.has(e.href))return yi.get(e.href);let i;try{i=Array.from(e.cssRules);const n=(e=>{if(!e.href)return null;try{return mi(new URL(e.href))}catch(e){return null}})(e);for(const e of(e=>e.filter(e=>e instanceof CSSImportRule))(i)){const r=bi(e,n);if(yi.has(r)){const e=yi.get(r);i=[...i,...e];continue}const a=await fi(r,t,o);yi.set(r,a),i=[...i,...a]}}catch(n){const r=e.href;i=await fi(r,t,o),yi.set(r,i)}return(e=>e.filter(e=>e instanceof CSSFontFaceRule))(i)},vi=(e,t)=>e.style.getPropertyValue(t),Si=(e,t)=>vi(e,"font-family").replace(/^"|"$/g,"")==t,wi=e=>e.style&&vi(e,"src")&&vi(e,"font-family"),ki=async(e,t,o)=>{const i=await(async(e,t)=>{const o=Array.from(document.styleSheets).map(o=>xi(o,e,t)),i=await Promise.all(o),n=[];return i.forEach(e=>n.push(...e)),n})(t,o),n=((e,t)=>{const o=[];for(const i of e)wi(i)&&Si(i,t)&&o.push(i);return o})(i,e);return n.length?n.map(e=>{const t=e.parentStyleSheet&&e.parentStyleSheet.href&&new URL(e.parentStyleSheet.href),o=t?t.origin+mi(t)+"/":"",i=e.style.getPropertyValue("src").match(/url\("?(.*?)"?\)/)[1],n=Array.from(e.style).filter(e=>"src"!=e).reduce((t,o)=>t+=o+":"+vi(e,o)+";","");return[/^http/.test(i)?i:o+i,n]}):[]},Ci=new Map,Ti=new Map,Mi=e=>!e||/woff2/.test(e)?"woff2":/woff/.test(e)?"woff":/ttf|truetype/.test(e)?"truetype":/otf|opentype/.test(e)?"opentype":/svg/.test(e)?"svg":"woff2";var Pi=async(e="",t)=>{if(!e.length)return;let{color:o,imageWidth:i=300,imageHeight:n=150,paddingTop:r=0,paddingRight:a=ri,paddingBottom:s=0,paddingLeft:l=ri,fontFamily:c,fontSize:d,pixelRatio:u=1,willRequest:p,outline:h,blur:m,styleNonce:g}=t,$=1,f="";d>1e3&&N()&&($=d/1e3,f=`transform-origin:0 0;transform:scale(${$})`);const y=u/$,b=(i+l+a)*u,x=(n+s+r)*u,v=await(async(e,t,o)=>{if(Ci.get(e))return;let i=Ti.get(e);if(!i){const n=await ki(e,t,o);if(!n.length)return void Ci.set(e,!0);const r=[];for(const[e,t]of n){const o=await fetch(e).then(e=>e.blob()),i=Mi(o.type),n=await ii(o);r.push(`@font-face { src:url(${n}) format('${i}');${t};font-display:block; }`)}i=r.join(""),Ti.set(e,i)}return i})(c,p,g);let S="";v&&(S=`<style${g?` nonce="${g}"`:""}>${v}</style>`);const w=e.replace(/%/g,"%25").replace(/#/g,"%23").replace(/&nbsp;/g," ").replace(/&(?!#\d{4};|[a-z]+;)/gi,"&amp;").replace(/<br>|\n/g,"<br/>"),k=`top:${r*y}px;right:${a*y}px;bottom:${s*y}px;left:${l*y}px`;let C=o,T="",M="";if(h||m){const e=Qo(o);h&&(C=[0,0,0,0],T=`-webkit-text-stroke: ${2*h*y}px ${e}`),m&&(no()?M=`filter:blur(${m*y*.4}px)`:(C=[0,0,0,0],M=`text-shadow: 0 0 ${m*y}px ${e}`))}return((e,{safariCacheKey:t="*"}={})=>new Promise((o,i)=>{const n=new Image;n.onerror=()=>i(new Error("Failed to load SVG")),n.onload=()=>{if(!no()||!e.includes("@font-face")||oi.has(t))return o(n);ti(n).then(()=>{oi.set(t,!0),o(n)})},n.src="data:image/svg+xml,"+e}))(`<svg xmlns="http://www.w3.org/2000/svg" width="${b}" height="${x}" viewBox="0 0 ${b} ${x}"><foreignObject x="0" y="0" width="${b}" height="${x}"><div xmlns="http://www.w3.org/1999/xhtml">${S}<pre contenteditable="true" spellcheck="false" style="position:absolute;${k};${ai({...t,color:C,fontSize:d},y)};${si(e,t,y)};${f};${T};${M}">${w}</pre></div></foreignObject></svg>`,{safariCacheKey:c})};const Ri=e=>{const t={...e};return A(t)},Ii=(e,t={})=>{const o=vt(e);let i,n;const r=t.width||t.rx,a=t.height||t.ry;if(r&&a)return Ne(t);if(r||a){i=parseFloat(r||Number.MAX_SAFE_INTEGER),n=parseFloat(a||Number.MAX_SAFE_INTEGER);const e=Math.min(i,n);y(r)||y(a)?(i=`${e}%`,n=e*o+"%"):(i=e,n=e)}else{const e=10;i=`${e}%`,n=e*o+"%"}const s=t.width?"width":t.rx?"rx":void 0,l=t.width?"height":t.rx?"ry":void 0;return{[s||"width"]:i,[l||"height"]:n}},Ei=(e,t={})=>{return{width:void 0,height:void 0,...t,aspectRatio:1,backgroundImage:(o=qo(e),`data:image/svg+xml,${o.replace("<","%3C").replace(">","%3E")}`)};var o},Ai=(e,t={})=>({backgroundColor:[0,0,0,0],..._i(t)?{}:{width:void 0,height:void 0,aspectRatio:void 0},...t,backgroundImage:y(e)?e:Ko(e)?URL.createObjectURL(e):e}),Li=(e,t)=>{let o;if(y(e)||Ko(e)){const i={...Ii(t),backgroundSize:"contain"};o=Ho(e)?Ei(e,i):Ai(e,i)}else if(e.src){const i=Ii(t,e.shape||e),n={...e.shape,...i};if(e.width&&e.height&&!jo(n,"aspectRatio")){const e=Fn(i,"width",t),o=Fn(i,"height",t);n.aspectRatio=Q(e,o)}n.backgroundSize||e.shape||e.width&&e.height||(n.backgroundSize="contain"),o=Ho(e.src)?Ei(e.src,n):Ai(e.src,n)}else e.shape&&(o=Ri(e.shape));return jo(o,"backgroundImage")&&(jo(o,"backgroundColor")||(o.backgroundColor=[0,0,0,0]),jo(o,"disableStyle")||(o.disableStyle=["cornerRadius","backgroundColor","strokeColor","strokeWidth"])),t?An(o,t):o},Fi=e=>be(e.x1,e.y1),zi=e=>be(e.x2,e.y2),Di=e=>jo(e,"text"),Oi=e=>Di(e)&&!(qi(e)||jo(e,"width")),Bi=e=>Di(e)&&(qi(e)||jo(e,"width")),Wi=e=>!Di(e)&&Ki(e),_i=e=>jo(e,"rx"),Vi=e=>jo(e,"x1"),Ni=e=>jo(e,"points"),Hi=e=>Di(e)&&e.isEditing,ji=e=>!jo(e,"opacity")||e.opacity>0,Ui=e=>e.isSelected,Gi=e=>e.isEditing,Zi=e=>e._isDraft,Xi=e=>jo(e,"width")&&jo(e,"height"),Yi=e=>{const t=jo(e,"right"),o=jo(e,"bottom");return t||o},qi=e=>(jo(e,"x")||jo(e,"left"))&&jo(e,"right")||(jo(e,"y")||jo(e,"top"))&&jo(e,"bottom"),Ki=e=>Xi(e)||qi(e),Ji=e=>(e._isDraft=!0,e),Qi=e=>(e._isDraft=!1,e),en=(e,t)=>!0!==e.disableStyle&&(!Uo(e.disableStyle)||!t||!e.disableStyle.includes(t)),tn=e=>!0!==e.disableErase,on=e=>!0!==e.disableSelect,nn=e=>!0!==e.disableRemove,rn=e=>!0!==e.disableDuplicate&&pn(e),an=e=>!e.disableFlip&&(!Zi(e)&&!Yi(e)&&(e=>jo(e,"backgroundImage")||jo(e,"text"))(e)),sn=(e,t)=>!!Di(e)&&(!0!==e.disableInput&&(L(e.disableInput)?e.disableInput(null!=t?t:e.text):t||!0)),ln=(e,t)=>!0!==e.disableTextLayout&&(!Uo(e.disableTextLayout)||!t||!e.disableTextLayout.includes(t)),cn=e=>dn(e)&&e.points.length>3,dn=e=>!!Ni(e)&&(void 0!==e.disableAddPoints&&!0!==e.disableAddPoints),un=e=>!0!==e.disableManipulate&&!Zi(e)&&!Yi(e),pn=e=>un(e)&&!0!==e.disableMove,hn=e=>(delete e.left,delete e.right,delete e.top,delete e.bottom,e),mn=e=>(delete e.rotation,e),gn=e=>(e.strokeWidth=e.strokeWidth||1,e.strokeColor=e.strokeColor||[0,0,0],e),$n=e=>(e.backgroundColor=e.backgroundColor?e.backgroundColor:e.strokeWidth||e.backgroundImage?void 0:[0,0,0],e),fn=e=>{let t=e.text;t=t.replace(/&(#[0-9]+|[a-z]+);/gi,(e,t)=>`___${t}___`),t=t.replace(/&/,"&amp;"),e.text=t.replace(/___(#[0-9]+|[a-z]+)___/gi,(e,t)=>`&${t};`)},yn=e=>{if(!e.textShadow)return e;const[t,o,i,n]=e.textShadow;return e.textShadowX=t,e.textShadowY=o,e.textShadowBlur=i,e.textShadowColor=n,delete e.textShadow,e},bn=e=>{if(!e.textOutline)return e;const[t,o]=e.textOutline;e.textOutlineWidth=t,e.textOutlineColor=o,delete e.textOutline},xn=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",yn(e),bn(e),"html"===e.format?fn(e):(e=>{fn(e);let t=e.text;t=t.replace(/</g,"&gt;"),t=t.replace(/>/g,"&lt;"),e.text=t})(e),Oi(e)?vn(e):Sn(e)),vn=e=>(!1!==e.disableNewline&&(delete e.textAlign,e.text=e.text.replace(/\n/g," ")),hn(e)),Sn=e=>(e.textAlign=e.textAlign||"left",e),wn=e=>((e=>{y(e.id)||(e.id=B()),jo(e,"rotation")||(e.rotation=0),jo(e,"opacity")||(e.opacity=1),jo(e,"disableErase")||(e.disableErase=!0)})(e),Di(e)?xn(e):Wi(e)?(e=>{e.cornerRadius=e.cornerRadius||0,e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],$n(e)})(e):Ni(e)?(e=>{gn(e),mn(e),jo(e,"pathClose")||(e.disableResize=!0,jo(e,"disableMove")||(e.disableMove=!0)),hn(e)})(e):Vi(e)?(e=>{gn(e),e.lineStart=e.lineStart||void 0,e.lineEnd=e.lineEnd||void 0,mn(e),hn(e)})(e):_i(e)&&(e=>{e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],$n(e)})(e),e),kn=e=>Di(e)?"text":Wi(e)?"rectangle":Ni(e)?"path":Vi(e)?"line":_i(e)?"ellipse":void 0,Cn=(e,t)=>parseFloat(e)/100*t,Tn=new RegExp(/^x|left|right|^width|rx|fontSize|eraseRadius|feather|cornerRadius|strokeWidth|strokeDash/,"i"),Mn=new RegExp(/^y|top|bottom|^height|ry/,"i"),Pn=(e,t,{width:o,height:i})=>{if(Array.isArray(t))return t.map(t=>(I(t)&&En(t,{width:o,height:i}),y(t)&&(t=Pn(e,t,{width:o,height:i})),t));if("string"!=typeof t)return t;if(!t.endsWith("%"))return t;const n=parseFloat(t)/100;return Tn.test(e)?ge(o*n,6):Mn.test(e)?ge(i*n,6):t},Rn=Pn,In=["lineHeight","textOutlineWidth","textShadowX","textShadowY","textShadowBlur"],En=(e,t)=>{Object.entries(e).map(([o,i])=>{e[o]=Pn(o,i,t)}),e.text&&In.filter(t=>y(e[t])).forEach(t=>{var o,i;e[t]=(o=e[t],i=e.fontSize,Math.round(i*(parseFloat(o)/100)))})},An=(e,t)=>(En(e,t),Wn(e,t),e),Ln=(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},Fn=(e,t,o)=>Array.isArray(e[t])?e[t].map(e=>Object.entries(e).reduce((e,[t,i])=>(e[t]=y(i)?Cn(i,Ln(t,o)):i,e),{})):y(e[t])?Cn(e[t],Ln(t,o)):e[t],zn=(e,t,o)=>t.reduce((t,i)=>{const n=Fn(e,i,o);return t[i]=n,t},{}),Dn=(e,t,o)=>(Object.keys(t).forEach(i=>((e,t,o,i)=>{if(!y(e[t]))return e[t]=o,e;const n=Ln(t,i);return e[t]=void 0===n?o:Jo(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=at(),o=e.strokeWidth||0;if(Wi(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(Vi(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&&jo(e,"rotation")&&kt(t,e.rotation),Rt(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},Bn=(e,t,o)=>{const i=Ri(e);An(i,t);const n=o(i);return Array.isArray(n)?n:[n]},Wn=(e,t)=>{if(jo(e,"left")&&(e.x=e.left),jo(e,"right")&&!y(e.right)){const o=t.width-e.right;jo(e,"left")?(e.x=e.left,e.width=Math.max(0,o-e.left)):jo(e,"width")&&(e.x=o-e.width)}if(jo(e,"top")&&(e.y=e.top),jo(e,"bottom")&&!y(e.bottom)){const o=t.height-e.bottom;jo(e,"top")?(e.y=e.top,e.height=Math.max(0,o-e.top)):jo(e,"height")&&(e.y=o-e.height)}return e},_n=(e,t)=>(Ni(e)&&e.points.filter(e=>No(e.x)).forEach(e=>{e.x*=t,e.y*=t}),Vi(e)&&No(e.x1)&&(e.x1*=t,e.y1*=t,e.x2*=t,e.y2*=t),No(e.x)&&No(e.y)&&(e.x*=t,e.y*=t),No(e.width)&&No(e.height)&&(e.width*=t,e.height*=t),No(e.rx)&&No(e.ry)&&(e.rx*=t,e.ry*=t),(e=>No(e.strokeWidth)&&e.strokeWidth>0)(e)&&(e.strokeWidth*=t),Di(e)&&(e._scale=t,No(e.fontSize)&&(e.fontSize*=t),No(e.lineHeight)&&(e.lineHeight*=t),No(e.width)&&!No(e.height)&&(e.width*=t)),jo(e,"cornerRadius")&&No(e.cornerRadius)&&(e.cornerRadius*=t),e),Vn=e=>{if(Wi(e))return be(e.x+.5*e.width,e.y+.5*e.height);if(_i(e))return be(e.x,e.y);if(e.text){if(Bi(e)){const t=e.height||hi(e.text,e).height;return be(e.x+.5*e.width,e.y+.5*t)}const t=hi(e.text,e);return be(e.x+.5*t.width,e.y+.5*t.height)}return Ni(e)?Be(e.points):Vi(e)?Be([Fi(e),zi(e)]):void 0};var Nn=e=>/canvas/i.test(e.nodeName),Hn=(e,t=void 0)=>new Promise((o,i)=>{let n=e,r=!1;const a=()=>{r||(r=!0,L(t)&&Promise.resolve().then(()=>t(Ze(n.naturalWidth,n.naturalHeight))))};if(n.src||(n=new Image,y(e)&&new URL(e,location.href).origin!==location.origin&&(n.crossOrigin="anonymous"),n.src=y(e)?e:URL.createObjectURL(e)),n.complete)return a(),o(n);L(t)&&ro(n).then(a).catch(i),n.onload=()=>{a(),o(n)},n.onerror=()=>i(new Error("Failed to load image"))});const jn=new Map([]),Un=(e,t={})=>new Promise((i,n)=>{const{onMetadata:r=o,onLoad:a=i,onError:s=n,onComplete:l=o}=t;let c=jn.get(e);if(c||(c={loading:!1,complete:!1,error:!1,image:void 0,size:void 0,bus:ni()},jn.set(e,c)),c.bus.sub("meta",r),c.bus.sub("load",a),c.bus.sub("error",s),c.bus.sub("complete",l),Nn(e)){const t=e,o=t.cloneNode();c.complete=!0,c.image=o,c.size=Ge(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=ni());c.loading||(c.loading=!0,Hn(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=ni()}))}),Gn=(e,t,o,i)=>e.drawImage(t,o.x,o.x,o.width,o.height,i.x,i.y,i.width,i.height);var Zn=async(e,t,o,i,n=Gn,r)=>{e.save(),e.clip(),await n(e,t,o,i,r),e.restore()};const Xn=(e,t,o,i,n)=>{const r=rt(e);if(i){const e=Et(dt(i),ge);return e.x*=o.width,e.width*=o.width,e.y*=o.height,e.height*=o.height,{srcRect:e,destRect:r}}const a=ht(0,0,o.width,o.height);if("contain"===t){const t=Pt(e,vt(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=Mt(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}},Yn=(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),qn=(e,t)=>(t.backgroundColor&&e.fill(),e),Kn=(e,t)=>(t.strokeWidth&&e.stroke(),e);var Jn=async(e,t,o={})=>{const{drawImage:i}=o;if(e.lineWidth=t.strokeWidth?t.strokeWidth:1,e.strokeStyle=t.strokeColor?Qo(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Qo(t.backgroundColor):"none",e.globalAlpha=t.opacity,t.backgroundImage){let o;if(o=Nn(t.backgroundImage)?t.backgroundImage:await Un(t.backgroundImage),Yn(e,t),qn(e,t),"repeat"===t.backgroundRepeat){const n=t.backgroundPosition||{x:0,y:0},{srcRect:r,destRect:a}=Xn(t,t.backgroundSize||Ge(o),Ge(o),t.backgroundCorners,{x:0,y:0}),s=document.createElement("canvas");s.width=a.width,s.height=a.height;const l=s.getContext("2d",{willReadFrequently:!1,desynchronized:!0});await i(l,o,r,{...a,x:0,y:0});const c=e.createPattern(s,"repeat");e.fillStyle=c,e.save(),e.beginPath(),e.rect(t.x+n.x,t.y+n.y,t.width-n.x,t.height-n.y),e.clip(),e.translate(a.x+n.x,a.y+n.y),e.fill(),S(s),e.restore()}else{const{srcRect:n,destRect:r}=Xn(t,t.backgroundSize,Ge(o),t.backgroundCorners,t.backgroundPosition);await Zn(e,o,n,r,i,{feather:t.feather})}return e.beginPath(),Yn(e,t),Kn(e,t),[]}return Yn(e,t),qn(e,t),Kn(e,t),[]},Qn=async(e,t,o={})=>new Promise(async(i,n)=>{const{drawImage:r}=o;if(e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Qo(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Qo(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 Un(t.backgroundImage)}catch(e){n(e)}const a=ht(t.x-t.rx,t.y-t.ry,2*t.rx,2*t.ry),{srcRect:s,destRect:l}=Xn(a,t.backgroundSize,Ge(o),t.backgroundCorners,t.backgroundPosition);await Zn(e,o,s,l,r),t.strokeWidth&&e.stroke(),i([])}else t.strokeWidth&&e.stroke(),i([])}),er=async(e,t,o)=>{const i=No(t.width)?Math.floor(t.width):void 0,n=No(t.height)?Math.floor(t.height):void 0,r=i&&n?He(t):hi(t.text,{...t,width:i,height:n}),a={x:t.x,y:t.y,width:r.width,height:r.height};if(Jn(e,{...t,...a,options:o}),!t.text.length)return[];const{textOutlineWidth:s=0,textShadowX:l=0,textShadowY:c=0,textShadowBlur:d=0,textShadowColor:u,outline:p,blur:h,...m}=t,g=!!t.height;if(g&&(e.rect(a.x,a.y,a.width,a.height),e.save(),e.clip()),l||c||d){e.save(),e.translate(l,c);const r={...a};g||(r.height+=ri+d),await tr(e,r,{...t,width:i,height:n},{...o,paddingLeft:ri+d,paddingRight:ri+d,paddingTop:d,paddingBottom:d+(g?-1*c:t.fontSize),shapeExtendedProps:{color:u,blur:d}}),e.restore()}if(s){const r={...a};g||(r.height+=ri+s),await tr(e,r,{...t,width:i,height:n},{...o,paddingLeft:ri+s,paddingRight:ri+s,paddingTop:s,paddingBottom:s+g?0:t.fontSize,shapeExtendedProps:{color:t.textOutlineColor,outline:s}})}return g&&e.restore(),await tr(e,a,{...m,width:i,height:n},{...o,paddingLeft:ri,paddingRight:ri,paddingTop:0,paddingBottom:g?0:t.fontSize}),[]};const tr=async(e,t,o,i)=>{const{willRequest:n,shapeExtendedProps:r,paddingLeft:a,paddingRight:s,paddingTop:l,paddingBottom:c,styleNonce:d}=i,u=No(o.width)?Math.floor(t.width):void 0,p=No(o.height)?Math.floor(t.height):void 0,h=Math.ceil(t.width),m=Math.ceil(t.height),g=await Pi(o.text,{...o,...r,...t,width:u,height:p,paddingLeft:a,paddingRight:s,paddingTop:l,paddingBottom:c,imageWidth:h,imageHeight:m,willRequest:n,styleNonce:d});e.drawImage(g,o.x-a,o.y-l,g.width,g.height)};var or=async(e,t)=>new Promise(async o=>{e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Qo(t.strokeColor):"none",e.globalAlpha=t.opacity,t.bitmap&&(e.lineCap=t.strokeCap,e.lineJoin=t.strokeJoin,e.setLineDash(t.strokeDash||[]));let i=Fi(t),n=zi(t);e.moveTo(i.x,i.y),e.lineTo(n.x,n.y),t.strokeWidth&&e.stroke(),o([])}),ir=async(e,t)=>new Promise((o,i)=>{if(t.bitmap&&1===t.points.length)return void Qn(e,{x:t.points[0].x,y:t.points[0].y,rx:.5*t.strokeWidth,ry:.5*t.strokeWidth,backgroundColor:t.strokeColor}).then(()=>o([]));e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Qo(t.strokeColor):"transparent",e.fillStyle=t.pathClose&&t.backgroundColor?Qo(t.backgroundColor):"transparent",e.globalAlpha=t.opacity;const{points:n}=t;t.bitmap&&(e.lineCap=t.strokeCap,e.lineJoin=t.strokeJoin,e.setLineDash(t.strokeDash||[])),t.pathClose&&e.beginPath(),e.moveTo(n[0].x,n[0].y);const r=n.length;for(let t=1;t<r;t++)e.lineTo(n[t].x,n[t].y);t.pathClose&&e.closePath(),t.strokeWidth&&e.stroke(),t.backgroundColor&&e.fill(),o([])}),nr=(e,t,o,i)=>t||o?(e.translate(i.x,i.y),e.scale(t?-1:1,o?-1:1),e.translate(-i.x,-i.y),e):e;const rr=async(e,t,o)=>{e.globalCompositeOperation="subtract"===t.drawMode?"destination-out":"source-over";const i=Vn(t);let n;if(Io(e,t.rotation,i),nr(e,t.flipX,t.flipY,i),Wi(t)?n=Jn:_i(t)?n=Qn:Vi(t)?n=or:Ni(t)?n=ir:Di(t)&&(n=er),n){const i=await n(e,t,o);if(!i.length)return[];return[t,...await ar(e,i,o)]}return[]};var ar=async(e,t,o)=>{let i=[];for(const n of t)e.save(),e.beginPath(),i=[...i,...await rr(e,n,o)],e.restore();return i},sr=async(e,t={})=>{const{shapes:i=[],contextBounds:n=e,transform:r=o,drawImage:a,willRequest:s,styleNonce:l,canvasMemoryLimit:c,computeShape:d=ee,preprocessShape:u=ee}=t;if(!i.length)return e;const p={willReadFrequently:!0,colorSpace:e.colorSpace},h=x("canvas");h.width=n.width,h.height=n.height;const m=h.getContext("2d",p);m.putImageData(e,n.x||0,n.y||0);const g=i.map(Ri).map(d).map(u).flat().filter(Boolean);r(m),await ar(m,g,{drawImage:a,canvasMemoryLimit:c,willRequest:s,styleNonce:l});const $=m.getImageData(0,0,h.width,h.height);return S(h),$},lr=async(e,t={})=>{const{backgroundFilterMode:o,backgroundColor:i,backgroundImage:n}=t,r=!(!i||i&&0===i[3]);if(!n&&!r)return e;const a={willReadFrequently:!0,colorSpace:e.colorSpace},s=x("canvas");s.width=e.width,s.height=e.height;const l=s.getContext("2d",a);if(l.putImageData(e,0,0),l.globalCompositeOperation="destination-over",r&&(l.fillStyle=Qo(i),l.fillRect(0,0,s.width,s.height)),n){let i,r;if(Nn(n)?i=n:(i=await Un(n),"image"===o&&(i=F(i,{contextOptions:a}))),"image"===o){const e=f(i),o=await Vo(e,t);r=await P(o)}const{srcRect:s,destRect:c}=Xn({x:0,y:0,width:e.width,height:e.height},"cover",{width:i.width||i.naturalWidth,height:i.height||i.naturalHeight});l.drawImage(r||i,s.x,s.y,s.width,s.height,c.x,c.y,c.width,c.height),r&&S(r),o&&"none"!==o&&i&&!Nn(n)&&S(i)}const c=l.getImageData(0,0,s.width,s.height);return S(s),c},cr=e=>e.length?e.reduce((e,t)=>((e,t)=>{const o=new Array(20);return o[0]=e[0]*t[0]+e[1]*t[5]+e[2]*t[10]+e[3]*t[15],o[1]=e[0]*t[1]+e[1]*t[6]+e[2]*t[11]+e[3]*t[16],o[2]=e[0]*t[2]+e[1]*t[7]+e[2]*t[12]+e[3]*t[17],o[3]=e[0]*t[3]+e[1]*t[8]+e[2]*t[13]+e[3]*t[18],o[4]=e[0]*t[4]+e[1]*t[9]+e[2]*t[14]+e[3]*t[19]+e[4],o[5]=e[5]*t[0]+e[6]*t[5]+e[7]*t[10]+e[8]*t[15],o[6]=e[5]*t[1]+e[6]*t[6]+e[7]*t[11]+e[8]*t[16],o[7]=e[5]*t[2]+e[6]*t[7]+e[7]*t[12]+e[8]*t[17],o[8]=e[5]*t[3]+e[6]*t[8]+e[7]*t[13]+e[8]*t[18],o[9]=e[5]*t[4]+e[6]*t[9]+e[7]*t[14]+e[8]*t[19]+e[9],o[10]=e[10]*t[0]+e[11]*t[5]+e[12]*t[10]+e[13]*t[15],o[11]=e[10]*t[1]+e[11]*t[6]+e[12]*t[11]+e[13]*t[16],o[12]=e[10]*t[2]+e[11]*t[7]+e[12]*t[12]+e[13]*t[17],o[13]=e[10]*t[3]+e[11]*t[8]+e[12]*t[13]+e[13]*t[18],o[14]=e[10]*t[4]+e[11]*t[9]+e[12]*t[14]+e[13]*t[19]+e[14],o[15]=e[15]*t[0]+e[16]*t[5]+e[17]*t[10]+e[18]*t[15],o[16]=e[15]*t[1]+e[16]*t[6]+e[17]*t[11]+e[18]*t[16],o[17]=e[15]*t[2]+e[16]*t[7]+e[17]*t[12]+e[18]*t[17],o[18]=e[15]*t[3]+e[16]*t[8]+e[17]*t[13]+e[18]*t[18],o[19]=e[15]*t[4]+e[16]*t[9]+e[17]*t[14]+e[18]*t[19]+e[19],o})([...e],t),e.shift()):[],dr=(e,t)=>{const o=e.width*e.height,i=t.reduce((e,t)=>(t.width>e.width&&t.height>e.height&&(e.width=t.width,e.height=t.height),e),{width:0,height:0}),n=i.width*i.height;return((e,t=2)=>Math.round(e*t)/t)(Math.max(.5,.5+(1-n/o)/2),5)};function ur(){}const pr=e=>e;function hr(e,t){for(const o in t)e[o]=t[o];return e}function mr(e){return e()}function gr(){return Object.create(null)}function $r(e){e.forEach(mr)}function fr(e){return"function"==typeof e}function yr(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}let br;function xr(e,t){return e===t||(br||(br=document.createElement("a")),br.href=t,e===br.href)}function vr(e,...t){if(null==e){for(const e of t)e(void 0);return ur}const o=e.subscribe(...t);return o.unsubscribe?()=>o.unsubscribe():o}function Sr(e){let t;return vr(e,e=>t=e)(),t}function wr(e,t,o){e.$$.on_destroy.push(vr(t,o))}function kr(e,t,o,i){if(e){const n=Cr(e,t,o,i);return e[0](n)}}function Cr(e,t,o,i){return e[1]&&i?hr(o.ctx.slice(),e[1](i(t))):o.ctx}function Tr(e,t,o,i){if(e[2]&&i){const n=e[2](i(o));if(void 0===t.dirty)return n;if("object"==typeof n){const e=[],o=Math.max(t.dirty.length,n.length);for(let i=0;i<o;i+=1)e[i]=t.dirty[i]|n[i];return e}return t.dirty|n}return t.dirty}function Mr(e,t,o,i,n,r){if(n){const a=Cr(t,o,i,r);e.p(a,n)}}function Pr(e){if(e.ctx.length>32){const t=[],o=e.ctx.length/32;for(let e=0;e<o;e++)t[e]=-1;return t}return-1}function Rr(e){const t={};for(const o in e)"$"!==o[0]&&(t[o]=e[o]);return t}function Ir(e,t){const o={};t=new Set(t);for(const i in e)t.has(i)||"$"===i[0]||(o[i]=e[i]);return o}function Er(e,t,o){return e.set(o),t}function Ar(e){return e&&fr(e.destroy)?e.destroy:ur}const Lr="undefined"!=typeof window;let Fr=Lr?()=>window.performance.now():()=>Date.now(),zr=Lr?e=>requestAnimationFrame(e):ur;const Dr=new Set;function Or(e){Dr.forEach(t=>{t.c(e)||(Dr.delete(t),t.f())}),0!==Dr.size&&zr(Or)}function Br(e){let t;return 0===Dr.size&&zr(Or),{promise:new Promise(o=>{Dr.add(t={c:e,f:o})}),abort(){Dr.delete(t)}}}const Wr="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function _r(e,t){e.appendChild(t)}function Vr(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function Nr(e){const t=Ur("style");return t.textContent="/* empty */",function(e,t){_r(e.head||e,t),t.sheet}(Vr(e),t),t.sheet}function Hr(e,t,o){e.insertBefore(t,o||null)}function jr(e){e.parentNode&&e.parentNode.removeChild(e)}function Ur(e){return document.createElement(e)}function Gr(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Zr(e){return document.createTextNode(e)}function Xr(){return Zr(" ")}function Yr(){return Zr("")}function qr(e,t,o,i){return e.addEventListener(t,o,i),()=>e.removeEventListener(t,o,i)}function Kr(e){return function(t){return t.preventDefault(),e.call(this,t)}}function Jr(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function Qr(e,t,o){null==o?e.removeAttribute(t):e.getAttribute(t)!==o&&e.setAttribute(t,o)}const ea=["width","height"];function ta(e,t){const o=Object.getOwnPropertyDescriptors(e.__proto__);for(const i in t)null==t[i]?e.removeAttribute(i):"style"===i?e.style.cssText=t[i]:"__value"===i?e.value=e[i]=t[i]:o[i]&&o[i].set&&-1===ea.indexOf(i)?e[i]=t[i]:Qr(e,i,t[i])}function oa(e,t){Object.keys(t).forEach(o=>{!function(e,t,o){const i=t.toLowerCase();i in e?e[i]="boolean"==typeof e[i]&&""===o||o:t in e?e[t]="boolean"==typeof e[t]&&""===o||o:Qr(e,t,o)}(e,o,t[o])})}function ia(e){return/-/.test(e)?oa:ta}function na(e,t){t=""+t,e.data!==t&&(e.data=t)}function ra(e,t){e.value=null==t?"":t}function aa(e,t,o,i){null==o?e.style.removeProperty(t):e.style.setProperty(t,o,i?"important":"")}function sa(e,t,{bubbles:o=!1,cancelable:i=!1}={}){return new CustomEvent(e,{detail:t,bubbles:o,cancelable:i})}class la{is_svg=!1;e=void 0;n=void 0;t=void 0;a=void 0;constructor(e=!1){this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,o=null){this.e||(this.is_svg?this.e=Gr(t.nodeName):this.e=Ur(11===t.nodeType?"TEMPLATE":t.nodeName),this.t="TEMPLATE"!==t.tagName?t:t.content,this.c(e)),this.i(o)}h(e){this.e.innerHTML=e,this.n=Array.from("TEMPLATE"===this.e.nodeName?this.e.content.childNodes:this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)Hr(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(jr)}}function ca(e,t){return new e(t)}const da=new Map;let ua,pa=0;function ha(e,t,o,i,n,r,a,s=0){const l=16.666/i;let c="{\n";for(let e=0;e<=1;e+=l){const i=t+(o-t)*r(e);c+=100*e+`%{${a(i,1-i)}}\n`}const d=c+`100% {${a(o,1-o)}}\n}`,u=`__svelte_${function(e){let t=5381,o=e.length;for(;o--;)t=(t<<5)-t^e.charCodeAt(o);return t>>>0}(d)}_${s}`,p=Vr(e),{stylesheet:h,rules:m}=da.get(p)||function(e,t){const o={stylesheet:Nr(t),rules:{}};return da.set(e,o),o}(p,e);m[u]||(m[u]=!0,h.insertRule(`@keyframes ${u} ${d}`,h.cssRules.length));const g=e.style.animation||"";return e.style.animation=`${g?`${g}, `:""}${u} ${i}ms linear ${n}ms 1 both`,pa+=1,u}function ma(e,t){const o=(e.style.animation||"").split(", "),i=o.filter(t?e=>e.indexOf(t)<0:e=>-1===e.indexOf("__svelte")),n=o.length-i.length;n&&(e.style.animation=i.join(", "),pa-=n,pa||zr(()=>{pa||(da.forEach(e=>{const{ownerNode:t}=e.stylesheet;t&&jr(t)}),da.clear())}))}function ga(e){ua=e}function $a(){if(!ua)throw new Error("Function called outside component initialization");return ua}function fa(e){$a().$$.on_mount.push(e)}function ya(e){$a().$$.after_update.push(e)}function ba(e){$a().$$.on_destroy.push(e)}function xa(){const e=$a();return(t,o,{cancelable:i=!1}={})=>{const n=e.$$.callbacks[t];if(n){const r=sa(t,o,{cancelable:i});return n.slice().forEach(t=>{t.call(e,r)}),!r.defaultPrevented}return!0}}function va(e,t){return $a().$$.context.set(e,t),t}function Sa(e){return $a().$$.context.get(e)}function wa(e,t){const o=e.$$.callbacks[t.type];o&&o.slice().forEach(e=>e.call(this,t))}const ka=[],Ca=[];let Ta=[];const Ma=[],Pa=Promise.resolve();let Ra=!1;function Ia(){Ra||(Ra=!0,Pa.then(Oa))}function Ea(){return Ia(),Pa}function Aa(e){Ta.push(e)}function La(e){Ma.push(e)}const Fa=new Set;let za,Da=0;function Oa(){if(0!==Da)return;const e=ua;do{try{for(;Da<ka.length;){const e=ka[Da];Da++,ga(e),Ba(e.$$)}}catch(e){throw ka.length=0,Da=0,e}for(ga(null),ka.length=0,Da=0;Ca.length;)Ca.pop()();for(let e=0;e<Ta.length;e+=1){const t=Ta[e];Fa.has(t)||(Fa.add(t),t())}Ta.length=0}while(ka.length);for(;Ma.length;)Ma.pop()();Ra=!1,Fa.clear(),ga(e)}function Ba(e){if(null!==e.fragment){e.update(),$r(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(Aa)}}function Wa(e,t,o){e.dispatchEvent(sa(`${t?"intro":"outro"}${o}`))}const _a=new Set;let Va;function Na(){Va={r:0,c:[],p:Va}}function Ha(){Va.r||$r(Va.c),Va=Va.p}function ja(e,t){e&&e.i&&(_a.delete(e),e.i(t))}function Ua(e,t,o,i){if(e&&e.o){if(_a.has(e))return;_a.add(e),Va.c.push(()=>{_a.delete(e),i&&(o&&e.d(1),i())}),e.o(t)}else i&&i()}const Ga={duration:0};function Za(e,t,o,i){let n,r=t(e,o,{direction:"both"}),a=i?0:1,s=null,l=null,c=null;function d(){c&&ma(e,c)}function u(e,t){const o=e.b-a;return t*=Math.abs(o),{a:a,b:e.b,d:o,duration:t,start:e.start,end:e.start+t,group:e.group}}function p(t){const{delay:o=0,duration:i=300,easing:p=pr,tick:h=ur,css:m}=r||Ga,g={start:Fr()+o,b:t};t||(g.group=Va,Va.r+=1),"inert"in e&&(t?void 0!==n&&(e.inert=n):(n=e.inert,e.inert=!0)),s||l?l=g:(m&&(d(),c=ha(e,a,t,i,o,p,m)),t&&h(0,1),s=u(g,i),Aa(()=>Wa(e,t,"start")),Br(t=>{if(l&&t>l.start&&(s=u(l,i),l=null,Wa(e,s.b,"start"),m&&(d(),c=ha(e,a,s.b,s.duration,0,p,r.css))),s)if(t>=s.end)h(a=s.b,1-a),Wa(e,s.b,"end"),l||(s.b?d():--s.group.r||$r(s.group.c)),s=null;else if(t>=s.start){const e=t-s.start;a=s.a+s.d*p(e/s.duration),h(a,1-a)}return!(!s&&!l)}))}return{run(e){fr(r)?(za||(za=Promise.resolve(),za.then(()=>{za=null})),za).then(()=>{r=r({direction:e?"in":"out"}),p(e)}):p(e)},end(){d(),s=l=null}}}function Xa(e){return void 0!==e?.length?e:Array.from(e)}function Ya(e,t){e.d(1),t.delete(e.key)}function qa(e,t){Ua(e,1,1,()=>{t.delete(e.key)})}function Ka(e,t,o,i,n,r,a,s,l,c,d,u){let p=e.length,h=r.length,m=p;const g={};for(;m--;)g[e[m].key]=m;const $=[],f=new Map,y=new Map,b=[];for(m=h;m--;){const e=u(n,r,m),s=o(e);let l=a.get(s);l?i&&b.push(()=>l.p(e,t)):(l=c(s,e),l.c()),f.set(s,$[m]=l),s in g&&y.set(s,Math.abs(m-g[s]))}const x=new Set,v=new Set;function S(e){ja(e,1),e.m(s,d),a.set(e.key,e),d=e.first,h--}for(;p&&h;){const t=$[h-1],o=e[p-1],i=t.key,n=o.key;t===o?(d=t.first,p--,h--):f.has(n)?!a.has(i)||x.has(i)?S(t):v.has(n)?p--:y.get(i)>y.get(n)?(v.add(i),S(t)):(x.add(n),p--):(l(o,a),p--)}for(;p--;){const t=e[p];f.has(t.key)||l(t,a)}for(;h;)S($[h-1]);return $r(b),$}function Ja(e,t){const o={},i={},n={$$scope:1};let r=e.length;for(;r--;){const a=e[r],s=t[r];if(s){for(const e in a)e in s||(i[e]=1);for(const e in s)n[e]||(o[e]=s[e],n[e]=1);e[r]=s}else for(const e in a)n[e]=1}for(const e in i)e in o||(o[e]=void 0);return o}function Qa(e){return"object"==typeof e&&null!==e?e:{}}function es(e,t,o){const i=e.$$.props[t];void 0!==i&&(e.$$.bound[i]=o,o(e.$$.ctx[i]))}function ts(e){e&&e.c()}function os(e,t,o){const{fragment:i,after_update:n}=e.$$;i&&i.m(t,o),Aa(()=>{const t=e.$$.on_mount.map(mr).filter(fr);e.$$.on_destroy?e.$$.on_destroy.push(...t):$r(t),e.$$.on_mount=[]}),n.forEach(Aa)}function is(e,t){const o=e.$$;null!==o.fragment&&(!function(e){const t=[],o=[];Ta.forEach(i=>-1===e.indexOf(i)?t.push(i):o.push(i)),o.forEach(e=>e()),Ta=t}(o.after_update),$r(o.on_destroy),o.fragment&&o.fragment.d(t),o.on_destroy=o.fragment=null,o.ctx=[])}function ns(e,t,o,i,n,r,a=null,s=[-1]){const l=ua;ga(e);const c=e.$$={fragment:null,ctx:[],props:r,update:ur,not_equal:n,bound:gr(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:gr(),dirty:s,skip_bound:!1,root:t.target||l.$$.root};a&&a(c.root);let d=!1;if(c.ctx=o?o(e,t.props||{},(t,o,...i)=>{const r=i.length?i[0]:o;return c.ctx&&n(c.ctx[t],c.ctx[t]=r)&&(!c.skip_bound&&c.bound[t]&&c.bound[t](r),d&&function(e,t){-1===e.$$.dirty[0]&&(ka.push(e),Ia(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(e,t)),o}):[],c.update(),d=!0,$r(c.before_update),c.fragment=!!i&&i(c.ctx),t.target){if(t.hydrate){const e=function(e){return Array.from(e.childNodes)}(t.target);c.fragment&&c.fragment.l(e),e.forEach(jr)}else c.fragment&&c.fragment.c();t.intro&&ja(e.$$.fragment),os(e,t.target,t.anchor),Oa()}ga(l)}class rs{$$=void 0;$$set=void 0;$destroy(){is(this,1),this.$destroy=ur}$on(e,t){if(!fr(t))return ur;const o=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return o.push(t),()=>{const e=o.indexOf(t);-1!==e&&o.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const as=[];function ss(e,t){return{subscribe:ls(e,t).subscribe}}function ls(e,t=ur){let o;const i=new Set;function n(t){if(yr(e,t)&&(e=t,o)){const t=!as.length;for(const t of i)t[1](),as.push(t,e);if(t){for(let e=0;e<as.length;e+=2)as[e][0](as[e+1]);as.length=0}}}function r(t){n(t(e))}return{set:n,update:r,subscribe:function(a,s=ur){const l=[a,s];return i.add(l),1===i.size&&(o=t(n,r)||ur),a(e),()=>{i.delete(l),0===i.size&&o&&(o(),o=null)}}}}function cs(e,t,o){const i=!Array.isArray(e),n=i?[e]:e;if(!n.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const r=t.length<2;return ss(o,(e,o)=>{let a=!1;const s=[];let l=0,c=ur;const d=()=>{if(l)return;c();const n=t(i?s[0]:s,e,o);r?e(n):c=fr(n)?n:ur},u=n.map((e,t)=>vr(e,e=>{s[t]=e,l&=~(1<<t),a&&d()},()=>{l|=1<<t}));return a=!0,d(),function(){$r(u),c(),a=!1}})}var ds=e=>e.reduce((e,t)=>Object.assign(e,t),{});const us=e=>({updateValue:e}),ps=e=>({defaultValue:e}),hs=e=>({store:e}),ms=e=>({store:(t,o)=>cs(...e(o))}),gs=e=>({store:(t,o)=>{const[i,n,r=()=>!1]=e(o);let a,s=!0;return cs(i,(e,t)=>{n(e,e=>{!s&&r(a,e)||(a=e,s=!1,t(e))})})}}),$s=e=>({store:(t,o)=>{const[i,n={},r]=e(o);let a=[];const s={},l=e=>i(e,s),c=e=>{(a.length||e.length)&&(a=e,d())},d=()=>{const e=a.map(l);r&&e.sort(r),a=[...e],p(e)};Object.entries(n).map(([e,t])=>t.subscribe(t=>{s[e]=t,t&&d()}));const{subscribe:u,set:p}=ls(t||[]);return{set:c,update:e=>c(e(a)),subscribe:u}}});var fs=e=>{const t={},i={};return e.forEach(([e,...n])=>{const r=ds(n),a=t[e]=((e,t,i)=>{const{store:n=e=>ls(e),defaultValue:r=o,updateValue:a}=i,s=n(r(),t,e),{subscribe:l,update:c=o}=s;let d;const u=e=>{let t=!0;d&&d(),d=l(o=>{if(t)return t=!1;e(o),d(),d=void 0})},p=a?a(e):ee;return s.set=e=>c(t=>p(e,t,u)),s.defaultValue=r,s})(i,t,r),s={get:()=>Sr(a),set:a.set};Object.defineProperty(i,e,s)}),{stores:t,accessors:i}};var ys=[["src",hs(()=>{let e;const{subscribe:t,set:o}=ls(),i=t=>{e!==t&&(e=t,o(e))};return{set:i,subscribe:t,update:t=>i(t(e))}})],["imageReader"],["imageWriter"],["imageScrambler"],["imageRedactionRendering",ps(()=>"pixelated")],["images",ps(()=>[])],["shapePreprocessor"],["willRequestResource"],["willRequest"],["csp"]],bs=e=>e.charAt(0).toUpperCase()+e.slice(1),xs=(e,t)=>{Object.keys(t).forEach(o=>{const i=L(t[o])?{value:t[o],writable:!1}:t[o];Object.defineProperty(e,o,i)})};const vs=(e,t)=>{let o,i,n,r,a,s,l,c,d,u;const p=t.length;for(o=0;o<p;o++)if(i=t[o],n=t[o+1>p-1?0:o+1],r=i.x-e.x,a=i.y-e.y,s=n.x-e.x,l=n.y-e.y,c=r-s,d=a-l,u=c*a-d*r,u<-1e-5)return!1;return!0},Ss=1e4;var ws=(e,t)=>{const o=Vt(t),i=ye();It(e).forEach(e=>{Re(e,i),vs(e,t)||o.forEach(t=>{const o=Math.atan2(t.start.y-t.end.y,t.start.x-t.end.x),n=Math.sin(Math.PI-o)*Ss,r=Math.cos(Math.PI-o)*Ss,a=be(e.x+n,e.y+r),s=ot(tt(t),Ss),l=zt(et(e,a),s);l&&Re(i,Ie(ve(l),e))})});const n=rt(e);Re(n,i);return!!It(n).every(e=>vs(e,t))&&(wt(e,n),!0)},ks=(e,t)=>{const o=It(e),i=Nt(t,5),n=mt(e),r=[];o.forEach(e=>{const t=((e,t)=>{if(0===t)return e;const o=be(e.start.x-e.end.x,e.start.y-e.end.y),i=Ce(o),n=Ae(i,t);return e.end.x+=n.x,e.end.y+=n.y,e})(et(ve(n),ve(e)),1e6);let o=!1;i.map(tt).forEach(e=>{const i=zt(t,e);i&&!o&&(r.push(i),o=!0)})});const a=De(r[0],r[2])<De(r[1],r[3])?[r[0],r[2]]:[r[1],r[3]],s=dt(a);return s.width<e.width&&(wt(e,s),!0)},Cs=(e,t,o={x:0,y:0})=>{const i=st(e),n=mt(i),r=At(i,o,n).map(e=>we(e,t,n)),a=dt(r);return r.map(e=>Ie(e,a))},Ts=(e,t=0,o=vt(e))=>{let i,n;if(0!==t){const r=Math.atan2(1,o),a=Math.sign(t)*t,s=a%Math.PI,l=a%oe;let c;c=s>ie&&s<oe+ie?l>ie?a:oe-l:l>ie?oe-l:a;const d=Math.min(Math.abs(e.height/Math.sin(r+c)),Math.abs(e.width/Math.cos(r-c)));i=Math.cos(r)*d,n=i/o}else i=e.width,n=i/o,n>e.height&&(n=e.height,i=n*o);return Ze(i,n)},Ms=(e,t,o,i,n,r,a,s)=>{const l=Ne(a),c=Ne(s),d=ge(Math.max(t.width/c.width,t.height/c.height)),u=ge(Math.min(t.width/l.width,t.height/l.height)),p=rt(t);if(u<1||d>1){const o=mt(e),i=mt(t),n=u<1?u:d,r=(i.x+o.x)/2,a=(i.y+o.y)/2,s=p.width/n,l=p.height/n;St(p,r-.5*s,a-.5*l,s,l)}return r?(((e,t,o=0,i=ye(),n)=>{if(No(o)&&0!==o||i.x||i.y){const n=vt(e),r=Cs(t,o,i),a=Ts(t,o,n);if(!(e.width<a.width&&e.height<a.height)){const t=.5*e.width-.5*a.width,o=.5*e.height-.5*a.height;e.width>a.width&&(e.width=a.width,e.x+=t),e.height>a.height&&(e.height=a.height,e.y+=o)}ws(e,r),ks(e,r)&&ws(e,r)}else{const o=vt(e);e.width=Math.min(e.width,t.width),e.height=Math.min(e.height,t.height),e.x=Math.max(e.x,0),e.x+e.width>t.width&&(e.x-=e.x+e.width-t.width),e.y=Math.max(e.y,0),e.y+e.height>t.height&&(e.y-=e.y+e.height-t.height);const i=mt(e),r=Pt(e,o);r.width=Math.max(n.width,r.width),r.height=Math.max(n.height,r.height),r.x=i.x-.5*r.width,r.y=i.y-.5*r.height,wt(e,r)}})(p,o,i,n,l),{crop:p}):{crop:p}},Ps=(e,t,o)=>{const i=st(e),n=mt(i),r=kt(i,o,n),a=mt(Lt(dt(r))),s=mt(t),l=we(s,-o,a),c=Ie(l,a),d=Pe(Re(n,c),ge);return ht(d.x-.5*t.width,d.y-.5*t.height,t.width,t.height)},Rs=(e,t,o)=>Math.max(t,Math.min(e,o));const Is=["cropLimitToImage","cropMinSize","cropMaxSize","cropAspectRatio","flipX","flipY","rotation","crop","colorMatrix","convolutionMatrix","gamma","vignette","manipulation","redaction","annotation","decoration","selection","frame","backgroundColor","backgroundImage","backgroundFilterMode","targetSize","metadata","trim","volume","minDuration","maxDuration","currentTime"],Es=e=>Uo(e)?e.map(Es):xo(e)||qt(e)?e:I(e)?{...e}:e,As=e=>e.map(e=>Object.entries(e).reduce((e,[t,o])=>(t.startsWith("_")||(e[t]=o),e),{}));const Ls=(e,t)=>e===t;var Fs=(e,t,o=Ls)=>{if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!o(e[i],t[i]))return!1;return!0};const zs=(e,t,o)=>{const i=Pe(mt(e),e=>ge(e,8)),n=st(t),r=mt(n),a=kt(n,o,r),s=Pe(qe(dt(a)),e=>ge(e,8)),l=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y);return l<1&&c<1},Ds=(e,t,o,i,n)=>{if(!n)return[-1/0,1/0];const r=Math.max(o.width/i.width,o.height/i.height),a=Ze(i.width*r,i.height*r),s=(l=a,Math.sqrt(l.width*l.width+l.height*l.height));var l;if(s<Math.min(e.width,e.height))return[-1/0,1/0];const c=t?e.height:e.width,d=t?e.width:e.height,u=Math.acos(a.height/s),p=u-Math.acos(d/s),h=Math.asin(c/s)-u;if(Number.isNaN(p)&&Number.isNaN(h))return[-1/0,1/0];const m=Number.isNaN(p)?h:Number.isNaN(h)?p:Math.min(p,h);return[-m,m]},Os=(e,t)=>{const{context:o,props:i}=t;return e._isFormatted||((e=wn(e))._isFormatted=!0,Object.assign(e,i)),e._isDraft||!qi(e)||e._context&&xt(o,e._context)||(Wn(e,o),e._context={...o}),e},Bs=(e,t)=>(e._isFormatted||(e.disableMove=!0,e.disableSelect=!0,e.disableResize=!0,e.disableRotate=!0),Os(e,t));var Ws=[["file"],["size"],["loadState"],["processState"],["aspectRatio",ms(({size:e})=>[e,e=>e?vt(e):void 0])],["perspectiveX",ps(()=>0)],["perspectiveY",ps(()=>0)],["perspective",ms(({perspectiveX:e,perspectiveY:t})=>[[e,t],([e,t])=>({x:e,y:t})])],["rotation",ps(()=>0),us(e=>(t,o,i)=>{if(t===o)return t;const{loadState:n,size:r,rotationRange:a,cropMinSize:s,cropMaxSize:l,crop:c,perspective:d,cropLimitToImage:u,cropOrigin:p}=e;if(!c||!n||!n.beforeComplete)return t;const h=u&&((e,t,o)=>{const i=Ts(t,o,vt(e));return Xe(Qe(i,Math.round),Qe(Ne(e),Math.round))})(c,r,o),m=u&&zs(c,r,o),g=((e,t,o,i,n,r,a,s,l,c)=>{const d=Ne(l),u=Ne(c);a&&(u.width=Math.min(c.width,n.width),u.height=Math.min(c.height,n.height));let p=!1;const h=(t,o)=>{const l=Ps(n,i,t),c=st(n),m=mt(c),g=At(c,r,m),$=Ie(ve(m),Ft(g)),f=we(mt(l),o,m),y=Ie(ve(m),f);g.forEach(e=>we(e,o,m));const b=dt(g),x=Ft(g),v=Re(Ie(Ie(x,y),b),$),S=ht(v.x-.5*l.width,v.y-.5*l.height,l.width,l.height);if(s&&$t(S,s.width/S.width),a){const e=Cs(n,o,r);ks(S,e)}const w=ge(Math.min(S.width/d.width,S.height/d.height),8),k=ge(Math.max(S.width/u.width,S.height/u.height),8);return(w<1||k>1)&&ge(Math.abs(o-t))===ge(Math.PI/2)&&!p?(p=!0,h(e,e+Math.sign(o-t)*Math.PI)):{rotation:o,crop:Et(S,e=>ge(e,8))}},m=Math.sign(t)*Math.round(Math.abs(t)/oe)*oe,g=Rs(t,m+o[0],m+o[1]);return h(e,g)})(o,t,a,c,r,d,u,p,s,l);if(h&&m){const e=Ts(r,t,vt(g.crop));g.crop.x+=.5*g.crop.width,g.crop.y+=.5*g.crop.height,g.crop.x-=.5*e.width,g.crop.y-=.5*e.height,g.crop.width=e.width,g.crop.height=e.height}return i(()=>{e.crop=Et(g.crop,e=>ge(e,8))}),g.rotation})],["flipX",ps(()=>!1)],["flipY",ps(()=>!1)],["flip",ms(({flipX:e,flipY:t})=>[[e,t],([e,t])=>({x:e,y:t})])],["isRotatedSideways",gs(({rotation:e})=>[[e],([e],t)=>t(ne(e)),(e,t)=>e!==t])],["crop",us(e=>(t,o=t)=>{const{loadState:i,size:n,cropMinSize:r,cropMaxSize:a,cropLimitToImage:s,cropAspectRatio:l,rotation:c,perspective:d}=e;if(!t&&!o||!i||!i.beforeComplete)return t;t||(t=st(Ts(n,c,l||vt(n))));const u=Ms(o,t,n,c,d,s,r,a),p=Et(u.crop,e=>ge(e,8));return xt(o,p)?o:p})],["cropAspectRatio",us(e=>(t,o)=>{const{loadState:i,crop:n,size:r,rotation:a,cropLimitToImage:s}=e,l=(e=>{if(e){if(/:/.test(e)){const[t,o]=e.split(":");return t/o}return parseFloat(e)}})(t);if(!l)return;if(!n||!i||!i.beforeComplete)return l;const c=o?Math.abs(t-o):1;if(zs(n,r,a)&&s&&c>=.1){const o=((e,t)=>{const o=e.width,i=e.height;return ne(t)&&(e.width=i,e.height=o),e})(Ne(r),a);e.crop=Et(Pt(st(o),t),ge)}else{const t={width:n.height*l,height:n.height},o=.5*(n.width-t.width),i=.5*(n.height-t.height);e.crop=Et(ht(n.x+o,n.y+i,t.width,t.height),ge)}return l})],["cropOrigin"],["cropMinSize",ps(()=>({width:1,height:1}))],["cropMaxSize",ps(()=>({width:32768,height:32768}))],["cropLimitToImage",ps(()=>!0),us(e=>(t,o,i)=>{const{crop:n}=e;return n?(!o&&t&&i(()=>e.crop=rt(e.crop)),t):t})],["cropSize",gs(({crop:e})=>[[e],([e],t)=>{e&&t(Ze(e.width,e.height))},(e,t)=>Xe(e,t)])],["cropRectAspectRatio",ms(({cropSize:e})=>[[e],([e],t)=>{e&&t(ge(vt(e),5))}])],["cropRange",gs(({size:e,rotation:t,cropRectAspectRatio:o,cropMinSize:i,cropMaxSize:n,cropLimitToImage:r})=>[[e,t,o,i,n,r],([e,t,o,i,n,r],a)=>{if(!e)return;const s=((e,t,o,i,n,r)=>{const a=Ne(i),s=Ne(n);return r?[a,Qe(Ts(e,t,o),Math.round)]:[a,s]})(e,t,o,i,n,r);a(s)},(e,t)=>Fs(e,t)])],["rotationRange",gs(({size:e,isRotatedSideways:t,cropMinSize:o,cropSize:i,cropLimitToImage:n})=>[[e,t,o,i,n],([e,t,o,i,n],r)=>{if(!e||!i)return;r(Ds(e,t,o,i,n))},(e,t)=>Fs(e,t)])],["backgroundColor",us(()=>e=>((e=[0,0,0,0],t=1)=>4===e.length?e:[...e,t])(e))],["backgroundImage"],["backgroundFilterMode"],["targetSize"],["colorMatrix"],["convolutionMatrix"],["gamma"],["noise"],["vignette"],["duration"],["currentTime"],["minDuration",ps(()=>1/24)],["maxDuration",ps(()=>1/0)],["volume",ps(()=>1)],["trim"],["redaction",$s(({size:e})=>[Os,{context:e}])],["manipulation",$s(({size:e})=>[Os,{context:e}])],["annotation",$s(({size:e})=>[Os,{context:e}])],["decoration",$s(({crop:e})=>[Os,{context:e}])],["selection",$s(({size:e})=>[Bs,{context:e}])],["frame",us(()=>e=>{if(!e)return;const t={frameStyle:void 0,x:0,y:0,width:"100%",height:"100%",disableStyle:["backgroundColor","strokeColor","strokeWidth"]};return y(e)?t.frameStyle=e:Object.assign(t,e),t})],["metadata"],["state",hs((e,t,o)=>{const i=Is.map(e=>t[e]);let n=!1;const r=ls({}),{subscribe:a}=cs([...i,r],(e,t)=>{if(n)return;const o=Is.reduce((t,o,i)=>(t[o]=Es(e[i]),t),{});o.crop&&Et(o.crop,Math.round),o.manipulation=o.manipulation&&As(o.manipulation),o.redaction=o.redaction&&As(o.redaction),o.annotation=o.annotation&&As(o.annotation),o.decoration=o.decoration&&As(o.decoration),o.selection=o.selection&&As(o.selection),t(o)}),s=e=>{e&&(n=!0,o.cropOrigin=void 0,Is.filter(t=>jo(e,t)).forEach(t=>{const i=e[t];o[t]=null===i?void 0:Es(i)}),n=!1,r.set({}))};return{set:s,update:e=>s(e(null)),subscribe:a}})]],_s=async(e,t,i={},n)=>{const{ontaskstart:r,ontaskprogress:a,ontaskend:s,token:l}=n;let c=!1;const d={cancel:o};l.cancel=()=>{c=!0,d.cancel()};for(const[o,n]of t.entries()){if(c)return;const[t,l]=n;r(o,l);try{e=await t(e,{...i,taskCancelToken:d},e=>a(o,l,e))}catch(e){throw c=!0,e}s(o,l)}return e};const Vs=e=>console.warn(`Pintura: ${e} is a required prop.`),Ns=["loadstart","loadabort","loaderror","loadprogress","load","processstart","processabort","processerror","processprogress","process"],Hs=["flip","cropOrigin","isRotatedSideways","perspective","perspectiveX","perspectiveY","cropRange"],js=["images"],Us=Ws.map(([e])=>e).filter(e=>!Hs.includes(e)),Gs=e=>`image${bs(e)}`,Zs=e=>jo(e,"crop");var Xs=()=>{const{stores:e,accessors:t}=fs(ys),{sub:i,pub:n}=ni(),r=()=>t.images?t.images[0]:{};let a={};const s={};Us.forEach(e=>{Object.defineProperty(t,Gs(e),{get:()=>{const t=r();if(t)return t.accessors[e]},set:t=>{a[Gs(e)]=t,s[Gs(e)]=t;const o=r();o&&(o.accessors[e]=t)}})});const l=()=>t.images&&t.images[0];let c;const d=e.src.subscribe(e=>{if(!e)return t.images=[];t.imageReader?(t.images.length&&(a={}),p(e)):c=setTimeout(()=>Vs("imageReader"),32)}),u=e.imageReader.subscribe(e=>{e&&(clearTimeout(c),t.images.length||t.src&&p(t.src))}),p=e=>{Promise.resolve().then(()=>m(e,a)).catch(()=>{})};let h;const m=(e,i={})=>new Promise((r,c)=>{let d=l();const u=!(!1===i.cropLimitToImage||!1===i.imageCropLimitToImage||!1===s.imageCropLmitedToImage),p=i.cropMinSize||i.imageCropMinSize||s.imageCropMinSize,m=u?p:d&&d.accessors.cropMinSize,g=i.minDuration||i.imageMinDuration;d&&$(),d=(({minSize:e={width:1,height:1},minDuration:t=0}={})=>{const{stores:i,accessors:n}=fs(Ws),{pub:r,sub:a}=ni(),s=(e,t)=>{const o=()=>n[e]||{},i=t=>{n[e]={...o(),...t,timeStamp:Date.now()}},a=()=>o().error,s=e=>{a()||(i({error:e}),r(`${t}error`,{...o()}))};return{start(){r(`${t}start`)},onabort(){i({abort:!0}),r(`${t}abort`,{...o()})},ontaskstart(e,n){a()||(i({index:e,task:n,taskProgress:void 0,taskLengthComputable:void 0}),r(`${t}taskstart`,{...o()}))},ontaskprogress(e,n,s){a()||(i({index:e,task:n,taskProgress:s.loaded/s.total,taskLengthComputable:s.lengthComputable}),r(`${t}taskprogress`,{...o()}),r(`${t}progress`,{...o()}))},ontaskend(e,n){a()||(i({index:e,task:n}),r(`${t}taskend`,{...o()}))},ontaskerror(e){s(e)},error(e){s(e)},beforeComplete(e){a()||(i({beforeComplete:!0}),r(`before${t}`,e))},complete(e){a()||(i({complete:!0}),r(t,e))}}};return xs(n,{read:(i,{reader:r},a={})=>{if(!r)return;Object.assign(n,{file:void 0,size:void 0,loadState:void 0});let l={cancel:o},c=!1;const d=s("loadState","load"),u={token:l,...d},p={src:i,size:void 0,dest:void 0,duration:void 0};return Promise.resolve().then(async()=>{try{if(d.start(),c)return d.onabort();const o=await _s(p,r,a,u);if(c)return d.onabort();const{size:i,duration:s,dest:l}=o||{};if(!i||!i.width||!i.height)throw new fo("Image size missing","IMAGE_SIZE_MISSING",o);if(s>0&&s<t)throw new fo("Video too short","VIDEO_TOO_SHORT",{...o,minDuration:t});if(i.width<e.width||i.height<e.height)throw new fo("Image too small","IMAGE_TOO_SMALL",{...o,minWidth:e.width,minHeight:e.height});Object.assign(n,{file:l,size:i,duration:s}),d.beforeComplete(o),d.complete(o)}catch(e){d.error(e)}finally{l=void 0}}),()=>{c=!0,l&&l.cancel(),d.onabort()}},write:(e,t)=>{if(!n.loadState.complete)return;n.processState=void 0;const i=s("processState","process"),r={src:n.file,imageState:n.state,dest:void 0};if(L(e)&&(e=e(n.file,n.state)),!e)return i.start(),void i.complete(r);let a={cancel:o},l=!1;const c=t,d={token:a,...i};return Promise.resolve().then(async()=>{try{if(i.start(),l)return i.onabort();const t=await _s(r,e,c,d);if(l)return i.onabort();i.complete(t)}catch(e){i.error(e)}finally{a=void 0}}),()=>{l=!0,a&&a.cancel(),i.onabort()}},on:a}),{accessors:n,stores:i}})({minSize:m,minDuration:g}),Ns.map(e=>{return d.accessors.on(e,(t=e,e=>n(t,e)));var t});const f=()=>{a={},y.forEach(e=>e())},y=[];y.push(d.accessors.on("loaderror",e=>{f(),c(e)})),y.push(d.accessors.on("loadabort",()=>{f(),c({name:"AbortError"})})),y.push(d.accessors.on("load",e=>{h=void 0,f(),r(e)})),y.push(d.accessors.on("beforeload",()=>((e,o)=>{if(Zs(o))return void(t.imageState=o);if(!o.imageCrop){const t=e.accessors.size,i=o.imageRotation||0,n=Ke(Ne(t),i),r=st(n);r.width=ge(Math.abs(r.width),6),r.height=ge(Math.abs(r.height),6);const a=o.imageCropAspectRatio||(o.imageCropLimitToImage?vt(t):vt(r));let s;o.imageCropLimitToImage?s=Pt(r,a):(s=Mt(r,a),s.x=(t.width-s.width)/2,s.y=(t.height-s.height)/2),o.imageCrop=s}if(e.accessors.duration&&!o.imageTrim&&o.imageMaxDuration){const{duration:t}=e.accessors;o.imageTrim=[[0,Math.min(o.imageMaxDuration/t,1)]]}const i=["imageCropLimitToImage","imageCrop","imageCropAspectRatio","imageRotation"];i.filter(e=>jo(o,e)).forEach(e=>{t[e]=o[e],delete o[e]});const n=Object.keys(o).filter(e=>!i.includes(e)).reduce((e,t)=>(e[t]=o[t],e),{});Object.assign(t,n)})(d,i))),t.images=[d],i.imageReader&&(t.imageReader=i.imageReader),i.imageWriter&&(t.imageWriter=i.imageWriter),h=d.accessors.read(e,{reader:t.imageReader},{willRequest:t.willRequest})});let g;const $=()=>{const e=l();e&&(h&&h(),e.accessors.loadState=void 0,t.images=[])};return Object.defineProperty(t,"stores",{get:()=>e}),xs(t,{on:i,loadImage:m,abortLoadImage:()=>{h&&h(),t.images=[]},editImage:(e,o)=>new Promise((i,n)=>{m(e,o).then(()=>{const{images:e}=t,o=e[0],r=()=>{a(),s()},a=o.accessors.on("processerror",e=>{r(),n(e)}),s=o.accessors.on("process",e=>{r(),i(e)})}).catch(n)}),removeImage:$,processImage:(e,o)=>new Promise((i,n)=>{try{const r=[],a=()=>{r.forEach(e=>e())};(async()=>{if((e=>y(e)||Ko(e)||Yt(e))(e))try{await m(e,o)}catch(e){n(e)}else e&&(Zs(e)?t.imageState=e:Object.assign(t,e));const s=l();if(!s)return n("no image");r.push(s.accessors.on("processerror",e=>{a(),n(e)})),r.push(s.accessors.on("processabort",()=>{a(),n({name:"AbortError"})})),r.push(s.accessors.on("process",e=>{g=void 0,a(),i(e)})),g=s.accessors.write(t.imageWriter,{redactionRenderStyle:t.imageRedactionRendering,shapePreprocessor:t.shapePreprocessor||ee,imageScrambler:t.imageScrambler,willRequest:t.willRequest,csp:t.csp||{},willRequestResource:t.willRequestResource})})()}catch(e){n(e)}}),abortProcessImage:()=>{const e=l();e&&(g&&g(),e.accessors.processState=void 0)},destroy:()=>{d&&d(),u&&u()}}),t};const Ys=(e,t)=>{const{processImage:o}=Xs();return o(e,t)};var qs=()=>no()?To()?/15_|16_/.test(navigator.userAgent)?14745600:16777216:/15_/.test(navigator.userAgent)?16777216:1/0:1/0,Ks=(e,t)=>Object.keys(e).filter(e=>!t.includes(e)).reduce((t,o)=>(t[o]=e[o],t),{}),Js=e=>new Promise(t=>{if(e.duration===1/0)return e.ontimeupdate=()=>{e.ontimeupdate=void 0,t(e)},void(e.currentTime=Number.MAX_SAFE_INTEGER);t(e)});const Qs=e=>new Promise(t=>{const o=new FileReader;o.onload=()=>t(o.result),o.readAsArrayBuffer(e)}),el=1836476516,tl=(e,t=0,o=e.byteLength)=>{const i=[],n=t+o;for(;t<n;){const o=e.getUint32(t);if(o<0)break;const n=e.getUint32(t+4);if(i.push({type:n,size:o,offset:t,bodyOffset:t+8,bodySize:o-8}),o<8)break;t+=o}return i},ol=(e,{limit:t=1024}={})=>{let o=0;o+=4;if(1718909296!==e.getUint32(o))return 0;o+=4;const i=e.getUint32(o);return 1836069938===i?((e,t,o)=>{let i=!1,n=-1;for(let r=t;r<o;r++)if(i||1953653099!==e.getUint32(r)||(i=!0,r+=4),i&&64==e.getUint8(r)){n=r;break}if(n<0)return 0;const r=e.getUint32(n-28),a=e.getUint32(n-20),s=e.getUint32(n-32),l=e.getUint32(n-16);return 65536===r&&4294901760===a?90:4294901760===s&&4294901760===l?180:4294901760===r&&65536===a?270:0})(e,o,t):1903435808===i?(e=>{const t=tl(e).find(e=>1836019574===e.type);if(!t)return 0;const o=tl(e,t.bodyOffset,t.bodySize);o.filter(e=>1953653099===e.type).forEach(t=>{o.push(...tl(e,t.bodyOffset,t.bodySize))});const i=[el,1953196132],n=o.filter(e=>i.includes(e.type));for(const{type:t,bodyOffset:o}of n){const i=e.getUint8(o);let n=o+4;n+=t===el?32:36,n+=1===i?12:0;const r=e.getInt32(n),a=e.getInt32(n+4);if(0===r&&a>0)return 90;if(r<0&&0===a)return 180;if(0===r&&a<0)return 270}return 0})(e):0};var il=e=>new Promise((t,o)=>{(N()?(async e=>{const t=await Qs(e),o=new DataView(t);return ol(o)})(e):Promise.resolve(0)).then(i=>{const n=document.createElement("video");n.onerror=()=>o(n.error),n.playsInline=!0,n.preload="auto",n.onseeked=()=>{n.onseeked=void 0,t(n)},n.onloadeddata=()=>{n.onloadeddata=void 0,n.dataset.rotation=i?`${i}`:"0",Js(n).then(t),n.currentTime=0},To()&&no()?(n.srcObject=e,n.load()):n.src=URL.createObjectURL(e)})}),nl=(e,t)=>new Promise(o=>{if(e.currentTime===t)return o(e);let i=e.onseeked;e.onseeked=()=>{e.onseeked=i,o(e)},e.currentTime=Rs(t,0,e.duration)}),rl=(e,t=0)=>new Promise((o,i)=>{il(e).then(e=>{nl(e,t).then(e=>{const t=x("canvas");ao(e).then(({width:i,height:n})=>{t.width=i,t.height=n;const r=t.getContext("2d",{willReadFrequently:!0}),a=()=>{r.drawImage(e,0,0,t.width,t.height);const i=r.getImageData(0,0,t.width,t.height);S(t),URL.revokeObjectURL(e.src),o(i)};no()?setTimeout(a,16):a()})})})}),al=e=>/video/.test(e.type);let sl=null;const ll=({imageDataResizer:e,canvasMemoryLimit:t}={})=>async(o,i,n,r,a)=>{n.width=Math.max(n.width,1),n.height=Math.max(n.height,1),r.width=Math.max(r.width,1),r.height=Math.max(r.height,1);const{dest:s}=await Ys(i,{imageReader:Ol(),imageWriter:Wl({format:"canvas",targetSize:{...r,upscale:!0},imageDataResizer:e,canvasMemoryLimit:t}),imageCrop:n}),{feather:l=0}=a||{};if(l>0){const e=x("canvas");e.width=s.width,e.height=s.height;const t=e.getContext("2d",{willReadFrequently:!0}),o=1/l;let i=0;for(i=0;i<l;i++){const e=i*o;t.strokeStyle=`rgba(0,0,0,${e*e})`,t.strokeRect(i+.5,i+.5,s.width-2*i-1,s.height-2*i-1)}t.fillStyle="#000",t.fillRect(i,i,s.width+.5-2*i,s.height+.5-2*i);const n=s.getContext("2d");n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),S(e)}o.drawImage(s,r.x,r.y,r.width,r.height),S(s)},cl=(e,t=(...e)=>e,o)=>async(i,n,r)=>{r(ho(0,!1));let a=!1;const s=await e(...t(i,n,e=>{a=!0,r(e)}));return o&&o(i,s),a||r(ho(1,!1)),i},dl=({willRequest:e,srcProp:t="src",destProp:o="dest"}={})=>[cl(So,(o,i,n)=>[o[t],n,{...i,willRequest:e}],(e,t)=>e[o]=t),"any-to-file"],ul=({srcProp:e="dest",destProp:t="dest"}={})=>[cl(async e=>{if(/octet-stream/.test(e.type)){console.warn(`Pintura: File has unknown mime type "${e.type}", make sure your server sets the correct Content-Type header.`);let t="image";const o=await lo(e);/video/i.test(o.nodeName)&&(t="video");const i={type:t+"/unknown"};return qt(e)?new File([e],e.name,{...i,lastModified:e.lastModified}):new Blob([e],i)}return e},t=>[t[e]],(e,o)=>e[t]=o),"guard-mimetype"],pl=({srcProp:e="src",destProp:t="size"}={})=>[cl(uo,t=>[t[e]],(e,o)=>e[t]=o),"read-image-size"],hl=async e=>{const t=await lo(e);if(co(t))return await(e=>new Promise((t,o)=>{const i=()=>{Js(e).then(()=>{t(e.duration)})};if(e.readyState>=1)return i();e.onloadedmetadata=i,e.onerror=()=>o(e.error)}))(t)},ml=({srcProp:e="src",destProp:t="duration"}={})=>[cl(hl,t=>[t[e]],(e,o)=>e[t]=o),"read-media-duration"],gl=({srcSize:e="size",srcOrientation:t="orientation",destSize:o="size"}={})=>[cl(Mo,o=>[o[e],o[t]],(e,t)=>e[o]=t),"image-size-match-orientation"],$l=({srcProp:e="src",destProp:t="copy"}={})=>[cl((e,t)=>Po(e)?u(e,t):void 0,t=>[t[e],onprogress],(e,o)=>{o&&(e[t]=o)}),"read-image-head"],fl=({srcProp:e="copy",orientationProp:t="orientation",colorSpaceProp:o="colorSpace"}={})=>[cl((e,t)=>{if(e)return s(e,t)},t=>[t[e],{exif:[n],app2:[r]}],(e,i)=>{i&&(e[t]=i.exif&&i.exif[274]||1,e[o]=(i.app2&&i.app2[r]||"sRGB").toLowerCase())}),"read-image-head-tags"],yl=({srcProp:e="copy"}={})=>[cl((e,t)=>{if(e)return((e,t)=>{const o=a(e);o&&Object.entries(t).forEach(([e,t])=>{if(!o[e])return;const i=o[e].getTags();i&&t.forEach(([e,t])=>{i.write(e,t)})})})(e,t)},t=>[t[e],{exif:[[n,1]]}]),"clear-exif-orientation-tag"],bl=({srcImageSize:e="size",srcCanvasSize:t="imageData",srcImageState:o="imageState",destImageSize:i="size",destScalar:n="scalar"}={})=>[cl((e,t)=>[Math.min(t.width/e.width,t.height/e.height),He(t)],i=>[i[e],i[t],i[o]],(e,[t,o])=>{e[n]=t,e[i]=o}),"calculate-canvas-scalar"],xl=({srcProp:e="src",destProp:t="imageData",canvasMemoryLimit:o,colorSpaceProp:i="colorSpace",srcImageState:n="imageState"}={})=>[cl((e,t,o,i)=>al(e)?rl(e,i.currentTime):j(e,{canvasMemoryLimit:t,colorSpace:o}),t=>[t[e],o,t[i],t[n]],(e,o)=>e[t]=o),"blob-to-image-data"],vl=({srcImageData:e="imageData",srcOrientation:t="orientation"}={})=>[cl(R,o=>[o[e],o[t]],(e,t)=>e.imageData=t),"image-data-match-orientation"],Sl=({srcImageData:e="imageData",srcImageState:t="imageState"}={})=>[cl(lr,o=>{const{colorMatrix:i}=o[t],n=i&&Object.keys(i).map(e=>i[e]).filter(Boolean);return[o[e],{backgroundColor:o[t].backgroundColor,backgroundImage:o[t].backgroundImage,backgroundFilterMode:o[t].backgroundFilterMode,colorMatrix:n&&cr(n),convolutionMatrix:o[t].convolutionMatrix,gamma:o[t].gamma,noise:o[t].noise,vignette:o[t].vignette}]},(e,t)=>e.imageData=t),"image-data-fill"],wl=({srcImageData:e="imageData",srcImageState:t="imageState",destScalar:o="scalar"}={})=>[cl(Ao,i=>{const n=i[o];let{crop:r}=i[t];return r&&1!==n&&(r=$t(rt(r),n,ye())),[i[e],{crop:r,rotation:i[t].rotation,flipX:i[t].flipX,flipY:i[t].flipY}]},(e,t)=>e.imageData=t),"image-data-crop"],kl=({targetSize:e={width:void 0,height:void 0,fit:void 0,upscale:void 0},imageDataResizer:t,srcProp:o="imageData",srcImageState:i="imageState",destImageScaledSize:n="imageScaledSize"})=>[cl(zo,n=>{const r=Math.min(e.width||Number.MAX_SAFE_INTEGER,n[i].targetSize&&n[i].targetSize.width||Number.MAX_SAFE_INTEGER),a=Math.min(e.height||Number.MAX_SAFE_INTEGER,n[i].targetSize&&n[i].targetSize.height||Number.MAX_SAFE_INTEGER);return[n[o],{width:r,height:a,fit:e.fit||"contain",upscale:(s=n[i],!!(s.targetSize&&s.targetSize.width||s.targetSize&&s.targetSize.height)||(e.upscale||!1))},t];var s},(e,t)=>{Xe(e.imageData,t)||(e[n]=He(t)),e.imageData=t}),"image-data-resize"],Cl=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData"}={})=>[cl(Vo,o=>{const{colorMatrix:i}=o[t],n=i&&Object.keys(i).map(e=>i[e]).filter(Boolean);return[o[e],{colorMatrix:n&&cr(n),convolutionMatrix:o[t].convolutionMatrix,gamma:o[t].gamma,noise:o[t].noise,vignette:o[t].vignette}]},(e,t)=>e[o]=t),"image-data-filter"],Tl=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destScalar:i="scalar"}={})=>[cl(async(e,t,o,i,n,r)=>{if(!t||!i.length)return e;let a;try{const n={dataSizeScalar:dr(e,i)};o&&o[3]>0&&(n.backgroundColor=[...o]),a=await t(e,n)}catch(e){}const s=x("canvas");s.width=e.width,s.height=e.height;const l=s.getContext("2d",{willReadFrequently:!0,colorSpace:e.colorSpace});if(l.putImageData(e,0,0),"auto"===r){const t=Math.sqrt(e.width*e.height);l.filter=`blur(${Math.round(t/100)}px)`}const c=new Path2D;i.forEach(e=>{const t=ht(e.x,e.y,e.width,e.height);bt(t,n);const o=kt(rt(t),e.rotation),i=new Path2D;o.forEach((e,t)=>{if(0===t)return i.moveTo(e.x,e.y);i.lineTo(e.x,e.y)}),c.addPath(i)}),l.clip(c,"nonzero"),l.imageSmoothingEnabled=!1,l.drawImage(a,0,0,s.width,s.height),S(a);const d=l.getImageData(0,0,s.width,s.height);return S(s),d},(o,{imageScrambler:n,redactionRenderStyle:r})=>[o[e],n,o[t].backgroundColor,o[t].redaction,o[i],r],(e,t)=>e[o]=t),"image-data-redact"],Ml=({srcImageData:e="imageData",srcSize:t="size",srcImageState:o="imageState",srcShapes:i="annotation",destImageData:n="imageData",destImageScaledSize:r="imageScaledSize",destScalar:a="scalar",imageDataResizer:s,canvasMemoryLimit:l,shapeFilter:c=ee,shapeClip:d=!0,destImageContext:u="imageContext"}={})=>[cl(sr,(n,{shapePreprocessor:p,willRequestResource:h,csp:m,willRequest:g})=>{const $=n[o][i].filter(c);if(!$.length)return[n[e]];const f=n[a],{crop:y}=n[o],b=n[t];let x=f;const v=n[r];v&&(x=Math.min(v.width/y.width,v.height/y.height));const S={width:b.width/f,height:b.height/f};return[n[e],{shapes:$,computeShape:e=>(e=An(e,S),e=Ks(e,["left","right","top","bottom"]),e=_n(e,x)),transform:e=>{const i=n[t],{rotation:a=0,flipX:s,flipY:l,cropLimitToImage:c}=n[o],{crop:p=st(i)}=n[o];let h=1;h=n[r]?x:f;const m={width:i.width/f*h,height:i.height/f*h},g=Xt(m,a),$=g.width,y=g.height,b=.5*m.width-.5*$,v=.5*m.height-.5*y,S=qe(m);e.translate(-b,-v),e.translate(-p.x*h,-p.y*h),e.translate(S.x,S.y),e.rotate(a),e.translate(-S.x,-S.y);const w=n[u]||{x:0,y:0};e.translate(w.x,w.y),e.scale(s?-1:1,l?-1:1),e.translate(s?-m.width*f:0,l?-m.height*f:0),c&&d&&(e.rect(0,0,m.width,m.height),e.clip())},drawImage:ll({imageDataResizer:s,canvasMemoryLimit:l}),preprocessShape:e=>p(e,{isPreview:!1,...n[o]}),canvasMemoryLimit:l,willRequest:g||h,styleNonce:m.styleNonce}]},(e,t)=>e[n]=t),"image-data-annotate"],Pl=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destImageScaledSize:i="imageScaledSize",imageDataResizer:n,canvasMemoryLimit:r,destScalar:a="scalar",shapeFilter:s=ee,destImageContext:l="imageContext"}={})=>[cl(sr,(o,{shapePreprocessor:c,willRequestResource:d,willRequest:u,csp:p})=>{let h=o[t].decoration.filter(s);if("undefined"!=typeof window&&(e=>{if(e&&e._jn1s076)return;const[i]=[[85,110,108,105,99,101,110,115,101,100,32,80,105,110,116,117,114,97,32,105,110,115,116,97,110,99,101,32]].map(e=>e.map(e=>String.fromCharCode(e)).join("")),{width:n,height:r}=o[t].crop,a=r/15;h=[...h,{x:.5*-a,y:.5*-a,width:1.5*n,height:1.25*r,text:Array(50).fill(i).join(""),fontWeight:900,lineHeight:a,fontSize:a,color:[1,1,1,.05]}]})(window),!h.length)return[o[e]];let m=o[a];const{crop:g}=o[t],$=o[i];if($){const e=Math.min($.width/g.width,$.height/g.height);m=e}return[o[e],{shapes:h,drawImage:ll({imageDataResizer:n,canvasMemoryLimit:r}),computeShape:e=>(e=An(e,g),e=Ks(e,["left","right","top","bottom"]),e=_n(e,m)),preprocessShape:e=>c(e,{isPreview:!1,...o[t]}),canvasMemoryLimit:r,willRequest:u||d,styleNonce:p.styleNonce,transform:e=>{const t=o[l]||{x:0,y:0};e.translate(t.x,t.y)}}]},(e,t)=>e[o]=t),"image-data-decorate"],Rl=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destImageScaledSize:i="imageScaledSize",imageDataResizer:n,canvasMemoryLimit:r,destScalar:a="scalar",destImageContext:s="imageContext"}={})=>[cl((e,t)=>new Promise(o=>{if(!t)return o([e]);sr(e,t).then(e=>{o([e,t.contextBounds])})}),(o,{shapePreprocessor:s,willRequestResource:l,willRequest:c,csp:d})=>{const u=o[t].frame;if(!u)return[o[e]];const p=o[a];let{crop:h}=o[t];h&&1!==p&&(h=$t(rt(h),p,ye()));const m={...h},g=On(Bn(u,m,s),m);m.x=Math.abs(g.left),m.y=Math.abs(g.top),m.width+=Math.abs(g.left)+Math.abs(g.right),m.height+=Math.abs(g.top)+Math.abs(g.bottom);const $=o[i],f=$?$.width/h.width:1,y=$?$.height/h.height:1;return m.x*=f,m.y*=y,m.width*=f,m.height*=y,m.x=Math.round(m.x),m.y=Math.round(m.y),m.width=Math.round(m.width),m.height=Math.round(m.height),$&&(Math.abs(m.width-$.width)<=1&&(m.width=$.width),Math.abs(m.height-$.height)<=1&&(m.height=$.height)),[o[e],{shapes:[u],contextBounds:m,computeShape:t=>An(t,o[e]),transform:e=>{e.translate(m.x,m.y)},drawImage:ll({imageDataResizer:n,canvasMemoryLimit:r}),preprocessShape:e=>s(e,{isPreview:!1,...o[t]}),canvasMemoryLimit:r,willRequest:c||l,styleNonce:d.styleNonce}]},(e,[t,i])=>{e[s]=i,e[o]=t}),"image-data-frame"],Il=({mimeType:e,quality:t,srcImageData:o="imageData",srcFile:i="src",destBlob:n="blob"}={})=>[cl(G,n=>[n[o],e||K(n[i].name)||n[i].type,t],(e,t)=>e[n]=t),"image-data-to-blob"],El=({srcImageData:e="imageData",srcOrientation:t="orientation",destCanvas:o="dest"}={})=>[cl(P,o=>[o[e],o[t]],(e,t)=>e[o]=t),"image-data-to-canvas"],Al=async(e,t,o)=>{if(!Po(e)||!t)return e;const i=/p3/i.test(o),n=(e,t)=>{let o=2;const i=new DataView(e),n=i.byteLength;for(t(i.getUint8(0),0,2,n);o<n&&255==i.getUint8(o);){const e=i.getUint8(o+1),r=i.getUint16(o+2)+2;if(!1===t(e,o,r,n))break;o+=r}},r=e=>e>=224&&e<=237,a=(e=>{const t=[];return n(e,(o,n,a)=>{if(218===o)return!1;if(r(o)){if(226===o){if(!i)return!1;if(null===sl&&(sl=void 0!==new ImageData(1,1).colorSpace),!sl)return!1}t.push(new Uint8Array(e,n,a))}}),t})(t),s=((e,t)=>{const o=[];n(e,(i,n,a,s)=>0===n?(o.push(new Uint8Array(e,n,a)),void o.push(...t)):218===i?(o.push(new Uint8Array(e,n,s-n)),!1):void(r(i)||o.push(new Uint8Array(e,n,a))));let i=o.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),s=0;return o.forEach(e=>{a.set(e,s),s+=e.length}),a})(await u(e),a);return new Blob([s],{type:"image/jpeg"})},Ll=(e="blob",t="copy",o="colorSpace",i="blob")=>[cl((e,t,o)=>{if(t)return Al(e,t,o)},i=>[i[e],i[t],i[o]],(e,t)=>{t&&(e[i]=t)}),"blob-write-image-head"],Fl=({renameFile:e,srcBlob:t="blob",srcFile:o="src",destFile:i="dest",defaultFilename:n}={})=>[cl(J,i=>[i[t],e?e(i[o]):i[o].name||`${n}.${X(i[t].type)}`],(e,t)=>e[i]=t),"blob-to-file"],zl=({url:e="./",dataset:t=e=>[["dest",e.dest,e.dest.name],["imageState",e.imageState]],destStore:i="store",credentials:n,headers:r={}})=>[cl(async(t,i)=>await((e,t,i)=>new Promise((n,r)=>{const{token:a={},beforeSend:s=o,onprogress:l=o}=i;a.cancel=()=>c.abort();const c=new XMLHttpRequest;c.upload.onprogress=l,c.onload=()=>c.status>=200&&c.status<300?n(c):r(c),c.onerror=()=>r(c),c.ontimeout=()=>r(c),c.open("POST",encodeURI(e)),s(c),c.send(t instanceof FormData?t:t.reduce((e,t)=>(e.append(...t.map(Ro)),e),new FormData))}))(e,t,{onprogress:i,beforeSend:e=>yo(e,{headers:r,credentials:n})}),(e,o,i)=>[t(e),i],(e,t)=>e[i]=t),"store"],Dl=e=>[cl(t=>e&&e.length?(Object.keys(t).forEach(o=>{e.includes(o)||delete t[o]}),t):t),"prop-filter"],Ol=(e={})=>{const{orientImage:t=!0,outputProps:o=["src","dest","size","duration"],preprocessImageFile:i,request:n={}}=e;return[dl({willRequest:()=>n}),ul(),i&&[cl(i,(e,t,o)=>[e.dest,t,o],(e,t)=>e.dest=t),"preprocess-image-file"],pl({srcProp:"dest"}),ml({srcProp:"dest"}),t&&$l({srcProp:"dest"}),t&&fl(),t&&gl(),Dl(o)].filter(Boolean)},Bl=e=>e&&(y(e)?zl({url:e}):L(e)?[e,"store"]:zl(e)),Wl=(e={})=>(t,o,i={})=>{let{canvasMemoryLimit:n=qs(),orientImage:r=!0,copyImageHead:a=!0,mimeType:s,quality:l,renameFile:c,targetSize:d,imageDataResizer:u,store:p,format:h="file",outputProps:m=["src","dest","imageState","store"],preprocessImageSource:g,preprocessImageState:$,postprocessImageData:f,postprocessImageBlob:y,testSrcSupport:b=!1}={...e,...i};if(!b||so(t))return"blob"===h&&(h="file"),[g&&[cl(g,(e,t,o)=>[e.src,t,o,e.imageState],(e,t)=>e.src=t),"preprocess-image-source"],(r||a)&&$l(),fl(),pl(),$&&[cl($,(e,t,o,i)=>[e.imageState,t,o,{size:e.size,orientation:e.orientation}],(e,t)=>e.imageState=t),"preprocess-image-state"],xl({canvasMemoryLimit:n}),r&&gl(),r&&vl(),bl(),Tl(),wl(),kl({imageDataResizer:u,targetSize:d}),Ml({imageDataResizer:u,canvasMemoryLimit:n,srcShapes:"manipulation"}),Cl(),Sl(),Ml({imageDataResizer:u,canvasMemoryLimit:n,srcShapes:"annotation",shapeFilter:e=>!e.aboveFrame}),Pl({imageDataResizer:u,canvasMemoryLimit:n,shapeFilter:e=>!e.aboveFrame}),Rl({imageDataResizer:u,canvasMemoryLimit:n}),Ml({imageDataResizer:u,canvasMemoryLimit:n,srcShapes:"annotation",shapeFilter:e=>e.aboveFrame,shapeClip:!1}),Pl({imageDataResizer:u,canvasMemoryLimit:n,shapeFilter:e=>e.aboveFrame}),f&&[cl(f,(e,t,o)=>[e.imageData,t,o],(e,t)=>e.imageData=t),"postprocess-image-data"],"file"===h?Il({mimeType:s,quality:l}):"canvas"===h?El():[e=>(e.dest=e.imageData,e)],"file"===h&&r&&yl(),"file"===h&&a&&Ll(),y&&[cl(y,({blob:e,imageData:t,src:o},i,n)=>[{blob:e,imageData:t,src:o},i,n],(e,t)=>e.blob=t),"postprocess-image-file"],"file"===h&&Fl({defaultFilename:"image",renameFile:c}),"file"===h?Bl(p):L(p)&&[p,"store"],Dl(m)].filter(Boolean)};var _l=(e,t,o,i,n,r,a,s,l,c,d)=>{if(!(e&&t&&o&&i&&s))return;s*=r;const u=Lt(rt(t)),p=mt(u),h=mt(e),m=st(o),g=mt(m),$=Ps(o,i,l),f=mt($),y=Ie(ve(g),f),b=Ie(ve(h),p);y.x+=b.x,y.y+=b.y;const x=Se(ve(y));x.x+=b.x,x.y+=b.y;const v=mt(gt(gt(rt(n),a),e)),S=Ie(v,h);return Re(y,S),{origin:x,translation:y,rotation:{x:d?Math.PI:0,y:c?Math.PI:0,z:l},scale:s}};let Vl=null;var Nl=()=>{if(null===Vl)if("WebGL2RenderingContext"in window){let e;try{e=x("canvas"),Vl=!!e.getContext("webgl2")}catch(e){Vl=!1}e&&S(e),e=void 0}else Vl=!1;return Vl},Hl=e=>!(e&e-1),jl=(e,t={},o="",i="")=>Object.keys(t).filter(e=>!I(t[e])).reduce((e,n)=>e.replace(new RegExp(o+n+i),t[n]),e);const Ul={head:"#version 300 es\n\nin vec4 aPosition;uniform mat4 uMatrix;",text:"\nin vec2 aTexCoord;out vec2 vTexCoord;",matrix:"\ngl_Position=uMatrix*vec4(aPosition.x,aPosition.y,0,1);"},Gl={head:"#version 300 es\nprecision highp float;\n\nout vec4 fragColor;",mask:"\nuniform float uMaskFeather[8];uniform float uMaskBounds[4];uniform float uMaskOpacity;float mask(float x,float y,float bounds[4],float opacity){return 1.0-(1.0-(smoothstep(bounds[3],bounds[3]+1.0,x)*(1.0-smoothstep(bounds[1]-1.0,bounds[1],x))*(1.0-step(bounds[0],y))*step(bounds[2],y)))*(1.0-opacity);}",init:"\nfloat a=1.0;vec4 fillColor=uColor;vec4 textureColor=texture(uTexture,vTexCoord);textureColor*=(1.0-step(uRepeat.y,vTexCoord.y))*step(0.0,vTexCoord.y)*(1.0-step(uRepeat.x,vTexCoord.x))*step(0.0,vTexCoord.x);",colorize:"\nif(uTextureColor.a!=0.0&&textureColor.a>0.0){vec3 colorFlattened=textureColor.rgb/textureColor.a;if(colorFlattened.r>=.9999&&colorFlattened.g==0.0&&colorFlattened.b>=.9999){textureColor.rgb=uTextureColor.rgb*textureColor.a;}textureColor*=uTextureColor.a;}",maskapply:"\nfloat m=mask(gl_FragCoord.x,gl_FragCoord.y,uMaskBounds,uMaskOpacity);",maskfeatherapply:"\nfloat leftFeatherOpacity=step(uMaskFeather[1],gl_FragCoord.x)*uMaskFeather[0]+((1.0-uMaskFeather[0])*smoothstep(uMaskFeather[1],uMaskFeather[3],gl_FragCoord.x));float rightFeatherOpacity=(1.0-step(uMaskFeather[7],gl_FragCoord.x))*uMaskFeather[4]+((1.0-uMaskFeather[4])*smoothstep(uMaskFeather[7],uMaskFeather[5],gl_FragCoord.x));a*=leftFeatherOpacity*rightFeatherOpacity;",rectaa:"\nvec2 scaledPoint=vec2(vRectCoord.x*uSize.x,vRectCoord.y*uSize.y);a*=smoothstep(0.0,uEdgeFeather,uSize.x-scaledPoint.x);a*=smoothstep(0.0,uEdgeFeather,uSize.y-scaledPoint.y);a*=smoothstep(0.0,uEdgeFeather,scaledPoint.x);a*=smoothstep(0.0,uEdgeFeather,scaledPoint.y);",cornerradius:"\nvec2 s=(uSize-2.0)*.5;vec2 r=(vRectCoord*uSize)-1.0;vec2 p=r-s;float cornerRadius=uCornerRadius[0];bool left=r.x<s.x;bool top=r.y<s.y;if(!left&&top){cornerRadius=uCornerRadius[1];}if(!left&&!top){cornerRadius=uCornerRadius[3];}if(left&&!top){cornerRadius=uCornerRadius[2];}a*=1.0-clamp(length(max(abs(p)-(s-cornerRadius),0.0))-cornerRadius,0.0,1.0);",fragcolor:"\nif(m<=0.0)discard;fillColor.a*=a;fillColor.rgb*=fillColor.a;fillColor.rgb*=m;fillColor.rgb+=(1.0-m)*(uCanvasColor.rgb*fillColor.a);textureColor*=uTextureOpacity;textureColor.a*=a;textureColor.rgb*=m*a;textureColor.rgb+=(1.0-m)*(uCanvasColor.rgb*textureColor.a);fragColor=textureColor+(fillColor*(1.0-textureColor.a));"},Zl=(e,t,o)=>{const i=e.createShader(o),n=((e,t,o)=>(t=jl(t,o===e.VERTEX_SHADER?Ul:Gl,"##").trim(),Nl()?t:(t=(t=t.replace(/#version.+/gm,"").trim()).replace(/^\/\/\#/gm,"#"),o===e.VERTEX_SHADER&&(t=t.replace(/in /gm,"attribute ").replace(/out /g,"varying ")),o===e.FRAGMENT_SHADER&&(t=t.replace(/in /gm,"varying ").replace(/out.*?;/gm,"").replace(/texture\(/g,"texture2D(").replace(/fragColor/g,"gl_FragColor")),`${t}`)))(e,t,o);return e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||console.error(e.getShaderInfoLog(i)),i},Xl=(e,t,o,i,n)=>{const r=Zl(e,t,e.VERTEX_SHADER),a=Zl(e,o,e.FRAGMENT_SHADER),s=e.createProgram();e.attachShader(s,r),e.attachShader(s,a),e.linkProgram(s);const l={};return i.forEach(t=>{l[t]=e.getAttribLocation(s,t)}),n.forEach(t=>{l[t]=e.getUniformLocation(s,t)}),{program:s,locations:l,destroy(){e.detachShader(s,r),e.detachShader(s,a),e.deleteShader(r),e.deleteShader(a),e.deleteProgram(s)}}},Yl=e=>"VIDEO"!==e.nodeName&&(!!Nl()||Hl(e.width)&&Hl(e.height)),ql=(e,t,o,i)=>{const{premultiply:n=!0}=i;return e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n),e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o),((e,t,o)=>{e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,Yl(t)?e.LINEAR_MIPMAP_LINEAR:e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o.filterParam),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o.wrapParam),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o.wrapParam),Yl(t)&&e.generateMipmap(e.TEXTURE_2D)})(e,o,i),e.bindTexture(e.TEXTURE_2D,null),t},Kl=(e,t=1)=>e?[e[0],e[1],e[2],No(e[3])?t*e[3]:t]:[0,0,0,0],Jl=()=>{const e=new Float32Array(16);return e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},Ql=(e,t,o,i,n,r,a)=>{const s=1/(t-o),l=1/(i-n),c=1/(r-a);e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+o)*s,e[13]=(n+i)*l,e[14]=(a+r)*c,e[15]=1},ec=(e,t,o,i)=>{e[12]=e[0]*t+e[4]*o+e[8]*i+e[12],e[13]=e[1]*t+e[5]*o+e[9]*i+e[13],e[14]=e[2]*t+e[6]*o+e[10]*i+e[14],e[15]=e[3]*t+e[7]*o+e[11]*i+e[15]},tc=(e,t)=>{e[0]*=t,e[1]*=t,e[2]*=t,e[3]*=t,e[4]*=t,e[5]*=t,e[6]*=t,e[7]*=t,e[8]*=t,e[9]*=t,e[10]*=t,e[11]*=t},oc=(e,t)=>{const o=Math.sin(t),i=Math.cos(t),n=e[4],r=e[5],a=e[6],s=e[7],l=e[8],c=e[9],d=e[10],u=e[11];e[4]=n*i+l*o,e[5]=r*i+c*o,e[6]=a*i+d*o,e[7]=s*i+u*o,e[8]=l*i-n*o,e[9]=c*i-r*o,e[10]=d*i-a*o,e[11]=u*i-s*o},ic=(e,t)=>{const o=Math.sin(t),i=Math.cos(t),n=e[0],r=e[1],a=e[2],s=e[3],l=e[8],c=e[9],d=e[10],u=e[11];e[0]=n*i-l*o,e[1]=r*i-c*o,e[2]=a*i-d*o,e[3]=s*i-u*o,e[8]=n*o+l*i,e[9]=r*o+c*i,e[10]=a*o+d*i,e[11]=s*o+u*i},nc=(e,t)=>{const o=Math.sin(t),i=Math.cos(t),n=e[0],r=e[1],a=e[2],s=e[3],l=e[4],c=e[5],d=e[6],u=e[7];e[0]=n*i+l*o,e[1]=r*i+c*o,e[2]=a*i+d*o,e[3]=s*i+u*o,e[4]=l*i-n*o,e[5]=c*i-r*o,e[6]=d*i-a*o,e[7]=u*i-s*o};var rc=e=>e*Math.PI/180,ac=(e,t)=>Nl()?e.getContext("webgl2",t):e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const sc=(e,t)=>{const o=e.length;return t>=o?e[t%o]:t<0?e[t%o+o]:e[t]},lc=(e,t,o,i)=>{const n=be(o.x-t.x,o.y-t.y),r=be(i.x-o.x,i.y-o.y),a=be(t.x-i.x,t.y-i.y),s=be(e.x-t.x,e.y-t.y),l=be(e.x-o.x,e.y-o.y),c=be(e.x-i.x,e.y-i.y),d=Fe(n,s),u=Fe(r,l),p=Fe(a,c);return d<=0&&u<=0&&p<=0},cc=e=>{if(e.length<3)return[];if((e=>{const t=e.length;for(let o=0;o<t;o++){const t=et(e[o],sc(e,o+1));if(Ot(t,e,{ignoreIdenticalLines:!0,breakOnIntersection:!0}))return!0}return!1})(e))return[];(e=>{let t,o,i,n,r,a=0;const s=e.length;for(t=0;t<s;t++)o=e[t],i=e[(t+1)%s],n=i.x-o.x,r=(i.y+o.y)/2,a+=n*r;return a})(e)<0&&e.reverse();const t=e.length,o=[...Array(t).keys()],i=[];let n,r,a,s,l,c,d,u,p,h,m,g,$=1024;for(;o.length>3;){if($<=0)return[];for($--,n=0;n<o.length;n++)if(a=o[n],s=sc(o,n-1),l=sc(o,n+1),c=e[a],d=e[s],u=e[l],p=be(d.x-c.x,d.y-c.y),h=be(u.x-c.x,u.y-c.y),!(Fe(p,h)<0)){for(m=!0,r=0;r<t;r++)if(r!==a&&r!==s&&r!==l&&(g=e[r],lc(g,d,c,u))){m=!1;break}if(m){i.push([d,c,u]),o.splice(n,1);break}}}return i.push([e[o[0]],e[o[1]],e[o[2]]]),i},dc=(e,t,o,i,n)=>{const r=Ce(be(i.x-o.x,i.y-o.y)),a=Ce(be(n.x-i.x,n.y-i.y)),s=Ce(be(r.x+a.x,r.y+a.y)),l=be(-s.y,s.x),c=be(-r.y,r.x),d=Math.min(1/Le(l,c),5);e[t]=i.x,e[t+1]=i.y,e[t+2]=l.x*d,e[t+3]=l.y*d,e[t+4]=-1,e[t+5]=i.x,e[t+6]=i.y,e[t+7]=l.x*d,e[t+8]=l.y*d,e[t+9]=1},uc=e=>{const t=new Float32Array(8);return t[0]=e[3].x,t[1]=e[3].y,t[2]=e[0].x,t[3]=e[0].y,t[4]=e[2].x,t[5]=e[2].y,t[6]=e[1].x,t[7]=e[1].y,t},pc=(e,t=0,o,i)=>{const n=It(e),r=e.x+.5*e.width,a=e.y+.5*e.height;return(o||i)&&We(n,o,i,r,a),0!==t&&_e(n,t,r,a),n},hc=(e,t,o,i,n)=>{const r=Math.min(20,Math.max(4,Math.round(i/2)));let a=0,s=0,l=0,c=0,d=0;for(;d<r;d++)a=d/r,s=n*oe+a*oe,l=i*Math.cos(s),c=i*Math.sin(s),e.push(be(t+l,o+c))};let mc=null;var gc=()=>{if(null!==mc)return mc;let e=x("canvas");const t=ac(e);return mc=t?t.getParameter(t.MAX_TEXTURE_SIZE):void 0,S(e),e=void 0,mc},$c=()=>m()&&!!window.chrome;const fc=new Float32Array([0,1,0,0,1,1,1,0]),yc=new Float32Array([1,0,0,0,1,1,0,1]),bc=m()&&N(),xc=[0,0,0,0,1,0,0,0,0],vc=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],Sc=[0,0,0,0],wc=[0,0,0,0],kc=(e,t,o,i,n)=>{if(!o||!i)return fc;let r=i.x/o.width,a=i.y/o.height,s=e/o.width/n,l=t/o.height/n;s-=r,l-=a;return new Float32Array([-r,l,-r,-a,s,l,s,-a])};var Cc=(e,t={})=>{const{alpha:o=!1}=t,i={width:0,height:0},n={width:0,height:0},r=gc()||1024;let a,s,l;const c=Jl(),d=Jl();let u,p,h,m,g,$,f,y,b,x=0,v=0,w=0,k=1;const C=new Map([]),T=()=>{R.stencilOp(R.KEEP,R.KEEP,R.KEEP),R.stencilFunc(R.ALWAYS,1,255),R.stencilMask(255)},M=rc(30),P=Math.tan(M/2),R=ac(e,{alpha:o,antialias:!1,premultipliedAlpha:!0,stencil:!0});if(!R)return;R.getExtension("OES_standard_derivatives"),R.disable(R.DEPTH_TEST),R.enable(R.STENCIL_TEST),R.enable(R.BLEND),R.blendFunc(R.ONE,R.ONE_MINUS_SRC_ALPHA),T();const I=R.createTexture();R.bindTexture(R.TEXTURE_2D,I),R.texImage2D(R.TEXTURE_2D,0,R.RGBA,1,1,0,R.RGBA,R.UNSIGNED_BYTE,new Uint8Array(Sc)),C.set(0,I);const E=R.createTexture();C.set(2,E);const A=R.createFramebuffer(),L=R.createTexture();C.set(1,L);const F=R.createFramebuffer(),z=Xl(R,"\n##head\n##text\nvoid main(){vTexCoord=aTexCoord;gl_Position=uMatrix*aPosition;}","\n##head\nin vec2 vTexCoord;uniform sampler2D uTexture;uniform sampler2D uTextureOverlay;uniform sampler2D uTextureBlend;uniform vec2 uTextureSize;uniform float uOpacity;uniform int uAntialias;uniform vec4 uOverlayColor;uniform mat4 uColorMatrix;uniform vec4 uColorOffset;uniform float uClarityKernel[9];uniform float uClarityKernelWeight;uniform float uColorGamma;uniform float uColorVignette;uniform float uMaskClip;uniform float uMaskOpacity;uniform float uMaskBounds[4];uniform float uMaskCornerRadius[4];uniform float uMaskFeather[8];vec4 applyGamma(vec4 c,float g){c.r=pow(c.r,g);c.g=pow(c.g,g);c.b=pow(c.b,g);return c;}vec4 applyColorMatrix(vec4 c,mat4 m,vec4 o){vec4 res=(c*m)+(o*c.a);res=clamp(res,0.0,1.0);return res;}vec4 applyConvolutionMatrix(vec4 c,float k0,float k1,float k2,float k3,float k4,float k5,float k6,float k7,float k8,float w){vec2 pixel=vec2(1)/uTextureSize;vec4 colorSum=texture(uTexture,vTexCoord-pixel)*k0+texture(uTexture,vTexCoord+pixel*vec2(0.0,-1.0))*k1+texture(uTexture,vTexCoord+pixel*vec2(1.0,-1.0))*k2+texture(uTexture,vTexCoord+pixel*vec2(-1.0,0.0))*k3+texture(uTexture,vTexCoord)*k4+texture(uTexture,vTexCoord+pixel*vec2(1.0,0.0))*k5+texture(uTexture,vTexCoord+pixel*vec2(-1.0,1.0))*k6+texture(uTexture,vTexCoord+pixel*vec2(0.0,1.0))*k7+texture(uTexture,vTexCoord+pixel)*k8;vec4 color=vec4(clamp((colorSum/w),0.0,1.0).rgb,c.a);return color;}vec4 blendPremultipliedAlpha(vec4 back,vec4 front){return front+(back*(1.0-front.a));}vec4 applyVignette(vec4 c,vec2 pos,vec2 center,float v){float d=distance(pos,center)/length(center);float f=1.0-(d*abs(v));if(v>0.0){c.rgb*=f;}else if(v<0.0){c.rgb+=(1.0-f)*(1.0-c.rgb);}return c;}void main(){float x=gl_FragCoord.x;float y=gl_FragCoord.y;float a=1.0;float maskTop=uMaskBounds[0];float maskRight=uMaskBounds[1];float maskBottom=uMaskBounds[2];float maskLeft=uMaskBounds[3];float leftFeatherOpacity=step(uMaskFeather[1],x)*uMaskFeather[0]+((1.0-uMaskFeather[0])*smoothstep(uMaskFeather[1],uMaskFeather[3],x));float rightFeatherOpacity=(1.0-step(uMaskFeather[7],x))*uMaskFeather[4]+((1.0-uMaskFeather[4])*smoothstep(uMaskFeather[7],uMaskFeather[5],x));a*=leftFeatherOpacity*rightFeatherOpacity;float overlayColorAlpha=(smoothstep(maskLeft,maskLeft+1.0,x)*(1.0-smoothstep(maskRight-1.0,maskRight,x))*(1.0-step(maskTop,y))*step(maskBottom,y));if(uOverlayColor.a==0.0){a*=overlayColorAlpha;}vec2 offset=vec2(maskLeft,maskBottom);vec2 size=vec2(maskRight-maskLeft,maskTop-maskBottom)*.5;vec2 center=offset.xy+size.xy;int pixelX=int(step(center.x,x));int pixelY=int(step(y,center.y));float cornerRadius=0.0;if(pixelX==0&&pixelY==0)cornerRadius=uMaskCornerRadius[0];if(pixelX==1&&pixelY==0)cornerRadius=uMaskCornerRadius[1];if(pixelX==0&&pixelY==1)cornerRadius=uMaskCornerRadius[2];if(pixelX==1&&pixelY==1)cornerRadius=uMaskCornerRadius[3];float cornerOffset=sign(cornerRadius)*length(max(abs(gl_FragCoord.xy-size-offset)-size+cornerRadius,0.0))-cornerRadius;float cornerOpacity=1.0-smoothstep(0.0,1.0,cornerOffset);a*=cornerOpacity;if(uAntialias==1){vec2 scaledPoint=vec2(vTexCoord.x*uTextureSize.x,vTexCoord.y*uTextureSize.y);a*=smoothstep(0.0,1.0,uTextureSize.x-scaledPoint.x);a*=smoothstep(0.0,1.0,uTextureSize.y-scaledPoint.y);a*=smoothstep(0.0,1.0,scaledPoint.x);a*=smoothstep(0.0,1.0,scaledPoint.y);}vec4 color=texture(uTexture,vTexCoord);if(uClarityKernelWeight!=-1.0){color=applyConvolutionMatrix(color,uClarityKernel[0],uClarityKernel[1],uClarityKernel[2],uClarityKernel[3],uClarityKernel[4],uClarityKernel[5],uClarityKernel[6],uClarityKernel[7],uClarityKernel[8],uClarityKernelWeight);}color=blendPremultipliedAlpha(color,texture(uTextureBlend,vTexCoord));color=applyGamma(color,uColorGamma);color=applyColorMatrix(color,uColorMatrix,uColorOffset);color*=a;if(uColorVignette!=0.0){vec2 pos=gl_FragCoord.xy-offset;color=applyVignette(color,pos,center-offset,uColorVignette);}color=blendPremultipliedAlpha(color,texture(uTextureOverlay,vTexCoord));if(overlayColorAlpha<=0.0){color*=1.0-uOverlayColor.a;}color*=uOpacity;fragColor=color;}",["aPosition","aTexCoord"],["uMatrix","uTexture","uTextureBlend","uTextureOverlay","uTextureSize","uColorGamma","uColorVignette","uColorOffset","uColorMatrix","uClarityKernel","uClarityKernelWeight","uOpacity","uMaskOpacity","uMaskBounds","uMaskCornerRadius","uMaskFeather","uOverlayColor","uAntialias"]),D=R.createBuffer(),O=R.createBuffer();R.bindBuffer(R.ARRAY_BUFFER,O),R.bufferData(R.ARRAY_BUFFER,fc,R.STATIC_DRAW);const B=R.createBuffer();R.bindBuffer(R.ARRAY_BUFFER,B),R.bufferData(R.ARRAY_BUFFER,yc,R.STATIC_DRAW);const W=Xl(R,"#version 300 es\n\nin vec4 aPosition;in vec2 aNormal;in float aMiter;out vec2 vNormal;out float vMiter;out float vWidth;uniform float uWidth;uniform float uSharpness;uniform mat4 uMatrix;void main(){vMiter=aMiter;vNormal=aNormal;vWidth=(uWidth*.5)+uSharpness;gl_Position=uMatrix*vec4(aPosition.x+(aNormal.x*vWidth*aMiter),aPosition.y+(aNormal.y*vWidth*aMiter),0,1);}","\n##head\n##mask\nin vec2 vNormal;in float vMiter;in float vWidth;uniform float uWidth;uniform vec4 uColor;uniform vec4 uCanvasColor;void main(){vec4 fillColor=uColor;float m=mask(gl_FragCoord.x,gl_FragCoord.y,uMaskBounds,uMaskOpacity);if(m<=0.0)discard;fillColor.a*=clamp(smoothstep(vWidth-.5,vWidth-1.0,abs(vMiter)*vWidth),0.0,1.0);fillColor.rgb*=fillColor.a;fillColor.rgb*=m;fillColor.rgb+=(1.0-m)*(uCanvasColor.rgb*fillColor.a);fragColor=fillColor;}",["aPosition","aNormal","aMiter"],["uColor","uCanvasColor","uMatrix","uWidth","uSharpness","uMaskBounds","uMaskOpacity"]),_=R.createBuffer();$c()&&(R.bindBuffer(R.ARRAY_BUFFER,_),R.bufferData(R.ARRAY_BUFFER,1,R.DYNAMIC_DRAW));const V=(e,t,o,i=!1)=>{const{program:n,locations:r}=W;R.useProgram(n),R.enableVertexAttribArray(r.aPosition),R.enableVertexAttribArray(r.aNormal),R.enableVertexAttribArray(r.aMiter);const a=((e,t)=>{let o,i,n,r=0;const a=e.length,s=new Float32Array(10*(t?a+1:a)),l=e[0],c=e[a-1];for(r=0;r<a;r++)o=e[r-1],i=e[r],n=e[r+1],o||(o=t?c:be(i.x+(i.x-n.x),i.y+(i.y-n.y))),n||(n=t?l:be(i.x+(i.x-o.x),i.y+(i.y-o.y))),dc(s,10*r,o,i,n);return t&&dc(s,10*a,c,l,e[1]),s})(e,i),s=5*Float32Array.BYTES_PER_ELEMENT,c=2*Float32Array.BYTES_PER_ELEMENT,d=4*Float32Array.BYTES_PER_ELEMENT;R.uniform1f(r.uWidth,t),R.uniform1f(r.uSharpness,l),R.uniform4fv(r.uColor,o),R.uniformMatrix4fv(r.uMatrix,!1,u),R.uniform4f(r.uCanvasColor,x,v,w,k),R.uniform1fv(r.uMaskBounds,f),R.uniform1f(r.uMaskOpacity,$),R.bindBuffer(R.ARRAY_BUFFER,_),R.bufferData(R.ARRAY_BUFFER,a,R.STATIC_DRAW),R.vertexAttribPointer(r.aPosition,2,R.FLOAT,!1,s,0),R.vertexAttribPointer(r.aNormal,2,R.FLOAT,!1,s,c),R.vertexAttribPointer(r.aMiter,1,R.FLOAT,!1,s,d),R.drawArrays(R.TRIANGLE_STRIP,0,a.length/5),R.disableVertexAttribArray(r.aPosition),R.disableVertexAttribArray(r.aNormal),R.disableVertexAttribArray(r.aMiter)},N=Xl(R,"\n##head\nvoid main(){\n##matrix\n}","\n##head\n##mask\nuniform vec4 uColor;uniform vec4 uCanvasColor;void main(){vec4 fillColor=uColor;\n##maskapply\nif(m<=0.0)discard;fillColor.rgb*=fillColor.a;fillColor.rgb*=m;fillColor.rgb+=(1.0-m)*(uCanvasColor.rgb*fillColor.a);fragColor=fillColor;}",["aPosition"],["uColor","uCanvasColor","uMatrix","uMaskBounds","uMaskOpacity"]),H=R.createBuffer(),j=Xl(R,"\n##head\n##text\nin vec2 aRectCoord;out vec2 vRectCoord;void main(){vTexCoord=aTexCoord;vRectCoord=aRectCoord;\n##matrix\n}","\n##head\n##mask\nin vec2 vTexCoord;in vec2 vRectCoord;uniform sampler2D uTexture;uniform vec4 uTextureColor;uniform float uTextureOpacity;uniform vec2 uRepeat;uniform vec4 uColor;uniform float uCornerRadius[4];uniform vec2 uSize;uniform vec2 uPosition;uniform vec4 uCanvasColor;uniform int uInverted;uniform float uEdgeFeather;void main(){\n##init\n##colorize\n##rectaa\n##cornerradius\n##maskfeatherapply\nif(uInverted==1)a=1.0-a;\n##maskapply\n##fragcolor\n}",["aPosition","aTexCoord","aRectCoord"],["uTexture","uColor","uMatrix","uCanvasColor","uTextureColor","uTextureOpacity","uRepeat","uPosition","uSize","uMaskBounds","uMaskOpacity","uMaskFeather","uCornerRadius","uInverted","uEdgeFeather"]),U=R.createBuffer(),G=R.createBuffer(),Z=R.createBuffer(),X=Xl(R,"\n##head\n##text\nout vec2 vTexCoordDouble;void main(){vTexCoordDouble=vec2(aTexCoord.x*2.0-1.0,aTexCoord.y*2.0-1.0);vTexCoord=aTexCoord;\n##matrix\n}","\n##head\n##mask\nin vec2 vTexCoord;in vec2 vTexCoordDouble;uniform sampler2D uTexture;uniform float uTextureOpacity;uniform vec2 uTextureAdjust;uniform vec2 uRepeat;uniform vec2 uRadius;uniform vec4 uColor;uniform int uInverted;uniform vec4 uCanvasColor;void main(){\n##init\nfloat ar=uRadius.x/uRadius.y;vec2 rAA=vec2(uRadius.x-1.0,uRadius.y-(1.0/ar));vec2 scaledPointSq=vec2((vTexCoordDouble.x*uTextureAdjust.x*uRadius.x)*(vTexCoordDouble.x*uTextureAdjust.x*uRadius.x),(vTexCoordDouble.y*uTextureAdjust.y*uRadius.y)*(vTexCoordDouble.y*uTextureAdjust.y*uRadius.y));float p=(scaledPointSq.x/(uRadius.x*uRadius.x))+(scaledPointSq.y/(uRadius.y*uRadius.y));float pAA=(scaledPointSq.x/(rAA.x*rAA.x))+(scaledPointSq.y/(rAA.y*rAA.y));a=smoothstep(1.0,p/pAA,p);if(uInverted==1)a=1.0-a;\n##maskapply\n##fragcolor\n}",["aPosition","aTexCoord"],["uTexture","uTextureOpacity","uTextureAdjust","uRepeat","uColor","uCanvasColor","uMatrix","uRadius","uInverted","uMaskBounds","uMaskOpacity"]),Y=R.createBuffer(),q=R.createBuffer(),K=new Map,J={2:{width:0,height:0},1:{width:0,height:0}},ee=(e,t,o,n=1)=>{const a=Math.min(Math.min(4096,r)/o.width,Math.min(4096,r)/o.height,n),l=Math.floor(a*o.width),c=Math.floor(a*o.height);Xe(o,J[e])?R.bindFramebuffer(R.FRAMEBUFFER,t):(R.bindTexture(R.TEXTURE_2D,C.get(e)),R.texImage2D(R.TEXTURE_2D,0,R.RGBA,l,c,0,R.RGBA,R.UNSIGNED_BYTE,null),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MIN_FILTER,R.LINEAR),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_WRAP_S,R.CLAMP_TO_EDGE),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_WRAP_T,R.CLAMP_TO_EDGE),R.bindFramebuffer(R.FRAMEBUFFER,t),R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,C.get(e),0),J[e]=o);const p=o.width*s,h=o.height*s;var m,g;Ql(d,0,p,h,0,-1,1),ec(d,0,h,0),g=1,(m=d)[0]*=g,m[1]*=g,m[2]*=g,m[3]*=g,((e,t)=>{e[4]*=t,e[5]*=t,e[6]*=t,e[7]*=t})(d,-1),u=d,R.viewport(0,0,l,c),R.colorMask(!0,!0,!0,!0),R.clearColor(0,0,0,0),R.clear(R.COLOR_BUFFER_BIT),b=[1,0,1,0,1,Math.max(i.width,o.width),1,Math.max(i.width,o.width)]},te=(e,t)=>{const{forceRelease:o=!1}=t||{},{src:i}=K.get(e);i instanceof HTMLCanvasElement&&(o||i.dataset.retain||S(i)),K.delete(e),R.deleteTexture(e)},oe=e=>K.get(e).isRotatedVideo;return{drawPath:(e,t=0,o=!1,i=!1,n,r,a,l,c)=>{if(e.length<2)return;const d=e.map(e=>({x:e.x*s,y:e.y*s})),p=n*s;if(p>0&&V(d,p,Kl(r,c),a),d.length<3||!l||0===l[3]||!a)return;const h=cc(d),m=new Float32Array(6*h.length);h.forEach(([e,t,o],i)=>{const n=6*i;m[n+0]=e.x,m[n+1]=e.y,m[n+2]=t.x,m[n+3]=t.y,m[n+4]=o.x,m[n+5]=o.y}),((e,t)=>{const{program:o,locations:i}=N;R.useProgram(o),R.enableVertexAttribArray(i.aPosition),R.uniform4fv(i.uColor,t),R.uniformMatrix4fv(i.uMatrix,!1,u),R.uniform1fv(i.uMaskBounds,f),R.uniform1f(i.uMaskOpacity,$),R.uniform4f(i.uCanvasColor,x,v,w,k),R.bindBuffer(R.ARRAY_BUFFER,H),R.bufferData(R.ARRAY_BUFFER,e,R.STATIC_DRAW),R.vertexAttribPointer(i.aPosition,2,R.FLOAT,!1,0,0),R.drawArrays(R.TRIANGLES,0,e.length/2),R.disableVertexAttribArray(i.aPosition)})(m,Kl(l,c))},drawRect:(e,t=0,o=!1,i=!1,n,r,a,l=void 0,c=void 0,d=!1,p=void 0,h,m,g,y=void 0,S=1/s,C,T)=>{const M=bt(rt(e),s),P=n.map(t=>((e,t)=>Math.floor(Rs(e,0,Math.min(.5*(t.width-1),.5*(t.height-1)))))(t||0,e)).map(e=>e*s);if(r||a){const e=rt(M);e.x-=.5,e.y-=.5,e.width+=1,e.height+=1;const n=pc(e,t,o,i),h=uc(n);let m;C&&(m=Kl(C),0===m[3]&&(m[3]=.001));const E=l&&d?[e.width/l.width,e.height/l.height]:[1,1];((e,t,o,i,n,r=I,a,l=1,c=Sc,d=fc,p=b,h=1,m)=>{const{program:g,locations:y}=j;R.useProgram(g),R.enableVertexAttribArray(y.aPosition),R.enableVertexAttribArray(y.aTexCoord),R.enableVertexAttribArray(y.aRectCoord),R.uniform4fv(y.uColor,n),R.uniform2fv(y.uSize,[t,o]),R.uniform2fv(y.uPosition,[e[2],e[3]]),R.uniform2fv(y.uRepeat,a),R.uniform1i(y.uInverted,m?1:0),R.uniform1fv(y.uCornerRadius,i),R.uniform4f(y.uCanvasColor,x,v,w,k),R.uniform1fv(y.uMaskFeather,p.map((e,t)=>t%2==0?e:e*s)),R.uniform1fv(y.uMaskBounds,f),R.uniform1f(y.uMaskOpacity,$),R.uniform1f(y.uEdgeFeather,Math.max(0,h)),R.uniformMatrix4fv(y.uMatrix,!1,u),R.uniform1i(y.uTexture,4),R.uniform4fv(y.uTextureColor,c),R.uniform1f(y.uTextureOpacity,l),R.activeTexture(R.TEXTURE0+4),R.bindTexture(R.TEXTURE_2D,r),R.bindBuffer(R.ARRAY_BUFFER,G),R.bufferData(R.ARRAY_BUFFER,d,R.STATIC_DRAW),R.vertexAttribPointer(y.aTexCoord,2,R.FLOAT,!1,0,0),R.bindBuffer(R.ARRAY_BUFFER,Z),R.bufferData(R.ARRAY_BUFFER,fc,R.STATIC_DRAW),R.vertexAttribPointer(y.aRectCoord,2,R.FLOAT,!1,0,0),R.bindBuffer(R.ARRAY_BUFFER,U),R.bufferData(R.ARRAY_BUFFER,e,R.STATIC_DRAW),R.vertexAttribPointer(y.aPosition,2,R.FLOAT,!1,0,0),R.drawArrays(R.TRIANGLE_STRIP,0,e.length/2),R.disableVertexAttribArray(y.aPosition),R.disableVertexAttribArray(y.aTexCoord),R.disableVertexAttribArray(y.aRectCoord)})(h,e.width,e.height,P,Kl(r,g),a,E,g,m,p?new Float32Array(p):kc(e.width,e.height,l,c,s),y,S*s,T)}h&&(h=Math.min(h,M.width,M.height),V(((e,t,o,i,n,r,a,s)=>{const l=[];if(r.every(e=>0===e))l.push(be(e,t),be(e+o,t),be(e+o,t+i),be(e,t+i));else{const[n,a,s,c]=r,d=e,u=e+o,p=t,h=t+i;l.push(be(d+n,p)),hc(l,u-a,p+a,a,-1),l.push(be(u,p+a)),hc(l,u-c,h-c,c,0),l.push(be(u-c,h)),hc(l,d+s,h-s,s,1),l.push(be(d,h-s)),hc(l,d+n,p+n,n,2)}return(a||s)&&We(l,a,s,e+.5*o,t+.5*i),n&&_e(l,n,e+.5*o,t+.5*i),l})(M.x,M.y,M.width,M.height,t,P,o,i),h*s,Kl(m,g),!0))},drawEllipse:(e,t,o,i,n,r,a,l,c=void 0,d=void 0,p=void 0,h,m,g,y)=>{const b=bt(ht(e.x-t,e.y-o,2*t,2*o),s);if(a||l){const e=rt(b);y||(e.x-=.5,e.y-=.5,e.width+=1,e.height+=1);const t=pc(e,i,n,r);((e,t,o,i,n=I,r,a=fc,l=1,c=!1)=>{const{program:d,locations:p}=X;R.useProgram(d),R.enableVertexAttribArray(p.aPosition),R.enableVertexAttribArray(p.aTexCoord),R.uniformMatrix4fv(p.uMatrix,!1,u),R.uniform2fv(p.uRadius,[.5*t,.5*o]),R.uniform2fv(p.uTextureAdjust,[r.width/(t/s),r.height/(o/s)]),R.uniform1i(p.uInverted,c?1:0),R.uniform4fv(p.uColor,i),R.uniform4f(p.uCanvasColor,x,v,w,k),R.uniform2fv(p.uRepeat,[1,1]),R.uniform1fv(p.uMaskBounds,f),R.uniform1f(p.uMaskOpacity,$),R.uniform1i(p.uTexture,4),R.uniform1f(p.uTextureOpacity,l),R.activeTexture(R.TEXTURE0+4),R.bindTexture(R.TEXTURE_2D,n),R.bindBuffer(R.ARRAY_BUFFER,q),R.bufferData(R.ARRAY_BUFFER,a,R.STATIC_DRAW),R.vertexAttribPointer(p.aTexCoord,2,R.FLOAT,!1,0,0),R.bindBuffer(R.ARRAY_BUFFER,Y),R.bufferData(R.ARRAY_BUFFER,e,R.STATIC_DRAW),R.vertexAttribPointer(p.aPosition,2,R.FLOAT,!1,0,0),R.drawArrays(R.TRIANGLE_STRIP,0,e.length/2),R.disableVertexAttribArray(p.aPosition),R.disableVertexAttribArray(p.aTexCoord)})(uc(t),e.width,e.height,Kl(a,g),l,c||Ze(e.width/s,e.height/s),p?new Float32Array(p):kc(e.width,e.height,c,d,s),g,y)}h&&V(((e,t,o,i,n,r,a)=>{const s=.5*Math.abs(o),l=.5*Math.abs(i),c=Math.abs(o)+Math.abs(i),d=Math.max(20,Math.round(c/6));return Ht(be(e+s,t+l),s,l,n,r,a,d)})(b.x,b.y,b.width,b.height,i,n,r),h*s,Kl(m,g),!0)},drawImage:(e,t,o,n,r,l,c,d,u,p,h=vc,m=1,g,b=1,x=0,v=y,S=wc,w=Sc,k=!1,T=!1,I=!0,E=!1)=>{const A=t.width*s,L=t.height*s,F=-.5*A,W=.5*L,_=.5*A,V=-.5*L,N=new Float32Array([F,V,0,F,W,0,_,V,0,_,W,0]);R.bindBuffer(R.ARRAY_BUFFER,D),R.bufferData(R.ARRAY_BUFFER,E?N.map(e=>Math.round(e)):N,R.STATIC_DRAW);const H=t.height/2/P*(i.height/t.height)*-1;r*=s,l*=s,o*=s,n*=s;const{program:j,locations:U}=z,G=Jl();((e,t,o,i,n)=>{const r=1/Math.tan(t/2),a=1/(i-n);e[0]=r/o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(n+i)*a,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*n*i*a,e[15]=0})(G,M,a,1,2*-H),ec(G,r,-l,H),ec(G,o,-n,0),nc(G,-u),tc(G,p),ec(G,-o,n,0),ic(G,d),oc(G,c),R.useProgram(j),R.enableVertexAttribArray(U.aPosition),R.enableVertexAttribArray(U.aTexCoord),R.uniform1i(U.uTexture,3),R.uniform2f(U.uTextureSize,t.width,t.height),R.activeTexture(R.TEXTURE0+3),R.bindTexture(R.TEXTURE_2D,e);const Z=T?1:0,X=C.get(Z);R.uniform1i(U.uTextureBlend,Z),R.activeTexture(R.TEXTURE0+Z),R.bindTexture(R.TEXTURE_2D,X);const Y=k?2:0,q=C.get(Y);R.uniform1i(U.uTextureOverlay,Y),R.activeTexture(R.TEXTURE0+Y),R.bindTexture(R.TEXTURE_2D,q),R.bindBuffer(R.ARRAY_BUFFER,D),R.vertexAttribPointer(U.aPosition,3,R.FLOAT,!1,0,0);const K=bc&&oe(e);let J;R.bindBuffer(R.ARRAY_BUFFER,K?B:O),R.vertexAttribPointer(U.aTexCoord,2,R.FLOAT,!1,0,0),R.uniformMatrix4fv(U.uMatrix,!1,G),R.uniform4fv(U.uOverlayColor,w),!g||Fs(g,xc)?(g=xc,J=-1):(J=g.reduce((e,t)=>e+t,0),J=J<=0?1:J),R.uniform1fv(U.uClarityKernel,g),R.uniform1f(U.uClarityKernelWeight,J),R.uniform1f(U.uColorGamma,1/b),R.uniform1f(U.uColorVignette,x),R.uniform1i(U.uAntialias,I?1:0),R.uniform4f(U.uColorOffset,h[4],h[9],h[14],h[19]),R.uniformMatrix4fv(U.uColorMatrix,!1,[h[0],h[1],h[2],h[3],h[5],h[6],h[7],h[8],h[10],h[11],h[12],h[13],h[15],h[16],h[17],h[18]]),R.uniform1f(U.uOpacity,m),R.uniform1f(U.uMaskOpacity,$),R.uniform1fv(U.uMaskBounds,f),R.uniform1fv(U.uMaskCornerRadius,S.map(e=>e*s)),R.uniform1fv(U.uMaskFeather,v.map((e,t)=>t%2==0?e:e*s)),R.drawArrays(R.TRIANGLE_STRIP,0,4),R.disableVertexAttribArray(U.aPosition),R.disableVertexAttribArray(U.aTexCoord)},textureFilterNearest:R.NEAREST,textureFilterLinear:R.LINEAR,textureClamp:R.CLAMP_TO_EDGE,textureRepeat:R.REPEAT,textureCreate:()=>R.createTexture(),textureUpdate:(e,t,o)=>(K.set(e,{src:t,options:o,isRotatedVideo:"VIDEO"===t.nodeName&&(t.dataset&&90==t.dataset.rotation||270==t.dataset.rotation)}),ql(R,e,t,o)),textureGetSize:e=>{const{src:t,options:o}=K.get(e),i=He(t);return o.scalar?Qe(i,e=>e/o.scalar):i},textureDelete:te,enablePreviewStencil:()=>{R.stencilOp(R.KEEP,R.KEEP,R.REPLACE),R.stencilFunc(R.ALWAYS,1,255),R.stencilMask(255)},applyPreviewStencil:()=>{R.stencilFunc(R.EQUAL,1,255),R.stencilMask(0)},disablePreviewStencil:T,setCanvasColor(e){x=e[0],v=e[1],w=e[2],k=o?e[3]:1,R.clear(R.COLOR_BUFFER_BIT)},resetCanvasMatrix:()=>{Ql(c,0,i.width,i.height,0,-1,1)},updateCanvasMatrix(e,t,o,n,r){const a=e.width,l=e.height,d=i.width*(.5/s),u=i.height*(.5/s),p={x:d+(o.x+t.x),y:u+(o.y+t.y)},h={x:p.x-t.x,y:p.y-t.y},m=.5*a,g=.5*l;we(h,r.z,p),Oe(h,n,p);ec(c,(h.x-m)*s,(h.y-g)*s,0),ec(c,m*s,g*s,0),nc(c,r.z);const $=r.x>Math.PI/2;oc(c,$?Math.PI:0);const f=r.y>Math.PI/2;ic(c,f?Math.PI:0),tc(c,n),ec(c,-m*s,-g*s,0)},drawToCanvas(){R.bindFramebuffer(R.FRAMEBUFFER,null),u=c,R.viewport(0,0,R.drawingBufferWidth,R.drawingBufferHeight),R.colorMask(!0,!0,!0,!0),R.clearColor(x,v,w,k),R.clear(R.COLOR_BUFFER_BIT),b=[1,0,1,0,1,i.width,1,i.width]},drawToImageBlendBuffer(e,t){ee(1,F,e,t)},drawToImageOverlayBuffer(e,t){ee(2,A,e,t)},enableMask(e,t){const o=e.x*s,n=e.y*s,r=e.width*s,a=e.height*s;g=o,h=g+r,p=i.height-n,m=i.height-(n+a),$=1-t,f=[p,h,m,g]},disableMask(){g=0,h=i.width,p=i.height,m=0,$=1,f=[p,h,m,g]},resize:(t,o,r)=>{s=Math.max(1,r),l=1===s?.75:1,n.width=t,n.height=o,i.width=t*s,i.height=o*s,a=Q(i.width,i.height),e.width=i.width,e.height=i.height,Ql(c,0,i.width,i.height,0,-1,1),y=[1,0,1,0,1,n.width,1,n.width]},release(){Array.from(K.keys()).forEach(e=>te(e,{forceRelease:!0})),K.clear(),C.forEach(e=>{R.deleteTexture(e)}),C.clear(),z.destroy(),W.destroy(),N.destroy(),j.destroy(),X.destroy(),e.width=1,e.height=1,e=void 0}}},Tc=e=>e%2==0?e:e+1;var Mc=(e,t)=>{const{imageData:o,amount:i=1}=e,n=Math.round(2*Math.max(1,i)),r=Math.round(.5*n),a=o.width,s=o.height,l=o.colorSpace,c=new Uint8ClampedArray(a*s*4),d=o.data;let u,p,h,m,g,$=0,f=0,y=0;const b=a*s*4-4;for(h=0;h<s;h++)for(u=crypto.getRandomValues(new Uint8ClampedArray(s)),p=0;p<a;p++)m=u[h]/255,f=0,y=0,m<.5&&(f=4*(-r+Math.round(Math.random()*n))),m>.5&&(y=(-r+Math.round(Math.random()*n))*(4*a)),g=Math.min(Math.max(0,$+f+y),b),c[$]=d[g],c[$+1]=d[g+1],c[$+2]=d[g+2],c[$+3]=d[g+3],$+=4;t(null,{data:c,width:o.width,height:o.height,colorSpace:l})};const Pc=[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625];function Rc(e){return"[object Date]"===Object.prototype.toString.call(e)}function Ic(e){return Math.sqrt(1- --e*e)}function Ec(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)=>Ec(e[o],t));return e=>o.map(t=>t(e))}if("object"===o){if(!e||!t)throw new Error("Object cannot be null");if(Rc(e)&&Rc(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]=Ec(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 Ac(e,t={}){const o=ls(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=pr,interpolate:p=Ec}=hr(hr({},t),a);if(0===d)return s&&(s.abort(),s=null),o.set(e=n),Promise.resolve();const h=Fr()+c;let m;return i=Br(t=>{if(t<h)return!0;l||(m=p(e,r),"function"==typeof d&&(d=d(e,r)),l=!0),s&&(s.abort(),s=null);const i=t-h;return i>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 Lc(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.opts.precision&&Math.abs(n)<e.opts.precision?i:(e.settled=!1,o+a)}if(Uo(o))return o.map((n,r)=>Lc(e,t[r],o[r],i[r]));if("object"==typeof o){const n={};for(const r in o)n[r]=Lc(e,t[r],o[r],i[r]);return n}throw new Error(`Cannot spring ${typeof o} values`)}function Fc(e,t={}){const o=ls(e),{stiffness:i=.15,damping:n=.8,precision:r=.01}=t;let a,s,l,c=e,d=e,u=1,p=0,h=!1;function m(t,i={}){d=t;const n=l={};if(null==e||i.hard||g.stiffness>=1&&g.damping>=1)return h=!0,a=null,c=t,o.set(e=d),Promise.resolve();if(i.soft){const e=!0===i.soft?.5:+i.soft;p=1/(60*e),u=0}if(!s){a=null,h=!1;const t={inv_mass:void 0,opts:g,settled:!0,dt:void 0};s=Br(i=>{if(null===a&&(a=i),h)return h=!1,s=null,!1;u=Math.min(u+p,1),t.inv_mass=u,t.opts=g,t.settled=!0,t.dt=60*(i-a)/1e3;const n=Lc(t,c,e,d);return a=i,c=e,o.set(e=n),t.settled&&(s=null),!t.settled})}return new Promise(e=>{s.promise.then(()=>{n===l&&e()})})}const g={set:m,update:(t,o)=>m(t(d,e),o),subscribe:o.subscribe,stiffness:i,damping:n,precision:r};return g}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");var zc=ss(!1,e=>{const t=window.matchMedia("(prefers-reduced-motion:reduce)"),o=()=>e(t.matches);return o(),t.addListener(o),()=>t.removeListener(o)}),Dc=()=>"ResizeObserver"in window;const Oc=at(),Bc=(e,t,o,i,n)=>{e.rect||(e.rect=at());const r=e.rect;St(Oc,t,o,i,n),xt(r,Oc)||(wt(r,Oc),e.dispatchEvent(new CustomEvent("measure",{detail:r})))},Wc=Math.round,_c=e=>{const t=e.getBoundingClientRect();Hc&&Bc(e,Wc(t.x),Wc(t.y),Wc(t.width),Wc(t.height))},Vc=e=>{Hc&&Bc(e,e.offsetLeft,e.offsetTop,e.offsetWidth,e.offsetHeight)},Nc=[];let Hc,jc,Uc;function Gc(){Nc.length?(Nc.forEach(e=>e.measure(e)),Hc=requestAnimationFrame(Gc)):Hc=void 0}let Zc=new Map([]),Xc=0,Yc=0;var qc=(e,t={})=>{const{observePosition:o=!1,observeViewRect:i=!1,once:n=!1,disabled:r=!1,isMeasureRoot:a=!1}=t;if(Dc()&&a&&(Uc||(Uc=new ResizeObserver(e=>{e.forEach(e=>{Zc.set(e.target,e.contentRect)});const t=Array.from(Zc.values()).some(({width:e,height:t})=>e>0&&t>0);t?t&&!1===Hc&&Gc():(Hc&&cancelAnimationFrame(Hc),Hc=!1)})),Uc.observe(e),Xc++),!r)return!Dc()||o||i?(e.measure=i?_c:Vc,Nc.push(e),void 0===Hc&&(Hc=requestAnimationFrame(Gc)),e.measure(e),{destroy(){a&&Uc&&(Zc.delete(e),Uc.unobserve(e),Xc--,0===Xc&&(Uc.disconnect(),Uc=void 0));const t=Nc.indexOf(e);Nc.splice(t,1),delete e.measure}}):(jc||(jc=new ResizeObserver(e=>{e.forEach(e=>{Hc&&Vc(e.target)})})),jc.observe(e),Vc(e),n?jc.unobserve(e):Yc++,{destroy(){a&&Uc&&(Zc.delete(e),Uc.unobserve(e),Xc--,0===Xc&&(Uc.disconnect(),Uc=void 0)),n||(jc.unobserve(e),Yc--,0===Yc&&(jc.disconnect(),jc=void 0))}})},Kc=e=>{let t;const o={pointerdown:()=>{t=!1},keydown:()=>{t=!0},keyup:()=>{t=!1},focus:e=>{!1!==t&&(e.target.dataset.focusVisible="")},blur:e=>{delete e.target.dataset.focusVisible}};return Object.keys(o).forEach(t=>e.addEventListener(t,o[t],!0)),{destroy(){Object.keys(o).forEach(t=>e.removeEventListener(t,o[t],!0))}}};const Jc=e=>/^http/.test(e),Qc=e=>new Promise((t,o)=>"file"===e.kind?t(e.getAsFile()):"string"===e.kind?e.getAsString(t):void o());var ed=(e,t={})=>{const o=e=>{e.preventDefault()},i=async o=>{o.preventDefault(),o.stopPropagation();try{const i=await(e=>new Promise((t,o)=>{const{items:i}=e.dataTransfer;if(!i)return t([]);const n=Array.from(i).some(e=>"text/uri-list"===e.type),r=Array.from(i).filter(e=>("file"===e.kind||"string"===e.kind)&&"text/x-moz-url"!==e.type).map(Qc);Promise.all(r).then(e=>{if(n)return t([e.find(Jc)].filter(Boolean));const o=e.filter(e=>Ko(e)&&(so(e)||al(e))||Jc(e));t(o)}).catch(o)}))(o);e.dispatchEvent(new CustomEvent("dropfiles",{detail:{event:o,resources:i},...t}))}catch(e){}};function n(){e.removeEventListener("drop",i),e.removeEventListener("dragover",o)}function r(t){const{disabled:r=!1}=t||{};n(),r||(e.addEventListener("drop",i),e.addEventListener("dragover",o))}return r(t),{update:r,destroy(){n()}}};let td=null;var od=()=>{if(null===td)if(m()){const e=x("canvas");td=!ac(e,{failIfMajorPerformanceCaveat:!0}),S(e)}else td=!1;return td},id=e=>e instanceof WebGLTexture,nd=([e,t,o,i])=>[i.x,i.y,e.x,e.y,o.x,o.y,t.x,t.y];function rd(e){let t,o,i,n;return{c(){t=Ur("div"),o=Ur("canvas"),Qr(t,"class","PinturaCanvas")},m(r,a){Hr(r,t,a),_r(t,o),e[37](o),i||(n=[qr(o,"measure",e[38]),Ar(qc.call(null,o))],i=!0)},p:ur,i:ur,o:ur,d(o){o&&jr(t),e[37](null),i=!1,$r(n)}}}function ad(e,t,i){let n,r,a,s,l,c,d;const u=[0,0,0,0],p=ye(),h=m()&&(e=>{const t=.5*e,o=x("canvas",{"data-retain":!0,width:e,height:e}),i=o.getContext("2d");return i.fillStyle="#f0f",i.fillRect(0,0,t,t),i.fillRect(t,t,t,t),o})(128),g=xa();let $,{isAnimated:f}=t,{isTransparent:b}=t,{maskRect:v}=t,{maskOpacity:k=1}=t,{maskFrameOpacity:C=.95}=t,{maskMarkupOpacity:T=1}=t,{clipAnnotationsToImage:M=!0}=t,{pixelRatio:P=1}=t,{textPixelRatio:R=P}=t,{backgroundColor:I}=t,{willRender:E=ee}=t,{didRender:A=ee}=t,{willRequest:L}=t,{csp:F}=t,{loadImageData:z=ee}=t,{enableGrid:D=!1}=t,{gridColors:O}=t,{gridSize:B}=t,{gridOpacity:W=0}=t,{images:_=[]}=t,{interfaceImages:V=[]}=t,{selectionColor:H}=t,j=null,U=null,G=null;const Z=(e,t)=>e.set(t,{hard:!f}),X={precision:1e-4*.01};let Y=0;const q=Ac(void 0,{duration:0});wr(e,q,e=>i(36,d=e));const K=Fc(1,X);wr(e,K,e=>i(35,l=e));const J=Fc(1,X);wr(e,J,e=>i(51,a=e));const te=ls();wr(e,te,e=>i(53,c=e));const oe=ls();wr(e,oe,e=>i(52,s=e));const ie={},ne=(e,t)=>{let o=ie[e.id];const i=Math.min(1,2048/t.width);let n=o?o.element:x("canvas",{width:t.width*i,height:t.height*i,"data-retain":!0});if(!o||((e,t)=>{if(e.total!==t.length)return!0;const o=e.last,i=t[t.length-1];return o.drawMode!==i.drawMode||!(!Wi(o)||Wi(i)&&xt(o,i))||!(!_i(o)||_i(i)&&o.x===i.x&&o.y===i.y&&o.rx===i.rx&&o.ry===i.ry)||!(!Ni(o)||Ni(i)&&o.id===i.id&&o.points.length===i.points.length&&(!o.pointerPoint||!i.pointerPoint||Me(o.pointerPoint,i.pointerPoint)))})(o,e.actions)){n=n.cloneNode(),((e,t,o)=>{const{selectionColor:i=[1,1,1],scalar:n=1}=o||{},r=[...t];let a=!1;for(const t of r){const o="subtract"===t.drawMode;if(o&&!a)continue;e.globalCompositeOperation=o?"destination-out":"source-over",e.save(),e.beginPath();const s=Vn(t);if(Eo(e,n,n),Io(e,t.rotation,s),nr(e,t.flipX,t.flipY,s),t.width)Jn(e,{...t,backgroundColor:i});else if(t.points){let o;o=t.pathClose?{backgroundColor:i,strokeColor:i,strokeJoin:"round",bitmap:!0}:{strokeColor:i,strokeJoin:"round",strokeCap:"round"};const n=t.pointerPoint?[...t.points,t.pointerPoint]:t.points;if(ir(e,Object.assign({},t,{points:n},o)),t.pathClose&&t.strokeWidth){const e=3*t.strokeWidth,o=2*t.strokeWidth;r.push({...t.points[0],rx:e,ry:e,drawMode:"add"},{...t.points[0],rx:o,ry:o,drawMode:"subtract"})}}else t.rx&&Qn(e,{...t,backgroundColor:i,strokeColor:[0,0,0,0],strokeJoin:"round",strokeCap:"round"});e.restore(),a=!0}})(n.getContext("2d"),e.actions,{selectionColor:[1,0,1],scalar:i});const t=e.actions.length;ie[e.id]={total:t,last:{...e.actions[t-1]},element:n}}return{x:0,y:0,...t,fillColor:e.color||[1,1,1],backgroundImage:n}};let re;const ae=()=>{cancelAnimationFrame(re),re=requestAnimationFrame(()=>{Ie=!0,Ve=0,r()})},se=new Map([]),le=new Map([]),ce=(e,t)=>({filterParam:"pixelated"===e?j.textureFilterNearest:j.textureFilterLinear,wrapParam:"repeat"===t?j.textureRepeat:j.textureClamp}),de=(e,t,o)=>{if(!se.has(e)){se.set(e,e);const n=ce(t,o);if(!y(i=e)&&(vo(i)||w(i)||Nn(i)||co(i))){const t=j.textureCreate();j.textureUpdate(t,e,n),se.set(e,t)}else z(e).then(t=>{if(!j||!t)return;const o=j.textureCreate();j.textureUpdate(o,t,n),se.set(e,o),ae()}).catch(t=>{se.set(e,t)})}var i,n;if(co(e)&&((n=e).currentTime>0&&!n.paused&&!n.ended&&n.readyState>2||"true"===e.dataset.redraw)){const i=se.get(e),n=ce(t,o);return j.textureUpdate(i,e,n),e.dataset.redraw=!1,i}return se.get(e)},ue=(e,t={})=>{const o=t.id||e.id;if(e.width&&e.width<1||e.height&&e.height<1||!e.text.length)return void le.delete(o);let{text:i,textAlign:n,fontFamily:r,fontSize:a=16,fontWeight:s,fontVariant:l,fontStyle:c,letterSpacing:d,lineHeight:u=a,width:p,height:h}=e,{outline:m=0,blur:g=0,paddingTop:$=0,paddingRight:f=0,paddingBottom:y=0,paddingLeft:b=0}=t;p=No(p)?Math.floor(p):p,h=No(h)?Math.floor(h):h;const{textSize:v,signature:S}=((e="",t)=>{let{width:o=0,height:i="auto",fontSize:n,fontFamily:r,lineHeight:a,fontWeight:s,fontStyle:l,fontVariant:c,letterSpacing:d}=t;const u=ei({text:e,fontFamily:r,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:n,lineHeight:a,letterSpacing:d,width:o,height:i});let p=li.get(u);if(p)return p;let h=1;n>1e3&&N()&&(h=n/1e3,n=1e3,a*=h);const m=oo(x("pre",{contenteditable:"true",spellcheck:"false",style:`${di}${ai({fontFamily:r,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:n,letterSpacing:d,lineHeight:a})};${si(e,t)}"`,innerHTML:e})),g=m.getBoundingClientRect();return p={signature:ci(m).flat().map(e=>e.text).join("_;_"),textSize:Qe(He(g),e=>Math.ceil(e*h))},li.set(u,p),m.remove(),p})(i,{...e,width:p,height:void 0}),w=ei({text:i,textAlign:n,fontFamily:r,fontSize:a,fontWeight:s,fontVariant:l,fontStyle:c,lineHeight:u,letterSpacing:d,outline:m,blur:g,signature:S});if(!se.has(w)){se.set(w,i);const e=Math.ceil(v.width),t=Math.ceil(v.height);if(0===e||0===t)return;const x=gc(),S=Math.min(1,(x-(b+f)*R)/(e*R),(x-($+y)*R)/(t*R));Pi(i,{fontSize:a,fontFamily:r,fontWeight:s,fontVariant:l,fontStyle:c,letterSpacing:d,textAlign:n,lineHeight:u,width:p,height:h,imageWidth:e,imageHeight:t,paddingLeft:b,paddingTop:$,paddingRight:f,paddingBottom:y,pixelRatio:R*S,willRequest:L,outline:m,blur:g,styleNonce:F.styleNonce,color:[1,0,1]}).then(e=>{if(!j)return;const t=j.textureCreate();j.textureUpdate(t,e,{filterParam:j.textureFilterLinear,wrapParam:j.textureClamp,scalar:S,premultiply:!N()}),se.set(w,t),le.set(o,t),ae()}).catch(console.error)}const k=se.get(w);return id(k)?k:le.get(o)},pe=new Map,he=e=>{let t;return e.backgroundImage?t=de(e.backgroundImage,e.backgroundImageRendering,"repeat"===e.backgroundRepeat?"repeat":void 0):e.bitmap&&e.points&&(t=(e=>{const{id:t,points:o,strokeWidth:i,strokeCap:n,strokeJoin:r,strokeColor:a,strokeDash:s,pathClose:l,backgroundColor:c}=e;let d=se.get(t),u=pe.get(t);const p=ei({points:o.map(e=>`${e.x},${e.y}`).join(","),strokeWidth:i,strokeCap:n,strokeJoin:r,strokeColor:a,strokeDash:(s||[]).join(","),pathClose:l,backgroundColor:l?(c||[]).join(","):void 0});if(u){const{hash:e}=u;if(se.has(t)){if(p===e)return se.get(t)}else u=void 0}if(!u){const o=x("canvas",{width:1,height:1});u={canvas:o,hash:void 0},pe.set(e.id,u),d=j.textureCreate(),j.textureUpdate(d,o,{filterParam:j.textureFilterLinear,wrapParam:j.textureClamp}),se.set(t,d)}const{canvas:h}=u,m=Math.ceil(e.strokeWidth)+2,g=dt(o),$=Math.floor(g.x-.5*m),f=Math.floor(g.y-.5*m),y=Math.ceil(g.width+m),b=Math.ceil(g.height+m);h.width=Math.max(y,1),h.height=Math.max(b,1);const v=h.getContext("2d");return v.clearRect(0,0,h.width,h.height),y>=1&&b>=1&&(v.translate(-$,-f),ir(v,e),v.resetTransform()),j.textureUpdate(d,h,{filterParam:j.textureFilterLinear,wrapParam:j.textureClamp}),pe.set(t,{canvas:h,hash:p}),se.get(t)})(e)),t},me=({texture:e,size:t,origin:o,translation:i,rotation:n,scale:r,colorMatrix:a,opacity:s,convolutionMatrix:l,gamma:c,vignette:d,maskFeather:u,maskCornerRadius:p,overlayColor:h,enableOverlay:m,enableManipulation:g,enableAntialiasing:$})=>{let f=1===P,y=0,b=0;if(1===P){const e=Math.abs(1-r)<Number.EPSILON;y=e&&U%2!=0?.5:0,b=e&&G%2!=0?.5:0}return j.drawImage(e,t,o.x,o.y,i.x+y,i.y+b,n.x,n.y,n.z,r,a,Rs(s,0,1),l,c,d,u,p,h,m,g,$,f),e},ge=(e,t,o)=>{const i=mt(t),n=mt(e),r=i.x-n.x,a=i.y-n.y,s=we(i,o,n);return{x:s.x-n.x-r,y:s.y-n.y-a}},$e=(e,t,o,i,n)=>{if("left"===i&&!n)return 0;const r=e.width+2*t-o.width;return"left"===i?r:"center"===i?.5*r:"right"===i?n?0:r:0},fe=(e,t,o)=>{let i,n;const r=Q(o.width,o.height);if("repeat"===e.backgroundRepeat&&(i={...o},n={x:0,y:0}),"contain"===e.backgroundSize){const o=Pt(t,r,t);i=je(o),n=e.backgroundPosition?e.backgroundPosition:be(.5*(t.width-i.width),.5*(t.height-i.height))}else if("cover"===e.backgroundSize){const o=Mt(t,r,t);i=je(o),e.backgroundPosition?n=e.backgroundPosition:(n=be(o.x,o.y),n=be(.5*(t.width-i.width),.5*(t.height-i.height)))}else e.backgroundSize?(i=e.backgroundSize,n=e.backgroundPosition||{x:0,y:0}):e.backgroundPosition&&(i={...o},n=e.backgroundPosition);return{backgroundSize:i,backgroundPosition:n}},xe=(e=[],t)=>{e.forEach(e=>{let o=he(e);const i="complete"!==e.status&&("loading"===e.status||e.backgroundImage&&o===e.backgroundImage);i&&ae();const n="error"===e.status||e.backgroundImage&&o instanceof Error;let r=id(o)?o:void 0;const a=e._scale||1,s=e._translate||p,l=e.strokeWidth&&e.strokeWidth*a,c=e.cornerRadius?((e,t)=>[e,e,e,e].map(e=>e*t))(e.cornerRadius,a):u,d=!!e.width,h=y(e.text),m=Uo(e.points),g=_i(e);if(m){const i=e.points.map(e=>be(e.x*a+s.x,e.y*a+s.y));if(e.bitmap){o&&t.push(o);const n=dt(i),s=Math.ceil(e.strokeWidth*a)+2;j.drawRect({x:Math.floor(n.x-.5*s),y:Math.floor(n.y-.5*s),width:Math.ceil(n.width+s),height:Math.ceil(n.height+s)},e.rotation,e.flipX,e.flipY,[0,0,0,0],void 0,r,void 0,void 0,void 0,void 0,void 0,void 0,e.opacity,void 0,void 0,!1,!1)}else j.drawPath(i,e.rotation,e.flipX,e.flipY,l,e.strokeColor,e.pathClose,e.backgroundColor,e.opacity)}else if(g){let c=e.x,d=e.y;c*=a,d*=a,c+=s.x,d+=s.y;const u=ut({x:c,y:d,rx:e.rx*a,ry:e.ry*a}),p=be(c,d),h=r&&j.textureGetSize(r);let m,g;if(h&&e.backgroundImage&&(e.backgroundSize||e.backgroundPosition||e.backgroundRepeat)){const t=fe(e,u,h);m=t.backgroundSize,g=t.backgroundPosition}if(j.drawEllipse(p,e.rx*a,e.ry*a,e.rotation,e.flipX,e.flipY,e.backgroundColor,r,m,g,e.backgroundCorners&&nd(e.backgroundCorners),l,e.strokeColor,e.opacity,e.inverted),o&&t.push(o),i||n){if(!(e.backgroundColor||e.strokeColor&&e.strokeWidth)){const t=e.opacity||1;j.drawEllipse(p,e.rx*a,e.ry*a,e.rotation,e.flipX,e.flipY,n?[1,.2549,.2118,.25*t]:[0,0,0,.25*t])}n&&Pe(p),i&&Te(p)}}else if(h){const{fontSize:o=16}=e,i=o>1e3&&N()?o/1e3:1,n=Math.max(16,Math.ceil(o/i*.25)),r=Math.abs(e.rotation)>0,d=No(e.width)?Math.floor(e.width):e.width,p=No(e.height)?Math.floor(e.height):e.height,h=hi(e.text,{...e,width:d,height:p}),m=Math.ceil(h.width),g=Math.ceil(h.height),$={x:e.x*a+s.x,y:e.y*a+s.y,width:m*a,height:g*a},f=!!e.height;(e.backgroundColor||e.strokeColor)&&j.drawRect($,e.rotation,e.flipX,e.flipY,c,e.backgroundColor,void 0,void 0,void 0,!1,void 0,l,e.strokeColor,e.opacity,void 0,void 0,void 0,e.inverted);const{textShadowX:y,textShadowY:b,textShadowBlur:x}=e;if(y||b||x){const o=Math.ceil(.5*x),l=Math.max(n,f?0:o),c=ue(e,{id:e.id+"shadow",blur:x,paddingTop:l,paddingRight:l,paddingBottom:l,paddingLeft:l});if(c&&!e._prerender){t.push(c);const o=j.textureGetSize(c),l={x:0,y:0},d={width:o.width/R*a,height:o.height/R*a},u=n*a/i;let p;if(f)p={...$},l.x=y-u,l.y=b-u,"right"===e.textAlign?l.x+=p.width-(d.width-2*u):"center"===e.textAlign&&(l.x+=.5*(p.width-(d.width-2*u)));else{p={x:e.x*a+s.x-u,y:e.y*a+s.y-u,width:d.width,height:d.height};const t=$e($,u,d,e.textAlign,e.flipX);if(p.x+=t,r){const t=ge($,p,e.rotation);p.x+=t.x,p.y+=t.y;const o=we(be(y,b),e.rotation);p.x+=o.x,p.y+=o.y}else p.x+=y,p.y+=b}j.drawRect(p,e.rotation,e.flipX,e.flipY,[0,0,0,0],void 0,c,d,l,!1,void 0,void 0,void 0,e.opacity,void 0,0,e.textShadowColor)}}if(e.textOutlineWidth){const o=Math.ceil(.5*e.textOutlineWidth),l=n+o,c=ue(e,{id:e.id+"outline",outline:e.textOutlineWidth,paddingTop:l,paddingRight:l,paddingBottom:l,paddingLeft:l});if(c&&!e._prerender){t.push(c);const l=j.textureGetSize(c),d={x:0,y:0},u={width:l.width/R*a,height:l.height/R*a},p=(n+o)*a/i,h={x:e.x*a+s.x-p,y:e.y*a+s.y-p,width:u.width,height:e.height?g+p:u.height},m=$e($,p,u,e.textAlign,e.flipX);if(h.x+=m,r){const t=ge($,h,e.rotation);h.x+=t.x,h.y+=t.y}j.drawRect(h,e.rotation,e.flipX,e.flipY,[0,0,0,0],void 0,c,u,d,!1,void 0,void 0,void 0,e.opacity,void 0,0,e.textOutlineColor)}}const v=ue(e,{id:e.id+"text",paddingTop:n,paddingRight:n,paddingBottom:n,paddingLeft:n});if(v&&!e._prerender){t.push(v);const o=j.textureGetSize(v),l={x:0,y:0},c={width:o.width/R*a,height:o.height/R*a},d=n*a/i,p={x:e.x*a+s.x-d,y:e.y*a+s.y-d,width:c.width,height:e.height?g+d:c.height},h=$e($,d,c,e.textAlign,e.flipX);if(p.x+=h,r){const t=ge($,p,e.rotation);p.x+=t.x,p.y+=t.y}const m=e.color||[0,0,0];e._prerender&&(m[3]=0),j.drawRect(p,e.rotation,e.flipX,e.flipY,u,!1,v,c,l,!1,!1,void 0,void 0,e.opacity,void 0,e.feather,m,e.inverted)}}else if(d){o&&t.push(o);const d=ct(e);let u,p;a&&s&&(d.x*=a,d.y*=a,d.x+=s.x,d.y+=s.y,d.width*=a,d.height*=a);const{backgroundRepeat:h="no-repeat"}=e,m=r&&j.textureGetSize(r);if(m&&e.backgroundImage&&(e.backgroundSize||e.backgroundPosition||e.backgroundRepeat)){const t=fe(e,d,m);u=t.backgroundSize,p=t.backgroundPosition}if(j.drawRect(d,e.rotation,e.flipX,e.flipY,c,e.backgroundColor||[0,0,0,0],r,u,p,"repeat"===h,e.backgroundCorners&&nd(e.backgroundCorners),l,e.strokeColor,e.opacity,void 0,e.feather,e.fillColor,e.inverted),i||n){if(!(e.backgroundColor&&0!==e.backgroundColor[3]||e.strokeColor&&e.strokeWidth)){const t=e.opacity||1;j.drawRect(d,e.rotation,e.flipX,e.flipY,c,n?[1,.2549,.2118,.25*t]:[0,0,0,.25*t])}const t=mt(d);n&&Pe(t),i&&Te(t)}}else o&&t.push(o)})};let ve=0;const Se=[{x:-5,y:-5},{x:5,y:5}],ke=[{x:5,y:-5},{x:-5,y:5}],Ce=Ht({x:0,y:0},10,10,0,!1,!1,16);Ce.length=9;const Te=e=>{ve=Date.now()/50,j.drawEllipse(e,15,15,0,!1,!1,[0,0,0,.5]);const t=_e(Ce.map(t=>({x:t.x+e.x,y:t.y+e.y})),ve,e.x,e.y);j.drawPath(t,0,!1,!1,2,[1,1,1])},Pe=e=>{j.drawEllipse(e,13,13,0,!1,!1,[1,.2549,.2118,.75]);const t=Se.map(t=>({x:t.x+e.x,y:t.y+e.y})),o=ke.map(t=>({x:t.x+e.x,y:t.y+e.y}));j.drawPath(t,0,!1,!1,3,[1,1,1]),j.drawPath(o,0,!1,!1,3,[1,1,1])},Re=(e,t,o,i,n,r)=>j.drawRect(t,0,!1,!1,u,u,e,i,o,!0,void 0,0,void 0,r,void 0,void 0,n);let Ie=!1,Ee=!0,Ae=!1;const Le=[],Fe=[],ze=[],De=e=>!e.aboveFrame,Oe=e=>e.aboveFrame,Be=()=>{ze.length=0;const e=_[0],{manipulationShapes:t,manipulationShapesDirty:o,annotationShapes:i,annotationShapesDirty:n,interfaceShapes:r,decorationShapes:p,frameShapes:m,selectionShapes:g}=E({opacity:e.opacity,rotation:e.rotation,scale:e.scale,images:_,size:Ze(U,G),backgroundColor:[...d],selectionRect:c}),$=[...d],f=c,y=Rs(l,0,1),x=s,S=Math.abs(e.rotation.x/Math.PI*2-1),w=Math.abs(e.rotation.y/Math.PI*2-1),k=S<.99||w<.99,C={...e.size},P=e.backgroundColor,I=e.backgroundImage,L=e.backgroundFilterMode,F=t.length>0,z=i.length>0,N=i.filter(Oe).length>0,Z=p.filter(Oe).length>0,X=P[3]>0,Y=!!M&&T>=1;if(y<1&&X){const e=$[0],t=$[1],o=$[2],i=1-y,n=P[0]*i,r=P[1]*i,a=P[2]*i,s=1-i;$[0]=n+e*s,$[1]=r+t*s,$[2]=a+o*s,$[3]=1}j.setCanvasColor(b?u:$);F&&(o||Ie)?(j.disableMask(),j.drawToImageBlendBuffer(C),Le.length=0,xe(t,Le)):F||(Le.length=0),ze.push(...Le),Ee&&(j.drawToImageOverlayBuffer(C,R),Ee=!1);if(k){if(z&&(n||Ie)||!Ae){j.disableMask(),j.drawToImageOverlayBuffer(C,R),Fe.length=0;const e=N?i.filter(De):i;xe(e,Fe)}else z||(Fe.length=0);Ae=!0}else Ae=!1;if(j.drawToCanvas(),j.enableMask(f,y),D&&B>=1&&2===O.length&&W&&((e,t,o,i,n)=>{const r=Ze(t,t),a=de(h,"pixelated","repeat"),s=be(-e.x%t,-e.y%t),l=be(s.x+.5*r.width,s.y);Re(a,e,s,r,o,n),Re(a,e,l,r,i,n)})(f,B,O[0],O[1],W),X&&j.drawRect(f,0,!1,!1,u,P),I){j.enableMask(f,1);const e=Math.max(v.width/I.width,v.height/I.height),t=I.width*e,o=I.height*e,i={x:v.x+.5*v.width,y:v.y+.5*v.height,width:t,height:o},[n]=_,r=me({...n,vignette:"image"===L?n.vignette:void 0,gamma:"image"===L?n.gamma:void 0,convolutionMatrix:"image"===L?n.convolutionMatrix:void 0,colorMatrix:"image"===L?n.colorMatrix:void 0,size:{width:I.width,height:I.height},translation:{x:i.x-.5*U,y:i.y-.5*G},scale:e,origin:{x:0,y:0},rotation:{x:0,y:0,z:0},backgroundColor:[0,0,0,0],backgroundImage:null,enableAntialiasing:!1,texture:de(I)});ze.push(r),j.enableMask(f,y)}if(Y&&j.enablePreviewStencil(),ze.push(...[..._].reverse().map(e=>me({...e,texture:de(e.data),enableOverlay:k&&z,enableManipulation:F,enableAntialiasing:!0,mask:f,maskOpacity:y,overlayColor:x}))),j.enableMask(f,T),!k){Y&&j.applyPreviewStencil(),j.resetCanvasMatrix(),j.updateCanvasMatrix(C,e.origin,e.translation,e.scale,e.rotation),Fe.length=0;const t=N?i.filter(De):i;xe(t,Fe),Y&&j.disablePreviewStencil()}if(ze.push(...Fe),j.resetCanvasMatrix(),j.enableMask(f,T),xe(Z?p.filter(De):p,ze),m.length){j.enableMask(f,1);const e=m.filter(e=>!e.expandsCanvas),t=m.filter(e=>e.expandsCanvas);e.length&&xe(e,ze),t.length&&(j.enableMask({x:f.x+.5,y:f.y+.5,width:f.width-1,height:f.height-1},a),xe(t,ze))}if(N&&(j.resetCanvasMatrix(),j.updateCanvasMatrix(C,e.origin,e.translation,e.scale,e.rotation),xe(i.filter(Oe),ze),j.resetCanvasMatrix()),Z&&(j.resetCanvasMatrix(),xe(p.filter(Oe),ze),j.resetCanvasMatrix()),H&&g.length&&!k){j.resetCanvasMatrix(),j.updateCanvasMatrix(C,e.origin,e.translation,e.scale,e.rotation);const t=[...H];t[3]=.5;const o=[{id:"selection",color:t,actions:[...g]}].map(e=>ne(e,C));xe(o,ze),j.resetCanvasMatrix()}j.disableMask(),xe(r,ze),V.forEach(e=>{if(j.enableMask(e.mask,e.maskOpacity),I){const t=me({...e,vignette:"image"===L?e.vignette:void 0,gamma:"image"===L?e.gamma:void 0,convolutionMatrix:"image"===L?e.convolutionMatrix:void 0,colorMatrix:"image"===L?e.colorMatrix:void 0,texture:de(I),enableAntialiasing:!1,translation:{x:e.translation.x+e.offset.x-.5*U,y:e.translation.y+e.offset.y-.5*G}});ze.push(t)}else e.backgroundColor&&j.drawRect(e.mask,0,!1,!1,e.maskCornerRadius,e.backgroundColor,void 0,void 0,void 0,void 0,void 0,void 0,void 0,e.opacity,e.maskFeather);const t=me({...e,texture:de(e.data),enableAntialiasing:!1,translation:{x:e.translation.x+e.offset.x-.5*U,y:e.translation.y+e.offset.y-.5*G}});ze.push(t)}),j.disableMask(),(e=>{se.forEach((t,o)=>{!e.find(e=>e===t)&&id(t)&&(Array.from(le.values()).includes(t)||(se.delete(o),j.textureDelete(t)))})})(ze),A(),Ie=!1};let We,Ve=0;const Ne=()=>{clearTimeout(We);const e=Date.now();e-Ve<48?We=setTimeout(Ne,48):(Ve=e,Be())};ya(()=>r()),fa(()=>i(31,j=Cc($,{alpha:b}))),ba(()=>{j&&(pe.forEach(({canvas:e})=>S(e)),pe.clear(),j.release(),i(31,j=void 0),i(0,$=void 0))});return e.$$set=e=>{"isAnimated"in e&&i(9,f=e.isAnimated),"isTransparent"in e&&i(10,b=e.isTransparent),"maskRect"in e&&i(11,v=e.maskRect),"maskOpacity"in e&&i(12,k=e.maskOpacity),"maskFrameOpacity"in e&&i(13,C=e.maskFrameOpacity),"maskMarkupOpacity"in e&&i(14,T=e.maskMarkupOpacity),"clipAnnotationsToImage"in e&&i(15,M=e.clipAnnotationsToImage),"pixelRatio"in e&&i(16,P=e.pixelRatio),"textPixelRatio"in e&&i(17,R=e.textPixelRatio),"backgroundColor"in e&&i(18,I=e.backgroundColor),"willRender"in e&&i(19,E=e.willRender),"didRender"in e&&i(20,A=e.didRender),"willRequest"in e&&i(21,L=e.willRequest),"csp"in e&&i(22,F=e.csp),"loadImageData"in e&&i(23,z=e.loadImageData),"enableGrid"in e&&i(24,D=e.enableGrid),"gridColors"in e&&i(25,O=e.gridColors),"gridSize"in e&&i(26,B=e.gridSize),"gridOpacity"in e&&i(27,W=e.gridOpacity),"images"in e&&i(28,_=e.images),"interfaceImages"in e&&i(29,V=e.interfaceImages),"selectionColor"in e&&i(30,H=e.selectionColor)},e.$$.update=()=>{if(1&e.$$.dirty[0]&&$){const e=getComputedStyle($).getPropertyValue("--color-transition-duration");i(32,Y=(e=>{let t=parseFloat(e);return/^[0-9]+s$/.test(e)?1e3*t:t})(e))}262656&e.$$.dirty[0]|2&e.$$.dirty[1]&&I&&q.set(I,{duration:f?Y:0}),4096&e.$$.dirty[0]&&Z(K,No(k)?k:1),8192&e.$$.dirty[0]&&Z(J,No(C)?C:1),2048&e.$$.dirty[0]&&v&&te.set(v),48&e.$$.dirty[1]&&d&&oe.set([d[0],d[1],d[2],Rs(l,0,1)]),268435462&e.$$.dirty[0]|1&e.$$.dirty[1]&&i(34,n=!!(j&&U&&G&&_.length)),65542&e.$$.dirty[0]|1&e.$$.dirty[1]&&U&&G&&j&&(Ve=0,j.resize(U,G,P)),8&e.$$.dirty[1]&&i(33,r=n?od()?Ne:Be:o),12&e.$$.dirty[1]&&n&&r&&r()},[$,U,G,g,q,K,J,te,oe,f,b,v,k,C,T,M,P,R,I,E,A,L,F,z,D,O,B,W,_,V,H,j,Y,r,n,l,d,function(e){Ca[e?"unshift":"push"](()=>{$=e,i(0,$)})},e=>{i(1,U=e.detail.width),i(2,G=e.detail.height),g("measure",{width:U,height:G})}]}class sd extends rs{constructor(e){super(),ns(this,e,ad,rd,yr,{isAnimated:9,isTransparent:10,maskRect:11,maskOpacity:12,maskFrameOpacity:13,maskMarkupOpacity:14,clipAnnotationsToImage:15,pixelRatio:16,textPixelRatio:17,backgroundColor:18,willRender:19,didRender:20,willRequest:21,csp:22,loadImageData:23,enableGrid:24,gridColors:25,gridSize:26,gridOpacity:27,images:28,interfaceImages:29,selectionColor:30},null,[-1,-1,-1])}}var ld=(e,t=Boolean,o=" ")=>e.filter(t).join(o);function cd(e,t,o){const i=e.slice();return i[17]=t[o],i}const dd=e=>({tab:4&e}),ud=e=>({tab:e[17]});function pd(e){let t,o,i,n=[],r=new Map,a=Xa(e[2]);const s=e=>e[17].id;for(let t=0;t<a.length;t+=1){let o=cd(e,a,t),i=s(o);r.set(i,n[t]=hd(i,o))}return{c(){t=Ur("div");for(let e=0;e<n.length;e+=1)n[e].c();Qr(t,"class",o=ld(["PinturaTabList",e[0]])),Qr(t,"role","tablist"),Qr(t,"data-layout",e[1])},m(o,r){Hr(o,t,r);for(let e=0;e<n.length;e+=1)n[e]&&n[e].m(t,null);e[14](t),i=!0},p(e,l){1124&l&&(a=Xa(e[2]),Na(),n=Ka(n,l,s,1,e,a,r,t,qa,hd,null,cd),Ha()),(!i||1&l&&o!==(o=ld(["PinturaTabList",e[0]])))&&Qr(t,"class",o),(!i||2&l)&&Qr(t,"data-layout",e[1])},i(e){if(!i){for(let e=0;e<a.length;e+=1)ja(n[e]);i=!0}},o(e){for(let e=0;e<n.length;e+=1)Ua(n[e]);i=!1},d(o){o&&jr(t);for(let e=0;e<n.length;e+=1)n[e].d();e[14](null)}}}function hd(e,t){let o,i,n,r,a,s,l,c,d,u;const p=t[11].default,h=kr(p,t,t[10],ud);function m(...e){return t[12](t[17],...e)}function g(...e){return t[13](t[17],...e)}return{key:e,first:null,c(){o=Ur("button"),h&&h.c(),i=Xr(),Qr(o,"role","tab"),Qr(o,"title",n=t[17].title),Qr(o,"id",r=t[17].tabId),Qr(o,"aria-controls",a=t[17].href.substring(1)),Qr(o,"aria-selected",s=t[17].selected),o.disabled=l=t[17].disabled,Qr(o,"type","button"),this.first=o},m(e,t){Hr(e,o,t),h&&h.m(o,null),_r(o,i),c=!0,d||(u=[qr(o,"keydown",m),qr(o,"click",g)],d=!0)},p(e,i){t=e,h&&h.p&&(!c||1028&i)&&Mr(h,p,t,t[10],c?Tr(p,t[10],i,dd):Pr(t[10]),ud),(!c||4&i&&n!==(n=t[17].title))&&Qr(o,"title",n),(!c||4&i&&r!==(r=t[17].tabId))&&Qr(o,"id",r),(!c||4&i&&a!==(a=t[17].href.substring(1)))&&Qr(o,"aria-controls",a),(!c||4&i&&s!==(s=t[17].selected))&&Qr(o,"aria-selected",s),(!c||4&i&&l!==(l=t[17].disabled))&&(o.disabled=l)},i(e){c||(ja(h,e),c=!0)},o(e){Ua(h,e),c=!1},d(e){e&&jr(o),h&&h.d(e),d=!1,$r(u)}}}function md(e){let t,o,i=e[4]&&pd(e);return{c(){i&&i.c(),t=Yr()},m(e,n){i&&i.m(e,n),Hr(e,t,n),o=!0},p(e,[o]){e[4]?i?(i.p(e,o),16&o&&ja(i,1)):(i=pd(e),i.c(),ja(i,1),i.m(t.parentNode,t)):i&&(Na(),Ua(i,1,1,()=>{i=null}),Ha())},i(e){o||(ja(i),o=!0)},o(e){Ua(i),o=!1},d(e){e&&jr(t),i&&i.d(e)}}}function gd(e,t,o){let i,n,r,{$$slots:a={},$$scope:s}=t,{class:l}=t,{name:c}=t,{selected:d}=t,{tabs:u=[]}=t,{layout:p}=t;const h=xa(),m=e=>{const t=r.querySelectorAll('[role="tab"] button')[e];t&&t.focus()},g=(e,t)=>{e.preventDefault(),e.stopPropagation(),no()&&e.target.focus(),h("select",t)},$=({key:e},t)=>{if(!/arrow/i.test(e))return;const o=u.findIndex(e=>e.id===t);return/right|down/i.test(e)?m(o<u.length-1?o+1:0):/left|up/i.test(e)?m(o>0?o-1:u.length-1):void 0};return e.$$set=e=>{"class"in e&&o(0,l=e.class),"name"in e&&o(7,c=e.name),"selected"in e&&o(8,d=e.selected),"tabs"in e&&o(9,u=e.tabs),"layout"in e&&o(1,p=e.layout),"$$scope"in e&&o(10,s=e.$$scope)},e.$$.update=()=>{896&e.$$.dirty&&o(2,i=u.map(e=>{const t=e.id===d;return{...e,tabId:`tab-${c}-${e.id}`,href:`#panel-${c}-${e.id}`,selected:t}})),4&e.$$.dirty&&o(4,n=i.length>1)},[l,p,i,r,n,g,$,c,d,u,s,a,(e,t)=>$(t,e.id),(e,t)=>g(t,e.id),function(e){Ca[e?"unshift":"push"](()=>{r=e,o(3,r)})}]}class $d extends rs{constructor(e){super(),ns(this,e,gd,md,yr,{class:0,name:7,selected:8,tabs:9,layout:1})}}var fd=(e,t)=>{if(!t)return;const o=t=>{b(e,t)};return o(t),{update:o}};const yd=e=>({panel:16&e}),bd=e=>({panel:e[4][0].id,panelIsActive:!0});function xd(e,t,o){const i=e.slice();return i[14]=t[o].id,i[15]=t[o].shouldDraw,i[16]=t[o].panelId,i[17]=t[o].labelledBy,i[18]=t[o].isActive,i[19]=t[o].hidden,i[3]=t[o].visible,i}const vd=e=>({panel:16&e,panelIsActive:16&e}),Sd=e=>({panel:e[14],panelIsActive:e[18]});function wd(e){let t,o,i,n,r,a,s;const l=e[11].default,c=kr(l,e,e[10],bd);return{c(){t=Ur("div"),o=Ur("div"),c&&c.c(),Qr(o,"class",i=ld([e[1]])),Qr(t,"class",e[0])},m(i,l){Hr(i,t,l),_r(t,o),c&&c.m(o,null),r=!0,a||(s=[Ar(n=fd.call(null,t,e[2])),qr(t,"measure",e[13]),Ar(qc.call(null,t))],a=!0)},p(e,a){c&&c.p&&(!r||1040&a)&&Mr(c,l,e,e[10],r?Tr(l,e[10],a,yd):Pr(e[10]),bd),(!r||2&a&&i!==(i=ld([e[1]])))&&Qr(o,"class",i),(!r||1&a)&&Qr(t,"class",e[0]),n&&fr(n.update)&&4&a&&n.update.call(null,e[2])},i(e){r||(ja(c,e),r=!0)},o(e){Ua(c,e),r=!1},d(e){e&&jr(t),c&&c.d(e),a=!1,$r(s)}}}function kd(e){let t,o,i,n,r,a,s=[],l=new Map,c=Xa(e[4]);const d=e=>e[14];for(let t=0;t<c.length;t+=1){let o=xd(e,c,t),i=d(o);l.set(i,s[t]=Td(i,o))}return{c(){t=Ur("div");for(let e=0;e<s.length;e+=1)s[e].c();Qr(t,"class",o=ld(["PinturaTabPanels",e[0]]))},m(o,l){Hr(o,t,l);for(let e=0;e<s.length;e+=1)s[e]&&s[e].m(t,null);n=!0,r||(a=[Ar(i=fd.call(null,t,e[2])),qr(t,"measure",e[12]),Ar(qc.call(null,t,{observePosition:!0}))],r=!0)},p(e,r){1042&r&&(c=Xa(e[4]),Na(),s=Ka(s,r,d,1,e,c,l,t,qa,Td,null,xd),Ha()),(!n||1&r&&o!==(o=ld(["PinturaTabPanels",e[0]])))&&Qr(t,"class",o),i&&fr(i.update)&&4&r&&i.update.call(null,e[2])},i(e){if(!n){for(let e=0;e<c.length;e+=1)ja(s[e]);n=!0}},o(e){for(let e=0;e<s.length;e+=1)Ua(s[e]);n=!1},d(e){e&&jr(t);for(let e=0;e<s.length;e+=1)s[e].d();r=!1,$r(a)}}}function Cd(e){let t;const o=e[11].default,i=kr(o,e,e[10],Sd);return{c(){i&&i.c()},m(e,o){i&&i.m(e,o),t=!0},p(e,n){i&&i.p&&(!t||1040&n)&&Mr(i,o,e,e[10],t?Tr(o,e[10],n,vd):Pr(e[10]),Sd)},i(e){t||(ja(i,e),t=!0)},o(e){Ua(i,e),t=!1},d(e){i&&i.d(e)}}}function Td(e,t){let o,i,n,r,a,s,l,c,d=t[15]&&Cd(t);return{key:e,first:null,c(){o=Ur("div"),d&&d.c(),i=Xr(),Qr(o,"id",n=t[16]),Qr(o,"class",r=ld(["PinturaTabPanel",t[1]])),Qr(o,"aria-hidden",a=t[19]),Qr(o,"aria-labelledby",s=t[17]),Qr(o,"data-inert",l=!t[3]),Qr(o,"role","tabpanel"),this.first=o},m(e,t){Hr(e,o,t),d&&d.m(o,null),_r(o,i),c=!0},p(e,u){(t=e)[15]?d?(d.p(t,u),16&u&&ja(d,1)):(d=Cd(t),d.c(),ja(d,1),d.m(o,i)):d&&(Na(),Ua(d,1,1,()=>{d=null}),Ha()),(!c||16&u&&n!==(n=t[16]))&&Qr(o,"id",n),(!c||2&u&&r!==(r=ld(["PinturaTabPanel",t[1]])))&&Qr(o,"class",r),(!c||16&u&&a!==(a=t[19]))&&Qr(o,"aria-hidden",a),(!c||16&u&&s!==(s=t[17]))&&Qr(o,"aria-labelledby",s),(!c||16&u&&l!==(l=!t[3]))&&Qr(o,"data-inert",l)},i(e){c||(ja(d),c=!0)},o(e){Ua(d),c=!1},d(e){e&&jr(o),d&&d.d()}}}function Md(e){let t,o,i,n;const r=[kd,wd],a=[];function s(e,t){return e[5]?0:1}return t=s(e),o=a[t]=r[t](e),{c(){o.c(),i=Yr()},m(e,o){a[t].m(e,o),Hr(e,i,o),n=!0},p(e,[n]){let l=t;t=s(e),t===l?a[t].p(e,n):(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha(),o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),ja(o,1),o.m(i.parentNode,i))},i(e){n||(ja(o),n=!0)},o(e){Ua(o),n=!1},d(e){e&&jr(i),a[t].d(e)}}}function Pd(e,t,o){let i,n,{$$slots:r={},$$scope:a}=t,{class:s}=t,{name:l}=t,{selected:c}=t,{panelClass:d}=t,{panels:u=[]}=t,{visible:p}=t,{style:h}=t;const m={};return e.$$set=e=>{"class"in e&&o(0,s=e.class),"name"in e&&o(6,l=e.name),"selected"in e&&o(7,c=e.selected),"panelClass"in e&&o(1,d=e.panelClass),"panels"in e&&o(8,u=e.panels),"visible"in e&&o(3,p=e.visible),"style"in e&&o(2,h=e.style),"$$scope"in e&&o(10,a=e.$$scope)},e.$$.update=()=>{968&e.$$.dirty&&o(4,i=u.map(e=>{const t=e===c;t&&o(9,m[e]=!0,m);const i=p?-1!==p.indexOf(e):t;return{id:e,panelId:`panel-${l}-${e}`,labelledBy:`tab-${l}-${e}`,isActive:t,hidden:!t,visible:i,shouldDraw:t||m[e]}})),16&e.$$.dirty&&o(5,n=i.length>1)},[s,d,h,p,i,n,l,c,u,m,a,r,function(t){wa.call(this,e,t)},function(t){wa.call(this,e,t)}]}class Rd extends rs{constructor(e){super(),ns(this,e,Pd,Md,yr,{class:0,name:6,selected:7,panelClass:1,panels:8,visible:3,style:2})}}var Id=e=>{const t=Object.getOwnPropertyDescriptors(e.prototype);return Object.keys(t).filter(e=>!!t[e].get)};function Ed(e){let t,o,i,n;const r=[e[5],{locale:e[1]}];function a(t){e[22](t)}var s=e[10];function l(e,t){let o={};for(let e=0;e<r.length;e+=1)o=hr(o,r[e]);return void 0!==t&&34&t[0]&&(o=hr(o,Ja(r,[32&t[0]&&Qa(e[5]),2&t[0]&&{locale:e[1]}]))),void 0!==e[3]&&(o.name=e[3]),{props:o}}return s&&(t=ca(s,l(e)),Ca.push(()=>es(t,"name",a)),e[23](t),t.$on("measure",e[11])),{c(){t&&ts(t.$$.fragment),i=Yr()},m(e,o){t&&os(t,e,o),Hr(e,i,o),n=!0},p(e,n){if(s!==(s=e[10])){if(t){Na();const e=t;Ua(e.$$.fragment,1,0,()=>{is(e,1)}),Ha()}s?(t=ca(s,l(e,n)),Ca.push(()=>es(t,"name",a)),e[23](t),t.$on("measure",e[11]),ts(t.$$.fragment),ja(t.$$.fragment,1),os(t,i.parentNode,i)):t=null}else if(s){const i=34&n[0]?Ja(r,[32&n[0]&&Qa(e[5]),2&n[0]&&{locale:e[1]}]):{};!o&&8&n[0]&&(o=!0,i.name=e[3],La(()=>o=!1)),t.$set(i)}},i(e){n||(t&&ja(t.$$.fragment,e),n=!0)},o(e){t&&Ua(t.$$.fragment,e),n=!1},d(o){o&&jr(i),e[23](null),t&&is(t,o)}}}function Ad(e){let t,o,i,n=e[6]&&Ed(e);return{c(){t=Ur("div"),n&&n.c(),Qr(t,"data-util",e[3]),Qr(t,"class",o=ld(["PinturaUtilPanel",e[2]])),aa(t,"opacity",e[7])},m(o,r){Hr(o,t,r),n&&n.m(t,null),e[24](t),i=!0},p(e,r){e[6]?n?(n.p(e,r),64&r[0]&&ja(n,1)):(n=Ed(e),n.c(),ja(n,1),n.m(t,null)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),(!i||8&r[0])&&Qr(t,"data-util",e[3]),(!i||4&r[0]&&o!==(o=ld(["PinturaUtilPanel",e[2]])))&&Qr(t,"class",o),128&r[0]&&aa(t,"opacity",e[7])},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(o){o&&jr(t),n&&n.d(),e[24](null)}}}function Ld(e,t,o){let i,n,r,a,s;const l=xa();let{isActive:c=!0}=t,{stores:d}=t,{view:u}=t,{props:p}=t,{component:h}=t,{locale:m}=t,{class:g}=t;const $=Sa("isAnimated");let f;wr(e,$,e=>o(21,s=e));const y=Fc(0),b=cs(y,e=>Rs(e,0,1));wr(e,b,e=>o(20,a=e));let x=!c;const v=ls(c),S=cs(v,async(e,t)=>{if(!e)return t(e);await Ea(),t(e)},!1),w=cs(b,e=>e),k=cs(b,e=>e>0),C={isActive:S,isActiveFraction:w,isVisible:k},T=u,M=Id(T),P=Object.keys(p||{}).reduce((e,t)=>M.includes(t)?(e[t]=p[t],e):e,{}),R=Object.keys(C).reduce((e,t)=>M.includes(t)?(e[t]=C[t],e):e,{});let I,E;const A=e=>{o(17,f={...e.detail}),F&&c&&l("measure",{...f})};va("measurable",qc);const L=$a().$$.context;let F=!1;return fa(()=>{if(o(19,F=!0),r)return;o(0,h=new T({target:E,props:{...n,locale:m},context:L})),o(3,I=h.name);const e=h.$on("measure",A);return()=>{e(),h.$destroy()}}),e.$$set=e=>{"isActive"in e&&o(12,c=e.isActive),"stores"in e&&o(13,d=e.stores),"view"in e&&o(14,u=e.view),"props"in e&&o(15,p=e.props),"component"in e&&o(0,h=e.component),"locale"in e&&o(1,m=e.locale),"class"in e&&o(2,g=e.class)},e.$$.update=()=>{135169&e.$$.dirty[0]&&f&&c&&h&&l("measure",f),2101248&e.$$.dirty[0]&&y.set(c?1:0,{hard:!1===s}),1310720&e.$$.dirty[0]&&(a<=0&&!x?o(18,x=!0):a>0&&x&&o(18,x=!1)),786432&e.$$.dirty[0]&&F&&l(x?"hide":"show"),1048576&e.$$.dirty[0]&&l("fade",a),1048576&e.$$.dirty[0]&&o(7,i=a),4096&e.$$.dirty[0]&&v.set(c),8192&e.$$.dirty[0]&&o(5,n={...P,...R,stores:d})},o(6,r=!M.includes("external")),[h,m,g,I,E,n,r,i,$,b,T,A,c,d,u,p,y,f,x,F,a,s,function(e){I=e,o(3,I)},function(e){Ca[e?"unshift":"push"](()=>{h=e,o(0,h)})},function(e){Ca[e?"unshift":"push"](()=>{E=e,o(4,E)})}]}class Fd extends rs{constructor(e){super(),ns(this,e,Ld,Ad,yr,{isActive:12,stores:13,view:14,props:15,component:0,locale:1,class:2,opacity:16},null,[-1,-1])}get opacity(){return this.$$.ctx[16]}}function zd(e){let t,o,i,n,r,a;const s=e[5].default,l=kr(s,e,e[4],null);return{c(){t=Gr("svg"),l&&l.c(),Qr(t,"class",e[3]),Qr(t,"width",e[0]),Qr(t,"height",e[1]),Qr(t,"viewBox",o="0 0 "+e[0]+"\n "+e[1]),Qr(t,"xmlns","http://www.w3.org/2000/svg"),Qr(t,"aria-hidden","true"),Qr(t,"focusable","false"),Qr(t,"stroke-linecap","round"),Qr(t,"stroke-linejoin","round")},m(o,s){Hr(o,t,s),l&&l.m(t,null),n=!0,r||(a=Ar(i=fd.call(null,t,e[2])),r=!0)},p(e,[r]){l&&l.p&&(!n||16&r)&&Mr(l,s,e,e[4],n?Tr(s,e[4],r,null):Pr(e[4]),null),(!n||8&r)&&Qr(t,"class",e[3]),(!n||1&r)&&Qr(t,"width",e[0]),(!n||2&r)&&Qr(t,"height",e[1]),(!n||3&r&&o!==(o="0 0 "+e[0]+"\n "+e[1]))&&Qr(t,"viewBox",o),i&&fr(i.update)&&4&r&&i.update.call(null,e[2])},i(e){n||(ja(l,e),n=!0)},o(e){Ua(l,e),n=!1},d(e){e&&jr(t),l&&l.d(e),r=!1,a()}}}function Dd(e,t,o){let{$$slots:i={},$$scope:n}=t,{width:r=24}=t,{height:a=24}=t,{style:s}=t,{class:l}=t;return e.$$set=e=>{"width"in e&&o(0,r=e.width),"height"in e&&o(1,a=e.height),"style"in e&&o(2,s=e.style),"class"in e&&o(3,l=e.class),"$$scope"in e&&o(4,n=e.$$scope)},[r,a,s,l,n,i]}class Od extends rs{constructor(e){super(),ns(this,e,Dd,zd,yr,{width:0,height:1,style:2,class:3})}}var Bd=(e,t)=>t===e.target||t.contains(e.target),Wd=(e,t,o)=>{const i=y(t)?t:e;return o?`${i} (${n=o,n.map(e=>"CMD"===e?ko()?"⌘":"Ctrl":e).join("+")})`:i;var n};const{document:_d}=Wr;function Vd(e){let t,o,i,n;return{c(){t=Xr(),o=Ur("button"),Qr(o,"class","PinturaImageButton"),Qr(o,"type","button"),Qr(o,"title",e[1]),o.disabled=e[2]},m(r,a){Hr(r,t,a),Hr(r,o,a),o.innerHTML=e[0],e[11](o),i||(n=[qr(_d.body,"load",e[5],!0),qr(_d.body,"error",e[6],!0),qr(o,"pointerdown",e[4])],i=!0)},p(e,[t]){1&t&&(o.innerHTML=e[0]),2&t&&Qr(o,"title",e[1]),4&t&&(o.disabled=e[2])},i:ur,o:ur,d(r){r&&(jr(t),jr(o)),e[11](null),i=!1,$r(n)}}}function Nd(e,t,i){let n,{html:r}=t,{title:a}=t,{onclick:s}=t,{disabled:l=!1}=t,{ongrab:c=o}=t,{ondrag:d=o}=t,{ondrop:u=o}=t;const p=e=>ze(h,be(e.pageX,e.pageY))<256;let h;const m=e=>{document.documentElement.removeEventListener("pointermove",g),document.documentElement.removeEventListener("pointerup",m);const t=be(e.pageX,e.pageY);if(ze(h,t)<32)return s(e);p(e)||u(e)},g=e=>{p(e)||d(e)},$=e=>n&&n.contains(e)&&"IMG"===e.nodeName;return e.$$set=e=>{"html"in e&&i(0,r=e.html),"title"in e&&i(1,a=e.title),"onclick"in e&&i(7,s=e.onclick),"disabled"in e&&i(2,l=e.disabled),"ongrab"in e&&i(8,c=e.ongrab),"ondrag"in e&&i(9,d=e.ondrag),"ondrop"in e&&i(10,u=e.ondrop)},e.$$.update=()=>{8&e.$$.dirty&&n&&n.querySelector("img")&&i(3,n.dataset.loader=!0,n)},[r,a,l,n,e=>{h=be(e.pageX,e.pageY),c(e),document.documentElement.addEventListener("pointermove",g),document.documentElement.addEventListener("pointerup",m)},({target:e})=>{$(e)&&i(3,n.dataset.load=!0,n)},({target:e})=>{$(e)&&i(3,n.dataset.error=!0,n)},s,c,d,u,function(e){Ca[e?"unshift":"push"](()=>{n=e,i(3,n)})}]}class Hd extends rs{constructor(e){super(),ns(this,e,Nd,Vd,yr,{html:0,title:1,onclick:7,disabled:2,ongrab:8,ondrag:9,ondrop:10})}}function jd(e,t,o){const i=e.slice();return i[13]=t[o],i}function Ud(e,t){let o,i,n,r,a,s,l;function c(){return t[9](t[13])}function d(...e){return t[10](t[13],...e)}function u(...e){return t[11](t[13],...e)}function p(...e){return t[12](t[13],...e)}return i=new Hd({props:{onclick:c,ongrab:d,ondrag:u,ondrop:p,disabled:t[1]||t[13].disabled,title:t[13].title,html:t[13].thumb}}),{key:e,first:null,c(){o=Ur("li"),ts(i.$$.fragment),n=Xr(),aa(o,"opacity",t[6]),this.first=o},m(e,c){Hr(e,o,c),os(i,o,null),_r(o,n),a=!0,s||(l=Ar(r=t[8].call(null,o,t[13])),s=!0)},p(e,n){t=e;const a={};5&n&&(a.onclick=c),9&n&&(a.ongrab=d),17&n&&(a.ondrag=u),33&n&&(a.ondrop=p),3&n&&(a.disabled=t[1]||t[13].disabled),1&n&&(a.title=t[13].title),1&n&&(a.html=t[13].thumb),i.$set(a),r&&fr(r.update)&&1&n&&r.update.call(null,t[13]),64&n&&aa(o,"opacity",t[6])},i(e){a||(ja(i.$$.fragment,e),a=!0)},o(e){Ua(i.$$.fragment,e),a=!1},d(e){e&&jr(o),is(i),s=!1,l()}}}function Gd(e){let t,o,i=[],n=new Map,r=Xa(e[0]);const a=e=>e[13].id;for(let t=0;t<r.length;t+=1){let o=jd(e,r,t),s=a(o);n.set(s,i[t]=Ud(s,o))}return{c(){t=Ur("ul");for(let e=0;e<i.length;e+=1)i[e].c();Qr(t,"class","PinturaImageButtonList")},m(e,n){Hr(e,t,n);for(let e=0;e<i.length;e+=1)i[e]&&i[e].m(t,null);o=!0},p(e,[o]){127&o&&(r=Xa(e[0]),Na(),i=Ka(i,o,a,1,e,r,n,t,qa,Ud,null,jd),Ha())},i(e){if(!o){for(let e=0;e<r.length;e+=1)ja(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)Ua(i[e]);o=!1},d(e){e&&jr(t);for(let e=0;e<i.length;e+=1)i[e].d()}}}function Zd(e,t,o){let i,{items:n}=t,{disabled:r}=t,{onclickitem:a}=t,{ongrabitem:s}=t,{ondragitem:l}=t,{ondropitem:c}=t;const d=Fc(0,{stiffness:.25,damping:.9});wr(e,d,e=>o(6,i=e));fa(()=>d.set(1));return e.$$set=e=>{"items"in e&&o(0,n=e.items),"disabled"in e&&o(1,r=e.disabled),"onclickitem"in e&&o(2,a=e.onclickitem),"ongrabitem"in e&&o(3,s=e.ongrabitem),"ondragitem"in e&&o(4,l=e.ondragitem),"ondropitem"in e&&o(5,c=e.ondropitem)},[n,r,a,s,l,c,i,d,(e,t)=>t.mount&&t.mount(e.firstChild,t),e=>a(e.id),(e,t)=>s&&s(e.id,t),(e,t)=>l&&l(e.id,t),(e,t)=>c&&c(e.id,t)]}class Xd extends rs{constructor(e){super(),ns(this,e,Zd,Gd,yr,{items:0,disabled:1,onclickitem:2,ongrabitem:3,ondragitem:4,ondropitem:5})}}var Yd=()=>m()&&window.devicePixelRatio||1;let qd=null;var Kd=e=>(null===qd&&(qd=1===Yd()?Math.round:e=>e),qd(e)),Jd=(e,t={})=>{if(e){if(t.preventScroll&&no()){const t=document.body.scrollTop;return e.focus(),void(document.body.scrollTop=t)}e.focus(t)}},Qd=e=>/date|email|number|search|text|url/.test(e.type),eu=e=>(e=>/textarea/i.test(e.nodeName))(e)||Qd(e)||e.isContentEditable;const tu=e=>({}),ou=e=>({}),iu=e=>({}),nu=e=>({});function ru(e){let t,o;const i=[e[7]];let n={$$slots:{default:[su]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Dh({props:n}),e[54](t),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=128&o[0]?Ja(i,[Qa(e[7])]):{};134217728&o[1]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(o){e[54](null),is(t,o)}}}function au(e){let t,o;const i=[e[7]];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Dh({props:n}),e[53](t),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=128&o[0]?Ja(i,[Qa(e[7])]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(o){e[53](null),is(t,o)}}}function su(e){let t;const o=e[52].label,i=kr(o,e,e[58],nu);return{c(){i&&i.c()},m(e,o){i&&i.m(e,o),t=!0},p(e,n){i&&i.p&&(!t||134217728&n[1])&&Mr(i,o,e,e[58],t?Tr(o,e[58],n,iu):Pr(e[58]),nu)},i(e){t||(ja(i,e),t=!0)},o(e){Ua(i,e),t=!1},d(e){i&&i.d(e)}}}function lu(e){let t,o,i,n,r,a,s;const l=e[52].details,c=kr(l,e,e[58],ou);return{c(){t=Ur("div"),c&&c.c(),o=Xr(),i=Ur("span"),Qr(i,"class","PinturaPanelTip"),Qr(i,"data-top",e[10]),aa(i,"opacity",e[14]),aa(i,"transform",e[13]),aa(i,"top",e[12]),aa(i,"left",e[11]),Qr(t,"class",n=ld(["PinturaPanel","pintura-editor-panel",e[2]])),Qr(t,"tabindex","-1"),aa(t,"opacity",e[18]),aa(t,"pointer-events",e[17]),aa(t,"transform",e[16]),aa(t,"--panel-max-height",e[15])},m(n,l){Hr(n,t,l),c&&c.m(t,null),_r(t,o),_r(t,i),e[55](t),r=!0,a||(s=[qr(t,"close",e[56]),qr(t,"keydown",e[25]),qr(t,"measure",e[57]),Ar(qc.call(null,t))],a=!0)},p(e,o){c&&c.p&&(!r||134217728&o[1])&&Mr(c,l,e,e[58],r?Tr(l,e[58],o,tu):Pr(e[58]),ou),(!r||1024&o[0])&&Qr(i,"data-top",e[10]),16384&o[0]&&aa(i,"opacity",e[14]),8192&o[0]&&aa(i,"transform",e[13]),4096&o[0]&&aa(i,"top",e[12]),2048&o[0]&&aa(i,"left",e[11]),(!r||4&o[0]&&n!==(n=ld(["PinturaPanel","pintura-editor-panel",e[2]])))&&Qr(t,"class",n),262144&o[0]&&aa(t,"opacity",e[18]),131072&o[0]&&aa(t,"pointer-events",e[17]),65536&o[0]&&aa(t,"transform",e[16]),32768&o[0]&&aa(t,"--panel-max-height",e[15])},i(e){r||(ja(c,e),r=!0)},o(e){Ua(c,e),r=!1},d(o){o&&jr(t),c&&c.d(o),e[55](null),a=!1,$r(s)}}}function cu(e){let t,o,i,n,r,a,s,l,c;const d=[au,ru],u=[];function p(e,t){return e[1]?0:1}o=p(e),i=u[o]=d[o](e);let h=e[6]&&lu(e),m=!1;return{c(){t=Xr(),i.c(),n=Xr(),h&&h.c(),r=Xr(),a=Yr()},m(i,d){Hr(i,t,d),u[o].m(i,d),Hr(i,n,d),h&&h.m(i,d),Hr(i,r,d),Hr(i,a,d),s=!0,l||(c=[qr(document.body,"pointerdown",function(){fr(e[9])&&e[9].apply(this,arguments)}),qr(document.body,"pointerup",function(){fr(e[8])&&e[8].apply(this,arguments)})],l=!0)},p(t,a){let s=o;o=p(e=t),o===s?u[o].p(e,a):(Na(),Ua(u[s],1,1,()=>{u[s]=null}),Ha(),i=u[o],i?i.p(e,a):(i=u[o]=d[o](e),i.c()),ja(i,1),i.m(n.parentNode,n)),e[6]?h?(h.p(e,a),64&a[0]&&ja(h,1)):(h=lu(e),h.c(),ja(h,1),h.m(r.parentNode,r)):h&&(Na(),Ua(h,1,1,()=>{h=null}),Ha())},i(e){s||(ja(i),ja(h),ja(m),s=!0)},o(e){Ua(i),Ua(h),Ua(m),s=!1},d(e){e&&(jr(t),jr(n),jr(r),jr(a)),u[o].d(e),h&&h.d(e),l=!1,$r(c)}}}let du=12;function uu(e,t,i){let n,r,a,s,l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w,k,C,T,M,P,{$$slots:R={},$$scope:I}=t,{buttonClass:E}=t,{buttonLabel:A}=t,{buttonLabelClass:F}=t,{buttonHideLabel:z}=t,{buttonIcon:D}=t,{buttonTitle:O}=t,{buttonOnClick:B}=t,{panelClass:W}=t,{isActive:_=!1}=t,{onshow:V=o}=t,{onhide:N=o}=t,{canConfirm:H=!1}=t;const j=Sa("isAnimated");wr(e,j,e=>i(51,P=e));const U=Sa("rootPortal");wr(e,U,e=>i(46,w=e));const G=Sa("rootRect");let Z,X,Y;wr(e,G,e=>i(48,C=e));const q=()=>i(35,Y=n&&n.getBoundingClientRect());let K=ye(),J=Fc(0);wr(e,J,e=>i(49,T=e));let Q=ye();const ee=ls({x:0,y:0});wr(e,ee,e=>i(47,k=e));const te=Fc(-5,{stiffness:.1,damping:.35,precision:.001});wr(e,te,e=>i(50,M=e));let oe=!0;const ie=e=>Bd(e,w)||X.isEventTarget(e);let ne,re,ae=!1;const se=e=>{eu(e.target)||(L(B)&&B(),_||q(),i(40,re=e),i(0,_=!_))},le=e=>{/down/i.test(e.key)&&(e.target&&eu(e.target)||(i(0,_=!0),i(40,re=e)))};ba(()=>{if(!w)return;if(!ne)return;const e=ne;Ea().then(()=>{e.parentNode&&e.remove()})});return e.$$set=e=>{"buttonClass"in e&&i(26,E=e.buttonClass),"buttonLabel"in e&&i(1,A=e.buttonLabel),"buttonLabelClass"in e&&i(27,F=e.buttonLabelClass),"buttonHideLabel"in e&&i(28,z=e.buttonHideLabel),"buttonIcon"in e&&i(29,D=e.buttonIcon),"buttonTitle"in e&&i(30,O=e.buttonTitle),"buttonOnClick"in e&&i(31,B=e.buttonOnClick),"panelClass"in e&&i(2,W=e.panelClass),"isActive"in e&&i(0,_=e.isActive),"onshow"in e&&i(32,V=e.onshow),"onhide"in e&&i(33,N=e.onhide),"canConfirm"in e&&i(34,H=e.canConfirm),"$$scope"in e&&i(58,I=e.$$scope)},e.$$.update=()=>{if(16&e.$$.dirty[0]&&(n=X&&X.getElement()),1&e.$$.dirty[0]|256&e.$$.dirty[1]&&i(8,v=_?e=>{ae&&(i(39,ae=!1),ie(e)||i(0,_=!1))}:void 0),1&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&J.set(_?1:0,{hard:!1===P}),1&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&te.set(_?0:-5,{hard:!1===P}),524288&e.$$.dirty[1]&&i(44,r=1-M/-5),1&e.$$.dirty[0]|131072&e.$$.dirty[1]&&C&&_&&q(),9&e.$$.dirty[0]|131088&e.$$.dirty[1]&&C&&Z&&Y&&_){i(38,oe=!0);let e=Y.x-C.x+.5*Y.width-.5*Z.width,t=Y.y-C.y+Y.height;const o=du,n=du,r=C.width-du,a=C.height-du,s=e,l=t,c=s+Z.width,d=l+Z.height;if(s<o&&(i(37,Q.x=s-o,Q),e=o),c>r&&(i(37,Q.x=c-r,Q),e=r-Z.width),d>a){i(36,K.y=-1,K);n<t-Z.height-Y.height?(i(37,Q.y=0,Q),t-=Z.height+Y.height):(i(37,Q.y=t-(d-a),Q),t-=d-a-du,i(38,oe=!1))}else i(36,K.y=1,K);Er(ee,k=Pe(be(e,t),Kd),k)}if(262144&e.$$.dirty[1]&&i(6,a=T>0),589856&e.$$.dirty[1]&&i(45,s=`translateX(${Math.round(k.x)+K.x*du}px) translateY(${Math.round(k.y)+K.y*du+K.y*M}px)`),262144&e.$$.dirty[1]&&i(18,l=T),262144&e.$$.dirty[1]&&i(17,c=T<1?"none":"all"),16384&e.$$.dirty[1]&&i(16,d=s),131072&e.$$.dirty[1]&&i(15,u=C.height-24+"px"),8192&e.$$.dirty[1]&&i(42,p=.5+.5*r),8192&e.$$.dirty[1]&&i(43,h=r),8&e.$$.dirty[0]|65536&e.$$.dirty[1]&&i(41,m=Z&&k),5248&e.$$.dirty[1]&&i(14,g=m&&oe?h:0),3072&e.$$.dirty[1]&&i(13,$=m?`scaleX(${p})rotate(45deg)`:"none"),8&e.$$.dirty[0]|1120&e.$$.dirty[1]&&i(12,f=m?`${K.y<0?Q.y+Z.height:0}px`:"0"),8&e.$$.dirty[0]|1088&e.$$.dirty[1]&&i(11,y=m?`${Q.x+.5*Z.width}px`:"0"),32&e.$$.dirty[1]&&i(10,b=K.y>=0),1&e.$$.dirty[0]&&i(9,x=_?e=>{ie(e)||i(39,ae=!0)}:void 0),96&e.$$.dirty[0]|32768&e.$$.dirty[1]&&a&&w&&ne&&ne.parentNode!==w&&w.append(ne),1&e.$$.dirty[0]&&(_||i(40,re=void 0)),97&e.$$.dirty[0]|514&e.$$.dirty[1]&&_&&a&&ne){let e=!1;V({e:re,panel:ne,preventFocus(){e=!0}}),e||Jd(ne,{preventScroll:!0})}65&e.$$.dirty[0]|4&e.$$.dirty[1]&&a&&!_&&N(),2080374786&e.$$.dirty[0]&&i(7,S={label:A,icon:D,class:ld(["PinturaPanelButton",E]),onkeydown:le,onclick:se,hideLabel:z,labelClass:F,title:O})},[_,A,W,Z,X,ne,a,S,v,x,b,y,f,$,g,u,d,c,l,j,U,G,J,ee,te,e=>{(/esc/i.test(e.key)||H&&/enter/i.test(e.key))&&(/enter/i.test(e.key)&&e.preventDefault(),i(0,_=!1),n.focus())},E,F,z,D,O,B,V,N,H,Y,K,Q,oe,ae,re,m,p,h,r,s,w,k,C,T,M,P,R,function(e){Ca[e?"unshift":"push"](()=>{X=e,i(4,X)})},function(e){Ca[e?"unshift":"push"](()=>{X=e,i(4,X)})},function(e){Ca[e?"unshift":"push"](()=>{ne=e,i(5,ne)})},e=>{e.stopPropagation(),i(0,_=!1)},e=>i(3,Z=He(e.detail)),I]}class pu extends rs{constructor(e){super(),ns(this,e,uu,cu,yr,{buttonClass:26,buttonLabel:1,buttonLabelClass:27,buttonHideLabel:28,buttonIcon:29,buttonTitle:30,buttonOnClick:31,panelClass:2,isActive:0,onshow:32,onhide:33,canConfirm:34},null,[-1,-1,-1])}}var hu={Up:38,Down:40,Left:37,Right:39};function mu(e){let t,o,i,n,r,a,s,l;const c=e[16].default,d=kr(c,e,e[15],null);return{c(){t=Ur("li"),o=Ur("input"),i=Xr(),n=Ur("label"),d&&d.c(),Qr(o,"type","radio"),Qr(o,"class","implicit"),Qr(o,"id",e[7]),Qr(o,"name",e[0]),o.value=e[3],o.disabled=e[6],o.hidden=e[5],o.checked=e[4],Qr(n,"for",e[7]),Qr(n,"title",e[2]),Qr(t,"class",r=ld(["PinturaRadioGroupOption",e[1]])),Qr(t,"data-hidden",e[5]),Qr(t,"data-disabled",e[6]),Qr(t,"data-selected",e[4])},m(r,c){Hr(r,t,c),_r(t,o),_r(t,i),_r(t,n),d&&d.m(n,null),a=!0,s||(l=[qr(o,"change",Jr(e[17])),qr(o,"keydown",e[9]),qr(o,"click",e[10])],s=!0)},p(e,[i]){(!a||128&i)&&Qr(o,"id",e[7]),(!a||1&i)&&Qr(o,"name",e[0]),(!a||8&i)&&(o.value=e[3]),(!a||64&i)&&(o.disabled=e[6]),(!a||32&i)&&(o.hidden=e[5]),(!a||16&i)&&(o.checked=e[4]),d&&d.p&&(!a||32768&i)&&Mr(d,c,e,e[15],a?Tr(c,e[15],i,null):Pr(e[15]),null),(!a||128&i)&&Qr(n,"for",e[7]),(!a||4&i)&&Qr(n,"title",e[2]),(!a||2&i&&r!==(r=ld(["PinturaRadioGroupOption",e[1]])))&&Qr(t,"class",r),(!a||32&i)&&Qr(t,"data-hidden",e[5]),(!a||64&i)&&Qr(t,"data-disabled",e[6]),(!a||16&i)&&Qr(t,"data-selected",e[4])},i(e){a||(ja(d,e),a=!0)},o(e){Ua(d,e),a=!1},d(e){e&&jr(t),d&&d.d(e),s=!1,$r(l)}}}function gu(e,t,o){let i,n,{$$slots:r={},$$scope:a}=t,{name:s}=t,{class:l}=t,{label:c}=t,{title:d}=t,{id:u}=t,{value:p}=t,{checked:h}=t,{onkeydown:m}=t,{onclick:g}=t,{hidden:$=!1}=t,{disabled:f=!1}=t;const y=Object.values(hu),b=Sa("keysPressed");wr(e,b,e=>o(18,n=e));return e.$$set=e=>{"name"in e&&o(0,s=e.name),"class"in e&&o(1,l=e.class),"label"in e&&o(11,c=e.label),"title"in e&&o(2,d=e.title),"id"in e&&o(12,u=e.id),"value"in e&&o(3,p=e.value),"checked"in e&&o(4,h=e.checked),"onkeydown"in e&&o(13,m=e.onkeydown),"onclick"in e&&o(14,g=e.onclick),"hidden"in e&&o(5,$=e.hidden),"disabled"in e&&o(6,f=e.disabled),"$$scope"in e&&o(15,a=e.$$scope)},e.$$.update=()=>{4097&e.$$.dirty&&o(7,i=`${s}-${u}`)},[s,l,d,p,h,$,f,i,b,e=>{m(e)},e=>{n.some(e=>y.includes(e))||g(e)},c,u,m,g,a,r,function(t){wa.call(this,e,t)}]}class $u extends rs{constructor(e){super(),ns(this,e,gu,mu,yr,{name:0,class:1,label:11,title:2,id:12,value:3,checked:4,onkeydown:13,onclick:14,hidden:5,disabled:6})}}var fu=(e=[])=>e.reduce((e,t)=>(Uo(t)?Uo(t[1]):!!t.options)?e.concat(Uo(t)?t[1]:t.options):(e.push(t),e),[]);const yu=(e,t,o)=>{let i;return Uo(e)?i={id:t,value:e[0],label:e[1],...e[2]||{}}:(i=e,i.id=null!=i.id?i.id:t),o?o(i):i};var bu=(e,t,o)=>L(e)?e(t,o):e;const xu=(e,t)=>e.map(([e,o,i])=>{if(Uo(o))return[bu(e,t),xu(o,t)];{const n=[e,bu(o,t)];if(i){let e={...i};i.icon&&(e.icon=bu(i.icon,t)),n.push(e)}return n}});var vu=(e,t)=>xu(e,t),Su=e=>/enter| /i.test(e),wu=(e,t)=>Array.isArray(e)&&Array.isArray(t)?Fs(e,t):e===t;function ku(e,t,o){const i=e.slice();return i[27]=t[o],i}const Cu=e=>({option:1024&e[0]}),Tu=e=>({option:e[27]});function Mu(e,t,o){const i=e.slice();return i[27]=t[o],i}const Pu=e=>({option:1024&e[0]}),Ru=e=>({option:e[27]}),Iu=e=>({option:1024&e[0]}),Eu=e=>({option:e[27]});function Au(e){let t,o,i,n,r,a=[],s=new Map,l=e[1]&&Lu(e),c=Xa(e[10]);const d=e=>e[27].id;for(let t=0;t<c.length;t+=1){let o=ku(e,c,t),i=d(o);s.set(i,a[t]=Uu(i,o))}return{c(){t=Ur("fieldset"),l&&l.c(),o=Xr(),i=Ur("ul");for(let e=0;e<a.length;e+=1)a[e].c();Qr(i,"class","PinturaRadioGroupOptions"),Qr(t,"class",n=ld(["PinturaRadioGroup",e[3]])),Qr(t,"data-layout",e[5]),Qr(t,"title",e[7])},m(e,n){Hr(e,t,n),l&&l.m(t,null),_r(t,o),_r(t,i);for(let e=0;e<a.length;e+=1)a[e]&&a[e].m(i,null);r=!0},p(e,u){e[1]?l?l.p(e,u):(l=Lu(e),l.c(),l.m(t,o)):l&&(l.d(1),l=null),8419153&u[0]&&(c=Xa(e[10]),Na(),a=Ka(a,u,d,1,e,c,s,i,qa,Uu,null,ku),Ha()),(!r||8&u[0]&&n!==(n=ld(["PinturaRadioGroup",e[3]])))&&Qr(t,"class",n),(!r||32&u[0])&&Qr(t,"data-layout",e[5]),(!r||128&u[0])&&Qr(t,"title",e[7])},i(e){if(!r){for(let e=0;e<c.length;e+=1)ja(a[e]);r=!0}},o(e){for(let e=0;e<a.length;e+=1)Ua(a[e]);r=!1},d(e){e&&jr(t),l&&l.d();for(let e=0;e<a.length;e+=1)a[e].d()}}}function Lu(e){let t,o,i;return{c(){t=Ur("legend"),o=Zr(e[1]),Qr(t,"class",i=e[2]&&"implicit")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,n){2&n[0]&&na(o,e[1]),4&n[0]&&i!==(i=e[2]&&"implicit")&&Qr(t,"class",i)},d(e){e&&jr(t)}}}function Fu(e){let t,o;return t=new $u({props:{name:e[4],label:e[27].label,title:e[27].hideLabel?e[27].title||e[27].label:e[27].title,id:e[27].id,value:e[27].value,disabled:e[27].disabled,hidden:e[27].hidden,class:e[8],checked:e[12](e[27])===e[0],onkeydown:e[13](e[27]),onclick:e[14](e[27]),$$slots:{default:[Wu]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.name=e[4]),1024&o[0]&&(i.label=e[27].label),1024&o[0]&&(i.title=e[27].hideLabel?e[27].title||e[27].label:e[27].title),1024&o[0]&&(i.id=e[27].id),1024&o[0]&&(i.value=e[27].value),1024&o[0]&&(i.disabled=e[27].disabled),1024&o[0]&&(i.hidden=e[27].hidden),256&o[0]&&(i.class=e[8]),1025&o[0]&&(i.checked=e[12](e[27])===e[0]),1024&o[0]&&(i.onkeydown=e[13](e[27])),1024&o[0]&&(i.onclick=e[14](e[27])),8389696&o[0]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function zu(e){let t,o,i,n,r,a,s=[],l=new Map;const c=e[22].group,d=kr(c,e,e[23],Eu),u=d||function(e){let t,o,i=e[27].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class","PinturaRadioGroupOptionGroupLabel")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){1024&t[0]&&i!==(i=e[27].label+"")&&na(o,i)},d(e){e&&jr(t)}}}(e);let p=Xa(e[27].options);const h=e=>e[27].id;for(let t=0;t<p.length;t+=1){let o=Mu(e,p,t),i=h(o);l.set(i,s[t]=ju(i,o))}return{c(){t=Ur("li"),u&&u.c(),o=Xr(),i=Ur("ul");for(let e=0;e<s.length;e+=1)s[e].c();n=Xr(),Qr(i,"class","PinturaRadioGroupOptions"),Qr(t,"class",r=ld(["PinturaRadioGroupOptionGroup",e[9]]))},m(e,r){Hr(e,t,r),u&&u.m(t,null),_r(t,o),_r(t,i);for(let e=0;e<s.length;e+=1)s[e]&&s[e].m(i,null);_r(t,n),a=!0},p(e,o){d?d.p&&(!a||8389632&o[0])&&Mr(d,c,e,e[23],a?Tr(c,e[23],o,Iu):Pr(e[23]),Eu):u&&u.p&&(!a||1024&o[0])&&u.p(e,a?o:[-1,-1]),8418641&o[0]&&(p=Xa(e[27].options),Na(),s=Ka(s,o,h,1,e,p,l,i,qa,ju,null,Mu),Ha()),(!a||512&o[0]&&r!==(r=ld(["PinturaRadioGroupOptionGroup",e[9]])))&&Qr(t,"class",r)},i(e){if(!a){ja(u,e);for(let e=0;e<p.length;e+=1)ja(s[e]);a=!0}},o(e){Ua(u,e);for(let e=0;e<s.length;e+=1)Ua(s[e]);a=!1},d(e){e&&jr(t),u&&u.d(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function Du(e){let t,o;return t=new Od({props:{$$slots:{default:[Ou]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8389632&o[0]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Ou(e){let t,o=e[27].icon+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){1024&i[0]&&o!==(o=e[27].icon+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function Bu(e){let t,o,i=e[27].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class",e[6])},m(e,i){Hr(e,t,i),_r(t,o)},p(e,n){1024&n[0]&&i!==(i=e[27].label+"")&&na(o,i),64&n[0]&&Qr(t,"class",e[6])},d(e){e&&jr(t)}}}function Wu(e){let t;const o=e[22].option,i=kr(o,e,e[23],Tu),n=i||function(e){let t,o,i,n=e[27].icon&&Du(e),r=!e[27].hideLabel&&Bu(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Xr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[27].icon?n?(n.p(e,i),1024&i[0]&&ja(n,1)):(n=Du(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[27].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=Bu(e),r.c(),r.m(o.parentNode,o))},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}(e);return{c(){n&&n.c()},m(e,o){n&&n.m(e,o),t=!0},p(e,r){i?i.p&&(!t||8389632&r[0])&&Mr(i,o,e,e[23],t?Tr(o,e[23],r,Cu):Pr(e[23]),Tu):n&&n.p&&(!t||1088&r[0])&&n.p(e,t?r:[-1,-1])},i(e){t||(ja(n,e),t=!0)},o(e){Ua(n,e),t=!1},d(e){n&&n.d(e)}}}function _u(e){let t,o;return t=new Od({props:{$$slots:{default:[Vu]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8389632&o[0]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Vu(e){let t,o=e[27].icon+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){1024&i[0]&&o!==(o=e[27].icon+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function Nu(e){let t,o,i=e[27].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class",e[6])},m(e,i){Hr(e,t,i),_r(t,o)},p(e,n){1024&n[0]&&i!==(i=e[27].label+"")&&na(o,i),64&n[0]&&Qr(t,"class",e[6])},d(e){e&&jr(t)}}}function Hu(e){let t;const o=e[22].option,i=kr(o,e,e[23],Ru),n=i||function(e){let t,o,i,n=e[27].icon&&_u(e),r=!e[27].hideLabel&&Nu(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Xr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[27].icon?n?(n.p(e,i),1024&i[0]&&ja(n,1)):(n=_u(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[27].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=Nu(e),r.c(),r.m(o.parentNode,o))},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}(e);return{c(){n&&n.c()},m(e,o){n&&n.m(e,o),t=!0},p(e,r){i?i.p&&(!t||8389632&r[0])&&Mr(i,o,e,e[23],t?Tr(o,e[23],r,Pu):Pr(e[23]),Ru):n&&n.p&&(!t||1088&r[0])&&n.p(e,t?r:[-1,-1])},i(e){t||(ja(n,e),t=!0)},o(e){Ua(n,e),t=!1},d(e){n&&n.d(e)}}}function ju(e,t){let o,i,n;return i=new $u({props:{name:t[4],label:t[27].label,title:t[27].hideLabel?t[27].title||t[27].label:t[27].title,id:t[27].id,value:t[27].value,disabled:t[27].disabled,hidden:t[27].hidden,class:t[8],checked:t[12](t[27])===t[0],onkeydown:t[13](t[27]),onclick:t[14](t[27]),$$slots:{default:[Hu]},$$scope:{ctx:t}}}),{key:e,first:null,c(){o=Yr(),ts(i.$$.fragment),this.first=o},m(e,t){Hr(e,o,t),os(i,e,t),n=!0},p(e,o){t=e;const n={};16&o[0]&&(n.name=t[4]),1024&o[0]&&(n.label=t[27].label),1024&o[0]&&(n.title=t[27].hideLabel?t[27].title||t[27].label:t[27].title),1024&o[0]&&(n.id=t[27].id),1024&o[0]&&(n.value=t[27].value),1024&o[0]&&(n.disabled=t[27].disabled),1024&o[0]&&(n.hidden=t[27].hidden),256&o[0]&&(n.class=t[8]),1025&o[0]&&(n.checked=t[12](t[27])===t[0]),1024&o[0]&&(n.onkeydown=t[13](t[27])),1024&o[0]&&(n.onclick=t[14](t[27])),8389696&o[0]&&(n.$$scope={dirty:o,ctx:t}),i.$set(n)},i(e){n||(ja(i.$$.fragment,e),n=!0)},o(e){Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(i,e)}}}function Uu(e,t){let o,i,n,r,a;const s=[zu,Fu],l=[];function c(e,t){return e[27].options?0:1}return i=c(t),n=l[i]=s[i](t),{key:e,first:null,c(){o=Yr(),n.c(),r=Yr(),this.first=o},m(e,t){Hr(e,o,t),l[i].m(e,t),Hr(e,r,t),a=!0},p(e,o){let a=i;i=c(t=e),i===a?l[i].p(t,o):(Na(),Ua(l[a],1,1,()=>{l[a]=null}),Ha(),n=l[i],n?n.p(t,o):(n=l[i]=s[i](t),n.c()),ja(n,1),n.m(r.parentNode,r))},i(e){a||(ja(n),a=!0)},o(e){Ua(n),a=!1},d(e){e&&(jr(o),jr(r)),l[i].d(e)}}}function Gu(e){let t,o,i,n=e[11].length&&Au(e),r=!1;return{c(){n&&n.c(),t=Xr(),o=Yr()},m(e,r){n&&n.m(e,r),Hr(e,t,r),Hr(e,o,r),i=!0},p(e,o){e[11].length?n?(n.p(e,o),2048&o[0]&&ja(n,1)):(n=Au(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e)}}}function Zu(e,t,o){let i,n,r,{$$slots:a={},$$scope:s}=t;const l=xa();let{label:c}=t,{hideLabel:d=!0}=t,{class:u}=t,{name:p=`radio-group-${B()}`}=t,{selectedIndex:h=-1}=t,{options:m=[]}=t,{onchange:g}=t,{layout:$}=t,{optionMapper:f}=t,{optionFilter:y}=t,{value:b}=t,{optionLabelClass:x}=t,{title:v}=t,{locale:S}=t,{optionClass:w}=t,{optionGroupClass:k}=t;const C=e=>r.findIndex(t=>t.id===e.id),T=(e,t)=>{o(0,h=C(e));const i={index:h,...e};((e,...t)=>{e&&e(...t)})(g,i,t),l("change",i)};return e.$$set=e=>{"label"in e&&o(1,c=e.label),"hideLabel"in e&&o(2,d=e.hideLabel),"class"in e&&o(3,u=e.class),"name"in e&&o(4,p=e.name),"selectedIndex"in e&&o(0,h=e.selectedIndex),"options"in e&&o(15,m=e.options),"onchange"in e&&o(16,g=e.onchange),"layout"in e&&o(5,$=e.layout),"optionMapper"in e&&o(17,f=e.optionMapper),"optionFilter"in e&&o(18,y=e.optionFilter),"value"in e&&o(19,b=e.value),"optionLabelClass"in e&&o(6,x=e.optionLabelClass),"title"in e&&o(7,v=e.title),"locale"in e&&o(20,S=e.locale),"optionClass"in e&&o(8,w=e.optionClass),"optionGroupClass"in e&&o(9,k=e.optionGroupClass),"$$scope"in e&&o(23,s=e.$$scope)},e.$$.update=()=>{1343488&e.$$.dirty[0]&&o(11,i=vu(y?m.filter(y):m,S)),133120&e.$$.dirty[0]&&o(10,n=((e=[],t)=>{let o=0;return e.map(e=>(o++,Uo(e)?Uo(e[1])?{id:o,label:e[0],options:e[1].map(e=>yu(e,++o,t))}:yu(e,o,t):e.options?{id:e.id||o,label:e.label,options:e.options.map(e=>yu(e,++o,t))}:yu(e,o,t)))})(i,f)),1024&e.$$.dirty[0]&&o(21,r=fu(n)),2654209&e.$$.dirty[0]&&h<0&&(o(0,h=r.findIndex(e=>wu(e.value,b))),h<0&&o(0,h=(e=>e.findIndex(e=>void 0===e[0]))(m)))},[h,c,d,u,p,$,x,v,w,k,n,i,C,e=>t=>{Su(t.key)&&T(e,t)},e=>t=>{T(e,t)},m,g,f,y,b,S,r,a,s]}class Xu extends rs{constructor(e){super(),ns(this,e,Zu,Gu,yr,{label:1,hideLabel:2,class:3,name:4,selectedIndex:0,options:15,onchange:16,layout:5,optionMapper:17,optionFilter:18,value:19,optionLabelClass:6,title:7,locale:20,optionClass:8,optionGroupClass:9},null,[-1,-1])}}function Yu(e){let t,o,i,n,r,a,s,l,c,d;return{c(){t=Ur("div"),o=Ur("button"),i=Zr("▲"),r=Xr(),a=Ur("button"),s=Zr("▼"),Qr(o,"type","button"),Qr(o,"tabindex","-1"),Qr(o,"aria-label",n=`increase ${e[7]}`),Qr(a,"type","button"),Qr(a,"tabindex","-1"),Qr(a,"aria-label",l=`decrease ${e[7]}`),Qr(t,"class","PinturaInputSpinners")},m(n,l){Hr(n,t,l),_r(t,o),_r(o,i),_r(t,r),_r(t,a),_r(a,s),c||(d=[qr(o,"click",e[18]),qr(a,"click",e[19])],c=!0)},p(e,t){128&t[0]&&n!==(n=`increase ${e[7]}`)&&Qr(o,"aria-label",n),128&t[0]&&l!==(l=`decrease ${e[7]}`)&&Qr(a,"aria-label",l)},d(e){e&&jr(t),c=!1,$r(d)}}}function qu(e){let t,o,i,n,r,a,s=e[14]&&e[9]&&Yu(e);return{c(){t=Ur("div"),o=Ur("input"),n=Xr(),s&&s.c(),Qr(o,"class","PinturaInputField"),Qr(o,"title",e[7]),Qr(o,"type",e[1]),Qr(o,"min",e[4]),Qr(o,"max",e[5]),Qr(o,"step",e[6]),Qr(o,"inputmode",e[3]),o.value=i=e[12]?e[15]:e[0],Qr(o,"placeholder",e[8]),Qr(o,"maxlength",e[13]),o.disabled=e[2],Qr(o,"spellcheck","false"),Qr(o,"autocorrect","off"),Qr(o,"autocapitalize","off"),aa(o,"min-width",e[11]?`${e[11]}em`:void 0),Qr(t,"class","PinturaInput")},m(i,l){Hr(i,t,l),_r(t,o),e[30](o),_r(t,n),s&&s.m(t,null),r||(a=[qr(o,"input",e[17]),qr(o,"blur",function(){fr(e[12]&&e[16])&&(e[12]&&e[16]).apply(this,arguments)}),qr(o,"keydown",e[20]),qr(o,"keyup",e[21])],r=!0)},p(n,r){e=n,128&r[0]&&Qr(o,"title",e[7]),2&r[0]&&Qr(o,"type",e[1]),16&r[0]&&Qr(o,"min",e[4]),32&r[0]&&Qr(o,"max",e[5]),64&r[0]&&Qr(o,"step",e[6]),8&r[0]&&Qr(o,"inputmode",e[3]),36865&r[0]&&i!==(i=e[12]?e[15]:e[0])&&o.value!==i&&(o.value=i),256&r[0]&&Qr(o,"placeholder",e[8]),8192&r[0]&&Qr(o,"maxlength",e[13]),4&r[0]&&(o.disabled=e[2]),2048&r[0]&&aa(o,"min-width",e[11]?`${e[11]}em`:void 0),e[14]&&e[9]?s?s.p(e,r):(s=Yu(e),s.c(),s.m(t,null)):s&&(s.d(1),s=null)},i:ur,o:ur,d(o){o&&jr(t),e[30](null),s&&s.d(),r=!1,$r(a)}}}function Ku(e,t,i){let n,r,a,s,l,c,d,u,p,{value:h}=t,{type:m="text"}=t,{disabled:g=!1}=t,{inputmode:$}=t,{min:f}=t,{max:y}=t,{step:b}=t,{onchange:x=o}=t,{onkeydown:v=o}=t,{onkeyup:S=o}=t,{title:w}=t,{stepMultiplier:k=10}=t,{placeholder:C}=t,{enableSpinButtons:T=!0}=t,{enableStopPropagation:M=!1}=t;const P=()=>{let e=u.value;return"number"===m&&(e="numeric"===$?parseInt(e,10):parseFloat(e),!No(e)||Number.isNaN(e)?e=f||0:r&&(e=Rs(e,f,y))),e};let R=h;const I=()=>{const e=Rs(P()+(p?b*k:b),f,y);e!==h&&(i(27,R=e),i(0,h=e),x(h))},E=()=>{const e=Rs(P()-(p?b*k:b),f,y);e!==h&&(i(27,R=e),i(0,h=e),x(h))};return e.$$set=e=>{"value"in e&&i(0,h=e.value),"type"in e&&i(1,m=e.type),"disabled"in e&&i(2,g=e.disabled),"inputmode"in e&&i(3,$=e.inputmode),"min"in e&&i(4,f=e.min),"max"in e&&i(5,y=e.max),"step"in e&&i(6,b=e.step),"onchange"in e&&i(22,x=e.onchange),"onkeydown"in e&&i(23,v=e.onkeydown),"onkeyup"in e&&i(24,S=e.onkeyup),"title"in e&&i(7,w=e.title),"stepMultiplier"in e&&i(25,k=e.stepMultiplier),"placeholder"in e&&i(8,C=e.placeholder),"enableSpinButtons"in e&&i(9,T=e.enableSpinButtons),"enableStopPropagation"in e&&i(26,M=e.enableStopPropagation)},e.$$.update=()=>{2&e.$$.dirty[0]&&i(29,n="number"===m),48&e.$$.dirty[0]&&i(12,r=No(f)&&No(y)),64&e.$$.dirty[0]&&i(28,a=No(b)),805310464&e.$$.dirty[0]&&i(14,s=n&&r&&a),134218753&e.$$.dirty[0]&&i(15,l=u===document.activeElement?R:h),32&e.$$.dirty[0]&&i(11,c=y?(y+"").length:void 0),2056&e.$$.dirty[0]&&i(13,d="numeric"===$&&c?c:void 0)},[h,m,g,$,f,y,b,w,C,T,u,c,r,d,s,l,()=>{i(27,R=P()),x(h)},()=>{i(27,R=u.value),x(P())},I,E,e=>{if(v(e),!s)return;p=e.shiftKey;const{key:t}=e;M&&e.stopPropagation(),/up|down/i.test(t)&&(/up/i.test(t)&&I(),/down/i.test(t)&&E(),e.preventDefault(),e.stopPropagation())},e=>{if(S(e),!s)return;const{key:t}=e;/up|down/i.test(t)&&(e.preventDefault(),e.stopPropagation())},x,v,S,k,M,R,a,n,function(e){Ca[e?"unshift":"push"](()=>{u=e,i(10,u)})}]}class Ju extends rs{constructor(e){super(),ns(this,e,Ku,qu,yr,{value:0,type:1,disabled:2,inputmode:3,min:4,max:5,step:6,onchange:22,onkeydown:23,onkeyup:24,title:7,stepMultiplier:25,placeholder:8,enableSpinButtons:9,enableStopPropagation:26},null,[-1,-1])}}const Qu=e=>({}),ep=e=>({});function tp(e){let t,o,i,n,r=(e[2]||e[21])+"",a=e[6]&&ip(e);return{c(){a&&a.c(),t=Xr(),o=Ur("span"),Qr(o,"class",i=ld(["PinturaButtonLabel",e[3],e[5]&&"implicit"]))},m(e,i){a&&a.m(e,i),Hr(e,t,i),Hr(e,o,i),o.innerHTML=r,n=!0},p(e,s){e[6]?a?(a.p(e,s),64&s[0]&&ja(a,1)):(a=ip(e),a.c(),ja(a,1),a.m(t.parentNode,t)):a&&(Na(),Ua(a,1,1,()=>{a=null}),Ha()),(!n||2097156&s[0])&&r!==(r=(e[2]||e[21])+"")&&(o.innerHTML=r),(!n||40&s[0]&&i!==(i=ld(["PinturaButtonLabel",e[3],e[5]&&"implicit"])))&&Qr(o,"class",i)},i(e){n||(ja(a),n=!0)},o(e){Ua(a),n=!1},d(e){e&&(jr(t),jr(o)),a&&a.d(e)}}}function op(e){let t,o;return t=new Ju({props:{value:parseFloat(e[10]),onchange:e[17],enableStopPropagation:!0,type:"number",inputmode:"numeric",min:e[8].reduce(e[29],1/0),max:e[8].reduce(e[30],-1/0),enableSpinButtons:!1}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o[0]&&(i.value=parseFloat(e[10])),131072&o[0]&&(i.onchange=e[17]),256&o[0]&&(i.min=e[8].reduce(e[29],1/0)),256&o[0]&&(i.max=e[8].reduce(e[30],-1/0)),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ip(e){let t,o;return t=new Od({props:{class:"PinturaButtonIcon",$$slots:{default:[np]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};64&o[0]|2&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function np(e){let t;return{c(){t=Gr("g")},m(o,i){Hr(o,t,i),t.innerHTML=e[6]},p(e,o){64&o[0]&&(t.innerHTML=e[6])},d(e){e&&jr(t)}}}function rp(e){let t,o,i,n,r;const a=[op,tp],s=[];function l(e,t){return e[18]?0:1}return o=l(e),i=s[o]=a[o](e),{c(){t=Ur("span"),i.c(),Qr(t,"slot","label"),Qr(t,"class",n=ld(["PinturaButtonInner",e[18]&&"PinturaComboBox",e[4]]))},m(e,i){Hr(e,t,i),s[o].m(t,null),r=!0},p(e,c){let d=o;o=l(e),o===d?s[o].p(e,c):(Na(),Ua(s[d],1,1,()=>{s[d]=null}),Ha(),i=s[o],i?i.p(e,c):(i=s[o]=a[o](e),i.c()),ja(i,1),i.m(t,null)),(!r||262160&c[0]&&n!==(n=ld(["PinturaButtonInner",e[18]&&"PinturaComboBox",e[4]])))&&Qr(t,"class",n)},i(e){r||(ja(i),r=!0)},o(e){Ua(i),r=!1},d(e){e&&jr(t),s[o].d()}}}function ap(e){let t,o,i=e[34].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"slot","group")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){8&t[1]&&i!==(i=e[34].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function sp(e){let t,o;return t=new Od({props:{style:L(e[14])?e[14](e[34].value):e[14],$$slots:{default:[lp]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16384&o[0]|8&o[1]&&(i.style=L(e[14])?e[14](e[34].value):e[14]),10&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function lp(e){let t,o=e[34].icon+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){8&i[1]&&o!==(o=e[34].icon+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function cp(e){let t,o,i,n,r,a,s,l=e[34].label+"",c=e[34].sublabel&&dp(e);return{c(){t=Ur("span"),o=new la(!1),i=Xr(),c&&c.c(),o.a=i,Qr(t,"class",n=ld(["PinturaDropdownOptionLabel",e[11]]))},m(n,d){Hr(n,t,d),o.m(l,t),_r(t,i),c&&c.m(t,null),a||(s=Ar(r=fd.call(null,t,L(e[15])?e[15](e[34].value):e[15])),a=!0)},p(e,i){8&i[1]&&l!==(l=e[34].label+"")&&o.p(l),e[34].sublabel?c?c.p(e,i):(c=dp(e),c.c(),c.m(t,null)):c&&(c.d(1),c=null),2048&i[0]&&n!==(n=ld(["PinturaDropdownOptionLabel",e[11]]))&&Qr(t,"class",n),r&&fr(r.update)&&32768&i[0]|8&i[1]&&r.update.call(null,L(e[15])?e[15](e[34].value):e[15])},d(e){e&&jr(t),c&&c.d(),a=!1,s()}}}function dp(e){let t,o=e[34].sublabel+"";return{c(){t=Ur("span"),Qr(t,"class","PinturaDropdownOptionSublabel")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){8&i[1]&&o!==(o=e[34].sublabel+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function up(e){let t,o,i,n=e[34].icon&&sp(e),r=!e[34].hideLabel&&cp(e);return{c(){t=Ur("span"),n&&n.c(),o=Xr(),r&&r.c(),Qr(t,"slot","option")},m(e,a){Hr(e,t,a),n&&n.m(t,null),_r(t,o),r&&r.m(t,null),i=!0},p(e,i){e[34].icon?n?(n.p(e,i),8&i[1]&&ja(n,1)):(n=sp(e),n.c(),ja(n,1),n.m(t,o)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[34].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=cp(e),r.c(),r.m(t,null))},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(e){e&&jr(t),n&&n.d(),r&&r.d()}}}function pp(e){let t,o,i,n,r,a;const s=e[28].controls,l=kr(s,e,e[32],ep);return i=new Xu({props:{class:"PinturaOptionsList PinturaScrollableContent",name:e[7],value:e[10],selectedIndex:e[9],optionFilter:e[12],optionMapper:e[13],optionLabelClass:ld(["PinturaDropdownOptionLabel",e[11]]),optionGroupClass:"PinturaListOptionGroup",optionClass:"PinturaListOption",options:e[19],onchange:e[22],$$slots:{option:[up,({option:e})=>({34:e}),({option:e})=>[0,e?8:0]],group:[ap,({option:e})=>({34:e}),({option:e})=>[0,e?8:0]]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),l&&l.c(),o=Xr(),ts(i.$$.fragment),Qr(t,"slot","details"),Qr(t,"class","PinturaOptionsListWrapper")},m(s,c){Hr(s,t,c),l&&l.m(t,null),_r(t,o),os(i,t,null),n=!0,r||(a=qr(t,"keydown",e[24]),r=!0)},p(e,t){l&&l.p&&(!n||2&t[1])&&Mr(l,s,e,e[32],n?Tr(s,e[32],t,Qu):Pr(e[32]),ep);const o={};128&t[0]&&(o.name=e[7]),1024&t[0]&&(o.value=e[10]),512&t[0]&&(o.selectedIndex=e[9]),4096&t[0]&&(o.optionFilter=e[12]),8192&t[0]&&(o.optionMapper=e[13]),2048&t[0]&&(o.optionLabelClass=ld(["PinturaDropdownOptionLabel",e[11]])),524288&t[0]&&(o.options=e[19]),51200&t[0]|10&t[1]&&(o.$$scope={dirty:t,ctx:e}),i.$set(o)},i(e){n||(ja(l,e),ja(i.$$.fragment,e),n=!0)},o(e){Ua(l,e),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(t),l&&l.d(e),is(i),r=!1,a()}}}function hp(e){let t,o,i;function n(t){e[31](t)}let r={onshow:e[23],buttonTitle:Wd(e[2],e[1]),buttonClass:ld(["PinturaDropdownButton",e[0],e[5]&&"PinturaDropdownIconOnly"]),buttonOnClick:e[16],$$slots:{details:[pp],label:[rp]},$$scope:{ctx:e}};return void 0!==e[20]&&(r.isActive=e[20]),t=new pu({props:r}),Ca.push(()=>es(t,"isActive",n)),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};6&i[0]&&(n.buttonTitle=Wd(e[2],e[1])),33&i[0]&&(n.buttonClass=ld(["PinturaDropdownButton",e[0],e[5]&&"PinturaDropdownIconOnly"])),65536&i[0]&&(n.buttonOnClick=e[16]),3080188&i[0]|2&i[1]&&(n.$$scope={dirty:i,ctx:e}),!o&&1048576&i[0]&&(o=!0,n.isActive=e[20],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function mp(e,t,i){let n,r,{$$slots:a={},$$scope:s}=t,{class:l}=t,{title:c}=t,{label:d}=t,{labelClass:u}=t,{innerClass:p}=t,{hideLabel:h=!1}=t,{icon:m}=t,{name:g}=t,{options:$=[]}=t,{selectedIndex:f=-1}=t,{value:y}=t,{optionLabelClass:b}=t,{optionFilter:x}=t,{optionMapper:v}=t,{optionIconStyle:S}=t,{optionLabelStyle:w}=t,{locale:k}=t,{onclick:C}=t,{onchange:T=o}=t,{onload:M=o}=t,{ondestroy:P=o}=t,{enableInput:R=!1}=t;let I;fa(()=>M({options:$})),ba(()=>P({options:$}));return e.$$set=e=>{"class"in e&&i(0,l=e.class),"title"in e&&i(1,c=e.title),"label"in e&&i(2,d=e.label),"labelClass"in e&&i(3,u=e.labelClass),"innerClass"in e&&i(4,p=e.innerClass),"hideLabel"in e&&i(5,h=e.hideLabel),"icon"in e&&i(6,m=e.icon),"name"in e&&i(7,g=e.name),"options"in e&&i(8,$=e.options),"selectedIndex"in e&&i(9,f=e.selectedIndex),"value"in e&&i(10,y=e.value),"optionLabelClass"in e&&i(11,b=e.optionLabelClass),"optionFilter"in e&&i(12,x=e.optionFilter),"optionMapper"in e&&i(13,v=e.optionMapper),"optionIconStyle"in e&&i(14,S=e.optionIconStyle),"optionLabelStyle"in e&&i(15,w=e.optionLabelStyle),"locale"in e&&i(25,k=e.locale),"onclick"in e&&i(16,C=e.onclick),"onchange"in e&&i(17,T=e.onchange),"onload"in e&&i(26,M=e.onload),"ondestroy"in e&&i(27,P=e.ondestroy),"enableInput"in e&&i(18,R=e.enableInput),"$$scope"in e&&i(32,s=e.$$scope)},e.$$.update=()=>{33554688&e.$$.dirty[0]&&i(19,n=k?vu($,k):$),525312&e.$$.dirty[0]&&i(21,r=n.reduce((e,t)=>{if(e)return e;const o=Array.isArray(t)?t:[t,t],[i,n]=o;return wu(i,y)?n:void 0},void 0)||(e=>{const t=e.find(e=>void 0===e[0]);if(t)return t[1]})(n)||y)},[l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w,C,T,R,n,I,r,e=>{i(21,r=e.value),T(e),i(20,I=!1)},({e:e,panel:t,preventFocus:o})=>{if(o(),e&&e.key&&/up|down/i.test(e.key))return Jd(t.querySelector("input:not([disabled])"));Jd(t.querySelector("fieldset"))},e=>{/tab/i.test(e.key)&&e.preventDefault()},k,M,P,a,(e,[t])=>(t=parseFloat(t))<e?t:e,(e,[t])=>(t=parseFloat(t))>e?t:e,function(e){I=e,i(20,I)},s]}class gp extends rs{constructor(e){super(),ns(this,e,mp,hp,yr,{class:0,title:1,label:2,labelClass:3,innerClass:4,hideLabel:5,icon:6,name:7,options:8,selectedIndex:9,value:10,optionLabelClass:11,optionFilter:12,optionMapper:13,optionIconStyle:14,optionLabelStyle:15,locale:25,onclick:16,onchange:17,onload:26,ondestroy:27,enableInput:18},null,[-1,-1])}}function $p(e){let t;return{c(){t=Ur("div"),Qr(t,"slot","details")},m(o,i){Hr(o,t,i),e[14](t)},p:ur,d(o){o&&jr(t),e[14](null)}}}function fp(e){let t,o,i;function n(t){e[15](t)}let r={buttonLabel:e[1],buttonClass:e[2],buttonIcon:e[3],buttonHideLabel:e[4],buttonTitle:e[5],buttonLabelClass:e[6],onshow:e[7],onhide:e[8],$$slots:{details:[$p]},$$scope:{ctx:e}};return void 0!==e[0]&&(r.isActive=e[0]),t=new pu({props:r}),Ca.push(()=>es(t,"isActive",n)),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,[i]){const n={};2&i&&(n.buttonLabel=e[1]),4&i&&(n.buttonClass=e[2]),8&i&&(n.buttonIcon=e[3]),16&i&&(n.buttonHideLabel=e[4]),32&i&&(n.buttonTitle=e[5]),64&i&&(n.buttonLabelClass=e[6]),128&i&&(n.onshow=e[7]),256&i&&(n.onhide=e[8]),66048&i&&(n.$$scope={dirty:i,ctx:e}),!o&&1&i&&(o=!0,n.isActive=e[0],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function yp(e,t,i){let{buttonLabel:n}=t,{buttonClass:r}=t,{buttonIcon:a}=t,{buttonHideLabel:s}=t,{buttonTitle:l}=t,{buttonLabelClass:c}=t,{isActive:d=!1}=t,{root:u}=t,{ondestroy:p=o}=t,{onshow:h=o}=t,{onhide:m=o}=t;let g;return ba(p),e.$$set=e=>{"buttonLabel"in e&&i(1,n=e.buttonLabel),"buttonClass"in e&&i(2,r=e.buttonClass),"buttonIcon"in e&&i(3,a=e.buttonIcon),"buttonHideLabel"in e&&i(4,s=e.buttonHideLabel),"buttonTitle"in e&&i(5,l=e.buttonTitle),"buttonLabelClass"in e&&i(6,c=e.buttonLabelClass),"isActive"in e&&i(0,d=e.isActive),"root"in e&&i(10,u=e.root),"ondestroy"in e&&i(11,p=e.ondestroy),"onshow"in e&&i(7,h=e.onshow),"onhide"in e&&i(8,m=e.onhide)},e.$$.update=()=>{1536&e.$$.dirty&&g&&u&&g.firstChild!==u&&(g.hasChildNodes()?g.replaceChild(u,g.firstChild):g.append(u))},[d,n,r,a,s,l,c,h,m,g,u,p,()=>i(0,d=!1),()=>i(0,d=!0),function(e){Ca[e?"unshift":"push"](()=>{g=e,i(9,g)})},function(e){d=e,i(0,d)}]}class bp extends rs{constructor(e){super(),ns(this,e,yp,fp,yr,{buttonLabel:1,buttonClass:2,buttonIcon:3,buttonHideLabel:4,buttonTitle:5,buttonLabelClass:6,isActive:0,root:10,ondestroy:11,onshow:7,onhide:8,hide:12,show:13})}get hide(){return this.$$.ctx[12]}get show(){return this.$$.ctx[13]}}var xp=(e,t={})=>{const{direction:o,shiftMultiplier:i=10,bubbles:n=!1,preventDefault:r=!1,stopKeydownPropagation:a=!0}=t,s="horizontal"===o,l="vertical"===o,c=t=>{const{key:o}=t,c=t.shiftKey,d=/up|down/i.test(o),u=/left|right/i.test(o);if(!u&&!d)return;if(s&&d)return;if(l&&u)return;const p=c?i:1;a&&t.stopPropagation(),r&&t.preventDefault(),e.dispatchEvent(new CustomEvent("nudge",{bubbles:n,detail:be((/left/i.test(o)?-1:/right/i.test(o)?1:0)*p,(/up/i.test(o)?-1:/down/i.test(o)?1:0)*p)}))};return e.addEventListener("keydown",c),{destroy(){e.removeEventListener("keydown",c)}}},vp=(e,t,o)=>(e-t)/(o-t);var Sp=(e,t)=>{const{fixScrollDirection:o=!1}=t||{},{deltaX:i,deltaY:n}=e;let r=function(e,t){let o=0;return o=Math.abs(e)>Math.abs(t)?e:t,-1*o}(i,n);return ko()?r%1!=0?r*=.05:N()?r*=.1:r*=.25:0===Math.abs(i)&&Math.abs(n)>=100?r*=.05:r*=.25,r=Rs(r,-10,10),ko()&&!o&&(r*=-1),r};const wp=e=>({}),kp=e=>({});function Cp(e){let t,o,i;return{c(){t=Ur("label"),o=Zr(e[0]),Qr(t,"for",e[17]),Qr(t,"class",i=e[1]?"implicit":void 0)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,n){1&n[0]&&na(o,e[0]),131072&n[0]&&Qr(t,"for",e[17]),2&n[0]&&i!==(i=e[1]?"implicit":void 0)&&Qr(t,"class",i)},d(e){e&&jr(t)}}}function Tp(e){let t,o,i,n,r,a,s,l;return o=new Od({props:{$$slots:{default:[Mp]},$$scope:{ctx:e}}}),r=new Od({props:{$$slots:{default:[Pp]},$$scope:{ctx:e}}}),{c(){t=Ur("button"),ts(o.$$.fragment),i=Xr(),n=Ur("button"),ts(r.$$.fragment),Qr(t,"type","button"),Qr(t,"aria-label","Increase"),Qr(n,"type","button"),Qr(n,"aria-label","Decrease")},m(c,d){Hr(c,t,d),os(o,t,null),Hr(c,i,d),Hr(c,n,d),os(r,n,null),a=!0,s||(l=[qr(t,"pointerdown",e[20](1)),qr(t,"keydown",e[20](1)),qr(n,"pointerdown",e[20](-1)),qr(n,"keydown",e[20](-1))],s=!0)},p(e,t){const i={};512&t[1]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i);const n={};512&t[1]&&(n.$$scope={dirty:t,ctx:e}),r.$set(n)},i(e){a||(ja(o.$$.fragment,e),ja(r.$$.fragment,e),a=!0)},o(e){Ua(o.$$.fragment,e),Ua(r.$$.fragment,e),a=!1},d(e){e&&(jr(t),jr(i),jr(n)),is(o),is(r),s=!1,$r(l)}}}function Mp(e){let t;return{c(){t=Gr("path"),Qr(t,"d","M8 12 h8 M12 8 v8")},m(e,o){Hr(e,t,o)},p:ur,d(e){e&&jr(t)}}}function Pp(e){let t;return{c(){t=Gr("path"),Qr(t,"d","M9 12 h6")},m(e,o){Hr(e,t,o)},p:ur,d(e){e&&jr(t)}}}function Rp(e){let t,o,i,n,r,a,s,l,c,d,u,p,h,m,g,$,f=e[0]&&Cp(e);const y=e[38].default,b=kr(y,e,e[40],null),x=e[38].knob,v=kr(x,e,e[40],kp);let S=e[8]&&Tp(e);return{c(){t=Ur("div"),o=Ur("div"),f&&f.c(),i=Xr(),n=Ur("input"),r=Xr(),a=Ur("div"),b&&b.c(),l=Xr(),c=Ur("div"),d=Ur("div"),v&&v.c(),p=Xr(),S&&S.c(),Qr(n,"type","range"),Qr(n,"id",e[17]),Qr(n,"min",e[2]),Qr(n,"max",e[3]),Qr(n,"step",e[4]),n.value=e[13],aa(n,"pointer-events",e[9]?"none":void 0),Qr(a,"class",s=ld(["PinturaSliderTrack",e[5]])),Qr(d,"class",u=ld(["PinturaSliderKnob",e[6]])),Qr(c,"class","PinturaSliderKnobController"),aa(c,"transform",e[16]),Qr(o,"class","PinturaSliderControl"),aa(o,"--slider-position",Math.round(e[14])),Qr(t,"class",h=ld(["PinturaSlider",e[11]])),Qr(t,"data-direction",e[7])},m(s,u){Hr(s,t,u),_r(t,o),f&&f.m(o,null),_r(o,i),_r(o,n),e[39](n),_r(o,r),_r(o,a),b&&b.m(a,null),_r(o,l),_r(o,c),_r(c,d),v&&v.m(d,null),_r(t,p),S&&S.m(t,null),m=!0,g||($=[qr(n,"input",e[18]),qr(n,"nudge",e[19]),qr(n,"wheel",e[21]),Ar(xp.call(null,n)),qr(o,"pointerdown",function(){fr(e[10]&&e[12])&&(e[10]&&e[12]).apply(this,arguments)})],g=!0)},p(r,l){(e=r)[0]?f?f.p(e,l):(f=Cp(e),f.c(),f.m(o,i)):f&&(f.d(1),f=null),(!m||131072&l[0])&&Qr(n,"id",e[17]),(!m||4&l[0])&&Qr(n,"min",e[2]),(!m||8&l[0])&&Qr(n,"max",e[3]),(!m||16&l[0])&&Qr(n,"step",e[4]),(!m||8192&l[0])&&(n.value=e[13]),512&l[0]&&aa(n,"pointer-events",e[9]?"none":void 0),b&&b.p&&(!m||512&l[1])&&Mr(b,y,e,e[40],m?Tr(y,e[40],l,null):Pr(e[40]),null),(!m||32&l[0]&&s!==(s=ld(["PinturaSliderTrack",e[5]])))&&Qr(a,"class",s),v&&v.p&&(!m||512&l[1])&&Mr(v,x,e,e[40],m?Tr(x,e[40],l,wp):Pr(e[40]),kp),(!m||64&l[0]&&u!==(u=ld(["PinturaSliderKnob",e[6]])))&&Qr(d,"class",u),65536&l[0]&&aa(c,"transform",e[16]),16384&l[0]&&aa(o,"--slider-position",Math.round(e[14])),e[8]?S?(S.p(e,l),256&l[0]&&ja(S,1)):(S=Tp(e),S.c(),ja(S,1),S.m(t,null)):S&&(Na(),Ua(S,1,1,()=>{S=null}),Ha()),(!m||2048&l[0]&&h!==(h=ld(["PinturaSlider",e[11]])))&&Qr(t,"class",h),(!m||128&l[0])&&Qr(t,"data-direction",e[7])},i(e){m||(ja(b,e),ja(v,e),ja(S),m=!0)},o(e){Ua(b,e),Ua(v,e),Ua(S),m=!1},d(o){o&&jr(t),f&&f.d(),e[39](null),b&&b.d(o),v&&v.d(o),S&&S.d(),g=!1,$r($)}}}function Ip(e,t,i){let n,r,a,s,l,c,d,u,p,h,m,g,$,f,b,x,{$$slots:v={},$$scope:S}=t,{id:w}=t,{label:k}=t,{hideLabel:C=!1}=t,{min:T=0}=t,{max:M=100}=t,{step:P=1}=t,{value:R=0}=t,{valueMin:I}=t,{valueMax:E}=t,{trackClass:A}=t,{knobClass:L}=t,{ongrab:F=o}=t,{onchange:z=o}=t,{onrelease:D=o}=t,{onexceed:O=o}=t,{direction:W="x"}=t,{getValue:_=ee}=t,{setValue:V=ee}=t,{enableSpinButtons:N=!0}=t,{enableForceUseKnob:H=!1}=t,{enableStopPropagation:j=!0}=t,{enablePointerdownListener:U=!0}=t,{maxInteractionDistance:G=6}=t,{class:Z}=t;const X=e=>V(((e,t)=>(t=1/t,Math.round(e*t)/t))(Rs(e,T,M),P),R),Y=(e,t,o={})=>{const{grabbed:n=!1,released:r=!1}=o,s=X(T+e/t*a),l=I||T,c=E||M;i(22,R=y(s)?s:Rs(s,l,c)),x!==s&&(x=s,!y(s)&&(s<l||s>c)&&O(R,s),R!==b&&(b=R,n&&F(R),z(R),r&&D(R)))};let q;let K;const J=e=>{const t=e[p]-f;Y($+t,g)},Q=e=>{K=setTimeout(()=>{g=void 0},50),document.documentElement.removeEventListener("pointermove",J),document.documentElement.removeEventListener("pointerup",Q),z(R),D(R)},te=()=>{i(22,R=X(r+ie*P)),z(R)};let oe=null,ie=1,ne=!1;const re=e=>{clearTimeout(oe),oe=null,ne||te(),D(R),document.removeEventListener("pointerup",re),document.removeEventListener("keyup",re)};return e.$$set=e=>{"id"in e&&i(23,w=e.id),"label"in e&&i(0,k=e.label),"hideLabel"in e&&i(1,C=e.hideLabel),"min"in e&&i(2,T=e.min),"max"in e&&i(3,M=e.max),"step"in e&&i(4,P=e.step),"value"in e&&i(22,R=e.value),"valueMin"in e&&i(24,I=e.valueMin),"valueMax"in e&&i(25,E=e.valueMax),"trackClass"in e&&i(5,A=e.trackClass),"knobClass"in e&&i(6,L=e.knobClass),"ongrab"in e&&i(26,F=e.ongrab),"onchange"in e&&i(27,z=e.onchange),"onrelease"in e&&i(28,D=e.onrelease),"onexceed"in e&&i(29,O=e.onexceed),"direction"in e&&i(7,W=e.direction),"getValue"in e&&i(30,_=e.getValue),"setValue"in e&&i(31,V=e.setValue),"enableSpinButtons"in e&&i(8,N=e.enableSpinButtons),"enableForceUseKnob"in e&&i(9,H=e.enableForceUseKnob),"enableStopPropagation"in e&&i(32,j=e.enableStopPropagation),"enablePointerdownListener"in e&&i(10,U=e.enablePointerdownListener),"maxInteractionDistance"in e&&i(33,G=e.maxInteractionDistance),"class"in e&&i(11,Z=e.class),"$$scope"in e&&i(40,S=e.$$scope)},e.$$.update=()=>{8388609&e.$$.dirty[0]&&i(17,n=w||(k?`PinturaSlider_${B()}`:void 0)),1077936128&e.$$.dirty[0]&&i(13,r=void 0!==R?_(R):0),12&e.$$.dirty[0]&&(a=M-T),8204&e.$$.dirty[0]&&i(35,s=vp(r,T,M)),16&e.$$.dirty[1]&&i(14,l=100*s),128&e.$$.dirty[0]&&i(36,c=W.toUpperCase()),128&e.$$.dirty[0]&&i(37,d="x"===W?"Width":"Height"),64&e.$$.dirty[1]&&(u=`offset${d}`),32&e.$$.dirty[1]&&(p=`page${c}`),16384&e.$$.dirty[0]|32&e.$$.dirty[1]&&i(16,h=`translate${c}(${l}%)`)},[k,C,T,M,P,A,L,W,N,H,U,Z,e=>{clearTimeout(K);let t=!1;j&&e.stopPropagation(),clearTimeout(q);const o=m.getBoundingClientRect();if(g=m[u],f=e[p],$=f-o[W],H){if(Math.abs($-s*g)>G)return;t=!0,e.stopPropagation()}return document.activeElement!==m&&m.focus(),Y($,g,{grabbed:!0}),document.documentElement.addEventListener("pointermove",J),document.documentElement.addEventListener("pointerup",Q),t},r,l,m,h,n,e=>{g||(i(22,R=V(parseFloat(e.target.value))),R!==b&&(b=R,z(R)))},e=>{const t=m[u];Y((r-T)/a*t+e.detail[W],t),clearTimeout(q),q=setTimeout(()=>{D(R)},250)},e=>t=>{("keydown"!==t.type||Su(t.key)&&null===oe)&&(clearTimeout(q),ie=e,ne=!1,oe=setInterval(()=>{ne=!0,te()},100),"pointerdown"===t.type?(document.addEventListener("pointercancel",re),document.addEventListener("pointerup",re)):document.addEventListener("keyup",re))},e=>{const t=Sp(e),o=t<0?Math.floor(t):Math.ceil(t);i(22,R=X(r+o*P)),z(R)},R,w,I,E,F,z,D,O,_,V,j,G,e=>{const t=m.getBoundingClientRect(),o=e[p]-t[W],i=m[u];return Math.abs(o-s*i)},s,c,d,v,function(e){Ca[e?"unshift":"push"](()=>{m=e,i(15,m)})},S]}class Ep extends rs{constructor(e){super(),ns(this,e,Ip,Rp,yr,{id:23,label:0,hideLabel:1,min:2,max:3,step:4,value:22,valueMin:24,valueMax:25,trackClass:5,knobClass:6,ongrab:26,onchange:27,onrelease:28,onexceed:29,direction:7,getValue:30,setValue:31,enableSpinButtons:8,enableForceUseKnob:9,enableStopPropagation:32,enablePointerdownListener:10,maxInteractionDistance:33,class:11,eventDistanceToKnob:34,handlePointerDown:12},null,[-1,-1])}get eventDistanceToKnob(){return this.$$.ctx[34]}get handlePointerDown(){return this.$$.ctx[12]}}function Ap(e){let t,o;return t=new Od({props:{class:"PinturaButtonIcon",$$slots:{default:[Lp]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1048580&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Lp(e){let t;return{c(){t=Gr("g")},m(o,i){Hr(o,t,i),t.innerHTML=e[2]},p(e,o){4&o&&(t.innerHTML=e[2])},d(e){e&&jr(t)}}}function Fp(e){let t,o,i=bu(e[8],e[6])+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class","PinturaButtonLabelPrefix")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){320&t&&i!==(i=bu(e[8],e[6])+"")&&na(o,i)},d(e){e&&jr(t)}}}function zp(e){let t,o,i,n,r,a,s,l,c,d=e[2]&&Ap(e),u=e[8]&&Fp(e);return{c(){t=Ur("span"),d&&d.c(),o=Xr(),u&&u.c(),i=Xr(),n=Ur("span"),r=Zr(e[9]),Qr(n,"class",a=ld(["PinturaButtonLabel",e[3],e[5]&&"implicit"])),Qr(t,"slot","label"),Qr(t,"title",s=bu(e[1],e[6])),Qr(t,"class",l=ld(["PinturaButtonInner",e[4]]))},m(e,a){Hr(e,t,a),d&&d.m(t,null),_r(t,o),u&&u.m(t,null),_r(t,i),_r(t,n),_r(n,r),c=!0},p(e,p){e[2]?d?(d.p(e,p),4&p&&ja(d,1)):(d=Ap(e),d.c(),ja(d,1),d.m(t,o)):d&&(Na(),Ua(d,1,1,()=>{d=null}),Ha()),e[8]?u?u.p(e,p):(u=Fp(e),u.c(),u.m(t,i)):u&&(u.d(1),u=null),(!c||512&p)&&na(r,e[9]),(!c||40&p&&a!==(a=ld(["PinturaButtonLabel",e[3],e[5]&&"implicit"])))&&Qr(n,"class",a),(!c||66&p&&s!==(s=bu(e[1],e[6])))&&Qr(t,"title",s),(!c||16&p&&l!==(l=ld(["PinturaButtonInner",e[4]])))&&Qr(t,"class",l)},i(e){c||(ja(d),c=!0)},o(e){Ua(d),c=!1},d(e){e&&jr(t),d&&d.d(),u&&u.d()}}}function Dp(e){let t,o,i,n,r;const a=[{label:bu(e[1],e[6])},{hideLabel:!0},e[12],{value:e[7]},{onchange:e[11]}];let s={};for(let e=0;e<a.length;e+=1)s=hr(s,a[e]);return o=new Ep({props:s}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"slot","details")},m(a,s){Hr(a,t,s),os(o,t,null),i=!0,n||(r=qr(t,"keydown",e[10]),n=!0)},p(e,t){const i=6338&t?Ja(a,[66&t&&{label:bu(e[1],e[6])},a[1],4096&t&&Qa(e[12]),128&t&&{value:e[7]},2048&t&&{onchange:e[11]}]):{};o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o),n=!1,r()}}}function Op(e){let t,o;return t=new pu({props:{canConfirm:!0,panelClass:"PinturaSliderPanel",buttonClass:ld(["PinturaSliderButton",e[0],e[5]&&"PinturaSliderIconOnly"]),$$slots:{details:[Dp],label:[zp]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,[o]){const i={};33&o&&(i.buttonClass=ld(["PinturaSliderButton",e[0],e[5]&&"PinturaSliderIconOnly"])),1053694&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Bp(e,t,i){const n=["class","title","label","icon","labelClass","innerClass","hideLabel","locale","value","onchange","labelPrefix"];let r=Ir(t,n),{class:a}=t,{title:s}=t,{label:l=Math.round}=t,{icon:c}=t,{labelClass:d}=t,{innerClass:u}=t,{hideLabel:p=!1}=t,{locale:h}=t,{value:m}=t,{onchange:g=o}=t,{labelPrefix:$}=t;const{min:f,max:y,getValue:b=ee}=r;let x;const v=e=>i(9,x=(e=>L(l)?l(b(e),f,y,e):l)(e));return e.$$set=e=>{t=hr(hr({},t),Rr(e)),i(12,r=Ir(t,n)),"class"in e&&i(0,a=e.class),"title"in e&&i(1,s=e.title),"label"in e&&i(13,l=e.label),"icon"in e&&i(2,c=e.icon),"labelClass"in e&&i(3,d=e.labelClass),"innerClass"in e&&i(4,u=e.innerClass),"hideLabel"in e&&i(5,p=e.hideLabel),"locale"in e&&i(6,h=e.locale),"value"in e&&i(7,m=e.value),"onchange"in e&&i(14,g=e.onchange),"labelPrefix"in e&&i(8,$=e.labelPrefix)},e.$$.update=()=>{8320&e.$$.dirty&&v(m)},[a,s,c,d,u,p,h,m,$,x,e=>{/tab/i.test(e.key)&&e.preventDefault()},e=>{v(e),g(e)},r,l,g]}class Wp extends rs{constructor(e){super(),ns(this,e,Bp,Op,yr,{class:0,title:1,label:13,icon:2,labelClass:3,innerClass:4,hideLabel:5,locale:6,value:7,onchange:14,labelPrefix:8})}}function _p(e){let t,o,i,n,r,a,s,l;return{c(){t=Ur("span"),o=Gr("svg"),i=Gr("g"),n=Gr("circle"),r=Gr("circle"),a=Xr(),s=Ur("span"),l=Zr(e[3]),Qr(n,"class","PinturaProgressIndicatorBar"),Qr(n,"r","8.5"),Qr(n,"cx","10"),Qr(n,"cy","10"),Qr(n,"stroke-linecap","round"),Qr(n,"opacity",".25"),Qr(r,"class","PinturaProgressIndicatorFill"),Qr(r,"r","8.5"),Qr(r,"stroke-dasharray",e[2]),Qr(r,"cx","10"),Qr(r,"cy","10"),Qr(r,"transform","rotate(-90) translate(-20)"),Qr(i,"fill","none"),Qr(i,"stroke","currentColor"),Qr(i,"stroke-width","2.5"),Qr(i,"stroke-linecap","round"),Qr(i,"opacity",e[1]),Qr(o,"width","20"),Qr(o,"height","20"),Qr(o,"viewBox","0 0 20 20"),Qr(o,"xmlns","http://www.w3.org/2000/svg"),Qr(o,"aria-hidden","true"),Qr(o,"focusable","false"),Qr(s,"class","implicit"),Qr(t,"class","PinturaProgressIndicator"),Qr(t,"data-status",e[0]),aa(t,"opacity",e[4])},m(e,c){Hr(e,t,c),_r(t,o),_r(o,i),_r(i,n),_r(i,r),_r(t,a),_r(t,s),_r(s,l)},p(e,[o]){4&o&&Qr(r,"stroke-dasharray",e[2]),2&o&&Qr(i,"opacity",e[1]),8&o&&na(l,e[3]),1&o&&Qr(t,"data-status",e[0]),16&o&&aa(t,"opacity",e[4])},i:ur,o:ur,d(e){e&&jr(t)}}}function Vp(e,t,o){let i,n,r,a,s,l,c,d;const u=xa();let{progress:p}=t,{min:h=0}=t,{max:m=100}=t,{labelBusy:g="Busy"}=t,{opacity:$}=t;const f=Sa("isAnimated");wr(e,f,e=>o(14,s=e));const y=Fc($,{precision:.01});wr(e,y,e=>o(4,d=e));const b=Fc(0,{precision:.01}),x=Fc(0,{precision:.01});wr(e,x,e=>o(15,l=e));const v=cs([b],e=>Rs(e,h,m));wr(e,v,e=>o(16,c=e));const S=v.subscribe(e=>{1===p&&Math.round(e)>=100&&u("complete")});return fa(()=>{x.set(1,{hard:!s})}),ba(()=>{S()}),e.$$set=e=>{"progress"in e&&o(9,p=e.progress),"min"in e&&o(10,h=e.min),"max"in e&&o(11,m=e.max),"labelBusy"in e&&o(12,g=e.labelBusy),"opacity"in e&&o(13,$=e.opacity)},e.$$.update=()=>{24576&e.$$.dirty&&No($)&&y.set($,{hard:!s}),16896&e.$$.dirty&&p&&p!==1/0&&b.set(100*p,{hard:!s}),70144&e.$$.dirty&&o(3,i=p===1/0?g:`${Math.round(c)}%`),66048&e.$$.dirty&&o(2,n=p===1/0?"26.5 53":c/100*53+" 53"),32768&e.$$.dirty&&o(1,r=l),512&e.$$.dirty&&o(0,a=p===1/0?"busy":"loading")},[a,r,n,i,d,f,y,x,v,p,h,m,g,$,s,l,c]}class Np extends rs{constructor(e){super(),ns(this,e,Vp,_p,yr,{progress:9,min:10,max:11,labelBusy:12,opacity:13})}}function Hp(e){let t,o,i=bu(e[0],e[1])+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class",e[3])},m(e,i){Hr(e,t,i),_r(t,o)},p(e,n){3&n&&i!==(i=bu(e[0],e[1])+"")&&na(o,i),8&n&&Qr(t,"class",e[3])},d(e){e&&jr(t)}}}function jp(e){let t,o,i,n,r=e[0]&&Hp(e);return i=new Rh({props:{items:e[2]}}),{c(){t=Ur("li"),r&&r.c(),o=Xr(),ts(i.$$.fragment),Qr(t,"class","PinturaShapeStyle")},m(e,a){Hr(e,t,a),r&&r.m(t,null),_r(t,o),os(i,t,null),n=!0},p(e,[n]){e[0]?r?r.p(e,n):(r=Hp(e),r.c(),r.m(t,o)):r&&(r.d(1),r=null);const a={};4&n&&(a.items=e[2]),i.$set(a)},i(e){n||(ja(i.$$.fragment,e),n=!0)},o(e){Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(t),r&&r.d(),is(i)}}}function Up(e,t,o){let i,{title:n}=t,{locale:r}=t,{items:a}=t,{hideTitle:s=!1}=t;return e.$$set=e=>{"title"in e&&o(0,n=e.title),"locale"in e&&o(1,r=e.locale),"items"in e&&o(2,a=e.items),"hideTitle"in e&&o(4,s=e.hideTitle)},e.$$.update=()=>{16&e.$$.dirty&&o(3,i="PinturaShapeStyleLabel"+(s?" implicit":""))},[n,r,a,i,s]}class Gp extends rs{constructor(e){super(),ns(this,e,Up,jp,yr,{title:0,locale:1,items:2,hideTitle:4})}}var Zp=(e,t,o)=>{let i,n,r;const a=Math.floor(6*e),s=6*e-a,l=o*(1-t),c=o*(1-s*t),d=o*(1-(1-s)*t);switch(a%6){case 0:i=o,n=d,r=l;break;case 1:i=c,n=o,r=l;break;case 2:i=l,n=o,r=d;break;case 3:i=l,n=c,r=o;break;case 4:i=d,n=l,r=o;break;case 5:i=o,n=l,r=c}return[i,n,r]};function Xp(e){let t,o;return{c(){t=Ur("div"),o=Ur("span"),Qr(t,"class","PinturaColorPreview"),Qr(t,"title",e[0]),aa(t,"--color",e[1])},m(e,i){Hr(e,t,i),_r(t,o)},p(e,[o]){1&o&&Qr(t,"title",e[0]),2&o&&aa(t,"--color",e[1])},i:ur,o:ur,d(e){e&&jr(t)}}}function Yp(e,t,o){let i,{color:n}=t,{title:r}=t;return e.$$set=e=>{"color"in e&&o(2,n=e.color),"title"in e&&o(0,r=e.title)},e.$$.update=()=>{4&e.$$.dirty&&o(1,i=n?Qo(n):"transparent")},[r,i,n]}class qp extends rs{constructor(e){super(),ns(this,e,Yp,Xp,yr,{color:2,title:0})}}var Kp=e=>(e=e.trim(),/^rgba/.test(e)?e.substring(5).split(",").map(parseFloat).map((e,t)=>e/(3===t?1:255)):/^rgb/.test(e)?e.substring(4).split(",").map(parseFloat).map(e=>e/255):/^#/.test(e)?(e=>{const[,t,o,i,n]=e.split("");e=e.length>=4&&e.length<=5?`#${t}${t}${o}${o}${i}${i}${n?`${n}${n}`:""}`:e;const[r,a,s,l,c]=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(e)||[];if(r)return[a,s,l,c].filter(e=>void 0!==e).map(e=>parseInt(e,16)/255)})(e):/[0-9]{1,3}\s?,\s?[0-9]{1,3}\s?,\s?[0-9]{1,3}/.test(e)?e.split(",").map(e=>parseInt(e,10)).map(e=>e/255):void 0);let Jp=null;function Qp(e){let t,o;return{c(){t=Ur("span"),o=Zr(e[0])},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){1&t[0]&&na(o,e[0])},d(e){e&&jr(t)}}}function eh(e){let t,o,i,n;o=new qp({props:{color:e[4],title:bu(e[8],e[10])}});let r=!e[9]&&Qp(e);return{c(){t=Ur("span"),ts(o.$$.fragment),i=Xr(),r&&r.c(),Qr(t,"slot","label"),Qr(t,"class","PinturaButtonLabel")},m(e,a){Hr(e,t,a),os(o,t,null),_r(t,i),r&&r.m(t,null),n=!0},p(e,i){const n={};16&i[0]&&(n.color=e[4]),1280&i[0]&&(n.title=bu(e[8],e[10])),o.$set(n),e[9]?r&&(r.d(1),r=null):r?r.p(e,i):(r=Qp(e),r.c(),r.m(t,null))},i(e){n||(ja(o.$$.fragment,e),n=!0)},o(e){Ua(o.$$.fragment,e),n=!1},d(e){e&&jr(t),is(o),r&&r.d()}}}function th(e){let t,o,i,n,r,a,s,l,c,d,u,p;s=new Ep({props:{label:"Hue",hideLabel:!0,class:"PinturaHuePicker",onchange:e[27],value:e[16],min:0,max:1,step:.01}});let h=e[11]&&oh(e),m=(e[14]||e[15])&&ih(e);return{c(){t=Ur("div"),o=Ur("div"),i=Ur("div"),n=Ur("div"),r=Xr(),a=Ur("div"),ts(s.$$.fragment),l=Xr(),h&&h.c(),c=Xr(),m&&m.c(),Qr(n,"role","button"),Qr(n,"aria-label","Saturation slider"),Qr(n,"class","PinturaPickerKnob"),Qr(n,"tabindex","0"),aa(n,"background-color",e[20]),Qr(i,"class","PinturaPickerKnobController"),aa(i,"transform",`translate(${e[25]}%,${e[24]}%)`),Qr(o,"class","PinturaSaturationPicker"),aa(o,"background-color",e[21]),aa(a,"--knob-background",e[21]),Qr(t,"class","PinturaPicker")},m(g,$){Hr(g,t,$),_r(t,o),_r(o,i),_r(i,n),e[42](o),_r(t,r),_r(t,a),os(s,a,null),_r(t,l),h&&h.m(t,null),_r(t,c),m&&m.m(t,null),d=!0,u||(p=[qr(n,"nudge",e[30]),Ar(xp.call(null,n,{preventDefault:!0})),qr(o,"pointerdown",e[29])],u=!0)},p(e,r){1048576&r[0]&&aa(n,"background-color",e[20]),50331648&r[0]&&aa(i,"transform",`translate(${e[25]}%,${e[24]}%)`),2097152&r[0]&&aa(o,"background-color",e[21]);const l={};65536&r[0]&&(l.value=e[16]),s.$set(l),2097152&r[0]&&aa(a,"--knob-background",e[21]),e[11]?h?(h.p(e,r),2048&r[0]&&ja(h,1)):(h=oh(e),h.c(),ja(h,1),h.m(t,c)):h&&(Na(),Ua(h,1,1,()=>{h=null}),Ha()),e[14]||e[15]?m?(m.p(e,r),49152&r[0]&&ja(m,1)):(m=ih(e),m.c(),ja(m,1),m.m(t,null)):m&&(Na(),Ua(m,1,1,()=>{m=null}),Ha())},i(e){d||(ja(s.$$.fragment,e),ja(h),ja(m),d=!0)},o(e){Ua(s.$$.fragment,e),Ua(h),Ua(m),d=!1},d(o){o&&jr(t),e[42](null),is(s),h&&h.d(),m&&m.d(),u=!1,$r(p)}}}function oh(e){let t,o,i;return o=new Ep({props:{label:"Opacity",hideLabel:!0,class:"PinturaOpacityPicker",onchange:e[28],value:e[17],min:0,max:1,step:.01}}),{c(){t=Ur("div"),ts(o.$$.fragment),aa(t,"--knob-background",e[18]),aa(t,"--track-background",`linear-gradient(to right,${e[19]},${e[20]})`)},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,i){const n={};131072&i[0]&&(n.value=e[17]),o.$set(n),262144&i[0]&&aa(t,"--knob-background",e[18]),1572864&i[0]&&aa(t,"--track-background",`linear-gradient(to right,${e[19]},${e[20]})`)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function ih(e){let t,o,i,n,r,a,s,l=e[15]&&nh(e);return{c(){t=Ur("div"),o=Ur("input"),n=Xr(),l&&l.c(),Qr(o,"class","PinturaColorPickerInput"),Qr(o,"type","text"),o.disabled=i=!e[14],o.value=e[23],Qr(t,"class","PinturColorPickerInputGroup")},m(i,c){Hr(i,t,c),_r(t,o),_r(t,n),l&&l.m(t,null),r=!0,a||(s=[qr(o,"keydown",e[32]),qr(o,"input",e[31])],a=!0)},p(e,n){(!r||16384&n[0]&&i!==(i=!e[14]))&&(o.disabled=i),(!r||8388608&n[0]&&o.value!==e[23])&&(o.value=e[23]),e[15]?l?(l.p(e,n),32768&n[0]&&ja(l,1)):(l=nh(e),l.c(),ja(l,1),l.m(t,null)):l&&(Na(),Ua(l,1,1,()=>{l=null}),Ha())},i(e){r||(ja(l),r=!0)},o(e){Ua(l),r=!1},d(e){e&&jr(t),l&&l.d(),a=!1,$r(s)}}}function nh(e){let t,o;return t=new Dh({props:{icon:'<path stroke="currentColor" stroke-linecap="square" d="m13 14-7 7a2.704 2.704 0 0 1-3 0 2.704 2.704 0 0 1 0-3l7-7"/><path fill="currentColor" d="M9.475 9.475 14.5 14.5c.263.263.69.265.955.005l.783-.767a4.209 4.209 0 0 0 1.262-3.006V10l4-4c.5-.5.375-2.125-.5-3s-2.5-1-3-.5l-4 4h-.732a4.329 4.329 0 0 0-3.03 1.238l-.758.742a.7.7 0 0 0-.005.995Z"/>',hideLabel:!0,label:"Pick a color",class:"PinturaEyeDropper",onclick:e[33]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p:ur,i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function rh(e){let t,o;return t=new Xu({props:{label:bu(e[10].labelColorPalette,e[10]),class:ld(["PinturaColorPresets",e[9]?"PinturaColorPresetsGrid":"PinturaColorPresetsList"]),hideLabel:!1,name:e[1],value:e[4],optionGroupClass:"PinturaListOptionGroup",optionClass:"PinturaListOption",options:e[2].map(e[43]),selectedIndex:e[3],optionMapper:e[7],optionLabelClass:e[6],onchange:e[44],$$slots:{option:[lh,({option:e})=>({60:e}),({option:e})=>[0,e?536870912:0]],group:[ah,({option:e})=>({60:e}),({option:e})=>[0,e?536870912:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o[0]&&(i.label=bu(e[10].labelColorPalette,e[10])),512&o[0]&&(i.class=ld(["PinturaColorPresets",e[9]?"PinturaColorPresetsGrid":"PinturaColorPresetsList"])),2&o[0]&&(i.name=e[1]),16&o[0]&&(i.value=e[4]),4&o[0]&&(i.options=e[2].map(e[43])),8&o[0]&&(i.selectedIndex=e[3]),128&o[0]&&(i.optionMapper=e[7]),64&o[0]&&(i.optionLabelClass=e[6]),512&o[0]|1610612736&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ah(e){let t,o,i=e[60].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"slot","group")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){536870912&t[1]&&i!==(i=e[60].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function sh(e){let t,o,i=e[60].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class","PinturaButtonLabel")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){536870912&t[1]&&i!==(i=e[60].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function lh(e){let t,o,i,n;o=new qp({props:{color:e[60].value}});let r=!e[9]&&sh(e);return{c(){t=Ur("span"),ts(o.$$.fragment),i=Xr(),r&&r.c(),Qr(t,"slot","option")},m(e,a){Hr(e,t,a),os(o,t,null),_r(t,i),r&&r.m(t,null),n=!0},p(e,i){const n={};536870912&i[1]&&(n.color=e[60].value),o.$set(n),e[9]?r&&(r.d(1),r=null):r?r.p(e,i):(r=sh(e),r.c(),r.m(t,null))},i(e){n||(ja(o.$$.fragment,e),n=!0)},o(e){Ua(o.$$.fragment,e),n=!1},d(e){e&&jr(t),is(o),r&&r.d()}}}function ch(e){let t,o,i,n=e[13]&&th(e),r=e[12]&&rh(e);return{c(){t=Ur("div"),n&&n.c(),o=Xr(),r&&r.c(),Qr(t,"slot","details"),Qr(t,"class","PinturaColorPickerPanel")},m(e,a){Hr(e,t,a),n&&n.m(t,null),_r(t,o),r&&r.m(t,null),i=!0},p(e,i){e[13]?n?(n.p(e,i),8192&i[0]&&ja(n,1)):(n=th(e),n.c(),ja(n,1),n.m(t,o)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[12]?r?(r.p(e,i),4096&i[0]&&ja(r,1)):(r=rh(e),r.c(),ja(r,1),r.m(t,null)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&jr(t),n&&n.d(),r&&r.d()}}}function dh(e){let t,o;return t=new pu({props:{buttonClass:ld(["PinturaColorPickerButton",e[5]]),$$slots:{details:[ch],label:[eh]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};32&o[0]&&(i.buttonClass=ld(["PinturaColorPickerButton",e[5]])),67108831&o[0]|1073741824&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function uh(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,g,$,{label:f}=t,{name:y}=t,{options:b=[]}=t,{selectedIndex:x=-1}=t,{value:v}=t,{buttonClass:S}=t,{optionLabelClass:w}=t,{optionMapper:k}=t,{onchange:C}=t,{title:T}=t,{hidePresetLabel:M=!0}=t,{locale:P}=t,{enableOpacity:R=!0}=t,{enablePresets:I=!0}=t,{enablePicker:E=!0}=t,{enableInput:A=!1}=t,{enableEyeDropper:F=!1}=t,z="transparent",D="transparent";const O=(e,t)=>{if(p=[e[0],e[1],e[2]],t){let t=((e,t,o)=>{let i=Math.max(e,t,o),n=i-Math.min(e,t,o),r=n&&(i==e?(t-o)/n:i==t?2+(o-e)/n:4+(e-t)/n);return[60*(r<0?r+6:r)/360,i&&n/i,i]})(...p),i=t[0],n=t[1],r=t[2];No(H)&&(i=H),No(V)&&(n=V),No(N)&&(r=N),o(16,l=i),o(37,c=n),o(38,d=r),o(17,u=No(e[3])?e[3]:1)}o(18,h=Qo(e)),o(19,g=Qo([...p,0])),o(20,z=Qo([...p,1])),o(21,D=Qo(Zp(l,1,1)))},B=()=>{const e=[...Zp(l,c,d),u];O(e),C(e)},W=e=>{const t=3===e.length?[...e,1]:e;_(),O(t,!0),C(t)},_=()=>{V=void 0,N=void 0,H=void 0};let V,N,H;const j=(e,t)=>{const i=Rs(e.x/t.width,0,1),n=Rs(e.y/t.height,0,1);var r,a;a=1-n,o(37,c=r=i),o(38,d=a),V=r,N=a,B()};let U,G,Z,X;const Y=e=>{const t=Ie(xe(e),X);j(Re(ve(Z),t),G)},q=e=>{G=void 0,document.documentElement.removeEventListener("pointermove",Y),document.documentElement.removeEventListener("pointerup",q)};let K;function J(e){return L(e)?e(P):e}return e.$$set=e=>{"label"in e&&o(0,f=e.label),"name"in e&&o(1,y=e.name),"options"in e&&o(2,b=e.options),"selectedIndex"in e&&o(3,x=e.selectedIndex),"value"in e&&o(4,v=e.value),"buttonClass"in e&&o(5,S=e.buttonClass),"optionLabelClass"in e&&o(6,w=e.optionLabelClass),"optionMapper"in e&&o(7,k=e.optionMapper),"onchange"in e&&o(35,C=e.onchange),"title"in e&&o(8,T=e.title),"hidePresetLabel"in e&&o(9,M=e.hidePresetLabel),"locale"in e&&o(10,P=e.locale),"enableOpacity"in e&&o(11,R=e.enableOpacity),"enablePresets"in e&&o(12,I=e.enablePresets),"enablePicker"in e&&o(13,E=e.enablePicker),"enableInput"in e&&o(14,A=e.enableInput),"enableEyeDropper"in e&&o(36,F=e.enableEyeDropper)},e.$$.update=()=>{32&e.$$.dirty[1]&&o(15,i=F&&(null===Jp&&(Jp=m()&&"EyeDropper"in window),Jp)),16&e.$$.dirty[0]|256&e.$$.dirty[1]&&(!v||$&&Fs(v,$)||(o(39,$=[...v]),O(v,!0))),64&e.$$.dirty[1]&&o(25,n=100*c),128&e.$$.dirty[1]&&o(24,r=100-100*d),512&e.$$.dirty[1]&&o(41,a=!!K&&(K.length>=4&&K.length<=5)),51216&e.$$.dirty[0]|1024&e.$$.dirty[1]&&o(23,s=(A||i)&&v?((e,t,o)=>{let i=e.map(e=>Math.round(255*e).toString(16).toLowerCase().padStart(2,"0"));return(!t&&i.length>3||"ff"===i[3])&&i.pop(),o&&(i=i.map(e=>e.substring(0,1))),`#${i.join("")}`})(v,R,a):void 0)},[f,y,b,x,v,S,w,k,T,M,P,R,I,E,A,i,l,u,h,g,z,D,U,s,r,n,W,e=>{o(16,l=e),H=e,B()},e=>{o(17,u=e),B()},e=>{e.stopPropagation(),G=Ze(U.offsetWidth,U.offsetHeight),Z=(e=>be(e.offsetX,e.offsetY))(e),X=xe(e),j(Z,G),document.documentElement.addEventListener("pointermove",Y),document.documentElement.addEventListener("pointerup",q)},e=>{G=Ze(U.offsetWidth,U.offsetHeight);const t=n/100*G.width,o=r/100*G.height;j({x:t+e.detail.x,y:o+e.detail.y},G)},e=>{const{value:t}=e.target,i=t.length;if(!t.startsWith("#")||i<4||6===i||8===i||i>9)return;if(!R&&i>7)return;const n=Kp(t);n&&(o(40,K=t),_(),O(n),C(n))},e=>{e.stopPropagation()},e=>{(new EyeDropper).open().then(({sRGBHex:e})=>{const t=Kp(e);t&&(t[3]=1,o(40,K=v),_(),O(t),C(t))}).catch(e=>{})},J,C,F,c,d,$,K,a,function(e){Ca[e?"unshift":"push"](()=>{U=e,o(22,U)})},([e,t])=>[e,J(t),{title:J(t)}],e=>W(e.value)]}class ph extends rs{constructor(e){super(),ns(this,e,uh,dh,yr,{label:0,name:1,options:2,selectedIndex:3,value:4,buttonClass:5,optionLabelClass:6,optionMapper:7,onchange:35,title:8,hidePresetLabel:9,locale:10,enableOpacity:11,enablePresets:12,enablePicker:13,enableInput:14,enableEyeDropper:36},null,[-1,-1])}}function hh(e){let t,o,i;return o=new Rh({props:{items:e[0]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaShorthandControl PinturaShapeStyle")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,[t]){const i={};1&t&&(i.items=e[0]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function mh(e,t,o){let i,n,{value:r}=t,{onchange:a}=t,{controls:s=[]}=t;return e.$$set=e=>{o(6,t=hr(hr({},t),Rr(e))),"value"in e&&o(1,r=e.value),"onchange"in e&&o(2,a=e.onchange),"controls"in e&&o(3,s=e.controls)},e.$$.update=()=>{o(4,i=(e=>{const{controls:t,...o}=e;return o})(t)),30&e.$$.dirty&&o(0,n=s.map((e,t)=>{const[o,n,s]=e;return[o,n,{...i,...s,value:r[t],onchange:e=>{const o=[...r];o[t]=e,a(o)}}]}))},t=Rr(t),[n,r,a,s,i]}class gh extends rs{constructor(e){super(),ns(this,e,mh,hh,yr,{value:1,onchange:2,controls:3})}}function $h(e){let t,o;return t=new gp({props:{label:e[4],options:e[1],title:e[2],selectedIndex:e[5],onchange:e[10]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,[o]){const i={};16&o&&(i.label=e[4]),2&o&&(i.options=e[1]),4&o&&(i.title=e[2]),32&o&&(i.selectedIndex=e[5]),9&o&&(i.onchange=e[10]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function fh(e,t,o){let i,n,r,a,{options:s}=t,{title:l}=t,{onchange:c}=t,{selectedIndex:d=-1}=t,{value:u}=t,{label:p}=t;return e.$$set=e=>{"options"in e&&o(1,s=e.options),"title"in e&&o(2,l=e.title),"onchange"in e&&o(3,c=e.onchange),"selectedIndex"in e&&o(0,d=e.selectedIndex),"value"in e&&o(6,u=e.value),"label"in e&&o(7,p=e.label)},e.$$.update=()=>{67&e.$$.dirty&&o(9,i=((e,t,o)=>{if(e)return t>-1?e[t]:void 0!==o?e.find(e=>e[0]===o):e[0]})(s,d,u)),514&e.$$.dirty&&o(5,n=s&&s.findIndex(e=>e===i)),512&e.$$.dirty&&o(8,r=i&&i[1]),384&e.$$.dirty&&o(4,a=p||r)},[d,s,l,c,a,n,u,p,r,i,e=>{o(0,d=e.index),c&&c(e)}]}class yh extends rs{constructor(e){super(),ns(this,e,fh,$h,yr,{options:1,title:2,onchange:3,selectedIndex:0,value:6,label:7})}}function bh(e,t,o){const i=e.slice();return i[9]=t[o][0],i[0]=t[o][1],i[10]=t[o][2],i[2]=t[o][3],i}function xh(e){let t,o,i;const n=[e[10]];var r=e[3][e[9]]||e[9];function a(e,t){let o={};for(let e=0;e<n.length;e+=1)o=hr(o,n[e]);return void 0!==t&&4&t&&(o=hr(o,Ja(n,[Qa(e[10])]))),{props:o}}return r&&(t=ca(r,a(e))),{c(){t&&ts(t.$$.fragment),o=Yr()},m(e,n){t&&os(t,e,n),Hr(e,o,n),i=!0},p(e,i){if(4&i&&r!==(r=e[3][e[9]]||e[9])){if(t){Na();const e=t;Ua(e.$$.fragment,1,0,()=>{is(e,1)}),Ha()}r?(t=ca(r,a(e,i)),ts(t.$$.fragment),ja(t.$$.fragment,1),os(t,o.parentNode,o)):t=null}else if(r){const o=4&i?Ja(n,[Qa(e[10])]):{};t.$set(o)}},i(e){i||(t&&ja(t.$$.fragment,e),i=!0)},o(e){t&&Ua(t.$$.fragment,e),i=!1},d(e){e&&jr(o),t&&is(t,e)}}}function vh(e){let t,o=e[9],i=e[9]&&Ch(e);return{c(){i&&i.c(),t=Yr()},m(e,o){i&&i.m(e,o),Hr(e,t,o)},p(e,n){e[9]?o?yr(o,e[9])?(i.d(1),i=Ch(e),o=e[9],i.c(),i.m(t.parentNode,t)):i.p(e,n):(i=Ch(e),o=e[9],i.c(),i.m(t.parentNode,t)):o&&(i.d(1),i=null,o=e[9])},i:ur,o(e){Ua(i,e)},d(e){e&&jr(t),i&&i.d(e)}}}function Sh(e){let t,o,i=e[10].innerHTML+"";return{c(){t=new la(!1),o=Yr(),t.a=o},m(e,n){t.m(i,e,n),Hr(e,o,n)},p(e,o){4&o&&i!==(i=e[10].innerHTML+"")&&t.p(i)},i:ur,o:ur,d(e){e&&(jr(o),t.d())}}}function wh(e){let t,o=e[10].textContent+"";return{c(){t=Zr(o)},m(e,o){Hr(e,t,o)},p(e,i){4&i&&o!==(o=e[10].textContent+"")&&na(t,o)},i:ur,o:ur,d(e){e&&jr(t)}}}function kh(e){let t,o;return t=new Rh({props:{items:e[2],discardEmptyItems:!0}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};4&o&&(i.items=e[2]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Ch(e){let t,o,i,n,r;const a=[kh,wh,Sh],s=[];function l(e,t){return e[2]&&e[2].length?0:e[10].textContent?1:e[10].innerHTML?2:-1}~(o=l(e))&&(i=s[o]=a[o](e));let c=[e[4](e[10])],d={};for(let e=0;e<c.length;e+=1)d=hr(d,c[e]);return{c(){t=Ur(e[9]),i&&i.c(),n=Xr(),ia(e[9])(t,d)},m(e,i){Hr(e,t,i),~o&&s[o].m(t,null),_r(t,n),r=!0},p(e,r){let u=o;o=l(e),o===u?~o&&s[o].p(e,r):(i&&(Na(),Ua(s[u],1,1,()=>{s[u]=null}),Ha()),~o?(i=s[o],i?i.p(e,r):(i=s[o]=a[o](e),i.c()),ja(i,1),i.m(t,n)):i=null),ia(e[9])(t,d=Ja(c,[4&r&&e[4](e[10])]))},i(e){r||(ja(i),r=!0)},o(e){Ua(i),r=!1},d(e){e&&jr(t),~o&&s[o].d()}}}function Th(e,t){let o,i,n,r,a,s;const l=[vh,xh],c=[];function d(e,t){return 4&t&&(i=null),null==i&&(i=!e[5](e[9])),i?0:1}return n=d(t,-1),r=c[n]=l[n](t),{key:e,first:null,c(){o=Yr(),r.c(),a=Yr(),this.first=o},m(e,t){Hr(e,o,t),c[n].m(e,t),Hr(e,a,t),s=!0},p(e,o){let i=n;n=d(t=e,o),n===i?c[n].p(t,o):(Na(),Ua(c[i],1,1,()=>{c[i]=null}),Ha(),r=c[n],r?r.p(t,o):(r=c[n]=l[n](t),r.c()),ja(r,1),r.m(a.parentNode,a))},i(e){s||(ja(r),s=!0)},o(e){Ua(r),s=!1},d(e){e&&(jr(o),jr(a)),c[n].d(e)}}}function Mh(e){let t,o,i=[],n=new Map,r=Xa(e[2]);const a=e=>e[0]+e[1];for(let t=0;t<r.length;t+=1){let o=bh(e,r,t),s=a(o);n.set(s,i[t]=Th(s,o))}return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=Yr()},m(e,n){for(let t=0;t<i.length;t+=1)i[t]&&i[t].m(e,n);Hr(e,t,n),o=!0},p(e,[o]){62&o&&(r=Xa(e[2]),Na(),i=Ka(i,o,a,1,e,r,n,t.parentNode,qa,Th,t,bh),Ha())},i(e){if(!o){for(let e=0;e<r.length;e+=1)ja(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)Ua(i[e]);o=!1},d(e){e&&jr(t);for(let t=0;t<i.length;t+=1)i[t].d(e)}}}function Ph(e,t,o){let i,n,{items:r}=t,{discardEmptyItems:a=!0}=t,{key:s=""}=t;const l={Button:Dh,ImageButton:Hd,ImageButtonList:Xd,Dropdown:gp,Select:yh,RadioGroup:Xu,Input:Ju,Panel:bp,ProgressIndicator:Np,ShapeStyle:Gp,ToggleSlider:Wp,ColorPicker:ph,ShorthandControl:gh},c=e=>!y(e)||!!l[e],d=e=>{if(!e)return!1;const[t,,o,i=[]]=e;return!!c(t)||(i.some(d)||o.textContent||o.innerHTML)};return e.$$set=e=>{"items"in e&&o(6,r=e.items),"discardEmptyItems"in e&&o(7,a=e.discardEmptyItems),"key"in e&&o(0,s=e.key)},e.$$.update=()=>{1&e.$$.dirty&&o(1,i=s),192&e.$$.dirty&&o(2,n=(r&&a?r.filter(d):r)||[])},[s,i,n,l,(e={})=>{const{textContent:t,innerHTML:o,...i}=e;return i},c,r,a]}class Rh extends rs{constructor(e){super(),ns(this,e,Ph,Mh,yr,{items:6,discardEmptyItems:7,key:0})}get items(){return this.$$.ctx[6]}set items(e){this.$$set({items:e}),Oa()}get discardEmptyItems(){return this.$$.ctx[7]}set discardEmptyItems(e){this.$$set({discardEmptyItems:e}),Oa()}get key(){return this.$$.ctx[0]}set key(e){this.$$set({key:e}),Oa()}}function Ih(e){let t,o;return t=new Od({props:{class:"PinturaButtonIcon",$$slots:{default:[Eh]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};536870920&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Eh(e){let t;return{c(){t=Gr("g")},m(o,i){Hr(o,t,i),t.innerHTML=e[3]},p(e,o){8&o&&(t.innerHTML=e[3])},d(e){e&&jr(t)}}}function Ah(e){let t;return{c(){t=Ur("span"),Qr(t,"class",e[11])},m(o,i){Hr(o,t,i),t.innerHTML=e[0]},p(e,o){1&o&&(t.innerHTML=e[0]),2048&o&&Qr(t,"class",e[11])},i:ur,o:ur,d(e){e&&jr(t)}}}function Lh(e){let t,o,i;return o=new Rh({props:{items:e[0]}}),{c(){t=Ur("span"),ts(o.$$.fragment),Qr(t,"class",e[11])},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,n){const r={};1&n&&(r.items=e[0]),o.$set(r),(!i||2048&n)&&Qr(t,"class",e[11])},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function Fh(e){let t,o,i,n,r,a;const s=e[27].default,l=kr(s,e,e[29],null),c=l||function(e){let t,o,i,n,r,a,s=e[3]&&Ih(e);const l=[Lh,Ah],c=[];function d(e,t){return 1&t&&(i=null),null==i&&(i=!!Uo(e[0])),i?0:1}return n=d(e,-1),r=c[n]=l[n](e),{c(){t=Ur("span"),s&&s.c(),o=Xr(),r.c(),Qr(t,"class",e[13])},m(e,i){Hr(e,t,i),s&&s.m(t,null),_r(t,o),c[n].m(t,null),a=!0},p(e,i){e[3]?s?(s.p(e,i),8&i&&ja(s,1)):(s=Ih(e),s.c(),ja(s,1),s.m(t,o)):s&&(Na(),Ua(s,1,1,()=>{s=null}),Ha());let u=n;n=d(e,i),n===u?c[n].p(e,i):(Na(),Ua(c[u],1,1,()=>{c[u]=null}),Ha(),r=c[n],r?r.p(e,i):(r=c[n]=l[n](e),r.c()),ja(r,1),r.m(t,null)),(!a||8192&i)&&Qr(t,"class",e[13])},i(e){a||(ja(s),ja(r),a=!0)},o(e){Ua(s),Ua(r),a=!1},d(e){e&&jr(t),s&&s.d(),c[n].d()}}}(e);return{c(){t=Ur("button"),c&&c.c(),Qr(t,"type",e[6]),t.disabled=e[5],Qr(t,"class",e[12]),Qr(t,"title",o=Wd(e[0],e[1],e[2]))},m(o,s){Hr(o,t,s),c&&c.m(t,null),e[28](t),n=!0,r||(a=[qr(t,"keydown",function(){fr(e[8])&&e[8].apply(this,arguments)}),qr(t,"click",function(){fr(e[7])&&e[7].apply(this,arguments)}),qr(t,"pointerdown",function(){fr(e[14])&&e[14].apply(this,arguments)}),Ar(i=fd.call(null,t,e[4])),Ar(e[9].call(null,t))],r=!0)},p(r,[a]){e=r,l?l.p&&(!n||536870912&a)&&Mr(l,s,e,e[29],n?Tr(s,e[29],a,null):Pr(e[29]),null):c&&c.p&&(!n||10249&a)&&c.p(e,n?a:-1),(!n||64&a)&&Qr(t,"type",e[6]),(!n||32&a)&&(t.disabled=e[5]),(!n||4096&a)&&Qr(t,"class",e[12]),(!n||7&a&&o!==(o=Wd(e[0],e[1],e[2])))&&Qr(t,"title",o),i&&fr(i.update)&&16&a&&i.update.call(null,e[4])},i(e){n||(ja(c,e),n=!0)},o(e){Ua(c,e),n=!1},d(o){o&&jr(t),c&&c.d(o),e[28](null),r=!1,$r(a)}}}function zh(e,t,i){let n,r,a,s,l,c,{$$slots:d={},$$scope:u}=t,{class:p}=t,{label:h}=t,{title:m}=t,{shortcut:g}=t,{labelClass:$}=t,{innerClass:f}=t,{hideLabel:y=!1}=t,{icon:b}=t,{style:x}=t,{disabled:v}=t,{type:S="button"}=t,{onclick:w}=t,{onkeydown:k}=t,{onhold:C}=t,{action:T=()=>{}}=t,{holdThreshold:M=500}=t,{holdSpeedUpFactor:P=.5}=t,{holdSpeedMin:R=20}=t;const I=e=>{i(25,c=setTimeout(()=>{C(),I(Math.max(e*P,R))},e))};let E;return e.$$set=e=>{"class"in e&&i(15,p=e.class),"label"in e&&i(0,h=e.label),"title"in e&&i(1,m=e.title),"shortcut"in e&&i(2,g=e.shortcut),"labelClass"in e&&i(16,$=e.labelClass),"innerClass"in e&&i(17,f=e.innerClass),"hideLabel"in e&&i(18,y=e.hideLabel),"icon"in e&&i(3,b=e.icon),"style"in e&&i(4,x=e.style),"disabled"in e&&i(5,v=e.disabled),"type"in e&&i(6,S=e.type),"onclick"in e&&i(7,w=e.onclick),"onkeydown"in e&&i(8,k=e.onkeydown),"onhold"in e&&i(19,C=e.onhold),"action"in e&&i(9,T=e.action),"holdThreshold"in e&&i(20,M=e.holdThreshold),"holdSpeedUpFactor"in e&&i(21,P=e.holdSpeedUpFactor),"holdSpeedMin"in e&&i(22,R=e.holdSpeedMin),"$$scope"in e&&i(29,u=e.$$scope)},e.$$.update=()=>{101187584&e.$$.dirty&&i(26,r=C?()=>{c&&(clearTimeout(c),i(25,c=void 0),document.documentElement.removeEventListener("pointerup",r))}:o),68681728&e.$$.dirty&&i(14,n=C?()=>{document.documentElement.addEventListener("pointerup",r),I(M)}:o),131072&e.$$.dirty&&i(13,a=ld(["PinturaButtonInner",f])),294912&e.$$.dirty&&i(12,s=ld(["PinturaButton",y&&"PinturaButtonIconOnly",p])),327680&e.$$.dirty&&i(11,l=ld([y?"implicit":"PinturaButtonLabel",$]))},[h,m,g,b,x,v,S,w,k,T,E,l,s,a,n,p,$,f,y,C,M,P,R,e=>Bd(e,E),()=>E,c,r,d,function(e){Ca[e?"unshift":"push"](()=>{E=e,i(10,E)})},u]}class Dh extends rs{constructor(e){super(),ns(this,e,zh,Fh,yr,{class:15,label:0,title:1,shortcut:2,labelClass:16,innerClass:17,hideLabel:18,icon:3,style:4,disabled:5,type:6,onclick:7,onkeydown:8,onhold:19,action:9,holdThreshold:20,holdSpeedUpFactor:21,holdSpeedMin:22,isEventTarget:23,getElement:24})}get isEventTarget(){return this.$$.ctx[23]}get getElement(){return this.$$.ctx[24]}}var Oh=(e,t)=>{const o=e.findIndex(t);if(o>=0)return e.splice(o,1)};const Bh=80;var Wh=(e,t={})=>{const{inertia:o=!1,inertiaDurationMultiplier:i=Bh,shouldStartInteraction:n=()=>!0,pinch:r=!1,multiTouch:a,getEventPosition:s=e=>be(e.clientX,e.clientY),observeKeys:l=!1}=t;function c(t,o){e.dispatchEvent(new CustomEvent(t,{detail:o}))}function d(){S&&S(),S=void 0}const u=[],p=e=>0===e.timeStamp?Date.now():e.timeStamp,h=()=>{const e=ve(u[0].position);if(u[1]){const t=.5*(u[1].position.x-e.x),o=.5*(u[1].position.y-e.y);e.x+=t,e.y+=o}return e},m=e=>{e.origin.x=e.position.x,e.origin.y=e.position.y,e.translation.x=0,e.translation.y=0},g=e=>{const t=(e=>u.findIndex(t=>t.event.pointerId===e.pointerId))(e);if(!(t<0))return u[t]},$=()=>1===u.length,f=()=>2===u.length,y=e=>{const t=Be(e.map(e=>e.position)),o=((e,t)=>e.reduce((e,o)=>e+De(t,o.position),0)/e.length)(e,t);return{center:t,distance:o,velocity:Be(e.map(e=>e.velocity)),translation:Be(e.map(e=>e.translation))}};let b,x,v,S,w,k,C,T,M,P=0;e.addEventListener("pointerdown",L);const R=["Meta","Control","Alt","Shift"];function I(e){if(!R.includes(e.key))return;const{metaKey:t,ctrlKey:o,altKey:i,shiftKey:n}=e;A({metaKey:t,ctrlKey:o,altKey:i,shiftKey:n})}let E=Date.now();const A=e=>{const t=ve(u[0].translation);let o=C;if(r&&f()){o*=De(u[0].position,u[1].position)/w,Re(t,u[1].translation)}Re(t,k);const i=Date.now();i-E<16||(E=i,c("interactionupdate",{position:h(),translation:t,scalar:r?o:void 0,isMultiTouching:f(),...e}))};function L(t){if(!f()&&!(e=>No(e.button)&&0!==e.button)(t)&&n(t,e))if(d(),(e=>{const t=p(e),o={timeStamp:t,timeStampInitial:t,position:s(e),origin:s(e),velocity:ye(),velocityHistory:[],velocityAverage:ye(),translation:ye(),interactionState:void 0,event:e};u.push(o),o.interactionState=y(u)})(t),l&&(window.addEventListener("keydown",I),window.addEventListener("keyup",I)),$())document.documentElement.addEventListener("pointermove",F),document.documentElement.addEventListener("pointerup",z),document.documentElement.addEventListener("pointercancel",z),document.addEventListener("visibilitychange",O),T=!1,C=1,k=ye(),w=void 0,c("interactionstart",{origin:ve(g(t).origin)});else if(r)T=!0,w=De(u[0].position,u[1].position),k.x+=u[0].translation.x,k.y+=u[0].translation.y,m(u[0]);else if(!1===a)return u.length=0,W(),c("interactioncancel")}function F(e){e.preventDefault(),(e=>{const t=g(e);if(!t)return;const o=p(e),i=s(e),n=Math.max(1,o-t.timeStamp);t.velocity.x=(i.x-t.position.x)/n,t.velocity.y=(i.y-t.position.y)/n,t.velocityHistory.push(ve(t.velocity)),t.velocityHistory=t.velocityHistory.slice(-3),t.velocityAverage=t.velocityHistory.reduce((e,t,o,i)=>(e.x+=t.x/i.length,e.y+=t.y/i.length,e),ye()),t.translation.x=i.x-t.origin.x,t.translation.y=i.y-t.origin.y,t.timeStamp=o,t.position.x=i.x,t.position.y=i.y,t.event=e})(e);const{metaKey:t=!1,ctrlKey:o=!1,altKey:i=!1,shiftKey:n=!1}=l?e:{};A({metaKey:t,ctrlKey:o,altKey:i,shiftKey:n})}function z(e){if(!g(e))return;const t=h(),n=(e=>{const t=Oh(u,t=>t.event.pointerId===e.pointerId);if(t)return t[0]})(e);if(r&&$()){const e=De(u[0].position,n.position);C*=e/w,k.x+=u[0].translation.x+n.translation.x,k.y+=u[0].translation.y+n.translation.y,m(u[0])}let a=!1,s=!1;if(!T&&n){const e=performance.now(),t=e-n.timeStampInitial,o=ze(n.translation);a=o<64&&t<300,s=!!(M&&a&&e-P<700&&ze(M,n.position)<128),a&&(M=ve(n.position),P=e)}if(u.length>0)return;W();const l=ve(n.translation),d=ve(n.velocityAverage);let p=!1;c("interactionrelease",{isTap:a,isDoubleTap:s,position:t,translation:l,scalar:C,preventInertia:()=>p=!0});const f=De(d);if(p||!o||f<.25)return B(l,{isTap:a,isDoubleTap:s});x=ve(t),v=ve(l),b=Ac(ve(l),{easing:Ic,duration:f*i}),b.set({x:l.x+50*d.x,y:l.y+50*d.y}).then(()=>{S&&B(Sr(b),{isTap:a,isDoubleTap:s})}),S=b.subscribe(D)}function D(e){e&&c("interactionupdate",{position:be(x.x+(e.x-v.x),x.y+(e.y-v.y)),translation:e,scalar:r?C:void 0})}function O(e){if("visible"===document.visibilityState||!u.length)return;const t=y(u);d(),c("interactionend",{...t}),u.length=0,W()}function B(e,t){d(),c("interactionend",{...t,translation:e,scalar:r?C:void 0})}function W(){l&&window.removeEventListener("keydown",I),l&&window.removeEventListener("keyup",I),document.documentElement.removeEventListener("pointermove",F),document.documentElement.removeEventListener("pointerup",z),document.documentElement.removeEventListener("pointercancel",z),document.removeEventListener("visibilitychange",O)}return{destroy(){d(),e.removeEventListener("pointerdown",L)}}};function _h(e,t){return t?t*Math.sign(e)*Math.log10(1+Math.abs(e)/t):e}const Vh=(e,t,o)=>{if(!t||!o)return{...e};const i=e.x+_h(t.x-e.x,o),n=e.x+e.width+_h(t.x+t.width-(e.x+e.width),o),r=e.y+_h(t.y-e.y,o);return{x:i,y:r,width:n-i,height:e.y+e.height+_h(t.y+t.height-(e.y+e.height),o)-r}},Nh=(e,t,o)=>t&&o?be(e.x+_h(t.x-e.x,o),e.y+_h(t.y-e.y,o)):{...e};var Hh=(e,t)=>{if(e)return/em/.test(e)?16*parseInt(e,10):/px/.test(e)?parseInt(e,10):void 0};function jh(e){let t,o,i,n,r,a,s;const l=e[40].default,c=kr(l,e,e[39],null);return{c(){t=Ur("div"),o=Ur("div"),c&&c.c(),aa(o,"transform",e[6]),Qr(t,"class",i=ld(["PinturaScrollable",e[0]])),Qr(t,"data-direction",e[1]),Qr(t,"data-state",e[7]),aa(t,"--scrollable-feather-start-opacity",e[4]),aa(t,"--scrollable-feather-end-opacity",e[5])},m(i,l){Hr(i,t,l),_r(t,o),c&&c.m(o,null),e[42](t),r=!0,a||(s=[qr(o,"interactionstart",e[10]),qr(o,"interactionupdate",e[12]),qr(o,"interactionend",e[13]),qr(o,"interactionrelease",e[11]),Ar(Wh.call(null,o,{inertia:!0})),qr(o,"measure",e[41]),Ar(qc.call(null,o)),qr(t,"wheel",e[15],{passive:!1}),qr(t,"scroll",e[17]),qr(t,"focusin",e[43]),qr(t,"nudge",e[18]),qr(t,"measure",e[14]),Ar(qc.call(null,t,{observePosition:!0})),Ar(n=xp.call(null,t,{direction:"x"===e[1]?"horizontal":"vertical",stopKeydownPropagation:!1}))],a=!0)},p(e,a){c&&c.p&&(!r||256&a[1])&&Mr(c,l,e,e[39],r?Tr(l,e[39],a,null):Pr(e[39]),null),64&a[0]&&aa(o,"transform",e[6]),(!r||1&a[0]&&i!==(i=ld(["PinturaScrollable",e[0]])))&&Qr(t,"class",i),(!r||2&a[0])&&Qr(t,"data-direction",e[1]),(!r||128&a[0])&&Qr(t,"data-state",e[7]),n&&fr(n.update)&&2&a[0]&&n.update.call(null,{direction:"x"===e[1]?"horizontal":"vertical",stopKeydownPropagation:!1}),16&a[0]&&aa(t,"--scrollable-feather-start-opacity",e[4]),32&a[0]&&aa(t,"--scrollable-feather-end-opacity",e[5])},i(e){r||(ja(c,e),r=!0)},o(e){Ua(c,e),r=!1},d(o){o&&jr(t),c&&c.d(o),e[42](null),a=!1,$r(s)}}}function Uh(e,t,i){let n,r,a,s,l,c,d,u,p,h,m,{$$slots:g={},$$scope:$}=t;const f=xa();let y,b,x,v,S="idle",w=Fc(0);wr(e,w,e=>i(38,h=e));let{class:k}=t,{scrollBlockInteractionDist:C=5}=t,{scrollStep:T=10}=t,{scrollFocusMargin:M=64}=t,{scrollDirection:P="x"}=t,{scrollAutoCancel:R=!1}=t,{elasticity:I=0}=t,{onscroll:E=o}=t,{maskFeatherSize:A}=t,{maskFeatherStartOpacity:L}=t,{maskFeatherEndOpacity:F}=t,{scroll:z}=t;const D=Sa("fixScrollDirection");let O,B,W;wr(e,D,e=>i(50,m=e));let _=!0;const V=w.subscribe(e=>{const t=ye();t[P]=e,E(t)}),N=e=>Math.max(Math.min(0,e),x[n]-b[n]);let H,j,U;const G=(e,t={})=>{const{elastic:o=!1,animate:n=!1,preventScrollState:r=!1}=t;Math.abs(e-y)>C&&"idle"===S&&!v&&!r&&i(29,S="scrolling");const a=N(e),s=o&&I&&!v?a+_h(e-a,I):a;let l=!0;n?l=!1:_||(l=!v),_=!1,w.set(s,{hard:l}).then(e=>{v&&(_=!0)})},Z=e=>{if(!l)return;if(!v)return;let t=e.target;e.target.classList.contains("implicit")&&(t=t.parentNode);const o=t["x"===P?"offsetLeft":"offsetTop"],i=o+t["x"===P?"offsetWidth":"offsetHeight"],r=Sr(w),a=M+A;r+o<a?G(-o+a):r+i>x[n]-a&&G(x[n]-i-a,{animate:!0})};ba(()=>{V()});return e.$$set=e=>{"class"in e&&i(0,k=e.class),"scrollBlockInteractionDist"in e&&i(22,C=e.scrollBlockInteractionDist),"scrollStep"in e&&i(23,T=e.scrollStep),"scrollFocusMargin"in e&&i(24,M=e.scrollFocusMargin),"scrollDirection"in e&&i(1,P=e.scrollDirection),"scrollAutoCancel"in e&&i(25,R=e.scrollAutoCancel),"elasticity"in e&&i(26,I=e.elasticity),"onscroll"in e&&i(27,E=e.onscroll),"maskFeatherSize"in e&&i(21,A=e.maskFeatherSize),"maskFeatherStartOpacity"in e&&i(19,L=e.maskFeatherStartOpacity),"maskFeatherEndOpacity"in e&&i(20,F=e.maskFeatherEndOpacity),"scroll"in e&&i(28,z=e.scroll),"$$scope"in e&&i(39,$=e.$$scope)},e.$$.update=()=>{if(2&e.$$.dirty[0]&&i(35,n="x"===P?"width":"height"),2&e.$$.dirty[0]&&i(31,r=P.toUpperCase()),8&e.$$.dirty[0]&&i(37,a=O&&getComputedStyle(O)),8&e.$$.dirty[0]|64&e.$$.dirty[1]&&i(36,s=a&&Hh(a.getPropertyValue("--scrollable-feather-size"))),1075314692&e.$$.dirty[0]|176&e.$$.dirty[1]&&null!=h&&x&&null!=s&&b){const e=-1*h/s,t=-(x[n]-b[n]-h)/s;i(19,L=Rs(1-e,0,1)),i(20,F=Rs(1-t,0,1)),i(21,A=s),i(4,B=L),i(5,W=F)}268435464&e.$$.dirty[0]&&O&&void 0!==z&&(No(z)?G(z):G(z.scrollOffset,z)),1073741828&e.$$.dirty[0]|16&e.$$.dirty[1]&&i(32,l=x&&b?b[n]>x[n]:void 0),128&e.$$.dirty[1]&&i(34,c=h<0),1073741828&e.$$.dirty[0]|144&e.$$.dirty[1]&&i(33,d=!(!b||!x)&&h+b[n]>x[n]),536870912&e.$$.dirty[0]|14&e.$$.dirty[1]&&i(7,u=ld([S,l?"overflows":void 0,c?"overflows-start":void 0,d?"overflows-end":void 0])),131&e.$$.dirty[1]&&i(6,p=l?`translate${r}(${h}px)`:"none")},[k,P,b,O,B,W,p,u,w,D,()=>{l&&(j=!1,H=!0,U=be(0,0),v=!1,i(29,S="idle"),y=Sr(w))},({detail:e})=>{l&&(v=!0,i(29,S="idle"))},({detail:e})=>{l&&(j||H&&(H=!1,ze(e.translation)<.1)||(!R||"x"!==P||(e=>{const t=Pe(be(e.x-U.x,e.y-U.y),Math.abs);U=ve(e);const o=ze(t),i=t.x-t.y;return!(o>1&&i<-.5)})(e.translation)?G(y+e.translation[P],{elastic:!0}):j=!0))},({detail:e})=>{if(!l)return;if(j)return;const t=y+e.translation[P],o=N(t);_=!1,w.set(o).then(e=>{v&&(_=!0)})},({detail:e})=>{i(30,x=e),f("measure",{x:e.x,y:e.y,width:e.width,height:e.height})},e=>{if(!l)return;e.preventDefault(),e.stopPropagation();const t=e.shiftKey,o=Sp(e,{fixScrollDirection:m})*(t?-1:1),i=Sr(w);G(i+o*T,{animate:!0})},Z,()=>{i(3,O["x"===P?"scrollLeft":"scrollTop"]=0,O)},({detail:e})=>{if(O.querySelector("[data-focus-visible]"))return;const t=-2*e[P],o=Sr(w);G(o+t*T,{animate:!0,preventScrollState:!0})},L,F,A,C,T,M,R,I,E,z,S,x,r,l,d,c,n,s,a,h,$,g,e=>i(2,b=e.detail),function(e){Ca[e?"unshift":"push"](()=>{O=e,i(3,O)})},e=>{setTimeout(()=>Z(e),32)}]}class Gh extends rs{constructor(e){super(),ns(this,e,Uh,jh,yr,{class:0,scrollBlockInteractionDist:22,scrollStep:23,scrollFocusMargin:24,scrollDirection:1,scrollAutoCancel:25,elasticity:26,onscroll:27,maskFeatherSize:21,maskFeatherStartOpacity:19,maskFeatherEndOpacity:20,scroll:28},null,[-1,-1])}}function Zh(e){let t,o,i,n,r;return{c(){t=Ur("span"),Qr(t,"class","PinturaStatusMessage")},m(o,a){Hr(o,t,a),t.innerHTML=e[0],i=!0,n||(r=[qr(t,"measure",function(){fr(e[1])&&e[1].apply(this,arguments)}),Ar(qc.call(null,t))],n=!0)},p(o,[n]){e=o,(!i||1&n)&&(t.innerHTML=e[0])},i(n){i||(Aa(()=>{i&&(o||(o=Za(t,e[4],{duration:e[2]},!0)),o.run(1))}),i=!0)},o(n){o||(o=Za(t,e[4],{duration:e[2]},!1)),o.run(0),i=!1},d(e){e&&jr(t),e&&o&&o.end(),n=!1,$r(r)}}}function Xh(e,t,i){let n,r,{text:a}=t,{onmeasure:s=o}=t;const l=Sa("isAnimated");return wr(e,l,e=>i(5,r=e)),e.$$set=e=>{"text"in e&&i(0,a=e.text),"onmeasure"in e&&i(1,s=e.onmeasure)},e.$$.update=()=>{32&e.$$.dirty&&i(2,n=r?500:0)},[a,s,n,l,function(e,{duration:t}){return{duration:t,tick:t=>{e.style.opacity=t}}},r]}class Yh extends rs{constructor(e){super(),ns(this,e,Xh,Zh,yr,{text:0,onmeasure:1})}}function qh(e){let t,o,i;const n=e[5].default,r=kr(n,e,e[4],null);return{c(){t=Ur("span"),r&&r.c(),Qr(t,"class",o=`PinturaStatusAside ${e[1]}`),aa(t,"transform",e[2]),aa(t,"opacity",e[0])},m(e,o){Hr(e,t,o),r&&r.m(t,null),i=!0},p(e,[a]){r&&r.p&&(!i||16&a)&&Mr(r,n,e,e[4],i?Tr(n,e[4],a,null):Pr(e[4]),null),(!i||2&a&&o!==(o=`PinturaStatusAside ${e[1]}`))&&Qr(t,"class",o),4&a&&aa(t,"transform",e[2]),1&a&&aa(t,"opacity",e[0])},i(e){i||(ja(r,e),i=!0)},o(e){Ua(r,e),i=!1},d(e){e&&jr(t),r&&r.d(e)}}}function Kh(e,t,o){let i,{$$slots:n={},$$scope:r}=t,{offset:a=0}=t,{opacity:s=0}=t,{class:l}=t;return e.$$set=e=>{"offset"in e&&o(3,a=e.offset),"opacity"in e&&o(0,s=e.opacity),"class"in e&&o(1,l=e.class),"$$scope"in e&&o(4,r=e.$$scope)},e.$$.update=()=>{8&e.$$.dirty&&o(2,i=`translateX(${a}px)`)},[s,l,i,a,r,n]}class Jh extends rs{constructor(e){super(),ns(this,e,Kh,qh,yr,{offset:3,opacity:0,class:1})}}let Qh=null;var em=()=>(null===Qh&&(Qh=m()&&"visualViewport"in window),Qh);function tm(e){let t,o;const i=[{onclick:e[1]},e[3]];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Dh({props:n}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=10&o[0]?Ja(i,[2&o[0]&&{onclick:e[1]},8&o[0]&&Qa(e[3])]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function om(e){let t,o;const i=[{onclick:e[0]},{class:"PinturaInputFormButtonConfirm"},e[2]];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Dh({props:n}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=5&o[0]?Ja(i,[1&o[0]&&{onclick:e[0]},i[1],4&o[0]&&Qa(e[2])]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function im(e){let t,o,i,n,r,a,s,l,c=e[3]&&tm(e);const d=e[29].default,u=kr(d,e,e[28],null);let p=e[2]&&om(e);return{c(){t=Ur("div"),o=Ur("div"),c&&c.c(),i=Xr(),n=Ur("div"),u&&u.c(),r=Xr(),p&&p.c(),Qr(n,"class","PinturaInputFormFields"),Qr(o,"class","PinturaInputFormInner"),Qr(t,"class","PinturaInputForm"),Qr(t,"data-layout",e[4]),aa(t,"opacity",e[6]),aa(t,"left",e[7]),aa(t,"top",e[8]),aa(t,"right",e[9]),aa(t,"bottom",e[10])},m(d,h){Hr(d,t,h),_r(t,o),c&&c.m(o,null),_r(o,i),_r(o,n),u&&u.m(n,null),_r(o,r),p&&p.m(o,null),e[30](t),a=!0,s||(l=[qr(n,"keydown",e[14]),qr(t,"focusin",e[11]),qr(t,"focusout",e[12]),qr(t,"measure",e[13]),Ar(qc.call(null,t))],s=!0)},p(e,n){e[3]?c?(c.p(e,n),8&n[0]&&ja(c,1)):(c=tm(e),c.c(),ja(c,1),c.m(o,i)):c&&(Na(),Ua(c,1,1,()=>{c=null}),Ha()),u&&u.p&&(!a||268435456&n[0])&&Mr(u,d,e,e[28],a?Tr(d,e[28],n,null):Pr(e[28]),null),e[2]?p?(p.p(e,n),4&n[0]&&ja(p,1)):(p=om(e),p.c(),ja(p,1),p.m(o,null)):p&&(Na(),Ua(p,1,1,()=>{p=null}),Ha()),(!a||16&n[0])&&Qr(t,"data-layout",e[4]),64&n[0]&&aa(t,"opacity",e[6]),128&n[0]&&aa(t,"left",e[7]),256&n[0]&&aa(t,"top",e[8]),512&n[0]&&aa(t,"right",e[9]),1024&n[0]&&aa(t,"bottom",e[10])},i(e){a||(ja(c),ja(u,e),ja(p),a=!0)},o(e){Ua(c),Ua(u,e),Ua(p),a=!1},d(o){o&&jr(t),c&&c.d(),u&&u.d(o),p&&p.d(),e[30](null),s=!1,$r(l)}}}function nm(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,{$$slots:m={},$$scope:g}=t,{onconfirm:$}=t,{oncancel:f}=t,{autoFocus:y=!0}=t,{autoPositionCursor:b=!0}=t,{buttonConfirm:x}=t,{buttonCancel:v}=t,{layout:S="stack"}=t,{parentRect:w}=t,{align:k}=t,{justify:C}=t,{parentMargin:M=16}=t,{panelOffset:P=ye()}=t,{willHandleKeydown:R=()=>!0}=t,I=!1,E={top:void 0,bottom:void 0},A=0;const L=()=>{const e=h.querySelector("input, textarea");e.focus(),A>=1||e.select()},F=()=>{I=!0,D||!To()&&!T()||o(24,E={top:"1em",bottom:"auto"}),To()&&(e=>{let t;const o=e=>t=e.touches[0].screenY,i=e=>{const o=e.touches[0].screenY,i=e.target;/textarea/i.test(i.nodeName)?(o>t?0==i.scrollTop&&e.preventDefault():o<t?i.scrollTop+i.offsetHeight==i.scrollHeight&&e.preventDefault():e.preventDefault(),t=o):e.preventDefault()};e.addEventListener("touchstart",o),e.addEventListener("touchmove",i)})(h),o(6,A=1)};let z;const D=(e=>{if(!em())return!1;const t=visualViewport.height,o=()=>{e(visualViewport.height<t?"visible":"hidden")};return visualViewport.addEventListener("resize",o),()=>visualViewport.removeEventListener("resize",o)})(e=>{a?"hidden"!==e||I?(clearTimeout(l),l=void 0,o(24,E={top:visualViewport.height-s.height-P.y+"px"}),"visible"===e?(o(5,h.dataset.stick=!0,h),L(),F()):(I=!1,o(6,A=0))):L():o(24,E={top:"4.5em",bottom:"auto"})});return fa(()=>{y&&L()}),ba(()=>{D&&D()}),e.$$set=e=>{"onconfirm"in e&&o(0,$=e.onconfirm),"oncancel"in e&&o(1,f=e.oncancel),"autoFocus"in e&&o(15,y=e.autoFocus),"autoPositionCursor"in e&&o(16,b=e.autoPositionCursor),"buttonConfirm"in e&&o(2,x=e.buttonConfirm),"buttonCancel"in e&&o(3,v=e.buttonCancel),"layout"in e&&o(4,S=e.layout),"parentRect"in e&&o(17,w=e.parentRect),"align"in e&&o(18,k=e.align),"justify"in e&&o(19,C=e.justify),"parentMargin"in e&&o(20,M=e.parentMargin),"panelOffset"in e&&o(21,P=e.panelOffset),"willHandleKeydown"in e&&o(22,R=e.willHandleKeydown),"$$scope"in e&&o(28,g=e.$$scope)},e.$$.update=()=>{8519680&e.$$.dirty[0]&&o(27,i=w&&s),144572416&e.$$.dirty[0]&&o(26,n=i?((e,t,o,i,n)=>{let r,a;return r="center"===i?e.x+.5*e.width-.5*t.width:"right"===i?e.x+e.width-t.width-n:e.x+n,a="center"===o?e.y+.5*e.height-.5*t.height:"bottom"===o?e.y+e.height-t.height-n:e.y+n,{top:`${a}px`,right:"auto",bottom:"auto",left:`${r}px`}})(w,s,k,C,M):void 0),201326592&e.$$.dirty[0]&&o(7,c=i?n.left:void 0),218103808&e.$$.dirty[0]&&o(8,d=i?n.top:E.top),201326592&e.$$.dirty[0]&&o(9,u=i?n.right:void 0),218103808&e.$$.dirty[0]&&o(10,p=i?n.bottom:E.bottom),32&e.$$.dirty[0]&&o(25,r=h&&getComputedStyle(h)),33554432&e.$$.dirty[0]&&(a=r&&"1"===r.getPropertyValue("--editor-modal"))},[$,f,x,v,S,h,A,c,d,u,p,e=>{var t;((e=>/textarea/i.test(e))(e.target)||Qd(e.target))&&(z=Date.now(),b&&((t=e.target).selectionStart=t.selectionEnd=t.value.length),clearTimeout(l),l=setTimeout(F,200))},e=>{Date.now()-z>50||(e.stopPropagation(),L())},({detail:e})=>{o(23,s={width:e.width,height:e.height})},e=>{if(R(e))return"Enter"===e.key?$():"Escape"===e.key?f():void 0},y,b,w,k,C,M,P,R,s,E,r,n,i,g,m,function(e){Ca[e?"unshift":"push"](()=>{h=e,o(5,h)})}]}class rm extends rs{constructor(e){super(),ns(this,e,nm,im,yr,{onconfirm:0,oncancel:1,autoFocus:15,autoPositionCursor:16,buttonConfirm:2,buttonCancel:3,layout:4,parentRect:17,align:18,justify:19,parentMargin:20,panelOffset:21,willHandleKeydown:22},null,[-1,-1])}}var am=(e,t)=>{e.fastSeek&&e.fastSeek(t),e.currentTime=t},sm=e=>e.touches&&e.touches.length&&"stylus"===e.touches[0].touchType;const lm=["aspectRatio","isRotatedSideways","flip","cropSize"],cm=Ws.map(([e])=>e).filter(e=>!lm.includes(e));var dm=(e,t)=>new CustomEvent("ping",{detail:{type:e,data:t},cancelable:!0,bubbles:!0}),um=(e,t)=>(t?jl(e,t):e).replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase(),pm=(e,t=ee)=>{const{subscribe:o,set:i}=ls(void 0),n=((e,t)=>{const o=matchMedia(e);return o.addListener(t),t(o),{get matches(){return o.matches},destroy:()=>o.removeListener(t)}})(e,({matches:e})=>i(t(e)));return{subscribe:o,destroy:n.destroy}},hm=(e,t)=>new Promise((o,i)=>{(async()=>{const{imageOrienter:n,canvasMemoryLimit:r}=t||{};al(e)&&o(await rl(e));const a=await n.read(e),s=e=>j(e,{canvasMemoryLimit:r}).then(e=>n.apply(e,a)).then(o).catch(i);if(O(e)||!D()||no()||To())return s(e);let l;try{l=await _((e,t)=>createImageBitmap(e,{colorSpaceConversion:"default"}).then(e=>t(null,e)).catch(t),[e])}catch(e){}l&&l.width?await $()?$c()&&a>1?o(await(async e=>f(await P(e)))(l)):o(l):o(n.apply(l,a)):s(e)})()}),mm=(e,t)=>new Promise(async o=>{if(e.width<t.width&&e.height<t.height)return o(e);const i=Math.min(t.width/e.width,t.height/e.height),n=i*e.width,r=i*e.height,a=x("canvas",{width:n,height:r}),s=a.getContext("2d",{willReadFrequently:!0}),l=w(e)?await P(e):e;s.drawImage(l,0,0,n,r),o(f(a))});let gm=null;var $m=()=>{if(null===gm){let e=x("canvas");gm=!!ac(e),S(e),e=void 0}return gm};const fm=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],ym={precision:1e-4},bm={precision:.01*ym.precision};var xm=()=>{const e=[],t=[],o=[],i=()=>{t.forEach(e=>e(o))},n=t=>{t.unsub=t.subscribe(n=>((t,n)=>{const r=e.indexOf(t);r<0||(o[r]=n,i())})(t,n)),i()};return{get length(){return e.length},clear:()=>{e.forEach(e=>e.unsub()),e.length=0,o.length=0},unshift:t=>{e.unshift(t),n(t)},get:t=>e[t],push:t=>{e.push(t),n(t)},remove:t=>{t.unsub();const i=e.indexOf(t);e.splice(i,1),o.splice(i,1)},forEach:t=>e.forEach(t),filter:t=>e.filter(t),subscribe:e=>(t.push(e),e(o),()=>{t.splice(t.indexOf(e),1)})}},vm=e=>e[0]<.25&&e[1]<.25&&e[2]<.25,Sm=(e={})=>new Promise(t=>{const{accept:o="image/*"}=e,i=x("input",{style:"position:absolute;visibility:hidden;width:0;height:0;",type:"file",accept:o}),n=()=>{const[e]=i.files;i.parentNode&&i.remove(),i.removeEventListener("change",n),t(e)};i.addEventListener("change",n),To()&&document.body.append(i),i.click()}),wm=e=>{try{return e()}catch(e){console.error(e)}},km=([e,t])=>e+.5*(t-e),Cm=e=>Math.round(100*e),Tm=e=>be(e.clientX,e.clientY),Mm=(e,t,o)=>{const i=Tm(e);return Ie(Ie(i,t),o)};function Pm(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w,k,C=ur,T=()=>(C(),C=vr(I,e=>o(74,S=e)),I);e.$$.on_destroy.push(()=>C());let{root:M}=t,{locale:P}=t,{stores:R}=t,{isAnimated:I}=t;T();let{allowPan:E=!0}=t,{allowZoom:A=!0}=t,{enablePan:L=!0}=t,{enableZoom:F=!0}=t,{enableZoomControls:z=F}=t,{enableZoomInput:D=!0}=t,{enablePanInput:O=!0}=t,{enablePanLimit:B=!0}=t,{panLimitGutterScalar:W=0}=t,{zoomOptions:_=[.25,.5,1,1.25,1.5,2,3,4,6,8,16]}=t,{zoomAdjustStep:V=.25}=t,{zoomAdjustFactor:N=.1}=t,{zoomAdjustWheelFactor:H=1}=t,{elasticity:j=5}=t,{imageSelectionRectCentered:U}=t,{imageSelectionRectScalar:G}=t,{zoomLevel:Z=null}=t,{zoomControls:X}=t,{zoomMultiTouching:Y=!1}=t;const{isInteracting:q,rootRect:K,stageRect:J,stageScalar:Q,imageSelectionPan:ee,imageSelectionZoom:te,imageSelectionStageFitScalar:oe,imageSelectionRect:ie,imageSelectionStoredState:ne,imagePreviewUpscale:re}=R;wr(e,q,e=>o(73,x=e)),wr(e,K,e=>o(70,f=e)),wr(e,J,e=>o(69,$=e)),wr(e,Q,e=>o(47,v=e)),wr(e,ee,e=>o(68,h=e)),wr(e,te,e=>o(44,p=e)),wr(e,oe,e=>o(45,m=e)),wr(e,ie,e=>o(71,y=e)),wr(e,ne,e=>o(76,k=e)),wr(e,re,e=>o(46,g=e));const ae=Sa("fixScrollDirection");wr(e,ae,e=>o(72,b=e));let se,le,ce,de,ue=!1;const pe=e=>{const t=M.querySelector(".PinturaMain > .PinturaUtilMain")||M.querySelector('div[data-inert="false"] .PinturaUtilMain');return!!t&&(!!t.contains(e.target)&&!eu(e.target))},he=(e={})=>{const{pan:t=h,zoom:o=p}=e;Er(ne,k={translation:t,zoom:o},k)},me=()=>h&&0===h.x&&0===h.y,ge=()=>{Er(te,p=void 0,p),me()||Er(ee,h=ye(),h),$e()},$e=()=>{xe.set(void 0,{hard:!0})},fe=()=>{ge(),he()},xe=Fc(void 0,{precision:.01});wr(e,xe,e=>o(75,w=e));const Se=(e,t,o,i)=>{const n=ye(),r=rt(y);$t(r,o),gt(r,e);const a=mt(r),s=rt(r);$t(s,i-o+1,t);const l=mt(s),c=Ee(Ie(l,a),o);return((e,t,o)=>{e.x=t,e.y=o})(n,e.x+c.x,e.y+c.y),Pe(n,o)};xe.subscribe(e=>{const t=p||m;void 0!==e&&(e<=m?me()||Er(ee,h=ye(),h):Er(ee,h=Se(h,mt({x:0,y:0,width:$.width,height:$.height}),t,e),h),Er(te,p=e,p))});const we=e=>{xe.update(t=>{const o=t||p||m;void 0===t&&xe.set(o,{hard:!0});const i=e(o);return he({zoom:i}),i},{hard:!S})},Ce=e=>{e?(void 0===w&&xe.set(p||m,{hard:!0}),xe.set(e,{hard:!1===S})):(e=void 0,xe.set(void 0,{hard:!0})),he({zoom:e})};let Te;function Me(){const e=Date.now();!No(Te)||e-Te>500?Te=e:(Te=void 0,Ce(r?1===d?m:1:d===m?1:m))}const Pe=(e,t)=>{const o=G*t,i={...U},n=1-Rs(W,0,1);$t(i,o<n?o:n);const r={...U};$t(r,o),gt(r,e);const a={...r};return r.x>i.x&&(a.x=i.x),r.y>i.y&&(a.y=i.y),r.x+r.width<i.x+i.width&&(a.x=i.x+i.width-r.width),r.y+r.height<i.y+i.height&&(a.y=i.y+i.height-r.height),Ie(mt(a),mt(i))},Re=({origin:e,translation:t,zoom:o=1,elastify:i=!0})=>{if(!e)return;let n=t;const r=be(e.x+n.x,e.y+n.y);if(!B)return r;const a=Pe(r,o);return i?Nh(a,r,j):a};let Ae,Le,Fe;const ze=e=>{Fe=void 0;const{origin:t}=e;Ie(Ie({...t},f),$),Er(q,x=!0,x),o(35,ue=O),Ae=!1,Le=!1,ce=!1,se={...h},le=g?p||m:r?p||1:p||m,De=le};let De;const Oe=e=>{const{position:t,scalar:n,translation:r,isMultiTouching:a}=e.detail;a&&(Le=!0);const c=Ie(Ie({...t},f),$);if(!se||!a&&!O)return;(O||a)&&(Ae=!0),Y||o(14,Y=a);const d=i?Rs(le*n,s,l):1,u=Re({origin:se,translation:r,zoom:d,elastify:!0}),p=ke(u);de=ke(h),ce=p<de,i&&($e(),te.set(d)),Er(ee,h=Le?Se(h,c,De,d):u,h),Fe=Y&&{translation:e.detail.translation,scalar:n},De=d},Be=e=>{Er(q,x=!1,x),o(35,ue=!1),o(14,Y=!1),!Le&&ce&&de<50&&(se=void 0,le=void 0,ee.set(ye()))},We=e=>{Er(q,x=!1,x),o(35,ue=!1),o(14,Y=!1),Promise.resolve().then(()=>{if(Ae&&se){if(Le)return;const t=Fe||e.detail,o=i?Rs(le*t.scalar,s,l):1,n=Re({origin:se,elastify:!1,translation:t.translation,zoom:o});ee.set(n)}se=void 0,le=void 0,O&&e.detail.isDoubleTap&&fe(),he()})};let _e,Ve=Date.now(),Ne=0,He=!1,je=!1;const Ue=e=>{if(!pe(e))return;if(e.preventDefault(),e.stopPropagation(),je)return;clearTimeout(_e);const t=Sp(e,{fixScrollDirection:b}),o=Date.now(),i=o-Ve;Ve=o;const n=Math.abs(t/i)>.2;Ne=n?Ne+1:0;const r=1+-1*t*H/(n?50:100),a=Mm(e,f,$);Ge(a,r,{isZoomingFast:n})},Ge=(e,t,{isZoomingFast:o})=>{const i=g?p||m:r?p||1:p||m,n=Rs(i*t,s,l),a=g?m:r?1:m,c=Math.abs(n-a),d=i>a&&n<i||i<a&&n>i,u=Ne>=5;if(o||(He=!1),Ne>0&&!He&&(He=d),u&&He)return fe(),je=!0,void setTimeout(()=>{je=!1},100);u||(!o&&d&&c<=.05&&(_e=setTimeout(()=>{fe()},250)),$e(),Er(te,p=Rs(n,s,l),p),Er(ee,h=Se(h,e,i,n),h),he())},Ze=e=>(e?"add":"remove")+"EventListener";let Xe,Ye,qe,Ke;const Je=e=>{e.preventDefault(),Ye={...h},Ke=rt(y),qe=Mm(e,f,$),Xe=g?p||m:r?p||1:p||m},Qe=e=>{e.preventDefault(),$e(),Er(te,p=Rs(e.scale*Xe,s,l),p);const t=rt(Ke);$t(t,Xe),gt(t,Ye);const o=mt(t),i=rt(t);$t(i,p-Xe+1,qe);const n=mt(i),r=Ee(Ie(n,o),Xe),a={x:Ye.x+r.x,y:Ye.y+r.y};Er(ee,h=Pe(a,p),h)},et=e=>{e.preventDefault()},tt=e=>{M[Ze(e)]("wheel",Ue),To()||(M[Ze(e)]("gesturestart",Je),M[Ze(e)]("gesturechange",Qe),M[Ze(e)]("gestureend",et))},ot=e=>{const t=Ze(e);M[t]("interactionstart",ze),M[t]("interactionupdate",Oe),M[t]("interactionrelease",Be),M[t]("interactionend",We)};let it;return fa(()=>{it=Wh(M,{drag:!0,pinch:!0,inertia:!0,inertiaDurationMultiplier:10,shouldStartInteraction:pe})}),ba(()=>{tt(!1),ot(!1),it.destroy(),it=void 0}),e.$$set=e=>{"root"in e&&o(15,M=e.root),"locale"in e&&o(16,P=e.locale),"stores"in e&&o(17,R=e.stores),"isAnimated"in e&&T(o(0,I=e.isAnimated)),"allowPan"in e&&o(18,E=e.allowPan),"allowZoom"in e&&o(19,A=e.allowZoom),"enablePan"in e&&o(20,L=e.enablePan),"enableZoom"in e&&o(21,F=e.enableZoom),"enableZoomControls"in e&&o(22,z=e.enableZoomControls),"enableZoomInput"in e&&o(23,D=e.enableZoomInput),"enablePanInput"in e&&o(24,O=e.enablePanInput),"enablePanLimit"in e&&o(25,B=e.enablePanLimit),"panLimitGutterScalar"in e&&o(26,W=e.panLimitGutterScalar),"zoomOptions"in e&&o(27,_=e.zoomOptions),"zoomAdjustStep"in e&&o(28,V=e.zoomAdjustStep),"zoomAdjustFactor"in e&&o(29,N=e.zoomAdjustFactor),"zoomAdjustWheelFactor"in e&&o(30,H=e.zoomAdjustWheelFactor),"elasticity"in e&&o(31,j=e.elasticity),"imageSelectionRectCentered"in e&&o(32,U=e.imageSelectionRectCentered),"imageSelectionRectScalar"in e&&o(33,G=e.imageSelectionRectScalar),"zoomLevel"in e&&o(34,Z=e.zoomLevel),"zoomControls"in e&&o(13,X=e.zoomControls),"zoomMultiTouching"in e&&o(14,Y=e.zoomMultiTouching)},e.$$.update=()=>{var t,$;11010048&e.$$.dirty[0]&&o(37,i=A&&F&&D),1310720&e.$$.dirty[0]&&o(36,n=E&&L),786432&e.$$.dirty[0]&&(E||A?(Er(te,p=F?k.zoom:void 0,p),Er(ee,h=L?ve(k.translation):me()?h:ye(),h),xe.set(p)):ge()),65536&e.$$.dirty[1]&&(r=v>=1),134283264&e.$$.dirty[0]|114688&e.$$.dirty[1]&&o(41,a=[(g||v<1)&&[m,Cm(m)+"%",{sublabel:P.labelZoomFit}],..._.map(e=>[e,Cm(e)+"%"])].filter(Boolean).map(e=>(1===e[0]&&(e[2]={sublabel:P.labelZoomActual}),e)).sort((e,t)=>{const o=e[0]||m,i=t[0]||m;return o<i?-1:i<o?1:0})),17408&e.$$.dirty[1]&&o(39,s=Math.min(a.reduce((e,[t])=>t<e?t:e,Number.MAX_SAFE_INTEGER),m)),1024&e.$$.dirty[1]&&o(38,l=a.reduce((e,[t])=>t>e?t:e,Number.MIN_SAFE_INTEGER)),8&e.$$.dirty[1]&&null!==Z&&Ce(Z),122880&e.$$.dirty[1]&&o(43,d=p||(g||v<1?m:1)),5120&e.$$.dirty[1]&&o(40,(t=a.map(([e])=>e),$=d,c=t.findIndex(e=>e===$))),4096&e.$$.dirty[1]&&o(42,u=Cm(d)+"%"),810090496&e.$$.dirty[0]|12160&e.$$.dirty[1]&&o(13,X=(A||A)&&z?[["Button","zoom-out",{hideLabel:!0,label:P.labelZoomOut,icon:P.iconZoomOut,disabled:p===s,onclick:()=>we(e=>Math.max(s,e-V)),onhold:()=>we(e=>Math.max(s,e*(1-N)))}],["Dropdown","zoom-level",{label:u,title:P.labelZoom,labelClass:"PinturaFixedWidthCharacters",options:a,selectedIndex:c,onchange:e=>Ce(e.value),onclick:Me}],["Button","zoom-in",{hideLabel:!0,label:P.labelZoomIn,icon:P.iconZoomIn,disabled:p===l,onclick:()=>we(e=>Math.min(l,e+V)),onhold:()=>we(e=>Math.min(l,e*(1+N)))}]]:[]),32768&e.$$.dirty[0]|64&e.$$.dirty[1]&&M&&tt(i),32768&e.$$.dirty[0]|32&e.$$.dirty[1]&&M&&ot(n),16809984&e.$$.dirty[0]|48&e.$$.dirty[1]&&M&&M.style.setProperty("--cursor",n&&O?ue?"grabbing":"grab":"")},[I,q,K,J,Q,ee,te,oe,ie,ne,re,ae,xe,X,Y,M,P,R,E,A,L,F,z,D,O,B,W,_,V,N,H,j,U,G,Z,ue,n,i,l,s,c,a,u,d,p,m,g,v]}class Rm extends rs{constructor(e){super(),ns(this,e,Pm,null,yr,{root:15,locale:16,stores:17,isAnimated:0,allowPan:18,allowZoom:19,enablePan:20,enableZoom:21,enableZoomControls:22,enableZoomInput:23,enablePanInput:24,enablePanLimit:25,panLimitGutterScalar:26,zoomOptions:27,zoomAdjustStep:28,zoomAdjustFactor:29,zoomAdjustWheelFactor:30,elasticity:31,imageSelectionRectCentered:32,imageSelectionRectScalar:33,zoomLevel:34,zoomControls:13,zoomMultiTouching:14},null,[-1,-1,-1,-1])}}const{window:Im}=Wr;function Em(e){let t,o,i,n=e[41]&&Am(e),r=e[38]&&Vm(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Yr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[41]?n?(n.p(e,i),1024&i[1]&&ja(n,1)):(n=Am(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[38]?r?(r.p(e,i),128&i[1]&&ja(r,1)):(r=Vm(e),r.c(),ja(r,1),r.m(o.parentNode,o)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}function Am(e){let t,o,i,n,r;const a=[Fm,Lm],s=[];function l(e,t){return e[39]?0:e[35]?1:-1}return~(i=l(e))&&(n=s[i]=a[i](e)),{c(){t=Ur("div"),o=Ur("p"),n&&n.c(),aa(o,"transform",e[72]),Qr(t,"class","PinturaStatus"),aa(t,"opacity",e[54])},m(e,n){Hr(e,t,n),_r(t,o),~i&&s[i].m(o,null),r=!0},p(e,r){let c=i;i=l(e),i===c?~i&&s[i].p(e,r):(n&&(Na(),Ua(s[c],1,1,()=>{s[c]=null}),Ha()),~i?(n=s[i],n?n.p(e,r):(n=s[i]=a[i](e),n.c()),ja(n,1),n.m(o,null)):n=null),1024&r[2]&&aa(o,"transform",e[72]),8388608&r[1]&&aa(t,"opacity",e[54])},i(e){r||(ja(n),r=!0)},o(e){Ua(n),r=!1},d(e){e&&jr(t),~i&&s[i].d()}}}function Lm(e){let t,o,i,n;t=new Yh({props:{text:e[35].text||"",onmeasure:e[221]}});let r=e[35].aside&&zm(e);return{c(){ts(t.$$.fragment),o=Xr(),r&&r.c(),i=Yr()},m(e,a){os(t,e,a),Hr(e,o,a),r&&r.m(e,a),Hr(e,i,a),n=!0},p(e,o){const n={};16&o[1]&&(n.text=e[35].text||""),t.$set(n),e[35].aside?r?(r.p(e,o),16&o[1]&&ja(r,1)):(r=zm(e),r.c(),ja(r,1),r.m(i.parentNode,i)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha())},i(e){n||(ja(t.$$.fragment,e),ja(r),n=!0)},o(e){Ua(t.$$.fragment,e),Ua(r),n=!1},d(e){e&&(jr(o),jr(i)),is(t,e),r&&r.d(e)}}}function Fm(e){let t,o,i,n;return t=new Yh({props:{text:e[39],onmeasure:e[221]}}),i=new Jh({props:{class:"PinturaStatusIcon",offset:e[82],opacity:e[83],$$slots:{default:[_m]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment),o=Xr(),ts(i.$$.fragment)},m(e,r){os(t,e,r),Hr(e,o,r),os(i,e,r),n=!0},p(e,o){const n={};256&o[1]&&(n.text=e[39]),t.$set(n);const r={};1048576&o[2]&&(r.offset=e[82]),2097152&o[2]&&(r.opacity=e[83]),8&o[0]|2&o[20]&&(r.$$scope={dirty:o,ctx:e}),i.$set(r)},i(e){n||(ja(t.$$.fragment,e),ja(i.$$.fragment,e),n=!0)},o(e){Ua(t.$$.fragment,e),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(t,e),is(i,e)}}}function zm(e){let t,o;return t=new Jh({props:{class:"PinturaStatusButton",offset:e[82],opacity:e[83],$$slots:{default:[Bm]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1048576&o[2]&&(i.offset=e[82]),2097152&o[2]&&(i.opacity=e[83]),16&o[1]|2&o[20]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Dm(e){let t,o;return t=new Np({props:{progress:e[35].progressIndicator.progress}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[1]&&(i.progress=e[35].progressIndicator.progress),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Om(e){let t,o;const i=[e[35].closeButton,{hideLabel:!0}];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Dh({props:n}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=16&o[1]?Ja(i,[Qa(e[35].closeButton),i[1]]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Bm(e){let t,o,i,n=e[35].progressIndicator.visible&&Dm(e),r=e[35].closeButton&&e[35].text&&Om(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Yr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[35].progressIndicator.visible?n?(n.p(e,i),16&i[1]&&ja(n,1)):(n=Dm(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[35].closeButton&&e[35].text?r?(r.p(e,i),16&i[1]&&ja(r,1)):(r=Om(e),r.c(),ja(r,1),r.m(o.parentNode,o)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}function Wm(e){let t,o=e[3].iconSupportError+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){8&i[0]&&o!==(o=e[3].iconSupportError+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function _m(e){let t,o;return t=new Od({props:{$$slots:{default:[Wm]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8&o[0]|2&o[20]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Vm(e){let t,o,i,n,r,a,s,l,c,d,u,p,h,m,g=e[10]&&Nm(e),$=e[46]&&e[45]&&Hm(e);const f=[qm,Ym],y=[];function b(e,t){return e[46]?0:1}function x(t){e[446](t)}function v(t){e[447](t)}function S(t){e[448](t)}i=b(e),n=y[i]=f[i](e),a=new sd({props:{isAnimated:e[53],isTransparent:e[20],pixelRatio:e[57],textPixelRatio:e[6],backgroundColor:e[56],maskRect:e[58],maskOpacity:e[73]?e[73].maskOpacity:1,maskMarkupOpacity:e[7],maskFrameOpacity:e[5],clipAnnotationsToImage:e[85],images:e[55],interfaceImages:e[86],loadImageData:e[28],enableGrid:e[11],gridSize:e[87],gridColors:[e[88],e[89]],gridOpacity:e[90],selectionColor:e[91],csp:e[92]||{},willRequest:e[81]||e[93],willRender:e[443],didRender:e[444]}});let w={root:e[2],locale:e[3],isAnimated:e[163],stores:e[202],allowPan:e[95],enablePan:e[17],enablePanLimit:e[21],panLimitGutterScalar:e[22],enablePanInput:e[96],allowZoom:e[97],enableZoom:e[18],enableZoomInput:void 0!==e[19]?e[19]:e[98],enableZoomControls:e[99],zoomOptions:e[13]||e[23],zoomAdjustStep:e[14]||e[24],zoomAdjustFactor:e[15]||e[25],zoomAdjustWheelFactor:e[16]||e[26],imageSelectionRectCentered:e[100],imageSelectionRectScalar:e[101],elasticity:og*e[8]};return void 0!==e[0]&&(w.zoomLevel=e[0]),void 0!==e[33]&&(w.zoomControls=e[33]),void 0!==e[34]&&(w.zoomMultiTouching=e[34]),d=new Rm({props:w}),Ca.push(()=>es(d,"zoomLevel",x)),Ca.push(()=>es(d,"zoomControls",v)),Ca.push(()=>es(d,"zoomMultiTouching",S)),{c(){g&&g.c(),t=Xr(),$&&$.c(),o=Xr(),n.c(),r=Xr(),ts(a.$$.fragment),s=Xr(),l=Ur("div"),c=Xr(),ts(d.$$.fragment),Qr(l,"class","PinturaRootPortal")},m(n,u){g&&g.m(n,u),Hr(n,t,u),$&&$.m(n,u),Hr(n,o,u),y[i].m(n,u),Hr(n,r,u),os(a,n,u),Hr(n,s,u),Hr(n,l,u),e[445](l),Hr(n,c,u),os(d,n,u),m=!0},p(e,s){e[10]?g?(g.p(e,s),1024&s[0]&&ja(g,1)):(g=Nm(e),g.c(),ja(g,1),g.m(t.parentNode,t)):g&&(Na(),Ua(g,1,1,()=>{g=null}),Ha()),e[46]&&e[45]?$?($.p(e,s),49152&s[1]&&ja($,1)):($=Hm(e),$.c(),ja($,1),$.m(o.parentNode,o)):$&&(Na(),Ua($,1,1,()=>{$=null}),Ha());let l=i;i=b(e),i===l?y[i].p(e,s):(Na(),Ua(y[l],1,1,()=>{y[l]=null}),Ha(),n=y[i],n?n.p(e,s):(n=y[i]=f[i](e),n.c()),ja(n,1),n.m(r.parentNode,r));const c={};4194304&s[1]&&(c.isAnimated=e[53]),1048576&s[0]&&(c.isTransparent=e[20]),67108864&s[1]&&(c.pixelRatio=e[57]),64&s[0]&&(c.textPixelRatio=e[6]),33554432&s[1]&&(c.backgroundColor=e[56]),134217728&s[1]&&(c.maskRect=e[58]),2048&s[2]&&(c.maskOpacity=e[73]?e[73].maskOpacity:1),128&s[0]&&(c.maskMarkupOpacity=e[7]),32&s[0]&&(c.maskFrameOpacity=e[5]),8388608&s[2]&&(c.clipAnnotationsToImage=e[85]),16777216&s[1]&&(c.images=e[55]),16777216&s[2]&&(c.interfaceImages=e[86]),268435456&s[0]&&(c.loadImageData=e[28]),2048&s[0]&&(c.enableGrid=e[11]),33554432&s[2]&&(c.gridSize=e[87]),201326592&s[2]&&(c.gridColors=[e[88],e[89]]),268435456&s[2]&&(c.gridOpacity=e[90]),536870912&s[2]&&(c.selectionColor=e[91]),1073741824&s[2]&&(c.csp=e[92]||{}),524288&s[2]|1&s[3]&&(c.willRequest=e[81]||e[93]),512&s[0]|270991424&s[1]|2&s[3]&&(c.willRender=e[443]),62&s[2]&&(c.didRender=e[444]),a.$set(c);const m={};4&s[0]&&(m.root=e[2]),8&s[0]&&(m.locale=e[3]),4&s[3]&&(m.allowPan=e[95]),131072&s[0]&&(m.enablePan=e[17]),2097152&s[0]&&(m.enablePanLimit=e[21]),4194304&s[0]&&(m.panLimitGutterScalar=e[22]),8&s[3]&&(m.enablePanInput=e[96]),16&s[3]&&(m.allowZoom=e[97]),262144&s[0]&&(m.enableZoom=e[18]),524288&s[0]|32&s[3]&&(m.enableZoomInput=void 0!==e[19]?e[19]:e[98]),64&s[3]&&(m.enableZoomControls=e[99]),8396800&s[0]&&(m.zoomOptions=e[13]||e[23]),16793600&s[0]&&(m.zoomAdjustStep=e[14]||e[24]),33587200&s[0]&&(m.zoomAdjustFactor=e[15]||e[25]),67174400&s[0]&&(m.zoomAdjustWheelFactor=e[16]||e[26]),128&s[3]&&(m.imageSelectionRectCentered=e[100]),256&s[3]&&(m.imageSelectionRectScalar=e[101]),256&s[0]&&(m.elasticity=og*e[8]),!u&&1&s[0]&&(u=!0,m.zoomLevel=e[0],La(()=>u=!1)),!p&&4&s[1]&&(p=!0,m.zoomControls=e[33],La(()=>p=!1)),!h&&8&s[1]&&(h=!0,m.zoomMultiTouching=e[34],La(()=>h=!1)),d.$set(m)},i(e){m||(ja(g),ja($),ja(n),ja(a.$$.fragment,e),ja(d.$$.fragment,e),m=!0)},o(e){Ua(g),Ua($),Ua(n),Ua(a.$$.fragment,e),Ua(d.$$.fragment,e),m=!1},d(n){n&&(jr(t),jr(o),jr(r),jr(s),jr(l),jr(c)),g&&g.d(n),$&&$.d(n),y[i].d(n),is(a,n),e[445](null),is(d,n)}}}function Nm(e){let t,o,i,n,r;return o=new Rh({props:{items:e[69]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaNav PinturaNavTools")},m(a,s){Hr(a,t,s),os(o,t,null),i=!0,n||(r=[qr(t,"measure",e[432]),Ar(qc.call(null,t))],n=!0)},p(e,t){const i={};128&t[2]&&(i.items=e[69]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o),n=!1,$r(r)}}}function Hm(e){let t,o,i;return o=new Gh({props:{elasticity:e[8]*ng,scrollDirection:e[76]?"y":"x",$$slots:{default:[Xm]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaNav PinturaNavMain")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};256&t[0]&&(i.elasticity=e[8]*ng),16384&t[2]&&(i.scrollDirection=e[76]?"y":"x"),12288&t[1]|135168&t[2]|2&t[20]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function jm(e){let t,o;const i=[e[79],{tabs:e[44]}];let n={$$slots:{default:[Zm,({tab:e})=>({620:e}),({tab:e})=>[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e?1:0]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new $d({props:n}),t.$on("select",e[433]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=8192&o[1]|131072&o[2]?Ja(i,[131072&o[2]&&Qa(e[79]),8192&o[1]&&{tabs:e[44]}]):{};3&o[20]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Um(e){let t,o;return t=new Rh({props:{items:e[44]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8192&o[1]&&(i.items=e[44]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Gm(e){let t,o=e[620].icon+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){1&i[20]&&o!==(o=e[620].icon+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function Zm(e){let t,o,i,n,r,a=e[620].label+"";return t=new Od({props:{$$slots:{default:[Gm]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment),o=Xr(),i=Ur("span"),n=Zr(a)},m(e,a){os(t,e,a),Hr(e,o,a),Hr(e,i,a),_r(i,n),r=!0},p(e,o){const i={};3&o[20]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i),(!r||1&o[20])&&a!==(a=e[620].label+"")&&na(n,a)},i(e){r||(ja(t.$$.fragment,e),r=!0)},o(e){Ua(t.$$.fragment,e),r=!1},d(e){e&&(jr(o),jr(i)),is(t,e)}}}function Xm(e){let t,o,i,n;const r=[Um,jm],a=[];function s(e,t){return e[74]?0:1}return t=s(e),o=a[t]=r[t](e),{c(){o.c(),i=Yr()},m(e,o){a[t].m(e,o),Hr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?a[t].p(e,n):(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha(),o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),ja(o,1),o.m(i.parentNode,i))},i(e){n||(ja(o),n=!0)},o(e){Ua(o),n=!1},d(e){e&&jr(i),a[t].d(e)}}}function Ym(e){let t,o,i;function n(t){e[439](t)}let r={locale:e[3],class:"PinturaMain",view:e[207](e[43]),props:e[206](e[43],e[27]),stores:e[202]};return void 0!==e[1][e[43]]&&(r.component=e[1][e[43]]),t=new Fd({props:r}),Ca.push(()=>es(t,"component",n)),t.$on("measure",e[233]),t.$on("show",e[440]),t.$on("hide",e[441]),t.$on("fade",e[442]),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};8&i[0]&&(n.locale=e[3]),4096&i[1]&&(n.view=e[207](e[43])),134217728&i[0]|4096&i[1]&&(n.props=e[206](e[43],e[27])),!o&&2&i[0]|4096&i[1]&&(o=!0,n.component=e[1][e[43]],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function qm(e){let t,o;const i=[{class:"PinturaMain"},{visible:e[62]},e[79],{panels:e[78]}];let n={$$slots:{default:[Km,({panel:e,panelIsActive:t})=>({618:e,619:t}),({panel:e,panelIsActive:t})=>[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(e?536870912:0)|(t?1073741824:0)]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Rd({props:n}),t.$on("measure",e[438]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=196609&o[2]?Ja(i,[i[0],1&o[2]&&{visible:e[62]},131072&o[2]&&Qa(e[79]),65536&o[2]&&{panels:e[78]}]):{};134217738&o[0]|1610612736&o[19]|2&o[20]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Km(e){let t,o,i;function n(t){e[434](t,e[618])}let r={locale:e[3],view:e[207](e[618]),props:e[206](e[618],e[27]),isActive:e[619],stores:e[202]};return void 0!==e[1][e[618]]&&(r.component=e[1][e[618]]),t=new Fd({props:r}),Ca.push(()=>es(t,"component",n)),t.$on("measure",e[233]),t.$on("show",function(){return e[435](e[618])}),t.$on("hide",function(){return e[436](e[618])}),t.$on("fade",function(...t){return e[437](e[618],...t)}),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(i,n){e=i;const r={};8&n[0]&&(r.locale=e[3]),536870912&n[19]&&(r.view=e[207](e[618])),134217728&n[0]|536870912&n[19]&&(r.props=e[206](e[618],e[27])),1073741824&n[19]&&(r.isActive=e[619]),!o&&2&n[0]|536870912&n[19]&&(o=!0,r.component=e[1][e[618]],La(()=>o=!1)),t.$set(r)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function Jm(e){let t;return{c(){t=Ur("span"),Qr(t,"class","PinturaEditorOverlay"),aa(t,"opacity",e[102])},m(e,o){Hr(e,t,o)},p(e,o){512&o[3]&&aa(t,"opacity",e[102])},d(e){e&&jr(t)}}}function Qm(e){let t,o;const i=[{layout:"row"},{parentRect:e[50]},e[60]];let n={$$slots:{default:[eg]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new rm({props:n}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=537395200&o[1]?Ja(i,[i[0],524288&o[1]&&{parentRect:e[50]},536870912&o[1]&&Qa(e[60])]):{};1610612736&o[1]|2&o[20]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function eg(e){let t,o,i;return{c(){t=Ur("input"),t.value=o=e[60].text,Qr(t,"placeholder",i=e[60].placeholder),Qr(t,"type","text"),Qr(t,"spellcheck","false"),Qr(t,"autocorrect","off"),Qr(t,"autocapitalize","off")},m(o,i){Hr(o,t,i),e[449](t)},p(e,n){536870912&n[1]&&o!==(o=e[60].text)&&t.value!==o&&(t.value=o),536870912&n[1]&&i!==(i=e[60].placeholder)&&Qr(t,"placeholder",i)},d(o){o&&jr(t),e[449](null)}}}function tg(e){let t,i,n,r,a,s;Aa(e[431]);let l=e[40]&&Em(e),c=e[102]>0&&Jm(e),d=e[60]&&Qm(e);return{c(){t=Ur("div"),l&&l.c(),i=Xr(),c&&c.c(),n=Xr(),d&&d.c(),Qr(t,"id",e[4]),Qr(t,"class",e[77]),Qr(t,"data-env",e[75]),Qr(t,"dir",e[12])},m(u,p){Hr(u,t,p),l&&l.m(t,null),_r(t,i),c&&c.m(t,null),_r(t,n),d&&d.m(t,null),e[450](t),r=!0,a||(s=[qr(Im,"keydown",e[224]),qr(Im,"keyup",e[225]),qr(Im,"blur",e[226]),qr(Im,"paste",e[230]),qr(Im,"resize",e[431]),qr(t,"ping",function(){fr(e[68])&&e[68].apply(this,arguments)}),qr(t,"contextmenu",e[227]),qr(t,"touchstart",e[222],{passive:!1}),qr(t,"touchmove",function(){fr(e[71])&&e[71].apply(this,arguments)}),qr(t,"pointermove",function(){fr(e[70])&&e[70].apply(this,arguments)}),qr(t,"transitionend",e[212]),qr(t,"dropfiles",e[228]),qr(t,"measure",e[451]),qr(t,"click",function(){fr(e[42]?e[229]:o)&&(e[42]?e[229]:o).apply(this,arguments)}),Ar(qc.call(null,t,{observeViewRect:!0,isMeasureRoot:!0})),Ar(Kc.call(null,t)),Ar(ed.call(null,t))],a=!0)},p(o,a){(e=o)[40]?l?(l.p(e,a),512&a[1]&&ja(l,1)):(l=Em(e),l.c(),ja(l,1),l.m(t,i)):l&&(Na(),Ua(l,1,1,()=>{l=null}),Ha()),e[102]>0?c?c.p(e,a):(c=Jm(e),c.c(),c.m(t,n)):c&&(c.d(1),c=null),e[60]?d?(d.p(e,a),536870912&a[1]&&ja(d,1)):(d=Qm(e),d.c(),ja(d,1),d.m(t,null)):d&&(Na(),Ua(d,1,1,()=>{d=null}),Ha()),(!r||16&a[0])&&Qr(t,"id",e[4]),(!r||32768&a[2])&&Qr(t,"class",e[77]),(!r||8192&a[2])&&Qr(t,"data-env",e[75]),(!r||4096&a[0])&&Qr(t,"dir",e[12])},i(e){r||(ja(l),ja(d),r=!0)},o(e){Ua(l),Ua(d),r=!1},d(o){o&&jr(t),l&&l.d(),c&&c.d(),d&&d.d(),e[450](null),a=!1,$r(s)}}}const og=1,ig="stage-overlay",ng=10;function rg(e,t,i){let n,r,a,s,l,c,d,u,p,h,g,$,b,x,v,w,k,C,P,R,I,E,A,F,z,D,O,W,_,V,H,j,U,G,Z,X,Y,q,K,J,Q,te,oe,ie,ne,re,ae,se,le,ce,de,ue,pe,he,me,$e,fe,xe,ve,Se,we,ke,Ce,Te,Me,Re,Ie,Ee,Ae,Le,Fe,ze,De,Oe,Be,We,_e,Ve,Ne,He,je,Ue,Ge,Xe,Ye,qe,Ke,Je,Qe,et,tt,ot,it,nt,lt,ct,ut,pt,mt,ft,yt,St,wt,Tt,Mt,It,At,Ft,zt,Dt,Ot,Bt,Wt,_t,Vt,Nt,Ht,jt,Ut,Gt,Zt,Xt,Kt,Jt,Qt,eo,to,oo,io,ro,ao,so,lo,co,uo,po,ho,mo,go,$o,fo,yo,bo,vo,So,wo,ko,Co,Mo,Po,Ro,Io,Eo,Ao,Lo,Fo,zo,Do,Oo,Bo,Wo,_o,Vo,Ho,jo,Uo,Go,Zo,Xo,Yo,qo,Jo,Qo,ei,ti,oi,ii,ri,ai,si,li,ci,di,ui,pi,hi,mi,gi,$i,fi,yi,bi,xi,vi,Si,wi,ki,Ci,Ti,Mi,Pi,Ii,Ei,Ai,Li,Fi,zi,Bi,Wi,_i,Ni,Hi,Ui,Gi,Xi,Yi=ur,qi=ur;wr(e,zc,e=>i(419,oi=e)),e.$$.on_destroy.push(()=>Yi()),e.$$.on_destroy.push(()=>qi());const Ki=ni(),Ji=xa();let{class:Qi}=t,{layout:en}=t,{stores:tn}=t,{locale:on}=t,{id:nn}=t,{util:rn}=t,{utils:an}=t,{animations:sn="auto"}=t,{disabled:ln=!1}=t,{previewUpscale:cn=!1}=t,{previewPad:dn=!1}=t,{previewMaskOpacity:un=.95}=t,{previewImageDataMaxSize:pn}=t,{previewImageTextPixelRatio:hn}=t,{markupMaskOpacity:mn=1}=t,{zoomMaskOpacity:gn=.85}=t,{elasticityMultiplier:$n=10}=t,{willRevert:fn=()=>Promise.resolve(!0)}=t,{willProcessImage:yn=()=>Promise.resolve(!0)}=t,{willRenderCanvas:bn=ee}=t,{willRenderToolbar:xn=ee}=t,{willRenderUtilTabs:vn=ee}=t,{willSetHistoryInitialState:Sn=ee}=t,{enableButtonExport:wn=!0}=t,{enableButtonRevert:kn=!0}=t,{enableNavigateHistory:Cn=!0}=t,{enableToolbar:Tn=!0}=t,{enableUtils:Mn=!0}=t,{enableButtonClose:Pn=!1}=t,{enableDropImage:Rn=!1}=t,{enablePasteImage:In=!1}=t,{enableBrowseImage:En=!1}=t,{accept:Ln="image/*"}=t,{enableTransparencyGrid:Fn=!1}=t,{layoutDirectionPreference:zn="auto"}=t,{layoutHorizontalUtilsPreference:Dn="left"}=t,{layoutVerticalUtilsPreference:Wn="bottom"}=t,{layoutVerticalToolbarPreference:_n="top"}=t,{layoutVerticalControlGroupsPreference:Vn="bottom"}=t,{layoutVerticalControlTabsPreference:Hn="bottom"}=t,{supportedMediaTypes:jn=["image"]}=t,{status:Un}=t,{formatStatusImageLoading:Gn=function(e,t){const{state:o}=e;if(!o||!o.task)return t.statusImageLoadNone;if(o.error){if("IMAGE_TOO_SMALL"===o.error.code)return t.statusImageLoadMinSize;if("VIDEO_TOO_SHORT"===o.error.code){const e=Array.isArray(t.unitSeconds)?1===o.error.metadata.minDuration?t.unitSeconds[0]:t.unitSeconds[1]:t.unitSeconds;return jl(t.statusImageLoadMinDuration,{seconds:e},"{","}")}return t.statusImageLoadError}return"blob-to-bitmap"===o.task?t.statusImageLoadPrepare:t.statusImageLoadBusy}}=t,{formatStatusImageProcessing:Zn=function(e,t){const{state:o}=e;if(o&&o.task)return"store"===o.task?o.error?t.statusImageUploadError:t.statusImageUploadBusy:o.error?t.statusImageProcessError:t.statusImageProcessBusy}}=t,{formatStatusSupportError:Xn=function(e,t){const{features:o}=e;return{features:o.join(", ")}}}=t,{textDirection:Yn}=t,{markupEditorZoomLevel:qn=null}=t,{markupEditorZoomLevels:Kn}=t,{markupEditorZoomAdjustStep:Jn}=t,{markupEditorZoomAdjustFactor:Qn}=t,{markupEditorZoomAdjustWheelFactor:er}=t,{markupEditorInteractionMode:tr=!1}=t,{muteAudio:or=!0}=t,{willSetMediaInitialTimeOffset:ir=(e,t)=>e*km(t[0])}=t,{enablePan:nr=!0}=t,{enableZoom:rr=!0}=t,{enableZoomControls:ar=!0}=t,{enableZoomInput:sr}=t,{enablePanInput:lr}=t,{enableCanvasAlpha:pr=!1}=t,{enablePanLimit:hr}=t,{panLimitGutterScalar:mr}=t,{pan:gr=null}=t,{zoomPresetOptions:$r=[.25,.5,1,1.25,1.5,2,3,4,6,8,16]}=t,{zoomAdjustStep:fr=.25}=t,{zoomAdjustFactor:yr=.1}=t,{zoomAdjustWheelFactor:br=1}=t,{zoomLevel:xr=null}=t,{fixScrollDirection:kr=!1}=t;const Cr=ls(kr);va("fixScrollDirection",Cr);const Tr=m()&&"visualViewport"in window,Mr=ls("hidden");function Pr(e){const{height:t,scale:o}=e.target,i=t*o/window.screen.height<.75?"visible":"hidden";Mr.set(i)}let Rr,Ir;va("softKeyboardState",Mr),Tr&&window.visualViewport.addEventListener("resize",Pr);let{imagePreviewSrc:Ar}=t,{imageOrienter:Lr={read:()=>1,apply:e=>e}}=t,{pluginComponents:Fr}=t,{pluginOptions:zr={}}=t;const Dr=Ki.sub,Or={};let{root:Br}=t;const Wr=()=>{wt.setAttribute("data-redraw","true"),sa.set({})},_r=ls(!0);wr(e,_r,e=>i(486,Xt=e));const Vr=ls(void 0);wr(e,Vr,e=>i(429,xi=e));const Nr=ls(0);wr(e,Nr,e=>i(426,fi=e));const Hr=ls(!1),jr=e=>{Hr.set("play"===e.type),Ki.pub(e.type)};let Ur,Gr;let Zr,Xr,Yr=!1;const qr=()=>{if(!a||!Jr())return;Xr=p,Er(Vr,xi=void 0,xi);const e=wt;Yr=!1;const t=1/24,o=na(),i=Math.abs(d*o-fi*o)<=t,n=o-o*fi<=t;i?Er(Nr,fi=c,fi):n&&Er(Nr,fi=0,fi),aa(fi*na()),e.play().catch(()=>{});const r=()=>{if(Jr())return;const e=Xr>=0;Zr=requestAnimationFrame(r);const t=ra();Er(Nr,fi=Math.min(t/na(),1),fi),e&&fi>=d&&(Er(Nr,fi=d,fi),Kr()),p>-1&&(Yr=!0),e&&Yr&&-1===p&&h>0&&(Er(Nr,fi=l[h][0],fi),aa(fi*na())),fi>=1&&Kr(),Er(wa,hi=fi*na(),hi),Wr()};r()},Kr=()=>{a&&!Jr()&&(Er(Vr,xi=void 0,xi),Xr=void 0,wt.pause(),cancelAnimationFrame(Zr),Wr())},Jr=()=>wt&&wt.paused,Qr=()=>{if(a)return Jr()?qr():Kr()},ea=()=>{if(!a)return;wt.muted=!0},ta=()=>{if(!a)return;wt.muted=!1},oa=()=>{a&&Er(ia,bi=!bi,bi)},ia=ls(or);wr(e,ia,e=>i(428,bi=e));const na=()=>{if(a)return wt.duration},ra=()=>{if(!a)return;return wt.currentTime},aa=e=>{a&&(am(wt,e),Er(Nr,fi=e/yi,fi))},sa=ls({});wr(e,sa,e=>i(52,Qt=e)),va("redrawTrigger",sa);const la=ls($n);wr(e,la,e=>i(503,gi=e)),va("elasticityMultiplier",la);let ca=[];const da=Fc();wr(e,da,e=>i(102,Xi=e));const ua=gc()||1024,pa=Ze(ua,ua),ha=qs(),ma=e=>Promise.resolve(mi&&mi(e,{resourceType:"image"})).then(t=>{if(!1===t)return;const{headers:o,credentials:i}=t||{};return fetch(e,{headers:o,credentials:i}).then(e=>{if(200!==e.status)throw`${e.status} (${e.statusText})`;return e.blob()}).then(e=>hm(e,{imageOrienter:Lr,canvasMemoryLimit:ha})).then(e=>mm(e,b))});let{imageSourceToImageData:ga=e=>y(e)?ma(e):Yt(e)?new Promise(t=>t(f(e))):xo(e)||qt(e)?hm(e,{imageOrienter:Lr,canvasMemoryLimit:ha}).then(e=>mm(e,b)):void 0}=t;const $a=(()=>{let e,t;const o=cm.reduce((e,o)=>(e[o]=function(e,t,o){let i=[];return{set:t,update:o,publish:e=>{i.forEach(t=>t(e))},subscribe:t=>(i.push(t),e(t),()=>{i=i.filter(e=>e!==t)})}}(e=>{if(!t)return e();t.stores[o].subscribe(e)()},e=>{t&&t.stores[o].set(e)},e=>{t&&t.stores[o].update(e)}),e),{});return{update:i=>{if(t=i,e&&(e.forEach(e=>e()),e=void 0),!i)return o.file.publish(void 0),void o.loadState.publish(void 0);e=cm.map(e=>i.stores[e].subscribe(t=>{o[e].publish(t)}))},stores:o,destroy:()=>{e&&e.forEach(e=>e())}}})(),{file:fa,size:ya,duration:Sa,currentTime:wa,trim:ka,volume:Ta,minDuration:Ma,maxDuration:Pa,loadState:Ra,processState:Ia,cropAspectRatio:Ea,cropLimitToImage:Aa,crop:La,cropMinSize:Fa,cropMaxSize:za,cropRange:Da,cropOrigin:Oa,cropRectAspectRatio:Ba,rotation:Wa,rotationRange:_a,targetSize:Va,flipX:Na,flipY:Ha,backgroundColor:ja,backgroundImage:Ua,backgroundFilterMode:Ga,colorMatrix:Za,convolutionMatrix:Xa,gamma:Ya,vignette:qa,noise:Ka,decoration:Ja,annotation:Qa,manipulation:es,redaction:ts,frame:os,selection:is,state:ns}=$a.stores;wr(e,fa,e=>i(403,So=e)),wr(e,ya,e=>i(377,It=e)),wr(e,Sa,e=>i(427,yi=e)),wr(e,wa,e=>i(502,hi=e)),wr(e,ka,e=>i(424,pi=e)),wr(e,Ta,e=>i(425,$i=e)),wr(e,Pa,e=>i(430,vi=e)),wr(e,Ra,e=>i(395,uo=e)),wr(e,Ia,e=>i(394,co=e)),wr(e,Ea,e=>i(499,ri=e)),wr(e,Aa,e=>i(85,Ci=e)),wr(e,La,e=>i(414,Vo=e)),wr(e,Wa,e=>i(380,zt=e)),wr(e,Na,e=>i(379,Ft=e)),wr(e,Ha,e=>i(378,At=e)),wr(e,ja,e=>i(385,Ut=e)),wr(e,Ja,e=>i(48,Mt=e)),wr(e,Qa,e=>i(49,Dt=e)),wr(e,es,e=>i(382,Nt=e)),wr(e,ts,e=>i(383,Ht=e)),wr(e,os,e=>i(47,Tt=e)),wr(e,is,e=>i(59,ci=e)),wr(e,ns,e=>i(488,Co=e)),va("components",{DynamicComponentTree:Rh}),va("previewcontrols",{play:qr,pause:Kr,togglePlayPause:Qr,mute:ea,unmute:ta,toggleMute:oa,setCurrentTime:aa,getCurrentTime:ra,getDuration:na,frameOffset:Nr,framePeekOffset:Vr,isPlaying:Hr,isMuted:ia});const rs=(e,t,o=0)=>new Promise((i,n)=>{if(al(e))return void il(e).then(e=>{const t=No(hi)?hi:ir(e.duration,pi||[[0,1]]);nl(e,t).then(i)}).catch(n);let r,a=!1;t.cancel=()=>a=!0;const s=Date.now();ga(e).then(e=>{const t=Date.now()-s;clearTimeout(r),r=setTimeout(()=>{a||i(e)},Math.max(0,o-t))}).catch(n)}),{images:as,shapePreprocessor:ds,imageScrambler:us,imageRedactionRendering:ps,willRequest:hs,willRequestResource:ms,csp:gs}=tn;let $s;wr(e,as,e=>i(423,ui=e)),wr(e,ds,e=>i(422,di=e)),wr(e,us,e=>i(386,Gt=e)),wr(e,ps,e=>i(384,jt=e)),wr(e,hs,e=>i(81,mi=e)),wr(e,ms,e=>i(93,Fi=e)),wr(e,gs,e=>i(92,Li=e));const fs=cs(Ua,(e,t)=>{if(!e)return t(void 0);$s&&($s.cancel(),$s=void 0),$s={cancel:o},rs(e,$s).then(t).catch(e=>{})}),ys=ns.subscribe(e=>Ki.pub("update",e)),bs=ls();va("ui",ls({})),va("selection",is);const xs=ls(!0);wr(e,xs,e=>i(95,Bi=e));const vs=ls(!0);wr(e,vs,e=>i(97,_i=e));const Ss=ls(!0);wr(e,Ss,e=>i(421,li=e));const ws=ls(!0);wr(e,ws,e=>i(500,ai=e));const ks=ls(!0);wr(e,ks,e=>i(98,Ni=e));const Cs=ls();wr(e,Cs,e=>i(99,Hi=e));const Ts=ls();wr(e,Ts,e=>i(501,si=e));const Ms=cs([Ts,ws],()=>void 0!==si?si:ai);wr(e,Ms,e=>i(96,Wi=e));const Ps=ls([0,0,0]);wr(e,Ps,e=>i(56,Eo=e));const Is=ls([1,1,1]);wr(e,Is,e=>i(484,Vt=e));const Es=Fc([1,1,1]);wr(e,Es,e=>i(483,_t=e));const As=ls();wr(e,As,e=>i(91,Ai=e));const Ls=ls(),zs=ls();wr(e,zs,e=>i(51,Kt=e));const Ds=ls();wr(e,Ds,e=>i(375,yt=e));const Os=ls(at());wr(e,Os,e=>i(80,Mo=e));const Bs=ls(0);wr(e,Bs,e=>i(420,ii=e));const Ws=ls(at());wr(e,Ws,e=>i(84,ki=e));const _s=ls();wr(e,_s,e=>i(481,St=e));const Ns=pm("(pointer: fine)",e=>e?"pointer-fine":"pointer-coarse");wr(e,Ns,e=>i(401,bo=e));const Hs=pm("(hover: hover)",e=>e?"pointer-hover":"pointer-no-hover");wr(e,Hs,e=>i(400,yo=e));const js=ls(!1),Us=ls(!1);wr(e,Us,e=>i(381,Wt=e));const Gs=ss(void 0,e=>{const t=Fc(0),o=[Us.subscribe(e=>{t.set(e?1:0,{hard:!to})}),t.subscribe(e)];return()=>o.forEach(e=>e())});wr(e,Gs,e=>i(482,Bt=e));const Zs=ls();wr(e,Zs,e=>i(487,go=e));const Xs=ls();let Ys;wr(e,Xs,e=>i(53,to=e)),va("isAnimated",Xs);const Ks=ls(cn);wr(e,Ks,e=>i(404,wo=e));const Js=ls(!1);wr(e,Js,e=>i(493,Uo=e)),va("imageIsStatic",Js);const Qs=ls();wr(e,Qs,e=>i(494,Go=e));const el=ls();wr(e,el,e=>i(491,Ho=e));const tl=ss(void 0,e=>{const t=ls(void 0),o=[La.subscribe(()=>{if(!Vo)return;if(Uo)return t.set(rt(Vo));const e=Vh(Vo,Ho,5*$n);t.set(e)}),t.subscribe(e)];return()=>o.forEach(e=>e())}),ol=ls();wr(e,ol,e=>i(490,_o=e));const rl=ls();wr(e,rl,e=>i(492,jo=e));const sl=ls(void 0);wr(e,sl,e=>i(497,Qo=e));const ll=ls(ye());wr(e,ll,e=>i(498,ei=e));const cl=(e,t)=>{if(!t||!e)return{top:0,right:0,bottom:0,left:0};const o=Bn(t,e,x),i=On(o,e);return{top:Math.abs(i.top),right:Math.abs(i.right),bottom:Math.abs(i.bottom),left:Math.abs(i.left)}},dl=ls({}),ul=cs([_s,Os,Ws,dl],([e,t,o,i],n)=>{if(!e)return n(void 0);let r=0;1!==V.length||g||"bottom"===_n||(r=o.y+o.height),n(ht(e.x+t.x,e.y+t.y+r,e.width,e.height))});let pl={left:0,right:0,top:0,bottom:0};const hl=ls(!1),ml=cs([hl,os,ul,Us],([e,t,o,i],n)=>{if(!o)return n({left:0,right:0,top:0,bottom:0});if(!e)return;const r=Math.min(o.width,o.height),a=cl({width:r,height:r},t);ge(pl.top,4)===ge(a.top,4)&&ge(pl.bottom,4)===ge(a.bottom,4)&&ge(pl.right,4)===ge(a.right,4)&&ge(pl.left,4)===ge(a.left,4)||(pl=a,n(a))});wr(e,ml,e=>i(412,Oo=e));const gl=cs([hl,ml],([e,t],o)=>{if(!e)return o(!1);o(Object.values(t).some(e=>e>0))});wr(e,gl,e=>i(413,Bo=e));const $l=cs([hl,_s,gl,ml],([e,t,o,i],n)=>{if(t)return e&&o?void n(ht(t.x+i.left,t.y+i.top,t.width-i.left-i.right,t.height-i.top-i.bottom)):n({...t})}),fl=cs([ul,gl,ml],([e,t,o],i)=>e?t?void i(ht(e.x+o.left,e.y+o.top,e.width-o.left-o.right,e.height-o.top-o.bottom)):i(e):i(void 0));wr(e,fl,e=>i(50,Ot=e));const yl=cs([Js,ya,Wa],([e,t,o],i)=>{if(!e||!t)return i(void 0);const n=st(t);i(kt(n,o))}),bl=cs([yl],([e],t)=>{if(!e)return t(void 0);const o=dt(e);t(Lt(o))});wr(e,bl,e=>i(416,Yo=e));const xl=cs([fl,La,bl,Ks],([e,t,o,i],n)=>{if(!e||!t||!(!Go&&!Ho))return;const{width:r,height:a}=o||t,s=Math.min(e.width/r,e.height/a);n(i?s:Math.min(1,s))});wr(e,xl,e=>i(415,Xo=e));const vl=cs([Js,ya,Wa,fl,_s,xl],([e,t,o,i,n,r],a)=>{if(!(e&&i&&n&&t))return a(void 0);const s=st(t),l=Lt($t(s,r)),c=Ct(i,l);l.x=c.x,l.y=c.y;a(kt(l,o))});va("imageStaticVisualCorners",vl);const Sl=ls(void 0);wr(e,Sl,e=>i(418,ti=e));const wl=cs([La,fl],([e,t])=>{if(t&&e)return Math.min(t.width/e.width,t.height/e.height)}),kl=cs([La,ol],([e,t])=>e&&t?Math.min(e.width/t.width,e.height/t.height):1);wr(e,kl,e=>i(101,Gi=e));const Cl=cs([Sl,kl],([e,t])=>e&&t?t*e:1);wr(e,Cl,e=>i(496,qo=e));const Tl=ls(ye());wr(e,Tl,e=>i(417,Jo=e));const Ml=ls({scalar:qo,translation:Jo}),Pl=()=>{Ml.set({scalar:void 0,translation:ye()})},Rl=ss(void 0,e=>{const t=Fc(void 0,{precision:1e-4}),o=1===Yd()?e=>Et(e,Math.round):ee,i=()=>{if(!_o)return;const e=Wt||!go;if(Uo){const o=rt(_o);return gt(o,ei),gt(o,Ot),t.set(o,{hard:e})}const i=Vh(_o,Qo,og*$n);i.width<0&&(i.width=0,i.x=_o.x),i.height<0&&(i.height=0,i.y=_o.y),gt(i,Ot),gt(i,Jo),$t(i,qo),!e&&o(i),t.set(i,{hard:e})},n=[fl.subscribe(i),ol.subscribe(i),Cl.subscribe(i),Tl.subscribe(i),os.subscribe(i),t.subscribe(e)];return()=>n.forEach(e=>e())});wr(e,Rl,e=>i(58,Do=e));const Il=ls(1);wr(e,Il,e=>i(489,Wo=e));const El=()=>{if(!Vo||!Ot)return;let e=bt(rt(Vo),Xo||1);const t=Ct(Ot,bt(rt(Yo),Xo));gt(e,t);const o=St.width/e.width,i=St.height/e.height,n=Math.min(1,o,i);Il.set(n),$t(e,n),((e,t)=>{const[o,i,n,r]=Rt(e);o<t.y&&(e.y=Math.max(t.y,e.y)),i>t.width&&(e.x=t.width-e.width),n>t.height&&(e.y=t.height-e.height),r<t.x&&(e.x=Math.max(t.x,e.x))})(e,{...St,x:0,y:0}),ol.set(e)},Al=cs([fl,xl,La,ya],([e,t,o,i],n)=>{e&&(o||i)&&n(Ll(e,t||1,o||i))});wr(e,Al,e=>i(100,Ui=e));const Ll=(e,t,o)=>o.width<=e.width&&o.height<=e.height?Ct(e,bt(rt(o),t)):Pt(e,vt(o));let Fl,zl;const Dl=e=>{if(g&&Fl&&xt(Fl,e)&&zl===Xo)return;if(Uo)return El();Fl=e,zl=Xo;const t=Ll(e,Xo,Vo||It);ol.set(t)};let Ol=!1;const Bl=xl.subscribe(e=>{!Ol&&void 0!==e&&Vo&&(Dl(Ot),Ol=!0)}),Wl=fl.subscribe(e=>{e&&void 0!==Xo&&Vo&&Dl(e)}),Vl=Js.subscribe(e=>{!e&&Ot&&Dl(Ot)});let Nl;const Hl=rl.subscribe(e=>{if(!e)return Nl=void 0,void Er(Qs,Go=void 0,Go);Nl=Zo;const t=rt(Vo);Qs.set(t)}),Ul=ol.subscribe(e=>{if(!e||!jo)return;const t=(o=rt(e),i=jo,o.x-=i.x,o.y-=i.y,o.width-=i.width,o.height-=i.height,o);var o,i;((e,t)=>{e.x/=t,e.y/=t,e.width/=t,e.height/=t})(t,Nl);const n=((e,t)=>(e.x+=t.x,e.y+=t.y,e.width+=t.width,e.height+=t.height,e))(rt(Go),t);La.set(n)}),Gl=La.subscribe(e=>{if(!e||!_o)return;if(Uo)return void(jo||El());if(Wt||jo||Ho)return;const t=vt(_o),o=vt(e);if(ge(t,6)===ge(o,6))return;const{width:i,height:n}=Vo,r=Math.min(Ot.width/i,Ot.height/n),a=Ze(e.width*r,e.height*r),s=.5*(_o.width-a.width),l=.5*(_o.height-a.height),c=ht(Math.max(0,Math.min(Ot.width-a.width,_o.x+s)),Math.max(0,Math.min(Ot.height-a.height,_o.y+l)),a.width,a.height);ol.set(c)}),Zl=cs([xl,La,ol,Js],([e,t,o,i],n)=>{if(!e||!t||!o)return;if(i)return n(Wo);const r=o.width/t.width,a=o.height/t.height;n(Math.max(r,a)/e)}),Xl=cs([xl,Zl],([e,t],o)=>{if(!t)return;o(e*t)});wr(e,Xl,e=>i(495,Zo=e));let Yl={left:0,right:0,top:0,bottom:0};const ql=cs([os,ol],([e,t],o)=>{if(!t)return o(Yl);const i=cl(t,e);ge(Yl.top,4)===ge(i.top,4)&&ge(Yl.bottom,4)===ge(i.bottom,4)&&ge(Yl.right,4)===ge(i.right,4)&&ge(Yl.left,4)===ge(i.left,4)||(Yl=i,o(i))}),Kl=cs([ql],([e],t)=>{t(Object.values(e).some(e=>e>0))}),Jl=Fc(.075,{stiffness:.03,damping:.4,precision:.001}),Ql=cs([Es,Ps,Jl,Rl,Cl,os,Kl,ql,gl],([e,t,o,i,n,r,a,s,l],c)=>{if(!i||g)return c([]);let{x:d,y:u,width:p,height:h}=i;d+=.5,u+=.5,p-=.5,h-=.5;const m=[];if(r){if(a){let{left:e,right:o,top:i,bottom:r}=s;e*=n,o*=n,i*=n,r*=n;const a=vm(t)?[1,1,1,.125]:[0,0,0,.075];m.push({x:d-e-.5,y:u-i-.5,width:p+e+o+1,height:h+i+r+1,strokeWidth:1,strokeColor:a,opacity:l?1:.5})}const i=vm(e);r&&r.frameColor&&vm(r.frameColor)||i||(m.push({x:d-1,y:u-1,width:p+2,height:h+2,strokeWidth:2,strokeColor:[0,0,0,.1],opacity:o}),m.push({x:d+1,y:u+1,width:p-2,height:h-2,strokeWidth:2,strokeColor:[0,0,0,.1],opacity:o}))}c([...m,{x:d,y:u,width:p,height:h,strokeWidth:1,strokeColor:e,opacity:o}])}),ec=ls([]);wr(e,ec,e=>i(406,Po=e));const tc=cs([Ql,ec],([e,t],o)=>{o([...e,...t])});wr(e,tc,e=>i(94,zi=e));const oc=Fc(0,{precision:.001});wr(e,oc,e=>i(408,Io=e));const ic=Fc();wr(e,ic,e=>i(411,Fo=e));const nc=Fc();wr(e,nc,e=>i(410,Lo=e));const rc=Fc();wr(e,rc,e=>i(409,Ao=e));const ac=Fc();wr(e,ac,e=>i(407,Ro=e));const sc=ls(!1);wr(e,sc,e=>i(393,lo=e));const lc=ls();let cc;wr(e,lc,e=>i(396,po=e));const dc=cs([sc,lc],([e,t],n)=>{if(!e||!t)return void n(void 0);if(cc&&(cc.cancel(),i(297,cc=void 0)),Nn(t))return n(M(t));const r=Oc.length?0:to?250:0;i(297,cc={cancel:o}),rs(t,cc,r).then(n).catch(e=>{Er(Ra,uo.error=e,uo)}).finally(()=>{i(297,cc=void 0)})});Yi(),Yi=vr(dc,e=>i(376,wt=e));let{imagePreviewCurrent:uc}=t;const pc=ls({});wr(e,pc,e=>i(398,$o=e));const hc=ls([]);wr(e,hc,e=>i(86,Ti=e));const mc=cs([fl,Ds,ya,tl,ol,Xl,Wa,Na,Ha,Cl,Tl,js],([e,t,o,i,n,r,a,s,l,c,d,u],p)=>{if(!e||!n)return;const h=_l(e,t,o,i,n,c,d,r,a,s,l);!u&&D(h),p(h)});wr(e,mc,e=>i(399,fo=e));const fc=cs([Za,Xa,Ya,qa,Ka],([e,t,o,i,n],r)=>{const a=e&&Object.keys(e).map(t=>e[t]).filter(Boolean);r({gamma:o||void 0,vignette:i||void 0,noise:n||void 0,convolutionMatrix:t||void 0,colorMatrix:a&&a.length&&cr(a)})});let yc,bc;const xc=(()=>{if(!To())return!1;const e=navigator.userAgent.match(/OS (\d+)_(\d+)_?(\d+)?/i)||[],[,t,o]=e.map(e=>parseInt(e,10)||0);return t>13||13===t&&o>=4})(),vc=ls({});wr(e,vc,e=>i(387,Jt=e)),va("env",vc);const Sc=Yd(),wc=ss(Sc,e=>{const t=()=>e(Yd()),o=matchMedia(`(resolution: ${Sc}dppx)`);return o.addListener(t),()=>o.removeListener(t)});wr(e,wc,e=>i(57,zo=e));const kc=((e,t,o)=>{const{sub:i,pub:n}=ni(),{willUndo:r=()=>!0}=o||{},a=[],s=ls(0),l=[],c=()=>l.forEach(e=>e({index:Sr(s),length:a.length})),d={get index(){return Sr(s)},set index(e){e=Number.isInteger(e)?e:0,e=Rs(e,0,a.length-1),s.set(e),t(a[d.index]),c()},get state(){return a[a.length-1]},length:()=>a.length,undo(){if(!1===r())return;const e=d.index--;return n("undo",e),e},redo(){const e=d.index++;return n("redo",d.index),e},revert(){a.length=1,d.index=0,n("revert")},write(o){o&&t({...e(),...o});const i=e(),r=a[a.length-1];JSON.stringify(i)!==JSON.stringify(r)&&(a.length=d.index+1,a.push(i),s.set(a.length-1),c(),n("writehistory"))},set(e={}){a.length=0,d.index=0;const t=Array.isArray(e)?e:[e];a.push(...t),d.index=a.length-1},get:()=>[...a],subscribe:e=>(l.push(e),e({index:d.index,length:a.length}),()=>l.splice(l.indexOf(e),1)),on:i};return d})(()=>Co,e=>{Er(ns,Co=e,Co),Os.set(Mo)},{willUndo:()=>!Ic()||(Rc(),!1)});qi(),qi=vr(kc,e=>i(405,ko=e));const Cc=()=>{const e={x:0,y:0,...It},t=Et(Pt(e,Co.cropAspectRatio),Math.round),o=Sn({...Co,rotation:0,crop:t},Co),i=[o];JSON.stringify(o)!==JSON.stringify(Co)&&i.push({...Co}),kc.set(i)},Tc=Ra.subscribe(e=>{e&&e.complete&&Cc()}),Mc=()=>fn().then(e=>e&&kc.revert()),Pc=[Qa,Ja,ts,es],Rc=()=>{Pc.forEach(e=>{e.update(e=>e.length&&Zi(e[e.length-1])?e.slice(0,-1):e)})},Ic=()=>_.filter(e=>e.length).some(e=>Zi(e[e.length-1])),Ec=ls(!1);wr(e,Ec,e=>i(388,eo=e));const Lc=()=>{Er(Ec,eo=!0,eo),yn().then(e=>{if(!e)return void Er(Ec,eo=!1,eo);let t;t=hd.subscribe(e=>{1===e&&(t&&t(),Ji("processImage"))})})},Dc=Ia.subscribe(e=>{if(!e)return void Er(Ec,eo=!1,eo);Er(Ec,eo=!0,eo);const{complete:t,abort:o}=e;(t||o)&&Er(Ec,eo=!1,eo)}),Oc=xm();wr(e,Oc,e=>i(55,ho=e));const Bc=cs([Oc],([e],t)=>{if(!e.length)return t();const{origin:o,translation:i,rotation:n,scale:r}=e[0];t({origin:o,translation:i,rotation:n,scale:r})}),Wc=ls();wr(e,Wc,e=>i(402,vo=e));let _c,Vc=[];const Nc=ls(),Hc=ls(),jc=cs([Sl,Hc,xl,wl],([e,t,o,i])=>e||(t||o<1?i:1)),Uc={...tn,imageFile:fa,imageSize:ya,mediaDuration:Sa,mediaMinDuration:Ma,mediaMaxDuration:Pa,mediaTrim:ka,imageBackgroundColor:ja,imageBackgroundImage:Ua,imageBackgroundFilterMode:Ga,imageCropAspectRatio:Ea,imageCropMinSize:Fa,imageCropMaxSize:za,imageCropLimitToImage:Aa,imageCropRect:La,imageCropRectOrigin:Oa,imageCropRectSnapshot:Qs,imageCropRectAspectRatio:Ba,imageCropRange:Da,imageRotation:Wa,imageRotationRange:_a,imageFlipX:Na,imageFlipY:Ha,imageOutputSize:Va,imageColorMatrix:Za,imageConvolutionMatrix:Xa,imageGamma:Ya,imageVignette:qa,imageNoise:Ka,imageManipulation:es,imageDecoration:Ja,imageAnnotation:Qa,imageRedaction:ts,imageFrame:os,imagePreview:dc,imagePreviewSource:lc,imageTransforms:mc,imagePreviewModifiers:pc,history:kc,animation:Zs,pixelRatio:wc,elasticityMultiplier:$n,scrollElasticity:ng,rangeInputElasticity:5,redrawTrigger:sa,pointerAccuracy:Ns,pointerHoverable:Hs,env:vc,rootRect:Ds,stageRect:fl,stageRectBase:ul,stageRecenter:dl,stageScalar:xl,stagePadding:ml,stagePadded:gl,presentationScalar:Xl,imagePreviewUpscale:Hc,utilRect:_s,utilRectPadded:$l,allowPlayPause:_r,allowPan:xs,allowZoom:vs,allowZoomControls:Ss,enableZoomInput:ks,enablePanInput:ws,enablePanInputStatus:Ms,imageSelectionMultiTouching:Nc,rootBackgroundColor:Ps,rootForegroundColor:Is,rootLineColor:Es,rootColorSecondary:Ls,imageOutlineOpacity:Jl,utilTools:Wc,imageSelectionPan:Tl,imageSelectionZoom:Sl,imageSelectionZoomCurrent:jc,imageSelectionStageFitScalar:wl,imageSelectionStoredState:Ml,imageOverlayMarkup:ec,interfaceImages:hc,isInteracting:Us,isTransformingImage:js,isInteractingFraction:Gs,imageCropRectIntent:el,imageCropRectPresentation:tl,imageSelectionRect:ol,imageSelectionRectIntent:sl,imageSelectionRectPresentation:Rl,imageSelectionRectSnapshot:rl,imageScalar:Zl,imageTransformsInterpolated:Bc,imageEffects:fc};delete Uc.image;const Gc=`util-${B()}`;let Zc=[];const Xc=e=>H.find(([t])=>e===t);let Yc=[];const qc=e=>{i(62,Yc=Yc.concat(e))},Kc=e=>{i(62,Yc=Yc.filter(t=>t!==e))},Jc=(e,t)=>{i(306,Z[e]=t,Z)};let Qc=To();const ed=(e,t,o)=>{let i=we.getPropertyValue(e);i=o?o(i):/^[0-9]+$/.test(i)?parseFloat(i):void 0,t.set(i,{hard:!to})},td=(e,t,o=!1)=>{const i=(e=>{const t=we.getPropertyValue(e);return Kp(t)})(e);i&&0!==i[3]&&(o||(i.length=3),t.set(i,{hard:!to}))},id=ls();wr(e,id,e=>i(87,Mi=e));const nd=ls();wr(e,nd,e=>i(88,Pi=e));const rd=ls();wr(e,rd,e=>i(89,Ii=e));const ad=Fc(0,{damping:.9});wr(e,ad,e=>i(90,Ei=e));const sd=()=>{td("color",Is),td(pr?"--color-background":"background-color",Ps),td("outline-color",Es),td("--color-primary",As),td("--color-secondary",Ls),td("--grid-color-even",nd,!0),td("--grid-color-odd",rd,!0),ed("--grid-size",id),ed("--editor-inset-top",Bs,e=>parseInt(e,10))},cd=cs([mc,fc,ja,fs,Ga],([e,t,o,i,n])=>e&&{...e,...t,backgroundColor:o,backgroundImage:i,backgroundFilterMode:n||"none"});wr(e,cd,e=>i(397,mo=e));const dd=()=>{const e=Oc.length?void 0:{resize:1.05},t=((e,t,o={})=>{const{resize:i=1,opacity:n=0}=o,r={opacity:[Fc(n,{...ym,stiffness:.1}),ee],resize:[Fc(i,{...ym,stiffness:.1}),ee],translation:[Fc(void 0,ym),ee],rotation:[Fc(void 0,bm),ee],origin:[Fc(void 0,ym),ee],scale:[Fc(void 0,bm),ee],gamma:[Fc(void 0,bm),e=>e||1],vignette:[Fc(void 0,bm),e=>e||0],colorMatrix:[Fc([...fm],ym),e=>e||[...fm]],convolutionMatrix:[ls(void 0),e=>e&&e.clarity||void 0],backgroundColor:[Fc(void 0,ym),(e,t,o)=>{if(Array.isArray(e)){if(Array.isArray(t)){const i=[...e];0===t[3]?(i[3]=0,o(i)):0===i[3]&&((e=[...t])[3]=0)}return e}}],backgroundImage:[ls(void 0),ee],backgroundFilterMode:[ls(void 0),ee]},a=Object.entries(r).map(([e,t])=>[e,t[0]]),s=a.map(([,e])=>e),l=Object.entries(r).reduce((e,[t,o])=>{const[i,n]=o;return e[t]=(e,o)=>i.set(n(e,c[t],e=>{i.set(e,{hard:!0})}),o),e},{});let c;const d=cs(s,o=>(c=o.reduce((e,t,o)=>(e[a[o][0]]=t,e),{}),c.data=e,c.size=t,c.scale*=o[1],c));return d.get=()=>c,d.set=(e,t)=>{const o={hard:!t};Object.entries(e).forEach(([e,t])=>{l[e]&&l[e](t,o)})},d})(wt,It,e);Oc.unshift(t),ud(mo)},ud=e=>{Oc.forEach((t,o)=>{const i=0===o?1:0;t.set({...e,opacity:i,resize:1},go)})};let pd;const hd=Ac(void 0,{duration:500});let md;wr(e,hd,e=>i(54,ao=e));const gd=ls(!1);let $d;wr(e,gd,e=>i(392,so=e));const fd=Fc(void 0,{stiffness:.1,damping:.7,precision:.25});wr(e,fd,e=>i(82,Si=e));const yd=Fc(0,{stiffness:.1,precision:.05});wr(e,yd,e=>i(83,wi=e));const bd=Fc(0,{stiffness:.02,damping:.5,precision:.25});wr(e,bd,e=>i(390,io=e));const xd=Fc(void 0,{stiffness:.02,damping:.5,precision:.25});wr(e,xd,e=>i(391,ro=e));const vd=Fc(void 0,{stiffness:.02,damping:.5,precision:.25});let Sd;wr(e,vd,e=>i(389,oo=e));const wd=()=>{Ji("abortLoadImage")},kd=()=>{Ji("abortProcessImage"),Er(Ec,eo=!1,eo)},Cd=e=>{e.target&&"true"===e.target.dataset.touchScroll||sm(e)||e.preventDefault()},Td=xc?e=>{const t=e.touches?e.touches[0]:e;t.pageX>20&&t.pageX<window.innerWidth-20||Cd(e)}:o,Md=ls([]);wr(e,Md,e=>i(485,Zt=e)),va("keysPressed",Md);const Pd=e=>{!e||Ko(e)&&!((e,t)=>!(!(e=>/^image/.test(e.type)&&!/svg/.test(e.type))(e)||!/image/.test(t))||!(!al(e)||!/video/.test(t)))(e,Ln)||!Ko(e)&&!/^http/.test(e)||Ji("loadImage",e)},Rd=e=>{e&&Pd(e)};let Id,Ed,Ad;let Ld,Fd=[];const zd=ls();va("rootPortal",zd),va("rootRect",Ds);const Dd=()=>({foregroundColor:[...Vt],lineColor:[..._t],utilVisibility:{...Z},isInteracting:Wt,isInteractingFraction:Bt,rootRect:rt(yt),stageRect:rt(Ot),manipulationShapesDirty:tu,annotationShapesDirty:qd,decorationShapesDirty:Jd,frameShapesDirty:Qd}),Od=(e,t,o)=>An(e,Ze(Math.round(t.width/o),Math.round(t.height/o))),Bd=(e,t,o)=>{var i;return e._translate=be((i=t).x,i.y),e._scale=o,e},Wd=e=>{const t=[];return e.forEach(e=>t.push(_d(e))),t.filter(Boolean)},_d=e=>Vi(e)?(e.points=[be(e.x1,e.y1),be(e.x2,e.y2)],e):(!(e=>Di(e)&&!e.text.length)(e)||e.backgroundColor&&0!==e.backgroundColor[3]||(Oi(e)&&(e.width=5,e.height=e.lineHeight),e.strokeWidth=1,e.strokeColor=[1,1,1,.5],e.backgroundColor=[0,0,0,.1]),e);let Vd,Nd=[],Hd=[],jd=[],Ud=[],Gd=[],Zd={};const Xd=(e,t,o,i,n,r,a)=>{const{manipulationShapesDirty:s,annotationShapesDirty:l,decorationShapesDirty:c,frameShapesDirty:d,selectionRect:u,scale:p}=e,h=Vd!==p,m=h||!xt(Zd,u);m&&(Vd=p,Zd=u),s&&(jd=t.filter(ji).map(Ri).map(e=>An(e,It))),(l||o!==Dt)&&(Nd=o.filter(ji).map(Ri).sort((e,t)=>e.alwaysOnTop?1:t.alwaysOnTop?-1:0).map(e=>An(e,It))),(h||Kd||l||o!==Dt)&&(Hd=Wd(Nd.map(e=>x(e,{flipX:Ft,flipY:At,rotation:zt,scale:p,context:st(It)})).flat())),(c||i!==Mt||m)&&(Ud=Wd(i.filter(ji).map(Ri).sort((e,t)=>e.alwaysOnTop?1:t.alwaysOnTop?-1:0).map(e=>Od(e,u,p)).map(e=>x(e,{context:u})).flat().map(e=>Bd(e,u,p)))),(d||r!==Tt||m)&&(Gd=r?Wd([r].map(Ri).map(e=>Od(e,u,p)).map(x).flat().map(e=>Bd(e,u,p))):[]);let g=Wd(n.filter(ji));return"undefined"!=typeof window&&(e=>{if(e&&e._jn1s076)return;const[t]=[[85,110,108,105,99,101,110,115,101,100,32,80,105,110,116,117,114,97,32,105,110,115,116,97,110,99,101]].map(e=>e.map(e=>String.fromCharCode(e)).join(""));g=[...g,{x:u.x+.5*u.width-82,y:u.y+u.height-16-12,width:164,height:16,text:t,fontWeight:900,fontSize:12,color:[1,1,1,.25]}]})(window),{manipulationShapesDirty:s,manipulationShapes:jd,annotationShapesDirty:l,annotationShapes:Hd,decorationShapesDirty:c,decorationShapes:Ud,frameShapesDirty:d,frameShapes:Gd,interfaceShapes:g,selectionShapes:a.map(Ri).map(e=>An(e,It))}};let qd=!0;let Kd=!0;let Jd=!0;let Qd=!0;let tu=!0;ba(()=>{Kr(),wt&&y(wt.src)&&/^blob:/.test(wt.src)&&URL.revokeObjectURL(wt.src),ys(),Wl(),Bl(),Vl(),Hl(),Ul(),Gl(),Tc(),Dc(),Ns.destroy(),Hs.destroy(),$a.destroy(),Oc.clear(),Nd.length=0,Hd.length=0,jd.length=0,Ud.length=0,Gd.length=0,Id&&S(Id),Tr&&window.visualViewport.removeEventListener("resize",Pr);try{i(235,uc=void 0),i(298,pd=void 0)}catch(e){}});let ou;return e.$$set=e=>{"class"in e&&i(236,Qi=e.class),"layout"in e&&i(237,en=e.layout),"stores"in e&&i(238,tn=e.stores),"locale"in e&&i(3,on=e.locale),"id"in e&&i(4,nn=e.id),"util"in e&&i(239,rn=e.util),"utils"in e&&i(240,an=e.utils),"animations"in e&&i(241,sn=e.animations),"disabled"in e&&i(242,ln=e.disabled),"previewUpscale"in e&&i(243,cn=e.previewUpscale),"previewPad"in e&&i(244,dn=e.previewPad),"previewMaskOpacity"in e&&i(5,un=e.previewMaskOpacity),"previewImageDataMaxSize"in e&&i(245,pn=e.previewImageDataMaxSize),"previewImageTextPixelRatio"in e&&i(6,hn=e.previewImageTextPixelRatio),"markupMaskOpacity"in e&&i(7,mn=e.markupMaskOpacity),"zoomMaskOpacity"in e&&i(246,gn=e.zoomMaskOpacity),"elasticityMultiplier"in e&&i(8,$n=e.elasticityMultiplier),"willRevert"in e&&i(247,fn=e.willRevert),"willProcessImage"in e&&i(248,yn=e.willProcessImage),"willRenderCanvas"in e&&i(9,bn=e.willRenderCanvas),"willRenderToolbar"in e&&i(249,xn=e.willRenderToolbar),"willRenderUtilTabs"in e&&i(250,vn=e.willRenderUtilTabs),"willSetHistoryInitialState"in e&&i(251,Sn=e.willSetHistoryInitialState),"enableButtonExport"in e&&i(252,wn=e.enableButtonExport),"enableButtonRevert"in e&&i(253,kn=e.enableButtonRevert),"enableNavigateHistory"in e&&i(254,Cn=e.enableNavigateHistory),"enableToolbar"in e&&i(10,Tn=e.enableToolbar),"enableUtils"in e&&i(255,Mn=e.enableUtils),"enableButtonClose"in e&&i(256,Pn=e.enableButtonClose),"enableDropImage"in e&&i(257,Rn=e.enableDropImage),"enablePasteImage"in e&&i(258,In=e.enablePasteImage),"enableBrowseImage"in e&&i(259,En=e.enableBrowseImage),"accept"in e&&i(260,Ln=e.accept),"enableTransparencyGrid"in e&&i(11,Fn=e.enableTransparencyGrid),"layoutDirectionPreference"in e&&i(261,zn=e.layoutDirectionPreference),"layoutHorizontalUtilsPreference"in e&&i(262,Dn=e.layoutHorizontalUtilsPreference),"layoutVerticalUtilsPreference"in e&&i(263,Wn=e.layoutVerticalUtilsPreference),"layoutVerticalToolbarPreference"in e&&i(264,_n=e.layoutVerticalToolbarPreference),"layoutVerticalControlGroupsPreference"in e&&i(265,Vn=e.layoutVerticalControlGroupsPreference),"layoutVerticalControlTabsPreference"in e&&i(266,Hn=e.layoutVerticalControlTabsPreference),"supportedMediaTypes"in e&&i(267,jn=e.supportedMediaTypes),"status"in e&&i(234,Un=e.status),"formatStatusImageLoading"in e&&i(268,Gn=e.formatStatusImageLoading),"formatStatusImageProcessing"in e&&i(269,Zn=e.formatStatusImageProcessing),"formatStatusSupportError"in e&&i(270,Xn=e.formatStatusSupportError),"textDirection"in e&&i(12,Yn=e.textDirection),"markupEditorZoomLevel"in e&&i(271,qn=e.markupEditorZoomLevel),"markupEditorZoomLevels"in e&&i(13,Kn=e.markupEditorZoomLevels),"markupEditorZoomAdjustStep"in e&&i(14,Jn=e.markupEditorZoomAdjustStep),"markupEditorZoomAdjustFactor"in e&&i(15,Qn=e.markupEditorZoomAdjustFactor),"markupEditorZoomAdjustWheelFactor"in e&&i(16,er=e.markupEditorZoomAdjustWheelFactor),"markupEditorInteractionMode"in e&&i(272,tr=e.markupEditorInteractionMode),"muteAudio"in e&&i(273,or=e.muteAudio),"willSetMediaInitialTimeOffset"in e&&i(274,ir=e.willSetMediaInitialTimeOffset),"enablePan"in e&&i(17,nr=e.enablePan),"enableZoom"in e&&i(18,rr=e.enableZoom),"enableZoomControls"in e&&i(275,ar=e.enableZoomControls),"enableZoomInput"in e&&i(19,sr=e.enableZoomInput),"enablePanInput"in e&&i(276,lr=e.enablePanInput),"enableCanvasAlpha"in e&&i(20,pr=e.enableCanvasAlpha),"enablePanLimit"in e&&i(21,hr=e.enablePanLimit),"panLimitGutterScalar"in e&&i(22,mr=e.panLimitGutterScalar),"pan"in e&&i(277,gr=e.pan),"zoomPresetOptions"in e&&i(23,$r=e.zoomPresetOptions),"zoomAdjustStep"in e&&i(24,fr=e.zoomAdjustStep),"zoomAdjustFactor"in e&&i(25,yr=e.zoomAdjustFactor),"zoomAdjustWheelFactor"in e&&i(26,br=e.zoomAdjustWheelFactor),"zoomLevel"in e&&i(0,xr=e.zoomLevel),"fixScrollDirection"in e&&i(278,kr=e.fixScrollDirection),"imagePreviewSrc"in e&&i(281,Ar=e.imagePreviewSrc),"imageOrienter"in e&&i(282,Lr=e.imageOrienter),"pluginComponents"in e&&i(283,Fr=e.pluginComponents),"pluginOptions"in e&&i(27,zr=e.pluginOptions),"root"in e&&i(2,Br=e.root),"imageSourceToImageData"in e&&i(28,ga=e.imageSourceToImageData),"imagePreviewCurrent"in e&&i(235,uc=e.imagePreviewCurrent)},e.$$.update=()=>{if(1073741824&e.$$.dirty[8]&&Cr.set(kr),8&e.$$.dirty[0]&&i(304,n=!!on),1&e.$$.dirty[0]|8388608&e.$$.dirty[8]&&i(0,xr=null===xr?qn:xr),2&e.$$.dirty[0]|16&e.$$.dirty[9]){let e=!1;Fr.forEach(([t])=>{Or[t]||(i(1,Or[t]={},Or),e=!0)}),e&&i(295,ca=[...Fr])}var t,m,f,T;if(8388608&e.$$.dirty[7]|33619968&e.$$.dirty[9]&&i(356,V=n&&ca.length?an||ca.map(([e])=>e):[]),134217728&e.$$.dirty[0]|65536&e.$$.dirty[9]|32768&e.$$.dirty[11]|1&e.$$.dirty[13]&&i(357,H=((e,t,o,i)=>{const n=t.filter(([t])=>e.includes(t)).filter(([e,{isSupported:t}])=>t({...i,...o[e]})).map(([e,t])=>[e,t.Component]);return Fs(n,Zc,(e,t)=>e[0]===t[0]&&e[1]===t[1])?Zc:(Zc=n,n)})(V,ca,zr,{src:So})),65536&e.$$.dirty[11]&&i(310,j=H.length),8&e.$$.dirty[0]|1&e.$$.dirty[10]|32768&e.$$.dirty[11]&&i(355,U=j&&V.map(e=>{const t=Xc(e);if(!t)return;const o=on[`${e}Label`],i=on[`${e}Title`];return{id:e,view:t[1],tabIcon:on[`${e}Icon`],tabLabel:o,tabTitle:y(i)?i:o}}).filter(Boolean)||[]),16384&e.$$.dirty[11]&&i(374,r=!!U.find(e=>"trim"===e.id)),20&e.$$.dirty[12]|16777216&e.$$.dirty[13]&&i(309,a=!!(yi&&wt&&r)),4194304&e.$$.dirty[7]|1&e.$$.dirty[10]&&i(43,G=j&&rn&&"string"==typeof rn&&Xc(rn)?rn:j>0?H[0][0]:void 0),4096&e.$$.dirty[1]|1073741824&e.$$.dirty[9]&&a&&G&&Kr(),1073741824&e.$$.dirty[9]|16&e.$$.dirty[12]&&(a?(wt.addEventListener("play",jr),wt.addEventListener("pause",jr)):wt&&"video"===wt.nodeName&&(wt.removeEventListener("play",jr),wt.removeEventListener("pause",jr))),1073741824&e.$$.dirty[9]&&a&&Nr.set(ra()/na()),75497472&e.$$.dirty[13]&&(e=>{if(!Jr())return;const t=Date.now();if(Gr&&t-Gr<16)return;Gr=t;const o=yi*e;if(o.toFixed(1)===Ur)return;Ur=o.toFixed(1);const i=wt,n=()=>{i.removeEventListener("seeked",n),Wr()};i.addEventListener("seeked",n),am(i,o)})(xi||fi),8388608&e.$$.dirty[13]&&i(372,s=fi&&ge(fi,6)),153092096&e.$$.dirty[13]&&i(370,l=pi||[[0,Math.min(yi,vi)/yi]]),536870912&e.$$.dirty[11]&&(c=l[0][0]),536870912&e.$$.dirty[11]&&(d=l[l.length-1][1]),536870912&e.$$.dirty[11]&&i(373,u=l.map(([e,t])=>[ge(e,6),ge(t,6)])),3&e.$$.dirty[12]&&i(371,p=u.findIndex(([e,t])=>s>=e&&s<=t)),1073741824&e.$$.dirty[11]|3&e.$$.dirty[12]&&(h=-1===p&&u.findIndex((e,t,o)=>{const i=o[t-1];return i?s<=e[0]&&s>=i[1]:s<=e[0]})),33554432&e.$$.dirty[8]&&ia.set(or),16&e.$$.dirty[12]|33554432&e.$$.dirty[13]&&(wt&&bi?ea():ta()),1073741824&e.$$.dirty[9]|8388608&e.$$.dirty[13]&&a&&wa.set(na()*fi),16&e.$$.dirty[12]|4194304&e.$$.dirty[13]&&wt&&(e=>{if(!a)return;wt.volume=Math.min(1,e)})($i),256&e.$$.dirty[0]&&Er(la,gi=$n,gi),1048576&e.$$.dirty[7]&&i(366,g="overlay"===en),128&e.$$.dirty[8]|33554432&e.$$.dirty[11]&&i(45,$=Mn&&!g),134217730&e.$$.dirty[0]&&zr&&Object.entries(zr).forEach(([e,t])=>{Object.entries(t).forEach(([t,o])=>{Or[e]&&i(1,Or[e][t]=o,Or)})}),65536&e.$$.dirty[13]&&i(367,k=!oi),16777216&e.$$.dirty[7]|201326592&e.$$.dirty[11]&&Er(Xs,to="always"===sn?v:"never"!==sn&&(v&&k),to),4194304&e.$$.dirty[1]|33554432&e.$$.dirty[7]&&da.set(ln?1:0,{hard:!to}),268435456&e.$$.dirty[7]&&(b=pn?(t=pn,m=pa,Ze(Math.min(t.width,m.width),Math.min(t.height,m.height))):pa),1048576&e.$$.dirty[13]&&$a.update(ui[0]),524288&e.$$.dirty[13]&&(x=di?(e,t)=>di(e,{flipX:void 0,flipY:void 0,rotation:void 0,...t,isPreview:!0}):ee),268435456&e.$$.dirty[1]&&Array.isArray(ci)&&Ji("selectionchange",[...ci]),134217728&e.$$.dirty[8]|262144&e.$$.dirty[13]&&Cs.set(li&&ar),285212672&e.$$.dirty[8]&&Ts.set("pan"===tr||lr),1048576&e.$$.dirty[1]&&Kt&&Ds.set(ht(Kt.x,Kt.y,Kt.width,Kt.height)),33554432&e.$$.dirty[11]|8388616&e.$$.dirty[12]&&yt&&g&&uo&&uo.complete&&(()=>{const e=ri,t=vt(yt);e&&e===t||(Ea.set(vt(yt)),Cc())})(),32768&e.$$.dirty[11]&&i(46,K=V.length>1),32768&e.$$.dirty[1]&&(K||Os.set(at())),1024&e.$$.dirty[0]|131072&e.$$.dirty[13]&&(Tn||Ws.set(ht(0,ii,0,0))),134217728&e.$$.dirty[11]|512&e.$$.dirty[12]&&i(369,w=!Wt&&v),1048576&e.$$.dirty[1]&&i(311,it=Kt&&Kt.width>0&&Kt.height>0),8&e.$$.dirty[0]|3&e.$$.dirty[10]&&i(40,nt=it&&on&&!!j),512&e.$$.dirty[1]&&setTimeout(()=>i(296,Ys=nt),1),16777216&e.$$.dirty[7]|131072&e.$$.dirty[9]|335544320&e.$$.dirty[11]&&Er(Zs,go="always"===sn?w:"never"!==sn&&(w&&Ys&&k),go),67108864&e.$$.dirty[7]|33554432&e.$$.dirty[11]&&Ks.set(cn||g),134217728&e.$$.dirty[7]&&hl.set(dn),536870912&e.$$.dirty[8]&&gr&&Tl.set(gr),4&e.$$.dirty[0]|36864&e.$$.dirty[13]&&Br&&(Br.dispatchEvent(dm("markupzoom",ti)),Br.dispatchEvent(dm("zoom",No(ti)?ti:Xo))),4&e.$$.dirty[0]|16384&e.$$.dirty[13]&&Br&&(Br.dispatchEvent(dm("markuppan",Jo)),Br.dispatchEvent(dm("pan",Jo))),2048&e.$$.dirty[13]&&Vo&&Pl(),8192&e.$$.dirty[13]&&Yo&&El(),4198400&e.$$.dirty[1]&&G&&Jl.set(.075,{hard:!to}),536870912&e.$$.dirty[7]&&i(364,C=gn),1536&e.$$.dirty[13]&&i(365,P=Bo?-Math.max(...Object.values(Oo)):0),138936320&e.$$.dirty[1]|25165824&e.$$.dirty[11]&&Do){let e=Do.x-Ot.x,t=Ot.x+Ot.width-(Do.x+Do.width),o=Do.y-Ot.y,i=Ot.y+Ot.height-(Do.y+Do.height),n=Math.min(e,o,t,i);oc.set(n>P?0:Math.min(C,Math.abs(n/64)),{hard:!to})}if(67108864&e.$$.dirty[1]&&i(363,R=.55/zo),4718592&e.$$.dirty[1]|4194304&e.$$.dirty[11]&&Ot&&ic.set({x:0,y:Ot.y,width:Ot.x<64?0:Ot.x,height:Ot.height+R},{hard:!to}),4718592&e.$$.dirty[1]|4194304&e.$$.dirty[11]|8&e.$$.dirty[12]&&Ot&&nc.set({x:0,y:0,width:yt.width,height:Ot.y+R},{hard:!to}),4718592&e.$$.dirty[1]|4194304&e.$$.dirty[11]|8&e.$$.dirty[12]&&Ot){let e=Ot.x+Ot.width,t=yt.width-(Ot.x+Ot.width);t<64&&(e+=t,t=0),rc.set({x:e,y:Ot.y,width:t,height:Ot.height+R},{hard:!to})}if(4718592&e.$$.dirty[1]|8&e.$$.dirty[12]&&Ot&&ac.set({x:0,y:Ot.y+Ot.height,width:yt.width,height:yt.height-(Ot.y+Ot.height)},{hard:!to}),33554432&e.$$.dirty[1]|288&e.$$.dirty[13]&&i(359,I=Fo&&{id:ig,backgroundColor:Eo,opacity:Io,...Fo}),33554432&e.$$.dirty[1]|160&e.$$.dirty[13]&&i(362,E=Lo&&{id:ig,backgroundColor:Eo,opacity:Io,...Lo}),33554432&e.$$.dirty[1]|96&e.$$.dirty[13]&&i(361,A=Ao&&{id:ig,backgroundColor:Eo,opacity:Io,...Ao}),33554432&e.$$.dirty[1]|48&e.$$.dirty[13]&&i(360,F=Ro&&{id:ig,backgroundColor:Eo,opacity:Io,...Ro}),3932160&e.$$.dirty[11]&&i(358,z=[E,A,F,I].filter(Boolean)),131072&e.$$.dirty[11]|8&e.$$.dirty[13]&&z&&Po&&ec.update(e=>[...e.filter(e=>e.id!==ig),...z]),4&e.$$.dirty[9]|1&e.$$.dirty[13]&&lc.set(Ar||(So||void 0)),4&e.$$.dirty[0]|262144&e.$$.dirty[7]|16&e.$$.dirty[12]&&(i(235,uc=wt),wt&&Br.dispatchEvent(dm("loadpreview",uc))),16777216&e.$$.dirty[12]&&po&&(Tl.set(ye()),Sl.set(void 0),Pl(),hc.set([])),4&e.$$.dirty[13]&&i(315,O=ko.index>0),4&e.$$.dirty[13]&&i(314,W=ko.index<ko.length-1),393216&e.$$.dirty[1]|3072&e.$$.dirty[12]&&(_=[Dt,Mt,Ht,Nt]),8&e.$$.dirty[1]&&Nc.set(_c),2&e.$$.dirty[13]&&Hc.set(wo),4096&e.$$.dirty[1]&&bs.set(G),4096&e.$$.dirty[1]|134217728&e.$$.dirty[9]|16384&e.$$.dirty[11]&&i(306,Z=U.reduce((e,t)=>{const o=Z&&Z[t.id];return e[t.id]=void 0!==o?o:t.id===G?1:0,e},{})),4096&e.$$.dirty[1]&&i(79,X={name:Gc,selected:G}),16384&e.$$.dirty[11]&&i(337,Y=U.map(e=>({id:e.id,icon:e.tabIcon,label:e.tabLabel,title:e.tabTitle}))),16384&e.$$.dirty[11]&&i(78,q=U.map(e=>e.id)),524288&e.$$.dirty[7]&&i(77,J=ld(["PinturaRoot","PinturaRootComponent",Qi])),8&e.$$.dirty[12]&&i(351,Q=yt&&(yt.width>1e3?"wide":yt.width<600?"narrow":void 0)),8&e.$$.dirty[12]&&i(338,te=yt&&(yt.width<=320||yt.height<=460)),8&e.$$.dirty[12]&&i(350,oe=yt&&(yt.height>1e3?"tall":yt.height<600?"short":void 0)),4&e.$$.dirty[0]&&i(317,ie=Br&&Br.parentNode&&Br.parentNode.classList.contains("PinturaModal")),1&e.$$.dirty[1]|128&e.$$.dirty[10]|8&e.$$.dirty[12]&&i(343,ne=ie&&yt&&yc>yt.width),2&e.$$.dirty[1]|128&e.$$.dirty[10]|8&e.$$.dirty[12]&&i(342,re=ie&&yt&&bc>yt.height),6&e.$$.dirty[11]&&i(344,ae=ne&&re),1048576&e.$$.dirty[0]&&i(341,se=pr),1024&e.$$.dirty[11]&&i(312,le="narrow"===Q),8192&e.$$.dirty[8]|8&e.$$.dirty[12]&&i(352,(f=yt,T=zn,ce=yt?"auto"===T?f.width>f.height?"landscape":"portrait":"horizontal"===T?f.width<500?"portrait":"landscape":"vertical"===T?f.height<400?"landscape":"portrait":void 0:"landscape")),2048&e.$$.dirty[11]&&i(76,de="landscape"===ce),4&e.$$.dirty[10]|512&e.$$.dirty[11]&&i(340,ue=le||"short"===oe),1&e.$$.dirty[1]|8&e.$$.dirty[12]&&i(339,pe=Qc&&yt&&yc===yt.width&&!xc),4&e.$$.dirty[1]|1073741824&e.$$.dirty[12]&&i(313,he=[...vo||[],...Vc].filter(Boolean)),16384&e.$$.dirty[8]&&i(349,me=`has-navigation-preference-${Dn}`),32768&e.$$.dirty[8]&&i(348,$e=`has-navigation-preference-${Wn}`),65536&e.$$.dirty[8]&&i(345,fe=`has-toolbar-preference-${_n}`),131072&e.$$.dirty[8]&&i(347,xe=`has-controlgroups-preference-${Vn}`),262144&e.$$.dirty[8]&&i(346,ve=`has-controltabs-preference-${Hn}`),8&e.$$.dirty[12]&&i(354,Se=void 0!==yt&&yt.width>0&&yt.height>0),4&e.$$.dirty[0]|8192&e.$$.dirty[11]&&i(353,we=Se&&Br&&getComputedStyle(Br)),4096&e.$$.dirty[11]&&we&&sd(),1024&e.$$.dirty[0]|4243456&e.$$.dirty[1]|34603008&e.$$.dirty[7]|1879048320&e.$$.dirty[10]|4095&e.$$.dirty[11]|805339136&e.$$.dirty[12]&&vc.set({...Jt,layoutMode:en,orientation:ce,horizontalSpace:Q,verticalSpace:oe,navigationHorizontalPreference:me,navigationVerticalPreference:$e,controlGroupsVerticalPreference:xe,controlTabsVerticalpreference:ve,toolbarVerticalPreference:fe,isModal:ie,isDisabled:ln,isCentered:ae,isCenteredHorizontally:ne,isCenteredVertically:re,isAnimated:to,isTransparent:se,pointerAccuracy:bo,pointerHoverable:yo,isCompact:ue,hasSwipeNavigation:pe,hasLimitedSpace:te,hasToolbar:Tn,hasNavigation:K&&$,isIOS:Qc,browserVersion:$c()?`chrome-${(navigator.userAgent.match(/Chrome\/([0-9]+)/)||[])[1]}`:void 0}),32768&e.$$.dirty[12]&&i(75,ke=Object.entries(Jt).map(([e,t])=>/^is|has/.test(e)?t?um(e):void 0:t).filter(Boolean).join(" ")),4096&e.$$.dirty[1]&&G&&Wc.set([]),4096&e.$$.dirty[1]|4&e.$$.dirty[8]|134217728&e.$$.dirty[10]|32768&e.$$.dirty[12]&&i(44,Ce=vn(Y.map(e=>({...e,selected:G===e.id})),{...Jt},()=>sa.set({}))),8192&e.$$.dirty[1]&&i(74,Te=!!Ce.find(e=>Array.isArray(e))),201326592&e.$$.dirty[12]&&i(73,Me=fo&&Object.entries($o).filter(([,e])=>null!=e).reduce((e,[,t])=>e={...e,...t},{})),8388608&e.$$.dirty[12]&&i(334,Ae=uo&&"any-to-file"===uo.task),16777216&e.$$.dirty[10]&&Ae&&Oc&&Oc.clear(),33554432&e.$$.dirty[12]&&i(336,Re=!!mo&&!!mo.translation),524288&e.$$.dirty[9]|67108864&e.$$.dirty[10]|16&e.$$.dirty[12]&&Re&&wt&&wt!==pd&&(i(298,pd=wt),dd()),67108864&e.$$.dirty[10]|33554432&e.$$.dirty[12]&&Re&&ud(mo),16777216&e.$$.dirty[1]&&ho&&ho.length>1){let e=[];Oc.forEach((t,o)=>{0!==o&&t.get().opacity<=0&&e.push(t)}),e.forEach(e=>Oc.remove(e))}if(8&e.$$.dirty[0]|33554432&e.$$.dirty[10]&&i(39,Ee=on&&Ie.length&&function(e,t){if(L(t.labelSupportError))return t.labelSupportError(e);const o=Xn({features:e},t);return jl(t.labelSupportError,o,"{","}")}(Ie,on)),8388608&e.$$.dirty[12]&&i(326,Le=uo&&!!uo.error),8388608&e.$$.dirty[12]&&i(42,Fe=!uo||!uo.complete&&void 0===uo.task),8388608&e.$$.dirty[12]&&i(327,ze=uo&&(uo.taskLengthComputable?uo.taskProgress:1/0)),16777216&e.$$.dirty[10]&&Ae&&Er(sc,lo=!1,lo),4194304&e.$$.dirty[1]|1048576&e.$$.dirty[9]|8388608&e.$$.dirty[12]&&uo&&uo.complete){const e=to?250:0;clearTimeout(md),i(299,md=setTimeout(()=>{Er(sc,lo=!0,lo)},e))}if(2048&e.$$.dirty[1]|65536&e.$$.dirty[10]|10485760&e.$$.dirty[12]&&i(331,De=uo&&!Le&&!Fe&&!lo),262144&e.$$.dirty[9]|16777232&e.$$.dirty[12]&&i(330,Oe=!(!po||wt&&!cc)),4194304&e.$$.dirty[1]|2097152&e.$$.dirty[12])if(lo){setTimeout(()=>ad.set(1,{hard:!to}),to?500:0)}else ad.set(0,{hard:!to});if(4259840&e.$$.dirty[12]&&i(325,Be=!!(eo||co&&void 0!==co.progress&&!co.complete)),32768&e.$$.dirty[10]&&Be&&Kr(),2048&e.$$.dirty[1]|8388608&e.$$.dirty[12]&&i(328,We=uo&&!(uo.error||Fe)),8&e.$$.dirty[0]|8388608&e.$$.dirty[12]&&i(329,_e=on&&function(e,t){const o=e?!e.complete||e.error?e:{task:"blob-to-bitmap",progress:1/0}:void 0;let i=L(t.statusLabelLoadImage)?t.statusLabelLoadImage(o):Gn({state:o},t);return e&&e.error&&e.error.metadata&&(i=jl(i,e.error.metadata,"{","}")),i}(uo,on)),8&e.$$.dirty[0]|4194304&e.$$.dirty[12]&&i(324,Ve=co&&on&&function(e,t){return L(t.statusLabelProcessImage)?t.statusLabelProcessImage(e):Zn({state:e},t)}(co,on)),4194304&e.$$.dirty[12]&&i(322,Ne=co&&(co.taskLengthComputable?co.taskProgress:1/0)),4194304&e.$$.dirty[12]&&i(323,He=co&&!co.error),4194304&e.$$.dirty[12]&&i(321,je=!(!co||!co.error)),8&e.$$.dirty[0]|2048&e.$$.dirty[1]|131072&e.$$.dirty[7]|4192256&e.$$.dirty[10])if(Un){let e,t,o,n,r;y(Un)&&(e=Un),No(Un)?t=Un:Array.isArray(Un)&&([e,t,r]=Un,!1===t&&(n=!0),No(t)&&(o=!0)),i(35,$d=(e||t)&&{text:e,aside:n||o,progressIndicator:{visible:o,progress:t},closeButton:n&&{label:on.statusLabelButtonClose,icon:on.statusIconButtonClose,onclick:r||(()=>i(234,Un=void 0))}})}else i(35,$d=on&&Fe||Le||De||Oe?{text:_e,aside:Le||We,progressIndicator:{visible:We,progress:ze},closeButton:Le&&{label:on.statusLabelButtonClose,icon:on.statusIconButtonClose,onclick:wd}}:on&&Be&&Ve?{text:Ve,aside:je||He,progressIndicator:{visible:He,progress:Ne},closeButton:je&&{label:on.statusLabelButtonClose,icon:on.statusIconButtonClose,onclick:kd}}:void 0);if(131072&e.$$.dirty[7]&&i(333,Ue=void 0!==Un),4194304&e.$$.dirty[1]|128&e.$$.dirty[10]|4194304&e.$$.dirty[12]&&ie&&co&&co.complete&&(gd.set(!0),setTimeout(()=>gd.set(!1),to?100:0)),4&e.$$.dirty[0]|4096&e.$$.dirty[1]|2097152&e.$$.dirty[12]&&lo&&Br&&Br.dispatchEvent(dm("selectutil",G)),2304&e.$$.dirty[1]|11632640&e.$$.dirty[10]|1048576&e.$$.dirty[12]&&i(332,Ge=so||Ee||Fe||Le||De||Oe||Be||Ue),4194304&e.$$.dirty[10]&&Er(hd,ao=Ge?1:0,ao),4194304&e.$$.dirty[1]|4194304&e.$$.dirty[10]&&hd.set(Ge?1:0,{duration:to?500:1}),8388608&e.$$.dirty[1]&&i(41,Xe=ao>0),16&e.$$.dirty[1]&&i(320,Ye=!(!$d||!$d.aside)),4195344&e.$$.dirty[1]|2097152&e.$$.dirty[9]|1024&e.$$.dirty[10]|524288&e.$$.dirty[12]&&Xe&&$d){clearTimeout(Sd);const e={hard:!1===to};if(Ye){const t=!!$d.error||!to;yd.set(1,e),fd.set(ro,{hard:t}),i(300,Sd=setTimeout(()=>{bd.set(16,e)},1))}else yd.set(0,e),i(300,Sd=setTimeout(()=>{bd.set(0,e)},1))}if(1024&e.$$.dirty[1]&&(Xe||(vd.set(void 0,{hard:!0}),fd.set(void 0,{hard:!0}),bd.set(0,{hard:!0}))),262144&e.$$.dirty[12]&&i(319,qe=.5*io),512&e.$$.dirty[10]|131072&e.$$.dirty[12]&&i(72,Ke=`translateX(${oo-qe}px)`),256&e.$$.dirty[1]|48&e.$$.dirty[12]&&i(38,mt=wt&&It&&!Ee),128&e.$$.dirty[1]|384&e.$$.dirty[10]&&i(316,Qe=Je&&(mt||ie)?Cd:o),64&e.$$.dirty[10]&&i(71,et=Qe),64&e.$$.dirty[10]&&i(70,tt=Qe),8&e.$$.dirty[0]|2097152&e.$$.dirty[1]|370&e.$$.dirty[8]|60&e.$$.dirty[10]|32768&e.$$.dirty[12]&&i(69,ot=on&&Qt&&wm(()=>xn([["div","alpha",{class:"PinturaNavGroup"},[["div","alpha-set",{class:"PinturaNavSet"},[Pn&&["Button","close",{label:on.labelClose,icon:on.iconButtonClose,onclick:()=>Ji("close"),hideLabel:!0}],kn&&["Button","revert",{label:on.labelButtonRevert,icon:on.iconButtonRevert,disabled:!O,onclick:Mc,hideLabel:!0}]]]]],["div","beta",{class:"PinturaNavGroup PinturaNavGroupFloat"},[Cn&&["div","history",{class:"PinturaNavSet"},[["Button","undo",{label:on.labelButtonUndo,icon:on.iconButtonUndo,disabled:!O,onclick:kc.undo,hideLabel:!0}],["Button","redo",{label:on.labelButtonRedo,icon:on.iconButtonRedo,disabled:!W,onclick:kc.redo,hideLabel:!0}]]],he.length&&["div","plugin-tools",{class:"PinturaNavSet"},he.filter(Boolean).map(([e,t,o])=>[e,t,{...o}])]]],["div","gamma",{class:"PinturaNavGroup"},[wn&&["Button","export",{label:on.labelButtonExport,icon:le&&on.iconButtonExport,class:"PinturaButtonExport",onclick:Lc,hideLabel:le}]]]],{...Jt},()=>sa.set({})))),2048&e.$$.dirty[12]&&i(308,lt=Ht&&!!Ht.length),536870912&e.$$.dirty[9]|2080&e.$$.dirty[12]&&i(307,ct=lt&&dr(It,Ht)),805306368&e.$$.dirty[9]|24592&e.$$.dirty[12]&&lt&&((e,t,o,n)=>{if(!t||!e)return;if(Ed===t&&Ad===e)return;Ad=e,Ed=t;const r={dataSizeScalar:o};n&&n[3]>0&&(r.backgroundColor=[...n]),t(e,r).then(e=>{Id&&S(Id),e.setAttribute("data-retain",!0),i(301,Id=e)})})(wt,Gt,ct,Ut),4194304&e.$$.dirty[9]|6176&e.$$.dirty[12]&&Ht&&Id&&It){const{width:e,height:t}=It,o=no()?"pixelated":"auto"===jt?"auto":"pixelated";i(302,Fd=Ht.map(i=>{const n=ht(i.x,i.y,i.width,i.height),r=kt(rt(n),i.rotation).map(o=>be(o.x/e,o.y/t));return{...i,id:"redaction",flipX:!1,flipY:!1,cornerRadius:0,strokeWidth:0,strokeColor:void 0,backgroundColor:[0,0,0,0],backgroundImage:Id,backgroundImageRendering:o,backgroundCorners:r}}))}8388608&e.$$.dirty[9]|1024&e.$$.dirty[12]&&i(37,ut=[...Fd,...Nt||[]]),32&e.$$.dirty[1]&&Ld&&zd.set(Ld),4&e.$$.dirty[0]|128&e.$$.dirty[1]&&mt&&Br&&Br.dispatchEvent(dm("ready")),262144&e.$$.dirty[1]&&i(63,qd=!0),480&e.$$.dirty[12]&&i(64,Kd=!0),131072&e.$$.dirty[1]&&i(65,Jd=!0),65536&e.$$.dirty[1]&&i(66,Qd=!0),64&e.$$.dirty[1]&&i(67,tu=!0),8&e.$$.dirty[12]&&i(305,ft=!!yt&&yt.height>0),117440512&e.$$.dirty[9]&&!n&&ft&&(clearTimeout(ou),i(303,ou=setTimeout(()=>{n||Vs("locale")},32)))},i(368,v=!od()),D=1===Yd()?e=>{e&&(Pe(e.origin,Math.round),Pe(e.translation,Math.round))}:ee,i(335,Ie=[!$m()&&"WebGL"].filter(Boolean)),i(318,Je=To()||T()&&N()),i(68,pt=((e,t=!0)=>o=>{"ping"===o.type&&(t&&o.stopPropagation(),e(o.detail.type,o.detail.data))})(Ki.pub)),[xr,Or,Br,on,nn,un,hn,mn,$n,bn,Tn,Fn,Yn,Kn,Jn,Qn,er,nr,rr,sr,pr,hr,mr,$r,fr,yr,br,zr,ga,dc,kc,yc,bc,Vc,_c,$d,Ld,ut,mt,Ee,nt,Xe,Fe,G,Ce,$,K,Tt,Mt,Dt,Ot,Kt,Qt,to,ao,ho,Eo,zo,Do,ci,Rr,Ir,Yc,qd,Kd,Jd,Qd,tu,pt,ot,tt,et,Ke,Me,Te,ke,de,J,q,X,Mo,mi,Si,wi,ki,Ci,Ti,Mi,Pi,Ii,Ei,Ai,Li,Fi,zi,Bi,Wi,_i,Ni,Hi,Ui,Gi,Xi,_r,Vr,Nr,ia,sa,la,da,fa,ya,Sa,wa,ka,Ta,Pa,Ra,Ia,Ea,Aa,La,Wa,Na,Ha,ja,Ja,Qa,es,ts,os,is,ns,as,ds,us,ps,hs,ms,gs,xs,vs,Ss,ws,ks,Cs,Ts,Ms,Ps,Is,Es,As,zs,Ds,Os,Bs,Ws,_s,Ns,Hs,Us,Gs,Zs,Xs,Ks,Js,Qs,el,ol,rl,sl,ll,ml,gl,fl,bl,xl,Sl,kl,Cl,Tl,Rl,Il,Al,Xl,ec,tc,oc,ic,nc,rc,ac,sc,lc,pc,hc,mc,vc,wc,Ec,Oc,Wc,Uc,qc,Kc,Jc,(e,t)=>t[e],e=>U.find(t=>t.id===e).view,id,nd,rd,ad,({target:e,propertyName:t})=>{e===Br&&/background|outline/.test(t)&&we&&sd()},cd,hd,gd,fd,yd,bd,xd,vd,e=>{const t=!(!$d||!$d.closeButton)||!to;xd.set(e.detail.width,{hard:t}),vd.set(Math.round(.5*-e.detail.width),{hard:t})},Td,Md,e=>{const{keyCode:t,metaKey:o,ctrlKey:i,shiftKey:n}=e;if(9===t&&ln)return void e.preventDefault();if(e.target&&32===t&&Br.contains(e.target)&&!eu(e.target)&&(Xt&&a&&Qr(),e.preventDefault()),90===t&&(o||i))return void(n&&o?kc.redo():kc.undo());if(89===t&&i)return void kc.redo();if(229===t)return;if(e.target&&(8===t||46===t)&&!Br.contains(e.target)&&eu(e.target))return;const r=new Set([...Zt,t]);Md.set(Array.from(r))},({key:e,keyCode:t})=>{if("Meta"===e)return Md.set([]);Md.set(Zt.filter(e=>e!==t))},()=>{Md.set([])},e=>{eu(e.target)||e.preventDefault()},e=>{Rn&&Pd(e.detail.resources[0])},e=>{!En||e.target&&"BUTTON"===e.target.tagName||Sm({accept:Ln}).then(Rd)},e=>{if(!In)return;const t=Rs((window.innerWidth-Math.abs(yt.x))/yt.width,0,1),o=Rs((window.innerHeight-Math.abs(yt.y))/yt.height,0,1);t<.75&&o<.75||Pd((e.clipboardData||window.clipboardData).files[0])},Dd,Xd,e=>{St&&xt(e.detail,St)||Er(_s,St=e.detail,St)},Un,uc,Qi,en,tn,rn,an,sn,ln,cn,dn,pn,gn,fn,yn,xn,vn,Sn,wn,kn,Cn,Mn,Pn,Rn,In,En,Ln,zn,Dn,Wn,_n,Vn,Hn,jn,Gn,Zn,Xn,qn,tr,or,ir,ar,lr,gr,kr,()=>i(60,Rr=void 0),(e,t,o)=>{const{text:n="",placeholder:r="",autoClose:a=!0,align:s="top",justify:l="center",buttonConfirm:c,buttonCancel:d}=o;i(60,Rr={align:s,justify:l,text:n,placeholder:r,buttonConfirm:c,buttonCancel:d,onconfirm:()=>{e(Ir.value),a&&i(60,Rr=void 0)},oncancel:()=>{t(void 0),i(60,Rr=void 0)}})},Ar,Lr,Fr,Dr,qr,Kr,Jr,Qr,ea,ta,oa,na,ra,aa,ca,Ys,cc,pd,md,Sd,Id,Fd,ou,n,ft,Z,ct,lt,a,j,it,le,he,W,O,Qe,ie,Je,qe,Ye,je,Ne,He,Ve,Be,Le,ze,We,_e,Oe,De,Ge,Ue,Ae,Ie,Re,Y,te,pe,ue,se,re,ne,ae,fe,ve,xe,$e,me,oe,Q,ce,we,Se,U,V,H,z,I,F,A,E,R,C,P,g,k,v,w,l,p,s,u,r,yt,wt,It,At,Ft,zt,Wt,Nt,Ht,jt,Ut,Gt,Jt,eo,oo,io,ro,so,lo,co,uo,po,mo,$o,fo,yo,bo,vo,So,wo,ko,Po,Ro,Io,Ao,Lo,Fo,Oo,Bo,Vo,Xo,Yo,Jo,ti,oi,ii,li,di,ui,pi,$i,fi,yi,bi,xi,vi,function(){i(31,yc=Im.innerWidth),i(32,bc=Im.innerHeight)},e=>Er(Ws,ki=e.detail,ki),({detail:e})=>i(43,G=e),function(t,o){e.$$.not_equal(Or[o],t)&&(Or[o]=t,i(1,Or),i(283,Fr),i(27,zr))},e=>qc(e),e=>Kc(e),(e,{detail:t})=>Jc(e,t),e=>Er(Os,Mo=e.detail,Mo),function(t){e.$$.not_equal(Or[G],t)&&(Or[G]=t,i(1,Or),i(283,Fr),i(27,zr))},()=>qc(G),()=>Kc(G),({detail:e})=>Jc(G,e),e=>{const t={...e,...Dd()},{annotationShapes:o,decorationShapes:i,interfaceShapes:n,frameShapes:r,selectionShapes:a}=bn({annotationShapes:Dt,decorationShapes:Mt,interfaceShapes:zi,frameShapes:Tt,selectionShapes:ci},t);return Xd(t,ut,o,i,n,r,a)},()=>{i(63,qd=!1),i(64,Kd=!1),i(65,Jd=!1),i(66,Qd=!1),i(67,tu=!1)},function(e){Ca[e?"unshift":"push"](()=>{Ld=e,i(36,Ld)})},function(e){xr=e,i(0,xr),i(271,qn)},function(e){Vc=e,i(33,Vc)},function(e){_c=e,i(34,_c)},function(e){Ca[e?"unshift":"push"](()=>{Ir=e,i(61,Ir)})},function(e){Ca[e?"unshift":"push"](()=>{Br=e,i(2,Br)})},e=>Er(zs,Kt=e.detail,Kt)]}class ag extends rs{constructor(e){super(),ns(this,e,rg,tg,yr,{class:236,layout:237,stores:238,locale:3,id:4,util:239,utils:240,animations:241,disabled:242,previewUpscale:243,previewPad:244,previewMaskOpacity:5,previewImageDataMaxSize:245,previewImageTextPixelRatio:6,markupMaskOpacity:7,zoomMaskOpacity:246,elasticityMultiplier:8,willRevert:247,willProcessImage:248,willRenderCanvas:9,willRenderToolbar:249,willRenderUtilTabs:250,willSetHistoryInitialState:251,enableButtonExport:252,enableButtonRevert:253,enableNavigateHistory:254,enableToolbar:10,enableUtils:255,enableButtonClose:256,enableDropImage:257,enablePasteImage:258,enableBrowseImage:259,accept:260,enableTransparencyGrid:11,layoutDirectionPreference:261,layoutHorizontalUtilsPreference:262,layoutVerticalUtilsPreference:263,layoutVerticalToolbarPreference:264,layoutVerticalControlGroupsPreference:265,layoutVerticalControlTabsPreference:266,supportedMediaTypes:267,status:234,formatStatusImageLoading:268,formatStatusImageProcessing:269,formatStatusSupportError:270,textDirection:12,markupEditorZoomLevel:271,markupEditorZoomLevels:13,markupEditorZoomAdjustStep:14,markupEditorZoomAdjustFactor:15,markupEditorZoomAdjustWheelFactor:16,markupEditorInteractionMode:272,muteAudio:273,willSetMediaInitialTimeOffset:274,enablePan:17,enableZoom:18,enableZoomControls:275,enableZoomInput:19,enablePanInput:276,enableCanvasAlpha:20,enablePanLimit:21,panLimitGutterScalar:22,pan:277,zoomPresetOptions:23,zoomAdjustStep:24,zoomAdjustFactor:25,zoomAdjustWheelFactor:26,zoomLevel:0,fixScrollDirection:278,hideTextInput:279,showTextInput:280,imagePreviewSrc:281,imageOrienter:282,pluginComponents:283,pluginOptions:27,sub:284,pluginInterface:1,root:2,play:285,pause:286,isPaused:287,togglePlayPause:288,mute:289,unmute:290,toggleMute:291,getDuration:292,getCurrentTime:293,setCurrentTime:294,imageSourceToImageData:28,imagePreview:29,imagePreviewCurrent:235,history:30},null,[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}get class(){return this.$$.ctx[236]}set class(e){this.$$set({class:e}),Oa()}get layout(){return this.$$.ctx[237]}set layout(e){this.$$set({layout:e}),Oa()}get stores(){return this.$$.ctx[238]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[3]}set locale(e){this.$$set({locale:e}),Oa()}get id(){return this.$$.ctx[4]}set id(e){this.$$set({id:e}),Oa()}get util(){return this.$$.ctx[239]}set util(e){this.$$set({util:e}),Oa()}get utils(){return this.$$.ctx[240]}set utils(e){this.$$set({utils:e}),Oa()}get animations(){return this.$$.ctx[241]}set animations(e){this.$$set({animations:e}),Oa()}get disabled(){return this.$$.ctx[242]}set disabled(e){this.$$set({disabled:e}),Oa()}get previewUpscale(){return this.$$.ctx[243]}set previewUpscale(e){this.$$set({previewUpscale:e}),Oa()}get previewPad(){return this.$$.ctx[244]}set previewPad(e){this.$$set({previewPad:e}),Oa()}get previewMaskOpacity(){return this.$$.ctx[5]}set previewMaskOpacity(e){this.$$set({previewMaskOpacity:e}),Oa()}get previewImageDataMaxSize(){return this.$$.ctx[245]}set previewImageDataMaxSize(e){this.$$set({previewImageDataMaxSize:e}),Oa()}get previewImageTextPixelRatio(){return this.$$.ctx[6]}set previewImageTextPixelRatio(e){this.$$set({previewImageTextPixelRatio:e}),Oa()}get markupMaskOpacity(){return this.$$.ctx[7]}set markupMaskOpacity(e){this.$$set({markupMaskOpacity:e}),Oa()}get zoomMaskOpacity(){return this.$$.ctx[246]}set zoomMaskOpacity(e){this.$$set({zoomMaskOpacity:e}),Oa()}get elasticityMultiplier(){return this.$$.ctx[8]}set elasticityMultiplier(e){this.$$set({elasticityMultiplier:e}),Oa()}get willRevert(){return this.$$.ctx[247]}set willRevert(e){this.$$set({willRevert:e}),Oa()}get willProcessImage(){return this.$$.ctx[248]}set willProcessImage(e){this.$$set({willProcessImage:e}),Oa()}get willRenderCanvas(){return this.$$.ctx[9]}set willRenderCanvas(e){this.$$set({willRenderCanvas:e}),Oa()}get willRenderToolbar(){return this.$$.ctx[249]}set willRenderToolbar(e){this.$$set({willRenderToolbar:e}),Oa()}get willRenderUtilTabs(){return this.$$.ctx[250]}set willRenderUtilTabs(e){this.$$set({willRenderUtilTabs:e}),Oa()}get willSetHistoryInitialState(){return this.$$.ctx[251]}set willSetHistoryInitialState(e){this.$$set({willSetHistoryInitialState:e}),Oa()}get enableButtonExport(){return this.$$.ctx[252]}set enableButtonExport(e){this.$$set({enableButtonExport:e}),Oa()}get enableButtonRevert(){return this.$$.ctx[253]}set enableButtonRevert(e){this.$$set({enableButtonRevert:e}),Oa()}get enableNavigateHistory(){return this.$$.ctx[254]}set enableNavigateHistory(e){this.$$set({enableNavigateHistory:e}),Oa()}get enableToolbar(){return this.$$.ctx[10]}set enableToolbar(e){this.$$set({enableToolbar:e}),Oa()}get enableUtils(){return this.$$.ctx[255]}set enableUtils(e){this.$$set({enableUtils:e}),Oa()}get enableButtonClose(){return this.$$.ctx[256]}set enableButtonClose(e){this.$$set({enableButtonClose:e}),Oa()}get enableDropImage(){return this.$$.ctx[257]}set enableDropImage(e){this.$$set({enableDropImage:e}),Oa()}get enablePasteImage(){return this.$$.ctx[258]}set enablePasteImage(e){this.$$set({enablePasteImage:e}),Oa()}get enableBrowseImage(){return this.$$.ctx[259]}set enableBrowseImage(e){this.$$set({enableBrowseImage:e}),Oa()}get accept(){return this.$$.ctx[260]}set accept(e){this.$$set({accept:e}),Oa()}get enableTransparencyGrid(){return this.$$.ctx[11]}set enableTransparencyGrid(e){this.$$set({enableTransparencyGrid:e}),Oa()}get layoutDirectionPreference(){return this.$$.ctx[261]}set layoutDirectionPreference(e){this.$$set({layoutDirectionPreference:e}),Oa()}get layoutHorizontalUtilsPreference(){return this.$$.ctx[262]}set layoutHorizontalUtilsPreference(e){this.$$set({layoutHorizontalUtilsPreference:e}),Oa()}get layoutVerticalUtilsPreference(){return this.$$.ctx[263]}set layoutVerticalUtilsPreference(e){this.$$set({layoutVerticalUtilsPreference:e}),Oa()}get layoutVerticalToolbarPreference(){return this.$$.ctx[264]}set layoutVerticalToolbarPreference(e){this.$$set({layoutVerticalToolbarPreference:e}),Oa()}get layoutVerticalControlGroupsPreference(){return this.$$.ctx[265]}set layoutVerticalControlGroupsPreference(e){this.$$set({layoutVerticalControlGroupsPreference:e}),Oa()}get layoutVerticalControlTabsPreference(){return this.$$.ctx[266]}set layoutVerticalControlTabsPreference(e){this.$$set({layoutVerticalControlTabsPreference:e}),Oa()}get supportedMediaTypes(){return this.$$.ctx[267]}set supportedMediaTypes(e){this.$$set({supportedMediaTypes:e}),Oa()}get status(){return this.$$.ctx[234]}set status(e){this.$$set({status:e}),Oa()}get formatStatusImageLoading(){return this.$$.ctx[268]}set formatStatusImageLoading(e){this.$$set({formatStatusImageLoading:e}),Oa()}get formatStatusImageProcessing(){return this.$$.ctx[269]}set formatStatusImageProcessing(e){this.$$set({formatStatusImageProcessing:e}),Oa()}get formatStatusSupportError(){return this.$$.ctx[270]}set formatStatusSupportError(e){this.$$set({formatStatusSupportError:e}),Oa()}get textDirection(){return this.$$.ctx[12]}set textDirection(e){this.$$set({textDirection:e}),Oa()}get markupEditorZoomLevel(){return this.$$.ctx[271]}set markupEditorZoomLevel(e){this.$$set({markupEditorZoomLevel:e}),Oa()}get markupEditorZoomLevels(){return this.$$.ctx[13]}set markupEditorZoomLevels(e){this.$$set({markupEditorZoomLevels:e}),Oa()}get markupEditorZoomAdjustStep(){return this.$$.ctx[14]}set markupEditorZoomAdjustStep(e){this.$$set({markupEditorZoomAdjustStep:e}),Oa()}get markupEditorZoomAdjustFactor(){return this.$$.ctx[15]}set markupEditorZoomAdjustFactor(e){this.$$set({markupEditorZoomAdjustFactor:e}),Oa()}get markupEditorZoomAdjustWheelFactor(){return this.$$.ctx[16]}set markupEditorZoomAdjustWheelFactor(e){this.$$set({markupEditorZoomAdjustWheelFactor:e}),Oa()}get markupEditorInteractionMode(){return this.$$.ctx[272]}set markupEditorInteractionMode(e){this.$$set({markupEditorInteractionMode:e}),Oa()}get muteAudio(){return this.$$.ctx[273]}set muteAudio(e){this.$$set({muteAudio:e}),Oa()}get willSetMediaInitialTimeOffset(){return this.$$.ctx[274]}set willSetMediaInitialTimeOffset(e){this.$$set({willSetMediaInitialTimeOffset:e}),Oa()}get enablePan(){return this.$$.ctx[17]}set enablePan(e){this.$$set({enablePan:e}),Oa()}get enableZoom(){return this.$$.ctx[18]}set enableZoom(e){this.$$set({enableZoom:e}),Oa()}get enableZoomControls(){return this.$$.ctx[275]}set enableZoomControls(e){this.$$set({enableZoomControls:e}),Oa()}get enableZoomInput(){return this.$$.ctx[19]}set enableZoomInput(e){this.$$set({enableZoomInput:e}),Oa()}get enablePanInput(){return this.$$.ctx[276]}set enablePanInput(e){this.$$set({enablePanInput:e}),Oa()}get enableCanvasAlpha(){return this.$$.ctx[20]}set enableCanvasAlpha(e){this.$$set({enableCanvasAlpha:e}),Oa()}get enablePanLimit(){return this.$$.ctx[21]}set enablePanLimit(e){this.$$set({enablePanLimit:e}),Oa()}get panLimitGutterScalar(){return this.$$.ctx[22]}set panLimitGutterScalar(e){this.$$set({panLimitGutterScalar:e}),Oa()}get pan(){return this.$$.ctx[277]}set pan(e){this.$$set({pan:e}),Oa()}get zoomPresetOptions(){return this.$$.ctx[23]}set zoomPresetOptions(e){this.$$set({zoomPresetOptions:e}),Oa()}get zoomAdjustStep(){return this.$$.ctx[24]}set zoomAdjustStep(e){this.$$set({zoomAdjustStep:e}),Oa()}get zoomAdjustFactor(){return this.$$.ctx[25]}set zoomAdjustFactor(e){this.$$set({zoomAdjustFactor:e}),Oa()}get zoomAdjustWheelFactor(){return this.$$.ctx[26]}set zoomAdjustWheelFactor(e){this.$$set({zoomAdjustWheelFactor:e}),Oa()}get zoomLevel(){return this.$$.ctx[0]}set zoomLevel(e){this.$$set({zoomLevel:e}),Oa()}get fixScrollDirection(){return this.$$.ctx[278]}set fixScrollDirection(e){this.$$set({fixScrollDirection:e}),Oa()}get hideTextInput(){return this.$$.ctx[279]}get showTextInput(){return this.$$.ctx[280]}get imagePreviewSrc(){return this.$$.ctx[281]}set imagePreviewSrc(e){this.$$set({imagePreviewSrc:e}),Oa()}get imageOrienter(){return this.$$.ctx[282]}set imageOrienter(e){this.$$set({imageOrienter:e}),Oa()}get pluginComponents(){return this.$$.ctx[283]}set pluginComponents(e){this.$$set({pluginComponents:e}),Oa()}get pluginOptions(){return this.$$.ctx[27]}set pluginOptions(e){this.$$set({pluginOptions:e}),Oa()}get sub(){return this.$$.ctx[284]}get pluginInterface(){return this.$$.ctx[1]}get root(){return this.$$.ctx[2]}set root(e){this.$$set({root:e}),Oa()}get play(){return this.$$.ctx[285]}get pause(){return this.$$.ctx[286]}get isPaused(){return this.$$.ctx[287]}get togglePlayPause(){return this.$$.ctx[288]}get mute(){return this.$$.ctx[289]}get unmute(){return this.$$.ctx[290]}get toggleMute(){return this.$$.ctx[291]}get getDuration(){return this.$$.ctx[292]}get getCurrentTime(){return this.$$.ctx[293]}get setCurrentTime(){return this.$$.ctx[294]}get imageSourceToImageData(){return this.$$.ctx[28]}set imageSourceToImageData(e){this.$$set({imageSourceToImageData:e}),Oa()}get imagePreview(){return this.$$.ctx[29]}get imagePreviewCurrent(){return this.$$.ctx[235]}set imagePreviewCurrent(e){this.$$set({imagePreviewCurrent:e}),Oa()}get history(){return this.$$.ctx[30]}}"undefined"!=typeof window&&(e=>{if(e&&e._jn1s076)return;const[t,o,i]=[[99,111,110,115,111,108,101],[108,111,103],[84,104,105,115,32,118,101,114,115,105,111,110,32,111,102,32,80,105,110,116,117,114,97,32,105,115,32,102,111,114,32,116,101,115,116,105,110,103,32,112,117,114,112,111,115,101,115,32,111,110,108,121,46,32,86,105,115,105,116,32,104,116,116,112,115,58,47,47,112,113,105,110,97,46,110,108,47,112,105,110,116,117,114,97,47,32,116,111,32,112,117,114,99,104,97,115,101,32,97,32,108,105,99,101,110,115,101,46,32,86,105,115,105,116,32,104,116,116,112,115,58,47,47,112,113,105,110,97,46,110,108,47,112,105,110,116,117,114,97,47,99,104,97,116,47,32,105,102,32,121,111,117,32,104,97,118,101,32,97,110,121,32,113,117,101,115,116,105,111,110,115,46]].map(e=>e.map(e=>String.fromCharCode(e)).join(""));e&&e[t]&&e[t][o](i)})(window);const sg=["klass","stores","isVisible","isActive","isActiveFraction","locale"],lg=["history","klass","stores","navButtons","pluginComponents","pluginInterface","pluginOptions","sub","imagePreviewSrc","imagePreview","imagePreviewCurrent"],cg=["locale"];let dg;const ug=new Set([]),pg={},hg=new Map,mg=(...e)=>{e.filter(e=>!!e.util).forEach(e=>{const[t,o,i=()=>!0]=e.util;hg.has(t)||(hg.set(t,{Component:o,isSupported:i}),Id(o).filter(e=>!sg.includes(e)).forEach(e=>{ug.add(e),pg[e]?pg[e].push(t):pg[e]=[t]}))})};var gg=[...Ns,"init","update","undo","redo","revert","writehistory","destroy","show","hide","close","ready","zoom","pan","loadpreview","selectshape","blurshape","updateshape","addshape","removeshape","selectstyle","markuptap","markupzoom","markuppan","selectutil","selectcontrol","selectiondown","selectionup","selectionchange"];var $g=(e,t,o={})=>{const{prefix:i="pintura:"}=o;return gg.map(o=>e.on(o,e=>Yt(t)?((e,t,o)=>e.dispatchEvent(new CustomEvent(t,{detail:o,bubbles:!0,cancelable:!0})))(t,`${i}${o}`,e):t(o,e)))};const fg=e=>y(e[0]),yg=e=>!fg(e),bg=e=>e[1],xg=e=>e[3]||[];const vg=(e,t,o,i=e=>e)=>{const n=kg(t,o),r=n.findIndex(e=>bg(e)===t);var a,s,l;a=n,s=i(r),l=e,a.splice(s,0,l)},Sg=(e,t)=>{const o=kg(e,t);return Oh(o,t=>bg(t)===e),o},wg=(e,t)=>{if(t&&t.length){if(fg(t)){if(bg(t)===e)return t;const o=wg(e,xg(t));if(o)return o}if(yg(t))for(const o of t){const t=wg(e,o);if(t)return t}}},kg=(e,t)=>{if(yg(t)){if(t.find(t=>bg(t)===e))return t;const o=t.find(t=>kg(e,xg(t)));return o&&o[3]}return kg(e,xg(t))},Cg=()=>[.75,.25,.25,0,0,.25,.75,.25,0,0,.25,.25,.75,0,0,0,0,0,1,0],Tg=()=>[1.398,-.316,.065,-.273,.201,-.051,1.278,-.08,-.273,.201,-.051,.119,1.151,-.29,.215,0,0,0,1,0],Mg=()=>[1.073,-.015,.092,-.115,-.017,.107,.859,.184,-.115,-.017,.015,.077,1.104,-.115,-.017,0,0,0,1,0],Pg=()=>[1.06,0,0,0,0,0,1.01,0,0,0,0,0,.93,0,0,0,0,0,1,0],Rg=()=>[1.1,0,0,0,-.1,0,1.1,0,0,-.1,0,0,1.2,0,-.1,0,0,0,1,0],Ig=()=>[.212,.715,.114,0,0,.212,.715,.114,0,0,.212,.715,.114,0,0,0,0,0,1,0],Eg=()=>[.15,1.3,-.25,.1,-.2,.15,1.3,-.25,.1,-.2,.15,1.3,-.25,.1,-.2,0,0,0,1,0],Ag=()=>[.163,.518,.084,-.01,.208,.163,.529,.082,-.02,.21,.171,.529,.084,0,.214,0,0,0,1,0],Lg=()=>[.338,.991,.117,.093,-.196,.302,1.049,.096,.078,-.196,.286,1.016,.146,.101,-.196,0,0,0,1,0],Fg=()=>[.393,.768,.188,0,0,.349,.685,.167,0,0,.272,.533,.13,0,0,0,0,0,1,0],zg=()=>[.289,.62,.185,0,.077,.257,.566,.163,0,.115,.2,.43,.128,0,.188,0,0,0,1,0],Dg=()=>[.269,.764,.172,.05,.1,.239,.527,.152,0,.176,.186,.4,.119,0,.159,0,0,0,1,0],Og=()=>[.547,.764,.134,0,-.147,.281,.925,.12,0,-.135,.225,.558,.33,0,-.113,0,0,0,1,0],Bg={chrome:Tg,fade:Mg,pastel:Cg,cold:Rg,warm:Pg,monoDefault:Ig,monoWash:Ag,monoNoir:Eg,monoStark:Lg,sepiaDefault:Fg,sepiaRust:Dg,sepiaBlues:zg,sepiaColor:Og};var Wg={filterFunctions:Bg,filterOptions:[["Default",[[void 0,e=>e.labelDefault]]],["Classic",[["chrome",e=>e.filterLabelChrome],["fade",e=>e.filterLabelFade],["cold",e=>e.filterLabelCold],["warm",e=>e.filterLabelWarm],["pastel",e=>e.filterLabelPastel]]],["Monochrome",[["monoDefault",e=>e.filterLabelMonoDefault],["monoNoir",e=>e.filterLabelMonoNoir],["monoStark",e=>e.filterLabelMonoStark],["monoWash",e=>e.filterLabelMonoWash]]],["Sepia",[["sepiaDefault",e=>e.filterLabelSepiaDefault],["sepiaRust",e=>e.filterLabelSepiaRust],["sepiaBlues",e=>e.filterLabelSepiaBlues],["sepiaColor",e=>e.filterLabelSepiaColor]]]]};const _g={borderColor:"strokeColor",borderWidth:"strokeWidth",lineWidth:"strokeWidth",fontColor:"color",lineColor:"strokeColor",src:"backgroundImage",fit:"backgroundSize"},Vg=e=>0===e||"0%"===e||"0px"===e?0:/px$/.test(e)?parseInt(e,10):/\%$/.test(e)?e:e<=1?100*e+"%":void 0,Ng=(e,t)=>{let o,i;return/%$/.test(e)?(o=parseFloat(e),i=parseFloat(t),`${o+i}%`):/px$/.test(e)?(o=parseInt(e,10),i=parseInt(t,10),`${o+i}px`):void 0},Hg=(e,t)=>{const o=e,i=t,n=1.5707963267948966-t,r=Math.sin(1.5707963267948966),a=Math.sin(i),s=Math.sin(n),l=Math.cos(n),c=o/r;return be(l*(c*a),l*(c*s))},jg=(e,{flip:t,aspectRatio:o,rotation:i,center:n,zoom:r,scaleToFit:a})=>{const s={flipX:!1,flipY:!1},l=!n||n&&.5===n.x&&.5===n.y;t&&t.horizontal&&(s.flipX=t.horizontal),t&&t.vertical&&(s.flipY=t.vertical);const c=((e,t)=>null!=t?1/t:e.width/e.height)(e,o),d=!(!1===a),u=((e,t,o=1)=>{const i=e.height/e.width,n=t;let r=1,a=i;a>n&&(a=n,r=a/i);const s=Math.max(1/r,n/a),l=e.width/(o*s*r);return{width:l,height:l*t}})(e,o,r),p=l?e:((e,t)=>{const o=t.x>.5?1-t.x:t.x,i=t.y>.5?1-t.y:t.y;return Ze(2*o*e.width,2*i*e.height)})(e,d?n:{x:.5,y:.5}),h=((e,t)=>{let o=e.width,i=o*t;i>e.height&&(i=e.height,o=i/t);const n=.5*(e.width-o),r=.5*(e.height-i);return ht(n,r,o,i)})(e,o);if((o||!l||r)&&(s.crop=Pt(st(p),c)),"number"==typeof i&&null!==i&&0!==i){null!=i&&(s.rotation=i);const t=((e,t)=>{const o=e.width,i=e.height,n=Hg(o,t),r=Hg(i,t),a=be(e.x+Math.abs(n.x),e.y-Math.abs(n.y)),s=be(e.x+e.width+Math.abs(r.y),e.y+Math.abs(r.x)),l=be(e.x-Math.abs(r.y),e.y+e.height-Math.abs(r.x));return{width:De(a,s),height:De(a,l)}})(h,i),o=Math.max(t.width/p.width,t.height/p.height),r=be(n.x*e.width,n.y*e.height),a=Xt(e,i),l=qe(a),c=be(.5*(a.width-e.width),.5*(a.height-e.height)),d=kt({x:c.x+r.x-u.width/o*.5,y:c.y+r.y-u.height/o*.5,width:u.width/o,height:u.height/o},i),m=_e(d.map(ve),i,l.x,l.y),g=mt(dt(m)),$=_e(m.map(ve),-2*i,g.x,g.y);s.crop=dt($)}else null!=r&&$t(s.crop,1/r);return d||(s.cropLimitToImage=!1),s};let Ug=null;const Gg={base:0,min:-.25,max:.25,getLabel:e=>Cm(e/.25),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.brightness)return e.brightness[4]},setValue:(e,t)=>e.update(e=>({...e,brightness:[1,0,0,0,t,0,1,0,0,t,0,0,1,0,t,0,0,0,1,0]}))},Zg={base:1,min:.5,max:1.5,getLabel:e=>Cm(2*(e-.5)-1),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.contrast)return e.contrast[0]},setValue:(e,t)=>e.update(e=>({...e,contrast:[t,0,0,0,.5*(1-t),0,t,0,0,.5*(1-t),0,0,t,0,.5*(1-t),0,0,0,1,0]}))},Xg={base:1,min:0,max:2,getLabel:e=>Cm(e-1),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.saturation)return(e.saturation[0]-.213)/.787},setValue:(e,t)=>e.update(e=>({...e,saturation:[.213+.787*t,.715-.715*t,.072-.072*t,0,0,.213-.213*t,.715+.285*t,.072-.072*t,0,0,.213-.213*t,.715-.715*t,.072+.928*t,0,0,0,0,0,1,0]}))},Yg={base:1,min:.5,max:1.5,getLabel:e=>Cm(2*(e-.5)-1),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.exposure)return e.exposure[0]},setValue:(e,t)=>e.update(e=>({...e,exposure:[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0]}))},qg={base:1,min:.15,max:4,getLabel:e=>Cm(e<1?(e-.15)/.85-1:(e-1)/3),getStore:({imageGamma:e})=>e},Kg={base:0,min:-1,max:1,getStore:({imageVignette:e})=>e},Jg={base:0,min:-1,max:1,getStore:({imageConvolutionMatrix:e})=>e,getValue:e=>{if(e.clarity)return 0===e.clarity[0]?e.clarity[1]/-1:e.clarity[1]/-2},setValue:(e,t)=>{e.update(e=>({...e,clarity:t>=0?[0,-1*t,0,-1*t,1+4*t,-1*t,0,-1*t,0]:[-1*t,-2*t,-1*t,-2*t,1+-3*t,-2*t,-1*t,-2*t,-1*t]}))}},Qg={base:0,min:-1,max:1,getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(!e.temperature)return;const t=e.temperature[0];return t>=1?(t-1)/.1:(1-t)/-.15},setValue:(e,t)=>e.update(e=>({...e,temperature:t>0?[1+.1*t,0,0,0,0,0,1,0,0,0,0,0,1+.1*-t,0,0,0,0,0,1,0]:[1+.15*t,0,0,0,0,0,1+.05*t,0,0,0,0,0,1+.15*-t,0,0,0,0,0,1,0]}))};var e$={finetuneControlConfiguration:{gamma:qg,brightness:Gg,contrast:Zg,saturation:Xg,exposure:Yg,temperature:Qg,clarity:Jg,vignette:Kg},finetuneOptions:[["brightness",e=>e.finetuneLabelBrightness],["contrast",e=>e.finetuneLabelContrast],["saturation",e=>e.finetuneLabelSaturation],["exposure",e=>e.finetuneLabelExposure],["temperature",e=>e.finetuneLabelTemperature],["gamma",e=>e.finetuneLabelGamma],!od()&&["clarity",e=>e.finetuneLabelClarity],["vignette",e=>e.finetuneLabelVignette]].filter(Boolean)};const t$=(e,t="thumb")=>["div",t,{style:e,textContent:" "}],o$={shape:{frameColor:[1,1,1],frameStyle:"solid",frameSize:"2.5%"},thumb:'<rect stroke-width="5" x="0" y="0" width="100%" height="100%"/>'},i$={shape:{frameColor:[1,1,1],frameStyle:"solid",frameSize:"2.5%",frameRound:!0},thumb:'<rect stroke-width="5" x="0" y="0" width="100%" height="100%" rx="12%"/>'},n$={shape:{frameColor:[1,1,1],frameStyle:"line",frameInset:"2.5%",frameSize:".3125%",frameRadius:0},thumb:[t$("top:.5em;left:.5em;right:.5em;bottom:.5em;box-shadow:inset 0 0 0 1px currentColor")]},r$={shape:{frameColor:[1,1,1],frameStyle:"line",frameAmount:2,frameInset:"2.5%",frameSize:".3125%",frameOffset:"1.25%",frameRadius:0},thumb:[t$("top:.75em;left:.75em;right:.75em;bottom:.75em; outline: 3px double")]},a$={shape:{frameColor:[1,1,1],frameStyle:"edge",frameInset:"2.5%",frameOffset:"5%",frameSize:".3125%"},thumb:[t$("top:.75em;left:.5em;bottom:.75em;border-left:1px solid","a"),t$("top:.75em;right:.5em;bottom:.75em;border-right:1px solid","b"),t$("top:.5em;left:.75em;right:.75em;border-top:1px solid","c"),t$("bottom:.5em;left:.75em;right:.75em;border-bottom:1px solid","d")]},s$={shape:{frameColor:[1,1,1],frameStyle:"edge",frameInset:"2.5%",frameSize:".3125%"},thumb:[t$("top:-.5em;left:.5em;right:.5em;bottom:-.5em; box-shadow: inset 0 0 0 1px currentColor","a"),t$("top:.5em;left:-.5em;right:-.5em;bottom:.5em;box-shadow:inset 0 0 0 1px currentColor","b")]},l$={shape:{frameColor:[1,1,1],frameStyle:"edge",frameOffset:"1.5%",frameSize:".3125%"},thumb:[t$("top:.3125em;left:.5em;bottom:.3125em;border-left:1px solid","a"),t$("top:.3125em;right:.5em;bottom:.3125em;border-right:1px solid","b"),t$("top:.5em;left:.3125em;right:.3125em;border-top:1px solid","c"),t$("bottom:.5em;left:.3125em;right:.3125em;border-bottom:1px solid","d")]},c$={shape:{frameColor:[1,1,1],frameStyle:"hook",frameInset:"2.5%",frameSize:".3125%",frameLength:"5%"},thumb:[t$("top:.5em;left:.5em;width:.75em;height:.75em; border-left: 1px solid;border-top: 1px solid","a"),t$("top:.5em;right:.5em;width:.75em;height:.75em; border-right: 1px solid;border-top: 1px solid","b"),t$("bottom:.5em;left:.5em;width:.75em;height:.75em; border-left: 1px solid;border-bottom: 1px solid","c"),t$("bottom:.5em;right:.5em;width:.75em;height:.75em; border-right: 1px solid;border-bottom: 1px solid","d")]},d$={shape:{frameColor:[1,1,1],frameStyle:"polaroid"},thumb:'<rect stroke-width="20%" x="-5%" y="-5%" width="110%" height="96%"/>'};var u$={frameStyles:{solidSharp:o$,solidRound:i$,lineSingle:n$,lineMultiple:r$,edgeSeparate:a$,edgeCross:s$,edgeOverlap:l$,hook:c$,polaroid:d$},frameOptions:[[void 0,e=>e.labelNone],["solidSharp",e=>e.frameLabelMatSharp],["solidRound",e=>e.frameLabelMatRound],["lineSingle",e=>e.frameLabelLineSingle],["lineMultiple",e=>e.frameLabelLineMultiple],["edgeCross",e=>e.frameLabelEdgeCross],["edgeSeparate",e=>e.frameLabelEdgeSeparate],["edgeOverlap",e=>e.frameLabelEdgeOverlap],["hook",e=>e.frameLabelCornerHooks],["polaroid",e=>e.frameLabelPolaroid]]},p$=e=>e.charAt(0).toUpperCase()+e.slice(1);let h$=null;var m$=()=>{if(null===h$)if(m())try{h$=!1===document.fonts.check("16px TestNonExistingFont")}catch(e){h$=!1}else h$=!1;return h$};const g$=(e,t)=>o=>o[t?`${t}${p$(e)}`:e],$$=e=>[e,`${e}`],f$=(e,t)=>o=>[e[o],g$(o,t)],y$=e=>Array.isArray(e)&&e.every(No)?e.map($$):e,b$=[1,.2549,.2118],x$="0.5%",v$=[1,1,1,0],S$={brush:["path",{bitmap:!0,drawMode:"add",strokeWidth:"5%",cursorStyle:"ellipse",cursorSize:"strokeWidth",disableStyle:["strokeColor"],settings:{strokeWidth:{control:"brushSize"}}}],lassoo:["path",{drawMode:"add",disableStyle:["strokeWidth","strokeColor"],strokeWidth:".25%",pathClose:!0}],polygon:["path",{drawMode:"add",disableStyle:["strokeWidth","strokeColor"],strokeWidth:".25%",pathClose:!0},{inputMode:"step"}],rectangle:["rectangle",{disableStyle:["backgroundColor","strokeWidth","strokeColor","cornerRadius"],drawMode:"add"}],ellipse:["ellipse",{disableStyle:["backgroundColor","strokeWidth","strokeColor"],drawMode:"add"}]},w$=["brush","lassoo","polygon","rectangle","ellipse"],k$=e=>{const{hideLabel:t=!0}=e||{};return sf(["new","add","subtract"].map(e=>[e,g$(e,"shapeLabelSelectionMode"),{icon:g$(e,"shapeIconSelectionMode"),hideLabel:t}]),{title:e=>e.shapeTitleSelectionMode,layout:"radio"})},C$=e=>af(e,{title:e=>e.shapeTitleBrushSize,layout:"radio",optionHideLabel:!0,optionIcon:(e,t)=>`<circle fill="currentColor" stroke-width=".05em" stroke="currentColor" fill-opacity=".25" cx="12" cy="12" r="${2+8*t}"/>`}),T$={eraser:()=>({eraseRadius:8,cursorStyle:"ellipse",cursorSize:"eraseRadius"}),path:()=>({points:[],disableAddPoints:!1}),line:()=>({x1:0,y1:0,x2:0,y2:0,disableErase:!1}),rectangle:()=>({x:0,y:0,width:0,height:0}),ellipse:()=>({x:0,y:0,rx:0,ry:0}),text:()=>({x:0,y:0,text:"Text",disableTextScale:!0})},M$=(e,t={},o)=>{if(!T$[e])return;const{position:i="relative",inputMode:n="drag",isSelection:r=!1,interpolateInput:a=!1}=o||{};return[{...T$[e](),...t},{position:i,inputMode:n,isSelection:r,interpolateInput:a}]},P$=e=>{const t={sharpie:M$("path",{bitmap:!0,strokeJoin:"round",strokeCap:"round",strokeWidth:x$,strokeColor:[...b$],cursorStyle:"ellipse",cursorSize:"strokeWidth",disableErase:!1,disableResize:!0,disableMove:!0},{interpolateInput:!0}),eraser:M$("eraser"),path:M$("path",{pathClose:void 0,strokeWidth:x$,strokeColor:[...b$],backgroundColor:[0,0,0,0]},{inputMode:"step"}),line:M$("line",{strokeColor:[...b$],strokeWidth:x$}),arrow:M$("line",{lineStart:"none",lineEnd:"arrow-solid",strokeColor:[...b$],strokeWidth:x$}),rectangle:M$("rectangle",{strokeColor:[...v$],backgroundColor:[...b$]}),ellipse:M$("ellipse",{strokeColor:[...v$],backgroundColor:[...b$]}),text:M$("text",{color:[...b$],fontSize:"2%"})};return e&&Object.entries(e).forEach(([e,o])=>{Array.isArray(o)?t[e]=o:I(o)&&t[e]&&(t[e]=[{...t[e][0],...o},t[e][1]])}),t},R$=(e,t,o)=>[e,t||g$(e,"shapeLabelTool"),{icon:g$(e,"shapeIconTool"),...o}],I$=(e=["move","view","sharpie","eraser","path","line","arrow","rectangle","ellipse","text","preset"])=>e.map(e=>y(e)?R$(e):Array.isArray(e)?I(e[1])?R$(e[0],void 0,e[1]):R$(e[0],e[1],e[2]):void 0).filter(Boolean),E$=()=>({transparent:[1,1,1,0],white:[1,1,1],silver:[.8667,.8667,.8667],gray:[.6667,.6667,.6667],black:[0,0,0],navy:[0,.1216,.2471],blue:[0,.4549,.851],aqua:[.498,.8588,1],teal:[.2235,.8,.8],olive:[.2392,.6,.4392],green:[.1804,.8,.251],yellow:[1,.8627,0],orange:[1,.5216,.1059],red:[1,.2549,.2118],maroon:[.5216,.0784,.2941],fuchsia:[.9412,.0706,.7451],purple:[.6941,.051,.7882]}),A$=()=>[16,18,20,24,30,36,48,64,72,96,128,144],L$=A$,F$=()=>({extraSmall:"2%",small:"4%",mediumSmall:"8%",medium:"10%",mediumLarge:"15%",large:"20%",extraLarge:"25%"}),z$=()=>({extraSmall:"40%",small:"60%",mediumSmall:"100%",medium:"120%",mediumLarge:"140%",large:"180%",extraLarge:"220%"}),D$=()=>({extraSmall:"0.25%",small:"0.5%",mediumSmall:"1%",medium:"1.75%",mediumLarge:"2.5%",large:"3.5%",extraLarge:"5%"}),O$=()=>["bar","arrow","arrowSolid","circle","circleSolid","square","squareSolid"],B$=()=>[["Helvetica, Arial, Verdana, 'Droid Sans', sans-serif","Sans Serif"],["'Arial Black', 'Avenir-Black', 'Arial Bold'","Black"],["'Arial Narrow', 'Futura-CondensedMedium'","Narrow"],["'Trebuchet MS'","Humanist"],["Georgia, 'Avenir-Black', 'Times New Roman', 'Droid Serif', serif","Serif"],["Palatino","Old-Style"],["'Times New Roman', 'TimesNewRomanPSMT'","Transitional"],["Menlo, Monaco, 'Lucida Console', monospace","Monospaced"],["'Courier New', monospace","Slab Serif"]],W$=()=>["left","center","right"],_$=()=>[["normal","bold"],["italic","normal"],["italic","bold"]],V$=e=>Object.keys(e).map(f$(e,"shapeTitleColor")),N$=e=>Object.keys(e).map(f$(e,"labelSize")),H$=e=>Object.keys(e).map(f$(e,"labelSize")),j$=e=>Object.keys(e).map(f$(e,"labelSize")),U$=e=>[...e],G$=e=>e.map(e=>[e,t=>t[`shapeLabelFontStyle${e.filter(e=>"normal"!==e).map(p$).join("")}`]]),Z$=e=>e.map(e=>[um(e),t=>t[`shapeTitleLineDecoration${p$(e)}`],{icon:t=>t[`shapeIconLineDecoration${p$(e)}`]}]),X$=(e,t)=>{const{defaultKey:o,defaultValue:i,defaultOptions:n}=t||{},r=[];return o&&(r[0]=[i,e=>e[o],{...n}]),[...r,...e]},Y$=e=>e.split(",").map(e=>e.trim()).some(e=>document.fonts.check(`16px ${e}`)),q$=(e={})=>["ToggleSlider",{...e}],K$="PinturaFontTest",J$=(e,t={defaultKey:"labelDefault"})=>["Dropdown",{title:e=>e.shapeTitleFontFamily,onload:({options:e=[]})=>{m$()&&e.map(([e])=>e).filter(Boolean).filter(e=>!Y$(e)).forEach(e=>{const t=`${K$}-${e.replace(/[^a-zA-Z0-9]+/g,"").toLowerCase()}`;document.getElementById(t)||document.body.append(x("span",{textContent:" ",id:t,class:K$,style:`font-family:${e};font-size:0;color:transparent;`}))})},ondestroy:()=>{if(!m$())return;document.querySelectorAll(".PinturaFontTest").forEach(e=>e.remove())},optionLabelStyle:e=>`font-family: ${e}`,options:X$(e,t),optionFilter:e=>{if(!m$())return!0;const[t]=e;if(!t)return!0;return Y$(t)}}],Q$=(e,t={})=>["ColorPicker",{options:X$(e),...t}],ef=(e,t={})=>Q$(e,{title:e=>e.labelColor,...t}),tf=e=>(t,o={})=>Q$(t,{title:t=>t[e],...o}),of=tf("shapeTitleBackgroundColor"),nf=tf("shapeTitleTextColor"),rf=(e,t={})=>Q$(e,{title:e=>e.shapeTitleStrokeColor,options:X$(e),buttonClass:"PinturaColorPickerButtonStroke",onchange:(e,o)=>{const i=o.strokeWidth;(No(i)||y(i)?parseFloat(i):0)>0||(o.strokeWidth=t&&t.defaultStrokeWidth||"0.5%")},...t}),af=(e,t)=>{const{title:o,optionHideLabel:i=!1,layout:n,optionIcon:r=!1}=t||{},a=y$(e),s=e.map(([e])=>y(e)?parseFloat(e):e),l=Math.max(...s),c=Math.min(...s),d=l-c;return["radio"===n?"RadioGroup":"Dropdown",{title:!1===o?void 0:o||(e=>e.shapeTitleStrokeWidth),options:e=>{const o=t?a.map(e=>{const[t,o,n={}]=e,a=y(t)?parseFloat(t):t,s=(a-c)/d;let l;return"line"===r?l=`<path stroke="currentColor" stroke-linecap="square" stroke-width="${.1+.875*s}em" d="M3,12 H20"/>`:"dot"===r?l=`<circle fill="currentColor" cx="12" cy="12" r="${2+8*s}"/>`:y(r)?l=r:L(r)&&(l=r(a,s)),[t,o,{icon:l,hideLabel:i,...n}]}):a;return jo(e,"backgroundColor")?X$(o,{defaultKey:"shapeLabelStrokeNone"}):X$(o)},onchange:(e,t)=>{if(!e)return;const o=t.strokeColor||[];if(o[3])return;const i=[...o];i[3]=1,t.strokeColor=i}}]},sf=(e,t)=>{const{title:o,layout:i}=t||{};return["radio"===i?"RadioGroup":"Dropdown",{title:o,options:X$(e)}]},lf=(e,t,o)=>["Dropdown",{title:e=>e[t],options:X$(e,{defaultKey:"labelNone",defaultOptions:{icon:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H14"/></g>'}}),optionIconStyle:o}],cf=e=>lf(e,"shapeTitleLineStart","transform: scaleX(-1)"),df=e=>lf(e,"shapeTitleLineEnd"),uf=e=>["Dropdown",{title:e=>e.shapeTitleFontStyle,optionLabelStyle:e=>e&&`font-style:${e[0]};font-weight:${e[1]}`,options:X$(e,{defaultKey:"shapeLabelFontStyleNormal"})}],pf=e=>["ShorthandControl",e];function hf(e){const t=function(e){let t=1,o=0;for(;Math.round(e*t)/t!==e&&(t*=10,o++,!(o>10)););return o}(y(e)?parseFloat(e):e);return t<4}const mf=(e,t,o,i)=>{i||e.find(([e])=>e===o)||(i={defaultKey:"labelAuto",defaultValue:o});const n=y$(e),r=n.some(([e])=>y(e)&&e.endsWith("%"));return["Dropdown",{title:t,options:X$(n,i),formatValue:e=>hf(e)?r?`${parseFloat(e)}%`:e:No(e)&&!r?Math.floor(e):`${Math.floor(parseFloat(e))}%`,...i}]},gf=(e,t)=>mf(e,e=>e.shapeTitleFontSize,"4%",t),$f=(e,t)=>mf(e,e=>e.shapeTitleLineHeight,"120%",t),ff=e=>["RadioGroup",{title:e=>e.shapeTitleTextAlign,options:X$(e)}],yf={colorOptions:()=>V$({transparent:[1,1,1,0],white:[1,1,1],silver:[.8667,.8667,.8667],gray:[.6667,.6667,.6667],black:[0,0,0],navy:[0,.1216,.2471],blue:[0,.4549,.851],aqua:[.498,.8588,1],teal:[.2235,.8,.8],olive:[.2392,.6,.4392],green:[.1804,.8,.251],yellow:[1,.8627,0],orange:[1,.5216,.1059],red:[1,.2549,.2118],maroon:[.5216,.0784,.2941],fuchsia:[.9412,.0706,.7451],purple:[.6941,.051,.7882]}),lineEndStyleOptions:()=>Z$(["bar","arrow","arrowSolid","circle","circleSolid","square","squareSolid"]),fontFamilyOptions:()=>U$([["Helvetica, Arial, Verdana, 'Droid Sans', sans-serif","Sans Serif"],["'Arial Black', 'Avenir-Black', 'Arial Bold'","Black"],["'Arial Narrow', 'Futura-CondensedMedium'","Narrow"],["'Trebuchet MS'","Humanist"],["Georgia, 'Avenir-Black', 'Times New Roman', 'Droid Serif', serif","Serif"],["Palatino","Old-Style"],["'Times New Roman', 'TimesNewRomanPSMT'","Transitional"],["Menlo, Monaco, 'Lucida Console', monospace","Monospaced"],["'Courier New', monospace","Slab Serif"]]),fontStyleOptions:()=>G$([["normal","bold"],["italic","normal"],["italic","bold"]]),textAlignOptions:()=>["left","center","right"].map(e=>[e,t=>t[`shapeTitleTextAlign${p$(e)}`],{hideLabel:!0,icon:t=>t[`shapeIconTextAlign${p$(e)}`]}]),strokeWidthOptions:()=>j$({extraSmall:"0.25%",small:"0.5%",mediumSmall:"1%",medium:"1.75%",mediumLarge:"2.5%",large:"3.5%",extraLarge:"5%"}),brushSizeOptions:()=>j$(Object.entries({extraSmall:"0.25%",small:"0.5%",mediumSmall:"1%",medium:"1.75%",mediumLarge:"2.5%",large:"3.5%",extraLarge:"5%"}).reduce((e,[t,o])=>(e[t]=2*parseFloat(o)+"%",e),{})),fontSizeOptions:()=>N$({extraSmall:"2%",small:"4%",mediumSmall:"8%",medium:"10%",mediumLarge:"15%",large:"20%",extraLarge:"25%"}),lineHeightOptions:()=>H$({extraSmall:"40%",small:"60%",mediumSmall:"100%",medium:"120%",mediumLarge:"140%",large:"180%",extraLarge:"220%"})},bf=new Intl.NumberFormat("default",{minimumFractionDigits:1,maximumFractionDigits:1}),xf=(e,t)=>y(t)?`${e}%`:e,vf=(e,t,o,i)=>y(i)?`${Math.round(e/o*100)}%`:`${bf.format(e)}`,Sf={getValue:e=>parseFloat(e),setValue:xf,label:vf,step:.05,labelClass:"PinturaPercentageLabel"},wf={factory:pf,options:{title:"Text shadow",controls:[["ToggleSlider","x",{...Sf,min:-100,max:100,labelPrefix:"X"}],["ToggleSlider","y",{...Sf,min:-100,max:100,labelPrefix:"Y"}],["ToggleSlider","blur",{...Sf,min:0,max:25,labelPrefix:e=>e.shapeTitleTextShadowBlur}],["ColorPicker","color",{enablePresets:!1}]]}},kf={defaultColor:{factory:ef,items:"colorOptions"},defaultNumber:{factory:q$},defaultPercentage:{factory:q$,options:{getValue:e=>parseFloat(e),setValue:e=>`${e}%`,step:.05,label:(e,t,o)=>`${Math.round(e/o*100)}%`,labelClass:"PinturaPercentageLabel"}},backgroundColor:{items:"colorOptions",factory:of},strokeColor:{items:"colorOptions",factory:rf},strokeWidth:{items:"strokeWidthOptions",factory:af},brushSize:{items:"brushSizeOptions",factory:C$},drawMode:{factory:k$},lineStart:{items:"lineEndStyleOptions",factory:cf},lineEnd:{items:"lineEndStyleOptions",factory:df},color:{items:"colorOptions",factory:nf},fontFamily:{items:"fontFamilyOptions",factory:J$},fontStyle_fontWeight:{items:"fontStyleOptions",factory:uf},fontSize:{items:"fontSizeOptions",factory:gf},lineHeight:{items:"lineHeightOptions",factory:$f},textAlign:{items:"textAlignOptions",factory:ff},textShadowX_textShadowY_textShadowBlur_textShadowColor:wf,textOutlineWidth_textOutlineColor:{factory:pf,options:{title:"Text outline",controls:[["ToggleSlider","width",{getValue:e=>parseFloat(e),setValue:xf,label:vf,min:0,max:15,step:.05,labelClass:"PinturaPercentageLabel",labelPrefix:e=>e.shapeTitleTextOutlineWidth}],["ColorPicker","color",{enablePresets:!1}]]}},cornerRadius:{factory:"defaultPercentage",options:{min:0,max:50,title:e=>e.shapeTitleCornerRadius}},frameColor:{factory:"defaultColor"},frameSize:{factory:"defaultPercentage",options:{min:.2,max:10,title:e=>e.labelSize}},frameInset:{factory:"defaultPercentage",options:{min:.5,max:10,title:e=>e.labelOffset}},frameOffset:{factory:"defaultPercentage",options:{min:.5,max:10,title:e=>e.labelOffset}},frameRadius:{factory:"defaultPercentage",options:{min:.5,max:10,title:e=>e.labelRadius}},frameAmount:{factory:"defaultNumber",options:{min:1,max:5,step:1,title:e=>e.labelAmount}}},Cf=(e={})=>{const t={...kf,...e},o={};return Object.entries(t).forEach(([e,i])=>{if(!/Options$/.test(e))if(kf[e]&&I(i)&&!Uo(i)){const{component:i,factory:n,items:r,options:a={}}=t[e];if(y(n))o[e]=[n,a];else{const s=kf[e].items;let l=y(s)?t[s]||yf[s]():void 0;y(r)&&yf[r]?l=t[r]?t[r].every(e=>!Array.isArray(e))?t[r].map(e=>[e,e]):t[r]:yf[r]():(r||a.items)&&(l=r||a.items);let c=n||kf[e].factory;L(c)?o[e]=l?c(l,a):c(a):i&&(o[e]=[i,{...a,items:r}])}}else o[e]=i}),o};function Tf(e){let t,o,i,n,r;const a=e[7].default,s=kr(a,e,e[6],null);return{c(){t=Ur("div"),o=Ur("div"),s&&s.c(),Qr(o,"class","PinturaToolbarInner"),Qr(t,"class","PinturaToolbar"),Qr(t,"data-layout",e[1]),Qr(t,"data-overflow",e[0])},m(a,l){Hr(a,t,l),_r(t,o),s&&s.m(o,null),i=!0,n||(r=[qr(o,"measure",e[3]),Ar(qc.call(null,o)),qr(t,"measure",e[2]),Ar(qc.call(null,t))],n=!0)},p(e,[o]){s&&s.p&&(!i||64&o)&&Mr(s,a,e,e[6],i?Tr(a,e[6],o,null):Pr(e[6]),null),(!i||2&o)&&Qr(t,"data-layout",e[1]),(!i||1&o)&&Qr(t,"data-overflow",e[0])},i(e){i||(ja(s,e),i=!0)},o(e){Ua(s,e),i=!1},d(e){e&&jr(t),s&&s.d(e),n=!1,$r(r)}}}function Mf(e,t,o){let i,n,{$$slots:r={},$$scope:a}=t,s=0,l=0,c=0;const d=()=>{o(0,n="compact"===i&&s>c?"overflow":void 0)};return e.$$set=e=>{"$$scope"in e&&o(6,a=e.$$scope)},e.$$.update=()=>{48&e.$$.dirty&&o(1,i=l>c?"compact":"default")},[n,i,({detail:e})=>{const{width:t}=e;o(5,c=t),d()},({detail:e})=>{const{width:t}=e;t>l&&o(4,l=t),s=t,n||d()},l,c,a,r]}class Pf extends rs{constructor(e){super(),ns(this,e,Mf,Tf,yr,{})}}function Rf(e){let t,o,i,n;const r=e[5].default,a=kr(r,e,e[4],null);return{c(){t=Ur("div"),a&&a.c(),Qr(t,"class",e[0])},m(r,s){Hr(r,t,s),a&&a.m(t,null),o=!0,i||(n=[qr(t,"measure",function(){fr(e[1]&&e[3])&&(e[1]&&e[3]).apply(this,arguments)}),Ar(e[2].call(null,t))],i=!0)},p(i,[n]){e=i,a&&a.p&&(!o||16&n)&&Mr(a,r,e,e[4],o?Tr(r,e[4],n,null):Pr(e[4]),null),(!o||1&n)&&Qr(t,"class",e[0])},i(e){o||(ja(a,e),o=!0)},o(e){Ua(a,e),o=!1},d(e){e&&jr(t),a&&a.d(e),i=!1,$r(n)}}}function If(e,t,o){let{$$slots:i={},$$scope:n}=t;const r=xa();let{class:a=null}=t;const s=Sa("measurable");let l=!1;return fa(()=>o(1,l=!0)),e.$$set=e=>{"class"in e&&o(0,a=e.class),"$$scope"in e&&o(4,n=e.$$scope)},[a,l,s,({detail:e})=>r("measure",e),n,i]}class Ef extends rs{constructor(e){super(),ns(this,e,If,Rf,yr,{class:0})}}const Af=e=>({}),Lf=e=>({}),Ff=e=>({}),zf=e=>({}),Df=e=>({}),Of=e=>({});function Bf(e){let t,o;const i=e[4].header,n=kr(i,e,e[3],Of);return{c(){t=Ur("div"),n&&n.c(),Qr(t,"class","PinturaUtilHeader")},m(e,i){Hr(e,t,i),n&&n.m(t,null),o=!0},p(e,t){n&&n.p&&(!o||8&t)&&Mr(n,i,e,e[3],o?Tr(i,e[3],t,Df):Pr(e[3]),Of)},i(e){o||(ja(n,e),o=!0)},o(e){Ua(n,e),o=!1},d(e){e&&jr(t),n&&n.d(e)}}}function Wf(e){let t,o;const i=e[4].footer,n=kr(i,e,e[3],Lf);return{c(){t=Ur("div"),n&&n.c(),Qr(t,"class","PinturaUtilFooter")},m(e,i){Hr(e,t,i),n&&n.m(t,null),o=!0},p(e,t){n&&n.p&&(!o||8&t)&&Mr(n,i,e,e[3],o?Tr(i,e[3],t,Af):Pr(e[3]),Lf)},i(e){o||(ja(n,e),o=!0)},o(e){Ua(n,e),o=!1},d(e){e&&jr(t),n&&n.d(e)}}}function _f(e){let t,o,i,n,r,a,s=e[1]&&Bf(e);const l=e[4].main,c=kr(l,e,e[3],zf),d=c||function(e){let t,o;return t=new Ef({props:{class:"PinturaStage"}}),t.$on("measure",e[5]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p:ur,i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}(e);let u=e[2]&&Wf(e),p=!1;return{c(){s&&s.c(),t=Xr(),o=Ur("div"),d&&d.c(),i=Xr(),u&&u.c(),n=Xr(),r=Yr(),Qr(o,"class","PinturaUtilMain")},m(l,c){s&&s.m(l,c),Hr(l,t,c),Hr(l,o,c),d&&d.m(o,null),e[6](o),Hr(l,i,c),u&&u.m(l,c),Hr(l,n,c),Hr(l,r,c),a=!0},p(e,[o]){e[1]?s?(s.p(e,o),2&o&&ja(s,1)):(s=Bf(e),s.c(),ja(s,1),s.m(t.parentNode,t)):s&&(Na(),Ua(s,1,1,()=>{s=null}),Ha()),c&&c.p&&(!a||8&o)&&Mr(c,l,e,e[3],a?Tr(l,e[3],o,Ff):Pr(e[3]),zf),e[2]?u?(u.p(e,o),4&o&&ja(u,1)):(u=Wf(e),u.c(),ja(u,1),u.m(n.parentNode,n)):u&&(Na(),Ua(u,1,1,()=>{u=null}),Ha())},i(e){a||(ja(s),ja(d,e),ja(u),ja(p),a=!0)},o(e){Ua(s),Ua(d,e),Ua(u),Ua(p),a=!1},d(a){a&&(jr(t),jr(o),jr(i),jr(n),jr(r)),s&&s.d(a),d&&d.d(a),e[6](null),u&&u.d(a)}}}function Vf(e,t,o){let{$$slots:i={},$$scope:n}=t,{hasHeader:r=!!t.$$slots.header}=t,{hasFooter:a=!!t.$$slots.footer}=t,{root:s}=t;return e.$$set=e=>{o(7,t=hr(hr({},t),Rr(e))),"hasHeader"in e&&o(1,r=e.hasHeader),"hasFooter"in e&&o(2,a=e.hasFooter),"root"in e&&o(0,s=e.root),"$$scope"in e&&o(3,n=e.$$scope)},t=Rr(t),[s,r,a,n,i,function(t){wa.call(this,e,t)},function(e){Ca[e?"unshift":"push"](()=>{s=e,o(0,s)})}]}class Nf extends rs{constructor(e){super(),ns(this,e,Vf,_f,yr,{hasHeader:1,hasFooter:2,root:0})}}function Hf(e){let t;return{c(){t=Ur("div"),Qr(t,"class","PinturaRangeInputMeter"),aa(t,"transform",`translateX(${e[10].x-e[13].x}px) translateY(${e[10].y-e[13].y}px)`)},m(o,i){Hr(o,t,i),t.innerHTML=e[7]},p(e,o){128&o[0]&&(t.innerHTML=e[7]),1024&o[0]&&aa(t,"transform",`translateX(${e[10].x-e[13].x}px) translateY(${e[10].y-e[13].y}px)`)},d(e){e&&jr(t)}}}function jf(e){let t,o,i,n,r,a,s,l,c,d,u,p=e[10]&&Hf(e);return{c(){t=Ur("div"),o=Ur("span"),i=Xr(),n=Ur("button"),r=Zr(e[1]),s=Xr(),l=Ur("div"),p&&p.c(),Qr(o,"class","PinturaRangeInputValue"),Qr(n,"class","PinturaRangeInputReset"),Qr(n,"type","button"),n.disabled=a=e[0]===e[2],Qr(l,"class","PinturaRangeInputInner"),Qr(l,"data-value-limited",e[5]),aa(l,"--range-mask-from",e[9]),aa(l,"--range-mask-to",e[8]),Qr(t,"class","PinturaRangeInput"),Qr(t,"tabindex","0")},m(a,h){Hr(a,t,h),_r(t,o),o.innerHTML=e[3],_r(t,i),_r(t,n),_r(n,r),_r(t,s),_r(t,l),p&&p.m(l,null),d||(u=[qr(n,"click",e[18]),qr(l,"interactionstart",e[14]),qr(l,"interactionupdate",e[16]),qr(l,"interactionend",e[17]),qr(l,"interactionrelease",e[15]),Ar(c=Wh.call(null,l,{inertia:e[6]})),qr(l,"measure",e[39]),Ar(qc.call(null,l)),qr(t,"wheel",e[20],{passive:!1}),qr(t,"nudge",e[21]),Ar(xp.call(null,t,{direction:"horizontal",preventDefault:!0}))],d=!0)},p(e,t){8&t[0]&&(o.innerHTML=e[3]),2&t[0]&&na(r,e[1]),5&t[0]&&a!==(a=e[0]===e[2])&&(n.disabled=a),e[10]?p?p.p(e,t):(p=Hf(e),p.c(),p.m(l,null)):p&&(p.d(1),p=null),32&t[0]&&Qr(l,"data-value-limited",e[5]),c&&fr(c.update)&&64&t[0]&&c.update.call(null,{inertia:e[6]}),512&t[0]&&aa(l,"--range-mask-from",e[9]),256&t[0]&&aa(l,"--range-mask-to",e[8])},i:ur,o:ur,d(e){e&&jr(t),p&&p.d(),d=!1,$r(u)}}}function Uf(e,t,i){let n,r,a,s,l,c,d,u,p,h,m,g,{labelReset:$="Reset"}=t,{direction:f="x"}=t,{min:y=0}=t,{max:b=1}=t,{base:x=y}=t,{value:v=0}=t,{valueLabel:S=0}=t,{valueMin:w}=t,{valueMax:k}=t,{oninputstart:C=o}=t,{oninputmove:T=o}=t,{oninputend:M=o}=t,{elasticity:P=0}=t,{nudgeMultiplier:R}=t,{step:I=8}=t;const E=Sa("isAnimated");wr(e,E,e=>i(6,h=e));const A=Sa("fixScrollDirection");wr(e,A,e=>i(45,m=e));const L=(e,t,o)=>Math.ceil((e-o)/t)*t+o;let F,z,D;const O={x:2,y:0},B=(e,t,o)=>`M ${e-o} ${t} a ${o} ${o} 0 1 0 0 -1`;let W,_,V=!1,N={snap:!1,elastic:!1};const H=(e,t,o)=>{const i=e[f]+t[f],n=Rs(i,_[1][f],_[0][f]),r=P?n+_h(i-n,P):n,a=o.elastic?r:n,s=be(0,0);return s[f]=a,j.set(s,{hard:o.snap}),Rs(G(s,f),y,b)},j=Fc();wr(e,j,e=>i(10,g=e));const U=(e,t)=>{const o=.5*(F[t]-s[t])-(vp(e,y,b)*s[t]-.5*s[t]);return{x:"x"===t?o:0,y:"y"===t?o:0}},G=(e,t)=>{const o=-(e[t]-.5*F[t])/s[t];return y+o*n},Z=j.subscribe(e=>{e&&W&&T(Rs(G(e,f),y,b))}),X=e=>{const t=[U(null!=w?w:y,f),U(null!=k?k:b,f)],o={x:"x"===f?g.x+e:0,y:"y"===f?g.y+e:0},i=Rs(o[f],t[1][f],t[0][f]),n={...g,[f]:i};Er(j,g=n,g);const r=Rs(G(n,f),y,b);C(),T(r),M(r)};ba(()=>{Z()});return e.$$set=e=>{"labelReset"in e&&i(1,$=e.labelReset),"direction"in e&&i(22,f=e.direction),"min"in e&&i(23,y=e.min),"max"in e&&i(24,b=e.max),"base"in e&&i(2,x=e.base),"value"in e&&i(0,v=e.value),"valueLabel"in e&&i(3,S=e.valueLabel),"valueMin"in e&&i(25,w=e.valueMin),"valueMax"in e&&i(26,k=e.valueMax),"oninputstart"in e&&i(27,C=e.oninputstart),"oninputmove"in e&&i(28,T=e.oninputmove),"oninputend"in e&&i(29,M=e.oninputend),"elasticity"in e&&i(30,P=e.elasticity),"nudgeMultiplier"in e&&i(31,R=e.nudgeMultiplier),"step"in e&&i(32,I=e.step)},e.$$.update=()=>{if(25165824&e.$$.dirty[0]&&i(34,n=b-y),41943040&e.$$.dirty[0]&&i(36,r=null!=w?Math.max(w,y):y),83886080&e.$$.dirty[0]&&i(35,a=null!=k?Math.min(k,b):b),25165828&e.$$.dirty[0]&&i(38,l=vp(x,y,b)),16&e.$$.dirty[0]|128&e.$$.dirty[1]&&F){const e=.5*F.y;let t,o=40*l,n="",r=F.y,a="";for(let i=0;i<=40;i++){const r=O.x+10*i,s=e;n+=B(r,s,i%5==0?2:.75)+" ",t=r+O.x,i===o&&(a=`<path d="M${r} ${s-4} l2 3 l-2 -1 l-2 1 z"/>`)}i(7,z=`<svg width="${t}" height="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${t} ${r}" aria-hidden="true" focusable="false">\n ${a}\n <rect rx="4" ry="4" y="${e-4}"" height="8"/>\n <path fill-rule="evenodd" d="${n.trim()}"/></svg>`),i(33,D={x:t-2*O.x,y:r})}16&e.$$.dirty[0]|4&e.$$.dirty[1]&&(s=F&&D),25165824&e.$$.dirty[0]|48&e.$$.dirty[1]&&i(5,c=r!==y||a!==b),32&e.$$.dirty[0]|48&e.$$.dirty[1]&&i(37,d=c?function(e,t){const o=1/40,i=vp(e,y,b),n=vp(t,y,b);return[100*ge(L(i,o,0)-.0125)+"%",100*ge(L(n,o,0)-.0125)+"%"]}(r,a):void 0),64&e.$$.dirty[1]&&i(9,u=d?d[0]:""),64&e.$$.dirty[1]&&i(8,p=d?d[1]:""),4194385&e.$$.dirty[0]|8&e.$$.dirty[1]&&n&&F&&F.x&&F.y&&j.set(U(v,f),{hard:!1===h})},[v,$,x,S,F,c,h,z,p,u,g,E,A,O,()=>{V=!1,W=Sr(j),_=[U(null!=w?w:y,f),U(null!=k?k:b,f)],C()},()=>{V=!0},({detail:e})=>{N.snap=!V,N.elastic=!V,H(W,e.translation,N)},({detail:e})=>{N.snap=!1,N.elastic=!1;const t=H(W,e.translation,N);if(W=void 0,_=void 0,Math.abs(t-x)<.01)return M(x);M(t)},()=>{i(0,v=Rs(x,r,a)),C(),M(v)},j,e=>{e.preventDefault(),e.stopPropagation();const t=Sp(e,{fixScrollDirection:m})*I;X(t)},({detail:e})=>{X(e[f]*Math.abs(R||8))},f,y,b,w,k,C,T,M,P,R,I,D,n,a,r,d,l,e=>i(4,F=(e=>be(e.width,e.height))(e.detail))]}class Gf extends rs{constructor(e){super(),ns(this,e,Uf,jf,yr,{labelReset:1,direction:22,min:23,max:24,base:2,value:0,valueLabel:3,valueMin:25,valueMax:26,oninputstart:27,oninputmove:28,oninputend:29,elasticity:30,nudgeMultiplier:31,step:32},null,[-1,-1])}}var Zf={[ae]:e=>({x:e.x,y:e.y}),[ue]:e=>({x:e.x+e.width,y:e.y}),[se]:e=>({x:e.x+e.width,y:e.y}),[pe]:e=>({x:e.x+e.width,y:e.y+e.height}),[le]:e=>({x:e.x,y:e.y+e.height}),[he]:e=>({x:e.x,y:e.y+e.height}),[ce]:e=>({x:e.x,y:e.y}),[de]:e=>({x:e.x,y:e.y})};const Xf={t:"top",r:"right",b:"bottom",l:"left"},Yf="horizontal",qf="vertical",Kf={t:qf,b:qf,r:Yf,l:Yf};function Jf(e,t,o){const i=e.slice();return i[15]=t[o].key,i[16]=t[o].translate,i[17]=t[o].scale,i[18]=t[o].type,i[19]=t[o].opacity,i[20]=t[o].role,i[21]=t[o].tabindex,i[22]=t[o].label,i[23]=t[o].orientation,i[24]=t[o].valuemin,i[25]=t[o].valuemax,i[26]=t[o].valuenow,i}function Qf(e,t){let o,i,n,r,a,s,l,c,d,u,p,h;return{key:e,first:null,c(){o=Ur("div"),Qr(o,"role",i=t[20]),Qr(o,"tabindex",n=t[21]),Qr(o,"aria-label",r=t[22]),Qr(o,"aria-orientation",a=t[23]),Qr(o,"aria-valuemin",s=t[24]),Qr(o,"aria-valuemax",l=t[25]),Qr(o,"aria-valuenow",c=t[26]),Qr(o,"class","PinturaRectManipulator"),Qr(o,"data-direction",d=t[15]),Qr(o,"data-shape",u=""+("edge"===t[18]?"edge":`${t[0]}`)),aa(o,"--tx",t[16].x),aa(o,"--ty",t[16].y),aa(o,"--sx",t[17].x),aa(o,"--sy",t[17].y),aa(o,"opacity",t[19]),this.first=o},m(e,i){Hr(e,o,i),p||(h=[qr(o,"nudge",function(){fr(t[6](t[15]))&&t[6](t[15]).apply(this,arguments)}),Ar(xp.call(null,o,{preventDefault:!0})),qr(o,"interactionstart",function(){fr(t[5]("resizestart",t[15]))&&t[5]("resizestart",t[15]).apply(this,arguments)}),qr(o,"interactionupdate",function(){fr(t[5]("resizemove",t[15]))&&t[5]("resizemove",t[15]).apply(this,arguments)}),qr(o,"interactionend",function(){fr(t[5]("resizeend",t[15]))&&t[5]("resizeend",t[15]).apply(this,arguments)}),Ar(Wh.call(null,o))],p=!0)},p(e,p){t=e,2&p&&i!==(i=t[20])&&Qr(o,"role",i),2&p&&n!==(n=t[21])&&Qr(o,"tabindex",n),2&p&&r!==(r=t[22])&&Qr(o,"aria-label",r),2&p&&a!==(a=t[23])&&Qr(o,"aria-orientation",a),2&p&&s!==(s=t[24])&&Qr(o,"aria-valuemin",s),2&p&&l!==(l=t[25])&&Qr(o,"aria-valuemax",l),2&p&&c!==(c=t[26])&&Qr(o,"aria-valuenow",c),2&p&&d!==(d=t[15])&&Qr(o,"data-direction",d),3&p&&u!==(u=""+("edge"===t[18]?"edge":`${t[0]}`))&&Qr(o,"data-shape",u),2&p&&aa(o,"--tx",t[16].x),2&p&&aa(o,"--ty",t[16].y),2&p&&aa(o,"--sx",t[17].x),2&p&&aa(o,"--sy",t[17].y),2&p&&aa(o,"opacity",t[19])},d(e){e&&jr(o),p=!1,$r(h)}}}function ey(e){let t,o=[],i=new Map,n=Xa(e[1]);const r=e=>e[15];for(let t=0;t<n.length;t+=1){let a=Jf(e,n,t),s=r(a);i.set(s,o[t]=Qf(s,a))}return{c(){for(let e=0;e<o.length;e+=1)o[e].c();t=Yr()},m(e,i){for(let t=0;t<o.length;t+=1)o[t]&&o[t].m(e,i);Hr(e,t,i)},p(e,[a]){99&a&&(n=Xa(e[1]),o=Ka(o,a,r,1,e,n,i,t.parentNode,Ya,Qf,t,Jf))},i:ur,o:ur,d(e){e&&jr(t);for(let t=0;t<o.length;t+=1)o[t].d(e)}}}function ty(e,t,o){let i,n,r,a,{rect:s=null}=t,{bounds:l=null}=t,{visible:c=!1}=t,{cornerStyle:d}=t;const u=Sa("isAnimated");wr(e,u,e=>o(12,a=e));const p=Fc(void 0,{precision:1e-4,stiffness:.2,damping:.4});wr(e,p,e=>o(11,r=e));const h=Fc(0,{precision:.001});let m;wr(e,h,e=>o(10,n=e));const g=xa();return e.$$set=e=>{"rect"in e&&o(7,s=e.rect),"bounds"in e&&o(8,l=e.bounds),"visible"in e&&o(9,c=e.visible),"cornerStyle"in e&&o(0,d=e.cornerStyle)},e.$$.update=()=>{4608&e.$$.dirty&&p.set(c?1:.5,{hard:!1===a}),4608&e.$$.dirty&&h.set(c?1:0,{hard:!1===a}),3456&e.$$.dirty&&o(1,i=Object.keys(re).map((e,t)=>{const o=re[e],i=Zf[o](s),a=1===o.length?"edge":"corner",c="corner"===a;let d;if("edge"===a&&l){let e,t,i;"l"===o&&(e=l.x,t=Math.min(l.width,s.x+s.width),i=s.x),"t"===o&&(e=l.y,t=Math.min(l.height,s.y+s.height),i=s.y),"r"===o&&(e=s.x,t=l.width,i=s.x+s.width),"b"===o&&(e=s.y,t=l.height,i=s.y+s.height),d={role:"slider",tabindex:0,label:`Drag ${Xf[o]}`,orientation:`${Kf[o]}`,valuemin:Math.round(e),valuemax:Math.round(t),valuenow:Math.round(i)}}return{key:o,type:a,scale:{x:/^(t|b)$/.test(o)?s.width:c?Rs(r,.5,1.25):1,y:/^(r|l)$/.test(o)?s.height:c?Rs(r,.5,1.25):1},translate:{x:i.x,y:i.y},opacity:n,...d}}))},[d,i,u,p,h,(e,t)=>({detail:o})=>{m&&t!==m||"resizestart"!==e&&void 0===m||("resizestart"===e&&(m=t),"resizeend"===e&&(m=void 0),g(e,{direction:t,translation:o&&o.translation}))},e=>({detail:t})=>{g("resizestart",{direction:e,translation:{x:0,y:0}}),g("resizemove",{direction:e,translation:t}),g("resizeend",{direction:e,translation:{x:0,y:0}})},s,l,c,n,r,a]}class oy extends rs{constructor(e){super(),ns(this,e,ty,ey,yr,{rect:7,bounds:8,visible:9,cornerStyle:0})}}var iy=e=>{function t(t,o){e.dispatchEvent(new CustomEvent(t,{detail:o}))}const o=o=>{o.preventDefault(),e.addEventListener("gesturechange",i),e.addEventListener("gestureend",n),t("gesturedown")},i=e=>{e.preventDefault(),t("gestureupdate",e.scale)},n=e=>{t("gestureup",e.scale),e.preventDefault(),r()},r=()=>{e.removeEventListener("gesturechange",i),e.removeEventListener("gestureend",n)};return e.addEventListener("gesturestart",o),{destroy:()=>{r(),e.removeEventListener("gesturestart",o)}}},ny={[ae]:le,[se]:ce,[le]:ae,[ce]:se,[de]:pe,[ue]:he,[pe]:de,[he]:ue},ry=e=>{const t=e===ce||e===se,o=e===ae||e===le;return[e===se||e===ue||e===pe,e===ce||e===he||e===de,e===ae||e===ue||e===de,e===le||e===pe||e===he,t,o,t||o]},ay=(e,t,o,i={})=>{const{target:n,translate:r}=t,{aspectRatio:a,minSize:s,maxSize:l}=i,c=me[ny[n]],d=Re(be(e.x,e.y),be(c[0]*e.width,c[1]*e.height)),u=me[n],p=Re(rt(e),be(u[0]*e.width,u[1]*e.height)),[h,m,g,$,f,y,b]=ry(n);let x=r.x,v=r.y;f?v=0:y&&(x=0);const{inner:S,outer:w}=sy(d,n,o,{aspectRatio:a,minSize:s,maxSize:l});let[k,C,T,M]=Rt(e);if(h?M=d.x:m&&(C=d.x),$?k=d.y:g&&(T=d.y),h){const e=S.x+S.width,t=w.x+w.width;C=Rs(p.x+x,e,t)}else if(m){const e=w.x,t=S.x;M=Rs(p.x+x,e,t)}if($){const e=S.y+S.height,t=w.y+w.height;T=Rs(p.y+v,e,t)}else if(g){const e=w.y,t=S.y;k=Rs(p.y+v,e,t)}if(M>S.x&&(M=S.x),C<S.x+S.width&&(C=S.x+S.width),k>S.y&&(k=S.y),T<S.y+S.height&&(T=S.y+S.height),M<w.x){const e=w.x-M;M=w.x,C+=e}if(C>w.x+w.width){const e=C-(w.x+w.width);C=w.x+w.width,M-=e}if(k<w.y){const e=w.y-k;k=w.y,T+=e}if(T>w.y+w.height){const e=T-(w.y+w.height);T=w.y+w.height,k-=e}if(a)if(b){let e=C-M,t=T-k;f?(t=e/a,k=d.y-.5*t,T=d.y+.5*t):y&&(e=t*a,M=d.x-.5*e,C=d.x+.5*e)}else{const e=be(p.x+x-d.x,p.y+v-d.y);n===ue?(e.x=Math.max(0,e.x),e.y=Math.min(0,e.y)):n===pe?(e.x=Math.max(0,e.x),e.y=Math.max(0,e.y)):n===he?(e.x=Math.min(0,e.x),e.y=Math.max(0,e.y)):n===de&&(e.x=Math.min(0,e.x),e.y=Math.min(0,e.y));const t=ke(e),o=ke(be(S.width,S.height)),i=ke(be(w.width,w.height)),r=Rs(t,o,i),s=be(a,1),l=Ae(Ce(s),r);n===ue?(C=d.x+l.x,k=d.y-l.y):n===pe?(C=d.x+l.x,T=d.y+l.y):n===he?(M=d.x-l.x,T=d.y+l.y):n===de&&(M=d.x-l.x,k=d.y-l.y)}return ht(M,k,C-M,T-k)};const sy=(e,t,o,i)=>{const{aspectRatio:n,minSize:r,maxSize:a}=i,s=t===se||t===ue||t===pe,l=t===ce||t===he||t===de,c=t===ae||t===ue||t===de,d=t===le||t===pe||t===he,u=t===ce||t===se,p=t===ae||t===le,h=rt(o);s?(h.x=e.x,h.width-=e.x):l&&(h.width=e.x),d?(h.y=e.y,h.height-=e.y):c&&(h.height=e.y);const m=((e,t)=>nt(0,0,e,t))(Math.min(h.width,a.width),Math.min(h.height,a.height));if(n)if(u){const t=Math.min(e.y,o.height-e.y);m.height=Math.min(2*t,m.height)}else if(p){const t=Math.min(e.x,o.width-e.x);m.width=Math.min(2*t,m.width)}const g=n?je(Mt(st(r),n)):r,$=n?je(Pt(m,n)):m;let f,y,b,x;s?f=e.x:l&&(y=e.x),d?b=e.y:c&&(x=e.y),s?y=f+g.width:l&&(f=y-g.width),d?x=b+g.height:c&&(b=x-g.height),u?(b=e.y-.5*g.height,x=e.y+.5*g.height):p&&(f=e.x-.5*g.width,y=e.x+.5*g.width);const v=dt([be(f,b),be(y,x)]);s?y=f+$.width:l&&(f=y-$.width),d?x=b+$.height:c&&(b=x-$.height),u?(b=e.y-.5*$.height,x=e.y+.5*$.height):p&&(f=e.x-.5*$.width,y=e.x+.5*$.width),f=Math.max(o.x,f),y=Math.min(o.x+o.width,y),b=Math.max(o.y,b),x=Math.min(o.y+o.height,x);return{inner:v,outer:dt([be(f,b),be(y,x)])}};var ly=e=>180*e/Math.PI;function cy(e){let t,o,i;return o=new Gf({props:{elasticity:e[5],min:e[9],max:e[10],value:e[11],valueMin:Math.max(e[9],e[0]),valueMax:Math.min(e[10],e[1]),labelReset:e[6],base:e[12],valueLabel:`${Math.round(ly(e[11]))}&deg;`,oninputstart:e[2],oninputmove:e[17],oninputend:e[18]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaImageRotator")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,[t]){const i={};32&t&&(i.elasticity=e[5]),512&t&&(i.min=e[9]),1024&t&&(i.max=e[10]),2048&t&&(i.value=e[11]),513&t&&(i.valueMin=Math.max(e[9],e[0])),1026&t&&(i.valueMax=Math.min(e[10],e[1])),64&t&&(i.labelReset=e[6]),4096&t&&(i.base=e[12]),2048&t&&(i.valueLabel=`${Math.round(ly(e[11]))}&deg;`),4&t&&(i.oninputstart=e[2]),392&t&&(i.oninputmove=e[17]),400&t&&(i.oninputend=e[18]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function dy(e,t,i){let n,r,a,s,l,c,d,{rotation:u}=t,{valueMin:p}=t,{valueMax:h}=t,{oninputstart:m=o}=t,{oninputmove:g=o}=t,{oninputend:$=o}=t,{elasticity:f=0}=t,{labelReset:y}=t,{rotationMin:b}=t,{rotationMax:x}=t;return e.$$set=e=>{"rotation"in e&&i(13,u=e.rotation),"valueMin"in e&&i(0,p=e.valueMin),"valueMax"in e&&i(1,h=e.valueMax),"oninputstart"in e&&i(2,m=e.oninputstart),"oninputmove"in e&&i(3,g=e.oninputmove),"oninputend"in e&&i(4,$=e.oninputend),"elasticity"in e&&i(5,f=e.elasticity),"labelReset"in e&&i(6,y=e.labelReset),"rotationMin"in e&&i(14,b=e.rotationMin),"rotationMax"in e&&i(15,x=e.rotationMax)},e.$$.update=()=>{16384&e.$$.dirty&&i(9,n=b+1e-9),32768&e.$$.dirty&&i(10,r=x-1e-9),1536&e.$$.dirty&&i(12,a=n+.5*(r-n)),32768&e.$$.dirty&&i(16,s=2*x),8192&e.$$.dirty&&i(8,l=Math.sign(u)),73728&e.$$.dirty&&i(7,c=Math.round(Math.abs(u)/s)*s),8576&e.$$.dirty&&i(11,d=u-l*c)},[p,h,m,g,$,f,y,c,l,n,r,d,a,u,b,x,s,e=>g(l*c+e),e=>$(l*c+e)]}class uy extends rs{constructor(e){super(),ns(this,e,dy,cy,yr,{rotation:13,valueMin:0,valueMax:1,oninputstart:2,oninputmove:3,oninputend:4,elasticity:5,labelReset:6,rotationMin:14,rotationMax:15})}}function py(e){let t,o;return t=new Xu({props:{class:"PinturaPresetListFilter",layout:"row",options:e[8],selectedIndex:e[7],onchange:e[10]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};256&o&&(i.options=e[8]),128&o&&(i.selectedIndex=e[7]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function hy(e){let t,o;return t=new gp({props:{icon:e[0],label:e[1],labelClass:e[2],hideLabel:e[3],options:e[9],selectedIndex:e[4],onchange:e[5],optionMapper:e[6],$$slots:{controls:[py]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,[o]){const i={};1&o&&(i.icon=e[0]),2&o&&(i.label=e[1]),4&o&&(i.labelClass=e[2]),8&o&&(i.hideLabel=e[3]),512&o&&(i.options=e[9]),16&o&&(i.selectedIndex=e[4]),32&o&&(i.onchange=e[5]),64&o&&(i.optionMapper=e[6]),262528&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}const my='fill="none" stroke="currentColor"';function gy(e,t,i){let n,r,a,{icon:s}=t,{label:l}=t,{labelClass:c}=t,{hideLabel:d}=t,{options:u}=t,{selectedIndex:p}=t,{onchange:h}=t,{optionMapper:m}=t,{filter:g="landscape"}=t,{onfilterchange:$=o}=t;const f=(e,t,o,i,n)=>`\n <rect ${my} x="${e}" y="${t}" width="${o}" height="${i}" rx="${n}"/>`,b=(e,t)=>`<path ${my} d="M${e} ${t} l2 2 l3 -4"/>`;return e.$$set=e=>{"icon"in e&&i(0,s=e.icon),"label"in e&&i(1,l=e.label),"labelClass"in e&&i(2,c=e.labelClass),"hideLabel"in e&&i(3,d=e.hideLabel),"options"in e&&i(12,u=e.options),"selectedIndex"in e&&i(4,p=e.selectedIndex),"onchange"in e&&i(5,h=e.onchange),"optionMapper"in e&&i(6,m=e.optionMapper),"filter"in e&&i(11,g=e.filter),"onfilterchange"in e&&i(13,$=e.onfilterchange)},e.$$.update=()=>{6144&e.$$.dirty&&i(9,n=((e,t)=>(e||[]).map(e=>y(e[0])?(e[1]=e[1].map(t),e):t(e)))(u,(e=>t=>{const[o,i,n={}]=t;return No(o)&&(n.hidden="landscape"===e?o<1:o>1),[o,i,n]})(g))),2048&e.$$.dirty&&i(7,r="landscape"===g?0:1),128&e.$$.dirty&&i(8,a=[["landscape","Landscape",{hideLabel:!0,icon:f(2,6,19,12,2)+(0===r?b(9,12):"")}],["portrait","Portrait",{hideLabel:!0,icon:f(5,3,13,18,2)+(1===r?b(9,12):"")}]])},[s,l,c,d,p,h,m,r,a,n,e=>{i(11,g=e.value),$(e.value)},g,u,$]}class $y extends rs{constructor(e){super(),ns(this,e,gy,hy,yr,{icon:0,label:1,labelClass:2,hideLabel:3,options:12,selectedIndex:4,onchange:5,optionMapper:6,filter:11,onfilterchange:13})}}const fy=e=>Pe(e,e=>ge(e,6)),yy=e=>Et(e,e=>ge(e,6)),by=(e,t,o=1e-4)=>Math.abs(e-t)<o;var xy=(e,t,o,i,n={})=>{const{aspectRatio:r}=n;e=yy(e),i=i.map(fy);const a=yt(e,ny[o.target]),s=Pe(a,e=>ge(e,6)),l=r?Mt(n.minSize,r):n.minSize,c=r?Pt(n.maxSize,r):n.maxSize,d=yt(t,o.target);if(De(d,a)<1){t=rt(e);const o=Math.min(l.width/e.width,l.height/e.height);$t(t,o,a)}t=ft(rt(t),l,c,a);let u=rt(t);t=yy(t);const p=Nt(i,1),h=It(e),m=It(t),g=h.findIndex(e=>Me(Pe(e,e=>ge(e,6)),s)),$=e=>p.map(t=>zt(t,e)).filter(Boolean).pop();if(r){const t=m.map((e,t)=>{if(t===g)return;const o=be(a.x-e.x,a.y-e.y);Ce(o),Ae(o,.5);const i=be(a.x-o.x,a.y-o.y),n=et(i,fy(e)),r=$(n);if(!r)return;const s=h[t];return{intersection:r,cornerDist:De(a,s),intersectionDist:De(a,r)}}).filter(Boolean);if(t.length){const o=t.reduce((e,t)=>{const o=t.intersectionDist/t.cornerDist;return o<e?o:e},Number.MAX_SAFE_INTEGER);u=rt(e),$t(u,o,a)}}else{const e=1===o.target.length,n=!(i[0].y===i[1].y||i[0].x===i[1].x),r=h.map((t,o)=>{if(o===g)return;const i=m[o],r=!by(i.x,s.x)&&!by(i.y,s.y);if(!e&&!n&&r)return;if(e&&(by(i.x,s.x)||by(i.y,s.y)))return;const l=ve(e?t:a),c=Ie(ve(l),i);Ce(c),Ae(c,.5),e?Re(l,c):Ie(l,c);const d=et(l,i),u=$(d);return u||void 0}).filter(Boolean);if(r.length){const[e,i,n,l]=ry(o.target);let[c,d,p,h]=Rt(t);r.forEach(({x:t,y:o})=>{const r=ge(t,6),a=ge(o,6);n&&!by(a,s.y)&&(c=Math.max(c,o)),e&&!by(r,s.x)&&(d=Math.min(d,t)),l&&!by(a,s.y)&&(p=Math.min(p,o)),i&&!by(r,s.x)&&(h=Math.max(h,t))}),u=lt([c,d,p,h]),$t(u,.9999,a)}}return ft(u,l,c,a),u};function vy(e){let t,o;return t=new Rh({props:{items:e[12]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};4096&o[0]&&(i.items=e[12]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Sy(e){let t,o,i;return o=new Pf({props:{$$slots:{default:[vy]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"slot","header")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};4096&t[0]|1024&t[7]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function wy(e){let t,o;return t=new Dh({props:{onclick:e[90],label:e[4].cropLabelButtonRecenter,icon:e[4].cropIconButtonRecenter,disabled:!e[9],hideLabel:!0,class:"PinturaButtonCenter",style:`opacity:${e[31]};transform:translate3d(${e[32].x}px, ${e[32].y}px,0)`}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.label=e[4].cropLabelButtonRecenter),16&o[0]&&(i.icon=e[4].cropIconButtonRecenter),512&o[0]&&(i.disabled=!e[9]),3&o[1]&&(i.style=`opacity:${e[31]};transform:translate3d(${e[32].x}px, ${e[32].y}px,0)`),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ky(e){let t,o;return t=new oy({props:{rect:e[8],bounds:e[14],visible:e[13],cornerStyle:e[1]}}),t.$on("resizestart",e[70]),t.$on("resizemove",e[71]),t.$on("resizeend",e[72]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};256&o[0]&&(i.rect=e[8]),16384&o[0]&&(i.bounds=e[14]),8192&o[0]&&(i.visible=e[13]),2&o[0]&&(i.cornerStyle=e[1]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Cy(e){let t,o;return{c(){t=Ur("div"),o=Ur("p"),Qr(t,"class","PinturaImageInfo"),Qr(t,"data-custom",e[24])},m(i,n){Hr(i,t,n),_r(t,o),o.innerHTML=e[23]},p(e,i){8388608&i[0]&&(o.innerHTML=e[23]),16777216&i[0]&&Qr(t,"data-custom",e[24])},d(e){e&&jr(t)}}}function Ty(e){let t,o,i,n,r,a,s,l,c=e[22]&&e[10]&&wy(e),d=e[22]&&ky(e),u=e[11]&&Cy(e);return{c(){t=Ur("div"),o=Ur("div"),c&&c.c(),i=Xr(),d&&d.c(),r=Xr(),u&&u.c(),Qr(o,"class","PinturaStage"),Qr(t,"slot","main")},m(p,h){Hr(p,t,h),_r(t,o),c&&c.m(o,null),_r(o,i),d&&d.m(o,null),e[168](o),_r(t,r),u&&u.m(t,null),a=!0,s||(l=[Ar(qc.call(null,o)),qr(o,"measure",e[166]),qr(o,"wheel",function(){fr(e[2]&&e[89])&&(e[2]&&e[89]).apply(this,arguments)},{passive:!1}),qr(o,"interactionstart",e[76]),qr(o,"interactionupdate",e[77]),qr(o,"interactionrelease",e[79]),qr(o,"interactionend",e[78]),Ar(n=Wh.call(null,o,{drag:!0,inertia:!0,pinch:e[2],shouldStartInteraction:Dy,getEventPosition:e[169]})),qr(o,"gesturedown",e[86]),qr(o,"gestureupdate",e[87]),qr(o,"gestureup",e[88]),Ar(iy.call(null,o))],s=!0)},p(r,a){(e=r)[22]&&e[10]?c?(c.p(e,a),4195328&a[0]&&ja(c,1)):(c=wy(e),c.c(),ja(c,1),c.m(o,i)):c&&(Na(),Ua(c,1,1,()=>{c=null}),Ha()),e[22]?d?(d.p(e,a),4194304&a[0]&&ja(d,1)):(d=ky(e),d.c(),ja(d,1),d.m(o,null)):d&&(Na(),Ua(d,1,1,()=>{d=null}),Ha()),n&&fr(n.update)&&67108868&a[0]&&n.update.call(null,{drag:!0,inertia:!0,pinch:e[2],shouldStartInteraction:Dy,getEventPosition:e[169]}),e[11]?u?u.p(e,a):(u=Cy(e),u.c(),u.m(t,null)):u&&(u.d(1),u=null)},i(e){a||(ja(c),ja(d),a=!0)},o(e){Ua(c),Ua(d),a=!1},d(o){o&&jr(t),c&&c.d(),d&&d.d(),e[168](null),u&&u.d(),s=!1,$r(l)}}}function My(e){let t,o,i,n;const r=[{class:"PinturaControlList"},{tabs:e[7]},e[19]];let a={$$slots:{default:[Py,({tab:e})=>({226:e}),({tab:e})=>[0,0,0,0,0,0,0,e?512:0]]},$$scope:{ctx:e}};for(let e=0;e<r.length;e+=1)a=hr(a,r[e]);t=new $d({props:a}),t.$on("select",e[167]);const s=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[18]},e[19]];let l={$$slots:{default:[Ey,({panel:e})=>({225:e}),({panel:e})=>[0,0,0,0,0,0,0,e?256:0]]},$$scope:{ctx:e}};for(let e=0;e<s.length;e+=1)l=hr(l,s[e]);return i=new Rd({props:l}),{c(){ts(t.$$.fragment),o=Xr(),ts(i.$$.fragment)},m(e,r){os(t,e,r),Hr(e,o,r),os(i,e,r),n=!0},p(e,o){const n=524416&o[0]?Ja(r,[r[0],128&o[0]&&{tabs:e[7]},524288&o[0]&&Qa(e[19])]):{};1536&o[7]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n);const a=786432&o[0]?Ja(s,[s[0],s[1],262144&o[0]&&{panels:e[18]},524288&o[0]&&Qa(e[19])]):{};2046853144&o[0]|1280&o[7]&&(a.$$scope={dirty:o,ctx:e}),i.$set(a)},i(e){n||(ja(t.$$.fragment,e),ja(i.$$.fragment,e),n=!0)},o(e){Ua(t.$$.fragment,e),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(t,e),is(i,e)}}}function Py(e){let t,o,i=e[226].label+"";return{c(){t=Ur("span"),o=Zr(i)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){512&t[7]&&i!==(i=e[226].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function Ry(e){let t,o;return t=new Gf({props:{elasticity:e[27]*e[46],base:zy,min:e[25],max:Fy,valueMin:e[29][0],valueMax:e[29][1],value:e[30],labelReset:e[4].labelReset,valueLabel:`${Math.round(100*e[30])}%`,oninputstart:e[83],oninputmove:e[84],oninputend:e[85]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};134217728&o[0]&&(i.elasticity=e[27]*e[46]),33554432&o[0]&&(i.min=e[25]),536870912&o[0]&&(i.valueMin=e[29][0]),536870912&o[0]&&(i.valueMax=e[29][1]),1073741824&o[0]&&(i.value=e[30]),16&o[0]&&(i.labelReset=e[4].labelReset),1073741824&o[0]&&(i.valueLabel=`${Math.round(100*e[30])}%`),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Iy(e){let t,o;return t=new uy({props:{elasticity:e[27]*e[46],rotation:e[15],labelReset:e[4].labelReset,valueMin:e[28][0],valueMax:e[28][1],rotationMin:-e[3],rotationMax:e[3],oninputstart:e[73],oninputmove:e[74],oninputend:e[75]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};134217728&o[0]&&(i.elasticity=e[27]*e[46]),32768&o[0]&&(i.rotation=e[15]),16&o[0]&&(i.labelReset=e[4].labelReset),268435456&o[0]&&(i.valueMin=e[28][0]),268435456&o[0]&&(i.valueMax=e[28][1]),8&o[0]&&(i.rotationMin=-e[3]),8&o[0]&&(i.rotationMax=e[3]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Ey(e){let t,o,i,n;const r=[Iy,Ry],a=[];function s(e,t){return e[225]===e[95]+"-rotation"?0:e[225]===e[95]+"-zoom"?1:-1}return~(t=s(e))&&(o=a[t]=r[t](e)),{c(){o&&o.c(),i=Yr()},m(e,o){~t&&a[t].m(e,o),Hr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),ja(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(ja(o),n=!0)},o(e){Ua(o),n=!1},d(e){e&&jr(i),~t&&a[t].d(e)}}}function Ay(e){let t,o,i=e[20]&&My(e);return{c(){t=Ur("div"),i&&i.c(),Qr(t,"slot","footer"),aa(t,"transform",e[17])},m(e,n){Hr(e,t,n),i&&i.m(t,null),o=!0},p(e,o){e[20]?i?(i.p(e,o),1048576&o[0]&&ja(i,1)):(i=My(e),i.c(),ja(i,1),i.m(t,null)):i&&(Na(),Ua(i,1,1,()=>{i=null}),Ha()),131072&o[0]&&aa(t,"transform",e[17])},i(e){o||(ja(i),o=!0)},o(e){Ua(i),o=!1},d(e){e&&jr(t),i&&i.d()}}}function Ly(e){let t,o,i;function n(t){e[170](t)}let r={hasHeader:e[21],$$slots:{footer:[Ay],main:[Ty],header:[Sy]},$$scope:{ctx:e}};return void 0!==e[16]&&(r.root=e[16]),t=new Nf({props:r}),Ca.push(()=>es(t,"root",n)),t.$on("measure",e[171]),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};2097152&i[0]&&(n.hasHeader=e[21]),2145320958&i[0]|3&i[1]|1024&i[7]&&(n.$$scope={dirty:i,ctx:e}),!o&&65536&i[0]&&(o=!0,n.root=e[16],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}const Fy=1,zy=0,Dy=(e,t)=>e.target===t;function Oy(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w,k,C,T,M,P,R,I,E,A,F,z,D,O,W,_,V,N,H,j,U,G,Z,X,Y,q,K,J,te,oe,re,ae,se,le,ce,$e,fe,ye,xe,we,Te,Pe,Ee,Le,Fe,ze,De,Oe,Be,We,_e,Ve,He,Ge,Xe=ur,et=()=>(Xe(),Xe=vr(tt,e=>o(13,F=e)),tt);e.$$.on_destroy.push(()=>Xe());let{isActive:tt}=t;et();let{stores:ot}=t,{cropImageSelectionCornerStyle:it="circle"}=t,{cropWillRenderImageSelectionGuides:nt=(e,t)=>{const o="rotate"==e;return{rows:o?5:3,cols:o?5:3,opacity:.25*t}}}=t,{cropAutoCenterImageSelectionTimeout:at}=t,{cropEnableZoomMatchImageAspectRatio:lt=!0}=t,{cropEnableRotateMatchImageAspectRatio:ct="never"}=t,{cropEnableRotationInput:dt=!0}=t,{cropEnableZoom:ut=!0}=t,{cropEnableZoomInput:ft=!0}=t,{cropEnableZoomAutoHide:yt=!0}=t,{cropEnableImageSelection:St=!0}=t,{cropEnableInfoIndicator:wt=!1}=t,{cropEnableZoomTowardsWheelPosition:kt=!0}=t,{cropEnableLimitWheelInputToCropSelection:It=!0}=t,{cropEnableCenterImageSelection:At=!0}=t,{cropEnableButtonRotateLeft:Lt=!0}=t,{cropEnableButtonRotateRight:Ft=!1}=t,{cropEnableButtonFlipHorizontal:zt=!0}=t,{cropEnableButtonFlipVertical:Dt=!1}=t,{cropSelectPresetOptions:Ot}=t,{cropEnableSelectPreset:Bt=!0}=t,{cropEnableFilterMatchAspectRatio:Wt=!0}=t,{cropSelectPresetFilter:_t=!1}=t,{cropEnableButtonToggleCropLimit:Vt=!1}=t,{cropWillRenderTools:Nt=ee}=t,{cropWillRenderInfoIndicator:Ht}=t,{cropActiveTransformTool:jt="rotation"}=t,{cropMinimizeToolbar:Ut="auto"}=t,{cropInteractionFocus:Gt="image"}=t,{cropRotationRange:Zt=ie}=t,{cropMaskOpacity:Xt=.85}=t,{locale:Yt={}}=t,{cropFormatIconSelectPreset:qt=function(e){const{aspectRatio:t}=e,[o,i,n]=t?[t<1?1:.3,1===t?.85:.5,t>1?1:.3]:[.2,.3,.4];return{a:o,b:i,c:n}}}=t,{cropFormatIconCropBoundary:Kt=function(e){const{isBoundToImage:t}=e,[o,i,n,r]=t?[.3,1,0,0]:[0,0,.3,1];return{a:o,b:i,c:n,d:r}}}=t;const Jt=Sa("isAnimated");wr(e,Jt,e=>o(144,z=e));const Qt=Sa("elasticityMultiplier");wr(e,Qt,e=>o(27,Be=e));const eo=Sa("redrawTrigger");wr(e,eo,e=>o(165,Oe=e));const to=Sa("imageIsStatic");wr(e,to,e=>o(150,H=e));const oo=Sa("imageStaticVisualCorners");wr(e,oo,e=>o(187,Te=e));const io=Sa("fixScrollDirection");wr(e,io,e=>o(181,le=e));let no="idle";const ro=ls();wr(e,ro,e=>o(162,Fe=e));const ao=()=>void 0===xe,so=e=>1/e,lo=e=>{Wt&&_t!==e&&(o(97,_t=e),xe&&1!==xe&&co()&&(Er(Xo,xe=so(xe),xe),mo.write()))},co=()=>{if(1===xe||!i)return!1;const e=so(xe);return!!fu(Fe).find(([t])=>t===e)},uo=(e,t,o)=>ne(o)?t.width===Math.round(e.height)||t.height===Math.round(e.width):t.width===Math.round(e.width)||t.height===Math.round(e.height),po=()=>(ao()||"always"===ct&&co())&&((e,t,o)=>{const i=Qe(Ke(Ne(t),o),e=>Math.abs(Math.round(e))),n=qe(i),r=mt(e);return Me(n,r)})(U,oe,re)&&uo(U,oe,re),ho=e=>{if("never"!==ct&&po()){Er(Fo,re+=e,re);const t=ne(re),o=t?oe.height:oe.width,i=t?oe.width:oe.height;Er(Ho,U=ht(0,0,o,i),U),ao()||Er(Xo,xe=Q(o,i),xe)}else Er(Fo,re+=e,re)},{history:mo,env:go,isInteracting:$o,isInteractingFraction:fo,isTransformingImage:yo,rootRect:bo,stageRect:xo,utilRect:vo,utilRectPadded:So,rootLineColor:wo,allowPan:ko,allowZoom:Co,allowPlayPause:To,rangeInputElasticity:Mo,presentationScalar:Po,utilTools:Ro,imagePreviewModifiers:Io,imageOutlineOpacity:Eo,imageFlipX:Ao,imageFlipY:Lo,imageRotation:Fo,imageRotationRange:zo,imageOutputSize:Do,imageSelectionRect:Oo,imageSelectionRectSnapshot:Bo,imageSelectionRectIntent:Wo,imageSelectionRectPresentation:_o,imageCropRectIntent:Vo,imageCropRectOrigin:No,imageCropRect:Ho,imageCropMinSize:jo,imageCropMaxSize:Go,imageCropRange:Zo,imageCropAspectRatio:Xo,imageCropLimitToImage:Yo,imageSize:qo,imageScalar:Ko,imageOverlayMarkup:Jo,stagePadded:Qo,stageRecenter:ei}=ot;function ti(e,t){return L(e.cropIconSelectPreset)?bu(e.cropIconSelectPreset,e,t):jl(e.cropIconSelectPreset,qt({aspectRatio:t}),"{","}")}function oi(e,t){return L(e.cropIconCropBoundary)?bu(e.cropIconCropBoundary,e,t):jl(e.cropIconCropBoundary,Kt({isBoundToImage:t}),"{","}")}let ii;wr(e,go,e=>o(145,D=e)),wr(e,$o,e=>o(149,N=e)),wr(e,yo,e=>o(179,J=e)),wr(e,bo,e=>o(26,ce=e)),wr(e,xo,e=>o(157,K=e)),wr(e,So,e=>o(14,X=e)),wr(e,Po,e=>o(154,Z=e)),wr(e,Ro,e=>o(189,Ee=e)),wr(e,Io,e=>o(178,_=e)),wr(e,Ao,e=>o(164,De=e)),wr(e,Lo,e=>o(163,ze=e)),wr(e,Fo,e=>o(15,re=e)),wr(e,zo,e=>o(28,We=e)),wr(e,Do,e=>o(151,j=e)),wr(e,Oo,e=>o(156,q=e)),wr(e,Bo,e=>o(155,Y=e)),wr(e,Wo,e=>o(188,Pe=e)),wr(e,_o,e=>o(148,V=e)),wr(e,Vo,e=>o(182,$e=e)),wr(e,No,e=>o(184,ye=e)),wr(e,Ho,e=>o(152,U=e)),wr(e,jo,e=>o(160,se=e)),wr(e,Go,e=>o(186,we=e)),wr(e,Zo,e=>o(183,fe=e)),wr(e,Xo,e=>o(185,xe=e)),wr(e,Yo,e=>o(159,ae=e)),wr(e,qo,e=>o(158,oe=e)),wr(e,Ko,e=>o(153,G=e)),wr(e,Qo,e=>o(147,W=e));const ni=(e,t)=>{const o={target:e,translate:t},i=Ye(Ne(se),Z),n=Ye(Ne(we),Z);let r=ay(Y,o,{...X,x:0,y:0},{aspectRatio:xe,minSize:i,maxSize:n});if(r=((e,t,o)=>{const[i,n,r,a]=Rt(e),s={...e};if(i<t.y&&(e.height=e.height-(t.y-i),e.y=t.y),n>t.x+t.width&&(e.width=t.x+t.width-e.x),r>t.y+t.height&&(e.height=t.y+t.height-e.y),a<t.x&&(e.width=e.width-(t.x-a),e.x=t.x),o){const t=Math.min(1,s.width/e.width,s.height/e.height);return bt(s,t)}return e})(r,{...X,x:0,y:0},xe),!ae)return{boundsLimited:r,boundsIntent:r};let a=xy(Y,r,o,Te,{aspectRatio:xe,minSize:i,maxSize:n});return{boundsLimited:a,boundsIntent:a}},ri=(e,t)=>{const o={target:e,translate:t},i=Ye(Ne(se),Z),n=Ye(Ne(we),Z),r=((e,t,o={})=>{const{target:i,translate:n}=t,{aspectRatio:r,minSize:a}=o,s=me[ny[i]],l=Re(rt(e),be(s[0]*e.width,s[1]*e.height)),c=me[i],d=Re(rt(e),be(c[0]*e.width,c[1]*e.height)),[u,p,h,m,g,$,f]=ry(i);let y=n.x,b=n.y;g?b=0:$&&(y=0);let[x,v,S,w]=Rt(e);if(u?w=l.x:p&&(v=l.x),m?x=l.y:h&&(S=l.y),u?v=d.x+y:p&&(w=d.x+y),m?S=d.y+b:h&&(x=d.y+b),a&&g&&S-x<a.height){const e=a.height-(S-x);x-=.5*e,S+=.5*e}if(a&&$&&v-w<a.width){const e=a.width-(v-w);w-=.5*e,v+=.5*e}if(r)if(f){let e=v-w,t=S-x;g?(t=e/r,x=l.y-.5*t,S=l.y+.5*t):$&&(e=t*r,w=l.x-.5*e,v=l.x+.5*e)}else{const e=be(d.x+y-l.x,d.y+b-l.y);i===ue?(e.x=Math.max(0,e.x),e.y=Math.min(0,e.y)):i===pe?(e.x=Math.max(0,e.x),e.y=Math.max(0,e.y)):i===he?(e.x=Math.min(0,e.x),e.y=Math.max(0,e.y)):i===de&&(e.x=Math.min(0,e.x),e.y=Math.min(0,e.y));const t=ke(e),o=be(r,1),n=Ae(Ce(o),t);i===ue?(v=l.x+n.x,x=l.y-n.y):i===pe?(v=l.x+n.x,S=l.y+n.y):i===he?(w=l.x-n.x,S=l.y+n.y):i===de&&(w=l.x-n.x,x=l.y-n.y)}return ht(w,x,v-w,S-x)})(Y,o,{aspectRatio:xe,minSize:i});return{boundsLimited:ay(Y,o,{...X,x:0,y:0},{aspectRatio:xe,minSize:i,maxSize:n}),boundsIntent:r}};let ai,si;const li=({translation:e,scalar:t})=>{H&&(t=1,e=Se(ve(e)));const o=Math.min(q.width/U.width,q.height/U.height),i=Ae(ve(e),1/o);let n;if(si){const t=Ie(ve(si),e);si=e,n=gt(rt(U),t)}else n=gt(rt(ai),Se(ve(i))),void 0!==t&&$t(n,1/t);Er(Vo,$e=n,$e),Er(Ho,U=n,U)},ci=cs([Zo,Ho],([e,t],o)=>{if(!t)return;const[i,n]=e,r=vt(t);o([je(Et(Mt(i,r),ge)),je(Et(Pt(n,r),ge))])});wr(e,ci,e=>o(180,te=e));const di=cs([qo,Yo,jo,Go,Zo,Fo],([e,t,o,i,n,r],a)=>{if(!e)return;const s=n[0],l=n[1];let c,d;t?(c=((e,t,o)=>ne(o)?1-1/Math.min(e.height/t.width,e.width/t.height):1-1/Math.min(e.width/t.width,e.height/t.height))(e,l,r),d=Math.min(s.width/o.width,s.height/o.height)):(c=-1,d=1);a([c,d].map(e=>ge(e)))});wr(e,di,e=>o(29,_e=e));const ui=cs([qo,Ho,Zo,Fo],([e,t,o,i],n)=>{if(!e||!t)return n(0);let r;const a=o[0],s=o[1],l=t.width,c=t.height,d=vt(t),u=ne(i)?Ze(e.height,e.width):e,p=Pt(u,d);if(l<=p.width||c<=p.height){const e=p.width-a.width,t=p.height-a.height;r=0===e||0===t?1:1-Math.min((l-a.width)/e,(c-a.height)/t)}else{const e=s.width-p.width,t=s.height-p.height,o=Pt({width:e,height:t},d);r=-Math.min((l-p.width)/o.width,(c-p.height)/o.height)}n(r)});wr(e,ui,e=>o(30,Ve=e));const pi=e=>{const t=vt(ai);let o,i,n;const r=ne(re)?Ze(oe.height,oe.width):oe,a=Pt(r,t);if(e>=0){const r=a.width-fe[0].width,s=a.height-fe[0].height;o=a.width-r*e,i=a.height-s*e,n=Mt({width:o,height:i},t)}else{const r=fe[1].width-a.width,s=fe[1].height-a.height;o=a.width+r*-e,i=a.height+s*-e,n=Pt({width:o,height:i},t)}o=n.width,i=n.height;const s=ai.x+.5*ai.width-.5*o,l=ai.y+.5*ai.height-.5*i;Er(Ho,U={x:s,y:l,width:o,height:i},U)};let hi;const mi=e=>{const t=$t(rt(hi),1/e);Er(Vo,$e=t,$e),Er(Ho,U=t,U)};let gi;const $i=()=>{ei.set({})};let fi;const yi=Fc(0,{precision:1e-4});wr(e,yi,e=>o(31,He=e));const bi=Fc();wr(e,bi,e=>o(32,Ge=e));const xi=cs([Xo,Do,ro],([e,t,o],n)=>{if(!i)return;const r=fu(o),a=[...r].map(e=>e[0]).sort((e,t)=>Uo(e[0])&&!Uo(t[0])?1:-1).find(o=>{if(Uo(o)&&t){const[i,n]=o,r=t.width===i&&t.height===n,a=e===Q(i,n);return r&&a}return o===e});if(!a)return n(void 0);n(r.map(e=>e[0]).findIndex(e=>Uo(e)?Fs(e,a):e===a))});wr(e,xi,e=>o(161,Le=e));const vi=(e,t)=>{if(!i||-1===e||void 0===e)return;const o=fu(t)[e][0];return o?Uo(o)?Q(o[0],o[1]):o:void 0},Si=cs([wo,_o,fo],([e,t,o],i)=>{const{rows:n,cols:r,opacity:a}=nt(no,o);if(!t||a<=0)return i([]);const{x:s,y:l,width:c,height:d}=t,u=c/r,p=d/n,h=[];for(let t=1;t<=n-1;t++){const o=l+p*t;h.push({id:`image-selection-guide-row-${t}`,points:[be(s,o),be(s+c,o)],opacity:a,strokeWidth:1,strokeColor:e})}for(let t=1;t<=r-1;t++){const o=s+u*t;h.push({id:`image-selection-guide-col-${t}`,points:[be(o,l),be(o,l+d)],opacity:a,strokeWidth:1,strokeColor:e})}i(h)});wr(e,Si,e=>o(146,O=e));const wi=`crop-${B()}`;let ki,Ci,Ti=wi+"-"+(dt?jt:"zoom"),Mi=Ti;const Pi=Fc(z?20:0);wr(e,Pi,e=>o(143,A=e));return e.$$set=e=>{"isActive"in e&&et(o(0,tt=e.isActive)),"stores"in e&&o(99,ot=e.stores),"cropImageSelectionCornerStyle"in e&&o(1,it=e.cropImageSelectionCornerStyle),"cropWillRenderImageSelectionGuides"in e&&o(100,nt=e.cropWillRenderImageSelectionGuides),"cropAutoCenterImageSelectionTimeout"in e&&o(101,at=e.cropAutoCenterImageSelectionTimeout),"cropEnableZoomMatchImageAspectRatio"in e&&o(102,lt=e.cropEnableZoomMatchImageAspectRatio),"cropEnableRotateMatchImageAspectRatio"in e&&o(103,ct=e.cropEnableRotateMatchImageAspectRatio),"cropEnableRotationInput"in e&&o(104,dt=e.cropEnableRotationInput),"cropEnableZoom"in e&&o(2,ut=e.cropEnableZoom),"cropEnableZoomInput"in e&&o(105,ft=e.cropEnableZoomInput),"cropEnableZoomAutoHide"in e&&o(106,yt=e.cropEnableZoomAutoHide),"cropEnableImageSelection"in e&&o(107,St=e.cropEnableImageSelection),"cropEnableInfoIndicator"in e&&o(108,wt=e.cropEnableInfoIndicator),"cropEnableZoomTowardsWheelPosition"in e&&o(109,kt=e.cropEnableZoomTowardsWheelPosition),"cropEnableLimitWheelInputToCropSelection"in e&&o(110,It=e.cropEnableLimitWheelInputToCropSelection),"cropEnableCenterImageSelection"in e&&o(111,At=e.cropEnableCenterImageSelection),"cropEnableButtonRotateLeft"in e&&o(112,Lt=e.cropEnableButtonRotateLeft),"cropEnableButtonRotateRight"in e&&o(113,Ft=e.cropEnableButtonRotateRight),"cropEnableButtonFlipHorizontal"in e&&o(114,zt=e.cropEnableButtonFlipHorizontal),"cropEnableButtonFlipVertical"in e&&o(115,Dt=e.cropEnableButtonFlipVertical),"cropSelectPresetOptions"in e&&o(116,Ot=e.cropSelectPresetOptions),"cropEnableSelectPreset"in e&&o(117,Bt=e.cropEnableSelectPreset),"cropEnableFilterMatchAspectRatio"in e&&o(118,Wt=e.cropEnableFilterMatchAspectRatio),"cropSelectPresetFilter"in e&&o(97,_t=e.cropSelectPresetFilter),"cropEnableButtonToggleCropLimit"in e&&o(119,Vt=e.cropEnableButtonToggleCropLimit),"cropWillRenderTools"in e&&o(120,Nt=e.cropWillRenderTools),"cropWillRenderInfoIndicator"in e&&o(121,Ht=e.cropWillRenderInfoIndicator),"cropActiveTransformTool"in e&&o(122,jt=e.cropActiveTransformTool),"cropMinimizeToolbar"in e&&o(123,Ut=e.cropMinimizeToolbar),"cropInteractionFocus"in e&&o(124,Gt=e.cropInteractionFocus),"cropRotationRange"in e&&o(3,Zt=e.cropRotationRange),"cropMaskOpacity"in e&&o(125,Xt=e.cropMaskOpacity),"locale"in e&&o(4,Yt=e.locale),"cropFormatIconSelectPreset"in e&&o(126,qt=e.cropFormatIconSelectPreset),"cropFormatIconCropBoundary"in e&&o(127,Kt=e.cropFormatIconCropBoundary)},e.$$.update=()=>{8192&e.$$.dirty[0]|1&e.$$.dirty[4]&&to.set("selection"===Gt&&F),8388608&e.$$.dirty[3]&&o(134,i=Ot&&Array.isArray(Ot)&&Ot.length),8388608&e.$$.dirty[3]|1024&e.$$.dirty[4]&&ro.set(i?Ot:[]),8192&e.$$.dirty[0]|1048576&e.$$.dirty[4]&&F&&Eo.set(1,{hard:!z}),8192&e.$$.dirty[0]&&ko.set(!F),8192&e.$$.dirty[0]&&Co.set(!F),8192&e.$$.dirty[0]&&F&&To.set(!0),2097152&e.$$.dirty[4]&&o(129,h="overlay"===D.layoutMode),16777216&e.$$.dirty[3]|32&e.$$.dirty[4]&&o(133,w=Bt&&!h),16384&e.$$.dirty[0]|2&e.$$.dirty[5]&&o(142,l=X&&q&&Ct(X,q)),262144&e.$$.dirty[4]|2&e.$$.dirty[5]&&o(140,c=!(!q||!l)),327680&e.$$.dirty[4]|2&e.$$.dirty[5]&&o(138,d=c&&xt(q,l,e=>ge(e,5))),32784&e.$$.dirty[0]|209190928&e.$$.dirty[3]|2115072&e.$$.dirty[4]|2040&e.$$.dirty[5]&&o(12,n=Oe&&Nt([Lt&&["Button","rotate-left",{label:Yt.cropLabelButtonRotateLeft,labelClass:"PinturaToolbarContentWide",icon:Yt.cropIconButtonRotateLeft,onclick:()=>{ho(-Math.PI/2),mo.write()}}],Ft&&["Button","rotate-right",{label:Yt.cropLabelButtonRotateRight,labelClass:"PinturaToolbarContentWide",icon:Yt.cropIconButtonRotateRight,onclick:()=>{ho(Math.PI/2),mo.write()}}],zt&&["Button","flip-horizontal",{label:Yt.cropLabelButtonFlipHorizontal,labelClass:"PinturaToolbarContentWide",icon:Yt.cropIconButtonFlipHorizontal,onclick:()=>{ne(re)?Er(Lo,ze=!ze,ze):Er(Ao,De=!De,De),mo.write()}}],Dt&&["Button","flip-vertical",{label:Yt.cropLabelButtonFlipVertical,labelClass:"PinturaToolbarContentWide",icon:Yt.cropIconButtonFlipVertical,onclick:()=>{ne(re)?Er(Ao,De=!De,De):Er(Lo,ze=!ze,ze),mo.write()}}],w&&i&&[!1===_t?"Dropdown":$y,"select-preset",{icon:ti(Yt,vi(Le,Fe)),label:bu(Yt.cropLabelSelectPreset,Yt,vi(Le,Fe)),labelClass:"PinturaToolbarContentWide",options:Fe,filter:_t,onfilterchange:lo,selectedIndex:Le,onchange:({value:e})=>{Uo(e)?(Er(Xo,xe=Q(e[0],e[1]),xe),Er(Do,j=Ue(e),j)):Er(Xo,xe=e,xe),d&&$i(),mo.write()},optionMapper:e=>{let t=!1;const o=Uo(e.value)?e.value[0]/e.value[1]:e.value;if(o){const e=Ts(oe,re,o);t=e.width<se.width||e.height<se.height}return e.icon=((e,t={})=>{const{width:o=24,height:i=24,bounds:n=16,radius:r=3}=t;let a,s,l,c,d=Uo(e)?Q(e[0],e[1]):e,u=!!d;return d=u?d:1,l=d>1?n:d*n,c=l/d,a=Math.round(.5*(o-l)),s=Math.round(.5*(i-c)),`<rect fill="${u?"currentColor":"none"}" stroke="${u?"none":"currentColor"}" stroke-width="${o/16}" stroke-dasharray="${[o/12,o/6].join(" ")}" x="${a}" y="${s}" width="${l}" height="${c}" rx="${r}"/>`})(e.value,{bounds:14}),{...e,disabled:t}}}],Vt&&["Dropdown","select-crop-limit",{icon:oi(Yt,ae),label:Yt.cropLabelCropBoundary,labelClass:"PinturaToolbarContentWide",onchange:({value:e})=>{Er(Yo,ae=e,ae),mo.write()},options:[[!0,Yt.cropLabelCropBoundaryEdge,{icon:oi(Yt,!0)}],[!1,Yt.cropLabelCropBoundaryNone,{icon:oi(Yt,!1)}]]}]].filter(Boolean),D,()=>eo.set({})).filter(Boolean)),12288&e.$$.dirty[0]|1073741824&e.$$.dirty[3]|2097184&e.$$.dirty[4]&&Er(Ro,Ee=F&&"never"!==Ut&&("always"===Ut||"short"===D.verticalSpace||h)?n.map(([e,t,o])=>Array.isArray(o)?[e,t,o]:[e,t,{...o,hideLabel:!0}]):[],Ee),16&e.$$.dirty[5]&&o(25,r=ae?0:-1),16384&e.$$.dirty[0]|4&e.$$.dirty[5]&&o(135,a=X&&be(-(K.x-X.x),-(K.y-X.y))),16779264&e.$$.dirty[4]&&o(136,s=V&&a&&be(Kd(V.x+.5*V.width+a.x),Kd(V.y+.5*V.height+a.y))),1&e.$$.dirty[5]&&o(139,u=null!=Y),16384&e.$$.dirty[0]|262144&e.$$.dirty[4]&&o(141,p=X&&l&&(l.height===X.height||l.width===X.width)),1610743808&e.$$.dirty[4]&&o(137,m=!p&&Z<1&&G<1),122880&e.$$.dirty[4]&&o(9,g=c&&!u&&(!d||m)),32768&e.$$.dirty[3]|268435488&e.$$.dirty[4]&&o(11,$=wt&&!!U&&!h),268435456&e.$$.dirty[3]&&o(24,f=!!Ht||void 0),2048&e.$$.dirty[0]|268435456&e.$$.dirty[3]|402653184&e.$$.dirty[4]&&o(23,y=$&&Ht?Ht(U,j):$&&function(e,t){let o={};if(t){const i=e.width/e.height;o=t.width&&!t.height?Ze(t.width,t.width/i):t.height&&!t.width?Ze(t.height*i,t.height):Ne(t)}else o=Ze(e.width,e.height);return`${Math.round(o.width)} &times; ${Math.round(o.height)}`}(U,j)),16779264&e.$$.dirty[4]&&o(8,v=V&&a&&{x:V.x+a.x,y:V.y+a.y,width:V.width,height:V.height}),256&e.$$.dirty[0]|16384&e.$$.dirty[3]|32&e.$$.dirty[4]&&o(22,b=St&&!!v&&!h),262400&e.$$.dirty[3]|67112960&e.$$.dirty[4]&&o(10,x=At&&!!s&&!at&&!H),512&e.$$.dirty[0]|256&e.$$.dirty[3]|33554448&e.$$.dirty[4]&&g&&at&&!N&&(clearTimeout(fi),o(128,fi=setTimeout($i,at))),33554448&e.$$.dirty[4]&&N&&clearTimeout(fi),1536&e.$$.dirty[0]|1048576&e.$$.dirty[4]&&yi.set(x&&g?1:0,{hard:!1===z}),1052672&e.$$.dirty[4]&&bi.set(s,{hard:!1===z}),8192&e.$$.dirty[0]|8388608&e.$$.dirty[4]&&(F&&!W?(Er(Io,_.crop={maskOpacity:Xt,maskMarkupOpacity:Xt},_),Io.set(_)):(delete _.crop,Io.set(_))),4194304&e.$$.dirty[4]&&O&&Jo.update(e=>{const t=e.filter(e=>!/^image\-selection\-guide/.test(e.id));return F?[...t,...O]:t}),2097152&e.$$.dirty[4]&&o(132,S="short"!==D.verticalSpace),1073741824&e.$$.dirty[3]|288&e.$$.dirty[4]&&o(21,k="never"===Ut&&!h||S&&"always"!==Ut),4&e.$$.dirty[0]|4096&e.$$.dirty[3]&&o(131,C=ut&&ft),8192&e.$$.dirty[3]|384&e.$$.dirty[4]&&o(130,T=yt?S&&C:C),2048&e.$$.dirty[3]|64&e.$$.dirty[4]&&o(20,M=dt||T),64&e.$$.dirty[4]&&(T||o(5,Mi=Ti)),32&e.$$.dirty[0]&&o(19,P={name:wi,selected:Mi}),16&e.$$.dirty[0]|2048&e.$$.dirty[3]|64&e.$$.dirty[4]&&o(7,R=[dt&&{id:wi+"-rotation",label:Yt.cropLabelTabRotation},T&&{id:wi+"-zoom",label:Yt.cropLabelTabZoom}].filter(Boolean)),128&e.$$.dirty[0]&&o(18,I=R.map(e=>e.id)),64&e.$$.dirty[0]|32&e.$$.dirty[4]&&Ci&&!Ci.children.length&&h&&Ci.dispatchEvent(new CustomEvent("measure",{detail:Ci.rect})),8192&e.$$.dirty[0]|1048576&e.$$.dirty[4]&&z&&Pi.set(F?0:20),524288&e.$$.dirty[4]&&o(17,E=A?`translateY(${A}px)`:"none")},[tt,it,ut,Zt,Yt,Mi,Ci,R,v,g,x,$,n,F,X,re,ki,E,I,P,M,k,b,y,f,r,ce,Be,We,_e,Ve,He,Ge,Jt,Qt,eo,to,oo,io,ro,go,$o,yo,bo,xo,So,Mo,Po,Ro,Io,Ao,Lo,Fo,zo,Do,Oo,Bo,Wo,_o,Vo,No,Ho,jo,Go,Zo,Xo,Yo,qo,Ko,Qo,()=>{no="select",Er($o,N=!0,N),Er(Bo,Y=rt(q),Y),ii=H?ni:ri},({detail:e})=>{const{boundsLimited:t,boundsIntent:o}=ii(e.direction,e.translation);Er(yo,J=!0,J),Er(Wo,Pe=o,Pe),Er(Oo,q=t,q)},({detail:e})=>{const{boundsLimited:t}=ii(e.direction,e.translation);Er(yo,J=!1,J),Er($o,N=!1,N),Er(Wo,Pe=void 0,Pe),ke(e.translation)&&(Er(Oo,q=t,q),mo.write()),Er(Bo,Y=void 0,Y),no=void 0},()=>{no="rotate",Er($o,N=!0,N),Er(No,ye=rt(U),ye)},e=>{Er(yo,J=!0,J),Er(Fo,re=e,re)},e=>{Er(yo,J=!1,J),Er($o,N=!1,N),Er(Fo,re=e,re),mo.write(),Er(No,ye=void 0,ye)},()=>{no="pan",si=void 0,Er($o,N=!0,N),ai=rt(U)},({detail:e})=>{Er(yo,J=!0,J),li(e)},({detail:e})=>{Er(yo,J=!1,J),Er($o,N=!1,N),(ke(e.translation)>0||0!==e.scalar)&&(li(e),mo.write()),Er(Vo,$e=void 0,$e),ai=void 0},({detail:{translation:e}})=>{H&&(e=Se(ve(e))),si=e,Er($o,N=!1,N)},ci,di,ui,()=>{no="zoom",Er($o,N=!0,N),ai=rt(U)},e=>{Er(yo,J=!1,J),pi(e)},e=>{pi(e),mo.write(),Er(yo,J=!1,J),Er($o,N=!1,N),ai=void 0},()=>{no="zoom",ai||(hi=rt(U),Er($o,N=!0,N))},({detail:e})=>{hi&&(Er(yo,J=!0,J),mi(e))},({detail:e})=>{hi&&(Er(yo,J=!1,J),Er($o,N=!1,N),mi(e),Er(Vo,$e=void 0,$e),hi=void 0,mo.write())},e=>{const t=Mm(e,ce,K);if(It&&!Tt(q,t))return;no="zoom",Er($o,N=!0,N),Er(yo,J=!0,J),e.preventDefault(),e.stopPropagation();const o=Sp(e,{fixScrollDirection:le}),i=1+o/100,n=rt(U),r=1===Math.min(U.width/se.width,U.height/se.height);if(lt&&ae){const e=uo(U,oe,re);if(ao()&&e&&o>0&&d){Er($o,N=!1,N),Er(yo,J=!1,J);const e=ne(re)?st({height:oe.width,width:oe.height}):st(oe);if(xt(n,e))return;if(clearTimeout(gi),xt(mo.state.crop,e))return;return Er(Ho,U=e,U),void mo.write()}}let a=mt(U);if(kt&&"selection"!==Gt&&o<0&&!r){const e=Ie(ve(t),q),o=Math.min(q.width/U.width,q.height/U.height),i=$t(rt(q),1.1);a=Tt(i,t)?Re(rt(U),Ae(e,1/o)):a}let s=$t(rt(U),i,a);if(Je(te[1],s)||(s=pt(mt(s),te[1])),Je(s,te[0])||(s=pt(mt(s),te[0])),xt(n,s,ge))return Er($o,N=!1,N),void Er(yo,J=!1,J);Er(Ho,U=Et(s,e=>ge(e,5)),U),Er($o,N=!1,N),Er(yo,J=!1,J),clearTimeout(gi),gi=setTimeout(()=>{mo.write()},500)},$i,yi,bi,xi,Si,wi,Pi,_t,"crop",ot,nt,at,lt,ct,dt,ft,yt,St,wt,kt,It,At,Lt,Ft,zt,Dt,Ot,Bt,Wt,Vt,Nt,Ht,jt,Ut,Gt,Xt,qt,Kt,fi,h,T,C,S,w,i,a,s,m,d,u,c,p,l,A,z,D,O,W,V,N,H,j,U,G,Z,Y,q,K,oe,ae,se,Le,Fe,ze,De,Oe,function(t){wa.call(this,e,t)},({detail:e})=>o(5,Mi=e),function(e){Ca[e?"unshift":"push"](()=>{Ci=e,o(6,Ci)})},e=>Tm(e),function(e){ki=e,o(16,ki)},function(t){wa.call(this,e,t)}]}var By={util:["crop",class extends rs{constructor(e){super(),ns(this,e,Oy,Ly,yr,{name:98,isActive:0,stores:99,cropImageSelectionCornerStyle:1,cropWillRenderImageSelectionGuides:100,cropAutoCenterImageSelectionTimeout:101,cropEnableZoomMatchImageAspectRatio:102,cropEnableRotateMatchImageAspectRatio:103,cropEnableRotationInput:104,cropEnableZoom:2,cropEnableZoomInput:105,cropEnableZoomAutoHide:106,cropEnableImageSelection:107,cropEnableInfoIndicator:108,cropEnableZoomTowardsWheelPosition:109,cropEnableLimitWheelInputToCropSelection:110,cropEnableCenterImageSelection:111,cropEnableButtonRotateLeft:112,cropEnableButtonRotateRight:113,cropEnableButtonFlipHorizontal:114,cropEnableButtonFlipVertical:115,cropSelectPresetOptions:116,cropEnableSelectPreset:117,cropEnableFilterMatchAspectRatio:118,cropSelectPresetFilter:97,cropEnableButtonToggleCropLimit:119,cropWillRenderTools:120,cropWillRenderInfoIndicator:121,cropActiveTransformTool:122,cropMinimizeToolbar:123,cropInteractionFocus:124,cropRotationRange:3,cropMaskOpacity:125,locale:4,cropFormatIconSelectPreset:126,cropFormatIconCropBoundary:127},null,[-1,-1,-1,-1,-1,-1,-1,-1])}get name(){return this.$$.ctx[98]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get stores(){return this.$$.ctx[99]}set stores(e){this.$$set({stores:e}),Oa()}get cropImageSelectionCornerStyle(){return this.$$.ctx[1]}set cropImageSelectionCornerStyle(e){this.$$set({cropImageSelectionCornerStyle:e}),Oa()}get cropWillRenderImageSelectionGuides(){return this.$$.ctx[100]}set cropWillRenderImageSelectionGuides(e){this.$$set({cropWillRenderImageSelectionGuides:e}),Oa()}get cropAutoCenterImageSelectionTimeout(){return this.$$.ctx[101]}set cropAutoCenterImageSelectionTimeout(e){this.$$set({cropAutoCenterImageSelectionTimeout:e}),Oa()}get cropEnableZoomMatchImageAspectRatio(){return this.$$.ctx[102]}set cropEnableZoomMatchImageAspectRatio(e){this.$$set({cropEnableZoomMatchImageAspectRatio:e}),Oa()}get cropEnableRotateMatchImageAspectRatio(){return this.$$.ctx[103]}set cropEnableRotateMatchImageAspectRatio(e){this.$$set({cropEnableRotateMatchImageAspectRatio:e}),Oa()}get cropEnableRotationInput(){return this.$$.ctx[104]}set cropEnableRotationInput(e){this.$$set({cropEnableRotationInput:e}),Oa()}get cropEnableZoom(){return this.$$.ctx[2]}set cropEnableZoom(e){this.$$set({cropEnableZoom:e}),Oa()}get cropEnableZoomInput(){return this.$$.ctx[105]}set cropEnableZoomInput(e){this.$$set({cropEnableZoomInput:e}),Oa()}get cropEnableZoomAutoHide(){return this.$$.ctx[106]}set cropEnableZoomAutoHide(e){this.$$set({cropEnableZoomAutoHide:e}),Oa()}get cropEnableImageSelection(){return this.$$.ctx[107]}set cropEnableImageSelection(e){this.$$set({cropEnableImageSelection:e}),Oa()}get cropEnableInfoIndicator(){return this.$$.ctx[108]}set cropEnableInfoIndicator(e){this.$$set({cropEnableInfoIndicator:e}),Oa()}get cropEnableZoomTowardsWheelPosition(){return this.$$.ctx[109]}set cropEnableZoomTowardsWheelPosition(e){this.$$set({cropEnableZoomTowardsWheelPosition:e}),Oa()}get cropEnableLimitWheelInputToCropSelection(){return this.$$.ctx[110]}set cropEnableLimitWheelInputToCropSelection(e){this.$$set({cropEnableLimitWheelInputToCropSelection:e}),Oa()}get cropEnableCenterImageSelection(){return this.$$.ctx[111]}set cropEnableCenterImageSelection(e){this.$$set({cropEnableCenterImageSelection:e}),Oa()}get cropEnableButtonRotateLeft(){return this.$$.ctx[112]}set cropEnableButtonRotateLeft(e){this.$$set({cropEnableButtonRotateLeft:e}),Oa()}get cropEnableButtonRotateRight(){return this.$$.ctx[113]}set cropEnableButtonRotateRight(e){this.$$set({cropEnableButtonRotateRight:e}),Oa()}get cropEnableButtonFlipHorizontal(){return this.$$.ctx[114]}set cropEnableButtonFlipHorizontal(e){this.$$set({cropEnableButtonFlipHorizontal:e}),Oa()}get cropEnableButtonFlipVertical(){return this.$$.ctx[115]}set cropEnableButtonFlipVertical(e){this.$$set({cropEnableButtonFlipVertical:e}),Oa()}get cropSelectPresetOptions(){return this.$$.ctx[116]}set cropSelectPresetOptions(e){this.$$set({cropSelectPresetOptions:e}),Oa()}get cropEnableSelectPreset(){return this.$$.ctx[117]}set cropEnableSelectPreset(e){this.$$set({cropEnableSelectPreset:e}),Oa()}get cropEnableFilterMatchAspectRatio(){return this.$$.ctx[118]}set cropEnableFilterMatchAspectRatio(e){this.$$set({cropEnableFilterMatchAspectRatio:e}),Oa()}get cropSelectPresetFilter(){return this.$$.ctx[97]}set cropSelectPresetFilter(e){this.$$set({cropSelectPresetFilter:e}),Oa()}get cropEnableButtonToggleCropLimit(){return this.$$.ctx[119]}set cropEnableButtonToggleCropLimit(e){this.$$set({cropEnableButtonToggleCropLimit:e}),Oa()}get cropWillRenderTools(){return this.$$.ctx[120]}set cropWillRenderTools(e){this.$$set({cropWillRenderTools:e}),Oa()}get cropWillRenderInfoIndicator(){return this.$$.ctx[121]}set cropWillRenderInfoIndicator(e){this.$$set({cropWillRenderInfoIndicator:e}),Oa()}get cropActiveTransformTool(){return this.$$.ctx[122]}set cropActiveTransformTool(e){this.$$set({cropActiveTransformTool:e}),Oa()}get cropMinimizeToolbar(){return this.$$.ctx[123]}set cropMinimizeToolbar(e){this.$$set({cropMinimizeToolbar:e}),Oa()}get cropInteractionFocus(){return this.$$.ctx[124]}set cropInteractionFocus(e){this.$$set({cropInteractionFocus:e}),Oa()}get cropRotationRange(){return this.$$.ctx[3]}set cropRotationRange(e){this.$$set({cropRotationRange:e}),Oa()}get cropMaskOpacity(){return this.$$.ctx[125]}set cropMaskOpacity(e){this.$$set({cropMaskOpacity:e}),Oa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),Oa()}get cropFormatIconSelectPreset(){return this.$$.ctx[126]}set cropFormatIconSelectPreset(e){this.$$set({cropFormatIconSelectPreset:e}),Oa()}get cropFormatIconCropBoundary(){return this.$$.ctx[127]}set cropFormatIconCropBoundary(e){this.$$set({cropFormatIconCropBoundary:e}),Oa()}}]};function Wy(e){let t,o,i,n,r,a,s,l=e[77],c=(L(e[77].label)?e[77].label(e[2]):e[77].label)+"";function d(...t){return e[51](e[77],...t)}const u=()=>e[52](o,l),p=()=>e[52](null,l);return{c(){t=Ur("div"),o=Ur("div"),i=Xr(),n=Ur("span"),r=Zr(c),Qr(o,"class",Hy),Qr(t,"slot","option"),Qr(t,"class","PinturaFilterOption")},m(e,l){Hr(e,t,l),_r(t,o),u(),_r(t,i),_r(t,n),_r(n,r),a||(s=[qr(o,"measure",d),Ar(qc.call(null,o))],a=!0)},p(t,o){l!==(e=t)[77]&&(p(),l=e[77],u()),4&o[0]|32768&o[2]&&c!==(c=(L(e[77].label)?e[77].label(e[2]):e[77].label)+"")&&na(r,c)},d(e){e&&jr(t),p(),a=!1,$r(s)}}}function _y(e){let t,o;return t=new Xu({props:{locale:e[2],layout:"row",options:e[3],selectedIndex:e[12],onchange:e[32],$$slots:{option:[Wy,({option:e})=>({77:e}),({option:e})=>[0,0,e?32768:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};4&o[0]&&(i.locale=e[2]),8&o[0]&&(i.options=e[3]),4096&o[0]&&(i.selectedIndex=e[12]),1028&o[0]|98304&o[2]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Vy(e){let t,o,i,n,r,a,s,l;function c(t){e[54](t)}function d(t){e[55](t)}function u(t){e[56](t)}let p={elasticity:e[13]*e[19],onscroll:e[53],$$slots:{default:[_y]},$$scope:{ctx:e}};return void 0!==e[4]&&(p.maskFeatherStartOpacity=e[4]),void 0!==e[5]&&(p.maskFeatherEndOpacity=e[5]),void 0!==e[6]&&(p.maskFeatherSize=e[6]),o=new Gh({props:p}),Ca.push(()=>es(o,"maskFeatherStartOpacity",c)),Ca.push(()=>es(o,"maskFeatherEndOpacity",d)),Ca.push(()=>es(o,"maskFeatherSize",u)),o.$on("measure",e[57]),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"slot","footer"),aa(t,"transform",e[11])},m(i,n){Hr(i,t,n),os(o,t,null),a=!0,s||(l=[qr(t,"transitionend",e[30]),qr(t,"measure",e[58]),Ar(qc.call(null,t,{observePosition:!0}))],s=!0)},p(e,a){const s={};8192&a[0]&&(s.elasticity=e[13]*e[19]),128&a[0]&&(s.onscroll=e[53]),5132&a[0]|65536&a[2]&&(s.$$scope={dirty:a,ctx:e}),!i&&16&a[0]&&(i=!0,s.maskFeatherStartOpacity=e[4],La(()=>i=!1)),!n&&32&a[0]&&(n=!0,s.maskFeatherEndOpacity=e[5],La(()=>n=!1)),!r&&64&a[0]&&(r=!0,s.maskFeatherSize=e[6],La(()=>r=!1)),o.$set(s),2048&a[0]&&aa(t,"transform",e[11])},i(e){a||(ja(o.$$.fragment,e),a=!0)},o(e){Ua(o.$$.fragment,e),a=!1},d(e){e&&jr(t),is(o),s=!1,$r(l)}}}function Ny(e){let t,o;return t=new Nf({props:{$$slots:{footer:[Vy]},$$scope:{ctx:e}}}),t.$on("measure",e[59]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16380&o[0]|65536&o[2]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}let Hy="PinturaFilterPreview";function jy(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w=ur,k=()=>(w(),w=vr(P,e=>o(43,d=e)),P),C=ur,T=()=>(C(),C=vr(M,e=>o(49,b=e)),M);e.$$.on_destroy.push(()=>w()),e.$$.on_destroy.push(()=>C());let{isActive:M}=t;T();let{isActiveFraction:P}=t;k();let{stores:R}=t,{locale:I}=t,{filterFunctions:E}=t,{filterOptions:A}=t;const F=Sa("elasticityMultiplier");wr(e,F,e=>o(13,S=e));const{history:z,interfaceImages:D,stageRectBase:O,utilRect:B,animation:W,scrollElasticity:_,imageSize:V,imagePreview:N,imageCropRect:H,imageRotation:j,imageFlipX:U,imageFlipY:G,imageBackgroundColor:Z,imageGamma:X,imageColorMatrix:Y,allowPan:q,allowZoom:K,allowZoomControls:J,allowPlayPause:Q}=R;wr(e,D,e=>o(60,u=e)),wr(e,O,e=>o(48,y=e)),wr(e,B,e=>o(47,f=e)),wr(e,W,e=>o(50,x=e)),wr(e,V,e=>o(62,h=e)),wr(e,N,e=>o(42,c=e)),wr(e,Z,e=>o(61,p=e)),wr(e,X,e=>o(44,m=e)),wr(e,Y,e=>o(40,s=e));const ee=ls({});wr(e,ee,e=>o(46,$=e));const te=(e,t)=>Er(ee,$[e.value]=t,$),oe=cs(ee,e=>{if(!e[void 0])return;const t=e[void 0];return v&&Xe(v,t)?v:Ne(t)});wr(e,oe,e=>o(63,v=e));const ie=cs([M,oe,H,V,j,U,G],([e,t,o,i,n,r,a],s)=>{if(!e||!t||!i)return g;const l=st(i),c=mt(l),d=Ps(i,o,n),u=mt(d),p=Ie(ve(c),u),h=Se(ve(p)),m=Math.max(t.width/o.width,t.height/o.height);s({origin:h,translation:p,rotation:{x:a?Math.PI:0,y:r?Math.PI:0,z:n},scale:m})});wr(e,ie,e=>o(45,g=e));const ne=Fc(x?20:0);let re;wr(e,ne,e=>o(39,a=e));const ae={};let se,le,ce,de,ue,pe,he={x:0,y:0};const me=ls([]);wr(e,me,e=>o(41,l=e));const ge=e=>{const t={...e,data:c,size:h,offset:{...e.offset},mask:{...e.mask},backgroundColor:p};return t.opacity=d,t.offset.y+=a,t.mask.y+=a,t.id="filter",t},$e=()=>u.filter(e=>"filter"!==e.id);ba(()=>{D.set([])});return e.$$set=e=>{"isActive"in e&&T(o(0,M=e.isActive)),"isActiveFraction"in e&&k(o(1,P=e.isActiveFraction)),"stores"in e&&o(34,R=e.stores),"locale"in e&&o(2,I=e.locale),"filterFunctions"in e&&o(35,E=e.filterFunctions),"filterOptions"in e&&o(3,A=e.filterOptions)},e.$$.update=()=>{if(262144&e.$$.dirty[1]&&q.set(b),262144&e.$$.dirty[1]&&K.set(b),262144&e.$$.dirty[1]&&J.set(b),262144&e.$$.dirty[1]&&b&&Q.set(!1),8&e.$$.dirty[0]&&o(38,i=fu(A)),640&e.$$.dirty[1]&&o(12,n=((e,t)=>{if(!e||!e.filter||!t)return 0;const o=e.filter;return t.findIndex(([e])=>{if(!E[e])return!1;const t=E[e]();return Fs(t,o)})})(s,i)),786432&e.$$.dirty[1]&&x&&ne.set(b?0:20),512&e.$$.dirty[0]|458752&e.$$.dirty[1]&&b&&f&&y&&pe&&o(37,ue={x:y.x-f.x,y:y.y-f.y+pe.y}),496&e.$$.dirty[0]|58096&e.$$.dirty[1]&&g&&ue&&he&&de&&re){const e=ue.x+de.x+he.x,t=ue.y,o=de.x+ue.x,n=o+de.width;me.set(i.map(([i],r)=>{const a=$[i],l=he.x+a.x,c=l+a.width;if(c<0||l>de.width)return!1;const d=e+a.x,u=t+a.y,p=(e=>({origin:ve(e.origin),translation:ve(e.translation),rotation:{...e.rotation},scale:e.scale}))(g);p.offset=be(.5*a.width+d,.5*a.height+u);p.maskOpacity=1,p.mask=ht(d+0,u,a.width+0,a.height),p.maskFeather=[1,0,1,0,1,n,1,n],l<ce&&se<1&&(p.maskFeather[0]=se,p.maskFeather[1]=o,p.maskFeather[2]=1,p.maskFeather[3]=o+ce),c>de.width-ce&&le<1&&(p.maskFeather[4]=le,p.maskFeather[5]=n-ce,p.maskFeather[6]=1,p.maskFeather[7]=n),p.maskCornerRadius=re[i];let h=s&&Object.keys(s).filter(e=>"filter"!=e).map(e=>s[e])||[];return L(E[i])&&h.push(E[i]()),p.colorMatrix=h.length?cr(h):void 0,p.gamma=m,p}).filter(Boolean))}if(7424&e.$$.dirty[1])if(d>0&&l){const e=[...$e(),...l.map(ge)];D.set(e)}else D.set($e());256&e.$$.dirty[1]&&o(11,r=a?`translateY(${a}px)`:"none")},[M,P,I,A,se,le,ce,he,de,pe,ae,r,n,S,F,D,O,B,W,_,V,N,Z,X,Y,ee,te,oe,ie,ne,e=>{e.target.className===Hy&&o(36,re=Object.keys(ae).reduce((e,t)=>{const o=ae[t],i=getComputedStyle(o),n=["top-left","top-right","bottom-left","bottom-right"].map(e=>i.getPropertyValue(`border-${e}-radius`)).map(Hh).map(e=>1.25*e);return e[t]=n,e},{}))},me,({value:e})=>{Er(Y,s={...s,filter:L(E[e])?E[e]():void 0},s),z.write()},"filter",R,E,re,ue,i,a,s,l,c,d,m,g,$,f,y,b,x,(e,t)=>te(e,t.detail),function(e,t){Ca[e?"unshift":"push"](()=>{ae[t.value]=e,o(10,ae)})},e=>o(7,he=e),function(e){se=e,o(4,se)},function(e){le=e,o(5,le)},function(e){ce=e,o(6,ce)},e=>o(8,de=e.detail),e=>o(9,pe=e.detail),function(t){wa.call(this,e,t)}]}var Uy={util:["filter",class extends rs{constructor(e){super(),ns(this,e,jy,Ny,yr,{name:33,isActive:0,isActiveFraction:1,stores:34,locale:2,filterFunctions:35,filterOptions:3},null,[-1,-1,-1])}get name(){return this.$$.ctx[33]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get stores(){return this.$$.ctx[34]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[2]}set locale(e){this.$$set({locale:e}),Oa()}get filterFunctions(){return this.$$.ctx[35]}set filterFunctions(e){this.$$set({filterFunctions:e}),Oa()}get filterOptions(){return this.$$.ctx[3]}set filterOptions(e){this.$$set({filterOptions:e}),Oa()}}]};function Gy(e){let t,o,i,n;t=new Gh({props:{elasticity:e[6]*e[9],class:"PinturaControlListScroller",$$slots:{default:[Xy]},$$scope:{ctx:e}}});const r=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[4]},e[5]];let a={$$slots:{default:[Yy,({panel:e})=>({44:e}),({panel:e})=>[0,e?8192:0]]},$$scope:{ctx:e}};for(let e=0;e<r.length;e+=1)a=hr(a,r[e]);return i=new Rd({props:a}),{c(){ts(t.$$.fragment),o=Xr(),ts(i.$$.fragment)},m(e,r){os(t,e,r),Hr(e,o,r),os(i,e,r),n=!0},p(e,o){const n={};64&o[0]&&(n.elasticity=e[6]*e[9]),38&o[0]|32768&o[1]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n);const a=48&o[0]?Ja(r,[r[0],r[1],16&o[0]&&{panels:e[4]},32&o[0]&&Qa(e[5])]):{};128&o[0]|40960&o[1]&&(a.$$scope={dirty:o,ctx:e}),i.$set(a)},i(e){n||(ja(t.$$.fragment,e),ja(i.$$.fragment,e),n=!0)},o(e){Ua(t.$$.fragment,e),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(t,e),is(i,e)}}}function Zy(e){let t,o,i=e[45].label+"";return{c(){t=Ur("span"),o=Zr(i)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){16384&t[1]&&i!==(i=e[45].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function Xy(e){let t,o;const i=[{class:"PinturaControlList"},{tabs:e[1]},e[5]];let n={$$slots:{default:[Zy,({tab:e})=>({45:e}),({tab:e})=>[0,e?16384:0]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new $d({props:n}),t.$on("select",e[24]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=34&o[0]?Ja(i,[i[0],2&o[0]&&{tabs:e[1]},32&o[0]&&Qa(e[5])]):{};49152&o[1]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Yy(e){let t,o;const i=[e[7][e[44]]];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Gf({props:n}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=128&o[0]|8192&o[1]?Ja(i,[Qa(e[7][e[44]])]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function qy(e){let t,o,i=e[5]&&Gy(e);return{c(){t=Ur("div"),i&&i.c(),Qr(t,"slot","footer"),aa(t,"transform",e[3])},m(e,n){Hr(e,t,n),i&&i.m(t,null),o=!0},p(e,o){e[5]?i?(i.p(e,o),32&o[0]&&ja(i,1)):(i=Gy(e),i.c(),ja(i,1),i.m(t,null)):i&&(Na(),Ua(i,1,1,()=>{i=null}),Ha()),8&o[0]&&aa(t,"transform",e[3])},i(e){o||(ja(i),o=!0)},o(e){Ua(i),o=!1},d(e){e&&jr(t),i&&i.d()}}}function Ky(e){let t,o;return t=new Nf({props:{$$slots:{footer:[qy]},$$scope:{ctx:e}}}),t.$on("measure",e[25]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};254&o[0]|32768&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Jy(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g=ur,$=()=>(g(),g=vr(y,e=>o(21,d=e)),y);e.$$.on_destroy.push(()=>g());let{stores:f}=t,{isActive:y}=t;$();let{locale:b={}}=t,{finetuneControlConfiguration:x}=t,{finetuneOptions:v}=t,{finetuneNudgePrecision:S}=t;const{history:w,animation:k,scrollElasticity:C,rangeInputElasticity:T,imageColorMatrix:M,imageConvolutionMatrix:P,imageGamma:R,imageVignette:I,imageNoise:E,allowPan:A,allowZoom:F,allowZoomControls:z,allowPlayPause:D}=f;wr(e,k,e=>o(22,u=e));const O={imageColorMatrix:M,imageConvolutionMatrix:P,imageGamma:R,imageVignette:I,imageNoise:E},W=Sa("elasticityMultiplier");wr(e,W,e=>o(6,h=e));const _=`finetune-${B()}`,V=ls({});wr(e,V,e=>o(23,p=e));const N=ls({});wr(e,N,e=>o(7,m=e));const H=(e,t)=>{e.update(e=>{const o={};return t.forEach(t=>{e[t]&&(o[t]=e[t])}),o})};let j=[];const U=Fc(u?20:0);wr(e,U,e=>o(20,c=e));return e.$$set=e=>{"stores"in e&&o(15,f=e.stores),"isActive"in e&&$(o(0,y=e.isActive)),"locale"in e&&o(16,b=e.locale),"finetuneControlConfiguration"in e&&o(17,x=e.finetuneControlConfiguration),"finetuneOptions"in e&&o(18,v=e.finetuneOptions),"finetuneNudgePrecision"in e&&o(19,S=e.finetuneNudgePrecision)},e.$$.update=()=>{var t;2097152&e.$$.dirty[0]&&A.set(d),2097152&e.$$.dirty[0]&&F.set(d),2097152&e.$$.dirty[0]&&z.set(d),2097152&e.$$.dirty[0]&&d&&D.set(!0),327680&e.$$.dirty[0]&&o(1,i=v?v.map(([e,t])=>({id:e,label:L(t)?t(b):t})):[]),2&e.$$.dirty[0]&&o(2,n=i.length?i[0].id:void 0),4&e.$$.dirty[0]&&o(5,r=n&&{name:_,selected:n}),2&e.$$.dirty[0]&&o(4,a=i.map(e=>e.id)),131072&e.$$.dirty[0]&&(s=[...Object.keys(x||{}),"filter"]),131072&e.$$.dirty[0]&&x&&(t=x,j&&j.forEach(e=>e()),j=a.map(e=>{const{getStore:o,getValue:i=ee}=t[e];return o(O).subscribe(t=>{const o=null!=t?i(t):t;Er(V,p={...p,[e]:o},p)})})),8519680&e.$$.dirty[0]&&x&&p&&Er(N,m=Object.keys(p).reduce((e,t)=>{const{base:o,min:i,max:n,getLabel:r,getStore:a,setValue:l=(e,t)=>e.set(t)}=x[t],c=a(O),d=null!=p[t]?p[t]:o;return e[t]={base:o,min:i,max:n,value:d,valueLabel:r?r(d,i,n,n-i):Math.round(100*d),oninputmove:e=>{l(c,e),c===M&&H(c,s)},oninputend:e=>{l(c,e),c===M&&H(c,s),w.write()},elasticity:h*T,labelReset:b.labelReset,nudgeMultiplier:S},e},{}),m),6291456&e.$$.dirty[0]&&u&&U.set(d?0:20),1048576&e.$$.dirty[0]&&o(3,l=c?`translateY(${c}px)`:"none")},[y,i,n,l,a,r,h,m,k,C,W,V,N,U,"finetune",f,b,x,v,S,c,d,u,p,({detail:e})=>o(2,n=e),function(t){wa.call(this,e,t)}]}var Qy={util:["finetune",class extends rs{constructor(e){super(),ns(this,e,Jy,Ky,yr,{name:14,stores:15,isActive:0,locale:16,finetuneControlConfiguration:17,finetuneOptions:18,finetuneNudgePrecision:19},null,[-1,-1])}get name(){return this.$$.ctx[14]}get stores(){return this.$$.ctx[15]}set stores(e){this.$$set({stores:e}),Oa()}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get locale(){return this.$$.ctx[16]}set locale(e){this.$$set({locale:e}),Oa()}get finetuneControlConfiguration(){return this.$$.ctx[17]}set finetuneControlConfiguration(e){this.$$set({finetuneControlConfiguration:e}),Oa()}get finetuneOptions(){return this.$$.ctx[18]}set finetuneOptions(e){this.$$set({finetuneOptions:e}),Oa()}get finetuneNudgePrecision(){return this.$$.ctx[19]}set finetuneNudgePrecision(e){this.$$set({finetuneNudgePrecision:e}),Oa()}}]},eb=(e,t)=>{const o=t.length;return e<0?e%o+o:e>=o?e%o:e};function tb(e,t,o){const i=e.slice();return i[51]=t[o].key,i[52]=t[o].index,i[53]=t[o].translate,i[16]=t[o].scale,i[54]=t[o].selected,i[15]=t[o].rotate,i[55]=t[o].dir,i[56]=t[o].center,i[57]=t[o].type,i[4]=t[o].visible,i[58]=t[o].role,i[59]=t[o].tabindex,i[60]=t[o].label,i[61]=t[o].orientation,i[62]=t[o].valuemin,i[63]=t[o].valuemax,i[64]=t[o].valuenow,i}function ob(e){let t;return{c(){t=Ur("div"),Qr(t,"class","PinturaShapeManipulator"),Qr(t,"data-control","point"),aa(t,"pointer-events","none"),aa(t,"opacity",e[6]),aa(t,"transform",`translate3d(${e[56].x}px, ${e[56].y}px, 0) scale(${e[7]}, ${e[7]})`)},m(e,o){Hr(e,t,o)},p(e,o){64&o[0]&&aa(t,"opacity",e[6]),160&o[0]&&aa(t,"transform",`translate3d(${e[56].x}px, ${e[56].y}px, 0) scale(${e[7]}, ${e[7]})`)},d(e){e&&jr(t)}}}function ib(e,t){let o,i,n,r,a,s,l,c,d,u,p,h,m,g;function $(...e){return t[23](t[52],...e)}let f="edge"===t[57]&&t[4]&&ob(t);return{key:e,first:null,c(){o=Ur("div"),p=Xr(),f&&f.c(),h=Yr(),Qr(o,"role",i=t[58]),Qr(o,"tabindex",n=t[59]),Qr(o,"aria-label",r=t[60]),Qr(o,"aria-orientation",a=t[61]),Qr(o,"aria-valuemin",s=t[62]),Qr(o,"aria-valuemax",l=t[63]),Qr(o,"aria-valuenow",c=t[64]),Qr(o,"class","PinturaShapeManipulator"),Qr(o,"data-control",d=t[57]),Qr(o,"data-selected",u=t[54]),aa(o,"cursor",t[55]?t[55]+"-resize":"move"),aa(o,"opacity",t[6]),aa(o,"--tx",t[53].x),aa(o,"--ty",t[53].y),aa(o,"--r",`${"edge"===t[57]?t[15]:0}rad`),aa(o,"--sx","point"===t[57]?t[7]:t[16].x),aa(o,"--sy","point"===t[57]?t[7]:t[16].y),this.first=o},m(e,i){Hr(e,o,i),Hr(e,p,i),f&&f.m(e,i),Hr(e,h,i),m||(g=[qr(o,"nudge",$),Ar(xp.call(null,o,{preventDefault:!0})),qr(o,"interactionstart",function(){fr(t[11]("start",t[52]))&&t[11]("start",t[52]).apply(this,arguments)}),qr(o,"interactionupdate",function(){fr(t[11]("move",t[52]))&&t[11]("move",t[52]).apply(this,arguments)}),qr(o,"interactionend",function(){fr(t[11]("end",t[52]))&&t[11]("end",t[52]).apply(this,arguments)}),Ar(Wh.call(null,o,{observeKeys:!0}))],m=!0)},p(e,p){t=e,32&p[0]&&i!==(i=t[58])&&Qr(o,"role",i),32&p[0]&&n!==(n=t[59])&&Qr(o,"tabindex",n),32&p[0]&&r!==(r=t[60])&&Qr(o,"aria-label",r),32&p[0]&&a!==(a=t[61])&&Qr(o,"aria-orientation",a),32&p[0]&&s!==(s=t[62])&&Qr(o,"aria-valuemin",s),32&p[0]&&l!==(l=t[63])&&Qr(o,"aria-valuemax",l),32&p[0]&&c!==(c=t[64])&&Qr(o,"aria-valuenow",c),32&p[0]&&d!==(d=t[57])&&Qr(o,"data-control",d),32&p[0]&&u!==(u=t[54])&&Qr(o,"data-selected",u),32&p[0]&&aa(o,"cursor",t[55]?t[55]+"-resize":"move"),64&p[0]&&aa(o,"opacity",t[6]),32&p[0]&&aa(o,"--tx",t[53].x),32&p[0]&&aa(o,"--ty",t[53].y),32&p[0]&&aa(o,"--r",`${"edge"===t[57]?t[15]:0}rad`),160&p[0]&&aa(o,"--sx","point"===t[57]?t[7]:t[16].x),160&p[0]&&aa(o,"--sy","point"===t[57]?t[7]:t[16].y),"edge"===t[57]&&t[4]?f?f.p(t,p):(f=ob(t),f.c(),f.m(h.parentNode,h)):f&&(f.d(1),f=null)},d(e){e&&(jr(o),jr(p),jr(h)),f&&f.d(e),m=!1,$r(g)}}}function nb(e){let t,o,i;return{c(){t=Ur("div"),Qr(t,"role","button"),Qr(t,"aria-label","Drag rotator"),Qr(t,"tabindex","0"),Qr(t,"class","PinturaShapeManipulator"),Qr(t,"data-control","rotate"),aa(t,"transform",`translate3d(${e[0].x}px, ${e[0].y}px, 0) scale(${e[7]}, ${e[7]})`),aa(t,"opacity",e[6])},m(n,r){Hr(n,t,r),o||(i=[qr(t,"nudge",e[13]),Ar(xp.call(null,t,{preventDefault:!0})),qr(t,"interactionstart",e[15]("start")),qr(t,"interactionupdate",e[15]("move")),qr(t,"interactionend",e[15]("end")),Ar(Wh.call(null,t,{observeKeys:!0}))],o=!0)},p(e,o){129&o[0]&&aa(t,"transform",`translate3d(${e[0].x}px, ${e[0].y}px, 0) scale(${e[7]}, ${e[7]})`),64&o[0]&&aa(t,"opacity",e[6])},d(e){e&&jr(t),o=!1,$r(i)}}}function rb(e){let t,o,i;return{c(){t=Ur("div"),Qr(t,"role","button"),Qr(t,"aria-label","Drag scalar"),Qr(t,"tabindex","0"),Qr(t,"class","PinturaShapeManipulator"),Qr(t,"data-control","scale"),aa(t,"transform",`translate3d(${e[1].x}px, ${e[1].y}px, 0) scale(${e[7]}, ${e[7]})`),aa(t,"opacity",e[6])},m(n,r){Hr(n,t,r),o||(i=[qr(t,"nudge",e[14]),Ar(xp.call(null,t,{preventDefault:!0})),qr(t,"interactionstart",e[16]("start")),qr(t,"interactionupdate",e[16]("move")),qr(t,"interactionend",e[16]("end")),Ar(Wh.call(null,t,{observeKeys:!0}))],o=!0)},p(e,o){130&o[0]&&aa(t,"transform",`translate3d(${e[1].x}px, ${e[1].y}px, 0) scale(${e[7]}, ${e[7]})`),64&o[0]&&aa(t,"opacity",e[6])},d(e){e&&jr(t),o=!1,$r(i)}}}function ab(e){let t,o,i,n=[],r=new Map,a=Xa(e[5]);const s=e=>e[51];for(let t=0;t<a.length;t+=1){let o=tb(e,a,t),i=s(o);r.set(i,n[t]=ib(i,o))}let l=e[2]&&e[0]&&nb(e),c=e[3]&&e[1]&&rb(e);return{c(){for(let e=0;e<n.length;e+=1)n[e].c();t=Xr(),l&&l.c(),o=Xr(),c&&c.c(),i=Yr()},m(e,r){for(let t=0;t<n.length;t+=1)n[t]&&n[t].m(e,r);Hr(e,t,r),l&&l.m(e,r),Hr(e,o,r),c&&c.m(e,r),Hr(e,i,r)},p(e,d){6368&d[0]&&(a=Xa(e[5]),n=Ka(n,d,s,1,e,a,r,t.parentNode,Ya,ib,t,tb)),e[2]&&e[0]?l?l.p(e,d):(l=nb(e),l.c(),l.m(o.parentNode,o)):l&&(l.d(1),l=null),e[3]&&e[1]?c?c.p(e,d):(c=rb(e),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null)},i:ur,o:ur,d(e){e&&(jr(t),jr(o),jr(i));for(let t=0;t<n.length;t+=1)n[t].d(e);l&&l.d(e),c&&c.d(e)}}}function sb(e,t,o){let i,n,r,a;const s=xa(),l=.5*ie,c=oe-l,d=oe+l,u=-oe,p=u-l,h=u+l,m=te-l,g=-te+l,$=l,f=-l,y=oe-ie,b=y-l,x=y+l,v=te-ie,S=v-l,w=v+l,k=u-ie,C=k+l,T=k-l,M=u+ie,P=M+l,R=M-l;let{visible:I=!1}=t,{points:E=[]}=t,{rotatorPoint:A}=t,{bounds:L=null}=t,{scalarPoint:F}=t,{selectedPoint:z}=t,{enableDragEdges:D=!0}=t,{enableDragPoints:O=!0}=t,{enableRotatePoints:B=!0}=t,{enableScalePoints:W=!0}=t;const _=Sa("isAnimated");wr(e,_,e=>o(22,n=e));const V=Fc(.5,{precision:1e-4,stiffness:.3,damping:.7});wr(e,V,e=>o(7,a=e));const N=Fc(0,{precision:.001,stiffness:.3,damping:.7});wr(e,N,e=>o(6,r=e));const H=e=>{let t="";return(e<=d&&e>=c||e>=p&&e<=h)&&(t="ns"),(e<=g||e>=m||e>=f&&e<=$)&&(t="ew"),(e>=S&&e<=w||e<=P&&e>=R)&&(t="nesw"),(e>=b&&e<=x||e<=C&&e>=T)&&(t="nwse"),t},j=(e,t)=>{let o=0;const i=Be(e),n=[],r=e.length,[a,s,l,c]=e.reduce(([e,t,o,i],{x:n,y:r})=>(i=Math.min(i,n),t=Math.max(t,n),[e=Math.min(e,r),t,o=Math.max(o,r),i]),[1/0,-1/0,-1/0,1/0]);for(;o<r;o++){const t=eb(o-1,e),r=eb(o+1,e),d=e[t],u=e[o],p=e[r],h=Math.atan2(p.y-u.y,p.x-u.x);if(O){const e=Ce(be(d.x-u.x,d.y-u.y)),t=Ce(be(p.x-u.x,p.y-u.y)),i=be(e.x+t.x,e.y+t.y),r=D?O&&H(Math.atan2(i.y,i.x)):void 0;n.push({index:[o],key:`point-${o}`,type:"point",selected:z===o,scale:{x:1,y:1},translate:{x:u.x,y:u.y},angle:void 0,rotate:B,center:u,dir:r})}if(!D)continue;if(Array.isArray(D)&&!D.some(([e,t])=>o===e&&r===t))continue;const m=be(u.x+.5*(p.x-u.x),u.y+.5*(p.y-u.y)),g=["t","r","b","l"][o];let $,f,y;"l"===g&&($=L.x,f=s,y=c),"t"===g&&($=L.y,f=l,y=a),"r"===g&&($=c,f=L.width,y=s),"b"===g&&($=a,f=L.height,y=l),n.push({index:[o,r],key:`edge-${o}`,type:"edge",scale:{x:De(u,p),y:1},translate:{x:u.x,y:u.y},angle:h,rotate:h,center:m,visible:Array.isArray(D),dir:H(Math.atan2(i.y-m.y,i.x-m.x)),role:"slider",tabindex:0,label:`Drag ${Xf[g]}`,orientation:`${Kf[g]}`,valuemin:Math.round($),valuemax:Math.round(f),valuenow:Math.round(y)})}return n},U=(e,t)=>{s("resizestart",{indexes:e,translation:ye(),isNudge:!0}),s("resizemove",{indexes:e,translation:t,isNudge:!0}),s("resizeend",{indexes:e,translation:ye(),isNudge:!0})};return e.$$set=e=>{"visible"in e&&o(4,I=e.visible),"points"in e&&o(17,E=e.points),"rotatorPoint"in e&&o(0,A=e.rotatorPoint),"bounds"in e&&o(18,L=e.bounds),"scalarPoint"in e&&o(1,F=e.scalarPoint),"selectedPoint"in e&&o(19,z=e.selectedPoint),"enableDragEdges"in e&&o(20,D=e.enableDragEdges),"enableDragPoints"in e&&o(21,O=e.enableDragPoints),"enableRotatePoints"in e&&o(2,B=e.enableRotatePoints),"enableScalePoints"in e&&o(3,W=e.enableScalePoints)},e.$$.update=()=>{4194320&e.$$.dirty[0]&&V.set(I?1:.5,{hard:!1===n}),4194320&e.$$.dirty[0]&&N.set(I?1:0,{hard:!1===n}),131072&e.$$.dirty[0]&&o(5,i=j(E))},[A,F,B,W,I,i,r,a,_,V,N,(e,t)=>({detail:o})=>{const i=o&&o.translation?o.translation:be(0,0);s(`resize${e}`,{...o,indexes:t,translation:i})},U,({detail:e})=>{s("rotatestart",{translation:ye(),isNudge:!0}),s("rotatemove",{translation:e,isNudge:!0}),s("rotateend",{translation:ye(),isNudge:!0})},({detail:e})=>{s("scalestart",{translation:ye(),isNudge:!0}),s("scalemove",{translation:e,isNudge:!0}),s("scaleend",{translation:ye(),isNudge:!0})},e=>({detail:t})=>{const o=t&&t.translation?t.translation:be(0,0);s(`rotate${e}`,{...t,translation:o})},e=>({detail:t})=>{const o=t&&t.translation?t.translation:be(0,0);s(`scale${e}`,{...t,translation:o})},E,L,z,D,O,n,(e,{detail:t})=>U(e,t)]}class lb extends rs{constructor(e){super(),ns(this,e,sb,ab,yr,{visible:4,points:17,rotatorPoint:0,bounds:18,scalarPoint:1,selectedPoint:19,enableDragEdges:20,enableDragPoints:21,enableRotatePoints:2,enableScalePoints:3},null,[-1,-1,-1])}}var cb=(e,t)=>{const o=Tm(e);return Ie(o,t)},db=e=>document.createTextNode(e),ub=e=>(no()&&e.endsWith("<div><br></div>")?e.replace(/<div><br><\/div>$/,"<br><br>"):e).replace(/<div><br><\/div>/g,"<br>").replace(/<\/div>/g,"").replace(/<div>/g,"<br>");function pb(e){let t,o,i,n;return{c(){t=Ur("pre"),Qr(t,"class","PinturaContentEditable")},m(r,a){Hr(r,t,a),t.innerHTML=e[0],i||(n=Ar(o=fd.call(null,t,`${e[7]};position:absolute;z-index:-1;pointer-events:none;`)),i=!0)},p(e,i){1&i[0]&&(t.innerHTML=e[0]),o&&fr(o.update)&&128&i[0]&&o.update.call(null,`${e[7]};position:absolute;z-index:-1;pointer-events:none;`)},d(e){e&&jr(t),i=!1,n()}}}function hb(e){let t,o,i,n,r,a,s=e[8]&&pb(e);return{c(){s&&s.c(),t=Xr(),o=Ur("pre"),Qr(o,"class","PinturaContentEditable"),Qr(o,"data-wrap-content",i=e[4]||e[5]?"wrap":"nowrap"),Qr(o,"contenteditable",""),Qr(o,"spellcheck",e[1]),Qr(o,"autocorrect",e[2]),Qr(o,"autocapitalize",e[3])},m(i,l){s&&s.m(i,l),Hr(i,t,l),Hr(i,o,l),e[26](o),r||(a=[Ar(n=fd.call(null,o,e[8]?e[15](e[7]):e[7])),qr(o,"input",e[13]),qr(o,"compositionend",e[12]),qr(o,"paste",e[14]),qr(o,"keydown",e[10]),qr(o,"keyup",e[11]),qr(o,"blur",e[9])],r=!0)},p(e,r){e[8]?s?s.p(e,r):(s=pb(e),s.c(),s.m(t.parentNode,t)):s&&(s.d(1),s=null),48&r[0]&&i!==(i=e[4]||e[5]?"wrap":"nowrap")&&Qr(o,"data-wrap-content",i),2&r[0]&&Qr(o,"spellcheck",e[1]),4&r[0]&&Qr(o,"autocorrect",e[2]),8&r[0]&&Qr(o,"autocapitalize",e[3]),n&&fr(n.update)&&384&r[0]&&n.update.call(null,e[8]?e[15](e[7]):e[7])},i:ur,o:ur,d(i){i&&(jr(t),jr(o)),s&&s.d(i),e[26](null),r=!1,$r(a)}}}function mb(e,t,i){let n,r,{spellcheck:a="false"}=t,{autocorrect:s="off"}=t,{autocapitalize:l="off"}=t,{wrapLines:c=!0}=t,{allowNewline:d=!0}=t,{textFormat:u="text"}=t,{formatInput:p=ee}=t,{formatPaste:h=ee}=t,{styles:m}=t,{innerHTML:g}=t,{oninput:$=o}=t,{enableTextStyleShortcuts:f=!1}=t;const y=()=>{if(!v)return;const e=document.createRange();e.selectNodeContents(v);const t=P();t.removeAllRanges(),t.addRange(e)},b=xa();let v;document.execCommand("defaultParagraphSeparator",!1,"br");const S=e=>e.replace(/<\/?(?:i|b|em|u|s|strike|strong|font)>/,"").replace(/style=".*?"/g,"").replace(/\n/gim,"<br>"),w=()=>{i(0,g=v.innerHTML);const e=ub(g);b("input",e),$(e),requestAnimationFrame(()=>v&&v.scrollTo(0,0))},k=()=>{R(v);const e="html"===u?v.innerHTML:S(v.innerHTML);i(6,v.innerHTML=p(e),v),I(v),w()},C={b:"bold",i:"italic",u:"underline",s:"strikethrough"},T=e=>{const t=x("span");return t.dataset.bookmark=e,t},M=(e,t,o)=>{const i=T(o);if(e.nodeType===Node.TEXT_NODE){const n=e.textContent;if("start"===o){const o=db(n.substring(0,t)),r=db(n.substring(t));e.replaceWith(o,i,r)}else{const o=db(n.substring(0,t)),r=db(n.substring(t));e.replaceWith(o,i,r)}}else e.nodeType===Node.ELEMENT_NODE&&e.insertBefore(i,e.childNodes[t])},P=()=>{const e=v.getRootNode();return"getSelection"in e?e.getSelection():document.getSelection()},R=e=>{const t=P();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.substring(0,i),o=T("start"),a=n-i>0?e.substring(i,n):"",s=T("end"),l=e.substring(n);r.replaceWith(t,o,a,s,l)}else M(r,i,"start"),M(a,n+(r===a?1:0),"end")},I=e=>{const t=E(e,"start"),o=E(e,"end");if(!t||!o)return;const i=document.createRange();i.setStart(t,0),i.setEnd(o,0);const n=P();n.removeAllRanges(),n.addRange(i),t.remove(),o.remove()},E=(e,t)=>{const o=e.children;for(let e=0;e<o.length;e++){const i=o[e];if(i.dataset.bookmark===t)return i;if(i.children.length){const e=E(i,t);if(e)return e}}};let A;return e.$$set=e=>{"spellcheck"in e&&i(1,a=e.spellcheck),"autocorrect"in e&&i(2,s=e.autocorrect),"autocapitalize"in e&&i(3,l=e.autocapitalize),"wrapLines"in e&&i(4,c=e.wrapLines),"allowNewline"in e&&i(5,d=e.allowNewline),"textFormat"in e&&i(16,u=e.textFormat),"formatInput"in e&&i(17,p=e.formatInput),"formatPaste"in e&&i(18,h=e.formatPaste),"styles"in e&&i(19,m=e.styles),"innerHTML"in e&&i(0,g=e.innerHTML),"oninput"in e&&i(20,$=e.oninput),"enableTextStyleShortcuts"in e&&i(21,f=e.enableTextStyleShortcuts)},e.$$.update=()=>{var t;if(64&e.$$.dirty[0]&&i(25,n=!!v),33554433&e.$$.dirty[0]&&n&&g&&(t=g)!==v.innerHTML&&(i(6,v.innerHTML=t,v),v===document.activeElement&&y()),524336&e.$$.dirty[0])if(!c&&d){const e=m.includes(":right")?"text-indent:-100px!important":m.includes(":center")?"":"min-width:calc(100% + 100px)!important";i(7,A=m+";overflow:visible;"+e)}else i(7,A=m);524288&e.$$.dirty[0]&&i(8,r=m.includes("text-stroke"))},[g,a,s,l,c,d,v,A,r,()=>{b("blur")},e=>{if(/escape/i.test(e.code))return e.stopPropagation(),void b("cancel");const t=e.ctrlKey||e.metaKey;if("html"===u&&t&&/b|i|u|s/.test(e.key))return f&&(e=>{const t=C[e];t&&document.execCommand(t)})(e.key),void e.preventDefault();/enter/i.test(e.key)&&(e.stopPropagation(),e.isComposing||(t?b("confirm"):(d||e.preventDefault(),document.execCommand("insertLineBreak"),e.preventDefault())))},()=>{},e=>{""!==e.data&&k()},e=>{const{inputType:t}=e;"insertCompositionText"!==t&&"deleteCompositionText"!==t&&k()},e=>{e.preventDefault();const t=e.clipboardData.getData("text/plain"),o="html"===u?t:S(t),i=h(o);if(!i.length)return;const n=P().getRangeAt(0);n.deleteContents(),n.insertNode(document.createTextNode(i)),w()},e=>e.replace("-webkit-text-stroke","--text-stroke").replace("text-shadow","--text-shadow"),u,p,h,m,$,f,()=>k(),()=>v&&v.focus(),y,n,function(e){Ca[e?"unshift":"push"](()=>{v=e,i(6,v)})}]}class gb extends rs{constructor(e){super(),ns(this,e,mb,hb,yr,{spellcheck:1,autocorrect:2,autocapitalize:3,wrapLines:4,allowNewline:5,textFormat:16,formatInput:17,formatPaste:18,styles:19,innerHTML:0,oninput:20,enableTextStyleShortcuts:21,confirm:22,focus:23,select:24},null,[-1,-1])}get spellcheck(){return this.$$.ctx[1]}set spellcheck(e){this.$$set({spellcheck:e}),Oa()}get autocorrect(){return this.$$.ctx[2]}set autocorrect(e){this.$$set({autocorrect:e}),Oa()}get autocapitalize(){return this.$$.ctx[3]}set autocapitalize(e){this.$$set({autocapitalize:e}),Oa()}get wrapLines(){return this.$$.ctx[4]}set wrapLines(e){this.$$set({wrapLines:e}),Oa()}get allowNewline(){return this.$$.ctx[5]}set allowNewline(e){this.$$set({allowNewline:e}),Oa()}get textFormat(){return this.$$.ctx[16]}set textFormat(e){this.$$set({textFormat:e}),Oa()}get formatInput(){return this.$$.ctx[17]}set formatInput(e){this.$$set({formatInput:e}),Oa()}get formatPaste(){return this.$$.ctx[18]}set formatPaste(e){this.$$set({formatPaste:e}),Oa()}get styles(){return this.$$.ctx[19]}set styles(e){this.$$set({styles:e}),Oa()}get innerHTML(){return this.$$.ctx[0]}set innerHTML(e){this.$$set({innerHTML:e}),Oa()}get oninput(){return this.$$.ctx[20]}set oninput(e){this.$$set({oninput:e}),Oa()}get enableTextStyleShortcuts(){return this.$$.ctx[21]}set enableTextStyleShortcuts(e){this.$$set({enableTextStyleShortcuts:e}),Oa()}get confirm(){return this.$$.ctx[22]}get focus(){return this.$$.ctx[23]}get select(){return this.$$.ctx[24]}}const $b=["i","b","u","strike"].map(e=>({tag:e,tagOpen:new RegExp(`<${e}>`,"g"),tagClose:new RegExp(`</${e}>`,"g"),placeholderOpen:new RegExp(`___${e}O___`,"g"),placeholderClose:new RegExp(`___${e}C___`,"g")}));var fb=e=>e=((e,t=$b)=>(t.forEach(({tag:t,placeholderOpen:o,placeholderClose:i})=>{e=e.replace(o,`<${t}>`).replace(i,`</${t}>`)}),e))(e=(e=((e,t=$b)=>(t.forEach(({tag:t,tagOpen:o,tagClose:i})=>{e=e.replace(o,`___${t}O___`).replace(i,`___${t}C___`)}),e))(e)).replace(/ {2,}/g," ").replace(/\u00a0/g,"&nbsp;").split("\n").join("<br>")),yb=(e,t)=>y(e)?parseFloat(e)/100*t:e,bb=(e,t)=>({x:Jo(e.x,t.width),y:Jo(e.y,t.height)});function xb(e,t,o){const i=e.slice();return i[323]=t[o],i[325]=o,i}function vb(e,t){let o,i,n,r,a,s,l,c,d,u,p,h=t[323].name+"";function m(){return t[205](t[325])}return n=new qp({props:{color:t[323].color}}),{key:e,first:null,c(){o=Ur("li"),i=Ur("button"),ts(n.$$.fragment),r=Xr(),a=Ur("span"),s=Zr(h),c=Xr(),Qr(i,"class","PinturaShapeListItem"),Qr(i,"type","button"),Qr(i,"aria-label",l="Select shape "+t[323].name),this.first=o},m(e,t){Hr(e,o,t),_r(o,i),os(n,i,null),_r(i,r),_r(i,a),_r(a,s),_r(o,c),d=!0,u||(p=qr(i,"click",m),u=!0)},p(e,o){t=e;const r={};16777216&o[0]&&(r.color=t[323].color),n.$set(r),(!d||16777216&o[0])&&h!==(h=t[323].name+"")&&na(s,h),(!d||16777216&o[0]&&l!==(l="Select shape "+t[323].name))&&Qr(i,"aria-label",l)},i(e){d||(ja(n.$$.fragment,e),d=!0)},o(e){Ua(n.$$.fragment,e),d=!1},d(e){e&&jr(o),is(n),u=!1,p()}}}function Sb(e){let t,o;return t=new lb({props:{visible:!0,points:e[15],bounds:e[5],rotatorPoint:e[32],scalarPoint:e[31],selectedPoint:e[20],enableDragEdges:e[21],enableDragPoints:e[34],enableRotatePoints:e[19],enableScalePoints:e[17]}}),t.$on("resizestart",e[43]),t.$on("resizemove",e[44]),t.$on("resizeend",e[45]),t.$on("rotatestart",e[46]),t.$on("rotatemove",e[47]),t.$on("rotateend",e[48]),t.$on("scalestart",e[49]),t.$on("scalemove",e[50]),t.$on("scaleend",e[51]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};32768&o[0]&&(i.points=e[15]),32&o[0]&&(i.bounds=e[5]),2&o[1]&&(i.rotatorPoint=e[32]),1&o[1]&&(i.scalarPoint=e[31]),1048576&o[0]&&(i.selectedPoint=e[20]),2097152&o[0]&&(i.enableDragEdges=e[21]),8&o[1]&&(i.enableDragPoints=e[34]),524288&o[0]&&(i.enableRotatePoints=e[19]),131072&o[0]&&(i.enableScalePoints=e[17]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function wb(e){let t,o,i,n;const r=[Cb,kb],a=[];function s(e,t){return"modal"===e[6]?0:"inline"===e[6]?1:-1}return~(t=s(e))&&(o=a[t]=r[t](e)),{c(){o&&o.c(),i=Yr()},m(e,o){~t&&a[t].m(e,o),Hr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),ja(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(ja(o),n=!0)},o(e){Ua(o),n=!1},d(e){e&&jr(i),~t&&a[t].d(e)}}}function kb(e){let t,o,i,n,r,a,s={formatInput:e[53],wrapLines:!!e[16].width,textFormat:e[16].format,enableTextStyleShortcuts:e[7],allowNewline:e[33],styles:e[30]};return o=new gb({props:s}),e[209](o),o.$on("input",e[54]),o.$on("keyup",e[58]),o.$on("cancel",e[60]),o.$on("confirm",e[59]),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaInlineInput")},m(s,l){Hr(s,t,l),os(o,t,null),n=!0,r||(a=[Ar(i=fd.call(null,t,e[29])),qr(t,"focusout",e[210])],r=!0)},p(e,t){const n={};65536&t[0]&&(n.wrapLines=!!e[16].width),65536&t[0]&&(n.textFormat=e[16].format),128&t[0]&&(n.enableTextStyleShortcuts=e[7]),4&t[1]&&(n.allowNewline=e[33]),1073741824&t[0]&&(n.styles=e[30]),o.$set(n),i&&fr(i.update)&&536870912&t[0]&&i.update.call(null,e[29])},i(e){n||(ja(o.$$.fragment,e),n=!0)},o(e){Ua(o.$$.fragment,e),n=!1},d(i){i&&jr(t),e[209](null),is(o),r=!1,$r(a)}}}function Cb(e){let t,o;return t=new rm({props:{panelOffset:e[3],onconfirm:e[59],oncancel:e[60],buttonCancel:{icon:e[8].shapeIconInputCancel,label:e[8].shapeLabelInputCancel},buttonConfirm:{icon:e[8].shapeIconInputConfirm,label:e[8].shapeLabelInputConfirm,hideLabel:!0},willHandleKeydown:e[208],$$slots:{default:[Tb]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8&o[0]&&(i.panelOffset=e[3]),256&o[0]&&(i.buttonCancel={icon:e[8].shapeIconInputCancel,label:e[8].shapeLabelInputCancel}),256&o[0]&&(i.buttonConfirm={icon:e[8].shapeIconInputConfirm,label:e[8].shapeLabelInputConfirm,hideLabel:!0}),8192&o[0]&&(i.willHandleKeydown=e[208]),1342177792&o[0]|65536&o[10]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Tb(e){let t,o,i,n;return{c(){t=Ur("textarea"),Qr(t,"spellcheck","false"),Qr(t,"autocorrect","off"),Qr(t,"autocapitalize","off")},m(r,a){Hr(r,t,a),e[206](t),ra(t,e[28]),i||(n=[qr(t,"keydown",e[56]),qr(t,"keypress",e[55]),qr(t,"keyup",e[58]),qr(t,"input",e[54]),qr(t,"input",e[207]),Ar(o=fd.call(null,t,e[30]))],i=!0)},p(e,i){268435456&i[0]&&ra(t,e[28]),o&&fr(o.update)&&1073741824&i[0]&&o.update.call(null,e[30])},d(o){o&&jr(t),e[206](null),i=!1,$r(n)}}}function Mb(e){let t,o,i,n,r;return o=new Rh({props:{items:e[25],key:e[12]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaShapeControls"),aa(t,"transform",e[27]),aa(t,"opacity",e[26])},m(a,s){Hr(a,t,s),os(o,t,null),i=!0,n||(r=[qr(t,"measure",e[211]),Ar(qc.call(null,t))],n=!0)},p(e,i){const n={};33554432&i[0]&&(n.items=e[25]),4096&i[0]&&(n.key=e[12]),o.$set(n),134217728&i[0]&&aa(t,"transform",e[27]),67108864&i[0]&&aa(t,"opacity",e[26])},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o),n=!1,$r(r)}}}function Pb(e){let t,i,n,r,a,s,l,c,d,u,p=[],h=new Map,m=Xa(e[24]);const g=e=>e[323].id;for(let t=0;t<m.length;t+=1){let o=xb(e,m,t),i=g(o);h.set(i,p[t]=vb(i,o))}let $=e[18]&&Sb(e),f=e[14]&&wb(e),y=e[22]>0&&Mb(e);return{c(){t=Ur("div"),i=Ur("nav"),n=Ur("ul");for(let e=0;e<p.length;e+=1)p[e].c();r=Xr(),$&&$.c(),a=Xr(),f&&f.c(),s=Xr(),y&&y.c(),Qr(i,"class","PinturaShapeList"),Qr(i,"data-visible",e[23]),Qr(t,"class","PinturaShapeEditor"),Qr(t,"tabindex","0")},m(h,m){Hr(h,t,m),_r(t,i),_r(i,n);for(let e=0;e<p.length;e+=1)p[e]&&p[e].m(n,null);_r(t,r),$&&$.m(t,null),_r(t,a),f&&f.m(t,null),_r(t,s),y&&y.m(t,null),e[212](t),c=!0,d||(u=[qr(i,"focusin",e[63]),qr(i,"focusout",e[64]),qr(t,"keydown",function(){fr(e[0]?o:e[52])&&(e[0]?o:e[52]).apply(this,arguments)}),qr(t,"nudge",function(){fr(e[0]?o:e[62])&&(e[0]?o:e[62]).apply(this,arguments)}),qr(t,"measure",e[204]),qr(t,"pointermove",function(){fr(e[0]?o:e[65])&&(e[0]?o:e[65]).apply(this,arguments)}),qr(t,"pointerleave",function(){fr(e[0]?o:e[66])&&(e[0]?o:e[66]).apply(this,arguments)}),qr(t,"interactionstart",function(){fr(e[0]?o:e[37])&&(e[0]?o:e[37]).apply(this,arguments)}),qr(t,"interactionupdate",function(){fr(e[0]?o:e[39])&&(e[0]?o:e[39]).apply(this,arguments)}),qr(t,"interactioncancel",function(){fr(e[0]?o:e[38])&&(e[0]?o:e[38]).apply(this,arguments)}),qr(t,"interactionrelease",function(){fr(e[0]?o:e[40])&&(e[0]?o:e[40]).apply(this,arguments)}),qr(t,"interactionend",function(){fr(e[0]?o:e[41])&&(e[0]?o:e[41]).apply(this,arguments)}),Ar(qc.call(null,t)),Ar(xp.call(null,t)),Ar(l=Wh.call(null,t,{drag:!0,inertia:!0,multiTouch:!1,observeKeys:!0,shouldStartInteraction:Eb,getEventPosition:e[213]}))],d=!0)},p(o,r){e=o,16777216&r[0]|32&r[2]&&(m=Xa(e[24]),Na(),p=Ka(p,r,g,1,e,m,h,n,qa,vb,null,xb),Ha()),(!c||8388608&r[0])&&Qr(i,"data-visible",e[23]),e[18]?$?($.p(e,r),262144&r[0]&&ja($,1)):($=Sb(e),$.c(),ja($,1),$.m(t,a)):$&&(Na(),Ua($,1,1,()=>{$=null}),Ha()),e[14]?f?(f.p(e,r),16384&r[0]&&ja(f,1)):(f=wb(e),f.c(),ja(f,1),f.m(t,s)):f&&(Na(),Ua(f,1,1,()=>{f=null}),Ha()),e[22]>0?y?(y.p(e,r),4194304&r[0]&&ja(y,1)):(y=Mb(e),y.c(),ja(y,1),y.m(t,null)):y&&(Na(),Ua(y,1,1,()=>{y=null}),Ha()),l&&fr(l.update)&&16&r[0]&&l.update.call(null,{drag:!0,inertia:!0,multiTouch:!1,observeKeys:!0,shouldStartInteraction:Eb,getEventPosition:e[213]})},i(e){if(!c){for(let e=0;e<m.length;e+=1)ja(p[e]);ja($),ja(f),ja(y),c=!0}},o(e){for(let e=0;e<p.length;e+=1)Ua(p[e]);Ua($),Ua(f),Ua(y),c=!1},d(o){o&&jr(t);for(let e=0;e<p.length;e+=1)p[e].d();$&&$.d(),f&&f.d(),y&&y.d(),e[212](null),d=!1,$r(u)}}}const Rb=256,Ib="markup-hover",Eb=(e,t)=>e.target===t||"PinturaContentEditable"===e.target.className;function Ab(e,t,i){let n,r,a,s,l,c,d,u,p,h,m,g,$,f,b,x,v,S,w,k,C,T,M,P,R,I,E,A,L,F,z,D,O,W,_,V,H,j,U,G,Z,X,Y,q,K,J,Q,te,oe,ie,ne,re,ae,se,le,ce,de,ue,pe,he,me,$e,xe,Se,ke,Ee,Le,Fe,Oe=ur,Ve=()=>(Oe(),Oe=vr(Ye,e=>i(199,xe=e)),Ye),Ne=ur,je=()=>(Ne(),Ne=vr(qe,e=>i(203,Fe=e)),qe);e.$$.on_destroy.push(()=>Oe()),e.$$.on_destroy.push(()=>Ne());let{uid:Ue=B()}=t,{ui:Ge}=t,{disabled:Xe=!1}=t,{shapes:Ye}=t;Ve();let{selection:qe}=t;je();let{offset:Ke}=t,{contextRotation:Je=0}=t,{contextFlipX:tt=!1}=t,{contextFlipY:it=!1}=t,{contextZoom:nt=1}=t,{active:rt=!1}=t,{opacity:at=1}=t,{parentRect:st}=t,{rootRect:lt}=t,{utilRect:pt}=t,{hoverColor:gt}=t,{caretColor:$t}=t,{gridColor:ft}=t,{snapColor:yt}=t,{textInputMode:bt="inline"}=t,{oninteractionstart:xt=o}=t,{oninteractionupdate:vt=o}=t,{oninteractionrelease:St=o}=t,{oninteractionend:wt=o}=t,{oninteractioncancel:Ct=o}=t,{onaddshape:Tt=o}=t,{onupdateshape:Mt=o}=t,{onselectshape:Et=o}=t,{onblurshape:At=o}=t,{onremoveshape:Lt=o}=t,{ontapshape:Ft=o}=t,{onhovershape:zt=o}=t,{ontriggerhistorywrite:Dt=o}=t,{onhovercanvas:Wt=o}=t,{ontapcanvas:Vt=o}=t,{onleavecanvas:Nt=o}=t,{beforeSelectShape:Xt=()=>!0}=t,{beforeDeselectShape:Yt=()=>!0}=t,{beforeRemoveShape:qt=()=>!0}=t,{beforeUpdateShape:Kt=(e,t,o)=>t}=t,{willRenderShapeControls:Jt=ee}=t,{willRenderShapeTextControls:Qt=ee}=t,{willStartInteraction:eo=(e,t)=>!0}=t,{mapEditorPointToImagePoint:to}=t,{mapImagePointToEditorPoint:oo}=t,{eraseRadius:io}=t,{selectRadius:no}=t,{enableButtonFlipVertical:ro=!1}=t,{enableTapToAddText:ao=!0}=t,{enableMultiSelect:so=!1}=t,{enableTextStyleControls:lo=!0}=t,{locale:co}=t,{snapThreshold:uo=0}=t,{snapPointer:po=!0}=t,{enableSnapToContext:ho=!0}=t,{gridSize:mo=0}=t;const go=e=>{if(0===uo)return[];let t;return ho&&(t={...st,x:0,y:0}),[...xe.filter(t=>t!==e).filter(e=>!Zi(e)).filter(e=>(e=>!0!==e.disableAcceptSnap)(e)).map(e=>An({...e},st)),t].filter(Boolean)},$o=(e,t,o,i)=>0===e?{snapTargets:[]}:{snapThreshold:e,gridSize:t,gridRect:o,snapTargets:go(i)},fo=Sa("isAnimated");wr(e,fo,e=>i(200,ke=e));const yo=Sa("softKeyboardState"),bo=e=>e.set(Sr(e)),xo=e=>Sr(e).find(Zi),vo=(e,t)=>{if(!xo(t))return Ji(e),Co(e,t)},So=e=>{xo(e)&&e.update(e=>e.filter(e=>!Zi(e)))},wo=e=>{const t=xo(e);if(t)return Qi(t),bo(e),t},ko=(e,t,o=(e,t)=>({...e,...t}))=>{xo(t)&&t.update(t=>t.map(t=>Zi(t)?o(t,e):t))},Co=(e,t=Ye)=>(t.update(t=>[...t,e]),e),To=(e,t,o)=>{const i=Kt({...e},t,{...o});return Dn(e,i,o),e},Mo=(e,t)=>{const o=De(e,t),i=Te(e,t),n=Math.PI/8,r=n*Math.round(i/n)-Je%n;t.x=e.x+o*Math.cos(r),t.y=e.y+o*Math.sin(r)},Po=Sa("keysPressed");wr(e,Po,e=>i(201,Ee=e));const Ro=(e,t,o)=>0===e||t&&o?e:t||o?-e:e,Io=e=>{if(null===e.x&&null===e.y)return Eo();e.x&&i(152,Ao=to({x:e.x,y:0}).x),e.y&&i(153,Lo=to({x:0,y:e.y}).y)},Eo=()=>{i(152,Ao=null),i(153,Lo=null)};let Ao=null,Lo=null,Fo=!1;const zo=(e,t)=>{const o=oo(e);return to(Re(o,t))},Do=(e,t,o)=>{const i=(o-t)/e+1;return Array.from({length:i},(o,i)=>t+i*e)},Oo=e=>{let t=[],o=[],i=e.points;if(void 0!==e.x1&&(i=[{x:e.x1,y:e.y1},{x:e.x2,y:e.y2}]),i){const e=i.map(oo),n=dt(e),r=e[0],a=e[e.length-1];t=[n.x,n.x+.5*n.width,n.x+n.width,r.x,a.x],o=[n.y,n.y+.5*n.height,n.y+n.height,r.y,a.y]}else if(e.text||void 0!==e.width||void 0!==e.rx){let i;if(e.text&&void 0===e.height){const t=hi(e.text,e);i=ht(e.x,e.y,t.width,t.height)}else i=void 0!==e.width?ct(e):ct({x:e.x-e.rx,y:e.y-e.ry,width:2*e.rx,height:2*e.ry});const n=It(i).map(oo),r=Math.abs(e.rotation)>0?kt(i,e.rotation).map(oo):n,a=dt(r),s=mt(a),l=.5*a.width,c=.5*a.height;t=[s.x-l,s.x,s.x+l],o=[s.y-c,s.y,s.y+c]}else if(void 0!==e.x){const i=oo(e);t=[i.x],o=[i.y]}return{x:t,y:o}},Bo=(e,t,o)=>{let i,n,r,a=Number.Infinity,s=null,l=null;for(let c=0;c<e.length;c++){n=e[c];for(let e=0;e<t.length;e++)r=t[e],i=Math.abs(n-r),i<o&&(null===l||i<a)&&(a=i,s=n,l=r)}return{origin:s,target:l}},Wo=(e,t,o,i,n)=>{const r={x:null,y:null},a={x:null,y:null},s=t.map(Oo);if(i>0){const e=oo({x:0,y:0}),t=oo({x:i,y:i}),o=oo({x:n.width,y:n.height}),r=t.x-e.x,a=Do(r,e.x,o.x),l=Do(r,e.y,o.y);s.push({x:a,y:l})}return s.forEach(t=>{const{snapTranslation:i,snapLine:n}=((e,t,o)=>{const i={x:null,y:null},n={x:null,y:null},r=Bo(e.x,t.x,o);null!==r.target&&(i.x=r.target,n.x=r.target-r.origin);const a=Bo(e.y,t.y,o);return null!==a.target&&(i.y=a.target,n.y=a.target-a.origin),{snapTranslation:n,snapLine:i}})(e,t,o);null!==i.x&&(null===a.x||Math.abs(i.x)<Math.abs(a.x))&&(a.x=i.x||0,r.x=n.x),null!==i.y&&(null===a.y||Math.abs(i.y)<Math.abs(a.y))&&(a.y=i.y||0,r.y=n.y)}),{snapTranslation:a,snapLines:r}},_o=(e,t)=>(null!==t.x&&(e.x+=t.x),null!==t.y&&(e.y+=t.y),e),Vo=(e,t,o,i)=>{const{snapThreshold:n=0,gridSize:r=0,gridRect:a,snapTargets:s=[]}=i||{};let l=null;if(Vi(e)){if(n){const i=An({...e},st),l=zo(Fi(t),o),c=zo(zi(t),o),d=Oo({...i,x1:l.x,y1:l.y,x2:c.x,y2:c.y}),{snapTranslation:u,snapLines:p}=Wo(d,s,n,r,a);_o(o,u),Io(p)}const i=zo(Fi(t),o),c=zo(zi(t),o);l={x1:i.x,y1:i.y,x2:c.x,y2:c.y}}else if(e.points){if(cn(Ii)&&ri(Ii,{selectedPoint:void 0}),n){const i=An({...e},st),l=Oo({...i,points:t.points.map(e=>zo(e,o))}),{snapTranslation:c,snapLines:d}=Wo(l,s,n,r,a);_o(o,c),Io(d)}l={points:t.points.map(e=>zo(e,o))}}else if(Wi(e)||Di(e)||_i(e)){if(n){const i=An({...e},st),l=zo(t,o),c=Oo({...i,...l}),{snapTranslation:d,snapLines:u}=Wo(c,s,n,r,a);_o(o,d),Io(u)}l=zo(t,o)}l&&(To(e,l,st),ii())},Ho={0:1,1:0,2:3,3:2},Uo={0:3,1:2,2:1,3:0},Go=(e,t,i,n,r)=>{const{shiftKey:a,snapThreshold:s=0,gridSize:l=0,gridRect:c,snapTargets:d=[],aspectRatio:u,beforeResizeShape:p=o}=r||{},h=s?(e,t,o)=>{const{snapTranslation:i,snapLines:n}=Wo(Oo(e),d,s,l,c);_o(t,i),Io(n);const r=zo(o(),t);e.x=r.x,e.y=r.y}:o;if(Vi(e)||Ni(e)&&jo(e,"pathClose")){const[o]=i,r=a?Mo:(e,t)=>t;let s,l,c;if(Vi(e))0===o?(s=()=>Fi(t),l=e=>r(zi(t),e),c=(e,t)=>{To(e,{x1:t.x,y1:t.y},st)}):1===o&&(s=()=>zi(t),l=e=>r(Fi(t),e),c=(e,t)=>{To(e,{x2:t.x,y2:t.y},st)});else{const e=t.points;s=()=>({...e[o]}),l=t=>{const i=e[eb(o-1,e)],n=e[eb(o+1,e)];r(i,t),r(n,t)},c=(e,t)=>{To(e,{points:e.points.map((e,i)=>o===i?t:e)},st)}}const d=zo(s(),n);h(d,n,s),l(d),c(e,d)}else if(Xi(e)||_i(e)||Di(e)){let o,a=!1,s=!1;if(_i(t))o=ut(t);else if(Xi(t))o=ct(t);else if(jo(t,"width")){a=!0,o=ct(t);const e=hi(t.text,t);o.height=e.height}else{s=!0,o=ct(t);const e=hi(t.text,t);o.width=e.width,o.height=e.height}let l=u;e.aspectRatio?l=e.aspectRatio:!r.shiftKey||a||s||(l=o.width/o.height);const c=ct(o),d=mt(c),m=e.rotation,g=It(c),$=kt(c,m);if(1===i.length){let t=i[0];e.flipX&&(t=Ho[t]),e.flipY&&(t=Uo[t]);const[o,r,a,s]=g,c=oo($[t]),u=Re({...c},n),f=to(u);h(f,n,()=>to(c));const y=be(f.x-$[t].x,f.y-$[t].y),b=we(ve(y),-m),x=be(g[t].x+b.x,g[t].y+b.y);let v;0===t&&(v=a),1===t&&(v=s),2===t&&(v=o),3===t&&(v=r);const S=dt([v,x]);if(l){const{width:e,height:t}=Pt(S,l),[o,i,n,r]=Rt(S);S.width=e,S.height=t,x.y<v.y&&(S.y=n-t),x.x<v.x&&(S.x=i-e)}const w=kt(S,m,d),k=Be(w),C=we(w[0],-m,k),T=we(w[2],-m,k),M=dt([C,T]);p(M),To(e,_i(e)?fe(M):M,st)}else{i=i.map(t=>(e.flipX&&(t=Ho[t]),e.flipY&&(t=Uo[t]),t));const[t,o]=i.map(e=>$[e]),r={x:t.x+.5*(o.x-t.x),y:t.y+.5*(o.y-t.y)},[s,c]=i.map(e=>g[e]),[u,p]=i.map(e=>{const t=e+2;return t<4?g[t]:g[t-4]}),f={x:u.x+.5*(p.x-u.x),y:u.y+.5*(p.y-u.y)},y=oo(r),b=Re({...y},n),x=to(b);h(x,n,()=>to(y));const v=be(x.x-r.x,x.y-r.y),S=we(ve(v),-m),w=Ie(ve(s),c),k=Pe(w,e=>1-Math.abs(Math.sign(e))),C=be(S.x*k.x,S.y*k.y);Re(s,C),Re(c,C);const T=dt(g);if(l){let e=T.width,t=T.height;0===k.y?t=e/l:e=t*l,T.width=e,T.height=t,0===k.y?T.y=f.y-.5*t:T.x=f.x-.5*e}const M=kt(T,m,d),P=Be(M),R=we(M[0],-m,P),I=we(M[2],-m,P),E=dt([R,I]);let A;_i(e)?A=fe(E):Xi(e)?A=E:a&&(A={x:E.x,y:E.y,width:E.width}),To(e,A,st)}}ii()};let Zo;const Xo=(e,t)=>{const o=e.points.filter((e,o)=>o!==t);To(e,{points:o,selectedPoint:void 0},st),ii()},Yo=()=>{if(Fe.length)return Fe.find(Zi)},qo=()=>{if(Fe.length)return Fe.findIndex(Zi)},Ko=()=>{if(xe.length)return xe.find(Zi)},ei=()=>{if(xe.length)return xe.findIndex(Zi)},ti=()=>{const e=Ko();if(e)return Qi(e),ii(),e},oi=()=>{if(!Ko())return;const e=[...xe];e.splice(ei(),1),Ye.set(e)},ii=()=>{Ye.set(xe)},ni=(e,t=[],o=!0)=>{t.filter(Boolean).forEach(t=>delete e[t]),o&&ii()},ri=(e,t,o=!0)=>{e=Object.assign(e,t),o&&ii()},ai=(e,t,o,i=!0)=>{e[t]=o,i&&ii()},si=(e,t=!0)=>{xe.forEach(t=>ri(t,e,!1)),t&&ii()},li=()=>[...xe].reverse().filter(Ui),ci=()=>[...xe].reverse().find(Ui),di=()=>!!ci(),ui=(e,t=!0,o=!1)=>{const i=xe.filter(e=>nn(e)&&on(e)),n=i.findIndex(t=>t===e),r=((e,t=!1)=>{if(!qt(e))return!1;Ye.set(xe.filter(t=>t!==e)),t||Lt(e)})(e,o);if(!1===r)return;if(mi=e,i.length-1<=0)return gi();if(!t)return!0;const a=n-1<0?i.length-1:n-1;return fi(i[a]),!0},pi=()=>{if(s){const e=[];return a.forEach((t,o)=>{if(!nn(t))return;ui(t,o===a.length-1,!0)&&e.push(t)}),void(e.length&&Dt())}const e=ci();e&&ui(e)};let mi;const gi=(e={})=>{const{storePrevious:t=!0}=e;Object.keys(Qn).forEach(e=>Qn[e]={});const o=$i();t&&(mi=o),si({isSelected:!1,isEditing:!1,_prerender:!1}),o&&At(o)},$i=()=>xe.find(Ui),fi=(e,t=!0,o=!1)=>{if(Zi(e))return;const i=$i()||mi,n=Ui(e);mi=void 0,Xt(i,e)&&(o||gi(),(e=>{e.isSelected=!0})(e),!n&&Et(e),t&&ii())},yi=e=>{jn&&jn.confirm&&e.isEditing&&jn.confirm();const t={isSelected:!1,isEditing:!1,_prerender:!1};e.selectedPoint>-1&&(t.selectedPoint=void 0),ri(e,t),At(e)},bi=e=>{ri(e,{isSelected:!0,isEditing:!0,_prerender:"inline"===bt})},xi=e=>{ri(e,{isSelected:!0,isEditing:!1,_prerender:!1})},vi=e=>{if(!e.length)return[];const t=e.filter(qt);return Ye.set(xe.filter(e=>!t.includes(e))),t},Si=e=>{const t=hi(e.text,e);return ht(e.x,e.y,e.width?Math.min(e.width,t.width):t.width,e.height?Math.min(e.height,t.height):t.height)},wi=e=>{if(Xi(e))return ct(e);if(_i(e))return ut(e);const t=Si(e);return t.width=Math.max(0,e.width||t.width),t},ki=(e,t,o=0,i=()=>!0)=>[...e].reverse().filter(i).map(e=>({shape:e,priority:1})).filter(e=>{const{shape:i}=e,n=An(Ri(i),st),r=o+.5*(n.strokeWidth||0);if(Wi(n))return Zt(t,r,n,i.rotation);if(Di(n)){const o=wi(n),a=Zt(t,r,o,i.rotation);let s=!1;if(a&&!Ui(i)){const a=Si(n);"right"!==i.textAlign||i.flipX||(a.x=o.x+o.width-a.width),"center"===i.textAlign&&(a.x=o.x+.5*o.width-.5*a.width),s=Zt(t,r,a,i.rotation,mt(o)),s||(e.priority=-1)}return a}return _i(n)?((e,t,o,i,n,r)=>{const a=Ht(be(o.x,o.y),o.rx,o.ry,i,n,r,12);return Gt(e,t,a)})(t,r,n,i.rotation,i.flipX,i.flipY):Vi(n)?jt(t,Math.max(16,r),Fi(n),zi(n)):Ni(n)&&n.pathClose?Gt(t,r,n.points):!!Ni(n)&&(1===n.points.length?ze(t,n.points[0])<r*r:Ut(t,Math.max(16,r),n.points))}).sort((e,t)=>e.priority<t.priority?1:e.priority>t.priority?-1:0).map(e=>e.shape),Ci=(e,t,o,i=0)=>{const n=Math.abs(i),r=et(t,o),a=ot(r,n),s=(({start:e,end:t},o)=>{if(0===o)return[be(e.x,e.y),be(e.x,e.y),be(t.x,t.y),be(t.x,t.y)];const i=Math.atan2(t.y-e.y,t.x-e.x),n=Math.sin(i)*o,r=Math.cos(i)*o;return[be(n+e.x,-r+e.y),be(-n+e.x,r+e.y),be(-n+t.x,r+t.y),be(n+t.x,-r+t.y)]})(a,n),l=e.filter(e=>{const t=An(Ri(e),st);if(Vi(t)||Ni(t)){const e=t.points?[...t.points]:[Fi(t),zi(t)];return!!Ot(a,e)}return((e,t)=>!!e.find(e=>Bt(e,t))||!!t.find(t=>Bt(t,e)))(s,((e,t=12)=>{if(Wi(e))return kt(e,e.rotation,mt(e));if(Di(e)){const t=wi(e);return kt(t,e.rotation,mt(t))}return _i(e)?Ht(be(e.x,e.y),e.rx,e.ry,e.rotation,e.flipX,e.flipY,t):[]})(t))});return l};let Ti,Mi,Pi,Ii,Ei,Ai,Li,ji=!1,Gi=!1,Yi=!1,qi=!1;const Ki=e=>{Li=e.map(e=>({shape:e,shapeOrigin:Ri(e),shapeOriginComputed:An(Ri(e),st)}))},hn=()=>{clearTimeout(Mi),Mi=void 0,i(156,qi=!1),Eo()};let mn=null;const gn=e=>{const t=No(e.rotation)&&0!==e.rotation;if(Wi(e)){const o=mt(e),i=It(e);return(e.flipX||e.flipY)&&We(i,e.flipX,e.flipY,o.x,o.y),t?_e(i,e.rotation,o.x,o.y):i}if(_i(e)){const o=e,i=It(ut(e));return(e.flipX||e.flipY)&&We(i,e.flipX,e.flipY,o.x,o.y),t?_e(i,e.rotation,o.x,o.y):i}if(Vi(e))return[Fi(e),zi(e)];if(Ni(e)){if(e.bitmap&&!jo(e,"pathClose")){const t=dt(e.points);t.x-=.5*e.strokeWidth,t.y-=.5*e.strokeWidth,t.width+=e.strokeWidth,t.height+=e.strokeWidth;return gn({...e,...t})}return[...e.points]}if(Di(e)){const o=wi(e),i=mt(o),n=It(o);return(e.flipX||e.flipY)&&We(n,e.flipX,e.flipY,i.x,i.y),t?_e(n,e.rotation,i.x,i.y):n}return[]},$n=e=>{const t=gn(e);let o,i;return e.flipY?(o=Be([t[0],t[1]]),i=Ce(be(t[1].x-t[2].x,t[1].y-t[2].y))):(o=Be([t[2],t[3]]),i=Ce(be(t[2].x-t[1].x,t[2].y-t[1].y))),Ae(i,20/nt),{origin:o,dir:i}};const fn=e=>t=>t.id===e,yn=e=>{const t=fn(e);return e=>e.filter((e=>t=>!e(t))(t))},bn=e=>{const t=fn(e),o=yn(e);return()=>Ge.update(e=>e.some(t)?o(e):e)},xn=e=>{const t=yn(e);return(...e)=>{Ge.update(o=>[...t(o),...e.filter(Boolean)])}},vn=bn(Ib),Sn=xn(Ib);let wn;const Cn="markup-manipulator-segment-"+Ue,Tn=bn(Cn),Mn=xn(Cn),Pn=(e,t)=>{const o=e[t],i=t-1<0?e[e.length-1]:e[t-1],n=t+1<e.length?e[t+1]:e[0],r=Ie(ve(i),o);Ce(r);const a=Re(Ae(r,10),o),s=Ie(ve(n),o);Ce(s);return[a,o,Re(Ae(s,10),o)]},Rn=()=>{i(157,wn=void 0),vn()},In="markup-multi-selection-segment-"+Ue,En=bn(In),Ln=xn(In),Fn=(e,t)=>{if(uo<=0)return e;if(t)return Eo(),e;const o=to(e),i=go(),{snapTranslation:r,snapLines:a}=Wo(Oo(o),i,uo,mo,n);return Io(a),_o(e,r),e},On=Fc(0);wr(e,On,e=>i(202,Le=e));const Bn=`markup-grid-line-${Ue}`,Wn=bn(Bn),_n=xn(Bn),Vn="markup-snap-line",Nn=bn(Vn),Hn=xn(Vn);let jn;yo.subscribe(e=>{"inline"===bt&&r&&r.isEditing&&"hidden"===e&&Yn()});const Un=e=>{i(9,jn.innerHTML=fb(e),jn)},Gn=e=>{const t=void 0===e.value?e.innerHTML:e.value,o="text"===r.format?ub(t).split(/<br>|<br\/>/g).join("\n").replace(/&nbsp;/g,String.fromCharCode(160)).replace(/&amp;/g,"&"):t;const i=Oi(r)&&!1!==r.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;return i},Zn=()=>{const e=Gn(jn),t=sn(r,e),o=!0===t?e:t;let i=j.x,n=j.y;if(!r.height){const e=kt({...G},r.rotation),t=hi(o,p),a=kt({x:i,y:n,...t},r.rotation),[s,,l]=e,[c,,d]=a;let u=s,h=c;r.flipX&&(u=l,h=d);const m=Ie(ve(u),h);i+=m.x,n+=m.y}To(r,{x:i,y:n,text:o},st),ii()},Xn=e=>{const{key:t,ctrlKey:o,metaKey:i,altKey:n}=e;return"Enter"===t&&(o||n||i)},Yn=()=>{d&&ti(),jn&&jn.confirm&&jn.confirm(),jn&&Zn(),xi(r),Mt(r)},qn=()=>{d?oi():(ri(r,{text:H.text,x:H.x,y:H.y}),xi(r))},Kn=(e,t,{flipX:o,flipY:i,rotation:n},r="top left")=>{let a,s;const[l,c,d,u]=kt(e,n),[p,h,m,g]=kt(t,n);if("top center"===r){a=Be(i?[u,d]:[l,c]),s=Be(i?[g,m]:[p,h])}else"top right"===r&&!o||"top left"===r&&o?(a=i?d:c,s=i?m:h):(a=i?u:l,s=i?g:p);return Ie(ve(a),s)},Jn=(e,t,o)=>be(y(e.x)?Jo(t.x+o.x,st.width):t.x+o.x,y(e.y)?Jo(t.y+o.y,st.height):t.y+o.y),Qn={},er=()=>Xo(r,r.selectedPoint),tr=()=>bi(r),or=(e,t,o)=>{const{width:i,height:n,...r}=o,a=hi(t.text,r),s=Kn(ht(o.x,o.y,e.width,e.height),ht(o.x,o.y,a.width,a.height),o,`top ${t.textAlign}`),l=!1!==o.disableNewline;ni(t,["width","height",l&&"textAlign"]),ri(t,{...Jn(t,o,s)})},ir=(e,t,o,i,n={})=>{const{height:r,...a}=o,s=Qe(hi(t.text,a),e=>Math.ceil(e)),l=Ze(n.width||o.width||i.width,s.height),c=n.textAlign||"left",d=Kn(ht(o.x,o.y,e.width,e.height),ht(o.x,o.y,l.width,l.height),o,`top ${c}`);ni(t,["height"]),ri(t,{...Jn(t,o,d),width:y(t.width)?Jo(l.width,st.width):l.width,textAlign:c})},nr=(e,t,o,i,n={})=>{const r=Ze(n.width||i.width,n.height||i.height),a=n.textAlign||"left",s=Kn(ht(o.x,o.y,e.width,e.height),ht(o.x,o.y,r.width,r.height),o,`top ${a}`);ri(t,{...Jn(t,o,s),width:y(t.width)?Jo(r.width,st.width):r.width,height:y(t.width)?Jo(r.height,st.height):r.height,textAlign:a})},rr=()=>{const e=Qe(hi(r.text,p),e=>Math.ceil(e)),t=jo(r,"height"),o=!t&&jo(r,"width"),i=r.id;let n=Qn[i];if(n||(Qn[i]={},n=Qn[i]),t){n.textAlign=r.textAlign,n.width=p.width,n.height=p.height;const t=Ze(p.width,p.height);ln(r,"auto-height")?ir(t,r,p,e,n):ln(r,"auto-width")&&or(t,r,p)}else if(o){n.textAlign=r.textAlign,n.width=p.width;const t=Ze(p.width,e.height);ln(r,"auto-width")?or(t,r,p):ln(r,"fixed-size")&&nr(t,r,p,e,n)}else{n.textAlign=r.textAlign||n.textAlign;const t=Ze(Math.ceil(e.width),Math.ceil(e.height));ln(r,"fixed-size")?nr(t,r,p,e,n):ln(r,"auto-height")&&ir(t,r,p,e,n)}},ar=e=>{e.stopPropagation();const t=r.flipX||!1;ai(r,"flipX",!t),Mt(r)},sr=e=>{e.stopPropagation();const t=r.flipY||!1;ai(r,"flipY",!t),Mt(r)},lr=e=>{ai(r,"opacity",e)},cr=e=>{lr(e),Mt(r)},dr=e=>{e.stopPropagation(),e.target.blur(),pi()},pr=e=>{e.stopPropagation();xe.findIndex(e=>e===r)!==xe.length-1&&(Ye.set(xe.filter(e=>e!==r).concat([r])),Mt(r))},hr=e=>{e.stopPropagation(),mr()},mr=()=>{const e=(s?a:[r]).filter(rn).map(e=>{const t=Ri(e);t.id=B();const o=be(50,-50);if(jo(t,"points")){const e=zn(t,["points"],st);e.points.forEach(e=>{e.x+=o.x,e.y+=o.y}),Dn(t,e,st)}else if(Vi(t)){const e=zn(t,["x1","y1","x2","y2"],st);e.x1+=o.x,e.y1+=o.y,e.x2+=o.x,e.y2+=o.y,Dn(t,e,st)}else{const e=zn(t,["x","y"],st);e.x+=50,e.y-=50,Dn(t,e,st)}return Ye.set([...xe,t]),Tt(t),t});if(e.length>1)return gi(),void e.forEach(e=>{fi(e,!0,!0)});fi(e[0])},gr=Fc(0,{stiffness:.2,damping:.7});wr(e,gr,e=>i(22,Se=e));let $r;const fr=(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},yr=(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 br=!1;let xr,kr=ye();const Cr=e=>{zt(e),i(157,wn=e)},Tr=e=>{fi(xe[e])};let Mr;function Pr(e){sm(e)&&e.target===Mr&&e.preventDefault()}ba(()=>{Nn(),Wn(),Tn(),vn(),Mr.removeEventListener("touchmove",Pr,!1)});return e.$$set=e=>{"uid"in e&&i(68,Ue=e.uid),"ui"in e&&i(69,Ge=e.ui),"disabled"in e&&i(0,Xe=e.disabled),"shapes"in e&&Ve(i(1,Ye=e.shapes)),"selection"in e&&je(i(2,qe=e.selection)),"offset"in e&&i(3,Ke=e.offset),"contextRotation"in e&&i(70,Je=e.contextRotation),"contextFlipX"in e&&i(71,tt=e.contextFlipX),"contextFlipY"in e&&i(72,it=e.contextFlipY),"contextZoom"in e&&i(73,nt=e.contextZoom),"active"in e&&i(74,rt=e.active),"opacity"in e&&i(75,at=e.opacity),"parentRect"in e&&i(76,st=e.parentRect),"rootRect"in e&&i(4,lt=e.rootRect),"utilRect"in e&&i(5,pt=e.utilRect),"hoverColor"in e&&i(77,gt=e.hoverColor),"caretColor"in e&&i(78,$t=e.caretColor),"gridColor"in e&&i(79,ft=e.gridColor),"snapColor"in e&&i(80,yt=e.snapColor),"textInputMode"in e&&i(6,bt=e.textInputMode),"oninteractionstart"in e&&i(81,xt=e.oninteractionstart),"oninteractionupdate"in e&&i(82,vt=e.oninteractionupdate),"oninteractionrelease"in e&&i(83,St=e.oninteractionrelease),"oninteractionend"in e&&i(84,wt=e.oninteractionend),"oninteractioncancel"in e&&i(85,Ct=e.oninteractioncancel),"onaddshape"in e&&i(86,Tt=e.onaddshape),"onupdateshape"in e&&i(87,Mt=e.onupdateshape),"onselectshape"in e&&i(88,Et=e.onselectshape),"onblurshape"in e&&i(89,At=e.onblurshape),"onremoveshape"in e&&i(90,Lt=e.onremoveshape),"ontapshape"in e&&i(91,Ft=e.ontapshape),"onhovershape"in e&&i(92,zt=e.onhovershape),"ontriggerhistorywrite"in e&&i(93,Dt=e.ontriggerhistorywrite),"onhovercanvas"in e&&i(94,Wt=e.onhovercanvas),"ontapcanvas"in e&&i(95,Vt=e.ontapcanvas),"onleavecanvas"in e&&i(96,Nt=e.onleavecanvas),"beforeSelectShape"in e&&i(97,Xt=e.beforeSelectShape),"beforeDeselectShape"in e&&i(98,Yt=e.beforeDeselectShape),"beforeRemoveShape"in e&&i(99,qt=e.beforeRemoveShape),"beforeUpdateShape"in e&&i(100,Kt=e.beforeUpdateShape),"willRenderShapeControls"in e&&i(101,Jt=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&i(102,Qt=e.willRenderShapeTextControls),"willStartInteraction"in e&&i(103,eo=e.willStartInteraction),"mapEditorPointToImagePoint"in e&&i(104,to=e.mapEditorPointToImagePoint),"mapImagePointToEditorPoint"in e&&i(105,oo=e.mapImagePointToEditorPoint),"eraseRadius"in e&&i(106,io=e.eraseRadius),"selectRadius"in e&&i(107,no=e.selectRadius),"enableButtonFlipVertical"in e&&i(108,ro=e.enableButtonFlipVertical),"enableTapToAddText"in e&&i(109,ao=e.enableTapToAddText),"enableMultiSelect"in e&&i(110,so=e.enableMultiSelect),"enableTextStyleControls"in e&&i(7,lo=e.enableTextStyleControls),"locale"in e&&i(8,co=e.locale),"snapThreshold"in e&&i(111,uo=e.snapThreshold),"snapPointer"in e&&i(112,po=e.snapPointer),"enableSnapToContext"in e&&i(113,ho=e.enableSnapToContext),"gridSize"in e&&i(114,mo=e.gridSize)},e.$$.update=()=>{var t,o;if(16384&e.$$.dirty[2]|2097152&e.$$.dirty[3]&&i(185,n=mo>0?{x:0,y:0,...st}:void 0),1&e.$$.dirty[0]|8192&e.$$.dirty[6]&&i(13,r=!Xe&&xe&&(Ko()||ci())),131072&e.$$.dirty[3]|8192&e.$$.dirty[6]&&i(177,a=so?xe.filter(Ui):[]),4194304&e.$$.dirty[5]&&i(176,s=a.length>1),16384&e.$$.dirty[2]|6291456&e.$$.dirty[5]&&i(198,l=s?a.map(e=>An(Ri(e),st)):[]),8192&e.$$.dirty[0]&&i(195,c=!!r),8192&e.$$.dirty[0]&&i(179,d=r&&Zi(r)),8192&e.$$.dirty[0]|16777216&e.$$.dirty[5]&&i(12,u=r&&!d?r.id:void 0),8208&e.$$.dirty[0]|16384&e.$$.dirty[2]&&i(16,p=lt&&r&&An(Ri(r),st)),8192&e.$$.dirty[0]|16777216&e.$$.dirty[5]&&i(160,h=!(!r||!d)),73728&e.$$.dirty[0]|8192&e.$$.dirty[2]&&i(193,m=r&&at&&gn(p)||[]),2097152&e.$$.dirty[5]|4096&e.$$.dirty[6]&&i(189,g=s?l.map(gn):[]),8192&e.$$.dirty[0]|2097152&e.$$.dirty[5]&&i(197,$=!s&&r&&(un(t=r)&&pn(t)&&!0!==t.disableResize&&(Xi(t)||Bi(t)||_i(t)||Vi(t)||Ni(t)&&jo(t,"pathClose")))&&!Hi(r)),8192&e.$$.dirty[0]|2097152&e.$$.dirty[5]&&i(19,f=!s&&r&&(e=>un(e)&&!0!==e.disableRotate&&(Xi(e)||jo(e,"text")||_i(e)))(r)&&!Hi(r)),8192&e.$$.dirty[0]&&i(17,b=r&&Di(r)&&!Bi(r)&&!Hi(r)&&!1===r.disableTextScale),8192&e.$$.dirty[0]|2048&e.$$.dirty[6]&&i(21,x=!!$&&function(e){return!!e&&(Di(e)&&!e.height?[[1,2],[3,0]]:!Vi(e)&&!Ni(e))}(r)),2105344&e.$$.dirty[0]|2048&e.$$.dirty[6]&&i(34,v=!!r&&(!Array.isArray(x)&&$)),6291456&e.$$.dirty[5]&&i(196,S=s?(e=>{const t=e.map(e=>gn(An(e,st))).flat(),o=dt(t);return It(o)})(a):[]),8192&e.$$.dirty[0]|2097152&e.$$.dirty[5]|128&e.$$.dirty[6]&&i(18,w=r&&m.length>1||s),4096&e.$$.dirty[3]|2097152&e.$$.dirty[5]|1152&e.$$.dirty[6]&&i(191,k=s?S.map(oo):m.map(oo)),8&e.$$.dirty[0]|32&e.$$.dirty[6]&&i(15,C=k.map(e=>be(e.x-Ke.x,e.y-Ke.y))),8192&e.$$.dirty[0]&&i(20,T=r&&r.points&&No(r.selectedPoint)?r.selectedPoint:-1),1048576&e.$$.dirty[0]&&i(169,M=T>=0),1081344&e.$$.dirty[0]|16384&e.$$.dirty[5]&&i(174,P=M?C[T]:void 0),8192&e.$$.dirty[0]|512&e.$$.dirty[6]&&i(33,R=c&&(Bi(r)?!jo(r,"disableNewline")||!r.disableNewline:!1===r.disableNewline)),4096&e.$$.dirty[3]|4&e.$$.dirty[5]&&(wn&&oo&&!Ui(wn)&&on(wn)?(e=>{const t=gn(An(Ri(e),st));if(!t)return;const o=t.map(oo);let i=!1;!0===e.pathClose?i=!0:Ni(e)?i=!jo(e,"pathClose"):o.length>2&&(i=!0);const n="hook"===e.selectionStyle,r=n?o.map((e,t,o)=>({id:Ib,points:Pn(o,t),strokeColor:[0,0,0,.1],strokeWidth:2})):[{id:Ib,points:o.map(e=>be(e.x+1,e.y+1)),strokeColor:[0,0,0,.1],strokeWidth:2,pathClose:i}],a=n?o.map((e,t,o)=>({id:Ib,points:Pn(o,t),strokeColor:gt,strokeWidth:2})):[{id:Ib,points:o,strokeColor:gt,strokeWidth:2,pathClose:i}];Sn(...r,...a)})(wn):vn()),884736&e.$$.dirty[0]|8192&e.$$.dirty[2]&&i(192,I=w&&f&&at&&C?(e=>{const t=$n(e),o=oo({x:t.origin.x+t.dir.x,y:t.origin.y+t.dir.y});return{origin:oo(t.origin),position:o}})(p):void 0),8&e.$$.dirty[0]|64&e.$$.dirty[6]&&i(32,E=I&&be(I.position.x-Ke.x,I.position.y-Ke.y)),491520&e.$$.dirty[0]|8192&e.$$.dirty[2]&&i(194,A=w&&b&&at&&C?(e=>{const t=gn(e);let o=2;e.flipX&&e.flipY?o=0:e.flipX?o=3:e.flipY&&(o=1);const i={...t[o]};return oo({x:i.x,y:i.y})})(p):void 0),8&e.$$.dirty[0]|256&e.$$.dirty[6]&&i(31,L=A&&be(A.x-Ke.x,A.y-Ke.y)),32768&e.$$.dirty[6]&&i(184,W=!!(Ee||[]).find(e=>[91,93,17].includes(e))),524288&e.$$.dirty[3]|536870912&e.$$.dirty[5]&&i(186,F=!(W||!po)),8192&e.$$.dirty[0]|8192&e.$$.dirty[2]|16777232&e.$$.dirty[5]|33&e.$$.dirty[6]&&r&&k&&at>0&&(r===wn&&Rn(),((e,t,o)=>{if(!on(t))return;const i=Ni(t),n=i&&jo(t,"pathClose"),r=n&&(e=>e.strokeWidth&&(e=>{const t=e.strokeColor;return!!t&&(3===t.length||t[3]>0)})(e))(t),a=Zi(t),s=Hi(t),l="hook"===t.selectionStyle,c=!0!==t.disableShowPoints,{selectionOpacity:d=1}=t;if(a&&i&&!n)return;const u=[],p=[...k],h=p[p.length-1],g=p[0],$=(s?.05:.1)*e*d,f=$>0,y=(s?.5:1)*e*d,b=y>0,x=[0,0,0],v=[1,1,1],S=s?1:1.5;Ee.includes(16)&&h&&o&&Mo(h,o);const w=p.length&&n&&a&&o?ze(g,o):1/0,C=p.length&&n&&a&&o?ze(h,o):1/0,T=w<=Rb,M=C<=Rb;!T&&o&&p.push(o);const P=p.length>1;let R=!1;!0===t.pathClose?R=!0:Ni(t)?R=Zi(t)?T:!jo(t,"pathClose"):p.length>2&&(R=!0),P&&f&&(l?u.push(...p.map((e,t,o)=>({id:Cn,points:Pn(o,t),strokeColor:x,opacity:$}))):u.push({id:Cn,points:p.map(e=>be(e.x+1,e.y+1)),pathClose:R,strokeColor:x,strokeWidth:2,opacity:$})),n&&f&&c&&u.push(...p.map(e=>({id:Cn,...e,rx:2*S,ry:2*S,backgroundColor:x,opacity:$}))),I&&f&&u.push({id:Cn,points:[be(I.origin.x+1,I.origin.y+1),be(I.position.x+1,I.position.y+1)],strokeColor:x,strokeWidth:2,opacity:$}),P&&b&&(l?u.push(...p.map((e,t,o)=>({id:Cn,points:Pn(o,t),strokeColor:v,strokeWidth:S,opacity:y}))):u.push({id:Cn,points:p,pathClose:R,strokeColor:v,strokeWidth:S,backgroundColor:a&&n&&t.backgroundColor&&t.backgroundColor[3]>0?t.backgroundColor:[0,0,0,0],opacity:y})),n&&c&&u.push(...p.map(e=>({id:Cn,...e,rx:3*S,ry:3*S,backgroundColor:[.5,.5,.5],strokeWidth:S,strokeColor:v}))),n&&a&&c&&k.length>=3&&u.push({...g,id:Cn,rx:S*(T?5:4),ry:S*(T?5:4),backgroundColor:T?gt:[.5,.5,.5],strokeWidth:S,strokeColor:v}),n&&a&&r&&c&&!T&&m.length>=2&&u.push({...h,id:Cn,rx:S*(M?5:4),ry:S*(M?5:4),backgroundColor:M?gt:[.5,.5,.5],strokeWidth:S,strokeColor:v}),I&&b&&!l&&u.push({id:Cn,points:[{x:I.origin.x,y:I.origin.y},{x:I.position.x,y:I.position.y}],strokeColor:v,strokeWidth:S,opacity:y}),Mn(...u)})(at,r,d&&Ni(r)?Fn({...xr},!F):void 0)),8192&e.$$.dirty[0]&&(r||(Rn(),Tn())),131072&e.$$.dirty[6]&&i(190,z=Fe.length&&Fe[Fe.length-1]._isDraft?Fe[Fe.length-1]:null),4&e.$$.dirty[0]|1073741824&e.$$.dirty[4]|8&e.$$.dirty[5]|16&e.$$.dirty[6]&&z&&z.points&&z.points.length>=1&&z.pathClose&&kr&&Fo&&qe.update(e=>e.map(e=>e.id!==z.id?e:{...e,pointerPoint:{...kr}})),4096&e.$$.dirty[3]|8&e.$$.dirty[6])if(g.length){En();const e=g.map(e=>({id:In,points:e.map(oo),strokeWidth:1,strokeColor:[1,1,1,.5],pathClose:!0}));Ln(...e)}else En();4&e.$$.dirty[5]&&i(187,D=!!wn),1&e.$$.dirty[5]&&i(188,O=!!Ii),16&e.$$.dirty[5]|7&e.$$.dirty[6]&&(!xr||O||D||Fn({...xr},!F)),131072&e.$$.dirty[2]|2101248&e.$$.dirty[3]|1073741824&e.$$.dirty[5]|65536&e.$$.dirty[6]&&mo>0&&n&&oo&&((e,t,o,i)=>{const n=oo({x:0,y:0}),r=oo({x:e,y:e}),a=oo({x:t.width,y:t.height}),s=r.x-n.x;if(On.set(s>6?1:0),i<=0)return Wn();const l=Do(s,n.x,a.x).map(e=>({id:Bn,opacity:i,points:[{x:e,y:n.y},{x:e,y:a.y}],strokeWidth:1,strokeColor:o})),c=Do(s,n.y,a.y).map(e=>({id:Bn,opacity:i,points:[{x:n.x,y:e},{x:a.x,y:e}],strokeWidth:1,strokeColor:o}));_n(...c,...l)})(mo,n,ft,Le),262144&e.$$.dirty[2]|4096&e.$$.dirty[3]|805306368&e.$$.dirty[4]|536870912&e.$$.dirty[5]&&oo&&(W?Nn():((e,t,o)=>{if(null===e&&null===t)return Nn();let i,n;null!==e&&(i={id:Vn,strokeColor:o,strokeWidth:1.5,points:[oo({x:e,y:0}),oo({x:e,y:st.height})]}),null!==t&&(n={id:Vn,strokeColor:o,strokeWidth:1.5,points:[oo({x:0,y:t}),oo({x:st.width,y:t})]}),Hn(i,n)})(Ao,Lo,yt)),4096&e.$$.dirty[2]&&(e=>{if(!e)return si({_prerender:!1});const t=xe.find(e=>e.isEditing);t&&ri(t,{_prerender:"inline"===bt})})(rt),32768&e.$$.dirty[6]&&Ee&&Ee.length&&(()=>{const[e]=Ee;8!==e&&46!==e||di()&&(r.isEditing||nn(r)&&(eu(document.activeElement)||(Ni(r)&&No(r.selectedPoint)?setTimeout(()=>Xo(r,r.selectedPoint),0):setTimeout(()=>pi(),0))))})(),576&e.$$.dirty[0]&&jn&&"inline"===bt&&jn.focus(),8192&e.$$.dirty[0]&&i(183,_=r&&Di(r)),8192&e.$$.dirty[0]|268435456&e.$$.dirty[5]&&i(14,V=_&&!1!==sn(r)&&Hi(r)),16384&e.$$.dirty[0]&&i(178,H=V?{...r}:void 0),16384&e.$$.dirty[2]|8388608&e.$$.dirty[5]&&i(180,j=H&&An({...H},st)),33554432&e.$$.dirty[5]&&i(182,U=j&&hi(j.text,j)),167772160&e.$$.dirty[5]&&(G=j&&ht(j.x,j.y,U.width,U.height)),24576&e.$$.dirty[0]&&i(28,Z=V?r.text:""),24592&e.$$.dirty[0]|16384&e.$$.dirty[2]&&i(181,X=lt&&r&&V&&An({...Ri(r),width:No(r.width)?Math.floor(r.width):void 0,height:No(r.height)?Math.floor(r.height):void 0},st)),16448&e.$$.dirty[0]|67108864&e.$$.dirty[5]&&i(30,Y=V&&((e,t)=>{const{textAlign:o="left",fontFamily:i="sans-serif",fontWeight:n="normal",fontStyle:r="normal",letterSpacing:a="normal",textShadowX:s=0,textShadowY:l=0,textShadowBlur:c=0,textShadowColor:d,textOutlineWidth:u=0,textOutlineColor:p}=e,h="!important",m=`caret-color:${K};text-align:${o}${h};font-family:${i}${h};font-weight:${n}${h};font-style:${r}${h};letter-spacing:${No(a)?a+"px":"normal"}${h}`;if("modal"===t)return m;const g=u?`;-webkit-text-stroke:${2*u}px ${Qo(p)} ${h}`:"",$=c||s||l?`;text-shadow:${s}px ${l}px ${c}px ${Qo(d)} ${h}`:"";let f=e.fontSize,y=1,b="";f>1e3&&N()&&(y=f/1e3,b=`transform-origin:0 0;transform:scale(${y})`,f=1e3);let x=e.lineHeight/y;const v=Qo(e.color),S=.5*Math.max(0,f-x);return`--font-scalar:${y};--bottom-inset:${S}px;padding:${S}px 0 0${h};color:${v}${h};font-size:${f}px${h};line-height:${x}px${h};${m};${b}${g}${$}`})(X,bt)),16392&e.$$.dirty[0]|2304&e.$$.dirty[2]|67108864&e.$$.dirty[5]&&i(29,q=V&&((e,t,o,i)=>{let n,a;e.width&&e.height?(n=mt(e),a=He(e)):(a=hi(r.text,p),a.width=p.width||a.width,n=be(e.x+.5*a.width,e.y+.5*a.height));const s=Math.max(0,e.fontSize-e.lineHeight)+e.lineHeight,l=oo(n);let c=l.x-t.x-.5*a.width,d=l.y-t.y-.5*a.height,u=e.flipX,h=e.flipY,m=e.rotation;tt&&it?(u=!u,h=!h):tt?(u=!u,m=-m):it&&(h=!h,m=-m),m+=i;const g=o*(u?-1:1),$=o*(h?-1:1);return`--line-height:${s}px;width:${a.width}px;height:${a.height}px;transform:translate(${c}px,${d}px) rotate(${m}rad) scale(${g}, ${$})`})(X,Ke,nt,Je)),65536&e.$$.dirty[2]&&(K=$t?Qo($t):"auto"),16960&e.$$.dirty[0]&&V&&jn&&"inline"===bt&&Un(Z),8192&e.$$.dirty[0]|1056&e.$$.dirty[5]&&i(165,J=r&&!h?r:J),1024&e.$$.dirty[5]&&i(167,Q=J&&an(J)),1024&e.$$.dirty[5]&&i(162,te=J&&ln(J)),1024&e.$$.dirty[5]&&i(164,oe=J&&rn(J)),1024&e.$$.dirty[5]&&i(163,ie=J&&nn(J)),2098176&e.$$.dirty[5]&&i(166,ne=!s&&J&&(e=>!0!==e.disableReorder)(J)),1024&e.$$.dirty[5]&&i(161,re=J&&!1!==sn(J)),1024&e.$$.dirty[5]&&i(168,ae=J&&jo(J,"backgroundImage")&&en(J,"opacity")),8256&e.$$.dirty[0]&&i(171,se=r&&"html"===r.format&&"inline"===bt),8192&e.$$.dirty[0]|65568&e.$$.dirty[5]&&i(175,le=r&&(!h||se)),1048578&e.$$.dirty[5]|16384&e.$$.dirty[6]&&gr.set(le&&!qi?1:0,{hard:!1===ke}),32768&e.$$.dirty[0]|1310720&e.$$.dirty[5]&&i(173,ce=le&&C.length?(o=dt(C),Pe(be(o.x+.5*o.width,o.y),Kd)):ce),1056&e.$$.dirty[0]|786432&e.$$.dirty[5]&&i(172,de=(P||ce)&&$r&&pt&&((e,t,o,i)=>{const n=e.x,r=e.y,a=n+e.width;let s=Math.max(t.x-.5*o.width,n),l=Math.max(t.y-o.height+i,r);return s+o.width>a&&(s=a-o.width),be(s,l)})(pt,P||ce,$r,-16)),131072&e.$$.dirty[5]&&i(27,ue=de?`translate(${de.x}px, ${de.y}px)`:void 0),4194304&e.$$.dirty[0]|131072&e.$$.dirty[5]&&i(26,pe=de?Se:void 0),16384&e.$$.dirty[0]&&i(170,he=V?"text":"shape"),12544&e.$$.dirty[0]|33536&e.$$.dirty[3]|131008&e.$$.dirty[5]|8192&e.$$.dirty[6]&&i(25,me="text"===he&&Qt&&se?wm(()=>Qt([["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",title:"Remove styles",label:[["span","T",{style:"font-size:1.25em;font-style:italic;font-family:Times New Roman;text-decoration:underline",textContent:"T"}],["span","x",{style:"position:relative;top:.175rem;",innerHTML:"&times;"}]]}]]]],u)):"shape"===he&&Jt&&u?wm(()=>Jt(M?[["div","epsilon",{class:"PinturaShapeControlsGroup"},[["Button","remove-point",{onclick:er,label:co.shapeTitleButtonRemove,icon:co.shapeIconButtonRemove,shortcut:["Backspace"],hideLabel:!0}]]]]:[ae&&["div","alpha",{class:"PinturaShapeControlsGroup"},[["ToggleSlider","adjust-opacity",{onrelease:cr,onchange:lr,step:.01,value:jo(r,"opacity")?r.opacity:1,label:(e,t,o)=>`${Math.round(e/o*100)}%`,min:0,max:1,direction:"x"}]]],["div","beta",{class:"PinturaShapeControlsGroup"},[Q&&["Button","flip-horizontal",{onclick:ar,label:co.shapeTitleButtonFlipHorizontal,icon:co.shapeIconButtonFlipHorizontal,hideLabel:!0}],Q&&ro&&["Button","flip-vertical",{onclick:sr,label:co.shapeTitleButtonFlipVertical,icon:co.shapeIconButtonFlipVertical,hideLabel:!0}],ne&&["Button","to-front",{onclick:pr,label:co.shapeTitleButtonMoveToFront,icon:co.shapeIconButtonMoveToFront,hideLabel:!0,disabled:xe[xe.length-1]===J}],oe&&["Button","duplicate",{onclick:hr,label:co.shapeTitleButtonDuplicate,icon:co.shapeIconButtonDuplicate,shortcut:["CMD","D"],hideLabel:!0}],ie&&["Button","remove",{onclick:dr,label:co.shapeTitleButtonRemove,icon:co.shapeIconButtonRemove,shortcut:["Backspace"],hideLabel:!0}]].filter(Boolean)],re&&te&&["div","gamma",{class:"PinturaShapeControlsGroup"},[["Button","text-layout",{onclick:rr,label:bu(yr,co,r),icon:bu(fr,co,r),hideLabel:!0}]]],re&&["div","delta",{class:"PinturaShapeControlsGroup"},[["Button","edit-text",{label:co.shapeLabelInputText,onclick:tr}]]]].filter(Boolean),u)):[]),256&e.$$.dirty[0]|8192&e.$$.dirty[6]&&i(24,$e=xe.filter(on).filter(e=>e.id).filter(e=>!Zi(e)).map(e=>({id:e.id,color:Di(e)?e.color:Vi(e)?e.strokeColor:e.backgroundColor,name:e.name||co[`shapeLabelTool${bs(kn(e))}`]}))),2048&e.$$.dirty[0]&&Mr&&Mr.addEventListener("touchmove",Pr,!1)},[Xe,Ye,qe,Ke,lt,pt,bt,lo,co,jn,$r,Mr,u,r,V,C,p,b,w,f,T,x,Se,br,$e,me,pe,ue,Z,q,Y,L,E,R,v,fo,Po,e=>{const{origin:t}=e.detail,o=so&&Ee.includes(16);Li=void 0,i(155,Ii=void 0),Ei=void 0,Ai=void 0,ji=!1,Pi=void 0,Gi=!1,Yi=!1,Eo(),clearTimeout(Mi),Mi=setTimeout(()=>i(156,qi=!0),250);const n=Ko();if(!n||Ni(n)&&jo(n,"pathClose")||ti(),Ti=to(ve(t)),n&&Ni(n)&&jo(n,"pathClose"))return xt(e);const l=ki(xe,Ti,no,e=>on(e)),c=l.length&&l.shift();if(r&&Hi(r))if(c!==r)Yn();else{const e=jo(r,"height"),t=!e&&jo(r,"width");if(e||t){const e=Ri(r),t=Ri(e);An(t,st);const o=Qe(hi(e.text,t),e=>Math.ceil(e)),i=Ze(t.width,t.height||o.height);or(i,e,t);const n=ki([{...e,strokeWidth:"5%"}],Ti,0);Yi=0===n.length}}if(r&&ao&&(Gi=!0),!c&&r&&Hi(r)&&yi(r),!eo(t))return;if(c&&Ui(c))return ji=!0,i(155,Ii=c),s?(o&&yi(c),void Ki(a)):(Ei=Ri(Ii),void(Ai=An(Ri(Ii),st)));Pi=Yo()?void 0:c||void 0;if(!xt(e)&&c){if(fi(c,!0,o),i(155,Ii=c),s)return Ki(a);Ei=Ri(Ii),Ai=An(Ri(Ii),st)}},e=>{hn(),Ct(e)},e=>{const{translation:t,ctrlKey:o,metaKey:i,shiftKey:r,position:s}=e.detail;if(Ii){if(!pn(Ii))return;if(Hi(Ii)){if(!Yi)return;Yn()}if(r){let e=Math.abs(t.x),o=Math.abs(t.y);"x"===mn&&(o-=64),"y"===mn&&(e-=64),e>o?(t.y=0,mn="x"):o>e&&(t.x=0,mn="y")}else mn=null;const e=o||i;if(Li){if(!a.every(pn))return;return void Li.forEach(({shape:e,shapeOriginComputed:o})=>{Vo(e,o,t,{...$o(0,mo,n,e)})})}return Vo(Ii,Ai,t,{...$o(e?0:uo,mo,n,Ii)})}vt(e)},e=>{if(hn(),Ii){if(!s){if(e.detail.isTap&&Ni(Ii)&&dn(Ii)){const{position:t}=e.detail,o=to(ve(t));return void((e,t)=>{const o=e.points,i=[];for(let e=0;e<o.length-1;e++)i.push([o[e],o[e+1]]);i.push([o[o.length-1],o[0]]);const n=i.findIndex(([e,o])=>jt(t,6,e,o));let r;const a=[];for(let e=0;e<i.length;e++)a.push(i[e][0]),e===n&&(r=e+1,a.push(t));To(e,{points:a,selectedPoint:r},st),ii()})(Ii,o)}e.detail.isTap&&ji&&Di(Ii)&&!1!==sn(Ii)&&bi(Ii)}}else St(e)},e=>{const t=Pi&&e.detail.isTap,o=so&&Ee.includes(16);if(e.detail.isTap&&setTimeout(()=>{Vt({target:Ii||Pi,position:Ti},0)}),Ii)return Ft(Ii),n=Ii,r=Ei,JSON.stringify(n)!==JSON.stringify(r)&&Mt(Ii),void i(155,Ii=void 0);var n,r;let a=!0;if(!o){const e=$i();a=!e||Yt(e,Pi||void 0),a&&gi({storePrevious:!1})}wt(e),a&&t&&fi(Pi,!0,o)},On,e=>{i(156,qi=!0),i(155,Ii=r),Ai=p},e=>{if(!Ii)return void i(156,qi=!1);const{translation:t,indexes:o,shiftKey:r,ctrlKey:a,metaKey:s,isNudge:l}=e.detail;Go(Ii,Ai,o,t,{shiftKey:!l&&r,...$o(a||s?0:uo,mo,n,Ii)}),cn(Ii)&&ze(t)>16&&ri(Ii,{selectedPoint:void 0})},e=>{if(!Ii)return void i(156,qi=!1);fi(Ii);const{isTap:t,translation:o,indexes:n}=e.detail;t&&(cn(Ii)&&ri(Ii,{selectedPoint:Ii.selectedPoint===n[0]?void 0:n[0]}),Ft(Ii)),i(155,Ii=void 0),i(156,qi=!1),Mt(r)},e=>{Zo=$n(p).origin,i(156,qi=!0),i(155,Ii=r),Ai=p},e=>{if(!Ii)return void i(156,qi=!1);const{translation:t,shiftKey:o}=e.detail;((e,t,o,i)=>{const n=wi(An(Ri(e),st)),r=mt(n),a=zo(Zo,o);let s=Te(a,r)+Math.PI/2;if(i.shiftKey){const e=Math.PI/16;s=e*Math.round(s/e)-Je%e}To(e,{rotation:s},st),ii()})(Ii,0,t,{shiftKey:o})},()=>{Ii?(fi(Ii),i(155,Ii=void 0),i(156,qi=!1),Mt(r)):i(156,qi=!1)},e=>{i(156,qi=!0),i(155,Ii=r),Ai=p},e=>{if(!Ii)return void i(156,qi=!1);const{translation:t,ctrlKey:o,metaKey:r}=e.detail;((e,t,o,i)=>{const n=ct(t),r=hi(t.text,t);n.width||(n.width=r.width),n.height||(n.height=r.height);let a=2;e.flipX&&e.flipY?a=0:e.flipX?a=3:e.flipY&&(a=1),Go(e,t,[a],o,{...i,aspectRatio:n.width/n.height,beforeResizeShape:e=>{const o=e.width/n.width;e.fontSize=t.fontSize*o,t.width||delete e.width,t.height||delete e.height}})})(Ii,Ai,t,{...$o(o||r?0:uo,mo,n,Ii)})},()=>{Ii?(fi(Ii),i(155,Ii=void 0),i(156,qi=!1),Mt(r)):i(156,qi=!1)},e=>{const{key:t}=e,o=/escape/i.test(t);if(/enter/i.test(t),di())return o?(e.preventDefault(),e.stopPropagation(),yi(r)):void(oe&&"d"===t&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.stopPropagation(),mr()))},e=>{const t=sn(r,e);return!0===t?e:t},Zn,e=>{const{target:t,key:o}=e,i=t.value||t.innerText,n=t.selectionStart||0,a=t.selectionEnd||i.length,s=i.substring(0,n)+o+i.substring(a);if(sn(r,s)!==s)return e.preventDefault()},e=>Oi(r)&&/enter/i.test(e.key)&&!1!==r.disableNewline?e.preventDefault():/arrow/i.test(e.code)?e.stopPropagation():/escape/i.test(e.key)?qn():void 0,Xn,e=>{if(Xn(e))return Yn()},Yn,qn,gr,e=>{const t=li();t&&(t.find(Hi)||t.find(e=>!pn(e))||t.forEach(t=>{i(155,Ii=t),Ai=An(Ri(Ii),st),Vo(Ii,Ai,e.detail)}))},e=>{i(23,br=!0)},({relatedTarget:e})=>{e&&e.classList.contains("shape-selector__button")||i(23,br=!1)},e=>{if("touch"===e.pointerType||"PinturaShapeEditor"!==e.target.className)return void Nt();(qi||Mi)&&Cr(void 0);const t=cb(e,lt);i(159,xr=ve(t));const o=Pe(to(t),e=>Math.round(e));if(Me(o,kr))return;if(i(158,kr=ve(o)),Wt(qi,t,o),qi||Mi)return;if(h||Yo())return;const[n]=ki(xe,o,0,on);n&&Zi(n)||Cr(n)},e=>{"touch"!==e.pointerType&&Nt()},Tr,Ue,Ge,Je,tt,it,nt,rt,at,st,gt,$t,ft,yt,xt,vt,St,wt,Ct,Tt,Mt,Et,At,Lt,Ft,zt,Dt,Wt,Vt,Nt,Xt,Yt,qt,Kt,Jt,Qt,eo,to,oo,io,no,ro,ao,so,uo,po,ho,mo,bo,xo,vo,So,wo,ko,Co,(e,t={})=>{let o,r,a;i(154,Fo=!1);let s=[],l=_i(e),c=Di(e),d="relative"===t.position;const u=t.interpolateInput,p=go(),h=e=>{if(!uo)return e;const t=to(e),{snapTranslation:o,snapLines:i}=Wo(Oo(t),p,uo,mo,n);return _o(e,o),Io(i),e},m=!!$i(),g=t.isSelection?qe:Ye,$="step"===t.inputMode;if(Ni(e)){if($){i(154,Fo=!0);let t=!1;const n=(e,o)=>{const i=xo(g),n=i.points,r=e&&be(yb(e.x,st.width),yb(e.y,st.height)),a=r&&oo(r);Ee.includes(16)&&a&&Mo(a,o);const s=to(o),l=n.length?n[0]:s,c=be(yb(l.x,st.width),yb(l.y,st.height)),u=oo(c),p=ze(u,o);if(!t&&1===n.length&&p<36)return So(g);if(n.length>2&&p<=Rb){i.pathClose=!0,delete i.pointerPoint,on(i)&&fi(i);const e=wo(g);return void Tt(e)}const h=i.strokeWidth&&i.strokeColor&&(void 0===i.strokeColor[3]||i.strokeColor[3]>0),m=ze(a,o);if(h&&!0!==i.pathClose&&n.length>1&&m<Rb){delete i.pointerPoint,i.pathClose=!1,i.backgroundColor=[0,0,0,0],on(i)&&fi(i);const e=wo(g);return void Tt(e)}return n.length>0&&m<100?void 0:d?bb(s,st):s};return{start:e=>{const i=xo(g),{origin:s}=e.detail;if(r=4,o=h(ve(s)),a=ve(o),i){const e=i.points,t=e[e.length-1],r=n(t,o);return r&&(i.points=[...e,r]),void ko({points:i.points},g)}t=!0},update:e=>{if(!t)return;const i=xo(g);if(!i)return;const r=i.points[0],a=n(r,be(o.x+e.detail.translation.x,o.y+e.detail.translation.y));a&&(i.points[1]=a,ko({points:i.points},g))},release:e=>{e.detail.preventInertia()},cancel:()=>{So(g)},end:i=>{if(!t)return;const n=to(o),r=d?bb(n,st):n,{isTap:a}=i.detail;if(a){if(ki(xe,n,0,on).length)return So(g)}vo({...e,points:[r]},g)}}}return{start:t=>{const{origin:i}=t.detail;r=4,o=ve(i),a=ve(o),s.push({...a});const n=to(o),l=d?bb(n,st):n;vo({...e,points:[l]},g)},update:e=>{const t=xo(g);if(!t)return;const{translation:i}=e.detail,n=be(o.x+i.x,o.y+i.y),l=De(a,n);if(ge(l,5)<=r)return;const c=[],p=Te(n,a),h=r-l,m={x:a.x+h*Math.cos(p),y:a.y+h*Math.sin(p)};if(s.push({...m}),u&&t.points.length>1){const e=s.length,t=Math.ceil(l/10);let o=l/30;const i=s[e-3],n=s[e-2],r=s[e-1];s[e-4]||(o*=.1),c.push(..._t(i,n,r,t,o).slice(1,-1)),s.splice(e-1,0,...c)}c.push(m),a.x=m.x,a.y=m.y,ko({points:t.points.concat(c.map(e=>{const t=to(e);return d?bb(t,st):t}))},g)},release:e=>e.detail.preventInertia(),cancel:()=>{So(g)},end:e=>{const t=xo(g);if(!t)return;if(e.detail.isTap){let e=!1;if(t.bitmap?(Pi&&(e=!0),m&&(e=!0)):e=!0,e)return So(g)}const o=wo(g);Tt(o)}}}return l||c||Wi(e)?{start:t=>{const{origin:i}=t.detail;o=h(ve(i));const n=to(o),r=d?bb(n,st):n,a=-1*Ro(Je,tt,it),s={...e,rotation:a,...r};s.flipX=tt,s.flipY=it,delete s.position,s.opacity=0;(l?["rx","ry"]:["width","height"]).forEach(e=>{s[e]=d?"0%":0}),vo(s,g)},update:e=>{const t=xo(g);if(!t)return;t.opacity=1;let{aspectRatio:i}=t,{translation:n,shiftKey:r,ctrlKey:a}=e.detail;!i&&r&&(i=1);const s=h(be(o.x+n.x,o.y+n.y)),c=to(o),d=to(s);if(i){const e=dt([c,d]),t=Pt(e,i),o=d.x<c.x?-1:1,n=d.y<c.y?-1:1;d.x=c.x+t.width*o,d.y=c.y+t.height*n}const u={x:c.x+.5*(d.x-c.x),y:c.y+.5*(d.y-c.y)},p=Ro(Je,tt,it);we(c,p,u),we(d,p,u);const m=Math.min(c.x,d.x),$=Math.min(c.y,d.y);let f=Math.max(c.x,d.x)-m,y=Math.max(c.y,d.y)-$,b={};l?(a?(b.x=c.x,b.y=c.y):(b.x=m+.5*f,b.y=$+.5*y),b.rx=.5*f,b.ry=.5*y):(a?(b.x=c.x-.5*f,b.y=c.y-.5*y):(b.x=m,b.y=$),b.width=f,b.height=y),ko(b,g,(e,t)=>To(e,t,st))},release:e=>{e.detail.preventInertia()},cancel:()=>{So(g)},end:e=>{const t=xo(g);if(t){if(e.detail.isTap){if(Di(t)&&ao&&Gi)return So(g);if(!Di(t)||!ao||Pi)return So(g);delete t.width,delete t.height,!1!==t.disableNewline&&delete t.textAlign;const e=An({...t},st),i=hi(t.text,e),n=to({x:o.x,y:o.y-.5*i.height}),r=to({x:o.x+i.width,y:o.y+.5*i.height}),a={x:n.x+.5*(r.x-n.x),y:n.y+.5*(r.y-n.y)},s=Ro(Je,tt,it);we(n,s,a),we(r,s,a);let l=Math.min(n.x,r.x),c=Math.min(n.y,r.y);l<0&&(l=0),c<0&&(c=0),l+i.width>st.width&&(l=st.width-i.width),c+i.height>st.height&&(c=st.height-i.height),t.x=y(t.x)?Jo(l,st.width):l,t.y=y(t.y)?Jo(c,st.height):c}if(t.opacity=1,Di(t)){const e=An({...t},st);if(No(e.width)&&e.width<1||No(e.height)&&e.height<1)return So(g);Tt(t)}else{const e=wo(g);Tt(e)}on(t)&&fi(t),Di(t)&&bi(t)}}}:Vi(e)?{start:t=>{const{origin:i}=t.detail,n=to(h(i)),r=Pe(n,Kd);o=ve(i),vo({...e,x1:d?Jo(r.x,st.width):r.x,y1:d?Jo(r.y,st.height):r.y,x2:d?Jo(r.x,st.width):r.x,y2:d?Jo(r.y,st.height):r.y,opacity:0},g)},update:e=>{if(!xo(g))return;const{translation:t}=e.detail,i=h(Re(ve(o),t));if(Ee.includes(16)){const e=De(o,i),t=Te(o,i),n=Math.PI/4,r=n*Math.round(t/n);i.x=o.x+e*Math.cos(r),i.y=o.y+e*Math.sin(r)}const n=to(i);ko({x2:d?Jo(n.x,st.width):n.x,y2:d?Jo(n.y,st.height):n.y,opacity:1},g)},release:e=>e.detail.preventInertia(),cancel:()=>{So(g)},end:e=>{const t=xo(g);if(!t)return;if(e.detail.isTap)return So(g);t.opacity=1;const o=wo(g);Tt(o),on(t)&&fi(o)}}:void 0},()=>{let e,t;const o=io*io,i=(e,t,i=!1)=>{const n=ze(e,t);if(!i&&n<2)return!1;const r=xe.filter(tn);let a;a=n<o?ki(r,to(t),io):Ci(r,to(e),to(t),io);return vi(a).forEach(Lt),!0};return{start:o=>{e=be(Math.round(o.detail.origin.x),Math.round(o.detail.origin.y)),i(e,e,!0),t=e},update:o=>{const{translation:n}=o.detail,r=be(Math.round(e.x+n.x),Math.round(e.y+n.y));i(t,r)&&(t=ve(r))},release:e=>e.detail.preventInertia(),cancel:()=>{So(collection)},end:()=>{}}},Yo,qo,()=>{if(!Yo())return;const e=[...Fe];e.splice(qo(),1),qe.set(e)},Ko,ei,e=>{if(!Ko())return Ji(e),Co(e)},ti,oi,(e={})=>({id:B(),...e}),ii,ni,ri,ai,(e,t,o=!0)=>{xe.forEach(o=>ai(o,e,t,!1)),o&&ii()},si,li,ci,di,gi,fi,yi,bi,xi,vi,Si,wi,ki,Ci,Ao,Lo,Fo,Ii,qi,wn,kr,xr,h,re,te,ie,oe,J,ne,Q,ae,M,he,se,de,ce,P,le,s,a,H,d,j,X,U,_,W,n,F,D,O,g,z,k,I,m,A,c,S,$,l,xe,ke,Ee,Le,Fe,function(t){wa.call(this,e,t)},e=>Tr(e),function(e){Ca[e?"unshift":"push"](()=>{jn=e,i(9,jn)})},function(){Z=this.value,i(28,Z),i(14,V),i(13,r),i(183,_),i(0,Xe),i(199,xe)},e=>{const{key:t}=e;if("Enter"===t){if(Xn(e))return!0;if(!1===r.disableNewline)return!1}return!0},function(e){Ca[e?"unshift":"push"](()=>{jn=e,i(9,jn)})},()=>{Mr&&Mr.focus()},e=>i(10,$r=e.detail),function(e){Ca[e?"unshift":"push"](()=>{Mr=e,i(11,Mr)})},e=>cb(e,lt)]}class Lb extends rs{constructor(e){super(),ns(this,e,Ab,Pb,yr,{uid:68,ui:69,disabled:0,shapes:1,selection:2,offset:3,contextRotation:70,contextFlipX:71,contextFlipY:72,contextZoom:73,active:74,opacity:75,parentRect:76,rootRect:4,utilRect:5,hoverColor:77,caretColor:78,gridColor:79,snapColor:80,textInputMode:6,oninteractionstart:81,oninteractionupdate:82,oninteractionrelease:83,oninteractionend:84,oninteractioncancel:85,onaddshape:86,onupdateshape:87,onselectshape:88,onblurshape:89,onremoveshape:90,ontapshape:91,onhovershape:92,ontriggerhistorywrite:93,onhovercanvas:94,ontapcanvas:95,onleavecanvas:96,beforeSelectShape:97,beforeDeselectShape:98,beforeRemoveShape:99,beforeUpdateShape:100,willRenderShapeControls:101,willRenderShapeTextControls:102,willStartInteraction:103,mapEditorPointToImagePoint:104,mapImagePointToEditorPoint:105,eraseRadius:106,selectRadius:107,enableButtonFlipVertical:108,enableTapToAddText:109,enableMultiSelect:110,enableTextStyleControls:7,locale:8,snapThreshold:111,snapPointer:112,enableSnapToContext:113,gridSize:114,syncShapeCollection:115,getShapeDraft:116,addShapeDraft:117,discardShapeDraft:118,confirmShapeDraft:119,updateShapeDraft:120,addShape:121,createShape:122,eraseShape:123,getSelectionItemDraft:124,getSelectionItemDraftIndex:125,discardSelectionItemDraft:126,getMarkupItemDraft:127,getMarkupItemDraftIndex:128,addMarkupItemDraft:129,confirmMarkupItemDraft:130,discardMarkupItemDraft:131,createMarkupItem:132,syncShapes:133,removeMarkupShapeProps:134,updateMarkupShape:135,updateMarkupShapeProperty:136,updateMarkupItemsShapeProperty:137,updateMarkupShapeItems:138,getActiveMarkupItems:139,getActiveMarkupItem:140,hasActiveMarkupItem:141,blurShapes:142,selectShape:143,deselectMarkupItem:144,editMarkupItem:145,finishEditMarkupItem:146,removeMarkupItems:147,getTextShapeRect:148,getMarkupShapeRect:149,getShapesNearPosition:150,getShapesBetweenPoints:151},null,[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}get syncShapeCollection(){return this.$$.ctx[115]}get getShapeDraft(){return this.$$.ctx[116]}get addShapeDraft(){return this.$$.ctx[117]}get discardShapeDraft(){return this.$$.ctx[118]}get confirmShapeDraft(){return this.$$.ctx[119]}get updateShapeDraft(){return this.$$.ctx[120]}get addShape(){return this.$$.ctx[121]}get createShape(){return this.$$.ctx[122]}get eraseShape(){return this.$$.ctx[123]}get getSelectionItemDraft(){return this.$$.ctx[124]}get getSelectionItemDraftIndex(){return this.$$.ctx[125]}get discardSelectionItemDraft(){return this.$$.ctx[126]}get getMarkupItemDraft(){return this.$$.ctx[127]}get getMarkupItemDraftIndex(){return this.$$.ctx[128]}get addMarkupItemDraft(){return this.$$.ctx[129]}get confirmMarkupItemDraft(){return this.$$.ctx[130]}get discardMarkupItemDraft(){return this.$$.ctx[131]}get createMarkupItem(){return this.$$.ctx[132]}get syncShapes(){return this.$$.ctx[133]}get removeMarkupShapeProps(){return this.$$.ctx[134]}get updateMarkupShape(){return this.$$.ctx[135]}get updateMarkupShapeProperty(){return this.$$.ctx[136]}get updateMarkupItemsShapeProperty(){return this.$$.ctx[137]}get updateMarkupShapeItems(){return this.$$.ctx[138]}get getActiveMarkupItems(){return this.$$.ctx[139]}get getActiveMarkupItem(){return this.$$.ctx[140]}get hasActiveMarkupItem(){return this.$$.ctx[141]}get blurShapes(){return this.$$.ctx[142]}get selectShape(){return this.$$.ctx[143]}get deselectMarkupItem(){return this.$$.ctx[144]}get editMarkupItem(){return this.$$.ctx[145]}get finishEditMarkupItem(){return this.$$.ctx[146]}get removeMarkupItems(){return this.$$.ctx[147]}get getTextShapeRect(){return this.$$.ctx[148]}get getMarkupShapeRect(){return this.$$.ctx[149]}get getShapesNearPosition(){return this.$$.ctx[150]}get getShapesBetweenPoints(){return this.$$.ctx[151]}}function Fb(e){let t,o,i;return o=new Rh({props:{items:e[2]}}),{c(){t=Ur("ul"),ts(o.$$.fragment),Qr(t,"class","PinturaShapeStyleList")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};4&t&&(i.items=e[2]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function zb(e){let t,o;return t=new Gh({props:{class:"PinturaShapeStyles",elasticity:e[0],$$slots:{default:[Db]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1&o&&(i.elasticity=e[0]),524292&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Db(e){let t,o,i;return o=new Rh({props:{items:e[2]}}),{c(){t=Ur("ul"),ts(o.$$.fragment),Qr(t,"class","PinturaShapeStyleList")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};4&t&&(i.items=e[2]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function Ob(e){let t,o,i,n;const r=[zb,Fb],a=[];function s(e,t){return e[1]?0:1}return o=s(e),i=a[o]=r[o](e),{c(){t=Ur("div"),i.c(),aa(t,"opacity",e[5]),aa(t,"pointer-events",e[4]),aa(t,"visibility",e[3])},m(e,i){Hr(e,t,i),a[o].m(t,null),n=!0},p(e,[n]){let l=o;o=s(e),o===l?a[o].p(e,n):(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha(),i=a[o],i?i.p(e,n):(i=a[o]=r[o](e),i.c()),ja(i,1),i.m(t,null)),32&n&&aa(t,"opacity",e[5]),16&n&&aa(t,"pointer-events",e[4]),8&n&&aa(t,"visibility",e[3])},i(e){n||(ja(i),n=!0)},o(e){Ua(i),n=!1},d(e){e&&jr(t),a[o].d()}}}function Bb(e,t,o){let i,n,r,a,s,l,c,d,{isActive:u=!1}=t,{controls:p=[]}=t,{locale:h}=t,{scrollElasticity:m}=t,{scrollEnable:g=!0}=t,{hideTitles:$=!1}=t,{willRenderControls:f=ee}=t;const y=Sa("redrawTrigger");wr(e,y,e=>o(16,l=e));const b=Sa("env");wr(e,b,e=>o(15,s=e));const x=Sa("isAnimated");wr(e,x,e=>o(18,d=e));const v=Fc(0,{stiffness:.25,damping:.9});return wr(e,v,e=>o(17,c=e)),e.$$set=e=>{"isActive"in e&&o(10,u=e.isActive),"controls"in e&&o(11,p=e.controls),"locale"in e&&o(12,h=e.locale),"scrollElasticity"in e&&o(0,m=e.scrollElasticity),"scrollEnable"in e&&o(1,g=e.scrollEnable),"hideTitles"in e&&o(13,$=e.hideTitles),"willRenderControls"in e&&o(14,f=e.willRenderControls)},e.$$.update=()=>{263168&e.$$.dirty&&v.set(u?1:0,{hard:!1===d}),131072&e.$$.dirty&&o(5,i=c),1024&e.$$.dirty&&o(4,n=u?"auto":"none"),131072&e.$$.dirty&&o(3,r=c<=0?"hidden":"visible"),129024&e.$$.dirty&&o(2,a=l&&f(p.map(e=>["ShapeStyle",e.id,{title:e.componentProps.title,locale:h,hideTitle:$,items:[[e.component,e.id,e.componentProps]]}]),s,()=>y.set({})))},[m,g,a,r,n,i,y,b,x,v,u,p,h,$,f,s,l,c,d]}class Wb extends rs{constructor(e){super(),ns(this,e,Bb,Ob,yr,{isActive:10,controls:11,locale:12,scrollElasticity:0,scrollEnable:1,hideTitles:13,willRenderControls:14})}}function _b(e,t,o){const i=e.slice();return i[15]=t[o].key,i[6]=t[o].controls,i[16]=t[o].isActive,i}function Vb(e,t){let o,i,n;return i=new Wb({props:{isActive:t[16],controls:t[6],locale:t[1],scrollElasticity:t[2],scrollEnable:t[3],hideTitles:t[4],willRenderControls:t[5]}}),{key:e,first:null,c(){o=Yr(),ts(i.$$.fragment),this.first=o},m(e,t){Hr(e,o,t),os(i,e,t),n=!0},p(e,o){t=e;const n={};128&o&&(n.isActive=t[16]),128&o&&(n.controls=t[6]),2&o&&(n.locale=t[1]),4&o&&(n.scrollElasticity=t[2]),8&o&&(n.scrollEnable=t[3]),16&o&&(n.hideTitles=t[4]),32&o&&(n.willRenderControls=t[5]),i.$set(n)},i(e){n||(ja(i.$$.fragment,e),n=!0)},o(e){Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(i,e)}}}function Nb(e){let t,o,i,n=[],r=new Map,a=Xa(e[7]);const s=e=>e[15];for(let t=0;t<a.length;t+=1){let o=_b(e,a,t),i=s(o);r.set(i,n[t]=Vb(i,o))}return{c(){t=Ur("div");for(let e=0;e<n.length;e+=1)n[e].c();Qr(t,"class",o=ld(["PinturaShapeStyleEditor",!e[3]&&"PinturaShapeStyleEditorOverflow",e[0]]))},m(e,o){Hr(e,t,o);for(let e=0;e<n.length;e+=1)n[e]&&n[e].m(t,null);i=!0},p(e,[l]){190&l&&(a=Xa(e[7]),Na(),n=Ka(n,l,s,1,e,a,r,t,qa,Vb,null,_b),Ha()),(!i||9&l&&o!==(o=ld(["PinturaShapeStyleEditor",!e[3]&&"PinturaShapeStyleEditorOverflow",e[0]])))&&Qr(t,"class",o)},i(e){if(!i){for(let e=0;e<a.length;e+=1)ja(n[e]);i=!0}},o(e){for(let e=0;e<n.length;e+=1)Ua(n[e]);i=!1},d(e){e&&jr(t);for(let e=0;e<n.length;e+=1)n[e].d()}}}function Hb(e,t,o){let i,n,r,{class:a}=t,{controls:s={}}=t,{shapeProps:l}=t,{onchange:c}=t,{locale:d}=t,{scrollElasticity:u}=t,{scrollEnable:p=!0}=t,{hideTitles:h=!1}=t,{willRenderControls:m}=t;const g=[];return e.$$set=e=>{"class"in e&&o(0,a=e.class),"controls"in e&&o(6,s=e.controls),"shapeProps"in e&&o(8,l=e.shapeProps),"onchange"in e&&o(9,c=e.onchange),"locale"in e&&o(1,d=e.locale),"scrollElasticity"in e&&o(2,u=e.scrollElasticity),"scrollEnable"in e&&o(3,p=e.scrollEnable),"hideTitles"in e&&o(4,h=e.hideTitles),"willRenderControls"in e&&o(5,m=e.willRenderControls)},e.$$.update=()=>{64&e.$$.dirty&&o(11,i=Object.keys(s).filter(e=>s[e])),2304&e.$$.dirty&&o(10,n=l&&Object.keys(l).length&&i&&en(l)?(e=>{const t=i.filter(t=>t.split("_").every(t=>jo(e,t)&&en(e,t))).map(t=>{const o=(e.settings&&e.settings[t]||{}).control||t,i=t.split("_");let n=i.length>1?i.map(t=>e[t]):e[t];if(L(s[o])){const{title:i,component:r}=s[o](n,e=>{c({[t]:e})},{selectedShapeId:e.id});return{id:o,component:Rh,componentProps:{title:i,items:r}}}let[r,a]=s[o];if(y(r)&&s[r]){const e={...a};[r,a]=s[r],a={...a,...e}}const l=L(a.options)?a.options(e):a.options;return"RadioGroup"===r&&(a.selectedIndex=-1),L(a.formatValue)&&(n=a.formatValue(n)),{id:o,component:r,componentProps:{...a,options:l,locale:d,value:n,optionLabelClass:"PinturaButtonLabel",onchange:o=>{let n=I(o)&&!Uo(o)?o.value:o;L(a.formatValue)&&(n=a.formatValue(n)),a.onchange&&a.onchange(n,e);const r=i.length>1?i.reduce((e,t,o)=>({...e,[t]:Array.isArray(n)?n[o]:n}),{}):{[t]:n};c(r)}}}}).filter(Boolean);return t})(l):[]),1280&e.$$.dirty&&o(7,r=((e,t)=>{let o=g.find(t=>t.key===e);return o||(o={key:e,controls:t},g.push(o)),g.forEach(e=>e.isActive=!1),o.controls=t,o.isActive=!0,g})(l&&Object.keys(l).length?Object.keys(l).join("_"):"none",n||[]))},[a,d,u,p,h,m,s,r,l,c,n,i]}class jb extends rs{constructor(e){super(),ns(this,e,Hb,Nb,yr,{class:0,controls:6,shapeProps:8,onchange:9,locale:1,scrollElasticity:2,scrollEnable:3,hideTitles:4,willRenderControls:5})}}var Ub=e=>/<svg /.test(e);function Gb(e){let t,o;return t=new Rh({props:{items:e[10]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Zb(e){let t,o,i,n;const r=[Yb,Xb],a=[];function s(e,t){return e[8]?0:1}return t=s(e),o=a[t]=r[t](e),{c(){o.c(),i=Yr()},m(e,o){a[t].m(e,o),Hr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?a[t].p(e,n):(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha(),o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),ja(o,1),o.m(i.parentNode,i))},i(e){n||(ja(o),n=!0)},o(e){Ua(o),n=!1},d(e){e&&jr(i),a[t].d(e)}}}function Xb(e){let t,o,i,n,r=e[10]&&qb(e);return i=new Gh({props:{scrollAutoCancel:e[9],elasticity:e[0],$$slots:{default:[Kb]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),r&&r.c(),o=Xr(),ts(i.$$.fragment),Qr(t,"class","PinturaShapePresetsFlat")},m(e,a){Hr(e,t,a),r&&r.m(t,null),_r(t,o),os(i,t,null),n=!0},p(e,n){e[10]?r?(r.p(e,n),1024&n&&ja(r,1)):(r=qb(e),r.c(),ja(r,1),r.m(t,o)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha());const a={};512&n&&(a.scrollAutoCancel=e[9]),1&n&&(a.elasticity=e[0]),536871070&n&&(a.$$scope={dirty:n,ctx:e}),i.$set(a)},i(e){n||(ja(r),ja(i.$$.fragment,e),n=!0)},o(e){Ua(r),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(t),r&&r.d(),is(i)}}}function Yb(e){let t,o,i,n,r;o=new Gh({props:{elasticity:e[0],class:"PinturaShapePresetsGroups",$$slots:{default:[ix]},$$scope:{ctx:e}}});const a=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[11]},e[12]];let s={$$slots:{default:[rx,({panel:e,panelIsActive:t})=>({26:e,27:t}),({panel:e,panelIsActive:t})=>(e?67108864:0)|(t?134217728:0)]},$$scope:{ctx:e}};for(let e=0;e<a.length;e+=1)s=hr(s,a[e]);return n=new Rd({props:s}),{c(){t=Ur("div"),ts(o.$$.fragment),i=Xr(),ts(n.$$.fragment),Qr(t,"class","PinturaShapePresetsGrouped")},m(e,a){Hr(e,t,a),os(o,t,null),_r(t,i),os(n,t,null),r=!0},p(e,t){const i={};1&t&&(i.elasticity=e[0]),536876128&t&&(i.$$scope={dirty:t,ctx:e}),o.$set(i);const r=6144&t?Ja(a,[a[0],a[1],2048&t&&{panels:e[11]},4096&t&&Qa(e[12])]):{};738206239&t&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||(ja(o.$$.fragment,e),ja(n.$$.fragment,e),r=!0)},o(e){Ua(o.$$.fragment,e),Ua(n.$$.fragment,e),r=!1},d(e){e&&jr(t),is(o),is(n)}}}function qb(e){let t,o;return t=new Rh({props:{items:e[10]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Kb(e){let t,o;return t=new Xd({props:{items:e[7],onclickitem:e[1],ongrabitem:e[2],ondragitem:e[3],ondropitem:e[4]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};128&o&&(i.items=e[7]),2&o&&(i.onclickitem=e[1]),4&o&&(i.ongrabitem=e[2]),8&o&&(i.ondragitem=e[3]),16&o&&(i.ondropitem=e[4]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Jb(e){let t,o;return t=new Rh({props:{items:e[10]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Qb(e){let t,o;return t=new Od({props:{$$slots:{default:[ex]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};805306368&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ex(e){let t,o=e[28].icon+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){268435456&i&&o!==(o=e[28].icon+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function tx(e){let t,o,i=e[28].label+"";return{c(){t=Ur("span"),o=Zr(i)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){268435456&t&&i!==(i=e[28].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function ox(e){let t,o,i,n=e[28].icon&&Qb(e),r=!e[28].hideLabel&&tx(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Yr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[28].icon?n?(n.p(e,i),268435456&i&&ja(n,1)):(n=Qb(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[28].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=tx(e),r.c(),r.m(o.parentNode,o))},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}function ix(e){let t,o,i,n=e[10]&&Jb(e);const r=[{class:"PinturaControlList"},{tabs:e[5]},e[12],{layout:"compact"}];let a={$$slots:{default:[ox,({tab:e})=>({28:e}),({tab:e})=>e?268435456:0]},$$scope:{ctx:e}};for(let e=0;e<r.length;e+=1)a=hr(a,r[e]);return o=new $d({props:a}),o.$on("select",e[18]),{c(){n&&n.c(),t=Xr(),ts(o.$$.fragment)},m(e,r){n&&n.m(e,r),Hr(e,t,r),os(o,e,r),i=!0},p(e,i){e[10]?n?(n.p(e,i),1024&i&&ja(n,1)):(n=Jb(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha());const a=4128&i?Ja(r,[r[0],32&i&&{tabs:e[5]},4096&i&&Qa(e[12]),r[3]]):{};805306368&i&&(a.$$scope={dirty:i,ctx:e}),o.$set(a)},i(e){i||(ja(n),ja(o.$$.fragment,e),i=!0)},o(e){Ua(n),Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),n&&n.d(e),is(o,e)}}}function nx(e){let t,o;return t=new Xd({props:{items:e[13][e[26]].items,disabled:e[13][e[26]].disabled,onclickitem:e[1],ongrabitem:e[2],ondragitem:e[3],ondropitem:e[4]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};67117056&o&&(i.items=e[13][e[26]].items),67117056&o&&(i.disabled=e[13][e[26]].disabled),2&o&&(i.onclickitem=e[1]),4&o&&(i.ongrabitem=e[2]),8&o&&(i.ondragitem=e[3]),16&o&&(i.ondropitem=e[4]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function rx(e){let t,o;return t=new Gh({props:{scroll:e[27]?{scrollOffset:0,animate:!1}:void 0,scrollAutoCancel:e[9],elasticity:e[0],$$slots:{default:[nx]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};134217728&o&&(i.scroll=e[27]?{scrollOffset:0,animate:!1}:void 0),512&o&&(i.scrollAutoCancel=e[9]),1&o&&(i.elasticity=e[0]),603987998&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ax(e){let t,o,i,n;const r=[Zb,Gb],a=[];function s(e,t){return e[9]?0:e[10]?1:-1}return~(o=s(e))&&(i=a[o]=r[o](e)),{c(){t=Ur("div"),i&&i.c(),Qr(t,"class","PinturaShapePresetsPalette")},m(e,i){Hr(e,t,i),~o&&a[o].m(t,null),n=!0},p(e,[n]){let l=o;o=s(e),o===l?~o&&a[o].p(e,n):(i&&(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha()),~o?(i=a[o],i?i.p(e,n):(i=a[o]=r[o](e),i.c()),ja(i,1),i.m(t,null)):i=null)},i(e){n||(ja(i),n=!0)},o(e){Ua(i),n=!1},d(e){e&&jr(t),~o&&a[o].d()}}}function sx(e,t,i){let n,r,a,s,l,c,d,u,p,{locale:h}=t,{presets:m}=t,{scrollElasticity:g}=t,{enableSelectImage:$=!0}=t,{willRenderPresetToolbar:f=ee}=t,{onaddpreset:b=o}=t,{ongrabpreset:x}=t,{ondragpreset:v}=t,{ondroppreset:S}=t;const w=`presets-${B()}`,k=(e,t="")=>Ub(e)?e:Ho(e)?qo(e,t):`<img src="${e}" alt="${t}"/>`,C=e=>Y(Jt(e)),T=["src","alt","thumb","shape","id","mount","disabled"],M=e=>e.map(e=>(e=>Uo(e)&&y(e[0])&&Uo(e[1]))(e)?{...e[2],id:`${w}-${e[0].toLowerCase()}`,label:e[0],items:M(e[1])}:(e=>{let t,o,i,n,r,a,s,l=e;return y(e)?Ho(e)?(t=e,r=e,n=k(t,r)):(t=e,r=C(t),n=k(t,r)):(t=e.src,r=e.alt||(y(t)?C(t):y(e.thumb)?C(e.thumb):void 0),n=k(e.thumb||t,r),o=e.shape,a=e.mount,s=e.disabled,i=Object.keys(e).reduce((t,o)=>(T.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&&i(14,h=e.locale),"presets"in e&&i(15,m=e.presets),"scrollElasticity"in e&&i(0,g=e.scrollElasticity),"enableSelectImage"in e&&i(16,$=e.enableSelectImage),"willRenderPresetToolbar"in e&&i(17,f=e.willRenderPresetToolbar),"onaddpreset"in e&&i(1,b=e.onaddpreset),"ongrabpreset"in e&&i(2,x=e.ongrabpreset),"ondragpreset"in e&&i(3,v=e.ondragpreset),"ondroppreset"in e&&i(4,S=e.ondroppreset)},e.$$.update=()=>{32768&e.$$.dirty&&i(7,n=M(m)),128&e.$$.dirty&&i(9,r=n.length),640&e.$$.dirty&&i(8,a=r&&n.some(e=>!!e.items)),384&e.$$.dirty&&i(5,s=a&&n),384&e.$$.dirty&&i(13,l=a&&n.reduce((e,t)=>(e[t.id]=t,e),{})),96&e.$$.dirty&&i(6,c=c||s&&(s.find(e=>!e.disabled)||{}).id),64&e.$$.dirty&&i(12,d={name:w,selected:c}),32&e.$$.dirty&&i(11,u=s&&s.map(e=>e.id)),212994&e.$$.dirty&&i(10,p=h&&f([$&&["Button","browse",{label:h.shapeLabelButtonSelectSticker,icon:h.shapeIconButtonSelectSticker,onclick:()=>{Sm().then(e=>{e&&b(e)})}}]]))},[g,b,x,v,S,s,c,n,a,r,p,u,d,l,h,m,$,f,({detail:e})=>i(6,c=e)]}class lx extends rs{constructor(e){super(),ns(this,e,sx,ax,yr,{locale:14,presets:15,scrollElasticity:0,enableSelectImage:16,willRenderPresetToolbar:17,onaddpreset:1,ongrabpreset:2,ondragpreset:3,ondroppreset:4})}}function cx(e){let t,o,i,n;return t=new Rh({props:{items:e[30]}}),i=new jb({props:{locale:e[4],shapeProps:e[49],onchange:e[85],controls:e[9],scrollEnable:!1,hideTitles:!0,willRenderControls:e[165]}}),{c(){ts(t.$$.fragment),o=Xr(),ts(i.$$.fragment)},m(e,r){os(t,e,r),Hr(e,o,r),os(i,e,r),n=!0},p(e,o){const n={};1073741824&o[0]&&(n.items=e[30]),t.$set(n);const r={};16&o[0]&&(r.locale=e[4]),262144&o[1]&&(r.shapeProps=e[49]),512&o[0]&&(r.controls=e[9]),i.$set(r)},i(e){n||(ja(t.$$.fragment,e),ja(i.$$.fragment,e),n=!0)},o(e){Ua(t.$$.fragment,e),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(t,e),is(i,e)}}}function dx(e){let t,o,i;return o=new Pf({props:{$$slots:{default:[cx]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"slot","header")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};1073742352&t[0]|262144&t[1]|268435456&t[6]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function ux(e){let t,o;const i=[{locale:e[4]},{ui:e[69]},{shapes:e[5]},{selection:e[58]},{uid:e[20]},{parentRect:e[37]},{rootRect:e[55]},{utilRect:e[39]},{offset:e[50]},{disabled:e[38]},{contextRotation:e[23]},{contextFlipX:e[24]},{contextFlipY:e[25]},{contextZoom:e[36]?e[36].scale:void 0},{active:e[35]},{opacity:e[56]},{hoverColor:e[57]},{caretColor:e[57]},{snapColor:e[57]},{gridColor:[1,1,1,.125]},{eraseRadius:e[47]},{selectRadius:e[6]},{enableButtonFlipVertical:e[10]},{enableMultiSelect:e[14]},{mapEditorPointToImagePoint:e[21]},{mapImagePointToEditorPoint:e[22]},{enableTapToAddText:e[13]},{textInputMode:e[8]},{snapThreshold:e[16]},{snapPointer:!e[48]},{enableSnapToContext:e[17]},{gridSize:e[15]},{willStartInteraction:e[95]},{oninteractionstart:e[79]},{oninteractionupdate:e[80]},{oninteractionrelease:e[81]},{oninteractionend:e[83]},{oninteractioncancel:e[82]},{onleavecanvas:e[87]},{onhovercanvas:e[86]},{onhovershape:e[89]},{ontapcanvas:e[88]},{onaddshape:e[156]},{onselectshape:e[157]},{onblurshape:e[158]},{ontapshape:e[159]},{onupdateshape:e[160]},{onremoveshape:e[161]},{ontriggerhistorywrite:e[162]},e[42]];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Lb({props:n}),e[163](t),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=66315632&o[0]|252381681&o[1]|255721600&o[2]|12&o[3]?Ja(i,[16&o[0]&&{locale:e[4]},128&o[2]&&{ui:e[69]},32&o[0]&&{shapes:e[5]},134217728&o[1]&&{selection:e[58]},1048576&o[0]&&{uid:e[20]},64&o[1]&&{parentRect:e[37]},16777216&o[1]&&{rootRect:e[55]},256&o[1]&&{utilRect:e[39]},524288&o[1]&&{offset:e[50]},128&o[1]&&{disabled:e[38]},8388608&o[0]&&{contextRotation:e[23]},16777216&o[0]&&{contextFlipX:e[24]},33554432&o[0]&&{contextFlipY:e[25]},32&o[1]&&{contextZoom:e[36]?e[36].scale:void 0},16&o[1]&&{active:e[35]},33554432&o[1]&&{opacity:e[56]},67108864&o[1]&&{hoverColor:e[57]},67108864&o[1]&&{caretColor:e[57]},67108864&o[1]&&{snapColor:e[57]},i[19],65536&o[1]&&{eraseRadius:e[47]},64&o[0]&&{selectRadius:e[6]},1024&o[0]&&{enableButtonFlipVertical:e[10]},16384&o[0]&&{enableMultiSelect:e[14]},2097152&o[0]&&{mapEditorPointToImagePoint:e[21]},4194304&o[0]&&{mapImagePointToEditorPoint:e[22]},8192&o[0]&&{enableTapToAddText:e[13]},256&o[0]&&{textInputMode:e[8]},65536&o[0]&&{snapThreshold:e[16]},131072&o[1]&&{snapPointer:!e[48]},131072&o[0]&&{enableSnapToContext:e[17]},32768&o[0]&&{gridSize:e[15]},4&o[3]&&{willStartInteraction:e[95]},131072&o[2]&&{oninteractionstart:e[79]},262144&o[2]&&{oninteractionupdate:e[80]},524288&o[2]&&{oninteractionrelease:e[81]},2097152&o[2]&&{oninteractionend:e[83]},1048576&o[2]&&{oninteractioncancel:e[82]},33554432&o[2]&&{onleavecanvas:e[87]},16777216&o[2]&&{onhovercanvas:e[86]},134217728&o[2]&&{onhovershape:e[89]},67108864&o[2]&&{ontapcanvas:e[88]},1&o[1]|8&o[3]&&{onaddshape:e[156]},1&o[1]&&{onselectshape:e[157]},1&o[1]&&{onblurshape:e[158]},1&o[1]&&{ontapshape:e[159]},1&o[1]|8&o[3]&&{onupdateshape:e[160]},1&o[1]|8&o[3]&&{onremoveshape:e[161]},8&o[3]&&{ontriggerhistorywrite:e[162]},2048&o[1]&&Qa(e[42])]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(o){e[163](null),is(t,o)}}}function px(e){let t,o,i,n,r,a=e[51]&&ux(e);return{c(){t=Ur("div"),a&&a.c(),Qr(t,"slot","main"),aa(t,"cursor",e[46])},m(s,l){Hr(s,t,l),a&&a.m(t,null),e[164](t),i=!0,n||(r=[qr(t,"keydown",e[84]),Ar(o=ed.call(null,t,{disabled:!e[12]})),qr(t,"dropfiles",e[94]),Ar(qc.call(null,t)),qr(t,"measure",e[152])],n=!0)},p(e,i){e[51]?a?(a.p(e,i),1048576&i[1]&&ja(a,1)):(a=ux(e),a.c(),ja(a,1),a.m(t,null)):a&&(Na(),Ua(a,1,1,()=>{a=null}),Ha()),o&&fr(o.update)&&4096&i[0]&&o.update.call(null,{disabled:!e[12]}),32768&i[1]&&aa(t,"cursor",e[46])},i(e){i||(ja(a),i=!0)},o(e){Ua(a),i=!1},d(o){o&&jr(t),a&&a.d(),e[164](null),n=!1,$r(r)}}}function hx(e){let t,o;return t=new lx({props:{locale:e[4],presets:e[19],enableSelectImage:e[11],willRenderPresetToolbar:e[43],onaddpreset:e[93],ongrabpreset:e[90],ondragpreset:e[91],ondroppreset:e[92],scrollElasticity:e[44]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),524288&o[0]&&(i.presets=e[19]),2048&o[0]&&(i.enableSelectImage=e[11]),4096&o[1]&&(i.willRenderPresetToolbar=e[43]),8192&o[1]&&(i.scrollElasticity=e[44]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function mx(e){let t,o,i,n="stack"===e[7]&&gx(e),r=(e[53]&&e[34]||"row"===e[7])&&yx(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Yr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){"stack"===e[7]?n?(n.p(e,i),128&i[0]&&ja(n,1)):(n=gx(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[53]&&e[34]||"row"===e[7]?r?(r.p(e,i),128&i[0]|4194312&i[1]&&ja(r,1)):(r=yx(e),r.c(),ja(r,1),r.m(o.parentNode,o)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}function gx(e){let t,o,i,n;const r=[fx,$x],a=[];function s(e,t){return e[45]?0:1}return o=s(e),i=a[o]=r[o](e),{c(){t=Ur("div"),i.c(),Qr(t,"class","PinturaControlPanels")},m(e,i){Hr(e,t,i),a[o].m(t,null),n=!0},p(e,n){let l=o;o=s(e),o===l?a[o].p(e,n):(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha(),i=a[o],i?i.p(e,n):(i=a[o]=r[o](e),i.c()),ja(i,1),i.m(t,null))},i(e){n||(ja(i),n=!0)},o(e){Ua(i),n=!1},d(e){e&&jr(t),a[o].d()}}}function $x(e){let t,o,i;return o=new jb({props:{locale:e[4],shapeProps:e[49],onchange:e[85],controls:e[9],scrollElasticity:e[44],willRenderControls:e[18]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaControlPanel")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};16&t[0]&&(i.locale=e[4]),262144&t[1]&&(i.shapeProps=e[49]),512&t[0]&&(i.controls=e[9]),8192&t[1]&&(i.scrollElasticity=e[44]),262144&t[0]&&(i.willRenderControls=e[18]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function fx(e){let t,o,i;return o=new lx({props:{locale:e[4],presets:e[19],enableSelectImage:e[11],willRenderPresetToolbar:e[43],onaddpreset:e[93],ongrabpreset:e[90],ondragpreset:e[91],ondroppreset:e[92],scrollElasticity:e[44]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaControlPanel")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};16&t[0]&&(i.locale=e[4]),524288&t[0]&&(i.presets=e[19]),2048&t[0]&&(i.enableSelectImage=e[11]),4096&t[1]&&(i.willRenderPresetToolbar=e[43]),8192&t[1]&&(i.scrollElasticity=e[44]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function yx(e){let t,o;return t=new Gh({props:{class:"PinturaControlListScroller",elasticity:e[44],$$slots:{default:[Cx]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8192&o[1]&&(i.elasticity=e[44]),262801&o[0]|262154&o[1]|268435456&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function bx(e){let t,o;return t=new Xu({props:{locale:e[4],class:"PinturaControlList",optionClass:"PinturaControlListOption",layout:"row",options:e[32],selectedIndex:e[32].findIndex(e[153]),onchange:e[78],$$slots:{option:[wx,({option:e})=>({213:e}),({option:e})=>[0,0,0,0,0,0,e?134217728:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),2&o[1]&&(i.options=e[32]),1&o[0]|2&o[1]&&(i.selectedIndex=e[32].findIndex(e[153])),16&o[0]|402653184&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function xx(e){let t,o;return t=new Od({props:{$$slots:{default:[vx]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]|402653184&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function vx(e){let t,o=(L(e[213].icon)?e[213].icon(e[4]):e[213].icon)+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){16&i[0]|134217728&i[6]&&o!==(o=(L(e[213].icon)?e[213].icon(e[4]):e[213].icon)+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function Sx(e){let t,o,i=(L(e[213].label)?e[213].label(e[4]):e[213].label)+"";return{c(){t=Ur("span"),o=Zr(i)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){16&t[0]|134217728&t[6]&&i!==(i=(L(e[213].label)?e[213].label(e[4]):e[213].label)+"")&&na(o,i)},d(e){e&&jr(t)}}}function wx(e){let t,o,i,n=e[213].icon&&xx(e),r=!e[213].hideLabel&&Sx(e);return{c(){t=Ur("div"),n&&n.c(),o=Xr(),r&&r.c(),Qr(t,"slot","option")},m(e,a){Hr(e,t,a),n&&n.m(t,null),_r(t,o),r&&r.m(t,null),i=!0},p(e,i){e[213].icon?n?(n.p(e,i),134217728&i[6]&&ja(n,1)):(n=xx(e),n.c(),ja(n,1),n.m(t,o)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[213].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=Sx(e),r.c(),r.m(t,null))},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(e){e&&jr(t),n&&n.d(),r&&r.d()}}}function kx(e){let t,o;return t=new jb({props:{locale:e[4],shapeProps:e[49],onchange:e[85],controls:e[9],scrollEnable:!1,hideTitles:!0,willRenderControls:e[154]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),262144&o[1]&&(i.shapeProps=e[49]),512&o[0]&&(i.controls=e[9]),262144&o[0]&&(i.willRenderControls=e[154]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Cx(e){let t,o,i,n=e[34]&&bx(e),r="row"===e[7]&&kx(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Yr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[34]?n?(n.p(e,i),8&i[1]&&ja(n,1)):(n=bx(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),"row"===e[7]?r?(r.p(e,i),128&i[0]&&ja(r,1)):(r=kx(e),r.c(),ja(r,1),r.m(o.parentNode,o)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}function Tx(e){let t,o;return t=new Gh({props:{class:"PinturaControlListScroller",elasticity:e[44],$$slots:{default:[Ix]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8192&o[1]&&(i.elasticity=e[44]),134217744&o[0]|8388608&o[1]|268435456&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Mx(e){let t,o;return t=new Od({props:{$$slots:{default:[Px]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]|402653184&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Px(e){let t,o=(L(e[213].icon)?e[213].icon(e[4]):e[213].icon)+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){16&i[0]|134217728&i[6]&&o!==(o=(L(e[213].icon)?e[213].icon(e[4]):e[213].icon)+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function Rx(e){let t,o,i,n,r,a=(L(e[213].label)?e[213].label(e[4]):e[213].label)+"",s=e[213].icon&&Mx(e);return{c(){t=Ur("div"),s&&s.c(),o=Xr(),i=Ur("span"),n=Zr(a),Qr(t,"slot","option")},m(e,a){Hr(e,t,a),s&&s.m(t,null),_r(t,o),_r(t,i),_r(i,n),r=!0},p(e,i){e[213].icon?s?(s.p(e,i),134217728&i[6]&&ja(s,1)):(s=Mx(e),s.c(),ja(s,1),s.m(t,o)):s&&(Na(),Ua(s,1,1,()=>{s=null}),Ha()),(!r||16&i[0]|134217728&i[6])&&a!==(a=(L(e[213].label)?e[213].label(e[4]):e[213].label)+"")&&na(n,a)},i(e){r||(ja(s),r=!0)},o(e){Ua(s),r=!1},d(e){e&&jr(t),s&&s.d()}}}function Ix(e){let t,o;return t=new Xu({props:{locale:e[4],class:"PinturaControlList",optionClass:"PinturaControlListOption",layout:"row",options:e[54],selectedIndex:e[54].findIndex(e[155]),onchange:e[77],$$slots:{option:[Rx,({option:e})=>({213:e}),({option:e})=>[0,0,0,0,0,0,e?134217728:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),8388608&o[1]&&(i.options=e[54]),134217728&o[0]|8388608&o[1]&&(i.selectedIndex=e[54].findIndex(e[155])),16&o[0]|402653184&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Ex(e){let t,o,i,n,r;const a=[mx,hx],s=[];function l(e,t){return e[52]?0:e[45]?1:-1}~(o=l(e))&&(i=s[o]=a[o](e));let c=e[33]&&Tx(e);return{c(){t=Ur("div"),i&&i.c(),n=Xr(),c&&c.c(),Qr(t,"slot","footer"),aa(t,"transform",e[40])},m(e,i){Hr(e,t,i),~o&&s[o].m(t,null),_r(t,n),c&&c.m(t,null),r=!0},p(e,r){let d=o;o=l(e),o===d?~o&&s[o].p(e,r):(i&&(Na(),Ua(s[d],1,1,()=>{s[d]=null}),Ha()),~o?(i=s[o],i?i.p(e,r):(i=s[o]=a[o](e),i.c()),ja(i,1),i.m(t,n)):i=null),e[33]?c?(c.p(e,r),4&r[1]&&ja(c,1)):(c=Tx(e),c.c(),ja(c,1),c.m(t,null)):c&&(Na(),Ua(c,1,1,()=>{c=null}),Ha()),512&r[1]&&aa(t,"transform",e[40])},i(e){r||(ja(i),ja(c),r=!0)},o(e){Ua(i),Ua(c),r=!1},d(e){e&&jr(t),~o&&s[o].d(),c&&c.d()}}}function Ax(e){let t,o;return t=new Nf({props:{hasHeader:e[41],$$slots:{footer:[Ex],main:[px],header:[dx]},$$scope:{ctx:e}}}),t.$on("measure",e[166]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o[1]&&(i.hasHeader=e[41]),2080374769&o[0]|134216703&o[1]|268435456&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Lx(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,b,x,v,S,w,k,C,T,M,P,R,I,E,A,L,F,z,D,O,B,W,_,V,N,H,j,U,G,Z,X,Y,q,K,J,Q,te,oe,ie,ne,re,ae,se,le,ce,de,ue,pe,he,me,ge,$e,fe,ye,xe=ur,ve=()=>(xe(),xe=vr(Ie,e=>o(35,X=e)),Ie),Se=ur,we=()=>(Se(),Se=vr(ze,e=>o(145,J=e)),ze),ke=ur,Ce=()=>(ke(),ke=vr(ft,e=>o(37,ae=e)),ft),Te=ur,Me=()=>(Te(),Te=vr(Ae,e=>o(151,me=e)),Ae),Pe=ur,Re=()=>(Pe(),Pe=vr(Ee,e=>o(56,fe=e)),Ee);e.$$.on_destroy.push(()=>xe()),e.$$.on_destroy.push(()=>Se()),e.$$.on_destroy.push(()=>ke()),e.$$.on_destroy.push(()=>Te()),e.$$.on_destroy.push(()=>Pe());let{isActive:Ie}=t;ve();let{isActiveFraction:Ee}=t;Re();let{isVisible:Ae}=t;Me();let{stores:Le}=t,{locale:Fe={}}=t,{shapes:ze}=t;we();let{toolbar:Oe=[]}=t,{toolShapes:We={}}=t,{toolActive:_e}=t,{toolSelectRadius:Ve}=t,{toolRetainStyles:Ne=!1}=t,{toolbarLayout:He="stack"}=t,{textInputMode:je}=t,{shapeControls:Ue={}}=t,{enableButtonFlipVertical:Ge=!1}=t,{enablePresetSelectImage:Ze=!0}=t,{enablePresetDropImage:Xe=!0}=t,{enableSelectToolToAddShape:Ye=!1}=t,{enableAutoSelectMoveTool:qe=["line","arrow","path","rectangle","ellipse","text"]}=t,{enableTapToAddText:Ke=!1}=t,{enableMoveTool:Je=!1}=t,{enableViewTool:Qe=!1}=t,{enableToolShareStyles:et=!0}=t,{enableMultiSelect:tt=!1}=t,{gridSize:ot=0}=t,{snapThreshold:it=0}=t,{enableSnapToContext:nt=!0}=t,{willRenderHeaderTools:rt=ee}=t,{willRenderPresetToolbar:at}=t,{willRenderShapeStyleControls:st}=t,{willStartInteraction:lt}=t,{shapePresets:ct=[]}=t,{utilKey:dt}=t,{mapScreenPointToImagePoint:ut}=t,{mapImagePointToScreenPoint:pt}=t,{imageRotation:ht=0}=t,{imageFlipX:gt=!1}=t,{imageFlipY:$t=!1}=t,{parentRect:ft}=t;Ce();let{hooks:yt={}}=t;const bt=Sa("selection");wr(e,bt,e=>o(150,ue=e));const xt=Sa("isAnimated");wr(e,xt,e=>o(142,Y=e));const vt=Sa("elasticityMultiplier");wr(e,vt,e=>o(146,Q=e));const St=Sa("ui");wr(e,St,e=>o(177,pe=e));const wt=Sa("keysPressed");let kt;wr(e,wt,e=>o(149,de=e));const{env:Ct,history:Mt,rootRect:Pt,rootColorSecondary:Rt,enablePanInput:It,enablePanInputStatus:Et,enableZoomInput:At,stageRect:Lt,utilRectPadded:Ft,scrollElasticity:zt,imageOverlayMarkup:Dt,imagePreviewModifiers:Ot,imageCropRect:Bt,stageScalar:Wt,imageSelectionRect:_t,imageTransformsInterpolated:Vt,imageSelectionPan:Nt,imageSize:Ht,allowPan:jt,allowZoom:Ut,allowZoomControls:Gt,allowPlayPause:Zt}=Le;wr(e,Ct,e=>o(143,q=e)),wr(e,Pt,e=>o(55,$e=e)),wr(e,Rt,e=>o(57,ye=e)),wr(e,Et,e=>o(38,le=e)),wr(e,Lt,e=>o(147,te=e)),wr(e,Ft,e=>o(39,he=e)),wr(e,Ot,e=>o(178,ge=e)),wr(e,Bt,e=>o(176,se=e)),wr(e,Wt,e=>o(174,ne=e)),wr(e,_t,e=>o(175,re=e)),wr(e,Vt,e=>o(36,oe=e)),wr(e,Nt,e=>o(173,ie=e)),wr(e,Ht,e=>o(148,ce=e));let Xt=0,Yt={};const qt=e=>{const[t,o]=kt[e];let i,n,r="relative"===o.position;const a=r?"0%":0,s=r?"0%":0;Wi(t)||Di(t)?(n=r?"20%":.2*ae.width,i=Ri(t),yn(i),bn(i),i.x=a,i.y=s,Dn(i,{width:n,height:n},ae)):_i(t)?(n=r?"10%":.1*ae.width,i=Ri(t),i.x=a,i.y=s,Dn(i,{rx:n,ry:n},ae)):Vi(t)&&(n=r?"10%":.1*ae.width,i=Ri(t),i.x1=a,i.y1=s,i.x2=a,i.y2=s),i&&Promise.resolve().then(()=>{mo(po(i,void 0,n))})},Kt=e=>ut(cb(e,$e));let Jt,Qt={};let eo;let to;const oo=e=>{if(!(Ni(e)&&jo(e,"pathClose")))return;const t=[...e.strokeColor];t[3]=1,Jt.updateMarkupShape(e,{pathClose:!1,strokeColor:t},!1),Jt.removeMarkupShapeProps(e,["backgroundColor"],!1),Jt.confirmMarkupItemDraft(),Jt.selectShape(e),_("addshape",e),Mt.write()},io=e=>{const t=Ri(e);return Object.assign(t,pe[dt]?pe[dt][_e]:{}),wn(t),t};let no;const ro=(e,t)=>{const o={};return Object.entries(e).forEach(([e,i])=>{jo(t,e)&&(o[e]=i)}),o},ao=(e,t)=>{if(No(e))return e;if(e.endsWith("%")){return parseFloat(e)/100*t.width}};let lo,co,uo;const po=(e,t,o)=>{let i=!1;t||(i=!0,t=W?ut(mt(te)):mt(se)),t.x-=ae.x||0,t.y-=ae.y||0,(gt||$t)&&(e.flipX=gt,e.flipY=$t);const n=Jt.getShapesNearPosition(J,t);if(i&&n.length){const e=.1*Math.min(se.width,se.height);t.x+=Math.round(-e+Math.random()*e*2),t.y+=Math.round(-e+Math.random()*e*2)}if(0!==ht&&(e.rotation=gt&&$t?-ht:gt||$t?ht:-ht),jo(e,"width")&&jo(e,"height")){const{width:o,height:i}=zn(e,["width","height"],ae);Dn(e,{x:t.x-.5*o,y:t.y-.5*i},ae)}else if(_i(e))Dn(e,{x:t.x,y:t.y},ae);else if(Vi(e)){const{x1:i,y1:n,x2:r,y2:a}=zn(e,["x1","y1","x2","y2"],ae),s=De(be(i,n),be(r,a)),l=y(o)?Cn(o,ae.width):s;Dn(e,{x1:t.x-l,y1:t.y+l,x2:t.x+l,y2:t.y-l},ae)}else if(Ni(e)){const{points:o}=zn(e,["points"],ae),i=Be(o);Dn(e,{points:o.map(e=>({x:e.x+t.x-i.x,y:e.y+t.y-i.y}))},ae)}return e},ho=(e,t)=>{const o=po(Li(e,se),t);return e.shape&&(jo(e.shape,"x")&&(o.x=e.shape.x),jo(e.shape,"y")&&(o.y=e.shape.y)),mo(o)},mo=e=>{const{beforeAddShape:t=()=>!0}=yt;if(t(e))return Jt.addShape(e),Jt.selectShape(e),_("addshape",e),Mt.write(),e};let go=!1;const $o=()=>{Mt.write()};let fo;const yo=Sa("redrawTrigger");wr(e,yo,e=>o(144,K=e));const bo=[],xo=Fc(Y?20:0);wr(e,xo,e=>o(141,Z=e));return e.$$set=e=>{"isActive"in e&&ve(o(1,Ie=e.isActive)),"isActiveFraction"in e&&Re(o(2,Ee=e.isActiveFraction)),"isVisible"in e&&Me(o(3,Ae=e.isVisible)),"stores"in e&&o(100,Le=e.stores),"locale"in e&&o(4,Fe=e.locale),"shapes"in e&&we(o(5,ze=e.shapes)),"toolbar"in e&&o(101,Oe=e.toolbar),"toolShapes"in e&&o(102,We=e.toolShapes),"toolActive"in e&&o(0,_e=e.toolActive),"toolSelectRadius"in e&&o(6,Ve=e.toolSelectRadius),"toolRetainStyles"in e&&o(103,Ne=e.toolRetainStyles),"toolbarLayout"in e&&o(7,He=e.toolbarLayout),"textInputMode"in e&&o(8,je=e.textInputMode),"shapeControls"in e&&o(9,Ue=e.shapeControls),"enableButtonFlipVertical"in e&&o(10,Ge=e.enableButtonFlipVertical),"enablePresetSelectImage"in e&&o(11,Ze=e.enablePresetSelectImage),"enablePresetDropImage"in e&&o(12,Xe=e.enablePresetDropImage),"enableSelectToolToAddShape"in e&&o(104,Ye=e.enableSelectToolToAddShape),"enableAutoSelectMoveTool"in e&&o(105,qe=e.enableAutoSelectMoveTool),"enableTapToAddText"in e&&o(13,Ke=e.enableTapToAddText),"enableMoveTool"in e&&o(106,Je=e.enableMoveTool),"enableViewTool"in e&&o(107,Qe=e.enableViewTool),"enableToolShareStyles"in e&&o(108,et=e.enableToolShareStyles),"enableMultiSelect"in e&&o(14,tt=e.enableMultiSelect),"gridSize"in e&&o(15,ot=e.gridSize),"snapThreshold"in e&&o(16,it=e.snapThreshold),"enableSnapToContext"in e&&o(17,nt=e.enableSnapToContext),"willRenderHeaderTools"in e&&o(109,rt=e.willRenderHeaderTools),"willRenderPresetToolbar"in e&&o(110,at=e.willRenderPresetToolbar),"willRenderShapeStyleControls"in e&&o(18,st=e.willRenderShapeStyleControls),"willStartInteraction"in e&&o(111,lt=e.willStartInteraction),"shapePresets"in e&&o(19,ct=e.shapePresets),"utilKey"in e&&o(20,dt=e.utilKey),"mapScreenPointToImagePoint"in e&&o(21,ut=e.mapScreenPointToImagePoint),"mapImagePointToScreenPoint"in e&&o(22,pt=e.mapImagePointToScreenPoint),"imageRotation"in e&&o(23,ht=e.imageRotation),"imageFlipX"in e&&o(24,gt=e.imageFlipX),"imageFlipY"in e&&o(25,$t=e.imageFlipY),"parentRect"in e&&Ce(o(26,ft=e.parentRect)),"hooks"in e&&o(112,yt=e.hooks)},e.$$.update=()=>{var t,ie,ne,re;if(33554432&e.$$.dirty[4]&&o(124,i=de.includes(18)),1049088&e.$$.dirty[3]&&(kt&&We===kt||o(113,kt=We)),16&e.$$.dirty[1]&&jt.set(X),16&e.$$.dirty[1]&&Ut.set(X),16&e.$$.dirty[1]&&Gt.set(X),256&e.$$.dirty[3]&&o(33,n=Array.isArray(Oe)&&Oe.length>1&&Array.isArray(Oe[0][1])),4&e.$$.dirty[1]|256&e.$$.dirty[3]&&o(54,r=n?Oe.map((e,t)=>[t,e[0]]):[]),134217728&e.$$.dirty[0]|4&e.$$.dirty[1]|256&e.$$.dirty[3]&&o(140,a=n?Oe[Xt][1]:Oe),524288&e.$$.dirty[0]|155648&e.$$.dirty[3]|65536&e.$$.dirty[4]&&o(32,s=((e,{willRenderPresetToolbar:t,shapePresets:o,enableViewTool:i,enableMoveTool:r})=>{let a=0!==o.length||t?e:e.filter(e=>"preset"!==e[0]);return n&&(a=[["move",e=>e.shapeLabelToolMove,{icon:e=>e.shapeIconToolMove}],["view",e=>e.shapeLabelToolView,{icon:e=>e.shapeIconToolView}],...a]),a=r?a:a.filter(e=>"move"!==e[0]),i?a:a.filter(e=>"view"!==e[0])})(a,{willRenderPresetToolbar:at,shapePresets:ct,enableMoveTool:Je,enableViewTool:Qe})),2&e.$$.dirty[1]&&o(138,d=!!s.length),1&e.$$.dirty[0]|2&e.$$.dirty[1]|16384&e.$$.dirty[4]&&d&&void 0===_e&&o(0,_e=s[0][0]),134217729&e.$$.dirty[0]|4&e.$$.dirty[1]|2097152&e.$$.dirty[3]|65536&e.$$.dirty[4]&&n&&o(114,Yt={...Yt,[Xt]:a.map(([e])=>e).includes(_e)?_e:Yt[Xt]||a[0][0]}),512&e.$$.dirty[0]&&o(137,l=!!Object.keys(Ue).length),2&e.$$.dirty[1]&&o(34,c=s.length>1),12&e.$$.dirty[1]&&o(53,u=c||n),1&e.$$.dirty[0]&&o(139,p=void 0!==_e),57344&e.$$.dirty[4]&&o(52,h=(!p||d)&&l),536870912&e.$$.dirty[0]&&o(31,_=fo&&(t=fo,(e,o)=>{t.dispatchEvent(dm(e,o))})),1&e.$$.dirty[0]|17&e.$$.dirty[1]&&X&&_&&_("selectcontrol",_e),16&e.$$.dirty[1]&&(X?Er(Ot,ge[dt]={maskMarkupOpacity:.85},ge):delete ge[dt]),1&e.$$.dirty[0]|1048576&e.$$.dirty[3]&&o(136,m=_e&&kt[_e]?kt[_e][1]:void 0),4096&e.$$.dirty[4]&&o(125,g=m&&m.isSelection?"selection":"shapes"),3&e.$$.dirty[4]&&(e=>{if(!Jt)return;const t=Jt.getShapeDraft(bt);t&&(e&&(eo=t.drawMode),Jt.updateShapeDraft({drawMode:e?"subtract":eo},bt))})("selection"===g&&i),268435457&e.$$.dirty[0]&&_e&&Jt){const e=Jt.getMarkupItemDraft();e&&oo(e)}if(1&e.$$.dirty[0]&&_e&&Jt&&"move"!==_e&&Jt.blurShapes(),16&e.$$.dirty[1]|134217728&e.$$.dirty[4]&&o(51,$=me&&X),256&e.$$.dirty[1]|8388608&e.$$.dirty[4]&&o(50,f=he&&be(te.x-he.x,te.y-he.y)),512&e.$$.dirty[0]&&o(135,b=Object.keys(Ue)),16384&e.$$.dirty[0]|16&e.$$.dirty[1]|2097152&e.$$.dirty[4]&&o(122,x=tt?X&&J.filter(Ui):[]),536870912&e.$$.dirty[3]&&o(123,v=x.length>1),16&e.$$.dirty[1]|2097152&e.$$.dirty[4]&&o(119,S=X&&J.filter(Ui)[0]),16&e.$$.dirty[1]|2097152&e.$$.dirty[4]&&o(130,w=X&&J.find(e=>Gi(e))),16&e.$$.dirty[1]|2097152&e.$$.dirty[4]&&o(133,k=X&&J.find(e=>Zi(e))),1&e.$$.dirty[0]|16&e.$$.dirty[1]|1048576&e.$$.dirty[3]&&o(127,C=X&&kt[_e]?io(kt[_e][0]):{}),1048576&e.$$.dirty[3]&&kt&&o(115,Qt={}),1&e.$$.dirty[0]|4227072&e.$$.dirty[3]|2056&e.$$.dirty[4]&&o(126,T=C&&Object.keys(C).reduce((e,t)=>{const o="disableStyle"===t,i="settings"===t,n=!!b.find(e=>e.split("_").includes(t));if(!o&&!i&&!n)return e;if(void 0===C[t])return e;if(!0===C.disableStyle)return e;if(C.disableStyle&&C.disableStyle.includes(t))return e;if("strokeWidth"===t&&Object.keys(Qt).includes("strokeWidth")&&void 0===Qt[t]&&jo(C,"points"))return e[t]=C[t],e;const{share:r=!0}=C.settings&&C.settings[t]||{},a=et&&r?Qt:Qt[_e]||{};return e[t]=jo(a,t)?a[t]:C[t],e},{})),1048577&e.$$.dirty[0]|1024&e.$$.dirty[3]|4&e.$$.dirty[4]&&(Ne?((e,t,o)=>{const i=pe[e],n=i?i[t]:{};St.set({...pe,[e]:{...i,[t]:{...n,...o}}})})(dt,_e,T):(ie=dt,St.set({[ie]:{}}))),16&e.$$.dirty[1]|67108864&e.$$.dirty[3]|67108868&e.$$.dirty[4]&&o(134,M=ue&&X?S||T:void 0),1610612736&e.$$.dirty[3]|1536&e.$$.dirty[4]&&o(49,P=v?function(e){const t={};return e.forEach(e=>{Object.entries(e).filter(([e])=>!e.startsWith("_")).forEach(([e,o])=>{jo(t,e)?"disableStyle"===e&&Uo(o)&&t[e].push(...o):t[e]=o})}),t}(x):M||k),1&e.$$.dirty[0]|8&e.$$.dirty[4]&&o(48,R=jo(C,"eraseRadius")||jo(C,"points")&&!jo(C,"pathClose")||"move"===_e||"view"===_e),64&e.$$.dirty[1]|8&e.$$.dirty[4]&&o(47,I=C&&void 0!==C.eraseRadius?ao(C.eraseRadius,ae):void 0),16&e.$$.dirty[1]|33554432&e.$$.dirty[4]&&o(131,E=X&&de.includes(32)),1&e.$$.dirty[0]|16&e.$$.dirty[1]&&o(132,A=X&&"view"===_e),384&e.$$.dirty[4]&&o(129,L=A||E),96&e.$$.dirty[4]&&o(128,F=!!L&&(!!w||eu(document.activeElement))),16&e.$$.dirty[1]|48&e.$$.dirty[4]&&It.set(!X||L&&!F),16&e.$$.dirty[1]|16&e.$$.dirty[4]&&At.set(!X||!F),64&e.$$.dirty[1]|12&e.$$.dirty[4]&&o(120,z=C.cursorStyle?(({cursorStyle:e,cursorSize:t},o,i)=>{let n;const r=o[t];if(void 0===r?n=ao(t,i):No(r)?n=r:y(r)&&(n=Rn(t,o[t],i),"strokeWidth"===t&&(n*=.5)),!(n<=0||void 0===n))return{size:n,style:e}})(C,{...C,...T},ae):void 0),33554432&e.$$.dirty[3]|16777216&e.$$.dirty[4]&&o(121,D=uo&&(re=ce,(ne=uo).x>=0&&ne.y>=0&&ne.x<=re.width&&ne.y<=re.height)),1048576&e.$$.dirty[0]|160&e.$$.dirty[1]|427819008&e.$$.dirty[3]|3&e.$$.dirty[4])if(D&&!lo&&z&&!le){const e=z.size*oe.scale,t={id:`cursor-${dt}`,x:co.x,y:co.y,strokeWidth:.5,strokeColor:[0,0,0]};"ellipse"===z.style&&(t.rx=e,t.ry=e);const o={strokeWidth:2.5,strokeColor:[1,1,1],opacity:.75},n=[{...t,...o},t];if("selection"===g&&i){const t=e,i=co.x+t,r=co.y+t+4,a={id:`cursor-${dt}`,strokeWidth:.75,strokeColor:[0,0,0],points:[{x:i,y:r},{x:i+4,y:r}]};n.push({...a,...o,strokeWidth:2,points:[{x:i-.5,y:r},{x:i+4.5,y:r}]},a)}(e=>{Dt.update(t=>[...t.filter(e=>e.id!==`cursor-${dt}`),...e])})(n)}else Dt.update(e=>e.filter(e=>e.id!==`cursor-${dt}`));1&e.$$.dirty[0]|128&e.$$.dirty[1]|478150656&e.$$.dirty[3]&&o(46,O=D?((e,t,o,i,n,r)=>{if(i)return n?"grabbing":"grab";if(e&&!t)return"none";if(!t)return"move"===r?"default":"crosshair";let a=t||o;return Ui(a)?Gi(a)?"modal"===je?"default":"text":!pn(a)||v&&!x.every(pn)?"default":"move":"default"})(z,lo,S,le,false,_e):"default"),526337&e.$$.dirty[0]|131072&e.$$.dirty[3]&&o(45,B="preset"===_e&&(ct.length>0||Ze||at)),64&e.$$.dirty[1]&&(W=!jo(ae,"x")&&!jo(ae,"y")),4194304&e.$$.dirty[4]&&o(44,V=Q*zt),131072&e.$$.dirty[3]|1572864&e.$$.dirty[4]&&o(43,N=K&&at?e=>wm(()=>at(e,ho,{...q},()=>yo.set({}))):ee),524288&e.$$.dirty[3]&&o(42,H=Object.keys(yt).reduce((e,t)=>("beforeAddShape"===t||void 0===yt[t]||(e[t]=yt[t]),e),{})),16&e.$$.dirty[1]&&(e=>{J&&ze.update(t=>t.map(t=>(t._prerender=!!e&&Gi(t),t)))})(X),65536&e.$$.dirty[3]|1572864&e.$$.dirty[4]&&o(30,j=K&&rt([],q,()=>yo.set({}))),1073742336&e.$$.dirty[0]&&o(41,U=!!j.length||!!Object.keys(Ue).some(e=>bo.includes(e))),16&e.$$.dirty[1]|262144&e.$$.dirty[4]&&Y&&xo.set(X?0:20),e.$$.dirty[4],131072&e.$$.dirty[4]&&o(40,G=Z?`translateY(${Z}px)`:"none")},Zt.set(!1),[_e,Ie,Ee,Ae,Fe,ze,Ve,He,je,Ue,Ge,Ze,Xe,Ke,tt,ot,it,nt,st,ct,dt,ut,pt,ht,gt,$t,ft,Xt,Jt,fo,j,_,s,n,c,X,oe,ae,le,he,G,U,H,N,V,B,O,I,R,P,f,$,h,u,r,$e,fe,ye,bt,xt,vt,St,wt,Ct,Pt,Rt,Et,Lt,Ft,Dt,Ot,Bt,Wt,_t,Vt,Nt,Ht,({index:e},t)=>{o(27,Xt=e),o(0,_e=Yt[e])},({value:e},t)=>{o(0,_e=e),(Ye||/enter/i.test(t.key))&&qt(e)},e=>{if("eraser"===_e)to=Jt.eraseShape();else if(_e&&kt[_e]){const[e,t={}]=kt[_e],o=Ri(e);yn(o),bn(o);const{drawMode:n}=M;"selection"===g&&"new"===n&&bt.set([]);let r={};"selection"===g&&(_("selectiondown",[...ue]),i&&(eo=o.drawMode,r.drawMode="subtract")),to=Jt.createShape({...o,...T,...r},t)}else to=void 0;return!!to&&(to.start(e),!0)},e=>!!to&&(to.update(e),!0),e=>!!to&&(to.release(e),!0),e=>!!to&&(to.cancel(e),to=void 0,!0),e=>{if(!to)return!1;if(to.end(e),to=void 0,"selection"===g){if(e.detail.isTap){const[e,t]=kt[_e];e.bitmap||"step"===t.inputMode||bt.set([])}_("selectionup",[...ue])}const t=Jt.getMarkupItemDraft(),i=Je&&(!0===qe||Array.isArray(qe)&&qe.includes(_e));return t&&!t.isEditing||!i||o(0,_e="move"),!0},e=>{const{key:t}=e,o=Jt.getMarkupItemDraft(),i=Jt.getSelectionItemDraft(),n=o||i;var r;/escape/i.test(t)&&n&&(e.preventDefault(),e.stopPropagation(),o?Jt.discardMarkupItemDraft():Jt.discardSelectionItemDraft(),to=void 0),/enter/i.test(t)&&n&&(e.preventDefault(),e.stopPropagation(),o?oo(o):((r=i).pointerPoint&&r.points.push(r.pointerPoint),Jt.confirmShapeDraft(bt),_("selectionup",[...ue]),bt.set([])),to=void 0)},function(e){Object.keys(e).forEach(t=>{const{retain:i=!0,share:n=!0}=C.settings&&C.settings[t]||{};i&&(et&&n?o(115,Qt[t]=e[t],Qt):(Qt[_e]||o(115,Qt[_e]={},Qt),o(115,Qt[_e][t]=e[t],Qt)))}),_("selectstyle",e),S&&(v?x.forEach(t=>{Jt.updateMarkupShape(t,ro(e,t))}):Jt.updateMarkupShape(S,e),clearTimeout(no),no=setTimeout(()=>{$o()},200))},(e,t,i)=>{o(117,co=t),o(118,uo=i)},()=>{o(118,uo=void 0),o(117,co=void 0)},e=>{_("markuptap",e)},e=>o(116,lo=e),()=>{go=!1},(e,t)=>{if(go)return;const{beforeAddShape:o=()=>!0}=yt,i=Kt(t),n=Jt.getMarkupItemDraft(),r=Tt(se,{x:i.x+(ae.x||0),y:i.y+(ae.y||0)});if(n&&!r&&Jt.discardMarkupItemDraft(),r){if(!n){const n=Li(e,se),r=po(n,i);return o(r)?(Ji(r),void Jt.addShape(r)):(go=!0,void t.preventDefault())}Wi(n)&&(i.x-=.5*n.width,i.y-=.5*n.height),e.shape&&(jo(e.shape,"x")&&(i.x=e.shape.x),jo(e.shape,"y")&&(i.y=e.shape.y)),Jt.updateMarkupShape(n,i)}},(e,t)=>{if(go)return;const o=Kt(t);if(!Tt(se,{x:o.x+(ae.x||0),y:o.y+(ae.y||0)}))return void Jt.discardMarkupItemDraft();const i=Jt.confirmMarkupItemDraft();Jt.selectShape(i),_("addshape",i),Mt.write()},e=>ho(e),e=>{return t=e.detail.resources,o=Kt(e.detail.event),t.filter(e=>so(e)).forEach(e=>ho(e,o));var t,o},e=>{if(!lt)return!0;const t=rectClone(re);return rectScale(t,1/ne),rectTranslate(t,ie),rectScale(t,oe.scale),lt(e,{...t,x:t.x+te.x,y:t.y+te.y})},$o,yo,bo,xo,Le,Oe,We,Ne,Ye,qe,Je,Qe,et,rt,at,lt,yt,kt,Yt,Qt,lo,co,uo,S,z,D,x,v,i,g,T,C,F,L,w,E,A,k,M,b,m,l,d,p,a,Z,Y,q,K,J,Q,te,ce,de,ue,me,function(t){wa.call(this,e,t)},e=>e[0]===_e,(e,t,o)=>{const i=e.filter(([,e])=>!bo.includes(e));return st?st(i,t,o):i},e=>e[0]===Xt,e=>{Promise.resolve().then(()=>{_("addshape",e),$o()})},e=>{_("selectshape",e)},e=>{Promise.resolve().then(()=>{_("blurshape",e)})},e=>{_("tapshape",e)},e=>{_("updateshape",e),$o()},e=>{_("removeshape",e),$o()},()=>{$o()},function(e){Ca[e?"unshift":"push"](()=>{Jt=e,o(28,Jt)})},function(e){Ca[e?"unshift":"push"](()=>{fo=e,o(29,fo)})},e=>e.filter(([,e])=>bo.includes(e)),function(t){wa.call(this,e,t)}]}class Fx extends rs{constructor(e){super(),ns(this,e,Lx,Ax,yr,{isActive:1,isActiveFraction:2,isVisible:3,stores:100,locale:4,shapes:5,toolbar:101,toolShapes:102,toolActive:0,toolSelectRadius:6,toolRetainStyles:103,toolbarLayout:7,textInputMode:8,shapeControls:9,enableButtonFlipVertical:10,enablePresetSelectImage:11,enablePresetDropImage:12,enableSelectToolToAddShape:104,enableAutoSelectMoveTool:105,enableTapToAddText:13,enableMoveTool:106,enableViewTool:107,enableToolShareStyles:108,enableMultiSelect:14,gridSize:15,snapThreshold:16,enableSnapToContext:17,willRenderHeaderTools:109,willRenderPresetToolbar:110,willRenderShapeStyleControls:18,willStartInteraction:111,shapePresets:19,utilKey:20,mapScreenPointToImagePoint:21,mapImagePointToScreenPoint:22,imageRotation:23,imageFlipX:24,imageFlipY:25,parentRect:26,hooks:112},null,[-1,-1,-1,-1,-1,-1,-1])}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[100]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),Oa()}get shapes(){return this.$$.ctx[5]}set shapes(e){this.$$set({shapes:e}),Oa()}get toolbar(){return this.$$.ctx[101]}set toolbar(e){this.$$set({toolbar:e}),Oa()}get toolShapes(){return this.$$.ctx[102]}set toolShapes(e){this.$$set({toolShapes:e}),Oa()}get toolActive(){return this.$$.ctx[0]}set toolActive(e){this.$$set({toolActive:e}),Oa()}get toolSelectRadius(){return this.$$.ctx[6]}set toolSelectRadius(e){this.$$set({toolSelectRadius:e}),Oa()}get toolRetainStyles(){return this.$$.ctx[103]}set toolRetainStyles(e){this.$$set({toolRetainStyles:e}),Oa()}get toolbarLayout(){return this.$$.ctx[7]}set toolbarLayout(e){this.$$set({toolbarLayout:e}),Oa()}get textInputMode(){return this.$$.ctx[8]}set textInputMode(e){this.$$set({textInputMode:e}),Oa()}get shapeControls(){return this.$$.ctx[9]}set shapeControls(e){this.$$set({shapeControls:e}),Oa()}get enableButtonFlipVertical(){return this.$$.ctx[10]}set enableButtonFlipVertical(e){this.$$set({enableButtonFlipVertical:e}),Oa()}get enablePresetSelectImage(){return this.$$.ctx[11]}set enablePresetSelectImage(e){this.$$set({enablePresetSelectImage:e}),Oa()}get enablePresetDropImage(){return this.$$.ctx[12]}set enablePresetDropImage(e){this.$$set({enablePresetDropImage:e}),Oa()}get enableSelectToolToAddShape(){return this.$$.ctx[104]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),Oa()}get enableAutoSelectMoveTool(){return this.$$.ctx[105]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),Oa()}get enableTapToAddText(){return this.$$.ctx[13]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),Oa()}get enableMoveTool(){return this.$$.ctx[106]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),Oa()}get enableViewTool(){return this.$$.ctx[107]}set enableViewTool(e){this.$$set({enableViewTool:e}),Oa()}get enableToolShareStyles(){return this.$$.ctx[108]}set enableToolShareStyles(e){this.$$set({enableToolShareStyles:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[14]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}get gridSize(){return this.$$.ctx[15]}set gridSize(e){this.$$set({gridSize:e}),Oa()}get snapThreshold(){return this.$$.ctx[16]}set snapThreshold(e){this.$$set({snapThreshold:e}),Oa()}get enableSnapToContext(){return this.$$.ctx[17]}set enableSnapToContext(e){this.$$set({enableSnapToContext:e}),Oa()}get willRenderHeaderTools(){return this.$$.ctx[109]}set willRenderHeaderTools(e){this.$$set({willRenderHeaderTools:e}),Oa()}get willRenderPresetToolbar(){return this.$$.ctx[110]}set willRenderPresetToolbar(e){this.$$set({willRenderPresetToolbar:e}),Oa()}get willRenderShapeStyleControls(){return this.$$.ctx[18]}set willRenderShapeStyleControls(e){this.$$set({willRenderShapeStyleControls:e}),Oa()}get willStartInteraction(){return this.$$.ctx[111]}set willStartInteraction(e){this.$$set({willStartInteraction:e}),Oa()}get shapePresets(){return this.$$.ctx[19]}set shapePresets(e){this.$$set({shapePresets:e}),Oa()}get utilKey(){return this.$$.ctx[20]}set utilKey(e){this.$$set({utilKey:e}),Oa()}get mapScreenPointToImagePoint(){return this.$$.ctx[21]}set mapScreenPointToImagePoint(e){this.$$set({mapScreenPointToImagePoint:e}),Oa()}get mapImagePointToScreenPoint(){return this.$$.ctx[22]}set mapImagePointToScreenPoint(e){this.$$set({mapImagePointToScreenPoint:e}),Oa()}get imageRotation(){return this.$$.ctx[23]}set imageRotation(e){this.$$set({imageRotation:e}),Oa()}get imageFlipX(){return this.$$.ctx[24]}set imageFlipX(e){this.$$set({imageFlipX:e}),Oa()}get imageFlipY(){return this.$$.ctx[25]}set imageFlipY(e){this.$$set({imageFlipY:e}),Oa()}get parentRect(){return this.$$.ctx[26]}set parentRect(e){this.$$set({parentRect:e}),Oa()}get hooks(){return this.$$.ctx[112]}set hooks(e){this.$$set({hooks:e}),Oa()}}var zx=(e,t,o,i,n,r,a,s,l)=>{const c=ve(e),d=.5*o.width,u=.5*o.height,p=.5*t.width,h=.5*t.height,m=n.x+i.x,g=n.y+i.y;s&&(c.x=o.width-c.x),l&&(c.y=o.height-c.y);const $=Math.cos(r),f=Math.sin(r);c.x-=d,c.y-=u;const y=c.x*$-c.y*f,b=c.x*f+c.y*$;c.x=d+y,c.y=u+b,c.x*=a,c.y*=a,c.x+=p,c.y+=h,c.x+=m,c.y+=g,c.x-=d*a,c.y-=u*a;const x=(n.x-m)*a,v=(n.y-g)*a,S=x*$-v*f,w=x*f+v*$;return c.x+=S,c.y+=w,c},Dx=(e,t,o,i,n,r,a,s,l)=>{const c=ve(e),d=qe(o),u=qe(t),p=be(n.x+i.x,n.y+i.y),h=Math.cos(r),m=Math.sin(r);c.x-=u.x,c.y-=u.y;const g=(n.x-p.x)*a,$=(n.y-p.y)*a,f=g*h-$*m,y=g*m+$*h;c.x-=f,c.y-=y,c.x-=p.x,c.y-=p.y,c.x/=a,c.y/=a;const b=c.x*h+c.y*m,x=c.x*m-c.y*h;return c.x=b,c.y=-x,c.x+=d.x,c.y+=d.y,s&&(c.x=o.width-c.x),l&&(c.y=o.height-c.y),c},Ox=e=>"boolean"==typeof e;function Bx(e){let t,o,i;function n(t){e[61](t)}let r={utilKey:e[1],stores:e[5],locale:e[6],isActive:e[2],isActiveFraction:e[3],isVisible:e[4],mapScreenPointToImagePoint:e[46],mapImagePointToScreenPoint:e[45],imageRotation:e[47],imageFlipX:e[44],imageFlipY:e[43],shapes:e[49],toolbar:e[21]||e[7],toolShapes:e[22]||e[8],toolRetainStyles:e[9],enableSelectToolToAddShape:e[31],enableTapToAddText:e[32],enableViewTool:e[30],enableMoveTool:e[34],enableAutoSelectMoveTool:e[33],enableMultiSelect:e[35],snapThreshold:e[16],gridSize:No(e[18])?e[18]:e[15],enableSnapToContext:Ox(e[19])?e[19]:e[17],enableToolShareStyles:e[13],shapeControls:e[23]||e[10],shapePresets:e[27],enableButtonFlipVertical:e[24],parentRect:e[50],enablePresetDropImage:e[26],enablePresetSelectImage:e[25],toolSelectRadius:e[11],textInputMode:e[12],willStartInteraction:e[14],willRenderPresetToolbar:e[28]||e[20],willRenderShapeStyleControls:e[29],hooks:{willRenderShapeControls:e[36],willRenderShapeTextControls:e[37],beforeAddShape:e[38],beforeRemoveShape:e[39],beforeDeselectShape:e[40],beforeSelectShape:e[41],beforeUpdateShape:e[42]}};return void 0!==e[0]&&(r.toolActive=e[0]),t=new Fx({props:r}),Ca.push(()=>es(t,"toolActive",n)),t.$on("measure",e[62]),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};32&i[0]&&(n.stores=e[5]),64&i[0]&&(n.locale=e[6]),4&i[0]&&(n.isActive=e[2]),8&i[0]&&(n.isActiveFraction=e[3]),16&i[0]&&(n.isVisible=e[4]),32768&i[1]&&(n.mapScreenPointToImagePoint=e[46]),16384&i[1]&&(n.mapImagePointToScreenPoint=e[45]),65536&i[1]&&(n.imageRotation=e[47]),8192&i[1]&&(n.imageFlipX=e[44]),4096&i[1]&&(n.imageFlipY=e[43]),2097280&i[0]&&(n.toolbar=e[21]||e[7]),4194560&i[0]&&(n.toolShapes=e[22]||e[8]),512&i[0]&&(n.toolRetainStyles=e[9]),1&i[1]&&(n.enableSelectToolToAddShape=e[31]),2&i[1]&&(n.enableTapToAddText=e[32]),1073741824&i[0]&&(n.enableViewTool=e[30]),8&i[1]&&(n.enableMoveTool=e[34]),4&i[1]&&(n.enableAutoSelectMoveTool=e[33]),16&i[1]&&(n.enableMultiSelect=e[35]),65536&i[0]&&(n.snapThreshold=e[16]),294912&i[0]&&(n.gridSize=No(e[18])?e[18]:e[15]),655360&i[0]&&(n.enableSnapToContext=Ox(e[19])?e[19]:e[17]),8192&i[0]&&(n.enableToolShareStyles=e[13]),8389632&i[0]&&(n.shapeControls=e[23]||e[10]),134217728&i[0]&&(n.shapePresets=e[27]),16777216&i[0]&&(n.enableButtonFlipVertical=e[24]),67108864&i[0]&&(n.enablePresetDropImage=e[26]),33554432&i[0]&&(n.enablePresetSelectImage=e[25]),2048&i[0]&&(n.toolSelectRadius=e[11]),4096&i[0]&&(n.textInputMode=e[12]),16384&i[0]&&(n.willStartInteraction=e[14]),269484032&i[0]&&(n.willRenderPresetToolbar=e[28]||e[20]),536870912&i[0]&&(n.willRenderShapeStyleControls=e[29]),4064&i[1]&&(n.hooks={willRenderShapeControls:e[36],willRenderShapeTextControls:e[37],beforeAddShape:e[38],beforeRemoveShape:e[39],beforeDeselectShape:e[40],beforeSelectShape:e[41],beforeUpdateShape:e[42]}),!o&&1&i[0]&&(o=!0,n.toolActive=e[0],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function Wx(e,t,o){let i,n,r,a,s,l,c,d,u,p;let{isActive:h}=t,{isActiveFraction:m}=t,{isVisible:g}=t,{stores:$}=t,{locale:f={}}=t,{markupEditorToolbar:y}=t,{markupEditorToolStyles:b}=t,{markupEditorToolRetainStyles:x}=t,{markupEditorShapeStyleControls:v}=t,{markupEditorToolSelectRadius:S}=t,{markupEditorTextInputMode:w}=t,{markupEditorToolShareStyles:k}=t,{markupEditorWillStartInteraction:C}=t,{markupEditorGridSize:T=0}=t,{markupEditorSnapThreshold:M=0}=t,{markupEditorSnapToContext:P=!1}=t,{annotateGridSize:R}=t,{annotateSnapToContext:I}=t,{willRenderShapePresetToolbar:E}=t,{annotateTools:A}=t,{annotateToolShapes:L}=t,{annotateShapeControls:F}=t,{annotateActiveTool:z}=t,{annotateEnableButtonFlipVertical:D=!1}=t,{annotateEnableSelectImagePreset:O=!1}=t,{annotateEnableDropImagePreset:B=!0}=t,{annotatePresets:W=[]}=t,{annotateWillRenderShapePresetToolbar:_}=t,{annotateWillRenderShapeStyleControls:V}=t,{enableViewTool:N}=t,{enableSelectToolToAddShape:H}=t,{enableTapToAddText:j}=t,{enableAutoSelectMoveTool:U}=t,{enableMoveTool:G}=t,{enableMultiSelect:Z}=t,{willRenderShapeControls:X}=t,{willRenderShapeTextControls:Y}=t,{beforeAddShape:q}=t,{beforeRemoveShape:K}=t,{beforeDeselectShape:J}=t,{beforeSelectShape:Q}=t,{beforeUpdateShape:ee}=t;const{rootRect:te,imageAnnotation:oe,imageSize:ie,imageRotation:ne,imageFlipX:re,imageFlipY:ae,imageTransforms:se,imageTransformsInterpolated:le}=$;return wr(e,te,e=>o(59,d=e)),wr(e,ie,e=>o(58,c=e)),wr(e,ne,e=>o(47,p=e)),wr(e,re,e=>o(44,s=e)),wr(e,ae,e=>o(43,a=e)),wr(e,se,e=>o(60,u=e)),wr(e,le,e=>o(57,l=e)),e.$$set=e=>{"isActive"in e&&o(2,h=e.isActive),"isActiveFraction"in e&&o(3,m=e.isActiveFraction),"isVisible"in e&&o(4,g=e.isVisible),"stores"in e&&o(5,$=e.stores),"locale"in e&&o(6,f=e.locale),"markupEditorToolbar"in e&&o(7,y=e.markupEditorToolbar),"markupEditorToolStyles"in e&&o(8,b=e.markupEditorToolStyles),"markupEditorToolRetainStyles"in e&&o(9,x=e.markupEditorToolRetainStyles),"markupEditorShapeStyleControls"in e&&o(10,v=e.markupEditorShapeStyleControls),"markupEditorToolSelectRadius"in e&&o(11,S=e.markupEditorToolSelectRadius),"markupEditorTextInputMode"in e&&o(12,w=e.markupEditorTextInputMode),"markupEditorToolShareStyles"in e&&o(13,k=e.markupEditorToolShareStyles),"markupEditorWillStartInteraction"in e&&o(14,C=e.markupEditorWillStartInteraction),"markupEditorGridSize"in e&&o(15,T=e.markupEditorGridSize),"markupEditorSnapThreshold"in e&&o(16,M=e.markupEditorSnapThreshold),"markupEditorSnapToContext"in e&&o(17,P=e.markupEditorSnapToContext),"annotateGridSize"in e&&o(18,R=e.annotateGridSize),"annotateSnapToContext"in e&&o(19,I=e.annotateSnapToContext),"willRenderShapePresetToolbar"in e&&o(20,E=e.willRenderShapePresetToolbar),"annotateTools"in e&&o(21,A=e.annotateTools),"annotateToolShapes"in e&&o(22,L=e.annotateToolShapes),"annotateShapeControls"in e&&o(23,F=e.annotateShapeControls),"annotateActiveTool"in e&&o(0,z=e.annotateActiveTool),"annotateEnableButtonFlipVertical"in e&&o(24,D=e.annotateEnableButtonFlipVertical),"annotateEnableSelectImagePreset"in e&&o(25,O=e.annotateEnableSelectImagePreset),"annotateEnableDropImagePreset"in e&&o(26,B=e.annotateEnableDropImagePreset),"annotatePresets"in e&&o(27,W=e.annotatePresets),"annotateWillRenderShapePresetToolbar"in e&&o(28,_=e.annotateWillRenderShapePresetToolbar),"annotateWillRenderShapeStyleControls"in e&&o(29,V=e.annotateWillRenderShapeStyleControls),"enableViewTool"in e&&o(30,N=e.enableViewTool),"enableSelectToolToAddShape"in e&&o(31,H=e.enableSelectToolToAddShape),"enableTapToAddText"in e&&o(32,j=e.enableTapToAddText),"enableAutoSelectMoveTool"in e&&o(33,U=e.enableAutoSelectMoveTool),"enableMoveTool"in e&&o(34,G=e.enableMoveTool),"enableMultiSelect"in e&&o(35,Z=e.enableMultiSelect),"willRenderShapeControls"in e&&o(36,X=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(37,Y=e.willRenderShapeTextControls),"beforeAddShape"in e&&o(38,q=e.beforeAddShape),"beforeRemoveShape"in e&&o(39,K=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(40,J=e.beforeDeselectShape),"beforeSelectShape"in e&&o(41,Q=e.beforeSelectShape),"beforeUpdateShape"in e&&o(42,ee=e.beforeUpdateShape)},e.$$.update=()=>{536870912&e.$$.dirty[1]&&o(56,i=u?u.rotation.z:0),503328768&e.$$.dirty[1]&&o(46,n=e=>Dx(e,d,c,l.origin,l.translation,i,l.scale,s,a)),503328768&e.$$.dirty[1]&&o(45,r=e=>zx(e,d,c,l.origin,l.translation,i,l.scale,s,a))},[z,"annotate",h,m,g,$,f,y,b,x,v,S,w,k,C,T,M,P,R,I,E,A,L,F,D,O,B,W,_,V,N,H,j,U,G,Z,X,Y,q,K,J,Q,ee,a,s,r,n,p,te,oe,ie,ne,re,ae,se,le,i,l,c,d,u,function(e){z=e,o(0,z)},function(t){wa.call(this,e,t)}]}var _x={util:["annotate",class extends rs{constructor(e){super(),ns(this,e,Wx,Bx,yr,{name:1,isActive:2,isActiveFraction:3,isVisible:4,stores:5,locale:6,markupEditorToolbar:7,markupEditorToolStyles:8,markupEditorToolRetainStyles:9,markupEditorShapeStyleControls:10,markupEditorToolSelectRadius:11,markupEditorTextInputMode:12,markupEditorToolShareStyles:13,markupEditorWillStartInteraction:14,markupEditorGridSize:15,markupEditorSnapThreshold:16,markupEditorSnapToContext:17,annotateGridSize:18,annotateSnapToContext:19,willRenderShapePresetToolbar:20,annotateTools:21,annotateToolShapes:22,annotateShapeControls:23,annotateActiveTool:0,annotateEnableButtonFlipVertical:24,annotateEnableSelectImagePreset:25,annotateEnableDropImagePreset:26,annotatePresets:27,annotateWillRenderShapePresetToolbar:28,annotateWillRenderShapeStyleControls:29,enableViewTool:30,enableSelectToolToAddShape:31,enableTapToAddText:32,enableAutoSelectMoveTool:33,enableMoveTool:34,enableMultiSelect:35,willRenderShapeControls:36,willRenderShapeTextControls:37,beforeAddShape:38,beforeRemoveShape:39,beforeDeselectShape:40,beforeSelectShape:41,beforeUpdateShape:42},null,[-1,-1,-1])}get name(){return this.$$.ctx[1]}get isActive(){return this.$$.ctx[2]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[3]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[4]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[5]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[6]}set locale(e){this.$$set({locale:e}),Oa()}get markupEditorToolbar(){return this.$$.ctx[7]}set markupEditorToolbar(e){this.$$set({markupEditorToolbar:e}),Oa()}get markupEditorToolStyles(){return this.$$.ctx[8]}set markupEditorToolStyles(e){this.$$set({markupEditorToolStyles:e}),Oa()}get markupEditorToolRetainStyles(){return this.$$.ctx[9]}set markupEditorToolRetainStyles(e){this.$$set({markupEditorToolRetainStyles:e}),Oa()}get markupEditorShapeStyleControls(){return this.$$.ctx[10]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),Oa()}get markupEditorToolSelectRadius(){return this.$$.ctx[11]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),Oa()}get markupEditorTextInputMode(){return this.$$.ctx[12]}set markupEditorTextInputMode(e){this.$$set({markupEditorTextInputMode:e}),Oa()}get markupEditorToolShareStyles(){return this.$$.ctx[13]}set markupEditorToolShareStyles(e){this.$$set({markupEditorToolShareStyles:e}),Oa()}get markupEditorWillStartInteraction(){return this.$$.ctx[14]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),Oa()}get markupEditorGridSize(){return this.$$.ctx[15]}set markupEditorGridSize(e){this.$$set({markupEditorGridSize:e}),Oa()}get markupEditorSnapThreshold(){return this.$$.ctx[16]}set markupEditorSnapThreshold(e){this.$$set({markupEditorSnapThreshold:e}),Oa()}get markupEditorSnapToContext(){return this.$$.ctx[17]}set markupEditorSnapToContext(e){this.$$set({markupEditorSnapToContext:e}),Oa()}get annotateGridSize(){return this.$$.ctx[18]}set annotateGridSize(e){this.$$set({annotateGridSize:e}),Oa()}get annotateSnapToContext(){return this.$$.ctx[19]}set annotateSnapToContext(e){this.$$set({annotateSnapToContext:e}),Oa()}get willRenderShapePresetToolbar(){return this.$$.ctx[20]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),Oa()}get annotateTools(){return this.$$.ctx[21]}set annotateTools(e){this.$$set({annotateTools:e}),Oa()}get annotateToolShapes(){return this.$$.ctx[22]}set annotateToolShapes(e){this.$$set({annotateToolShapes:e}),Oa()}get annotateShapeControls(){return this.$$.ctx[23]}set annotateShapeControls(e){this.$$set({annotateShapeControls:e}),Oa()}get annotateActiveTool(){return this.$$.ctx[0]}set annotateActiveTool(e){this.$$set({annotateActiveTool:e}),Oa()}get annotateEnableButtonFlipVertical(){return this.$$.ctx[24]}set annotateEnableButtonFlipVertical(e){this.$$set({annotateEnableButtonFlipVertical:e}),Oa()}get annotateEnableSelectImagePreset(){return this.$$.ctx[25]}set annotateEnableSelectImagePreset(e){this.$$set({annotateEnableSelectImagePreset:e}),Oa()}get annotateEnableDropImagePreset(){return this.$$.ctx[26]}set annotateEnableDropImagePreset(e){this.$$set({annotateEnableDropImagePreset:e}),Oa()}get annotatePresets(){return this.$$.ctx[27]}set annotatePresets(e){this.$$set({annotatePresets:e}),Oa()}get annotateWillRenderShapePresetToolbar(){return this.$$.ctx[28]}set annotateWillRenderShapePresetToolbar(e){this.$$set({annotateWillRenderShapePresetToolbar:e}),Oa()}get annotateWillRenderShapeStyleControls(){return this.$$.ctx[29]}set annotateWillRenderShapeStyleControls(e){this.$$set({annotateWillRenderShapeStyleControls:e}),Oa()}get enableViewTool(){return this.$$.ctx[30]}set enableViewTool(e){this.$$set({enableViewTool:e}),Oa()}get enableSelectToolToAddShape(){return this.$$.ctx[31]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),Oa()}get enableTapToAddText(){return this.$$.ctx[32]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),Oa()}get enableAutoSelectMoveTool(){return this.$$.ctx[33]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),Oa()}get enableMoveTool(){return this.$$.ctx[34]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[35]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}get willRenderShapeControls(){return this.$$.ctx[36]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),Oa()}get willRenderShapeTextControls(){return this.$$.ctx[37]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),Oa()}get beforeAddShape(){return this.$$.ctx[38]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),Oa()}get beforeRemoveShape(){return this.$$.ctx[39]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),Oa()}get beforeDeselectShape(){return this.$$.ctx[40]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),Oa()}get beforeSelectShape(){return this.$$.ctx[41]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),Oa()}get beforeUpdateShape(){return this.$$.ctx[42]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),Oa()}}]};function Vx(e){let t,o,i;function n(t){e[52](t)}let r={utilKey:e[1],stores:e[5],locale:e[6],isActive:e[2],isActiveFraction:e[3],isVisible:e[4],mapScreenPointToImagePoint:e[44],mapImagePointToScreenPoint:e[43],shapes:e[46],toolbar:e[20]||e[7],toolShapes:e[21]||e[8],toolRetainStyles:e[9],shapeControls:e[22]||e[10],shapePresets:e[26],enableSelectToolToAddShape:e[29],enableTapToAddText:e[30],enableViewTool:e[31],enableMoveTool:e[32],enableAutoSelectMoveTool:e[33],enableMultiSelect:e[34],snapThreshold:e[16],gridSize:No(e[18])?e[18]:e[15],enableSnapToContext:Ox(e[19])?e[19]:e[17],enableToolShareStyles:e[13],enablePresetSelectImage:e[24],enablePresetDropImage:e[25],enableButtonFlipVertical:e[23],parentRect:e[45],toolSelectRadius:e[11],textInputMode:e[12],willStartInteraction:e[42],willRenderPresetToolbar:e[27]||e[14],willRenderShapeStyleControls:e[28],hooks:{willRenderShapeControls:e[35],willRenderShapeTextControls:e[36],beforeAddShape:e[37],beforeRemoveShape:e[38],beforeDeselectShape:e[39],beforeSelectShape:e[40],beforeUpdateShape:e[41]}};return void 0!==e[0]&&(r.toolActive=e[0]),t=new Fx({props:r}),Ca.push(()=>es(t,"toolActive",n)),t.$on("measure",e[53]),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};32&i[0]&&(n.stores=e[5]),64&i[0]&&(n.locale=e[6]),4&i[0]&&(n.isActive=e[2]),8&i[0]&&(n.isActiveFraction=e[3]),16&i[0]&&(n.isVisible=e[4]),8192&i[1]&&(n.mapScreenPointToImagePoint=e[44]),4096&i[1]&&(n.mapImagePointToScreenPoint=e[43]),1048704&i[0]&&(n.toolbar=e[20]||e[7]),2097408&i[0]&&(n.toolShapes=e[21]||e[8]),512&i[0]&&(n.toolRetainStyles=e[9]),4195328&i[0]&&(n.shapeControls=e[22]||e[10]),67108864&i[0]&&(n.shapePresets=e[26]),536870912&i[0]&&(n.enableSelectToolToAddShape=e[29]),1073741824&i[0]&&(n.enableTapToAddText=e[30]),1&i[1]&&(n.enableViewTool=e[31]),2&i[1]&&(n.enableMoveTool=e[32]),4&i[1]&&(n.enableAutoSelectMoveTool=e[33]),8&i[1]&&(n.enableMultiSelect=e[34]),65536&i[0]&&(n.snapThreshold=e[16]),294912&i[0]&&(n.gridSize=No(e[18])?e[18]:e[15]),655360&i[0]&&(n.enableSnapToContext=Ox(e[19])?e[19]:e[17]),8192&i[0]&&(n.enableToolShareStyles=e[13]),16777216&i[0]&&(n.enablePresetSelectImage=e[24]),33554432&i[0]&&(n.enablePresetDropImage=e[25]),8388608&i[0]&&(n.enableButtonFlipVertical=e[23]),2048&i[0]&&(n.toolSelectRadius=e[11]),4096&i[0]&&(n.textInputMode=e[12]),2048&i[1]&&(n.willStartInteraction=e[42]),134234112&i[0]&&(n.willRenderPresetToolbar=e[27]||e[14]),268435456&i[0]&&(n.willRenderShapeStyleControls=e[28]),2032&i[1]&&(n.hooks={willRenderShapeControls:e[35],willRenderShapeTextControls:e[36],beforeAddShape:e[37],beforeRemoveShape:e[38],beforeDeselectShape:e[39],beforeSelectShape:e[40],beforeUpdateShape:e[41]}),!o&&1&i[0]&&(o=!0,n.toolActive=e[0],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function Nx(e,t,o){let i,n,r,a,s;let{isActive:l}=t,{isActiveFraction:c}=t,{isVisible:d}=t,{stores:u}=t,{locale:p={}}=t,{markupEditorToolbar:h}=t,{markupEditorToolStyles:m}=t,{markupEditorToolRetainStyles:g}=t,{markupEditorShapeStyleControls:$}=t,{markupEditorToolSelectRadius:f}=t,{markupEditorTextInputMode:y}=t,{markupEditorToolShareStyles:b}=t,{willRenderShapePresetToolbar:x}=t,{markupEditorGridSize:v}=t,{markupEditorSnapThreshold:S}=t,{markupEditorSnapToContext:w=!0}=t,{decorateGridSize:k}=t,{decorateSnapToContext:C}=t,{decorateTools:T}=t,{decorateToolShapes:M}=t,{decorateShapeControls:P}=t,{decorateActiveTool:R}=t,{decorateEnableButtonFlipVertical:I=!1}=t,{decorateEnableSelectImagePreset:E=!1}=t,{decorateEnableDropImagePreset:A=!0}=t,{decoratePresets:L=[]}=t,{decorateWillRenderShapePresetToolbar:F}=t,{decorateWillRenderShapeStyleControls:z}=t,{enableSelectToolToAddShape:D}=t,{enableTapToAddText:O}=t,{enableViewTool:B}=t,{enableMoveTool:W}=t,{enableAutoSelectMoveTool:_}=t,{enableMultiSelect:V}=t,{willRenderShapeControls:N}=t,{willRenderShapeTextControls:H}=t,{beforeAddShape:j}=t,{beforeRemoveShape:U}=t,{beforeDeselectShape:G}=t,{beforeSelectShape:Z}=t,{beforeUpdateShape:X}=t,{markupEditorWillStartInteraction:Y}=t;const{imageCropRect:q,imageDecoration:K,imageSelectionRectPresentation:J,imageTransformsInterpolated:Q}=u;return wr(e,J,e=>o(50,a=e)),wr(e,Q,e=>o(51,s=e)),e.$$set=e=>{"isActive"in e&&o(2,l=e.isActive),"isActiveFraction"in e&&o(3,c=e.isActiveFraction),"isVisible"in e&&o(4,d=e.isVisible),"stores"in e&&o(5,u=e.stores),"locale"in e&&o(6,p=e.locale),"markupEditorToolbar"in e&&o(7,h=e.markupEditorToolbar),"markupEditorToolStyles"in e&&o(8,m=e.markupEditorToolStyles),"markupEditorToolRetainStyles"in e&&o(9,g=e.markupEditorToolRetainStyles),"markupEditorShapeStyleControls"in e&&o(10,$=e.markupEditorShapeStyleControls),"markupEditorToolSelectRadius"in e&&o(11,f=e.markupEditorToolSelectRadius),"markupEditorTextInputMode"in e&&o(12,y=e.markupEditorTextInputMode),"markupEditorToolShareStyles"in e&&o(13,b=e.markupEditorToolShareStyles),"willRenderShapePresetToolbar"in e&&o(14,x=e.willRenderShapePresetToolbar),"markupEditorGridSize"in e&&o(15,v=e.markupEditorGridSize),"markupEditorSnapThreshold"in e&&o(16,S=e.markupEditorSnapThreshold),"markupEditorSnapToContext"in e&&o(17,w=e.markupEditorSnapToContext),"decorateGridSize"in e&&o(18,k=e.decorateGridSize),"decorateSnapToContext"in e&&o(19,C=e.decorateSnapToContext),"decorateTools"in e&&o(20,T=e.decorateTools),"decorateToolShapes"in e&&o(21,M=e.decorateToolShapes),"decorateShapeControls"in e&&o(22,P=e.decorateShapeControls),"decorateActiveTool"in e&&o(0,R=e.decorateActiveTool),"decorateEnableButtonFlipVertical"in e&&o(23,I=e.decorateEnableButtonFlipVertical),"decorateEnableSelectImagePreset"in e&&o(24,E=e.decorateEnableSelectImagePreset),"decorateEnableDropImagePreset"in e&&o(25,A=e.decorateEnableDropImagePreset),"decoratePresets"in e&&o(26,L=e.decoratePresets),"decorateWillRenderShapePresetToolbar"in e&&o(27,F=e.decorateWillRenderShapePresetToolbar),"decorateWillRenderShapeStyleControls"in e&&o(28,z=e.decorateWillRenderShapeStyleControls),"enableSelectToolToAddShape"in e&&o(29,D=e.enableSelectToolToAddShape),"enableTapToAddText"in e&&o(30,O=e.enableTapToAddText),"enableViewTool"in e&&o(31,B=e.enableViewTool),"enableMoveTool"in e&&o(32,W=e.enableMoveTool),"enableAutoSelectMoveTool"in e&&o(33,_=e.enableAutoSelectMoveTool),"enableMultiSelect"in e&&o(34,V=e.enableMultiSelect),"willRenderShapeControls"in e&&o(35,N=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(36,H=e.willRenderShapeTextControls),"beforeAddShape"in e&&o(37,j=e.beforeAddShape),"beforeRemoveShape"in e&&o(38,U=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(39,G=e.beforeDeselectShape),"beforeSelectShape"in e&&o(40,Z=e.beforeSelectShape),"beforeUpdateShape"in e&&o(41,X=e.beforeUpdateShape),"markupEditorWillStartInteraction"in e&&o(42,Y=e.markupEditorWillStartInteraction)},e.$$.update=()=>{1048576&e.$$.dirty[1]&&o(49,i=s?s.scale:1),786432&e.$$.dirty[1]&&o(44,n=e=>{const t=ve(e);return t.x-=a.x,t.y-=a.y,t.x/=i,t.y/=i,t}),786432&e.$$.dirty[1]&&o(43,r=e=>{const t=ve(e);return t.x*=i,t.y*=i,t.x+=a.x,t.y+=a.y,t})},[R,"decorate",l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w,k,C,T,M,P,I,E,A,L,F,z,D,O,B,W,_,V,N,H,j,U,G,Z,X,Y,r,n,q,K,J,Q,i,a,s,function(e){R=e,o(0,R)},function(t){wa.call(this,e,t)}]}var Hx={util:["decorate",class extends rs{constructor(e){super(),ns(this,e,Nx,Vx,yr,{name:1,isActive:2,isActiveFraction:3,isVisible:4,stores:5,locale:6,markupEditorToolbar:7,markupEditorToolStyles:8,markupEditorToolRetainStyles:9,markupEditorShapeStyleControls:10,markupEditorToolSelectRadius:11,markupEditorTextInputMode:12,markupEditorToolShareStyles:13,willRenderShapePresetToolbar:14,markupEditorGridSize:15,markupEditorSnapThreshold:16,markupEditorSnapToContext:17,decorateGridSize:18,decorateSnapToContext:19,decorateTools:20,decorateToolShapes:21,decorateShapeControls:22,decorateActiveTool:0,decorateEnableButtonFlipVertical:23,decorateEnableSelectImagePreset:24,decorateEnableDropImagePreset:25,decoratePresets:26,decorateWillRenderShapePresetToolbar:27,decorateWillRenderShapeStyleControls:28,enableSelectToolToAddShape:29,enableTapToAddText:30,enableViewTool:31,enableMoveTool:32,enableAutoSelectMoveTool:33,enableMultiSelect:34,willRenderShapeControls:35,willRenderShapeTextControls:36,beforeAddShape:37,beforeRemoveShape:38,beforeDeselectShape:39,beforeSelectShape:40,beforeUpdateShape:41,markupEditorWillStartInteraction:42},null,[-1,-1])}get name(){return this.$$.ctx[1]}get isActive(){return this.$$.ctx[2]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[3]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[4]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[5]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[6]}set locale(e){this.$$set({locale:e}),Oa()}get markupEditorToolbar(){return this.$$.ctx[7]}set markupEditorToolbar(e){this.$$set({markupEditorToolbar:e}),Oa()}get markupEditorToolStyles(){return this.$$.ctx[8]}set markupEditorToolStyles(e){this.$$set({markupEditorToolStyles:e}),Oa()}get markupEditorToolRetainStyles(){return this.$$.ctx[9]}set markupEditorToolRetainStyles(e){this.$$set({markupEditorToolRetainStyles:e}),Oa()}get markupEditorShapeStyleControls(){return this.$$.ctx[10]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),Oa()}get markupEditorToolSelectRadius(){return this.$$.ctx[11]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),Oa()}get markupEditorTextInputMode(){return this.$$.ctx[12]}set markupEditorTextInputMode(e){this.$$set({markupEditorTextInputMode:e}),Oa()}get markupEditorToolShareStyles(){return this.$$.ctx[13]}set markupEditorToolShareStyles(e){this.$$set({markupEditorToolShareStyles:e}),Oa()}get willRenderShapePresetToolbar(){return this.$$.ctx[14]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),Oa()}get markupEditorGridSize(){return this.$$.ctx[15]}set markupEditorGridSize(e){this.$$set({markupEditorGridSize:e}),Oa()}get markupEditorSnapThreshold(){return this.$$.ctx[16]}set markupEditorSnapThreshold(e){this.$$set({markupEditorSnapThreshold:e}),Oa()}get markupEditorSnapToContext(){return this.$$.ctx[17]}set markupEditorSnapToContext(e){this.$$set({markupEditorSnapToContext:e}),Oa()}get decorateGridSize(){return this.$$.ctx[18]}set decorateGridSize(e){this.$$set({decorateGridSize:e}),Oa()}get decorateSnapToContext(){return this.$$.ctx[19]}set decorateSnapToContext(e){this.$$set({decorateSnapToContext:e}),Oa()}get decorateTools(){return this.$$.ctx[20]}set decorateTools(e){this.$$set({decorateTools:e}),Oa()}get decorateToolShapes(){return this.$$.ctx[21]}set decorateToolShapes(e){this.$$set({decorateToolShapes:e}),Oa()}get decorateShapeControls(){return this.$$.ctx[22]}set decorateShapeControls(e){this.$$set({decorateShapeControls:e}),Oa()}get decorateActiveTool(){return this.$$.ctx[0]}set decorateActiveTool(e){this.$$set({decorateActiveTool:e}),Oa()}get decorateEnableButtonFlipVertical(){return this.$$.ctx[23]}set decorateEnableButtonFlipVertical(e){this.$$set({decorateEnableButtonFlipVertical:e}),Oa()}get decorateEnableSelectImagePreset(){return this.$$.ctx[24]}set decorateEnableSelectImagePreset(e){this.$$set({decorateEnableSelectImagePreset:e}),Oa()}get decorateEnableDropImagePreset(){return this.$$.ctx[25]}set decorateEnableDropImagePreset(e){this.$$set({decorateEnableDropImagePreset:e}),Oa()}get decoratePresets(){return this.$$.ctx[26]}set decoratePresets(e){this.$$set({decoratePresets:e}),Oa()}get decorateWillRenderShapePresetToolbar(){return this.$$.ctx[27]}set decorateWillRenderShapePresetToolbar(e){this.$$set({decorateWillRenderShapePresetToolbar:e}),Oa()}get decorateWillRenderShapeStyleControls(){return this.$$.ctx[28]}set decorateWillRenderShapeStyleControls(e){this.$$set({decorateWillRenderShapeStyleControls:e}),Oa()}get enableSelectToolToAddShape(){return this.$$.ctx[29]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),Oa()}get enableTapToAddText(){return this.$$.ctx[30]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),Oa()}get enableViewTool(){return this.$$.ctx[31]}set enableViewTool(e){this.$$set({enableViewTool:e}),Oa()}get enableMoveTool(){return this.$$.ctx[32]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),Oa()}get enableAutoSelectMoveTool(){return this.$$.ctx[33]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[34]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}get willRenderShapeControls(){return this.$$.ctx[35]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),Oa()}get willRenderShapeTextControls(){return this.$$.ctx[36]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),Oa()}get beforeAddShape(){return this.$$.ctx[37]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),Oa()}get beforeRemoveShape(){return this.$$.ctx[38]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),Oa()}get beforeDeselectShape(){return this.$$.ctx[39]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),Oa()}get beforeSelectShape(){return this.$$.ctx[40]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),Oa()}get beforeUpdateShape(){return this.$$.ctx[41]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),Oa()}get markupEditorWillStartInteraction(){return this.$$.ctx[42]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),Oa()}}]};function jx(e){let t,o;return t=new Fx({props:{stores:e[3],locale:e[4],isActive:e[0],isActiveFraction:e[1],isVisible:e[2],mapScreenPointToImagePoint:e[26],mapImagePointToScreenPoint:e[25],utilKey:"sticker",shapePresets:e[5],shapes:e[6]?e[35]:e[36],toolActive:"preset",imageFlipX:!!e[6]&&e[24],imageFlipY:!!e[6]&&e[23],imageRotation:e[6]?e[31]:0,parentRect:e[6]?e[37]:e[33],snapThreshold:e[29],gridSize:e[28],enableMultiSelect:e[12],enableSnapToContext:e[27],enablePresetDropImage:e[7],enablePresetSelectImage:e[30],enableButtonFlipVertical:e[10]||e[8],toolSelectRadius:e[15],willStartInteraction:e[22],willRenderPresetToolbar:e[11]||e[9]||e[16],hooks:{willRenderShapeControls:e[13],willRenderShapeTextControls:e[14],beforeAddShape:e[17],beforeRemoveShape:e[18],beforeDeselectShape:e[19],beforeSelectShape:e[20],beforeUpdateShape:e[21]}}}),t.$on("measure",e[61]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8&o[0]&&(i.stores=e[3]),16&o[0]&&(i.locale=e[4]),1&o[0]&&(i.isActive=e[0]),2&o[0]&&(i.isActiveFraction=e[1]),4&o[0]&&(i.isVisible=e[2]),67108864&o[0]&&(i.mapScreenPointToImagePoint=e[26]),33554432&o[0]&&(i.mapImagePointToScreenPoint=e[25]),32&o[0]&&(i.shapePresets=e[5]),64&o[0]&&(i.shapes=e[6]?e[35]:e[36]),16777280&o[0]&&(i.imageFlipX=!!e[6]&&e[24]),8388672&o[0]&&(i.imageFlipY=!!e[6]&&e[23]),64&o[0]|1&o[1]&&(i.imageRotation=e[6]?e[31]:0),64&o[0]&&(i.parentRect=e[6]?e[37]:e[33]),536870912&o[0]&&(i.snapThreshold=e[29]),268435456&o[0]&&(i.gridSize=e[28]),4096&o[0]&&(i.enableMultiSelect=e[12]),134217728&o[0]&&(i.enableSnapToContext=e[27]),128&o[0]&&(i.enablePresetDropImage=e[7]),1073741824&o[0]&&(i.enablePresetSelectImage=e[30]),1280&o[0]&&(i.enableButtonFlipVertical=e[10]||e[8]),32768&o[0]&&(i.toolSelectRadius=e[15]),4194304&o[0]&&(i.willStartInteraction=e[22]),68096&o[0]&&(i.willRenderPresetToolbar=e[11]||e[9]||e[16]),4087808&o[0]&&(i.hooks={willRenderShapeControls:e[13],willRenderShapeTextControls:e[14],beforeAddShape:e[17],beforeRemoveShape:e[18],beforeDeselectShape:e[19],beforeSelectShape:e[20],beforeUpdateShape:e[21]}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Ux(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,y;let{isActive:b}=t,{isActiveFraction:x}=t,{isVisible:v}=t,{stores:S}=t,{locale:w={}}=t,{stickers:k=[]}=t,{stickerForceEnable:C=!1}=t,{stickerStickToImage:T=!1}=t,{stickerEnableSelectImagePreset:M=!0}=t,{stickerEnableDropImagePreset:P=!0}=t,{stickerEnableButtonFlipVertical:R=!1}=t,{stickerWillRenderShapePresetToolbar:I}=t,{stickerEnableSelectImage:E=!0}=t,{stickersEnableButtonFlipVertical:A=!1}=t,{stickersWillRenderShapePresetToolbar:L}=t,{markupEditorGridSize:F=0}=t,{markupEditorSnapThreshold:z=0}=t,{markupEditorSnapToContext:D=!1}=t,{enableMultiSelect:O}=t,{annotateGridSize:B}=t,{annotateSnapToContext:W}=t,{decorateGridSize:_}=t,{decorateSnapToContext:V}=t,{willRenderShapeControls:N}=t,{willRenderShapeTextControls:H}=t,{markupEditorToolSelectRadius:j}=t,{willRenderShapePresetToolbar:U}=t,{beforeAddShape:G}=t,{beforeRemoveShape:Z}=t,{beforeDeselectShape:X}=t,{beforeSelectShape:Y}=t,{beforeUpdateShape:q}=t,{markupEditorWillStartInteraction:K}=t;const{rootRect:J,imageCropRect:Q,imageSelectionRectPresentation:ee,imageAnnotation:te,imageDecoration:oe,imageSize:ie,imageTransforms:ne,imageTransformsInterpolated:re,imageRotation:ae,imageFlipX:se,imageFlipY:le}=S;return wr(e,J,e=>o(59,$=e)),wr(e,ee,e=>o(56,u=e)),wr(e,ie,e=>o(58,g=e)),wr(e,ne,e=>o(60,f=e)),wr(e,re,e=>o(57,m=e)),wr(e,ae,e=>o(31,y=e)),wr(e,se,e=>o(24,h=e)),wr(e,le,e=>o(23,p=e)),e.$$set=e=>{"isActive"in e&&o(0,b=e.isActive),"isActiveFraction"in e&&o(1,x=e.isActiveFraction),"isVisible"in e&&o(2,v=e.isVisible),"stores"in e&&o(3,S=e.stores),"locale"in e&&o(4,w=e.locale),"stickers"in e&&o(5,k=e.stickers),"stickerForceEnable"in e&&o(44,C=e.stickerForceEnable),"stickerStickToImage"in e&&o(6,T=e.stickerStickToImage),"stickerEnableSelectImagePreset"in e&&o(45,M=e.stickerEnableSelectImagePreset),"stickerEnableDropImagePreset"in e&&o(7,P=e.stickerEnableDropImagePreset),"stickerEnableButtonFlipVertical"in e&&o(8,R=e.stickerEnableButtonFlipVertical),"stickerWillRenderShapePresetToolbar"in e&&o(9,I=e.stickerWillRenderShapePresetToolbar),"stickerEnableSelectImage"in e&&o(46,E=e.stickerEnableSelectImage),"stickersEnableButtonFlipVertical"in e&&o(10,A=e.stickersEnableButtonFlipVertical),"stickersWillRenderShapePresetToolbar"in e&&o(11,L=e.stickersWillRenderShapePresetToolbar),"markupEditorGridSize"in e&&o(47,F=e.markupEditorGridSize),"markupEditorSnapThreshold"in e&&o(48,z=e.markupEditorSnapThreshold),"markupEditorSnapToContext"in e&&o(49,D=e.markupEditorSnapToContext),"enableMultiSelect"in e&&o(12,O=e.enableMultiSelect),"annotateGridSize"in e&&o(50,B=e.annotateGridSize),"annotateSnapToContext"in e&&o(51,W=e.annotateSnapToContext),"decorateGridSize"in e&&o(52,_=e.decorateGridSize),"decorateSnapToContext"in e&&o(53,V=e.decorateSnapToContext),"willRenderShapeControls"in e&&o(13,N=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(14,H=e.willRenderShapeTextControls),"markupEditorToolSelectRadius"in e&&o(15,j=e.markupEditorToolSelectRadius),"willRenderShapePresetToolbar"in e&&o(16,U=e.willRenderShapePresetToolbar),"beforeAddShape"in e&&o(17,G=e.beforeAddShape),"beforeRemoveShape"in e&&o(18,Z=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(19,X=e.beforeDeselectShape),"beforeSelectShape"in e&&o(20,Y=e.beforeSelectShape),"beforeUpdateShape"in e&&o(21,q=e.beforeUpdateShape),"markupEditorWillStartInteraction"in e&&o(22,K=e.markupEditorWillStartInteraction)},e.$$.update=()=>{67108864&e.$$.dirty[1]&&o(54,i=m?m.scale:1),536870912&e.$$.dirty[1]&&o(55,n=f?f.rotation.z:0),49152&e.$$.dirty[1]&&o(30,r=!1!==M&&E),131072&e.$$.dirty[1]&&o(29,a=z),64&e.$$.dirty[0]|2686976&e.$$.dirty[1]&&o(28,s=T?No(B)?B:F:No(_)?_:F),64&e.$$.dirty[0]|5505024&e.$$.dirty[1]&&o(27,l=T?Ox(W)?W:D:Ox(V)?V:D),25165888&e.$$.dirty[0]|528482304&e.$$.dirty[1]&&o(26,c=T?e=>Dx(e,$,g,m.origin,m.translation,n,m.scale,h,p):e=>{const t=ve(e);return t.x-=u.x,t.y-=u.y,t.x/=i,t.y/=i,t}),25165888&e.$$.dirty[0]|528482304&e.$$.dirty[1]&&o(25,d=T?e=>zx(e,$,g,m.origin,m.translation,n,m.scale,h,p):e=>{const t=ve(e);return t.x*=i,t.y*=i,t.x+=u.x,t.y+=u.y,t})},[b,x,v,S,w,k,T,P,R,I,A,L,O,N,H,j,U,G,Z,X,Y,q,K,p,h,d,c,l,s,a,r,y,J,Q,ee,te,oe,ie,ne,re,ae,se,le,"sticker",C,M,E,F,z,D,B,W,_,V,i,n,u,m,g,$,f,function(t){wa.call(this,e,t)}]}var Gx={util:["sticker",class extends rs{constructor(e){super(),ns(this,e,Ux,jx,yr,{name:43,isActive:0,isActiveFraction:1,isVisible:2,stores:3,locale:4,stickers:5,stickerForceEnable:44,stickerStickToImage:6,stickerEnableSelectImagePreset:45,stickerEnableDropImagePreset:7,stickerEnableButtonFlipVertical:8,stickerWillRenderShapePresetToolbar:9,stickerEnableSelectImage:46,stickersEnableButtonFlipVertical:10,stickersWillRenderShapePresetToolbar:11,markupEditorGridSize:47,markupEditorSnapThreshold:48,markupEditorSnapToContext:49,enableMultiSelect:12,annotateGridSize:50,annotateSnapToContext:51,decorateGridSize:52,decorateSnapToContext:53,willRenderShapeControls:13,willRenderShapeTextControls:14,markupEditorToolSelectRadius:15,willRenderShapePresetToolbar:16,beforeAddShape:17,beforeRemoveShape:18,beforeDeselectShape:19,beforeSelectShape:20,beforeUpdateShape:21,markupEditorWillStartInteraction:22},null,[-1,-1])}get name(){return this.$$.ctx[43]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[2]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[3]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),Oa()}get stickers(){return this.$$.ctx[5]}set stickers(e){this.$$set({stickers:e}),Oa()}get stickerForceEnable(){return this.$$.ctx[44]}set stickerForceEnable(e){this.$$set({stickerForceEnable:e}),Oa()}get stickerStickToImage(){return this.$$.ctx[6]}set stickerStickToImage(e){this.$$set({stickerStickToImage:e}),Oa()}get stickerEnableSelectImagePreset(){return this.$$.ctx[45]}set stickerEnableSelectImagePreset(e){this.$$set({stickerEnableSelectImagePreset:e}),Oa()}get stickerEnableDropImagePreset(){return this.$$.ctx[7]}set stickerEnableDropImagePreset(e){this.$$set({stickerEnableDropImagePreset:e}),Oa()}get stickerEnableButtonFlipVertical(){return this.$$.ctx[8]}set stickerEnableButtonFlipVertical(e){this.$$set({stickerEnableButtonFlipVertical:e}),Oa()}get stickerWillRenderShapePresetToolbar(){return this.$$.ctx[9]}set stickerWillRenderShapePresetToolbar(e){this.$$set({stickerWillRenderShapePresetToolbar:e}),Oa()}get stickerEnableSelectImage(){return this.$$.ctx[46]}set stickerEnableSelectImage(e){this.$$set({stickerEnableSelectImage:e}),Oa()}get stickersEnableButtonFlipVertical(){return this.$$.ctx[10]}set stickersEnableButtonFlipVertical(e){this.$$set({stickersEnableButtonFlipVertical:e}),Oa()}get stickersWillRenderShapePresetToolbar(){return this.$$.ctx[11]}set stickersWillRenderShapePresetToolbar(e){this.$$set({stickersWillRenderShapePresetToolbar:e}),Oa()}get markupEditorGridSize(){return this.$$.ctx[47]}set markupEditorGridSize(e){this.$$set({markupEditorGridSize:e}),Oa()}get markupEditorSnapThreshold(){return this.$$.ctx[48]}set markupEditorSnapThreshold(e){this.$$set({markupEditorSnapThreshold:e}),Oa()}get markupEditorSnapToContext(){return this.$$.ctx[49]}set markupEditorSnapToContext(e){this.$$set({markupEditorSnapToContext:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[12]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}get annotateGridSize(){return this.$$.ctx[50]}set annotateGridSize(e){this.$$set({annotateGridSize:e}),Oa()}get annotateSnapToContext(){return this.$$.ctx[51]}set annotateSnapToContext(e){this.$$set({annotateSnapToContext:e}),Oa()}get decorateGridSize(){return this.$$.ctx[52]}set decorateGridSize(e){this.$$set({decorateGridSize:e}),Oa()}get decorateSnapToContext(){return this.$$.ctx[53]}set decorateSnapToContext(e){this.$$set({decorateSnapToContext:e}),Oa()}get willRenderShapeControls(){return this.$$.ctx[13]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),Oa()}get willRenderShapeTextControls(){return this.$$.ctx[14]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),Oa()}get markupEditorToolSelectRadius(){return this.$$.ctx[15]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),Oa()}get willRenderShapePresetToolbar(){return this.$$.ctx[16]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),Oa()}get beforeAddShape(){return this.$$.ctx[17]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),Oa()}get beforeRemoveShape(){return this.$$.ctx[18]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),Oa()}get beforeDeselectShape(){return this.$$.ctx[19]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),Oa()}get beforeSelectShape(){return this.$$.ctx[20]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),Oa()}get beforeUpdateShape(){return this.$$.ctx[21]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),Oa()}get markupEditorWillStartInteraction(){return this.$$.ctx[22]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),Oa()}},({stickers:e,stickerEnableSelectImage:t,stickerEnableSelectImagePreset:o,stickerEnableDropImagePreset:i,stickerForceEnable:n})=>e&&e.length||t||o||i||n]};function Zx(e){let t,o,i=(e[14](e[36].value)||"")+"";return{c(){t=new la(!1),o=Yr(),t.a=o},m(e,n){t.m(i,e,n),Hr(e,o,n)},p(e,o){32&o[1]&&i!==(i=(e[14](e[36].value)||"")+"")&&t.p(i)},i:ur,o:ur,d(e){e&&(jr(o),t.d())}}}function Xx(e){let t,o;return t=new Rh({props:{items:e[16](e[36].value)}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};32&o[1]&&(i.items=e[16](e[36].value)),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Yx(e){let t,o,i,n,r,a,s,l,c=(L(e[36].label)?e[36].label(e[1]):e[36].label)+"";const d=[Xx,Zx],u=[];function p(e,t){return 32&t[1]&&(o=null),null==o&&(o=!!e[15](e[36].value)),o?0:1}return i=p(e,[-1,-1]),n=u[i]=d[i](e),{c(){t=Ur("div"),n.c(),r=Xr(),a=Ur("span"),s=Zr(c),Qr(t,"slot","option")},m(e,o){Hr(e,t,o),u[i].m(t,null),_r(t,r),_r(t,a),_r(a,s),l=!0},p(e,o){let a=i;i=p(e,o),i===a?u[i].p(e,o):(Na(),Ua(u[a],1,1,()=>{u[a]=null}),Ha(),n=u[i],n?n.p(e,o):(n=u[i]=d[i](e),n.c()),ja(n,1),n.m(t,r)),(!l||2&o[0]|32&o[1])&&c!==(c=(L(e[36].label)?e[36].label(e[1]):e[36].label)+"")&&na(s,c)},i(e){l||(ja(n),l=!0)},o(e){Ua(n),l=!1},d(e){e&&jr(t),u[i].d()}}}function qx(e){let t,o;return t=new Xu({props:{locale:e[1],class:"PinturaControlList",layout:"row",options:e[2],selectedIndex:e[6],onchange:e[12],$$slots:{option:[Yx,({option:e})=>({36:e}),({option:e})=>[0,e?32:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};2&o[0]&&(i.locale=e[1]),4&o[0]&&(i.options=e[2]),64&o[0]&&(i.selectedIndex=e[6]),2&o[0]|96&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Kx(e){let t,o,i,n,r;return o=new jb({props:{locale:e[1],class:"PinturaControlPanels",shapeProps:e[4],onchange:e[13],controls:e[3],scrollElasticity:e[7]}}),n=new Gh({props:{elasticity:e[10],$$slots:{default:[qx]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),ts(o.$$.fragment),i=Xr(),ts(n.$$.fragment),Qr(t,"slot","footer"),aa(t,"transform",e[5])},m(e,a){Hr(e,t,a),os(o,t,null),_r(t,i),os(n,t,null),r=!0},p(e,i){const r={};2&i[0]&&(r.locale=e[1]),16&i[0]&&(r.shapeProps=e[4]),8&i[0]&&(r.controls=e[3]),128&i[0]&&(r.scrollElasticity=e[7]),o.$set(r);const a={};70&i[0]|64&i[1]&&(a.$$scope={dirty:i,ctx:e}),n.$set(a),32&i[0]&&aa(t,"transform",e[5])},i(e){r||(ja(o.$$.fragment,e),ja(n.$$.fragment,e),r=!0)},o(e){Ua(o.$$.fragment,e),Ua(n.$$.fragment,e),r=!1},d(e){e&&jr(t),is(o),is(n)}}}function Jx(e){let t,o;return t=new Nf({props:{$$slots:{footer:[Kx]},$$scope:{ctx:e}}}),t.$on("measure",e[25]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};254&o[0]|64&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Qx(e,t,o){let i,n,r,a,s,l,c,d,u=ur,p=()=>(u(),u=vr(h,e=>o(22,s=e)),h);e.$$.on_destroy.push(()=>u());let{isActive:h}=t;p();let{stores:m}=t,{locale:g={}}=t,{frameStyles:$={}}=t,{frameOptions:f=[]}=t,{markupEditorShapeStyleControls:y}=t;const b=Sa("elasticityMultiplier");wr(e,b,e=>o(24,d=e));const{history:x,animation:v,scrollElasticity:S,imageFrame:w,allowPan:k,allowZoom:C,allowZoomControls:T,allowPlayPause:M}=m;wr(e,v,e=>o(23,l=e)),wr(e,w,e=>o(4,c=e));let P={};let R;const I=Fc(l?20:0);return wr(e,I,e=>o(21,a=e)),e.$$set=e=>{"isActive"in e&&p(o(0,h=e.isActive)),"stores"in e&&o(19,m=e.stores),"locale"in e&&o(1,g=e.locale),"frameStyles"in e&&o(20,$=e.frameStyles),"frameOptions"in e&&o(2,f=e.frameOptions),"markupEditorShapeStyleControls"in e&&o(3,y=e.markupEditorShapeStyleControls)},e.$$.update=()=>{4194304&e.$$.dirty[0]&&k.set(s),4194304&e.$$.dirty[0]&&C.set(s),4194304&e.$$.dirty[0]&&T.set(s),4194304&e.$$.dirty[0]&&s&&M.set(!0),16777216&e.$$.dirty[0]&&o(7,i=d*S),20&e.$$.dirty[0]&&o(6,n=c?f.findIndex(([e])=>e===c.id):0),12582912&e.$$.dirty[0]&&l&&I.set(s?0:20),2097152&e.$$.dirty[0]&&o(5,r=a?`translateY(${a}px)`:"none")},[h,g,f,y,c,r,n,i,b,v,S,w,({value:e})=>{const t=$[e];if(!t||!t.shape)return w.set(void 0),void x.write();const{shape:o}=t,i={id:e,...Ri(o),...Object.keys(P).reduce((e,t)=>o[t]?(e[t]=P[t],e):e,{})};w.set(i),x.write()},function(e){jo(e,"frameColor")&&(P.frameColor=e.frameColor),c&&(Dn(c,e),w.set(c),clearTimeout(R),R=setTimeout(()=>{x.write()},200))},e=>{const t=$[e];var o;if(t&&t.thumb)return o=t.thumb,/div/i.test(o)||Ub(o)?o:/rect|path|circle|line|<g>/i.test(o)?`<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" stroke-width="1" stroke="currentColor" fill="none" aria-hidden="true" focusable="false" stroke-linecap="round" stroke-linejoin="round">${o}</svg>`:`<img src="${o}" alt=""/>`},e=>{const t=$[e];return!(!t||!t.thumb)&&Uo(t.thumb)},e=>$[e].thumb,I,"frame",m,$,a,s,l,d,function(t){wa.call(this,e,t)}]}var ev={util:["frame",class extends rs{constructor(e){super(),ns(this,e,Qx,Jx,yr,{name:18,isActive:0,stores:19,locale:1,frameStyles:20,frameOptions:2,markupEditorShapeStyleControls:3},null,[-1,-1])}get name(){return this.$$.ctx[18]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get stores(){return this.$$.ctx[19]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),Oa()}get frameStyles(){return this.$$.ctx[20]}set frameStyles(e){this.$$set({frameStyles:e}),Oa()}get frameOptions(){return this.$$.ctx[2]}set frameOptions(e){this.$$set({frameOptions:e}),Oa()}get markupEditorShapeStyleControls(){return this.$$.ctx[3]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),Oa()}},({src:e})=>e&&!al(e)]};function tv(e){let t,o,i,n,r,a,s,l;return{c(){t=Ur("div"),o=Ur("input"),n=Xr(),r=Ur("label"),a=Zr(e[1]),Qr(o,"id",e[0]),Qr(o,"type","number"),Qr(o,"min","1"),Qr(o,"inputmode","numeric"),Qr(o,"pattern","[0-9]*"),Qr(o,"data-state",e[3]),Qr(o,"autocomplete","off"),Qr(o,"placeholder",e[4]),o.value=i=void 0===e[5]?"":e[7](e[5]+""),Qr(r,"for",e[0]),Qr(r,"title",e[2]),Qr(r,"aria-label",e[2]),Qr(t,"class","PinturaInputDimension")},m(i,c){Hr(i,t,c),_r(t,o),_r(t,n),_r(t,r),_r(r,a),s||(l=qr(o,"input",e[8]),s=!0)},p(e,[t]){1&t&&Qr(o,"id",e[0]),8&t&&Qr(o,"data-state",e[3]),16&t&&Qr(o,"placeholder",e[4]),160&t&&i!==(i=void 0===e[5]?"":e[7](e[5]+""))&&o.value!==i&&(o.value=i),2&t&&na(a,e[1]),1&t&&Qr(r,"for",e[0]),4&t&&Qr(r,"title",e[2]),4&t&&Qr(r,"aria-label",e[2])},i:ur,o:ur,d(e){e&&jr(t),s=!1,l()}}}function ov(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 iv extends rs{constructor(e){super(),ns(this,e,ov,tv,yr,{id:0,label:1,title:2,state:3,placeholder:4,value:5,onchange:6,format:7})}}function nv(e){let t;return{c(){t=Gr("g")},m(o,i){Hr(o,t,i),t.innerHTML=e[2]},p(e,o){4&o&&(t.innerHTML=e[2])},d(e){e&&jr(t)}}}function rv(e){let t,o,i,n,r,a,s,l;return r=new Od({props:{$$slots:{default:[nv]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),o=Ur("input"),i=Xr(),n=Ur("label"),ts(r.$$.fragment),Qr(o,"id",e[0]),Qr(o,"class","implicit"),Qr(o,"type","checkbox"),o.checked=e[1],Qr(n,"for",e[0]),Qr(n,"title",e[3])},m(c,d){Hr(c,t,d),_r(t,o),_r(t,i),_r(t,n),os(r,n,null),a=!0,s||(l=qr(o,"change",e[5]),s=!0)},p(e,[t]){(!a||1&t)&&Qr(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)&&Qr(n,"for",e[0]),(!a||8&t)&&Qr(n,"title",e[3])},i(e){a||(ja(r.$$.fragment,e),a=!0)},o(e){Ua(r.$$.fragment,e),a=!1},d(e){e&&jr(t),is(r),s=!1,l()}}}function av(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 sv extends rs{constructor(e){super(),ns(this,e,av,rv,yr,{id:0,locked:1,icon:2,title:3,onchange:4})}}function lv(e){let t;return{c(){t=Zr("Save")},m(e,o){Hr(e,t,o)},d(e){e&&jr(t)}}}function cv(e){let t,o,i,n,r,a,s,l,c,d,u,p,h,m=e[1].resizeLabelFormCaption+"";return l=new Rh({props:{items:e[4]}}),d=new Dh({props:{type:"submit",class:"implicit",$$slots:{default:[lv]},$$scope:{ctx:e}}}),{c(){t=Ur("form"),o=Ur("div"),i=Ur("fieldset"),n=Ur("legend"),r=Zr(m),a=Xr(),s=Ur("div"),ts(l.$$.fragment),c=Xr(),ts(d.$$.fragment),Qr(n,"class","implicit"),Qr(s,"class","PinturaFieldsetInner"),Qr(o,"class","PinturaFormInner"),Qr(t,"slot","footer"),aa(t,"transform",e[3])},m(m,g){Hr(m,t,g),_r(t,o),_r(o,i),_r(i,n),_r(n,r),_r(i,a),_r(i,s),os(l,s,null),e[66](s),_r(o,c),os(d,o,null),u=!0,p||(h=[qr(s,"focusin",e[15]),qr(s,"focusout",e[16]),qr(t,"submit",Kr(e[17]))],p=!0)},p(e,o){(!u||2&o[0])&&m!==(m=e[1].resizeLabelFormCaption+"")&&na(r,m);const i={};16&o[0]&&(i.items=e[4]),l.$set(i);const n={};32&o[3]&&(n.$$scope={dirty:o,ctx:e}),d.$set(n),8&o[0]&&aa(t,"transform",e[3])},i(e){u||(ja(l.$$.fragment,e),ja(d.$$.fragment,e),u=!0)},o(e){Ua(l.$$.fragment,e),Ua(d.$$.fragment,e),u=!1},d(o){o&&jr(t),is(l),e[66](null),is(d),p=!1,$r(h)}}}function dv(e){let t,o;return t=new Nf({props:{$$slots:{footer:[cv]},$$scope:{ctx:e}}}),t.$on("measure",e[67]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};30&o[0]|32&o[3]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function uv(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,b,x,v,S,w,k,C,T,M,P,R,I,E,A,F,z=ur,D=()=>(z(),z=vr(W,e=>o(50,h=e)),W);e.$$.on_destroy.push(()=>z());const O=(e,t=0,o=9999)=>{if(y(e)&&!(e=e.replace(/\D/g,"")).length)return;const i=Math.round(e);return Number.isNaN(i)?void 0:Rs(i,t,o)};let{isActive:W}=t;D();let{stores:_}=t,{locale:V={}}=t,{resizeMinSize:N=Ze(1,1)}=t,{resizeMaxSize:H=Ze(9999,9999)}=t,{resizeAspectRatioLocked:j=!1}=t,{resizeEnableButtonLockAspectRatio:U=!0}=t,{resizeSizePresetOptions:G}=t,{resizeWidthPresetOptions:Z}=t,{resizeHeightPresetOptions:X}=t,{resizeWillRenderFooter:Y=ee}=t,{resizeFormatIconButtonMaintainAspectRatio:q=function(e){const{active:t,activeFraction:o}=e;return{active:t,activeFraction:3*(o-1)}}}=t;const K=Fc(0,{stiffness:.15,damping:.3});wr(e,K,e=>o(55,b=e));const{animation:J,imageSize:te,imageCropRect:oe,imageCropRectAspectRatio:ie,imageCropAspectRatio:ne,imageOutputSize:re,imageSelectionZoom:ae,imageSelectionPan:se,history:le,env:ce,allowPan:de,allowZoom:ue,allowZoomControls:pe,allowPlayPause:he}=_;wr(e,J,e=>o(51,m=e)),wr(e,te,e=>o(74,E=e)),wr(e,oe,e=>o(53,$=e)),wr(e,ie,e=>o(54,f=e)),wr(e,ne,e=>o(73,M=e)),wr(e,re,e=>o(62,T=e)),wr(e,ae,e=>o(75,A=e)),wr(e,se,e=>o(76,F=e)),wr(e,ce,e=>o(52,g=e));const me=B();let ge,$e,fe,be,xe,ve,Se=ye();const we=(e,t,o,i,n)=>null!=e&&o!==t?e>=i[t]&&e<=n[t]?"valid":"invalid":"undetermined",ke=(e,t,o)=>Math.round(null!=e?e/t:o.height),Ce=()=>{j&&$e&&fe&&("width"===be?o(40,fe=Math.round($e/f)):"height"===be?o(39,$e=Math.round(fe*f)):("width"===xe?o(40,fe=Math.round($e/f)):"height"===xe&&o(39,$e=Math.round(fe*f)),Te()))},Te=e=>{let t=O($e),i=O(fe),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?Q(n,r):f;let l=Ze(n,r);Je(H,l)||(l=Pt(H,s)),Je(l,N)||(l=Mt(N,s)),o(39,$e=null!=t?Math.round(l.width):void 0),o(40,fe=null!=i?Math.round(l.height):void 0)},Me=()=>{Te();const{width:e,height:t}=T||{};e===$e&&t===fe||($e||fe?($e&&fe&&Er(ne,M=$e/fe,M),Er(re,T=Ze($e,fe),T)):(Er(ne,M=E.width/E.height,M),Er(ne,M=void 0,M),Er(re,T=void 0,T)),le.write())},Pe=re.subscribe(e=>{if(!e)return o(39,$e=void 0),void o(40,fe=void 0);o(39,$e=e.width),o(40,fe=e.height),Te()}),Re=ne.subscribe(e=>{($e||fe)&&e&&($e&&fe&&Q($e,fe)!==e?(o(40,fe=$e/e),Te(e)):Te())}),Ie=e=>y(e[0])?(e[1]=e[1].map(Ie),e):No(e)?[e,""+e]:e,Ee=e=>{if(y(e[0]))return e[1]=e[1].map(Ee),e;let[t,o]=e;if(No(t)&&No(o)){const[e,i]=[t,o];o=`${e} &times; ${i}`,t=[e,i]}return[t,o]},Ae=ls();wr(e,Ae,e=>o(61,C=e));const Le=ls();wr(e,Le,e=>o(65,I=e));const Fe=ls();wr(e,Fe,e=>o(59,w=e));const ze=ls();wr(e,ze,e=>o(64,R=e));const De=ls();wr(e,De,e=>o(57,v=e));const Oe=ls();wr(e,Oe,e=>o(63,P=e));const Be=cs([re,Le],([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)});wr(e,Be,e=>o(60,k=e));const We=cs([re,ze],([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex(([t])=>!t&&!e||!!t&&e.width===t);o(i<0?0:i)});wr(e,We,e=>o(58,S=e));const _e=cs([re,Oe],([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex(([t])=>!t&&!e||!!t&&e.height===t);o(i<0?0:i)});let Ve,Ne;wr(e,_e,e=>o(56,x=e));const He=Sa("redrawTrigger"),je=Fc(m?20:0);return wr(e,je,e=>o(49,p=e)),ba(()=>{Pe(),Re()}),e.$$set=e=>{"isActive"in e&&D(o(0,W=e.isActive)),"stores"in e&&o(30,_=e.stores),"locale"in e&&o(1,V=e.locale),"resizeMinSize"in e&&o(31,N=e.resizeMinSize),"resizeMaxSize"in e&&o(32,H=e.resizeMaxSize),"resizeAspectRatioLocked"in e&&o(28,j=e.resizeAspectRatioLocked),"resizeEnableButtonLockAspectRatio"in e&&o(33,U=e.resizeEnableButtonLockAspectRatio),"resizeSizePresetOptions"in e&&o(34,G=e.resizeSizePresetOptions),"resizeWidthPresetOptions"in e&&o(35,Z=e.resizeWidthPresetOptions),"resizeHeightPresetOptions"in e&&o(36,X=e.resizeHeightPresetOptions),"resizeWillRenderFooter"in e&&o(37,Y=e.resizeWillRenderFooter),"resizeFormatIconButtonMaintainAspectRatio"in e&&o(38,q=e.resizeFormatIconButtonMaintainAspectRatio)},e.$$.update=()=>{524288&e.$$.dirty[1]&&de.set(!h),524288&e.$$.dirty[1]&&ue.set(!h),524288&e.$$.dirty[1]&&pe.set(!h),524288&e.$$.dirty[1]&&h&&he.set(!0),1073741832&e.$$.dirty[1]&&G&&(Er(Ae,C=G.map(Ee),C),Er(Le,I=fu(C),I)),1073741824&e.$$.dirty[1]&&o(48,a=!!C),536870912&e.$$.dirty[1]|8&e.$$.dirty[2]&&o(47,i=k>-1&&I[k][1]),268435472&e.$$.dirty[1]&&Z&&(Er(Fe,w=Z.map(Ie),w),Er(ze,R=fu(w),R)),268566528&e.$$.dirty[1]&&o(45,s=!a&&w),134217728&e.$$.dirty[1]|4&e.$$.dirty[2]&&o(46,n=S>-1&&R[S][1]),67108896&e.$$.dirty[1]&&X&&(Er(De,v=X.map(Ie),v),Er(Oe,P=fu(v),P)),67239936&e.$$.dirty[1]&&o(44,l=!a&&v),33554432&e.$$.dirty[1]|2&e.$$.dirty[2]&&o(43,r=x>-1&&P[x][1]),155648&e.$$.dirty[1]&&o(42,c=!a&&!s&&!l),268435458&e.$$.dirty[0]|2145648583&e.$$.dirty[1]&&o(4,d=He&&wm(()=>{return Y([a&&["Dropdown","size-presets",{label:i,options:C,onchange:e=>{return(t=e.value)&&!Ve&&(Ve={...$},Ne=M),t?(Er(ne,M=Q(t[0],t[1]),M),Er(re,T=Ue(t),T)):(Er(oe,$=Ve,$),Er(ne,M=Ne,M),Er(re,T=void 0,T),Ve=void 0,Ne=void 0),void le.write();var t},selectedIndex:k}],s&&["Dropdown","width-presets",{label:n,options:w,onchange:e=>{o(39,$e=e.value),Me()},selectedIndex:S}],s&&l&&["span","times",{class:"PinturaResizeLabel",innerHTML:"&times;"}],l&&["Dropdown","height-presets",{label:r,options:v,onchange:e=>{o(40,fe=e.value),Me()},selectedIndex:x}],c&&[iv,"width-input",{id:`width-${me}`,title:V.resizeTitleInputWidth,label:V.resizeLabelInputWidth,placeholder:(e=O(fe),t=f,d=$,Math.round(null!=e?e*t:d.width)),value:$e,state:we(O($e),"width",be,N,H),onchange:e=>{o(39,$e=e),Ce()}}],c&&U&&[sv,"aspect-ratio-lock",{id:`aspect-ratio-lock-${me}`,title:V.resizeTitleButtonMaintainAspectRatio,icon:L(V.resizeIconButtonMaintainAspectRatio)?V.resizeIconButtonMaintainAspectRatio(j,b):jl(V.resizeIconButtonMaintainAspectRatio,q({active:j,activeFraction:b}),"{","}"),locked:j,onchange:e=>{o(28,j=e),Ce()}}],c&&[iv,"height-input",{id:`height-${me}`,title:V.resizeTitleInputHeight,label:V.resizeLabelInputHeight,placeholder:ke(O($e),f,$),value:fe,state:we(O(fe),"height",be,N,H),onchange:e=>{o(40,fe=e),Ce()}}]].filter(Boolean),{...g},()=>He.set({}));var e,t,d}).filter(Boolean)),268435456&e.$$.dirty[0]&&K.set(j?1:0),1024&e.$$.dirty[1]&&be&&(xe=be),524288&e.$$.dirty[1]&&h&&(Se=F,ve=A),524288&e.$$.dirty[1]|1&e.$$.dirty[2]&&(h?setTimeout(()=>{return e=T,Er(se,F=ye(),F),void Er(ae,A=e&&$?e.width/$.width||e.height/$.height:1,A);var e},0):(Er(se,F=Se,F),Er(ae,A=ve,A))),1572864&e.$$.dirty[1]&&m&&je.set(h?0:20),262144&e.$$.dirty[1]&&o(3,u=p?`translateY(${p}px)`:"none")},[W,V,ge,u,d,K,J,te,oe,ie,ne,re,ae,se,ce,e=>{const t=e.target.id;/width/.test(t)?o(41,be="width"):/height/.test(t)?o(41,be="height"):/aspectRatio/i.test(t)?o(41,be="lock"):o(41,be=void 0)},e=>{ge.contains(e.relatedTarget)||Me(),o(41,be=void 0)},Me,Ae,Le,Fe,ze,De,Oe,Be,We,_e,je,j,"resize",_,N,H,U,G,Z,X,Y,q,$e,fe,be,c,r,l,s,n,i,a,p,h,m,g,$,f,b,x,v,S,w,k,C,T,P,R,I,function(e){Ca[e?"unshift":"push"](()=>{ge=e,o(2,ge)})},function(t){wa.call(this,e,t)}]}var pv={util:["resize",class extends rs{constructor(e){super(),ns(this,e,uv,dv,yr,{name:29,isActive:0,stores:30,locale:1,resizeMinSize:31,resizeMaxSize:32,resizeAspectRatioLocked:28,resizeEnableButtonLockAspectRatio:33,resizeSizePresetOptions:34,resizeWidthPresetOptions:35,resizeHeightPresetOptions:36,resizeWillRenderFooter:37,resizeFormatIconButtonMaintainAspectRatio:38},null,[-1,-1,-1,-1])}get name(){return this.$$.ctx[29]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get stores(){return this.$$.ctx[30]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),Oa()}get resizeMinSize(){return this.$$.ctx[31]}set resizeMinSize(e){this.$$set({resizeMinSize:e}),Oa()}get resizeMaxSize(){return this.$$.ctx[32]}set resizeMaxSize(e){this.$$set({resizeMaxSize:e}),Oa()}get resizeAspectRatioLocked(){return this.$$.ctx[28]}set resizeAspectRatioLocked(e){this.$$set({resizeAspectRatioLocked:e}),Oa()}get resizeEnableButtonLockAspectRatio(){return this.$$.ctx[33]}set resizeEnableButtonLockAspectRatio(e){this.$$set({resizeEnableButtonLockAspectRatio:e}),Oa()}get resizeSizePresetOptions(){return this.$$.ctx[34]}set resizeSizePresetOptions(e){this.$$set({resizeSizePresetOptions:e}),Oa()}get resizeWidthPresetOptions(){return this.$$.ctx[35]}set resizeWidthPresetOptions(e){this.$$set({resizeWidthPresetOptions:e}),Oa()}get resizeHeightPresetOptions(){return this.$$.ctx[36]}set resizeHeightPresetOptions(e){this.$$set({resizeHeightPresetOptions:e}),Oa()}get resizeWillRenderFooter(){return this.$$.ctx[37]}set resizeWillRenderFooter(e){this.$$set({resizeWillRenderFooter:e}),Oa()}get resizeFormatIconButtonMaintainAspectRatio(){return this.$$.ctx[38]}set resizeFormatIconButtonMaintainAspectRatio(e){this.$$set({resizeFormatIconButtonMaintainAspectRatio:e}),Oa()}}]};function hv(e){let t,o;return t=new Fx({props:{stores:e[3],locale:e[4],isActive:e[0],isActiveFraction:e[1],isVisible:e[2],mapScreenPointToImagePoint:e[10],mapImagePointToScreenPoint:e[9],enableMultiSelect:e[6],utilKey:"redact",imageRotation:e[11],imageFlipX:e[8],imageFlipY:e[7],shapes:e[12],toolbar:["rect"],toolShapes:{rectangle:[{x:0,y:0,width:0,height:0}]},toolActive:"rectangle",parentRect:e[14],enablePresetDropImage:!1,enablePresetSelectImage:!1,willStartInteraction:e[5],hooks:{willRenderShapeControls:e[26]}}}),t.$on("measure",e[27]),{c(){ts(t.$$.fragment)},m(e,i){os(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]),1024&o&&(i.mapScreenPointToImagePoint=e[10]),512&o&&(i.mapImagePointToScreenPoint=e[9]),64&o&&(i.enableMultiSelect=e[6]),2048&o&&(i.imageRotation=e[11]),256&o&&(i.imageFlipX=e[8]),128&o&&(i.imageFlipY=e[7]),32&o&&(i.willStartInteraction=e[5]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function mv(e,t,o){let i,n,r,a,s,l,c,d,u,p;let{isActive:h}=t,{isActiveFraction:m}=t,{isVisible:g}=t,{stores:$}=t,{locale:f={}}=t,{markupEditorWillStartInteraction:y}=t,{enableMultiSelect:b}=t;const{imageRedaction:x,rootRect:v,imageSize:S,imageRotation:w,imageFlipX:k,imageFlipY:C,imageTransforms:T,imageTransformsInterpolated:M}=$;wr(e,v,e=>o(24,d=e)),wr(e,S,e=>o(23,c=e)),wr(e,w,e=>o(11,p=e)),wr(e,k,e=>o(8,s=e)),wr(e,C,e=>o(7,a=e)),wr(e,T,e=>o(25,u=e)),wr(e,M,e=>o(22,l=e));return e.$$set=e=>{"isActive"in e&&o(0,h=e.isActive),"isActiveFraction"in e&&o(1,m=e.isActiveFraction),"isVisible"in e&&o(2,g=e.isVisible),"stores"in e&&o(3,$=e.stores),"locale"in e&&o(4,f=e.locale),"markupEditorWillStartInteraction"in e&&o(5,y=e.markupEditorWillStartInteraction),"enableMultiSelect"in e&&o(6,b=e.enableMultiSelect)},e.$$.update=()=>{33554432&e.$$.dirty&&o(21,i=u?u.rotation.z:0),31457664&e.$$.dirty&&o(10,n=e=>Dx(e,d,c,l.origin,l.translation,i,l.scale,s,a)),31457664&e.$$.dirty&&o(9,r=e=>zx(e,d,c,l.origin,l.translation,i,l.scale,s,a))},[h,m,g,$,f,y,b,a,s,r,n,p,x,v,S,w,k,C,T,M,"redact",i,l,c,d,u,e=>{const t=xg(e[0]);return Sg("to-front",t),e},function(t){wa.call(this,e,t)}]}var gv={util:["redact",class extends rs{constructor(e){super(),ns(this,e,mv,hv,yr,{name:20,isActive:0,isActiveFraction:1,isVisible:2,stores:3,locale:4,markupEditorWillStartInteraction:5,enableMultiSelect:6})}get name(){return this.$$.ctx[20]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[2]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[3]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),Oa()}get markupEditorWillStartInteraction(){return this.$$.ctx[5]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[6]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}},({src:e})=>e&&!al(e)]};function $v(e){let t;return{c(){t=Ur("div")},m(e,o){Hr(e,t,o)},p:ur,d(e){e&&jr(t)}}}function fv(e){let t,o,i,n;return{c(){t=Ur("div"),Qr(t,"class","PinturaFillTile")},m(r,a){Hr(r,t,a),i||(n=Ar(o=kv.call(null,t,e[31].value)),i=!0)},p(e,t){o&&fr(o.update)&&1&t[1]&&o.update.call(null,e[31].value)},d(e){e&&jr(t),i=!1,n()}}}function yv(e){let t,o,i;return{c(){t=Ur("div"),o=Ur("img"),xr(o.src,i=e[31].value)||Qr(o,"src",i),Qr(o,"alt",""),Qr(o,"width","48"),Qr(o,"height","64"),Qr(t,"class","PinturaFillTile")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){1&t[1]&&!xr(o.src,i=e[31].value)&&Qr(o,"src",i)},d(e){e&&jr(t)}}}function bv(e){let t,o,i=(L(e[31].label)?e[31].label(e[1]):e[31].label)+"";return{c(){t=Ur("span"),o=Zr(i)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){2&t[0]|1&t[1]&&i!==(i=(L(e[31].label)?e[31].label(e[1]):e[31].label)+"")&&na(o,i)},d(e){e&&jr(t)}}}function xv(e){let t,o,i,n;function r(e,t){return 1&t[1]&&(o=null),1&t[1]&&(i=null),null==o&&(o=!!y(e[31].value)),o?yv:(null==i&&(i=!!Uo(e[31].value)),i?fv:$v)}let a=r(e,[-1,-1]),s=a(e),l=e[31].label&&bv(e);return{c(){t=Ur("div"),s.c(),n=Xr(),l&&l.c(),Qr(t,"slot","option")},m(e,o){Hr(e,t,o),s.m(t,null),_r(t,n),l&&l.m(t,null)},p(e,o){a===(a=r(e,o))&&s?s.p(e,o):(s.d(1),s=a(e),s&&(s.c(),s.m(t,n))),e[31].label?l?l.p(e,o):(l=bv(e),l.c(),l.m(t,null)):l&&(l.d(1),l=null)},d(e){e&&jr(t),s.d(),l&&l.d()}}}function vv(e){let t,o;return t=new Xu({props:{locale:e[1],class:"PinturaControlList",layout:"row",options:e[2],selectedIndex:e[4],onchange:e[10],$$slots:{option:[xv,({option:e})=>({31:e}),({option:e})=>[0,e?1:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(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||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Sv(e){let t,o,i;return o=new Gh({props:{elasticity:e[5],$$slots:{default:[vv]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"slot","footer"),aa(t,"transform",e[3])},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,i){const n={};32&i[0]&&(n.elasticity=e[5]),22&i[0]|2&i[1]&&(n.$$scope={dirty:i,ctx:e}),o.$set(n),8&i[0]&&aa(t,"transform",e[3])},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function wv(e){let t,o;return t=new Nf({props:{$$slots:{footer:[Sv]},$$scope:{ctx:e}}}),t.$on("measure",e[21]),{c(){ts(t.$$.fragment)},m(e,i){os(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||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function kv(e){const t=document.createElement("div");return e.append(t),{update(o){const[i,n,r,a]=o.map((e,t)=>t<3?Math.round(255*e):e);e.dataset.transparent=a<1,t.style.backgroundColor=`rgba(${i},${n},${r},${a})`}}}function Cv(e,t,o){let i,n,r,a,s,l,c,d,u,p,h=ur,m=()=>(h(),h=vr(g,e=>o(16,l=e)),g);e.$$.on_destroy.push(()=>h());let{isActive:g}=t;m();let{stores:$}=t,{locale:f={}}=t,{fillOptions:b=[]}=t;const x=e=>e.map(e=>(e=>Uo(e)&&y(e[0])&&Uo(e[1]))(e)?[e[0],x(e[1]),e[2]]:(e=>[Array.isArray(e)&&3===e.length?[...e,1]:e,void 0,{disabled:!1}])(e)),v=Sa("elasticityMultiplier");wr(e,v,e=>o(20,p=e));const{history:S,animation:w,scrollElasticity:k,imageBackgroundColor:C,imageBackgroundImage:T,allowPan:M,allowZoom:P,allowZoomControls:R,allowPlayPause:I}=$;wr(e,w,e=>o(17,c=e)),wr(e,C,e=>o(19,u=e)),wr(e,T,e=>o(18,d=e));const E=Fc(c?20:0);return wr(e,E,e=>o(15,s=e)),e.$$set=e=>{"isActive"in e&&m(o(0,g=e.isActive)),"stores"in e&&o(13,$=e.stores),"locale"in e&&o(1,f=e.locale),"fillOptions"in e&&o(14,b=e.fillOptions)},e.$$.update=()=>{16384&e.$$.dirty[0]&&o(2,i=x(b)),65536&e.$$.dirty[0]&&M.set(l),65536&e.$$.dirty[0]&&P.set(l),65536&e.$$.dirty[0]&&R.set(l),65536&e.$$.dirty[0]&&l&&I.set(!0),1048576&e.$$.dirty[0]&&o(5,n=p*k),786436&e.$$.dirty[0]&&o(4,r=i.findIndex(([e])=>d?e===d:Array.isArray(e)?Fs(e,u):void 0)||0),196608&e.$$.dirty[0]&&c&&E.set(l?0:20),32768&e.$$.dirty[0]&&o(3,a=s?`translateY(${s}px)`:"none")},[g,f,i,a,r,n,v,w,C,T,({value:e})=>{y(e)&&(Er(C,u=void 0,u),Er(T,d=e,d)),Uo(e)&&(Er(C,u=e,u),Er(T,d=void 0,d)),S.write()},E,"fill",$,b,s,l,c,d,u,p,function(t){wa.call(this,e,t)}]}var Tv={util:["fill",class extends rs{constructor(e){super(),ns(this,e,Cv,wv,yr,{name:12,isActive:0,stores:13,locale:1,fillOptions:14},null,[-1,-1])}get name(){return this.$$.ctx[12]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get stores(){return this.$$.ctx[13]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),Oa()}get fillOptions(){return this.$$.ctx[14]}set fillOptions(e){this.$$set({fillOptions:e}),Oa()}},({src:e,fillOptions:t})=>e&&!al(e)&&t&&t.length]};function Mv(e){let t,o,i;function n(t){e[43](t)}let r={utilKey:"retouch",stores:e[4],locale:e[5],isActive:e[1],isActiveFraction:e[2],isVisible:e[3],mapScreenPointToImagePoint:e[27],mapImagePointToScreenPoint:e[26],imageRotation:e[28],imageFlipX:e[25],imageFlipY:e[24],toolbar:e[6],toolbarLayout:"stack",shapes:e[30],toolShapes:e[7],enableMultiSelect:e[23],enableViewTool:e[14],enableMoveTool:e[13],enableToolShareStyles:!1,shapeControls:e[8],enablePresetSelectImage:!1,enablePresetDropImage:!1,parentRect:e[31],willStartInteraction:e[12],willRenderHeaderTools:e[10]||e[17],willRenderShapeStyleControls:e[9],hooks:{willRenderShapeControls:e[11]||e[15],willRenderShapeTextControls:e[16],beforeAddShape:e[18],beforeRemoveShape:e[19],beforeDeselectShape:e[20],beforeSelectShape:e[21],beforeUpdateShape:e[22]}};return void 0!==e[0]&&(r.toolActive=e[0]),t=new Fx({props:r}),Ca.push(()=>es(t,"toolActive",n)),t.$on("measure",e[44]),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};16&i[0]&&(n.stores=e[4]),32&i[0]&&(n.locale=e[5]),2&i[0]&&(n.isActive=e[1]),4&i[0]&&(n.isActiveFraction=e[2]),8&i[0]&&(n.isVisible=e[3]),134217728&i[0]&&(n.mapScreenPointToImagePoint=e[27]),67108864&i[0]&&(n.mapImagePointToScreenPoint=e[26]),268435456&i[0]&&(n.imageRotation=e[28]),33554432&i[0]&&(n.imageFlipX=e[25]),16777216&i[0]&&(n.imageFlipY=e[24]),64&i[0]&&(n.toolbar=e[6]),128&i[0]&&(n.toolShapes=e[7]),8388608&i[0]&&(n.enableMultiSelect=e[23]),16384&i[0]&&(n.enableViewTool=e[14]),8192&i[0]&&(n.enableMoveTool=e[13]),256&i[0]&&(n.shapeControls=e[8]),4096&i[0]&&(n.willStartInteraction=e[12]),132096&i[0]&&(n.willRenderHeaderTools=e[10]||e[17]),512&i[0]&&(n.willRenderShapeStyleControls=e[9]),8226816&i[0]&&(n.hooks={willRenderShapeControls:e[11]||e[15],willRenderShapeTextControls:e[16],beforeAddShape:e[18],beforeRemoveShape:e[19],beforeDeselectShape:e[20],beforeSelectShape:e[21],beforeUpdateShape:e[22]}),!o&&1&i[0]&&(o=!0,n.toolActive=e[0],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function Pv(e,t,o){let i,n,r,a,s,l,c,d,u,p;let{isActive:h}=t,{isActiveFraction:m}=t,{isVisible:g}=t,{stores:$}=t,{locale:f={}}=t,{retouchTools:y}=t,{retouchToolShapes:b}=t,{retouchShapeControls:x}=t,{retouchActiveTool:v}=t,{retouchWillRenderShapeStyleControls:S}=t,{retouchWillRenderHeaderTools:w}=t,{retouchWillRenderShapeControls:k}=t,{markupEditorWillStartInteraction:C}=t,{retouchEnableMoveTool:T}=t,{retouchEnableViewTool:M}=t,{willRenderShapeControls:P}=t,{willRenderShapeTextControls:R}=t,{willRenderHeaderTools:I}=t,{beforeAddShape:E}=t,{beforeRemoveShape:A}=t,{beforeDeselectShape:L}=t,{beforeSelectShape:F}=t,{beforeUpdateShape:z}=t,{enableMultiSelect:D}=t;const{rootRect:O,imageManipulation:B,imageSize:W,imageRotation:_,imageFlipX:V,imageFlipY:N,imageTransforms:H,imageTransformsInterpolated:j}=$;return wr(e,O,e=>o(41,d=e)),wr(e,W,e=>o(40,c=e)),wr(e,_,e=>o(28,p=e)),wr(e,V,e=>o(25,s=e)),wr(e,N,e=>o(24,a=e)),wr(e,H,e=>o(42,u=e)),wr(e,j,e=>o(39,l=e)),e.$$set=e=>{"isActive"in e&&o(1,h=e.isActive),"isActiveFraction"in e&&o(2,m=e.isActiveFraction),"isVisible"in e&&o(3,g=e.isVisible),"stores"in e&&o(4,$=e.stores),"locale"in e&&o(5,f=e.locale),"retouchTools"in e&&o(6,y=e.retouchTools),"retouchToolShapes"in e&&o(7,b=e.retouchToolShapes),"retouchShapeControls"in e&&o(8,x=e.retouchShapeControls),"retouchActiveTool"in e&&o(0,v=e.retouchActiveTool),"retouchWillRenderShapeStyleControls"in e&&o(9,S=e.retouchWillRenderShapeStyleControls),"retouchWillRenderHeaderTools"in e&&o(10,w=e.retouchWillRenderHeaderTools),"retouchWillRenderShapeControls"in e&&o(11,k=e.retouchWillRenderShapeControls),"markupEditorWillStartInteraction"in e&&o(12,C=e.markupEditorWillStartInteraction),"retouchEnableMoveTool"in e&&o(13,T=e.retouchEnableMoveTool),"retouchEnableViewTool"in e&&o(14,M=e.retouchEnableViewTool),"willRenderShapeControls"in e&&o(15,P=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(16,R=e.willRenderShapeTextControls),"willRenderHeaderTools"in e&&o(17,I=e.willRenderHeaderTools),"beforeAddShape"in e&&o(18,E=e.beforeAddShape),"beforeRemoveShape"in e&&o(19,A=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(20,L=e.beforeDeselectShape),"beforeSelectShape"in e&&o(21,F=e.beforeSelectShape),"beforeUpdateShape"in e&&o(22,z=e.beforeUpdateShape),"enableMultiSelect"in e&&o(23,D=e.enableMultiSelect)},e.$$.update=()=>{2048&e.$$.dirty[1]&&o(38,i=u?u.rotation.z:0),50331648&e.$$.dirty[0]|1920&e.$$.dirty[1]&&o(27,n=e=>Dx(e,d,c,l.origin,l.translation,i,l.scale,s,a)),50331648&e.$$.dirty[0]|1920&e.$$.dirty[1]&&o(26,r=e=>zx(e,d,c,l.origin,l.translation,i,l.scale,s,a))},[v,h,m,g,$,f,y,b,x,S,w,k,C,T,M,P,R,I,E,A,L,F,z,D,a,s,r,n,p,O,B,W,_,V,N,H,j,"retouch",i,l,c,d,u,function(e){v=e,o(0,v)},function(t){wa.call(this,e,t)}]}var Rv={util:["retouch",class extends rs{constructor(e){super(),ns(this,e,Pv,Mv,yr,{name:37,isActive:1,isActiveFraction:2,isVisible:3,stores:4,locale:5,retouchTools:6,retouchToolShapes:7,retouchShapeControls:8,retouchActiveTool:0,retouchWillRenderShapeStyleControls:9,retouchWillRenderHeaderTools:10,retouchWillRenderShapeControls:11,markupEditorWillStartInteraction:12,retouchEnableMoveTool:13,retouchEnableViewTool:14,willRenderShapeControls:15,willRenderShapeTextControls:16,willRenderHeaderTools:17,beforeAddShape:18,beforeRemoveShape:19,beforeDeselectShape:20,beforeSelectShape:21,beforeUpdateShape:22,enableMultiSelect:23},null,[-1,-1])}get name(){return this.$$.ctx[37]}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[4]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[5]}set locale(e){this.$$set({locale:e}),Oa()}get retouchTools(){return this.$$.ctx[6]}set retouchTools(e){this.$$set({retouchTools:e}),Oa()}get retouchToolShapes(){return this.$$.ctx[7]}set retouchToolShapes(e){this.$$set({retouchToolShapes:e}),Oa()}get retouchShapeControls(){return this.$$.ctx[8]}set retouchShapeControls(e){this.$$set({retouchShapeControls:e}),Oa()}get retouchActiveTool(){return this.$$.ctx[0]}set retouchActiveTool(e){this.$$set({retouchActiveTool:e}),Oa()}get retouchWillRenderShapeStyleControls(){return this.$$.ctx[9]}set retouchWillRenderShapeStyleControls(e){this.$$set({retouchWillRenderShapeStyleControls:e}),Oa()}get retouchWillRenderHeaderTools(){return this.$$.ctx[10]}set retouchWillRenderHeaderTools(e){this.$$set({retouchWillRenderHeaderTools:e}),Oa()}get retouchWillRenderShapeControls(){return this.$$.ctx[11]}set retouchWillRenderShapeControls(e){this.$$set({retouchWillRenderShapeControls:e}),Oa()}get markupEditorWillStartInteraction(){return this.$$.ctx[12]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),Oa()}get retouchEnableMoveTool(){return this.$$.ctx[13]}set retouchEnableMoveTool(e){this.$$set({retouchEnableMoveTool:e}),Oa()}get retouchEnableViewTool(){return this.$$.ctx[14]}set retouchEnableViewTool(e){this.$$set({retouchEnableViewTool:e}),Oa()}get willRenderShapeControls(){return this.$$.ctx[15]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),Oa()}get willRenderShapeTextControls(){return this.$$.ctx[16]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),Oa()}get willRenderHeaderTools(){return this.$$.ctx[17]}set willRenderHeaderTools(e){this.$$set({willRenderHeaderTools:e}),Oa()}get beforeAddShape(){return this.$$.ctx[18]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),Oa()}get beforeRemoveShape(){return this.$$.ctx[19]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),Oa()}get beforeDeselectShape(){return this.$$.ctx[20]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),Oa()}get beforeSelectShape(){return this.$$.ctx[21]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),Oa()}get beforeUpdateShape(){return this.$$.ctx[22]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[23]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}},({src:e})=>e&&!al(e)]};const Iv='<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M18 6L6 18M6 6l12 12"></path></path></g>',Ev='<path fill="none" d="M9 15 L12 9 L15 15 M10 13.5 h3" stroke="currentColor" stroke-width=".125em"/>';var Av={labelReset:"Reset",labelDefault:"Default",labelAuto:"Auto",labelNone:"None",labelEdit:"Edit",labelClose:"Close",labelSupportError:"{features} not supported on this browser",labelColor:"Color",labelWidth:"Width",labelSize:"Size",labelOffset:"Offset",labelAmount:"Amount",labelInset:"Inset",labelRadius:"Radius",labelColorPalette:"Color palette",labelSizeExtraSmall:"Extra small",labelSizeSmall:"Small",labelSizeMediumSmall:"Medium small",labelSizeMedium:"Medium",labelSizeMediumLarge:"Medium large",labelSizeLarge:"Large",labelSizeExtraLarge:"Extra large",labelButtonCancel:"Cancel",labelButtonUndo:"Undo",labelButtonRedo:"Redo",labelButtonRevert:"Revert",labelButtonExport:"Done",labelZoom:"Zoom",labelZoomIn:"Zoom in",labelZoomOut:"Zoom out",labelZoomFit:"Fit to view",labelZoomActual:"Actual size",iconZoomIn:'<path stroke="currentColor" stroke-width=".125em" d="M8 12 h8 M12 8 v8" />',iconZoomOut:'<path stroke="currentColor" stroke-width=".125em" d="M9 12 h6" />',iconSupportError:'<g fill="none" stroke="currentColor" stroke-width="2"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><g><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></g>',iconButtonClose:Iv,iconButtonRevert:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M7.388 18.538a8 8 0 10-2.992-9.03"/><path fill="currentColor" d="M2.794 11.696L2.37 6.714l5.088 3.18z"/><path d="M12 8v4M12 12l4 2"/></g>',iconButtonUndo:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M10 8h4c2.485 0 5 2 5 5s-2.515 5-5 5h-4"/><path fill="currentColor" d="M5 8l4-3v6z"/></g>',iconButtonRedo:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M14 8h-4c-2.485 0-5 2-5 5s2.515 5 5 5h4"/><path fill="currentColor" d="M19 8l-4-3v6z"/></g>',iconButtonExport:'<polyline points="20 6 9 17 4 12" fill="none" stroke="currentColor" stroke-width=".125em"></polyline>',statusLabelButtonClose:"Close",statusIconButtonClose:Iv,statusImageLoadNone:"Waiting for image",statusImageLoadMinSize:"Minimum image size is {minWidth} &times; {minHeight}",statusImageLoadPrepare:"Preparing image&hellip;",statusImageLoadBusy:"Loading image&hellip;",statusImageLoadError:"Error loading image",statusImageProcessBusy:"Processing image&hellip;",statusImageProcessError:"Error processing image",statusImageUploadBusy:"Uploading image&hellip;",statusImageUploadError:"Error uploading image"};const Lv={shapeLabelButtonSelectSticker:"Select image",shapeIconButtonSelectSticker:'<g fill="none" stroke="currentColor" stroke-width="0.0625em"><path d="M8 21 L15 11 L19 15"/><path d="M15 2 v5 h5"/><path d="M8 2 h8 l4 4 v12 q0 4 -4 4 h-8 q-4 0 -4 -4 v-12 q0 -4 4 -4z"/></g><circle fill="currentColor" cx="10" cy="8" r="1.5"/>',shapeIconButtonFlipHorizontal:'<g stroke="currentColor" stroke-width=".125em"><path fill="none" d="M6 6.5h5v11H6z"/><path fill="currentColor" d="M15 6.5h3v11h-3z"/><path d="M11 4v16" fill="currentColor"/></g>',shapeIconButtonFlipVertical:'<g stroke="currentColor" stroke-width=".125em"><rect x="7" y="8" width="11" height="5" fill="none"/><rect x="7" y="17" width="11" height="2" fill="currentColor"/><line x1="5" y1="13" x2="20" y2="13"/></g>',shapeIconButtonRemove:'<g fill="none" fill-rule="evenodd"><path stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7.5 7h9z"/><path d="M7.916 9h8.168a1 1 0 01.99 1.14l-.972 6.862a2 2 0 01-1.473 1.653c-.877.23-1.753.345-2.629.345-.876 0-1.752-.115-2.628-.345a2 2 0 01-1.473-1.653l-.973-6.862A1 1 0 017.916 9z" fill="currentColor"/><rect fill="currentColor" x="10" y="5" width="4" height="3" rx="1"/></g>',shapeIconButtonDuplicate:'<g fill="none" fill-rule="evenodd"><path d="M15 13.994V16a2 2 0 01-2 2H8a2 2 0 01-2-2v-5a2 2 0 012-2h2.142" stroke="currentColor" stroke-width=".125em"/><path d="M15 9V8a1 1 0 00-2 0v1h-1a1 1 0 000 2h1v1a1 1 0 002 0v-1h1a1 1 0 000-2h-1zm-4-4h6a2 2 0 012 2v6a2 2 0 01-2 2h-6a2 2 0 01-2-2V7a2 2 0 012-2z" fill="currentColor"/></g>',shapeIconButtonMoveToFront:'<g fill="none" fill-rule="evenodd"><rect fill="currentColor" x="11" y="13" width="8" height="2" rx="1"/><rect fill="currentColor" x="9" y="17" width="10" height="2" rx="1"/><path d="M11.364 8H10a5 5 0 000 10M12 6.5L14.5 8 12 9.5z" stroke="currentColor" stroke-width=".125em" stroke-linecap="round"/></g>',shapeIconButtonTextLayoutAutoWidth:`${Ev}`,shapeIconButtonTextLayoutAutoHeight:`<g fill="currentColor"><circle cx="4" cy="12" r="1.5"/><circle cx="20" cy="12" r="1.5"/></g>${Ev}`,shapeIconButtonTextLayoutFixedSize:`<g fill="currentColor"><circle cx="5" cy="6" r="1.5"/><circle cx="19" cy="6" r="1.5"/><circle cx="19" cy="19" r="1.5"/><circle cx="5" cy="19" r="1.5"/></g>${Ev}`,shapeTitleButtonTextLayoutAutoWidth:"Auto width",shapeTitleButtonTextLayoutAutoHeight:"Auto height",shapeTitleButtonTextLayoutFixedSize:"Fixed size",shapeTitleButtonFlipHorizontal:"Flip Horizontal",shapeTitleButtonFlipVertical:"Flip Vertical",shapeTitleButtonRemove:"Remove",shapeTitleButtonDuplicate:"Duplicate",shapeTitleButtonMoveToFront:"Move to front",shapeLabelInputText:"Edit text",shapeIconInputCancel:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M18 6L6 18M6 6l12 12"/></g>',shapeIconInputConfirm:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><polyline points="20 6 9 17 4 12"/></g>',shapeLabelInputCancel:"Cancel",shapeLabelInputConfirm:"Confirm",shapeLabelStrokeNone:"No outline",shapeLabelFontStyleNormal:"Normal",shapeLabelFontStyleBold:"Bold",shapeLabelFontStyleItalic:"Italic",shapeLabelFontStyleItalicBold:"Bold Italic",shapeTitleBackgroundColor:"Fill color",shapeTitleCornerRadius:"Corner radius",shapeTitleFontFamily:"Font",shapeTitleFontSize:"Font size",shapeTitleFontStyle:"Font style",shapeTitleLineHeight:"Line height",shapeTitleLineStart:"Start",shapeTitleLineEnd:"End",shapeTitleStrokeWidth:"Line width",shapeTitleStrokeColor:"Line color",shapeTitleLineDecorationBar:"Bar",shapeTitleLineDecorationCircle:"Circle",shapeTitleLineDecorationSquare:"Square",shapeTitleLineDecorationArrow:"Arrow",shapeTitleLineDecorationCircleSolid:"Circle solid",shapeTitleLineDecorationSquareSolid:"Square solid",shapeTitleLineDecorationArrowSolid:"Arrow solid",shapeIconLineDecorationBar:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H16"/><path d="M16,8 V16"/></g>',shapeIconLineDecorationCircle:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><circle fill="none" stroke-width=".125em" cx="16" cy="12" r="4"/></g>',shapeIconLineDecorationSquare:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><rect fill="none" stroke-width=".125em" x="12" y="8" width="8" height="8"/></g>',shapeIconLineDecorationArrow:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H16 M13,7 l6,5 l-6,5" fill="none"/></g>',shapeIconLineDecorationCircleSolid:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><circle fill="currentColor" cx="16" cy="12" r="4"/></g>',shapeIconLineDecorationSquareSolid:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><rect fill="currentColor" x="12" y="8" width="8" height="8"/></g>',shapeIconLineDecorationArrowSolid:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H16"/><path d="M13,7 l6,5 l-6,5z" fill="currentColor"/></g>',shapeTitleColorTransparent:"Transparent",shapeTitleColorWhite:"White",shapeTitleColorSilver:"Silver",shapeTitleColorGray:"Gray",shapeTitleColorBlack:"Black",shapeTitleColorNavy:"Navy",shapeTitleColorBlue:"Blue",shapeTitleColorAqua:"Aqua",shapeTitleColorTeal:"Teal",shapeTitleColorOlive:"Olive",shapeTitleColorGreen:"Green",shapeTitleColorYellow:"Yellow",shapeTitleColorOrange:"Orange",shapeTitleColorRed:"Red",shapeTitleColorMaroon:"Maroon",shapeTitleColorFuchsia:"Fuchsia",shapeTitleColorPurple:"Purple",shapeTitleTextOutline:"Text outline",shapeTitleTextOutlineWidth:"Width",shapeTitleTextShadow:"Text shadow",shapeTitleTextShadowBlur:"Blur",shapeTitleTextColor:"Font color",shapeTitleTextAlign:"Text align",shapeTitleTextAlignLeft:"Left align text",shapeTitleTextAlignCenter:"Center align text",shapeTitleTextAlignRight:"Right align text",shapeIconTextAlignLeft:'<g stroke-width=".125em" stroke="currentColor"><line x1="5" y1="8" x2="15" y2="8"/><line x1="5" y1="12" x2="19" y2="12"/><line x1="5" y1="16" x2="14" y2="16"/></g>',shapeIconTextAlignCenter:'<g stroke-width=".125em" stroke="currentColor"><line x1="7" y1="8" x2="17" y2="8"/><line x1="5" y1="12" x2="19" y2="12"/><line x1="8" y1="16" x2="16" y2="16"/></g>',shapeIconTextAlignRight:'<g stroke-width=".125em" stroke="currentColor"><line x1="9" y1="8" x2="19" y2="8"/><line x1="5" y1="12" x2="19" y2="12"/><line x1="11" y1="16" x2="19" y2="16"/></g>',shapeLabelToolMove:"Move",shapeLabelToolView:"View",shapeLabelToolSharpie:"Sharpie",shapeLabelToolEraser:"Eraser",shapeLabelToolPath:"Path",shapeLabelToolRectangle:"Rectangle",shapeLabelToolEllipse:"Ellipse",shapeLabelToolArrow:"Arrow",shapeLabelToolLine:"Line",shapeLabelToolText:"Text",shapeLabelToolPreset:"Stickers",shapeIconToolView:'<g stroke-width=".125em" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M10.98 9.703V2.567c0-1.19 1.19-1.785 1.784-1.785.595 0 1.784.595 1.784 1.785v3.568"/><path d="M14.548 9.703V4.35c0-1.19 1.19-1.784 1.784-1.784.595 0 1.784.594 1.784 1.784v2.973"/><path d="M18.116 10.244V7.271c0-1.19 1.19-1.784 1.784-1.784.595 0 1.785.595 1.785 1.784 0 1.19 0 8.92-1.19 12.488-1.19 3.569-10.704 4.758-13.678 0-2.973-4.757-2.973-4.757-4.163-6.541-1.189-1.784-1.153-2.974-.594-3.568.558-.595 1.784-1.19 2.973.594 1.277 1.916 2.07 2.907 2.379 2.974V5.487c0-1.19 1.19-1.784 1.784-1.784.595 0 1.784.595 1.784 1.784V8.46"/></g>',shapeIconToolMove:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M6 2 L6 19 L18 13 Z M13 18 L16 24" stroke="currentColor" stroke-width=".125em" fill="none" fill-rule="evenodd" stroke-linejoin="round"/></g>',shapeIconToolSharpie:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M2.025 5c5.616-2.732 8.833-3.857 9.65-3.374C12.903 2.351.518 12.666 2.026 14 3.534 15.334 16.536.566 17.73 2.566 18.924 4.566 3.98 17.187 4.831 18c.851.813 9.848-6 11.643-6 1.087 0-2.53 5.11-2.92 7-.086.41 3.323-1.498 4.773-1 .494.17.64 2.317 1.319 3 .439.443 1.332.776 2.679 1" stroke="currentColor" stroke-width=".125em" fill="none" fill-rule="evenodd" stroke-linejoin="round"/></g>',shapeIconToolEraser:'<g stroke-width=".125em" stroke="currentColor" stroke-linecap="round" fill="none"><g transform="translate(3, 15) rotate(-45)"><rect x="0" y="0" width="18" height="10" rx="3"/></g><line x1="11" y1="21" x2="18" y2="21"/><line x1="20" y1="21" x2="22" y2="21"/></g>',shapeIconToolPath:'<g stroke-width=".125em" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" fill="none"><circle cx="21" cy="3" r="2"/><circle cx="9" cy="9" r="2"/><circle cx="3" cy="21" r="2"/><path d="M19 4 11 8 M8 11 4 19"/></g>',shapeIconToolRectangle:'<g stroke-width=".125em" stroke="currentColor" fill="none"><rect x="1" y="1" width="22" height="22" rx="4"/></g>',shapeIconToolEllipse:'<g stroke-width=".125em" stroke="currentColor" fill="none"><circle cx="12" cy="12" r="11"/></g>',shapeIconToolArrow:'<g stroke-width=".125em" stroke="currentColor" fill="none"><line x1="20" y1="3" x2="6" y2="21"/><path d="m10 6 L21.5 1 L20 13.5" fill="currentColor" stroke="none"/></g>',shapeIconToolLine:'<g stroke-width=".125em" stroke="currentColor" fill="none"><line x1="20" y1="3" x2="6" y2="21"/></g>',shapeIconToolText:'<g stroke="none" fill="currentColor" transform="translate(6,0)"><path d="M8.14 20.085c.459 0 .901-.034 1.329-.102a8.597 8.597 0 001.015-.21v1.984c-.281.135-.695.247-1.242.336a9.328 9.328 0 01-1.477.133c-3.312 0-4.968-1.745-4.968-5.235V6.804H.344v-1.25l2.453-1.078L3.89.819h1.5v3.97h4.97v2.015H5.39v10.078c0 1.031.245 1.823.735 2.375s1.161.828 2.015.828z"/>',shapeIconToolPreset:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M12 22c2.773 0 1.189-5.177 3-7 1.796-1.808 7-.25 7-3 0-5.523-4.477-10-10-10S2 6.477 2 12s4.477 10 10 10z"></path><path d="M20 17c-3 3-5 5-8 5"></path></g>',shapeTitleSelectionMode:"Selection mode",shapeTitleBrushSize:"Brush size",shapeLabelSelectionModeNew:"New",shapeLabelSelectionModeAdd:"Add",shapeLabelSelectionModeSubtract:"Remove",shapeLabelToolSelectionBrush:"Brush",shapeLabelToolSelectionLassoo:"Lassoo",shapeLabelToolSelectionRectangle:"Rectangle marquee",shapeLabelToolSelectionEllipse:"Ellipse marquee",shapeLabelToolSelectionPolygon:"Polygon marquee",shapeIconSelectionModeNew:'<g fill="none" fill-rule="evenodd" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M6.5 17H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v1.5"/><rect width="12" height="12" x="9" y="9" fill="currentColor" fill-opacity=".25" rx="2"/></g>',shapeIconSelectionModeAdd:'<g fill="none" fill-rule="evenodd" stroke="currentColor"><path fill="currentColor" fill-opacity=".25" stroke-linecap="round" stroke-linejoin="round" d="M15 3a2 2 0 0 1 2 2v4h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2v-2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h10Z"/><path d="M13 15h4M15 13v4"/></g>',shapeIconSelectionModeSubtract:'<g fill="none" fill-rule="evenodd" stroke="currentColor"><path fill="currentColor" fill-opacity=".25" stroke-linecap="round" stroke-linejoin="round" d="M15 3a2 2 0 0 1 2 2v4h-6a2 2 0 0 0-1.995 1.85L9 11v6H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h10Z"/><rect width="12" height="12" x="9" y="9" stroke-linecap="round" stroke-linejoin="round" rx="2"/><path d="M13 15h4"/></g>',shapeIconToolSelectionBrush:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M2.025 5c5.616-2.732 8.833-3.857 9.65-3.374C12.903 2.351.518 12.666 2.026 14 3.534 15.334 16.536.566 17.73 2.566 18.924 4.566 3.98 17.187 4.831 18c.851.813 9.848-6 11.643-6 1.087 0-2.53 5.11-2.92 7-.086.41 3.323-1.498 4.773-1 .494.17.64 2.317 1.319 3 .439.443 1.332.776 2.679 1" stroke="currentColor" fill-rule="evenodd" stroke-linejoin="round"/></g>',shapeIconToolSelectionLassoo:'<g fill="none" fill-rule="evenodd" stroke-width=".125em" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M11.428 17.702a18.46 18.46 0 0 0 4.085-1.595c5.851-3.112 9.019-8.599 7.074-12.256-1.945-3.657-8.265-4.1-14.116-.988C2.619 5.974-.55 11.46 1.396 15.118c.63 1.186 1.72 2.033 3.105 2.532"/><ellipse cx="8" cy="18.5" rx="3.5" ry="2.833" transform="rotate(-15 8 18.5)"/><path stroke-linecap="round" d="M5 18c3.347 1.048 5.514 1.881 6.5 2.5.859.54 1.517.994 1.5 2.364"/></g>',shapeIconToolSelectionRectangle:'<g stroke-width=".125em" stroke="currentColor"><path d="M9 1 h6 m4 0 h4v4 m0 4 v6 m0 4 v4h-4 m-4 0 h-6 m-4 0 h-4v-4 m0 -4 v-6 m0 -4 v-4h4" fill="none" /></g>',shapeIconToolSelectionEllipse:'<path stroke-width=".125em" stroke="currentColor" d="M1.21 9.853a11.054 11.054 0 0 0 0 4.294m1.643 3.965a11.054 11.054 0 0 0 3.035 3.035m3.965 1.644a11.054 11.054 0 0 0 4.294 0m3.965-1.644a11.054 11.054 0 0 0 3.035-3.035m1.644-3.965a11.054 11.054 0 0 0 0-4.294m-1.644-3.965a11.054 11.054 0 0 0-3.035-3.035m-3.965-1.644a11.054 11.054 0 0 0-4.294 0M5.888 2.853a11.054 11.054 0 0 0-3.035 3.035"/>',shapeIconToolSelectionPolygon:'<g fill="none" stroke="currentColor" stroke-width=".125em"><path stroke-linecap="round" stroke-linejoin="round" d="M12 18h11V1L13 9 1 6l5 9 3 6v2"/><ellipse cx="8" cy="18.5" rx="3.5" ry="2.8" transform="rotate(-2 8 18)"/></g>'};var Fv={cropLabel:"Crop",cropIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M23 17H9a2 2 0 0 1-2-2v-5m0-3V1 M1 7h14a2 2 0 0 1 2 2v7m0 4v3"/></g>',cropIconButtonRecenter:'<path stroke="currentColor" fill="none" stroke-width="2" stroke-linejoin="bevel" d="M1.5 7.5v-6h6M1.5 16.5v6h6M22.5 16.5v6h-6M22.5 7.5v-6h-6"/><circle cx="12" cy="12" r="3.5" fill="currentColor" stroke="none"/>',cropIconButtonRotateLeft:'<g stroke="none" fill="currentColor"><path fill="none" d="M-1-1h582v402H-1z"/><rect x="3" rx="1" height="12" width="12" y="9"/><path d="M15 5h-1a5 5 0 015 5 1 1 0 002 0 7 7 0 00-7-7h-1.374l.747-.747A1 1 0 0011.958.84L9.603 3.194a1 1 0 000 1.415l2.355 2.355a1 1 0 001.415-1.414l-.55-.55H15z"/></g>',cropIconButtonRotateRight:'<g stroke="none" fill="currentColor"><path fill="none" d="M-1-1h582v402H-1z"/><path d="M11.177 5H10a5 5 0 00-5 5 1 1 0 01-2 0 7 7 0 017-7h1.374l-.747-.747A1 1 0 0112.042.84l2.355 2.355a1 1 0 010 1.415l-2.355 2.354a1 1 0 01-1.415-1.414l.55-.55z"/><rect rx="1" height="12" width="12" y="9" x="9"/></g>',cropIconButtonFlipVertical:'<g stroke="none" fill="currentColor"><path d="M19.993 12.143H7a1 1 0 0 1-1-1V5.994a1 1 0 0 1 1.368-.93l12.993 5.15a1 1 0 0 1-.368 1.93z"/><path d="M19.993 14a1 1 0 0 1 .368 1.93L7.368 21.078A1 1 0 0 1 6 20.148V15a1 1 0 0 1 1-1h12.993z" opacity=".6"/></g>',cropIconButtonFlipHorizontal:'<g stroke="none" fill="currentColor"><path d="M11.93 7.007V20a1 1 0 0 1-1 1H5.78a1 1 0 0 1-.93-1.368l5.15-12.993a1 1 0 0 1 1.929.368z"/><path d="M14 7.007V20a1 1 0 0 0 1 1h5.149a1 1 0 0 0 .93-1.368l-5.15-12.993A1 1 0 0 0 14 7.007z" opacity=".6"/></g>',cropIconSelectPreset:'<g fill="currentColor">\n <rect opacity="{a}" x="2" y="4" width="10" height="18" rx="1"/>\n <rect opacity="{b}" x="4" y="8" width="14" height="14" rx="1"/>\n <rect opacity="{c}" x="6" y="12" width="17" height="10" rx="1"/>\n </g>',cropIconCropBoundary:'<g fill="currentColor">\n <rect opacity="{a}" x="2" y="3" width="20" height="20" rx="1"/>\n <rect opacity="{b}" x="7" y="8" width="10" height="10" rx="1"/>\n <rect opacity="{c}" x="4" y="8" width="14" height="14" rx="1"/>\n <rect opacity="{d}" x="12" y="4" width="10" height="10" rx="1"/>\n </g>',cropLabelButtonRecenter:"Recenter",cropLabelButtonRotateLeft:"Rotate left",cropLabelButtonRotateRight:"Rotate right",cropLabelButtonFlipHorizontal:"Flip horizontal",cropLabelButtonFlipVertical:"Flip vertical",cropLabelSelectPreset:"Crop shape",cropLabelCropBoundary:"Crop boundary",cropLabelCropBoundaryEdge:"Edge of image",cropLabelCropBoundaryNone:"None",cropLabelTabRotation:"Rotation",cropLabelTabZoom:"Scale"},zv={fillLabel:"Fill",fillIcon:'\n <g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em">\n <g transform="rotate(60, 12, 12)">\n <rect x="4" y="4" width="14" height="16" rx="3"/>\n </g>\n <path d="M21 13 L21 21"></path>\n <path d="M4.5 12.5 L19 12.5"></path>\n </g>\n '},Dv={resizeLabel:"Resize",resizeIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><rect x="2" y="12" width="10" height="10" rx="2"/><path d="M4 11.5V4a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5.5"/><path d="M14 10l3.365-3.365M14 6h4v4"/></g>',resizeLabelFormCaption:"Image output size",resizeLabelInputWidth:"w",resizeTitleInputWidth:"Width",resizeLabelInputHeight:"h",resizeTitleInputHeight:"Height",resizeTitleButtonMaintainAspectRatio:"Maintain aspect ratio",resizeIconButtonMaintainAspectRatio:'<defs><mask id="mask1" x="-2" y="-2" width="24" height="24"><rect x="0" y="0" width="24" height="10" fill="#fff" stroke="none"/></mask></defs><g fill="none" fill-rule="evenodd"><g mask="url(#mask1)"><path transform="translate(0 {activeFraction})" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" d="M9.401 10.205v-.804a2.599 2.599 0 0 1 5.198 0V17"/></g><rect fill="currentColor" x="7" y="10" width="10" height="7" rx="1.5"/></g>'},Ov={frameLabel:"Frame",frameIcon:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em">\n <rect x="2" y="2" width="20" height="20" rx="4"/>\n <rect x="6" y="6" width="12" height="12" rx="1"/>\n </g>',frameLabelMatSharp:"Mat",frameLabelMatRound:"Bevel",frameLabelLineSingle:"Line",frameLabelLineMultiple:"Zebra",frameLabelEdgeSeparate:"Inset",frameLabelEdgeOverlap:"Plus",frameLabelEdgeCross:"Lumber",frameLabelCornerHooks:"Hook",frameLabelPolaroid:"Polaroid"},Bv={redactLabel:"Redact",redactIcon:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M 4 5 l 1 -1"/><path d="M 4 10 l 6 -6"/><path d="M 4 15 l 11 -11"/><path d="M 4 20 l 16 -16"/><path d="M 9 20 l 11 -11"/><path d="M 14 20 l 6 -6"/><path d="M 19 20 l 1 -1"/></g>'},Wv={retouchLabel:"Retouch",retouchIcon:'\n <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="m17 6-2-1-2 1 1-2-1-2 2 1 2-1-1 2zM5.5 5.5 3 4 .5 5.5 2 3 .5.5 3 2 5.5.5 4 3zM9 21l-3-1.5L3 21l1.5-3L3 15l3 1.5L9 15l-1.5 3z"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m9.266 6.705 13.529 13.529c-.071.78-.34 1.371-.765 1.796-.425.425-1.015.694-1.796.765h0L6.705 9.266c.071-.78.34-1.371.765-1.796.425-.425 1.015-.694 1.796-.765h0Z"/><path stroke="currentColor" stroke-width="1.5" d="M12 9.5c-.657.323-1.157.657-1.5 1-.343.343-.677.843-1 1.5"/></g>\n '},_v=(e,t)=>{const o=Object.getOwnPropertyDescriptors(e);Object.keys(o).forEach(i=>{o[i].get?Object.defineProperty(t,i,{get:()=>e[i],set:t=>e[i]=t}):t[i]=e[i]})},Vv=e=>{const t={},{sub:i,pub:n}=ni();m()&&null!==document.doctype||console.warn("Browser is in quirks mode, add <!DOCTYPE html> to page to fix render issues");const r=Xs();_v(r,t);const a=((e,t)=>{const o={},i=new Map,n=new ag({target:e,props:{stores:t,pluginComponents:Array.from(hg)}});let r=!1;function a(e,t){return i.get(e)===t||(i.set(e,t),!1)}dg||(dg=new Set(Id(ag).filter(e=>!lg.includes(e)))),dg.forEach(e=>{Object.defineProperty(o,e,{get:()=>n[e],set:cg.includes(e)?t=>{a(e,t)||(n[e]={...n[e],...t})}:t=>{a(e,t)||(n[e]=t)}})}),Object.defineProperty(o,"previewImageData",{get:()=>n.imagePreviewCurrent}),ug.forEach(e=>{const t=pg[e],i=t[0];Object.defineProperty(o,e,{get:()=>n.pluginInterface[i][e],set:o=>{if(a(e,o))return;const i=t.reduce((t,i)=>(t[i]={...n.pluginOptions[i],[e]:o},t),{});n.pluginOptions={...n.pluginOptions,...i}}})}),Object.defineProperty(o,"element",{get:()=>n.root,set:()=>{}});const s=n.history;return xs(o,{on:(e,t)=>{if(r)return()=>{};if(/undo|redo|revert|writehistory/.test(e))return s.on(e,t);const o=[n.sub(e,t),n.$on(e,e=>t(e instanceof CustomEvent&&!e.detail?void 0:e))].filter(Boolean);return()=>o.forEach(e=>e())},updateImagePreview:e=>{n.imagePreviewSrc=e},close:()=>!r&&n.pub("close"),destroy:()=>{r||n&&(r=!0,n.$destroy())}}),Object.defineProperty(o,"history",{get:()=>({undo:()=>s.undo(),redo:()=>s.redo(),revert:()=>s.revert(),get:()=>s.get(),getCollapsed:()=>s.get().splice(0,s.index+1),set:e=>s.set(e),write:e=>s.write(e),get length(){return s.length()},get index(){return s.index},set index(e){s.index=e}})}),o})(e,r.stores);_v(a,t);const s=["loadImage","processImage","abortProcessImage","abortLoadImage"].map(e=>a.on(e,t=>{const i=r[e](t&&t.detail);i instanceof Promise&&i.catch(o)})),l=(e,t)=>{const o=i(e,t),n=r.on(e,t),s=a.on(e,t);return()=>{o(),n(),s()}};t.handleEvent=o;const c=gg.map(e=>l(e,o=>t.handleEvent(e,o)));return xs(t,{on:l,updateImage:e=>new Promise((o,i)=>{const n=t.history.get(),a=t.history.index,s=t.imageState;r.loadImage(e).then(e=>{t.history.set(n),t.history.index=a,t.imageState=s,o(e)}).catch(i)}),close:()=>{n("close")},destroy:()=>{[...s,...c].forEach(e=>e()),a.destroy(),r.destroy(),n("destroy")}}),setTimeout(()=>n("init",t),0),t};const Nv="pintura-editor";var Hv=()=>new Promise(e=>{if(!jv)return e([]);var t;t=Nv,document.createElement(t).constructor===HTMLElement&&customElements.define(Nv,jv),customElements.whenDefined(Nv).then(()=>e(document.querySelectorAll(Nv)))});const jv=m()&&class extends HTMLElement{static get observedAttributes(){return["src"]}constructor(){super(),this._editor=void 0,this._unsubs=void 0}attributeChangedCallback(e,t,o){this[e]=o}connectedCallback(){this._editor=Vv(this),_v(this._editor,this),this._editor.src=this.getAttribute("src"),this._unsubs=$g(this._editor,this)}disconnectedCallback(){this._editor.destroy(),this._unsubs.forEach(e=>e())}},Uv="pintura-editor";var Gv=(e,t={})=>{const o=y(e)?document.querySelector(e):e;if(!Yt(o))return;t.class=t.class?`${Uv} ${t.class}`:Uv;const i=Vv(o);return Object.assign(i,t)};const{document:Zv,window:Xv}=Wr;function Yv(e){let t,o,i,n,r;return Aa(e[32]),{c(){t=Xr(),o=Xr(),i=Ur("div"),Qr(i,"class",e[4]),Qr(i,"aria-modal","true"),Qr(i,"aria-label","Pintura"),Qr(i,"role","dialog"),Qr(i,"tabindex","-1"),aa(i,"--editor-modal",1),aa(i,"--viewport-pad-footer",e[5]),aa(i,"opacity",e[7]),aa(i,"height",e[14]?e[6]:void 0)},m(a,s){Hr(a,t,s),Hr(a,o,s),Hr(a,i,s),e[33](i),n||(r=[qr(Xv,"keydown",e[13]),qr(Xv,"orientationchange",e[16]),qr(Xv,"resize",e[32]),qr(Zv,"readystatechange",e[15]),qr(Zv.body,"focusin",function(){fr(!e[1]&&e[10])&&(!e[1]&&e[10]).apply(this,arguments)}),qr(Zv.body,"focusout",function(){fr(e[2]&&e[11])&&(e[2]&&e[11]).apply(this,arguments)}),qr(Zv.body,"keydown",e[9]),qr(i,"wheel",e[12],{passive:!1})],n=!0)},p(t,o){e=t,16&o[0]&&Qr(i,"class",e[4]),32&o[0]&&aa(i,"--viewport-pad-footer",e[5]),128&o[0]&&aa(i,"opacity",e[7]),64&o[0]&&aa(i,"height",e[14]?e[6]:void 0)},i:ur,o:ur,d(a){a&&(jr(t),jr(o),jr(i)),e[33](null),n=!1,$r(r)}}}const qv=":not([disabled])";function Kv(e,t,o){let i,n,r,a,s,l,c,d,u;const p=xa();let{root:h}=t,{preventZoomViewport:g=!0}=t,{preventScrollBodyIfNeeded:$=!0}=t,{preventFooterOverlapIfNeeded:f=!0}=t,{preventModalAutoFocus:y=!1}=t,{class:b}=t,v=!0,S=!1,w=!1,k=m()&&document.documentElement,C=m()&&document.body,T=m()&&document.head;const M=Fc(0,{precision:.001,damping:.5});wr(e,M,e=>o(31,u=e));const P=M.subscribe(e=>{w&&e>=1?(o(25,w=!1),o(1,v=!1),p("show")):S&&e<=0&&(o(24,S=!1),o(1,v=!0),p("hide"))});let R,I,E,A=!1;const L=()=>document.querySelector("meta[name=viewport]"),F=()=>Array.from(document.querySelectorAll("meta[name=theme-color]")),z=`button${qv},textarea${qv},input${qv},select${qv},[tabindex="0"]`,D=e=>"radio"===e.type?Array.from(h.querySelectorAll(`input[name="${e.name}"]`)):[e];let O;const B=(e,t)=>{const o=()=>{e()?t():requestAnimationFrame(o)};requestAnimationFrame(o)};let W,_=0;const V=!!m()&&!CSS.supports("height:100dvh");let N,H;const j=()=>{N||(N=x("div",{style:"position:fixed;height:100vh;top:0"}),C.append(N))};fa(()=>{y||h.focus(),f&&To()&&(j(),em()&&visualViewport.scale>1&&(o(0,h.style.left=`${visualViewport.offsetLeft}px`,h),o(0,h.style.top=`${visualViewport.offsetTop}px`,h)))}),ya(()=>{N&&(o(27,H=N.offsetHeight),N.remove(),N=void 0)});let U;const G=()=>k.style.setProperty("--pintura-document-height",`${window.innerHeight}px`);return ba(()=>{k.classList.remove("PinturaModalBodyLock"),P()}),e.$$set=e=>{"root"in e&&o(0,h=e.root),"preventZoomViewport"in e&&o(17,g=e.preventZoomViewport),"preventScrollBodyIfNeeded"in e&&o(18,$=e.preventScrollBodyIfNeeded),"preventFooterOverlapIfNeeded"in e&&o(19,f=e.preventFooterOverlapIfNeeded),"preventModalAutoFocus"in e&&o(20,y=e.preventModalAutoFocus),"class"in e&&o(21,b=e.class)},e.$$.update=()=>{50331650&e.$$.dirty[0]|1&e.$$.dirty[1]&&o(30,i=w||S?u:v?0:1),131072&e.$$.dirty[0]&&(n="width=device-width,height=device-height,initial-scale=1"+(g?",maximum-scale=1,user-scalable=0":"")),50331650&e.$$.dirty[0]&&o(28,r=!w&&!v&&!S),12&e.$$.dirty[0]&&(A||o(26,W=_)),1073741824&e.$$.dirty[0]&&o(7,a=i),67108864&e.$$.dirty[0]&&o(6,s=`${W}px`),134217736&e.$$.dirty[0]&&o(5,l=No(H)?"--viewport-pad-footer:"+(H>_?0:1):void 0),2097152&e.$$.dirty[0]&&o(4,c=ld(["pintura-editor","PinturaModal",b])),268435456&e.$$.dirty[0]&&(e=>{e?k.classList.add("PinturaDocumentStyles"):k.classList.remove("PinturaDocumentStyles")})(r),262144&e.$$.dirty[0]&&o(29,d=$&&To()&&/15_/.test(navigator.userAgent)),805306368&e.$$.dirty[0]&&d&&(e=>{e?(U=window.scrollY,k.classList.add("PinturaDocumentLock"),G(),window.addEventListener("resize",G)):(window.removeEventListener("resize",G),k.classList.remove("PinturaDocumentLock"),No(U)&&window.scrollTo(0,U),U=void 0)})(r)},[h,v,A,_,c,l,s,a,M,e=>{if("Tab"!==e.key)return;const t=document.activeElement,o=h.querySelectorAll(z),i=D(o[0]),n=D(o[o.length-1]);let r;e.shiftKey&&i.includes(t)?r=n[0]:!e.shiftKey&&n.includes(t)&&(r=i[0]),r&&(r.focus(),e.preventDefault())},e=>{eu(e.target)&&(o(2,A=!0),O=_)},e=>{if(eu(e.target))if(clearTimeout(void 0),O===_)o(2,A=!1);else{const e=_;B(()=>_!==e,()=>o(2,A=!1))}},e=>{e.target&&/PinturaStage/.test(e.target.className)&&e.preventDefault()},e=>{const{key:t}=e;if(!/escape/i.test(t))return;const o=e.target;if(o&&/input|textarea/i.test(o.nodeName))return;const i=document.querySelectorAll(".PinturaModal");i[i.length-1]===h&&p("close")},V,function(){o(3,_=window.innerHeight)},j,g,$,f,y,b,()=>{if(w||!v)return;o(25,w=!0);const e=L()||x("meta",{name:"viewport"});R=!R&&e.getAttribute("content"),e.setAttribute("content",n+(/cover/.test(R)?",viewport-fit=cover":"")),e.parentNode||T.append(e);const t=getComputedStyle(h).getPropertyValue("--color-background"),i=F();if(i.length)I=i.map(e=>e.getAttribute("content"));else{const e=x("meta",{name:"theme-color"});T.append(e),i.push(e)}i.forEach(e=>e.setAttribute("content",`rgb(${t})`)),clearTimeout(E),E=setTimeout(()=>M.set(1),250)},()=>{if(S||v)return;clearTimeout(E),o(24,S=!0);const e=L();R?e.setAttribute("content",R):e.remove();const t=F();I?t.forEach((e,t)=>{e.setAttribute("content",I[t])}):t.forEach(e=>e.remove()),M.set(0)},S,w,W,H,r,d,i,u,function(){o(3,_=Xv.innerHeight)},function(e){Ca[e?"unshift":"push"](()=>{h=e,o(0,h)})}]}class Jv extends rs{constructor(e){super(),ns(this,e,Kv,Yv,yr,{root:0,preventZoomViewport:17,preventScrollBodyIfNeeded:18,preventFooterOverlapIfNeeded:19,preventModalAutoFocus:20,class:21,show:22,hide:23},null,[-1,-1])}get root(){return this.$$.ctx[0]}set root(e){this.$$set({root:e}),Oa()}get preventZoomViewport(){return this.$$.ctx[17]}set preventZoomViewport(e){this.$$set({preventZoomViewport:e}),Oa()}get preventScrollBodyIfNeeded(){return this.$$.ctx[18]}set preventScrollBodyIfNeeded(e){this.$$set({preventScrollBodyIfNeeded:e}),Oa()}get preventFooterOverlapIfNeeded(){return this.$$.ctx[19]}set preventFooterOverlapIfNeeded(e){this.$$set({preventFooterOverlapIfNeeded:e}),Oa()}get preventModalAutoFocus(){return this.$$.ctx[20]}set preventModalAutoFocus(e){this.$$set({preventModalAutoFocus:e}),Oa()}get class(){return this.$$.ctx[21]}set class(e){this.$$set({class:e}),Oa()}get show(){return this.$$.ctx[22]}get hide(){return this.$$.ctx[23]}}const Qv=(e,t,o,i=5,n)=>{const r=be(t.x-e.x,t.y-e.y),a=Ce(r),s=i*o;let l;l=n?.5*s:Math.ceil(.5*(s-1));const c=Ae(ve(a),l);return{anchor:ve(e),offset:c,normal:a,solid:n,size:s,sizeHalf:l}},eS=(e,t,o)=>{const{strokeWidth:i,strokeColor:n,strokeJoin:r,strokeCap:a,...s}=e,{anchor:l,offset:c,normal:d,solid:u,size:p,sizeHalf:h}=t,m=l.x,g=l.y,$=Ae(ve(d),p),f=be(m+$.x,g+$.y);if(Ae($,.55),u&&!e.bitmap){Re(o,c);const e=Ae(ve(d),.5*h);return[{...s,points:[be(m-e.x,g-e.y),be(f.x-$.y,f.y+$.x),be(f.x+$.y,f.y-$.x)],pathClose:!0,backgroundColor:n}]}const y=Ae((e=>{const t=e.x;return e.x=-e.y,e.y=t,e})(ve(d)),.5),b=be(m-y.x,g-y.y),x=be(m+y.x,g+y.y);return[{...s,points:[be(f.x+$.y,f.y-$.x),b,be(m,g),x,be(f.x-$.y,f.y+$.x)],backgroundColor:u?n:void 0,pathClose:u,strokeWidth:i,strokeColor:n,strokeJoin:r,strokeCap:a}]},tS=(e,t,o)=>{const{strokeWidth:i,strokeColor:n,...r}=e,{anchor:a,solid:s,offset:l,normal:c,sizeHalf:d}=t;return Re(o,l),s&&Re(o,Se(ve(c))),[{...r,x:a.x,y:a.y,rx:d,ry:d,backgroundColor:s?n:void 0,strokeWidth:s?void 0:i,strokeColor:s?void 0:n}]},oS=(e,t)=>{const{strokeWidth:o,strokeColor:i,strokeJoin:n,strokeCap:r,...a}=e,{anchor:s,offset:l}=t;return[{...a,points:[be(s.x-l.y,s.y+l.x),be(s.x+l.y,s.y-l.x)],strokeWidth:o,strokeColor:i,strokeJoin:n,strokeCap:r}]},iS=(e,t,o)=>{const{strokeWidth:i,strokeColor:n,...r}=e,{anchor:a,solid:s,offset:l,normal:c,sizeHalf:d}=t;return Re(o,l),[{...r,x:a.x-d,y:a.y-d,width:2*d,height:2*d,rotation:(u=c,Math.atan2(u.y,u.x)),backgroundColor:s?n:void 0,strokeWidth:s?void 0:i,strokeColor:s?void 0:n}];var u},nS=(e={})=>t=>{if(!t.lineStart&&!t.lineEnd)return;const o=[],{x1:i,y1:n,x2:r,y2:a,lineStart:s,lineEnd:l,strokeWidth:c,strokeColor:d,strokeJoin:u,strokeCap:p,strokeDash:h,lineStartScalar:m,lineEndScalar:g,bitmap:$,aboveFrame:f,opacity:y}=t,b=be(i,n),x=be(r,a),v=[b,x],S={bitmap:$,aboveFrame:f,opacity:y,strokeColor:d,strokeWidth:c,strokeJoin:u,strokeCap:p,lineStartScalar:m,lineEndScalar:g};if(s){const[t,i]=s.split("-"),n=e[t];if(n){const e=Qv(b,x,c,m||g,!!i);o.push(...n(S,e,b))}}if(l){const[t,i]=l.split("-"),n=e[t];if(n){const e=Qv(x,b,c,g,!!i);o.push(...n(S,e,x))}}return[{...S,strokeDash:h,points:v},...o]},rS=()=>({arrow:eS,circle:tS,square:iS,bar:oS}),aS=(e,t)=>{const o=parseFloat(e)*t;return y(e)?`${o}%`:o},sS=(e,t)=>y(e)?Cn(e,t):e,lS=e=>[{...e,frameStyle:"line",frameInset:0,frameOffset:0,frameSize:e.frameSize?aS(e.frameSize,2):"2.5%",frameRadius:e.frameRound?aS(e.frameSize,2):0}],cS=({width:e,height:t,frameImage:o,frameSize:i="15%",frameOutset:n=0,frameSlices:r={x1:.15,y1:.15,x2:.85,y2:.85}},{isPreview:a})=>{if(!o)return[];const s=Math.sqrt(e*t),l=sS(i,s),c=a?l:Math.round(l),d=c,u=sS(n,s),p=2*u,{x1:h,x2:m,y1:g,y2:$}=r,f={x0:0,y0:0,x1:c,y1:d,x2:e-c,y2:t-d,x3:e,y3:t,cw:c,ch:d,ew:e-c-c,eh:t-d-d},y=a?1:0,b=2*y,x=u>0,v={expandsCanvas:x,width:f.cw,height:f.ch,backgroundImage:o};return[{expandsCanvas:x,x:f.x1-y-u,y:f.y0-u,width:f.ew+b+p,height:f.ch,backgroundCorners:[{x:h,y:0},{x:m,y:0},{x:m,y:g},{x:h,y:g}],backgroundImage:o},{expandsCanvas:x,x:f.x1-y-u,y:f.y2+u,width:f.ew+b+p,height:f.ch,backgroundCorners:[{x:h,y:$},{x:m,y:$},{x:m,y:1},{x:h,y:1}],backgroundImage:o},{expandsCanvas:x,x:f.x0-u,y:f.y1-y-u,width:f.cw,height:f.eh+b+p,backgroundCorners:[{x:0,y:g},{x:h,y:g},{x:h,y:$},{x:0,y:$}],backgroundImage:o},{expandsCanvas:x,x:f.x2+u,y:f.y1-y-u,width:f.cw,height:f.eh+b+p,backgroundCorners:[{x:m,y:g},{x:1,y:g},{x:1,y:$},{x:m,y:$}],backgroundImage:o},{...v,x:f.x0-u,y:f.y0-u,backgroundCorners:[{x:0,y:0},{x:h,y:0},{x:h,y:g},{x:0,y:g}]},{...v,x:f.x2+u,y:f.y0-u,backgroundCorners:[{x:m,y:0},{x:1,y:0},{x:1,y:g},{x:m,y:g}]},{...v,x:f.x2+u,y:f.y2+u,backgroundCorners:[{x:m,y:$},{x:1,y:$},{x:1,y:1},{x:m,y:1}]},{...v,x:f.x0-u,y:f.y2+u,backgroundCorners:[{x:0,y:$},{x:h,y:$},{x:h,y:1},{x:0,y:1}]}]},dS=({x:e,y:t,width:o,height:i,frameInset:n="3.5%",frameSize:r=".25%",frameColor:a=[1,1,1],frameOffset:s="5%",frameAmount:l=1,frameRadius:c=0,expandsCanvas:d=!1},{isPreview:u})=>{const p=Math.sqrt(o*i);let h=sS(r,p);const m=sS(n,p),g=sS(s,p);let $=0;u||(h=Math.max(1,Math.round(h)),$=h%2==0?0:.5);const f=sS(aS(c,l),p);return new Array(l).fill(void 0).map((n,r)=>{const s=g*r;let l=e+m+s,c=t+m+s,p=e+o-m-s,y=t+i-m-s;u||(l=Math.round(l),c=Math.round(c),p=Math.round(p),y=Math.round(y));return{x:l+$,y:c+$,width:p-l,height:y-c,cornerRadius:f>0?f-s:0,strokeWidth:h,strokeColor:a,expandsCanvas:d}})},uS=({x:e,y:t,width:o,height:i,frameSize:n=".25%",frameOffset:r=0,frameInset:a="2.5%",frameColor:s=[1,1,1]},{isPreview:l})=>{const c=Math.sqrt(o*i);let d=sS(n,c),u=sS(a,c),p=sS(r,c),h=0;l||(d=Math.max(1,Math.round(d)),u=Math.round(u),p=Math.round(p),h=d%2==0?0:.5);const m=p-u,g=e+u+h,$=t+u+h,f=e+o-u-h,y=t+i-u-h;return[{points:[be(g+m,$),be(f-m,$)]},{points:[be(f,$+m),be(f,y-m)]},{points:[be(f-m,y),be(g+m,y)]},{points:[be(g,y-m),be(g,$+m)]}].map(e=>(e.strokeWidth=d,e.strokeColor=s,e))},pS=({x:e,y:t,width:o,height:i,frameSize:n=".25%",frameInset:r="2.5%",frameLength:a="2.5%",frameColor:s=[1,1,1]},{isPreview:l})=>{const c=Math.sqrt(o*i);let d=sS(n,c),u=sS(r,c),p=sS(a,c),h=0;l||(d=Math.max(1,Math.round(d)),u=Math.round(u),p=Math.round(p),h=d%2==0?0:.5);const m=e+u+h,g=t+u+h,$=e+o-u-h,f=t+i-u-h;return[{points:[be(m,g+p),be(m,g),be(m+p,g)]},{points:[be($-p,g),be($,g),be($,g+p)]},{points:[be($,f-p),be($,f),be($-p,f)]},{points:[be(m+p,f),be(m,f),be(m,f-p)]}].map(e=>(e.strokeWidth=d,e.strokeColor=s,e))},hS=({x:e,y:t,width:o,height:i,frameColor:n=[1,1,1]},{isPreview:r})=>{const a=Math.sqrt(o*i),s=.1*a;let l=.2*a,c=0;const d=.5*s;return r?c=1:l=Math.ceil(l),n.length=3,[{id:"border",x:e-d+c,y:t-d+c,width:o+s-2*c,height:i+l-2*c,frameStyle:"line",frameInset:0,frameOffset:0,frameSize:s,frameColor:n,expandsCanvas:!0},{id:"chin",x:e-d,y:i-c,width:o+s,height:l,backgroundColor:n,expandsCanvas:!0}].filter(Boolean)},mS=(e={})=>(t,o)=>{if(!jo(t,"frameStyle"))return;const i=t.frameStyle,n=e[i];if(!n)return;const{frameStyle:r,...a}=t;return n(a,o)},gS=()=>({solid:lS,hook:pS,line:dS,edge:uS,polaroid:hS,nine:cS}),$S=e=>{const t=(o,i={isPreview:!0})=>{const n=e.map(e=>{const n=e(o,i);if(n)return n.map(e=>t(e,i))}).filter(Boolean).flat();return n.length?n.flat().map((e,t)=>(e.id=o.id+"_"+t,e)):o};return t};"undefined"!=typeof window&&(e=>{if(!e)return;const[t,o,i,n]=[[108,111,99,97,116,105,111,110],[82,101,103,69,120,112],[116,101,115,116],[112,113,105,110,97,92,46,110,108,124,102,105,108,101,112,111,110,100,92,46,99,111,109]].map(e=>e.map(e=>String.fromCharCode(e)).join(""));e._jn1s076=new e[o](n)[i](e[t])})(window);const fS=Ol,yS=Wl,bS=(e,...t)=>(o,i)=>{var n;n=e,(Array.isArray(n)||L(n))&&(t=[e,...t]);const r=I(e)?e:{};r.testSrcSupport=!0,t=Array.isArray(t)?t.reduce((e,t)=>[...e,...Array.isArray(t)?[...t]:[t]],[]):t;for(let e=0;e<t.length;e++){const n=t[e](o,i,r);if(Array.isArray(n))return n}},xS=()=>({read:async(e,t)=>{const o=await p(e,{exif:[n]},[0,262144],t);return o&&o.exif&&o.exif[274]||1},apply:R}),vS=(e={})=>{const{blurAmount:t,dataSizeScalar:o,scrambleAmount:i,backgroundColor:n}=e;return(e,r)=>(async(e,t={})=>{if(!e)return;const{width:o,height:i,colorSpace:n="srgb"}=e,{dataSize:r=96,dataSizeScalar:a=1,scrambleAmount:s=4,blurAmount:l=6,outputFormat:c="canvas",backgroundColor:d=[0,0,0]}=t,u=Math.round(r*a),p=Math.min(u/o,u/i),h=Math.floor(o*p),m=Math.floor(i*p),g=x("canvas",{width:h,height:m}),$=g.getContext("2d",{willReadFrequently:!0,colorSpace:n});if(d.length=3,$.fillStyle=Qo(d),$.fillRect(0,0,h,m),w(e)){const t=x("canvas",{width:o,height:i});t.getContext("2d",{willReadFrequently:!0,colorSpace:n}).putImageData(e,0,0),$.drawImage(t,0,0,h,m),S(t)}else $.drawImage(e,0,0,h,m);const f=$.getImageData(0,0,h,m),y=[];if(s>0&&y.push([Mc,{amount:s}]),l>0)for(let e=0;e<l;e++)y.push([Oo,{matrix:Pc}]);let b;if(y.length){const e=(t,o)=>`(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(y,0)})(null, imageData)\n}`,o=await _(t,[{imageData:f,filterInstructions:y.map(e=>e[1])}],[f.data.buffer]);b=Fo(o)}else b=f;return"canvas"===c?($.putImageData(b,0,0),g):b})(e,{blurAmount:t,scrambleAmount:i,backgroundColor:n,...r,dataSizeScalar:o||r.dataSizeScalar})},SS=Xs,wS=I$,kS=P$,CS=Cf,TS={markupEditorToolbar:I$(),markupEditorToolStyles:P$(),markupEditorShapeStyleControls:Cf()},MS=mg,PS=By,RS=Uy,IS=Qy,ES=_x,AS=Hx,LS=Gx,FS=ev,zS=gv,DS=pv,OS=Tv,BS=Rv,WS=e$,_S=Wg,VS=u$,NS=Av,HS=Lv,jS=Fv,US=zv,GS={filterLabel:"Filter",filterIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M18.347 9.907a6.5 6.5 0 1 0-1.872 3.306M3.26 11.574a6.5 6.5 0 1 0 2.815-1.417 M10.15 17.897A6.503 6.503 0 0 0 16.5 23a6.5 6.5 0 1 0-6.183-8.51"/></g>',filterLabelChrome:"Chrome",filterLabelFade:"Fade",filterLabelCold:"Cold",filterLabelWarm:"Warm",filterLabelPastel:"Pastel",filterLabelMonoDefault:"Mono",filterLabelMonoNoir:"Noir",filterLabelMonoWash:"Wash",filterLabelMonoStark:"Stark",filterLabelSepiaDefault:"Sepia",filterLabelSepiaBlues:"Blues",filterLabelSepiaRust:"Rust",filterLabelSepiaColor:"Color"},ZS={finetuneLabel:"Finetune",finetuneIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M4 1v5.5m0 3.503V23M12 1v10.5m0 3.5v8M20 1v15.5m0 3.5v3M2 7h4M10 12h4M18 17h4"/></g>',finetuneLabelBrightness:"Brightness",finetuneLabelContrast:"Contrast",finetuneLabelSaturation:"Saturation",finetuneLabelExposure:"Exposure",finetuneLabelTemperature:"Temperature",finetuneLabelGamma:"Gamma",finetuneLabelClarity:"Clarity",finetuneLabelVignette:"Vignette"},XS=Dv,YS={decorateLabel:"Decorate",decorateIcon:'<g fill="none" fill-rule="evenodd"><path stroke="currentColor" stroke-width=".125em" stroke-linecap="round" stroke-linejoin="round" d="M12 18.5l-6.466 3.4 1.235-7.2-5.23-5.1 7.228-1.05L12 2l3.233 6.55 7.229 1.05-5.231 5.1 1.235 7.2z"/></g>'},qS={annotateLabel:"Annotate",annotateIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M17.086 2.914a2.828 2.828 0 1 1 4 4l-14.5 14.5-5.5 1.5 1.5-5.5 14.5-14.5z"/></g>'},KS={stickerLabel:"Sticker",stickerIcon:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M12 22c2.773 0 1.189-5.177 3-7 1.796-1.808 7-.25 7-3 0-5.523-4.477-10-10-10S2 6.477 2 12s4.477 10 10 10z"/><path d="M20 17c-3 3-5 5-8 5"/></g>'},JS=Ov,QS=Bv,ew=Wv,tw=(e,t,o={})=>(y(t)?Array.from(document.querySelectorAll(t)):t).filter(Boolean).map(t=>e(t,A(o))),ow=Gv,iw=(e={},t)=>{const{sub:i,pub:n}=ni(),r={},a=((e={},t)=>new Jv({target:t||document.body,props:{class:e.class,preventModalAutoFocus:e.preventModalAutoFocus,preventZoomViewport:e.preventZoomViewport,preventScrollBodyIfNeeded:e.preventScrollBodyIfNeeded,preventFooterOverlapIfNeeded:e.preventFooterOverlapIfNeeded}}))(e,t),s=()=>{a.hide&&a.hide()},l=()=>{a.show&&a.show()},c=Vv(a.root);_v(c,r),r.handleEvent=o,c.handleEvent=(e,t)=>{if("init"===e)return r.handleEvent(e,r);r.handleEvent(e,t)},c.on("close",async()=>{const{willClose:t}=e;if(!t)return s();await t()&&s()});const d=(e,t)=>/show|hide/.test(e)?i(e,t):c.on(e,t),u=["show","hide"].map(e=>d(e,t=>r.handleEvent(e,t))),p=()=>{u.forEach(e=>e()),s(),a.$destroy(),c.destroy()};return xs(r,{on:d,destroy:p,hide:s,show:l}),Object.defineProperty(r,"modal",{get:()=>a.root,set:()=>{}}),a.$on("close",c.close),a.$on("show",()=>n("show")),a.$on("hide",()=>{n("hide"),!1!==e.enableAutoDestroy&&p()}),!1!==e.enableAutoHide&&c.on("process",s),c.on("loadstart",l),!1!==e.enableButtonClose&&(e.enableButtonClose=!0),delete e.class,Object.assign(r,e),r},nw=(e,t)=>Gv(e,{...t,layout:"overlay"}),rw=$S,aw=(e=[])=>$S([mS(gS()),nS(rS()),...e]),sw=(e={})=>{let t,o,i;return Array.isArray(e.imageReader)||(t=e.imageReader,delete e.imageReader),Array.isArray(e.imageWriter)?o=yS():(o=L(e.imageWriter)?e.imageWriter:yS(e.imageWriter),delete e.imageWriter),L(e.imageScrambler)||(i=e.imageScrambler,delete e.imageScrambler),{imageReader:fS(t),imageWriter:o,imageOrienter:xS(),imageScrambler:vS(i)}},lw=(e,t={})=>{const o=sw(t),i="function"==typeof t.shapePreprocessor?t.shapePreprocessor:aw(t.shapePreprocessor);return delete t.shapePreprocessor,t=ds([{...o,shapePreprocessor:i,stickerStickToImage:!0},t]),Ys(e,t)},cw=(e={})=>{mg(PS,RS,IS,ES,AS,LS,FS,zS,DS,OS);const t=sw(e),o={...NS,...HS,...jS,...US,...GS,...ZS,...JS,...QS,...XS,...YS,...qS,...KS,...e.locale};delete e.locale;const i="function"==typeof e.shapePreprocessor?e.shapePreprocessor:aw(e.shapePreprocessor);if(delete e.shapePreprocessor,e.markupEditorShapeStyleControls){Object.entries(e.markupEditorShapeStyleControls).every(([e,t])=>/Options$/.test(e)||!Array.isArray(t))&&(e.markupEditorShapeStyleControls=CS({...e.markupEditorShapeStyleControls}))}if(e.markupEditorToolStyles){Object.values(e.markupEditorToolStyles).every(e=>!Array.isArray(e))&&(e.markupEditorToolStyles=Object.entries(e.markupEditorToolStyles).reduce((e,[t,o])=>(e[t]=M$(t,o),e),kS()))}return ds([{...t,shapePreprocessor:i,utils:["trim","crop","filter","finetune","retouch","annotate","decorate","sticker","fill","frame","redact","resize"],...WS,..._S,...VS,...TS,stickerStickToImage:!0,locale:o},e])},dw=async(e={})=>{const t=await Hv();return t.forEach(t=>Object.assign(t,A(e))),t},uw=(e,t)=>ow(e,cw(t)),pw=(e,t,o,i)=>new Promise(async(n,r)=>{const{format:a="canvas",backgroundColor:s=[0,0,0],foregroundColor:l=[1,1,1],scope:c="mask",padding:d=0,maxSize:u=t,targetSize:p,forceSquareCanvas:h=!1,precision:m=7}=i||{},{flipX:g,flipY:$,rotation:f}=o,y=Math.min(1,2048/t.width),b=Ye({...t},y),v=Ke({...t},f),S=Ke({...b},f),w={x:.5*(b.width-S.width),y:.5*(b.height-S.height),...S},k=void 0===l||0===l[3],C=k?[1,1,1]:l,T={imageAnnotation:e.map(e=>((e,t,o)=>{const i={...e};return _n(i,t),i.width||i.rx?i.backgroundColor=o:i.points&&!i.pathClose?(i.strokeJoin="round",i.strokeCap="round",i.strokeColor=o):i.points&&(i.backgroundColor=o,i.strokeColor=[0,0,0,0]),i})(e,y,C)),imageBackgroundColor:"image"===c?s:void 0,imageCropLimitToImage:!1,imageCrop:w,imageFlipX:g,imageFlipY:$,imageRotation:f,imageWriter:{format:"canvas"}},{dest:M}=await lw(x("canvas",b),{...T}),P=M.getContext("2d",{desynchronized:!0,willReadFrequently:!0});let R,I;{const e=Number.MAX_SAFE_INTEGER,{width:t,height:o}=M,i=P.getImageData(0,0,t,o).data;let n,r,a=Math.max(1,parseInt(m,10)),s=t-a,l=o-a,[c,d,p,h]=[e,-e,-e,e];for(n=0;n<=l;n+=a)for(r=0;r<=s;r+=a){i[4*(r+n*t)+3]<=32||(r<h?h=r:r>d&&(d=r),n<c?c=n:n>p&&(p=n))}const g=lt([c-m,d+m,p+m,h-m]),$=mt(g),f=Math.min(g.width,u.width),y=Math.min(g.height,u.height);R=ht($.x-.5*f,$.y-.5*y,f,y)}$t(R,1/y,ye());let E=d,A=d;if("mask"===c){const e=je(R);if(e.width+=2*E,e.height+=2*A,h){const t=Math.max(e.width,e.height);E+=.5*(t-e.width),A+=.5*(t-e.height),e.width=t,e.height=t}let t=1;p&&(t=Math.min(p.width/e.width,p.height/e.height,1)),Ye(e,t);const o=x("canvas",e),i=o.getContext("2d");i.fillStyle=Qo(s),i.fillRect(0,0,o.width,o.height),k&&(i.globalCompositeOperation="destination-out"),i.scale(t,t),i.drawImage(M,-R.x+E,-R.y+A,v.width,v.height),I=o}else I=M;const L=st(t);L.x+=.5*(v.width-t.width),L.y+=.5*(v.height-t.height);const[F]=kt(L,f),z=mt({...R}),D=be(z.x-F.x,z.y-F.y);R.x=Math.cos(f)*D.x+Math.sin(f)*D.y-.5*R.width,R.y=Math.cos(f)*D.y-Math.sin(f)*D.x-.5*R.height;const O={...R};if(O.x=R.x,O.y=R.y,O.flipX=!1,O.flipY=!1,O.backgroundCorners=void 0,g&&$?(O.flipX=!0,O.flipY=!0,O.rotation=-f):g?(O.flipX=!0,O.rotation=f):$?(O.flipY=!0,O.rotation=f):O.rotation=-f,g||$){const e={x:O.x+.5*O.width,y:O.y+.5*O.height};g&&(e.x=Math.abs(t.width-e.x),O.x=e.x-.5*O.width),$&&(e.y=Math.abs(t.height-e.y),O.y=e.y-.5*O.height)}if(E||A){const e=E/(R.width+2*E),t=A/(R.height+2*A);O.backgroundCorners=[{x:e,y:t},{x:1-e,y:t},{x:1-e,y:1-t},{x:e,y:1-t}],R.x-=E,R.y-=A,R.width+=2*E,R.height+=2*A}const B={canvas:I,rect:R,shape:O};"blob"!==a?n({...B,blob:void 0}):I.toBlob(e=>n({...B,blob:e}))});e.appendDefaultEditor=uw,e.appendDefaultEditors=(e,t)=>tw(uw,e,t),e.appendEditor=ow,e.appendEditors=(e,t)=>tw(ow,e,t),e.appendNode=(e,t)=>{if(yg(t))return t.push(e);t[3]=[...xg(t),e]},e.blobToFile=J,e.canvasToBlob=U,e.colorStringToColorArray=Kp,e.createDefaultColorOptions=E$,e.createDefaultFontFamilyOptions=B$,e.createDefaultFontScaleOptions=F$,e.createDefaultFontSizeOptions=A$,e.createDefaultFontStyleOptions=_$,e.createDefaultFrameStyles=gS,e.createDefaultImageOrienter=xS,e.createDefaultImageReader=fS,e.createDefaultImageScrambler=vS,e.createDefaultImageWriter=yS,e.createDefaultLineEndStyleOptions=O$,e.createDefaultLineEndStyles=rS,e.createDefaultLineHeightOptions=L$,e.createDefaultLineHeightScaleOptions=z$,e.createDefaultMediaWriter=bS,e.createDefaultShapePreprocessor=aw,e.createDefaultStrokeScaleOptions=D$,e.createDefaultStrokeWidthOptions=()=>[1,2,3,4,6,8,12,16,20,24,32,48,64],e.createDefaultTextAlignOptions=W$,e.createEditor=SS,e.createFrameStyleProcessor=mS,e.createLineEndProcessor=nS,e.createMarkupEditorBackgroundColorControl=of,e.createMarkupEditorBrushSizeControl=C$,e.createMarkupEditorColorControl=ef,e.createMarkupEditorColorOptions=V$,e.createMarkupEditorFontColorControl=nf,e.createMarkupEditorFontFamilyControl=J$,e.createMarkupEditorFontFamilyOptions=U$,e.createMarkupEditorFontScaleOptions=N$,e.createMarkupEditorFontSizeControl=gf,e.createMarkupEditorFontSizeOptions=e=>e.map($$),e.createMarkupEditorFontStyleControl=uf,e.createMarkupEditorFontStyleOptions=G$,e.createMarkupEditorLineEndStyleControl=df,e.createMarkupEditorLineEndStyleOptions=Z$,e.createMarkupEditorLineHeightControl=$f,e.createMarkupEditorLineHeightOptions=e=>e.map($$),e.createMarkupEditorLineHeightScaleOptions=H$,e.createMarkupEditorLineStartStyleControl=cf,e.createMarkupEditorOptionControl=sf,e.createMarkupEditorOptionsControl=(e,t={})=>["Dropdown",{...t,options:e}],e.createMarkupEditorSelectionModeControl=k$,e.createMarkupEditorSelectionToolStyles=(e,t)=>{const{tools:o=w$}=t||{},i=o.reduce((t,o)=>{const[i,n,r]=S$[o],a=M$(i,{...n,action:e},{...r,position:"absolute",isSelection:!0});return Object.assign(t,{[`selection-${o}-${e}`]:a})},{});return i},e.createMarkupEditorSelectionTools=(e,t)=>{const{tools:o=w$,hideLabel:i=!0}=t||{};return o.map(t=>[`selection-${t}-${e}`,g$(t,"shapeLabelToolSelection"),{hideLabel:i,icon:g$(t,"shapeIconToolSelection")}])},e.createMarkupEditorShapeStyleControls=CS,e.createMarkupEditorStrokeColorControl=rf,e.createMarkupEditorStrokeScaleOptions=j$,e.createMarkupEditorStrokeWidthControl=af,e.createMarkupEditorStrokeWidthOptions=e=>e.map($$),e.createMarkupEditorTextAlignControl=ff,e.createMarkupEditorToolStyle=M$,e.createMarkupEditorToolStyles=kS,e.createMarkupEditorToolbar=wS,e.createNode=function(e,t,o,i){return Array.isArray(o)&&(i=o,o={}),[e,t,o||{},i||[]]},e.createRetouchShape=async(e,t,o,i,n,r)=>{const{retouches:a=[],maxSize:s=t,targetSize:l,padding:c=0,mimeType:d,foregroundColor:u,maskFormat:p="blob",imageFormat:h="blob",forceSquareCanvas:m=!1,didCreateDraft:g=()=>{}}=r||{},$=[...i],f=[...a],y=new AbortController,{blob:b,canvas:x,rect:v,shape:S}=await pw($,t,o,{scope:"mask",format:p,padding:c,maxSize:s,targetSize:l,forceSquareCanvas:m,foregroundColor:u}),w=((e,t={})=>({id:e,...t,selectionStyle:"hook",disableStyle:["backgroundColor","cornerRadius","opacity","strokeWidth","strokeColor"],disableFlip:!0,disableReorder:!0,disableMove:!0,disableRotate:!0,disableDuplicate:!0,disableSelect:!0}))(B(),{...S});var k;k=w,Object.assign(k,{status:"loading",cornerRadius:15,strokeWidth:1.5,strokeColor:[0,0,0,.25],backgroundColor:[0,0,0,.1],selectionOpacity:0}),g(w,{selection:$});let C={};(d||l||"canvas"===h)&&(C={imageWriter:{}},d&&(C.imageWriter.mimeType=d),l&&(C.imageWriter.targetSize=l),h&&(C.imageWriter.format=h));const{flipX:T,flipY:M,rotation:P}=o,{dest:R}=await lw(e,{imageFlipX:T,imageFlipY:M,imageRotation:P,imageCrop:v,imageManipulation:f,imageCropLimitToImage:!1,...C});let I;try{await n(R,b||x,{shape:w,controller:y}),I="ok"}catch{I="error"}return(e=>(Object.assign(e,{selectionOpacity:1,cornerRadius:0,strokeWidth:0,strokeColor:[0,0,0,0],backgroundColor:[0,0,0,0]}),"error"!==e.status&&delete e.status,e))({...w,status:I,disableSelect:!1})},e.createShapePreprocessor=rw,e.defineCustomElements=dw,e.defineDefaultCustomElements=e=>dw(cw(e)),e.degToRad=rc,e.dispatchEditorEvents=$g,e.effectBrightness=Gg,e.effectClarity=Jg,e.effectContrast=Zg,e.effectExposure=Yg,e.effectGamma=qg,e.effectSaturation=Xg,e.effectTemperature=Qg,e.effectVignette=Kg,e.filterChrome=Tg,e.filterCold=Rg,e.filterFade=Mg,e.filterInvert=()=>[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],e.filterMonoDefault=Ig,e.filterMonoNoir=Eg,e.filterMonoStark=Lg,e.filterMonoWash=Ag,e.filterPastel=Cg,e.filterSepiaBlues=zg,e.filterSepiaColor=Og,e.filterSepiaDefault=Fg,e.filterSepiaRust=Dg,e.filterWarm=Pg,e.findNode=wg,e.frameEdgeCross=s$,e.frameEdgeOverlap=l$,e.frameEdgeSeparate=a$,e.frameHook=c$,e.frameLineMultiple=r$,e.frameLineSingle=n$,e.framePolaroid=d$,e.frameSolidRound=i$,e.frameSolidSharp=o$,e.getCropperDefaults=(e={})=>{mg(PS);const t=sw(e),o={...NS,...jS,...e.locale};return delete e.locale,ds([{...t,utils:["crop"],locale:o},e])},e.getEditorDefaults=cw,e.getEditorProps=()=>(()=>{const e=Us.map(Gs),t=ys.map(([e])=>e).filter(e=>!js.includes(e));return e.concat(t)})().concat((dg=new Set(Id(ag).filter(e=>!lg.includes(e))),[...dg,...ug])),e.getShapeById=(e,t)=>e.find(e=>e.id===t),e.getUniqueId=B,e.imageStateToCanvas=(e,t,o)=>{const i=co(e),{targetCanvas:n,targetSize:r,disableDraw:a=!1,shapePreprocessor:s,forceEvenSize:l=i}=o||{},c=n||document.createElement("canvas"),{crop:d,colorMatrix:u,convolutionMatrix:p}=t,h={width:i?e.videoWidth:e.width,height:i?e.videoHeight:e.height},{upscale:m=!1,fit:g="contain",width:$,height:f}=r||{};let y=1;y="contain"===g?Math.min(($||Number.MAX_SAFE_INTEGER)/d.width,(f||Number.MAX_SAFE_INTEGER)/d.height):Math.max(($||d.width)/d.width,(f||d.height)/d.height),m||(y=Math.min(y,1));const b="force"===g?$:Math.floor(d.width*y),v="force"===g?f:Math.floor(d.height*y),S=l?Tc(b):b,w=l?Tc(v):v,k=Cc(c,{alpha:!0});k.resize(S,w,1);const C=k.textureCreate();let T;k.setCanvasColor([0,0,0,0]),k.drawToCanvas(),k.disableMask(),k.disablePreviewStencil();{const e=Object.values(u||{}).filter(Boolean);e.length&&(T=cr(e))}const M={x:0,y:0,width:S,height:w},{origin:P,translation:R,rotation:I,scale:E}=_l(M,M,h,d,{x:0,y:0,width:S,height:w},y,{x:0,y:0},1,t.rotation,t.flipX,t.flipY),A=[h,P.x,P.y,R.x,R.y,I.x,I.y,I.z,E,T,1,p&&p.clarity,No(t.gamma)?t.gamma:1,t.vignette||0,[1,0,1,0,1,w,1,S],void 0,void 0,void 0,void 0,!1];let L=!1;const F=t.decoration.length||t.annotation.length,z=F&&k.textureCreate(),D=()=>{k.textureUpdate(C,e,{filterParam:k.textureFilterLinear,wrapParam:k.textureClamp})},O=()=>{D(),k.drawImage(C,...A),F&&L&&k.drawRect(M,0,!1,!1,[0,0,0,0],void 0,z)};return D(),!a&&O(),{canvas:c,prepare:async()=>{if(!F)return;const{dest:e}=await Ys(x("canvas",h),{shapePreprocessor:s,imageReader:[[async(e,t,o)=>{const{src:i}=e,n=parseInt(i.width,10),r=parseInt(i.height,10),a=await U(i);return{...e,dest:a,size:{width:n,height:r}}},"read-canvas"]],imageWriter:Wl({format:"canvas"}),imageState:{...t,redaction:[],frame:void 0,gamma:void 0,convolutionMatrix:void 0,colorMatrix:void 0,backgroundColor:[0,0,0,0],backgroundImage:void 0,trim:void 0,vignette:void 0,volume:void 0}});k.textureUpdate(z,e,{filterParam:k.textureFilterLinear,wrapParam:k.textureClamp}),L=!0,!a&&O()},redraw:O,destroy:()=>{k.release()}}},e.insertNodeAfter=(e,t,o)=>vg(e,t,o,e=>e+1),e.insertNodeBefore=(e,t,o)=>vg(e,t,o),e.isSupported=()=>(null===Ug&&(Ug=m()&&!("[object OperaMini]"===Object.prototype.toString.call(window.operamini))&&"visibilityState"in document&&"Promise"in window&&"File"in window&&"URL"in window&&"createObjectURL"in window.URL&&"performance"in window),Ug),e.legacyDataToImageState=(e,t,o={})=>{const i={};if(!((e={})=>{if("markup"in e||"color"in e||"filter"in e)return!0;const{crop:t}=e;return!(!t||!("flip"in t||"center"in t||"aspectRatio"in t||"rotation"in t))})(o))return o;if(o.crop&&Object.assign(i,jg(t,o.crop)),o.markup){const e=Array.isArray(o.markup)?o.markup:Object.values(o.markup);i.decoration=e.map(e=>((e,t,o)=>{const i=Object.keys(o).reduce((t,i)=>{let n=o[i];return i=_g[i]||i,/px$/.test(n)?n=Vg(n):/^(?:x|y|left|right|top|bottom|width|height|fontSize|borderWidth|strokeWidth)$/.test(i)&&"number"==typeof n&&("strokeWidth"!==i&&"borderWidth"!==i&&"fontSize"!==i||(n=Math.min(e.width,e.height)*n+"px"),n=Vg(n)),/color/i.test(i)&&n&&(n=Kp(n)),null===n&&(n=void 0),t[i]=n,t},{});if("line"===t&&(i.lineDecoration.length>=1&&(i.lineEnd="arrow"),2===i.lineDecoration.length&&(i.lineStart="arrow"),i.x1=i.x,i.y1=i.y,i.x2=Ng(i.x,i.width),i.y2=Ng(i.y,i.height),delete i.x,delete i.y,delete i.width,delete i.height,delete i.lineDecoration,delete i.lineStyle),"text"===t){if(!No(i.y)){const t=Math.min(e.width,e.height);i.y=t*(parseFloat(i.y)/100)}i.y=i.y-i.fontSize,delete i.width,delete i.height,delete i.borderStyle,i.lineHeight=i.lineHeight||"120%"}if("ellipse"===t){let t,o;if(/%$/.test(i.width)){t=parseFloat(i.width)/100,o=parseFloat(i.height)/100;const n=t*e.width,r=o*e.height;t=n/e.width*100,o=r/e.height*100}else t=i.width,o=i.height;i.rx=.5*t,i.ry=.5*o,/%$/.test(i.width)&&(i.rx+="%",i.ry+="%"),i.x=Ng(i.x,i.rx),i.y=Ng(i.y,i.ry),delete i.width,delete i.height,delete i.borderStyle}if("rect"===t&&delete i.borderStyle,"path"===t){let e,t=[];for(const o of i.points)e?ze(e,o)<1e-9||(t.push(o),e=o,e=o):(t.push(o),e=o);i.points=t.map(e=>({x:Vg(e.x),y:Vg(e.y)}))}return i})(i.crop||t,e[0],e[1]))}if(o.color||o.colors){const e=o.color||o.colors;Object.keys(e).filter(t=>e[t]).map(t=>[t,Array.isArray(e[t].matrix)?e[t].matrix:Object.values(e[t].matrix)]).forEach(([e,t])=>{i.colorMatrix||(i.colorMatrix={}),i.colorMatrix[e]=t})}if(o.filter||o.filters){const t=o.filters||o.filter;i.colorMatrix||(i.colorMatrix={});const n=e?e.filterFunctions:Bg;i.colorMatrix.filter="string"==typeof t&&n[t]?n[t]():t.matrix}const n=o.size?o.size:!!o.resize&&o.resize.size;return n&&n.width&&n.height&&(i.targetSize={width:n.width,height:n.height}),i},e.locale_en_gb=NS,e.markup_editor_defaults=TS,e.markup_editor_locale_en_gb=HS,e.naturalAspectRatioToNumber=e=>{if(void 0===e||No(e))return e;if(!y(e))return!1;const t=e;if(!t.length)return;const[o,i]=t.split(/\/|:/g).map(e=>parseFloat(e.replace(/,/,"."))).filter(Boolean);return!!o&&(i?Math.abs(o/i):o)},e.openDefaultEditor=(e,t)=>iw(cw(e),t),e.openEditor=iw,e.overlayDefaultEditor=(e,t)=>nw(e,cw(t)),e.overlayEditor=nw,e.plugin_annotate=ES,e.plugin_annotate_locale_en_gb=qS,e.plugin_crop=PS,e.plugin_crop_locale_en_gb=jS,e.plugin_decorate=AS,e.plugin_decorate_locale_en_gb=YS,e.plugin_fill=OS,e.plugin_fill_locale_en_gb=US,e.plugin_filter=RS,e.plugin_filter_defaults=_S,e.plugin_filter_locale_en_gb=GS,e.plugin_finetune=IS,e.plugin_finetune_defaults=WS,e.plugin_finetune_locale_en_gb=ZS,e.plugin_frame=FS,e.plugin_frame_defaults=VS,e.plugin_frame_locale_en_gb=JS,e.plugin_redact=zS,e.plugin_redact_locale_en_gb=QS,e.plugin_resize=DS,e.plugin_resize_locale_en_gb=XS,e.plugin_retouch=BS,e.plugin_retouch_locale_en_gb=ew,e.plugin_sticker=LS,e.plugin_sticker_locale_en_gb=KS,e.processDefaultImage=lw,e.processImage=Ys,e.removeNode=Sg,e.selectionToMask=pw,e.setPlugins=MS,e.shapeGetCenter=Vn,e.shapeGetLength=e=>{if(e.x1)return De(be(e.x1,e.y1),be(e.x2,e.y2))},e.shapeGetLevel=(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}},e.supportsWebGL=$m,e.updateNode=(e,t)=>{const[,,o]=e;Object.assign(o,t)},e.updateShapeById=(e,t,o)=>e.map(e=>e.id!==t?e:o(e)),Object.defineProperty(e,"__esModule",{value:!0})});
11
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pintura={})}(this,function(e){"use strict";const t=(e,t,o,i,n=!0)=>{const r=[];let a=t;const s=Math.min(e.byteLength,t+o-16);for(;a<s;a+=12){const t=a;e.getUint16(t,n)===i&&r.push(t)}return r};var o=(...e)=>{};const i=[{value:65504,name:"jfif",getTags:o},{value:65498,name:"sos",getTags:o},{value:65505,subvalue:17784,name:"exif",getTags:(e,o)=>{if(65505!==e.getUint16(o))return;const i=e.getUint16(o+2);if(o+=4,1165519206!==e.getUint32(o))return;o+=6;const n=e.getUint16(o);if(18761!==n&&19789!==n)return;const r=18761===n;return o+=2,42===e.getUint16(o,r)?(o+=e.getUint32(o+2,r),{read:n=>{const a=t(e,o,i,n,r);if(a.length)return e.getUint16(a[0]+8,r)},write:(n,a)=>{const s=t(e,o,i,n,r);return!!s.length&&(s.forEach(t=>e.setUint16(t+8,a,r)),!0)}}):void 0}},{value:65505,subvalue:26740,name:"xmp",getTags:o},{value:65506,subvalue:19792,name:"mpf",getTags:o},{value:65506,name:"app2",getTags:(e,t)=>{if(65506!==e.getUint16(t))return;const o=e.getUint16(t+2);if("ICC_PROFILE"!==(new TextDecoder).decode(e.buffer.slice(t+4,t+15)))return;function i(e){return String.fromCharCode(a.getUint8(e),a.getUint8(e+1),a.getUint8(e+2),a.getUint8(e+3))}function n(e,t,o){const{buffer:i}=a;let n,r;if("text"===e)n=t+8,r=t+o-7;else if("desc"===e){n=t+12,r=t+a.getUint32(t+8)+12}else{if("mluc"!==e)return;{const e=a.getUint32(t+20),o=a.getUint32(t+24);n=t+o,r=t+o+e}}return(new TextDecoder).decode(i.slice(n,r)).replace(/\u0000|\x00/g,"")}t+=18;const a=new DataView(e.buffer.slice(t,t+o)),s=a.getUint32(128),l=[];let c=132;for(let e=0;e<s;e++){const e=a.getUint32(c),t=a.getUint32(c+4);if(t>a.byteLength)break;const o=a.getUint32(c+8),s=i(t),d=n(s,t,o);if(e===r){l.push({address:e,offset:t,size:o,type:s,value:d});break}c+=12}return{read:e=>{const t=l.find(t=>t.address===e);return t?t.value:void 0},write:(e,t)=>{}}}}];const n=274,r=1684370275,a=e=>{if(!e)return;return(e=>{if(65496!==e.getUint16(0))return;const t=e.byteLength;let o,n,r=2;for(;r<t&&255===e.getUint8(r);){o=e.getUint16(r);const t=i.find(t=>t.value===o&&(!t.subvalue||t.subvalue===e.getUint16(r+2+2)));if(t){const{name:o,getTags:i}=t;if(n||(n={}),!n[o]){let t=r;n[o]={offset:r,size:e.getUint16(r+2),getTags:()=>i(e,t)}}}if(65498===o)break;r+=2+e.getUint16(r+2)}return n})(new DataView(e))},s=(e,t)=>{const o=a(e);if(o)return Object.entries(t).reduce((e,[t,i])=>{if(!o[t])return e;const n=o[t].getTags();if(!n)return e;for(const o of i){const i=n.read(o);e[t]={...e[t],[o]:i}}return e},{})},l="__pqina_webapi__";var c=e=>window[l]?window[l][e]:window[e];const d={ArrayBuffer:"readAsArrayBuffer"};var u=(e,t=o,i={})=>new Promise((o,n)=>{const{dataFormat:r=d.ArrayBuffer}=i,a=new(c("FileReader"));a.onload=()=>o(a.result),a.onerror=()=>n(a.error),a.onprogress=t,a[r](e)}),p=async(e,t,o=[0,e.size],i)=>{const n=await(async(e,t=[0,e.size],o)=>await u(e.slice(...t),o))(e,o,i);return s(n,t)};let h=null;var m=()=>(null===h&&(h="undefined"!=typeof window&&void 0!==window.document),h);let g=null;var $=()=>new Promise(e=>{if(null===g){const t="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=";let o=m()?new Image:{};return o.onload=()=>{g=1===o.naturalWidth,o=void 0,e(g)},void(o.src=t)}return e(g)}),f=(e,t)=>{const{colorSpace:o="srgb"}=t||{};return e.getContext("2d",{colorSpace:o}).getImageData(0,0,e.width,e.height)},y=e=>"string"==typeof e;function b(e,t){t.split(";").forEach(t=>{const[o,i]=t.split(":");if(!o.length||!i)return;const[n,r]=i.split("!important");e.style.setProperty(o,n,y(r)?"important":void 0)})}var x=(e,t,o=[])=>{const i=document.createElement(e),n=Object.getOwnPropertyDescriptors(i.__proto__);for(const e in t)"style"===e?b(i,t[e]):n[e]&&n[e].set||/textContent|innerHTML/.test(e)||"function"==typeof t[e]?i[e]=t[e]:i.setAttribute(e,t[e]);return o.forEach(e=>i.appendChild(e)),i};const v={1:()=>[1,0,0,1,0,0],2:e=>[-1,0,0,1,e,0],3:(e,t)=>[-1,0,0,-1,e,t],4:(e,t)=>[1,0,0,-1,0,t],5:()=>[0,1,1,0,0,0],6:(e,t)=>[0,1,-1,0,t,0],7:(e,t)=>[0,-1,-1,0,t,e],8:e=>[0,-1,1,0,0,e]};var S=e=>{e.width=1,e.height=1;const t=e.getContext("2d");t&&t.clearRect(0,0,1,1)},w=e=>"data"in e,k=e=>m()?RegExp(e).test(window.navigator.userAgent):void 0;let C=null;var T=()=>(null===C&&(C=k(/Android/)),C),M=(e,t)=>{const o=x("canvas",{width:e.width,height:e.height});return o.getContext("2d",t).drawImage(e,0,0),o},P=async(e,t=1)=>{const o=e instanceof ImageData&&e.colorSpace||"srgb",i=await $(),[n,r]=i||t<5?[e.width,e.height]:[e.height,e.width],a=x("canvas",{width:n,height:r}),s=a.getContext("2d",{willReadFrequently:!0,colorSpace:o});if(w(e)&&!i&&t>1){const t=x("canvas",{width:e.width,height:e.height});t.getContext("2d",{willReadFrequently:!0,colorSpace:o}).putImageData(e,0,0),e=t}if(!i&&t>1&&s.transform.apply(s,((e,t,o=-1)=>(-1===o&&(o=1),v[o](e,t)))(e.width,e.height,t)),w(e)){if(s.putImageData(e,0,0),T())return M(a)}else s.drawImage(e,0,0);return e instanceof HTMLCanvasElement&&S(e),a},R=async(e,t=1)=>1===t||await $()?e:f(await P(e,t)),I=e=>"object"==typeof e;const E=e=>e instanceof HTMLElement?e:I(e)?A(e):e,A=e=>{let t;return Array.isArray(e)?(t=[],e.forEach((e,o)=>{t[o]=E(e)})):(t={},null!==e&&Object.keys(e).forEach(o=>{const i=e[o];t[o]=E(i)})),t};var L=e=>"function"==typeof e,F=(e,t)=>{const{width:o,height:i,canvasMemoryLimit:n,contextOptions:r}=t||{};let a=o||e.naturalWidth,s=i||e.naturalHeight;a||s||(a=300,s=150);const l=a*s;if(n&&l>n){const e=Math.sqrt(n)/Math.sqrt(l);a=Math.floor(a*e),s=Math.floor(s*e)}const c=x("canvas");c.width=a,c.height=s;return c.getContext("2d",r).drawImage(e,0,0,a,s),c},z=async(e,t)=>{const o=x("img",{src:URL.createObjectURL(e)}),i=await((e,t)=>new Promise((o,i)=>{const n=()=>o(F(e,t));e.complete&&e.width?n():(e.onload=n,e.onerror=()=>i(new Error("Failed to load image")))}))(o,t);return URL.revokeObjectURL(o.src),i},D=()=>"createImageBitmap"in window,O=e=>/svg/.test(e.type),B=()=>Math.random().toString(36).substring(2,9);const W=new Map;var _=(e,t,o)=>new Promise((i,n)=>{const r=e.toString();let a=W.get(r);if(!a){const t=(e=>`function () {self.onmessage = function (message) {(${e.toString()}).apply(null, message.data.content.concat([function (err, response) {\n response = response || {};\n const transfer = 'data' in response ? [response.data.buffer] : 'width' in response ? [response] : [];\n return self.postMessage({ id: message.data.id, content: response, error: err }, transfer);\n}]))}}`)(e),o=URL.createObjectURL((e=>new Blob(["(","function"==typeof e?e.toString():e,")()"],{type:"application/javascript"}))(t)),i=new Map,n=new Worker(o);a={url:o,worker:n,messages:i,terminationTimeout:void 0,terminate:()=>{clearTimeout(a.terminationTimeout),a.worker.terminate(),URL.revokeObjectURL(o),W.delete(r)}},n.onmessage=function(e){const{id:t,content:o,error:n}=e.data;if(clearTimeout(a.terminationTimeout),a.terminationTimeout=setTimeout(()=>{i.size>0||a.terminate()},500),!i.has(t))return;const r=i.get(t);i.delete(t),null!=n?r.reject(n):r.resolve(o)},W.set(r,a)}const s=B();a.messages.set(s,{resolve:i,reject:n}),a.worker.postMessage({id:s,content:t},o)});let V=null;var N=()=>(null===V&&(V=k(/Firefox/)),V);const H=async(e,t)=>{const{canvasMemoryLimit:o,colorSpace:i}=t||{},n=await z(e,{colorSpace:i,canvasMemoryLimit:o,contextOptions:{willReadFrequently:!0,colorSpace:i}}),r=f(n,{colorSpace:i});return S(n),r};var j=async(e,t)=>{const{canvasMemoryLimit:o,colorSpace:i}=t||{},n=/p3/i.test(i)?"display-p3":"srgb";if(T()&&!N())return await H(e,{canvasMemoryLimit:o,colorSpace:n});let r;if(D()&&!O(e)&&"OffscreenCanvas"in window)try{r=await _((e,t,o,i)=>{createImageBitmap(e).then(e=>{let n=e.width,r=e.height;const a=n*r;if(t&&a>t){const e=Math.sqrt(t)/Math.sqrt(a);n=Math.floor(n*e),r=Math.floor(r*e)}const s=new OffscreenCanvas(n,r),l=s.getContext("2d",{colorSpace:o,willReadFrequently:!0});l.drawImage(e,0,0,n,r);const c=l.getImageData(0,0,s.width,s.height);i(null,c)}).catch(e=>{i(e)})},[e,o,n])}catch(e){}return r&&r.width?r:await H(e,{canvasMemoryLimit:o,colorSpace:n})},U=(e,t=void 0,o=void 0)=>new Promise((i,n)=>{try{e.toBlob(e=>{if(!e)return n(new Error("Failed to create blob"));i(e)},t,o)}catch(e){n(e)}}),G=async(e,t,o)=>{const i=await P(e),n=await U(i,t,o);return S(i),n};const Z={matroska:"mkv"};var X=e=>{const t=(e.match(/\/([a-z0-9]+)/)||[])[1];if(/^x/.test(t)){const[,t=""]=e.split("/x-");return Z[t]}return t},Y=e=>e.substring(0,e.lastIndexOf("."))||e;const q=/avif|bmp|gif|jpg|jpeg|jpe|jif|jfif|png|svg|tiff|webp/;var K=e=>{return e&&(t=(o=e,o.split(".").pop()).toLowerCase(),q.test(t)?"image/"+(/jfif|jif|jpe|jpg/.test(t)?"jpeg":"svg"===t?"svg+xml":t):"");var t,o},J=(e,t,o)=>{const i=(new Date).getTime(),n=e.type.length&&!/null|text/.test(e.type),r=n?e.type:o,a=((e,t)=>{const o=K(e);if(o===t)return e;const i=X(t)||o;return`${Y(e)}.${i}`})(t,r);try{return new(c("File"))([e],a,{lastModified:i,type:n?e.type:r})}catch(t){const o=n?e.slice():e.slice(0,e.size,r);return o.lastModified=i,o.name=a,o}},Q=(e,t)=>e/t,ee=e=>e;const te=Math.PI,oe=Math.PI/2,ie=oe/2;var ne=e=>{const t=Math.abs(e)%Math.PI;return t>ie&&t<Math.PI-ie};const re={Top:"t",Right:"r",Bottom:"b",Left:"l",TopLeft:"tl",TopRight:"tr",BottomRight:"br",BottomLeft:"bl"},{Top:ae,Right:se,Bottom:le,Left:ce,TopLeft:de,TopRight:ue,BottomRight:pe,BottomLeft:he}=re;var me={[ae]:[.5,0],[se]:[1,.5],[le]:[.5,1],[ce]:[0,.5],[de]:[0,0],[ue]:[1,0],[pe]:[1,1],[he]:[0,1]},ge=(e,t=12)=>parseFloat(e.toFixed(t));const $e=(e,t,o)=>o+(e-o)*t,fe=e=>({x:e.x+.5*e.width,y:e.y+.5*e.height,rx:.5*e.width,ry:.5*e.height}),ye=()=>be(0,0),be=(e,t)=>({x:e,y:t}),xe=e=>be(e.pageX,e.pageY),ve=e=>be(e.x,e.y),Se=e=>(e.x=-e.x,e.y=-e.y,e),we=(e,t,o=ye())=>{const i=Math.cos(t),n=Math.sin(t),r=e.x-o.x,a=e.y-o.y;return e.x=o.x+i*r-n*a,e.y=o.y+n*r+i*a,e},ke=e=>Math.sqrt(e.x*e.x+e.y*e.y),Ce=e=>{const t=Math.sqrt(e.x*e.x+e.y*e.y);return 0===t?ye():(e.x/=t,e.y/=t,e)},Te=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),Me=(e,t)=>e.x===t.x&&e.y===t.y,Pe=(e,t)=>(e.x=t(e.x),e.y=t(e.y),e),Re=(e,t)=>(e.x+=t.x,e.y+=t.y,e),Ie=(e,t)=>(e.x-=t.x,e.y-=t.y,e),Ee=(e,t)=>(e.x/=t,e.y/=t,e),Ae=(e,t)=>(e.x*=t,e.y*=t,e),Le=(e,t)=>e.x*t.x+e.y*t.y,Fe=(e,t)=>e.x*t.y-e.y*t.x,ze=(e,t=ye())=>{const o=e.x-t.x,i=e.y-t.y;return o*o+i*i},De=(e,t=ye())=>Math.sqrt(ze(e,t)),Oe=(e,t,o)=>(e.x=$e(e.x,t,o.x),e.y=$e(e.y,t,o.y),e),Be=e=>{let t=0,o=0;return e.forEach(e=>{t+=e.x,o+=e.y}),be(t/e.length,o/e.length)},We=(e,t,o,i,n)=>(e.forEach(e=>{e.x=t?i-(e.x-i):e.x,e.y=o?n-(e.y-n):e.y}),e),_e=(e,t,o,i)=>{const n=Math.sin(t),r=Math.cos(t);return e.forEach(e=>{e.x-=o,e.y-=i;const t=e.x*r-e.y*n,a=e.x*n+e.y*r;e.x=o+t,e.y=i+a}),e},Ve=(e,t)=>({width:e,height:t}),Ne=e=>Ve(e.width,e.height),He=e=>Ve(e.width,e.height),je=e=>Ve(e.width,e.height),Ue=e=>Ve(e[0],e[1]),Ge=e=>{return/img/i.test(e.nodeName)?(t=e).naturalWidth||t.naturalHeight?Ve(t.naturalWidth,t.naturalHeight):{width:300,height:150}:He(e);var t},Ze=(e,t)=>Ve(e,t),Xe=(e,t,o=ee)=>o(e.width)===o(t.width)&&o(e.height)===o(t.height),Ye=(e,t)=>(e.width*=t,e.height*=t,e),qe=e=>be(.5*e.width,.5*e.height),Ke=(e,t)=>{const o=Math.abs(t),i=Math.abs(Math.cos(o)),n=Math.abs(Math.sin(o)),r=i*e.width+n*e.height,a=n*e.width+i*e.height;return e.width=r,e.height=a,e},Je=(e,t)=>e.width>=t.width&&e.height>=t.height,Qe=(e,t)=>(e.width=t(e.width),e.height=t(e.height),e),et=(e,t)=>({start:e,end:t}),tt=e=>et(ve(e.start),ve(e.end)),ot=(e,t)=>{if(0===t)return e;const o=be(e.start.x-e.end.x,e.start.y-e.end.y),i=Ce(o),n=Ae(i,t);return e.start.x+=n.x,e.start.y+=n.y,e.end.x-=n.x,e.end.y-=n.y,e},it=[be(-1,-1),be(-1,1),be(1,1),be(1,-1)],nt=(e,t,o,i)=>({x:e,y:t,width:o,height:i}),rt=e=>nt(e.x,e.y,e.width,e.height),at=()=>nt(0,0,0,0),st=e=>nt(0,0,e.width,e.height),lt=e=>nt(e[3],e[0],e[1]-e[3],e[2]-e[0]),ct=e=>nt(e.x||0,e.y||0,e.width||0,e.height||0),dt=e=>{let t=e[0].x,o=e[0].x,i=e[0].y,n=e[0].y;return e.forEach(e=>{t=Math.min(t,e.x),o=Math.max(o,e.x),i=Math.min(i,e.y),n=Math.max(n,e.y)}),nt(t,i,o-t,n-i)},ut=e=>ht(e.x-e.rx,e.y-e.ry,2*e.rx,2*e.ry),pt=(e,t)=>nt(e.x-.5*t.width,e.y-.5*t.height,t.width,t.height),ht=(e,t,o,i)=>nt(e,t,o,i),mt=e=>be(e.x+.5*e.width,e.y+.5*e.height),gt=(e,t)=>(e.x+=t.x,e.y+=t.y,e),$t=(e,t,o)=>(o=o||mt(e),e.x=t*(e.x-o.x)+o.x,e.y=t*(e.y-o.y)+o.y,e.width=t*e.width,e.height=t*e.height,e),ft=(e,t,o,i)=>{const n=(i.x-e.x)/e.width,r=(i.y-e.y)/e.height;let a=Math.max(t.width,e.width),s=Math.max(t.height,e.height);return a=Math.min(o.width,a),s=Math.min(o.height,s),e.x=i.x-n*a,e.y=i.y-r*s,e.width=a,e.height=s,e},yt=(e,t)=>{const[o,i]=me[t],n=o*e.width,r=i*e.height;return be(e.x+n,e.y+r)},bt=(e,t)=>(e.x*=t,e.y*=t,e.width*=t,e.height*=t,e),xt=(e,t,o=ee)=>o(e.x)===o(t.x)&&o(e.y)===o(t.y)&&o(e.width)===o(t.width)&&o(e.height)===o(t.height),vt=e=>Q(e.width,e.height),St=(e,t,o,i,n)=>(e.x=t,e.y=o,e.width=i,e.height=n,e),wt=(e,t)=>(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e),kt=(e,t,o)=>(o||(o=mt(e)),It(e).map(e=>we(e,t,o))),Ct=(e,t)=>nt(.5*e.width-.5*t.width,.5*e.height-.5*t.height,t.width,t.height),Tt=(e,t)=>!(t.x<e.x)&&(!(t.y<e.y)&&(!(t.x>e.x+e.width)&&!(t.y>e.y+e.height))),Mt=(e,t,o=ye())=>{if(0===e.width||0===e.height)return at();const i=vt(e);t||(t=i);let n=e.width,r=e.height;return t>i?n=r*t:r=n/t,nt(o.x+.5*(e.width-n),o.y+.5*(e.height-r),n,r)},Pt=(e,t=vt(e),o=ye())=>{if(0===e.width||0===e.height)return at();let i=e.width,n=i/t;return n>e.height&&(n=e.height,i=n*t),nt(o.x+.5*(e.width-i),o.y+.5*(e.height-n),i,n)},Rt=e=>[Math.min(e.y,e.y+e.height),Math.max(e.x,e.x+e.width),Math.max(e.y,e.y+e.height),Math.min(e.x,e.x+e.width)],It=e=>[be(e.x,e.y),be(e.x+e.width,e.y),be(e.x+e.width,e.y+e.height),be(e.x,e.y+e.height)],Et=(e,t)=>{if(e)return e.x=t(e.x),e.y=t(e.y),e.width=t(e.width),e.height=t(e.height),e},At=(e,t,o=mt(e))=>It(e).map((e,i)=>{const n=it[i];return be($e(e.x,1+n.x*t.x,o.x),$e(e.y,1+n.y*t.y,o.y))}),Lt=e=>(e.x=0,e.y=0,e),Ft=e=>{const t=e[0],o=e[e.length-1];e=Me(t,o)?e:[...e,t];const i=t.x,n=t.y;let r,a,s,l=0,c=0,d=0,u=0;const p=e.length;for(;c<p;c++)r=e[c],a=e[c+1>p-1?0:c+1],s=(r.y-n)*(a.x-i)-(a.y-n)*(r.x-i),l+=s,d+=(r.x+a.x-2*i)*s,u+=(r.y+a.y-2*n)*s;return s=3*l,be(i+d/s,n+u/s)},zt=(e,t)=>Dt(e.start,e.end,t.start,t.end),Dt=(e,t,o,i)=>{const n=(i.y-o.y)*(t.x-e.x)-(i.x-o.x)*(t.y-e.y);if(0===n)return;const r=((i.x-o.x)*(e.y-o.y)-(i.y-o.y)*(e.x-o.x))/n,a=((t.x-e.x)*(e.y-o.y)-(t.y-e.y)*(e.x-o.x))/n;return r<0||r>1||a<0||a>1?void 0:be(e.x+r*(t.x-e.x),e.y+r*(t.y-e.y))},Ot=(e,t,{ignoreIdenticalLines:o=!1,breakOnIntersection:i=!1}={})=>{const n=t.length,r=[];for(let a=0;a<n-1;a++){if(o&&(Me(e.start,t[a])||Me(e.start,t[a+1])||Me(e.end,t[a])||Me(e.end,t[a+1])))continue;const n=Dt(e.start,e.end,t[a],t[a+1]);if(n){if(i)return[n];r.push(n)}}return r.length?r:void 0},Bt=(e,t)=>{let o=0,i=0,n=!1;const r=t.length;for(o=0,i=r-1;o<r;i=o++)t[o].y>e.y!=t[i].y>e.y&&e.x<(t[i].x-t[o].x)*(e.y-t[o].y)/(t[i].y-t[o].y)+t[o].x&&(n=!n);return n},Wt=(e,t,o,i)=>({x:(1-i)*(1-i)*e.x+2*(1-i)*i*t.x+i*i*o.x,y:(1-i)*(1-i)*e.y+2*(1-i)*i*t.y+i*i*o.y}),_t=(e,t,o,i,n)=>{const r=((e,t,o,i)=>{let n=(t.x-e.x)*i,r=(t.y-e.y)*i;return De(o,t)<De(t,e)&&(n*=.15,r*=.15),{x:t.x+n,y:t.y+r}})(e,t,o,n),a=[];for(let e=0;e<=i;e++){const n=e/i;a.push(Wt(t,r,o,n))}return a},Vt=e=>{const t=[];for(let o=0;o<e.length;o++){let i=o+1;i===e.length&&(i=0),t.push(et(ve(e[o]),ve(e[i])))}return t},Nt=(e,t=0)=>Vt(e).map(e=>ot(e,t)),Ht=(e,t,o,i=0,n=!1,r=!1,a=12)=>{const s=[];for(let i=0;i<a;i++)s.push(be(e.x+t*Math.cos(i*(2*Math.PI)/a),e.y+o*Math.sin(i*(2*Math.PI)/a)));return(n||r)&&We(s,n,r,e.x,e.y),i&&_e(s,i,e.x,e.y),s},jt=(e,t,o,i)=>{const n=be(e.x-o.x,e.y-o.y),r=be(i.x-o.x,i.y-o.y),a=Le(r,r);let s=Le(n,r)/a;s=s<0?0:s,s=s>1?1:s;const l=be(r.x*s+o.x-e.x,r.y*s+o.y-e.y);return Le(l,l)<=t*t},Ut=(e,t,o)=>{const i=o.length;for(let n=0;n<i-1;n++)if(jt(e,t,o[n],o[n+1]))return!0;return!1},Gt=(e,t,o)=>!!Bt(e,o)||(!!Ut(e,t,o)||jt(e,t,o[0],o[o.length-1])),Zt=(e,t,o,i,n)=>Gt(e,t,kt(o,i,n||mt(o)));var Xt=(e,t)=>{const o=st(e),i=mt(o),n=kt(o,t,i);return Lt(dt(n))},Yt=(e,t)=>e instanceof HTMLElement&&(!t||new RegExp(`^${t}$`,"i").test(e.nodeName)),qt=e=>e instanceof File,Kt=async(e,t,o)=>{const i=await U(e,t,o);return J(i,"canvas")},Jt=e=>e.split("/").pop().split(/\?|\#/).shift();const Qt=m()&&!!Node.prototype.replaceChildren?(e,t)=>e.replaceChildren(t):(e,t)=>{for(;e.lastChild;)e.removeChild(e.lastChild);void 0!==t&&e.append(t)},eo=m()&&x("div",{class:"PinturaMeasure",style:"position:absolute;left:0;top:0;width:99999px;height:0;pointer-events:none;contain:strict;margin:0;padding:0;"});let to;var oo=e=>(Qt(eo,e),eo.parentNode||document.body.append(eo),clearTimeout(to),to=setTimeout(()=>{eo.remove()},500),e);let io=null;var no=()=>(null===io&&(io=m()&&/^((?!chrome|android).)*(safari|iphone|ipad)/i.test(navigator.userAgent)),io),ro=e=>new Promise((t,o)=>{let i=!1;!e.parentNode&&no()&&(i=!0,e.style.cssText="position:absolute;visibility:hidden;pointer-events:none;left:0;top:0;width:0;height:0;",oo(e));let n=!1;const r=()=>{let o=e.naturalWidth,r=e.naturalHeight;if(!(o&&r)){if(!n)return;o=300,r=150}delete e.onload,i&&e.remove(),clearInterval(a),t({width:o,height:r})};e.onerror=e=>{clearInterval(a),o(e)},e.onload=()=>{n=!0,clearInterval(a),r()};const a=setInterval(r,1);r()}),ao=e=>new Promise((t,o)=>{const i=()=>{t({width:e.videoWidth,height:e.videoHeight})};if(e.readyState>=1)return i();e.onloadedmetadata=i,e.onerror=()=>o(e.error)}),so=e=>/^image/.test(e.type),lo=e=>new Promise(t=>{const o=y(e)?e:URL.createObjectURL(e),i=()=>{const e=new Image;e.src=o,t(e)};if(e instanceof Blob&&so(e))return i();const n=document.createElement("video");n.preload="metadata",n.onloadedmetadata=()=>t(n),n.onerror=i,n.src=o}),co=e=>"VIDEO"===e.nodeName,uo=async e=>{let t,o;t=e.src?e:await lo(e);try{o=co(t)?await ao(t):await ro(t)}finally{qt(e)&&URL.revokeObjectURL(t.src)}return o};var po=async e=>{const t=await uo(e),o=await(e=>new Promise((t,o)=>{if(e.complete)return t(e);e.onload=()=>t(e),e.onerror=()=>o(new Error("Failed to load image"))}))(e),i=x("canvas",t);i.getContext("2d",{willReadFrequently:!0}).drawImage(o,0,0);const n=await U(i);return J(n,Jt(o.src))},ho=(e=0,t=!0)=>new(c("ProgressEvent"))("progress",{loaded:100*e,total:100,lengthComputable:t}),mo=(e,t,o=e=>e)=>e.getAllResponseHeaders().indexOf(t)>=0?o(e.getResponseHeader(t)):void 0,go=e=>{if(!e)return null;const t=e.split(/filename=|filename\*=.+''/).splice(1).map(e=>e.trim().replace(/^["']|[;"']{0,2}$/g,"")).filter(e=>e.length);return t.length?decodeURI(t[t.length-1]):null};const $o="URL_REQUEST";class fo extends Error{constructor(e,t,o){super(e),this.name="EditorError",this.code=t,this.metadata=o}}var yo=(e,t)=>{const{headers:o={},credentials:i}=t||{};Object.entries(o).forEach(([t,o])=>e.setRequestHeader(t,o)),i&&(e.withCredentials="omit"!==i)},bo=(e,t,i)=>/^data:/.test(e)?(async(e,t="data-uri",i=o)=>{i(ho(0));const n=await fetch(e);i(ho(.33));const r=await n.blob();let a;so(r)||(a="image/"+(e.includes(",/9j/")?"jpeg":"png")),i(ho(.66));const s=J(r,t,a);return i(ho(1)),s})(e,void 0,t):((e,t,o)=>new Promise((i,n)=>{const r=()=>n(new fo("Error fetching image",$o,a)),a=new XMLHttpRequest;a.onprogress=t,a.onerror=r,a.onload=()=>{if(!a.response||a.status>=300||a.status<200)return r();const t=mo(a,"Content-Type"),o=mo(a,"Content-Disposition",go)||Jt(e);i(J(a.response,o,t||K(o)))};const{willRequest:s}=o;Promise.resolve(s&&s(e,{resourceType:"image"})).then(t=>{if(!1===t)return n("Image load rejected");a.open("GET",e,!0),yo(a,t),a.responseType="blob",a.send()}).catch(console.error)}))(e,t,i),xo=e=>e instanceof Blob&&!(e instanceof File),vo=e=>"close"in e,So=async(e,t,o)=>{if(qt(e)||xo(e))return e;if(y(e))return await bo(e,t,o);if(Yt(e,"canvas"))return await Kt(e);if(Yt(e,"img"))return await po(e);if(w(e)||vo(e))return await Kt(await P(e));throw new fo("Invalid image source","invalid-image-source")};let wo=null;var ko=()=>(null===wo&&(wo=m()&&/^mac/i.test(navigator.platform)),wo);let Co=null;var To=()=>(null===Co&&(Co=m()&&(k(/iPhone|iPad|iPod/)||ko()&&navigator.maxTouchPoints>=1)),Co),Mo=async(e,t=1)=>await $()||To()||t<5?e:Ze(e.height,e.width),Po=e=>/jpeg/.test(e.type),Ro=e=>{return"object"!=typeof(t=e)||t.constructor!=Object?e:JSON.stringify(e);var t},Io=(e,t=0,o)=>(0===t||(e.translate(o.x,o.y),e.rotate(t),e.translate(-o.x,-o.y)),e),Eo=(e,t,o)=>(e.scale(t,o),e),Ao=async(e,t={})=>{const{flipX:o,flipY:i,rotation:n,crop:r}=t,a=He(e),s=o||i,l=!!n,c=r&&(r.x||r.y||r.width||r.height),d=c&&xt(r,st(a)),u=c&&!d;if(!s&&!l&&!u)return e;const p={willReadFrequently:!0,colorSpace:e.colorSpace};let h,m=x("canvas",{width:e.width,height:e.height});if(m.getContext("2d",p).putImageData(e,0,0),s){const e=x("canvas",{width:m.width,height:m.height}).getContext("2d",p);Eo(e,o?-1:1,i?-1:1),e.drawImage(m,o?-m.width:0,i?-m.height:0),e.restore(),S(m),m=e.canvas}if(l){const e=Qe(je(dt(kt(ct(m),n))),Math.floor),t=x("canvas",{width:r.width,height:r.height}).getContext("2d",p);((e,t,o)=>{e.translate(t,o)})(t,-r.x,-r.y),Io(t,n,qe(e)),t.drawImage(m,.5*(e.width-m.width),.5*(e.height-m.height)),t.restore(),S(m),m=t.canvas}else if(u){return h=m.getContext("2d",p).getImageData(r.x,r.y,r.width,r.height),S(m),h}return h=m.getContext("2d",p).getImageData(0,0,m.width,m.height),S(m),h},Lo=(e,t)=>{const{imageData:o,width:i,height:n}=e,r=o.width,a=o.height,s=o.colorSpace,l=Math.round(i),c=Math.round(n),d=o.data,u=new Uint8ClampedArray(l*c*4),p=r/l,h=a/c,m=Math.ceil(.5*p),g=Math.ceil(.5*h);for(let e=0;e<c;e++)for(let t=0;t<l;t++){const o=4*(t+e*l);let i=0,n=0,a=0,s=0,c=0,$=0,f=0;const y=(e+.5)*h;for(let o=Math.floor(e*h);o<(e+1)*h;o++){const e=Math.abs(y-(o+.5))/g,l=(t+.5)*p,u=e*e;for(let e=Math.floor(t*p);e<(t+1)*p;e++){let t=Math.abs(l-(e+.5))/m;const p=Math.sqrt(u+t*t);if(p<-1||p>1)continue;if(i=2*p*p*p-3*p*p+1,i<=0)continue;t=4*(e+o*r);const h=d[t+3];f+=i*h,a+=i,h<255&&(i=i*h/250),s+=i*d[t],c+=i*d[t+1],$+=i*d[t+2],n+=i}}u[o]=s/n,u[o+1]=c/n,u[o+2]=$/n,u[o+3]=f/a}t(null,{data:u,width:l,height:c,colorSpace:s})},Fo=e=>{if(e instanceof ImageData)return e;let t;try{t=new ImageData(e.width,e.height,{colorSpace:e.colorSpace||"srgb"})}catch(o){t=x("canvas").getContext("2d").createImageData(e.width,e.height)}return t.data.set(e.data),t},zo=async(e,t={},o)=>{const{width:i,height:n,fit:r,upscale:a}=t;if(!i&&!n)return e;let s=i,l=n;if(i?n||(l=i):s=n,"force"!==r){const t=s/e.width,o=l/e.height;let c=1;if("cover"===r?c=Math.max(t,o):"contain"===r&&(c=Math.min(t,o)),c>1&&!1===a)return e;s=Math.round(e.width*c),l=Math.round(e.height*c),i&&n&&(Math.abs(s-i)<=1&&(s=i),Math.abs(l-n)<=1&&(l=n))}return s=Math.max(s,1),l=Math.max(l,1),e.width===s&&e.height===l?e:o?o(e,s,l):(e=await _(Lo,[{imageData:e,width:s,height:l}],[e.data.buffer]),Fo(e))},Do=(e,t)=>{const{imageData:o,matrix:i}=e;if(!i||20!==i.length)return t(null,o);const n=o.colorSpace,r=o.data,a=r.length,s=i[0],l=i[1],c=i[2],d=i[3],u=i[4],p=i[5],h=i[6],m=i[7],g=i[8],$=i[9],f=i[10],y=i[11],b=i[12],x=i[13],v=i[14],S=i[15],w=i[16],k=i[17],C=i[18],T=i[19];let M=0,P=0,R=0,I=0,E=0,A=0,L=0,F=0,z=0;const D=e=>Math.max(0,Math.min(255,255*e));for(;M<a;M+=4)P=r[M]/255,R=r[M+1]/255,I=r[M+2]/255,E=r[M+3]/255,E>0&&(P/=E,R/=E,I/=E),A=P*s+R*l+I*c+E*d+u,L=P*p+R*h+I*m+E*g+$,F=P*f+R*y+I*b+E*x+v,z=P*S+R*w+I*k+E*C+T,E>0?(P=A*E,R=L*E,I=F*E):(P=0,R=0,I=0),r[M]=D(A*z),r[M+1]=D(L*z),r[M+2]=D(F*z),r[M+3]=D(E);t(null,{data:r,width:o.width,height:o.height,colorSpace:n})},Oo=(e,t)=>{const{imageData:o,matrix:i}=e;if(!i)return t(null,o);let n=i.reduce((e,t)=>e+t);n=n<=0?1:n;const r=o.width,a=o.height,s=o.data,l=o.colorSpace;let c=0,d=0,u=0;const p=Math.round(Math.sqrt(i.length)),h=Math.floor(p/2);let m=0,g=0,$=0,f=0,y=0,b=0,x=0,v=0,S=0,w=0;const k=new Uint8ClampedArray(r*a*4);for(u=0;u<a;u++)for(d=0;d<r;d++){for(m=0,g=0,$=0,f=0,b=0;b<p;b++)for(y=0;y<p;y++)x=u+b-h,v=d+y-h,x<0&&(x=a-1),x>=a&&(x=0),v<0&&(v=r-1),v>=r&&(v=0),S=4*(x*r+v),w=i[b*p+y],m+=s[S]*w,g+=s[S+1]*w,$+=s[S+2]*w,f+=s[S+3]*w;k[c]=m/n,k[c+1]=g/n,k[c+2]=$/n,k[c+3]=f/n,c+=4}t(null,{data:k,width:r,height:a,colorSpace:l})},Bo=(e,t)=>{let{imageData:o,strength:i}=e;if(!i)return t(null,o);const n=o.colorSpace,r=o.width,a=o.height,s=o.data,l=(e,t)=>(c=e-S,d=t-w,Math.sqrt(c*c+d*d));let c,d,u,p,h,m,g,$,f,y,b,x=0,v=0,S=.5*r,w=.5*a,k=l(0,0);const C=(e,t,o,i)=>{m=t[e]/255,g=t[e+1]/255,$=t[e+2]/255,f=t[e+3]/255,y=1-i,b=y*f+i,o[e]=(y*f*m+i*u)/b*255,o[e+1]=(y*f*g+i*p)/b*255,o[e+2]=(y*f*$+i*h)/b*255,o[e+3]=255*b};for(i>0?(u=0,p=0,h=0):(i=Math.abs(i),u=1,p=1,h=1),v=0;v<a;v++)for(x=0;x<r;x++)C(4*(x+v*r),s,s,l(x,v)*i/k);t(null,{data:s,width:o.width,height:o.height,colorSpace:n})},Wo=(e,t)=>{const{imageData:o,level:i,monochrome:n=!1}=e;if(!i)return t(null,o);const r=o.colorSpace,a=o.data,s=a.length;let l,c,d,u=0;const p=()=>255*(2*Math.random()-1)*i,h=n?()=>{const e=p();return[e,e,e]}:()=>[p(),p(),p()];for(;u<s;u+=4)[l,c,d]=h(),a[u]=a[u]+l,a[u+1]=a[u+1]+c,a[u+2]=a[u+2]+d;t(null,{data:a,width:o.width,height:o.height,colorSpace:r})},_o=(e,t)=>{const{imageData:o,level:i}=e;if(!i)return t(null,o);const n=o.colorSpace,r=o.data,a=r.length;let s,l,c,d=0;for(;d<a;d+=4)s=r[d]/255,l=r[d+1]/255,c=r[d+2]/255,r[d]=255*Math.pow(s,i),r[d+1]=255*Math.pow(l,i),r[d+2]=255*Math.pow(c,i);t(null,{data:r,width:o.width,height:o.height,colorSpace:n})},Vo=async(e,t={})=>{const{colorMatrix:o,convolutionMatrix:i,gamma:n,noise:r,vignette:a}=t,s=[];if(i&&s.push([Oo,{matrix:i.clarity}]),n>0&&s.push([_o,{level:1/n}]),o&&!(e=>{const t=e.length;let o;const i=t>=20?6:t>=16?5:3;for(let n=0;n<t;n++){if(o=e[n],1===o&&n%i!==0)return!1;if(0!==o&&1!==o)return!1}return!0})(o)&&s.push([Do,{matrix:o}]),(r>0||r<0)&&s.push([Wo,{level:r}]),(a>0||a<0)&&s.push([Bo,{strength:a}]),!s.length)return e;const l=(e,t)=>`(err, imageData) => {\n (${e[t][0].toString()})(Object.assign({ imageData: imageData }, filterInstructions[${t}]), \n ${e[t+1]?l(e,t+1):"done"})\n }`,c=`function (options, done) {\n const filterInstructions = options.filterInstructions;\n const imageData = options.imageData;\n (${l(s,0)})(null, imageData)\n }`;return e=await _(c,[{imageData:e,filterInstructions:s.map(e=>e[1])}],[e.data.buffer]),Fo(e)},No=e=>"number"==typeof e,Ho=e=>y(e)&&null!==e.match(/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g),jo=(e,t)=>e.hasOwnProperty(t),Uo=e=>Array.isArray(e);let Go=64,Zo=102,Xo=112,Yo=!1;var qo=(e,t)=>(!Yo&&m()&&(/^win/i.test(navigator.platform)&&(Zo=103),(To()||ko())&&(Go=63.5,Zo=110,Xo=123),Yo=!0),`<svg${t?` aria-label="${t}"`:""} width="128" height="128" viewBox="0 0 128 128" preserveAspectRatio="xMinYMin meet" xmlns="http://www.w3.org/2000/svg"><text x="${Go}" y="${Zo}" alignment-baseline="text-top" dominant-baseline="text-top" text-anchor="middle" font-size="${Xo}px">${e}</text></svg>`),Ko=e=>e instanceof Blob,Jo=(e,t)=>e/t*100+"%",Qo=e=>`rgba(${Math.round(255*e[0])}, ${Math.round(255*e[1])}, ${Math.round(255*e[2])}, ${No(e[3])?e[3]:1})`,ei=e=>Object.values(e).join("_");const ti=async(e,t=0)=>{const o=x("canvas",{width:80,height:80}).getContext("2d");return await((e=0)=>new Promise(t=>{setTimeout(t,e)}))(t),o.drawImage(e,0,0,80,80),!((e=>!new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data.buffer).some(e=>0!==e))(o)&&t<=256)||await ti(e,t+16)},oi=new Map;var ii=e=>new Promise((t,o)=>{const i=new FileReader;i.onerror=()=>o(i.error),i.onload=()=>t(i.result),i.readAsDataURL(e)}),ni=()=>{let e=[];return{sub:(t,o)=>(e.push({event:t,callback:o}),()=>e=e.filter(e=>e.event!==t||e.callback!==o)),pub:(t,o)=>{e.filter(e=>e.event===t).forEach(e=>e.callback(o))}}};const ri=32,ai=({color:e=[0,0,0],fontSize:t=16,fontFamily:o="sans-serif",fontVariant:i="normal",fontWeight:n="normal",fontStyle:r="normal",textAlign:a="left",letterSpacing:s="normal",lineHeight:l=20},c=1)=>`font-size:${t*c}px;font-style:${r};font-weight:${n};font-family:${o};font-variant:${i};line-height:${l*c}px;text-align:${a};letter-spacing:${No(s)?s+"px":"normal"};color:${Qo(e)};`,si=(e,t,o=1)=>{const{width:i,height:n,disableNewline:r}=t,a=!i,s=!1===r?((e="")=>e.split("\n").length)(e):void 0,l=a?"auto":i*o+"px",c=n?n*o+"px":"auto",d=a?"normal":"break-word",u=a&&!s?"nowrap":"pre-line",p=(({fontSize:e=16,lineHeight:t=20}={})=>.5*Math.max(0,e-t))(t)*o;return`max-width:none;min-width:auto;width:${l};height:${c};margin-top:0;margin-bottom:0;padding-top:${p}px;word-break:${d};word-wrap:normal;white-space:${u};`},li=new Map,ci=e=>{const t=[];for(const o of Array.from(e.childNodes))o.nodeType===Node.TEXT_NODE?t.push(ui(o)):t.push(...ci(o));return t},di="pointer-events:none;visibility:hidden;position:absolute;left:0;top:0;",ui=e=>{const t=e.nodeValue;if(!t)return[];const o=t.length,i=document.createRange();i.selectNodeContents(e);const n=[];for(let r=0;r<o;r++){i.setStart(e,0),i.setEnd(e,r+1);const o=i.getClientRects().length-1,a=t.charAt(r);n[o]?n[o]+=a:n.push(a)}const r=i.getClientRects();return n.map((e,t)=>({rect:r[t],text:e}))},pi=new Map,hi=(e="",t)=>{const{width:o,height:i}=t;if(No(o)&&No(i))return Ze(o,i);let{fontSize:n=16,fontFamily:r,lineHeight:a=20,fontWeight:s,fontStyle:l,fontVariant:c,letterSpacing:d}=t;const u=ei({text:e,fontFamily:r,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:n,letterSpacing:d,lineHeight:a,width:o});let p=pi.get(u);if(p)return p;let h=1;n>1e3&&N()&&(h=n/1e3,n=1e3,a/=h);const m=oo(x("pre",{contenteditable:"true",spellcheck:"false",style:`${di}${ai({...t,fontSize:n,lineHeight:a})};${si(e,t)}"`,innerHTML:e})).getBoundingClientRect();return p=He(m),p=Qe(p,e=>e*h),o&&(p.width=o),pi.set(u,p),p},mi=e=>e.pathname.split("/").slice(0,-1).join("/"),gi=new Map,$i=(e,t)=>new Promise((o,i)=>{let n=gi.get(e);void 0===n&&(n=((e,t)=>{const{sub:o,pub:i}=ni();let n,r;return Promise.resolve(t&&t(e,{resourceType:"stylesheet"})).then(t=>{if(!1===t)return r="requestPrevented",i("error",r);const{headers:o,credentials:a}=t||{};fetch(e,{headers:o,credentials:a}).then(e=>e.text()).then(e=>{n=e,i("load",n)}).catch(e=>{r=e,i("error",r)})}),{sub:(e,t)=>"load"===e&&n?t(n):"error"===e&&r?t(r):void o(e,t)}})(e,t),gi.set(e,n)),n.sub("load",o),n.sub("error",i)}),fi=async(e,t,o)=>{let i;try{i=await $i(e,t)}catch(e){return[]}const n={innerHTML:i,id:B()};o&&(n.nonce=o);const r=x("style",n);document.head.append(r);const a=Array.from(document.styleSheets).find(e=>e.ownerNode.id===r.id);return r.remove(),Array.from(a.cssRules)},yi=new Map,bi=(e,t)=>!t||!e.href||e.href.startsWith("/")||e.href.startsWith("http")?e.href:t+"/"+e.href.replace(/^\.\//,""),xi=async(e,t,o)=>{if(yi.has(e.href))return yi.get(e.href);let i;try{i=Array.from(e.cssRules);const n=(e=>{if(!e.href)return null;try{return mi(new URL(e.href))}catch(e){return null}})(e);for(const e of(e=>e.filter(e=>e instanceof CSSImportRule))(i)){const r=bi(e,n);if(yi.has(r)){const e=yi.get(r);i=[...i,...e];continue}const a=await fi(r,t,o);yi.set(r,a),i=[...i,...a]}}catch(n){const r=e.href;i=await fi(r,t,o),yi.set(r,i)}return(e=>e.filter(e=>e instanceof CSSFontFaceRule))(i)},vi=(e,t)=>e.style.getPropertyValue(t),Si=(e,t)=>vi(e,"font-family").replace(/^"|"$/g,"")==t,wi=e=>e.style&&vi(e,"src")&&vi(e,"font-family"),ki=async(e,t,o)=>{const i=await(async(e,t)=>{const o=Array.from(document.styleSheets).map(o=>xi(o,e,t)),i=await Promise.all(o),n=[];return i.forEach(e=>n.push(...e)),n})(t,o),n=((e,t)=>{const o=[];for(const i of e)wi(i)&&Si(i,t)&&o.push(i);return o})(i,e);return n.length?n.map(e=>{const t=e.parentStyleSheet&&e.parentStyleSheet.href&&new URL(e.parentStyleSheet.href),o=t?t.origin+mi(t)+"/":"",i=e.style.getPropertyValue("src").match(/url\("?(.*?)"?\)/)[1],n=Array.from(e.style).filter(e=>"src"!=e).reduce((t,o)=>t+=o+":"+vi(e,o)+";","");return[/^http/.test(i)?i:o+i,n]}):[]},Ci=new Map,Ti=new Map,Mi=e=>!e||/woff2/.test(e)?"woff2":/woff/.test(e)?"woff":/ttf|truetype/.test(e)?"truetype":/otf|opentype/.test(e)?"opentype":/svg/.test(e)?"svg":"woff2";var Pi=async(e="",t)=>{if(!e.length)return;let{color:o,imageWidth:i=300,imageHeight:n=150,paddingTop:r=0,paddingRight:a=ri,paddingBottom:s=0,paddingLeft:l=ri,fontFamily:c,fontSize:d,pixelRatio:u=1,willRequest:p,outline:h,blur:m,styleNonce:g}=t,$=1,f="";d>1e3&&N()&&($=d/1e3,f=`transform-origin:0 0;transform:scale(${$})`);const y=u/$,b=(i+l+a)*u,x=(n+s+r)*u,v=await(async(e,t,o)=>{if(Ci.get(e))return;let i=Ti.get(e);if(!i){const n=await ki(e,t,o);if(!n.length)return void Ci.set(e,!0);const r=[];for(const[e,t]of n){const o=await fetch(e).then(e=>e.blob()),i=Mi(o.type),n=await ii(o);r.push(`@font-face { src:url(${n}) format('${i}');${t};font-display:block; }`)}i=r.join(""),Ti.set(e,i)}return i})(c,p,g);let S="";v&&(S=`<style${g?` nonce="${g}"`:""}>${v}</style>`);const w=e.replace(/%/g,"%25").replace(/#/g,"%23").replace(/&nbsp;/g," ").replace(/&(?!#\d{4};|[a-z]+;)/gi,"&amp;").replace(/<br>|\n/g,"<br/>"),k=`top:${r*y}px;right:${a*y}px;bottom:${s*y}px;left:${l*y}px`;let C=o,T="",M="";if(h||m){const e=Qo(o);h&&(C=[0,0,0,0],T=`-webkit-text-stroke: ${2*h*y}px ${e}`),m&&(no()?M=`filter:blur(${m*y*.4}px)`:(C=[0,0,0,0],M=`text-shadow: 0 0 ${m*y}px ${e}`))}return((e,{safariCacheKey:t="*"}={})=>new Promise((o,i)=>{const n=new Image;n.onerror=()=>i(new Error("Failed to load SVG")),n.onload=()=>{if(!no()||!e.includes("@font-face")||oi.has(t))return o(n);ti(n).then(()=>{oi.set(t,!0),o(n)})},n.src="data:image/svg+xml,"+e}))(`<svg xmlns="http://www.w3.org/2000/svg" width="${b}" height="${x}" viewBox="0 0 ${b} ${x}"><foreignObject x="0" y="0" width="${b}" height="${x}"><div xmlns="http://www.w3.org/1999/xhtml">${S}<pre contenteditable="true" spellcheck="false" style="position:absolute;${k};${ai({...t,color:C,fontSize:d},y)};${si(e,t,y)};${f};${T};${M}">${w}</pre></div></foreignObject></svg>`,{safariCacheKey:c})};const Ri=e=>{const t={...e};return A(t)},Ii=(e,t={})=>{const o=vt(e);let i,n;const r=t.width||t.rx,a=t.height||t.ry;if(r&&a)return Ne(t);if(r||a){i=parseFloat(r||Number.MAX_SAFE_INTEGER),n=parseFloat(a||Number.MAX_SAFE_INTEGER);const e=Math.min(i,n);y(r)||y(a)?(i=`${e}%`,n=e*o+"%"):(i=e,n=e)}else{const e=10;i=`${e}%`,n=e*o+"%"}const s=t.width?"width":t.rx?"rx":void 0,l=t.width?"height":t.rx?"ry":void 0;return{[s||"width"]:i,[l||"height"]:n}},Ei=(e,t={})=>{return{width:void 0,height:void 0,...t,aspectRatio:1,backgroundImage:(o=qo(e),`data:image/svg+xml,${o.replace("<","%3C").replace(">","%3E")}`)};var o},Ai=(e,t={})=>({backgroundColor:[0,0,0,0],..._i(t)?{}:{width:void 0,height:void 0,aspectRatio:void 0},...t,backgroundImage:y(e)?e:Ko(e)?URL.createObjectURL(e):e}),Li=(e,t)=>{let o;if(y(e)||Ko(e)){const i={...Ii(t),backgroundSize:"contain"};o=Ho(e)?Ei(e,i):Ai(e,i)}else if(e.src){const i=Ii(t,e.shape||e),n={...e.shape,...i};if(e.width&&e.height&&!jo(n,"aspectRatio")){const e=Fn(i,"width",t),o=Fn(i,"height",t);n.aspectRatio=Q(e,o)}n.backgroundSize||e.shape||e.width&&e.height||(n.backgroundSize="contain"),o=Ho(e.src)?Ei(e.src,n):Ai(e.src,n)}else e.shape&&(o=Ri(e.shape));return jo(o,"backgroundImage")&&(jo(o,"backgroundColor")||(o.backgroundColor=[0,0,0,0]),jo(o,"disableStyle")||(o.disableStyle=["cornerRadius","backgroundColor","strokeColor","strokeWidth"])),t?An(o,t):o},Fi=e=>be(e.x1,e.y1),zi=e=>be(e.x2,e.y2),Di=e=>jo(e,"text"),Oi=e=>Di(e)&&!(qi(e)||jo(e,"width")),Bi=e=>Di(e)&&(qi(e)||jo(e,"width")),Wi=e=>!Di(e)&&Ki(e),_i=e=>jo(e,"rx"),Vi=e=>jo(e,"x1"),Ni=e=>jo(e,"points"),Hi=e=>Di(e)&&e.isEditing,ji=e=>!jo(e,"opacity")||e.opacity>0,Ui=e=>e.isSelected,Gi=e=>e.isEditing,Zi=e=>e._isDraft,Xi=e=>jo(e,"width")&&jo(e,"height"),Yi=e=>{const t=jo(e,"right"),o=jo(e,"bottom");return t||o},qi=e=>(jo(e,"x")||jo(e,"left"))&&jo(e,"right")||(jo(e,"y")||jo(e,"top"))&&jo(e,"bottom"),Ki=e=>Xi(e)||qi(e),Ji=e=>(e._isDraft=!0,e),Qi=e=>(e._isDraft=!1,e),en=(e,t)=>!0!==e.disableStyle&&(!Uo(e.disableStyle)||!t||!e.disableStyle.includes(t)),tn=e=>!0!==e.disableErase,on=e=>!0!==e.disableSelect,nn=e=>!0!==e.disableRemove,rn=e=>!0!==e.disableDuplicate&&pn(e),an=e=>!e.disableFlip&&(!Zi(e)&&!Yi(e)&&(e=>jo(e,"backgroundImage")||jo(e,"text"))(e)),sn=(e,t)=>!!Di(e)&&(!0!==e.disableInput&&(L(e.disableInput)?e.disableInput(null!=t?t:e.text):t||!0)),ln=(e,t)=>!0!==e.disableTextLayout&&(!Uo(e.disableTextLayout)||!t||!e.disableTextLayout.includes(t)),cn=e=>dn(e)&&e.points.length>3,dn=e=>!!Ni(e)&&(void 0!==e.disableAddPoints&&!0!==e.disableAddPoints),un=e=>!0!==e.disableManipulate&&!Zi(e)&&!Yi(e),pn=e=>un(e)&&!0!==e.disableMove,hn=e=>(delete e.left,delete e.right,delete e.top,delete e.bottom,e),mn=e=>(delete e.rotation,e),gn=e=>(e.strokeWidth=e.strokeWidth||1,e.strokeColor=e.strokeColor||[0,0,0],e),$n=e=>(e.backgroundColor=e.backgroundColor?e.backgroundColor:e.strokeWidth||e.backgroundImage?void 0:[0,0,0],e),fn=e=>{let t=e.text;t=t.replace(/&(#[0-9]+|[a-z]+);/gi,(e,t)=>`___${t}___`),t=t.replace(/&/,"&amp;"),e.text=t.replace(/___(#[0-9]+|[a-z]+)___/gi,(e,t)=>`&${t};`)},yn=e=>{if(!e.textShadow)return e;const[t,o,i,n]=e.textShadow;return e.textShadowX=t,e.textShadowY=o,e.textShadowBlur=i,e.textShadowColor=n,delete e.textShadow,e},bn=e=>{if(!e.textOutline)return e;const[t,o]=e.textOutline;e.textOutlineWidth=t,e.textOutlineColor=o,delete e.textOutline},xn=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",yn(e),bn(e),"html"===e.format?fn(e):(e=>{fn(e);let t=e.text;t=t.replace(/</g,"&gt;"),t=t.replace(/>/g,"&lt;"),e.text=t})(e),Oi(e)?vn(e):Sn(e)),vn=e=>(!1!==e.disableNewline&&(delete e.textAlign,e.text=e.text.replace(/\n/g," ")),hn(e)),Sn=e=>(e.textAlign=e.textAlign||"left",e),wn=e=>((e=>{y(e.id)||(e.id=B()),jo(e,"rotation")||(e.rotation=0),jo(e,"opacity")||(e.opacity=1),jo(e,"disableErase")||(e.disableErase=!0)})(e),Di(e)?xn(e):Wi(e)?(e=>{e.cornerRadius=e.cornerRadius||0,e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],$n(e)})(e):Ni(e)?(e=>{gn(e),mn(e),jo(e,"pathClose")||(e.disableResize=!0,jo(e,"disableMove")||(e.disableMove=!0)),hn(e)})(e):Vi(e)?(e=>{gn(e),e.lineStart=e.lineStart||void 0,e.lineEnd=e.lineEnd||void 0,mn(e),hn(e)})(e):_i(e)&&(e=>{e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],$n(e)})(e),e),kn=e=>Di(e)?"text":Wi(e)?"rectangle":Ni(e)?"path":Vi(e)?"line":_i(e)?"ellipse":void 0,Cn=(e,t)=>parseFloat(e)/100*t,Tn=new RegExp(/^x|left|right|^width|rx|fontSize|eraseRadius|feather|cornerRadius|strokeWidth|strokeDash/,"i"),Mn=new RegExp(/^y|top|bottom|^height|ry/,"i"),Pn=(e,t,{width:o,height:i})=>{if(Array.isArray(t))return t.map(t=>(I(t)&&En(t,{width:o,height:i}),y(t)&&(t=Pn(e,t,{width:o,height:i})),t));if("string"!=typeof t)return t;if(!t.endsWith("%"))return t;const n=parseFloat(t)/100;return Tn.test(e)?ge(o*n,6):Mn.test(e)?ge(i*n,6):t},Rn=Pn,In=["lineHeight","textOutlineWidth","textShadowX","textShadowY","textShadowBlur"],En=(e,t)=>{Object.entries(e).map(([o,i])=>{e[o]=Pn(o,i,t)}),e.text&&In.filter(t=>y(e[t])).forEach(t=>{var o,i;e[t]=(o=e[t],i=e.fontSize,Math.round(i*(parseFloat(o)/100)))})},An=(e,t)=>(En(e,t),Wn(e,t),e),Ln=(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},Fn=(e,t,o)=>Array.isArray(e[t])?e[t].map(e=>Object.entries(e).reduce((e,[t,i])=>(e[t]=y(i)?Cn(i,Ln(t,o)):i,e),{})):y(e[t])?Cn(e[t],Ln(t,o)):e[t],zn=(e,t,o)=>t.reduce((t,i)=>{const n=Fn(e,i,o);return t[i]=n,t},{}),Dn=(e,t,o)=>(Object.keys(t).forEach(i=>((e,t,o,i)=>{if(!y(e[t]))return e[t]=o,e;const n=Ln(t,i);return e[t]=void 0===n?o:Jo(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=at(),o=e.strokeWidth||0;if(Wi(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(Vi(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&&jo(e,"rotation")&&kt(t,e.rotation),Rt(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},Bn=(e,t,o)=>{const i=Ri(e);An(i,t);const n=o(i);return Array.isArray(n)?n:[n]},Wn=(e,t)=>{if(jo(e,"left")&&(e.x=e.left),jo(e,"right")&&!y(e.right)){const o=t.width-e.right;jo(e,"left")?(e.x=e.left,e.width=Math.max(0,o-e.left)):jo(e,"width")&&(e.x=o-e.width)}if(jo(e,"top")&&(e.y=e.top),jo(e,"bottom")&&!y(e.bottom)){const o=t.height-e.bottom;jo(e,"top")?(e.y=e.top,e.height=Math.max(0,o-e.top)):jo(e,"height")&&(e.y=o-e.height)}return e},_n=(e,t)=>(Ni(e)&&e.points.filter(e=>No(e.x)).forEach(e=>{e.x*=t,e.y*=t}),Vi(e)&&No(e.x1)&&(e.x1*=t,e.y1*=t,e.x2*=t,e.y2*=t),No(e.x)&&No(e.y)&&(e.x*=t,e.y*=t),No(e.width)&&No(e.height)&&(e.width*=t,e.height*=t),No(e.rx)&&No(e.ry)&&(e.rx*=t,e.ry*=t),(e=>No(e.strokeWidth)&&e.strokeWidth>0)(e)&&(e.strokeWidth*=t),Di(e)&&(e._scale=t,No(e.fontSize)&&(e.fontSize*=t),No(e.lineHeight)&&(e.lineHeight*=t),No(e.width)&&!No(e.height)&&(e.width*=t)),jo(e,"cornerRadius")&&No(e.cornerRadius)&&(e.cornerRadius*=t),e),Vn=e=>{if(Wi(e))return be(e.x+.5*e.width,e.y+.5*e.height);if(_i(e))return be(e.x,e.y);if(e.text){if(Bi(e)){const t=e.height||hi(e.text,e).height;return be(e.x+.5*e.width,e.y+.5*t)}const t=hi(e.text,e);return be(e.x+.5*t.width,e.y+.5*t.height)}return Ni(e)?Be(e.points):Vi(e)?Be([Fi(e),zi(e)]):void 0};var Nn=e=>/canvas/i.test(e.nodeName),Hn=(e,t=void 0)=>new Promise((o,i)=>{let n=e,r=!1;const a=()=>{r||(r=!0,L(t)&&Promise.resolve().then(()=>t(Ze(n.naturalWidth,n.naturalHeight))))};if(n.src||(n=new Image,y(e)&&new URL(e,location.href).origin!==location.origin&&(n.crossOrigin="anonymous"),n.src=y(e)?e:URL.createObjectURL(e)),n.complete)return a(),o(n);L(t)&&ro(n).then(a).catch(i),n.onload=()=>{a(),o(n)},n.onerror=()=>i(new Error("Failed to load image"))});const jn=new Map([]),Un=(e,t={})=>new Promise((i,n)=>{const{onMetadata:r=o,onLoad:a=i,onError:s=n,onComplete:l=o}=t;let c=jn.get(e);if(c||(c={loading:!1,complete:!1,error:!1,image:void 0,size:void 0,bus:ni()},jn.set(e,c)),c.bus.sub("meta",r),c.bus.sub("load",a),c.bus.sub("error",s),c.bus.sub("complete",l),Nn(e)){const t=e,o=t.cloneNode();c.complete=!0,c.image=o,c.size=Ge(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=ni());c.loading||(c.loading=!0,Hn(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=ni()}))}),Gn=(e,t,o,i)=>e.drawImage(t,o.x,o.x,o.width,o.height,i.x,i.y,i.width,i.height);var Zn=async(e,t,o,i,n=Gn,r)=>{e.save(),e.clip(),await n(e,t,o,i,r),e.restore()};const Xn=(e,t,o,i,n)=>{const r=rt(e);if(i){const e=Et(dt(i),ge);return e.x*=o.width,e.width*=o.width,e.y*=o.height,e.height*=o.height,{srcRect:e,destRect:r}}const a=ht(0,0,o.width,o.height);if("contain"===t){const t=Pt(e,vt(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=Mt(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}},Yn=(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),qn=(e,t)=>(t.backgroundColor&&e.fill(),e),Kn=(e,t)=>(t.strokeWidth&&e.stroke(),e);var Jn=async(e,t,o={})=>{const{drawImage:i}=o;if(e.lineWidth=t.strokeWidth?t.strokeWidth:1,e.strokeStyle=t.strokeColor?Qo(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Qo(t.backgroundColor):"none",e.globalAlpha=t.opacity,t.backgroundImage){let o;if(o=Nn(t.backgroundImage)?t.backgroundImage:await Un(t.backgroundImage),Yn(e,t),qn(e,t),"repeat"===t.backgroundRepeat){const n=t.backgroundPosition||{x:0,y:0},{srcRect:r,destRect:a}=Xn(t,t.backgroundSize||Ge(o),Ge(o),t.backgroundCorners,{x:0,y:0}),s=document.createElement("canvas");s.width=a.width,s.height=a.height;const l=s.getContext("2d",{willReadFrequently:!1,desynchronized:!0});await i(l,o,r,{...a,x:0,y:0});const c=e.createPattern(s,"repeat");e.fillStyle=c,e.save(),e.beginPath(),e.rect(t.x+n.x,t.y+n.y,t.width-n.x,t.height-n.y),e.clip(),e.translate(a.x+n.x,a.y+n.y),e.fill(),S(s),e.restore()}else{const{srcRect:n,destRect:r}=Xn(t,t.backgroundSize,Ge(o),t.backgroundCorners,t.backgroundPosition);await Zn(e,o,n,r,i,{feather:t.feather})}return e.beginPath(),Yn(e,t),Kn(e,t),[]}return Yn(e,t),qn(e,t),Kn(e,t),[]},Qn=async(e,t,o={})=>new Promise(async(i,n)=>{const{drawImage:r}=o;if(e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Qo(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Qo(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 Un(t.backgroundImage)}catch(e){n(e)}const a=ht(t.x-t.rx,t.y-t.ry,2*t.rx,2*t.ry),{srcRect:s,destRect:l}=Xn(a,t.backgroundSize,Ge(o),t.backgroundCorners,t.backgroundPosition);await Zn(e,o,s,l,r),t.strokeWidth&&e.stroke(),i([])}else t.strokeWidth&&e.stroke(),i([])}),er=async(e,t,o)=>{const i=No(t.width)?Math.floor(t.width):void 0,n=No(t.height)?Math.floor(t.height):void 0,r=i&&n?He(t):hi(t.text,{...t,width:i,height:n}),a={x:t.x,y:t.y,width:r.width,height:r.height};if(Jn(e,{...t,...a,options:o}),!t.text.length)return[];const{textOutlineWidth:s=0,textShadowX:l=0,textShadowY:c=0,textShadowBlur:d=0,textShadowColor:u,outline:p,blur:h,...m}=t,g=!!t.height;if(g&&(e.rect(a.x,a.y,a.width,a.height),e.save(),e.clip()),l||c||d){e.save(),e.translate(l,c);const r={...a};g||(r.height+=ri+d),await tr(e,r,{...t,width:i,height:n},{...o,paddingLeft:ri+d,paddingRight:ri+d,paddingTop:d,paddingBottom:d+(g?-1*c:t.fontSize),shapeExtendedProps:{color:u,blur:d}}),e.restore()}if(s){const r={...a};g||(r.height+=ri+s),await tr(e,r,{...t,width:i,height:n},{...o,paddingLeft:ri+s,paddingRight:ri+s,paddingTop:s,paddingBottom:s+g?0:t.fontSize,shapeExtendedProps:{color:t.textOutlineColor,outline:s}})}return g&&e.restore(),await tr(e,a,{...m,width:i,height:n},{...o,paddingLeft:ri,paddingRight:ri,paddingTop:0,paddingBottom:g?0:t.fontSize}),[]};const tr=async(e,t,o,i)=>{const{willRequest:n,shapeExtendedProps:r,paddingLeft:a,paddingRight:s,paddingTop:l,paddingBottom:c,styleNonce:d}=i,u=No(o.width)?Math.floor(t.width):void 0,p=No(o.height)?Math.floor(t.height):void 0,h=Math.ceil(t.width),m=Math.ceil(t.height),g=await Pi(o.text,{...o,...r,...t,width:u,height:p,paddingLeft:a,paddingRight:s,paddingTop:l,paddingBottom:c,imageWidth:h,imageHeight:m,willRequest:n,styleNonce:d});e.drawImage(g,o.x-a,o.y-l,g.width,g.height)};var or=async(e,t)=>new Promise(async o=>{e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Qo(t.strokeColor):"none",e.globalAlpha=t.opacity,t.bitmap&&(e.lineCap=t.strokeCap,e.lineJoin=t.strokeJoin,e.setLineDash(t.strokeDash||[]));let i=Fi(t),n=zi(t);e.moveTo(i.x,i.y),e.lineTo(n.x,n.y),t.strokeWidth&&e.stroke(),o([])}),ir=async(e,t)=>new Promise((o,i)=>{if(t.bitmap&&1===t.points.length)return void Qn(e,{x:t.points[0].x,y:t.points[0].y,rx:.5*t.strokeWidth,ry:.5*t.strokeWidth,backgroundColor:t.strokeColor}).then(()=>o([]));e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Qo(t.strokeColor):"transparent",e.fillStyle=t.pathClose&&t.backgroundColor?Qo(t.backgroundColor):"transparent",e.globalAlpha=t.opacity;const{points:n}=t;t.bitmap&&(e.lineCap=t.strokeCap,e.lineJoin=t.strokeJoin,e.setLineDash(t.strokeDash||[])),t.pathClose&&e.beginPath(),e.moveTo(n[0].x,n[0].y);const r=n.length;for(let t=1;t<r;t++)e.lineTo(n[t].x,n[t].y);t.pathClose&&e.closePath(),t.strokeWidth&&e.stroke(),t.backgroundColor&&e.fill(),o([])}),nr=(e,t,o,i)=>t||o?(e.translate(i.x,i.y),e.scale(t?-1:1,o?-1:1),e.translate(-i.x,-i.y),e):e;const rr=async(e,t,o)=>{e.globalCompositeOperation="subtract"===t.drawMode?"destination-out":"source-over";const i=Vn(t);let n;if(Io(e,t.rotation,i),nr(e,t.flipX,t.flipY,i),Wi(t)?n=Jn:_i(t)?n=Qn:Vi(t)?n=or:Ni(t)?n=ir:Di(t)&&(n=er),n){const i=await n(e,t,o);if(!i.length)return[];return[t,...await ar(e,i,o)]}return[]};var ar=async(e,t,o)=>{let i=[];for(const n of t)e.save(),e.beginPath(),i=[...i,...await rr(e,n,o)],e.restore();return i},sr=async(e,t={})=>{const{shapes:i=[],contextBounds:n=e,transform:r=o,drawImage:a,willRequest:s,styleNonce:l,canvasMemoryLimit:c,computeShape:d=ee,preprocessShape:u=ee}=t;if(!i.length)return e;const p={willReadFrequently:!0,colorSpace:e.colorSpace},h=x("canvas");h.width=n.width,h.height=n.height;const m=h.getContext("2d",p);m.putImageData(e,n.x||0,n.y||0);const g=i.map(Ri).map(d).map(u).flat().filter(Boolean);r(m),await ar(m,g,{drawImage:a,canvasMemoryLimit:c,willRequest:s,styleNonce:l});const $=m.getImageData(0,0,h.width,h.height);return S(h),$},lr=async(e,t={})=>{const{backgroundFilterMode:o,backgroundColor:i,backgroundImage:n}=t,r=!(!i||i&&0===i[3]);if(!n&&!r)return e;const a={willReadFrequently:!0,colorSpace:e.colorSpace},s=x("canvas");s.width=e.width,s.height=e.height;const l=s.getContext("2d",a);if(l.putImageData(e,0,0),l.globalCompositeOperation="destination-over",r&&(l.fillStyle=Qo(i),l.fillRect(0,0,s.width,s.height)),n){let i,r;if(Nn(n)?i=n:(i=await Un(n),"image"===o&&(i=F(i,{contextOptions:a}))),"image"===o){const e=f(i),o=await Vo(e,t);r=await P(o)}const{srcRect:s,destRect:c}=Xn({x:0,y:0,width:e.width,height:e.height},"cover",{width:i.width||i.naturalWidth,height:i.height||i.naturalHeight});l.drawImage(r||i,s.x,s.y,s.width,s.height,c.x,c.y,c.width,c.height),r&&S(r),o&&"none"!==o&&i&&!Nn(n)&&S(i)}const c=l.getImageData(0,0,s.width,s.height);return S(s),c},cr=e=>e.length?e.reduce((e,t)=>((e,t)=>{const o=new Array(20);return o[0]=e[0]*t[0]+e[1]*t[5]+e[2]*t[10]+e[3]*t[15],o[1]=e[0]*t[1]+e[1]*t[6]+e[2]*t[11]+e[3]*t[16],o[2]=e[0]*t[2]+e[1]*t[7]+e[2]*t[12]+e[3]*t[17],o[3]=e[0]*t[3]+e[1]*t[8]+e[2]*t[13]+e[3]*t[18],o[4]=e[0]*t[4]+e[1]*t[9]+e[2]*t[14]+e[3]*t[19]+e[4],o[5]=e[5]*t[0]+e[6]*t[5]+e[7]*t[10]+e[8]*t[15],o[6]=e[5]*t[1]+e[6]*t[6]+e[7]*t[11]+e[8]*t[16],o[7]=e[5]*t[2]+e[6]*t[7]+e[7]*t[12]+e[8]*t[17],o[8]=e[5]*t[3]+e[6]*t[8]+e[7]*t[13]+e[8]*t[18],o[9]=e[5]*t[4]+e[6]*t[9]+e[7]*t[14]+e[8]*t[19]+e[9],o[10]=e[10]*t[0]+e[11]*t[5]+e[12]*t[10]+e[13]*t[15],o[11]=e[10]*t[1]+e[11]*t[6]+e[12]*t[11]+e[13]*t[16],o[12]=e[10]*t[2]+e[11]*t[7]+e[12]*t[12]+e[13]*t[17],o[13]=e[10]*t[3]+e[11]*t[8]+e[12]*t[13]+e[13]*t[18],o[14]=e[10]*t[4]+e[11]*t[9]+e[12]*t[14]+e[13]*t[19]+e[14],o[15]=e[15]*t[0]+e[16]*t[5]+e[17]*t[10]+e[18]*t[15],o[16]=e[15]*t[1]+e[16]*t[6]+e[17]*t[11]+e[18]*t[16],o[17]=e[15]*t[2]+e[16]*t[7]+e[17]*t[12]+e[18]*t[17],o[18]=e[15]*t[3]+e[16]*t[8]+e[17]*t[13]+e[18]*t[18],o[19]=e[15]*t[4]+e[16]*t[9]+e[17]*t[14]+e[18]*t[19]+e[19],o})([...e],t),e.shift()):[],dr=(e,t)=>{const o=e.width*e.height,i=t.reduce((e,t)=>(t.width>e.width&&t.height>e.height&&(e.width=t.width,e.height=t.height),e),{width:0,height:0}),n=i.width*i.height;return((e,t=2)=>Math.round(e*t)/t)(Math.max(.5,.5+(1-n/o)/2),5)};function ur(){}const pr=e=>e;function hr(e,t){for(const o in t)e[o]=t[o];return e}function mr(e){return e()}function gr(){return Object.create(null)}function $r(e){e.forEach(mr)}function fr(e){return"function"==typeof e}function yr(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}let br;function xr(e,t){return e===t||(br||(br=document.createElement("a")),br.href=t,e===br.href)}function vr(e,...t){if(null==e){for(const e of t)e(void 0);return ur}const o=e.subscribe(...t);return o.unsubscribe?()=>o.unsubscribe():o}function Sr(e){let t;return vr(e,e=>t=e)(),t}function wr(e,t,o){e.$$.on_destroy.push(vr(t,o))}function kr(e,t,o,i){if(e){const n=Cr(e,t,o,i);return e[0](n)}}function Cr(e,t,o,i){return e[1]&&i?hr(o.ctx.slice(),e[1](i(t))):o.ctx}function Tr(e,t,o,i){if(e[2]&&i){const n=e[2](i(o));if(void 0===t.dirty)return n;if("object"==typeof n){const e=[],o=Math.max(t.dirty.length,n.length);for(let i=0;i<o;i+=1)e[i]=t.dirty[i]|n[i];return e}return t.dirty|n}return t.dirty}function Mr(e,t,o,i,n,r){if(n){const a=Cr(t,o,i,r);e.p(a,n)}}function Pr(e){if(e.ctx.length>32){const t=[],o=e.ctx.length/32;for(let e=0;e<o;e++)t[e]=-1;return t}return-1}function Rr(e){const t={};for(const o in e)"$"!==o[0]&&(t[o]=e[o]);return t}function Ir(e,t){const o={};t=new Set(t);for(const i in e)t.has(i)||"$"===i[0]||(o[i]=e[i]);return o}function Er(e,t,o){return e.set(o),t}function Ar(e){return e&&fr(e.destroy)?e.destroy:ur}const Lr="undefined"!=typeof window;let Fr=Lr?()=>window.performance.now():()=>Date.now(),zr=Lr?e=>requestAnimationFrame(e):ur;const Dr=new Set;function Or(e){Dr.forEach(t=>{t.c(e)||(Dr.delete(t),t.f())}),0!==Dr.size&&zr(Or)}function Br(e){let t;return 0===Dr.size&&zr(Or),{promise:new Promise(o=>{Dr.add(t={c:e,f:o})}),abort(){Dr.delete(t)}}}const Wr="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function _r(e,t){e.appendChild(t)}function Vr(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function Nr(e){const t=Ur("style");return t.textContent="/* empty */",function(e,t){_r(e.head||e,t),t.sheet}(Vr(e),t),t.sheet}function Hr(e,t,o){e.insertBefore(t,o||null)}function jr(e){e.parentNode&&e.parentNode.removeChild(e)}function Ur(e){return document.createElement(e)}function Gr(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Zr(e){return document.createTextNode(e)}function Xr(){return Zr(" ")}function Yr(){return Zr("")}function qr(e,t,o,i){return e.addEventListener(t,o,i),()=>e.removeEventListener(t,o,i)}function Kr(e){return function(t){return t.preventDefault(),e.call(this,t)}}function Jr(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function Qr(e,t,o){null==o?e.removeAttribute(t):e.getAttribute(t)!==o&&e.setAttribute(t,o)}const ea=["width","height"];function ta(e,t){const o=Object.getOwnPropertyDescriptors(e.__proto__);for(const i in t)null==t[i]?e.removeAttribute(i):"style"===i?e.style.cssText=t[i]:"__value"===i?e.value=e[i]=t[i]:o[i]&&o[i].set&&-1===ea.indexOf(i)?e[i]=t[i]:Qr(e,i,t[i])}function oa(e,t){Object.keys(t).forEach(o=>{!function(e,t,o){const i=t.toLowerCase();i in e?e[i]="boolean"==typeof e[i]&&""===o||o:t in e?e[t]="boolean"==typeof e[t]&&""===o||o:Qr(e,t,o)}(e,o,t[o])})}function ia(e){return/-/.test(e)?oa:ta}function na(e,t){t=""+t,e.data!==t&&(e.data=t)}function ra(e,t){e.value=null==t?"":t}function aa(e,t,o,i){null==o?e.style.removeProperty(t):e.style.setProperty(t,o,i?"important":"")}function sa(e,t,{bubbles:o=!1,cancelable:i=!1}={}){return new CustomEvent(e,{detail:t,bubbles:o,cancelable:i})}class la{is_svg=!1;e=void 0;n=void 0;t=void 0;a=void 0;constructor(e=!1){this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,o=null){this.e||(this.is_svg?this.e=Gr(t.nodeName):this.e=Ur(11===t.nodeType?"TEMPLATE":t.nodeName),this.t="TEMPLATE"!==t.tagName?t:t.content,this.c(e)),this.i(o)}h(e){this.e.innerHTML=e,this.n=Array.from("TEMPLATE"===this.e.nodeName?this.e.content.childNodes:this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)Hr(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(jr)}}function ca(e,t){return new e(t)}const da=new Map;let ua,pa=0;function ha(e,t,o,i,n,r,a,s=0){const l=16.666/i;let c="{\n";for(let e=0;e<=1;e+=l){const i=t+(o-t)*r(e);c+=100*e+`%{${a(i,1-i)}}\n`}const d=c+`100% {${a(o,1-o)}}\n}`,u=`__svelte_${function(e){let t=5381,o=e.length;for(;o--;)t=(t<<5)-t^e.charCodeAt(o);return t>>>0}(d)}_${s}`,p=Vr(e),{stylesheet:h,rules:m}=da.get(p)||function(e,t){const o={stylesheet:Nr(t),rules:{}};return da.set(e,o),o}(p,e);m[u]||(m[u]=!0,h.insertRule(`@keyframes ${u} ${d}`,h.cssRules.length));const g=e.style.animation||"";return e.style.animation=`${g?`${g}, `:""}${u} ${i}ms linear ${n}ms 1 both`,pa+=1,u}function ma(e,t){const o=(e.style.animation||"").split(", "),i=o.filter(t?e=>e.indexOf(t)<0:e=>-1===e.indexOf("__svelte")),n=o.length-i.length;n&&(e.style.animation=i.join(", "),pa-=n,pa||zr(()=>{pa||(da.forEach(e=>{const{ownerNode:t}=e.stylesheet;t&&jr(t)}),da.clear())}))}function ga(e){ua=e}function $a(){if(!ua)throw new Error("Function called outside component initialization");return ua}function fa(e){$a().$$.on_mount.push(e)}function ya(e){$a().$$.after_update.push(e)}function ba(e){$a().$$.on_destroy.push(e)}function xa(){const e=$a();return(t,o,{cancelable:i=!1}={})=>{const n=e.$$.callbacks[t];if(n){const r=sa(t,o,{cancelable:i});return n.slice().forEach(t=>{t.call(e,r)}),!r.defaultPrevented}return!0}}function va(e,t){return $a().$$.context.set(e,t),t}function Sa(e){return $a().$$.context.get(e)}function wa(e,t){const o=e.$$.callbacks[t.type];o&&o.slice().forEach(e=>e.call(this,t))}const ka=[],Ca=[];let Ta=[];const Ma=[],Pa=Promise.resolve();let Ra=!1;function Ia(){Ra||(Ra=!0,Pa.then(Oa))}function Ea(){return Ia(),Pa}function Aa(e){Ta.push(e)}function La(e){Ma.push(e)}const Fa=new Set;let za,Da=0;function Oa(){if(0!==Da)return;const e=ua;do{try{for(;Da<ka.length;){const e=ka[Da];Da++,ga(e),Ba(e.$$)}}catch(e){throw ka.length=0,Da=0,e}for(ga(null),ka.length=0,Da=0;Ca.length;)Ca.pop()();for(let e=0;e<Ta.length;e+=1){const t=Ta[e];Fa.has(t)||(Fa.add(t),t())}Ta.length=0}while(ka.length);for(;Ma.length;)Ma.pop()();Ra=!1,Fa.clear(),ga(e)}function Ba(e){if(null!==e.fragment){e.update(),$r(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(Aa)}}function Wa(e,t,o){e.dispatchEvent(sa(`${t?"intro":"outro"}${o}`))}const _a=new Set;let Va;function Na(){Va={r:0,c:[],p:Va}}function Ha(){Va.r||$r(Va.c),Va=Va.p}function ja(e,t){e&&e.i&&(_a.delete(e),e.i(t))}function Ua(e,t,o,i){if(e&&e.o){if(_a.has(e))return;_a.add(e),Va.c.push(()=>{_a.delete(e),i&&(o&&e.d(1),i())}),e.o(t)}else i&&i()}const Ga={duration:0};function Za(e,t,o,i){let n,r=t(e,o,{direction:"both"}),a=i?0:1,s=null,l=null,c=null;function d(){c&&ma(e,c)}function u(e,t){const o=e.b-a;return t*=Math.abs(o),{a:a,b:e.b,d:o,duration:t,start:e.start,end:e.start+t,group:e.group}}function p(t){const{delay:o=0,duration:i=300,easing:p=pr,tick:h=ur,css:m}=r||Ga,g={start:Fr()+o,b:t};t||(g.group=Va,Va.r+=1),"inert"in e&&(t?void 0!==n&&(e.inert=n):(n=e.inert,e.inert=!0)),s||l?l=g:(m&&(d(),c=ha(e,a,t,i,o,p,m)),t&&h(0,1),s=u(g,i),Aa(()=>Wa(e,t,"start")),Br(t=>{if(l&&t>l.start&&(s=u(l,i),l=null,Wa(e,s.b,"start"),m&&(d(),c=ha(e,a,s.b,s.duration,0,p,r.css))),s)if(t>=s.end)h(a=s.b,1-a),Wa(e,s.b,"end"),l||(s.b?d():--s.group.r||$r(s.group.c)),s=null;else if(t>=s.start){const e=t-s.start;a=s.a+s.d*p(e/s.duration),h(a,1-a)}return!(!s&&!l)}))}return{run(e){fr(r)?(za||(za=Promise.resolve(),za.then(()=>{za=null})),za).then(()=>{r=r({direction:e?"in":"out"}),p(e)}):p(e)},end(){d(),s=l=null}}}function Xa(e){return void 0!==e?.length?e:Array.from(e)}function Ya(e,t){e.d(1),t.delete(e.key)}function qa(e,t){Ua(e,1,1,()=>{t.delete(e.key)})}function Ka(e,t,o,i,n,r,a,s,l,c,d,u){let p=e.length,h=r.length,m=p;const g={};for(;m--;)g[e[m].key]=m;const $=[],f=new Map,y=new Map,b=[];for(m=h;m--;){const e=u(n,r,m),s=o(e);let l=a.get(s);l?i&&b.push(()=>l.p(e,t)):(l=c(s,e),l.c()),f.set(s,$[m]=l),s in g&&y.set(s,Math.abs(m-g[s]))}const x=new Set,v=new Set;function S(e){ja(e,1),e.m(s,d),a.set(e.key,e),d=e.first,h--}for(;p&&h;){const t=$[h-1],o=e[p-1],i=t.key,n=o.key;t===o?(d=t.first,p--,h--):f.has(n)?!a.has(i)||x.has(i)?S(t):v.has(n)?p--:y.get(i)>y.get(n)?(v.add(i),S(t)):(x.add(n),p--):(l(o,a),p--)}for(;p--;){const t=e[p];f.has(t.key)||l(t,a)}for(;h;)S($[h-1]);return $r(b),$}function Ja(e,t){const o={},i={},n={$$scope:1};let r=e.length;for(;r--;){const a=e[r],s=t[r];if(s){for(const e in a)e in s||(i[e]=1);for(const e in s)n[e]||(o[e]=s[e],n[e]=1);e[r]=s}else for(const e in a)n[e]=1}for(const e in i)e in o||(o[e]=void 0);return o}function Qa(e){return"object"==typeof e&&null!==e?e:{}}function es(e,t,o){const i=e.$$.props[t];void 0!==i&&(e.$$.bound[i]=o,o(e.$$.ctx[i]))}function ts(e){e&&e.c()}function os(e,t,o){const{fragment:i,after_update:n}=e.$$;i&&i.m(t,o),Aa(()=>{const t=e.$$.on_mount.map(mr).filter(fr);e.$$.on_destroy?e.$$.on_destroy.push(...t):$r(t),e.$$.on_mount=[]}),n.forEach(Aa)}function is(e,t){const o=e.$$;null!==o.fragment&&(!function(e){const t=[],o=[];Ta.forEach(i=>-1===e.indexOf(i)?t.push(i):o.push(i)),o.forEach(e=>e()),Ta=t}(o.after_update),$r(o.on_destroy),o.fragment&&o.fragment.d(t),o.on_destroy=o.fragment=null,o.ctx=[])}function ns(e,t,o,i,n,r,a=null,s=[-1]){const l=ua;ga(e);const c=e.$$={fragment:null,ctx:[],props:r,update:ur,not_equal:n,bound:gr(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:gr(),dirty:s,skip_bound:!1,root:t.target||l.$$.root};a&&a(c.root);let d=!1;if(c.ctx=o?o(e,t.props||{},(t,o,...i)=>{const r=i.length?i[0]:o;return c.ctx&&n(c.ctx[t],c.ctx[t]=r)&&(!c.skip_bound&&c.bound[t]&&c.bound[t](r),d&&function(e,t){-1===e.$$.dirty[0]&&(ka.push(e),Ia(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(e,t)),o}):[],c.update(),d=!0,$r(c.before_update),c.fragment=!!i&&i(c.ctx),t.target){if(t.hydrate){const e=function(e){return Array.from(e.childNodes)}(t.target);c.fragment&&c.fragment.l(e),e.forEach(jr)}else c.fragment&&c.fragment.c();t.intro&&ja(e.$$.fragment),os(e,t.target,t.anchor),Oa()}ga(l)}class rs{$$=void 0;$$set=void 0;$destroy(){is(this,1),this.$destroy=ur}$on(e,t){if(!fr(t))return ur;const o=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return o.push(t),()=>{const e=o.indexOf(t);-1!==e&&o.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const as=[];function ss(e,t){return{subscribe:ls(e,t).subscribe}}function ls(e,t=ur){let o;const i=new Set;function n(t){if(yr(e,t)&&(e=t,o)){const t=!as.length;for(const t of i)t[1](),as.push(t,e);if(t){for(let e=0;e<as.length;e+=2)as[e][0](as[e+1]);as.length=0}}}function r(t){n(t(e))}return{set:n,update:r,subscribe:function(a,s=ur){const l=[a,s];return i.add(l),1===i.size&&(o=t(n,r)||ur),a(e),()=>{i.delete(l),0===i.size&&o&&(o(),o=null)}}}}function cs(e,t,o){const i=!Array.isArray(e),n=i?[e]:e;if(!n.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const r=t.length<2;return ss(o,(e,o)=>{let a=!1;const s=[];let l=0,c=ur;const d=()=>{if(l)return;c();const n=t(i?s[0]:s,e,o);r?e(n):c=fr(n)?n:ur},u=n.map((e,t)=>vr(e,e=>{s[t]=e,l&=~(1<<t),a&&d()},()=>{l|=1<<t}));return a=!0,d(),function(){$r(u),c(),a=!1}})}var ds=e=>e.reduce((e,t)=>Object.assign(e,t),{});const us=e=>({updateValue:e}),ps=e=>({defaultValue:e}),hs=e=>({store:e}),ms=e=>({store:(t,o)=>cs(...e(o))}),gs=e=>({store:(t,o)=>{const[i,n,r=()=>!1]=e(o);let a,s=!0;return cs(i,(e,t)=>{n(e,e=>{!s&&r(a,e)||(a=e,s=!1,t(e))})})}}),$s=e=>({store:(t,o)=>{const[i,n={},r]=e(o);let a=[];const s={},l=e=>i(e,s),c=e=>{(a.length||e.length)&&(a=e,d())},d=()=>{const e=a.map(l);r&&e.sort(r),a=[...e],p(e)};Object.entries(n).map(([e,t])=>t.subscribe(t=>{s[e]=t,t&&d()}));const{subscribe:u,set:p}=ls(t||[]);return{set:c,update:e=>c(e(a)),subscribe:u}}});var fs=e=>{const t={},i={};return e.forEach(([e,...n])=>{const r=ds(n),a=t[e]=((e,t,i)=>{const{store:n=e=>ls(e),defaultValue:r=o,updateValue:a}=i,s=n(r(),t,e),{subscribe:l,update:c=o}=s;let d;const u=e=>{let t=!0;d&&d(),d=l(o=>{if(t)return t=!1;e(o),d(),d=void 0})},p=a?a(e):ee;return s.set=e=>c(t=>p(e,t,u)),s.defaultValue=r,s})(i,t,r),s={get:()=>Sr(a),set:a.set};Object.defineProperty(i,e,s)}),{stores:t,accessors:i}};var ys=[["src",hs(()=>{let e;const{subscribe:t,set:o}=ls(),i=t=>{e!==t&&(e=t,o(e))};return{set:i,subscribe:t,update:t=>i(t(e))}})],["imageReader"],["imageWriter"],["imageScrambler"],["imageRedactionRendering",ps(()=>"pixelated")],["images",ps(()=>[])],["shapePreprocessor"],["willRequestResource"],["willRequest"],["csp"]],bs=e=>e.charAt(0).toUpperCase()+e.slice(1),xs=(e,t)=>{Object.keys(t).forEach(o=>{const i=L(t[o])?{value:t[o],writable:!1}:t[o];Object.defineProperty(e,o,i)})};const vs=(e,t)=>{let o,i,n,r,a,s,l,c,d,u;const p=t.length;for(o=0;o<p;o++)if(i=t[o],n=t[o+1>p-1?0:o+1],r=i.x-e.x,a=i.y-e.y,s=n.x-e.x,l=n.y-e.y,c=r-s,d=a-l,u=c*a-d*r,u<-1e-5)return!1;return!0},Ss=1e4;var ws=(e,t)=>{const o=Vt(t),i=ye();It(e).forEach(e=>{Re(e,i),vs(e,t)||o.forEach(t=>{const o=Math.atan2(t.start.y-t.end.y,t.start.x-t.end.x),n=Math.sin(Math.PI-o)*Ss,r=Math.cos(Math.PI-o)*Ss,a=be(e.x+n,e.y+r),s=ot(tt(t),Ss),l=zt(et(e,a),s);l&&Re(i,Ie(ve(l),e))})});const n=rt(e);Re(n,i);return!!It(n).every(e=>vs(e,t))&&(wt(e,n),!0)},ks=(e,t)=>{const o=It(e),i=Nt(t,5),n=mt(e),r=[];o.forEach(e=>{const t=((e,t)=>{if(0===t)return e;const o=be(e.start.x-e.end.x,e.start.y-e.end.y),i=Ce(o),n=Ae(i,t);return e.end.x+=n.x,e.end.y+=n.y,e})(et(ve(n),ve(e)),1e6);let o=!1;i.map(tt).forEach(e=>{const i=zt(t,e);i&&!o&&(r.push(i),o=!0)})});const a=De(r[0],r[2])<De(r[1],r[3])?[r[0],r[2]]:[r[1],r[3]],s=dt(a);return s.width<e.width&&(wt(e,s),!0)},Cs=(e,t,o={x:0,y:0})=>{const i=st(e),n=mt(i),r=At(i,o,n).map(e=>we(e,t,n)),a=dt(r);return r.map(e=>Ie(e,a))},Ts=(e,t=0,o=vt(e))=>{let i,n;if(0!==t){const r=Math.atan2(1,o),a=Math.sign(t)*t,s=a%Math.PI,l=a%oe;let c;c=s>ie&&s<oe+ie?l>ie?a:oe-l:l>ie?oe-l:a;const d=Math.min(Math.abs(e.height/Math.sin(r+c)),Math.abs(e.width/Math.cos(r-c)));i=Math.cos(r)*d,n=i/o}else i=e.width,n=i/o,n>e.height&&(n=e.height,i=n*o);return Ze(i,n)},Ms=(e,t,o,i,n,r,a,s)=>{const l=Ne(a),c=Ne(s),d=ge(Math.max(t.width/c.width,t.height/c.height)),u=ge(Math.min(t.width/l.width,t.height/l.height)),p=rt(t);if(u<1||d>1){const o=mt(e),i=mt(t),n=u<1?u:d,r=(i.x+o.x)/2,a=(i.y+o.y)/2,s=p.width/n,l=p.height/n;St(p,r-.5*s,a-.5*l,s,l)}return r?(((e,t,o=0,i=ye(),n)=>{if(No(o)&&0!==o||i.x||i.y){const n=vt(e),r=Cs(t,o,i),a=Ts(t,o,n);if(!(e.width<a.width&&e.height<a.height)){const t=.5*e.width-.5*a.width,o=.5*e.height-.5*a.height;e.width>a.width&&(e.width=a.width,e.x+=t),e.height>a.height&&(e.height=a.height,e.y+=o)}ws(e,r),ks(e,r)&&ws(e,r)}else{const o=vt(e);e.width=Math.min(e.width,t.width),e.height=Math.min(e.height,t.height),e.x=Math.max(e.x,0),e.x+e.width>t.width&&(e.x-=e.x+e.width-t.width),e.y=Math.max(e.y,0),e.y+e.height>t.height&&(e.y-=e.y+e.height-t.height);const i=mt(e),r=Pt(e,o);r.width=Math.max(n.width,r.width),r.height=Math.max(n.height,r.height),r.x=i.x-.5*r.width,r.y=i.y-.5*r.height,wt(e,r)}})(p,o,i,n,l),{crop:p}):{crop:p}},Ps=(e,t,o)=>{const i=st(e),n=mt(i),r=kt(i,o,n),a=mt(Lt(dt(r))),s=mt(t),l=we(s,-o,a),c=Ie(l,a),d=Pe(Re(n,c),ge);return ht(d.x-.5*t.width,d.y-.5*t.height,t.width,t.height)},Rs=(e,t,o)=>Math.max(t,Math.min(e,o));const Is=["cropLimitToImage","cropMinSize","cropMaxSize","cropAspectRatio","flipX","flipY","rotation","crop","colorMatrix","convolutionMatrix","gamma","vignette","manipulation","redaction","annotation","decoration","selection","frame","backgroundColor","backgroundImage","backgroundFilterMode","targetSize","metadata","trim","volume","minDuration","maxDuration","currentTime"],Es=e=>Uo(e)?e.map(Es):xo(e)||qt(e)?e:I(e)?{...e}:e,As=e=>e.map(e=>Object.entries(e).reduce((e,[t,o])=>(t.startsWith("_")||(e[t]=o),e),{}));const Ls=(e,t)=>e===t;var Fs=(e,t,o=Ls)=>{if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!o(e[i],t[i]))return!1;return!0};const zs=(e,t,o)=>{const i=Pe(mt(e),e=>ge(e,8)),n=st(t),r=mt(n),a=kt(n,o,r),s=Pe(qe(dt(a)),e=>ge(e,8)),l=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y);return l<1&&c<1},Ds=(e,t,o,i,n)=>{if(!n)return[-1/0,1/0];const r=Math.max(o.width/i.width,o.height/i.height),a=Ze(i.width*r,i.height*r),s=(l=a,Math.sqrt(l.width*l.width+l.height*l.height));var l;if(s<Math.min(e.width,e.height))return[-1/0,1/0];const c=t?e.height:e.width,d=t?e.width:e.height,u=Math.acos(a.height/s),p=u-Math.acos(d/s),h=Math.asin(c/s)-u;if(Number.isNaN(p)&&Number.isNaN(h))return[-1/0,1/0];const m=Number.isNaN(p)?h:Number.isNaN(h)?p:Math.min(p,h);return[-m,m]},Os=(e,t)=>{const{context:o,props:i}=t;return e._isFormatted||((e=wn(e))._isFormatted=!0,Object.assign(e,i)),e._isDraft||!qi(e)||e._context&&xt(o,e._context)||(Wn(e,o),e._context={...o}),e},Bs=(e,t)=>(e._isFormatted||(e.disableMove=!0,e.disableSelect=!0,e.disableResize=!0,e.disableRotate=!0),Os(e,t));var Ws=[["file"],["size"],["loadState"],["processState"],["aspectRatio",ms(({size:e})=>[e,e=>e?vt(e):void 0])],["perspectiveX",ps(()=>0)],["perspectiveY",ps(()=>0)],["perspective",ms(({perspectiveX:e,perspectiveY:t})=>[[e,t],([e,t])=>({x:e,y:t})])],["rotation",ps(()=>0),us(e=>(t,o,i)=>{if(t===o)return t;const{loadState:n,size:r,rotationRange:a,cropMinSize:s,cropMaxSize:l,crop:c,perspective:d,cropLimitToImage:u,cropOrigin:p}=e;if(!c||!n||!n.beforeComplete)return t;const h=u&&((e,t,o)=>{const i=Ts(t,o,vt(e));return Xe(Qe(i,Math.round),Qe(Ne(e),Math.round))})(c,r,o),m=u&&zs(c,r,o),g=((e,t,o,i,n,r,a,s,l,c)=>{const d=Ne(l),u=Ne(c);a&&(u.width=Math.min(c.width,n.width),u.height=Math.min(c.height,n.height));let p=!1;const h=(t,o)=>{const l=Ps(n,i,t),c=st(n),m=mt(c),g=At(c,r,m),$=Ie(ve(m),Ft(g)),f=we(mt(l),o,m),y=Ie(ve(m),f);g.forEach(e=>we(e,o,m));const b=dt(g),x=Ft(g),v=Re(Ie(Ie(x,y),b),$),S=ht(v.x-.5*l.width,v.y-.5*l.height,l.width,l.height);if(s&&$t(S,s.width/S.width),a){const e=Cs(n,o,r);ks(S,e)}const w=ge(Math.min(S.width/d.width,S.height/d.height),8),k=ge(Math.max(S.width/u.width,S.height/u.height),8);return(w<1||k>1)&&ge(Math.abs(o-t))===ge(Math.PI/2)&&!p?(p=!0,h(e,e+Math.sign(o-t)*Math.PI)):{rotation:o,crop:Et(S,e=>ge(e,8))}},m=Math.sign(t)*Math.round(Math.abs(t)/oe)*oe,g=Rs(t,m+o[0],m+o[1]);return h(e,g)})(o,t,a,c,r,d,u,p,s,l);if(h&&m){const e=Ts(r,t,vt(g.crop));g.crop.x+=.5*g.crop.width,g.crop.y+=.5*g.crop.height,g.crop.x-=.5*e.width,g.crop.y-=.5*e.height,g.crop.width=e.width,g.crop.height=e.height}return i(()=>{e.crop=Et(g.crop,e=>ge(e,8))}),g.rotation})],["flipX",ps(()=>!1)],["flipY",ps(()=>!1)],["flip",ms(({flipX:e,flipY:t})=>[[e,t],([e,t])=>({x:e,y:t})])],["isRotatedSideways",gs(({rotation:e})=>[[e],([e],t)=>t(ne(e)),(e,t)=>e!==t])],["crop",us(e=>(t,o=t)=>{const{loadState:i,size:n,cropMinSize:r,cropMaxSize:a,cropLimitToImage:s,cropAspectRatio:l,rotation:c,perspective:d}=e;if(!t&&!o||!i||!i.beforeComplete)return t;t||(t=st(Ts(n,c,l||vt(n))));const u=Ms(o,t,n,c,d,s,r,a),p=Et(u.crop,e=>ge(e,8));return xt(o,p)?o:p})],["cropAspectRatio",us(e=>(t,o)=>{const{loadState:i,crop:n,size:r,rotation:a,cropLimitToImage:s}=e,l=(e=>{if(e){if(/:/.test(e)){const[t,o]=e.split(":");return t/o}return parseFloat(e)}})(t);if(!l)return;if(!n||!i||!i.beforeComplete)return l;const c=o?Math.abs(t-o):1;if(zs(n,r,a)&&s&&c>=.1){const o=((e,t)=>{const o=e.width,i=e.height;return ne(t)&&(e.width=i,e.height=o),e})(Ne(r),a);e.crop=Et(Pt(st(o),t),ge)}else{const t={width:n.height*l,height:n.height},o=.5*(n.width-t.width),i=.5*(n.height-t.height);e.crop=Et(ht(n.x+o,n.y+i,t.width,t.height),ge)}return l})],["cropOrigin"],["cropMinSize",ps(()=>({width:1,height:1}))],["cropMaxSize",ps(()=>({width:32768,height:32768}))],["cropLimitToImage",ps(()=>!0),us(e=>(t,o,i)=>{const{crop:n}=e;return n?(!o&&t&&i(()=>e.crop=rt(e.crop)),t):t})],["cropSize",gs(({crop:e})=>[[e],([e],t)=>{e&&t(Ze(e.width,e.height))},(e,t)=>Xe(e,t)])],["cropRectAspectRatio",ms(({cropSize:e})=>[[e],([e],t)=>{e&&t(ge(vt(e),5))}])],["cropRange",gs(({size:e,rotation:t,cropRectAspectRatio:o,cropMinSize:i,cropMaxSize:n,cropLimitToImage:r})=>[[e,t,o,i,n,r],([e,t,o,i,n,r],a)=>{if(!e)return;const s=((e,t,o,i,n,r)=>{const a=Ne(i),s=Ne(n);return r?[a,Qe(Ts(e,t,o),Math.round)]:[a,s]})(e,t,o,i,n,r);a(s)},(e,t)=>Fs(e,t)])],["rotationRange",gs(({size:e,isRotatedSideways:t,cropMinSize:o,cropSize:i,cropLimitToImage:n})=>[[e,t,o,i,n],([e,t,o,i,n],r)=>{if(!e||!i)return;r(Ds(e,t,o,i,n))},(e,t)=>Fs(e,t)])],["backgroundColor",us(()=>e=>((e=[0,0,0,0],t=1)=>4===e.length?e:[...e,t])(e))],["backgroundImage"],["backgroundFilterMode"],["targetSize"],["colorMatrix"],["convolutionMatrix"],["gamma"],["noise"],["vignette"],["duration"],["currentTime"],["minDuration",ps(()=>1/24)],["maxDuration",ps(()=>1/0)],["volume",ps(()=>1)],["trim"],["redaction",$s(({size:e})=>[Os,{context:e}])],["manipulation",$s(({size:e})=>[Os,{context:e}])],["annotation",$s(({size:e})=>[Os,{context:e}])],["decoration",$s(({crop:e})=>[Os,{context:e}])],["selection",$s(({size:e})=>[Bs,{context:e}])],["frame",us(()=>e=>{if(!e)return;const t={frameStyle:void 0,x:0,y:0,width:"100%",height:"100%",disableStyle:["backgroundColor","strokeColor","strokeWidth"]};return y(e)?t.frameStyle=e:Object.assign(t,e),t})],["metadata"],["state",hs((e,t,o)=>{const i=Is.map(e=>t[e]);let n=!1;const r=ls({}),{subscribe:a}=cs([...i,r],(e,t)=>{if(n)return;const o=Is.reduce((t,o,i)=>(t[o]=Es(e[i]),t),{});o.crop&&Et(o.crop,Math.round),o.manipulation=o.manipulation&&As(o.manipulation),o.redaction=o.redaction&&As(o.redaction),o.annotation=o.annotation&&As(o.annotation),o.decoration=o.decoration&&As(o.decoration),o.selection=o.selection&&As(o.selection),t(o)}),s=e=>{e&&(n=!0,o.cropOrigin=void 0,Is.filter(t=>jo(e,t)).forEach(t=>{const i=e[t];o[t]=null===i?void 0:Es(i)}),n=!1,r.set({}))};return{set:s,update:e=>s(e(null)),subscribe:a}})]],_s=async(e,t,i={},n)=>{const{ontaskstart:r,ontaskprogress:a,ontaskend:s,token:l}=n;let c=!1;const d={cancel:o};l.cancel=()=>{c=!0,d.cancel()};for(const[o,n]of t.entries()){if(c)return;const[t,l]=n;r(o,l);try{e=await t(e,{...i,taskCancelToken:d},e=>a(o,l,e))}catch(e){throw c=!0,e}s(o,l)}return e};const Vs=e=>console.warn(`Pintura: ${e} is a required prop.`),Ns=["loadstart","loadabort","loaderror","loadprogress","load","processstart","processabort","processerror","processprogress","process"],Hs=["flip","cropOrigin","isRotatedSideways","perspective","perspectiveX","perspectiveY","cropRange"],js=["images"],Us=Ws.map(([e])=>e).filter(e=>!Hs.includes(e)),Gs=e=>`image${bs(e)}`,Zs=e=>jo(e,"crop");var Xs=()=>{const{stores:e,accessors:t}=fs(ys),{sub:i,pub:n}=ni(),r=()=>t.images?t.images[0]:{};let a={};const s={};Us.forEach(e=>{Object.defineProperty(t,Gs(e),{get:()=>{const t=r();if(t)return t.accessors[e]},set:t=>{a[Gs(e)]=t,s[Gs(e)]=t;const o=r();o&&(o.accessors[e]=t)}})});const l=()=>t.images&&t.images[0];let c;const d=e.src.subscribe(e=>{if(!e)return t.images=[];t.imageReader?(t.images.length&&(a={}),p(e)):c=setTimeout(()=>Vs("imageReader"),32)}),u=e.imageReader.subscribe(e=>{e&&(clearTimeout(c),t.images.length||t.src&&p(t.src))}),p=e=>{Promise.resolve().then(()=>m(e,a)).catch(()=>{})};let h;const m=(e,i={})=>new Promise((r,c)=>{let d=l();const u=!(!1===i.cropLimitToImage||!1===i.imageCropLimitToImage||!1===s.imageCropLmitedToImage),p=i.cropMinSize||i.imageCropMinSize||s.imageCropMinSize,m=u?p:d&&d.accessors.cropMinSize,g=i.minDuration||i.imageMinDuration;d&&$(),d=(({minSize:e={width:1,height:1},minDuration:t=0}={})=>{const{stores:i,accessors:n}=fs(Ws),{pub:r,sub:a}=ni(),s=(e,t)=>{const o=()=>n[e]||{},i=t=>{n[e]={...o(),...t,timeStamp:Date.now()}},a=()=>o().error,s=e=>{a()||(i({error:e}),r(`${t}error`,{...o()}))};return{start(){r(`${t}start`)},onabort(){i({abort:!0}),r(`${t}abort`,{...o()})},ontaskstart(e,n){a()||(i({index:e,task:n,taskProgress:void 0,taskLengthComputable:void 0}),r(`${t}taskstart`,{...o()}))},ontaskprogress(e,n,s){a()||(i({index:e,task:n,taskProgress:s.loaded/s.total,taskLengthComputable:s.lengthComputable}),r(`${t}taskprogress`,{...o()}),r(`${t}progress`,{...o()}))},ontaskend(e,n){a()||(i({index:e,task:n}),r(`${t}taskend`,{...o()}))},ontaskerror(e){s(e)},error(e){s(e)},beforeComplete(e){a()||(i({beforeComplete:!0}),r(`before${t}`,e))},complete(e){a()||(i({complete:!0}),r(t,e))}}};return xs(n,{read:(i,{reader:r},a={})=>{if(!r)return;Object.assign(n,{file:void 0,size:void 0,loadState:void 0});let l={cancel:o},c=!1;const d=s("loadState","load"),u={token:l,...d},p={src:i,size:void 0,dest:void 0,duration:void 0};return Promise.resolve().then(async()=>{try{if(d.start(),c)return d.onabort();const o=await _s(p,r,a,u);if(c)return d.onabort();const{size:i,duration:s,dest:l}=o||{};if(!i||!i.width||!i.height)throw new fo("Image size missing","IMAGE_SIZE_MISSING",o);if(s>0&&s<t)throw new fo("Video too short","VIDEO_TOO_SHORT",{...o,minDuration:t});if(i.width<e.width||i.height<e.height)throw new fo("Image too small","IMAGE_TOO_SMALL",{...o,minWidth:e.width,minHeight:e.height});Object.assign(n,{file:l,size:i,duration:s}),d.beforeComplete(o),d.complete(o)}catch(e){d.error(e)}finally{l=void 0}}),()=>{c=!0,l&&l.cancel(),d.onabort()}},write:(e,t)=>{if(!n.loadState.complete)return;n.processState=void 0;const i=s("processState","process"),r={src:n.file,imageState:n.state,dest:void 0};if(L(e)&&(e=e(n.file,n.state)),!e)return i.start(),void i.complete(r);let a={cancel:o},l=!1;const c=t,d={token:a,...i};return Promise.resolve().then(async()=>{try{if(i.start(),l)return i.onabort();const t=await _s(r,e,c,d);if(l)return i.onabort();i.complete(t)}catch(e){i.error(e)}finally{a=void 0}}),()=>{l=!0,a&&a.cancel(),i.onabort()}},on:a}),{accessors:n,stores:i}})({minSize:m,minDuration:g}),Ns.map(e=>{return d.accessors.on(e,(t=e,e=>n(t,e)));var t});const f=()=>{a={},y.forEach(e=>e())},y=[];y.push(d.accessors.on("loaderror",e=>{f(),c(e)})),y.push(d.accessors.on("loadabort",()=>{f(),c({name:"AbortError"})})),y.push(d.accessors.on("load",e=>{h=void 0,f(),r(e)})),y.push(d.accessors.on("beforeload",()=>((e,o)=>{if(Zs(o))return void(t.imageState=o);if(!o.imageCrop){const t=e.accessors.size,i=o.imageRotation||0,n=Ke(Ne(t),i),r=st(n);r.width=ge(Math.abs(r.width),6),r.height=ge(Math.abs(r.height),6);const a=o.imageCropAspectRatio||(o.imageCropLimitToImage?vt(t):vt(r));let s;o.imageCropLimitToImage?s=Pt(r,a):(s=Mt(r,a),s.x=(t.width-s.width)/2,s.y=(t.height-s.height)/2),o.imageCrop=s}if(e.accessors.duration&&!o.imageTrim&&o.imageMaxDuration){const{duration:t}=e.accessors;o.imageTrim=[[0,Math.min(o.imageMaxDuration/t,1)]]}const i=["imageCropLimitToImage","imageCrop","imageCropAspectRatio","imageRotation"];i.filter(e=>jo(o,e)).forEach(e=>{t[e]=o[e],delete o[e]});const n=Object.keys(o).filter(e=>!i.includes(e)).reduce((e,t)=>(e[t]=o[t],e),{});Object.assign(t,n)})(d,i))),t.images=[d],i.imageReader&&(t.imageReader=i.imageReader),i.imageWriter&&(t.imageWriter=i.imageWriter),h=d.accessors.read(e,{reader:t.imageReader},{willRequest:t.willRequest})});let g;const $=()=>{const e=l();e&&(h&&h(),e.accessors.loadState=void 0,t.images=[])};return Object.defineProperty(t,"stores",{get:()=>e}),xs(t,{on:i,loadImage:m,abortLoadImage:()=>{h&&h(),t.images=[]},editImage:(e,o)=>new Promise((i,n)=>{m(e,o).then(()=>{const{images:e}=t,o=e[0],r=()=>{a(),s()},a=o.accessors.on("processerror",e=>{r(),n(e)}),s=o.accessors.on("process",e=>{r(),i(e)})}).catch(n)}),removeImage:$,processImage:(e,o)=>new Promise((i,n)=>{try{const r=[],a=()=>{r.forEach(e=>e())};(async()=>{if((e=>y(e)||Ko(e)||Yt(e))(e))try{await m(e,o)}catch(e){n(e)}else e&&(Zs(e)?t.imageState=e:Object.assign(t,e));const s=l();if(!s)return n("no image");r.push(s.accessors.on("processerror",e=>{a(),n(e)})),r.push(s.accessors.on("processabort",()=>{a(),n({name:"AbortError"})})),r.push(s.accessors.on("process",e=>{g=void 0,a(),i(e)})),g=s.accessors.write(t.imageWriter,{redactionRenderStyle:t.imageRedactionRendering,shapePreprocessor:t.shapePreprocessor||ee,imageScrambler:t.imageScrambler,willRequest:t.willRequest,csp:t.csp||{},willRequestResource:t.willRequestResource})})()}catch(e){n(e)}}),abortProcessImage:()=>{const e=l();e&&(g&&g(),e.accessors.processState=void 0)},destroy:()=>{d&&d(),u&&u()}}),t};const Ys=(e,t)=>{const{processImage:o}=Xs();return o(e,t)};var qs=()=>no()?To()?/15_|16_/.test(navigator.userAgent)?14745600:16777216:/15_/.test(navigator.userAgent)?16777216:1/0:1/0,Ks=(e,t)=>Object.keys(e).filter(e=>!t.includes(e)).reduce((t,o)=>(t[o]=e[o],t),{}),Js=e=>new Promise(t=>{if(e.duration===1/0)return e.ontimeupdate=()=>{e.ontimeupdate=void 0,t(e)},void(e.currentTime=Number.MAX_SAFE_INTEGER);t(e)});const Qs=e=>new Promise(t=>{const o=new FileReader;o.onload=()=>t(o.result),o.readAsArrayBuffer(e)}),el=1836476516,tl=(e,t=0,o=e.byteLength)=>{const i=[],n=t+o;for(;t<n;){const o=e.getUint32(t);if(o<0)break;const n=e.getUint32(t+4);if(i.push({type:n,size:o,offset:t,bodyOffset:t+8,bodySize:o-8}),o<8)break;t+=o}return i},ol=(e,{limit:t=1024}={})=>{let o=0;o+=4;if(1718909296!==e.getUint32(o))return 0;o+=4;const i=e.getUint32(o);return 1836069938===i?((e,t,o)=>{let i=!1,n=-1;for(let r=t;r<o;r++)if(i||1953653099!==e.getUint32(r)||(i=!0,r+=4),i&&64==e.getUint8(r)){n=r;break}if(n<0)return 0;const r=e.getUint32(n-28),a=e.getUint32(n-20),s=e.getUint32(n-32),l=e.getUint32(n-16);return 65536===r&&4294901760===a?90:4294901760===s&&4294901760===l?180:4294901760===r&&65536===a?270:0})(e,o,t):1903435808===i?(e=>{const t=tl(e).find(e=>1836019574===e.type);if(!t)return 0;const o=tl(e,t.bodyOffset,t.bodySize);o.filter(e=>1953653099===e.type).forEach(t=>{o.push(...tl(e,t.bodyOffset,t.bodySize))});const i=[el,1953196132],n=o.filter(e=>i.includes(e.type));for(const{type:t,bodyOffset:o}of n){const i=e.getUint8(o);let n=o+4;n+=t===el?32:36,n+=1===i?12:0;const r=e.getInt32(n),a=e.getInt32(n+4);if(0===r&&a>0)return 90;if(r<0&&0===a)return 180;if(0===r&&a<0)return 270}return 0})(e):0};var il=e=>new Promise((t,o)=>{(N()?(async e=>{const t=await Qs(e),o=new DataView(t);return ol(o)})(e):Promise.resolve(0)).then(i=>{const n=document.createElement("video");n.onerror=()=>o(n.error),n.playsInline=!0,n.preload="auto",n.onseeked=()=>{n.onseeked=void 0,t(n)},n.onloadeddata=()=>{n.onloadeddata=void 0,n.dataset.rotation=i?`${i}`:"0",Js(n).then(t),n.currentTime=0},To()&&no()?(n.srcObject=e,n.load()):n.src=URL.createObjectURL(e)})}),nl=(e,t)=>new Promise(o=>{if(e.currentTime===t)return o(e);let i=e.onseeked;e.onseeked=()=>{e.onseeked=i,o(e)},e.currentTime=Rs(t,0,e.duration)}),rl=(e,t=0)=>new Promise((o,i)=>{il(e).then(e=>{nl(e,t).then(e=>{const t=x("canvas");ao(e).then(({width:i,height:n})=>{t.width=i,t.height=n;const r=t.getContext("2d",{willReadFrequently:!0}),a=()=>{r.drawImage(e,0,0,t.width,t.height);const i=r.getImageData(0,0,t.width,t.height);S(t),URL.revokeObjectURL(e.src),o(i)};no()?setTimeout(a,16):a()})})})}),al=e=>/video/.test(e.type);let sl=null;const ll=({imageDataResizer:e,canvasMemoryLimit:t}={})=>async(o,i,n,r,a)=>{n.width=Math.max(n.width,1),n.height=Math.max(n.height,1),r.width=Math.max(r.width,1),r.height=Math.max(r.height,1);const{dest:s}=await Ys(i,{imageReader:Ol(),imageWriter:Wl({format:"canvas",targetSize:{...r,upscale:!0},imageDataResizer:e,canvasMemoryLimit:t}),imageCrop:n}),{feather:l=0}=a||{};if(l>0){const e=x("canvas");e.width=s.width,e.height=s.height;const t=e.getContext("2d",{willReadFrequently:!0}),o=1/l;let i=0;for(i=0;i<l;i++){const e=i*o;t.strokeStyle=`rgba(0,0,0,${e*e})`,t.strokeRect(i+.5,i+.5,s.width-2*i-1,s.height-2*i-1)}t.fillStyle="#000",t.fillRect(i,i,s.width+.5-2*i,s.height+.5-2*i);const n=s.getContext("2d");n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),S(e)}o.drawImage(s,r.x,r.y,r.width,r.height),S(s)},cl=(e,t=(...e)=>e,o)=>async(i,n,r)=>{r(ho(0,!1));let a=!1;const s=await e(...t(i,n,e=>{a=!0,r(e)}));return o&&o(i,s),a||r(ho(1,!1)),i},dl=({willRequest:e,srcProp:t="src",destProp:o="dest"}={})=>[cl(So,(o,i,n)=>[o[t],n,{...i,willRequest:e}],(e,t)=>e[o]=t),"any-to-file"],ul=({srcProp:e="dest",destProp:t="dest"}={})=>[cl(async e=>{if(/octet-stream/.test(e.type)){console.warn(`Pintura: File has unknown mime type "${e.type}", make sure your server sets the correct Content-Type header.`);let t="image";const o=await lo(e);/video/i.test(o.nodeName)&&(t="video");const i={type:t+"/unknown"};return qt(e)?new File([e],e.name,{...i,lastModified:e.lastModified}):new Blob([e],i)}return e},t=>[t[e]],(e,o)=>e[t]=o),"guard-mimetype"],pl=({srcProp:e="src",destProp:t="size"}={})=>[cl(uo,t=>[t[e]],(e,o)=>e[t]=o),"read-image-size"],hl=async e=>{const t=await lo(e);if(co(t))return await(e=>new Promise((t,o)=>{const i=()=>{Js(e).then(()=>{t(e.duration)})};if(e.readyState>=1)return i();e.onloadedmetadata=i,e.onerror=()=>o(e.error)}))(t)},ml=({srcProp:e="src",destProp:t="duration"}={})=>[cl(hl,t=>[t[e]],(e,o)=>e[t]=o),"read-media-duration"],gl=({srcSize:e="size",srcOrientation:t="orientation",destSize:o="size"}={})=>[cl(Mo,o=>[o[e],o[t]],(e,t)=>e[o]=t),"image-size-match-orientation"],$l=({srcProp:e="src",destProp:t="copy"}={})=>[cl((e,t)=>Po(e)?u(e,t):void 0,t=>[t[e],onprogress],(e,o)=>{o&&(e[t]=o)}),"read-image-head"],fl=({srcProp:e="copy",orientationProp:t="orientation",colorSpaceProp:o="colorSpace"}={})=>[cl((e,t)=>{if(e)return s(e,t)},t=>[t[e],{exif:[n],app2:[r]}],(e,i)=>{i&&(e[t]=i.exif&&i.exif[274]||1,e[o]=(i.app2&&i.app2[r]||"sRGB").toLowerCase())}),"read-image-head-tags"],yl=({srcProp:e="copy"}={})=>[cl((e,t)=>{if(e)return((e,t)=>{const o=a(e);o&&Object.entries(t).forEach(([e,t])=>{if(!o[e])return;const i=o[e].getTags();i&&t.forEach(([e,t])=>{i.write(e,t)})})})(e,t)},t=>[t[e],{exif:[[n,1]]}]),"clear-exif-orientation-tag"],bl=({srcImageSize:e="size",srcCanvasSize:t="imageData",srcImageState:o="imageState",destImageSize:i="size",destScalar:n="scalar"}={})=>[cl((e,t)=>[Math.min(t.width/e.width,t.height/e.height),He(t)],i=>[i[e],i[t],i[o]],(e,[t,o])=>{e[n]=t,e[i]=o}),"calculate-canvas-scalar"],xl=({srcProp:e="src",destProp:t="imageData",canvasMemoryLimit:o,colorSpaceProp:i="colorSpace",srcImageState:n="imageState"}={})=>[cl((e,t,o,i)=>al(e)?rl(e,i.currentTime):j(e,{canvasMemoryLimit:t,colorSpace:o}),t=>[t[e],o,t[i],t[n]],(e,o)=>e[t]=o),"blob-to-image-data"],vl=({srcImageData:e="imageData",srcOrientation:t="orientation"}={})=>[cl(R,o=>[o[e],o[t]],(e,t)=>e.imageData=t),"image-data-match-orientation"],Sl=({srcImageData:e="imageData",srcImageState:t="imageState"}={})=>[cl(lr,o=>{const{colorMatrix:i}=o[t],n=i&&Object.keys(i).map(e=>i[e]).filter(Boolean);return[o[e],{backgroundColor:o[t].backgroundColor,backgroundImage:o[t].backgroundImage,backgroundFilterMode:o[t].backgroundFilterMode,colorMatrix:n&&cr(n),convolutionMatrix:o[t].convolutionMatrix,gamma:o[t].gamma,noise:o[t].noise,vignette:o[t].vignette}]},(e,t)=>e.imageData=t),"image-data-fill"],wl=({srcImageData:e="imageData",srcImageState:t="imageState",destScalar:o="scalar"}={})=>[cl(Ao,i=>{const n=i[o];let{crop:r}=i[t];return r&&1!==n&&(r=$t(rt(r),n,ye())),[i[e],{crop:r,rotation:i[t].rotation,flipX:i[t].flipX,flipY:i[t].flipY}]},(e,t)=>e.imageData=t),"image-data-crop"],kl=({targetSize:e={width:void 0,height:void 0,fit:void 0,upscale:void 0},imageDataResizer:t,srcProp:o="imageData",srcImageState:i="imageState",destImageScaledSize:n="imageScaledSize"})=>[cl(zo,n=>{const r=Math.min(e.width||Number.MAX_SAFE_INTEGER,n[i].targetSize&&n[i].targetSize.width||Number.MAX_SAFE_INTEGER),a=Math.min(e.height||Number.MAX_SAFE_INTEGER,n[i].targetSize&&n[i].targetSize.height||Number.MAX_SAFE_INTEGER);return[n[o],{width:r,height:a,fit:e.fit||"contain",upscale:(s=n[i],!!(s.targetSize&&s.targetSize.width||s.targetSize&&s.targetSize.height)||(e.upscale||!1))},t];var s},(e,t)=>{Xe(e.imageData,t)||(e[n]=He(t)),e.imageData=t}),"image-data-resize"],Cl=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData"}={})=>[cl(Vo,o=>{const{colorMatrix:i}=o[t],n=i&&Object.keys(i).map(e=>i[e]).filter(Boolean);return[o[e],{colorMatrix:n&&cr(n),convolutionMatrix:o[t].convolutionMatrix,gamma:o[t].gamma,noise:o[t].noise,vignette:o[t].vignette}]},(e,t)=>e[o]=t),"image-data-filter"],Tl=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destScalar:i="scalar"}={})=>[cl(async(e,t,o,i,n,r)=>{if(!t||!i.length)return e;let a;try{const n={dataSizeScalar:dr(e,i)};o&&o[3]>0&&(n.backgroundColor=[...o]),a=await t(e,n)}catch(e){}const s=x("canvas");s.width=e.width,s.height=e.height;const l=s.getContext("2d",{willReadFrequently:!0,colorSpace:e.colorSpace});if(l.putImageData(e,0,0),"auto"===r){const t=Math.sqrt(e.width*e.height);l.filter=`blur(${Math.round(t/100)}px)`}const c=new Path2D;i.forEach(e=>{const t=ht(e.x,e.y,e.width,e.height);bt(t,n);const o=kt(rt(t),e.rotation),i=new Path2D;o.forEach((e,t)=>{if(0===t)return i.moveTo(e.x,e.y);i.lineTo(e.x,e.y)}),c.addPath(i)}),l.clip(c,"nonzero"),l.imageSmoothingEnabled=!1,l.drawImage(a,0,0,s.width,s.height),S(a);const d=l.getImageData(0,0,s.width,s.height);return S(s),d},(o,{imageScrambler:n,redactionRenderStyle:r})=>[o[e],n,o[t].backgroundColor,o[t].redaction,o[i],r],(e,t)=>e[o]=t),"image-data-redact"],Ml=({srcImageData:e="imageData",srcSize:t="size",srcImageState:o="imageState",srcShapes:i="annotation",destImageData:n="imageData",destImageScaledSize:r="imageScaledSize",destScalar:a="scalar",imageDataResizer:s,canvasMemoryLimit:l,shapeFilter:c=ee,shapeClip:d=!0,destImageContext:u="imageContext"}={})=>[cl(sr,(n,{shapePreprocessor:p,willRequestResource:h,csp:m,willRequest:g})=>{const $=n[o][i].filter(c);if(!$.length)return[n[e]];const f=n[a],{crop:y}=n[o],b=n[t];let x=f;const v=n[r];v&&(x=Math.min(v.width/y.width,v.height/y.height));const S={width:b.width/f,height:b.height/f};return[n[e],{shapes:$,computeShape:e=>(e=An(e,S),e=Ks(e,["left","right","top","bottom"]),e=_n(e,x)),transform:e=>{const i=n[t],{rotation:a=0,flipX:s,flipY:l,cropLimitToImage:c}=n[o],{crop:p=st(i)}=n[o];let h=1;h=n[r]?x:f;const m={width:i.width/f*h,height:i.height/f*h},g=Xt(m,a),$=g.width,y=g.height,b=.5*m.width-.5*$,v=.5*m.height-.5*y,S=qe(m);e.translate(-b,-v),e.translate(-p.x*h,-p.y*h),e.translate(S.x,S.y),e.rotate(a),e.translate(-S.x,-S.y);const w=n[u]||{x:0,y:0};e.translate(w.x,w.y),e.scale(s?-1:1,l?-1:1),e.translate(s?-m.width*f:0,l?-m.height*f:0),c&&d&&(e.rect(0,0,m.width,m.height),e.clip())},drawImage:ll({imageDataResizer:s,canvasMemoryLimit:l}),preprocessShape:e=>p(e,{isPreview:!1,...n[o]}),canvasMemoryLimit:l,willRequest:g||h,styleNonce:m.styleNonce}]},(e,t)=>e[n]=t),"image-data-annotate"],Pl=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destImageScaledSize:i="imageScaledSize",imageDataResizer:n,canvasMemoryLimit:r,destScalar:a="scalar",shapeFilter:s=ee,destImageContext:l="imageContext"}={})=>[cl(sr,(o,{shapePreprocessor:c,willRequestResource:d,willRequest:u,csp:p})=>{let h=o[t].decoration.filter(s);if("undefined"!=typeof window&&(e=>{if(e&&e._3so2s47)return;const[i]=[[85,110,108,105,99,101,110,115,101,100,32,80,105,110,116,117,114,97,32,105,110,115,116,97,110,99,101,32]].map(e=>e.map(e=>String.fromCharCode(e)).join("")),{width:n,height:r}=o[t].crop,a=r/15;h=[...h,{x:.5*-a,y:.5*-a,width:1.5*n,height:1.25*r,text:Array(50).fill(i).join(""),fontWeight:900,lineHeight:a,fontSize:a,color:[1,1,1,.05]}]})(window),!h.length)return[o[e]];let m=o[a];const{crop:g}=o[t],$=o[i];if($){const e=Math.min($.width/g.width,$.height/g.height);m=e}return[o[e],{shapes:h,drawImage:ll({imageDataResizer:n,canvasMemoryLimit:r}),computeShape:e=>(e=An(e,g),e=Ks(e,["left","right","top","bottom"]),e=_n(e,m)),preprocessShape:e=>c(e,{isPreview:!1,...o[t]}),canvasMemoryLimit:r,willRequest:u||d,styleNonce:p.styleNonce,transform:e=>{const t=o[l]||{x:0,y:0};e.translate(t.x,t.y)}}]},(e,t)=>e[o]=t),"image-data-decorate"],Rl=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destImageScaledSize:i="imageScaledSize",imageDataResizer:n,canvasMemoryLimit:r,destScalar:a="scalar",destImageContext:s="imageContext"}={})=>[cl((e,t)=>new Promise(o=>{if(!t)return o([e]);sr(e,t).then(e=>{o([e,t.contextBounds])})}),(o,{shapePreprocessor:s,willRequestResource:l,willRequest:c,csp:d})=>{const u=o[t].frame;if(!u)return[o[e]];const p=o[a];let{crop:h}=o[t];h&&1!==p&&(h=$t(rt(h),p,ye()));const m={...h},g=On(Bn(u,m,s),m);m.x=Math.abs(g.left),m.y=Math.abs(g.top),m.width+=Math.abs(g.left)+Math.abs(g.right),m.height+=Math.abs(g.top)+Math.abs(g.bottom);const $=o[i],f=$?$.width/h.width:1,y=$?$.height/h.height:1;return m.x*=f,m.y*=y,m.width*=f,m.height*=y,m.x=Math.round(m.x),m.y=Math.round(m.y),m.width=Math.round(m.width),m.height=Math.round(m.height),$&&(Math.abs(m.width-$.width)<=1&&(m.width=$.width),Math.abs(m.height-$.height)<=1&&(m.height=$.height)),[o[e],{shapes:[u],contextBounds:m,computeShape:t=>An(t,o[e]),transform:e=>{e.translate(m.x,m.y)},drawImage:ll({imageDataResizer:n,canvasMemoryLimit:r}),preprocessShape:e=>s(e,{isPreview:!1,...o[t]}),canvasMemoryLimit:r,willRequest:c||l,styleNonce:d.styleNonce}]},(e,[t,i])=>{e[s]=i,e[o]=t}),"image-data-frame"],Il=({mimeType:e,quality:t,srcImageData:o="imageData",srcFile:i="src",destBlob:n="blob"}={})=>[cl(G,n=>[n[o],e||K(n[i].name)||n[i].type,t],(e,t)=>e[n]=t),"image-data-to-blob"],El=({srcImageData:e="imageData",srcOrientation:t="orientation",destCanvas:o="dest"}={})=>[cl(P,o=>[o[e],o[t]],(e,t)=>e[o]=t),"image-data-to-canvas"],Al=async(e,t,o)=>{if(!Po(e)||!t)return e;const i=/p3/i.test(o),n=(e,t)=>{let o=2;const i=new DataView(e),n=i.byteLength;for(t(i.getUint8(0),0,2,n);o<n&&255==i.getUint8(o);){const e=i.getUint8(o+1),r=i.getUint16(o+2)+2;if(!1===t(e,o,r,n))break;o+=r}},r=e=>e>=224&&e<=237,a=(e=>{const t=[];return n(e,(o,n,a)=>{if(218===o)return!1;if(r(o)){if(226===o){if(!i)return!1;if(null===sl&&(sl=void 0!==new ImageData(1,1).colorSpace),!sl)return!1}t.push(new Uint8Array(e,n,a))}}),t})(t),s=((e,t)=>{const o=[];n(e,(i,n,a,s)=>0===n?(o.push(new Uint8Array(e,n,a)),void o.push(...t)):218===i?(o.push(new Uint8Array(e,n,s-n)),!1):void(r(i)||o.push(new Uint8Array(e,n,a))));let i=o.reduce((e,t)=>e+t.length,0),a=new Uint8Array(i),s=0;return o.forEach(e=>{a.set(e,s),s+=e.length}),a})(await u(e),a);return new Blob([s],{type:"image/jpeg"})},Ll=(e="blob",t="copy",o="colorSpace",i="blob")=>[cl((e,t,o)=>{if(t)return Al(e,t,o)},i=>[i[e],i[t],i[o]],(e,t)=>{t&&(e[i]=t)}),"blob-write-image-head"],Fl=({renameFile:e,srcBlob:t="blob",srcFile:o="src",destFile:i="dest",defaultFilename:n}={})=>[cl(J,i=>[i[t],e?e(i[o]):i[o].name||`${n}.${X(i[t].type)}`],(e,t)=>e[i]=t),"blob-to-file"],zl=({url:e="./",dataset:t=e=>[["dest",e.dest,e.dest.name],["imageState",e.imageState]],destStore:i="store",credentials:n,headers:r={}})=>[cl(async(t,i)=>await((e,t,i)=>new Promise((n,r)=>{const{token:a={},beforeSend:s=o,onprogress:l=o}=i;a.cancel=()=>c.abort();const c=new XMLHttpRequest;c.upload.onprogress=l,c.onload=()=>c.status>=200&&c.status<300?n(c):r(c),c.onerror=()=>r(c),c.ontimeout=()=>r(c),c.open("POST",encodeURI(e)),s(c),c.send(t instanceof FormData?t:t.reduce((e,t)=>(e.append(...t.map(Ro)),e),new FormData))}))(e,t,{onprogress:i,beforeSend:e=>yo(e,{headers:r,credentials:n})}),(e,o,i)=>[t(e),i],(e,t)=>e[i]=t),"store"],Dl=e=>[cl(t=>e&&e.length?(Object.keys(t).forEach(o=>{e.includes(o)||delete t[o]}),t):t),"prop-filter"],Ol=(e={})=>{const{orientImage:t=!0,outputProps:o=["src","dest","size","duration"],preprocessImageFile:i,request:n={}}=e;return[dl({willRequest:()=>n}),ul(),i&&[cl(i,(e,t,o)=>[e.dest,t,o],(e,t)=>e.dest=t),"preprocess-image-file"],pl({srcProp:"dest"}),ml({srcProp:"dest"}),t&&$l({srcProp:"dest"}),t&&fl(),t&&gl(),Dl(o)].filter(Boolean)},Bl=e=>e&&(y(e)?zl({url:e}):L(e)?[e,"store"]:zl(e)),Wl=(e={})=>(t,o,i={})=>{let{canvasMemoryLimit:n=qs(),orientImage:r=!0,copyImageHead:a=!0,mimeType:s,quality:l,renameFile:c,targetSize:d,imageDataResizer:u,store:p,format:h="file",outputProps:m=["src","dest","imageState","store"],preprocessImageSource:g,preprocessImageState:$,postprocessImageData:f,postprocessImageBlob:y,testSrcSupport:b=!1}={...e,...i};if(!b||so(t))return"blob"===h&&(h="file"),[g&&[cl(g,(e,t,o)=>[e.src,t,o,e.imageState],(e,t)=>e.src=t),"preprocess-image-source"],(r||a)&&$l(),fl(),pl(),$&&[cl($,(e,t,o,i)=>[e.imageState,t,o,{size:e.size,orientation:e.orientation}],(e,t)=>e.imageState=t),"preprocess-image-state"],xl({canvasMemoryLimit:n}),r&&gl(),r&&vl(),bl(),Tl(),wl(),kl({imageDataResizer:u,targetSize:d}),Ml({imageDataResizer:u,canvasMemoryLimit:n,srcShapes:"manipulation"}),Cl(),Sl(),Ml({imageDataResizer:u,canvasMemoryLimit:n,srcShapes:"annotation",shapeFilter:e=>!e.aboveFrame}),Pl({imageDataResizer:u,canvasMemoryLimit:n,shapeFilter:e=>!e.aboveFrame}),Rl({imageDataResizer:u,canvasMemoryLimit:n}),Ml({imageDataResizer:u,canvasMemoryLimit:n,srcShapes:"annotation",shapeFilter:e=>e.aboveFrame,shapeClip:!1}),Pl({imageDataResizer:u,canvasMemoryLimit:n,shapeFilter:e=>e.aboveFrame}),f&&[cl(f,(e,t,o)=>[e.imageData,t,o],(e,t)=>e.imageData=t),"postprocess-image-data"],"file"===h?Il({mimeType:s,quality:l}):"canvas"===h?El():[e=>(e.dest=e.imageData,e)],"file"===h&&r&&yl(),"file"===h&&a&&Ll(),y&&[cl(y,({blob:e,imageData:t,src:o},i,n)=>[{blob:e,imageData:t,src:o},i,n],(e,t)=>e.blob=t),"postprocess-image-file"],"file"===h&&Fl({defaultFilename:"image",renameFile:c}),"file"===h?Bl(p):L(p)&&[p,"store"],Dl(m)].filter(Boolean)};var _l=(e,t,o,i,n,r,a,s,l,c,d)=>{if(!(e&&t&&o&&i&&s))return;s*=r;const u=Lt(rt(t)),p=mt(u),h=mt(e),m=st(o),g=mt(m),$=Ps(o,i,l),f=mt($),y=Ie(ve(g),f),b=Ie(ve(h),p);y.x+=b.x,y.y+=b.y;const x=Se(ve(y));x.x+=b.x,x.y+=b.y;const v=mt(gt(gt(rt(n),a),e)),S=Ie(v,h);return Re(y,S),{origin:x,translation:y,rotation:{x:d?Math.PI:0,y:c?Math.PI:0,z:l},scale:s}};let Vl=null;var Nl=()=>{if(null===Vl)if("WebGL2RenderingContext"in window){let e;try{e=x("canvas"),Vl=!!e.getContext("webgl2")}catch(e){Vl=!1}e&&S(e),e=void 0}else Vl=!1;return Vl},Hl=e=>!(e&e-1),jl=(e,t={},o="",i="")=>Object.keys(t).filter(e=>!I(t[e])).reduce((e,n)=>e.replace(new RegExp(o+n+i),t[n]),e);const Ul={head:"#version 300 es\n\nin vec4 aPosition;uniform mat4 uMatrix;",text:"\nin vec2 aTexCoord;out vec2 vTexCoord;",matrix:"\ngl_Position=uMatrix*vec4(aPosition.x,aPosition.y,0,1);"},Gl={head:"#version 300 es\nprecision highp float;\n\nout vec4 fragColor;",mask:"\nuniform float uMaskFeather[8];uniform float uMaskBounds[4];uniform float uMaskOpacity;float mask(float x,float y,float bounds[4],float opacity){return 1.0-(1.0-(smoothstep(bounds[3],bounds[3]+1.0,x)*(1.0-smoothstep(bounds[1]-1.0,bounds[1],x))*(1.0-step(bounds[0],y))*step(bounds[2],y)))*(1.0-opacity);}",init:"\nfloat a=1.0;vec4 fillColor=uColor;vec4 textureColor=texture(uTexture,vTexCoord);textureColor*=(1.0-step(uRepeat.y,vTexCoord.y))*step(0.0,vTexCoord.y)*(1.0-step(uRepeat.x,vTexCoord.x))*step(0.0,vTexCoord.x);",colorize:"\nif(uTextureColor.a!=0.0&&textureColor.a>0.0){vec3 colorFlattened=textureColor.rgb/textureColor.a;if(colorFlattened.r>=.9999&&colorFlattened.g==0.0&&colorFlattened.b>=.9999){textureColor.rgb=uTextureColor.rgb*textureColor.a;}textureColor*=uTextureColor.a;}",maskapply:"\nfloat m=mask(gl_FragCoord.x,gl_FragCoord.y,uMaskBounds,uMaskOpacity);",maskfeatherapply:"\nfloat leftFeatherOpacity=step(uMaskFeather[1],gl_FragCoord.x)*uMaskFeather[0]+((1.0-uMaskFeather[0])*smoothstep(uMaskFeather[1],uMaskFeather[3],gl_FragCoord.x));float rightFeatherOpacity=(1.0-step(uMaskFeather[7],gl_FragCoord.x))*uMaskFeather[4]+((1.0-uMaskFeather[4])*smoothstep(uMaskFeather[7],uMaskFeather[5],gl_FragCoord.x));a*=leftFeatherOpacity*rightFeatherOpacity;",rectaa:"\nvec2 scaledPoint=vec2(vRectCoord.x*uSize.x,vRectCoord.y*uSize.y);a*=smoothstep(0.0,uEdgeFeather,uSize.x-scaledPoint.x);a*=smoothstep(0.0,uEdgeFeather,uSize.y-scaledPoint.y);a*=smoothstep(0.0,uEdgeFeather,scaledPoint.x);a*=smoothstep(0.0,uEdgeFeather,scaledPoint.y);",cornerradius:"\nvec2 s=(uSize-2.0)*.5;vec2 r=(vRectCoord*uSize)-1.0;vec2 p=r-s;float cornerRadius=uCornerRadius[0];bool left=r.x<s.x;bool top=r.y<s.y;if(!left&&top){cornerRadius=uCornerRadius[1];}if(!left&&!top){cornerRadius=uCornerRadius[3];}if(left&&!top){cornerRadius=uCornerRadius[2];}a*=1.0-clamp(length(max(abs(p)-(s-cornerRadius),0.0))-cornerRadius,0.0,1.0);",fragcolor:"\nif(m<=0.0)discard;fillColor.a*=a;fillColor.rgb*=fillColor.a;fillColor.rgb*=m;fillColor.rgb+=(1.0-m)*(uCanvasColor.rgb*fillColor.a);textureColor*=uTextureOpacity;textureColor.a*=a;textureColor.rgb*=m*a;textureColor.rgb+=(1.0-m)*(uCanvasColor.rgb*textureColor.a);fragColor=textureColor+(fillColor*(1.0-textureColor.a));"},Zl=(e,t,o)=>{const i=e.createShader(o);if(!i)return null;const n=((e,t,o)=>(t=jl(t,o===e.VERTEX_SHADER?Ul:Gl,"##").trim(),Nl()?t:(t=(t=t.replace(/#version.+/gm,"").trim()).replace(/^\/\/\#/gm,"#"),o===e.VERTEX_SHADER&&(t=t.replace(/in /gm,"attribute ").replace(/out /g,"varying ")),o===e.FRAGMENT_SHADER&&(t=t.replace(/in /gm,"varying ").replace(/out.*?;/gm,"").replace(/texture\(/g,"texture2D(").replace(/fragColor/g,"gl_FragColor")),`${t}`)))(e,t,o);return e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||console.error(e.getShaderInfoLog(i)),i},Xl=(e,t,o,i,n)=>{const r=Zl(e,t,e.VERTEX_SHADER),a=Zl(e,o,e.FRAGMENT_SHADER);if(!r||!a)return null;const s=e.createProgram();e.attachShader(s,r),e.attachShader(s,a),e.linkProgram(s);const l={};return i.forEach(t=>{l[t]=e.getAttribLocation(s,t)}),n.forEach(t=>{l[t]=e.getUniformLocation(s,t)}),{program:s,locations:l,destroy(){e.detachShader(s,r),e.detachShader(s,a),e.deleteShader(r),e.deleteShader(a),e.deleteProgram(s)}}},Yl=e=>"VIDEO"!==e.nodeName&&(!!Nl()||Hl(e.width)&&Hl(e.height)),ql=(e,t,o,i)=>{const{premultiply:n=!0}=i;return e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n),e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o),((e,t,o)=>{e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,Yl(t)?e.LINEAR_MIPMAP_LINEAR:e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o.filterParam),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o.wrapParam),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o.wrapParam),Yl(t)&&e.generateMipmap(e.TEXTURE_2D)})(e,o,i),e.bindTexture(e.TEXTURE_2D,null),t},Kl=(e,t=1)=>e?[e[0],e[1],e[2],No(e[3])?t*e[3]:t]:[0,0,0,0],Jl=()=>{const e=new Float32Array(16);return e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},Ql=(e,t,o,i,n,r,a)=>{const s=1/(t-o),l=1/(i-n),c=1/(r-a);e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+o)*s,e[13]=(n+i)*l,e[14]=(a+r)*c,e[15]=1},ec=(e,t,o,i)=>{e[12]=e[0]*t+e[4]*o+e[8]*i+e[12],e[13]=e[1]*t+e[5]*o+e[9]*i+e[13],e[14]=e[2]*t+e[6]*o+e[10]*i+e[14],e[15]=e[3]*t+e[7]*o+e[11]*i+e[15]},tc=(e,t)=>{e[0]*=t,e[1]*=t,e[2]*=t,e[3]*=t,e[4]*=t,e[5]*=t,e[6]*=t,e[7]*=t,e[8]*=t,e[9]*=t,e[10]*=t,e[11]*=t},oc=(e,t)=>{const o=Math.sin(t),i=Math.cos(t),n=e[4],r=e[5],a=e[6],s=e[7],l=e[8],c=e[9],d=e[10],u=e[11];e[4]=n*i+l*o,e[5]=r*i+c*o,e[6]=a*i+d*o,e[7]=s*i+u*o,e[8]=l*i-n*o,e[9]=c*i-r*o,e[10]=d*i-a*o,e[11]=u*i-s*o},ic=(e,t)=>{const o=Math.sin(t),i=Math.cos(t),n=e[0],r=e[1],a=e[2],s=e[3],l=e[8],c=e[9],d=e[10],u=e[11];e[0]=n*i-l*o,e[1]=r*i-c*o,e[2]=a*i-d*o,e[3]=s*i-u*o,e[8]=n*o+l*i,e[9]=r*o+c*i,e[10]=a*o+d*i,e[11]=s*o+u*i},nc=(e,t)=>{const o=Math.sin(t),i=Math.cos(t),n=e[0],r=e[1],a=e[2],s=e[3],l=e[4],c=e[5],d=e[6],u=e[7];e[0]=n*i+l*o,e[1]=r*i+c*o,e[2]=a*i+d*o,e[3]=s*i+u*o,e[4]=l*i-n*o,e[5]=c*i-r*o,e[6]=d*i-a*o,e[7]=u*i-s*o};var rc=e=>e*Math.PI/180,ac=(e,t)=>Nl()?e.getContext("webgl2",t):e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const sc=(e,t)=>{const o=e.length;return t>=o?e[t%o]:t<0?e[t%o+o]:e[t]},lc=(e,t,o,i)=>{const n=be(o.x-t.x,o.y-t.y),r=be(i.x-o.x,i.y-o.y),a=be(t.x-i.x,t.y-i.y),s=be(e.x-t.x,e.y-t.y),l=be(e.x-o.x,e.y-o.y),c=be(e.x-i.x,e.y-i.y),d=Fe(n,s),u=Fe(r,l),p=Fe(a,c);return d<=0&&u<=0&&p<=0},cc=e=>{if(e.length<3)return[];if((e=>{const t=e.length;for(let o=0;o<t;o++){const t=et(e[o],sc(e,o+1));if(Ot(t,e,{ignoreIdenticalLines:!0,breakOnIntersection:!0}))return!0}return!1})(e))return[];(e=>{let t,o,i,n,r,a=0;const s=e.length;for(t=0;t<s;t++)o=e[t],i=e[(t+1)%s],n=i.x-o.x,r=(i.y+o.y)/2,a+=n*r;return a})(e)<0&&e.reverse();const t=e.length,o=[...Array(t).keys()],i=[];let n,r,a,s,l,c,d,u,p,h,m,g,$=1024;for(;o.length>3;){if($<=0)return[];for($--,n=0;n<o.length;n++)if(a=o[n],s=sc(o,n-1),l=sc(o,n+1),c=e[a],d=e[s],u=e[l],p=be(d.x-c.x,d.y-c.y),h=be(u.x-c.x,u.y-c.y),!(Fe(p,h)<0)){for(m=!0,r=0;r<t;r++)if(r!==a&&r!==s&&r!==l&&(g=e[r],lc(g,d,c,u))){m=!1;break}if(m){i.push([d,c,u]),o.splice(n,1);break}}}return i.push([e[o[0]],e[o[1]],e[o[2]]]),i},dc=(e,t,o,i,n)=>{const r=Ce(be(i.x-o.x,i.y-o.y)),a=Ce(be(n.x-i.x,n.y-i.y)),s=Ce(be(r.x+a.x,r.y+a.y)),l=be(-s.y,s.x),c=be(-r.y,r.x),d=Math.min(1/Le(l,c),5);e[t]=i.x,e[t+1]=i.y,e[t+2]=l.x*d,e[t+3]=l.y*d,e[t+4]=-1,e[t+5]=i.x,e[t+6]=i.y,e[t+7]=l.x*d,e[t+8]=l.y*d,e[t+9]=1},uc=e=>{const t=new Float32Array(8);return t[0]=e[3].x,t[1]=e[3].y,t[2]=e[0].x,t[3]=e[0].y,t[4]=e[2].x,t[5]=e[2].y,t[6]=e[1].x,t[7]=e[1].y,t},pc=(e,t=0,o,i)=>{const n=It(e),r=e.x+.5*e.width,a=e.y+.5*e.height;return(o||i)&&We(n,o,i,r,a),0!==t&&_e(n,t,r,a),n},hc=(e,t,o,i,n)=>{const r=Math.min(20,Math.max(4,Math.round(i/2)));let a=0,s=0,l=0,c=0,d=0;for(;d<r;d++)a=d/r,s=n*oe+a*oe,l=i*Math.cos(s),c=i*Math.sin(s),e.push(be(t+l,o+c))};let mc=null;var gc=()=>{if(null!==mc)return mc;let e=x("canvas");const t=ac(e);return mc=t?t.getParameter(t.MAX_TEXTURE_SIZE):void 0,S(e),e=void 0,mc},$c=()=>m()&&!!window.chrome;const fc=new Float32Array([0,1,0,0,1,1,1,0]),yc=new Float32Array([1,0,0,0,1,1,0,1]),bc=m()&&N(),xc=[0,0,0,0,1,0,0,0,0],vc=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],Sc=[0,0,0,0],wc=[0,0,0,0],kc=(e,t,o,i,n)=>{if(!o||!i)return fc;let r=i.x/o.width,a=i.y/o.height,s=e/o.width/n,l=t/o.height/n;s-=r,l-=a;return new Float32Array([-r,l,-r,-a,s,l,s,-a])};var Cc=(e,t={})=>{const{alpha:i=!1,onContextExhausted:n=o}=t,r={width:0,height:0},a={width:0,height:0},s=gc()||1024;let l,c,d;const u=Jl(),p=Jl();let h,m,g,$,f,y,b,x,v,w=0,k=0,C=0,T=1;const M=new Map([]),P=()=>{E.stencilOp(E.KEEP,E.KEEP,E.KEEP),E.stencilFunc(E.ALWAYS,1,255),E.stencilMask(255)},R=rc(30),I=Math.tan(R/2),E=ac(e,{alpha:i,antialias:!1,premultipliedAlpha:!0,stencil:!0});if(!E)return;E.getExtension("OES_standard_derivatives"),E.disable(E.DEPTH_TEST),E.enable(E.STENCIL_TEST),E.enable(E.BLEND),E.blendFunc(E.ONE,E.ONE_MINUS_SRC_ALPHA),P();const A=E.createTexture();E.bindTexture(E.TEXTURE_2D,A),E.texImage2D(E.TEXTURE_2D,0,E.RGBA,1,1,0,E.RGBA,E.UNSIGNED_BYTE,new Uint8Array(Sc)),M.set(0,A);const L=E.createTexture();M.set(2,L);const F=E.createFramebuffer(),z=E.createTexture();M.set(1,z);const D=E.createFramebuffer(),O=Xl(E,"\n##head\n##text\nvoid main(){vTexCoord=aTexCoord;gl_Position=uMatrix*aPosition;}","\n##head\nin vec2 vTexCoord;uniform sampler2D uTexture;uniform sampler2D uTextureOverlay;uniform sampler2D uTextureBlend;uniform vec2 uTextureSize;uniform float uOpacity;uniform int uAntialias;uniform vec4 uOverlayColor;uniform mat4 uColorMatrix;uniform vec4 uColorOffset;uniform float uClarityKernel[9];uniform float uClarityKernelWeight;uniform float uColorGamma;uniform float uColorVignette;uniform float uMaskClip;uniform float uMaskOpacity;uniform float uMaskBounds[4];uniform float uMaskCornerRadius[4];uniform float uMaskFeather[8];vec4 applyGamma(vec4 c,float g){c.r=pow(c.r,g);c.g=pow(c.g,g);c.b=pow(c.b,g);return c;}vec4 applyColorMatrix(vec4 c,mat4 m,vec4 o){vec4 res=(c*m)+(o*c.a);res=clamp(res,0.0,1.0);return res;}vec4 applyConvolutionMatrix(vec4 c,float k0,float k1,float k2,float k3,float k4,float k5,float k6,float k7,float k8,float w){vec2 pixel=vec2(1)/uTextureSize;vec4 colorSum=texture(uTexture,vTexCoord-pixel)*k0+texture(uTexture,vTexCoord+pixel*vec2(0.0,-1.0))*k1+texture(uTexture,vTexCoord+pixel*vec2(1.0,-1.0))*k2+texture(uTexture,vTexCoord+pixel*vec2(-1.0,0.0))*k3+texture(uTexture,vTexCoord)*k4+texture(uTexture,vTexCoord+pixel*vec2(1.0,0.0))*k5+texture(uTexture,vTexCoord+pixel*vec2(-1.0,1.0))*k6+texture(uTexture,vTexCoord+pixel*vec2(0.0,1.0))*k7+texture(uTexture,vTexCoord+pixel)*k8;vec4 color=vec4(clamp((colorSum/w),0.0,1.0).rgb,c.a);return color;}vec4 blendPremultipliedAlpha(vec4 back,vec4 front){return front+(back*(1.0-front.a));}vec4 applyVignette(vec4 c,vec2 pos,vec2 center,float v){float d=distance(pos,center)/length(center);float f=1.0-(d*abs(v));if(v>0.0){c.rgb*=f;}else if(v<0.0){c.rgb+=(1.0-f)*(1.0-c.rgb);}return c;}void main(){float x=gl_FragCoord.x;float y=gl_FragCoord.y;float a=1.0;float maskTop=uMaskBounds[0];float maskRight=uMaskBounds[1];float maskBottom=uMaskBounds[2];float maskLeft=uMaskBounds[3];float leftFeatherOpacity=step(uMaskFeather[1],x)*uMaskFeather[0]+((1.0-uMaskFeather[0])*smoothstep(uMaskFeather[1],uMaskFeather[3],x));float rightFeatherOpacity=(1.0-step(uMaskFeather[7],x))*uMaskFeather[4]+((1.0-uMaskFeather[4])*smoothstep(uMaskFeather[7],uMaskFeather[5],x));a*=leftFeatherOpacity*rightFeatherOpacity;float overlayColorAlpha=(smoothstep(maskLeft,maskLeft+1.0,x)*(1.0-smoothstep(maskRight-1.0,maskRight,x))*(1.0-step(maskTop,y))*step(maskBottom,y));if(uOverlayColor.a==0.0){a*=overlayColorAlpha;}vec2 offset=vec2(maskLeft,maskBottom);vec2 size=vec2(maskRight-maskLeft,maskTop-maskBottom)*.5;vec2 center=offset.xy+size.xy;int pixelX=int(step(center.x,x));int pixelY=int(step(y,center.y));float cornerRadius=0.0;if(pixelX==0&&pixelY==0)cornerRadius=uMaskCornerRadius[0];if(pixelX==1&&pixelY==0)cornerRadius=uMaskCornerRadius[1];if(pixelX==0&&pixelY==1)cornerRadius=uMaskCornerRadius[2];if(pixelX==1&&pixelY==1)cornerRadius=uMaskCornerRadius[3];float cornerOffset=sign(cornerRadius)*length(max(abs(gl_FragCoord.xy-size-offset)-size+cornerRadius,0.0))-cornerRadius;float cornerOpacity=1.0-smoothstep(0.0,1.0,cornerOffset);a*=cornerOpacity;if(uAntialias==1){vec2 scaledPoint=vec2(vTexCoord.x*uTextureSize.x,vTexCoord.y*uTextureSize.y);a*=smoothstep(0.0,1.0,uTextureSize.x-scaledPoint.x);a*=smoothstep(0.0,1.0,uTextureSize.y-scaledPoint.y);a*=smoothstep(0.0,1.0,scaledPoint.x);a*=smoothstep(0.0,1.0,scaledPoint.y);}vec4 color=texture(uTexture,vTexCoord);if(uClarityKernelWeight!=-1.0){color=applyConvolutionMatrix(color,uClarityKernel[0],uClarityKernel[1],uClarityKernel[2],uClarityKernel[3],uClarityKernel[4],uClarityKernel[5],uClarityKernel[6],uClarityKernel[7],uClarityKernel[8],uClarityKernelWeight);}color=blendPremultipliedAlpha(color,texture(uTextureBlend,vTexCoord));color=applyGamma(color,uColorGamma);color=applyColorMatrix(color,uColorMatrix,uColorOffset);color*=a;if(uColorVignette!=0.0){vec2 pos=gl_FragCoord.xy-offset;color=applyVignette(color,pos,center-offset,uColorVignette);}color=blendPremultipliedAlpha(color,texture(uTextureOverlay,vTexCoord));if(overlayColorAlpha<=0.0){color*=1.0-uOverlayColor.a;}color*=uOpacity;fragColor=color;}",["aPosition","aTexCoord"],["uMatrix","uTexture","uTextureBlend","uTextureOverlay","uTextureSize","uColorGamma","uColorVignette","uColorOffset","uColorMatrix","uClarityKernel","uClarityKernelWeight","uOpacity","uMaskOpacity","uMaskBounds","uMaskCornerRadius","uMaskFeather","uOverlayColor","uAntialias"]);if(!O)return void n();const B=E.createBuffer(),W=E.createBuffer();E.bindBuffer(E.ARRAY_BUFFER,W),E.bufferData(E.ARRAY_BUFFER,fc,E.STATIC_DRAW);const _=E.createBuffer();E.bindBuffer(E.ARRAY_BUFFER,_),E.bufferData(E.ARRAY_BUFFER,yc,E.STATIC_DRAW);const V=Xl(E,"#version 300 es\n\nin vec4 aPosition;in vec2 aNormal;in float aMiter;out vec2 vNormal;out float vMiter;out float vWidth;uniform float uWidth;uniform float uSharpness;uniform mat4 uMatrix;void main(){vMiter=aMiter;vNormal=aNormal;vWidth=(uWidth*.5)+uSharpness;gl_Position=uMatrix*vec4(aPosition.x+(aNormal.x*vWidth*aMiter),aPosition.y+(aNormal.y*vWidth*aMiter),0,1);}","\n##head\n##mask\nin vec2 vNormal;in float vMiter;in float vWidth;uniform float uWidth;uniform vec4 uColor;uniform vec4 uCanvasColor;void main(){vec4 fillColor=uColor;float m=mask(gl_FragCoord.x,gl_FragCoord.y,uMaskBounds,uMaskOpacity);if(m<=0.0)discard;fillColor.a*=clamp(smoothstep(vWidth-.5,vWidth-1.0,abs(vMiter)*vWidth),0.0,1.0);fillColor.rgb*=fillColor.a;fillColor.rgb*=m;fillColor.rgb+=(1.0-m)*(uCanvasColor.rgb*fillColor.a);fragColor=fillColor;}",["aPosition","aNormal","aMiter"],["uColor","uCanvasColor","uMatrix","uWidth","uSharpness","uMaskBounds","uMaskOpacity"]);if(!V)return void n();const N=E.createBuffer();$c()&&(E.bindBuffer(E.ARRAY_BUFFER,N),E.bufferData(E.ARRAY_BUFFER,1,E.DYNAMIC_DRAW));const H=(e,t,o,i=!1)=>{const{program:n,locations:r}=V;E.useProgram(n),E.enableVertexAttribArray(r.aPosition),E.enableVertexAttribArray(r.aNormal),E.enableVertexAttribArray(r.aMiter);const a=((e,t)=>{let o,i,n,r=0;const a=e.length,s=new Float32Array(10*(t?a+1:a)),l=e[0],c=e[a-1];for(r=0;r<a;r++)o=e[r-1],i=e[r],n=e[r+1],o||(o=t?c:be(i.x+(i.x-n.x),i.y+(i.y-n.y))),n||(n=t?l:be(i.x+(i.x-o.x),i.y+(i.y-o.y))),dc(s,10*r,o,i,n);return t&&dc(s,10*a,c,l,e[1]),s})(e,i),s=5*Float32Array.BYTES_PER_ELEMENT,l=2*Float32Array.BYTES_PER_ELEMENT,c=4*Float32Array.BYTES_PER_ELEMENT;E.uniform1f(r.uWidth,t),E.uniform1f(r.uSharpness,d),E.uniform4fv(r.uColor,o),E.uniformMatrix4fv(r.uMatrix,!1,h),E.uniform4f(r.uCanvasColor,w,k,C,T),E.uniform1fv(r.uMaskBounds,b),E.uniform1f(r.uMaskOpacity,y),E.bindBuffer(E.ARRAY_BUFFER,N),E.bufferData(E.ARRAY_BUFFER,a,E.STATIC_DRAW),E.vertexAttribPointer(r.aPosition,2,E.FLOAT,!1,s,0),E.vertexAttribPointer(r.aNormal,2,E.FLOAT,!1,s,l),E.vertexAttribPointer(r.aMiter,1,E.FLOAT,!1,s,c),E.drawArrays(E.TRIANGLE_STRIP,0,a.length/5),E.disableVertexAttribArray(r.aPosition),E.disableVertexAttribArray(r.aNormal),E.disableVertexAttribArray(r.aMiter)},j=Xl(E,"\n##head\nvoid main(){\n##matrix\n}","\n##head\n##mask\nuniform vec4 uColor;uniform vec4 uCanvasColor;void main(){vec4 fillColor=uColor;\n##maskapply\nif(m<=0.0)discard;fillColor.rgb*=fillColor.a;fillColor.rgb*=m;fillColor.rgb+=(1.0-m)*(uCanvasColor.rgb*fillColor.a);fragColor=fillColor;}",["aPosition"],["uColor","uCanvasColor","uMatrix","uMaskBounds","uMaskOpacity"]);if(!j)return void n();const U=E.createBuffer(),G=Xl(E,"\n##head\n##text\nin vec2 aRectCoord;out vec2 vRectCoord;void main(){vTexCoord=aTexCoord;vRectCoord=aRectCoord;\n##matrix\n}","\n##head\n##mask\nin vec2 vTexCoord;in vec2 vRectCoord;uniform sampler2D uTexture;uniform vec4 uTextureColor;uniform float uTextureOpacity;uniform vec2 uRepeat;uniform vec4 uColor;uniform float uCornerRadius[4];uniform vec2 uSize;uniform vec2 uPosition;uniform vec4 uCanvasColor;uniform int uInverted;uniform float uEdgeFeather;void main(){\n##init\n##colorize\n##rectaa\n##cornerradius\n##maskfeatherapply\nif(uInverted==1)a=1.0-a;\n##maskapply\n##fragcolor\n}",["aPosition","aTexCoord","aRectCoord"],["uTexture","uColor","uMatrix","uCanvasColor","uTextureColor","uTextureOpacity","uRepeat","uPosition","uSize","uMaskBounds","uMaskOpacity","uMaskFeather","uCornerRadius","uInverted","uEdgeFeather"]);if(!G)return void n();const Z=E.createBuffer(),X=E.createBuffer(),Y=E.createBuffer(),q=Xl(E,"\n##head\n##text\nout vec2 vTexCoordDouble;void main(){vTexCoordDouble=vec2(aTexCoord.x*2.0-1.0,aTexCoord.y*2.0-1.0);vTexCoord=aTexCoord;\n##matrix\n}","\n##head\n##mask\nin vec2 vTexCoord;in vec2 vTexCoordDouble;uniform sampler2D uTexture;uniform float uTextureOpacity;uniform vec2 uTextureAdjust;uniform vec2 uRepeat;uniform vec2 uRadius;uniform vec4 uColor;uniform int uInverted;uniform vec4 uCanvasColor;void main(){\n##init\nfloat ar=uRadius.x/uRadius.y;vec2 rAA=vec2(uRadius.x-1.0,uRadius.y-(1.0/ar));vec2 scaledPointSq=vec2((vTexCoordDouble.x*uTextureAdjust.x*uRadius.x)*(vTexCoordDouble.x*uTextureAdjust.x*uRadius.x),(vTexCoordDouble.y*uTextureAdjust.y*uRadius.y)*(vTexCoordDouble.y*uTextureAdjust.y*uRadius.y));float p=(scaledPointSq.x/(uRadius.x*uRadius.x))+(scaledPointSq.y/(uRadius.y*uRadius.y));float pAA=(scaledPointSq.x/(rAA.x*rAA.x))+(scaledPointSq.y/(rAA.y*rAA.y));a=smoothstep(1.0,p/pAA,p);if(uInverted==1)a=1.0-a;\n##maskapply\n##fragcolor\n}",["aPosition","aTexCoord"],["uTexture","uTextureOpacity","uTextureAdjust","uRepeat","uColor","uCanvasColor","uMatrix","uRadius","uInverted","uMaskBounds","uMaskOpacity"]);if(!q)return void n();const K=E.createBuffer(),J=E.createBuffer(),ee=new Map,te={2:{width:0,height:0},1:{width:0,height:0}},oe=(e,t,o,i=1)=>{const n=Math.min(Math.min(4096,s)/o.width,Math.min(4096,s)/o.height,i),a=Math.floor(n*o.width),l=Math.floor(n*o.height);Xe(o,te[e])?E.bindFramebuffer(E.FRAMEBUFFER,t):(E.bindTexture(E.TEXTURE_2D,M.get(e)),E.texImage2D(E.TEXTURE_2D,0,E.RGBA,a,l,0,E.RGBA,E.UNSIGNED_BYTE,null),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_MIN_FILTER,E.LINEAR),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.bindFramebuffer(E.FRAMEBUFFER,t),E.framebufferTexture2D(E.FRAMEBUFFER,E.COLOR_ATTACHMENT0,E.TEXTURE_2D,M.get(e),0),te[e]=o);const d=o.width*c,u=o.height*c;var m,g;Ql(p,0,d,u,0,-1,1),ec(p,0,u,0),g=1,(m=p)[0]*=g,m[1]*=g,m[2]*=g,m[3]*=g,((e,t)=>{e[4]*=t,e[5]*=t,e[6]*=t,e[7]*=t})(p,-1),h=p,E.viewport(0,0,a,l),E.colorMask(!0,!0,!0,!0),E.clearColor(0,0,0,0),E.clear(E.COLOR_BUFFER_BIT),v=[1,0,1,0,1,Math.max(r.width,o.width),1,Math.max(r.width,o.width)]},ie=(e,t)=>{const{forceRelease:o=!1}=t||{},{src:i}=ee.get(e);i instanceof HTMLCanvasElement&&(o||i.dataset.retain||S(i)),ee.delete(e),E.deleteTexture(e)},ne=e=>ee.get(e).isRotatedVideo;return{drawPath:(e,t=0,o=!1,i=!1,n,r,a,s,l)=>{if(e.length<2)return;const d=e.map(e=>({x:e.x*c,y:e.y*c})),u=n*c;if(u>0&&H(d,u,Kl(r,l),a),d.length<3||!s||0===s[3]||!a)return;const p=cc(d),m=new Float32Array(6*p.length);p.forEach(([e,t,o],i)=>{const n=6*i;m[n+0]=e.x,m[n+1]=e.y,m[n+2]=t.x,m[n+3]=t.y,m[n+4]=o.x,m[n+5]=o.y}),((e,t)=>{const{program:o,locations:i}=j;E.useProgram(o),E.enableVertexAttribArray(i.aPosition),E.uniform4fv(i.uColor,t),E.uniformMatrix4fv(i.uMatrix,!1,h),E.uniform1fv(i.uMaskBounds,b),E.uniform1f(i.uMaskOpacity,y),E.uniform4f(i.uCanvasColor,w,k,C,T),E.bindBuffer(E.ARRAY_BUFFER,U),E.bufferData(E.ARRAY_BUFFER,e,E.STATIC_DRAW),E.vertexAttribPointer(i.aPosition,2,E.FLOAT,!1,0,0),E.drawArrays(E.TRIANGLES,0,e.length/2),E.disableVertexAttribArray(i.aPosition)})(m,Kl(s,l))},drawRect:(e,t=0,o=!1,i=!1,n,r,a,s=void 0,l=void 0,d=!1,u=void 0,p,m,g,$=void 0,f=1/c,x,S)=>{const M=bt(rt(e),c),P=n.map(t=>((e,t)=>Math.floor(Rs(e,0,Math.min(.5*(t.width-1),.5*(t.height-1)))))(t||0,e)).map(e=>e*c);if(r||a){const e=rt(M);e.x-=.5,e.y-=.5,e.width+=1,e.height+=1;const n=pc(e,t,o,i),p=uc(n);let m;x&&(m=Kl(x),0===m[3]&&(m[3]=.001));const R=s&&d?[e.width/s.width,e.height/s.height]:[1,1];((e,t,o,i,n,r=A,a,s=1,l=Sc,d=fc,u=v,p=1,m)=>{const{program:g,locations:$}=G;E.useProgram(g),E.enableVertexAttribArray($.aPosition),E.enableVertexAttribArray($.aTexCoord),E.enableVertexAttribArray($.aRectCoord),E.uniform4fv($.uColor,n),E.uniform2fv($.uSize,[t,o]),E.uniform2fv($.uPosition,[e[2],e[3]]),E.uniform2fv($.uRepeat,a),E.uniform1i($.uInverted,m?1:0),E.uniform1fv($.uCornerRadius,i),E.uniform4f($.uCanvasColor,w,k,C,T),E.uniform1fv($.uMaskFeather,u.map((e,t)=>t%2==0?e:e*c)),E.uniform1fv($.uMaskBounds,b),E.uniform1f($.uMaskOpacity,y),E.uniform1f($.uEdgeFeather,Math.max(0,p)),E.uniformMatrix4fv($.uMatrix,!1,h),E.uniform1i($.uTexture,4),E.uniform4fv($.uTextureColor,l),E.uniform1f($.uTextureOpacity,s),E.activeTexture(E.TEXTURE0+4),E.bindTexture(E.TEXTURE_2D,r),E.bindBuffer(E.ARRAY_BUFFER,X),E.bufferData(E.ARRAY_BUFFER,d,E.STATIC_DRAW),E.vertexAttribPointer($.aTexCoord,2,E.FLOAT,!1,0,0),E.bindBuffer(E.ARRAY_BUFFER,Y),E.bufferData(E.ARRAY_BUFFER,fc,E.STATIC_DRAW),E.vertexAttribPointer($.aRectCoord,2,E.FLOAT,!1,0,0),E.bindBuffer(E.ARRAY_BUFFER,Z),E.bufferData(E.ARRAY_BUFFER,e,E.STATIC_DRAW),E.vertexAttribPointer($.aPosition,2,E.FLOAT,!1,0,0),E.drawArrays(E.TRIANGLE_STRIP,0,e.length/2),E.disableVertexAttribArray($.aPosition),E.disableVertexAttribArray($.aTexCoord),E.disableVertexAttribArray($.aRectCoord)})(p,e.width,e.height,P,Kl(r,g),a,R,g,m,u?new Float32Array(u):kc(e.width,e.height,s,l,c),$,f*c,S)}p&&(p=Math.min(p,M.width,M.height),H(((e,t,o,i,n,r,a,s)=>{const l=[];if(r.every(e=>0===e))l.push(be(e,t),be(e+o,t),be(e+o,t+i),be(e,t+i));else{const[n,a,s,c]=r,d=e,u=e+o,p=t,h=t+i;l.push(be(d+n,p)),hc(l,u-a,p+a,a,-1),l.push(be(u,p+a)),hc(l,u-c,h-c,c,0),l.push(be(u-c,h)),hc(l,d+s,h-s,s,1),l.push(be(d,h-s)),hc(l,d+n,p+n,n,2)}return(a||s)&&We(l,a,s,e+.5*o,t+.5*i),n&&_e(l,n,e+.5*o,t+.5*i),l})(M.x,M.y,M.width,M.height,t,P,o,i),p*c,Kl(m,g),!0))},drawEllipse:(e,t,o,i,n,r,a,s,l=void 0,d=void 0,u=void 0,p,m,g,$)=>{const f=bt(ht(e.x-t,e.y-o,2*t,2*o),c);if(a||s){const e=rt(f);$||(e.x-=.5,e.y-=.5,e.width+=1,e.height+=1);const t=pc(e,i,n,r);((e,t,o,i,n=A,r,a=fc,s=1,l=!1)=>{const{program:d,locations:u}=q;E.useProgram(d),E.enableVertexAttribArray(u.aPosition),E.enableVertexAttribArray(u.aTexCoord),E.uniformMatrix4fv(u.uMatrix,!1,h),E.uniform2fv(u.uRadius,[.5*t,.5*o]),E.uniform2fv(u.uTextureAdjust,[r.width/(t/c),r.height/(o/c)]),E.uniform1i(u.uInverted,l?1:0),E.uniform4fv(u.uColor,i),E.uniform4f(u.uCanvasColor,w,k,C,T),E.uniform2fv(u.uRepeat,[1,1]),E.uniform1fv(u.uMaskBounds,b),E.uniform1f(u.uMaskOpacity,y),E.uniform1i(u.uTexture,4),E.uniform1f(u.uTextureOpacity,s),E.activeTexture(E.TEXTURE0+4),E.bindTexture(E.TEXTURE_2D,n),E.bindBuffer(E.ARRAY_BUFFER,J),E.bufferData(E.ARRAY_BUFFER,a,E.STATIC_DRAW),E.vertexAttribPointer(u.aTexCoord,2,E.FLOAT,!1,0,0),E.bindBuffer(E.ARRAY_BUFFER,K),E.bufferData(E.ARRAY_BUFFER,e,E.STATIC_DRAW),E.vertexAttribPointer(u.aPosition,2,E.FLOAT,!1,0,0),E.drawArrays(E.TRIANGLE_STRIP,0,e.length/2),E.disableVertexAttribArray(u.aPosition),E.disableVertexAttribArray(u.aTexCoord)})(uc(t),e.width,e.height,Kl(a,g),s,l||Ze(e.width/c,e.height/c),u?new Float32Array(u):kc(e.width,e.height,l,d,c),g,$)}p&&H(((e,t,o,i,n,r,a)=>{const s=.5*Math.abs(o),l=.5*Math.abs(i),c=Math.abs(o)+Math.abs(i),d=Math.max(20,Math.round(c/6));return Ht(be(e+s,t+l),s,l,n,r,a,d)})(f.x,f.y,f.width,f.height,i,n,r),p*c,Kl(m,g),!0)},drawImage:(e,t,o,i,n,a,s,d,u,p,h=vc,m=1,g,$=1,f=0,v=x,S=wc,w=Sc,k=!1,C=!1,T=!0,P=!1)=>{const A=t.width*c,L=t.height*c,F=-.5*A,z=.5*L,D=.5*A,V=-.5*L,N=new Float32Array([F,V,0,F,z,0,D,V,0,D,z,0]);E.bindBuffer(E.ARRAY_BUFFER,B),E.bufferData(E.ARRAY_BUFFER,P?N.map(e=>Math.round(e)):N,E.STATIC_DRAW);const H=t.height/2/I*(r.height/t.height)*-1;n*=c,a*=c,o*=c,i*=c;const{program:j,locations:U}=O,G=Jl();((e,t,o,i,n)=>{const r=1/Math.tan(t/2),a=1/(i-n);e[0]=r/o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(n+i)*a,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*n*i*a,e[15]=0})(G,R,l,1,2*-H),ec(G,n,-a,H),ec(G,o,-i,0),nc(G,-u),tc(G,p),ec(G,-o,i,0),ic(G,d),oc(G,s),E.useProgram(j),E.enableVertexAttribArray(U.aPosition),E.enableVertexAttribArray(U.aTexCoord),E.uniform1i(U.uTexture,3),E.uniform2f(U.uTextureSize,t.width,t.height),E.activeTexture(E.TEXTURE0+3),E.bindTexture(E.TEXTURE_2D,e);const Z=C?1:0,X=M.get(Z);E.uniform1i(U.uTextureBlend,Z),E.activeTexture(E.TEXTURE0+Z),E.bindTexture(E.TEXTURE_2D,X);const Y=k?2:0,q=M.get(Y);E.uniform1i(U.uTextureOverlay,Y),E.activeTexture(E.TEXTURE0+Y),E.bindTexture(E.TEXTURE_2D,q),E.bindBuffer(E.ARRAY_BUFFER,B),E.vertexAttribPointer(U.aPosition,3,E.FLOAT,!1,0,0);const K=bc&&ne(e);let J;E.bindBuffer(E.ARRAY_BUFFER,K?_:W),E.vertexAttribPointer(U.aTexCoord,2,E.FLOAT,!1,0,0),E.uniformMatrix4fv(U.uMatrix,!1,G),E.uniform4fv(U.uOverlayColor,w),!g||Fs(g,xc)?(g=xc,J=-1):(J=g.reduce((e,t)=>e+t,0),J=J<=0?1:J),E.uniform1fv(U.uClarityKernel,g),E.uniform1f(U.uClarityKernelWeight,J),E.uniform1f(U.uColorGamma,1/$),E.uniform1f(U.uColorVignette,f),E.uniform1i(U.uAntialias,T?1:0),E.uniform4f(U.uColorOffset,h[4],h[9],h[14],h[19]),E.uniformMatrix4fv(U.uColorMatrix,!1,[h[0],h[1],h[2],h[3],h[5],h[6],h[7],h[8],h[10],h[11],h[12],h[13],h[15],h[16],h[17],h[18]]),E.uniform1f(U.uOpacity,m),E.uniform1f(U.uMaskOpacity,y),E.uniform1fv(U.uMaskBounds,b),E.uniform1fv(U.uMaskCornerRadius,S.map(e=>e*c)),E.uniform1fv(U.uMaskFeather,v.map((e,t)=>t%2==0?e:e*c)),E.drawArrays(E.TRIANGLE_STRIP,0,4),E.disableVertexAttribArray(U.aPosition),E.disableVertexAttribArray(U.aTexCoord)},textureFilterNearest:E.NEAREST,textureFilterLinear:E.LINEAR,textureClamp:E.CLAMP_TO_EDGE,textureRepeat:E.REPEAT,textureCreate:()=>E.createTexture(),textureUpdate:(e,t,o)=>(ee.set(e,{src:t,options:o,isRotatedVideo:"VIDEO"===t.nodeName&&(t.dataset&&90==t.dataset.rotation||270==t.dataset.rotation)}),ql(E,e,t,o)),textureGetSize:e=>{const{src:t,options:o}=ee.get(e),i=He(t);return o.scalar?Qe(i,e=>e/o.scalar):i},textureDelete:ie,enablePreviewStencil:()=>{E.stencilOp(E.KEEP,E.KEEP,E.REPLACE),E.stencilFunc(E.ALWAYS,1,255),E.stencilMask(255)},applyPreviewStencil:()=>{E.stencilFunc(E.EQUAL,1,255),E.stencilMask(0)},disablePreviewStencil:P,setCanvasColor(e){w=e[0],k=e[1],C=e[2],T=i?e[3]:1,E.clear(E.COLOR_BUFFER_BIT)},resetCanvasMatrix:()=>{Ql(u,0,r.width,r.height,0,-1,1)},updateCanvasMatrix(e,t,o,i,n){const a=e.width,s=e.height,l=r.width*(.5/c),d=r.height*(.5/c),p={x:l+(o.x+t.x),y:d+(o.y+t.y)},h={x:p.x-t.x,y:p.y-t.y},m=.5*a,g=.5*s;we(h,n.z,p),Oe(h,i,p);ec(u,(h.x-m)*c,(h.y-g)*c,0),ec(u,m*c,g*c,0),nc(u,n.z);const $=n.x>Math.PI/2;oc(u,$?Math.PI:0);const f=n.y>Math.PI/2;ic(u,f?Math.PI:0),tc(u,i),ec(u,-m*c,-g*c,0)},drawToCanvas(){E.bindFramebuffer(E.FRAMEBUFFER,null),h=u,E.viewport(0,0,E.drawingBufferWidth,E.drawingBufferHeight),E.colorMask(!0,!0,!0,!0),E.clearColor(w,k,C,T),E.clear(E.COLOR_BUFFER_BIT),v=[1,0,1,0,1,r.width,1,r.width]},drawToImageBlendBuffer(e,t){oe(1,D,e,t)},drawToImageOverlayBuffer(e,t){oe(2,F,e,t)},enableMask(e,t){const o=e.x*c,i=e.y*c,n=e.width*c,a=e.height*c;f=o,g=f+n,m=r.height-i,$=r.height-(i+a),y=1-t,b=[m,g,$,f]},disableMask(){f=0,g=r.width,m=r.height,$=0,y=1,b=[m,g,$,f]},resize:(t,o,i)=>{c=Math.max(1,i),d=1===c?.75:1,a.width=t,a.height=o,r.width=t*c,r.height=o*c,l=Q(r.width,r.height),e.width=r.width,e.height=r.height,Ql(u,0,r.width,r.height,0,-1,1),x=[1,0,1,0,1,a.width,1,a.width]},release(){Array.from(ee.keys()).forEach(e=>ie(e,{forceRelease:!0})),ee.clear(),M.forEach(e=>{E.deleteTexture(e)}),M.clear(),O.destroy(),V.destroy(),j.destroy(),G.destroy(),q.destroy(),e.width=1,e.height=1,e=void 0}}},Tc=e=>e%2==0?e:e+1;var Mc=(e,t)=>{const{imageData:o,amount:i=1}=e,n=Math.round(2*Math.max(1,i)),r=Math.round(.5*n),a=o.width,s=o.height,l=o.colorSpace,c=new Uint8ClampedArray(a*s*4),d=o.data;let u,p,h,m,g,$=0,f=0,y=0;const b=a*s*4-4;for(h=0;h<s;h++)for(u=crypto.getRandomValues(new Uint8ClampedArray(s)),p=0;p<a;p++)m=u[h]/255,f=0,y=0,m<.5&&(f=4*(-r+Math.round(Math.random()*n))),m>.5&&(y=(-r+Math.round(Math.random()*n))*(4*a)),g=Math.min(Math.max(0,$+f+y),b),c[$]=d[g],c[$+1]=d[g+1],c[$+2]=d[g+2],c[$+3]=d[g+3],$+=4;t(null,{data:c,width:o.width,height:o.height,colorSpace:l})};const Pc=[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625];function Rc(e){return"[object Date]"===Object.prototype.toString.call(e)}function Ic(e){return Math.sqrt(1- --e*e)}function Ec(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)=>Ec(e[o],t));return e=>o.map(t=>t(e))}if("object"===o){if(!e||!t)throw new Error("Object cannot be null");if(Rc(e)&&Rc(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]=Ec(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 Ac(e,t={}){const o=ls(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=pr,interpolate:p=Ec}=hr(hr({},t),a);if(0===d)return s&&(s.abort(),s=null),o.set(e=n),Promise.resolve();const h=Fr()+c;let m;return i=Br(t=>{if(t<h)return!0;l||(m=p(e,r),"function"==typeof d&&(d=d(e,r)),l=!0),s&&(s.abort(),s=null);const i=t-h;return i>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 Lc(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.opts.precision&&Math.abs(n)<e.opts.precision?i:(e.settled=!1,o+a)}if(Uo(o))return o.map((n,r)=>Lc(e,t[r],o[r],i[r]));if("object"==typeof o){const n={};for(const r in o)n[r]=Lc(e,t[r],o[r],i[r]);return n}throw new Error(`Cannot spring ${typeof o} values`)}function Fc(e,t={}){const o=ls(e),{stiffness:i=.15,damping:n=.8,precision:r=.01}=t;let a,s,l,c=e,d=e,u=1,p=0,h=!1;function m(t,i={}){d=t;const n=l={};if(null==e||i.hard||g.stiffness>=1&&g.damping>=1)return h=!0,a=null,c=t,o.set(e=d),Promise.resolve();if(i.soft){const e=!0===i.soft?.5:+i.soft;p=1/(60*e),u=0}if(!s){a=null,h=!1;const t={inv_mass:void 0,opts:g,settled:!0,dt:void 0};s=Br(i=>{if(null===a&&(a=i),h)return h=!1,s=null,!1;u=Math.min(u+p,1),t.inv_mass=u,t.opts=g,t.settled=!0,t.dt=60*(i-a)/1e3;const n=Lc(t,c,e,d);return a=i,c=e,o.set(e=n),t.settled&&(s=null),!t.settled})}return new Promise(e=>{s.promise.then(()=>{n===l&&e()})})}const g={set:m,update:(t,o)=>m(t(d,e),o),subscribe:o.subscribe,stiffness:i,damping:n,precision:r};return g}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");var zc=ss(!1,e=>{const t=window.matchMedia("(prefers-reduced-motion:reduce)"),o=()=>e(t.matches);return o(),t.addListener(o),()=>t.removeListener(o)}),Dc=()=>"ResizeObserver"in window;const Oc=at(),Bc=(e,t,o,i,n)=>{e.rect||(e.rect=at());const r=e.rect;St(Oc,t,o,i,n),xt(r,Oc)||(wt(r,Oc),e.dispatchEvent(new CustomEvent("measure",{detail:r})))},Wc=Math.round,_c=e=>{const t=e.getBoundingClientRect();Hc&&Bc(e,Wc(t.x),Wc(t.y),Wc(t.width),Wc(t.height))},Vc=e=>{Hc&&Bc(e,e.offsetLeft,e.offsetTop,e.offsetWidth,e.offsetHeight)},Nc=[];let Hc,jc,Uc;function Gc(){Nc.length?(Nc.forEach(e=>e.measure(e)),Hc=requestAnimationFrame(Gc)):Hc=void 0}let Zc=new Map([]),Xc=0,Yc=0;var qc=(e,t={})=>{const{observePosition:o=!1,observeViewRect:i=!1,once:n=!1,disabled:r=!1,isMeasureRoot:a=!1}=t;if(Dc()&&a&&(Uc||(Uc=new ResizeObserver(e=>{e.forEach(e=>{Zc.set(e.target,e.contentRect)});const t=Array.from(Zc.values()).some(({width:e,height:t})=>e>0&&t>0);t?t&&!1===Hc&&Gc():(Hc&&cancelAnimationFrame(Hc),Hc=!1)})),Uc.observe(e),Xc++),!r)return!Dc()||o||i?(e.measure=i?_c:Vc,Nc.push(e),void 0===Hc&&(Hc=requestAnimationFrame(Gc)),e.measure(e),{destroy(){a&&Uc&&(Zc.delete(e),Uc.unobserve(e),Xc--,0===Xc&&(Uc.disconnect(),Uc=void 0));const t=Nc.indexOf(e);Nc.splice(t,1),delete e.measure}}):(jc||(jc=new ResizeObserver(e=>{e.forEach(e=>{Hc&&Vc(e.target)})})),jc.observe(e),Vc(e),n?jc.unobserve(e):Yc++,{destroy(){a&&Uc&&(Zc.delete(e),Uc.unobserve(e),Xc--,0===Xc&&(Uc.disconnect(),Uc=void 0)),n||(jc.unobserve(e),Yc--,0===Yc&&(jc.disconnect(),jc=void 0))}})},Kc=e=>{let t;const o={pointerdown:()=>{t=!1},keydown:()=>{t=!0},keyup:()=>{t=!1},focus:e=>{!1!==t&&(e.target.dataset.focusVisible="")},blur:e=>{delete e.target.dataset.focusVisible}};return Object.keys(o).forEach(t=>e.addEventListener(t,o[t],!0)),{destroy(){Object.keys(o).forEach(t=>e.removeEventListener(t,o[t],!0))}}};const Jc=e=>/^http/.test(e),Qc=e=>new Promise((t,o)=>"file"===e.kind?t(e.getAsFile()):"string"===e.kind?e.getAsString(t):void o());var ed=(e,t={})=>{const o=e=>{e.preventDefault()},i=async o=>{o.preventDefault(),o.stopPropagation();try{const i=await(e=>new Promise((t,o)=>{const{items:i}=e.dataTransfer;if(!i)return t([]);const n=Array.from(i).some(e=>"text/uri-list"===e.type),r=Array.from(i).filter(e=>("file"===e.kind||"string"===e.kind)&&"text/x-moz-url"!==e.type).map(Qc);Promise.all(r).then(e=>{if(n)return t([e.find(Jc)].filter(Boolean));const o=e.filter(e=>Ko(e)&&(so(e)||al(e))||Jc(e));t(o)}).catch(o)}))(o);e.dispatchEvent(new CustomEvent("dropfiles",{detail:{event:o,resources:i},...t}))}catch(e){}};function n(){e.removeEventListener("drop",i),e.removeEventListener("dragover",o)}function r(t){const{disabled:r=!1}=t||{};n(),r||(e.addEventListener("drop",i),e.addEventListener("dragover",o))}return r(t),{update:r,destroy(){n()}}};let td=null;var od=()=>{if(null===td)if(m()){const e=x("canvas");td=!ac(e,{failIfMajorPerformanceCaveat:!0}),S(e)}else td=!1;return td},id=e=>e instanceof WebGLTexture,nd=([e,t,o,i])=>[i.x,i.y,e.x,e.y,o.x,o.y,t.x,t.y];function rd(e){let t,o,i,n;return{c(){t=Ur("div"),o=Ur("canvas"),Qr(t,"class","PinturaCanvas")},m(r,a){Hr(r,t,a),_r(t,o),e[38](o),i||(n=[qr(o,"measure",e[39]),Ar(qc.call(null,o))],i=!0)},p:ur,i:ur,o:ur,d(o){o&&jr(t),e[38](null),i=!1,$r(n)}}}function ad(e,t,i){let n,r,a,s,l,c,d;const u=[0,0,0,0],p=ye(),h=m()&&(e=>{const t=.5*e,o=x("canvas",{"data-retain":!0,width:e,height:e}),i=o.getContext("2d");return i.fillStyle="#f0f",i.fillRect(0,0,t,t),i.fillRect(t,t,t,t),o})(128),g=xa();let $,{isAnimated:f}=t,{isTransparent:b}=t,{maskRect:v}=t,{maskOpacity:k=1}=t,{maskFrameOpacity:C=.95}=t,{maskMarkupOpacity:T=1}=t,{clipAnnotationsToImage:M=!0}=t,{pixelRatio:P=1}=t,{textPixelRatio:R=P}=t,{backgroundColor:I}=t,{willRender:E=ee}=t,{didRender:A=ee}=t,{willRequest:L}=t,{csp:F}=t,{loadImageData:z=ee}=t,{enableGrid:D=!1}=t,{gridColors:O}=t,{gridSize:B}=t,{gridOpacity:W=0}=t,{images:_=[]}=t,{interfaceImages:V=[]}=t,{selectionColor:H}=t,{onerror:j=o}=t,U=null,G=null,Z=null;const X=(e,t)=>e.set(t,{hard:!f}),Y={precision:1e-4*.01};let q=0;const K=Ac(void 0,{duration:0});wr(e,K,e=>i(37,d=e));const J=Fc(1,Y);wr(e,J,e=>i(36,l=e));const te=Fc(1,Y);wr(e,te,e=>i(52,a=e));const oe=ls();wr(e,oe,e=>i(54,c=e));const ie=ls();wr(e,ie,e=>i(53,s=e));const ne={},re=(e,t)=>{let o=ne[e.id];const i=Math.min(1,2048/t.width);let n=o?o.element:x("canvas",{width:t.width*i,height:t.height*i,"data-retain":!0});if(!o||((e,t)=>{if(e.total!==t.length)return!0;const o=e.last,i=t[t.length-1];return o.drawMode!==i.drawMode||!(!Wi(o)||Wi(i)&&xt(o,i))||!(!_i(o)||_i(i)&&o.x===i.x&&o.y===i.y&&o.rx===i.rx&&o.ry===i.ry)||!(!Ni(o)||Ni(i)&&o.id===i.id&&o.points.length===i.points.length&&(!o.pointerPoint||!i.pointerPoint||Me(o.pointerPoint,i.pointerPoint)))})(o,e.actions)){n=n.cloneNode(),((e,t,o)=>{const{selectionColor:i=[1,1,1],scalar:n=1}=o||{},r=[...t];let a=!1;for(const t of r){const o="subtract"===t.drawMode;if(o&&!a)continue;e.globalCompositeOperation=o?"destination-out":"source-over",e.save(),e.beginPath();const s=Vn(t);if(Eo(e,n,n),Io(e,t.rotation,s),nr(e,t.flipX,t.flipY,s),t.width)Jn(e,{...t,backgroundColor:i});else if(t.points){let o;o=t.pathClose?{backgroundColor:i,strokeColor:i,strokeJoin:"round",bitmap:!0}:{strokeColor:i,strokeJoin:"round",strokeCap:"round"};const n=t.pointerPoint?[...t.points,t.pointerPoint]:t.points;if(ir(e,Object.assign({},t,{points:n},o)),t.pathClose&&t.strokeWidth){const e=3*t.strokeWidth,o=2*t.strokeWidth;r.push({...t.points[0],rx:e,ry:e,drawMode:"add"},{...t.points[0],rx:o,ry:o,drawMode:"subtract"})}}else t.rx&&Qn(e,{...t,backgroundColor:i,strokeColor:[0,0,0,0],strokeJoin:"round",strokeCap:"round"});e.restore(),a=!0}})(n.getContext("2d"),e.actions,{selectionColor:[1,0,1],scalar:i});const t=e.actions.length;ne[e.id]={total:t,last:{...e.actions[t-1]},element:n}}return{x:0,y:0,...t,fillColor:e.color||[1,1,1],backgroundImage:n}};let ae;const se=()=>{cancelAnimationFrame(ae),ae=requestAnimationFrame(()=>{Ee=!0,Ne=0,r()})},le=new Map([]),ce=new Map([]),de=(e,t)=>({filterParam:"pixelated"===e?U.textureFilterNearest:U.textureFilterLinear,wrapParam:"repeat"===t?U.textureRepeat:U.textureClamp}),ue=(e,t,o)=>{if(!le.has(e)){le.set(e,e);const n=de(t,o);if(!y(i=e)&&(vo(i)||w(i)||Nn(i)||co(i))){const t=U.textureCreate();U.textureUpdate(t,e,n),le.set(e,t)}else z(e).then(t=>{if(!U||!t)return;const o=U.textureCreate();U.textureUpdate(o,t,n),le.set(e,o),se()}).catch(t=>{le.set(e,t)})}var i,n;if(co(e)&&((n=e).currentTime>0&&!n.paused&&!n.ended&&n.readyState>2||"true"===e.dataset.redraw)){const i=le.get(e),n=de(t,o);return U.textureUpdate(i,e,n),e.dataset.redraw=!1,i}return le.get(e)},pe=(e,t={})=>{const o=t.id||e.id;if(e.width&&e.width<1||e.height&&e.height<1||!e.text.length)return void ce.delete(o);let{text:i,textAlign:n,fontFamily:r,fontSize:a=16,fontWeight:s,fontVariant:l,fontStyle:c,letterSpacing:d,lineHeight:u=a,width:p,height:h}=e,{outline:m=0,blur:g=0,paddingTop:$=0,paddingRight:f=0,paddingBottom:y=0,paddingLeft:b=0}=t;p=No(p)?Math.floor(p):p,h=No(h)?Math.floor(h):h;const{textSize:v,signature:S}=((e="",t)=>{let{width:o=0,height:i="auto",fontSize:n,fontFamily:r,lineHeight:a,fontWeight:s,fontStyle:l,fontVariant:c,letterSpacing:d}=t;const u=ei({text:e,fontFamily:r,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:n,lineHeight:a,letterSpacing:d,width:o,height:i});let p=li.get(u);if(p)return p;let h=1;n>1e3&&N()&&(h=n/1e3,n=1e3,a*=h);const m=oo(x("pre",{contenteditable:"true",spellcheck:"false",style:`${di}${ai({fontFamily:r,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:n,letterSpacing:d,lineHeight:a})};${si(e,t)}"`,innerHTML:e})),g=m.getBoundingClientRect();return p={signature:ci(m).flat().map(e=>e.text).join("_;_"),textSize:Qe(He(g),e=>Math.ceil(e*h))},li.set(u,p),m.remove(),p})(i,{...e,width:p,height:void 0}),w=ei({text:i,textAlign:n,fontFamily:r,fontSize:a,fontWeight:s,fontVariant:l,fontStyle:c,lineHeight:u,letterSpacing:d,outline:m,blur:g,signature:S});if(!le.has(w)){le.set(w,i);const e=Math.ceil(v.width),t=Math.ceil(v.height);if(0===e||0===t)return;const x=gc(),S=Math.min(1,(x-(b+f)*R)/(e*R),(x-($+y)*R)/(t*R));Pi(i,{fontSize:a,fontFamily:r,fontWeight:s,fontVariant:l,fontStyle:c,letterSpacing:d,textAlign:n,lineHeight:u,width:p,height:h,imageWidth:e,imageHeight:t,paddingLeft:b,paddingTop:$,paddingRight:f,paddingBottom:y,pixelRatio:R*S,willRequest:L,outline:m,blur:g,styleNonce:F.styleNonce,color:[1,0,1]}).then(e=>{if(!U)return;const t=U.textureCreate();U.textureUpdate(t,e,{filterParam:U.textureFilterLinear,wrapParam:U.textureClamp,scalar:S,premultiply:!N()}),le.set(w,t),ce.set(o,t),se()}).catch(console.error)}const k=le.get(w);return id(k)?k:ce.get(o)},he=new Map,me=e=>{let t;return e.backgroundImage?t=ue(e.backgroundImage,e.backgroundImageRendering,"repeat"===e.backgroundRepeat?"repeat":void 0):e.bitmap&&e.points&&(t=(e=>{const{id:t,points:o,strokeWidth:i,strokeCap:n,strokeJoin:r,strokeColor:a,strokeDash:s,pathClose:l,backgroundColor:c}=e;let d=le.get(t),u=he.get(t);const p=ei({points:o.map(e=>`${e.x},${e.y}`).join(","),strokeWidth:i,strokeCap:n,strokeJoin:r,strokeColor:a,strokeDash:(s||[]).join(","),pathClose:l,backgroundColor:l?(c||[]).join(","):void 0});if(u){const{hash:e}=u;if(le.has(t)){if(p===e)return le.get(t)}else u=void 0}if(!u){const o=x("canvas",{width:1,height:1});u={canvas:o,hash:void 0},he.set(e.id,u),d=U.textureCreate(),U.textureUpdate(d,o,{filterParam:U.textureFilterLinear,wrapParam:U.textureClamp}),le.set(t,d)}const{canvas:h}=u,m=Math.ceil(e.strokeWidth)+2,g=dt(o),$=Math.floor(g.x-.5*m),f=Math.floor(g.y-.5*m),y=Math.ceil(g.width+m),b=Math.ceil(g.height+m);h.width=Math.max(y,1),h.height=Math.max(b,1);const v=h.getContext("2d");return v.clearRect(0,0,h.width,h.height),y>=1&&b>=1&&(v.translate(-$,-f),ir(v,e),v.resetTransform()),U.textureUpdate(d,h,{filterParam:U.textureFilterLinear,wrapParam:U.textureClamp}),he.set(t,{canvas:h,hash:p}),le.get(t)})(e)),t},ge=({texture:e,size:t,origin:o,translation:i,rotation:n,scale:r,colorMatrix:a,opacity:s,convolutionMatrix:l,gamma:c,vignette:d,maskFeather:u,maskCornerRadius:p,overlayColor:h,enableOverlay:m,enableManipulation:g,enableAntialiasing:$})=>{let f=1===P,y=0,b=0;if(1===P){const e=Math.abs(1-r)<Number.EPSILON;y=e&&G%2!=0?.5:0,b=e&&Z%2!=0?.5:0}return U.drawImage(e,t,o.x,o.y,i.x+y,i.y+b,n.x,n.y,n.z,r,a,Rs(s,0,1),l,c,d,u,p,h,m,g,$,f),e},$e=(e,t,o)=>{const i=mt(t),n=mt(e),r=i.x-n.x,a=i.y-n.y,s=we(i,o,n);return{x:s.x-n.x-r,y:s.y-n.y-a}},fe=(e,t,o,i,n)=>{if("left"===i&&!n)return 0;const r=e.width+2*t-o.width;return"left"===i?r:"center"===i?.5*r:"right"===i?n?0:r:0},xe=(e,t,o)=>{let i,n;const r=Q(o.width,o.height);if("repeat"===e.backgroundRepeat&&(i={...o},n={x:0,y:0}),"contain"===e.backgroundSize){const o=Pt(t,r,t);i=je(o),n=e.backgroundPosition?e.backgroundPosition:be(.5*(t.width-i.width),.5*(t.height-i.height))}else if("cover"===e.backgroundSize){const o=Mt(t,r,t);i=je(o),e.backgroundPosition?n=e.backgroundPosition:(n=be(o.x,o.y),n=be(.5*(t.width-i.width),.5*(t.height-i.height)))}else e.backgroundSize?(i=e.backgroundSize,n=e.backgroundPosition||{x:0,y:0}):e.backgroundPosition&&(i={...o},n=e.backgroundPosition);return{backgroundSize:i,backgroundPosition:n}},ve=(e=[],t)=>{e.forEach(e=>{let o=me(e);const i="complete"!==e.status&&("loading"===e.status||e.backgroundImage&&o===e.backgroundImage);i&&se();const n="error"===e.status||e.backgroundImage&&o instanceof Error;let r=id(o)?o:void 0;const a=e._scale||1,s=e._translate||p,l=e.strokeWidth&&e.strokeWidth*a,c=e.cornerRadius?((e,t)=>[e,e,e,e].map(e=>e*t))(e.cornerRadius,a):u,d=!!e.width,h=y(e.text),m=Uo(e.points),g=_i(e);if(m){const i=e.points.map(e=>be(e.x*a+s.x,e.y*a+s.y));if(e.bitmap){o&&t.push(o);const n=dt(i),s=Math.ceil(e.strokeWidth*a)+2;U.drawRect({x:Math.floor(n.x-.5*s),y:Math.floor(n.y-.5*s),width:Math.ceil(n.width+s),height:Math.ceil(n.height+s)},e.rotation,e.flipX,e.flipY,[0,0,0,0],void 0,r,void 0,void 0,void 0,void 0,void 0,void 0,e.opacity,void 0,void 0,!1,!1)}else U.drawPath(i,e.rotation,e.flipX,e.flipY,l,e.strokeColor,e.pathClose,e.backgroundColor,e.opacity)}else if(g){let c=e.x,d=e.y;c*=a,d*=a,c+=s.x,d+=s.y;const u=ut({x:c,y:d,rx:e.rx*a,ry:e.ry*a}),p=be(c,d),h=r&&U.textureGetSize(r);let m,g;if(h&&e.backgroundImage&&(e.backgroundSize||e.backgroundPosition||e.backgroundRepeat)){const t=xe(e,u,h);m=t.backgroundSize,g=t.backgroundPosition}if(U.drawEllipse(p,e.rx*a,e.ry*a,e.rotation,e.flipX,e.flipY,e.backgroundColor,r,m,g,e.backgroundCorners&&nd(e.backgroundCorners),l,e.strokeColor,e.opacity,e.inverted),o&&t.push(o),i||n){if(!(e.backgroundColor||e.strokeColor&&e.strokeWidth)){const t=e.opacity||1;U.drawEllipse(p,e.rx*a,e.ry*a,e.rotation,e.flipX,e.flipY,n?[1,.2549,.2118,.25*t]:[0,0,0,.25*t])}n&&Re(p),i&&Pe(p)}}else if(h){const{fontSize:o=16}=e,i=o>1e3&&N()?o/1e3:1,n=Math.max(16,Math.ceil(o/i*.25)),r=Math.abs(e.rotation)>0,d=No(e.width)?Math.floor(e.width):e.width,p=No(e.height)?Math.floor(e.height):e.height,h=hi(e.text,{...e,width:d,height:p}),m=Math.ceil(h.width),g=Math.ceil(h.height),$={x:e.x*a+s.x,y:e.y*a+s.y,width:m*a,height:g*a},f=!!e.height;(e.backgroundColor||e.strokeColor)&&U.drawRect($,e.rotation,e.flipX,e.flipY,c,e.backgroundColor,void 0,void 0,void 0,!1,void 0,l,e.strokeColor,e.opacity,void 0,void 0,void 0,e.inverted);const{textShadowX:y,textShadowY:b,textShadowBlur:x}=e;if(y||b||x){const o=Math.ceil(.5*x),l=Math.max(n,f?0:o),c=pe(e,{id:e.id+"shadow",blur:x,paddingTop:l,paddingRight:l,paddingBottom:l,paddingLeft:l});if(c&&!e._prerender){t.push(c);const o=U.textureGetSize(c),l={x:0,y:0},d={width:o.width/R*a,height:o.height/R*a},u=n*a/i;let p;if(f)p={...$},l.x=y-u,l.y=b-u,"right"===e.textAlign?l.x+=p.width-(d.width-2*u):"center"===e.textAlign&&(l.x+=.5*(p.width-(d.width-2*u)));else{p={x:e.x*a+s.x-u,y:e.y*a+s.y-u,width:d.width,height:d.height};const t=fe($,u,d,e.textAlign,e.flipX);if(p.x+=t,r){const t=$e($,p,e.rotation);p.x+=t.x,p.y+=t.y;const o=we(be(y,b),e.rotation);p.x+=o.x,p.y+=o.y}else p.x+=y,p.y+=b}U.drawRect(p,e.rotation,e.flipX,e.flipY,[0,0,0,0],void 0,c,d,l,!1,void 0,void 0,void 0,e.opacity,void 0,0,e.textShadowColor)}}if(e.textOutlineWidth){const o=Math.ceil(.5*e.textOutlineWidth),l=n+o,c=pe(e,{id:e.id+"outline",outline:e.textOutlineWidth,paddingTop:l,paddingRight:l,paddingBottom:l,paddingLeft:l});if(c&&!e._prerender){t.push(c);const l=U.textureGetSize(c),d={x:0,y:0},u={width:l.width/R*a,height:l.height/R*a},p=(n+o)*a/i,h={x:e.x*a+s.x-p,y:e.y*a+s.y-p,width:u.width,height:e.height?g+p:u.height},m=fe($,p,u,e.textAlign,e.flipX);if(h.x+=m,r){const t=$e($,h,e.rotation);h.x+=t.x,h.y+=t.y}U.drawRect(h,e.rotation,e.flipX,e.flipY,[0,0,0,0],void 0,c,u,d,!1,void 0,void 0,void 0,e.opacity,void 0,0,e.textOutlineColor)}}const v=pe(e,{id:e.id+"text",paddingTop:n,paddingRight:n,paddingBottom:n,paddingLeft:n});if(v&&!e._prerender){t.push(v);const o=U.textureGetSize(v),l={x:0,y:0},c={width:o.width/R*a,height:o.height/R*a},d=n*a/i,p={x:e.x*a+s.x-d,y:e.y*a+s.y-d,width:c.width,height:e.height?g+d:c.height},h=fe($,d,c,e.textAlign,e.flipX);if(p.x+=h,r){const t=$e($,p,e.rotation);p.x+=t.x,p.y+=t.y}const m=e.color||[0,0,0];e._prerender&&(m[3]=0),U.drawRect(p,e.rotation,e.flipX,e.flipY,u,!1,v,c,l,!1,!1,void 0,void 0,e.opacity,void 0,e.feather,m,e.inverted)}}else if(d){o&&t.push(o);const d=ct(e);let u,p;a&&s&&(d.x*=a,d.y*=a,d.x+=s.x,d.y+=s.y,d.width*=a,d.height*=a);const{backgroundRepeat:h="no-repeat"}=e,m=r&&U.textureGetSize(r);if(m&&e.backgroundImage&&(e.backgroundSize||e.backgroundPosition||e.backgroundRepeat)){const t=xe(e,d,m);u=t.backgroundSize,p=t.backgroundPosition}if(U.drawRect(d,e.rotation,e.flipX,e.flipY,c,e.backgroundColor||[0,0,0,0],r,u,p,"repeat"===h,e.backgroundCorners&&nd(e.backgroundCorners),l,e.strokeColor,e.opacity,void 0,e.feather,e.fillColor,e.inverted),i||n){if(!(e.backgroundColor&&0!==e.backgroundColor[3]||e.strokeColor&&e.strokeWidth)){const t=e.opacity||1;U.drawRect(d,e.rotation,e.flipX,e.flipY,c,n?[1,.2549,.2118,.25*t]:[0,0,0,.25*t])}const t=mt(d);n&&Re(t),i&&Pe(t)}}else o&&t.push(o)})};let Se=0;const ke=[{x:-5,y:-5},{x:5,y:5}],Ce=[{x:5,y:-5},{x:-5,y:5}],Te=Ht({x:0,y:0},10,10,0,!1,!1,16);Te.length=9;const Pe=e=>{Se=Date.now()/50,U.drawEllipse(e,15,15,0,!1,!1,[0,0,0,.5]);const t=_e(Te.map(t=>({x:t.x+e.x,y:t.y+e.y})),Se,e.x,e.y);U.drawPath(t,0,!1,!1,2,[1,1,1])},Re=e=>{U.drawEllipse(e,13,13,0,!1,!1,[1,.2549,.2118,.75]);const t=ke.map(t=>({x:t.x+e.x,y:t.y+e.y})),o=Ce.map(t=>({x:t.x+e.x,y:t.y+e.y}));U.drawPath(t,0,!1,!1,3,[1,1,1]),U.drawPath(o,0,!1,!1,3,[1,1,1])},Ie=(e,t,o,i,n,r)=>U.drawRect(t,0,!1,!1,u,u,e,i,o,!0,void 0,0,void 0,r,void 0,void 0,n);let Ee=!1,Ae=!0,Le=!1;const Fe=[],ze=[],De=[],Oe=e=>!e.aboveFrame,Be=e=>e.aboveFrame,We=()=>{De.length=0;const e=_[0],{manipulationShapes:t,manipulationShapesDirty:o,annotationShapes:i,annotationShapesDirty:n,interfaceShapes:r,decorationShapes:p,frameShapes:m,selectionShapes:g}=E({opacity:e.opacity,rotation:e.rotation,scale:e.scale,images:_,size:Ze(G,Z),backgroundColor:[...d],selectionRect:c}),$=[...d],f=c,y=Rs(l,0,1),x=s,S=Math.abs(e.rotation.x/Math.PI*2-1),w=Math.abs(e.rotation.y/Math.PI*2-1),k=S<.99||w<.99,C={...e.size},P=e.backgroundColor,I=e.backgroundImage,L=e.backgroundFilterMode,F=t.length>0,z=i.length>0,N=i.filter(Be).length>0,j=p.filter(Be).length>0,X=P[3]>0,Y=!!M&&T>=1;if(y<1&&X){const e=$[0],t=$[1],o=$[2],i=1-y,n=P[0]*i,r=P[1]*i,a=P[2]*i,s=1-i;$[0]=n+e*s,$[1]=r+t*s,$[2]=a+o*s,$[3]=1}U.setCanvasColor(b?u:$);F&&(o||Ee)?(U.disableMask(),U.drawToImageBlendBuffer(C),Fe.length=0,ve(t,Fe)):F||(Fe.length=0),De.push(...Fe),Ae&&(U.drawToImageOverlayBuffer(C,R),Ae=!1);if(k){if(z&&(n||Ee)||!Le){U.disableMask(),U.drawToImageOverlayBuffer(C,R),ze.length=0;const e=N?i.filter(Oe):i;ve(e,ze)}else z||(ze.length=0);Le=!0}else Le=!1;if(U.drawToCanvas(),U.enableMask(f,y),D&&B>=1&&2===O.length&&W&&((e,t,o,i,n)=>{const r=Ze(t,t),a=ue(h,"pixelated","repeat"),s=be(-e.x%t,-e.y%t),l=be(s.x+.5*r.width,s.y);Ie(a,e,s,r,o,n),Ie(a,e,l,r,i,n)})(f,B,O[0],O[1],W),X&&U.drawRect(f,0,!1,!1,u,P),I){U.enableMask(f,1);const e=Math.max(v.width/I.width,v.height/I.height),t=I.width*e,o=I.height*e,i={x:v.x+.5*v.width,y:v.y+.5*v.height,width:t,height:o},[n]=_,r=ge({...n,vignette:"image"===L?n.vignette:void 0,gamma:"image"===L?n.gamma:void 0,convolutionMatrix:"image"===L?n.convolutionMatrix:void 0,colorMatrix:"image"===L?n.colorMatrix:void 0,size:{width:I.width,height:I.height},translation:{x:i.x-.5*G,y:i.y-.5*Z},scale:e,origin:{x:0,y:0},rotation:{x:0,y:0,z:0},backgroundColor:[0,0,0,0],backgroundImage:null,enableAntialiasing:!1,texture:ue(I)});De.push(r),U.enableMask(f,y)}if(Y&&U.enablePreviewStencil(),De.push(...[..._].reverse().map(e=>ge({...e,texture:ue(e.data),enableOverlay:k&&z,enableManipulation:F,enableAntialiasing:!0,mask:f,maskOpacity:y,overlayColor:x}))),U.enableMask(f,T),!k){Y&&U.applyPreviewStencil(),U.resetCanvasMatrix(),U.updateCanvasMatrix(C,e.origin,e.translation,e.scale,e.rotation),ze.length=0;const t=N?i.filter(Oe):i;ve(t,ze),Y&&U.disablePreviewStencil()}if(De.push(...ze),U.resetCanvasMatrix(),U.enableMask(f,T),ve(j?p.filter(Oe):p,De),m.length){U.enableMask(f,1);const e=m.filter(e=>!e.expandsCanvas),t=m.filter(e=>e.expandsCanvas);e.length&&ve(e,De),t.length&&(U.enableMask({x:f.x+.5,y:f.y+.5,width:f.width-1,height:f.height-1},a),ve(t,De))}if(N&&(U.resetCanvasMatrix(),U.updateCanvasMatrix(C,e.origin,e.translation,e.scale,e.rotation),ve(i.filter(Be),De),U.resetCanvasMatrix()),j&&(U.resetCanvasMatrix(),ve(p.filter(Be),De),U.resetCanvasMatrix()),H&&g.length&&!k){U.resetCanvasMatrix(),U.updateCanvasMatrix(C,e.origin,e.translation,e.scale,e.rotation);const t=[...H];t[3]=.5;const o=[{id:"selection",color:t,actions:[...g]}].map(e=>re(e,C));ve(o,De),U.resetCanvasMatrix()}U.disableMask(),ve(r,De),V.forEach(e=>{if(U.enableMask(e.mask,e.maskOpacity),I){const t=ge({...e,vignette:"image"===L?e.vignette:void 0,gamma:"image"===L?e.gamma:void 0,convolutionMatrix:"image"===L?e.convolutionMatrix:void 0,colorMatrix:"image"===L?e.colorMatrix:void 0,texture:ue(I),enableAntialiasing:!1,translation:{x:e.translation.x+e.offset.x-.5*G,y:e.translation.y+e.offset.y-.5*Z}});De.push(t)}else e.backgroundColor&&U.drawRect(e.mask,0,!1,!1,e.maskCornerRadius,e.backgroundColor,void 0,void 0,void 0,void 0,void 0,void 0,void 0,e.opacity,e.maskFeather);const t=ge({...e,texture:ue(e.data),enableAntialiasing:!1,translation:{x:e.translation.x+e.offset.x-.5*G,y:e.translation.y+e.offset.y-.5*Z}});De.push(t)}),U.disableMask(),(e=>{le.forEach((t,o)=>{!e.find(e=>e===t)&&id(t)&&(Array.from(ce.values()).includes(t)||(le.delete(o),U.textureDelete(t)))})})(De),A(),Ee=!1};let Ve,Ne=0;const Ue=()=>{clearTimeout(Ve);const e=Date.now();e-Ne<48?Ve=setTimeout(Ue,48):(Ne=e,We())};ya(()=>r()),fa(()=>i(32,U=Cc($,{alpha:b,onContextExhausted:()=>{j("EXHAUSTED")}}))),ba(()=>{U&&(he.forEach(({canvas:e})=>S(e)),he.clear(),U.release(),i(32,U=void 0),i(0,$=void 0))});return e.$$set=e=>{"isAnimated"in e&&i(9,f=e.isAnimated),"isTransparent"in e&&i(10,b=e.isTransparent),"maskRect"in e&&i(11,v=e.maskRect),"maskOpacity"in e&&i(12,k=e.maskOpacity),"maskFrameOpacity"in e&&i(13,C=e.maskFrameOpacity),"maskMarkupOpacity"in e&&i(14,T=e.maskMarkupOpacity),"clipAnnotationsToImage"in e&&i(15,M=e.clipAnnotationsToImage),"pixelRatio"in e&&i(16,P=e.pixelRatio),"textPixelRatio"in e&&i(17,R=e.textPixelRatio),"backgroundColor"in e&&i(18,I=e.backgroundColor),"willRender"in e&&i(19,E=e.willRender),"didRender"in e&&i(20,A=e.didRender),"willRequest"in e&&i(21,L=e.willRequest),"csp"in e&&i(22,F=e.csp),"loadImageData"in e&&i(23,z=e.loadImageData),"enableGrid"in e&&i(24,D=e.enableGrid),"gridColors"in e&&i(25,O=e.gridColors),"gridSize"in e&&i(26,B=e.gridSize),"gridOpacity"in e&&i(27,W=e.gridOpacity),"images"in e&&i(28,_=e.images),"interfaceImages"in e&&i(29,V=e.interfaceImages),"selectionColor"in e&&i(30,H=e.selectionColor),"onerror"in e&&i(31,j=e.onerror)},e.$$.update=()=>{if(1&e.$$.dirty[0]&&$){const e=getComputedStyle($).getPropertyValue("--color-transition-duration");i(33,q=(e=>{let t=parseFloat(e);return/^[0-9]+s$/.test(e)?1e3*t:t})(e))}262656&e.$$.dirty[0]|4&e.$$.dirty[1]&&I&&K.set(I,{duration:f?q:0}),4096&e.$$.dirty[0]&&X(J,No(k)?k:1),8192&e.$$.dirty[0]&&X(te,No(C)?C:1),2048&e.$$.dirty[0]&&v&&oe.set(v),96&e.$$.dirty[1]&&d&&ie.set([d[0],d[1],d[2],Rs(l,0,1)]),268435462&e.$$.dirty[0]|2&e.$$.dirty[1]&&i(35,n=!!(U&&G&&Z&&_.length)),65542&e.$$.dirty[0]|2&e.$$.dirty[1]&&G&&Z&&U&&(Ne=0,U.resize(G,Z,P)),16&e.$$.dirty[1]&&i(34,r=n?od()?Ue:We:o),24&e.$$.dirty[1]&&n&&r&&r()},[$,G,Z,g,K,J,te,oe,ie,f,b,v,k,C,T,M,P,R,I,E,A,L,F,z,D,O,B,W,_,V,H,j,U,q,r,n,l,d,function(e){Ca[e?"unshift":"push"](()=>{$=e,i(0,$)})},e=>{i(1,G=e.detail.width),i(2,Z=e.detail.height),g("measure",{width:G,height:Z})}]}class sd extends rs{constructor(e){super(),ns(this,e,ad,rd,yr,{isAnimated:9,isTransparent:10,maskRect:11,maskOpacity:12,maskFrameOpacity:13,maskMarkupOpacity:14,clipAnnotationsToImage:15,pixelRatio:16,textPixelRatio:17,backgroundColor:18,willRender:19,didRender:20,willRequest:21,csp:22,loadImageData:23,enableGrid:24,gridColors:25,gridSize:26,gridOpacity:27,images:28,interfaceImages:29,selectionColor:30,onerror:31},null,[-1,-1,-1])}}var ld=(e,t=Boolean,o=" ")=>e.filter(t).join(o);function cd(e,t,o){const i=e.slice();return i[17]=t[o],i}const dd=e=>({tab:4&e}),ud=e=>({tab:e[17]});function pd(e){let t,o,i,n=[],r=new Map,a=Xa(e[2]);const s=e=>e[17].id;for(let t=0;t<a.length;t+=1){let o=cd(e,a,t),i=s(o);r.set(i,n[t]=hd(i,o))}return{c(){t=Ur("div");for(let e=0;e<n.length;e+=1)n[e].c();Qr(t,"class",o=ld(["PinturaTabList",e[0]])),Qr(t,"role","tablist"),Qr(t,"data-layout",e[1])},m(o,r){Hr(o,t,r);for(let e=0;e<n.length;e+=1)n[e]&&n[e].m(t,null);e[14](t),i=!0},p(e,l){1124&l&&(a=Xa(e[2]),Na(),n=Ka(n,l,s,1,e,a,r,t,qa,hd,null,cd),Ha()),(!i||1&l&&o!==(o=ld(["PinturaTabList",e[0]])))&&Qr(t,"class",o),(!i||2&l)&&Qr(t,"data-layout",e[1])},i(e){if(!i){for(let e=0;e<a.length;e+=1)ja(n[e]);i=!0}},o(e){for(let e=0;e<n.length;e+=1)Ua(n[e]);i=!1},d(o){o&&jr(t);for(let e=0;e<n.length;e+=1)n[e].d();e[14](null)}}}function hd(e,t){let o,i,n,r,a,s,l,c,d,u;const p=t[11].default,h=kr(p,t,t[10],ud);function m(...e){return t[12](t[17],...e)}function g(...e){return t[13](t[17],...e)}return{key:e,first:null,c(){o=Ur("button"),h&&h.c(),i=Xr(),Qr(o,"role","tab"),Qr(o,"title",n=t[17].title),Qr(o,"id",r=t[17].tabId),Qr(o,"aria-controls",a=t[17].href.substring(1)),Qr(o,"aria-selected",s=t[17].selected),o.disabled=l=t[17].disabled,Qr(o,"type","button"),this.first=o},m(e,t){Hr(e,o,t),h&&h.m(o,null),_r(o,i),c=!0,d||(u=[qr(o,"keydown",m),qr(o,"click",g)],d=!0)},p(e,i){t=e,h&&h.p&&(!c||1028&i)&&Mr(h,p,t,t[10],c?Tr(p,t[10],i,dd):Pr(t[10]),ud),(!c||4&i&&n!==(n=t[17].title))&&Qr(o,"title",n),(!c||4&i&&r!==(r=t[17].tabId))&&Qr(o,"id",r),(!c||4&i&&a!==(a=t[17].href.substring(1)))&&Qr(o,"aria-controls",a),(!c||4&i&&s!==(s=t[17].selected))&&Qr(o,"aria-selected",s),(!c||4&i&&l!==(l=t[17].disabled))&&(o.disabled=l)},i(e){c||(ja(h,e),c=!0)},o(e){Ua(h,e),c=!1},d(e){e&&jr(o),h&&h.d(e),d=!1,$r(u)}}}function md(e){let t,o,i=e[4]&&pd(e);return{c(){i&&i.c(),t=Yr()},m(e,n){i&&i.m(e,n),Hr(e,t,n),o=!0},p(e,[o]){e[4]?i?(i.p(e,o),16&o&&ja(i,1)):(i=pd(e),i.c(),ja(i,1),i.m(t.parentNode,t)):i&&(Na(),Ua(i,1,1,()=>{i=null}),Ha())},i(e){o||(ja(i),o=!0)},o(e){Ua(i),o=!1},d(e){e&&jr(t),i&&i.d(e)}}}function gd(e,t,o){let i,n,r,{$$slots:a={},$$scope:s}=t,{class:l}=t,{name:c}=t,{selected:d}=t,{tabs:u=[]}=t,{layout:p}=t;const h=xa(),m=e=>{const t=r.querySelectorAll('[role="tab"] button')[e];t&&t.focus()},g=(e,t)=>{e.preventDefault(),e.stopPropagation(),no()&&e.target.focus(),h("select",t)},$=({key:e},t)=>{if(!/arrow/i.test(e))return;const o=u.findIndex(e=>e.id===t);return/right|down/i.test(e)?m(o<u.length-1?o+1:0):/left|up/i.test(e)?m(o>0?o-1:u.length-1):void 0};return e.$$set=e=>{"class"in e&&o(0,l=e.class),"name"in e&&o(7,c=e.name),"selected"in e&&o(8,d=e.selected),"tabs"in e&&o(9,u=e.tabs),"layout"in e&&o(1,p=e.layout),"$$scope"in e&&o(10,s=e.$$scope)},e.$$.update=()=>{896&e.$$.dirty&&o(2,i=u.map(e=>{const t=e.id===d;return{...e,tabId:`tab-${c}-${e.id}`,href:`#panel-${c}-${e.id}`,selected:t}})),4&e.$$.dirty&&o(4,n=i.length>1)},[l,p,i,r,n,g,$,c,d,u,s,a,(e,t)=>$(t,e.id),(e,t)=>g(t,e.id),function(e){Ca[e?"unshift":"push"](()=>{r=e,o(3,r)})}]}class $d extends rs{constructor(e){super(),ns(this,e,gd,md,yr,{class:0,name:7,selected:8,tabs:9,layout:1})}}var fd=(e,t)=>{if(!t)return;const o=t=>{b(e,t)};return o(t),{update:o}};const yd=e=>({panel:16&e}),bd=e=>({panel:e[4][0].id,panelIsActive:!0});function xd(e,t,o){const i=e.slice();return i[14]=t[o].id,i[15]=t[o].shouldDraw,i[16]=t[o].panelId,i[17]=t[o].labelledBy,i[18]=t[o].isActive,i[19]=t[o].hidden,i[3]=t[o].visible,i}const vd=e=>({panel:16&e,panelIsActive:16&e}),Sd=e=>({panel:e[14],panelIsActive:e[18]});function wd(e){let t,o,i,n,r,a,s;const l=e[11].default,c=kr(l,e,e[10],bd);return{c(){t=Ur("div"),o=Ur("div"),c&&c.c(),Qr(o,"class",i=ld([e[1]])),Qr(t,"class",e[0])},m(i,l){Hr(i,t,l),_r(t,o),c&&c.m(o,null),r=!0,a||(s=[Ar(n=fd.call(null,t,e[2])),qr(t,"measure",e[13]),Ar(qc.call(null,t))],a=!0)},p(e,a){c&&c.p&&(!r||1040&a)&&Mr(c,l,e,e[10],r?Tr(l,e[10],a,yd):Pr(e[10]),bd),(!r||2&a&&i!==(i=ld([e[1]])))&&Qr(o,"class",i),(!r||1&a)&&Qr(t,"class",e[0]),n&&fr(n.update)&&4&a&&n.update.call(null,e[2])},i(e){r||(ja(c,e),r=!0)},o(e){Ua(c,e),r=!1},d(e){e&&jr(t),c&&c.d(e),a=!1,$r(s)}}}function kd(e){let t,o,i,n,r,a,s=[],l=new Map,c=Xa(e[4]);const d=e=>e[14];for(let t=0;t<c.length;t+=1){let o=xd(e,c,t),i=d(o);l.set(i,s[t]=Td(i,o))}return{c(){t=Ur("div");for(let e=0;e<s.length;e+=1)s[e].c();Qr(t,"class",o=ld(["PinturaTabPanels",e[0]]))},m(o,l){Hr(o,t,l);for(let e=0;e<s.length;e+=1)s[e]&&s[e].m(t,null);n=!0,r||(a=[Ar(i=fd.call(null,t,e[2])),qr(t,"measure",e[12]),Ar(qc.call(null,t,{observePosition:!0}))],r=!0)},p(e,r){1042&r&&(c=Xa(e[4]),Na(),s=Ka(s,r,d,1,e,c,l,t,qa,Td,null,xd),Ha()),(!n||1&r&&o!==(o=ld(["PinturaTabPanels",e[0]])))&&Qr(t,"class",o),i&&fr(i.update)&&4&r&&i.update.call(null,e[2])},i(e){if(!n){for(let e=0;e<c.length;e+=1)ja(s[e]);n=!0}},o(e){for(let e=0;e<s.length;e+=1)Ua(s[e]);n=!1},d(e){e&&jr(t);for(let e=0;e<s.length;e+=1)s[e].d();r=!1,$r(a)}}}function Cd(e){let t;const o=e[11].default,i=kr(o,e,e[10],Sd);return{c(){i&&i.c()},m(e,o){i&&i.m(e,o),t=!0},p(e,n){i&&i.p&&(!t||1040&n)&&Mr(i,o,e,e[10],t?Tr(o,e[10],n,vd):Pr(e[10]),Sd)},i(e){t||(ja(i,e),t=!0)},o(e){Ua(i,e),t=!1},d(e){i&&i.d(e)}}}function Td(e,t){let o,i,n,r,a,s,l,c,d=t[15]&&Cd(t);return{key:e,first:null,c(){o=Ur("div"),d&&d.c(),i=Xr(),Qr(o,"id",n=t[16]),Qr(o,"class",r=ld(["PinturaTabPanel",t[1]])),Qr(o,"aria-hidden",a=t[19]),Qr(o,"aria-labelledby",s=t[17]),Qr(o,"data-inert",l=!t[3]),Qr(o,"role","tabpanel"),this.first=o},m(e,t){Hr(e,o,t),d&&d.m(o,null),_r(o,i),c=!0},p(e,u){(t=e)[15]?d?(d.p(t,u),16&u&&ja(d,1)):(d=Cd(t),d.c(),ja(d,1),d.m(o,i)):d&&(Na(),Ua(d,1,1,()=>{d=null}),Ha()),(!c||16&u&&n!==(n=t[16]))&&Qr(o,"id",n),(!c||2&u&&r!==(r=ld(["PinturaTabPanel",t[1]])))&&Qr(o,"class",r),(!c||16&u&&a!==(a=t[19]))&&Qr(o,"aria-hidden",a),(!c||16&u&&s!==(s=t[17]))&&Qr(o,"aria-labelledby",s),(!c||16&u&&l!==(l=!t[3]))&&Qr(o,"data-inert",l)},i(e){c||(ja(d),c=!0)},o(e){Ua(d),c=!1},d(e){e&&jr(o),d&&d.d()}}}function Md(e){let t,o,i,n;const r=[kd,wd],a=[];function s(e,t){return e[5]?0:1}return t=s(e),o=a[t]=r[t](e),{c(){o.c(),i=Yr()},m(e,o){a[t].m(e,o),Hr(e,i,o),n=!0},p(e,[n]){let l=t;t=s(e),t===l?a[t].p(e,n):(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha(),o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),ja(o,1),o.m(i.parentNode,i))},i(e){n||(ja(o),n=!0)},o(e){Ua(o),n=!1},d(e){e&&jr(i),a[t].d(e)}}}function Pd(e,t,o){let i,n,{$$slots:r={},$$scope:a}=t,{class:s}=t,{name:l}=t,{selected:c}=t,{panelClass:d}=t,{panels:u=[]}=t,{visible:p}=t,{style:h}=t;const m={};return e.$$set=e=>{"class"in e&&o(0,s=e.class),"name"in e&&o(6,l=e.name),"selected"in e&&o(7,c=e.selected),"panelClass"in e&&o(1,d=e.panelClass),"panels"in e&&o(8,u=e.panels),"visible"in e&&o(3,p=e.visible),"style"in e&&o(2,h=e.style),"$$scope"in e&&o(10,a=e.$$scope)},e.$$.update=()=>{968&e.$$.dirty&&o(4,i=u.map(e=>{const t=e===c;t&&o(9,m[e]=!0,m);const i=p?-1!==p.indexOf(e):t;return{id:e,panelId:`panel-${l}-${e}`,labelledBy:`tab-${l}-${e}`,isActive:t,hidden:!t,visible:i,shouldDraw:t||m[e]}})),16&e.$$.dirty&&o(5,n=i.length>1)},[s,d,h,p,i,n,l,c,u,m,a,r,function(t){wa.call(this,e,t)},function(t){wa.call(this,e,t)}]}class Rd extends rs{constructor(e){super(),ns(this,e,Pd,Md,yr,{class:0,name:6,selected:7,panelClass:1,panels:8,visible:3,style:2})}}var Id=e=>{const t=Object.getOwnPropertyDescriptors(e.prototype);return Object.keys(t).filter(e=>!!t[e].get)};function Ed(e){let t,o,i,n;const r=[e[5],{locale:e[1]}];function a(t){e[22](t)}var s=e[10];function l(e,t){let o={};for(let e=0;e<r.length;e+=1)o=hr(o,r[e]);return void 0!==t&&34&t[0]&&(o=hr(o,Ja(r,[32&t[0]&&Qa(e[5]),2&t[0]&&{locale:e[1]}]))),void 0!==e[3]&&(o.name=e[3]),{props:o}}return s&&(t=ca(s,l(e)),Ca.push(()=>es(t,"name",a)),e[23](t),t.$on("measure",e[11])),{c(){t&&ts(t.$$.fragment),i=Yr()},m(e,o){t&&os(t,e,o),Hr(e,i,o),n=!0},p(e,n){if(s!==(s=e[10])){if(t){Na();const e=t;Ua(e.$$.fragment,1,0,()=>{is(e,1)}),Ha()}s?(t=ca(s,l(e,n)),Ca.push(()=>es(t,"name",a)),e[23](t),t.$on("measure",e[11]),ts(t.$$.fragment),ja(t.$$.fragment,1),os(t,i.parentNode,i)):t=null}else if(s){const i=34&n[0]?Ja(r,[32&n[0]&&Qa(e[5]),2&n[0]&&{locale:e[1]}]):{};!o&&8&n[0]&&(o=!0,i.name=e[3],La(()=>o=!1)),t.$set(i)}},i(e){n||(t&&ja(t.$$.fragment,e),n=!0)},o(e){t&&Ua(t.$$.fragment,e),n=!1},d(o){o&&jr(i),e[23](null),t&&is(t,o)}}}function Ad(e){let t,o,i,n=e[6]&&Ed(e);return{c(){t=Ur("div"),n&&n.c(),Qr(t,"data-util",e[3]),Qr(t,"class",o=ld(["PinturaUtilPanel",e[2]])),aa(t,"opacity",e[7])},m(o,r){Hr(o,t,r),n&&n.m(t,null),e[24](t),i=!0},p(e,r){e[6]?n?(n.p(e,r),64&r[0]&&ja(n,1)):(n=Ed(e),n.c(),ja(n,1),n.m(t,null)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),(!i||8&r[0])&&Qr(t,"data-util",e[3]),(!i||4&r[0]&&o!==(o=ld(["PinturaUtilPanel",e[2]])))&&Qr(t,"class",o),128&r[0]&&aa(t,"opacity",e[7])},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(o){o&&jr(t),n&&n.d(),e[24](null)}}}function Ld(e,t,o){let i,n,r,a,s;const l=xa();let{isActive:c=!0}=t,{stores:d}=t,{view:u}=t,{props:p}=t,{component:h}=t,{locale:m}=t,{class:g}=t;const $=Sa("isAnimated");let f;wr(e,$,e=>o(21,s=e));const y=Fc(0),b=cs(y,e=>Rs(e,0,1));wr(e,b,e=>o(20,a=e));let x=!c;const v=ls(c),S=cs(v,async(e,t)=>{if(!e)return t(e);await Ea(),t(e)},!1),w=cs(b,e=>e),k=cs(b,e=>e>0),C={isActive:S,isActiveFraction:w,isVisible:k},T=u,M=Id(T),P=Object.keys(p||{}).reduce((e,t)=>M.includes(t)?(e[t]=p[t],e):e,{}),R=Object.keys(C).reduce((e,t)=>M.includes(t)?(e[t]=C[t],e):e,{});let I,E;const A=e=>{o(17,f={...e.detail}),F&&c&&l("measure",{...f})};va("measurable",qc);const L=$a().$$.context;let F=!1;return fa(()=>{if(o(19,F=!0),r)return;o(0,h=new T({target:E,props:{...n,locale:m},context:L})),o(3,I=h.name);const e=h.$on("measure",A);return()=>{e(),h.$destroy()}}),e.$$set=e=>{"isActive"in e&&o(12,c=e.isActive),"stores"in e&&o(13,d=e.stores),"view"in e&&o(14,u=e.view),"props"in e&&o(15,p=e.props),"component"in e&&o(0,h=e.component),"locale"in e&&o(1,m=e.locale),"class"in e&&o(2,g=e.class)},e.$$.update=()=>{135169&e.$$.dirty[0]&&f&&c&&h&&l("measure",f),2101248&e.$$.dirty[0]&&y.set(c?1:0,{hard:!1===s}),1310720&e.$$.dirty[0]&&(a<=0&&!x?o(18,x=!0):a>0&&x&&o(18,x=!1)),786432&e.$$.dirty[0]&&F&&l(x?"hide":"show"),1048576&e.$$.dirty[0]&&l("fade",a),1048576&e.$$.dirty[0]&&o(7,i=a),4096&e.$$.dirty[0]&&v.set(c),8192&e.$$.dirty[0]&&o(5,n={...P,...R,stores:d})},o(6,r=!M.includes("external")),[h,m,g,I,E,n,r,i,$,b,T,A,c,d,u,p,y,f,x,F,a,s,function(e){I=e,o(3,I)},function(e){Ca[e?"unshift":"push"](()=>{h=e,o(0,h)})},function(e){Ca[e?"unshift":"push"](()=>{E=e,o(4,E)})}]}class Fd extends rs{constructor(e){super(),ns(this,e,Ld,Ad,yr,{isActive:12,stores:13,view:14,props:15,component:0,locale:1,class:2,opacity:16},null,[-1,-1])}get opacity(){return this.$$.ctx[16]}}function zd(e){let t,o,i,n,r,a;const s=e[5].default,l=kr(s,e,e[4],null);return{c(){t=Gr("svg"),l&&l.c(),Qr(t,"class",e[3]),Qr(t,"width",e[0]),Qr(t,"height",e[1]),Qr(t,"viewBox",o="0 0 "+e[0]+"\n "+e[1]),Qr(t,"xmlns","http://www.w3.org/2000/svg"),Qr(t,"aria-hidden","true"),Qr(t,"focusable","false"),Qr(t,"stroke-linecap","round"),Qr(t,"stroke-linejoin","round")},m(o,s){Hr(o,t,s),l&&l.m(t,null),n=!0,r||(a=Ar(i=fd.call(null,t,e[2])),r=!0)},p(e,[r]){l&&l.p&&(!n||16&r)&&Mr(l,s,e,e[4],n?Tr(s,e[4],r,null):Pr(e[4]),null),(!n||8&r)&&Qr(t,"class",e[3]),(!n||1&r)&&Qr(t,"width",e[0]),(!n||2&r)&&Qr(t,"height",e[1]),(!n||3&r&&o!==(o="0 0 "+e[0]+"\n "+e[1]))&&Qr(t,"viewBox",o),i&&fr(i.update)&&4&r&&i.update.call(null,e[2])},i(e){n||(ja(l,e),n=!0)},o(e){Ua(l,e),n=!1},d(e){e&&jr(t),l&&l.d(e),r=!1,a()}}}function Dd(e,t,o){let{$$slots:i={},$$scope:n}=t,{width:r=24}=t,{height:a=24}=t,{style:s}=t,{class:l}=t;return e.$$set=e=>{"width"in e&&o(0,r=e.width),"height"in e&&o(1,a=e.height),"style"in e&&o(2,s=e.style),"class"in e&&o(3,l=e.class),"$$scope"in e&&o(4,n=e.$$scope)},[r,a,s,l,n,i]}class Od extends rs{constructor(e){super(),ns(this,e,Dd,zd,yr,{width:0,height:1,style:2,class:3})}}var Bd=(e,t)=>t===e.target||t.contains(e.target),Wd=(e,t,o)=>{const i=y(t)?t:e;return o?`${i} (${n=o,n.map(e=>"CMD"===e?ko()?"⌘":"Ctrl":e).join("+")})`:i;var n};const{document:_d}=Wr;function Vd(e){let t,o,i,n;return{c(){t=Xr(),o=Ur("button"),Qr(o,"class","PinturaImageButton"),Qr(o,"type","button"),Qr(o,"title",e[1]),o.disabled=e[2]},m(r,a){Hr(r,t,a),Hr(r,o,a),o.innerHTML=e[0],e[11](o),i||(n=[qr(_d.body,"load",e[5],!0),qr(_d.body,"error",e[6],!0),qr(o,"pointerdown",e[4])],i=!0)},p(e,[t]){1&t&&(o.innerHTML=e[0]),2&t&&Qr(o,"title",e[1]),4&t&&(o.disabled=e[2])},i:ur,o:ur,d(r){r&&(jr(t),jr(o)),e[11](null),i=!1,$r(n)}}}function Nd(e,t,i){let n,{html:r}=t,{title:a}=t,{onclick:s}=t,{disabled:l=!1}=t,{ongrab:c=o}=t,{ondrag:d=o}=t,{ondrop:u=o}=t;const p=e=>ze(h,be(e.pageX,e.pageY))<256;let h;const m=e=>{document.documentElement.removeEventListener("pointermove",g),document.documentElement.removeEventListener("pointerup",m);const t=be(e.pageX,e.pageY);if(ze(h,t)<32)return s(e);p(e)||u(e)},g=e=>{p(e)||d(e)},$=e=>n&&n.contains(e)&&"IMG"===e.nodeName;return e.$$set=e=>{"html"in e&&i(0,r=e.html),"title"in e&&i(1,a=e.title),"onclick"in e&&i(7,s=e.onclick),"disabled"in e&&i(2,l=e.disabled),"ongrab"in e&&i(8,c=e.ongrab),"ondrag"in e&&i(9,d=e.ondrag),"ondrop"in e&&i(10,u=e.ondrop)},e.$$.update=()=>{8&e.$$.dirty&&n&&n.querySelector("img")&&i(3,n.dataset.loader=!0,n)},[r,a,l,n,e=>{h=be(e.pageX,e.pageY),c(e),document.documentElement.addEventListener("pointermove",g),document.documentElement.addEventListener("pointerup",m)},({target:e})=>{$(e)&&i(3,n.dataset.load=!0,n)},({target:e})=>{$(e)&&i(3,n.dataset.error=!0,n)},s,c,d,u,function(e){Ca[e?"unshift":"push"](()=>{n=e,i(3,n)})}]}class Hd extends rs{constructor(e){super(),ns(this,e,Nd,Vd,yr,{html:0,title:1,onclick:7,disabled:2,ongrab:8,ondrag:9,ondrop:10})}}function jd(e,t,o){const i=e.slice();return i[13]=t[o],i}function Ud(e,t){let o,i,n,r,a,s,l;function c(){return t[9](t[13])}function d(...e){return t[10](t[13],...e)}function u(...e){return t[11](t[13],...e)}function p(...e){return t[12](t[13],...e)}return i=new Hd({props:{onclick:c,ongrab:d,ondrag:u,ondrop:p,disabled:t[1]||t[13].disabled,title:t[13].title,html:t[13].thumb}}),{key:e,first:null,c(){o=Ur("li"),ts(i.$$.fragment),n=Xr(),aa(o,"opacity",t[6]),this.first=o},m(e,c){Hr(e,o,c),os(i,o,null),_r(o,n),a=!0,s||(l=Ar(r=t[8].call(null,o,t[13])),s=!0)},p(e,n){t=e;const a={};5&n&&(a.onclick=c),9&n&&(a.ongrab=d),17&n&&(a.ondrag=u),33&n&&(a.ondrop=p),3&n&&(a.disabled=t[1]||t[13].disabled),1&n&&(a.title=t[13].title),1&n&&(a.html=t[13].thumb),i.$set(a),r&&fr(r.update)&&1&n&&r.update.call(null,t[13]),64&n&&aa(o,"opacity",t[6])},i(e){a||(ja(i.$$.fragment,e),a=!0)},o(e){Ua(i.$$.fragment,e),a=!1},d(e){e&&jr(o),is(i),s=!1,l()}}}function Gd(e){let t,o,i=[],n=new Map,r=Xa(e[0]);const a=e=>e[13].id;for(let t=0;t<r.length;t+=1){let o=jd(e,r,t),s=a(o);n.set(s,i[t]=Ud(s,o))}return{c(){t=Ur("ul");for(let e=0;e<i.length;e+=1)i[e].c();Qr(t,"class","PinturaImageButtonList")},m(e,n){Hr(e,t,n);for(let e=0;e<i.length;e+=1)i[e]&&i[e].m(t,null);o=!0},p(e,[o]){127&o&&(r=Xa(e[0]),Na(),i=Ka(i,o,a,1,e,r,n,t,qa,Ud,null,jd),Ha())},i(e){if(!o){for(let e=0;e<r.length;e+=1)ja(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)Ua(i[e]);o=!1},d(e){e&&jr(t);for(let e=0;e<i.length;e+=1)i[e].d()}}}function Zd(e,t,o){let i,{items:n}=t,{disabled:r}=t,{onclickitem:a}=t,{ongrabitem:s}=t,{ondragitem:l}=t,{ondropitem:c}=t;const d=Fc(0,{stiffness:.25,damping:.9});wr(e,d,e=>o(6,i=e));fa(()=>d.set(1));return e.$$set=e=>{"items"in e&&o(0,n=e.items),"disabled"in e&&o(1,r=e.disabled),"onclickitem"in e&&o(2,a=e.onclickitem),"ongrabitem"in e&&o(3,s=e.ongrabitem),"ondragitem"in e&&o(4,l=e.ondragitem),"ondropitem"in e&&o(5,c=e.ondropitem)},[n,r,a,s,l,c,i,d,(e,t)=>t.mount&&t.mount(e.firstChild,t),e=>a(e.id),(e,t)=>s&&s(e.id,t),(e,t)=>l&&l(e.id,t),(e,t)=>c&&c(e.id,t)]}class Xd extends rs{constructor(e){super(),ns(this,e,Zd,Gd,yr,{items:0,disabled:1,onclickitem:2,ongrabitem:3,ondragitem:4,ondropitem:5})}}var Yd=()=>m()&&window.devicePixelRatio||1;let qd=null;var Kd=e=>(null===qd&&(qd=1===Yd()?Math.round:e=>e),qd(e)),Jd=(e,t={})=>{if(e){if(t.preventScroll&&no()){const t=document.body.scrollTop;return e.focus(),void(document.body.scrollTop=t)}e.focus(t)}},Qd=e=>/date|email|number|search|text|url/.test(e.type),eu=e=>(e=>/textarea/i.test(e.nodeName))(e)||Qd(e)||e.isContentEditable;const tu=e=>({}),ou=e=>({}),iu=e=>({}),nu=e=>({});function ru(e){let t,o;const i=[e[7]];let n={$$slots:{default:[su]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Dh({props:n}),e[54](t),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=128&o[0]?Ja(i,[Qa(e[7])]):{};134217728&o[1]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(o){e[54](null),is(t,o)}}}function au(e){let t,o;const i=[e[7]];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Dh({props:n}),e[53](t),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=128&o[0]?Ja(i,[Qa(e[7])]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(o){e[53](null),is(t,o)}}}function su(e){let t;const o=e[52].label,i=kr(o,e,e[58],nu);return{c(){i&&i.c()},m(e,o){i&&i.m(e,o),t=!0},p(e,n){i&&i.p&&(!t||134217728&n[1])&&Mr(i,o,e,e[58],t?Tr(o,e[58],n,iu):Pr(e[58]),nu)},i(e){t||(ja(i,e),t=!0)},o(e){Ua(i,e),t=!1},d(e){i&&i.d(e)}}}function lu(e){let t,o,i,n,r,a,s;const l=e[52].details,c=kr(l,e,e[58],ou);return{c(){t=Ur("div"),c&&c.c(),o=Xr(),i=Ur("span"),Qr(i,"class","PinturaPanelTip"),Qr(i,"data-top",e[10]),aa(i,"opacity",e[14]),aa(i,"transform",e[13]),aa(i,"top",e[12]),aa(i,"left",e[11]),Qr(t,"class",n=ld(["PinturaPanel","pintura-editor-panel",e[2]])),Qr(t,"tabindex","-1"),aa(t,"opacity",e[18]),aa(t,"pointer-events",e[17]),aa(t,"transform",e[16]),aa(t,"--panel-max-height",e[15])},m(n,l){Hr(n,t,l),c&&c.m(t,null),_r(t,o),_r(t,i),e[55](t),r=!0,a||(s=[qr(t,"close",e[56]),qr(t,"keydown",e[25]),qr(t,"measure",e[57]),Ar(qc.call(null,t))],a=!0)},p(e,o){c&&c.p&&(!r||134217728&o[1])&&Mr(c,l,e,e[58],r?Tr(l,e[58],o,tu):Pr(e[58]),ou),(!r||1024&o[0])&&Qr(i,"data-top",e[10]),16384&o[0]&&aa(i,"opacity",e[14]),8192&o[0]&&aa(i,"transform",e[13]),4096&o[0]&&aa(i,"top",e[12]),2048&o[0]&&aa(i,"left",e[11]),(!r||4&o[0]&&n!==(n=ld(["PinturaPanel","pintura-editor-panel",e[2]])))&&Qr(t,"class",n),262144&o[0]&&aa(t,"opacity",e[18]),131072&o[0]&&aa(t,"pointer-events",e[17]),65536&o[0]&&aa(t,"transform",e[16]),32768&o[0]&&aa(t,"--panel-max-height",e[15])},i(e){r||(ja(c,e),r=!0)},o(e){Ua(c,e),r=!1},d(o){o&&jr(t),c&&c.d(o),e[55](null),a=!1,$r(s)}}}function cu(e){let t,o,i,n,r,a,s,l,c;const d=[au,ru],u=[];function p(e,t){return e[1]?0:1}o=p(e),i=u[o]=d[o](e);let h=e[6]&&lu(e),m=!1;return{c(){t=Xr(),i.c(),n=Xr(),h&&h.c(),r=Xr(),a=Yr()},m(i,d){Hr(i,t,d),u[o].m(i,d),Hr(i,n,d),h&&h.m(i,d),Hr(i,r,d),Hr(i,a,d),s=!0,l||(c=[qr(document.body,"pointerdown",function(){fr(e[9])&&e[9].apply(this,arguments)}),qr(document.body,"pointerup",function(){fr(e[8])&&e[8].apply(this,arguments)})],l=!0)},p(t,a){let s=o;o=p(e=t),o===s?u[o].p(e,a):(Na(),Ua(u[s],1,1,()=>{u[s]=null}),Ha(),i=u[o],i?i.p(e,a):(i=u[o]=d[o](e),i.c()),ja(i,1),i.m(n.parentNode,n)),e[6]?h?(h.p(e,a),64&a[0]&&ja(h,1)):(h=lu(e),h.c(),ja(h,1),h.m(r.parentNode,r)):h&&(Na(),Ua(h,1,1,()=>{h=null}),Ha())},i(e){s||(ja(i),ja(h),ja(m),s=!0)},o(e){Ua(i),Ua(h),Ua(m),s=!1},d(e){e&&(jr(t),jr(n),jr(r),jr(a)),u[o].d(e),h&&h.d(e),l=!1,$r(c)}}}let du=12;function uu(e,t,i){let n,r,a,s,l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w,k,C,T,M,P,{$$slots:R={},$$scope:I}=t,{buttonClass:E}=t,{buttonLabel:A}=t,{buttonLabelClass:F}=t,{buttonHideLabel:z}=t,{buttonIcon:D}=t,{buttonTitle:O}=t,{buttonOnClick:B}=t,{panelClass:W}=t,{isActive:_=!1}=t,{onshow:V=o}=t,{onhide:N=o}=t,{canConfirm:H=!1}=t;const j=Sa("isAnimated");wr(e,j,e=>i(51,P=e));const U=Sa("rootPortal");wr(e,U,e=>i(46,w=e));const G=Sa("rootRect");let Z,X,Y;wr(e,G,e=>i(48,C=e));const q=()=>i(35,Y=n&&n.getBoundingClientRect());let K=ye(),J=Fc(0);wr(e,J,e=>i(49,T=e));let Q=ye();const ee=ls({x:0,y:0});wr(e,ee,e=>i(47,k=e));const te=Fc(-5,{stiffness:.1,damping:.35,precision:.001});wr(e,te,e=>i(50,M=e));let oe=!0;const ie=e=>Bd(e,w)||X.isEventTarget(e);let ne,re,ae=!1;const se=e=>{eu(e.target)||(L(B)&&B(),_||q(),i(40,re=e),i(0,_=!_))},le=e=>{/down/i.test(e.key)&&(e.target&&eu(e.target)||(i(0,_=!0),i(40,re=e)))};ba(()=>{if(!w)return;if(!ne)return;const e=ne;Ea().then(()=>{e.parentNode&&e.remove()})});return e.$$set=e=>{"buttonClass"in e&&i(26,E=e.buttonClass),"buttonLabel"in e&&i(1,A=e.buttonLabel),"buttonLabelClass"in e&&i(27,F=e.buttonLabelClass),"buttonHideLabel"in e&&i(28,z=e.buttonHideLabel),"buttonIcon"in e&&i(29,D=e.buttonIcon),"buttonTitle"in e&&i(30,O=e.buttonTitle),"buttonOnClick"in e&&i(31,B=e.buttonOnClick),"panelClass"in e&&i(2,W=e.panelClass),"isActive"in e&&i(0,_=e.isActive),"onshow"in e&&i(32,V=e.onshow),"onhide"in e&&i(33,N=e.onhide),"canConfirm"in e&&i(34,H=e.canConfirm),"$$scope"in e&&i(58,I=e.$$scope)},e.$$.update=()=>{if(16&e.$$.dirty[0]&&(n=X&&X.getElement()),1&e.$$.dirty[0]|256&e.$$.dirty[1]&&i(8,v=_?e=>{ae&&(i(39,ae=!1),ie(e)||i(0,_=!1))}:void 0),1&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&J.set(_?1:0,{hard:!1===P}),1&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&te.set(_?0:-5,{hard:!1===P}),524288&e.$$.dirty[1]&&i(44,r=1-M/-5),1&e.$$.dirty[0]|131072&e.$$.dirty[1]&&C&&_&&q(),9&e.$$.dirty[0]|131088&e.$$.dirty[1]&&C&&Z&&Y&&_){i(38,oe=!0);let e=Y.x-C.x+.5*Y.width-.5*Z.width,t=Y.y-C.y+Y.height;const o=du,n=du,r=C.width-du,a=C.height-du,s=e,l=t,c=s+Z.width,d=l+Z.height;if(s<o&&(i(37,Q.x=s-o,Q),e=o),c>r&&(i(37,Q.x=c-r,Q),e=r-Z.width),d>a){i(36,K.y=-1,K);n<t-Z.height-Y.height?(i(37,Q.y=0,Q),t-=Z.height+Y.height):(i(37,Q.y=t-(d-a),Q),t-=d-a-du,i(38,oe=!1))}else i(36,K.y=1,K);Er(ee,k=Pe(be(e,t),Kd),k)}if(262144&e.$$.dirty[1]&&i(6,a=T>0),589856&e.$$.dirty[1]&&i(45,s=`translateX(${Math.round(k.x)+K.x*du}px) translateY(${Math.round(k.y)+K.y*du+K.y*M}px)`),262144&e.$$.dirty[1]&&i(18,l=T),262144&e.$$.dirty[1]&&i(17,c=T<1?"none":"all"),16384&e.$$.dirty[1]&&i(16,d=s),131072&e.$$.dirty[1]&&i(15,u=C.height-24+"px"),8192&e.$$.dirty[1]&&i(42,p=.5+.5*r),8192&e.$$.dirty[1]&&i(43,h=r),8&e.$$.dirty[0]|65536&e.$$.dirty[1]&&i(41,m=Z&&k),5248&e.$$.dirty[1]&&i(14,g=m&&oe?h:0),3072&e.$$.dirty[1]&&i(13,$=m?`scaleX(${p})rotate(45deg)`:"none"),8&e.$$.dirty[0]|1120&e.$$.dirty[1]&&i(12,f=m?`${K.y<0?Q.y+Z.height:0}px`:"0"),8&e.$$.dirty[0]|1088&e.$$.dirty[1]&&i(11,y=m?`${Q.x+.5*Z.width}px`:"0"),32&e.$$.dirty[1]&&i(10,b=K.y>=0),1&e.$$.dirty[0]&&i(9,x=_?e=>{ie(e)||i(39,ae=!0)}:void 0),96&e.$$.dirty[0]|32768&e.$$.dirty[1]&&a&&w&&ne&&ne.parentNode!==w&&w.append(ne),1&e.$$.dirty[0]&&(_||i(40,re=void 0)),97&e.$$.dirty[0]|514&e.$$.dirty[1]&&_&&a&&ne){let e=!1;V({e:re,panel:ne,preventFocus(){e=!0}}),e||Jd(ne,{preventScroll:!0})}65&e.$$.dirty[0]|4&e.$$.dirty[1]&&a&&!_&&N(),2080374786&e.$$.dirty[0]&&i(7,S={label:A,icon:D,class:ld(["PinturaPanelButton",E]),onkeydown:le,onclick:se,hideLabel:z,labelClass:F,title:O})},[_,A,W,Z,X,ne,a,S,v,x,b,y,f,$,g,u,d,c,l,j,U,G,J,ee,te,e=>{(/esc/i.test(e.key)||H&&/enter/i.test(e.key))&&(/enter/i.test(e.key)&&e.preventDefault(),i(0,_=!1),n.focus())},E,F,z,D,O,B,V,N,H,Y,K,Q,oe,ae,re,m,p,h,r,s,w,k,C,T,M,P,R,function(e){Ca[e?"unshift":"push"](()=>{X=e,i(4,X)})},function(e){Ca[e?"unshift":"push"](()=>{X=e,i(4,X)})},function(e){Ca[e?"unshift":"push"](()=>{ne=e,i(5,ne)})},e=>{e.stopPropagation(),i(0,_=!1)},e=>i(3,Z=He(e.detail)),I]}class pu extends rs{constructor(e){super(),ns(this,e,uu,cu,yr,{buttonClass:26,buttonLabel:1,buttonLabelClass:27,buttonHideLabel:28,buttonIcon:29,buttonTitle:30,buttonOnClick:31,panelClass:2,isActive:0,onshow:32,onhide:33,canConfirm:34},null,[-1,-1,-1])}}var hu={Up:38,Down:40,Left:37,Right:39};function mu(e){let t,o,i,n,r,a,s,l;const c=e[16].default,d=kr(c,e,e[15],null);return{c(){t=Ur("li"),o=Ur("input"),i=Xr(),n=Ur("label"),d&&d.c(),Qr(o,"type","radio"),Qr(o,"class","implicit"),Qr(o,"id",e[7]),Qr(o,"name",e[0]),o.value=e[3],o.disabled=e[6],o.hidden=e[5],o.checked=e[4],Qr(n,"for",e[7]),Qr(n,"title",e[2]),Qr(t,"class",r=ld(["PinturaRadioGroupOption",e[1]])),Qr(t,"data-hidden",e[5]),Qr(t,"data-disabled",e[6]),Qr(t,"data-selected",e[4])},m(r,c){Hr(r,t,c),_r(t,o),_r(t,i),_r(t,n),d&&d.m(n,null),a=!0,s||(l=[qr(o,"change",Jr(e[17])),qr(o,"keydown",e[9]),qr(o,"click",e[10])],s=!0)},p(e,[i]){(!a||128&i)&&Qr(o,"id",e[7]),(!a||1&i)&&Qr(o,"name",e[0]),(!a||8&i)&&(o.value=e[3]),(!a||64&i)&&(o.disabled=e[6]),(!a||32&i)&&(o.hidden=e[5]),(!a||16&i)&&(o.checked=e[4]),d&&d.p&&(!a||32768&i)&&Mr(d,c,e,e[15],a?Tr(c,e[15],i,null):Pr(e[15]),null),(!a||128&i)&&Qr(n,"for",e[7]),(!a||4&i)&&Qr(n,"title",e[2]),(!a||2&i&&r!==(r=ld(["PinturaRadioGroupOption",e[1]])))&&Qr(t,"class",r),(!a||32&i)&&Qr(t,"data-hidden",e[5]),(!a||64&i)&&Qr(t,"data-disabled",e[6]),(!a||16&i)&&Qr(t,"data-selected",e[4])},i(e){a||(ja(d,e),a=!0)},o(e){Ua(d,e),a=!1},d(e){e&&jr(t),d&&d.d(e),s=!1,$r(l)}}}function gu(e,t,o){let i,n,{$$slots:r={},$$scope:a}=t,{name:s}=t,{class:l}=t,{label:c}=t,{title:d}=t,{id:u}=t,{value:p}=t,{checked:h}=t,{onkeydown:m}=t,{onclick:g}=t,{hidden:$=!1}=t,{disabled:f=!1}=t;const y=Object.values(hu),b=Sa("keysPressed");wr(e,b,e=>o(18,n=e));return e.$$set=e=>{"name"in e&&o(0,s=e.name),"class"in e&&o(1,l=e.class),"label"in e&&o(11,c=e.label),"title"in e&&o(2,d=e.title),"id"in e&&o(12,u=e.id),"value"in e&&o(3,p=e.value),"checked"in e&&o(4,h=e.checked),"onkeydown"in e&&o(13,m=e.onkeydown),"onclick"in e&&o(14,g=e.onclick),"hidden"in e&&o(5,$=e.hidden),"disabled"in e&&o(6,f=e.disabled),"$$scope"in e&&o(15,a=e.$$scope)},e.$$.update=()=>{4097&e.$$.dirty&&o(7,i=`${s}-${u}`)},[s,l,d,p,h,$,f,i,b,e=>{m(e)},e=>{n.some(e=>y.includes(e))||g(e)},c,u,m,g,a,r,function(t){wa.call(this,e,t)}]}class $u extends rs{constructor(e){super(),ns(this,e,gu,mu,yr,{name:0,class:1,label:11,title:2,id:12,value:3,checked:4,onkeydown:13,onclick:14,hidden:5,disabled:6})}}var fu=(e=[])=>e.reduce((e,t)=>(Uo(t)?Uo(t[1]):!!t.options)?e.concat(Uo(t)?t[1]:t.options):(e.push(t),e),[]);const yu=(e,t,o)=>{let i;return Uo(e)?i={id:t,value:e[0],label:e[1],...e[2]||{}}:(i=e,i.id=null!=i.id?i.id:t),o?o(i):i};var bu=(e,t,o)=>L(e)?e(t,o):e;const xu=(e,t)=>e.map(([e,o,i])=>{if(Uo(o))return[bu(e,t),xu(o,t)];{const n=[e,bu(o,t)];if(i){let e={...i};i.icon&&(e.icon=bu(i.icon,t)),n.push(e)}return n}});var vu=(e,t)=>xu(e,t),Su=e=>/enter| /i.test(e),wu=(e,t)=>Array.isArray(e)&&Array.isArray(t)?Fs(e,t):e===t;function ku(e,t,o){const i=e.slice();return i[27]=t[o],i}const Cu=e=>({option:1024&e[0]}),Tu=e=>({option:e[27]});function Mu(e,t,o){const i=e.slice();return i[27]=t[o],i}const Pu=e=>({option:1024&e[0]}),Ru=e=>({option:e[27]}),Iu=e=>({option:1024&e[0]}),Eu=e=>({option:e[27]});function Au(e){let t,o,i,n,r,a=[],s=new Map,l=e[1]&&Lu(e),c=Xa(e[10]);const d=e=>e[27].id;for(let t=0;t<c.length;t+=1){let o=ku(e,c,t),i=d(o);s.set(i,a[t]=Uu(i,o))}return{c(){t=Ur("fieldset"),l&&l.c(),o=Xr(),i=Ur("ul");for(let e=0;e<a.length;e+=1)a[e].c();Qr(i,"class","PinturaRadioGroupOptions"),Qr(t,"class",n=ld(["PinturaRadioGroup",e[3]])),Qr(t,"data-layout",e[5]),Qr(t,"title",e[7])},m(e,n){Hr(e,t,n),l&&l.m(t,null),_r(t,o),_r(t,i);for(let e=0;e<a.length;e+=1)a[e]&&a[e].m(i,null);r=!0},p(e,u){e[1]?l?l.p(e,u):(l=Lu(e),l.c(),l.m(t,o)):l&&(l.d(1),l=null),8419153&u[0]&&(c=Xa(e[10]),Na(),a=Ka(a,u,d,1,e,c,s,i,qa,Uu,null,ku),Ha()),(!r||8&u[0]&&n!==(n=ld(["PinturaRadioGroup",e[3]])))&&Qr(t,"class",n),(!r||32&u[0])&&Qr(t,"data-layout",e[5]),(!r||128&u[0])&&Qr(t,"title",e[7])},i(e){if(!r){for(let e=0;e<c.length;e+=1)ja(a[e]);r=!0}},o(e){for(let e=0;e<a.length;e+=1)Ua(a[e]);r=!1},d(e){e&&jr(t),l&&l.d();for(let e=0;e<a.length;e+=1)a[e].d()}}}function Lu(e){let t,o,i;return{c(){t=Ur("legend"),o=Zr(e[1]),Qr(t,"class",i=e[2]&&"implicit")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,n){2&n[0]&&na(o,e[1]),4&n[0]&&i!==(i=e[2]&&"implicit")&&Qr(t,"class",i)},d(e){e&&jr(t)}}}function Fu(e){let t,o;return t=new $u({props:{name:e[4],label:e[27].label,title:e[27].hideLabel?e[27].title||e[27].label:e[27].title,id:e[27].id,value:e[27].value,disabled:e[27].disabled,hidden:e[27].hidden,class:e[8],checked:e[12](e[27])===e[0],onkeydown:e[13](e[27]),onclick:e[14](e[27]),$$slots:{default:[Wu]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.name=e[4]),1024&o[0]&&(i.label=e[27].label),1024&o[0]&&(i.title=e[27].hideLabel?e[27].title||e[27].label:e[27].title),1024&o[0]&&(i.id=e[27].id),1024&o[0]&&(i.value=e[27].value),1024&o[0]&&(i.disabled=e[27].disabled),1024&o[0]&&(i.hidden=e[27].hidden),256&o[0]&&(i.class=e[8]),1025&o[0]&&(i.checked=e[12](e[27])===e[0]),1024&o[0]&&(i.onkeydown=e[13](e[27])),1024&o[0]&&(i.onclick=e[14](e[27])),8389696&o[0]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function zu(e){let t,o,i,n,r,a,s=[],l=new Map;const c=e[22].group,d=kr(c,e,e[23],Eu),u=d||function(e){let t,o,i=e[27].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class","PinturaRadioGroupOptionGroupLabel")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){1024&t[0]&&i!==(i=e[27].label+"")&&na(o,i)},d(e){e&&jr(t)}}}(e);let p=Xa(e[27].options);const h=e=>e[27].id;for(let t=0;t<p.length;t+=1){let o=Mu(e,p,t),i=h(o);l.set(i,s[t]=ju(i,o))}return{c(){t=Ur("li"),u&&u.c(),o=Xr(),i=Ur("ul");for(let e=0;e<s.length;e+=1)s[e].c();n=Xr(),Qr(i,"class","PinturaRadioGroupOptions"),Qr(t,"class",r=ld(["PinturaRadioGroupOptionGroup",e[9]]))},m(e,r){Hr(e,t,r),u&&u.m(t,null),_r(t,o),_r(t,i);for(let e=0;e<s.length;e+=1)s[e]&&s[e].m(i,null);_r(t,n),a=!0},p(e,o){d?d.p&&(!a||8389632&o[0])&&Mr(d,c,e,e[23],a?Tr(c,e[23],o,Iu):Pr(e[23]),Eu):u&&u.p&&(!a||1024&o[0])&&u.p(e,a?o:[-1,-1]),8418641&o[0]&&(p=Xa(e[27].options),Na(),s=Ka(s,o,h,1,e,p,l,i,qa,ju,null,Mu),Ha()),(!a||512&o[0]&&r!==(r=ld(["PinturaRadioGroupOptionGroup",e[9]])))&&Qr(t,"class",r)},i(e){if(!a){ja(u,e);for(let e=0;e<p.length;e+=1)ja(s[e]);a=!0}},o(e){Ua(u,e);for(let e=0;e<s.length;e+=1)Ua(s[e]);a=!1},d(e){e&&jr(t),u&&u.d(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function Du(e){let t,o;return t=new Od({props:{$$slots:{default:[Ou]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8389632&o[0]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Ou(e){let t,o=e[27].icon+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){1024&i[0]&&o!==(o=e[27].icon+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function Bu(e){let t,o,i=e[27].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class",e[6])},m(e,i){Hr(e,t,i),_r(t,o)},p(e,n){1024&n[0]&&i!==(i=e[27].label+"")&&na(o,i),64&n[0]&&Qr(t,"class",e[6])},d(e){e&&jr(t)}}}function Wu(e){let t;const o=e[22].option,i=kr(o,e,e[23],Tu),n=i||function(e){let t,o,i,n=e[27].icon&&Du(e),r=!e[27].hideLabel&&Bu(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Xr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[27].icon?n?(n.p(e,i),1024&i[0]&&ja(n,1)):(n=Du(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[27].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=Bu(e),r.c(),r.m(o.parentNode,o))},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}(e);return{c(){n&&n.c()},m(e,o){n&&n.m(e,o),t=!0},p(e,r){i?i.p&&(!t||8389632&r[0])&&Mr(i,o,e,e[23],t?Tr(o,e[23],r,Cu):Pr(e[23]),Tu):n&&n.p&&(!t||1088&r[0])&&n.p(e,t?r:[-1,-1])},i(e){t||(ja(n,e),t=!0)},o(e){Ua(n,e),t=!1},d(e){n&&n.d(e)}}}function _u(e){let t,o;return t=new Od({props:{$$slots:{default:[Vu]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8389632&o[0]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Vu(e){let t,o=e[27].icon+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){1024&i[0]&&o!==(o=e[27].icon+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function Nu(e){let t,o,i=e[27].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class",e[6])},m(e,i){Hr(e,t,i),_r(t,o)},p(e,n){1024&n[0]&&i!==(i=e[27].label+"")&&na(o,i),64&n[0]&&Qr(t,"class",e[6])},d(e){e&&jr(t)}}}function Hu(e){let t;const o=e[22].option,i=kr(o,e,e[23],Ru),n=i||function(e){let t,o,i,n=e[27].icon&&_u(e),r=!e[27].hideLabel&&Nu(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Xr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[27].icon?n?(n.p(e,i),1024&i[0]&&ja(n,1)):(n=_u(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[27].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=Nu(e),r.c(),r.m(o.parentNode,o))},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}(e);return{c(){n&&n.c()},m(e,o){n&&n.m(e,o),t=!0},p(e,r){i?i.p&&(!t||8389632&r[0])&&Mr(i,o,e,e[23],t?Tr(o,e[23],r,Pu):Pr(e[23]),Ru):n&&n.p&&(!t||1088&r[0])&&n.p(e,t?r:[-1,-1])},i(e){t||(ja(n,e),t=!0)},o(e){Ua(n,e),t=!1},d(e){n&&n.d(e)}}}function ju(e,t){let o,i,n;return i=new $u({props:{name:t[4],label:t[27].label,title:t[27].hideLabel?t[27].title||t[27].label:t[27].title,id:t[27].id,value:t[27].value,disabled:t[27].disabled,hidden:t[27].hidden,class:t[8],checked:t[12](t[27])===t[0],onkeydown:t[13](t[27]),onclick:t[14](t[27]),$$slots:{default:[Hu]},$$scope:{ctx:t}}}),{key:e,first:null,c(){o=Yr(),ts(i.$$.fragment),this.first=o},m(e,t){Hr(e,o,t),os(i,e,t),n=!0},p(e,o){t=e;const n={};16&o[0]&&(n.name=t[4]),1024&o[0]&&(n.label=t[27].label),1024&o[0]&&(n.title=t[27].hideLabel?t[27].title||t[27].label:t[27].title),1024&o[0]&&(n.id=t[27].id),1024&o[0]&&(n.value=t[27].value),1024&o[0]&&(n.disabled=t[27].disabled),1024&o[0]&&(n.hidden=t[27].hidden),256&o[0]&&(n.class=t[8]),1025&o[0]&&(n.checked=t[12](t[27])===t[0]),1024&o[0]&&(n.onkeydown=t[13](t[27])),1024&o[0]&&(n.onclick=t[14](t[27])),8389696&o[0]&&(n.$$scope={dirty:o,ctx:t}),i.$set(n)},i(e){n||(ja(i.$$.fragment,e),n=!0)},o(e){Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(i,e)}}}function Uu(e,t){let o,i,n,r,a;const s=[zu,Fu],l=[];function c(e,t){return e[27].options?0:1}return i=c(t),n=l[i]=s[i](t),{key:e,first:null,c(){o=Yr(),n.c(),r=Yr(),this.first=o},m(e,t){Hr(e,o,t),l[i].m(e,t),Hr(e,r,t),a=!0},p(e,o){let a=i;i=c(t=e),i===a?l[i].p(t,o):(Na(),Ua(l[a],1,1,()=>{l[a]=null}),Ha(),n=l[i],n?n.p(t,o):(n=l[i]=s[i](t),n.c()),ja(n,1),n.m(r.parentNode,r))},i(e){a||(ja(n),a=!0)},o(e){Ua(n),a=!1},d(e){e&&(jr(o),jr(r)),l[i].d(e)}}}function Gu(e){let t,o,i,n=e[11].length&&Au(e),r=!1;return{c(){n&&n.c(),t=Xr(),o=Yr()},m(e,r){n&&n.m(e,r),Hr(e,t,r),Hr(e,o,r),i=!0},p(e,o){e[11].length?n?(n.p(e,o),2048&o[0]&&ja(n,1)):(n=Au(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e)}}}function Zu(e,t,o){let i,n,r,{$$slots:a={},$$scope:s}=t;const l=xa();let{label:c}=t,{hideLabel:d=!0}=t,{class:u}=t,{name:p=`radio-group-${B()}`}=t,{selectedIndex:h=-1}=t,{options:m=[]}=t,{onchange:g}=t,{layout:$}=t,{optionMapper:f}=t,{optionFilter:y}=t,{value:b}=t,{optionLabelClass:x}=t,{title:v}=t,{locale:S}=t,{optionClass:w}=t,{optionGroupClass:k}=t;const C=e=>r.findIndex(t=>t.id===e.id),T=(e,t)=>{o(0,h=C(e));const i={index:h,...e};((e,...t)=>{e&&e(...t)})(g,i,t),l("change",i)};return e.$$set=e=>{"label"in e&&o(1,c=e.label),"hideLabel"in e&&o(2,d=e.hideLabel),"class"in e&&o(3,u=e.class),"name"in e&&o(4,p=e.name),"selectedIndex"in e&&o(0,h=e.selectedIndex),"options"in e&&o(15,m=e.options),"onchange"in e&&o(16,g=e.onchange),"layout"in e&&o(5,$=e.layout),"optionMapper"in e&&o(17,f=e.optionMapper),"optionFilter"in e&&o(18,y=e.optionFilter),"value"in e&&o(19,b=e.value),"optionLabelClass"in e&&o(6,x=e.optionLabelClass),"title"in e&&o(7,v=e.title),"locale"in e&&o(20,S=e.locale),"optionClass"in e&&o(8,w=e.optionClass),"optionGroupClass"in e&&o(9,k=e.optionGroupClass),"$$scope"in e&&o(23,s=e.$$scope)},e.$$.update=()=>{1343488&e.$$.dirty[0]&&o(11,i=vu(y?m.filter(y):m,S)),133120&e.$$.dirty[0]&&o(10,n=((e=[],t)=>{let o=0;return e.map(e=>(o++,Uo(e)?Uo(e[1])?{id:o,label:e[0],options:e[1].map(e=>yu(e,++o,t))}:yu(e,o,t):e.options?{id:e.id||o,label:e.label,options:e.options.map(e=>yu(e,++o,t))}:yu(e,o,t)))})(i,f)),1024&e.$$.dirty[0]&&o(21,r=fu(n)),2654209&e.$$.dirty[0]&&h<0&&(o(0,h=r.findIndex(e=>wu(e.value,b))),h<0&&o(0,h=(e=>e.findIndex(e=>void 0===e[0]))(m)))},[h,c,d,u,p,$,x,v,w,k,n,i,C,e=>t=>{Su(t.key)&&T(e,t)},e=>t=>{T(e,t)},m,g,f,y,b,S,r,a,s]}class Xu extends rs{constructor(e){super(),ns(this,e,Zu,Gu,yr,{label:1,hideLabel:2,class:3,name:4,selectedIndex:0,options:15,onchange:16,layout:5,optionMapper:17,optionFilter:18,value:19,optionLabelClass:6,title:7,locale:20,optionClass:8,optionGroupClass:9},null,[-1,-1])}}function Yu(e){let t,o,i,n,r,a,s,l,c,d;return{c(){t=Ur("div"),o=Ur("button"),i=Zr("▲"),r=Xr(),a=Ur("button"),s=Zr("▼"),Qr(o,"type","button"),Qr(o,"tabindex","-1"),Qr(o,"aria-label",n=`increase ${e[7]}`),Qr(a,"type","button"),Qr(a,"tabindex","-1"),Qr(a,"aria-label",l=`decrease ${e[7]}`),Qr(t,"class","PinturaInputSpinners")},m(n,l){Hr(n,t,l),_r(t,o),_r(o,i),_r(t,r),_r(t,a),_r(a,s),c||(d=[qr(o,"click",e[18]),qr(a,"click",e[19])],c=!0)},p(e,t){128&t[0]&&n!==(n=`increase ${e[7]}`)&&Qr(o,"aria-label",n),128&t[0]&&l!==(l=`decrease ${e[7]}`)&&Qr(a,"aria-label",l)},d(e){e&&jr(t),c=!1,$r(d)}}}function qu(e){let t,o,i,n,r,a,s=e[14]&&e[9]&&Yu(e);return{c(){t=Ur("div"),o=Ur("input"),n=Xr(),s&&s.c(),Qr(o,"class","PinturaInputField"),Qr(o,"title",e[7]),Qr(o,"type",e[1]),Qr(o,"min",e[4]),Qr(o,"max",e[5]),Qr(o,"step",e[6]),Qr(o,"inputmode",e[3]),o.value=i=e[12]?e[15]:e[0],Qr(o,"placeholder",e[8]),Qr(o,"maxlength",e[13]),o.disabled=e[2],Qr(o,"spellcheck","false"),Qr(o,"autocorrect","off"),Qr(o,"autocapitalize","off"),aa(o,"min-width",e[11]?`${e[11]}em`:void 0),Qr(t,"class","PinturaInput")},m(i,l){Hr(i,t,l),_r(t,o),e[30](o),_r(t,n),s&&s.m(t,null),r||(a=[qr(o,"input",e[17]),qr(o,"blur",function(){fr(e[12]&&e[16])&&(e[12]&&e[16]).apply(this,arguments)}),qr(o,"keydown",e[20]),qr(o,"keyup",e[21])],r=!0)},p(n,r){e=n,128&r[0]&&Qr(o,"title",e[7]),2&r[0]&&Qr(o,"type",e[1]),16&r[0]&&Qr(o,"min",e[4]),32&r[0]&&Qr(o,"max",e[5]),64&r[0]&&Qr(o,"step",e[6]),8&r[0]&&Qr(o,"inputmode",e[3]),36865&r[0]&&i!==(i=e[12]?e[15]:e[0])&&o.value!==i&&(o.value=i),256&r[0]&&Qr(o,"placeholder",e[8]),8192&r[0]&&Qr(o,"maxlength",e[13]),4&r[0]&&(o.disabled=e[2]),2048&r[0]&&aa(o,"min-width",e[11]?`${e[11]}em`:void 0),e[14]&&e[9]?s?s.p(e,r):(s=Yu(e),s.c(),s.m(t,null)):s&&(s.d(1),s=null)},i:ur,o:ur,d(o){o&&jr(t),e[30](null),s&&s.d(),r=!1,$r(a)}}}function Ku(e,t,i){let n,r,a,s,l,c,d,u,p,{value:h}=t,{type:m="text"}=t,{disabled:g=!1}=t,{inputmode:$}=t,{min:f}=t,{max:y}=t,{step:b}=t,{onchange:x=o}=t,{onkeydown:v=o}=t,{onkeyup:S=o}=t,{title:w}=t,{stepMultiplier:k=10}=t,{placeholder:C}=t,{enableSpinButtons:T=!0}=t,{enableStopPropagation:M=!1}=t;const P=()=>{let e=u.value;return"number"===m&&(e="numeric"===$?parseInt(e,10):parseFloat(e),!No(e)||Number.isNaN(e)?e=f||0:r&&(e=Rs(e,f,y))),e};let R=h;const I=()=>{const e=Rs(P()+(p?b*k:b),f,y);e!==h&&(i(27,R=e),i(0,h=e),x(h))},E=()=>{const e=Rs(P()-(p?b*k:b),f,y);e!==h&&(i(27,R=e),i(0,h=e),x(h))};return e.$$set=e=>{"value"in e&&i(0,h=e.value),"type"in e&&i(1,m=e.type),"disabled"in e&&i(2,g=e.disabled),"inputmode"in e&&i(3,$=e.inputmode),"min"in e&&i(4,f=e.min),"max"in e&&i(5,y=e.max),"step"in e&&i(6,b=e.step),"onchange"in e&&i(22,x=e.onchange),"onkeydown"in e&&i(23,v=e.onkeydown),"onkeyup"in e&&i(24,S=e.onkeyup),"title"in e&&i(7,w=e.title),"stepMultiplier"in e&&i(25,k=e.stepMultiplier),"placeholder"in e&&i(8,C=e.placeholder),"enableSpinButtons"in e&&i(9,T=e.enableSpinButtons),"enableStopPropagation"in e&&i(26,M=e.enableStopPropagation)},e.$$.update=()=>{2&e.$$.dirty[0]&&i(29,n="number"===m),48&e.$$.dirty[0]&&i(12,r=No(f)&&No(y)),64&e.$$.dirty[0]&&i(28,a=No(b)),805310464&e.$$.dirty[0]&&i(14,s=n&&r&&a),134218753&e.$$.dirty[0]&&i(15,l=u===document.activeElement?R:h),32&e.$$.dirty[0]&&i(11,c=y?(y+"").length:void 0),2056&e.$$.dirty[0]&&i(13,d="numeric"===$&&c?c:void 0)},[h,m,g,$,f,y,b,w,C,T,u,c,r,d,s,l,()=>{i(27,R=P()),x(h)},()=>{i(27,R=u.value),x(P())},I,E,e=>{if(v(e),!s)return;p=e.shiftKey;const{key:t}=e;M&&e.stopPropagation(),/up|down/i.test(t)&&(/up/i.test(t)&&I(),/down/i.test(t)&&E(),e.preventDefault(),e.stopPropagation())},e=>{if(S(e),!s)return;const{key:t}=e;/up|down/i.test(t)&&(e.preventDefault(),e.stopPropagation())},x,v,S,k,M,R,a,n,function(e){Ca[e?"unshift":"push"](()=>{u=e,i(10,u)})}]}class Ju extends rs{constructor(e){super(),ns(this,e,Ku,qu,yr,{value:0,type:1,disabled:2,inputmode:3,min:4,max:5,step:6,onchange:22,onkeydown:23,onkeyup:24,title:7,stepMultiplier:25,placeholder:8,enableSpinButtons:9,enableStopPropagation:26},null,[-1,-1])}}const Qu=e=>({}),ep=e=>({});function tp(e){let t,o,i,n,r=(e[2]||e[21])+"",a=e[6]&&ip(e);return{c(){a&&a.c(),t=Xr(),o=Ur("span"),Qr(o,"class",i=ld(["PinturaButtonLabel",e[3],e[5]&&"implicit"]))},m(e,i){a&&a.m(e,i),Hr(e,t,i),Hr(e,o,i),o.innerHTML=r,n=!0},p(e,s){e[6]?a?(a.p(e,s),64&s[0]&&ja(a,1)):(a=ip(e),a.c(),ja(a,1),a.m(t.parentNode,t)):a&&(Na(),Ua(a,1,1,()=>{a=null}),Ha()),(!n||2097156&s[0])&&r!==(r=(e[2]||e[21])+"")&&(o.innerHTML=r),(!n||40&s[0]&&i!==(i=ld(["PinturaButtonLabel",e[3],e[5]&&"implicit"])))&&Qr(o,"class",i)},i(e){n||(ja(a),n=!0)},o(e){Ua(a),n=!1},d(e){e&&(jr(t),jr(o)),a&&a.d(e)}}}function op(e){let t,o;return t=new Ju({props:{value:parseFloat(e[10]),onchange:e[17],enableStopPropagation:!0,type:"number",inputmode:"numeric",min:e[8].reduce(e[29],1/0),max:e[8].reduce(e[30],-1/0),enableSpinButtons:!1}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o[0]&&(i.value=parseFloat(e[10])),131072&o[0]&&(i.onchange=e[17]),256&o[0]&&(i.min=e[8].reduce(e[29],1/0)),256&o[0]&&(i.max=e[8].reduce(e[30],-1/0)),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ip(e){let t,o;return t=new Od({props:{class:"PinturaButtonIcon",$$slots:{default:[np]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};64&o[0]|2&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function np(e){let t;return{c(){t=Gr("g")},m(o,i){Hr(o,t,i),t.innerHTML=e[6]},p(e,o){64&o[0]&&(t.innerHTML=e[6])},d(e){e&&jr(t)}}}function rp(e){let t,o,i,n,r;const a=[op,tp],s=[];function l(e,t){return e[18]?0:1}return o=l(e),i=s[o]=a[o](e),{c(){t=Ur("span"),i.c(),Qr(t,"slot","label"),Qr(t,"class",n=ld(["PinturaButtonInner",e[18]&&"PinturaComboBox",e[4]]))},m(e,i){Hr(e,t,i),s[o].m(t,null),r=!0},p(e,c){let d=o;o=l(e),o===d?s[o].p(e,c):(Na(),Ua(s[d],1,1,()=>{s[d]=null}),Ha(),i=s[o],i?i.p(e,c):(i=s[o]=a[o](e),i.c()),ja(i,1),i.m(t,null)),(!r||262160&c[0]&&n!==(n=ld(["PinturaButtonInner",e[18]&&"PinturaComboBox",e[4]])))&&Qr(t,"class",n)},i(e){r||(ja(i),r=!0)},o(e){Ua(i),r=!1},d(e){e&&jr(t),s[o].d()}}}function ap(e){let t,o,i=e[34].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"slot","group")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){8&t[1]&&i!==(i=e[34].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function sp(e){let t,o;return t=new Od({props:{style:L(e[14])?e[14](e[34].value):e[14],$$slots:{default:[lp]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16384&o[0]|8&o[1]&&(i.style=L(e[14])?e[14](e[34].value):e[14]),10&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function lp(e){let t,o=e[34].icon+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){8&i[1]&&o!==(o=e[34].icon+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function cp(e){let t,o,i,n,r,a,s,l=e[34].label+"",c=e[34].sublabel&&dp(e);return{c(){t=Ur("span"),o=new la(!1),i=Xr(),c&&c.c(),o.a=i,Qr(t,"class",n=ld(["PinturaDropdownOptionLabel",e[11]]))},m(n,d){Hr(n,t,d),o.m(l,t),_r(t,i),c&&c.m(t,null),a||(s=Ar(r=fd.call(null,t,L(e[15])?e[15](e[34].value):e[15])),a=!0)},p(e,i){8&i[1]&&l!==(l=e[34].label+"")&&o.p(l),e[34].sublabel?c?c.p(e,i):(c=dp(e),c.c(),c.m(t,null)):c&&(c.d(1),c=null),2048&i[0]&&n!==(n=ld(["PinturaDropdownOptionLabel",e[11]]))&&Qr(t,"class",n),r&&fr(r.update)&&32768&i[0]|8&i[1]&&r.update.call(null,L(e[15])?e[15](e[34].value):e[15])},d(e){e&&jr(t),c&&c.d(),a=!1,s()}}}function dp(e){let t,o=e[34].sublabel+"";return{c(){t=Ur("span"),Qr(t,"class","PinturaDropdownOptionSublabel")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){8&i[1]&&o!==(o=e[34].sublabel+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function up(e){let t,o,i,n=e[34].icon&&sp(e),r=!e[34].hideLabel&&cp(e);return{c(){t=Ur("span"),n&&n.c(),o=Xr(),r&&r.c(),Qr(t,"slot","option")},m(e,a){Hr(e,t,a),n&&n.m(t,null),_r(t,o),r&&r.m(t,null),i=!0},p(e,i){e[34].icon?n?(n.p(e,i),8&i[1]&&ja(n,1)):(n=sp(e),n.c(),ja(n,1),n.m(t,o)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[34].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=cp(e),r.c(),r.m(t,null))},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(e){e&&jr(t),n&&n.d(),r&&r.d()}}}function pp(e){let t,o,i,n,r,a;const s=e[28].controls,l=kr(s,e,e[32],ep);return i=new Xu({props:{class:"PinturaOptionsList PinturaScrollableContent",name:e[7],value:e[10],selectedIndex:e[9],optionFilter:e[12],optionMapper:e[13],optionLabelClass:ld(["PinturaDropdownOptionLabel",e[11]]),optionGroupClass:"PinturaListOptionGroup",optionClass:"PinturaListOption",options:e[19],onchange:e[22],$$slots:{option:[up,({option:e})=>({34:e}),({option:e})=>[0,e?8:0]],group:[ap,({option:e})=>({34:e}),({option:e})=>[0,e?8:0]]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),l&&l.c(),o=Xr(),ts(i.$$.fragment),Qr(t,"slot","details"),Qr(t,"class","PinturaOptionsListWrapper")},m(s,c){Hr(s,t,c),l&&l.m(t,null),_r(t,o),os(i,t,null),n=!0,r||(a=qr(t,"keydown",e[24]),r=!0)},p(e,t){l&&l.p&&(!n||2&t[1])&&Mr(l,s,e,e[32],n?Tr(s,e[32],t,Qu):Pr(e[32]),ep);const o={};128&t[0]&&(o.name=e[7]),1024&t[0]&&(o.value=e[10]),512&t[0]&&(o.selectedIndex=e[9]),4096&t[0]&&(o.optionFilter=e[12]),8192&t[0]&&(o.optionMapper=e[13]),2048&t[0]&&(o.optionLabelClass=ld(["PinturaDropdownOptionLabel",e[11]])),524288&t[0]&&(o.options=e[19]),51200&t[0]|10&t[1]&&(o.$$scope={dirty:t,ctx:e}),i.$set(o)},i(e){n||(ja(l,e),ja(i.$$.fragment,e),n=!0)},o(e){Ua(l,e),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(t),l&&l.d(e),is(i),r=!1,a()}}}function hp(e){let t,o,i;function n(t){e[31](t)}let r={onshow:e[23],buttonTitle:Wd(e[2],e[1]),buttonClass:ld(["PinturaDropdownButton",e[0],e[5]&&"PinturaDropdownIconOnly"]),buttonOnClick:e[16],$$slots:{details:[pp],label:[rp]},$$scope:{ctx:e}};return void 0!==e[20]&&(r.isActive=e[20]),t=new pu({props:r}),Ca.push(()=>es(t,"isActive",n)),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};6&i[0]&&(n.buttonTitle=Wd(e[2],e[1])),33&i[0]&&(n.buttonClass=ld(["PinturaDropdownButton",e[0],e[5]&&"PinturaDropdownIconOnly"])),65536&i[0]&&(n.buttonOnClick=e[16]),3080188&i[0]|2&i[1]&&(n.$$scope={dirty:i,ctx:e}),!o&&1048576&i[0]&&(o=!0,n.isActive=e[20],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function mp(e,t,i){let n,r,{$$slots:a={},$$scope:s}=t,{class:l}=t,{title:c}=t,{label:d}=t,{labelClass:u}=t,{innerClass:p}=t,{hideLabel:h=!1}=t,{icon:m}=t,{name:g}=t,{options:$=[]}=t,{selectedIndex:f=-1}=t,{value:y}=t,{optionLabelClass:b}=t,{optionFilter:x}=t,{optionMapper:v}=t,{optionIconStyle:S}=t,{optionLabelStyle:w}=t,{locale:k}=t,{onclick:C}=t,{onchange:T=o}=t,{onload:M=o}=t,{ondestroy:P=o}=t,{enableInput:R=!1}=t;let I;fa(()=>M({options:$})),ba(()=>P({options:$}));return e.$$set=e=>{"class"in e&&i(0,l=e.class),"title"in e&&i(1,c=e.title),"label"in e&&i(2,d=e.label),"labelClass"in e&&i(3,u=e.labelClass),"innerClass"in e&&i(4,p=e.innerClass),"hideLabel"in e&&i(5,h=e.hideLabel),"icon"in e&&i(6,m=e.icon),"name"in e&&i(7,g=e.name),"options"in e&&i(8,$=e.options),"selectedIndex"in e&&i(9,f=e.selectedIndex),"value"in e&&i(10,y=e.value),"optionLabelClass"in e&&i(11,b=e.optionLabelClass),"optionFilter"in e&&i(12,x=e.optionFilter),"optionMapper"in e&&i(13,v=e.optionMapper),"optionIconStyle"in e&&i(14,S=e.optionIconStyle),"optionLabelStyle"in e&&i(15,w=e.optionLabelStyle),"locale"in e&&i(25,k=e.locale),"onclick"in e&&i(16,C=e.onclick),"onchange"in e&&i(17,T=e.onchange),"onload"in e&&i(26,M=e.onload),"ondestroy"in e&&i(27,P=e.ondestroy),"enableInput"in e&&i(18,R=e.enableInput),"$$scope"in e&&i(32,s=e.$$scope)},e.$$.update=()=>{33554688&e.$$.dirty[0]&&i(19,n=k?vu($,k):$),525312&e.$$.dirty[0]&&i(21,r=n.reduce((e,t)=>{if(e)return e;const o=Array.isArray(t)?t:[t,t],[i,n]=o;return wu(i,y)?n:void 0},void 0)||(e=>{const t=e.find(e=>void 0===e[0]);if(t)return t[1]})(n)||y)},[l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w,C,T,R,n,I,r,e=>{i(21,r=e.value),T(e),i(20,I=!1)},({e:e,panel:t,preventFocus:o})=>{if(o(),e&&e.key&&/up|down/i.test(e.key))return Jd(t.querySelector("input:not([disabled])"));Jd(t.querySelector("fieldset"))},e=>{/tab/i.test(e.key)&&e.preventDefault()},k,M,P,a,(e,[t])=>(t=parseFloat(t))<e?t:e,(e,[t])=>(t=parseFloat(t))>e?t:e,function(e){I=e,i(20,I)},s]}class gp extends rs{constructor(e){super(),ns(this,e,mp,hp,yr,{class:0,title:1,label:2,labelClass:3,innerClass:4,hideLabel:5,icon:6,name:7,options:8,selectedIndex:9,value:10,optionLabelClass:11,optionFilter:12,optionMapper:13,optionIconStyle:14,optionLabelStyle:15,locale:25,onclick:16,onchange:17,onload:26,ondestroy:27,enableInput:18},null,[-1,-1])}}function $p(e){let t;return{c(){t=Ur("div"),Qr(t,"slot","details")},m(o,i){Hr(o,t,i),e[14](t)},p:ur,d(o){o&&jr(t),e[14](null)}}}function fp(e){let t,o,i;function n(t){e[15](t)}let r={buttonLabel:e[1],buttonClass:e[2],buttonIcon:e[3],buttonHideLabel:e[4],buttonTitle:e[5],buttonLabelClass:e[6],onshow:e[7],onhide:e[8],$$slots:{details:[$p]},$$scope:{ctx:e}};return void 0!==e[0]&&(r.isActive=e[0]),t=new pu({props:r}),Ca.push(()=>es(t,"isActive",n)),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,[i]){const n={};2&i&&(n.buttonLabel=e[1]),4&i&&(n.buttonClass=e[2]),8&i&&(n.buttonIcon=e[3]),16&i&&(n.buttonHideLabel=e[4]),32&i&&(n.buttonTitle=e[5]),64&i&&(n.buttonLabelClass=e[6]),128&i&&(n.onshow=e[7]),256&i&&(n.onhide=e[8]),66048&i&&(n.$$scope={dirty:i,ctx:e}),!o&&1&i&&(o=!0,n.isActive=e[0],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function yp(e,t,i){let{buttonLabel:n}=t,{buttonClass:r}=t,{buttonIcon:a}=t,{buttonHideLabel:s}=t,{buttonTitle:l}=t,{buttonLabelClass:c}=t,{isActive:d=!1}=t,{root:u}=t,{ondestroy:p=o}=t,{onshow:h=o}=t,{onhide:m=o}=t;let g;return ba(p),e.$$set=e=>{"buttonLabel"in e&&i(1,n=e.buttonLabel),"buttonClass"in e&&i(2,r=e.buttonClass),"buttonIcon"in e&&i(3,a=e.buttonIcon),"buttonHideLabel"in e&&i(4,s=e.buttonHideLabel),"buttonTitle"in e&&i(5,l=e.buttonTitle),"buttonLabelClass"in e&&i(6,c=e.buttonLabelClass),"isActive"in e&&i(0,d=e.isActive),"root"in e&&i(10,u=e.root),"ondestroy"in e&&i(11,p=e.ondestroy),"onshow"in e&&i(7,h=e.onshow),"onhide"in e&&i(8,m=e.onhide)},e.$$.update=()=>{1536&e.$$.dirty&&g&&u&&g.firstChild!==u&&(g.hasChildNodes()?g.replaceChild(u,g.firstChild):g.append(u))},[d,n,r,a,s,l,c,h,m,g,u,p,()=>i(0,d=!1),()=>i(0,d=!0),function(e){Ca[e?"unshift":"push"](()=>{g=e,i(9,g)})},function(e){d=e,i(0,d)}]}class bp extends rs{constructor(e){super(),ns(this,e,yp,fp,yr,{buttonLabel:1,buttonClass:2,buttonIcon:3,buttonHideLabel:4,buttonTitle:5,buttonLabelClass:6,isActive:0,root:10,ondestroy:11,onshow:7,onhide:8,hide:12,show:13})}get hide(){return this.$$.ctx[12]}get show(){return this.$$.ctx[13]}}var xp=(e,t={})=>{const{direction:o,shiftMultiplier:i=10,bubbles:n=!1,preventDefault:r=!1,stopKeydownPropagation:a=!0}=t,s="horizontal"===o,l="vertical"===o,c=t=>{const{key:o}=t,c=t.shiftKey,d=/up|down/i.test(o),u=/left|right/i.test(o);if(!u&&!d)return;if(s&&d)return;if(l&&u)return;const p=c?i:1;a&&t.stopPropagation(),r&&t.preventDefault(),e.dispatchEvent(new CustomEvent("nudge",{bubbles:n,detail:be((/left/i.test(o)?-1:/right/i.test(o)?1:0)*p,(/up/i.test(o)?-1:/down/i.test(o)?1:0)*p)}))};return e.addEventListener("keydown",c),{destroy(){e.removeEventListener("keydown",c)}}},vp=(e,t,o)=>(e-t)/(o-t);var Sp=(e,t)=>{const{fixScrollDirection:o=!1}=t||{},{deltaX:i,deltaY:n}=e;let r=function(e,t){let o=0;return o=Math.abs(e)>Math.abs(t)?e:t,-1*o}(i,n);return ko()?r%1!=0?r*=.05:N()?r*=.1:r*=.25:0===Math.abs(i)&&Math.abs(n)>=100?r*=.05:r*=.25,r=Rs(r,-10,10),ko()&&!o&&(r*=-1),r};const wp=e=>({}),kp=e=>({});function Cp(e){let t,o,i;return{c(){t=Ur("label"),o=Zr(e[0]),Qr(t,"for",e[17]),Qr(t,"class",i=e[1]?"implicit":void 0)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,n){1&n[0]&&na(o,e[0]),131072&n[0]&&Qr(t,"for",e[17]),2&n[0]&&i!==(i=e[1]?"implicit":void 0)&&Qr(t,"class",i)},d(e){e&&jr(t)}}}function Tp(e){let t,o,i,n,r,a,s,l;return o=new Od({props:{$$slots:{default:[Mp]},$$scope:{ctx:e}}}),r=new Od({props:{$$slots:{default:[Pp]},$$scope:{ctx:e}}}),{c(){t=Ur("button"),ts(o.$$.fragment),i=Xr(),n=Ur("button"),ts(r.$$.fragment),Qr(t,"type","button"),Qr(t,"aria-label","Increase"),Qr(n,"type","button"),Qr(n,"aria-label","Decrease")},m(c,d){Hr(c,t,d),os(o,t,null),Hr(c,i,d),Hr(c,n,d),os(r,n,null),a=!0,s||(l=[qr(t,"pointerdown",e[20](1)),qr(t,"keydown",e[20](1)),qr(n,"pointerdown",e[20](-1)),qr(n,"keydown",e[20](-1))],s=!0)},p(e,t){const i={};512&t[1]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i);const n={};512&t[1]&&(n.$$scope={dirty:t,ctx:e}),r.$set(n)},i(e){a||(ja(o.$$.fragment,e),ja(r.$$.fragment,e),a=!0)},o(e){Ua(o.$$.fragment,e),Ua(r.$$.fragment,e),a=!1},d(e){e&&(jr(t),jr(i),jr(n)),is(o),is(r),s=!1,$r(l)}}}function Mp(e){let t;return{c(){t=Gr("path"),Qr(t,"d","M8 12 h8 M12 8 v8")},m(e,o){Hr(e,t,o)},p:ur,d(e){e&&jr(t)}}}function Pp(e){let t;return{c(){t=Gr("path"),Qr(t,"d","M9 12 h6")},m(e,o){Hr(e,t,o)},p:ur,d(e){e&&jr(t)}}}function Rp(e){let t,o,i,n,r,a,s,l,c,d,u,p,h,m,g,$,f=e[0]&&Cp(e);const y=e[38].default,b=kr(y,e,e[40],null),x=e[38].knob,v=kr(x,e,e[40],kp);let S=e[8]&&Tp(e);return{c(){t=Ur("div"),o=Ur("div"),f&&f.c(),i=Xr(),n=Ur("input"),r=Xr(),a=Ur("div"),b&&b.c(),l=Xr(),c=Ur("div"),d=Ur("div"),v&&v.c(),p=Xr(),S&&S.c(),Qr(n,"type","range"),Qr(n,"id",e[17]),Qr(n,"min",e[2]),Qr(n,"max",e[3]),Qr(n,"step",e[4]),n.value=e[13],aa(n,"pointer-events",e[9]?"none":void 0),Qr(a,"class",s=ld(["PinturaSliderTrack",e[5]])),Qr(d,"class",u=ld(["PinturaSliderKnob",e[6]])),Qr(c,"class","PinturaSliderKnobController"),aa(c,"transform",e[16]),Qr(o,"class","PinturaSliderControl"),aa(o,"--slider-position",Math.round(e[14])),Qr(t,"class",h=ld(["PinturaSlider",e[11]])),Qr(t,"data-direction",e[7])},m(s,u){Hr(s,t,u),_r(t,o),f&&f.m(o,null),_r(o,i),_r(o,n),e[39](n),_r(o,r),_r(o,a),b&&b.m(a,null),_r(o,l),_r(o,c),_r(c,d),v&&v.m(d,null),_r(t,p),S&&S.m(t,null),m=!0,g||($=[qr(n,"input",e[18]),qr(n,"nudge",e[19]),qr(n,"wheel",e[21]),Ar(xp.call(null,n)),qr(o,"pointerdown",function(){fr(e[10]&&e[12])&&(e[10]&&e[12]).apply(this,arguments)})],g=!0)},p(r,l){(e=r)[0]?f?f.p(e,l):(f=Cp(e),f.c(),f.m(o,i)):f&&(f.d(1),f=null),(!m||131072&l[0])&&Qr(n,"id",e[17]),(!m||4&l[0])&&Qr(n,"min",e[2]),(!m||8&l[0])&&Qr(n,"max",e[3]),(!m||16&l[0])&&Qr(n,"step",e[4]),(!m||8192&l[0])&&(n.value=e[13]),512&l[0]&&aa(n,"pointer-events",e[9]?"none":void 0),b&&b.p&&(!m||512&l[1])&&Mr(b,y,e,e[40],m?Tr(y,e[40],l,null):Pr(e[40]),null),(!m||32&l[0]&&s!==(s=ld(["PinturaSliderTrack",e[5]])))&&Qr(a,"class",s),v&&v.p&&(!m||512&l[1])&&Mr(v,x,e,e[40],m?Tr(x,e[40],l,wp):Pr(e[40]),kp),(!m||64&l[0]&&u!==(u=ld(["PinturaSliderKnob",e[6]])))&&Qr(d,"class",u),65536&l[0]&&aa(c,"transform",e[16]),16384&l[0]&&aa(o,"--slider-position",Math.round(e[14])),e[8]?S?(S.p(e,l),256&l[0]&&ja(S,1)):(S=Tp(e),S.c(),ja(S,1),S.m(t,null)):S&&(Na(),Ua(S,1,1,()=>{S=null}),Ha()),(!m||2048&l[0]&&h!==(h=ld(["PinturaSlider",e[11]])))&&Qr(t,"class",h),(!m||128&l[0])&&Qr(t,"data-direction",e[7])},i(e){m||(ja(b,e),ja(v,e),ja(S),m=!0)},o(e){Ua(b,e),Ua(v,e),Ua(S),m=!1},d(o){o&&jr(t),f&&f.d(),e[39](null),b&&b.d(o),v&&v.d(o),S&&S.d(),g=!1,$r($)}}}function Ip(e,t,i){let n,r,a,s,l,c,d,u,p,h,m,g,$,f,b,x,{$$slots:v={},$$scope:S}=t,{id:w}=t,{label:k}=t,{hideLabel:C=!1}=t,{min:T=0}=t,{max:M=100}=t,{step:P=1}=t,{value:R=0}=t,{valueMin:I}=t,{valueMax:E}=t,{trackClass:A}=t,{knobClass:L}=t,{ongrab:F=o}=t,{onchange:z=o}=t,{onrelease:D=o}=t,{onexceed:O=o}=t,{direction:W="x"}=t,{getValue:_=ee}=t,{setValue:V=ee}=t,{enableSpinButtons:N=!0}=t,{enableForceUseKnob:H=!1}=t,{enableStopPropagation:j=!0}=t,{enablePointerdownListener:U=!0}=t,{maxInteractionDistance:G=6}=t,{class:Z}=t;const X=e=>V(((e,t)=>(t=1/t,Math.round(e*t)/t))(Rs(e,T,M),P),R),Y=(e,t,o={})=>{const{grabbed:n=!1,released:r=!1}=o,s=X(T+e/t*a),l=I||T,c=E||M;i(22,R=y(s)?s:Rs(s,l,c)),x!==s&&(x=s,!y(s)&&(s<l||s>c)&&O(R,s),R!==b&&(b=R,n&&F(R),z(R),r&&D(R)))};let q;let K;const J=e=>{const t=e[p]-f;Y($+t,g)},Q=e=>{K=setTimeout(()=>{g=void 0},50),document.documentElement.removeEventListener("pointermove",J),document.documentElement.removeEventListener("pointerup",Q),z(R),D(R)},te=()=>{i(22,R=X(r+ie*P)),z(R)};let oe=null,ie=1,ne=!1;const re=e=>{clearTimeout(oe),oe=null,ne||te(),D(R),document.removeEventListener("pointerup",re),document.removeEventListener("keyup",re)};return e.$$set=e=>{"id"in e&&i(23,w=e.id),"label"in e&&i(0,k=e.label),"hideLabel"in e&&i(1,C=e.hideLabel),"min"in e&&i(2,T=e.min),"max"in e&&i(3,M=e.max),"step"in e&&i(4,P=e.step),"value"in e&&i(22,R=e.value),"valueMin"in e&&i(24,I=e.valueMin),"valueMax"in e&&i(25,E=e.valueMax),"trackClass"in e&&i(5,A=e.trackClass),"knobClass"in e&&i(6,L=e.knobClass),"ongrab"in e&&i(26,F=e.ongrab),"onchange"in e&&i(27,z=e.onchange),"onrelease"in e&&i(28,D=e.onrelease),"onexceed"in e&&i(29,O=e.onexceed),"direction"in e&&i(7,W=e.direction),"getValue"in e&&i(30,_=e.getValue),"setValue"in e&&i(31,V=e.setValue),"enableSpinButtons"in e&&i(8,N=e.enableSpinButtons),"enableForceUseKnob"in e&&i(9,H=e.enableForceUseKnob),"enableStopPropagation"in e&&i(32,j=e.enableStopPropagation),"enablePointerdownListener"in e&&i(10,U=e.enablePointerdownListener),"maxInteractionDistance"in e&&i(33,G=e.maxInteractionDistance),"class"in e&&i(11,Z=e.class),"$$scope"in e&&i(40,S=e.$$scope)},e.$$.update=()=>{8388609&e.$$.dirty[0]&&i(17,n=w||(k?`PinturaSlider_${B()}`:void 0)),1077936128&e.$$.dirty[0]&&i(13,r=void 0!==R?_(R):0),12&e.$$.dirty[0]&&(a=M-T),8204&e.$$.dirty[0]&&i(35,s=vp(r,T,M)),16&e.$$.dirty[1]&&i(14,l=100*s),128&e.$$.dirty[0]&&i(36,c=W.toUpperCase()),128&e.$$.dirty[0]&&i(37,d="x"===W?"Width":"Height"),64&e.$$.dirty[1]&&(u=`offset${d}`),32&e.$$.dirty[1]&&(p=`page${c}`),16384&e.$$.dirty[0]|32&e.$$.dirty[1]&&i(16,h=`translate${c}(${l}%)`)},[k,C,T,M,P,A,L,W,N,H,U,Z,e=>{clearTimeout(K);let t=!1;j&&e.stopPropagation(),clearTimeout(q);const o=m.getBoundingClientRect();if(g=m[u],f=e[p],$=f-o[W],H){if(Math.abs($-s*g)>G)return;t=!0,e.stopPropagation()}return document.activeElement!==m&&m.focus(),Y($,g,{grabbed:!0}),document.documentElement.addEventListener("pointermove",J),document.documentElement.addEventListener("pointerup",Q),t},r,l,m,h,n,e=>{g||(i(22,R=V(parseFloat(e.target.value))),R!==b&&(b=R,z(R)))},e=>{const t=m[u];Y((r-T)/a*t+e.detail[W],t),clearTimeout(q),q=setTimeout(()=>{D(R)},250)},e=>t=>{("keydown"!==t.type||Su(t.key)&&null===oe)&&(clearTimeout(q),ie=e,ne=!1,oe=setInterval(()=>{ne=!0,te()},100),"pointerdown"===t.type?(document.addEventListener("pointercancel",re),document.addEventListener("pointerup",re)):document.addEventListener("keyup",re))},e=>{const t=Sp(e),o=t<0?Math.floor(t):Math.ceil(t);i(22,R=X(r+o*P)),z(R)},R,w,I,E,F,z,D,O,_,V,j,G,e=>{const t=m.getBoundingClientRect(),o=e[p]-t[W],i=m[u];return Math.abs(o-s*i)},s,c,d,v,function(e){Ca[e?"unshift":"push"](()=>{m=e,i(15,m)})},S]}class Ep extends rs{constructor(e){super(),ns(this,e,Ip,Rp,yr,{id:23,label:0,hideLabel:1,min:2,max:3,step:4,value:22,valueMin:24,valueMax:25,trackClass:5,knobClass:6,ongrab:26,onchange:27,onrelease:28,onexceed:29,direction:7,getValue:30,setValue:31,enableSpinButtons:8,enableForceUseKnob:9,enableStopPropagation:32,enablePointerdownListener:10,maxInteractionDistance:33,class:11,eventDistanceToKnob:34,handlePointerDown:12},null,[-1,-1])}get eventDistanceToKnob(){return this.$$.ctx[34]}get handlePointerDown(){return this.$$.ctx[12]}}function Ap(e){let t,o;return t=new Od({props:{class:"PinturaButtonIcon",$$slots:{default:[Lp]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1048580&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Lp(e){let t;return{c(){t=Gr("g")},m(o,i){Hr(o,t,i),t.innerHTML=e[2]},p(e,o){4&o&&(t.innerHTML=e[2])},d(e){e&&jr(t)}}}function Fp(e){let t,o,i=bu(e[8],e[6])+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class","PinturaButtonLabelPrefix")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){320&t&&i!==(i=bu(e[8],e[6])+"")&&na(o,i)},d(e){e&&jr(t)}}}function zp(e){let t,o,i,n,r,a,s,l,c,d=e[2]&&Ap(e),u=e[8]&&Fp(e);return{c(){t=Ur("span"),d&&d.c(),o=Xr(),u&&u.c(),i=Xr(),n=Ur("span"),r=Zr(e[9]),Qr(n,"class",a=ld(["PinturaButtonLabel",e[3],e[5]&&"implicit"])),Qr(t,"slot","label"),Qr(t,"title",s=bu(e[1],e[6])),Qr(t,"class",l=ld(["PinturaButtonInner",e[4]]))},m(e,a){Hr(e,t,a),d&&d.m(t,null),_r(t,o),u&&u.m(t,null),_r(t,i),_r(t,n),_r(n,r),c=!0},p(e,p){e[2]?d?(d.p(e,p),4&p&&ja(d,1)):(d=Ap(e),d.c(),ja(d,1),d.m(t,o)):d&&(Na(),Ua(d,1,1,()=>{d=null}),Ha()),e[8]?u?u.p(e,p):(u=Fp(e),u.c(),u.m(t,i)):u&&(u.d(1),u=null),(!c||512&p)&&na(r,e[9]),(!c||40&p&&a!==(a=ld(["PinturaButtonLabel",e[3],e[5]&&"implicit"])))&&Qr(n,"class",a),(!c||66&p&&s!==(s=bu(e[1],e[6])))&&Qr(t,"title",s),(!c||16&p&&l!==(l=ld(["PinturaButtonInner",e[4]])))&&Qr(t,"class",l)},i(e){c||(ja(d),c=!0)},o(e){Ua(d),c=!1},d(e){e&&jr(t),d&&d.d(),u&&u.d()}}}function Dp(e){let t,o,i,n,r;const a=[{label:bu(e[1],e[6])},{hideLabel:!0},e[12],{value:e[7]},{onchange:e[11]}];let s={};for(let e=0;e<a.length;e+=1)s=hr(s,a[e]);return o=new Ep({props:s}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"slot","details")},m(a,s){Hr(a,t,s),os(o,t,null),i=!0,n||(r=qr(t,"keydown",e[10]),n=!0)},p(e,t){const i=6338&t?Ja(a,[66&t&&{label:bu(e[1],e[6])},a[1],4096&t&&Qa(e[12]),128&t&&{value:e[7]},2048&t&&{onchange:e[11]}]):{};o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o),n=!1,r()}}}function Op(e){let t,o;return t=new pu({props:{canConfirm:!0,panelClass:"PinturaSliderPanel",buttonClass:ld(["PinturaSliderButton",e[0],e[5]&&"PinturaSliderIconOnly"]),$$slots:{details:[Dp],label:[zp]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,[o]){const i={};33&o&&(i.buttonClass=ld(["PinturaSliderButton",e[0],e[5]&&"PinturaSliderIconOnly"])),1053694&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Bp(e,t,i){const n=["class","title","label","icon","labelClass","innerClass","hideLabel","locale","value","onchange","labelPrefix"];let r=Ir(t,n),{class:a}=t,{title:s}=t,{label:l=Math.round}=t,{icon:c}=t,{labelClass:d}=t,{innerClass:u}=t,{hideLabel:p=!1}=t,{locale:h}=t,{value:m}=t,{onchange:g=o}=t,{labelPrefix:$}=t;const{min:f,max:y,getValue:b=ee}=r;let x;const v=e=>i(9,x=(e=>L(l)?l(b(e),f,y,e):l)(e));return e.$$set=e=>{t=hr(hr({},t),Rr(e)),i(12,r=Ir(t,n)),"class"in e&&i(0,a=e.class),"title"in e&&i(1,s=e.title),"label"in e&&i(13,l=e.label),"icon"in e&&i(2,c=e.icon),"labelClass"in e&&i(3,d=e.labelClass),"innerClass"in e&&i(4,u=e.innerClass),"hideLabel"in e&&i(5,p=e.hideLabel),"locale"in e&&i(6,h=e.locale),"value"in e&&i(7,m=e.value),"onchange"in e&&i(14,g=e.onchange),"labelPrefix"in e&&i(8,$=e.labelPrefix)},e.$$.update=()=>{8320&e.$$.dirty&&v(m)},[a,s,c,d,u,p,h,m,$,x,e=>{/tab/i.test(e.key)&&e.preventDefault()},e=>{v(e),g(e)},r,l,g]}class Wp extends rs{constructor(e){super(),ns(this,e,Bp,Op,yr,{class:0,title:1,label:13,icon:2,labelClass:3,innerClass:4,hideLabel:5,locale:6,value:7,onchange:14,labelPrefix:8})}}function _p(e){let t,o,i,n,r,a,s,l;return{c(){t=Ur("span"),o=Gr("svg"),i=Gr("g"),n=Gr("circle"),r=Gr("circle"),a=Xr(),s=Ur("span"),l=Zr(e[3]),Qr(n,"class","PinturaProgressIndicatorBar"),Qr(n,"r","8.5"),Qr(n,"cx","10"),Qr(n,"cy","10"),Qr(n,"stroke-linecap","round"),Qr(n,"opacity",".25"),Qr(r,"class","PinturaProgressIndicatorFill"),Qr(r,"r","8.5"),Qr(r,"stroke-dasharray",e[2]),Qr(r,"cx","10"),Qr(r,"cy","10"),Qr(r,"transform","rotate(-90) translate(-20)"),Qr(i,"fill","none"),Qr(i,"stroke","currentColor"),Qr(i,"stroke-width","2.5"),Qr(i,"stroke-linecap","round"),Qr(i,"opacity",e[1]),Qr(o,"width","20"),Qr(o,"height","20"),Qr(o,"viewBox","0 0 20 20"),Qr(o,"xmlns","http://www.w3.org/2000/svg"),Qr(o,"aria-hidden","true"),Qr(o,"focusable","false"),Qr(s,"class","implicit"),Qr(t,"class","PinturaProgressIndicator"),Qr(t,"data-status",e[0]),aa(t,"opacity",e[4])},m(e,c){Hr(e,t,c),_r(t,o),_r(o,i),_r(i,n),_r(i,r),_r(t,a),_r(t,s),_r(s,l)},p(e,[o]){4&o&&Qr(r,"stroke-dasharray",e[2]),2&o&&Qr(i,"opacity",e[1]),8&o&&na(l,e[3]),1&o&&Qr(t,"data-status",e[0]),16&o&&aa(t,"opacity",e[4])},i:ur,o:ur,d(e){e&&jr(t)}}}function Vp(e,t,o){let i,n,r,a,s,l,c,d;const u=xa();let{progress:p}=t,{min:h=0}=t,{max:m=100}=t,{labelBusy:g="Busy"}=t,{opacity:$}=t;const f=Sa("isAnimated");wr(e,f,e=>o(14,s=e));const y=Fc($,{precision:.01});wr(e,y,e=>o(4,d=e));const b=Fc(0,{precision:.01}),x=Fc(0,{precision:.01});wr(e,x,e=>o(15,l=e));const v=cs([b],e=>Rs(e,h,m));wr(e,v,e=>o(16,c=e));const S=v.subscribe(e=>{1===p&&Math.round(e)>=100&&u("complete")});return fa(()=>{x.set(1,{hard:!s})}),ba(()=>{S()}),e.$$set=e=>{"progress"in e&&o(9,p=e.progress),"min"in e&&o(10,h=e.min),"max"in e&&o(11,m=e.max),"labelBusy"in e&&o(12,g=e.labelBusy),"opacity"in e&&o(13,$=e.opacity)},e.$$.update=()=>{24576&e.$$.dirty&&No($)&&y.set($,{hard:!s}),16896&e.$$.dirty&&p&&p!==1/0&&b.set(100*p,{hard:!s}),70144&e.$$.dirty&&o(3,i=p===1/0?g:`${Math.round(c)}%`),66048&e.$$.dirty&&o(2,n=p===1/0?"26.5 53":c/100*53+" 53"),32768&e.$$.dirty&&o(1,r=l),512&e.$$.dirty&&o(0,a=p===1/0?"busy":"loading")},[a,r,n,i,d,f,y,x,v,p,h,m,g,$,s,l,c]}class Np extends rs{constructor(e){super(),ns(this,e,Vp,_p,yr,{progress:9,min:10,max:11,labelBusy:12,opacity:13})}}function Hp(e){let t,o,i=bu(e[0],e[1])+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class",e[3])},m(e,i){Hr(e,t,i),_r(t,o)},p(e,n){3&n&&i!==(i=bu(e[0],e[1])+"")&&na(o,i),8&n&&Qr(t,"class",e[3])},d(e){e&&jr(t)}}}function jp(e){let t,o,i,n,r=e[0]&&Hp(e);return i=new Rh({props:{items:e[2]}}),{c(){t=Ur("li"),r&&r.c(),o=Xr(),ts(i.$$.fragment),Qr(t,"class","PinturaShapeStyle")},m(e,a){Hr(e,t,a),r&&r.m(t,null),_r(t,o),os(i,t,null),n=!0},p(e,[n]){e[0]?r?r.p(e,n):(r=Hp(e),r.c(),r.m(t,o)):r&&(r.d(1),r=null);const a={};4&n&&(a.items=e[2]),i.$set(a)},i(e){n||(ja(i.$$.fragment,e),n=!0)},o(e){Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(t),r&&r.d(),is(i)}}}function Up(e,t,o){let i,{title:n}=t,{locale:r}=t,{items:a}=t,{hideTitle:s=!1}=t;return e.$$set=e=>{"title"in e&&o(0,n=e.title),"locale"in e&&o(1,r=e.locale),"items"in e&&o(2,a=e.items),"hideTitle"in e&&o(4,s=e.hideTitle)},e.$$.update=()=>{16&e.$$.dirty&&o(3,i="PinturaShapeStyleLabel"+(s?" implicit":""))},[n,r,a,i,s]}class Gp extends rs{constructor(e){super(),ns(this,e,Up,jp,yr,{title:0,locale:1,items:2,hideTitle:4})}}var Zp=(e,t,o)=>{let i,n,r;const a=Math.floor(6*e),s=6*e-a,l=o*(1-t),c=o*(1-s*t),d=o*(1-(1-s)*t);switch(a%6){case 0:i=o,n=d,r=l;break;case 1:i=c,n=o,r=l;break;case 2:i=l,n=o,r=d;break;case 3:i=l,n=c,r=o;break;case 4:i=d,n=l,r=o;break;case 5:i=o,n=l,r=c}return[i,n,r]};function Xp(e){let t,o;return{c(){t=Ur("div"),o=Ur("span"),Qr(t,"class","PinturaColorPreview"),Qr(t,"title",e[0]),aa(t,"--color",e[1])},m(e,i){Hr(e,t,i),_r(t,o)},p(e,[o]){1&o&&Qr(t,"title",e[0]),2&o&&aa(t,"--color",e[1])},i:ur,o:ur,d(e){e&&jr(t)}}}function Yp(e,t,o){let i,{color:n}=t,{title:r}=t;return e.$$set=e=>{"color"in e&&o(2,n=e.color),"title"in e&&o(0,r=e.title)},e.$$.update=()=>{4&e.$$.dirty&&o(1,i=n?Qo(n):"transparent")},[r,i,n]}class qp extends rs{constructor(e){super(),ns(this,e,Yp,Xp,yr,{color:2,title:0})}}var Kp=e=>(e=e.trim(),/^rgba/.test(e)?e.substring(5).split(",").map(parseFloat).map((e,t)=>e/(3===t?1:255)):/^rgb/.test(e)?e.substring(4).split(",").map(parseFloat).map(e=>e/255):/^#/.test(e)?(e=>{const[,t,o,i,n]=e.split("");e=e.length>=4&&e.length<=5?`#${t}${t}${o}${o}${i}${i}${n?`${n}${n}`:""}`:e;const[r,a,s,l,c]=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(e)||[];if(r)return[a,s,l,c].filter(e=>void 0!==e).map(e=>parseInt(e,16)/255)})(e):/[0-9]{1,3}\s?,\s?[0-9]{1,3}\s?,\s?[0-9]{1,3}/.test(e)?e.split(",").map(e=>parseInt(e,10)).map(e=>e/255):void 0);let Jp=null;function Qp(e){let t,o;return{c(){t=Ur("span"),o=Zr(e[0])},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){1&t[0]&&na(o,e[0])},d(e){e&&jr(t)}}}function eh(e){let t,o,i,n;o=new qp({props:{color:e[4],title:bu(e[8],e[10])}});let r=!e[9]&&Qp(e);return{c(){t=Ur("span"),ts(o.$$.fragment),i=Xr(),r&&r.c(),Qr(t,"slot","label"),Qr(t,"class","PinturaButtonLabel")},m(e,a){Hr(e,t,a),os(o,t,null),_r(t,i),r&&r.m(t,null),n=!0},p(e,i){const n={};16&i[0]&&(n.color=e[4]),1280&i[0]&&(n.title=bu(e[8],e[10])),o.$set(n),e[9]?r&&(r.d(1),r=null):r?r.p(e,i):(r=Qp(e),r.c(),r.m(t,null))},i(e){n||(ja(o.$$.fragment,e),n=!0)},o(e){Ua(o.$$.fragment,e),n=!1},d(e){e&&jr(t),is(o),r&&r.d()}}}function th(e){let t,o,i,n,r,a,s,l,c,d,u,p;s=new Ep({props:{label:"Hue",hideLabel:!0,class:"PinturaHuePicker",onchange:e[27],value:e[16],min:0,max:1,step:.01}});let h=e[11]&&oh(e),m=(e[14]||e[15])&&ih(e);return{c(){t=Ur("div"),o=Ur("div"),i=Ur("div"),n=Ur("div"),r=Xr(),a=Ur("div"),ts(s.$$.fragment),l=Xr(),h&&h.c(),c=Xr(),m&&m.c(),Qr(n,"role","button"),Qr(n,"aria-label","Saturation slider"),Qr(n,"class","PinturaPickerKnob"),Qr(n,"tabindex","0"),aa(n,"background-color",e[20]),Qr(i,"class","PinturaPickerKnobController"),aa(i,"transform",`translate(${e[25]}%,${e[24]}%)`),Qr(o,"class","PinturaSaturationPicker"),aa(o,"background-color",e[21]),aa(a,"--knob-background",e[21]),Qr(t,"class","PinturaPicker")},m(g,$){Hr(g,t,$),_r(t,o),_r(o,i),_r(i,n),e[42](o),_r(t,r),_r(t,a),os(s,a,null),_r(t,l),h&&h.m(t,null),_r(t,c),m&&m.m(t,null),d=!0,u||(p=[qr(n,"nudge",e[30]),Ar(xp.call(null,n,{preventDefault:!0})),qr(o,"pointerdown",e[29])],u=!0)},p(e,r){1048576&r[0]&&aa(n,"background-color",e[20]),50331648&r[0]&&aa(i,"transform",`translate(${e[25]}%,${e[24]}%)`),2097152&r[0]&&aa(o,"background-color",e[21]);const l={};65536&r[0]&&(l.value=e[16]),s.$set(l),2097152&r[0]&&aa(a,"--knob-background",e[21]),e[11]?h?(h.p(e,r),2048&r[0]&&ja(h,1)):(h=oh(e),h.c(),ja(h,1),h.m(t,c)):h&&(Na(),Ua(h,1,1,()=>{h=null}),Ha()),e[14]||e[15]?m?(m.p(e,r),49152&r[0]&&ja(m,1)):(m=ih(e),m.c(),ja(m,1),m.m(t,null)):m&&(Na(),Ua(m,1,1,()=>{m=null}),Ha())},i(e){d||(ja(s.$$.fragment,e),ja(h),ja(m),d=!0)},o(e){Ua(s.$$.fragment,e),Ua(h),Ua(m),d=!1},d(o){o&&jr(t),e[42](null),is(s),h&&h.d(),m&&m.d(),u=!1,$r(p)}}}function oh(e){let t,o,i;return o=new Ep({props:{label:"Opacity",hideLabel:!0,class:"PinturaOpacityPicker",onchange:e[28],value:e[17],min:0,max:1,step:.01}}),{c(){t=Ur("div"),ts(o.$$.fragment),aa(t,"--knob-background",e[18]),aa(t,"--track-background",`linear-gradient(to right,${e[19]},${e[20]})`)},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,i){const n={};131072&i[0]&&(n.value=e[17]),o.$set(n),262144&i[0]&&aa(t,"--knob-background",e[18]),1572864&i[0]&&aa(t,"--track-background",`linear-gradient(to right,${e[19]},${e[20]})`)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function ih(e){let t,o,i,n,r,a,s,l=e[15]&&nh(e);return{c(){t=Ur("div"),o=Ur("input"),n=Xr(),l&&l.c(),Qr(o,"class","PinturaColorPickerInput"),Qr(o,"type","text"),o.disabled=i=!e[14],o.value=e[23],Qr(t,"class","PinturColorPickerInputGroup")},m(i,c){Hr(i,t,c),_r(t,o),_r(t,n),l&&l.m(t,null),r=!0,a||(s=[qr(o,"keydown",e[32]),qr(o,"input",e[31])],a=!0)},p(e,n){(!r||16384&n[0]&&i!==(i=!e[14]))&&(o.disabled=i),(!r||8388608&n[0]&&o.value!==e[23])&&(o.value=e[23]),e[15]?l?(l.p(e,n),32768&n[0]&&ja(l,1)):(l=nh(e),l.c(),ja(l,1),l.m(t,null)):l&&(Na(),Ua(l,1,1,()=>{l=null}),Ha())},i(e){r||(ja(l),r=!0)},o(e){Ua(l),r=!1},d(e){e&&jr(t),l&&l.d(),a=!1,$r(s)}}}function nh(e){let t,o;return t=new Dh({props:{icon:'<path stroke="currentColor" stroke-linecap="square" d="m13 14-7 7a2.704 2.704 0 0 1-3 0 2.704 2.704 0 0 1 0-3l7-7"/><path fill="currentColor" d="M9.475 9.475 14.5 14.5c.263.263.69.265.955.005l.783-.767a4.209 4.209 0 0 0 1.262-3.006V10l4-4c.5-.5.375-2.125-.5-3s-2.5-1-3-.5l-4 4h-.732a4.329 4.329 0 0 0-3.03 1.238l-.758.742a.7.7 0 0 0-.005.995Z"/>',hideLabel:!0,label:"Pick a color",class:"PinturaEyeDropper",onclick:e[33]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p:ur,i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function rh(e){let t,o;return t=new Xu({props:{label:bu(e[10].labelColorPalette,e[10]),class:ld(["PinturaColorPresets",e[9]?"PinturaColorPresetsGrid":"PinturaColorPresetsList"]),hideLabel:!1,name:e[1],value:e[4],optionGroupClass:"PinturaListOptionGroup",optionClass:"PinturaListOption",options:e[2].map(e[43]),selectedIndex:e[3],optionMapper:e[7],optionLabelClass:e[6],onchange:e[44],$$slots:{option:[lh,({option:e})=>({60:e}),({option:e})=>[0,e?536870912:0]],group:[ah,({option:e})=>({60:e}),({option:e})=>[0,e?536870912:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o[0]&&(i.label=bu(e[10].labelColorPalette,e[10])),512&o[0]&&(i.class=ld(["PinturaColorPresets",e[9]?"PinturaColorPresetsGrid":"PinturaColorPresetsList"])),2&o[0]&&(i.name=e[1]),16&o[0]&&(i.value=e[4]),4&o[0]&&(i.options=e[2].map(e[43])),8&o[0]&&(i.selectedIndex=e[3]),128&o[0]&&(i.optionMapper=e[7]),64&o[0]&&(i.optionLabelClass=e[6]),512&o[0]|1610612736&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ah(e){let t,o,i=e[60].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"slot","group")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){536870912&t[1]&&i!==(i=e[60].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function sh(e){let t,o,i=e[60].label+"";return{c(){t=Ur("span"),o=Zr(i),Qr(t,"class","PinturaButtonLabel")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){536870912&t[1]&&i!==(i=e[60].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function lh(e){let t,o,i,n;o=new qp({props:{color:e[60].value}});let r=!e[9]&&sh(e);return{c(){t=Ur("span"),ts(o.$$.fragment),i=Xr(),r&&r.c(),Qr(t,"slot","option")},m(e,a){Hr(e,t,a),os(o,t,null),_r(t,i),r&&r.m(t,null),n=!0},p(e,i){const n={};536870912&i[1]&&(n.color=e[60].value),o.$set(n),e[9]?r&&(r.d(1),r=null):r?r.p(e,i):(r=sh(e),r.c(),r.m(t,null))},i(e){n||(ja(o.$$.fragment,e),n=!0)},o(e){Ua(o.$$.fragment,e),n=!1},d(e){e&&jr(t),is(o),r&&r.d()}}}function ch(e){let t,o,i,n=e[13]&&th(e),r=e[12]&&rh(e);return{c(){t=Ur("div"),n&&n.c(),o=Xr(),r&&r.c(),Qr(t,"slot","details"),Qr(t,"class","PinturaColorPickerPanel")},m(e,a){Hr(e,t,a),n&&n.m(t,null),_r(t,o),r&&r.m(t,null),i=!0},p(e,i){e[13]?n?(n.p(e,i),8192&i[0]&&ja(n,1)):(n=th(e),n.c(),ja(n,1),n.m(t,o)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[12]?r?(r.p(e,i),4096&i[0]&&ja(r,1)):(r=rh(e),r.c(),ja(r,1),r.m(t,null)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&jr(t),n&&n.d(),r&&r.d()}}}function dh(e){let t,o;return t=new pu({props:{buttonClass:ld(["PinturaColorPickerButton",e[5]]),$$slots:{details:[ch],label:[eh]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};32&o[0]&&(i.buttonClass=ld(["PinturaColorPickerButton",e[5]])),67108831&o[0]|1073741824&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function uh(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,g,$,{label:f}=t,{name:y}=t,{options:b=[]}=t,{selectedIndex:x=-1}=t,{value:v}=t,{buttonClass:S}=t,{optionLabelClass:w}=t,{optionMapper:k}=t,{onchange:C}=t,{title:T}=t,{hidePresetLabel:M=!0}=t,{locale:P}=t,{enableOpacity:R=!0}=t,{enablePresets:I=!0}=t,{enablePicker:E=!0}=t,{enableInput:A=!1}=t,{enableEyeDropper:F=!1}=t,z="transparent",D="transparent";const O=(e,t)=>{if(p=[e[0],e[1],e[2]],t){let t=((e,t,o)=>{let i=Math.max(e,t,o),n=i-Math.min(e,t,o),r=n&&(i==e?(t-o)/n:i==t?2+(o-e)/n:4+(e-t)/n);return[60*(r<0?r+6:r)/360,i&&n/i,i]})(...p),i=t[0],n=t[1],r=t[2];No(H)&&(i=H),No(V)&&(n=V),No(N)&&(r=N),o(16,l=i),o(37,c=n),o(38,d=r),o(17,u=No(e[3])?e[3]:1)}o(18,h=Qo(e)),o(19,g=Qo([...p,0])),o(20,z=Qo([...p,1])),o(21,D=Qo(Zp(l,1,1)))},B=()=>{const e=[...Zp(l,c,d),u];O(e),C(e)},W=e=>{const t=3===e.length?[...e,1]:e;_(),O(t,!0),C(t)},_=()=>{V=void 0,N=void 0,H=void 0};let V,N,H;const j=(e,t)=>{const i=Rs(e.x/t.width,0,1),n=Rs(e.y/t.height,0,1);var r,a;a=1-n,o(37,c=r=i),o(38,d=a),V=r,N=a,B()};let U,G,Z,X;const Y=e=>{const t=Ie(xe(e),X);j(Re(ve(Z),t),G)},q=e=>{G=void 0,document.documentElement.removeEventListener("pointermove",Y),document.documentElement.removeEventListener("pointerup",q)};let K;function J(e){return L(e)?e(P):e}return e.$$set=e=>{"label"in e&&o(0,f=e.label),"name"in e&&o(1,y=e.name),"options"in e&&o(2,b=e.options),"selectedIndex"in e&&o(3,x=e.selectedIndex),"value"in e&&o(4,v=e.value),"buttonClass"in e&&o(5,S=e.buttonClass),"optionLabelClass"in e&&o(6,w=e.optionLabelClass),"optionMapper"in e&&o(7,k=e.optionMapper),"onchange"in e&&o(35,C=e.onchange),"title"in e&&o(8,T=e.title),"hidePresetLabel"in e&&o(9,M=e.hidePresetLabel),"locale"in e&&o(10,P=e.locale),"enableOpacity"in e&&o(11,R=e.enableOpacity),"enablePresets"in e&&o(12,I=e.enablePresets),"enablePicker"in e&&o(13,E=e.enablePicker),"enableInput"in e&&o(14,A=e.enableInput),"enableEyeDropper"in e&&o(36,F=e.enableEyeDropper)},e.$$.update=()=>{32&e.$$.dirty[1]&&o(15,i=F&&(null===Jp&&(Jp=m()&&"EyeDropper"in window),Jp)),16&e.$$.dirty[0]|256&e.$$.dirty[1]&&(!v||$&&Fs(v,$)||(o(39,$=[...v]),O(v,!0))),64&e.$$.dirty[1]&&o(25,n=100*c),128&e.$$.dirty[1]&&o(24,r=100-100*d),512&e.$$.dirty[1]&&o(41,a=!!K&&(K.length>=4&&K.length<=5)),51216&e.$$.dirty[0]|1024&e.$$.dirty[1]&&o(23,s=(A||i)&&v?((e,t,o)=>{let i=e.map(e=>Math.round(255*e).toString(16).toLowerCase().padStart(2,"0"));return(!t&&i.length>3||"ff"===i[3])&&i.pop(),o&&(i=i.map(e=>e.substring(0,1))),`#${i.join("")}`})(v,R,a):void 0)},[f,y,b,x,v,S,w,k,T,M,P,R,I,E,A,i,l,u,h,g,z,D,U,s,r,n,W,e=>{o(16,l=e),H=e,B()},e=>{o(17,u=e),B()},e=>{e.stopPropagation(),G=Ze(U.offsetWidth,U.offsetHeight),Z=(e=>be(e.offsetX,e.offsetY))(e),X=xe(e),j(Z,G),document.documentElement.addEventListener("pointermove",Y),document.documentElement.addEventListener("pointerup",q)},e=>{G=Ze(U.offsetWidth,U.offsetHeight);const t=n/100*G.width,o=r/100*G.height;j({x:t+e.detail.x,y:o+e.detail.y},G)},e=>{const{value:t}=e.target,i=t.length;if(!t.startsWith("#")||i<4||6===i||8===i||i>9)return;if(!R&&i>7)return;const n=Kp(t);n&&(o(40,K=t),_(),O(n),C(n))},e=>{e.stopPropagation()},e=>{(new EyeDropper).open().then(({sRGBHex:e})=>{const t=Kp(e);t&&(t[3]=1,o(40,K=v),_(),O(t),C(t))}).catch(e=>{})},J,C,F,c,d,$,K,a,function(e){Ca[e?"unshift":"push"](()=>{U=e,o(22,U)})},([e,t])=>[e,J(t),{title:J(t)}],e=>W(e.value)]}class ph extends rs{constructor(e){super(),ns(this,e,uh,dh,yr,{label:0,name:1,options:2,selectedIndex:3,value:4,buttonClass:5,optionLabelClass:6,optionMapper:7,onchange:35,title:8,hidePresetLabel:9,locale:10,enableOpacity:11,enablePresets:12,enablePicker:13,enableInput:14,enableEyeDropper:36},null,[-1,-1])}}function hh(e){let t,o,i;return o=new Rh({props:{items:e[0]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaShorthandControl PinturaShapeStyle")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,[t]){const i={};1&t&&(i.items=e[0]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function mh(e,t,o){let i,n,{value:r}=t,{onchange:a}=t,{controls:s=[]}=t;return e.$$set=e=>{o(6,t=hr(hr({},t),Rr(e))),"value"in e&&o(1,r=e.value),"onchange"in e&&o(2,a=e.onchange),"controls"in e&&o(3,s=e.controls)},e.$$.update=()=>{o(4,i=(e=>{const{controls:t,...o}=e;return o})(t)),30&e.$$.dirty&&o(0,n=s.map((e,t)=>{const[o,n,s]=e;return[o,n,{...i,...s,value:r[t],onchange:e=>{const o=[...r];o[t]=e,a(o)}}]}))},t=Rr(t),[n,r,a,s,i]}class gh extends rs{constructor(e){super(),ns(this,e,mh,hh,yr,{value:1,onchange:2,controls:3})}}function $h(e){let t,o;return t=new gp({props:{label:e[4],options:e[1],title:e[2],selectedIndex:e[5],onchange:e[10]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,[o]){const i={};16&o&&(i.label=e[4]),2&o&&(i.options=e[1]),4&o&&(i.title=e[2]),32&o&&(i.selectedIndex=e[5]),9&o&&(i.onchange=e[10]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function fh(e,t,o){let i,n,r,a,{options:s}=t,{title:l}=t,{onchange:c}=t,{selectedIndex:d=-1}=t,{value:u}=t,{label:p}=t;return e.$$set=e=>{"options"in e&&o(1,s=e.options),"title"in e&&o(2,l=e.title),"onchange"in e&&o(3,c=e.onchange),"selectedIndex"in e&&o(0,d=e.selectedIndex),"value"in e&&o(6,u=e.value),"label"in e&&o(7,p=e.label)},e.$$.update=()=>{67&e.$$.dirty&&o(9,i=((e,t,o)=>{if(e)return t>-1?e[t]:void 0!==o?e.find(e=>e[0]===o):e[0]})(s,d,u)),514&e.$$.dirty&&o(5,n=s&&s.findIndex(e=>e===i)),512&e.$$.dirty&&o(8,r=i&&i[1]),384&e.$$.dirty&&o(4,a=p||r)},[d,s,l,c,a,n,u,p,r,i,e=>{o(0,d=e.index),c&&c(e)}]}class yh extends rs{constructor(e){super(),ns(this,e,fh,$h,yr,{options:1,title:2,onchange:3,selectedIndex:0,value:6,label:7})}}function bh(e,t,o){const i=e.slice();return i[9]=t[o][0],i[0]=t[o][1],i[10]=t[o][2],i[2]=t[o][3],i}function xh(e){let t,o,i;const n=[e[10]];var r=e[3][e[9]]||e[9];function a(e,t){let o={};for(let e=0;e<n.length;e+=1)o=hr(o,n[e]);return void 0!==t&&4&t&&(o=hr(o,Ja(n,[Qa(e[10])]))),{props:o}}return r&&(t=ca(r,a(e))),{c(){t&&ts(t.$$.fragment),o=Yr()},m(e,n){t&&os(t,e,n),Hr(e,o,n),i=!0},p(e,i){if(4&i&&r!==(r=e[3][e[9]]||e[9])){if(t){Na();const e=t;Ua(e.$$.fragment,1,0,()=>{is(e,1)}),Ha()}r?(t=ca(r,a(e,i)),ts(t.$$.fragment),ja(t.$$.fragment,1),os(t,o.parentNode,o)):t=null}else if(r){const o=4&i?Ja(n,[Qa(e[10])]):{};t.$set(o)}},i(e){i||(t&&ja(t.$$.fragment,e),i=!0)},o(e){t&&Ua(t.$$.fragment,e),i=!1},d(e){e&&jr(o),t&&is(t,e)}}}function vh(e){let t,o=e[9],i=e[9]&&Ch(e);return{c(){i&&i.c(),t=Yr()},m(e,o){i&&i.m(e,o),Hr(e,t,o)},p(e,n){e[9]?o?yr(o,e[9])?(i.d(1),i=Ch(e),o=e[9],i.c(),i.m(t.parentNode,t)):i.p(e,n):(i=Ch(e),o=e[9],i.c(),i.m(t.parentNode,t)):o&&(i.d(1),i=null,o=e[9])},i:ur,o(e){Ua(i,e)},d(e){e&&jr(t),i&&i.d(e)}}}function Sh(e){let t,o,i=e[10].innerHTML+"";return{c(){t=new la(!1),o=Yr(),t.a=o},m(e,n){t.m(i,e,n),Hr(e,o,n)},p(e,o){4&o&&i!==(i=e[10].innerHTML+"")&&t.p(i)},i:ur,o:ur,d(e){e&&(jr(o),t.d())}}}function wh(e){let t,o=e[10].textContent+"";return{c(){t=Zr(o)},m(e,o){Hr(e,t,o)},p(e,i){4&i&&o!==(o=e[10].textContent+"")&&na(t,o)},i:ur,o:ur,d(e){e&&jr(t)}}}function kh(e){let t,o;return t=new Rh({props:{items:e[2],discardEmptyItems:!0}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};4&o&&(i.items=e[2]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Ch(e){let t,o,i,n,r;const a=[kh,wh,Sh],s=[];function l(e,t){return e[2]&&e[2].length?0:e[10].textContent?1:e[10].innerHTML?2:-1}~(o=l(e))&&(i=s[o]=a[o](e));let c=[e[4](e[10])],d={};for(let e=0;e<c.length;e+=1)d=hr(d,c[e]);return{c(){t=Ur(e[9]),i&&i.c(),n=Xr(),ia(e[9])(t,d)},m(e,i){Hr(e,t,i),~o&&s[o].m(t,null),_r(t,n),r=!0},p(e,r){let u=o;o=l(e),o===u?~o&&s[o].p(e,r):(i&&(Na(),Ua(s[u],1,1,()=>{s[u]=null}),Ha()),~o?(i=s[o],i?i.p(e,r):(i=s[o]=a[o](e),i.c()),ja(i,1),i.m(t,n)):i=null),ia(e[9])(t,d=Ja(c,[4&r&&e[4](e[10])]))},i(e){r||(ja(i),r=!0)},o(e){Ua(i),r=!1},d(e){e&&jr(t),~o&&s[o].d()}}}function Th(e,t){let o,i,n,r,a,s;const l=[vh,xh],c=[];function d(e,t){return 4&t&&(i=null),null==i&&(i=!e[5](e[9])),i?0:1}return n=d(t,-1),r=c[n]=l[n](t),{key:e,first:null,c(){o=Yr(),r.c(),a=Yr(),this.first=o},m(e,t){Hr(e,o,t),c[n].m(e,t),Hr(e,a,t),s=!0},p(e,o){let i=n;n=d(t=e,o),n===i?c[n].p(t,o):(Na(),Ua(c[i],1,1,()=>{c[i]=null}),Ha(),r=c[n],r?r.p(t,o):(r=c[n]=l[n](t),r.c()),ja(r,1),r.m(a.parentNode,a))},i(e){s||(ja(r),s=!0)},o(e){Ua(r),s=!1},d(e){e&&(jr(o),jr(a)),c[n].d(e)}}}function Mh(e){let t,o,i=[],n=new Map,r=Xa(e[2]);const a=e=>e[0]+e[1];for(let t=0;t<r.length;t+=1){let o=bh(e,r,t),s=a(o);n.set(s,i[t]=Th(s,o))}return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=Yr()},m(e,n){for(let t=0;t<i.length;t+=1)i[t]&&i[t].m(e,n);Hr(e,t,n),o=!0},p(e,[o]){62&o&&(r=Xa(e[2]),Na(),i=Ka(i,o,a,1,e,r,n,t.parentNode,qa,Th,t,bh),Ha())},i(e){if(!o){for(let e=0;e<r.length;e+=1)ja(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)Ua(i[e]);o=!1},d(e){e&&jr(t);for(let t=0;t<i.length;t+=1)i[t].d(e)}}}function Ph(e,t,o){let i,n,{items:r}=t,{discardEmptyItems:a=!0}=t,{key:s=""}=t;const l={Button:Dh,ImageButton:Hd,ImageButtonList:Xd,Dropdown:gp,Select:yh,RadioGroup:Xu,Input:Ju,Panel:bp,ProgressIndicator:Np,ShapeStyle:Gp,ToggleSlider:Wp,ColorPicker:ph,ShorthandControl:gh},c=e=>!y(e)||!!l[e],d=e=>{if(!e)return!1;const[t,,o,i=[]]=e;return!!c(t)||(i.some(d)||o.textContent||o.innerHTML)};return e.$$set=e=>{"items"in e&&o(6,r=e.items),"discardEmptyItems"in e&&o(7,a=e.discardEmptyItems),"key"in e&&o(0,s=e.key)},e.$$.update=()=>{1&e.$$.dirty&&o(1,i=s),192&e.$$.dirty&&o(2,n=(r&&a?r.filter(d):r)||[])},[s,i,n,l,(e={})=>{const{textContent:t,innerHTML:o,...i}=e;return i},c,r,a]}class Rh extends rs{constructor(e){super(),ns(this,e,Ph,Mh,yr,{items:6,discardEmptyItems:7,key:0})}get items(){return this.$$.ctx[6]}set items(e){this.$$set({items:e}),Oa()}get discardEmptyItems(){return this.$$.ctx[7]}set discardEmptyItems(e){this.$$set({discardEmptyItems:e}),Oa()}get key(){return this.$$.ctx[0]}set key(e){this.$$set({key:e}),Oa()}}function Ih(e){let t,o;return t=new Od({props:{class:"PinturaButtonIcon",$$slots:{default:[Eh]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};536870920&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Eh(e){let t;return{c(){t=Gr("g")},m(o,i){Hr(o,t,i),t.innerHTML=e[3]},p(e,o){8&o&&(t.innerHTML=e[3])},d(e){e&&jr(t)}}}function Ah(e){let t;return{c(){t=Ur("span"),Qr(t,"class",e[11])},m(o,i){Hr(o,t,i),t.innerHTML=e[0]},p(e,o){1&o&&(t.innerHTML=e[0]),2048&o&&Qr(t,"class",e[11])},i:ur,o:ur,d(e){e&&jr(t)}}}function Lh(e){let t,o,i;return o=new Rh({props:{items:e[0]}}),{c(){t=Ur("span"),ts(o.$$.fragment),Qr(t,"class",e[11])},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,n){const r={};1&n&&(r.items=e[0]),o.$set(r),(!i||2048&n)&&Qr(t,"class",e[11])},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function Fh(e){let t,o,i,n,r,a;const s=e[27].default,l=kr(s,e,e[29],null),c=l||function(e){let t,o,i,n,r,a,s=e[3]&&Ih(e);const l=[Lh,Ah],c=[];function d(e,t){return 1&t&&(i=null),null==i&&(i=!!Uo(e[0])),i?0:1}return n=d(e,-1),r=c[n]=l[n](e),{c(){t=Ur("span"),s&&s.c(),o=Xr(),r.c(),Qr(t,"class",e[13])},m(e,i){Hr(e,t,i),s&&s.m(t,null),_r(t,o),c[n].m(t,null),a=!0},p(e,i){e[3]?s?(s.p(e,i),8&i&&ja(s,1)):(s=Ih(e),s.c(),ja(s,1),s.m(t,o)):s&&(Na(),Ua(s,1,1,()=>{s=null}),Ha());let u=n;n=d(e,i),n===u?c[n].p(e,i):(Na(),Ua(c[u],1,1,()=>{c[u]=null}),Ha(),r=c[n],r?r.p(e,i):(r=c[n]=l[n](e),r.c()),ja(r,1),r.m(t,null)),(!a||8192&i)&&Qr(t,"class",e[13])},i(e){a||(ja(s),ja(r),a=!0)},o(e){Ua(s),Ua(r),a=!1},d(e){e&&jr(t),s&&s.d(),c[n].d()}}}(e);return{c(){t=Ur("button"),c&&c.c(),Qr(t,"type",e[6]),t.disabled=e[5],Qr(t,"class",e[12]),Qr(t,"title",o=Wd(e[0],e[1],e[2]))},m(o,s){Hr(o,t,s),c&&c.m(t,null),e[28](t),n=!0,r||(a=[qr(t,"keydown",function(){fr(e[8])&&e[8].apply(this,arguments)}),qr(t,"click",function(){fr(e[7])&&e[7].apply(this,arguments)}),qr(t,"pointerdown",function(){fr(e[14])&&e[14].apply(this,arguments)}),Ar(i=fd.call(null,t,e[4])),Ar(e[9].call(null,t))],r=!0)},p(r,[a]){e=r,l?l.p&&(!n||536870912&a)&&Mr(l,s,e,e[29],n?Tr(s,e[29],a,null):Pr(e[29]),null):c&&c.p&&(!n||10249&a)&&c.p(e,n?a:-1),(!n||64&a)&&Qr(t,"type",e[6]),(!n||32&a)&&(t.disabled=e[5]),(!n||4096&a)&&Qr(t,"class",e[12]),(!n||7&a&&o!==(o=Wd(e[0],e[1],e[2])))&&Qr(t,"title",o),i&&fr(i.update)&&16&a&&i.update.call(null,e[4])},i(e){n||(ja(c,e),n=!0)},o(e){Ua(c,e),n=!1},d(o){o&&jr(t),c&&c.d(o),e[28](null),r=!1,$r(a)}}}function zh(e,t,i){let n,r,a,s,l,c,{$$slots:d={},$$scope:u}=t,{class:p}=t,{label:h}=t,{title:m}=t,{shortcut:g}=t,{labelClass:$}=t,{innerClass:f}=t,{hideLabel:y=!1}=t,{icon:b}=t,{style:x}=t,{disabled:v}=t,{type:S="button"}=t,{onclick:w}=t,{onkeydown:k}=t,{onhold:C}=t,{action:T=()=>{}}=t,{holdThreshold:M=500}=t,{holdSpeedUpFactor:P=.5}=t,{holdSpeedMin:R=20}=t;const I=e=>{i(25,c=setTimeout(()=>{C(),I(Math.max(e*P,R))},e))};let E;return e.$$set=e=>{"class"in e&&i(15,p=e.class),"label"in e&&i(0,h=e.label),"title"in e&&i(1,m=e.title),"shortcut"in e&&i(2,g=e.shortcut),"labelClass"in e&&i(16,$=e.labelClass),"innerClass"in e&&i(17,f=e.innerClass),"hideLabel"in e&&i(18,y=e.hideLabel),"icon"in e&&i(3,b=e.icon),"style"in e&&i(4,x=e.style),"disabled"in e&&i(5,v=e.disabled),"type"in e&&i(6,S=e.type),"onclick"in e&&i(7,w=e.onclick),"onkeydown"in e&&i(8,k=e.onkeydown),"onhold"in e&&i(19,C=e.onhold),"action"in e&&i(9,T=e.action),"holdThreshold"in e&&i(20,M=e.holdThreshold),"holdSpeedUpFactor"in e&&i(21,P=e.holdSpeedUpFactor),"holdSpeedMin"in e&&i(22,R=e.holdSpeedMin),"$$scope"in e&&i(29,u=e.$$scope)},e.$$.update=()=>{101187584&e.$$.dirty&&i(26,r=C?()=>{c&&(clearTimeout(c),i(25,c=void 0),document.documentElement.removeEventListener("pointerup",r))}:o),68681728&e.$$.dirty&&i(14,n=C?()=>{document.documentElement.addEventListener("pointerup",r),I(M)}:o),131072&e.$$.dirty&&i(13,a=ld(["PinturaButtonInner",f])),294912&e.$$.dirty&&i(12,s=ld(["PinturaButton",y&&"PinturaButtonIconOnly",p])),327680&e.$$.dirty&&i(11,l=ld([y?"implicit":"PinturaButtonLabel",$]))},[h,m,g,b,x,v,S,w,k,T,E,l,s,a,n,p,$,f,y,C,M,P,R,e=>Bd(e,E),()=>E,c,r,d,function(e){Ca[e?"unshift":"push"](()=>{E=e,i(10,E)})},u]}class Dh extends rs{constructor(e){super(),ns(this,e,zh,Fh,yr,{class:15,label:0,title:1,shortcut:2,labelClass:16,innerClass:17,hideLabel:18,icon:3,style:4,disabled:5,type:6,onclick:7,onkeydown:8,onhold:19,action:9,holdThreshold:20,holdSpeedUpFactor:21,holdSpeedMin:22,isEventTarget:23,getElement:24})}get isEventTarget(){return this.$$.ctx[23]}get getElement(){return this.$$.ctx[24]}}var Oh=(e,t)=>{const o=e.findIndex(t);if(o>=0)return e.splice(o,1)};const Bh=80;var Wh=(e,t={})=>{const{inertia:o=!1,inertiaDurationMultiplier:i=Bh,shouldStartInteraction:n=()=>!0,pinch:r=!1,multiTouch:a,getEventPosition:s=e=>be(e.clientX,e.clientY),observeKeys:l=!1}=t;function c(t,o){e.dispatchEvent(new CustomEvent(t,{detail:o}))}function d(){S&&S(),S=void 0}const u=[],p=e=>0===e.timeStamp?Date.now():e.timeStamp,h=()=>{const e=ve(u[0].position);if(u[1]){const t=.5*(u[1].position.x-e.x),o=.5*(u[1].position.y-e.y);e.x+=t,e.y+=o}return e},m=e=>{e.origin.x=e.position.x,e.origin.y=e.position.y,e.translation.x=0,e.translation.y=0},g=e=>{const t=(e=>u.findIndex(t=>t.event.pointerId===e.pointerId))(e);if(!(t<0))return u[t]},$=()=>1===u.length,f=()=>2===u.length,y=e=>{const t=Be(e.map(e=>e.position)),o=((e,t)=>e.reduce((e,o)=>e+De(t,o.position),0)/e.length)(e,t);return{center:t,distance:o,velocity:Be(e.map(e=>e.velocity)),translation:Be(e.map(e=>e.translation))}};let b,x,v,S,w,k,C,T,M,P=0;e.addEventListener("pointerdown",L);const R=["Meta","Control","Alt","Shift"];function I(e){if(!R.includes(e.key))return;const{metaKey:t,ctrlKey:o,altKey:i,shiftKey:n}=e;A({metaKey:t,ctrlKey:o,altKey:i,shiftKey:n})}let E=Date.now();const A=e=>{const t=ve(u[0].translation);let o=C;if(r&&f()){o*=De(u[0].position,u[1].position)/w,Re(t,u[1].translation)}Re(t,k);const i=Date.now();i-E<16||(E=i,c("interactionupdate",{position:h(),translation:t,scalar:r?o:void 0,isMultiTouching:f(),...e}))};function L(t){if(!f()&&!(e=>No(e.button)&&0!==e.button)(t)&&n(t,e))if(d(),(e=>{const t=p(e),o={timeStamp:t,timeStampInitial:t,position:s(e),origin:s(e),velocity:ye(),velocityHistory:[],velocityAverage:ye(),translation:ye(),interactionState:void 0,event:e};u.push(o),o.interactionState=y(u)})(t),l&&(window.addEventListener("keydown",I),window.addEventListener("keyup",I)),$())document.documentElement.addEventListener("pointermove",F),document.documentElement.addEventListener("pointerup",z),document.documentElement.addEventListener("pointercancel",z),document.addEventListener("visibilitychange",O),T=!1,C=1,k=ye(),w=void 0,c("interactionstart",{origin:ve(g(t).origin)});else if(r)T=!0,w=De(u[0].position,u[1].position),k.x+=u[0].translation.x,k.y+=u[0].translation.y,m(u[0]);else if(!1===a)return u.length=0,W(),c("interactioncancel")}function F(e){e.preventDefault(),(e=>{const t=g(e);if(!t)return;const o=p(e),i=s(e),n=Math.max(1,o-t.timeStamp);t.velocity.x=(i.x-t.position.x)/n,t.velocity.y=(i.y-t.position.y)/n,t.velocityHistory.push(ve(t.velocity)),t.velocityHistory=t.velocityHistory.slice(-3),t.velocityAverage=t.velocityHistory.reduce((e,t,o,i)=>(e.x+=t.x/i.length,e.y+=t.y/i.length,e),ye()),t.translation.x=i.x-t.origin.x,t.translation.y=i.y-t.origin.y,t.timeStamp=o,t.position.x=i.x,t.position.y=i.y,t.event=e})(e);const{metaKey:t=!1,ctrlKey:o=!1,altKey:i=!1,shiftKey:n=!1}=l?e:{};A({metaKey:t,ctrlKey:o,altKey:i,shiftKey:n})}function z(e){if(!g(e))return;const t=h(),n=(e=>{const t=Oh(u,t=>t.event.pointerId===e.pointerId);if(t)return t[0]})(e);if(r&&$()){const e=De(u[0].position,n.position);C*=e/w,k.x+=u[0].translation.x+n.translation.x,k.y+=u[0].translation.y+n.translation.y,m(u[0])}let a=!1,s=!1;if(!T&&n){const e=performance.now(),t=e-n.timeStampInitial,o=ze(n.translation);a=o<64&&t<300,s=!!(M&&a&&e-P<700&&ze(M,n.position)<128),a&&(M=ve(n.position),P=e)}if(u.length>0)return;W();const l=ve(n.translation),d=ve(n.velocityAverage);let p=!1;c("interactionrelease",{isTap:a,isDoubleTap:s,position:t,translation:l,scalar:C,preventInertia:()=>p=!0});const f=De(d);if(p||!o||f<.25)return B(l,{isTap:a,isDoubleTap:s});x=ve(t),v=ve(l),b=Ac(ve(l),{easing:Ic,duration:f*i}),b.set({x:l.x+50*d.x,y:l.y+50*d.y}).then(()=>{S&&B(Sr(b),{isTap:a,isDoubleTap:s})}),S=b.subscribe(D)}function D(e){e&&c("interactionupdate",{position:be(x.x+(e.x-v.x),x.y+(e.y-v.y)),translation:e,scalar:r?C:void 0})}function O(e){if("visible"===document.visibilityState||!u.length)return;const t=y(u);d(),c("interactionend",{...t}),u.length=0,W()}function B(e,t){d(),c("interactionend",{...t,translation:e,scalar:r?C:void 0})}function W(){l&&window.removeEventListener("keydown",I),l&&window.removeEventListener("keyup",I),document.documentElement.removeEventListener("pointermove",F),document.documentElement.removeEventListener("pointerup",z),document.documentElement.removeEventListener("pointercancel",z),document.removeEventListener("visibilitychange",O)}return{destroy(){d(),e.removeEventListener("pointerdown",L)}}};function _h(e,t){return t?t*Math.sign(e)*Math.log10(1+Math.abs(e)/t):e}const Vh=(e,t,o)=>{if(!t||!o)return{...e};const i=e.x+_h(t.x-e.x,o),n=e.x+e.width+_h(t.x+t.width-(e.x+e.width),o),r=e.y+_h(t.y-e.y,o);return{x:i,y:r,width:n-i,height:e.y+e.height+_h(t.y+t.height-(e.y+e.height),o)-r}},Nh=(e,t,o)=>t&&o?be(e.x+_h(t.x-e.x,o),e.y+_h(t.y-e.y,o)):{...e};var Hh=(e,t)=>{if(e)return/em/.test(e)?16*parseInt(e,10):/px/.test(e)?parseInt(e,10):void 0};function jh(e){let t,o,i,n,r,a,s;const l=e[40].default,c=kr(l,e,e[39],null);return{c(){t=Ur("div"),o=Ur("div"),c&&c.c(),aa(o,"transform",e[6]),Qr(t,"class",i=ld(["PinturaScrollable",e[0]])),Qr(t,"data-direction",e[1]),Qr(t,"data-state",e[7]),aa(t,"--scrollable-feather-start-opacity",e[4]),aa(t,"--scrollable-feather-end-opacity",e[5])},m(i,l){Hr(i,t,l),_r(t,o),c&&c.m(o,null),e[42](t),r=!0,a||(s=[qr(o,"interactionstart",e[10]),qr(o,"interactionupdate",e[12]),qr(o,"interactionend",e[13]),qr(o,"interactionrelease",e[11]),Ar(Wh.call(null,o,{inertia:!0})),qr(o,"measure",e[41]),Ar(qc.call(null,o)),qr(t,"wheel",e[15],{passive:!1}),qr(t,"scroll",e[17]),qr(t,"focusin",e[43]),qr(t,"nudge",e[18]),qr(t,"measure",e[14]),Ar(qc.call(null,t,{observePosition:!0})),Ar(n=xp.call(null,t,{direction:"x"===e[1]?"horizontal":"vertical",stopKeydownPropagation:!1}))],a=!0)},p(e,a){c&&c.p&&(!r||256&a[1])&&Mr(c,l,e,e[39],r?Tr(l,e[39],a,null):Pr(e[39]),null),64&a[0]&&aa(o,"transform",e[6]),(!r||1&a[0]&&i!==(i=ld(["PinturaScrollable",e[0]])))&&Qr(t,"class",i),(!r||2&a[0])&&Qr(t,"data-direction",e[1]),(!r||128&a[0])&&Qr(t,"data-state",e[7]),n&&fr(n.update)&&2&a[0]&&n.update.call(null,{direction:"x"===e[1]?"horizontal":"vertical",stopKeydownPropagation:!1}),16&a[0]&&aa(t,"--scrollable-feather-start-opacity",e[4]),32&a[0]&&aa(t,"--scrollable-feather-end-opacity",e[5])},i(e){r||(ja(c,e),r=!0)},o(e){Ua(c,e),r=!1},d(o){o&&jr(t),c&&c.d(o),e[42](null),a=!1,$r(s)}}}function Uh(e,t,i){let n,r,a,s,l,c,d,u,p,h,m,{$$slots:g={},$$scope:$}=t;const f=xa();let y,b,x,v,S="idle",w=Fc(0);wr(e,w,e=>i(38,h=e));let{class:k}=t,{scrollBlockInteractionDist:C=5}=t,{scrollStep:T=10}=t,{scrollFocusMargin:M=64}=t,{scrollDirection:P="x"}=t,{scrollAutoCancel:R=!1}=t,{elasticity:I=0}=t,{onscroll:E=o}=t,{maskFeatherSize:A}=t,{maskFeatherStartOpacity:L}=t,{maskFeatherEndOpacity:F}=t,{scroll:z}=t;const D=Sa("fixScrollDirection");let O,B,W;wr(e,D,e=>i(50,m=e));let _=!0;const V=w.subscribe(e=>{const t=ye();t[P]=e,E(t)}),N=e=>Math.max(Math.min(0,e),x[n]-b[n]);let H,j,U;const G=(e,t={})=>{const{elastic:o=!1,animate:n=!1,preventScrollState:r=!1}=t;Math.abs(e-y)>C&&"idle"===S&&!v&&!r&&i(29,S="scrolling");const a=N(e),s=o&&I&&!v?a+_h(e-a,I):a;let l=!0;n?l=!1:_||(l=!v),_=!1,w.set(s,{hard:l}).then(e=>{v&&(_=!0)})},Z=e=>{if(!l)return;if(!v)return;let t=e.target;e.target.classList.contains("implicit")&&(t=t.parentNode);const o=t["x"===P?"offsetLeft":"offsetTop"],i=o+t["x"===P?"offsetWidth":"offsetHeight"],r=Sr(w),a=M+A;r+o<a?G(-o+a):r+i>x[n]-a&&G(x[n]-i-a,{animate:!0})};ba(()=>{V()});return e.$$set=e=>{"class"in e&&i(0,k=e.class),"scrollBlockInteractionDist"in e&&i(22,C=e.scrollBlockInteractionDist),"scrollStep"in e&&i(23,T=e.scrollStep),"scrollFocusMargin"in e&&i(24,M=e.scrollFocusMargin),"scrollDirection"in e&&i(1,P=e.scrollDirection),"scrollAutoCancel"in e&&i(25,R=e.scrollAutoCancel),"elasticity"in e&&i(26,I=e.elasticity),"onscroll"in e&&i(27,E=e.onscroll),"maskFeatherSize"in e&&i(21,A=e.maskFeatherSize),"maskFeatherStartOpacity"in e&&i(19,L=e.maskFeatherStartOpacity),"maskFeatherEndOpacity"in e&&i(20,F=e.maskFeatherEndOpacity),"scroll"in e&&i(28,z=e.scroll),"$$scope"in e&&i(39,$=e.$$scope)},e.$$.update=()=>{if(2&e.$$.dirty[0]&&i(35,n="x"===P?"width":"height"),2&e.$$.dirty[0]&&i(31,r=P.toUpperCase()),8&e.$$.dirty[0]&&i(37,a=O&&getComputedStyle(O)),8&e.$$.dirty[0]|64&e.$$.dirty[1]&&i(36,s=a&&Hh(a.getPropertyValue("--scrollable-feather-size"))),1075314692&e.$$.dirty[0]|176&e.$$.dirty[1]&&null!=h&&x&&null!=s&&b){const e=-1*h/s,t=-(x[n]-b[n]-h)/s;i(19,L=Rs(1-e,0,1)),i(20,F=Rs(1-t,0,1)),i(21,A=s),i(4,B=L),i(5,W=F)}268435464&e.$$.dirty[0]&&O&&void 0!==z&&(No(z)?G(z):G(z.scrollOffset,z)),1073741828&e.$$.dirty[0]|16&e.$$.dirty[1]&&i(32,l=x&&b?b[n]>x[n]:void 0),128&e.$$.dirty[1]&&i(34,c=h<0),1073741828&e.$$.dirty[0]|144&e.$$.dirty[1]&&i(33,d=!(!b||!x)&&h+b[n]>x[n]),536870912&e.$$.dirty[0]|14&e.$$.dirty[1]&&i(7,u=ld([S,l?"overflows":void 0,c?"overflows-start":void 0,d?"overflows-end":void 0])),131&e.$$.dirty[1]&&i(6,p=l?`translate${r}(${h}px)`:"none")},[k,P,b,O,B,W,p,u,w,D,()=>{l&&(j=!1,H=!0,U=be(0,0),v=!1,i(29,S="idle"),y=Sr(w))},({detail:e})=>{l&&(v=!0,i(29,S="idle"))},({detail:e})=>{l&&(j||H&&(H=!1,ze(e.translation)<.1)||(!R||"x"!==P||(e=>{const t=Pe(be(e.x-U.x,e.y-U.y),Math.abs);U=ve(e);const o=ze(t),i=t.x-t.y;return!(o>1&&i<-.5)})(e.translation)?G(y+e.translation[P],{elastic:!0}):j=!0))},({detail:e})=>{if(!l)return;if(j)return;const t=y+e.translation[P],o=N(t);_=!1,w.set(o).then(e=>{v&&(_=!0)})},({detail:e})=>{i(30,x=e),f("measure",{x:e.x,y:e.y,width:e.width,height:e.height})},e=>{if(!l)return;e.preventDefault(),e.stopPropagation();const t=e.shiftKey,o=Sp(e,{fixScrollDirection:m})*(t?-1:1),i=Sr(w);G(i+o*T,{animate:!0})},Z,()=>{i(3,O["x"===P?"scrollLeft":"scrollTop"]=0,O)},({detail:e})=>{if(O.querySelector("[data-focus-visible]"))return;const t=-2*e[P],o=Sr(w);G(o+t*T,{animate:!0,preventScrollState:!0})},L,F,A,C,T,M,R,I,E,z,S,x,r,l,d,c,n,s,a,h,$,g,e=>i(2,b=e.detail),function(e){Ca[e?"unshift":"push"](()=>{O=e,i(3,O)})},e=>{setTimeout(()=>Z(e),32)}]}class Gh extends rs{constructor(e){super(),ns(this,e,Uh,jh,yr,{class:0,scrollBlockInteractionDist:22,scrollStep:23,scrollFocusMargin:24,scrollDirection:1,scrollAutoCancel:25,elasticity:26,onscroll:27,maskFeatherSize:21,maskFeatherStartOpacity:19,maskFeatherEndOpacity:20,scroll:28},null,[-1,-1])}}function Zh(e){let t,o,i,n,r;return{c(){t=Ur("span"),Qr(t,"class","PinturaStatusMessage")},m(o,a){Hr(o,t,a),t.innerHTML=e[0],i=!0,n||(r=[qr(t,"measure",function(){fr(e[1])&&e[1].apply(this,arguments)}),Ar(qc.call(null,t))],n=!0)},p(o,[n]){e=o,(!i||1&n)&&(t.innerHTML=e[0])},i(n){i||(Aa(()=>{i&&(o||(o=Za(t,e[4],{duration:e[2]},!0)),o.run(1))}),i=!0)},o(n){o||(o=Za(t,e[4],{duration:e[2]},!1)),o.run(0),i=!1},d(e){e&&jr(t),e&&o&&o.end(),n=!1,$r(r)}}}function Xh(e,t,i){let n,r,{text:a}=t,{onmeasure:s=o}=t;const l=Sa("isAnimated");return wr(e,l,e=>i(5,r=e)),e.$$set=e=>{"text"in e&&i(0,a=e.text),"onmeasure"in e&&i(1,s=e.onmeasure)},e.$$.update=()=>{32&e.$$.dirty&&i(2,n=r?500:0)},[a,s,n,l,function(e,{duration:t}){return{duration:t,tick:t=>{e.style.opacity=t}}},r]}class Yh extends rs{constructor(e){super(),ns(this,e,Xh,Zh,yr,{text:0,onmeasure:1})}}function qh(e){let t,o,i;const n=e[5].default,r=kr(n,e,e[4],null);return{c(){t=Ur("span"),r&&r.c(),Qr(t,"class",o=`PinturaStatusAside ${e[1]}`),aa(t,"transform",e[2]),aa(t,"opacity",e[0])},m(e,o){Hr(e,t,o),r&&r.m(t,null),i=!0},p(e,[a]){r&&r.p&&(!i||16&a)&&Mr(r,n,e,e[4],i?Tr(n,e[4],a,null):Pr(e[4]),null),(!i||2&a&&o!==(o=`PinturaStatusAside ${e[1]}`))&&Qr(t,"class",o),4&a&&aa(t,"transform",e[2]),1&a&&aa(t,"opacity",e[0])},i(e){i||(ja(r,e),i=!0)},o(e){Ua(r,e),i=!1},d(e){e&&jr(t),r&&r.d(e)}}}function Kh(e,t,o){let i,{$$slots:n={},$$scope:r}=t,{offset:a=0}=t,{opacity:s=0}=t,{class:l}=t;return e.$$set=e=>{"offset"in e&&o(3,a=e.offset),"opacity"in e&&o(0,s=e.opacity),"class"in e&&o(1,l=e.class),"$$scope"in e&&o(4,r=e.$$scope)},e.$$.update=()=>{8&e.$$.dirty&&o(2,i=`translateX(${a}px)`)},[s,l,i,a,r,n]}class Jh extends rs{constructor(e){super(),ns(this,e,Kh,qh,yr,{offset:3,opacity:0,class:1})}}let Qh=null;var em=()=>(null===Qh&&(Qh=m()&&"visualViewport"in window),Qh);function tm(e){let t,o;const i=[{onclick:e[1]},e[3]];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Dh({props:n}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=10&o[0]?Ja(i,[2&o[0]&&{onclick:e[1]},8&o[0]&&Qa(e[3])]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function om(e){let t,o;const i=[{onclick:e[0]},{class:"PinturaInputFormButtonConfirm"},e[2]];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Dh({props:n}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=5&o[0]?Ja(i,[1&o[0]&&{onclick:e[0]},i[1],4&o[0]&&Qa(e[2])]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function im(e){let t,o,i,n,r,a,s,l,c=e[3]&&tm(e);const d=e[29].default,u=kr(d,e,e[28],null);let p=e[2]&&om(e);return{c(){t=Ur("div"),o=Ur("div"),c&&c.c(),i=Xr(),n=Ur("div"),u&&u.c(),r=Xr(),p&&p.c(),Qr(n,"class","PinturaInputFormFields"),Qr(o,"class","PinturaInputFormInner"),Qr(t,"class","PinturaInputForm"),Qr(t,"data-layout",e[4]),aa(t,"opacity",e[6]),aa(t,"left",e[7]),aa(t,"top",e[8]),aa(t,"right",e[9]),aa(t,"bottom",e[10])},m(d,h){Hr(d,t,h),_r(t,o),c&&c.m(o,null),_r(o,i),_r(o,n),u&&u.m(n,null),_r(o,r),p&&p.m(o,null),e[30](t),a=!0,s||(l=[qr(n,"keydown",e[14]),qr(t,"focusin",e[11]),qr(t,"focusout",e[12]),qr(t,"measure",e[13]),Ar(qc.call(null,t))],s=!0)},p(e,n){e[3]?c?(c.p(e,n),8&n[0]&&ja(c,1)):(c=tm(e),c.c(),ja(c,1),c.m(o,i)):c&&(Na(),Ua(c,1,1,()=>{c=null}),Ha()),u&&u.p&&(!a||268435456&n[0])&&Mr(u,d,e,e[28],a?Tr(d,e[28],n,null):Pr(e[28]),null),e[2]?p?(p.p(e,n),4&n[0]&&ja(p,1)):(p=om(e),p.c(),ja(p,1),p.m(o,null)):p&&(Na(),Ua(p,1,1,()=>{p=null}),Ha()),(!a||16&n[0])&&Qr(t,"data-layout",e[4]),64&n[0]&&aa(t,"opacity",e[6]),128&n[0]&&aa(t,"left",e[7]),256&n[0]&&aa(t,"top",e[8]),512&n[0]&&aa(t,"right",e[9]),1024&n[0]&&aa(t,"bottom",e[10])},i(e){a||(ja(c),ja(u,e),ja(p),a=!0)},o(e){Ua(c),Ua(u,e),Ua(p),a=!1},d(o){o&&jr(t),c&&c.d(),u&&u.d(o),p&&p.d(),e[30](null),s=!1,$r(l)}}}function nm(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,{$$slots:m={},$$scope:g}=t,{onconfirm:$}=t,{oncancel:f}=t,{autoFocus:y=!0}=t,{autoPositionCursor:b=!0}=t,{buttonConfirm:x}=t,{buttonCancel:v}=t,{layout:S="stack"}=t,{parentRect:w}=t,{align:k}=t,{justify:C}=t,{parentMargin:M=16}=t,{panelOffset:P=ye()}=t,{willHandleKeydown:R=()=>!0}=t,I=!1,E={top:void 0,bottom:void 0},A=0;const L=()=>{const e=h.querySelector("input, textarea");e.focus(),A>=1||e.select()},F=()=>{I=!0,D||!To()&&!T()||o(24,E={top:"1em",bottom:"auto"}),To()&&(e=>{let t;const o=e=>t=e.touches[0].screenY,i=e=>{const o=e.touches[0].screenY,i=e.target;/textarea/i.test(i.nodeName)?(o>t?0==i.scrollTop&&e.preventDefault():o<t?i.scrollTop+i.offsetHeight==i.scrollHeight&&e.preventDefault():e.preventDefault(),t=o):e.preventDefault()};e.addEventListener("touchstart",o),e.addEventListener("touchmove",i)})(h),o(6,A=1)};let z;const D=(e=>{if(!em())return!1;const t=visualViewport.height,o=()=>{e(visualViewport.height<t?"visible":"hidden")};return visualViewport.addEventListener("resize",o),()=>visualViewport.removeEventListener("resize",o)})(e=>{a?"hidden"!==e||I?(clearTimeout(l),l=void 0,o(24,E={top:visualViewport.height-s.height-P.y+"px"}),"visible"===e?(o(5,h.dataset.stick=!0,h),L(),F()):(I=!1,o(6,A=0))):L():o(24,E={top:"4.5em",bottom:"auto"})});return fa(()=>{y&&L()}),ba(()=>{D&&D()}),e.$$set=e=>{"onconfirm"in e&&o(0,$=e.onconfirm),"oncancel"in e&&o(1,f=e.oncancel),"autoFocus"in e&&o(15,y=e.autoFocus),"autoPositionCursor"in e&&o(16,b=e.autoPositionCursor),"buttonConfirm"in e&&o(2,x=e.buttonConfirm),"buttonCancel"in e&&o(3,v=e.buttonCancel),"layout"in e&&o(4,S=e.layout),"parentRect"in e&&o(17,w=e.parentRect),"align"in e&&o(18,k=e.align),"justify"in e&&o(19,C=e.justify),"parentMargin"in e&&o(20,M=e.parentMargin),"panelOffset"in e&&o(21,P=e.panelOffset),"willHandleKeydown"in e&&o(22,R=e.willHandleKeydown),"$$scope"in e&&o(28,g=e.$$scope)},e.$$.update=()=>{8519680&e.$$.dirty[0]&&o(27,i=w&&s),144572416&e.$$.dirty[0]&&o(26,n=i?((e,t,o,i,n)=>{let r,a;return r="center"===i?e.x+.5*e.width-.5*t.width:"right"===i?e.x+e.width-t.width-n:e.x+n,a="center"===o?e.y+.5*e.height-.5*t.height:"bottom"===o?e.y+e.height-t.height-n:e.y+n,{top:`${a}px`,right:"auto",bottom:"auto",left:`${r}px`}})(w,s,k,C,M):void 0),201326592&e.$$.dirty[0]&&o(7,c=i?n.left:void 0),218103808&e.$$.dirty[0]&&o(8,d=i?n.top:E.top),201326592&e.$$.dirty[0]&&o(9,u=i?n.right:void 0),218103808&e.$$.dirty[0]&&o(10,p=i?n.bottom:E.bottom),32&e.$$.dirty[0]&&o(25,r=h&&getComputedStyle(h)),33554432&e.$$.dirty[0]&&(a=r&&"1"===r.getPropertyValue("--editor-modal"))},[$,f,x,v,S,h,A,c,d,u,p,e=>{var t;((e=>/textarea/i.test(e))(e.target)||Qd(e.target))&&(z=Date.now(),b&&((t=e.target).selectionStart=t.selectionEnd=t.value.length),clearTimeout(l),l=setTimeout(F,200))},e=>{Date.now()-z>50||(e.stopPropagation(),L())},({detail:e})=>{o(23,s={width:e.width,height:e.height})},e=>{if(R(e))return"Enter"===e.key?$():"Escape"===e.key?f():void 0},y,b,w,k,C,M,P,R,s,E,r,n,i,g,m,function(e){Ca[e?"unshift":"push"](()=>{h=e,o(5,h)})}]}class rm extends rs{constructor(e){super(),ns(this,e,nm,im,yr,{onconfirm:0,oncancel:1,autoFocus:15,autoPositionCursor:16,buttonConfirm:2,buttonCancel:3,layout:4,parentRect:17,align:18,justify:19,parentMargin:20,panelOffset:21,willHandleKeydown:22},null,[-1,-1])}}var am=(e,t)=>{e.fastSeek&&e.fastSeek(t),e.currentTime=t},sm=e=>e.touches&&e.touches.length&&"stylus"===e.touches[0].touchType;const lm=["aspectRatio","isRotatedSideways","flip","cropSize"],cm=Ws.map(([e])=>e).filter(e=>!lm.includes(e));var dm=(e,t)=>new CustomEvent("ping",{detail:{type:e,data:t},cancelable:!0,bubbles:!0}),um=(e,t)=>(t?jl(e,t):e).replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase(),pm=(e,t=ee)=>{const{subscribe:o,set:i}=ls(void 0),n=((e,t)=>{const o=matchMedia(e);return o.addListener(t),t(o),{get matches(){return o.matches},destroy:()=>o.removeListener(t)}})(e,({matches:e})=>i(t(e)));return{subscribe:o,destroy:n.destroy}},hm=(e,t)=>new Promise((o,i)=>{(async()=>{const{imageOrienter:n,canvasMemoryLimit:r}=t||{};al(e)&&o(await rl(e));const a=await n.read(e),s=e=>j(e,{canvasMemoryLimit:r}).then(e=>n.apply(e,a)).then(o).catch(i);if(O(e)||!D()||no()||To())return s(e);let l;try{l=await _((e,t)=>createImageBitmap(e,{colorSpaceConversion:"default"}).then(e=>t(null,e)).catch(t),[e])}catch(e){}l&&l.width?await $()?$c()&&a>1?o(await(async e=>f(await P(e)))(l)):o(l):o(n.apply(l,a)):s(e)})()}),mm=(e,t)=>new Promise(async o=>{if(e.width<t.width&&e.height<t.height)return o(e);const i=Math.min(t.width/e.width,t.height/e.height),n=i*e.width,r=i*e.height,a=x("canvas",{width:n,height:r}),s=a.getContext("2d",{willReadFrequently:!0}),l=w(e)?await P(e):e;s.drawImage(l,0,0,n,r),o(f(a))});let gm=null;var $m=()=>{if(null===gm){let e=x("canvas");const t=ac(e);gm=!!t&&!t.isContextLost(),S(e),e=void 0}return gm};const fm=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],ym={precision:1e-4},bm={precision:.01*ym.precision};var xm=()=>{const e=[],t=[],o=[],i=()=>{t.forEach(e=>e(o))},n=t=>{t.unsub=t.subscribe(n=>((t,n)=>{const r=e.indexOf(t);r<0||(o[r]=n,i())})(t,n)),i()};return{get length(){return e.length},clear:()=>{e.forEach(e=>e.unsub()),e.length=0,o.length=0},unshift:t=>{e.unshift(t),n(t)},get:t=>e[t],push:t=>{e.push(t),n(t)},remove:t=>{t.unsub();const i=e.indexOf(t);e.splice(i,1),o.splice(i,1)},forEach:t=>e.forEach(t),filter:t=>e.filter(t),subscribe:e=>(t.push(e),e(o),()=>{t.splice(t.indexOf(e),1)})}},vm=e=>e[0]<.25&&e[1]<.25&&e[2]<.25,Sm=(e={})=>new Promise(t=>{const{accept:o="image/*"}=e,i=x("input",{style:"position:absolute;visibility:hidden;width:0;height:0;",type:"file",accept:o}),n=()=>{const[e]=i.files;i.parentNode&&i.remove(),i.removeEventListener("change",n),t(e)};i.addEventListener("change",n),To()&&document.body.append(i),i.click()}),wm=e=>{try{return e()}catch(e){console.error(e)}},km=([e,t])=>e+.5*(t-e),Cm=e=>Math.round(100*e),Tm=e=>be(e.clientX,e.clientY),Mm=(e,t,o)=>{const i=Tm(e);return Ie(Ie(i,t),o)};function Pm(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w,k,C=ur,T=()=>(C(),C=vr(I,e=>o(74,S=e)),I);e.$$.on_destroy.push(()=>C());let{root:M}=t,{locale:P}=t,{stores:R}=t,{isAnimated:I}=t;T();let{allowPan:E=!0}=t,{allowZoom:A=!0}=t,{enablePan:L=!0}=t,{enableZoom:F=!0}=t,{enableZoomControls:z=F}=t,{enableZoomInput:D=!0}=t,{enablePanInput:O=!0}=t,{enablePanLimit:B=!0}=t,{panLimitGutterScalar:W=0}=t,{zoomOptions:_=[.25,.5,1,1.25,1.5,2,3,4,6,8,16]}=t,{zoomAdjustStep:V=.25}=t,{zoomAdjustFactor:N=.1}=t,{zoomAdjustWheelFactor:H=1}=t,{elasticity:j=5}=t,{imageSelectionRectCentered:U}=t,{imageSelectionRectScalar:G}=t,{zoomLevel:Z=null}=t,{zoomControls:X}=t,{zoomMultiTouching:Y=!1}=t;const{isInteracting:q,rootRect:K,stageRect:J,stageScalar:Q,imageSelectionPan:ee,imageSelectionZoom:te,imageSelectionStageFitScalar:oe,imageSelectionRect:ie,imageSelectionStoredState:ne,imagePreviewUpscale:re}=R;wr(e,q,e=>o(73,x=e)),wr(e,K,e=>o(70,f=e)),wr(e,J,e=>o(69,$=e)),wr(e,Q,e=>o(47,v=e)),wr(e,ee,e=>o(68,h=e)),wr(e,te,e=>o(44,p=e)),wr(e,oe,e=>o(45,m=e)),wr(e,ie,e=>o(71,y=e)),wr(e,ne,e=>o(76,k=e)),wr(e,re,e=>o(46,g=e));const ae=Sa("fixScrollDirection");wr(e,ae,e=>o(72,b=e));let se,le,ce,de,ue=!1;const pe=e=>{const t=M.querySelector(".PinturaMain > .PinturaUtilMain")||M.querySelector('div[data-inert="false"] .PinturaUtilMain');return!!t&&(!!t.contains(e.target)&&!eu(e.target))},he=(e={})=>{const{pan:t=h,zoom:o=p}=e;Er(ne,k={translation:t,zoom:o},k)},me=()=>h&&0===h.x&&0===h.y,ge=()=>{Er(te,p=void 0,p),me()||Er(ee,h=ye(),h),$e()},$e=()=>{xe.set(void 0,{hard:!0})},fe=()=>{ge(),he()},xe=Fc(void 0,{precision:.01});wr(e,xe,e=>o(75,w=e));const Se=(e,t,o,i)=>{const n=ye(),r=rt(y);$t(r,o),gt(r,e);const a=mt(r),s=rt(r);$t(s,i-o+1,t);const l=mt(s),c=Ee(Ie(l,a),o);return((e,t,o)=>{e.x=t,e.y=o})(n,e.x+c.x,e.y+c.y),Pe(n,o)};xe.subscribe(e=>{const t=p||m;void 0!==e&&(e<=m?me()||Er(ee,h=ye(),h):Er(ee,h=Se(h,mt({x:0,y:0,width:$.width,height:$.height}),t,e),h),Er(te,p=e,p))});const we=e=>{xe.update(t=>{const o=t||p||m;void 0===t&&xe.set(o,{hard:!0});const i=e(o);return he({zoom:i}),i},{hard:!S})},Ce=e=>{e?(void 0===w&&xe.set(p||m,{hard:!0}),xe.set(e,{hard:!1===S})):(e=void 0,xe.set(void 0,{hard:!0})),he({zoom:e})};let Te;function Me(){const e=Date.now();!No(Te)||e-Te>500?Te=e:(Te=void 0,Ce(r?1===d?m:1:d===m?1:m))}const Pe=(e,t)=>{const o=G*t,i={...U},n=1-Rs(W,0,1);$t(i,o<n?o:n);const r={...U};$t(r,o),gt(r,e);const a={...r};return r.x>i.x&&(a.x=i.x),r.y>i.y&&(a.y=i.y),r.x+r.width<i.x+i.width&&(a.x=i.x+i.width-r.width),r.y+r.height<i.y+i.height&&(a.y=i.y+i.height-r.height),Ie(mt(a),mt(i))},Re=({origin:e,translation:t,zoom:o=1,elastify:i=!0})=>{if(!e)return;let n=t;const r=be(e.x+n.x,e.y+n.y);if(!B)return r;const a=Pe(r,o);return i?Nh(a,r,j):a};let Ae,Le,Fe;const ze=e=>{Fe=void 0;const{origin:t}=e;Ie(Ie({...t},f),$),Er(q,x=!0,x),o(35,ue=O),Ae=!1,Le=!1,ce=!1,se={...h},le=g?p||m:r?p||1:p||m,De=le};let De;const Oe=e=>{const{position:t,scalar:n,translation:r,isMultiTouching:a}=e.detail;a&&(Le=!0);const c=Ie(Ie({...t},f),$);if(!se||!a&&!O)return;(O||a)&&(Ae=!0),Y||o(14,Y=a);const d=i?Rs(le*n,s,l):1,u=Re({origin:se,translation:r,zoom:d,elastify:!0}),p=ke(u);de=ke(h),ce=p<de,i&&($e(),te.set(d)),Er(ee,h=Le?Se(h,c,De,d):u,h),Fe=Y&&{translation:e.detail.translation,scalar:n},De=d},Be=e=>{Er(q,x=!1,x),o(35,ue=!1),o(14,Y=!1),!Le&&ce&&de<50&&(se=void 0,le=void 0,ee.set(ye()))},We=e=>{Er(q,x=!1,x),o(35,ue=!1),o(14,Y=!1),Promise.resolve().then(()=>{if(Ae&&se){if(Le)return;const t=Fe||e.detail,o=i?Rs(le*t.scalar,s,l):1,n=Re({origin:se,elastify:!1,translation:t.translation,zoom:o});ee.set(n)}se=void 0,le=void 0,O&&e.detail.isDoubleTap&&fe(),he()})};let _e,Ve=Date.now(),Ne=0,He=!1,je=!1;const Ue=e=>{if(!pe(e))return;if(e.preventDefault(),e.stopPropagation(),je)return;clearTimeout(_e);const t=Sp(e,{fixScrollDirection:b}),o=Date.now(),i=o-Ve;Ve=o;const n=Math.abs(t/i)>.2;Ne=n?Ne+1:0;const r=1+-1*t*H/(n?50:100),a=Mm(e,f,$);Ge(a,r,{isZoomingFast:n})},Ge=(e,t,{isZoomingFast:o})=>{const i=g?p||m:r?p||1:p||m,n=Rs(i*t,s,l),a=g?m:r?1:m,c=Math.abs(n-a),d=i>a&&n<i||i<a&&n>i,u=Ne>=5;if(o||(He=!1),Ne>0&&!He&&(He=d),u&&He)return fe(),je=!0,void setTimeout(()=>{je=!1},100);u||(!o&&d&&c<=.05&&(_e=setTimeout(()=>{fe()},250)),$e(),Er(te,p=Rs(n,s,l),p),Er(ee,h=Se(h,e,i,n),h),he())},Ze=e=>(e?"add":"remove")+"EventListener";let Xe,Ye,qe,Ke;const Je=e=>{e.preventDefault(),Ye={...h},Ke=rt(y),qe=Mm(e,f,$),Xe=g?p||m:r?p||1:p||m},Qe=e=>{e.preventDefault(),$e(),Er(te,p=Rs(e.scale*Xe,s,l),p);const t=rt(Ke);$t(t,Xe),gt(t,Ye);const o=mt(t),i=rt(t);$t(i,p-Xe+1,qe);const n=mt(i),r=Ee(Ie(n,o),Xe),a={x:Ye.x+r.x,y:Ye.y+r.y};Er(ee,h=Pe(a,p),h)},et=e=>{e.preventDefault()},tt=e=>{M[Ze(e)]("wheel",Ue),To()||(M[Ze(e)]("gesturestart",Je),M[Ze(e)]("gesturechange",Qe),M[Ze(e)]("gestureend",et))},ot=e=>{const t=Ze(e);M[t]("interactionstart",ze),M[t]("interactionupdate",Oe),M[t]("interactionrelease",Be),M[t]("interactionend",We)};let it;return fa(()=>{it=Wh(M,{drag:!0,pinch:!0,inertia:!0,inertiaDurationMultiplier:10,shouldStartInteraction:pe})}),ba(()=>{tt(!1),ot(!1),it.destroy(),it=void 0}),e.$$set=e=>{"root"in e&&o(15,M=e.root),"locale"in e&&o(16,P=e.locale),"stores"in e&&o(17,R=e.stores),"isAnimated"in e&&T(o(0,I=e.isAnimated)),"allowPan"in e&&o(18,E=e.allowPan),"allowZoom"in e&&o(19,A=e.allowZoom),"enablePan"in e&&o(20,L=e.enablePan),"enableZoom"in e&&o(21,F=e.enableZoom),"enableZoomControls"in e&&o(22,z=e.enableZoomControls),"enableZoomInput"in e&&o(23,D=e.enableZoomInput),"enablePanInput"in e&&o(24,O=e.enablePanInput),"enablePanLimit"in e&&o(25,B=e.enablePanLimit),"panLimitGutterScalar"in e&&o(26,W=e.panLimitGutterScalar),"zoomOptions"in e&&o(27,_=e.zoomOptions),"zoomAdjustStep"in e&&o(28,V=e.zoomAdjustStep),"zoomAdjustFactor"in e&&o(29,N=e.zoomAdjustFactor),"zoomAdjustWheelFactor"in e&&o(30,H=e.zoomAdjustWheelFactor),"elasticity"in e&&o(31,j=e.elasticity),"imageSelectionRectCentered"in e&&o(32,U=e.imageSelectionRectCentered),"imageSelectionRectScalar"in e&&o(33,G=e.imageSelectionRectScalar),"zoomLevel"in e&&o(34,Z=e.zoomLevel),"zoomControls"in e&&o(13,X=e.zoomControls),"zoomMultiTouching"in e&&o(14,Y=e.zoomMultiTouching)},e.$$.update=()=>{var t,$;11010048&e.$$.dirty[0]&&o(37,i=A&&F&&D),1310720&e.$$.dirty[0]&&o(36,n=E&&L),786432&e.$$.dirty[0]&&(E||A?(Er(te,p=F?k.zoom:void 0,p),Er(ee,h=L?ve(k.translation):me()?h:ye(),h),xe.set(p)):ge()),65536&e.$$.dirty[1]&&(r=v>=1),134283264&e.$$.dirty[0]|114688&e.$$.dirty[1]&&o(41,a=[(g||v<1)&&[m,Cm(m)+"%",{sublabel:P.labelZoomFit}],..._.map(e=>[e,Cm(e)+"%"])].filter(Boolean).map(e=>(1===e[0]&&(e[2]={sublabel:P.labelZoomActual}),e)).sort((e,t)=>{const o=e[0]||m,i=t[0]||m;return o<i?-1:i<o?1:0})),17408&e.$$.dirty[1]&&o(39,s=Math.min(a.reduce((e,[t])=>t<e?t:e,Number.MAX_SAFE_INTEGER),m)),1024&e.$$.dirty[1]&&o(38,l=a.reduce((e,[t])=>t>e?t:e,Number.MIN_SAFE_INTEGER)),8&e.$$.dirty[1]&&null!==Z&&Ce(Z),122880&e.$$.dirty[1]&&o(43,d=p||(g||v<1?m:1)),5120&e.$$.dirty[1]&&o(40,(t=a.map(([e])=>e),$=d,c=t.findIndex(e=>e===$))),4096&e.$$.dirty[1]&&o(42,u=Cm(d)+"%"),810090496&e.$$.dirty[0]|12160&e.$$.dirty[1]&&o(13,X=(A||A)&&z?[["Button","zoom-out",{hideLabel:!0,label:P.labelZoomOut,icon:P.iconZoomOut,disabled:p===s,onclick:()=>we(e=>Math.max(s,e-V)),onhold:()=>we(e=>Math.max(s,e*(1-N)))}],["Dropdown","zoom-level",{label:u,title:P.labelZoom,labelClass:"PinturaFixedWidthCharacters",options:a,selectedIndex:c,onchange:e=>Ce(e.value),onclick:Me}],["Button","zoom-in",{hideLabel:!0,label:P.labelZoomIn,icon:P.iconZoomIn,disabled:p===l,onclick:()=>we(e=>Math.min(l,e+V)),onhold:()=>we(e=>Math.min(l,e*(1+N)))}]]:[]),32768&e.$$.dirty[0]|64&e.$$.dirty[1]&&M&&tt(i),32768&e.$$.dirty[0]|32&e.$$.dirty[1]&&M&&ot(n),16809984&e.$$.dirty[0]|48&e.$$.dirty[1]&&M&&M.style.setProperty("--cursor",n&&O?ue?"grabbing":"grab":"")},[I,q,K,J,Q,ee,te,oe,ie,ne,re,ae,xe,X,Y,M,P,R,E,A,L,F,z,D,O,B,W,_,V,N,H,j,U,G,Z,ue,n,i,l,s,c,a,u,d,p,m,g,v]}class Rm extends rs{constructor(e){super(),ns(this,e,Pm,null,yr,{root:15,locale:16,stores:17,isAnimated:0,allowPan:18,allowZoom:19,enablePan:20,enableZoom:21,enableZoomControls:22,enableZoomInput:23,enablePanInput:24,enablePanLimit:25,panLimitGutterScalar:26,zoomOptions:27,zoomAdjustStep:28,zoomAdjustFactor:29,zoomAdjustWheelFactor:30,elasticity:31,imageSelectionRectCentered:32,imageSelectionRectScalar:33,zoomLevel:34,zoomControls:13,zoomMultiTouching:14},null,[-1,-1,-1,-1])}}const{window:Im}=Wr;function Em(e){let t,o,i,n=e[41]&&Am(e),r=e[38]&&jm(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Yr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[41]?n?(n.p(e,i),1024&i[1]&&ja(n,1)):(n=Am(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[38]?r?(r.p(e,i),128&i[1]&&ja(r,1)):(r=jm(e),r.c(),ja(r,1),r.m(o.parentNode,o)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}function Am(e){let t,o,i,n,r;const a=[Fm,Lm],s=[];function l(e,t){return e[39]?0:e[35]?1:-1}return~(i=l(e))&&(n=s[i]=a[i](e)),{c(){t=Ur("div"),o=Ur("p"),n&&n.c(),aa(o,"transform",e[72]),Qr(t,"class","PinturaStatus"),aa(t,"opacity",e[54])},m(e,n){Hr(e,t,n),_r(t,o),~i&&s[i].m(o,null),r=!0},p(e,r){let c=i;i=l(e),i===c?~i&&s[i].p(e,r):(n&&(Na(),Ua(s[c],1,1,()=>{s[c]=null}),Ha()),~i?(n=s[i],n?n.p(e,r):(n=s[i]=a[i](e),n.c()),ja(n,1),n.m(o,null)):n=null),1024&r[2]&&aa(o,"transform",e[72]),8388608&r[1]&&aa(t,"opacity",e[54])},i(e){r||(ja(n),r=!0)},o(e){Ua(n),r=!1},d(e){e&&jr(t),~i&&s[i].d()}}}function Lm(e){let t,o,i,n,r;t=new Yh({props:{text:e[35].text||"",onmeasure:e[222]}});let a=e[35].aside&&zm(e),s=e[35].icon&&Wm(e);return{c(){ts(t.$$.fragment),o=Xr(),a&&a.c(),i=Xr(),s&&s.c(),n=Yr()},m(e,l){os(t,e,l),Hr(e,o,l),a&&a.m(e,l),Hr(e,i,l),s&&s.m(e,l),Hr(e,n,l),r=!0},p(e,o){const r={};16&o[1]&&(r.text=e[35].text||""),t.$set(r),e[35].aside?a?(a.p(e,o),16&o[1]&&ja(a,1)):(a=zm(e),a.c(),ja(a,1),a.m(i.parentNode,i)):a&&(Na(),Ua(a,1,1,()=>{a=null}),Ha()),e[35].icon?s?(s.p(e,o),16&o[1]&&ja(s,1)):(s=Wm(e),s.c(),ja(s,1),s.m(n.parentNode,n)):s&&(Na(),Ua(s,1,1,()=>{s=null}),Ha())},i(e){r||(ja(t.$$.fragment,e),ja(a),ja(s),r=!0)},o(e){Ua(t.$$.fragment,e),Ua(a),Ua(s),r=!1},d(e){e&&(jr(o),jr(i),jr(n)),is(t,e),a&&a.d(e),s&&s.d(e)}}}function Fm(e){let t,o,i,n;return t=new Yh({props:{text:e[39],onmeasure:e[222]}}),i=new Jh({props:{class:"PinturaStatusIcon",offset:e[82],opacity:e[83],$$slots:{default:[Hm]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment),o=Xr(),ts(i.$$.fragment)},m(e,r){os(t,e,r),Hr(e,o,r),os(i,e,r),n=!0},p(e,o){const n={};256&o[1]&&(n.text=e[39]),t.$set(n);const r={};1048576&o[2]&&(r.offset=e[82]),2097152&o[2]&&(r.opacity=e[83]),8&o[0]|16&o[20]&&(r.$$scope={dirty:o,ctx:e}),i.$set(r)},i(e){n||(ja(t.$$.fragment,e),ja(i.$$.fragment,e),n=!0)},o(e){Ua(t.$$.fragment,e),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(t,e),is(i,e)}}}function zm(e){let t,o;return t=new Jh({props:{class:"PinturaStatusButton",offset:e[82],opacity:e[83],$$slots:{default:[Bm]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1048576&o[2]&&(i.offset=e[82]),2097152&o[2]&&(i.opacity=e[83]),16&o[1]|16&o[20]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Dm(e){let t,o;return t=new Np({props:{progress:e[35].progressIndicator.progress}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[1]&&(i.progress=e[35].progressIndicator.progress),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Om(e){let t,o;const i=[e[35].closeButton,{hideLabel:!0}];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Dh({props:n}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=16&o[1]?Ja(i,[Qa(e[35].closeButton),i[1]]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Bm(e){let t,o,i,n=e[35].progressIndicator.visible&&Dm(e),r=e[35].closeButton&&e[35].text&&Om(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Yr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[35].progressIndicator.visible?n?(n.p(e,i),16&i[1]&&ja(n,1)):(n=Dm(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[35].closeButton&&e[35].text?r?(r.p(e,i),16&i[1]&&ja(r,1)):(r=Om(e),r.c(),ja(r,1),r.m(o.parentNode,o)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}function Wm(e){let t,o;return t=new Jh({props:{class:"PinturaStatusIcon",offset:e[82],opacity:e[83],$$slots:{default:[Vm]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1048576&o[2]&&(i.offset=e[82]),2097152&o[2]&&(i.opacity=e[83]),16&o[1]|16&o[20]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function _m(e){let t,o=e[35].icon+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){16&i[1]&&o!==(o=e[35].icon+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function Vm(e){let t,o;return t=new Od({props:{$$slots:{default:[_m]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[1]|16&o[20]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Nm(e){let t,o=e[3].iconSupportError+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){8&i[0]&&o!==(o=e[3].iconSupportError+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function Hm(e){let t,o;return t=new Od({props:{$$slots:{default:[Nm]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8&o[0]|16&o[20]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function jm(e){let t,o,i,n,r,a,s,l,c,d,u,p,h,m,g=e[10]&&Um(e),$=e[46]&&e[45]&&Gm(e);const f=[Qm,Jm],y=[];function b(e,t){return e[46]?0:1}function x(t){e[449](t)}function v(t){e[450](t)}function S(t){e[451](t)}i=b(e),n=y[i]=f[i](e),a=new sd({props:{onerror:e[215],isAnimated:e[53],isTransparent:e[20],pixelRatio:e[57],textPixelRatio:e[6],backgroundColor:e[56],maskRect:e[58],maskOpacity:e[73]?e[73].maskOpacity:1,maskMarkupOpacity:e[7],maskFrameOpacity:e[5],clipAnnotationsToImage:e[85],images:e[55],interfaceImages:e[86],loadImageData:e[28],enableGrid:e[11],gridSize:e[87],gridColors:[e[88],e[89]],gridOpacity:e[90],selectionColor:e[91],csp:e[92]||{},willRequest:e[81]||e[93],willRender:e[446],didRender:e[447]}});let w={root:e[2],locale:e[3],isAnimated:e[163],stores:e[202],allowPan:e[95],enablePan:e[17],enablePanLimit:e[21],panLimitGutterScalar:e[22],enablePanInput:e[96],allowZoom:e[97],enableZoom:e[18],enableZoomInput:void 0!==e[19]?e[19]:e[98],enableZoomControls:e[99],zoomOptions:e[13]||e[23],zoomAdjustStep:e[14]||e[24],zoomAdjustFactor:e[15]||e[25],zoomAdjustWheelFactor:e[16]||e[26],imageSelectionRectCentered:e[100],imageSelectionRectScalar:e[101],elasticity:rg*e[8]};return void 0!==e[0]&&(w.zoomLevel=e[0]),void 0!==e[33]&&(w.zoomControls=e[33]),void 0!==e[34]&&(w.zoomMultiTouching=e[34]),d=new Rm({props:w}),Ca.push(()=>es(d,"zoomLevel",x)),Ca.push(()=>es(d,"zoomControls",v)),Ca.push(()=>es(d,"zoomMultiTouching",S)),{c(){g&&g.c(),t=Xr(),$&&$.c(),o=Xr(),n.c(),r=Xr(),ts(a.$$.fragment),s=Xr(),l=Ur("div"),c=Xr(),ts(d.$$.fragment),Qr(l,"class","PinturaRootPortal")},m(n,u){g&&g.m(n,u),Hr(n,t,u),$&&$.m(n,u),Hr(n,o,u),y[i].m(n,u),Hr(n,r,u),os(a,n,u),Hr(n,s,u),Hr(n,l,u),e[448](l),Hr(n,c,u),os(d,n,u),m=!0},p(e,s){e[10]?g?(g.p(e,s),1024&s[0]&&ja(g,1)):(g=Um(e),g.c(),ja(g,1),g.m(t.parentNode,t)):g&&(Na(),Ua(g,1,1,()=>{g=null}),Ha()),e[46]&&e[45]?$?($.p(e,s),49152&s[1]&&ja($,1)):($=Gm(e),$.c(),ja($,1),$.m(o.parentNode,o)):$&&(Na(),Ua($,1,1,()=>{$=null}),Ha());let l=i;i=b(e),i===l?y[i].p(e,s):(Na(),Ua(y[l],1,1,()=>{y[l]=null}),Ha(),n=y[i],n?n.p(e,s):(n=y[i]=f[i](e),n.c()),ja(n,1),n.m(r.parentNode,r));const c={};4194304&s[1]&&(c.isAnimated=e[53]),1048576&s[0]&&(c.isTransparent=e[20]),67108864&s[1]&&(c.pixelRatio=e[57]),64&s[0]&&(c.textPixelRatio=e[6]),33554432&s[1]&&(c.backgroundColor=e[56]),134217728&s[1]&&(c.maskRect=e[58]),2048&s[2]&&(c.maskOpacity=e[73]?e[73].maskOpacity:1),128&s[0]&&(c.maskMarkupOpacity=e[7]),32&s[0]&&(c.maskFrameOpacity=e[5]),8388608&s[2]&&(c.clipAnnotationsToImage=e[85]),16777216&s[1]&&(c.images=e[55]),16777216&s[2]&&(c.interfaceImages=e[86]),268435456&s[0]&&(c.loadImageData=e[28]),2048&s[0]&&(c.enableGrid=e[11]),33554432&s[2]&&(c.gridSize=e[87]),201326592&s[2]&&(c.gridColors=[e[88],e[89]]),268435456&s[2]&&(c.gridOpacity=e[90]),536870912&s[2]&&(c.selectionColor=e[91]),1073741824&s[2]&&(c.csp=e[92]||{}),524288&s[2]|1&s[3]&&(c.willRequest=e[81]||e[93]),512&s[0]|270991424&s[1]|2&s[3]&&(c.willRender=e[446]),62&s[2]&&(c.didRender=e[447]),a.$set(c);const m={};4&s[0]&&(m.root=e[2]),8&s[0]&&(m.locale=e[3]),4&s[3]&&(m.allowPan=e[95]),131072&s[0]&&(m.enablePan=e[17]),2097152&s[0]&&(m.enablePanLimit=e[21]),4194304&s[0]&&(m.panLimitGutterScalar=e[22]),8&s[3]&&(m.enablePanInput=e[96]),16&s[3]&&(m.allowZoom=e[97]),262144&s[0]&&(m.enableZoom=e[18]),524288&s[0]|32&s[3]&&(m.enableZoomInput=void 0!==e[19]?e[19]:e[98]),64&s[3]&&(m.enableZoomControls=e[99]),8396800&s[0]&&(m.zoomOptions=e[13]||e[23]),16793600&s[0]&&(m.zoomAdjustStep=e[14]||e[24]),33587200&s[0]&&(m.zoomAdjustFactor=e[15]||e[25]),67174400&s[0]&&(m.zoomAdjustWheelFactor=e[16]||e[26]),128&s[3]&&(m.imageSelectionRectCentered=e[100]),256&s[3]&&(m.imageSelectionRectScalar=e[101]),256&s[0]&&(m.elasticity=rg*e[8]),!u&&1&s[0]&&(u=!0,m.zoomLevel=e[0],La(()=>u=!1)),!p&&4&s[1]&&(p=!0,m.zoomControls=e[33],La(()=>p=!1)),!h&&8&s[1]&&(h=!0,m.zoomMultiTouching=e[34],La(()=>h=!1)),d.$set(m)},i(e){m||(ja(g),ja($),ja(n),ja(a.$$.fragment,e),ja(d.$$.fragment,e),m=!0)},o(e){Ua(g),Ua($),Ua(n),Ua(a.$$.fragment,e),Ua(d.$$.fragment,e),m=!1},d(n){n&&(jr(t),jr(o),jr(r),jr(s),jr(l),jr(c)),g&&g.d(n),$&&$.d(n),y[i].d(n),is(a,n),e[448](null),is(d,n)}}}function Um(e){let t,o,i,n,r;return o=new Rh({props:{items:e[69]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaNav PinturaNavTools")},m(a,s){Hr(a,t,s),os(o,t,null),i=!0,n||(r=[qr(t,"measure",e[435]),Ar(qc.call(null,t))],n=!0)},p(e,t){const i={};128&t[2]&&(i.items=e[69]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o),n=!1,$r(r)}}}function Gm(e){let t,o,i;return o=new Gh({props:{elasticity:e[8]*sg,scrollDirection:e[76]?"y":"x",$$slots:{default:[Km]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaNav PinturaNavMain")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};256&t[0]&&(i.elasticity=e[8]*sg),16384&t[2]&&(i.scrollDirection=e[76]?"y":"x"),12288&t[1]|135168&t[2]|16&t[20]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function Zm(e){let t,o;const i=[e[79],{tabs:e[44]}];let n={$$slots:{default:[qm,({tab:e})=>({623:e}),({tab:e})=>[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e?8:0]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new $d({props:n}),t.$on("select",e[436]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=8192&o[1]|131072&o[2]?Ja(i,[131072&o[2]&&Qa(e[79]),8192&o[1]&&{tabs:e[44]}]):{};24&o[20]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Xm(e){let t,o;return t=new Rh({props:{items:e[44]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8192&o[1]&&(i.items=e[44]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Ym(e){let t,o=e[623].icon+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){8&i[20]&&o!==(o=e[623].icon+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function qm(e){let t,o,i,n,r,a=e[623].label+"";return t=new Od({props:{$$slots:{default:[Ym]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment),o=Xr(),i=Ur("span"),n=Zr(a)},m(e,a){os(t,e,a),Hr(e,o,a),Hr(e,i,a),_r(i,n),r=!0},p(e,o){const i={};24&o[20]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i),(!r||8&o[20])&&a!==(a=e[623].label+"")&&na(n,a)},i(e){r||(ja(t.$$.fragment,e),r=!0)},o(e){Ua(t.$$.fragment,e),r=!1},d(e){e&&(jr(o),jr(i)),is(t,e)}}}function Km(e){let t,o,i,n;const r=[Xm,Zm],a=[];function s(e,t){return e[74]?0:1}return t=s(e),o=a[t]=r[t](e),{c(){o.c(),i=Yr()},m(e,o){a[t].m(e,o),Hr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?a[t].p(e,n):(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha(),o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),ja(o,1),o.m(i.parentNode,i))},i(e){n||(ja(o),n=!0)},o(e){Ua(o),n=!1},d(e){e&&jr(i),a[t].d(e)}}}function Jm(e){let t,o,i;function n(t){e[442](t)}let r={locale:e[3],class:"PinturaMain",view:e[207](e[43]),props:e[206](e[43],e[27]),stores:e[202]};return void 0!==e[1][e[43]]&&(r.component=e[1][e[43]]),t=new Fd({props:r}),Ca.push(()=>es(t,"component",n)),t.$on("measure",e[234]),t.$on("show",e[443]),t.$on("hide",e[444]),t.$on("fade",e[445]),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};8&i[0]&&(n.locale=e[3]),4096&i[1]&&(n.view=e[207](e[43])),134217728&i[0]|4096&i[1]&&(n.props=e[206](e[43],e[27])),!o&&2&i[0]|4096&i[1]&&(o=!0,n.component=e[1][e[43]],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function Qm(e){let t,o;const i=[{class:"PinturaMain"},{visible:e[62]},e[79],{panels:e[78]}];let n={$$slots:{default:[eg,({panel:e,panelIsActive:t})=>({621:e,622:t}),({panel:e,panelIsActive:t})=>[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(e?2:0)|(t?4:0)]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Rd({props:n}),t.$on("measure",e[441]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=196609&o[2]?Ja(i,[i[0],1&o[2]&&{visible:e[62]},131072&o[2]&&Qa(e[79]),65536&o[2]&&{panels:e[78]}]):{};134217738&o[0]|22&o[20]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function eg(e){let t,o,i;function n(t){e[437](t,e[621])}let r={locale:e[3],view:e[207](e[621]),props:e[206](e[621],e[27]),isActive:e[622],stores:e[202]};return void 0!==e[1][e[621]]&&(r.component=e[1][e[621]]),t=new Fd({props:r}),Ca.push(()=>es(t,"component",n)),t.$on("measure",e[234]),t.$on("show",function(){return e[438](e[621])}),t.$on("hide",function(){return e[439](e[621])}),t.$on("fade",function(...t){return e[440](e[621],...t)}),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(i,n){e=i;const r={};8&n[0]&&(r.locale=e[3]),2&n[20]&&(r.view=e[207](e[621])),134217728&n[0]|2&n[20]&&(r.props=e[206](e[621],e[27])),4&n[20]&&(r.isActive=e[622]),!o&&2&n[0]|2&n[20]&&(o=!0,r.component=e[1][e[621]],La(()=>o=!1)),t.$set(r)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function tg(e){let t;return{c(){t=Ur("span"),Qr(t,"class","PinturaEditorOverlay"),aa(t,"opacity",e[102])},m(e,o){Hr(e,t,o)},p(e,o){512&o[3]&&aa(t,"opacity",e[102])},d(e){e&&jr(t)}}}function og(e){let t,o;const i=[{layout:"row"},{parentRect:e[50]},e[60]];let n={$$slots:{default:[ig]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new rm({props:n}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=537395200&o[1]?Ja(i,[i[0],524288&o[1]&&{parentRect:e[50]},536870912&o[1]&&Qa(e[60])]):{};1610612736&o[1]|16&o[20]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ig(e){let t,o,i;return{c(){t=Ur("input"),t.value=o=e[60].text,Qr(t,"placeholder",i=e[60].placeholder),Qr(t,"type","text"),Qr(t,"spellcheck","false"),Qr(t,"autocorrect","off"),Qr(t,"autocapitalize","off")},m(o,i){Hr(o,t,i),e[452](t)},p(e,n){536870912&n[1]&&o!==(o=e[60].text)&&t.value!==o&&(t.value=o),536870912&n[1]&&i!==(i=e[60].placeholder)&&Qr(t,"placeholder",i)},d(o){o&&jr(t),e[452](null)}}}function ng(e){let t,i,n,r,a,s;Aa(e[434]);let l=e[40]&&Em(e),c=e[102]>0&&tg(e),d=e[60]&&og(e);return{c(){t=Ur("div"),l&&l.c(),i=Xr(),c&&c.c(),n=Xr(),d&&d.c(),Qr(t,"id",e[4]),Qr(t,"class",e[77]),Qr(t,"data-env",e[75]),Qr(t,"dir",e[12])},m(u,p){Hr(u,t,p),l&&l.m(t,null),_r(t,i),c&&c.m(t,null),_r(t,n),d&&d.m(t,null),e[453](t),r=!0,a||(s=[qr(Im,"keydown",e[225]),qr(Im,"keyup",e[226]),qr(Im,"blur",e[227]),qr(Im,"paste",e[231]),qr(Im,"resize",e[434]),qr(t,"ping",function(){fr(e[68])&&e[68].apply(this,arguments)}),qr(t,"contextmenu",e[228]),qr(t,"touchstart",e[223],{passive:!1}),qr(t,"touchmove",function(){fr(e[71])&&e[71].apply(this,arguments)}),qr(t,"pointermove",function(){fr(e[70])&&e[70].apply(this,arguments)}),qr(t,"transitionend",e[212]),qr(t,"dropfiles",e[229]),qr(t,"measure",e[454]),qr(t,"click",function(){fr(e[42]?e[230]:o)&&(e[42]?e[230]:o).apply(this,arguments)}),Ar(qc.call(null,t,{observeViewRect:!0,isMeasureRoot:!0})),Ar(Kc.call(null,t)),Ar(ed.call(null,t))],a=!0)},p(o,a){(e=o)[40]?l?(l.p(e,a),512&a[1]&&ja(l,1)):(l=Em(e),l.c(),ja(l,1),l.m(t,i)):l&&(Na(),Ua(l,1,1,()=>{l=null}),Ha()),e[102]>0?c?c.p(e,a):(c=tg(e),c.c(),c.m(t,n)):c&&(c.d(1),c=null),e[60]?d?(d.p(e,a),536870912&a[1]&&ja(d,1)):(d=og(e),d.c(),ja(d,1),d.m(t,null)):d&&(Na(),Ua(d,1,1,()=>{d=null}),Ha()),(!r||16&a[0])&&Qr(t,"id",e[4]),(!r||32768&a[2])&&Qr(t,"class",e[77]),(!r||8192&a[2])&&Qr(t,"data-env",e[75]),(!r||4096&a[0])&&Qr(t,"dir",e[12])},i(e){r||(ja(l),ja(d),r=!0)},o(e){Ua(l),Ua(d),r=!1},d(o){o&&jr(t),l&&l.d(),c&&c.d(),d&&d.d(),e[453](null),a=!1,$r(s)}}}const rg=1,ag="stage-overlay",sg=10;function lg(e,t,i){let n,r,a,s,l,c,d,u,p,h,g,$,b,x,v,w,k,C,P,R,I,E,A,F,z,D,O,W,_,V,H,j,U,G,Z,X,Y,q,K,J,Q,te,oe,ie,ne,re,ae,se,le,ce,de,ue,pe,he,me,$e,fe,xe,ve,Se,we,ke,Ce,Te,Me,Re,Ie,Ee,Ae,Le,Fe,ze,De,Oe,Be,We,_e,Ve,Ne,He,je,Ue,Ge,Xe,Ye,qe,Ke,Je,Qe,et,tt,ot,it,nt,lt,ct,ut,pt,mt,ft,yt,St,wt,Tt,Mt,It,At,Ft,zt,Dt,Ot,Bt,Wt,_t,Vt,Nt,Ht,jt,Ut,Gt,Zt,Xt,Kt,Jt,Qt,eo,to,oo,io,ro,ao,so,lo,co,uo,po,ho,mo,go,$o,fo,yo,bo,vo,So,wo,ko,Co,Mo,Po,Ro,Io,Eo,Ao,Lo,Fo,zo,Do,Oo,Bo,Wo,_o,Vo,Ho,jo,Uo,Go,Zo,Xo,Yo,qo,Jo,Qo,ei,ti,oi,ii,ri,ai,si,li,ci,di,ui,pi,hi,mi,gi,$i,fi,yi,bi,xi,vi,Si,wi,ki,Ci,Ti,Mi,Pi,Ii,Ei,Ai,Li,Fi,zi,Bi,Wi,_i,Ni,Hi,Ui,Gi,Xi,Yi,qi=ur,Ki=ur;wr(e,zc,e=>i(422,ii=e)),e.$$.on_destroy.push(()=>qi()),e.$$.on_destroy.push(()=>Ki());const Ji=ni(),Qi=xa();let{class:en}=t,{layout:tn}=t,{stores:on}=t,{locale:nn}=t,{id:rn}=t,{util:an}=t,{utils:sn}=t,{animations:ln="auto"}=t,{disabled:cn=!1}=t,{previewUpscale:dn=!1}=t,{previewPad:un=!1}=t,{previewMaskOpacity:pn=.95}=t,{previewImageDataMaxSize:hn}=t,{previewImageTextPixelRatio:mn}=t,{markupMaskOpacity:gn=1}=t,{zoomMaskOpacity:$n=.85}=t,{elasticityMultiplier:fn=10}=t,{willRevert:yn=()=>Promise.resolve(!0)}=t,{willProcessImage:bn=()=>Promise.resolve(!0)}=t,{willRenderCanvas:xn=ee}=t,{willRenderToolbar:vn=ee}=t,{willRenderUtilTabs:Sn=ee}=t,{willSetHistoryInitialState:wn=ee}=t,{enableButtonExport:kn=!0}=t,{enableButtonRevert:Cn=!0}=t,{enableNavigateHistory:Tn=!0}=t,{enableToolbar:Mn=!0}=t,{enableUtils:Pn=!0}=t,{enableButtonClose:Rn=!1}=t,{enableDropImage:In=!1}=t,{enablePasteImage:En=!1}=t,{enableBrowseImage:Ln=!1}=t,{accept:Fn="image/*"}=t,{enableTransparencyGrid:zn=!1}=t,{layoutDirectionPreference:Dn="auto"}=t,{layoutHorizontalUtilsPreference:Wn="left"}=t,{layoutVerticalUtilsPreference:_n="bottom"}=t,{layoutVerticalToolbarPreference:Vn="top"}=t,{layoutVerticalControlGroupsPreference:Hn="bottom"}=t,{layoutVerticalControlTabsPreference:jn="bottom"}=t,{supportedMediaTypes:Un=["image"]}=t,{status:Gn}=t,{formatStatusImageLoading:Zn=function(e,t){const{state:o}=e;if(!o||!o.task)return t.statusImageLoadNone;if(o.error){if("IMAGE_TOO_SMALL"===o.error.code)return t.statusImageLoadMinSize;if("VIDEO_TOO_SHORT"===o.error.code){const e=Array.isArray(t.unitSeconds)?1===o.error.metadata.minDuration?t.unitSeconds[0]:t.unitSeconds[1]:t.unitSeconds;return jl(t.statusImageLoadMinDuration,{seconds:e},"{","}")}return t.statusImageLoadError}return"blob-to-bitmap"===o.task?t.statusImageLoadPrepare:t.statusImageLoadBusy}}=t,{formatStatusImageProcessing:Xn=function(e,t){const{state:o}=e;if(o&&o.task)return"store"===o.task?o.error?t.statusImageUploadError:t.statusImageUploadBusy:o.error?t.statusImageProcessError:t.statusImageProcessBusy}}=t,{formatStatusSupportError:Yn=function(e,t){const{features:o}=e;return{features:o.join(", ")}}}=t,{textDirection:qn}=t,{markupEditorZoomLevel:Kn=null}=t,{markupEditorZoomLevels:Jn}=t,{markupEditorZoomAdjustStep:Qn}=t,{markupEditorZoomAdjustFactor:er}=t,{markupEditorZoomAdjustWheelFactor:tr}=t,{markupEditorInteractionMode:or=!1}=t,{muteAudio:ir=!0}=t,{willSetMediaInitialTimeOffset:nr=(e,t)=>e*km(t[0])}=t,{enablePan:rr=!0}=t,{enableZoom:ar=!0}=t,{enableZoomControls:sr=!0}=t,{enableZoomInput:lr}=t,{enablePanInput:pr}=t,{enableCanvasAlpha:hr=!1}=t,{enablePanLimit:mr}=t,{panLimitGutterScalar:gr}=t,{pan:$r=null}=t,{zoomPresetOptions:fr=[.25,.5,1,1.25,1.5,2,3,4,6,8,16]}=t,{zoomAdjustStep:yr=.25}=t,{zoomAdjustFactor:br=.1}=t,{zoomAdjustWheelFactor:xr=1}=t,{zoomLevel:kr=null}=t,{fixScrollDirection:Cr=!1}=t;const Tr=ls(Cr);va("fixScrollDirection",Tr);const Mr=m()&&"visualViewport"in window,Pr=ls("hidden");function Rr(e){const{height:t,scale:o}=e.target,i=t*o/window.screen.height<.75?"visible":"hidden";Pr.set(i)}let Ir,Ar;va("softKeyboardState",Pr),Mr&&window.visualViewport.addEventListener("resize",Rr);let{imagePreviewSrc:Lr}=t,{imageOrienter:Fr={read:()=>1,apply:e=>e}}=t,{pluginComponents:zr}=t,{pluginOptions:Dr={}}=t;const Or=Ji.sub,Br={};let{root:Wr}=t;const _r=()=>{Tt.setAttribute("data-redraw","true"),la.set({})},Vr=ls(!0);wr(e,Vr,e=>i(489,Kt=e));const Nr=ls(void 0);wr(e,Nr,e=>i(432,vi=e));const Hr=ls(0);wr(e,Hr,e=>i(429,yi=e));const jr=ls(!1),Ur=e=>{jr.set("play"===e.type),Ji.pub(e.type)};let Gr,Zr;let Xr,Yr,qr=!1;const Kr=()=>{if(!a||!Qr())return;Yr=p,Er(Nr,vi=void 0,vi);const e=Tt;qr=!1;const t=1/24,o=ra(),i=Math.abs(d*o-yi*o)<=t,n=o-o*yi<=t;i?Er(Hr,yi=c,yi):n&&Er(Hr,yi=0,yi),sa(yi*ra()),e.play().catch(()=>{});const r=()=>{if(Qr())return;const e=Yr>=0;Xr=requestAnimationFrame(r);const t=aa();Er(Hr,yi=Math.min(t/ra(),1),yi),e&&yi>=d&&(Er(Hr,yi=d,yi),Jr()),p>-1&&(qr=!0),e&&qr&&-1===p&&h>0&&(Er(Hr,yi=l[h][0],yi),sa(yi*ra())),yi>=1&&Jr(),Er(ka,mi=yi*ra(),mi),_r()};r()},Jr=()=>{a&&!Qr()&&(Er(Nr,vi=void 0,vi),Yr=void 0,Tt.pause(),cancelAnimationFrame(Xr),_r())},Qr=()=>Tt&&Tt.paused,ea=()=>{if(a)return Qr()?Kr():Jr()},ta=()=>{if(!a)return;Tt.muted=!0},oa=()=>{if(!a)return;Tt.muted=!1},ia=()=>{a&&Er(na,xi=!xi,xi)},na=ls(ir);wr(e,na,e=>i(431,xi=e));const ra=()=>{if(a)return Tt.duration},aa=()=>{if(!a)return;return Tt.currentTime},sa=e=>{a&&(am(Tt,e),Er(Hr,yi=e/bi,yi))},la=ls({});wr(e,la,e=>i(52,eo=e)),va("redrawTrigger",la);const ca=ls(fn);wr(e,ca,e=>i(506,$i=e)),va("elasticityMultiplier",ca);let da=[];const ua=Fc();wr(e,ua,e=>i(102,Yi=e));const pa=gc()||1024,ha=Ze(pa,pa),ma=qs(),ga=e=>Promise.resolve(gi&&gi(e,{resourceType:"image"})).then(t=>{if(!1===t)return;const{headers:o,credentials:i}=t||{};return fetch(e,{headers:o,credentials:i}).then(e=>{if(200!==e.status)throw`${e.status} (${e.statusText})`;return e.blob()}).then(e=>hm(e,{imageOrienter:Fr,canvasMemoryLimit:ma})).then(e=>mm(e,b))});let{imageSourceToImageData:$a=e=>y(e)?ga(e):Yt(e)?new Promise(t=>t(f(e))):xo(e)||qt(e)?hm(e,{imageOrienter:Fr,canvasMemoryLimit:ma}).then(e=>mm(e,b)):void 0}=t;const fa=(()=>{let e,t;const o=cm.reduce((e,o)=>(e[o]=function(e,t,o){let i=[];return{set:t,update:o,publish:e=>{i.forEach(t=>t(e))},subscribe:t=>(i.push(t),e(t),()=>{i=i.filter(e=>e!==t)})}}(e=>{if(!t)return e();t.stores[o].subscribe(e)()},e=>{t&&t.stores[o].set(e)},e=>{t&&t.stores[o].update(e)}),e),{});return{update:i=>{if(t=i,e&&(e.forEach(e=>e()),e=void 0),!i)return o.file.publish(void 0),void o.loadState.publish(void 0);e=cm.map(e=>i.stores[e].subscribe(t=>{o[e].publish(t)}))},stores:o,destroy:()=>{e&&e.forEach(e=>e())}}})(),{file:ya,size:Sa,duration:wa,currentTime:ka,trim:Ta,volume:Ma,minDuration:Pa,maxDuration:Ra,loadState:Ia,processState:Ea,cropAspectRatio:Aa,cropLimitToImage:La,crop:Fa,cropMinSize:za,cropMaxSize:Da,cropRange:Oa,cropOrigin:Ba,cropRectAspectRatio:Wa,rotation:_a,rotationRange:Va,targetSize:Na,flipX:Ha,flipY:ja,backgroundColor:Ua,backgroundImage:Ga,backgroundFilterMode:Za,colorMatrix:Xa,convolutionMatrix:Ya,gamma:qa,vignette:Ka,noise:Ja,decoration:Qa,annotation:es,manipulation:ts,redaction:os,frame:is,selection:ns,state:rs}=fa.stores;wr(e,ya,e=>i(406,wo=e)),wr(e,Sa,e=>i(380,At=e)),wr(e,wa,e=>i(430,bi=e)),wr(e,ka,e=>i(505,mi=e)),wr(e,Ta,e=>i(427,hi=e)),wr(e,Ma,e=>i(428,fi=e)),wr(e,Ra,e=>i(433,Si=e)),wr(e,Ia,e=>i(398,po=e)),wr(e,Ea,e=>i(397,uo=e)),wr(e,Aa,e=>i(502,ai=e)),wr(e,La,e=>i(85,Ti=e)),wr(e,Fa,e=>i(417,Ho=e)),wr(e,_a,e=>i(383,Dt=e)),wr(e,Ha,e=>i(382,zt=e)),wr(e,ja,e=>i(381,Ft=e)),wr(e,Ua,e=>i(388,Gt=e)),wr(e,Qa,e=>i(48,It=e)),wr(e,es,e=>i(49,Ot=e)),wr(e,ts,e=>i(385,Ht=e)),wr(e,os,e=>i(386,jt=e)),wr(e,is,e=>i(47,Mt=e)),wr(e,ns,e=>i(59,di=e)),wr(e,rs,e=>i(491,Mo=e)),va("components",{DynamicComponentTree:Rh}),va("previewcontrols",{play:Kr,pause:Jr,togglePlayPause:ea,mute:ta,unmute:oa,toggleMute:ia,setCurrentTime:sa,getCurrentTime:aa,getDuration:ra,frameOffset:Hr,framePeekOffset:Nr,isPlaying:jr,isMuted:na});const as=(e,t,o=0)=>new Promise((i,n)=>{if(al(e))return void il(e).then(e=>{const t=No(mi)?mi:nr(e.duration,hi||[[0,1]]);nl(e,t).then(i)}).catch(n);let r,a=!1;t.cancel=()=>a=!0;const s=Date.now();$a(e).then(e=>{const t=Date.now()-s;clearTimeout(r),r=setTimeout(()=>{a||i(e)},Math.max(0,o-t))}).catch(n)}),{images:ds,shapePreprocessor:us,imageScrambler:ps,imageRedactionRendering:hs,willRequest:ms,willRequestResource:gs,csp:$s}=on;let fs;wr(e,ds,e=>i(426,pi=e)),wr(e,us,e=>i(425,ui=e)),wr(e,ps,e=>i(389,Zt=e)),wr(e,hs,e=>i(387,Ut=e)),wr(e,ms,e=>i(81,gi=e)),wr(e,gs,e=>i(93,zi=e)),wr(e,$s,e=>i(92,Fi=e));const ys=cs(Ga,(e,t)=>{if(!e)return t(void 0);fs&&(fs.cancel(),fs=void 0),fs={cancel:o},as(e,fs).then(t).catch(e=>{})}),bs=rs.subscribe(e=>Ji.pub("update",e)),xs=ls();va("ui",ls({})),va("selection",ns);const vs=ls(!0);wr(e,vs,e=>i(95,Wi=e));const Ss=ls(!0);wr(e,Ss,e=>i(97,Ni=e));const ws=ls(!0);wr(e,ws,e=>i(424,ci=e));const ks=ls(!0);wr(e,ks,e=>i(503,si=e));const Cs=ls(!0);wr(e,Cs,e=>i(98,Hi=e));const Ts=ls();wr(e,Ts,e=>i(99,Ui=e));const Ms=ls();wr(e,Ms,e=>i(504,li=e));const Ps=cs([Ms,ks],()=>void 0!==li?li:si);wr(e,Ps,e=>i(96,_i=e));const Is=ls([0,0,0]);wr(e,Is,e=>i(56,Ao=e));const Es=ls([1,1,1]);wr(e,Es,e=>i(487,Nt=e));const As=Fc([1,1,1]);wr(e,As,e=>i(486,Vt=e));const Ls=ls();wr(e,Ls,e=>i(91,Li=e));const zs=ls(),Ds=ls();wr(e,Ds,e=>i(51,Jt=e));const Os=ls();wr(e,Os,e=>i(378,St=e));const Bs=ls(at());wr(e,Bs,e=>i(80,Po=e));const Ws=ls(0);wr(e,Ws,e=>i(423,ri=e));const _s=ls(at());wr(e,_s,e=>i(84,Ci=e));const Ns=ls();wr(e,Ns,e=>i(484,wt=e));const Hs=pm("(pointer: fine)",e=>e?"pointer-fine":"pointer-coarse");wr(e,Hs,e=>i(404,vo=e));const js=pm("(hover: hover)",e=>e?"pointer-hover":"pointer-no-hover");wr(e,js,e=>i(403,bo=e));const Us=ls(!1),Gs=ls(!1);wr(e,Gs,e=>i(384,_t=e));const Zs=ss(void 0,e=>{const t=Fc(0),o=[Gs.subscribe(e=>{t.set(e?1:0,{hard:!oo})}),t.subscribe(e)];return()=>o.forEach(e=>e())});wr(e,Zs,e=>i(485,Wt=e));const Xs=ls();wr(e,Xs,e=>i(490,$o=e));const Ys=ls();let Ks;wr(e,Ys,e=>i(53,oo=e)),va("isAnimated",Ys);const Js=ls(dn);wr(e,Js,e=>i(407,ko=e));const Qs=ls(!1);wr(e,Qs,e=>i(496,Go=e)),va("imageIsStatic",Qs);const el=ls();wr(e,el,e=>i(497,Zo=e));const tl=ls();wr(e,tl,e=>i(494,jo=e));const ol=ss(void 0,e=>{const t=ls(void 0),o=[Fa.subscribe(()=>{if(!Ho)return;if(Go)return t.set(rt(Ho));const e=Vh(Ho,jo,5*fn);t.set(e)}),t.subscribe(e)];return()=>o.forEach(e=>e())}),rl=ls();wr(e,rl,e=>i(493,Vo=e));const sl=ls();wr(e,sl,e=>i(495,Uo=e));const ll=ls(void 0);wr(e,ll,e=>i(500,ei=e));const cl=ls(ye());wr(e,cl,e=>i(501,ti=e));const dl=(e,t)=>{if(!t||!e)return{top:0,right:0,bottom:0,left:0};const o=Bn(t,e,x),i=On(o,e);return{top:Math.abs(i.top),right:Math.abs(i.right),bottom:Math.abs(i.bottom),left:Math.abs(i.left)}},ul=ls({}),pl=cs([Ns,Bs,_s,ul],([e,t,o,i],n)=>{if(!e)return n(void 0);let r=0;1!==V.length||g||"bottom"===Vn||(r=o.y+o.height),n(ht(e.x+t.x,e.y+t.y+r,e.width,e.height))});let hl={left:0,right:0,top:0,bottom:0};const ml=ls(!1),gl=cs([ml,is,pl,Gs],([e,t,o,i],n)=>{if(!o)return n({left:0,right:0,top:0,bottom:0});if(!e)return;const r=Math.min(o.width,o.height),a=dl({width:r,height:r},t);ge(hl.top,4)===ge(a.top,4)&&ge(hl.bottom,4)===ge(a.bottom,4)&&ge(hl.right,4)===ge(a.right,4)&&ge(hl.left,4)===ge(a.left,4)||(hl=a,n(a))});wr(e,gl,e=>i(415,Bo=e));const $l=cs([ml,gl],([e,t],o)=>{if(!e)return o(!1);o(Object.values(t).some(e=>e>0))});wr(e,$l,e=>i(416,Wo=e));const fl=cs([ml,Ns,$l,gl],([e,t,o,i],n)=>{if(t)return e&&o?void n(ht(t.x+i.left,t.y+i.top,t.width-i.left-i.right,t.height-i.top-i.bottom)):n({...t})}),yl=cs([pl,$l,gl],([e,t,o],i)=>e?t?void i(ht(e.x+o.left,e.y+o.top,e.width-o.left-o.right,e.height-o.top-o.bottom)):i(e):i(void 0));wr(e,yl,e=>i(50,Bt=e));const bl=cs([Qs,Sa,_a],([e,t,o],i)=>{if(!e||!t)return i(void 0);const n=st(t);i(kt(n,o))}),xl=cs([bl],([e],t)=>{if(!e)return t(void 0);const o=dt(e);t(Lt(o))});wr(e,xl,e=>i(419,qo=e));const vl=cs([yl,Fa,xl,Js],([e,t,o,i],n)=>{if(!e||!t||!(!Zo&&!jo))return;const{width:r,height:a}=o||t,s=Math.min(e.width/r,e.height/a);n(i?s:Math.min(1,s))});wr(e,vl,e=>i(418,Yo=e));const Sl=cs([Qs,Sa,_a,yl,Ns,vl],([e,t,o,i,n,r],a)=>{if(!(e&&i&&n&&t))return a(void 0);const s=st(t),l=Lt($t(s,r)),c=Ct(i,l);l.x=c.x,l.y=c.y;a(kt(l,o))});va("imageStaticVisualCorners",Sl);const wl=ls(void 0);wr(e,wl,e=>i(421,oi=e));const kl=cs([Fa,yl],([e,t])=>{if(t&&e)return Math.min(t.width/e.width,t.height/e.height)}),Cl=cs([Fa,rl],([e,t])=>e&&t?Math.min(e.width/t.width,e.height/t.height):1);wr(e,Cl,e=>i(101,Xi=e));const Tl=cs([wl,Cl],([e,t])=>e&&t?t*e:1);wr(e,Tl,e=>i(499,Jo=e));const Ml=ls(ye());wr(e,Ml,e=>i(420,Qo=e));const Pl=ls({scalar:Jo,translation:Qo}),Rl=()=>{Pl.set({scalar:void 0,translation:ye()})},Il=ss(void 0,e=>{const t=Fc(void 0,{precision:1e-4}),o=1===Yd()?e=>Et(e,Math.round):ee,i=()=>{if(!Vo)return;const e=_t||!$o;if(Go){const o=rt(Vo);return gt(o,ti),gt(o,Bt),t.set(o,{hard:e})}const i=Vh(Vo,ei,rg*fn);i.width<0&&(i.width=0,i.x=Vo.x),i.height<0&&(i.height=0,i.y=Vo.y),gt(i,Bt),gt(i,Qo),$t(i,Jo),!e&&o(i),t.set(i,{hard:e})},n=[yl.subscribe(i),rl.subscribe(i),Tl.subscribe(i),Ml.subscribe(i),is.subscribe(i),t.subscribe(e)];return()=>n.forEach(e=>e())});wr(e,Il,e=>i(58,Oo=e));const El=ls(1);wr(e,El,e=>i(492,_o=e));const Al=()=>{if(!Ho||!Bt)return;let e=bt(rt(Ho),Yo||1);const t=Ct(Bt,bt(rt(qo),Yo));gt(e,t);const o=wt.width/e.width,i=wt.height/e.height,n=Math.min(1,o,i);El.set(n),$t(e,n),((e,t)=>{const[o,i,n,r]=Rt(e);o<t.y&&(e.y=Math.max(t.y,e.y)),i>t.width&&(e.x=t.width-e.width),n>t.height&&(e.y=t.height-e.height),r<t.x&&(e.x=Math.max(t.x,e.x))})(e,{...wt,x:0,y:0}),rl.set(e)},Ll=cs([yl,vl,Fa,Sa],([e,t,o,i],n)=>{e&&(o||i)&&n(Fl(e,t||1,o||i))});wr(e,Ll,e=>i(100,Gi=e));const Fl=(e,t,o)=>o.width<=e.width&&o.height<=e.height?Ct(e,bt(rt(o),t)):Pt(e,vt(o));let zl,Dl;const Ol=e=>{if(g&&zl&&xt(zl,e)&&Dl===Yo)return;if(Go)return Al();zl=e,Dl=Yo;const t=Fl(e,Yo,Ho||At);rl.set(t)};let Bl=!1;const Wl=vl.subscribe(e=>{!Bl&&void 0!==e&&Ho&&(Ol(Bt),Bl=!0)}),Vl=yl.subscribe(e=>{e&&void 0!==Yo&&Ho&&Ol(e)}),Nl=Qs.subscribe(e=>{!e&&Bt&&Ol(Bt)});let Hl;const Ul=sl.subscribe(e=>{if(!e)return Hl=void 0,void Er(el,Zo=void 0,Zo);Hl=Xo;const t=rt(Ho);el.set(t)}),Gl=rl.subscribe(e=>{if(!e||!Uo)return;const t=(o=rt(e),i=Uo,o.x-=i.x,o.y-=i.y,o.width-=i.width,o.height-=i.height,o);var o,i;((e,t)=>{e.x/=t,e.y/=t,e.width/=t,e.height/=t})(t,Hl);const n=((e,t)=>(e.x+=t.x,e.y+=t.y,e.width+=t.width,e.height+=t.height,e))(rt(Zo),t);Fa.set(n)}),Zl=Fa.subscribe(e=>{if(!e||!Vo)return;if(Go)return void(Uo||Al());if(_t||Uo||jo)return;const t=vt(Vo),o=vt(e);if(ge(t,6)===ge(o,6))return;const{width:i,height:n}=Ho,r=Math.min(Bt.width/i,Bt.height/n),a=Ze(e.width*r,e.height*r),s=.5*(Vo.width-a.width),l=.5*(Vo.height-a.height),c=ht(Math.max(0,Math.min(Bt.width-a.width,Vo.x+s)),Math.max(0,Math.min(Bt.height-a.height,Vo.y+l)),a.width,a.height);rl.set(c)}),Xl=cs([vl,Fa,rl,Qs],([e,t,o,i],n)=>{if(!e||!t||!o)return;if(i)return n(_o);const r=o.width/t.width,a=o.height/t.height;n(Math.max(r,a)/e)}),Yl=cs([vl,Xl],([e,t],o)=>{if(!t)return;o(e*t)});wr(e,Yl,e=>i(498,Xo=e));let ql={left:0,right:0,top:0,bottom:0};const Kl=cs([is,rl],([e,t],o)=>{if(!t)return o(ql);const i=dl(t,e);ge(ql.top,4)===ge(i.top,4)&&ge(ql.bottom,4)===ge(i.bottom,4)&&ge(ql.right,4)===ge(i.right,4)&&ge(ql.left,4)===ge(i.left,4)||(ql=i,o(i))}),Jl=cs([Kl],([e],t)=>{t(Object.values(e).some(e=>e>0))}),Ql=Fc(.075,{stiffness:.03,damping:.4,precision:.001}),ec=cs([As,Is,Ql,Il,Tl,is,Jl,Kl,$l],([e,t,o,i,n,r,a,s,l],c)=>{if(!i||g)return c([]);let{x:d,y:u,width:p,height:h}=i;d+=.5,u+=.5,p-=.5,h-=.5;const m=[];if(r){if(a){let{left:e,right:o,top:i,bottom:r}=s;e*=n,o*=n,i*=n,r*=n;const a=vm(t)?[1,1,1,.125]:[0,0,0,.075];m.push({x:d-e-.5,y:u-i-.5,width:p+e+o+1,height:h+i+r+1,strokeWidth:1,strokeColor:a,opacity:l?1:.5})}const i=vm(e);r&&r.frameColor&&vm(r.frameColor)||i||(m.push({x:d-1,y:u-1,width:p+2,height:h+2,strokeWidth:2,strokeColor:[0,0,0,.1],opacity:o}),m.push({x:d+1,y:u+1,width:p-2,height:h-2,strokeWidth:2,strokeColor:[0,0,0,.1],opacity:o}))}c([...m,{x:d,y:u,width:p,height:h,strokeWidth:1,strokeColor:e,opacity:o}])}),tc=ls([]);wr(e,tc,e=>i(409,Ro=e));const oc=cs([ec,tc],([e,t],o)=>{o([...e,...t])});wr(e,oc,e=>i(94,Bi=e));const ic=Fc(0,{precision:.001});wr(e,ic,e=>i(411,Eo=e));const nc=Fc();wr(e,nc,e=>i(414,zo=e));const rc=Fc();wr(e,rc,e=>i(413,Fo=e));const ac=Fc();wr(e,ac,e=>i(412,Lo=e));const sc=Fc();wr(e,sc,e=>i(410,Io=e));const lc=ls(!1);wr(e,lc,e=>i(396,co=e));const cc=ls();let dc;wr(e,cc,e=>i(399,ho=e));const uc=cs([lc,cc],([e,t],n)=>{if(!e||!t)return void n(void 0);if(dc&&(dc.cancel(),i(298,dc=void 0)),Nn(t))return n(M(t));const r=Bc.length?0:oo?250:0;i(298,dc={cancel:o}),as(t,dc,r).then(n).catch(e=>{Er(Ia,po.error=e,po)}).finally(()=>{i(298,dc=void 0)})});qi(),qi=vr(uc,e=>i(379,Tt=e));let{imagePreviewCurrent:pc}=t;const hc=ls({});wr(e,hc,e=>i(401,fo=e));const mc=ls([]);wr(e,mc,e=>i(86,Mi=e));const fc=cs([yl,Os,Sa,ol,rl,Yl,_a,Ha,ja,Tl,Ml,Us],([e,t,o,i,n,r,a,s,l,c,d,u],p)=>{if(!e||!n)return;const h=_l(e,t,o,i,n,c,d,r,a,s,l);!u&&D(h),p(h)});wr(e,fc,e=>i(402,yo=e));const yc=cs([Xa,Ya,qa,Ka,Ja],([e,t,o,i,n],r)=>{const a=e&&Object.keys(e).map(t=>e[t]).filter(Boolean);r({gamma:o||void 0,vignette:i||void 0,noise:n||void 0,convolutionMatrix:t||void 0,colorMatrix:a&&a.length&&cr(a)})});let bc,xc;const vc=(()=>{if(!To())return!1;const e=navigator.userAgent.match(/OS (\d+)_(\d+)_?(\d+)?/i)||[],[,t,o]=e.map(e=>parseInt(e,10)||0);return t>13||13===t&&o>=4})(),Sc=ls({});wr(e,Sc,e=>i(390,Qt=e)),va("env",Sc);const wc=Yd(),kc=ss(wc,e=>{const t=()=>e(Yd()),o=matchMedia(`(resolution: ${wc}dppx)`);return o.addListener(t),()=>o.removeListener(t)});wr(e,kc,e=>i(57,Do=e));const Cc=((e,t,o)=>{const{sub:i,pub:n}=ni(),{willUndo:r=()=>!0}=o||{},a=[],s=ls(0),l=[],c=()=>l.forEach(e=>e({index:Sr(s),length:a.length})),d={get index(){return Sr(s)},set index(e){e=Number.isInteger(e)?e:0,e=Rs(e,0,a.length-1),s.set(e),t(a[d.index]),c()},get state(){return a[a.length-1]},length:()=>a.length,undo(){if(!1===r())return;const e=d.index--;return n("undo",e),e},redo(){const e=d.index++;return n("redo",d.index),e},revert(){a.length=1,d.index=0,n("revert")},write(o){o&&t({...e(),...o});const i=e(),r=a[a.length-1];JSON.stringify(i)!==JSON.stringify(r)&&(a.length=d.index+1,a.push(i),s.set(a.length-1),c(),n("writehistory"))},set(e={}){a.length=0,d.index=0;const t=Array.isArray(e)?e:[e];a.push(...t),d.index=a.length-1},get:()=>[...a],subscribe:e=>(l.push(e),e({index:d.index,length:a.length}),()=>l.splice(l.indexOf(e),1)),on:i};return d})(()=>Mo,e=>{Er(rs,Mo=e,Mo),Bs.set(Po)},{willUndo:()=>!Ec()||(Ic(),!1)});Ki(),Ki=vr(Cc,e=>i(408,Co=e));const Tc=()=>{const e={x:0,y:0,...At},t=Et(Pt(e,Mo.cropAspectRatio),Math.round),o=wn({...Mo,rotation:0,crop:t},Mo),i=[o];JSON.stringify(o)!==JSON.stringify(Mo)&&i.push({...Mo}),Cc.set(i)},Mc=Ia.subscribe(e=>{e&&e.complete&&Tc()}),Pc=()=>yn().then(e=>e&&Cc.revert()),Rc=[es,Qa,os,ts],Ic=()=>{Rc.forEach(e=>{e.update(e=>e.length&&Zi(e[e.length-1])?e.slice(0,-1):e)})},Ec=()=>_.filter(e=>e.length).some(e=>Zi(e[e.length-1])),Lc=ls(!1);wr(e,Lc,e=>i(391,to=e));const Dc=()=>{Er(Lc,to=!0,to),bn().then(e=>{if(!e)return void Er(Lc,to=!1,to);let t;t=md.subscribe(e=>{1===e&&(t&&t(),Qi("processImage"))})})},Oc=Ea.subscribe(e=>{if(!e)return void Er(Lc,to=!1,to);Er(Lc,to=!0,to);const{complete:t,abort:o}=e;(t||o)&&Er(Lc,to=!1,to)}),Bc=xm();wr(e,Bc,e=>i(55,mo=e));const Wc=cs([Bc],([e],t)=>{if(!e.length)return t();const{origin:o,translation:i,rotation:n,scale:r}=e[0];t({origin:o,translation:i,rotation:n,scale:r})}),_c=ls();wr(e,_c,e=>i(405,So=e));let Vc,Nc=[];const Hc=ls(),jc=ls(),Uc=cs([wl,jc,vl,kl],([e,t,o,i])=>e||(t||o<1?i:1)),Gc={...on,imageFile:ya,imageSize:Sa,mediaDuration:wa,mediaMinDuration:Pa,mediaMaxDuration:Ra,mediaTrim:Ta,imageBackgroundColor:Ua,imageBackgroundImage:Ga,imageBackgroundFilterMode:Za,imageCropAspectRatio:Aa,imageCropMinSize:za,imageCropMaxSize:Da,imageCropLimitToImage:La,imageCropRect:Fa,imageCropRectOrigin:Ba,imageCropRectSnapshot:el,imageCropRectAspectRatio:Wa,imageCropRange:Oa,imageRotation:_a,imageRotationRange:Va,imageFlipX:Ha,imageFlipY:ja,imageOutputSize:Na,imageColorMatrix:Xa,imageConvolutionMatrix:Ya,imageGamma:qa,imageVignette:Ka,imageNoise:Ja,imageManipulation:ts,imageDecoration:Qa,imageAnnotation:es,imageRedaction:os,imageFrame:is,imagePreview:uc,imagePreviewSource:cc,imageTransforms:fc,imagePreviewModifiers:hc,history:Cc,animation:Xs,pixelRatio:kc,elasticityMultiplier:fn,scrollElasticity:sg,rangeInputElasticity:5,redrawTrigger:la,pointerAccuracy:Hs,pointerHoverable:js,env:Sc,rootRect:Os,stageRect:yl,stageRectBase:pl,stageRecenter:ul,stageScalar:vl,stagePadding:gl,stagePadded:$l,presentationScalar:Yl,imagePreviewUpscale:jc,utilRect:Ns,utilRectPadded:fl,allowPlayPause:Vr,allowPan:vs,allowZoom:Ss,allowZoomControls:ws,enableZoomInput:Cs,enablePanInput:ks,enablePanInputStatus:Ps,imageSelectionMultiTouching:Hc,rootBackgroundColor:Is,rootForegroundColor:Es,rootLineColor:As,rootColorSecondary:zs,imageOutlineOpacity:Ql,utilTools:_c,imageSelectionPan:Ml,imageSelectionZoom:wl,imageSelectionZoomCurrent:Uc,imageSelectionStageFitScalar:kl,imageSelectionStoredState:Pl,imageOverlayMarkup:tc,interfaceImages:mc,isInteracting:Gs,isTransformingImage:Us,isInteractingFraction:Zs,imageCropRectIntent:tl,imageCropRectPresentation:ol,imageSelectionRect:rl,imageSelectionRectIntent:ll,imageSelectionRectPresentation:Il,imageSelectionRectSnapshot:sl,imageScalar:Xl,imageTransformsInterpolated:Wc,imageEffects:yc};delete Gc.image;const Zc=`util-${B()}`;let Xc=[];const Yc=e=>H.find(([t])=>e===t);let qc=[];const Kc=e=>{i(62,qc=qc.concat(e))},Jc=e=>{i(62,qc=qc.filter(t=>t!==e))},Qc=(e,t)=>{i(308,Z[e]=t,Z)};let ed=To();const td=(e,t,o)=>{let i=we.getPropertyValue(e);i=o?o(i):/^[0-9]+$/.test(i)?parseFloat(i):void 0,t.set(i,{hard:!oo})},id=(e,t,o=!1)=>{const i=(e=>{const t=we.getPropertyValue(e);return Kp(t)})(e);i&&0!==i[3]&&(o||(i.length=3),t.set(i,{hard:!oo}))},nd=ls();wr(e,nd,e=>i(87,Pi=e));const rd=ls();wr(e,rd,e=>i(88,Ii=e));const ad=ls();wr(e,ad,e=>i(89,Ei=e));const sd=Fc(0,{damping:.9});wr(e,sd,e=>i(90,Ai=e));const cd=()=>{id("color",Es),id(hr?"--color-background":"background-color",Is),id("outline-color",As),id("--color-primary",Ls),id("--color-secondary",zs),id("--grid-color-even",rd,!0),id("--grid-color-odd",ad,!0),td("--grid-size",nd),td("--editor-inset-top",Ws,e=>parseInt(e,10))},dd=cs([fc,yc,Ua,ys,Za],([e,t,o,i,n])=>e&&{...e,...t,backgroundColor:o,backgroundImage:i,backgroundFilterMode:n||"none"});wr(e,dd,e=>i(400,go=e));const ud=()=>{const e=Bc.length?void 0:{resize:1.05},t=((e,t,o={})=>{const{resize:i=1,opacity:n=0}=o,r={opacity:[Fc(n,{...ym,stiffness:.1}),ee],resize:[Fc(i,{...ym,stiffness:.1}),ee],translation:[Fc(void 0,ym),ee],rotation:[Fc(void 0,bm),ee],origin:[Fc(void 0,ym),ee],scale:[Fc(void 0,bm),ee],gamma:[Fc(void 0,bm),e=>e||1],vignette:[Fc(void 0,bm),e=>e||0],colorMatrix:[Fc([...fm],ym),e=>e||[...fm]],convolutionMatrix:[ls(void 0),e=>e&&e.clarity||void 0],backgroundColor:[Fc(void 0,ym),(e,t,o)=>{if(Array.isArray(e)){if(Array.isArray(t)){const i=[...e];0===t[3]?(i[3]=0,o(i)):0===i[3]&&((e=[...t])[3]=0)}return e}}],backgroundImage:[ls(void 0),ee],backgroundFilterMode:[ls(void 0),ee]},a=Object.entries(r).map(([e,t])=>[e,t[0]]),s=a.map(([,e])=>e),l=Object.entries(r).reduce((e,[t,o])=>{const[i,n]=o;return e[t]=(e,o)=>i.set(n(e,c[t],e=>{i.set(e,{hard:!0})}),o),e},{});let c;const d=cs(s,o=>(c=o.reduce((e,t,o)=>(e[a[o][0]]=t,e),{}),c.data=e,c.size=t,c.scale*=o[1],c));return d.get=()=>c,d.set=(e,t)=>{const o={hard:!t};Object.entries(e).forEach(([e,t])=>{l[e]&&l[e](t,o)})},d})(Tt,At,e);Bc.unshift(t),pd(go)},pd=e=>{Bc.forEach((t,o)=>{const i=0===o?1:0;t.set({...e,opacity:i,resize:1},$o)})};let hd;const md=Ac(void 0,{duration:500});wr(e,md,e=>i(54,so=e));let gd,$d=!1;const fd=ls(!1);let yd;wr(e,fd,e=>i(395,lo=e));const bd=Fc(void 0,{stiffness:.1,damping:.7,precision:.25});wr(e,bd,e=>i(82,wi=e));const xd=Fc(0,{stiffness:.1,precision:.05});wr(e,xd,e=>i(83,ki=e));const vd=Fc(0,{stiffness:.02,damping:.5,precision:.25});wr(e,vd,e=>i(393,ro=e));const Sd=Fc(void 0,{stiffness:.02,damping:.5,precision:.25});wr(e,Sd,e=>i(394,ao=e));const wd=Fc(void 0,{stiffness:.02,damping:.5,precision:.25});let kd;wr(e,wd,e=>i(392,io=e));const Cd=()=>{Qi("abortLoadImage")},Td=()=>{Qi("abortProcessImage"),Er(Lc,to=!1,to)},Md=e=>{e.target&&"true"===e.target.dataset.touchScroll||sm(e)||e.preventDefault()},Pd=vc?e=>{const t=e.touches?e.touches[0]:e;t.pageX>20&&t.pageX<window.innerWidth-20||Md(e)}:o,Rd=ls([]);wr(e,Rd,e=>i(488,Xt=e)),va("keysPressed",Rd);const Id=e=>{!e||Ko(e)&&!((e,t)=>!(!(e=>/^image/.test(e.type)&&!/svg/.test(e.type))(e)||!/image/.test(t))||!(!al(e)||!/video/.test(t)))(e,Fn)||!Ko(e)&&!/^http/.test(e)||Qi("loadImage",e)},Ed=e=>{e&&Id(e)};let Ad,Ld,Fd;let zd,Dd=[];const Od=ls();va("rootPortal",Od),va("rootRect",Os);const Bd=()=>({foregroundColor:[...Nt],lineColor:[...Vt],utilVisibility:{...Z},isInteracting:_t,isInteractingFraction:Wt,rootRect:rt(St),stageRect:rt(Bt),manipulationShapesDirty:iu,annotationShapesDirty:Jd,decorationShapesDirty:tu,frameShapesDirty:ou}),Wd=(e,t,o)=>An(e,Ze(Math.round(t.width/o),Math.round(t.height/o))),_d=(e,t,o)=>{var i;return e._translate=be((i=t).x,i.y),e._scale=o,e},Vd=e=>{const t=[];return e.forEach(e=>t.push(Nd(e))),t.filter(Boolean)},Nd=e=>Vi(e)?(e.points=[be(e.x1,e.y1),be(e.x2,e.y2)],e):(!(e=>Di(e)&&!e.text.length)(e)||e.backgroundColor&&0!==e.backgroundColor[3]||(Oi(e)&&(e.width=5,e.height=e.lineHeight),e.strokeWidth=1,e.strokeColor=[1,1,1,.5],e.backgroundColor=[0,0,0,.1]),e);let Hd,jd=[],Ud=[],Gd=[],Zd=[],Xd=[],qd={};const Kd=(e,t,o,i,n,r,a)=>{const{manipulationShapesDirty:s,annotationShapesDirty:l,decorationShapesDirty:c,frameShapesDirty:d,selectionRect:u,scale:p}=e,h=Hd!==p,m=h||!xt(qd,u);m&&(Hd=p,qd=u),s&&(Gd=t.filter(ji).map(Ri).map(e=>An(e,At))),(l||o!==Ot)&&(jd=o.filter(ji).map(Ri).sort((e,t)=>e.alwaysOnTop?1:t.alwaysOnTop?-1:0).map(e=>An(e,At))),(h||Qd||l||o!==Ot)&&(Ud=Vd(jd.map(e=>x(e,{flipX:zt,flipY:Ft,rotation:Dt,scale:p,context:st(At)})).flat())),(c||i!==It||m)&&(Zd=Vd(i.filter(ji).map(Ri).sort((e,t)=>e.alwaysOnTop?1:t.alwaysOnTop?-1:0).map(e=>Wd(e,u,p)).map(e=>x(e,{context:u})).flat().map(e=>_d(e,u,p)))),(d||r!==Mt||m)&&(Xd=r?Vd([r].map(Ri).map(e=>Wd(e,u,p)).map(x).flat().map(e=>_d(e,u,p))):[]);let g=Vd(n.filter(ji));return"undefined"!=typeof window&&(e=>{if(e&&e._3so2s47)return;const[t]=[[85,110,108,105,99,101,110,115,101,100,32,80,105,110,116,117,114,97,32,105,110,115,116,97,110,99,101]].map(e=>e.map(e=>String.fromCharCode(e)).join(""));g=[...g,{x:u.x+.5*u.width-82,y:u.y+u.height-16-12,width:164,height:16,text:t,fontWeight:900,fontSize:12,color:[1,1,1,.25]}]})(window),{manipulationShapesDirty:s,manipulationShapes:Gd,annotationShapesDirty:l,annotationShapes:Ud,decorationShapesDirty:c,decorationShapes:Zd,frameShapesDirty:d,frameShapes:Xd,interfaceShapes:g,selectionShapes:a.map(Ri).map(e=>An(e,At))}};let Jd=!0;let Qd=!0;let tu=!0;let ou=!0;let iu=!0;ba(()=>{Jr(),Tt&&y(Tt.src)&&/^blob:/.test(Tt.src)&&URL.revokeObjectURL(Tt.src),bs(),Vl(),Wl(),Nl(),Ul(),Gl(),Zl(),Mc(),Oc(),Hs.destroy(),js.destroy(),fa.destroy(),Bc.clear(),jd.length=0,Ud.length=0,Gd.length=0,Zd.length=0,Xd.length=0,Ad&&S(Ad),Mr&&window.visualViewport.removeEventListener("resize",Rr);try{i(236,pc=void 0),i(299,hd=void 0)}catch(e){}});let nu;return e.$$set=e=>{"class"in e&&i(237,en=e.class),"layout"in e&&i(238,tn=e.layout),"stores"in e&&i(239,on=e.stores),"locale"in e&&i(3,nn=e.locale),"id"in e&&i(4,rn=e.id),"util"in e&&i(240,an=e.util),"utils"in e&&i(241,sn=e.utils),"animations"in e&&i(242,ln=e.animations),"disabled"in e&&i(243,cn=e.disabled),"previewUpscale"in e&&i(244,dn=e.previewUpscale),"previewPad"in e&&i(245,un=e.previewPad),"previewMaskOpacity"in e&&i(5,pn=e.previewMaskOpacity),"previewImageDataMaxSize"in e&&i(246,hn=e.previewImageDataMaxSize),"previewImageTextPixelRatio"in e&&i(6,mn=e.previewImageTextPixelRatio),"markupMaskOpacity"in e&&i(7,gn=e.markupMaskOpacity),"zoomMaskOpacity"in e&&i(247,$n=e.zoomMaskOpacity),"elasticityMultiplier"in e&&i(8,fn=e.elasticityMultiplier),"willRevert"in e&&i(248,yn=e.willRevert),"willProcessImage"in e&&i(249,bn=e.willProcessImage),"willRenderCanvas"in e&&i(9,xn=e.willRenderCanvas),"willRenderToolbar"in e&&i(250,vn=e.willRenderToolbar),"willRenderUtilTabs"in e&&i(251,Sn=e.willRenderUtilTabs),"willSetHistoryInitialState"in e&&i(252,wn=e.willSetHistoryInitialState),"enableButtonExport"in e&&i(253,kn=e.enableButtonExport),"enableButtonRevert"in e&&i(254,Cn=e.enableButtonRevert),"enableNavigateHistory"in e&&i(255,Tn=e.enableNavigateHistory),"enableToolbar"in e&&i(10,Mn=e.enableToolbar),"enableUtils"in e&&i(256,Pn=e.enableUtils),"enableButtonClose"in e&&i(257,Rn=e.enableButtonClose),"enableDropImage"in e&&i(258,In=e.enableDropImage),"enablePasteImage"in e&&i(259,En=e.enablePasteImage),"enableBrowseImage"in e&&i(260,Ln=e.enableBrowseImage),"accept"in e&&i(261,Fn=e.accept),"enableTransparencyGrid"in e&&i(11,zn=e.enableTransparencyGrid),"layoutDirectionPreference"in e&&i(262,Dn=e.layoutDirectionPreference),"layoutHorizontalUtilsPreference"in e&&i(263,Wn=e.layoutHorizontalUtilsPreference),"layoutVerticalUtilsPreference"in e&&i(264,_n=e.layoutVerticalUtilsPreference),"layoutVerticalToolbarPreference"in e&&i(265,Vn=e.layoutVerticalToolbarPreference),"layoutVerticalControlGroupsPreference"in e&&i(266,Hn=e.layoutVerticalControlGroupsPreference),"layoutVerticalControlTabsPreference"in e&&i(267,jn=e.layoutVerticalControlTabsPreference),"supportedMediaTypes"in e&&i(268,Un=e.supportedMediaTypes),"status"in e&&i(235,Gn=e.status),"formatStatusImageLoading"in e&&i(269,Zn=e.formatStatusImageLoading),"formatStatusImageProcessing"in e&&i(270,Xn=e.formatStatusImageProcessing),"formatStatusSupportError"in e&&i(271,Yn=e.formatStatusSupportError),"textDirection"in e&&i(12,qn=e.textDirection),"markupEditorZoomLevel"in e&&i(272,Kn=e.markupEditorZoomLevel),"markupEditorZoomLevels"in e&&i(13,Jn=e.markupEditorZoomLevels),"markupEditorZoomAdjustStep"in e&&i(14,Qn=e.markupEditorZoomAdjustStep),"markupEditorZoomAdjustFactor"in e&&i(15,er=e.markupEditorZoomAdjustFactor),"markupEditorZoomAdjustWheelFactor"in e&&i(16,tr=e.markupEditorZoomAdjustWheelFactor),"markupEditorInteractionMode"in e&&i(273,or=e.markupEditorInteractionMode),"muteAudio"in e&&i(274,ir=e.muteAudio),"willSetMediaInitialTimeOffset"in e&&i(275,nr=e.willSetMediaInitialTimeOffset),"enablePan"in e&&i(17,rr=e.enablePan),"enableZoom"in e&&i(18,ar=e.enableZoom),"enableZoomControls"in e&&i(276,sr=e.enableZoomControls),"enableZoomInput"in e&&i(19,lr=e.enableZoomInput),"enablePanInput"in e&&i(277,pr=e.enablePanInput),"enableCanvasAlpha"in e&&i(20,hr=e.enableCanvasAlpha),"enablePanLimit"in e&&i(21,mr=e.enablePanLimit),"panLimitGutterScalar"in e&&i(22,gr=e.panLimitGutterScalar),"pan"in e&&i(278,$r=e.pan),"zoomPresetOptions"in e&&i(23,fr=e.zoomPresetOptions),"zoomAdjustStep"in e&&i(24,yr=e.zoomAdjustStep),"zoomAdjustFactor"in e&&i(25,br=e.zoomAdjustFactor),"zoomAdjustWheelFactor"in e&&i(26,xr=e.zoomAdjustWheelFactor),"zoomLevel"in e&&i(0,kr=e.zoomLevel),"fixScrollDirection"in e&&i(279,Cr=e.fixScrollDirection),"imagePreviewSrc"in e&&i(282,Lr=e.imagePreviewSrc),"imageOrienter"in e&&i(283,Fr=e.imageOrienter),"pluginComponents"in e&&i(284,zr=e.pluginComponents),"pluginOptions"in e&&i(27,Dr=e.pluginOptions),"root"in e&&i(2,Wr=e.root),"imageSourceToImageData"in e&&i(28,$a=e.imageSourceToImageData),"imagePreviewCurrent"in e&&i(236,pc=e.imagePreviewCurrent)},e.$$.update=()=>{if(1&e.$$.dirty[9]&&Tr.set(Cr),8&e.$$.dirty[0]&&i(306,n=!!nn),1&e.$$.dirty[0]|16777216&e.$$.dirty[8]&&i(0,kr=null===kr?Kn:kr),2&e.$$.dirty[0]|32&e.$$.dirty[9]){let e=!1;zr.forEach(([t])=>{Br[t]||(i(1,Br[t]={},Br),e=!0)}),e&&i(296,da=[...zr])}var t,m,f,T;if(16777216&e.$$.dirty[7]|134348800&e.$$.dirty[9]&&i(359,V=n&&da.length?sn||da.map(([e])=>e):[]),134217728&e.$$.dirty[0]|131072&e.$$.dirty[9]|262144&e.$$.dirty[11]|8&e.$$.dirty[13]&&i(360,H=((e,t,o,i)=>{const n=t.filter(([t])=>e.includes(t)).filter(([e,{isSupported:t}])=>t({...i,...o[e]})).map(([e,t])=>[e,t.Component]);return Fs(n,Xc,(e,t)=>e[0]===t[0]&&e[1]===t[1])?Xc:(Xc=n,n)})(V,da,Dr,{src:wo})),524288&e.$$.dirty[11]&&i(313,j=H.length),8&e.$$.dirty[0]|8&e.$$.dirty[10]|262144&e.$$.dirty[11]&&i(358,U=j&&V.map(e=>{const t=Yc(e);if(!t)return;const o=nn[`${e}Label`],i=nn[`${e}Title`];return{id:e,view:t[1],tabIcon:nn[`${e}Icon`],tabLabel:o,tabTitle:y(i)?i:o}}).filter(Boolean)||[]),131072&e.$$.dirty[11]&&i(377,r=!!U.find(e=>"trim"===e.id)),160&e.$$.dirty[12]|134217728&e.$$.dirty[13]&&i(312,a=!!(bi&&Tt&&r)),8388608&e.$$.dirty[7]|8&e.$$.dirty[10]&&i(43,G=j&&an&&"string"==typeof an&&Yc(an)?an:j>0?H[0][0]:void 0),4096&e.$$.dirty[1]|4&e.$$.dirty[10]&&a&&G&&Jr(),4&e.$$.dirty[10]|128&e.$$.dirty[12]&&(a?(Tt.addEventListener("play",Ur),Tt.addEventListener("pause",Ur)):Tt&&"video"===Tt.nodeName&&(Tt.removeEventListener("play",Ur),Tt.removeEventListener("pause",Ur))),4&e.$$.dirty[10]&&a&&Hr.set(aa()/ra()),603979776&e.$$.dirty[13]&&(e=>{if(!Qr())return;const t=Date.now();if(Zr&&t-Zr<16)return;Zr=t;const o=bi*e;if(o.toFixed(1)===Gr)return;Gr=o.toFixed(1);const i=Tt,n=()=>{i.removeEventListener("seeked",n),_r()};i.addEventListener("seeked",n),am(i,o)})(vi||yi),67108864&e.$$.dirty[13]&&i(375,s=yi&&ge(yi,6)),1224736768&e.$$.dirty[13]&&i(373,l=hi||[[0,Math.min(bi,Si)/bi]]),2&e.$$.dirty[12]&&(c=l[0][0]),2&e.$$.dirty[12]&&(d=l[l.length-1][1]),2&e.$$.dirty[12]&&i(376,u=l.map(([e,t])=>[ge(e,6),ge(t,6)])),24&e.$$.dirty[12]&&i(374,p=u.findIndex(([e,t])=>s>=e&&s<=t)),28&e.$$.dirty[12]&&(h=-1===p&&u.findIndex((e,t,o)=>{const i=o[t-1];return i?s<=e[0]&&s>=i[1]:s<=e[0]})),67108864&e.$$.dirty[8]&&na.set(ir),128&e.$$.dirty[12]|268435456&e.$$.dirty[13]&&(Tt&&xi?ta():oa()),4&e.$$.dirty[10]|67108864&e.$$.dirty[13]&&a&&ka.set(ra()*yi),128&e.$$.dirty[12]|33554432&e.$$.dirty[13]&&Tt&&(e=>{if(!a)return;Tt.volume=Math.min(1,e)})(fi),256&e.$$.dirty[0]&&Er(ca,$i=fn,$i),2097152&e.$$.dirty[7]&&i(369,g="overlay"===tn),256&e.$$.dirty[8]|268435456&e.$$.dirty[11]&&i(45,$=Pn&&!g),134217730&e.$$.dirty[0]&&Dr&&Object.entries(Dr).forEach(([e,t])=>{Object.entries(t).forEach(([t,o])=>{Br[e]&&i(1,Br[e][t]=o,Br)})}),524288&e.$$.dirty[13]&&i(370,k=!ii),33554432&e.$$.dirty[7]|1610612736&e.$$.dirty[11]&&Er(Ys,oo="always"===ln?v:"never"!==ln&&(v&&k),oo),4194304&e.$$.dirty[1]|67108864&e.$$.dirty[7]&&ua.set(cn?1:0,{hard:!oo}),536870912&e.$$.dirty[7]&&(b=hn?(t=hn,m=ha,Ze(Math.min(t.width,m.width),Math.min(t.height,m.height))):ha),8388608&e.$$.dirty[13]&&fa.update(pi[0]),4194304&e.$$.dirty[13]&&(x=ui?(e,t)=>ui(e,{flipX:void 0,flipY:void 0,rotation:void 0,...t,isPreview:!0}):ee),268435456&e.$$.dirty[1]&&Array.isArray(di)&&Qi("selectionchange",[...di]),268435456&e.$$.dirty[8]|2097152&e.$$.dirty[13]&&Ts.set(ci&&sr),570425344&e.$$.dirty[8]&&Ms.set("pan"===or||pr),1048576&e.$$.dirty[1]&&Jt&&Os.set(ht(Jt.x,Jt.y,Jt.width,Jt.height)),268435456&e.$$.dirty[11]|67108928&e.$$.dirty[12]&&St&&g&&po&&po.complete&&(()=>{const e=ai,t=vt(St);e&&e===t||(Aa.set(vt(St)),Tc())})(),262144&e.$$.dirty[11]&&i(46,K=V.length>1),32768&e.$$.dirty[1]&&(K||Bs.set(at())),1024&e.$$.dirty[0]|1048576&e.$$.dirty[13]&&(Mn||_s.set(ht(0,ri,0,0))),1073741824&e.$$.dirty[11]|4096&e.$$.dirty[12]&&i(372,w=!_t&&v),1048576&e.$$.dirty[1]&&i(314,nt=Jt&&Jt.width>0&&Jt.height>0),8&e.$$.dirty[0]|24&e.$$.dirty[10]&&i(40,lt=nt&&nn&&!!j),512&e.$$.dirty[1]&&setTimeout(()=>i(297,Ks=lt),1),33554432&e.$$.dirty[7]|262144&e.$$.dirty[9]|536870912&e.$$.dirty[11]|1&e.$$.dirty[12]&&Er(Xs,$o="always"===ln?w:"never"!==ln&&(w&&Ks&&k),$o),134217728&e.$$.dirty[7]|268435456&e.$$.dirty[11]&&Js.set(dn||g),268435456&e.$$.dirty[7]&&ml.set(un),1073741824&e.$$.dirty[8]&&$r&&Ml.set($r),4&e.$$.dirty[0]|294912&e.$$.dirty[13]&&Wr&&(Wr.dispatchEvent(dm("markupzoom",oi)),Wr.dispatchEvent(dm("zoom",No(oi)?oi:Yo))),4&e.$$.dirty[0]|131072&e.$$.dirty[13]&&Wr&&(Wr.dispatchEvent(dm("markuppan",Qo)),Wr.dispatchEvent(dm("pan",Qo))),16384&e.$$.dirty[13]&&Ho&&Rl(),65536&e.$$.dirty[13]&&qo&&Al(),4198400&e.$$.dirty[1]&&G&&Ql.set(.075,{hard:!oo}),1073741824&e.$$.dirty[7]&&i(367,C=$n),12288&e.$$.dirty[13]&&i(368,P=Wo?-Math.max(...Object.values(Bo)):0),138936320&e.$$.dirty[1]|201326592&e.$$.dirty[11]&&Oo){let e=Oo.x-Bt.x,t=Bt.x+Bt.width-(Oo.x+Oo.width),o=Oo.y-Bt.y,i=Bt.y+Bt.height-(Oo.y+Oo.height),n=Math.min(e,o,t,i);ic.set(n>P?0:Math.min(C,Math.abs(n/64)),{hard:!oo})}if(67108864&e.$$.dirty[1]&&i(366,R=.55/Do),4718592&e.$$.dirty[1]|33554432&e.$$.dirty[11]&&Bt&&nc.set({x:0,y:Bt.y,width:Bt.x<64?0:Bt.x,height:Bt.height+R},{hard:!oo}),4718592&e.$$.dirty[1]|33554432&e.$$.dirty[11]|64&e.$$.dirty[12]&&Bt&&rc.set({x:0,y:0,width:St.width,height:Bt.y+R},{hard:!oo}),4718592&e.$$.dirty[1]|33554432&e.$$.dirty[11]|64&e.$$.dirty[12]&&Bt){let e=Bt.x+Bt.width,t=St.width-(Bt.x+Bt.width);t<64&&(e+=t,t=0),ac.set({x:e,y:Bt.y,width:t,height:Bt.height+R},{hard:!oo})}if(4718592&e.$$.dirty[1]|64&e.$$.dirty[12]&&Bt&&sc.set({x:0,y:Bt.y+Bt.height,width:St.width,height:St.height-(Bt.y+Bt.height)},{hard:!oo}),33554432&e.$$.dirty[1]|2304&e.$$.dirty[13]&&i(362,I=zo&&{id:ag,backgroundColor:Ao,opacity:Eo,...zo}),33554432&e.$$.dirty[1]|1280&e.$$.dirty[13]&&i(365,E=Fo&&{id:ag,backgroundColor:Ao,opacity:Eo,...Fo}),33554432&e.$$.dirty[1]|768&e.$$.dirty[13]&&i(364,A=Lo&&{id:ag,backgroundColor:Ao,opacity:Eo,...Lo}),33554432&e.$$.dirty[1]|384&e.$$.dirty[13]&&i(363,F=Io&&{id:ag,backgroundColor:Ao,opacity:Eo,...Io}),31457280&e.$$.dirty[11]&&i(361,z=[E,A,F,I].filter(Boolean)),1048576&e.$$.dirty[11]|64&e.$$.dirty[13]&&z&&Ro&&tc.update(e=>[...e.filter(e=>e.id!==ag),...z]),8&e.$$.dirty[9]|8&e.$$.dirty[13]&&cc.set(Lr||(wo||void 0)),4&e.$$.dirty[0]|524288&e.$$.dirty[7]|128&e.$$.dirty[12]&&(i(236,pc=Tt),Tt&&Wr.dispatchEvent(dm("loadpreview",pc))),134217728&e.$$.dirty[12]&&ho&&(Ml.set(ye()),wl.set(void 0),Rl(),mc.set([])),32&e.$$.dirty[13]&&i(318,O=Co.index>0),32&e.$$.dirty[13]&&i(317,W=Co.index<Co.length-1),393216&e.$$.dirty[1]|24576&e.$$.dirty[12]&&(_=[Ot,It,jt,Ht]),8&e.$$.dirty[1]&&Hc.set(Vc),16&e.$$.dirty[13]&&jc.set(ko),4096&e.$$.dirty[1]&&xs.set(G),4096&e.$$.dirty[1]|536870912&e.$$.dirty[9]|131072&e.$$.dirty[11]&&i(308,Z=U.reduce((e,t)=>{const o=Z&&Z[t.id];return e[t.id]=void 0!==o?o:t.id===G?1:0,e},{})),4096&e.$$.dirty[1]&&i(79,X={name:Zc,selected:G}),131072&e.$$.dirty[11]&&i(340,Y=U.map(e=>({id:e.id,icon:e.tabIcon,label:e.tabLabel,title:e.tabTitle}))),131072&e.$$.dirty[11]&&i(78,q=U.map(e=>e.id)),1048576&e.$$.dirty[7]&&i(77,J=ld(["PinturaRoot","PinturaRootComponent",en])),64&e.$$.dirty[12]&&i(354,Q=St&&(St.width>1e3?"wide":St.width<600?"narrow":void 0)),64&e.$$.dirty[12]&&i(341,te=St&&(St.width<=320||St.height<=460)),64&e.$$.dirty[12]&&i(353,oe=St&&(St.height>1e3?"tall":St.height<600?"short":void 0)),4&e.$$.dirty[0]&&i(320,ie=Wr&&Wr.parentNode&&Wr.parentNode.classList.contains("PinturaModal")),1&e.$$.dirty[1]|1024&e.$$.dirty[10]|64&e.$$.dirty[12]&&i(346,ne=ie&&St&&bc>St.width),2&e.$$.dirty[1]|1024&e.$$.dirty[10]|64&e.$$.dirty[12]&&i(345,re=ie&&St&&xc>St.height),48&e.$$.dirty[11]&&i(347,ae=ne&&re),1048576&e.$$.dirty[0]&&i(344,se=hr),8192&e.$$.dirty[11]&&i(315,le="narrow"===Q),16384&e.$$.dirty[8]|64&e.$$.dirty[12]&&i(355,(f=St,T=Dn,ce=St?"auto"===T?f.width>f.height?"landscape":"portrait":"horizontal"===T?f.width<500?"portrait":"landscape":"vertical"===T?f.height<400?"landscape":"portrait":void 0:"landscape")),16384&e.$$.dirty[11]&&i(76,de="landscape"===ce),32&e.$$.dirty[10]|4096&e.$$.dirty[11]&&i(343,ue=le||"short"===oe),1&e.$$.dirty[1]|64&e.$$.dirty[12]&&i(342,pe=ed&&St&&bc===St.width&&!vc),4&e.$$.dirty[1]|4&e.$$.dirty[13]&&i(316,he=[...So||[],...Nc].filter(Boolean)),32768&e.$$.dirty[8]&&i(352,me=`has-navigation-preference-${Wn}`),65536&e.$$.dirty[8]&&i(351,$e=`has-navigation-preference-${_n}`),131072&e.$$.dirty[8]&&i(348,fe=`has-toolbar-preference-${Vn}`),262144&e.$$.dirty[8]&&i(350,xe=`has-controlgroups-preference-${Hn}`),524288&e.$$.dirty[8]&&i(349,ve=`has-controltabs-preference-${jn}`),64&e.$$.dirty[12]&&i(357,Se=void 0!==St&&St.width>0&&St.height>0),4&e.$$.dirty[0]|65536&e.$$.dirty[11]&&i(356,we=Se&&Wr&&getComputedStyle(Wr)),32768&e.$$.dirty[11]&&we&&cd(),1024&e.$$.dirty[0]|4243456&e.$$.dirty[1]|69206016&e.$$.dirty[7]|1024&e.$$.dirty[10]|32767&e.$$.dirty[11]|262144&e.$$.dirty[12]|3&e.$$.dirty[13]&&Sc.set({...Qt,layoutMode:tn,orientation:ce,horizontalSpace:Q,verticalSpace:oe,navigationHorizontalPreference:me,navigationVerticalPreference:$e,controlGroupsVerticalPreference:xe,controlTabsVerticalpreference:ve,toolbarVerticalPreference:fe,isModal:ie,isDisabled:cn,isCentered:ae,isCenteredHorizontally:ne,isCenteredVertically:re,isAnimated:oo,isTransparent:se,pointerAccuracy:vo,pointerHoverable:bo,isCompact:ue,hasSwipeNavigation:pe,hasLimitedSpace:te,hasToolbar:Mn,hasNavigation:K&&$,isIOS:ed,browserVersion:$c()?`chrome-${(navigator.userAgent.match(/Chrome\/([0-9]+)/)||[])[1]}`:void 0}),262144&e.$$.dirty[12]&&i(75,ke=Object.entries(Qt).map(([e,t])=>/^is|has/.test(e)?t?um(e):void 0:t).filter(Boolean).join(" ")),4096&e.$$.dirty[1]&&G&&_c.set([]),4096&e.$$.dirty[1]|8&e.$$.dirty[8]|1073741824&e.$$.dirty[10]|262144&e.$$.dirty[12]&&i(44,Ce=Sn(Y.map(e=>({...e,selected:G===e.id})),{...Qt},()=>la.set({}))),8192&e.$$.dirty[1]&&i(74,Te=!!Ce.find(e=>Array.isArray(e))),1610612736&e.$$.dirty[12]&&i(73,Me=yo&&Object.entries(fo).filter(([,e])=>null!=e).reduce((e,[,t])=>e={...e,...t},{})),67108864&e.$$.dirty[12]&&i(337,Le=po&&"any-to-file"===po.task),134217728&e.$$.dirty[10]&&Le&&Bc&&Bc.clear(),268435456&e.$$.dirty[12]&&i(339,Re=!!go&&!!go.translation),1048576&e.$$.dirty[9]|536870912&e.$$.dirty[10]|128&e.$$.dirty[12]&&Re&&Tt&&Tt!==hd&&(i(299,hd=Tt),ud()),536870912&e.$$.dirty[10]|268435456&e.$$.dirty[12]&&Re&&pd(go),16777216&e.$$.dirty[1]&&mo&&mo.length>1){let e=[];Bc.forEach((t,o)=>{0!==o&&t.get().opacity<=0&&e.push(t)}),e.forEach(e=>Bc.remove(e))}if(8&e.$$.dirty[0]|268435456&e.$$.dirty[10]&&i(39,Ee=nn&&Ie.length&&function(e,t){if(L(t.labelSupportError))return t.labelSupportError(e);const o=Yn({features:e},t);return jl(t.labelSupportError,o,"{","}")}(Ie,nn)),8&e.$$.dirty[0]|2097152&e.$$.dirty[9]&&i(309,Ae=nn&&$d&&nn.labelMemoryError),67108864&e.$$.dirty[12]&&i(329,Fe=po&&!!po.error),67108864&e.$$.dirty[12]&&i(42,ze=!po||!po.complete&&void 0===po.task),67108864&e.$$.dirty[12]&&i(330,De=po&&(po.taskLengthComputable?po.taskProgress:1/0)),134217728&e.$$.dirty[10]&&Le&&Er(lc,co=!1,co),4194304&e.$$.dirty[1]|4194304&e.$$.dirty[9]|67108864&e.$$.dirty[12]&&po&&po.complete){const e=oo?250:0;clearTimeout(gd),i(301,gd=setTimeout(()=>{Er(lc,co=!0,co)},e))}if(2048&e.$$.dirty[1]|524288&e.$$.dirty[10]|83886080&e.$$.dirty[12]&&i(334,Oe=po&&!Fe&&!ze&&!co),524288&e.$$.dirty[9]|134217856&e.$$.dirty[12]&&i(333,Be=!(!ho||Tt&&!dc)),4194304&e.$$.dirty[1]|16777216&e.$$.dirty[12])if(co){setTimeout(()=>sd.set(1,{hard:!oo}),oo?500:0)}else sd.set(0,{hard:!oo});if(34078720&e.$$.dirty[12]&&i(328,We=!!(to||uo&&void 0!==uo.progress&&!uo.complete)),262144&e.$$.dirty[10]&&We&&Jr(),2048&e.$$.dirty[1]|67108864&e.$$.dirty[12]&&i(331,_e=po&&!(po.error||ze)),8&e.$$.dirty[0]|67108864&e.$$.dirty[12]&&i(332,Ve=nn&&function(e,t){const o=e?!e.complete||e.error?e:{task:"blob-to-bitmap",progress:1/0}:void 0;let i=L(t.statusLabelLoadImage)?t.statusLabelLoadImage(o):Zn({state:o},t);return e&&e.error&&e.error.metadata&&(i=jl(i,e.error.metadata,"{","}")),i}(po,nn)),8&e.$$.dirty[0]|33554432&e.$$.dirty[12]&&i(327,Ne=uo&&nn&&function(e,t){return L(t.statusLabelProcessImage)?t.statusLabelProcessImage(e):Xn({state:e},t)}(uo,nn)),33554432&e.$$.dirty[12]&&i(325,He=uo&&(uo.taskLengthComputable?uo.taskProgress:1/0)),33554432&e.$$.dirty[12]&&i(326,je=uo&&!uo.error),33554432&e.$$.dirty[12]&&i(324,Ue=!(!uo||!uo.error)),8&e.$$.dirty[0]|2048&e.$$.dirty[1]|262144&e.$$.dirty[7]|1073741824&e.$$.dirty[9]|33538048&e.$$.dirty[10])if(Gn){let e,t,o,n,r;y(Gn)&&(e=Gn),No(Gn)?t=Gn:Array.isArray(Gn)&&([e,t,r]=Gn,!1===t&&(n=!0),No(t)&&(o=!0)),i(35,yd=(e||t)&&{text:e,aside:n||o,progressIndicator:{visible:o,progress:t},closeButton:n&&{label:nn.statusLabelButtonClose,icon:nn.statusIconButtonClose,onclick:r||(()=>i(235,Gn=void 0))}})}else i(35,yd=nn&&ze||Fe||Oe||Be?{text:Ve,aside:Fe||_e,progressIndicator:{visible:_e,progress:De},closeButton:Fe&&{label:nn.statusLabelButtonClose,icon:nn.statusIconButtonClose,onclick:Cd}}:nn&&We&&Ne?{text:Ne,aside:Ue||je,progressIndicator:{visible:je,progress:He},closeButton:Ue&&{label:nn.statusLabelButtonClose,icon:nn.statusIconButtonClose,onclick:Td}}:Ae?{text:Ae,aside:!0,error:!0,progressIndicator:{visible:!1},icon:nn.iconSupportError}:void 0);if(262144&e.$$.dirty[7]&&i(336,Ge=void 0!==Gn),4194304&e.$$.dirty[1]|1024&e.$$.dirty[10]|33554432&e.$$.dirty[12]&&ie&&uo&&uo.complete&&(fd.set(!0),setTimeout(()=>fd.set(!1),oo?100:0)),4&e.$$.dirty[0]|4096&e.$$.dirty[1]|16777216&e.$$.dirty[12]&&co&&Wr&&Wr.dispatchEvent(dm("selectutil",G)),2304&e.$$.dirty[1]|1073741824&e.$$.dirty[9]|93061120&e.$$.dirty[10]|8388608&e.$$.dirty[12]&&i(335,Xe=lo||Ee||Ae||ze||Fe||Oe||Be||We||Ge),33554432&e.$$.dirty[10]&&Er(md,so=Xe?1:0,so),4194304&e.$$.dirty[1]|33554432&e.$$.dirty[10]&&md.set(Xe?1:0,{duration:oo?500:1}),8388608&e.$$.dirty[1]&&i(41,Ye=so>0),16&e.$$.dirty[1]&&i(323,qe=!(!yd||!yd.aside)),4195344&e.$$.dirty[1]|8388608&e.$$.dirty[9]|8192&e.$$.dirty[10]|4194304&e.$$.dirty[12]&&Ye&&yd){clearTimeout(kd);const e={hard:!1===oo};if(qe){const t=!!yd.error||!oo;xd.set(1,e),bd.set(ao,{hard:t}),i(302,kd=setTimeout(()=>{vd.set(16,e)},1))}else xd.set(0,e),i(302,kd=setTimeout(()=>{vd.set(0,e)},1))}if(1024&e.$$.dirty[1]&&(Ye||(wd.set(void 0,{hard:!0}),bd.set(void 0,{hard:!0}),vd.set(0,{hard:!0}))),2097152&e.$$.dirty[12]&&i(322,Ke=.5*ro),4096&e.$$.dirty[10]|1048576&e.$$.dirty[12]&&i(72,Je=`translateX(${io-Ke}px)`),256&e.$$.dirty[1]|1073741824&e.$$.dirty[9]|384&e.$$.dirty[12]&&i(38,ft=Tt&&At&&!Ee&&!Ae),128&e.$$.dirty[1]|3072&e.$$.dirty[10]&&i(319,et=Qe&&(ft||ie)?Md:o),512&e.$$.dirty[10]&&i(71,tt=et),512&e.$$.dirty[10]&&i(70,ot=et),8&e.$$.dirty[0]|2097152&e.$$.dirty[1]|740&e.$$.dirty[8]|480&e.$$.dirty[10]|262144&e.$$.dirty[12]&&i(69,it=nn&&eo&&wm(()=>vn([["div","alpha",{class:"PinturaNavGroup"},[["div","alpha-set",{class:"PinturaNavSet"},[Rn&&["Button","close",{label:nn.labelClose,icon:nn.iconButtonClose,onclick:()=>Qi("close"),hideLabel:!0}],Cn&&["Button","revert",{label:nn.labelButtonRevert,icon:nn.iconButtonRevert,disabled:!O,onclick:Pc,hideLabel:!0}]]]]],["div","beta",{class:"PinturaNavGroup PinturaNavGroupFloat"},[Tn&&["div","history",{class:"PinturaNavSet"},[["Button","undo",{label:nn.labelButtonUndo,icon:nn.iconButtonUndo,disabled:!O,onclick:Cc.undo,hideLabel:!0}],["Button","redo",{label:nn.labelButtonRedo,icon:nn.iconButtonRedo,disabled:!W,onclick:Cc.redo,hideLabel:!0}]]],he.length&&["div","plugin-tools",{class:"PinturaNavSet"},he.filter(Boolean).map(([e,t,o])=>[e,t,{...o}])]]],["div","gamma",{class:"PinturaNavGroup"},[kn&&["Button","export",{label:nn.labelButtonExport,icon:le&&nn.iconButtonExport,class:"PinturaButtonExport",onclick:Dc,hideLabel:le}]]]],{...Qt},()=>la.set({})))),16384&e.$$.dirty[12]&&i(311,ct=jt&&!!jt.length),2&e.$$.dirty[10]|16640&e.$$.dirty[12]&&i(310,ut=ct&&dr(At,jt)),3&e.$$.dirty[10]|196736&e.$$.dirty[12]&&ct&&((e,t,o,n)=>{if(!t||!e)return;if(Ld===t&&Fd===e)return;Fd=e,Ld=t;const r={dataSizeScalar:o};n&&n[3]>0&&(r.backgroundColor=[...n]),t(e,r).then(e=>{Ad&&S(Ad),e.setAttribute("data-retain",!0),i(303,Ad=e)})})(Tt,Zt,ut,Gt),16777216&e.$$.dirty[9]|49408&e.$$.dirty[12]&&jt&&Ad&&At){const{width:e,height:t}=At,o=no()?"pixelated":"auto"===Ut?"auto":"pixelated";i(304,Dd=jt.map(i=>{const n=ht(i.x,i.y,i.width,i.height),r=kt(rt(n),i.rotation).map(o=>be(o.x/e,o.y/t));return{...i,id:"redaction",flipX:!1,flipY:!1,cornerRadius:0,strokeWidth:0,strokeColor:void 0,backgroundColor:[0,0,0,0],backgroundImage:Ad,backgroundImageRendering:o,backgroundCorners:r}}))}33554432&e.$$.dirty[9]|8192&e.$$.dirty[12]&&i(37,pt=[...Dd,...Ht||[]]),32&e.$$.dirty[1]&&zd&&Od.set(zd),4&e.$$.dirty[0]|128&e.$$.dirty[1]&&ft&&Wr&&Wr.dispatchEvent(dm("ready")),262144&e.$$.dirty[1]&&i(63,Jd=!0),3840&e.$$.dirty[12]&&i(64,Qd=!0),131072&e.$$.dirty[1]&&i(65,tu=!0),65536&e.$$.dirty[1]&&i(66,ou=!0),64&e.$$.dirty[1]&&i(67,iu=!0),64&e.$$.dirty[12]&&i(307,yt=!!St&&St.height>0),469762048&e.$$.dirty[9]&&!n&&yt&&(clearTimeout(nu),i(305,nu=setTimeout(()=>{n||Vs("locale")},32)))},i(371,v=!od()),D=1===Yd()?e=>{e&&(Pe(e.origin,Math.round),Pe(e.translation,Math.round))}:ee,i(338,Ie=[!$m()&&"WebGL"].filter(Boolean)),i(321,Qe=To()||T()&&N()),i(68,mt=((e,t=!0)=>o=>{"ping"===o.type&&(t&&o.stopPropagation(),e(o.detail.type,o.detail.data))})(Ji.pub)),[kr,Br,Wr,nn,rn,pn,mn,gn,fn,xn,Mn,zn,qn,Jn,Qn,er,tr,rr,ar,lr,hr,mr,gr,fr,yr,br,xr,Dr,$a,uc,Cc,bc,xc,Nc,Vc,yd,zd,pt,ft,Ee,lt,Ye,ze,G,Ce,$,K,Mt,It,Ot,Bt,Jt,eo,oo,so,mo,Ao,Do,Oo,di,Ir,Ar,qc,Jd,Qd,tu,ou,iu,mt,it,ot,tt,Je,Me,Te,ke,de,J,q,X,Po,gi,wi,ki,Ci,Ti,Mi,Pi,Ii,Ei,Ai,Li,Fi,zi,Bi,Wi,_i,Ni,Hi,Ui,Gi,Xi,Yi,Vr,Nr,Hr,na,la,ca,ua,ya,Sa,wa,ka,Ta,Ma,Ra,Ia,Ea,Aa,La,Fa,_a,Ha,ja,Ua,Qa,es,ts,os,is,ns,rs,ds,us,ps,hs,ms,gs,$s,vs,Ss,ws,ks,Cs,Ts,Ms,Ps,Is,Es,As,Ls,Ds,Os,Bs,Ws,_s,Ns,Hs,js,Gs,Zs,Xs,Ys,Js,Qs,el,tl,rl,sl,ll,cl,gl,$l,yl,xl,vl,wl,Cl,Tl,Ml,Il,El,Ll,Yl,tc,oc,ic,nc,rc,ac,sc,lc,cc,hc,mc,fc,Sc,kc,Lc,Bc,_c,Gc,Kc,Jc,Qc,(e,t)=>t[e],e=>U.find(t=>t.id===e).view,nd,rd,ad,sd,({target:e,propertyName:t})=>{e===Wr&&/background|outline/.test(t)&&we&&cd()},dd,md,function(){i(300,$d=!0)},fd,bd,xd,vd,Sd,wd,e=>{const t=!(!yd||!yd.closeButton&&!yd.error)||!oo;Sd.set(e.detail.width,{hard:t}),wd.set(Math.round(.5*-e.detail.width),{hard:t})},Pd,Rd,e=>{const{keyCode:t,metaKey:o,ctrlKey:i,shiftKey:n}=e;if(9===t&&cn)return void e.preventDefault();if(e.target&&32===t&&Wr.contains(e.target)&&!eu(e.target)&&(Kt&&a&&ea(),e.preventDefault()),90===t&&(o||i))return void(n&&o?Cc.redo():Cc.undo());if(89===t&&i)return void Cc.redo();if(229===t)return;if(e.target&&(8===t||46===t)&&!Wr.contains(e.target)&&eu(e.target))return;const r=new Set([...Xt,t]);Rd.set(Array.from(r))},({key:e,keyCode:t})=>{if("Meta"===e)return Rd.set([]);Rd.set(Xt.filter(e=>e!==t))},()=>{Rd.set([])},e=>{eu(e.target)||e.preventDefault()},e=>{In&&Id(e.detail.resources[0])},e=>{!Ln||e.target&&"BUTTON"===e.target.tagName||Sm({accept:Fn}).then(Ed)},e=>{if(!En)return;const t=Rs((window.innerWidth-Math.abs(St.x))/St.width,0,1),o=Rs((window.innerHeight-Math.abs(St.y))/St.height,0,1);t<.75&&o<.75||Id((e.clipboardData||window.clipboardData).files[0])},Bd,Kd,e=>{wt&&xt(e.detail,wt)||Er(Ns,wt=e.detail,wt)},Gn,pc,en,tn,on,an,sn,ln,cn,dn,un,hn,$n,yn,bn,vn,Sn,wn,kn,Cn,Tn,Pn,Rn,In,En,Ln,Fn,Dn,Wn,_n,Vn,Hn,jn,Un,Zn,Xn,Yn,Kn,or,ir,nr,sr,pr,$r,Cr,()=>i(60,Ir=void 0),(e,t,o)=>{const{text:n="",placeholder:r="",autoClose:a=!0,align:s="top",justify:l="center",buttonConfirm:c,buttonCancel:d}=o;i(60,Ir={align:s,justify:l,text:n,placeholder:r,buttonConfirm:c,buttonCancel:d,onconfirm:()=>{e(Ar.value),a&&i(60,Ir=void 0)},oncancel:()=>{t(void 0),i(60,Ir=void 0)}})},Lr,Fr,zr,Or,Kr,Jr,Qr,ea,ta,oa,ia,ra,aa,sa,da,Ks,dc,hd,$d,gd,kd,Ad,Dd,nu,n,yt,Z,Ae,ut,ct,a,j,nt,le,he,W,O,et,ie,Qe,Ke,qe,Ue,He,je,Ne,We,Fe,De,_e,Ve,Be,Oe,Xe,Ge,Le,Ie,Re,Y,te,pe,ue,se,re,ne,ae,fe,ve,xe,$e,me,oe,Q,ce,we,Se,U,V,H,z,I,F,A,E,R,C,P,g,k,v,w,l,p,s,u,r,St,Tt,At,Ft,zt,Dt,_t,Ht,jt,Ut,Gt,Zt,Qt,to,io,ro,ao,lo,co,uo,po,ho,go,fo,yo,bo,vo,So,wo,ko,Co,Ro,Io,Eo,Lo,Fo,zo,Bo,Wo,Ho,Yo,qo,Qo,oi,ii,ri,ci,ui,pi,hi,fi,yi,bi,xi,vi,Si,function(){i(31,bc=Im.innerWidth),i(32,xc=Im.innerHeight)},e=>Er(_s,Ci=e.detail,Ci),({detail:e})=>i(43,G=e),function(t,o){e.$$.not_equal(Br[o],t)&&(Br[o]=t,i(1,Br),i(284,zr),i(27,Dr))},e=>Kc(e),e=>Jc(e),(e,{detail:t})=>Qc(e,t),e=>Er(Bs,Po=e.detail,Po),function(t){e.$$.not_equal(Br[G],t)&&(Br[G]=t,i(1,Br),i(284,zr),i(27,Dr))},()=>Kc(G),()=>Jc(G),({detail:e})=>Qc(G,e),e=>{const t={...e,...Bd()},{annotationShapes:o,decorationShapes:i,interfaceShapes:n,frameShapes:r,selectionShapes:a}=xn({annotationShapes:Ot,decorationShapes:It,interfaceShapes:Bi,frameShapes:Mt,selectionShapes:di},t);return Kd(t,pt,o,i,n,r,a)},()=>{i(63,Jd=!1),i(64,Qd=!1),i(65,tu=!1),i(66,ou=!1),i(67,iu=!1)},function(e){Ca[e?"unshift":"push"](()=>{zd=e,i(36,zd)})},function(e){kr=e,i(0,kr),i(272,Kn)},function(e){Nc=e,i(33,Nc)},function(e){Vc=e,i(34,Vc)},function(e){Ca[e?"unshift":"push"](()=>{Ar=e,i(61,Ar)})},function(e){Ca[e?"unshift":"push"](()=>{Wr=e,i(2,Wr)})},e=>Er(Ds,Jt=e.detail,Jt)]}class cg extends rs{constructor(e){super(),ns(this,e,lg,ng,yr,{class:237,layout:238,stores:239,locale:3,id:4,util:240,utils:241,animations:242,disabled:243,previewUpscale:244,previewPad:245,previewMaskOpacity:5,previewImageDataMaxSize:246,previewImageTextPixelRatio:6,markupMaskOpacity:7,zoomMaskOpacity:247,elasticityMultiplier:8,willRevert:248,willProcessImage:249,willRenderCanvas:9,willRenderToolbar:250,willRenderUtilTabs:251,willSetHistoryInitialState:252,enableButtonExport:253,enableButtonRevert:254,enableNavigateHistory:255,enableToolbar:10,enableUtils:256,enableButtonClose:257,enableDropImage:258,enablePasteImage:259,enableBrowseImage:260,accept:261,enableTransparencyGrid:11,layoutDirectionPreference:262,layoutHorizontalUtilsPreference:263,layoutVerticalUtilsPreference:264,layoutVerticalToolbarPreference:265,layoutVerticalControlGroupsPreference:266,layoutVerticalControlTabsPreference:267,supportedMediaTypes:268,status:235,formatStatusImageLoading:269,formatStatusImageProcessing:270,formatStatusSupportError:271,textDirection:12,markupEditorZoomLevel:272,markupEditorZoomLevels:13,markupEditorZoomAdjustStep:14,markupEditorZoomAdjustFactor:15,markupEditorZoomAdjustWheelFactor:16,markupEditorInteractionMode:273,muteAudio:274,willSetMediaInitialTimeOffset:275,enablePan:17,enableZoom:18,enableZoomControls:276,enableZoomInput:19,enablePanInput:277,enableCanvasAlpha:20,enablePanLimit:21,panLimitGutterScalar:22,pan:278,zoomPresetOptions:23,zoomAdjustStep:24,zoomAdjustFactor:25,zoomAdjustWheelFactor:26,zoomLevel:0,fixScrollDirection:279,hideTextInput:280,showTextInput:281,imagePreviewSrc:282,imageOrienter:283,pluginComponents:284,pluginOptions:27,sub:285,pluginInterface:1,root:2,play:286,pause:287,isPaused:288,togglePlayPause:289,mute:290,unmute:291,toggleMute:292,getDuration:293,getCurrentTime:294,setCurrentTime:295,imageSourceToImageData:28,imagePreview:29,imagePreviewCurrent:236,history:30},null,[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}get class(){return this.$$.ctx[237]}set class(e){this.$$set({class:e}),Oa()}get layout(){return this.$$.ctx[238]}set layout(e){this.$$set({layout:e}),Oa()}get stores(){return this.$$.ctx[239]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[3]}set locale(e){this.$$set({locale:e}),Oa()}get id(){return this.$$.ctx[4]}set id(e){this.$$set({id:e}),Oa()}get util(){return this.$$.ctx[240]}set util(e){this.$$set({util:e}),Oa()}get utils(){return this.$$.ctx[241]}set utils(e){this.$$set({utils:e}),Oa()}get animations(){return this.$$.ctx[242]}set animations(e){this.$$set({animations:e}),Oa()}get disabled(){return this.$$.ctx[243]}set disabled(e){this.$$set({disabled:e}),Oa()}get previewUpscale(){return this.$$.ctx[244]}set previewUpscale(e){this.$$set({previewUpscale:e}),Oa()}get previewPad(){return this.$$.ctx[245]}set previewPad(e){this.$$set({previewPad:e}),Oa()}get previewMaskOpacity(){return this.$$.ctx[5]}set previewMaskOpacity(e){this.$$set({previewMaskOpacity:e}),Oa()}get previewImageDataMaxSize(){return this.$$.ctx[246]}set previewImageDataMaxSize(e){this.$$set({previewImageDataMaxSize:e}),Oa()}get previewImageTextPixelRatio(){return this.$$.ctx[6]}set previewImageTextPixelRatio(e){this.$$set({previewImageTextPixelRatio:e}),Oa()}get markupMaskOpacity(){return this.$$.ctx[7]}set markupMaskOpacity(e){this.$$set({markupMaskOpacity:e}),Oa()}get zoomMaskOpacity(){return this.$$.ctx[247]}set zoomMaskOpacity(e){this.$$set({zoomMaskOpacity:e}),Oa()}get elasticityMultiplier(){return this.$$.ctx[8]}set elasticityMultiplier(e){this.$$set({elasticityMultiplier:e}),Oa()}get willRevert(){return this.$$.ctx[248]}set willRevert(e){this.$$set({willRevert:e}),Oa()}get willProcessImage(){return this.$$.ctx[249]}set willProcessImage(e){this.$$set({willProcessImage:e}),Oa()}get willRenderCanvas(){return this.$$.ctx[9]}set willRenderCanvas(e){this.$$set({willRenderCanvas:e}),Oa()}get willRenderToolbar(){return this.$$.ctx[250]}set willRenderToolbar(e){this.$$set({willRenderToolbar:e}),Oa()}get willRenderUtilTabs(){return this.$$.ctx[251]}set willRenderUtilTabs(e){this.$$set({willRenderUtilTabs:e}),Oa()}get willSetHistoryInitialState(){return this.$$.ctx[252]}set willSetHistoryInitialState(e){this.$$set({willSetHistoryInitialState:e}),Oa()}get enableButtonExport(){return this.$$.ctx[253]}set enableButtonExport(e){this.$$set({enableButtonExport:e}),Oa()}get enableButtonRevert(){return this.$$.ctx[254]}set enableButtonRevert(e){this.$$set({enableButtonRevert:e}),Oa()}get enableNavigateHistory(){return this.$$.ctx[255]}set enableNavigateHistory(e){this.$$set({enableNavigateHistory:e}),Oa()}get enableToolbar(){return this.$$.ctx[10]}set enableToolbar(e){this.$$set({enableToolbar:e}),Oa()}get enableUtils(){return this.$$.ctx[256]}set enableUtils(e){this.$$set({enableUtils:e}),Oa()}get enableButtonClose(){return this.$$.ctx[257]}set enableButtonClose(e){this.$$set({enableButtonClose:e}),Oa()}get enableDropImage(){return this.$$.ctx[258]}set enableDropImage(e){this.$$set({enableDropImage:e}),Oa()}get enablePasteImage(){return this.$$.ctx[259]}set enablePasteImage(e){this.$$set({enablePasteImage:e}),Oa()}get enableBrowseImage(){return this.$$.ctx[260]}set enableBrowseImage(e){this.$$set({enableBrowseImage:e}),Oa()}get accept(){return this.$$.ctx[261]}set accept(e){this.$$set({accept:e}),Oa()}get enableTransparencyGrid(){return this.$$.ctx[11]}set enableTransparencyGrid(e){this.$$set({enableTransparencyGrid:e}),Oa()}get layoutDirectionPreference(){return this.$$.ctx[262]}set layoutDirectionPreference(e){this.$$set({layoutDirectionPreference:e}),Oa()}get layoutHorizontalUtilsPreference(){return this.$$.ctx[263]}set layoutHorizontalUtilsPreference(e){this.$$set({layoutHorizontalUtilsPreference:e}),Oa()}get layoutVerticalUtilsPreference(){return this.$$.ctx[264]}set layoutVerticalUtilsPreference(e){this.$$set({layoutVerticalUtilsPreference:e}),Oa()}get layoutVerticalToolbarPreference(){return this.$$.ctx[265]}set layoutVerticalToolbarPreference(e){this.$$set({layoutVerticalToolbarPreference:e}),Oa()}get layoutVerticalControlGroupsPreference(){return this.$$.ctx[266]}set layoutVerticalControlGroupsPreference(e){this.$$set({layoutVerticalControlGroupsPreference:e}),Oa()}get layoutVerticalControlTabsPreference(){return this.$$.ctx[267]}set layoutVerticalControlTabsPreference(e){this.$$set({layoutVerticalControlTabsPreference:e}),Oa()}get supportedMediaTypes(){return this.$$.ctx[268]}set supportedMediaTypes(e){this.$$set({supportedMediaTypes:e}),Oa()}get status(){return this.$$.ctx[235]}set status(e){this.$$set({status:e}),Oa()}get formatStatusImageLoading(){return this.$$.ctx[269]}set formatStatusImageLoading(e){this.$$set({formatStatusImageLoading:e}),Oa()}get formatStatusImageProcessing(){return this.$$.ctx[270]}set formatStatusImageProcessing(e){this.$$set({formatStatusImageProcessing:e}),Oa()}get formatStatusSupportError(){return this.$$.ctx[271]}set formatStatusSupportError(e){this.$$set({formatStatusSupportError:e}),Oa()}get textDirection(){return this.$$.ctx[12]}set textDirection(e){this.$$set({textDirection:e}),Oa()}get markupEditorZoomLevel(){return this.$$.ctx[272]}set markupEditorZoomLevel(e){this.$$set({markupEditorZoomLevel:e}),Oa()}get markupEditorZoomLevels(){return this.$$.ctx[13]}set markupEditorZoomLevels(e){this.$$set({markupEditorZoomLevels:e}),Oa()}get markupEditorZoomAdjustStep(){return this.$$.ctx[14]}set markupEditorZoomAdjustStep(e){this.$$set({markupEditorZoomAdjustStep:e}),Oa()}get markupEditorZoomAdjustFactor(){return this.$$.ctx[15]}set markupEditorZoomAdjustFactor(e){this.$$set({markupEditorZoomAdjustFactor:e}),Oa()}get markupEditorZoomAdjustWheelFactor(){return this.$$.ctx[16]}set markupEditorZoomAdjustWheelFactor(e){this.$$set({markupEditorZoomAdjustWheelFactor:e}),Oa()}get markupEditorInteractionMode(){return this.$$.ctx[273]}set markupEditorInteractionMode(e){this.$$set({markupEditorInteractionMode:e}),Oa()}get muteAudio(){return this.$$.ctx[274]}set muteAudio(e){this.$$set({muteAudio:e}),Oa()}get willSetMediaInitialTimeOffset(){return this.$$.ctx[275]}set willSetMediaInitialTimeOffset(e){this.$$set({willSetMediaInitialTimeOffset:e}),Oa()}get enablePan(){return this.$$.ctx[17]}set enablePan(e){this.$$set({enablePan:e}),Oa()}get enableZoom(){return this.$$.ctx[18]}set enableZoom(e){this.$$set({enableZoom:e}),Oa()}get enableZoomControls(){return this.$$.ctx[276]}set enableZoomControls(e){this.$$set({enableZoomControls:e}),Oa()}get enableZoomInput(){return this.$$.ctx[19]}set enableZoomInput(e){this.$$set({enableZoomInput:e}),Oa()}get enablePanInput(){return this.$$.ctx[277]}set enablePanInput(e){this.$$set({enablePanInput:e}),Oa()}get enableCanvasAlpha(){return this.$$.ctx[20]}set enableCanvasAlpha(e){this.$$set({enableCanvasAlpha:e}),Oa()}get enablePanLimit(){return this.$$.ctx[21]}set enablePanLimit(e){this.$$set({enablePanLimit:e}),Oa()}get panLimitGutterScalar(){return this.$$.ctx[22]}set panLimitGutterScalar(e){this.$$set({panLimitGutterScalar:e}),Oa()}get pan(){return this.$$.ctx[278]}set pan(e){this.$$set({pan:e}),Oa()}get zoomPresetOptions(){return this.$$.ctx[23]}set zoomPresetOptions(e){this.$$set({zoomPresetOptions:e}),Oa()}get zoomAdjustStep(){return this.$$.ctx[24]}set zoomAdjustStep(e){this.$$set({zoomAdjustStep:e}),Oa()}get zoomAdjustFactor(){return this.$$.ctx[25]}set zoomAdjustFactor(e){this.$$set({zoomAdjustFactor:e}),Oa()}get zoomAdjustWheelFactor(){return this.$$.ctx[26]}set zoomAdjustWheelFactor(e){this.$$set({zoomAdjustWheelFactor:e}),Oa()}get zoomLevel(){return this.$$.ctx[0]}set zoomLevel(e){this.$$set({zoomLevel:e}),Oa()}get fixScrollDirection(){return this.$$.ctx[279]}set fixScrollDirection(e){this.$$set({fixScrollDirection:e}),Oa()}get hideTextInput(){return this.$$.ctx[280]}get showTextInput(){return this.$$.ctx[281]}get imagePreviewSrc(){return this.$$.ctx[282]}set imagePreviewSrc(e){this.$$set({imagePreviewSrc:e}),Oa()}get imageOrienter(){return this.$$.ctx[283]}set imageOrienter(e){this.$$set({imageOrienter:e}),Oa()}get pluginComponents(){return this.$$.ctx[284]}set pluginComponents(e){this.$$set({pluginComponents:e}),Oa()}get pluginOptions(){return this.$$.ctx[27]}set pluginOptions(e){this.$$set({pluginOptions:e}),Oa()}get sub(){return this.$$.ctx[285]}get pluginInterface(){return this.$$.ctx[1]}get root(){return this.$$.ctx[2]}set root(e){this.$$set({root:e}),Oa()}get play(){return this.$$.ctx[286]}get pause(){return this.$$.ctx[287]}get isPaused(){return this.$$.ctx[288]}get togglePlayPause(){return this.$$.ctx[289]}get mute(){return this.$$.ctx[290]}get unmute(){return this.$$.ctx[291]}get toggleMute(){return this.$$.ctx[292]}get getDuration(){return this.$$.ctx[293]}get getCurrentTime(){return this.$$.ctx[294]}get setCurrentTime(){return this.$$.ctx[295]}get imageSourceToImageData(){return this.$$.ctx[28]}set imageSourceToImageData(e){this.$$set({imageSourceToImageData:e}),Oa()}get imagePreview(){return this.$$.ctx[29]}get imagePreviewCurrent(){return this.$$.ctx[236]}set imagePreviewCurrent(e){this.$$set({imagePreviewCurrent:e}),Oa()}get history(){return this.$$.ctx[30]}}"undefined"!=typeof window&&(e=>{if(e&&e._3so2s47)return;const[t,o,i]=[[99,111,110,115,111,108,101],[108,111,103],[84,104,105,115,32,118,101,114,115,105,111,110,32,111,102,32,80,105,110,116,117,114,97,32,105,115,32,102,111,114,32,116,101,115,116,105,110,103,32,112,117,114,112,111,115,101,115,32,111,110,108,121,46,32,86,105,115,105,116,32,104,116,116,112,115,58,47,47,112,113,105,110,97,46,110,108,47,112,105,110,116,117,114,97,47,32,116,111,32,112,117,114,99,104,97,115,101,32,97,32,108,105,99,101,110,115,101,46,32,86,105,115,105,116,32,104,116,116,112,115,58,47,47,112,113,105,110,97,46,110,108,47,112,105,110,116,117,114,97,47,99,104,97,116,47,32,105,102,32,121,111,117,32,104,97,118,101,32,97,110,121,32,113,117,101,115,116,105,111,110,115,46]].map(e=>e.map(e=>String.fromCharCode(e)).join(""));e&&e[t]&&e[t][o](i)})(window);const dg=["klass","stores","isVisible","isActive","isActiveFraction","locale"],ug=["history","klass","stores","navButtons","pluginComponents","pluginInterface","pluginOptions","sub","imagePreviewSrc","imagePreview","imagePreviewCurrent"],pg=["locale"];let hg;const mg=new Set([]),gg={},$g=new Map,fg=(...e)=>{e.filter(e=>!!e.util).forEach(e=>{const[t,o,i=()=>!0]=e.util;$g.has(t)||($g.set(t,{Component:o,isSupported:i}),Id(o).filter(e=>!dg.includes(e)).forEach(e=>{mg.add(e),gg[e]?gg[e].push(t):gg[e]=[t]}))})};var yg=[...Ns,"init","update","undo","redo","revert","writehistory","destroy","show","hide","close","ready","zoom","pan","loadpreview","selectshape","blurshape","updateshape","addshape","removeshape","selectstyle","markuptap","markupzoom","markuppan","selectutil","selectcontrol","selectiondown","selectionup","selectionchange"];var bg=(e,t,o={})=>{const{prefix:i="pintura:"}=o;return yg.map(o=>e.on(o,e=>Yt(t)?((e,t,o)=>e.dispatchEvent(new CustomEvent(t,{detail:o,bubbles:!0,cancelable:!0})))(t,`${i}${o}`,e):t(o,e)))};const xg=e=>y(e[0]),vg=e=>!xg(e),Sg=e=>e[1],wg=e=>e[3]||[];const kg=(e,t,o,i=e=>e)=>{const n=Mg(t,o),r=n.findIndex(e=>Sg(e)===t);var a,s,l;a=n,s=i(r),l=e,a.splice(s,0,l)},Cg=(e,t)=>{const o=Mg(e,t);return Oh(o,t=>Sg(t)===e),o},Tg=(e,t)=>{if(t&&t.length){if(xg(t)){if(Sg(t)===e)return t;const o=Tg(e,wg(t));if(o)return o}if(vg(t))for(const o of t){const t=Tg(e,o);if(t)return t}}},Mg=(e,t)=>{if(vg(t)){if(t.find(t=>Sg(t)===e))return t;const o=t.find(t=>Mg(e,wg(t)));return o&&o[3]}return Mg(e,wg(t))},Pg=()=>[.75,.25,.25,0,0,.25,.75,.25,0,0,.25,.25,.75,0,0,0,0,0,1,0],Rg=()=>[1.398,-.316,.065,-.273,.201,-.051,1.278,-.08,-.273,.201,-.051,.119,1.151,-.29,.215,0,0,0,1,0],Ig=()=>[1.073,-.015,.092,-.115,-.017,.107,.859,.184,-.115,-.017,.015,.077,1.104,-.115,-.017,0,0,0,1,0],Eg=()=>[1.06,0,0,0,0,0,1.01,0,0,0,0,0,.93,0,0,0,0,0,1,0],Ag=()=>[1.1,0,0,0,-.1,0,1.1,0,0,-.1,0,0,1.2,0,-.1,0,0,0,1,0],Lg=()=>[.212,.715,.114,0,0,.212,.715,.114,0,0,.212,.715,.114,0,0,0,0,0,1,0],Fg=()=>[.15,1.3,-.25,.1,-.2,.15,1.3,-.25,.1,-.2,.15,1.3,-.25,.1,-.2,0,0,0,1,0],zg=()=>[.163,.518,.084,-.01,.208,.163,.529,.082,-.02,.21,.171,.529,.084,0,.214,0,0,0,1,0],Dg=()=>[.338,.991,.117,.093,-.196,.302,1.049,.096,.078,-.196,.286,1.016,.146,.101,-.196,0,0,0,1,0],Og=()=>[.393,.768,.188,0,0,.349,.685,.167,0,0,.272,.533,.13,0,0,0,0,0,1,0],Bg=()=>[.289,.62,.185,0,.077,.257,.566,.163,0,.115,.2,.43,.128,0,.188,0,0,0,1,0],Wg=()=>[.269,.764,.172,.05,.1,.239,.527,.152,0,.176,.186,.4,.119,0,.159,0,0,0,1,0],_g=()=>[.547,.764,.134,0,-.147,.281,.925,.12,0,-.135,.225,.558,.33,0,-.113,0,0,0,1,0],Vg={chrome:Rg,fade:Ig,pastel:Pg,cold:Ag,warm:Eg,monoDefault:Lg,monoWash:zg,monoNoir:Fg,monoStark:Dg,sepiaDefault:Og,sepiaRust:Wg,sepiaBlues:Bg,sepiaColor:_g};var Ng={filterFunctions:Vg,filterOptions:[["Default",[[void 0,e=>e.labelDefault]]],["Classic",[["chrome",e=>e.filterLabelChrome],["fade",e=>e.filterLabelFade],["cold",e=>e.filterLabelCold],["warm",e=>e.filterLabelWarm],["pastel",e=>e.filterLabelPastel]]],["Monochrome",[["monoDefault",e=>e.filterLabelMonoDefault],["monoNoir",e=>e.filterLabelMonoNoir],["monoStark",e=>e.filterLabelMonoStark],["monoWash",e=>e.filterLabelMonoWash]]],["Sepia",[["sepiaDefault",e=>e.filterLabelSepiaDefault],["sepiaRust",e=>e.filterLabelSepiaRust],["sepiaBlues",e=>e.filterLabelSepiaBlues],["sepiaColor",e=>e.filterLabelSepiaColor]]]]};const Hg={borderColor:"strokeColor",borderWidth:"strokeWidth",lineWidth:"strokeWidth",fontColor:"color",lineColor:"strokeColor",src:"backgroundImage",fit:"backgroundSize"},jg=e=>0===e||"0%"===e||"0px"===e?0:/px$/.test(e)?parseInt(e,10):/\%$/.test(e)?e:e<=1?100*e+"%":void 0,Ug=(e,t)=>{let o,i;return/%$/.test(e)?(o=parseFloat(e),i=parseFloat(t),`${o+i}%`):/px$/.test(e)?(o=parseInt(e,10),i=parseInt(t,10),`${o+i}px`):void 0},Gg=(e,t)=>{const o=e,i=t,n=1.5707963267948966-t,r=Math.sin(1.5707963267948966),a=Math.sin(i),s=Math.sin(n),l=Math.cos(n),c=o/r;return be(l*(c*a),l*(c*s))},Zg=(e,{flip:t,aspectRatio:o,rotation:i,center:n,zoom:r,scaleToFit:a})=>{const s={flipX:!1,flipY:!1},l=!n||n&&.5===n.x&&.5===n.y;t&&t.horizontal&&(s.flipX=t.horizontal),t&&t.vertical&&(s.flipY=t.vertical);const c=((e,t)=>null!=t?1/t:e.width/e.height)(e,o),d=!(!1===a),u=((e,t,o=1)=>{const i=e.height/e.width,n=t;let r=1,a=i;a>n&&(a=n,r=a/i);const s=Math.max(1/r,n/a),l=e.width/(o*s*r);return{width:l,height:l*t}})(e,o,r),p=l?e:((e,t)=>{const o=t.x>.5?1-t.x:t.x,i=t.y>.5?1-t.y:t.y;return Ze(2*o*e.width,2*i*e.height)})(e,d?n:{x:.5,y:.5}),h=((e,t)=>{let o=e.width,i=o*t;i>e.height&&(i=e.height,o=i/t);const n=.5*(e.width-o),r=.5*(e.height-i);return ht(n,r,o,i)})(e,o);if((o||!l||r)&&(s.crop=Pt(st(p),c)),"number"==typeof i&&null!==i&&0!==i){null!=i&&(s.rotation=i);const t=((e,t)=>{const o=e.width,i=e.height,n=Gg(o,t),r=Gg(i,t),a=be(e.x+Math.abs(n.x),e.y-Math.abs(n.y)),s=be(e.x+e.width+Math.abs(r.y),e.y+Math.abs(r.x)),l=be(e.x-Math.abs(r.y),e.y+e.height-Math.abs(r.x));return{width:De(a,s),height:De(a,l)}})(h,i),o=Math.max(t.width/p.width,t.height/p.height),r=be(n.x*e.width,n.y*e.height),a=Xt(e,i),l=qe(a),c=be(.5*(a.width-e.width),.5*(a.height-e.height)),d=kt({x:c.x+r.x-u.width/o*.5,y:c.y+r.y-u.height/o*.5,width:u.width/o,height:u.height/o},i),m=_e(d.map(ve),i,l.x,l.y),g=mt(dt(m)),$=_e(m.map(ve),-2*i,g.x,g.y);s.crop=dt($)}else null!=r&&$t(s.crop,1/r);return d||(s.cropLimitToImage=!1),s};let Xg=null;const Yg={base:0,min:-.25,max:.25,getLabel:e=>Cm(e/.25),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.brightness)return e.brightness[4]},setValue:(e,t)=>e.update(e=>({...e,brightness:[1,0,0,0,t,0,1,0,0,t,0,0,1,0,t,0,0,0,1,0]}))},qg={base:1,min:.5,max:1.5,getLabel:e=>Cm(2*(e-.5)-1),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.contrast)return e.contrast[0]},setValue:(e,t)=>e.update(e=>({...e,contrast:[t,0,0,0,.5*(1-t),0,t,0,0,.5*(1-t),0,0,t,0,.5*(1-t),0,0,0,1,0]}))},Kg={base:1,min:0,max:2,getLabel:e=>Cm(e-1),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.saturation)return(e.saturation[0]-.213)/.787},setValue:(e,t)=>e.update(e=>({...e,saturation:[.213+.787*t,.715-.715*t,.072-.072*t,0,0,.213-.213*t,.715+.285*t,.072-.072*t,0,0,.213-.213*t,.715-.715*t,.072+.928*t,0,0,0,0,0,1,0]}))},Jg={base:1,min:.5,max:1.5,getLabel:e=>Cm(2*(e-.5)-1),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.exposure)return e.exposure[0]},setValue:(e,t)=>e.update(e=>({...e,exposure:[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0]}))},Qg={base:1,min:.15,max:4,getLabel:e=>Cm(e<1?(e-.15)/.85-1:(e-1)/3),getStore:({imageGamma:e})=>e},e$={base:0,min:-1,max:1,getStore:({imageVignette:e})=>e},t$={base:0,min:-1,max:1,getStore:({imageConvolutionMatrix:e})=>e,getValue:e=>{if(e.clarity)return 0===e.clarity[0]?e.clarity[1]/-1:e.clarity[1]/-2},setValue:(e,t)=>{e.update(e=>({...e,clarity:t>=0?[0,-1*t,0,-1*t,1+4*t,-1*t,0,-1*t,0]:[-1*t,-2*t,-1*t,-2*t,1+-3*t,-2*t,-1*t,-2*t,-1*t]}))}},o$={base:0,min:-1,max:1,getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(!e.temperature)return;const t=e.temperature[0];return t>=1?(t-1)/.1:(1-t)/-.15},setValue:(e,t)=>e.update(e=>({...e,temperature:t>0?[1+.1*t,0,0,0,0,0,1,0,0,0,0,0,1+.1*-t,0,0,0,0,0,1,0]:[1+.15*t,0,0,0,0,0,1+.05*t,0,0,0,0,0,1+.15*-t,0,0,0,0,0,1,0]}))};var i$={finetuneControlConfiguration:{gamma:Qg,brightness:Yg,contrast:qg,saturation:Kg,exposure:Jg,temperature:o$,clarity:t$,vignette:e$},finetuneOptions:[["brightness",e=>e.finetuneLabelBrightness],["contrast",e=>e.finetuneLabelContrast],["saturation",e=>e.finetuneLabelSaturation],["exposure",e=>e.finetuneLabelExposure],["temperature",e=>e.finetuneLabelTemperature],["gamma",e=>e.finetuneLabelGamma],!od()&&["clarity",e=>e.finetuneLabelClarity],["vignette",e=>e.finetuneLabelVignette]].filter(Boolean)};const n$=(e,t="thumb")=>["div",t,{style:e,textContent:" "}],r$={shape:{frameColor:[1,1,1],frameStyle:"solid",frameSize:"2.5%"},thumb:'<rect stroke-width="5" x="0" y="0" width="100%" height="100%"/>'},a$={shape:{frameColor:[1,1,1],frameStyle:"solid",frameSize:"2.5%",frameRound:!0},thumb:'<rect stroke-width="5" x="0" y="0" width="100%" height="100%" rx="12%"/>'},s$={shape:{frameColor:[1,1,1],frameStyle:"line",frameInset:"2.5%",frameSize:".3125%",frameRadius:0},thumb:[n$("top:.5em;left:.5em;right:.5em;bottom:.5em;box-shadow:inset 0 0 0 1px currentColor")]},l$={shape:{frameColor:[1,1,1],frameStyle:"line",frameAmount:2,frameInset:"2.5%",frameSize:".3125%",frameOffset:"1.25%",frameRadius:0},thumb:[n$("top:.75em;left:.75em;right:.75em;bottom:.75em; outline: 3px double")]},c$={shape:{frameColor:[1,1,1],frameStyle:"edge",frameInset:"2.5%",frameOffset:"5%",frameSize:".3125%"},thumb:[n$("top:.75em;left:.5em;bottom:.75em;border-left:1px solid","a"),n$("top:.75em;right:.5em;bottom:.75em;border-right:1px solid","b"),n$("top:.5em;left:.75em;right:.75em;border-top:1px solid","c"),n$("bottom:.5em;left:.75em;right:.75em;border-bottom:1px solid","d")]},d$={shape:{frameColor:[1,1,1],frameStyle:"edge",frameInset:"2.5%",frameSize:".3125%"},thumb:[n$("top:-.5em;left:.5em;right:.5em;bottom:-.5em; box-shadow: inset 0 0 0 1px currentColor","a"),n$("top:.5em;left:-.5em;right:-.5em;bottom:.5em;box-shadow:inset 0 0 0 1px currentColor","b")]},u$={shape:{frameColor:[1,1,1],frameStyle:"edge",frameOffset:"1.5%",frameSize:".3125%"},thumb:[n$("top:.3125em;left:.5em;bottom:.3125em;border-left:1px solid","a"),n$("top:.3125em;right:.5em;bottom:.3125em;border-right:1px solid","b"),n$("top:.5em;left:.3125em;right:.3125em;border-top:1px solid","c"),n$("bottom:.5em;left:.3125em;right:.3125em;border-bottom:1px solid","d")]},p$={shape:{frameColor:[1,1,1],frameStyle:"hook",frameInset:"2.5%",frameSize:".3125%",frameLength:"5%"},thumb:[n$("top:.5em;left:.5em;width:.75em;height:.75em; border-left: 1px solid;border-top: 1px solid","a"),n$("top:.5em;right:.5em;width:.75em;height:.75em; border-right: 1px solid;border-top: 1px solid","b"),n$("bottom:.5em;left:.5em;width:.75em;height:.75em; border-left: 1px solid;border-bottom: 1px solid","c"),n$("bottom:.5em;right:.5em;width:.75em;height:.75em; border-right: 1px solid;border-bottom: 1px solid","d")]},h$={shape:{frameColor:[1,1,1],frameStyle:"polaroid"},thumb:'<rect stroke-width="20%" x="-5%" y="-5%" width="110%" height="96%"/>'};var m$={frameStyles:{solidSharp:r$,solidRound:a$,lineSingle:s$,lineMultiple:l$,edgeSeparate:c$,edgeCross:d$,edgeOverlap:u$,hook:p$,polaroid:h$},frameOptions:[[void 0,e=>e.labelNone],["solidSharp",e=>e.frameLabelMatSharp],["solidRound",e=>e.frameLabelMatRound],["lineSingle",e=>e.frameLabelLineSingle],["lineMultiple",e=>e.frameLabelLineMultiple],["edgeCross",e=>e.frameLabelEdgeCross],["edgeSeparate",e=>e.frameLabelEdgeSeparate],["edgeOverlap",e=>e.frameLabelEdgeOverlap],["hook",e=>e.frameLabelCornerHooks],["polaroid",e=>e.frameLabelPolaroid]]},g$=e=>e.charAt(0).toUpperCase()+e.slice(1);let $$=null;var f$=()=>{if(null===$$)if(m())try{$$=!1===document.fonts.check("16px TestNonExistingFont")}catch(e){$$=!1}else $$=!1;return $$};const y$=(e,t)=>o=>o[t?`${t}${g$(e)}`:e],b$=e=>[e,`${e}`],x$=(e,t)=>o=>[e[o],y$(o,t)],v$=e=>Array.isArray(e)&&e.every(No)?e.map(b$):e,S$=[1,.2549,.2118],w$="0.5%",k$=[1,1,1,0],C$={brush:["path",{bitmap:!0,drawMode:"add",strokeWidth:"5%",cursorStyle:"ellipse",cursorSize:"strokeWidth",disableStyle:["strokeColor"],settings:{strokeWidth:{control:"brushSize"}}}],lassoo:["path",{drawMode:"add",disableStyle:["strokeWidth","strokeColor"],strokeWidth:".25%",pathClose:!0}],polygon:["path",{drawMode:"add",disableStyle:["strokeWidth","strokeColor"],strokeWidth:".25%",pathClose:!0},{inputMode:"step"}],rectangle:["rectangle",{disableStyle:["backgroundColor","strokeWidth","strokeColor","cornerRadius"],drawMode:"add"}],ellipse:["ellipse",{disableStyle:["backgroundColor","strokeWidth","strokeColor"],drawMode:"add"}]},T$=["brush","lassoo","polygon","rectangle","ellipse"],M$=e=>{const{hideLabel:t=!0}=e||{};return df(["new","add","subtract"].map(e=>[e,y$(e,"shapeLabelSelectionMode"),{icon:y$(e,"shapeIconSelectionMode"),hideLabel:t}]),{title:e=>e.shapeTitleSelectionMode,layout:"radio"})},P$=e=>cf(e,{title:e=>e.shapeTitleBrushSize,layout:"radio",optionHideLabel:!0,optionIcon:(e,t)=>`<circle fill="currentColor" stroke-width=".05em" stroke="currentColor" fill-opacity=".25" cx="12" cy="12" r="${2+8*t}"/>`}),R$={eraser:()=>({eraseRadius:8,cursorStyle:"ellipse",cursorSize:"eraseRadius"}),path:()=>({points:[],disableAddPoints:!1}),line:()=>({x1:0,y1:0,x2:0,y2:0,disableErase:!1}),rectangle:()=>({x:0,y:0,width:0,height:0}),ellipse:()=>({x:0,y:0,rx:0,ry:0}),text:()=>({x:0,y:0,text:"Text",disableTextScale:!0})},I$=(e,t={},o)=>{if(!R$[e])return;const{position:i="relative",inputMode:n="drag",isSelection:r=!1,interpolateInput:a=!1}=o||{};return[{...R$[e](),...t},{position:i,inputMode:n,isSelection:r,interpolateInput:a}]},E$=e=>{const t={sharpie:I$("path",{bitmap:!0,strokeJoin:"round",strokeCap:"round",strokeWidth:w$,strokeColor:[...S$],cursorStyle:"ellipse",cursorSize:"strokeWidth",disableErase:!1,disableResize:!0,disableMove:!0},{interpolateInput:!0}),eraser:I$("eraser"),path:I$("path",{pathClose:void 0,strokeWidth:w$,strokeColor:[...S$],backgroundColor:[0,0,0,0]},{inputMode:"step"}),line:I$("line",{strokeColor:[...S$],strokeWidth:w$}),arrow:I$("line",{lineStart:"none",lineEnd:"arrow-solid",strokeColor:[...S$],strokeWidth:w$}),rectangle:I$("rectangle",{strokeColor:[...k$],backgroundColor:[...S$]}),ellipse:I$("ellipse",{strokeColor:[...k$],backgroundColor:[...S$]}),text:I$("text",{color:[...S$],fontSize:"2%"})};return e&&Object.entries(e).forEach(([e,o])=>{Array.isArray(o)?t[e]=o:I(o)&&t[e]&&(t[e]=[{...t[e][0],...o},t[e][1]])}),t},A$=(e,t,o)=>[e,t||y$(e,"shapeLabelTool"),{icon:y$(e,"shapeIconTool"),...o}],L$=(e=["move","view","sharpie","eraser","path","line","arrow","rectangle","ellipse","text","preset"])=>e.map(e=>y(e)?A$(e):Array.isArray(e)?I(e[1])?A$(e[0],void 0,e[1]):A$(e[0],e[1],e[2]):void 0).filter(Boolean),F$=()=>({transparent:[1,1,1,0],white:[1,1,1],silver:[.8667,.8667,.8667],gray:[.6667,.6667,.6667],black:[0,0,0],navy:[0,.1216,.2471],blue:[0,.4549,.851],aqua:[.498,.8588,1],teal:[.2235,.8,.8],olive:[.2392,.6,.4392],green:[.1804,.8,.251],yellow:[1,.8627,0],orange:[1,.5216,.1059],red:[1,.2549,.2118],maroon:[.5216,.0784,.2941],fuchsia:[.9412,.0706,.7451],purple:[.6941,.051,.7882]}),z$=()=>[16,18,20,24,30,36,48,64,72,96,128,144],D$=z$,O$=()=>({extraSmall:"2%",small:"4%",mediumSmall:"8%",medium:"10%",mediumLarge:"15%",large:"20%",extraLarge:"25%"}),B$=()=>({extraSmall:"40%",small:"60%",mediumSmall:"100%",medium:"120%",mediumLarge:"140%",large:"180%",extraLarge:"220%"}),W$=()=>({extraSmall:"0.25%",small:"0.5%",mediumSmall:"1%",medium:"1.75%",mediumLarge:"2.5%",large:"3.5%",extraLarge:"5%"}),_$=()=>["bar","arrow","arrowSolid","circle","circleSolid","square","squareSolid"],V$=()=>[["Helvetica, Arial, Verdana, 'Droid Sans', sans-serif","Sans Serif"],["'Arial Black', 'Avenir-Black', 'Arial Bold'","Black"],["'Arial Narrow', 'Futura-CondensedMedium'","Narrow"],["'Trebuchet MS'","Humanist"],["Georgia, 'Avenir-Black', 'Times New Roman', 'Droid Serif', serif","Serif"],["Palatino","Old-Style"],["'Times New Roman', 'TimesNewRomanPSMT'","Transitional"],["Menlo, Monaco, 'Lucida Console', monospace","Monospaced"],["'Courier New', monospace","Slab Serif"]],N$=()=>["left","center","right"],H$=()=>[["normal","bold"],["italic","normal"],["italic","bold"]],j$=e=>Object.keys(e).map(x$(e,"shapeTitleColor")),U$=e=>Object.keys(e).map(x$(e,"labelSize")),G$=e=>Object.keys(e).map(x$(e,"labelSize")),Z$=e=>Object.keys(e).map(x$(e,"labelSize")),X$=e=>[...e],Y$=e=>e.map(e=>[e,t=>t[`shapeLabelFontStyle${e.filter(e=>"normal"!==e).map(g$).join("")}`]]),q$=e=>e.map(e=>[um(e),t=>t[`shapeTitleLineDecoration${g$(e)}`],{icon:t=>t[`shapeIconLineDecoration${g$(e)}`]}]),K$=(e,t)=>{const{defaultKey:o,defaultValue:i,defaultOptions:n}=t||{},r=[];return o&&(r[0]=[i,e=>e[o],{...n}]),[...r,...e]},J$=e=>e.split(",").map(e=>e.trim()).some(e=>document.fonts.check(`16px ${e}`)),Q$=(e={})=>["ToggleSlider",{...e}],ef="PinturaFontTest",tf=(e,t={defaultKey:"labelDefault"})=>["Dropdown",{title:e=>e.shapeTitleFontFamily,onload:({options:e=[]})=>{f$()&&e.map(([e])=>e).filter(Boolean).filter(e=>!J$(e)).forEach(e=>{const t=`${ef}-${e.replace(/[^a-zA-Z0-9]+/g,"").toLowerCase()}`;document.getElementById(t)||document.body.append(x("span",{textContent:" ",id:t,class:ef,style:`font-family:${e};font-size:0;color:transparent;`}))})},ondestroy:()=>{if(!f$())return;document.querySelectorAll(".PinturaFontTest").forEach(e=>e.remove())},optionLabelStyle:e=>`font-family: ${e}`,options:K$(e,t),optionFilter:e=>{if(!f$())return!0;const[t]=e;if(!t)return!0;return J$(t)}}],of=(e,t={})=>["ColorPicker",{options:K$(e),...t}],nf=(e,t={})=>of(e,{title:e=>e.labelColor,...t}),rf=e=>(t,o={})=>of(t,{title:t=>t[e],...o}),af=rf("shapeTitleBackgroundColor"),sf=rf("shapeTitleTextColor"),lf=(e,t={})=>of(e,{title:e=>e.shapeTitleStrokeColor,options:K$(e),buttonClass:"PinturaColorPickerButtonStroke",onchange:(e,o)=>{const i=o.strokeWidth;(No(i)||y(i)?parseFloat(i):0)>0||(o.strokeWidth=t&&t.defaultStrokeWidth||"0.5%")},...t}),cf=(e,t)=>{const{title:o,optionHideLabel:i=!1,layout:n,optionIcon:r=!1}=t||{},a=v$(e),s=e.map(([e])=>y(e)?parseFloat(e):e),l=Math.max(...s),c=Math.min(...s),d=l-c;return["radio"===n?"RadioGroup":"Dropdown",{title:!1===o?void 0:o||(e=>e.shapeTitleStrokeWidth),options:e=>{const o=t?a.map(e=>{const[t,o,n={}]=e,a=y(t)?parseFloat(t):t,s=(a-c)/d;let l;return"line"===r?l=`<path stroke="currentColor" stroke-linecap="square" stroke-width="${.1+.875*s}em" d="M3,12 H20"/>`:"dot"===r?l=`<circle fill="currentColor" cx="12" cy="12" r="${2+8*s}"/>`:y(r)?l=r:L(r)&&(l=r(a,s)),[t,o,{icon:l,hideLabel:i,...n}]}):a;return jo(e,"backgroundColor")?K$(o,{defaultKey:"shapeLabelStrokeNone"}):K$(o)},onchange:(e,t)=>{if(!e)return;const o=t.strokeColor||[];if(o[3])return;const i=[...o];i[3]=1,t.strokeColor=i}}]},df=(e,t)=>{const{title:o,layout:i}=t||{};return["radio"===i?"RadioGroup":"Dropdown",{title:o,options:K$(e)}]},uf=(e,t,o)=>["Dropdown",{title:e=>e[t],options:K$(e,{defaultKey:"labelNone",defaultOptions:{icon:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H14"/></g>'}}),optionIconStyle:o}],pf=e=>uf(e,"shapeTitleLineStart","transform: scaleX(-1)"),hf=e=>uf(e,"shapeTitleLineEnd"),mf=e=>["Dropdown",{title:e=>e.shapeTitleFontStyle,optionLabelStyle:e=>e&&`font-style:${e[0]};font-weight:${e[1]}`,options:K$(e,{defaultKey:"shapeLabelFontStyleNormal"})}],gf=e=>["ShorthandControl",e];function $f(e){const t=function(e){let t=1,o=0;for(;Math.round(e*t)/t!==e&&(t*=10,o++,!(o>10)););return o}(y(e)?parseFloat(e):e);return t<4}const ff=(e,t,o,i)=>{i||e.find(([e])=>e===o)||(i={defaultKey:"labelAuto",defaultValue:o});const n=v$(e),r=n.some(([e])=>y(e)&&e.endsWith("%"));return["Dropdown",{title:t,options:K$(n,i),formatValue:e=>$f(e)?r?`${parseFloat(e)}%`:e:No(e)&&!r?Math.floor(e):`${Math.floor(parseFloat(e))}%`,...i}]},yf=(e,t)=>ff(e,e=>e.shapeTitleFontSize,"4%",t),bf=(e,t)=>ff(e,e=>e.shapeTitleLineHeight,"120%",t),xf=e=>["RadioGroup",{title:e=>e.shapeTitleTextAlign,options:K$(e)}],vf={colorOptions:()=>j$({transparent:[1,1,1,0],white:[1,1,1],silver:[.8667,.8667,.8667],gray:[.6667,.6667,.6667],black:[0,0,0],navy:[0,.1216,.2471],blue:[0,.4549,.851],aqua:[.498,.8588,1],teal:[.2235,.8,.8],olive:[.2392,.6,.4392],green:[.1804,.8,.251],yellow:[1,.8627,0],orange:[1,.5216,.1059],red:[1,.2549,.2118],maroon:[.5216,.0784,.2941],fuchsia:[.9412,.0706,.7451],purple:[.6941,.051,.7882]}),lineEndStyleOptions:()=>q$(["bar","arrow","arrowSolid","circle","circleSolid","square","squareSolid"]),fontFamilyOptions:()=>X$([["Helvetica, Arial, Verdana, 'Droid Sans', sans-serif","Sans Serif"],["'Arial Black', 'Avenir-Black', 'Arial Bold'","Black"],["'Arial Narrow', 'Futura-CondensedMedium'","Narrow"],["'Trebuchet MS'","Humanist"],["Georgia, 'Avenir-Black', 'Times New Roman', 'Droid Serif', serif","Serif"],["Palatino","Old-Style"],["'Times New Roman', 'TimesNewRomanPSMT'","Transitional"],["Menlo, Monaco, 'Lucida Console', monospace","Monospaced"],["'Courier New', monospace","Slab Serif"]]),fontStyleOptions:()=>Y$([["normal","bold"],["italic","normal"],["italic","bold"]]),textAlignOptions:()=>["left","center","right"].map(e=>[e,t=>t[`shapeTitleTextAlign${g$(e)}`],{hideLabel:!0,icon:t=>t[`shapeIconTextAlign${g$(e)}`]}]),strokeWidthOptions:()=>Z$({extraSmall:"0.25%",small:"0.5%",mediumSmall:"1%",medium:"1.75%",mediumLarge:"2.5%",large:"3.5%",extraLarge:"5%"}),brushSizeOptions:()=>Z$(Object.entries({extraSmall:"0.25%",small:"0.5%",mediumSmall:"1%",medium:"1.75%",mediumLarge:"2.5%",large:"3.5%",extraLarge:"5%"}).reduce((e,[t,o])=>(e[t]=2*parseFloat(o)+"%",e),{})),fontSizeOptions:()=>U$({extraSmall:"2%",small:"4%",mediumSmall:"8%",medium:"10%",mediumLarge:"15%",large:"20%",extraLarge:"25%"}),lineHeightOptions:()=>G$({extraSmall:"40%",small:"60%",mediumSmall:"100%",medium:"120%",mediumLarge:"140%",large:"180%",extraLarge:"220%"})},Sf=new Intl.NumberFormat("default",{minimumFractionDigits:1,maximumFractionDigits:1}),wf=(e,t)=>y(t)?`${e}%`:e,kf=(e,t,o,i)=>y(i)?`${Math.round(e/o*100)}%`:`${Sf.format(e)}`,Cf={getValue:e=>parseFloat(e),setValue:wf,label:kf,step:.05,labelClass:"PinturaPercentageLabel"},Tf={factory:gf,options:{title:"Text shadow",controls:[["ToggleSlider","x",{...Cf,min:-100,max:100,labelPrefix:"X"}],["ToggleSlider","y",{...Cf,min:-100,max:100,labelPrefix:"Y"}],["ToggleSlider","blur",{...Cf,min:0,max:25,labelPrefix:e=>e.shapeTitleTextShadowBlur}],["ColorPicker","color",{enablePresets:!1}]]}},Mf={defaultColor:{factory:nf,items:"colorOptions"},defaultNumber:{factory:Q$},defaultPercentage:{factory:Q$,options:{getValue:e=>parseFloat(e),setValue:e=>`${e}%`,step:.05,label:(e,t,o)=>`${Math.round(e/o*100)}%`,labelClass:"PinturaPercentageLabel"}},backgroundColor:{items:"colorOptions",factory:af},strokeColor:{items:"colorOptions",factory:lf},strokeWidth:{items:"strokeWidthOptions",factory:cf},brushSize:{items:"brushSizeOptions",factory:P$},drawMode:{factory:M$},lineStart:{items:"lineEndStyleOptions",factory:pf},lineEnd:{items:"lineEndStyleOptions",factory:hf},color:{items:"colorOptions",factory:sf},fontFamily:{items:"fontFamilyOptions",factory:tf},fontStyle_fontWeight:{items:"fontStyleOptions",factory:mf},fontSize:{items:"fontSizeOptions",factory:yf},lineHeight:{items:"lineHeightOptions",factory:bf},textAlign:{items:"textAlignOptions",factory:xf},textShadowX_textShadowY_textShadowBlur_textShadowColor:Tf,textOutlineWidth_textOutlineColor:{factory:gf,options:{title:"Text outline",controls:[["ToggleSlider","width",{getValue:e=>parseFloat(e),setValue:wf,label:kf,min:0,max:15,step:.05,labelClass:"PinturaPercentageLabel",labelPrefix:e=>e.shapeTitleTextOutlineWidth}],["ColorPicker","color",{enablePresets:!1}]]}},cornerRadius:{factory:"defaultPercentage",options:{min:0,max:50,title:e=>e.shapeTitleCornerRadius}},frameColor:{factory:"defaultColor"},frameSize:{factory:"defaultPercentage",options:{min:.2,max:10,title:e=>e.labelSize}},frameInset:{factory:"defaultPercentage",options:{min:.5,max:10,title:e=>e.labelOffset}},frameOffset:{factory:"defaultPercentage",options:{min:.5,max:10,title:e=>e.labelOffset}},frameRadius:{factory:"defaultPercentage",options:{min:.5,max:10,title:e=>e.labelRadius}},frameAmount:{factory:"defaultNumber",options:{min:1,max:5,step:1,title:e=>e.labelAmount}}},Pf=(e={})=>{const t={...Mf,...e},o={};return Object.entries(t).forEach(([e,i])=>{if(!/Options$/.test(e))if(Mf[e]&&I(i)&&!Uo(i)){const{component:i,factory:n,items:r,options:a={}}=t[e];if(y(n))o[e]=[n,a];else{const s=Mf[e].items;let l=y(s)?t[s]||vf[s]():void 0;y(r)&&vf[r]?l=t[r]?t[r].every(e=>!Array.isArray(e))?t[r].map(e=>[e,e]):t[r]:vf[r]():(r||a.items)&&(l=r||a.items);let c=n||Mf[e].factory;L(c)?o[e]=l?c(l,a):c(a):i&&(o[e]=[i,{...a,items:r}])}}else o[e]=i}),o};function Rf(e){let t,o,i,n,r;const a=e[7].default,s=kr(a,e,e[6],null);return{c(){t=Ur("div"),o=Ur("div"),s&&s.c(),Qr(o,"class","PinturaToolbarInner"),Qr(t,"class","PinturaToolbar"),Qr(t,"data-layout",e[1]),Qr(t,"data-overflow",e[0])},m(a,l){Hr(a,t,l),_r(t,o),s&&s.m(o,null),i=!0,n||(r=[qr(o,"measure",e[3]),Ar(qc.call(null,o)),qr(t,"measure",e[2]),Ar(qc.call(null,t))],n=!0)},p(e,[o]){s&&s.p&&(!i||64&o)&&Mr(s,a,e,e[6],i?Tr(a,e[6],o,null):Pr(e[6]),null),(!i||2&o)&&Qr(t,"data-layout",e[1]),(!i||1&o)&&Qr(t,"data-overflow",e[0])},i(e){i||(ja(s,e),i=!0)},o(e){Ua(s,e),i=!1},d(e){e&&jr(t),s&&s.d(e),n=!1,$r(r)}}}function If(e,t,o){let i,n,{$$slots:r={},$$scope:a}=t,s=0,l=0,c=0;const d=()=>{o(0,n="compact"===i&&s>c?"overflow":void 0)};return e.$$set=e=>{"$$scope"in e&&o(6,a=e.$$scope)},e.$$.update=()=>{48&e.$$.dirty&&o(1,i=l>c?"compact":"default")},[n,i,({detail:e})=>{const{width:t}=e;o(5,c=t),d()},({detail:e})=>{const{width:t}=e;t>l&&o(4,l=t),s=t,n||d()},l,c,a,r]}class Ef extends rs{constructor(e){super(),ns(this,e,If,Rf,yr,{})}}function Af(e){let t,o,i,n;const r=e[5].default,a=kr(r,e,e[4],null);return{c(){t=Ur("div"),a&&a.c(),Qr(t,"class",e[0])},m(r,s){Hr(r,t,s),a&&a.m(t,null),o=!0,i||(n=[qr(t,"measure",function(){fr(e[1]&&e[3])&&(e[1]&&e[3]).apply(this,arguments)}),Ar(e[2].call(null,t))],i=!0)},p(i,[n]){e=i,a&&a.p&&(!o||16&n)&&Mr(a,r,e,e[4],o?Tr(r,e[4],n,null):Pr(e[4]),null),(!o||1&n)&&Qr(t,"class",e[0])},i(e){o||(ja(a,e),o=!0)},o(e){Ua(a,e),o=!1},d(e){e&&jr(t),a&&a.d(e),i=!1,$r(n)}}}function Lf(e,t,o){let{$$slots:i={},$$scope:n}=t;const r=xa();let{class:a=null}=t;const s=Sa("measurable");let l=!1;return fa(()=>o(1,l=!0)),e.$$set=e=>{"class"in e&&o(0,a=e.class),"$$scope"in e&&o(4,n=e.$$scope)},[a,l,s,({detail:e})=>r("measure",e),n,i]}class Ff extends rs{constructor(e){super(),ns(this,e,Lf,Af,yr,{class:0})}}const zf=e=>({}),Df=e=>({}),Of=e=>({}),Bf=e=>({}),Wf=e=>({}),_f=e=>({});function Vf(e){let t,o;const i=e[4].header,n=kr(i,e,e[3],_f);return{c(){t=Ur("div"),n&&n.c(),Qr(t,"class","PinturaUtilHeader")},m(e,i){Hr(e,t,i),n&&n.m(t,null),o=!0},p(e,t){n&&n.p&&(!o||8&t)&&Mr(n,i,e,e[3],o?Tr(i,e[3],t,Wf):Pr(e[3]),_f)},i(e){o||(ja(n,e),o=!0)},o(e){Ua(n,e),o=!1},d(e){e&&jr(t),n&&n.d(e)}}}function Nf(e){let t,o;const i=e[4].footer,n=kr(i,e,e[3],Df);return{c(){t=Ur("div"),n&&n.c(),Qr(t,"class","PinturaUtilFooter")},m(e,i){Hr(e,t,i),n&&n.m(t,null),o=!0},p(e,t){n&&n.p&&(!o||8&t)&&Mr(n,i,e,e[3],o?Tr(i,e[3],t,zf):Pr(e[3]),Df)},i(e){o||(ja(n,e),o=!0)},o(e){Ua(n,e),o=!1},d(e){e&&jr(t),n&&n.d(e)}}}function Hf(e){let t,o,i,n,r,a,s=e[1]&&Vf(e);const l=e[4].main,c=kr(l,e,e[3],Bf),d=c||function(e){let t,o;return t=new Ff({props:{class:"PinturaStage"}}),t.$on("measure",e[5]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p:ur,i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}(e);let u=e[2]&&Nf(e),p=!1;return{c(){s&&s.c(),t=Xr(),o=Ur("div"),d&&d.c(),i=Xr(),u&&u.c(),n=Xr(),r=Yr(),Qr(o,"class","PinturaUtilMain")},m(l,c){s&&s.m(l,c),Hr(l,t,c),Hr(l,o,c),d&&d.m(o,null),e[6](o),Hr(l,i,c),u&&u.m(l,c),Hr(l,n,c),Hr(l,r,c),a=!0},p(e,[o]){e[1]?s?(s.p(e,o),2&o&&ja(s,1)):(s=Vf(e),s.c(),ja(s,1),s.m(t.parentNode,t)):s&&(Na(),Ua(s,1,1,()=>{s=null}),Ha()),c&&c.p&&(!a||8&o)&&Mr(c,l,e,e[3],a?Tr(l,e[3],o,Of):Pr(e[3]),Bf),e[2]?u?(u.p(e,o),4&o&&ja(u,1)):(u=Nf(e),u.c(),ja(u,1),u.m(n.parentNode,n)):u&&(Na(),Ua(u,1,1,()=>{u=null}),Ha())},i(e){a||(ja(s),ja(d,e),ja(u),ja(p),a=!0)},o(e){Ua(s),Ua(d,e),Ua(u),Ua(p),a=!1},d(a){a&&(jr(t),jr(o),jr(i),jr(n),jr(r)),s&&s.d(a),d&&d.d(a),e[6](null),u&&u.d(a)}}}function jf(e,t,o){let{$$slots:i={},$$scope:n}=t,{hasHeader:r=!!t.$$slots.header}=t,{hasFooter:a=!!t.$$slots.footer}=t,{root:s}=t;return e.$$set=e=>{o(7,t=hr(hr({},t),Rr(e))),"hasHeader"in e&&o(1,r=e.hasHeader),"hasFooter"in e&&o(2,a=e.hasFooter),"root"in e&&o(0,s=e.root),"$$scope"in e&&o(3,n=e.$$scope)},t=Rr(t),[s,r,a,n,i,function(t){wa.call(this,e,t)},function(e){Ca[e?"unshift":"push"](()=>{s=e,o(0,s)})}]}class Uf extends rs{constructor(e){super(),ns(this,e,jf,Hf,yr,{hasHeader:1,hasFooter:2,root:0})}}function Gf(e){let t;return{c(){t=Ur("div"),Qr(t,"class","PinturaRangeInputMeter"),aa(t,"transform",`translateX(${e[10].x-e[13].x}px) translateY(${e[10].y-e[13].y}px)`)},m(o,i){Hr(o,t,i),t.innerHTML=e[7]},p(e,o){128&o[0]&&(t.innerHTML=e[7]),1024&o[0]&&aa(t,"transform",`translateX(${e[10].x-e[13].x}px) translateY(${e[10].y-e[13].y}px)`)},d(e){e&&jr(t)}}}function Zf(e){let t,o,i,n,r,a,s,l,c,d,u,p=e[10]&&Gf(e);return{c(){t=Ur("div"),o=Ur("span"),i=Xr(),n=Ur("button"),r=Zr(e[1]),s=Xr(),l=Ur("div"),p&&p.c(),Qr(o,"class","PinturaRangeInputValue"),Qr(n,"class","PinturaRangeInputReset"),Qr(n,"type","button"),n.disabled=a=e[0]===e[2],Qr(l,"class","PinturaRangeInputInner"),Qr(l,"data-value-limited",e[5]),aa(l,"--range-mask-from",e[9]),aa(l,"--range-mask-to",e[8]),Qr(t,"class","PinturaRangeInput"),Qr(t,"tabindex","0")},m(a,h){Hr(a,t,h),_r(t,o),o.innerHTML=e[3],_r(t,i),_r(t,n),_r(n,r),_r(t,s),_r(t,l),p&&p.m(l,null),d||(u=[qr(n,"click",e[18]),qr(l,"interactionstart",e[14]),qr(l,"interactionupdate",e[16]),qr(l,"interactionend",e[17]),qr(l,"interactionrelease",e[15]),Ar(c=Wh.call(null,l,{inertia:e[6]})),qr(l,"measure",e[39]),Ar(qc.call(null,l)),qr(t,"wheel",e[20],{passive:!1}),qr(t,"nudge",e[21]),Ar(xp.call(null,t,{direction:"horizontal",preventDefault:!0}))],d=!0)},p(e,t){8&t[0]&&(o.innerHTML=e[3]),2&t[0]&&na(r,e[1]),5&t[0]&&a!==(a=e[0]===e[2])&&(n.disabled=a),e[10]?p?p.p(e,t):(p=Gf(e),p.c(),p.m(l,null)):p&&(p.d(1),p=null),32&t[0]&&Qr(l,"data-value-limited",e[5]),c&&fr(c.update)&&64&t[0]&&c.update.call(null,{inertia:e[6]}),512&t[0]&&aa(l,"--range-mask-from",e[9]),256&t[0]&&aa(l,"--range-mask-to",e[8])},i:ur,o:ur,d(e){e&&jr(t),p&&p.d(),d=!1,$r(u)}}}function Xf(e,t,i){let n,r,a,s,l,c,d,u,p,h,m,g,{labelReset:$="Reset"}=t,{direction:f="x"}=t,{min:y=0}=t,{max:b=1}=t,{base:x=y}=t,{value:v=0}=t,{valueLabel:S=0}=t,{valueMin:w}=t,{valueMax:k}=t,{oninputstart:C=o}=t,{oninputmove:T=o}=t,{oninputend:M=o}=t,{elasticity:P=0}=t,{nudgeMultiplier:R}=t,{step:I=8}=t;const E=Sa("isAnimated");wr(e,E,e=>i(6,h=e));const A=Sa("fixScrollDirection");wr(e,A,e=>i(45,m=e));const L=(e,t,o)=>Math.ceil((e-o)/t)*t+o;let F,z,D;const O={x:2,y:0},B=(e,t,o)=>`M ${e-o} ${t} a ${o} ${o} 0 1 0 0 -1`;let W,_,V=!1,N={snap:!1,elastic:!1};const H=(e,t,o)=>{const i=e[f]+t[f],n=Rs(i,_[1][f],_[0][f]),r=P?n+_h(i-n,P):n,a=o.elastic?r:n,s=be(0,0);return s[f]=a,j.set(s,{hard:o.snap}),Rs(G(s,f),y,b)},j=Fc();wr(e,j,e=>i(10,g=e));const U=(e,t)=>{const o=.5*(F[t]-s[t])-(vp(e,y,b)*s[t]-.5*s[t]);return{x:"x"===t?o:0,y:"y"===t?o:0}},G=(e,t)=>{const o=-(e[t]-.5*F[t])/s[t];return y+o*n},Z=j.subscribe(e=>{e&&W&&T(Rs(G(e,f),y,b))}),X=e=>{const t=[U(null!=w?w:y,f),U(null!=k?k:b,f)],o={x:"x"===f?g.x+e:0,y:"y"===f?g.y+e:0},i=Rs(o[f],t[1][f],t[0][f]),n={...g,[f]:i};Er(j,g=n,g);const r=Rs(G(n,f),y,b);C(),T(r),M(r)};ba(()=>{Z()});return e.$$set=e=>{"labelReset"in e&&i(1,$=e.labelReset),"direction"in e&&i(22,f=e.direction),"min"in e&&i(23,y=e.min),"max"in e&&i(24,b=e.max),"base"in e&&i(2,x=e.base),"value"in e&&i(0,v=e.value),"valueLabel"in e&&i(3,S=e.valueLabel),"valueMin"in e&&i(25,w=e.valueMin),"valueMax"in e&&i(26,k=e.valueMax),"oninputstart"in e&&i(27,C=e.oninputstart),"oninputmove"in e&&i(28,T=e.oninputmove),"oninputend"in e&&i(29,M=e.oninputend),"elasticity"in e&&i(30,P=e.elasticity),"nudgeMultiplier"in e&&i(31,R=e.nudgeMultiplier),"step"in e&&i(32,I=e.step)},e.$$.update=()=>{if(25165824&e.$$.dirty[0]&&i(34,n=b-y),41943040&e.$$.dirty[0]&&i(36,r=null!=w?Math.max(w,y):y),83886080&e.$$.dirty[0]&&i(35,a=null!=k?Math.min(k,b):b),25165828&e.$$.dirty[0]&&i(38,l=vp(x,y,b)),16&e.$$.dirty[0]|128&e.$$.dirty[1]&&F){const e=.5*F.y;let t,o=40*l,n="",r=F.y,a="";for(let i=0;i<=40;i++){const r=O.x+10*i,s=e;n+=B(r,s,i%5==0?2:.75)+" ",t=r+O.x,i===o&&(a=`<path d="M${r} ${s-4} l2 3 l-2 -1 l-2 1 z"/>`)}i(7,z=`<svg width="${t}" height="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${t} ${r}" aria-hidden="true" focusable="false">\n ${a}\n <rect rx="4" ry="4" y="${e-4}"" height="8"/>\n <path fill-rule="evenodd" d="${n.trim()}"/></svg>`),i(33,D={x:t-2*O.x,y:r})}16&e.$$.dirty[0]|4&e.$$.dirty[1]&&(s=F&&D),25165824&e.$$.dirty[0]|48&e.$$.dirty[1]&&i(5,c=r!==y||a!==b),32&e.$$.dirty[0]|48&e.$$.dirty[1]&&i(37,d=c?function(e,t){const o=1/40,i=vp(e,y,b),n=vp(t,y,b);return[100*ge(L(i,o,0)-.0125)+"%",100*ge(L(n,o,0)-.0125)+"%"]}(r,a):void 0),64&e.$$.dirty[1]&&i(9,u=d?d[0]:""),64&e.$$.dirty[1]&&i(8,p=d?d[1]:""),4194385&e.$$.dirty[0]|8&e.$$.dirty[1]&&n&&F&&F.x&&F.y&&j.set(U(v,f),{hard:!1===h})},[v,$,x,S,F,c,h,z,p,u,g,E,A,O,()=>{V=!1,W=Sr(j),_=[U(null!=w?w:y,f),U(null!=k?k:b,f)],C()},()=>{V=!0},({detail:e})=>{N.snap=!V,N.elastic=!V,H(W,e.translation,N)},({detail:e})=>{N.snap=!1,N.elastic=!1;const t=H(W,e.translation,N);if(W=void 0,_=void 0,Math.abs(t-x)<.01)return M(x);M(t)},()=>{i(0,v=Rs(x,r,a)),C(),M(v)},j,e=>{e.preventDefault(),e.stopPropagation();const t=Sp(e,{fixScrollDirection:m})*I;X(t)},({detail:e})=>{X(e[f]*Math.abs(R||8))},f,y,b,w,k,C,T,M,P,R,I,D,n,a,r,d,l,e=>i(4,F=(e=>be(e.width,e.height))(e.detail))]}class Yf extends rs{constructor(e){super(),ns(this,e,Xf,Zf,yr,{labelReset:1,direction:22,min:23,max:24,base:2,value:0,valueLabel:3,valueMin:25,valueMax:26,oninputstart:27,oninputmove:28,oninputend:29,elasticity:30,nudgeMultiplier:31,step:32},null,[-1,-1])}}var qf={[ae]:e=>({x:e.x,y:e.y}),[ue]:e=>({x:e.x+e.width,y:e.y}),[se]:e=>({x:e.x+e.width,y:e.y}),[pe]:e=>({x:e.x+e.width,y:e.y+e.height}),[le]:e=>({x:e.x,y:e.y+e.height}),[he]:e=>({x:e.x,y:e.y+e.height}),[ce]:e=>({x:e.x,y:e.y}),[de]:e=>({x:e.x,y:e.y})};const Kf={t:"top",r:"right",b:"bottom",l:"left"},Jf="horizontal",Qf="vertical",ey={t:Qf,b:Qf,r:Jf,l:Jf};function ty(e,t,o){const i=e.slice();return i[15]=t[o].key,i[16]=t[o].translate,i[17]=t[o].scale,i[18]=t[o].type,i[19]=t[o].opacity,i[20]=t[o].role,i[21]=t[o].tabindex,i[22]=t[o].label,i[23]=t[o].orientation,i[24]=t[o].valuemin,i[25]=t[o].valuemax,i[26]=t[o].valuenow,i}function oy(e,t){let o,i,n,r,a,s,l,c,d,u,p,h;return{key:e,first:null,c(){o=Ur("div"),Qr(o,"role",i=t[20]),Qr(o,"tabindex",n=t[21]),Qr(o,"aria-label",r=t[22]),Qr(o,"aria-orientation",a=t[23]),Qr(o,"aria-valuemin",s=t[24]),Qr(o,"aria-valuemax",l=t[25]),Qr(o,"aria-valuenow",c=t[26]),Qr(o,"class","PinturaRectManipulator"),Qr(o,"data-direction",d=t[15]),Qr(o,"data-shape",u=""+("edge"===t[18]?"edge":`${t[0]}`)),aa(o,"--tx",t[16].x),aa(o,"--ty",t[16].y),aa(o,"--sx",t[17].x),aa(o,"--sy",t[17].y),aa(o,"opacity",t[19]),this.first=o},m(e,i){Hr(e,o,i),p||(h=[qr(o,"nudge",function(){fr(t[6](t[15]))&&t[6](t[15]).apply(this,arguments)}),Ar(xp.call(null,o,{preventDefault:!0})),qr(o,"interactionstart",function(){fr(t[5]("resizestart",t[15]))&&t[5]("resizestart",t[15]).apply(this,arguments)}),qr(o,"interactionupdate",function(){fr(t[5]("resizemove",t[15]))&&t[5]("resizemove",t[15]).apply(this,arguments)}),qr(o,"interactionend",function(){fr(t[5]("resizeend",t[15]))&&t[5]("resizeend",t[15]).apply(this,arguments)}),Ar(Wh.call(null,o))],p=!0)},p(e,p){t=e,2&p&&i!==(i=t[20])&&Qr(o,"role",i),2&p&&n!==(n=t[21])&&Qr(o,"tabindex",n),2&p&&r!==(r=t[22])&&Qr(o,"aria-label",r),2&p&&a!==(a=t[23])&&Qr(o,"aria-orientation",a),2&p&&s!==(s=t[24])&&Qr(o,"aria-valuemin",s),2&p&&l!==(l=t[25])&&Qr(o,"aria-valuemax",l),2&p&&c!==(c=t[26])&&Qr(o,"aria-valuenow",c),2&p&&d!==(d=t[15])&&Qr(o,"data-direction",d),3&p&&u!==(u=""+("edge"===t[18]?"edge":`${t[0]}`))&&Qr(o,"data-shape",u),2&p&&aa(o,"--tx",t[16].x),2&p&&aa(o,"--ty",t[16].y),2&p&&aa(o,"--sx",t[17].x),2&p&&aa(o,"--sy",t[17].y),2&p&&aa(o,"opacity",t[19])},d(e){e&&jr(o),p=!1,$r(h)}}}function iy(e){let t,o=[],i=new Map,n=Xa(e[1]);const r=e=>e[15];for(let t=0;t<n.length;t+=1){let a=ty(e,n,t),s=r(a);i.set(s,o[t]=oy(s,a))}return{c(){for(let e=0;e<o.length;e+=1)o[e].c();t=Yr()},m(e,i){for(let t=0;t<o.length;t+=1)o[t]&&o[t].m(e,i);Hr(e,t,i)},p(e,[a]){99&a&&(n=Xa(e[1]),o=Ka(o,a,r,1,e,n,i,t.parentNode,Ya,oy,t,ty))},i:ur,o:ur,d(e){e&&jr(t);for(let t=0;t<o.length;t+=1)o[t].d(e)}}}function ny(e,t,o){let i,n,r,a,{rect:s=null}=t,{bounds:l=null}=t,{visible:c=!1}=t,{cornerStyle:d}=t;const u=Sa("isAnimated");wr(e,u,e=>o(12,a=e));const p=Fc(void 0,{precision:1e-4,stiffness:.2,damping:.4});wr(e,p,e=>o(11,r=e));const h=Fc(0,{precision:.001});let m;wr(e,h,e=>o(10,n=e));const g=xa();return e.$$set=e=>{"rect"in e&&o(7,s=e.rect),"bounds"in e&&o(8,l=e.bounds),"visible"in e&&o(9,c=e.visible),"cornerStyle"in e&&o(0,d=e.cornerStyle)},e.$$.update=()=>{4608&e.$$.dirty&&p.set(c?1:.5,{hard:!1===a}),4608&e.$$.dirty&&h.set(c?1:0,{hard:!1===a}),3456&e.$$.dirty&&o(1,i=Object.keys(re).map((e,t)=>{const o=re[e],i=qf[o](s),a=1===o.length?"edge":"corner",c="corner"===a;let d;if("edge"===a&&l){let e,t,i;"l"===o&&(e=l.x,t=Math.min(l.width,s.x+s.width),i=s.x),"t"===o&&(e=l.y,t=Math.min(l.height,s.y+s.height),i=s.y),"r"===o&&(e=s.x,t=l.width,i=s.x+s.width),"b"===o&&(e=s.y,t=l.height,i=s.y+s.height),d={role:"slider",tabindex:0,label:`Drag ${Kf[o]}`,orientation:`${ey[o]}`,valuemin:Math.round(e),valuemax:Math.round(t),valuenow:Math.round(i)}}return{key:o,type:a,scale:{x:/^(t|b)$/.test(o)?s.width:c?Rs(r,.5,1.25):1,y:/^(r|l)$/.test(o)?s.height:c?Rs(r,.5,1.25):1},translate:{x:i.x,y:i.y},opacity:n,...d}}))},[d,i,u,p,h,(e,t)=>({detail:o})=>{m&&t!==m||"resizestart"!==e&&void 0===m||("resizestart"===e&&(m=t),"resizeend"===e&&(m=void 0),g(e,{direction:t,translation:o&&o.translation}))},e=>({detail:t})=>{g("resizestart",{direction:e,translation:{x:0,y:0}}),g("resizemove",{direction:e,translation:t}),g("resizeend",{direction:e,translation:{x:0,y:0}})},s,l,c,n,r,a]}class ry extends rs{constructor(e){super(),ns(this,e,ny,iy,yr,{rect:7,bounds:8,visible:9,cornerStyle:0})}}var ay=e=>{function t(t,o){e.dispatchEvent(new CustomEvent(t,{detail:o}))}const o=o=>{o.preventDefault(),e.addEventListener("gesturechange",i),e.addEventListener("gestureend",n),t("gesturedown")},i=e=>{e.preventDefault(),t("gestureupdate",e.scale)},n=e=>{t("gestureup",e.scale),e.preventDefault(),r()},r=()=>{e.removeEventListener("gesturechange",i),e.removeEventListener("gestureend",n)};return e.addEventListener("gesturestart",o),{destroy:()=>{r(),e.removeEventListener("gesturestart",o)}}},sy={[ae]:le,[se]:ce,[le]:ae,[ce]:se,[de]:pe,[ue]:he,[pe]:de,[he]:ue},ly=e=>{const t=e===ce||e===se,o=e===ae||e===le;return[e===se||e===ue||e===pe,e===ce||e===he||e===de,e===ae||e===ue||e===de,e===le||e===pe||e===he,t,o,t||o]},cy=(e,t,o,i={})=>{const{target:n,translate:r}=t,{aspectRatio:a,minSize:s,maxSize:l}=i,c=me[sy[n]],d=Re(be(e.x,e.y),be(c[0]*e.width,c[1]*e.height)),u=me[n],p=Re(rt(e),be(u[0]*e.width,u[1]*e.height)),[h,m,g,$,f,y,b]=ly(n);let x=r.x,v=r.y;f?v=0:y&&(x=0);const{inner:S,outer:w}=dy(d,n,o,{aspectRatio:a,minSize:s,maxSize:l});let[k,C,T,M]=Rt(e);if(h?M=d.x:m&&(C=d.x),$?k=d.y:g&&(T=d.y),h){const e=S.x+S.width,t=w.x+w.width;C=Rs(p.x+x,e,t)}else if(m){const e=w.x,t=S.x;M=Rs(p.x+x,e,t)}if($){const e=S.y+S.height,t=w.y+w.height;T=Rs(p.y+v,e,t)}else if(g){const e=w.y,t=S.y;k=Rs(p.y+v,e,t)}if(M>S.x&&(M=S.x),C<S.x+S.width&&(C=S.x+S.width),k>S.y&&(k=S.y),T<S.y+S.height&&(T=S.y+S.height),M<w.x){const e=w.x-M;M=w.x,C+=e}if(C>w.x+w.width){const e=C-(w.x+w.width);C=w.x+w.width,M-=e}if(k<w.y){const e=w.y-k;k=w.y,T+=e}if(T>w.y+w.height){const e=T-(w.y+w.height);T=w.y+w.height,k-=e}if(a)if(b){let e=C-M,t=T-k;f?(t=e/a,k=d.y-.5*t,T=d.y+.5*t):y&&(e=t*a,M=d.x-.5*e,C=d.x+.5*e)}else{const e=be(p.x+x-d.x,p.y+v-d.y);n===ue?(e.x=Math.max(0,e.x),e.y=Math.min(0,e.y)):n===pe?(e.x=Math.max(0,e.x),e.y=Math.max(0,e.y)):n===he?(e.x=Math.min(0,e.x),e.y=Math.max(0,e.y)):n===de&&(e.x=Math.min(0,e.x),e.y=Math.min(0,e.y));const t=ke(e),o=ke(be(S.width,S.height)),i=ke(be(w.width,w.height)),r=Rs(t,o,i),s=be(a,1),l=Ae(Ce(s),r);n===ue?(C=d.x+l.x,k=d.y-l.y):n===pe?(C=d.x+l.x,T=d.y+l.y):n===he?(M=d.x-l.x,T=d.y+l.y):n===de&&(M=d.x-l.x,k=d.y-l.y)}return ht(M,k,C-M,T-k)};const dy=(e,t,o,i)=>{const{aspectRatio:n,minSize:r,maxSize:a}=i,s=t===se||t===ue||t===pe,l=t===ce||t===he||t===de,c=t===ae||t===ue||t===de,d=t===le||t===pe||t===he,u=t===ce||t===se,p=t===ae||t===le,h=rt(o);s?(h.x=e.x,h.width-=e.x):l&&(h.width=e.x),d?(h.y=e.y,h.height-=e.y):c&&(h.height=e.y);const m=((e,t)=>nt(0,0,e,t))(Math.min(h.width,a.width),Math.min(h.height,a.height));if(n)if(u){const t=Math.min(e.y,o.height-e.y);m.height=Math.min(2*t,m.height)}else if(p){const t=Math.min(e.x,o.width-e.x);m.width=Math.min(2*t,m.width)}const g=n?je(Mt(st(r),n)):r,$=n?je(Pt(m,n)):m;let f,y,b,x;s?f=e.x:l&&(y=e.x),d?b=e.y:c&&(x=e.y),s?y=f+g.width:l&&(f=y-g.width),d?x=b+g.height:c&&(b=x-g.height),u?(b=e.y-.5*g.height,x=e.y+.5*g.height):p&&(f=e.x-.5*g.width,y=e.x+.5*g.width);const v=dt([be(f,b),be(y,x)]);s?y=f+$.width:l&&(f=y-$.width),d?x=b+$.height:c&&(b=x-$.height),u?(b=e.y-.5*$.height,x=e.y+.5*$.height):p&&(f=e.x-.5*$.width,y=e.x+.5*$.width),f=Math.max(o.x,f),y=Math.min(o.x+o.width,y),b=Math.max(o.y,b),x=Math.min(o.y+o.height,x);return{inner:v,outer:dt([be(f,b),be(y,x)])}};var uy=e=>180*e/Math.PI;function py(e){let t,o,i;return o=new Yf({props:{elasticity:e[5],min:e[9],max:e[10],value:e[11],valueMin:Math.max(e[9],e[0]),valueMax:Math.min(e[10],e[1]),labelReset:e[6],base:e[12],valueLabel:`${Math.round(uy(e[11]))}&deg;`,oninputstart:e[2],oninputmove:e[17],oninputend:e[18]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaImageRotator")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,[t]){const i={};32&t&&(i.elasticity=e[5]),512&t&&(i.min=e[9]),1024&t&&(i.max=e[10]),2048&t&&(i.value=e[11]),513&t&&(i.valueMin=Math.max(e[9],e[0])),1026&t&&(i.valueMax=Math.min(e[10],e[1])),64&t&&(i.labelReset=e[6]),4096&t&&(i.base=e[12]),2048&t&&(i.valueLabel=`${Math.round(uy(e[11]))}&deg;`),4&t&&(i.oninputstart=e[2]),392&t&&(i.oninputmove=e[17]),400&t&&(i.oninputend=e[18]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function hy(e,t,i){let n,r,a,s,l,c,d,{rotation:u}=t,{valueMin:p}=t,{valueMax:h}=t,{oninputstart:m=o}=t,{oninputmove:g=o}=t,{oninputend:$=o}=t,{elasticity:f=0}=t,{labelReset:y}=t,{rotationMin:b}=t,{rotationMax:x}=t;return e.$$set=e=>{"rotation"in e&&i(13,u=e.rotation),"valueMin"in e&&i(0,p=e.valueMin),"valueMax"in e&&i(1,h=e.valueMax),"oninputstart"in e&&i(2,m=e.oninputstart),"oninputmove"in e&&i(3,g=e.oninputmove),"oninputend"in e&&i(4,$=e.oninputend),"elasticity"in e&&i(5,f=e.elasticity),"labelReset"in e&&i(6,y=e.labelReset),"rotationMin"in e&&i(14,b=e.rotationMin),"rotationMax"in e&&i(15,x=e.rotationMax)},e.$$.update=()=>{16384&e.$$.dirty&&i(9,n=b+1e-9),32768&e.$$.dirty&&i(10,r=x-1e-9),1536&e.$$.dirty&&i(12,a=n+.5*(r-n)),32768&e.$$.dirty&&i(16,s=2*x),8192&e.$$.dirty&&i(8,l=Math.sign(u)),73728&e.$$.dirty&&i(7,c=Math.round(Math.abs(u)/s)*s),8576&e.$$.dirty&&i(11,d=u-l*c)},[p,h,m,g,$,f,y,c,l,n,r,d,a,u,b,x,s,e=>g(l*c+e),e=>$(l*c+e)]}class my extends rs{constructor(e){super(),ns(this,e,hy,py,yr,{rotation:13,valueMin:0,valueMax:1,oninputstart:2,oninputmove:3,oninputend:4,elasticity:5,labelReset:6,rotationMin:14,rotationMax:15})}}function gy(e){let t,o;return t=new Xu({props:{class:"PinturaPresetListFilter",layout:"row",options:e[8],selectedIndex:e[7],onchange:e[10]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};256&o&&(i.options=e[8]),128&o&&(i.selectedIndex=e[7]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function $y(e){let t,o;return t=new gp({props:{icon:e[0],label:e[1],labelClass:e[2],hideLabel:e[3],options:e[9],selectedIndex:e[4],onchange:e[5],optionMapper:e[6],$$slots:{controls:[gy]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,[o]){const i={};1&o&&(i.icon=e[0]),2&o&&(i.label=e[1]),4&o&&(i.labelClass=e[2]),8&o&&(i.hideLabel=e[3]),512&o&&(i.options=e[9]),16&o&&(i.selectedIndex=e[4]),32&o&&(i.onchange=e[5]),64&o&&(i.optionMapper=e[6]),262528&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}const fy='fill="none" stroke="currentColor"';function yy(e,t,i){let n,r,a,{icon:s}=t,{label:l}=t,{labelClass:c}=t,{hideLabel:d}=t,{options:u}=t,{selectedIndex:p}=t,{onchange:h}=t,{optionMapper:m}=t,{filter:g="landscape"}=t,{onfilterchange:$=o}=t;const f=(e,t,o,i,n)=>`\n <rect ${fy} x="${e}" y="${t}" width="${o}" height="${i}" rx="${n}"/>`,b=(e,t)=>`<path ${fy} d="M${e} ${t} l2 2 l3 -4"/>`;return e.$$set=e=>{"icon"in e&&i(0,s=e.icon),"label"in e&&i(1,l=e.label),"labelClass"in e&&i(2,c=e.labelClass),"hideLabel"in e&&i(3,d=e.hideLabel),"options"in e&&i(12,u=e.options),"selectedIndex"in e&&i(4,p=e.selectedIndex),"onchange"in e&&i(5,h=e.onchange),"optionMapper"in e&&i(6,m=e.optionMapper),"filter"in e&&i(11,g=e.filter),"onfilterchange"in e&&i(13,$=e.onfilterchange)},e.$$.update=()=>{6144&e.$$.dirty&&i(9,n=((e,t)=>(e||[]).map(e=>y(e[0])?(e[1]=e[1].map(t),e):t(e)))(u,(e=>t=>{const[o,i,n={}]=t;return No(o)&&(n.hidden="landscape"===e?o<1:o>1),[o,i,n]})(g))),2048&e.$$.dirty&&i(7,r="landscape"===g?0:1),128&e.$$.dirty&&i(8,a=[["landscape","Landscape",{hideLabel:!0,icon:f(2,6,19,12,2)+(0===r?b(9,12):"")}],["portrait","Portrait",{hideLabel:!0,icon:f(5,3,13,18,2)+(1===r?b(9,12):"")}]])},[s,l,c,d,p,h,m,r,a,n,e=>{i(11,g=e.value),$(e.value)},g,u,$]}class by extends rs{constructor(e){super(),ns(this,e,yy,$y,yr,{icon:0,label:1,labelClass:2,hideLabel:3,options:12,selectedIndex:4,onchange:5,optionMapper:6,filter:11,onfilterchange:13})}}const xy=e=>Pe(e,e=>ge(e,6)),vy=e=>Et(e,e=>ge(e,6)),Sy=(e,t,o=1e-4)=>Math.abs(e-t)<o;var wy=(e,t,o,i,n={})=>{const{aspectRatio:r}=n;e=vy(e),i=i.map(xy);const a=yt(e,sy[o.target]),s=Pe(a,e=>ge(e,6)),l=r?Mt(n.minSize,r):n.minSize,c=r?Pt(n.maxSize,r):n.maxSize,d=yt(t,o.target);if(De(d,a)<1){t=rt(e);const o=Math.min(l.width/e.width,l.height/e.height);$t(t,o,a)}t=ft(rt(t),l,c,a);let u=rt(t);t=vy(t);const p=Nt(i,1),h=It(e),m=It(t),g=h.findIndex(e=>Me(Pe(e,e=>ge(e,6)),s)),$=e=>p.map(t=>zt(t,e)).filter(Boolean).pop();if(r){const t=m.map((e,t)=>{if(t===g)return;const o=be(a.x-e.x,a.y-e.y);Ce(o),Ae(o,.5);const i=be(a.x-o.x,a.y-o.y),n=et(i,xy(e)),r=$(n);if(!r)return;const s=h[t];return{intersection:r,cornerDist:De(a,s),intersectionDist:De(a,r)}}).filter(Boolean);if(t.length){const o=t.reduce((e,t)=>{const o=t.intersectionDist/t.cornerDist;return o<e?o:e},Number.MAX_SAFE_INTEGER);u=rt(e),$t(u,o,a)}}else{const e=1===o.target.length,n=!(i[0].y===i[1].y||i[0].x===i[1].x),r=h.map((t,o)=>{if(o===g)return;const i=m[o],r=!Sy(i.x,s.x)&&!Sy(i.y,s.y);if(!e&&!n&&r)return;if(e&&(Sy(i.x,s.x)||Sy(i.y,s.y)))return;const l=ve(e?t:a),c=Ie(ve(l),i);Ce(c),Ae(c,.5),e?Re(l,c):Ie(l,c);const d=et(l,i),u=$(d);return u||void 0}).filter(Boolean);if(r.length){const[e,i,n,l]=ly(o.target);let[c,d,p,h]=Rt(t);r.forEach(({x:t,y:o})=>{const r=ge(t,6),a=ge(o,6);n&&!Sy(a,s.y)&&(c=Math.max(c,o)),e&&!Sy(r,s.x)&&(d=Math.min(d,t)),l&&!Sy(a,s.y)&&(p=Math.min(p,o)),i&&!Sy(r,s.x)&&(h=Math.max(h,t))}),u=lt([c,d,p,h]),$t(u,.9999,a)}}return ft(u,l,c,a),u};function ky(e){let t,o;return t=new Rh({props:{items:e[12]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};4096&o[0]&&(i.items=e[12]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Cy(e){let t,o,i;return o=new Ef({props:{$$slots:{default:[ky]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"slot","header")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};4096&t[0]|1024&t[7]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function Ty(e){let t,o;return t=new Dh({props:{onclick:e[90],label:e[4].cropLabelButtonRecenter,icon:e[4].cropIconButtonRecenter,disabled:!e[9],hideLabel:!0,class:"PinturaButtonCenter",style:`opacity:${e[31]};transform:translate3d(${e[32].x}px, ${e[32].y}px,0)`}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.label=e[4].cropLabelButtonRecenter),16&o[0]&&(i.icon=e[4].cropIconButtonRecenter),512&o[0]&&(i.disabled=!e[9]),3&o[1]&&(i.style=`opacity:${e[31]};transform:translate3d(${e[32].x}px, ${e[32].y}px,0)`),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function My(e){let t,o;return t=new ry({props:{rect:e[8],bounds:e[14],visible:e[13],cornerStyle:e[1]}}),t.$on("resizestart",e[70]),t.$on("resizemove",e[71]),t.$on("resizeend",e[72]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};256&o[0]&&(i.rect=e[8]),16384&o[0]&&(i.bounds=e[14]),8192&o[0]&&(i.visible=e[13]),2&o[0]&&(i.cornerStyle=e[1]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Py(e){let t,o;return{c(){t=Ur("div"),o=Ur("p"),Qr(t,"class","PinturaImageInfo"),Qr(t,"data-custom",e[24])},m(i,n){Hr(i,t,n),_r(t,o),o.innerHTML=e[23]},p(e,i){8388608&i[0]&&(o.innerHTML=e[23]),16777216&i[0]&&Qr(t,"data-custom",e[24])},d(e){e&&jr(t)}}}function Ry(e){let t,o,i,n,r,a,s,l,c=e[22]&&e[10]&&Ty(e),d=e[22]&&My(e),u=e[11]&&Py(e);return{c(){t=Ur("div"),o=Ur("div"),c&&c.c(),i=Xr(),d&&d.c(),r=Xr(),u&&u.c(),Qr(o,"class","PinturaStage"),Qr(t,"slot","main")},m(p,h){Hr(p,t,h),_r(t,o),c&&c.m(o,null),_r(o,i),d&&d.m(o,null),e[168](o),_r(t,r),u&&u.m(t,null),a=!0,s||(l=[Ar(qc.call(null,o)),qr(o,"measure",e[166]),qr(o,"wheel",function(){fr(e[2]&&e[89])&&(e[2]&&e[89]).apply(this,arguments)},{passive:!1}),qr(o,"interactionstart",e[76]),qr(o,"interactionupdate",e[77]),qr(o,"interactionrelease",e[79]),qr(o,"interactionend",e[78]),Ar(n=Wh.call(null,o,{drag:!0,inertia:!0,pinch:e[2],shouldStartInteraction:Wy,getEventPosition:e[169]})),qr(o,"gesturedown",e[86]),qr(o,"gestureupdate",e[87]),qr(o,"gestureup",e[88]),Ar(ay.call(null,o))],s=!0)},p(r,a){(e=r)[22]&&e[10]?c?(c.p(e,a),4195328&a[0]&&ja(c,1)):(c=Ty(e),c.c(),ja(c,1),c.m(o,i)):c&&(Na(),Ua(c,1,1,()=>{c=null}),Ha()),e[22]?d?(d.p(e,a),4194304&a[0]&&ja(d,1)):(d=My(e),d.c(),ja(d,1),d.m(o,null)):d&&(Na(),Ua(d,1,1,()=>{d=null}),Ha()),n&&fr(n.update)&&67108868&a[0]&&n.update.call(null,{drag:!0,inertia:!0,pinch:e[2],shouldStartInteraction:Wy,getEventPosition:e[169]}),e[11]?u?u.p(e,a):(u=Py(e),u.c(),u.m(t,null)):u&&(u.d(1),u=null)},i(e){a||(ja(c),ja(d),a=!0)},o(e){Ua(c),Ua(d),a=!1},d(o){o&&jr(t),c&&c.d(),d&&d.d(),e[168](null),u&&u.d(),s=!1,$r(l)}}}function Iy(e){let t,o,i,n;const r=[{class:"PinturaControlList"},{tabs:e[7]},e[19]];let a={$$slots:{default:[Ey,({tab:e})=>({226:e}),({tab:e})=>[0,0,0,0,0,0,0,e?512:0]]},$$scope:{ctx:e}};for(let e=0;e<r.length;e+=1)a=hr(a,r[e]);t=new $d({props:a}),t.$on("select",e[167]);const s=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[18]},e[19]];let l={$$slots:{default:[Fy,({panel:e})=>({225:e}),({panel:e})=>[0,0,0,0,0,0,0,e?256:0]]},$$scope:{ctx:e}};for(let e=0;e<s.length;e+=1)l=hr(l,s[e]);return i=new Rd({props:l}),{c(){ts(t.$$.fragment),o=Xr(),ts(i.$$.fragment)},m(e,r){os(t,e,r),Hr(e,o,r),os(i,e,r),n=!0},p(e,o){const n=524416&o[0]?Ja(r,[r[0],128&o[0]&&{tabs:e[7]},524288&o[0]&&Qa(e[19])]):{};1536&o[7]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n);const a=786432&o[0]?Ja(s,[s[0],s[1],262144&o[0]&&{panels:e[18]},524288&o[0]&&Qa(e[19])]):{};2046853144&o[0]|1280&o[7]&&(a.$$scope={dirty:o,ctx:e}),i.$set(a)},i(e){n||(ja(t.$$.fragment,e),ja(i.$$.fragment,e),n=!0)},o(e){Ua(t.$$.fragment,e),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(t,e),is(i,e)}}}function Ey(e){let t,o,i=e[226].label+"";return{c(){t=Ur("span"),o=Zr(i)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){512&t[7]&&i!==(i=e[226].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function Ay(e){let t,o;return t=new Yf({props:{elasticity:e[27]*e[46],base:By,min:e[25],max:Oy,valueMin:e[29][0],valueMax:e[29][1],value:e[30],labelReset:e[4].labelReset,valueLabel:`${Math.round(100*e[30])}%`,oninputstart:e[83],oninputmove:e[84],oninputend:e[85]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};134217728&o[0]&&(i.elasticity=e[27]*e[46]),33554432&o[0]&&(i.min=e[25]),536870912&o[0]&&(i.valueMin=e[29][0]),536870912&o[0]&&(i.valueMax=e[29][1]),1073741824&o[0]&&(i.value=e[30]),16&o[0]&&(i.labelReset=e[4].labelReset),1073741824&o[0]&&(i.valueLabel=`${Math.round(100*e[30])}%`),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Ly(e){let t,o;return t=new my({props:{elasticity:e[27]*e[46],rotation:e[15],labelReset:e[4].labelReset,valueMin:e[28][0],valueMax:e[28][1],rotationMin:-e[3],rotationMax:e[3],oninputstart:e[73],oninputmove:e[74],oninputend:e[75]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};134217728&o[0]&&(i.elasticity=e[27]*e[46]),32768&o[0]&&(i.rotation=e[15]),16&o[0]&&(i.labelReset=e[4].labelReset),268435456&o[0]&&(i.valueMin=e[28][0]),268435456&o[0]&&(i.valueMax=e[28][1]),8&o[0]&&(i.rotationMin=-e[3]),8&o[0]&&(i.rotationMax=e[3]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Fy(e){let t,o,i,n;const r=[Ly,Ay],a=[];function s(e,t){return e[225]===e[95]+"-rotation"?0:e[225]===e[95]+"-zoom"?1:-1}return~(t=s(e))&&(o=a[t]=r[t](e)),{c(){o&&o.c(),i=Yr()},m(e,o){~t&&a[t].m(e,o),Hr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),ja(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(ja(o),n=!0)},o(e){Ua(o),n=!1},d(e){e&&jr(i),~t&&a[t].d(e)}}}function zy(e){let t,o,i=e[20]&&Iy(e);return{c(){t=Ur("div"),i&&i.c(),Qr(t,"slot","footer"),aa(t,"transform",e[17])},m(e,n){Hr(e,t,n),i&&i.m(t,null),o=!0},p(e,o){e[20]?i?(i.p(e,o),1048576&o[0]&&ja(i,1)):(i=Iy(e),i.c(),ja(i,1),i.m(t,null)):i&&(Na(),Ua(i,1,1,()=>{i=null}),Ha()),131072&o[0]&&aa(t,"transform",e[17])},i(e){o||(ja(i),o=!0)},o(e){Ua(i),o=!1},d(e){e&&jr(t),i&&i.d()}}}function Dy(e){let t,o,i;function n(t){e[170](t)}let r={hasHeader:e[21],$$slots:{footer:[zy],main:[Ry],header:[Cy]},$$scope:{ctx:e}};return void 0!==e[16]&&(r.root=e[16]),t=new Uf({props:r}),Ca.push(()=>es(t,"root",n)),t.$on("measure",e[171]),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};2097152&i[0]&&(n.hasHeader=e[21]),2145320958&i[0]|3&i[1]|1024&i[7]&&(n.$$scope={dirty:i,ctx:e}),!o&&65536&i[0]&&(o=!0,n.root=e[16],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}const Oy=1,By=0,Wy=(e,t)=>e.target===t;function _y(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w,k,C,T,M,P,R,I,E,A,F,z,D,O,W,_,V,N,H,j,U,G,Z,X,Y,q,K,J,te,oe,re,ae,se,le,ce,$e,fe,ye,xe,we,Te,Pe,Ee,Le,Fe,ze,De,Oe,Be,We,_e,Ve,He,Ge,Xe=ur,et=()=>(Xe(),Xe=vr(tt,e=>o(13,F=e)),tt);e.$$.on_destroy.push(()=>Xe());let{isActive:tt}=t;et();let{stores:ot}=t,{cropImageSelectionCornerStyle:it="circle"}=t,{cropWillRenderImageSelectionGuides:nt=(e,t)=>{const o="rotate"==e;return{rows:o?5:3,cols:o?5:3,opacity:.25*t}}}=t,{cropAutoCenterImageSelectionTimeout:at}=t,{cropEnableZoomMatchImageAspectRatio:lt=!0}=t,{cropEnableRotateMatchImageAspectRatio:ct="never"}=t,{cropEnableRotationInput:dt=!0}=t,{cropEnableZoom:ut=!0}=t,{cropEnableZoomInput:ft=!0}=t,{cropEnableZoomAutoHide:yt=!0}=t,{cropEnableImageSelection:St=!0}=t,{cropEnableInfoIndicator:wt=!1}=t,{cropEnableZoomTowardsWheelPosition:kt=!0}=t,{cropEnableLimitWheelInputToCropSelection:It=!0}=t,{cropEnableCenterImageSelection:At=!0}=t,{cropEnableButtonRotateLeft:Lt=!0}=t,{cropEnableButtonRotateRight:Ft=!1}=t,{cropEnableButtonFlipHorizontal:zt=!0}=t,{cropEnableButtonFlipVertical:Dt=!1}=t,{cropSelectPresetOptions:Ot}=t,{cropEnableSelectPreset:Bt=!0}=t,{cropEnableFilterMatchAspectRatio:Wt=!0}=t,{cropSelectPresetFilter:_t=!1}=t,{cropEnableButtonToggleCropLimit:Vt=!1}=t,{cropWillRenderTools:Nt=ee}=t,{cropWillRenderInfoIndicator:Ht}=t,{cropActiveTransformTool:jt="rotation"}=t,{cropMinimizeToolbar:Ut="auto"}=t,{cropInteractionFocus:Gt="image"}=t,{cropRotationRange:Zt=ie}=t,{cropMaskOpacity:Xt=.85}=t,{locale:Yt={}}=t,{cropFormatIconSelectPreset:qt=function(e){const{aspectRatio:t}=e,[o,i,n]=t?[t<1?1:.3,1===t?.85:.5,t>1?1:.3]:[.2,.3,.4];return{a:o,b:i,c:n}}}=t,{cropFormatIconCropBoundary:Kt=function(e){const{isBoundToImage:t}=e,[o,i,n,r]=t?[.3,1,0,0]:[0,0,.3,1];return{a:o,b:i,c:n,d:r}}}=t;const Jt=Sa("isAnimated");wr(e,Jt,e=>o(144,z=e));const Qt=Sa("elasticityMultiplier");wr(e,Qt,e=>o(27,Be=e));const eo=Sa("redrawTrigger");wr(e,eo,e=>o(165,Oe=e));const to=Sa("imageIsStatic");wr(e,to,e=>o(150,H=e));const oo=Sa("imageStaticVisualCorners");wr(e,oo,e=>o(187,Te=e));const io=Sa("fixScrollDirection");wr(e,io,e=>o(181,le=e));let no="idle";const ro=ls();wr(e,ro,e=>o(162,Fe=e));const ao=()=>void 0===xe,so=e=>1/e,lo=e=>{Wt&&_t!==e&&(o(97,_t=e),xe&&1!==xe&&co()&&(Er(Xo,xe=so(xe),xe),mo.write()))},co=()=>{if(1===xe||!i)return!1;const e=so(xe);return!!fu(Fe).find(([t])=>t===e)},uo=(e,t,o)=>ne(o)?t.width===Math.round(e.height)||t.height===Math.round(e.width):t.width===Math.round(e.width)||t.height===Math.round(e.height),po=()=>(ao()||"always"===ct&&co())&&((e,t,o)=>{const i=Qe(Ke(Ne(t),o),e=>Math.abs(Math.round(e))),n=qe(i),r=mt(e);return Me(n,r)})(U,oe,re)&&uo(U,oe,re),ho=e=>{if("never"!==ct&&po()){Er(Fo,re+=e,re);const t=ne(re),o=t?oe.height:oe.width,i=t?oe.width:oe.height;Er(Ho,U=ht(0,0,o,i),U),ao()||Er(Xo,xe=Q(o,i),xe)}else Er(Fo,re+=e,re)},{history:mo,env:go,isInteracting:$o,isInteractingFraction:fo,isTransformingImage:yo,rootRect:bo,stageRect:xo,utilRect:vo,utilRectPadded:So,rootLineColor:wo,allowPan:ko,allowZoom:Co,allowPlayPause:To,rangeInputElasticity:Mo,presentationScalar:Po,utilTools:Ro,imagePreviewModifiers:Io,imageOutlineOpacity:Eo,imageFlipX:Ao,imageFlipY:Lo,imageRotation:Fo,imageRotationRange:zo,imageOutputSize:Do,imageSelectionRect:Oo,imageSelectionRectSnapshot:Bo,imageSelectionRectIntent:Wo,imageSelectionRectPresentation:_o,imageCropRectIntent:Vo,imageCropRectOrigin:No,imageCropRect:Ho,imageCropMinSize:jo,imageCropMaxSize:Go,imageCropRange:Zo,imageCropAspectRatio:Xo,imageCropLimitToImage:Yo,imageSize:qo,imageScalar:Ko,imageOverlayMarkup:Jo,stagePadded:Qo,stageRecenter:ei}=ot;function ti(e,t){return L(e.cropIconSelectPreset)?bu(e.cropIconSelectPreset,e,t):jl(e.cropIconSelectPreset,qt({aspectRatio:t}),"{","}")}function oi(e,t){return L(e.cropIconCropBoundary)?bu(e.cropIconCropBoundary,e,t):jl(e.cropIconCropBoundary,Kt({isBoundToImage:t}),"{","}")}let ii;wr(e,go,e=>o(145,D=e)),wr(e,$o,e=>o(149,N=e)),wr(e,yo,e=>o(179,J=e)),wr(e,bo,e=>o(26,ce=e)),wr(e,xo,e=>o(157,K=e)),wr(e,So,e=>o(14,X=e)),wr(e,Po,e=>o(154,Z=e)),wr(e,Ro,e=>o(189,Ee=e)),wr(e,Io,e=>o(178,_=e)),wr(e,Ao,e=>o(164,De=e)),wr(e,Lo,e=>o(163,ze=e)),wr(e,Fo,e=>o(15,re=e)),wr(e,zo,e=>o(28,We=e)),wr(e,Do,e=>o(151,j=e)),wr(e,Oo,e=>o(156,q=e)),wr(e,Bo,e=>o(155,Y=e)),wr(e,Wo,e=>o(188,Pe=e)),wr(e,_o,e=>o(148,V=e)),wr(e,Vo,e=>o(182,$e=e)),wr(e,No,e=>o(184,ye=e)),wr(e,Ho,e=>o(152,U=e)),wr(e,jo,e=>o(160,se=e)),wr(e,Go,e=>o(186,we=e)),wr(e,Zo,e=>o(183,fe=e)),wr(e,Xo,e=>o(185,xe=e)),wr(e,Yo,e=>o(159,ae=e)),wr(e,qo,e=>o(158,oe=e)),wr(e,Ko,e=>o(153,G=e)),wr(e,Qo,e=>o(147,W=e));const ni=(e,t)=>{const o={target:e,translate:t},i=Ye(Ne(se),Z),n=Ye(Ne(we),Z);let r=cy(Y,o,{...X,x:0,y:0},{aspectRatio:xe,minSize:i,maxSize:n});if(r=((e,t,o)=>{const[i,n,r,a]=Rt(e),s={...e};if(i<t.y&&(e.height=e.height-(t.y-i),e.y=t.y),n>t.x+t.width&&(e.width=t.x+t.width-e.x),r>t.y+t.height&&(e.height=t.y+t.height-e.y),a<t.x&&(e.width=e.width-(t.x-a),e.x=t.x),o){const t=Math.min(1,s.width/e.width,s.height/e.height);return bt(s,t)}return e})(r,{...X,x:0,y:0},xe),!ae)return{boundsLimited:r,boundsIntent:r};let a=wy(Y,r,o,Te,{aspectRatio:xe,minSize:i,maxSize:n});return{boundsLimited:a,boundsIntent:a}},ri=(e,t)=>{const o={target:e,translate:t},i=Ye(Ne(se),Z),n=Ye(Ne(we),Z),r=((e,t,o={})=>{const{target:i,translate:n}=t,{aspectRatio:r,minSize:a}=o,s=me[sy[i]],l=Re(rt(e),be(s[0]*e.width,s[1]*e.height)),c=me[i],d=Re(rt(e),be(c[0]*e.width,c[1]*e.height)),[u,p,h,m,g,$,f]=ly(i);let y=n.x,b=n.y;g?b=0:$&&(y=0);let[x,v,S,w]=Rt(e);if(u?w=l.x:p&&(v=l.x),m?x=l.y:h&&(S=l.y),u?v=d.x+y:p&&(w=d.x+y),m?S=d.y+b:h&&(x=d.y+b),a&&g&&S-x<a.height){const e=a.height-(S-x);x-=.5*e,S+=.5*e}if(a&&$&&v-w<a.width){const e=a.width-(v-w);w-=.5*e,v+=.5*e}if(r)if(f){let e=v-w,t=S-x;g?(t=e/r,x=l.y-.5*t,S=l.y+.5*t):$&&(e=t*r,w=l.x-.5*e,v=l.x+.5*e)}else{const e=be(d.x+y-l.x,d.y+b-l.y);i===ue?(e.x=Math.max(0,e.x),e.y=Math.min(0,e.y)):i===pe?(e.x=Math.max(0,e.x),e.y=Math.max(0,e.y)):i===he?(e.x=Math.min(0,e.x),e.y=Math.max(0,e.y)):i===de&&(e.x=Math.min(0,e.x),e.y=Math.min(0,e.y));const t=ke(e),o=be(r,1),n=Ae(Ce(o),t);i===ue?(v=l.x+n.x,x=l.y-n.y):i===pe?(v=l.x+n.x,S=l.y+n.y):i===he?(w=l.x-n.x,S=l.y+n.y):i===de&&(w=l.x-n.x,x=l.y-n.y)}return ht(w,x,v-w,S-x)})(Y,o,{aspectRatio:xe,minSize:i});return{boundsLimited:cy(Y,o,{...X,x:0,y:0},{aspectRatio:xe,minSize:i,maxSize:n}),boundsIntent:r}};let ai,si;const li=({translation:e,scalar:t})=>{H&&(t=1,e=Se(ve(e)));const o=Math.min(q.width/U.width,q.height/U.height),i=Ae(ve(e),1/o);let n;if(si){const t=Ie(ve(si),e);si=e,n=gt(rt(U),t)}else n=gt(rt(ai),Se(ve(i))),void 0!==t&&$t(n,1/t);Er(Vo,$e=n,$e),Er(Ho,U=n,U)},ci=cs([Zo,Ho],([e,t],o)=>{if(!t)return;const[i,n]=e,r=vt(t);o([je(Et(Mt(i,r),ge)),je(Et(Pt(n,r),ge))])});wr(e,ci,e=>o(180,te=e));const di=cs([qo,Yo,jo,Go,Zo,Fo],([e,t,o,i,n,r],a)=>{if(!e)return;const s=n[0],l=n[1];let c,d;t?(c=((e,t,o)=>ne(o)?1-1/Math.min(e.height/t.width,e.width/t.height):1-1/Math.min(e.width/t.width,e.height/t.height))(e,l,r),d=Math.min(s.width/o.width,s.height/o.height)):(c=-1,d=1);a([c,d].map(e=>ge(e)))});wr(e,di,e=>o(29,_e=e));const ui=cs([qo,Ho,Zo,Fo],([e,t,o,i],n)=>{if(!e||!t)return n(0);let r;const a=o[0],s=o[1],l=t.width,c=t.height,d=vt(t),u=ne(i)?Ze(e.height,e.width):e,p=Pt(u,d);if(l<=p.width||c<=p.height){const e=p.width-a.width,t=p.height-a.height;r=0===e||0===t?1:1-Math.min((l-a.width)/e,(c-a.height)/t)}else{const e=s.width-p.width,t=s.height-p.height,o=Pt({width:e,height:t},d);r=-Math.min((l-p.width)/o.width,(c-p.height)/o.height)}n(r)});wr(e,ui,e=>o(30,Ve=e));const pi=e=>{const t=vt(ai);let o,i,n;const r=ne(re)?Ze(oe.height,oe.width):oe,a=Pt(r,t);if(e>=0){const r=a.width-fe[0].width,s=a.height-fe[0].height;o=a.width-r*e,i=a.height-s*e,n=Mt({width:o,height:i},t)}else{const r=fe[1].width-a.width,s=fe[1].height-a.height;o=a.width+r*-e,i=a.height+s*-e,n=Pt({width:o,height:i},t)}o=n.width,i=n.height;const s=ai.x+.5*ai.width-.5*o,l=ai.y+.5*ai.height-.5*i;Er(Ho,U={x:s,y:l,width:o,height:i},U)};let hi;const mi=e=>{const t=$t(rt(hi),1/e);Er(Vo,$e=t,$e),Er(Ho,U=t,U)};let gi;const $i=()=>{ei.set({})};let fi;const yi=Fc(0,{precision:1e-4});wr(e,yi,e=>o(31,He=e));const bi=Fc();wr(e,bi,e=>o(32,Ge=e));const xi=cs([Xo,Do,ro],([e,t,o],n)=>{if(!i)return;const r=fu(o),a=[...r].map(e=>e[0]).sort((e,t)=>Uo(e[0])&&!Uo(t[0])?1:-1).find(o=>{if(Uo(o)&&t){const[i,n]=o,r=t.width===i&&t.height===n,a=e===Q(i,n);return r&&a}return o===e});if(!a)return n(void 0);n(r.map(e=>e[0]).findIndex(e=>Uo(e)?Fs(e,a):e===a))});wr(e,xi,e=>o(161,Le=e));const vi=(e,t)=>{if(!i||-1===e||void 0===e)return;const o=fu(t)[e][0];return o?Uo(o)?Q(o[0],o[1]):o:void 0},Si=cs([wo,_o,fo],([e,t,o],i)=>{const{rows:n,cols:r,opacity:a}=nt(no,o);if(!t||a<=0)return i([]);const{x:s,y:l,width:c,height:d}=t,u=c/r,p=d/n,h=[];for(let t=1;t<=n-1;t++){const o=l+p*t;h.push({id:`image-selection-guide-row-${t}`,points:[be(s,o),be(s+c,o)],opacity:a,strokeWidth:1,strokeColor:e})}for(let t=1;t<=r-1;t++){const o=s+u*t;h.push({id:`image-selection-guide-col-${t}`,points:[be(o,l),be(o,l+d)],opacity:a,strokeWidth:1,strokeColor:e})}i(h)});wr(e,Si,e=>o(146,O=e));const wi=`crop-${B()}`;let ki,Ci,Ti=wi+"-"+(dt?jt:"zoom"),Mi=Ti;const Pi=Fc(z?20:0);wr(e,Pi,e=>o(143,A=e));return e.$$set=e=>{"isActive"in e&&et(o(0,tt=e.isActive)),"stores"in e&&o(99,ot=e.stores),"cropImageSelectionCornerStyle"in e&&o(1,it=e.cropImageSelectionCornerStyle),"cropWillRenderImageSelectionGuides"in e&&o(100,nt=e.cropWillRenderImageSelectionGuides),"cropAutoCenterImageSelectionTimeout"in e&&o(101,at=e.cropAutoCenterImageSelectionTimeout),"cropEnableZoomMatchImageAspectRatio"in e&&o(102,lt=e.cropEnableZoomMatchImageAspectRatio),"cropEnableRotateMatchImageAspectRatio"in e&&o(103,ct=e.cropEnableRotateMatchImageAspectRatio),"cropEnableRotationInput"in e&&o(104,dt=e.cropEnableRotationInput),"cropEnableZoom"in e&&o(2,ut=e.cropEnableZoom),"cropEnableZoomInput"in e&&o(105,ft=e.cropEnableZoomInput),"cropEnableZoomAutoHide"in e&&o(106,yt=e.cropEnableZoomAutoHide),"cropEnableImageSelection"in e&&o(107,St=e.cropEnableImageSelection),"cropEnableInfoIndicator"in e&&o(108,wt=e.cropEnableInfoIndicator),"cropEnableZoomTowardsWheelPosition"in e&&o(109,kt=e.cropEnableZoomTowardsWheelPosition),"cropEnableLimitWheelInputToCropSelection"in e&&o(110,It=e.cropEnableLimitWheelInputToCropSelection),"cropEnableCenterImageSelection"in e&&o(111,At=e.cropEnableCenterImageSelection),"cropEnableButtonRotateLeft"in e&&o(112,Lt=e.cropEnableButtonRotateLeft),"cropEnableButtonRotateRight"in e&&o(113,Ft=e.cropEnableButtonRotateRight),"cropEnableButtonFlipHorizontal"in e&&o(114,zt=e.cropEnableButtonFlipHorizontal),"cropEnableButtonFlipVertical"in e&&o(115,Dt=e.cropEnableButtonFlipVertical),"cropSelectPresetOptions"in e&&o(116,Ot=e.cropSelectPresetOptions),"cropEnableSelectPreset"in e&&o(117,Bt=e.cropEnableSelectPreset),"cropEnableFilterMatchAspectRatio"in e&&o(118,Wt=e.cropEnableFilterMatchAspectRatio),"cropSelectPresetFilter"in e&&o(97,_t=e.cropSelectPresetFilter),"cropEnableButtonToggleCropLimit"in e&&o(119,Vt=e.cropEnableButtonToggleCropLimit),"cropWillRenderTools"in e&&o(120,Nt=e.cropWillRenderTools),"cropWillRenderInfoIndicator"in e&&o(121,Ht=e.cropWillRenderInfoIndicator),"cropActiveTransformTool"in e&&o(122,jt=e.cropActiveTransformTool),"cropMinimizeToolbar"in e&&o(123,Ut=e.cropMinimizeToolbar),"cropInteractionFocus"in e&&o(124,Gt=e.cropInteractionFocus),"cropRotationRange"in e&&o(3,Zt=e.cropRotationRange),"cropMaskOpacity"in e&&o(125,Xt=e.cropMaskOpacity),"locale"in e&&o(4,Yt=e.locale),"cropFormatIconSelectPreset"in e&&o(126,qt=e.cropFormatIconSelectPreset),"cropFormatIconCropBoundary"in e&&o(127,Kt=e.cropFormatIconCropBoundary)},e.$$.update=()=>{8192&e.$$.dirty[0]|1&e.$$.dirty[4]&&to.set("selection"===Gt&&F),8388608&e.$$.dirty[3]&&o(134,i=Ot&&Array.isArray(Ot)&&Ot.length),8388608&e.$$.dirty[3]|1024&e.$$.dirty[4]&&ro.set(i?Ot:[]),8192&e.$$.dirty[0]|1048576&e.$$.dirty[4]&&F&&Eo.set(1,{hard:!z}),8192&e.$$.dirty[0]&&ko.set(!F),8192&e.$$.dirty[0]&&Co.set(!F),8192&e.$$.dirty[0]&&F&&To.set(!0),2097152&e.$$.dirty[4]&&o(129,h="overlay"===D.layoutMode),16777216&e.$$.dirty[3]|32&e.$$.dirty[4]&&o(133,w=Bt&&!h),16384&e.$$.dirty[0]|2&e.$$.dirty[5]&&o(142,l=X&&q&&Ct(X,q)),262144&e.$$.dirty[4]|2&e.$$.dirty[5]&&o(140,c=!(!q||!l)),327680&e.$$.dirty[4]|2&e.$$.dirty[5]&&o(138,d=c&&xt(q,l,e=>ge(e,5))),32784&e.$$.dirty[0]|209190928&e.$$.dirty[3]|2115072&e.$$.dirty[4]|2040&e.$$.dirty[5]&&o(12,n=Oe&&Nt([Lt&&["Button","rotate-left",{label:Yt.cropLabelButtonRotateLeft,labelClass:"PinturaToolbarContentWide",icon:Yt.cropIconButtonRotateLeft,onclick:()=>{ho(-Math.PI/2),mo.write()}}],Ft&&["Button","rotate-right",{label:Yt.cropLabelButtonRotateRight,labelClass:"PinturaToolbarContentWide",icon:Yt.cropIconButtonRotateRight,onclick:()=>{ho(Math.PI/2),mo.write()}}],zt&&["Button","flip-horizontal",{label:Yt.cropLabelButtonFlipHorizontal,labelClass:"PinturaToolbarContentWide",icon:Yt.cropIconButtonFlipHorizontal,onclick:()=>{ne(re)?Er(Lo,ze=!ze,ze):Er(Ao,De=!De,De),mo.write()}}],Dt&&["Button","flip-vertical",{label:Yt.cropLabelButtonFlipVertical,labelClass:"PinturaToolbarContentWide",icon:Yt.cropIconButtonFlipVertical,onclick:()=>{ne(re)?Er(Ao,De=!De,De):Er(Lo,ze=!ze,ze),mo.write()}}],w&&i&&[!1===_t?"Dropdown":by,"select-preset",{icon:ti(Yt,vi(Le,Fe)),label:bu(Yt.cropLabelSelectPreset,Yt,vi(Le,Fe)),labelClass:"PinturaToolbarContentWide",options:Fe,filter:_t,onfilterchange:lo,selectedIndex:Le,onchange:({value:e})=>{Uo(e)?(Er(Xo,xe=Q(e[0],e[1]),xe),Er(Do,j=Ue(e),j)):Er(Xo,xe=e,xe),d&&$i(),mo.write()},optionMapper:e=>{let t=!1;const o=Uo(e.value)?e.value[0]/e.value[1]:e.value;if(o){const e=Ts(oe,re,o);t=e.width<se.width||e.height<se.height}return e.icon=((e,t={})=>{const{width:o=24,height:i=24,bounds:n=16,radius:r=3}=t;let a,s,l,c,d=Uo(e)?Q(e[0],e[1]):e,u=!!d;return d=u?d:1,l=d>1?n:d*n,c=l/d,a=Math.round(.5*(o-l)),s=Math.round(.5*(i-c)),`<rect fill="${u?"currentColor":"none"}" stroke="${u?"none":"currentColor"}" stroke-width="${o/16}" stroke-dasharray="${[o/12,o/6].join(" ")}" x="${a}" y="${s}" width="${l}" height="${c}" rx="${r}"/>`})(e.value,{bounds:14}),{...e,disabled:t}}}],Vt&&["Dropdown","select-crop-limit",{icon:oi(Yt,ae),label:Yt.cropLabelCropBoundary,labelClass:"PinturaToolbarContentWide",onchange:({value:e})=>{Er(Yo,ae=e,ae),mo.write()},options:[[!0,Yt.cropLabelCropBoundaryEdge,{icon:oi(Yt,!0)}],[!1,Yt.cropLabelCropBoundaryNone,{icon:oi(Yt,!1)}]]}]].filter(Boolean),D,()=>eo.set({})).filter(Boolean)),12288&e.$$.dirty[0]|1073741824&e.$$.dirty[3]|2097184&e.$$.dirty[4]&&Er(Ro,Ee=F&&"never"!==Ut&&("always"===Ut||"short"===D.verticalSpace||h)?n.map(([e,t,o])=>Array.isArray(o)?[e,t,o]:[e,t,{...o,hideLabel:!0}]):[],Ee),16&e.$$.dirty[5]&&o(25,r=ae?0:-1),16384&e.$$.dirty[0]|4&e.$$.dirty[5]&&o(135,a=X&&be(-(K.x-X.x),-(K.y-X.y))),16779264&e.$$.dirty[4]&&o(136,s=V&&a&&be(Kd(V.x+.5*V.width+a.x),Kd(V.y+.5*V.height+a.y))),1&e.$$.dirty[5]&&o(139,u=null!=Y),16384&e.$$.dirty[0]|262144&e.$$.dirty[4]&&o(141,p=X&&l&&(l.height===X.height||l.width===X.width)),1610743808&e.$$.dirty[4]&&o(137,m=!p&&Z<1&&G<1),122880&e.$$.dirty[4]&&o(9,g=c&&!u&&(!d||m)),32768&e.$$.dirty[3]|268435488&e.$$.dirty[4]&&o(11,$=wt&&!!U&&!h),268435456&e.$$.dirty[3]&&o(24,f=!!Ht||void 0),2048&e.$$.dirty[0]|268435456&e.$$.dirty[3]|402653184&e.$$.dirty[4]&&o(23,y=$&&Ht?Ht(U,j):$&&function(e,t){let o={};if(t){const i=e.width/e.height;o=t.width&&!t.height?Ze(t.width,t.width/i):t.height&&!t.width?Ze(t.height*i,t.height):Ne(t)}else o=Ze(e.width,e.height);return`${Math.round(o.width)} &times; ${Math.round(o.height)}`}(U,j)),16779264&e.$$.dirty[4]&&o(8,v=V&&a&&{x:V.x+a.x,y:V.y+a.y,width:V.width,height:V.height}),256&e.$$.dirty[0]|16384&e.$$.dirty[3]|32&e.$$.dirty[4]&&o(22,b=St&&!!v&&!h),262400&e.$$.dirty[3]|67112960&e.$$.dirty[4]&&o(10,x=At&&!!s&&!at&&!H),512&e.$$.dirty[0]|256&e.$$.dirty[3]|33554448&e.$$.dirty[4]&&g&&at&&!N&&(clearTimeout(fi),o(128,fi=setTimeout($i,at))),33554448&e.$$.dirty[4]&&N&&clearTimeout(fi),1536&e.$$.dirty[0]|1048576&e.$$.dirty[4]&&yi.set(x&&g?1:0,{hard:!1===z}),1052672&e.$$.dirty[4]&&bi.set(s,{hard:!1===z}),8192&e.$$.dirty[0]|8388608&e.$$.dirty[4]&&(F&&!W?(Er(Io,_.crop={maskOpacity:Xt,maskMarkupOpacity:Xt},_),Io.set(_)):(delete _.crop,Io.set(_))),4194304&e.$$.dirty[4]&&O&&Jo.update(e=>{const t=e.filter(e=>!/^image\-selection\-guide/.test(e.id));return F?[...t,...O]:t}),2097152&e.$$.dirty[4]&&o(132,S="short"!==D.verticalSpace),1073741824&e.$$.dirty[3]|288&e.$$.dirty[4]&&o(21,k="never"===Ut&&!h||S&&"always"!==Ut),4&e.$$.dirty[0]|4096&e.$$.dirty[3]&&o(131,C=ut&&ft),8192&e.$$.dirty[3]|384&e.$$.dirty[4]&&o(130,T=yt?S&&C:C),2048&e.$$.dirty[3]|64&e.$$.dirty[4]&&o(20,M=dt||T),64&e.$$.dirty[4]&&(T||o(5,Mi=Ti)),32&e.$$.dirty[0]&&o(19,P={name:wi,selected:Mi}),16&e.$$.dirty[0]|2048&e.$$.dirty[3]|64&e.$$.dirty[4]&&o(7,R=[dt&&{id:wi+"-rotation",label:Yt.cropLabelTabRotation},T&&{id:wi+"-zoom",label:Yt.cropLabelTabZoom}].filter(Boolean)),128&e.$$.dirty[0]&&o(18,I=R.map(e=>e.id)),64&e.$$.dirty[0]|32&e.$$.dirty[4]&&Ci&&!Ci.children.length&&h&&Ci.dispatchEvent(new CustomEvent("measure",{detail:Ci.rect})),8192&e.$$.dirty[0]|1048576&e.$$.dirty[4]&&z&&Pi.set(F?0:20),524288&e.$$.dirty[4]&&o(17,E=A?`translateY(${A}px)`:"none")},[tt,it,ut,Zt,Yt,Mi,Ci,R,v,g,x,$,n,F,X,re,ki,E,I,P,M,k,b,y,f,r,ce,Be,We,_e,Ve,He,Ge,Jt,Qt,eo,to,oo,io,ro,go,$o,yo,bo,xo,So,Mo,Po,Ro,Io,Ao,Lo,Fo,zo,Do,Oo,Bo,Wo,_o,Vo,No,Ho,jo,Go,Zo,Xo,Yo,qo,Ko,Qo,()=>{no="select",Er($o,N=!0,N),Er(Bo,Y=rt(q),Y),ii=H?ni:ri},({detail:e})=>{const{boundsLimited:t,boundsIntent:o}=ii(e.direction,e.translation);Er(yo,J=!0,J),Er(Wo,Pe=o,Pe),Er(Oo,q=t,q)},({detail:e})=>{const{boundsLimited:t}=ii(e.direction,e.translation);Er(yo,J=!1,J),Er($o,N=!1,N),Er(Wo,Pe=void 0,Pe),ke(e.translation)&&(Er(Oo,q=t,q),mo.write()),Er(Bo,Y=void 0,Y),no=void 0},()=>{no="rotate",Er($o,N=!0,N),Er(No,ye=rt(U),ye)},e=>{Er(yo,J=!0,J),Er(Fo,re=e,re)},e=>{Er(yo,J=!1,J),Er($o,N=!1,N),Er(Fo,re=e,re),mo.write(),Er(No,ye=void 0,ye)},()=>{no="pan",si=void 0,Er($o,N=!0,N),ai=rt(U)},({detail:e})=>{Er(yo,J=!0,J),li(e)},({detail:e})=>{Er(yo,J=!1,J),Er($o,N=!1,N),(ke(e.translation)>0||0!==e.scalar)&&(li(e),mo.write()),Er(Vo,$e=void 0,$e),ai=void 0},({detail:{translation:e}})=>{H&&(e=Se(ve(e))),si=e,Er($o,N=!1,N)},ci,di,ui,()=>{no="zoom",Er($o,N=!0,N),ai=rt(U)},e=>{Er(yo,J=!1,J),pi(e)},e=>{pi(e),mo.write(),Er(yo,J=!1,J),Er($o,N=!1,N),ai=void 0},()=>{no="zoom",ai||(hi=rt(U),Er($o,N=!0,N))},({detail:e})=>{hi&&(Er(yo,J=!0,J),mi(e))},({detail:e})=>{hi&&(Er(yo,J=!1,J),Er($o,N=!1,N),mi(e),Er(Vo,$e=void 0,$e),hi=void 0,mo.write())},e=>{const t=Mm(e,ce,K);if(It&&!Tt(q,t))return;no="zoom",Er($o,N=!0,N),Er(yo,J=!0,J),e.preventDefault(),e.stopPropagation();const o=Sp(e,{fixScrollDirection:le}),i=1+o/100,n=rt(U),r=1===Math.min(U.width/se.width,U.height/se.height);if(lt&&ae){const e=uo(U,oe,re);if(ao()&&e&&o>0&&d){Er($o,N=!1,N),Er(yo,J=!1,J);const e=ne(re)?st({height:oe.width,width:oe.height}):st(oe);if(xt(n,e))return;if(clearTimeout(gi),xt(mo.state.crop,e))return;return Er(Ho,U=e,U),void mo.write()}}let a=mt(U);if(kt&&"selection"!==Gt&&o<0&&!r){const e=Ie(ve(t),q),o=Math.min(q.width/U.width,q.height/U.height),i=$t(rt(q),1.1);a=Tt(i,t)?Re(rt(U),Ae(e,1/o)):a}let s=$t(rt(U),i,a);if(Je(te[1],s)||(s=pt(mt(s),te[1])),Je(s,te[0])||(s=pt(mt(s),te[0])),xt(n,s,ge))return Er($o,N=!1,N),void Er(yo,J=!1,J);Er(Ho,U=Et(s,e=>ge(e,5)),U),Er($o,N=!1,N),Er(yo,J=!1,J),clearTimeout(gi),gi=setTimeout(()=>{mo.write()},500)},$i,yi,bi,xi,Si,wi,Pi,_t,"crop",ot,nt,at,lt,ct,dt,ft,yt,St,wt,kt,It,At,Lt,Ft,zt,Dt,Ot,Bt,Wt,Vt,Nt,Ht,jt,Ut,Gt,Xt,qt,Kt,fi,h,T,C,S,w,i,a,s,m,d,u,c,p,l,A,z,D,O,W,V,N,H,j,U,G,Z,Y,q,K,oe,ae,se,Le,Fe,ze,De,Oe,function(t){wa.call(this,e,t)},({detail:e})=>o(5,Mi=e),function(e){Ca[e?"unshift":"push"](()=>{Ci=e,o(6,Ci)})},e=>Tm(e),function(e){ki=e,o(16,ki)},function(t){wa.call(this,e,t)}]}var Vy={util:["crop",class extends rs{constructor(e){super(),ns(this,e,_y,Dy,yr,{name:98,isActive:0,stores:99,cropImageSelectionCornerStyle:1,cropWillRenderImageSelectionGuides:100,cropAutoCenterImageSelectionTimeout:101,cropEnableZoomMatchImageAspectRatio:102,cropEnableRotateMatchImageAspectRatio:103,cropEnableRotationInput:104,cropEnableZoom:2,cropEnableZoomInput:105,cropEnableZoomAutoHide:106,cropEnableImageSelection:107,cropEnableInfoIndicator:108,cropEnableZoomTowardsWheelPosition:109,cropEnableLimitWheelInputToCropSelection:110,cropEnableCenterImageSelection:111,cropEnableButtonRotateLeft:112,cropEnableButtonRotateRight:113,cropEnableButtonFlipHorizontal:114,cropEnableButtonFlipVertical:115,cropSelectPresetOptions:116,cropEnableSelectPreset:117,cropEnableFilterMatchAspectRatio:118,cropSelectPresetFilter:97,cropEnableButtonToggleCropLimit:119,cropWillRenderTools:120,cropWillRenderInfoIndicator:121,cropActiveTransformTool:122,cropMinimizeToolbar:123,cropInteractionFocus:124,cropRotationRange:3,cropMaskOpacity:125,locale:4,cropFormatIconSelectPreset:126,cropFormatIconCropBoundary:127},null,[-1,-1,-1,-1,-1,-1,-1,-1])}get name(){return this.$$.ctx[98]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get stores(){return this.$$.ctx[99]}set stores(e){this.$$set({stores:e}),Oa()}get cropImageSelectionCornerStyle(){return this.$$.ctx[1]}set cropImageSelectionCornerStyle(e){this.$$set({cropImageSelectionCornerStyle:e}),Oa()}get cropWillRenderImageSelectionGuides(){return this.$$.ctx[100]}set cropWillRenderImageSelectionGuides(e){this.$$set({cropWillRenderImageSelectionGuides:e}),Oa()}get cropAutoCenterImageSelectionTimeout(){return this.$$.ctx[101]}set cropAutoCenterImageSelectionTimeout(e){this.$$set({cropAutoCenterImageSelectionTimeout:e}),Oa()}get cropEnableZoomMatchImageAspectRatio(){return this.$$.ctx[102]}set cropEnableZoomMatchImageAspectRatio(e){this.$$set({cropEnableZoomMatchImageAspectRatio:e}),Oa()}get cropEnableRotateMatchImageAspectRatio(){return this.$$.ctx[103]}set cropEnableRotateMatchImageAspectRatio(e){this.$$set({cropEnableRotateMatchImageAspectRatio:e}),Oa()}get cropEnableRotationInput(){return this.$$.ctx[104]}set cropEnableRotationInput(e){this.$$set({cropEnableRotationInput:e}),Oa()}get cropEnableZoom(){return this.$$.ctx[2]}set cropEnableZoom(e){this.$$set({cropEnableZoom:e}),Oa()}get cropEnableZoomInput(){return this.$$.ctx[105]}set cropEnableZoomInput(e){this.$$set({cropEnableZoomInput:e}),Oa()}get cropEnableZoomAutoHide(){return this.$$.ctx[106]}set cropEnableZoomAutoHide(e){this.$$set({cropEnableZoomAutoHide:e}),Oa()}get cropEnableImageSelection(){return this.$$.ctx[107]}set cropEnableImageSelection(e){this.$$set({cropEnableImageSelection:e}),Oa()}get cropEnableInfoIndicator(){return this.$$.ctx[108]}set cropEnableInfoIndicator(e){this.$$set({cropEnableInfoIndicator:e}),Oa()}get cropEnableZoomTowardsWheelPosition(){return this.$$.ctx[109]}set cropEnableZoomTowardsWheelPosition(e){this.$$set({cropEnableZoomTowardsWheelPosition:e}),Oa()}get cropEnableLimitWheelInputToCropSelection(){return this.$$.ctx[110]}set cropEnableLimitWheelInputToCropSelection(e){this.$$set({cropEnableLimitWheelInputToCropSelection:e}),Oa()}get cropEnableCenterImageSelection(){return this.$$.ctx[111]}set cropEnableCenterImageSelection(e){this.$$set({cropEnableCenterImageSelection:e}),Oa()}get cropEnableButtonRotateLeft(){return this.$$.ctx[112]}set cropEnableButtonRotateLeft(e){this.$$set({cropEnableButtonRotateLeft:e}),Oa()}get cropEnableButtonRotateRight(){return this.$$.ctx[113]}set cropEnableButtonRotateRight(e){this.$$set({cropEnableButtonRotateRight:e}),Oa()}get cropEnableButtonFlipHorizontal(){return this.$$.ctx[114]}set cropEnableButtonFlipHorizontal(e){this.$$set({cropEnableButtonFlipHorizontal:e}),Oa()}get cropEnableButtonFlipVertical(){return this.$$.ctx[115]}set cropEnableButtonFlipVertical(e){this.$$set({cropEnableButtonFlipVertical:e}),Oa()}get cropSelectPresetOptions(){return this.$$.ctx[116]}set cropSelectPresetOptions(e){this.$$set({cropSelectPresetOptions:e}),Oa()}get cropEnableSelectPreset(){return this.$$.ctx[117]}set cropEnableSelectPreset(e){this.$$set({cropEnableSelectPreset:e}),Oa()}get cropEnableFilterMatchAspectRatio(){return this.$$.ctx[118]}set cropEnableFilterMatchAspectRatio(e){this.$$set({cropEnableFilterMatchAspectRatio:e}),Oa()}get cropSelectPresetFilter(){return this.$$.ctx[97]}set cropSelectPresetFilter(e){this.$$set({cropSelectPresetFilter:e}),Oa()}get cropEnableButtonToggleCropLimit(){return this.$$.ctx[119]}set cropEnableButtonToggleCropLimit(e){this.$$set({cropEnableButtonToggleCropLimit:e}),Oa()}get cropWillRenderTools(){return this.$$.ctx[120]}set cropWillRenderTools(e){this.$$set({cropWillRenderTools:e}),Oa()}get cropWillRenderInfoIndicator(){return this.$$.ctx[121]}set cropWillRenderInfoIndicator(e){this.$$set({cropWillRenderInfoIndicator:e}),Oa()}get cropActiveTransformTool(){return this.$$.ctx[122]}set cropActiveTransformTool(e){this.$$set({cropActiveTransformTool:e}),Oa()}get cropMinimizeToolbar(){return this.$$.ctx[123]}set cropMinimizeToolbar(e){this.$$set({cropMinimizeToolbar:e}),Oa()}get cropInteractionFocus(){return this.$$.ctx[124]}set cropInteractionFocus(e){this.$$set({cropInteractionFocus:e}),Oa()}get cropRotationRange(){return this.$$.ctx[3]}set cropRotationRange(e){this.$$set({cropRotationRange:e}),Oa()}get cropMaskOpacity(){return this.$$.ctx[125]}set cropMaskOpacity(e){this.$$set({cropMaskOpacity:e}),Oa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),Oa()}get cropFormatIconSelectPreset(){return this.$$.ctx[126]}set cropFormatIconSelectPreset(e){this.$$set({cropFormatIconSelectPreset:e}),Oa()}get cropFormatIconCropBoundary(){return this.$$.ctx[127]}set cropFormatIconCropBoundary(e){this.$$set({cropFormatIconCropBoundary:e}),Oa()}}]};function Ny(e){let t,o,i,n,r,a,s,l=e[77],c=(L(e[77].label)?e[77].label(e[2]):e[77].label)+"";function d(...t){return e[51](e[77],...t)}const u=()=>e[52](o,l),p=()=>e[52](null,l);return{c(){t=Ur("div"),o=Ur("div"),i=Xr(),n=Ur("span"),r=Zr(c),Qr(o,"class",Gy),Qr(t,"slot","option"),Qr(t,"class","PinturaFilterOption")},m(e,l){Hr(e,t,l),_r(t,o),u(),_r(t,i),_r(t,n),_r(n,r),a||(s=[qr(o,"measure",d),Ar(qc.call(null,o))],a=!0)},p(t,o){l!==(e=t)[77]&&(p(),l=e[77],u()),4&o[0]|32768&o[2]&&c!==(c=(L(e[77].label)?e[77].label(e[2]):e[77].label)+"")&&na(r,c)},d(e){e&&jr(t),p(),a=!1,$r(s)}}}function Hy(e){let t,o;return t=new Xu({props:{locale:e[2],layout:"row",options:e[3],selectedIndex:e[12],onchange:e[32],$$slots:{option:[Ny,({option:e})=>({77:e}),({option:e})=>[0,0,e?32768:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};4&o[0]&&(i.locale=e[2]),8&o[0]&&(i.options=e[3]),4096&o[0]&&(i.selectedIndex=e[12]),1028&o[0]|98304&o[2]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function jy(e){let t,o,i,n,r,a,s,l;function c(t){e[54](t)}function d(t){e[55](t)}function u(t){e[56](t)}let p={elasticity:e[13]*e[19],onscroll:e[53],$$slots:{default:[Hy]},$$scope:{ctx:e}};return void 0!==e[4]&&(p.maskFeatherStartOpacity=e[4]),void 0!==e[5]&&(p.maskFeatherEndOpacity=e[5]),void 0!==e[6]&&(p.maskFeatherSize=e[6]),o=new Gh({props:p}),Ca.push(()=>es(o,"maskFeatherStartOpacity",c)),Ca.push(()=>es(o,"maskFeatherEndOpacity",d)),Ca.push(()=>es(o,"maskFeatherSize",u)),o.$on("measure",e[57]),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"slot","footer"),aa(t,"transform",e[11])},m(i,n){Hr(i,t,n),os(o,t,null),a=!0,s||(l=[qr(t,"transitionend",e[30]),qr(t,"measure",e[58]),Ar(qc.call(null,t,{observePosition:!0}))],s=!0)},p(e,a){const s={};8192&a[0]&&(s.elasticity=e[13]*e[19]),128&a[0]&&(s.onscroll=e[53]),5132&a[0]|65536&a[2]&&(s.$$scope={dirty:a,ctx:e}),!i&&16&a[0]&&(i=!0,s.maskFeatherStartOpacity=e[4],La(()=>i=!1)),!n&&32&a[0]&&(n=!0,s.maskFeatherEndOpacity=e[5],La(()=>n=!1)),!r&&64&a[0]&&(r=!0,s.maskFeatherSize=e[6],La(()=>r=!1)),o.$set(s),2048&a[0]&&aa(t,"transform",e[11])},i(e){a||(ja(o.$$.fragment,e),a=!0)},o(e){Ua(o.$$.fragment,e),a=!1},d(e){e&&jr(t),is(o),s=!1,$r(l)}}}function Uy(e){let t,o;return t=new Uf({props:{$$slots:{footer:[jy]},$$scope:{ctx:e}}}),t.$on("measure",e[59]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16380&o[0]|65536&o[2]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}let Gy="PinturaFilterPreview";function Zy(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w=ur,k=()=>(w(),w=vr(P,e=>o(43,d=e)),P),C=ur,T=()=>(C(),C=vr(M,e=>o(49,b=e)),M);e.$$.on_destroy.push(()=>w()),e.$$.on_destroy.push(()=>C());let{isActive:M}=t;T();let{isActiveFraction:P}=t;k();let{stores:R}=t,{locale:I}=t,{filterFunctions:E}=t,{filterOptions:A}=t;const F=Sa("elasticityMultiplier");wr(e,F,e=>o(13,S=e));const{history:z,interfaceImages:D,stageRectBase:O,utilRect:B,animation:W,scrollElasticity:_,imageSize:V,imagePreview:N,imageCropRect:H,imageRotation:j,imageFlipX:U,imageFlipY:G,imageBackgroundColor:Z,imageGamma:X,imageColorMatrix:Y,allowPan:q,allowZoom:K,allowZoomControls:J,allowPlayPause:Q}=R;wr(e,D,e=>o(60,u=e)),wr(e,O,e=>o(48,y=e)),wr(e,B,e=>o(47,f=e)),wr(e,W,e=>o(50,x=e)),wr(e,V,e=>o(62,h=e)),wr(e,N,e=>o(42,c=e)),wr(e,Z,e=>o(61,p=e)),wr(e,X,e=>o(44,m=e)),wr(e,Y,e=>o(40,s=e));const ee=ls({});wr(e,ee,e=>o(46,$=e));const te=(e,t)=>Er(ee,$[e.value]=t,$),oe=cs(ee,e=>{if(!e[void 0])return;const t=e[void 0];return v&&Xe(v,t)?v:Ne(t)});wr(e,oe,e=>o(63,v=e));const ie=cs([M,oe,H,V,j,U,G],([e,t,o,i,n,r,a],s)=>{if(!e||!t||!i)return g;const l=st(i),c=mt(l),d=Ps(i,o,n),u=mt(d),p=Ie(ve(c),u),h=Se(ve(p)),m=Math.max(t.width/o.width,t.height/o.height);s({origin:h,translation:p,rotation:{x:a?Math.PI:0,y:r?Math.PI:0,z:n},scale:m})});wr(e,ie,e=>o(45,g=e));const ne=Fc(x?20:0);let re;wr(e,ne,e=>o(39,a=e));const ae={};let se,le,ce,de,ue,pe,he={x:0,y:0};const me=ls([]);wr(e,me,e=>o(41,l=e));const ge=e=>{const t={...e,data:c,size:h,offset:{...e.offset},mask:{...e.mask},backgroundColor:p};return t.opacity=d,t.offset.y+=a,t.mask.y+=a,t.id="filter",t},$e=()=>u.filter(e=>"filter"!==e.id);ba(()=>{D.set([])});return e.$$set=e=>{"isActive"in e&&T(o(0,M=e.isActive)),"isActiveFraction"in e&&k(o(1,P=e.isActiveFraction)),"stores"in e&&o(34,R=e.stores),"locale"in e&&o(2,I=e.locale),"filterFunctions"in e&&o(35,E=e.filterFunctions),"filterOptions"in e&&o(3,A=e.filterOptions)},e.$$.update=()=>{if(262144&e.$$.dirty[1]&&q.set(b),262144&e.$$.dirty[1]&&K.set(b),262144&e.$$.dirty[1]&&J.set(b),262144&e.$$.dirty[1]&&b&&Q.set(!1),8&e.$$.dirty[0]&&o(38,i=fu(A)),640&e.$$.dirty[1]&&o(12,n=((e,t)=>{if(!e||!e.filter||!t)return 0;const o=e.filter;return t.findIndex(([e])=>{if(!E[e])return!1;const t=E[e]();return Fs(t,o)})})(s,i)),786432&e.$$.dirty[1]&&x&&ne.set(b?0:20),512&e.$$.dirty[0]|458752&e.$$.dirty[1]&&b&&f&&y&&pe&&o(37,ue={x:y.x-f.x,y:y.y-f.y+pe.y}),496&e.$$.dirty[0]|58096&e.$$.dirty[1]&&g&&ue&&he&&de&&re){const e=ue.x+de.x+he.x,t=ue.y,o=de.x+ue.x,n=o+de.width;me.set(i.map(([i],r)=>{const a=$[i],l=he.x+a.x,c=l+a.width;if(c<0||l>de.width)return!1;const d=e+a.x,u=t+a.y,p=(e=>({origin:ve(e.origin),translation:ve(e.translation),rotation:{...e.rotation},scale:e.scale}))(g);p.offset=be(.5*a.width+d,.5*a.height+u);p.maskOpacity=1,p.mask=ht(d+0,u,a.width+0,a.height),p.maskFeather=[1,0,1,0,1,n,1,n],l<ce&&se<1&&(p.maskFeather[0]=se,p.maskFeather[1]=o,p.maskFeather[2]=1,p.maskFeather[3]=o+ce),c>de.width-ce&&le<1&&(p.maskFeather[4]=le,p.maskFeather[5]=n-ce,p.maskFeather[6]=1,p.maskFeather[7]=n),p.maskCornerRadius=re[i];let h=s&&Object.keys(s).filter(e=>"filter"!=e).map(e=>s[e])||[];return L(E[i])&&h.push(E[i]()),p.colorMatrix=h.length?cr(h):void 0,p.gamma=m,p}).filter(Boolean))}if(7424&e.$$.dirty[1])if(d>0&&l){const e=[...$e(),...l.map(ge)];D.set(e)}else D.set($e());256&e.$$.dirty[1]&&o(11,r=a?`translateY(${a}px)`:"none")},[M,P,I,A,se,le,ce,he,de,pe,ae,r,n,S,F,D,O,B,W,_,V,N,Z,X,Y,ee,te,oe,ie,ne,e=>{e.target.className===Gy&&o(36,re=Object.keys(ae).reduce((e,t)=>{const o=ae[t],i=getComputedStyle(o),n=["top-left","top-right","bottom-left","bottom-right"].map(e=>i.getPropertyValue(`border-${e}-radius`)).map(Hh).map(e=>1.25*e);return e[t]=n,e},{}))},me,({value:e})=>{Er(Y,s={...s,filter:L(E[e])?E[e]():void 0},s),z.write()},"filter",R,E,re,ue,i,a,s,l,c,d,m,g,$,f,y,b,x,(e,t)=>te(e,t.detail),function(e,t){Ca[e?"unshift":"push"](()=>{ae[t.value]=e,o(10,ae)})},e=>o(7,he=e),function(e){se=e,o(4,se)},function(e){le=e,o(5,le)},function(e){ce=e,o(6,ce)},e=>o(8,de=e.detail),e=>o(9,pe=e.detail),function(t){wa.call(this,e,t)}]}var Xy={util:["filter",class extends rs{constructor(e){super(),ns(this,e,Zy,Uy,yr,{name:33,isActive:0,isActiveFraction:1,stores:34,locale:2,filterFunctions:35,filterOptions:3},null,[-1,-1,-1])}get name(){return this.$$.ctx[33]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get stores(){return this.$$.ctx[34]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[2]}set locale(e){this.$$set({locale:e}),Oa()}get filterFunctions(){return this.$$.ctx[35]}set filterFunctions(e){this.$$set({filterFunctions:e}),Oa()}get filterOptions(){return this.$$.ctx[3]}set filterOptions(e){this.$$set({filterOptions:e}),Oa()}}]};function Yy(e){let t,o,i,n;t=new Gh({props:{elasticity:e[6]*e[9],class:"PinturaControlListScroller",$$slots:{default:[Ky]},$$scope:{ctx:e}}});const r=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[4]},e[5]];let a={$$slots:{default:[Jy,({panel:e})=>({44:e}),({panel:e})=>[0,e?8192:0]]},$$scope:{ctx:e}};for(let e=0;e<r.length;e+=1)a=hr(a,r[e]);return i=new Rd({props:a}),{c(){ts(t.$$.fragment),o=Xr(),ts(i.$$.fragment)},m(e,r){os(t,e,r),Hr(e,o,r),os(i,e,r),n=!0},p(e,o){const n={};64&o[0]&&(n.elasticity=e[6]*e[9]),38&o[0]|32768&o[1]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n);const a=48&o[0]?Ja(r,[r[0],r[1],16&o[0]&&{panels:e[4]},32&o[0]&&Qa(e[5])]):{};128&o[0]|40960&o[1]&&(a.$$scope={dirty:o,ctx:e}),i.$set(a)},i(e){n||(ja(t.$$.fragment,e),ja(i.$$.fragment,e),n=!0)},o(e){Ua(t.$$.fragment,e),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(t,e),is(i,e)}}}function qy(e){let t,o,i=e[45].label+"";return{c(){t=Ur("span"),o=Zr(i)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){16384&t[1]&&i!==(i=e[45].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function Ky(e){let t,o;const i=[{class:"PinturaControlList"},{tabs:e[1]},e[5]];let n={$$slots:{default:[qy,({tab:e})=>({45:e}),({tab:e})=>[0,e?16384:0]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new $d({props:n}),t.$on("select",e[24]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=34&o[0]?Ja(i,[i[0],2&o[0]&&{tabs:e[1]},32&o[0]&&Qa(e[5])]):{};49152&o[1]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Jy(e){let t,o;const i=[e[7][e[44]]];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Yf({props:n}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=128&o[0]|8192&o[1]?Ja(i,[Qa(e[7][e[44]])]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Qy(e){let t,o,i=e[5]&&Yy(e);return{c(){t=Ur("div"),i&&i.c(),Qr(t,"slot","footer"),aa(t,"transform",e[3])},m(e,n){Hr(e,t,n),i&&i.m(t,null),o=!0},p(e,o){e[5]?i?(i.p(e,o),32&o[0]&&ja(i,1)):(i=Yy(e),i.c(),ja(i,1),i.m(t,null)):i&&(Na(),Ua(i,1,1,()=>{i=null}),Ha()),8&o[0]&&aa(t,"transform",e[3])},i(e){o||(ja(i),o=!0)},o(e){Ua(i),o=!1},d(e){e&&jr(t),i&&i.d()}}}function eb(e){let t,o;return t=new Uf({props:{$$slots:{footer:[Qy]},$$scope:{ctx:e}}}),t.$on("measure",e[25]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};254&o[0]|32768&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function tb(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g=ur,$=()=>(g(),g=vr(y,e=>o(21,d=e)),y);e.$$.on_destroy.push(()=>g());let{stores:f}=t,{isActive:y}=t;$();let{locale:b={}}=t,{finetuneControlConfiguration:x}=t,{finetuneOptions:v}=t,{finetuneNudgePrecision:S}=t;const{history:w,animation:k,scrollElasticity:C,rangeInputElasticity:T,imageColorMatrix:M,imageConvolutionMatrix:P,imageGamma:R,imageVignette:I,imageNoise:E,allowPan:A,allowZoom:F,allowZoomControls:z,allowPlayPause:D}=f;wr(e,k,e=>o(22,u=e));const O={imageColorMatrix:M,imageConvolutionMatrix:P,imageGamma:R,imageVignette:I,imageNoise:E},W=Sa("elasticityMultiplier");wr(e,W,e=>o(6,h=e));const _=`finetune-${B()}`,V=ls({});wr(e,V,e=>o(23,p=e));const N=ls({});wr(e,N,e=>o(7,m=e));const H=(e,t)=>{e.update(e=>{const o={};return t.forEach(t=>{e[t]&&(o[t]=e[t])}),o})};let j=[];const U=Fc(u?20:0);wr(e,U,e=>o(20,c=e));return e.$$set=e=>{"stores"in e&&o(15,f=e.stores),"isActive"in e&&$(o(0,y=e.isActive)),"locale"in e&&o(16,b=e.locale),"finetuneControlConfiguration"in e&&o(17,x=e.finetuneControlConfiguration),"finetuneOptions"in e&&o(18,v=e.finetuneOptions),"finetuneNudgePrecision"in e&&o(19,S=e.finetuneNudgePrecision)},e.$$.update=()=>{var t;2097152&e.$$.dirty[0]&&A.set(d),2097152&e.$$.dirty[0]&&F.set(d),2097152&e.$$.dirty[0]&&z.set(d),2097152&e.$$.dirty[0]&&d&&D.set(!0),327680&e.$$.dirty[0]&&o(1,i=v?v.map(([e,t])=>({id:e,label:L(t)?t(b):t})):[]),2&e.$$.dirty[0]&&o(2,n=i.length?i[0].id:void 0),4&e.$$.dirty[0]&&o(5,r=n&&{name:_,selected:n}),2&e.$$.dirty[0]&&o(4,a=i.map(e=>e.id)),131072&e.$$.dirty[0]&&(s=[...Object.keys(x||{}),"filter"]),131072&e.$$.dirty[0]&&x&&(t=x,j&&j.forEach(e=>e()),j=a.map(e=>{const{getStore:o,getValue:i=ee}=t[e];return o(O).subscribe(t=>{const o=null!=t?i(t):t;Er(V,p={...p,[e]:o},p)})})),8519680&e.$$.dirty[0]&&x&&p&&Er(N,m=Object.keys(p).reduce((e,t)=>{const{base:o,min:i,max:n,getLabel:r,getStore:a,setValue:l=(e,t)=>e.set(t)}=x[t],c=a(O),d=null!=p[t]?p[t]:o;return e[t]={base:o,min:i,max:n,value:d,valueLabel:r?r(d,i,n,n-i):Math.round(100*d),oninputmove:e=>{l(c,e),c===M&&H(c,s)},oninputend:e=>{l(c,e),c===M&&H(c,s),w.write()},elasticity:h*T,labelReset:b.labelReset,nudgeMultiplier:S},e},{}),m),6291456&e.$$.dirty[0]&&u&&U.set(d?0:20),1048576&e.$$.dirty[0]&&o(3,l=c?`translateY(${c}px)`:"none")},[y,i,n,l,a,r,h,m,k,C,W,V,N,U,"finetune",f,b,x,v,S,c,d,u,p,({detail:e})=>o(2,n=e),function(t){wa.call(this,e,t)}]}var ob={util:["finetune",class extends rs{constructor(e){super(),ns(this,e,tb,eb,yr,{name:14,stores:15,isActive:0,locale:16,finetuneControlConfiguration:17,finetuneOptions:18,finetuneNudgePrecision:19},null,[-1,-1])}get name(){return this.$$.ctx[14]}get stores(){return this.$$.ctx[15]}set stores(e){this.$$set({stores:e}),Oa()}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get locale(){return this.$$.ctx[16]}set locale(e){this.$$set({locale:e}),Oa()}get finetuneControlConfiguration(){return this.$$.ctx[17]}set finetuneControlConfiguration(e){this.$$set({finetuneControlConfiguration:e}),Oa()}get finetuneOptions(){return this.$$.ctx[18]}set finetuneOptions(e){this.$$set({finetuneOptions:e}),Oa()}get finetuneNudgePrecision(){return this.$$.ctx[19]}set finetuneNudgePrecision(e){this.$$set({finetuneNudgePrecision:e}),Oa()}}]},ib=(e,t)=>{const o=t.length;return e<0?e%o+o:e>=o?e%o:e};function nb(e,t,o){const i=e.slice();return i[51]=t[o].key,i[52]=t[o].index,i[53]=t[o].translate,i[16]=t[o].scale,i[54]=t[o].selected,i[15]=t[o].rotate,i[55]=t[o].dir,i[56]=t[o].center,i[57]=t[o].type,i[4]=t[o].visible,i[58]=t[o].role,i[59]=t[o].tabindex,i[60]=t[o].label,i[61]=t[o].orientation,i[62]=t[o].valuemin,i[63]=t[o].valuemax,i[64]=t[o].valuenow,i}function rb(e){let t;return{c(){t=Ur("div"),Qr(t,"class","PinturaShapeManipulator"),Qr(t,"data-control","point"),aa(t,"pointer-events","none"),aa(t,"opacity",e[6]),aa(t,"transform",`translate3d(${e[56].x}px, ${e[56].y}px, 0) scale(${e[7]}, ${e[7]})`)},m(e,o){Hr(e,t,o)},p(e,o){64&o[0]&&aa(t,"opacity",e[6]),160&o[0]&&aa(t,"transform",`translate3d(${e[56].x}px, ${e[56].y}px, 0) scale(${e[7]}, ${e[7]})`)},d(e){e&&jr(t)}}}function ab(e,t){let o,i,n,r,a,s,l,c,d,u,p,h,m,g;function $(...e){return t[23](t[52],...e)}let f="edge"===t[57]&&t[4]&&rb(t);return{key:e,first:null,c(){o=Ur("div"),p=Xr(),f&&f.c(),h=Yr(),Qr(o,"role",i=t[58]),Qr(o,"tabindex",n=t[59]),Qr(o,"aria-label",r=t[60]),Qr(o,"aria-orientation",a=t[61]),Qr(o,"aria-valuemin",s=t[62]),Qr(o,"aria-valuemax",l=t[63]),Qr(o,"aria-valuenow",c=t[64]),Qr(o,"class","PinturaShapeManipulator"),Qr(o,"data-control",d=t[57]),Qr(o,"data-selected",u=t[54]),aa(o,"cursor",t[55]?t[55]+"-resize":"move"),aa(o,"opacity",t[6]),aa(o,"--tx",t[53].x),aa(o,"--ty",t[53].y),aa(o,"--r",`${"edge"===t[57]?t[15]:0}rad`),aa(o,"--sx","point"===t[57]?t[7]:t[16].x),aa(o,"--sy","point"===t[57]?t[7]:t[16].y),this.first=o},m(e,i){Hr(e,o,i),Hr(e,p,i),f&&f.m(e,i),Hr(e,h,i),m||(g=[qr(o,"nudge",$),Ar(xp.call(null,o,{preventDefault:!0})),qr(o,"interactionstart",function(){fr(t[11]("start",t[52]))&&t[11]("start",t[52]).apply(this,arguments)}),qr(o,"interactionupdate",function(){fr(t[11]("move",t[52]))&&t[11]("move",t[52]).apply(this,arguments)}),qr(o,"interactionend",function(){fr(t[11]("end",t[52]))&&t[11]("end",t[52]).apply(this,arguments)}),Ar(Wh.call(null,o,{observeKeys:!0}))],m=!0)},p(e,p){t=e,32&p[0]&&i!==(i=t[58])&&Qr(o,"role",i),32&p[0]&&n!==(n=t[59])&&Qr(o,"tabindex",n),32&p[0]&&r!==(r=t[60])&&Qr(o,"aria-label",r),32&p[0]&&a!==(a=t[61])&&Qr(o,"aria-orientation",a),32&p[0]&&s!==(s=t[62])&&Qr(o,"aria-valuemin",s),32&p[0]&&l!==(l=t[63])&&Qr(o,"aria-valuemax",l),32&p[0]&&c!==(c=t[64])&&Qr(o,"aria-valuenow",c),32&p[0]&&d!==(d=t[57])&&Qr(o,"data-control",d),32&p[0]&&u!==(u=t[54])&&Qr(o,"data-selected",u),32&p[0]&&aa(o,"cursor",t[55]?t[55]+"-resize":"move"),64&p[0]&&aa(o,"opacity",t[6]),32&p[0]&&aa(o,"--tx",t[53].x),32&p[0]&&aa(o,"--ty",t[53].y),32&p[0]&&aa(o,"--r",`${"edge"===t[57]?t[15]:0}rad`),160&p[0]&&aa(o,"--sx","point"===t[57]?t[7]:t[16].x),160&p[0]&&aa(o,"--sy","point"===t[57]?t[7]:t[16].y),"edge"===t[57]&&t[4]?f?f.p(t,p):(f=rb(t),f.c(),f.m(h.parentNode,h)):f&&(f.d(1),f=null)},d(e){e&&(jr(o),jr(p),jr(h)),f&&f.d(e),m=!1,$r(g)}}}function sb(e){let t,o,i;return{c(){t=Ur("div"),Qr(t,"role","button"),Qr(t,"aria-label","Drag rotator"),Qr(t,"tabindex","0"),Qr(t,"class","PinturaShapeManipulator"),Qr(t,"data-control","rotate"),aa(t,"transform",`translate3d(${e[0].x}px, ${e[0].y}px, 0) scale(${e[7]}, ${e[7]})`),aa(t,"opacity",e[6])},m(n,r){Hr(n,t,r),o||(i=[qr(t,"nudge",e[13]),Ar(xp.call(null,t,{preventDefault:!0})),qr(t,"interactionstart",e[15]("start")),qr(t,"interactionupdate",e[15]("move")),qr(t,"interactionend",e[15]("end")),Ar(Wh.call(null,t,{observeKeys:!0}))],o=!0)},p(e,o){129&o[0]&&aa(t,"transform",`translate3d(${e[0].x}px, ${e[0].y}px, 0) scale(${e[7]}, ${e[7]})`),64&o[0]&&aa(t,"opacity",e[6])},d(e){e&&jr(t),o=!1,$r(i)}}}function lb(e){let t,o,i;return{c(){t=Ur("div"),Qr(t,"role","button"),Qr(t,"aria-label","Drag scalar"),Qr(t,"tabindex","0"),Qr(t,"class","PinturaShapeManipulator"),Qr(t,"data-control","scale"),aa(t,"transform",`translate3d(${e[1].x}px, ${e[1].y}px, 0) scale(${e[7]}, ${e[7]})`),aa(t,"opacity",e[6])},m(n,r){Hr(n,t,r),o||(i=[qr(t,"nudge",e[14]),Ar(xp.call(null,t,{preventDefault:!0})),qr(t,"interactionstart",e[16]("start")),qr(t,"interactionupdate",e[16]("move")),qr(t,"interactionend",e[16]("end")),Ar(Wh.call(null,t,{observeKeys:!0}))],o=!0)},p(e,o){130&o[0]&&aa(t,"transform",`translate3d(${e[1].x}px, ${e[1].y}px, 0) scale(${e[7]}, ${e[7]})`),64&o[0]&&aa(t,"opacity",e[6])},d(e){e&&jr(t),o=!1,$r(i)}}}function cb(e){let t,o,i,n=[],r=new Map,a=Xa(e[5]);const s=e=>e[51];for(let t=0;t<a.length;t+=1){let o=nb(e,a,t),i=s(o);r.set(i,n[t]=ab(i,o))}let l=e[2]&&e[0]&&sb(e),c=e[3]&&e[1]&&lb(e);return{c(){for(let e=0;e<n.length;e+=1)n[e].c();t=Xr(),l&&l.c(),o=Xr(),c&&c.c(),i=Yr()},m(e,r){for(let t=0;t<n.length;t+=1)n[t]&&n[t].m(e,r);Hr(e,t,r),l&&l.m(e,r),Hr(e,o,r),c&&c.m(e,r),Hr(e,i,r)},p(e,d){6368&d[0]&&(a=Xa(e[5]),n=Ka(n,d,s,1,e,a,r,t.parentNode,Ya,ab,t,nb)),e[2]&&e[0]?l?l.p(e,d):(l=sb(e),l.c(),l.m(o.parentNode,o)):l&&(l.d(1),l=null),e[3]&&e[1]?c?c.p(e,d):(c=lb(e),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null)},i:ur,o:ur,d(e){e&&(jr(t),jr(o),jr(i));for(let t=0;t<n.length;t+=1)n[t].d(e);l&&l.d(e),c&&c.d(e)}}}function db(e,t,o){let i,n,r,a;const s=xa(),l=.5*ie,c=oe-l,d=oe+l,u=-oe,p=u-l,h=u+l,m=te-l,g=-te+l,$=l,f=-l,y=oe-ie,b=y-l,x=y+l,v=te-ie,S=v-l,w=v+l,k=u-ie,C=k+l,T=k-l,M=u+ie,P=M+l,R=M-l;let{visible:I=!1}=t,{points:E=[]}=t,{rotatorPoint:A}=t,{bounds:L=null}=t,{scalarPoint:F}=t,{selectedPoint:z}=t,{enableDragEdges:D=!0}=t,{enableDragPoints:O=!0}=t,{enableRotatePoints:B=!0}=t,{enableScalePoints:W=!0}=t;const _=Sa("isAnimated");wr(e,_,e=>o(22,n=e));const V=Fc(.5,{precision:1e-4,stiffness:.3,damping:.7});wr(e,V,e=>o(7,a=e));const N=Fc(0,{precision:.001,stiffness:.3,damping:.7});wr(e,N,e=>o(6,r=e));const H=e=>{let t="";return(e<=d&&e>=c||e>=p&&e<=h)&&(t="ns"),(e<=g||e>=m||e>=f&&e<=$)&&(t="ew"),(e>=S&&e<=w||e<=P&&e>=R)&&(t="nesw"),(e>=b&&e<=x||e<=C&&e>=T)&&(t="nwse"),t},j=(e,t)=>{let o=0;const i=Be(e),n=[],r=e.length,[a,s,l,c]=e.reduce(([e,t,o,i],{x:n,y:r})=>(i=Math.min(i,n),t=Math.max(t,n),[e=Math.min(e,r),t,o=Math.max(o,r),i]),[1/0,-1/0,-1/0,1/0]);for(;o<r;o++){const t=ib(o-1,e),r=ib(o+1,e),d=e[t],u=e[o],p=e[r],h=Math.atan2(p.y-u.y,p.x-u.x);if(O){const e=Ce(be(d.x-u.x,d.y-u.y)),t=Ce(be(p.x-u.x,p.y-u.y)),i=be(e.x+t.x,e.y+t.y),r=D?O&&H(Math.atan2(i.y,i.x)):void 0;n.push({index:[o],key:`point-${o}`,type:"point",selected:z===o,scale:{x:1,y:1},translate:{x:u.x,y:u.y},angle:void 0,rotate:B,center:u,dir:r})}if(!D)continue;if(Array.isArray(D)&&!D.some(([e,t])=>o===e&&r===t))continue;const m=be(u.x+.5*(p.x-u.x),u.y+.5*(p.y-u.y)),g=["t","r","b","l"][o];let $,f,y;"l"===g&&($=L.x,f=s,y=c),"t"===g&&($=L.y,f=l,y=a),"r"===g&&($=c,f=L.width,y=s),"b"===g&&($=a,f=L.height,y=l),n.push({index:[o,r],key:`edge-${o}`,type:"edge",scale:{x:De(u,p),y:1},translate:{x:u.x,y:u.y},angle:h,rotate:h,center:m,visible:Array.isArray(D),dir:H(Math.atan2(i.y-m.y,i.x-m.x)),role:"slider",tabindex:0,label:`Drag ${Kf[g]}`,orientation:`${ey[g]}`,valuemin:Math.round($),valuemax:Math.round(f),valuenow:Math.round(y)})}return n},U=(e,t)=>{s("resizestart",{indexes:e,translation:ye(),isNudge:!0}),s("resizemove",{indexes:e,translation:t,isNudge:!0}),s("resizeend",{indexes:e,translation:ye(),isNudge:!0})};return e.$$set=e=>{"visible"in e&&o(4,I=e.visible),"points"in e&&o(17,E=e.points),"rotatorPoint"in e&&o(0,A=e.rotatorPoint),"bounds"in e&&o(18,L=e.bounds),"scalarPoint"in e&&o(1,F=e.scalarPoint),"selectedPoint"in e&&o(19,z=e.selectedPoint),"enableDragEdges"in e&&o(20,D=e.enableDragEdges),"enableDragPoints"in e&&o(21,O=e.enableDragPoints),"enableRotatePoints"in e&&o(2,B=e.enableRotatePoints),"enableScalePoints"in e&&o(3,W=e.enableScalePoints)},e.$$.update=()=>{4194320&e.$$.dirty[0]&&V.set(I?1:.5,{hard:!1===n}),4194320&e.$$.dirty[0]&&N.set(I?1:0,{hard:!1===n}),131072&e.$$.dirty[0]&&o(5,i=j(E))},[A,F,B,W,I,i,r,a,_,V,N,(e,t)=>({detail:o})=>{const i=o&&o.translation?o.translation:be(0,0);s(`resize${e}`,{...o,indexes:t,translation:i})},U,({detail:e})=>{s("rotatestart",{translation:ye(),isNudge:!0}),s("rotatemove",{translation:e,isNudge:!0}),s("rotateend",{translation:ye(),isNudge:!0})},({detail:e})=>{s("scalestart",{translation:ye(),isNudge:!0}),s("scalemove",{translation:e,isNudge:!0}),s("scaleend",{translation:ye(),isNudge:!0})},e=>({detail:t})=>{const o=t&&t.translation?t.translation:be(0,0);s(`rotate${e}`,{...t,translation:o})},e=>({detail:t})=>{const o=t&&t.translation?t.translation:be(0,0);s(`scale${e}`,{...t,translation:o})},E,L,z,D,O,n,(e,{detail:t})=>U(e,t)]}class ub extends rs{constructor(e){super(),ns(this,e,db,cb,yr,{visible:4,points:17,rotatorPoint:0,bounds:18,scalarPoint:1,selectedPoint:19,enableDragEdges:20,enableDragPoints:21,enableRotatePoints:2,enableScalePoints:3},null,[-1,-1,-1])}}var pb=(e,t)=>{const o=Tm(e);return Ie(o,t)},hb=e=>document.createTextNode(e),mb=e=>(no()&&e.endsWith("<div><br></div>")?e.replace(/<div><br><\/div>$/,"<br><br>"):e).replace(/<div><br><\/div>/g,"<br>").replace(/<\/div>/g,"").replace(/<div>/g,"<br>");function gb(e){let t,o,i,n;return{c(){t=Ur("pre"),Qr(t,"class","PinturaContentEditable")},m(r,a){Hr(r,t,a),t.innerHTML=e[0],i||(n=Ar(o=fd.call(null,t,`${e[7]};position:absolute;z-index:-1;pointer-events:none;`)),i=!0)},p(e,i){1&i[0]&&(t.innerHTML=e[0]),o&&fr(o.update)&&128&i[0]&&o.update.call(null,`${e[7]};position:absolute;z-index:-1;pointer-events:none;`)},d(e){e&&jr(t),i=!1,n()}}}function $b(e){let t,o,i,n,r,a,s=e[8]&&gb(e);return{c(){s&&s.c(),t=Xr(),o=Ur("pre"),Qr(o,"class","PinturaContentEditable"),Qr(o,"data-wrap-content",i=e[4]||e[5]?"wrap":"nowrap"),Qr(o,"contenteditable",""),Qr(o,"spellcheck",e[1]),Qr(o,"autocorrect",e[2]),Qr(o,"autocapitalize",e[3])},m(i,l){s&&s.m(i,l),Hr(i,t,l),Hr(i,o,l),e[26](o),r||(a=[Ar(n=fd.call(null,o,e[8]?e[15](e[7]):e[7])),qr(o,"input",e[13]),qr(o,"compositionend",e[12]),qr(o,"paste",e[14]),qr(o,"keydown",e[10]),qr(o,"keyup",e[11]),qr(o,"blur",e[9])],r=!0)},p(e,r){e[8]?s?s.p(e,r):(s=gb(e),s.c(),s.m(t.parentNode,t)):s&&(s.d(1),s=null),48&r[0]&&i!==(i=e[4]||e[5]?"wrap":"nowrap")&&Qr(o,"data-wrap-content",i),2&r[0]&&Qr(o,"spellcheck",e[1]),4&r[0]&&Qr(o,"autocorrect",e[2]),8&r[0]&&Qr(o,"autocapitalize",e[3]),n&&fr(n.update)&&384&r[0]&&n.update.call(null,e[8]?e[15](e[7]):e[7])},i:ur,o:ur,d(i){i&&(jr(t),jr(o)),s&&s.d(i),e[26](null),r=!1,$r(a)}}}function fb(e,t,i){let n,r,{spellcheck:a="false"}=t,{autocorrect:s="off"}=t,{autocapitalize:l="off"}=t,{wrapLines:c=!0}=t,{allowNewline:d=!0}=t,{textFormat:u="text"}=t,{formatInput:p=ee}=t,{formatPaste:h=ee}=t,{styles:m}=t,{innerHTML:g}=t,{oninput:$=o}=t,{enableTextStyleShortcuts:f=!1}=t;const y=()=>{if(!v)return;const e=document.createRange();e.selectNodeContents(v);const t=P();t.removeAllRanges(),t.addRange(e)},b=xa();let v;document.execCommand("defaultParagraphSeparator",!1,"br");const S=e=>e.replace(/<\/?(?:i|b|em|u|s|strike|strong|font)>/,"").replace(/style=".*?"/g,"").replace(/\n/gim,"<br>"),w=()=>{i(0,g=v.innerHTML);const e=mb(g);b("input",e),$(e),requestAnimationFrame(()=>v&&v.scrollTo(0,0))},k=()=>{R(v);const e="html"===u?v.innerHTML:S(v.innerHTML);i(6,v.innerHTML=p(e),v),I(v),w()},C={b:"bold",i:"italic",u:"underline",s:"strikethrough"},T=e=>{const t=x("span");return t.dataset.bookmark=e,t},M=(e,t,o)=>{const i=T(o);if(e.nodeType===Node.TEXT_NODE){const n=e.textContent;if("start"===o){const o=hb(n.substring(0,t)),r=hb(n.substring(t));e.replaceWith(o,i,r)}else{const o=hb(n.substring(0,t)),r=hb(n.substring(t));e.replaceWith(o,i,r)}}else e.nodeType===Node.ELEMENT_NODE&&e.insertBefore(i,e.childNodes[t])},P=()=>{const e=v.getRootNode();return"getSelection"in e?e.getSelection():document.getSelection()},R=e=>{const t=P();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.substring(0,i),o=T("start"),a=n-i>0?e.substring(i,n):"",s=T("end"),l=e.substring(n);r.replaceWith(t,o,a,s,l)}else M(r,i,"start"),M(a,n+(r===a?1:0),"end")},I=e=>{const t=E(e,"start"),o=E(e,"end");if(!t||!o)return;const i=document.createRange();i.setStart(t,0),i.setEnd(o,0);const n=P();n.removeAllRanges(),n.addRange(i),t.remove(),o.remove()},E=(e,t)=>{const o=e.children;for(let e=0;e<o.length;e++){const i=o[e];if(i.dataset.bookmark===t)return i;if(i.children.length){const e=E(i,t);if(e)return e}}};let A;return e.$$set=e=>{"spellcheck"in e&&i(1,a=e.spellcheck),"autocorrect"in e&&i(2,s=e.autocorrect),"autocapitalize"in e&&i(3,l=e.autocapitalize),"wrapLines"in e&&i(4,c=e.wrapLines),"allowNewline"in e&&i(5,d=e.allowNewline),"textFormat"in e&&i(16,u=e.textFormat),"formatInput"in e&&i(17,p=e.formatInput),"formatPaste"in e&&i(18,h=e.formatPaste),"styles"in e&&i(19,m=e.styles),"innerHTML"in e&&i(0,g=e.innerHTML),"oninput"in e&&i(20,$=e.oninput),"enableTextStyleShortcuts"in e&&i(21,f=e.enableTextStyleShortcuts)},e.$$.update=()=>{var t;if(64&e.$$.dirty[0]&&i(25,n=!!v),33554433&e.$$.dirty[0]&&n&&g&&(t=g)!==v.innerHTML&&(i(6,v.innerHTML=t,v),v===document.activeElement&&y()),524336&e.$$.dirty[0])if(!c&&d){const e=m.includes(":right")?"text-indent:-100px!important":m.includes(":center")?"":"min-width:calc(100% + 100px)!important";i(7,A=m+";overflow:visible;"+e)}else i(7,A=m);524288&e.$$.dirty[0]&&i(8,r=m.includes("text-stroke"))},[g,a,s,l,c,d,v,A,r,()=>{b("blur")},e=>{if(/escape/i.test(e.code))return e.stopPropagation(),void b("cancel");const t=e.ctrlKey||e.metaKey;if("html"===u&&t&&/b|i|u|s/.test(e.key))return f&&(e=>{const t=C[e];t&&document.execCommand(t)})(e.key),void e.preventDefault();/enter/i.test(e.key)&&(e.stopPropagation(),e.isComposing||(t?b("confirm"):(d||e.preventDefault(),document.execCommand("insertLineBreak"),e.preventDefault())))},()=>{},e=>{""!==e.data&&k()},e=>{const{inputType:t}=e;"insertCompositionText"!==t&&"deleteCompositionText"!==t&&k()},e=>{e.preventDefault();const t=e.clipboardData.getData("text/plain"),o="html"===u?t:S(t),i=h(o);if(!i.length)return;const n=P().getRangeAt(0);n.deleteContents(),n.insertNode(document.createTextNode(i)),w()},e=>e.replace("-webkit-text-stroke","--text-stroke").replace("text-shadow","--text-shadow"),u,p,h,m,$,f,()=>k(),()=>v&&v.focus(),y,n,function(e){Ca[e?"unshift":"push"](()=>{v=e,i(6,v)})}]}class yb extends rs{constructor(e){super(),ns(this,e,fb,$b,yr,{spellcheck:1,autocorrect:2,autocapitalize:3,wrapLines:4,allowNewline:5,textFormat:16,formatInput:17,formatPaste:18,styles:19,innerHTML:0,oninput:20,enableTextStyleShortcuts:21,confirm:22,focus:23,select:24},null,[-1,-1])}get spellcheck(){return this.$$.ctx[1]}set spellcheck(e){this.$$set({spellcheck:e}),Oa()}get autocorrect(){return this.$$.ctx[2]}set autocorrect(e){this.$$set({autocorrect:e}),Oa()}get autocapitalize(){return this.$$.ctx[3]}set autocapitalize(e){this.$$set({autocapitalize:e}),Oa()}get wrapLines(){return this.$$.ctx[4]}set wrapLines(e){this.$$set({wrapLines:e}),Oa()}get allowNewline(){return this.$$.ctx[5]}set allowNewline(e){this.$$set({allowNewline:e}),Oa()}get textFormat(){return this.$$.ctx[16]}set textFormat(e){this.$$set({textFormat:e}),Oa()}get formatInput(){return this.$$.ctx[17]}set formatInput(e){this.$$set({formatInput:e}),Oa()}get formatPaste(){return this.$$.ctx[18]}set formatPaste(e){this.$$set({formatPaste:e}),Oa()}get styles(){return this.$$.ctx[19]}set styles(e){this.$$set({styles:e}),Oa()}get innerHTML(){return this.$$.ctx[0]}set innerHTML(e){this.$$set({innerHTML:e}),Oa()}get oninput(){return this.$$.ctx[20]}set oninput(e){this.$$set({oninput:e}),Oa()}get enableTextStyleShortcuts(){return this.$$.ctx[21]}set enableTextStyleShortcuts(e){this.$$set({enableTextStyleShortcuts:e}),Oa()}get confirm(){return this.$$.ctx[22]}get focus(){return this.$$.ctx[23]}get select(){return this.$$.ctx[24]}}const bb=["i","b","u","strike"].map(e=>({tag:e,tagOpen:new RegExp(`<${e}>`,"g"),tagClose:new RegExp(`</${e}>`,"g"),placeholderOpen:new RegExp(`___${e}O___`,"g"),placeholderClose:new RegExp(`___${e}C___`,"g")}));var xb=e=>e=((e,t=bb)=>(t.forEach(({tag:t,placeholderOpen:o,placeholderClose:i})=>{e=e.replace(o,`<${t}>`).replace(i,`</${t}>`)}),e))(e=(e=((e,t=bb)=>(t.forEach(({tag:t,tagOpen:o,tagClose:i})=>{e=e.replace(o,`___${t}O___`).replace(i,`___${t}C___`)}),e))(e)).replace(/ {2,}/g," ").replace(/\u00a0/g,"&nbsp;").split("\n").join("<br>")),vb=(e,t)=>y(e)?parseFloat(e)/100*t:e,Sb=(e,t)=>({x:Jo(e.x,t.width),y:Jo(e.y,t.height)});function wb(e,t,o){const i=e.slice();return i[323]=t[o],i[325]=o,i}function kb(e,t){let o,i,n,r,a,s,l,c,d,u,p,h=t[323].name+"";function m(){return t[205](t[325])}return n=new qp({props:{color:t[323].color}}),{key:e,first:null,c(){o=Ur("li"),i=Ur("button"),ts(n.$$.fragment),r=Xr(),a=Ur("span"),s=Zr(h),c=Xr(),Qr(i,"class","PinturaShapeListItem"),Qr(i,"type","button"),Qr(i,"aria-label",l="Select shape "+t[323].name),this.first=o},m(e,t){Hr(e,o,t),_r(o,i),os(n,i,null),_r(i,r),_r(i,a),_r(a,s),_r(o,c),d=!0,u||(p=qr(i,"click",m),u=!0)},p(e,o){t=e;const r={};16777216&o[0]&&(r.color=t[323].color),n.$set(r),(!d||16777216&o[0])&&h!==(h=t[323].name+"")&&na(s,h),(!d||16777216&o[0]&&l!==(l="Select shape "+t[323].name))&&Qr(i,"aria-label",l)},i(e){d||(ja(n.$$.fragment,e),d=!0)},o(e){Ua(n.$$.fragment,e),d=!1},d(e){e&&jr(o),is(n),u=!1,p()}}}function Cb(e){let t,o;return t=new ub({props:{visible:!0,points:e[15],bounds:e[5],rotatorPoint:e[32],scalarPoint:e[31],selectedPoint:e[20],enableDragEdges:e[21],enableDragPoints:e[34],enableRotatePoints:e[19],enableScalePoints:e[17]}}),t.$on("resizestart",e[43]),t.$on("resizemove",e[44]),t.$on("resizeend",e[45]),t.$on("rotatestart",e[46]),t.$on("rotatemove",e[47]),t.$on("rotateend",e[48]),t.$on("scalestart",e[49]),t.$on("scalemove",e[50]),t.$on("scaleend",e[51]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};32768&o[0]&&(i.points=e[15]),32&o[0]&&(i.bounds=e[5]),2&o[1]&&(i.rotatorPoint=e[32]),1&o[1]&&(i.scalarPoint=e[31]),1048576&o[0]&&(i.selectedPoint=e[20]),2097152&o[0]&&(i.enableDragEdges=e[21]),8&o[1]&&(i.enableDragPoints=e[34]),524288&o[0]&&(i.enableRotatePoints=e[19]),131072&o[0]&&(i.enableScalePoints=e[17]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Tb(e){let t,o,i,n;const r=[Pb,Mb],a=[];function s(e,t){return"modal"===e[6]?0:"inline"===e[6]?1:-1}return~(t=s(e))&&(o=a[t]=r[t](e)),{c(){o&&o.c(),i=Yr()},m(e,o){~t&&a[t].m(e,o),Hr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),ja(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(ja(o),n=!0)},o(e){Ua(o),n=!1},d(e){e&&jr(i),~t&&a[t].d(e)}}}function Mb(e){let t,o,i,n,r,a,s={formatInput:e[53],wrapLines:!!e[16].width,textFormat:e[16].format,enableTextStyleShortcuts:e[7],allowNewline:e[33],styles:e[30]};return o=new yb({props:s}),e[209](o),o.$on("input",e[54]),o.$on("keyup",e[58]),o.$on("cancel",e[60]),o.$on("confirm",e[59]),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaInlineInput")},m(s,l){Hr(s,t,l),os(o,t,null),n=!0,r||(a=[Ar(i=fd.call(null,t,e[29])),qr(t,"focusout",e[210])],r=!0)},p(e,t){const n={};65536&t[0]&&(n.wrapLines=!!e[16].width),65536&t[0]&&(n.textFormat=e[16].format),128&t[0]&&(n.enableTextStyleShortcuts=e[7]),4&t[1]&&(n.allowNewline=e[33]),1073741824&t[0]&&(n.styles=e[30]),o.$set(n),i&&fr(i.update)&&536870912&t[0]&&i.update.call(null,e[29])},i(e){n||(ja(o.$$.fragment,e),n=!0)},o(e){Ua(o.$$.fragment,e),n=!1},d(i){i&&jr(t),e[209](null),is(o),r=!1,$r(a)}}}function Pb(e){let t,o;return t=new rm({props:{panelOffset:e[3],onconfirm:e[59],oncancel:e[60],buttonCancel:{icon:e[8].shapeIconInputCancel,label:e[8].shapeLabelInputCancel},buttonConfirm:{icon:e[8].shapeIconInputConfirm,label:e[8].shapeLabelInputConfirm,hideLabel:!0},willHandleKeydown:e[208],$$slots:{default:[Rb]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8&o[0]&&(i.panelOffset=e[3]),256&o[0]&&(i.buttonCancel={icon:e[8].shapeIconInputCancel,label:e[8].shapeLabelInputCancel}),256&o[0]&&(i.buttonConfirm={icon:e[8].shapeIconInputConfirm,label:e[8].shapeLabelInputConfirm,hideLabel:!0}),8192&o[0]&&(i.willHandleKeydown=e[208]),1342177792&o[0]|65536&o[10]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Rb(e){let t,o,i,n;return{c(){t=Ur("textarea"),Qr(t,"spellcheck","false"),Qr(t,"autocorrect","off"),Qr(t,"autocapitalize","off")},m(r,a){Hr(r,t,a),e[206](t),ra(t,e[28]),i||(n=[qr(t,"keydown",e[56]),qr(t,"keypress",e[55]),qr(t,"keyup",e[58]),qr(t,"input",e[54]),qr(t,"input",e[207]),Ar(o=fd.call(null,t,e[30]))],i=!0)},p(e,i){268435456&i[0]&&ra(t,e[28]),o&&fr(o.update)&&1073741824&i[0]&&o.update.call(null,e[30])},d(o){o&&jr(t),e[206](null),i=!1,$r(n)}}}function Ib(e){let t,o,i,n,r;return o=new Rh({props:{items:e[25],key:e[12]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaShapeControls"),aa(t,"transform",e[27]),aa(t,"opacity",e[26])},m(a,s){Hr(a,t,s),os(o,t,null),i=!0,n||(r=[qr(t,"measure",e[211]),Ar(qc.call(null,t))],n=!0)},p(e,i){const n={};33554432&i[0]&&(n.items=e[25]),4096&i[0]&&(n.key=e[12]),o.$set(n),134217728&i[0]&&aa(t,"transform",e[27]),67108864&i[0]&&aa(t,"opacity",e[26])},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o),n=!1,$r(r)}}}function Eb(e){let t,i,n,r,a,s,l,c,d,u,p=[],h=new Map,m=Xa(e[24]);const g=e=>e[323].id;for(let t=0;t<m.length;t+=1){let o=wb(e,m,t),i=g(o);h.set(i,p[t]=kb(i,o))}let $=e[18]&&Cb(e),f=e[14]&&Tb(e),y=e[22]>0&&Ib(e);return{c(){t=Ur("div"),i=Ur("nav"),n=Ur("ul");for(let e=0;e<p.length;e+=1)p[e].c();r=Xr(),$&&$.c(),a=Xr(),f&&f.c(),s=Xr(),y&&y.c(),Qr(i,"class","PinturaShapeList"),Qr(i,"data-visible",e[23]),Qr(t,"class","PinturaShapeEditor"),Qr(t,"tabindex","0")},m(h,m){Hr(h,t,m),_r(t,i),_r(i,n);for(let e=0;e<p.length;e+=1)p[e]&&p[e].m(n,null);_r(t,r),$&&$.m(t,null),_r(t,a),f&&f.m(t,null),_r(t,s),y&&y.m(t,null),e[212](t),c=!0,d||(u=[qr(i,"focusin",e[63]),qr(i,"focusout",e[64]),qr(t,"keydown",function(){fr(e[0]?o:e[52])&&(e[0]?o:e[52]).apply(this,arguments)}),qr(t,"nudge",function(){fr(e[0]?o:e[62])&&(e[0]?o:e[62]).apply(this,arguments)}),qr(t,"measure",e[204]),qr(t,"pointermove",function(){fr(e[0]?o:e[65])&&(e[0]?o:e[65]).apply(this,arguments)}),qr(t,"pointerleave",function(){fr(e[0]?o:e[66])&&(e[0]?o:e[66]).apply(this,arguments)}),qr(t,"interactionstart",function(){fr(e[0]?o:e[37])&&(e[0]?o:e[37]).apply(this,arguments)}),qr(t,"interactionupdate",function(){fr(e[0]?o:e[39])&&(e[0]?o:e[39]).apply(this,arguments)}),qr(t,"interactioncancel",function(){fr(e[0]?o:e[38])&&(e[0]?o:e[38]).apply(this,arguments)}),qr(t,"interactionrelease",function(){fr(e[0]?o:e[40])&&(e[0]?o:e[40]).apply(this,arguments)}),qr(t,"interactionend",function(){fr(e[0]?o:e[41])&&(e[0]?o:e[41]).apply(this,arguments)}),Ar(qc.call(null,t)),Ar(xp.call(null,t)),Ar(l=Wh.call(null,t,{drag:!0,inertia:!0,multiTouch:!1,observeKeys:!0,shouldStartInteraction:Fb,getEventPosition:e[213]}))],d=!0)},p(o,r){e=o,16777216&r[0]|32&r[2]&&(m=Xa(e[24]),Na(),p=Ka(p,r,g,1,e,m,h,n,qa,kb,null,wb),Ha()),(!c||8388608&r[0])&&Qr(i,"data-visible",e[23]),e[18]?$?($.p(e,r),262144&r[0]&&ja($,1)):($=Cb(e),$.c(),ja($,1),$.m(t,a)):$&&(Na(),Ua($,1,1,()=>{$=null}),Ha()),e[14]?f?(f.p(e,r),16384&r[0]&&ja(f,1)):(f=Tb(e),f.c(),ja(f,1),f.m(t,s)):f&&(Na(),Ua(f,1,1,()=>{f=null}),Ha()),e[22]>0?y?(y.p(e,r),4194304&r[0]&&ja(y,1)):(y=Ib(e),y.c(),ja(y,1),y.m(t,null)):y&&(Na(),Ua(y,1,1,()=>{y=null}),Ha()),l&&fr(l.update)&&16&r[0]&&l.update.call(null,{drag:!0,inertia:!0,multiTouch:!1,observeKeys:!0,shouldStartInteraction:Fb,getEventPosition:e[213]})},i(e){if(!c){for(let e=0;e<m.length;e+=1)ja(p[e]);ja($),ja(f),ja(y),c=!0}},o(e){for(let e=0;e<p.length;e+=1)Ua(p[e]);Ua($),Ua(f),Ua(y),c=!1},d(o){o&&jr(t);for(let e=0;e<p.length;e+=1)p[e].d();$&&$.d(),f&&f.d(),y&&y.d(),e[212](null),d=!1,$r(u)}}}const Ab=256,Lb="markup-hover",Fb=(e,t)=>e.target===t||"PinturaContentEditable"===e.target.className;function zb(e,t,i){let n,r,a,s,l,c,d,u,p,h,m,g,$,f,b,x,v,S,w,k,C,T,M,P,R,I,E,A,L,F,z,D,O,W,_,V,H,j,U,G,Z,X,Y,q,K,J,Q,te,oe,ie,ne,re,ae,se,le,ce,de,ue,pe,he,me,$e,xe,Se,ke,Ee,Le,Fe,Oe=ur,Ve=()=>(Oe(),Oe=vr(Ye,e=>i(199,xe=e)),Ye),Ne=ur,je=()=>(Ne(),Ne=vr(qe,e=>i(203,Fe=e)),qe);e.$$.on_destroy.push(()=>Oe()),e.$$.on_destroy.push(()=>Ne());let{uid:Ue=B()}=t,{ui:Ge}=t,{disabled:Xe=!1}=t,{shapes:Ye}=t;Ve();let{selection:qe}=t;je();let{offset:Ke}=t,{contextRotation:Je=0}=t,{contextFlipX:tt=!1}=t,{contextFlipY:it=!1}=t,{contextZoom:nt=1}=t,{active:rt=!1}=t,{opacity:at=1}=t,{parentRect:st}=t,{rootRect:lt}=t,{utilRect:pt}=t,{hoverColor:gt}=t,{caretColor:$t}=t,{gridColor:ft}=t,{snapColor:yt}=t,{textInputMode:bt="inline"}=t,{oninteractionstart:xt=o}=t,{oninteractionupdate:vt=o}=t,{oninteractionrelease:St=o}=t,{oninteractionend:wt=o}=t,{oninteractioncancel:Ct=o}=t,{onaddshape:Tt=o}=t,{onupdateshape:Mt=o}=t,{onselectshape:Et=o}=t,{onblurshape:At=o}=t,{onremoveshape:Lt=o}=t,{ontapshape:Ft=o}=t,{onhovershape:zt=o}=t,{ontriggerhistorywrite:Dt=o}=t,{onhovercanvas:Wt=o}=t,{ontapcanvas:Vt=o}=t,{onleavecanvas:Nt=o}=t,{beforeSelectShape:Xt=()=>!0}=t,{beforeDeselectShape:Yt=()=>!0}=t,{beforeRemoveShape:qt=()=>!0}=t,{beforeUpdateShape:Kt=(e,t,o)=>t}=t,{willRenderShapeControls:Jt=ee}=t,{willRenderShapeTextControls:Qt=ee}=t,{willStartInteraction:eo=(e,t)=>!0}=t,{mapEditorPointToImagePoint:to}=t,{mapImagePointToEditorPoint:oo}=t,{eraseRadius:io}=t,{selectRadius:no}=t,{enableButtonFlipVertical:ro=!1}=t,{enableTapToAddText:ao=!0}=t,{enableMultiSelect:so=!1}=t,{enableTextStyleControls:lo=!0}=t,{locale:co}=t,{snapThreshold:uo=0}=t,{snapPointer:po=!0}=t,{enableSnapToContext:ho=!0}=t,{gridSize:mo=0}=t;const go=e=>{if(0===uo)return[];let t;return ho&&(t={...st,x:0,y:0}),[...xe.filter(t=>t!==e).filter(e=>!Zi(e)).filter(e=>(e=>!0!==e.disableAcceptSnap)(e)).map(e=>An({...e},st)),t].filter(Boolean)},$o=(e,t,o,i)=>0===e?{snapTargets:[]}:{snapThreshold:e,gridSize:t,gridRect:o,snapTargets:go(i)},fo=Sa("isAnimated");wr(e,fo,e=>i(200,ke=e));const yo=Sa("softKeyboardState"),bo=e=>e.set(Sr(e)),xo=e=>Sr(e).find(Zi),vo=(e,t)=>{if(!xo(t))return Ji(e),Co(e,t)},So=e=>{xo(e)&&e.update(e=>e.filter(e=>!Zi(e)))},wo=e=>{const t=xo(e);if(t)return Qi(t),bo(e),t},ko=(e,t,o=(e,t)=>({...e,...t}))=>{xo(t)&&t.update(t=>t.map(t=>Zi(t)?o(t,e):t))},Co=(e,t=Ye)=>(t.update(t=>[...t,e]),e),To=(e,t,o)=>{const i=Kt({...e},t,{...o});return Dn(e,i,o),e},Mo=(e,t)=>{const o=De(e,t),i=Te(e,t),n=Math.PI/8,r=n*Math.round(i/n)-Je%n;t.x=e.x+o*Math.cos(r),t.y=e.y+o*Math.sin(r)},Po=Sa("keysPressed");wr(e,Po,e=>i(201,Ee=e));const Ro=(e,t,o)=>0===e||t&&o?e:t||o?-e:e,Io=e=>{if(null===e.x&&null===e.y)return Eo();e.x&&i(152,Ao=to({x:e.x,y:0}).x),e.y&&i(153,Lo=to({x:0,y:e.y}).y)},Eo=()=>{i(152,Ao=null),i(153,Lo=null)};let Ao=null,Lo=null,Fo=!1;const zo=(e,t)=>{const o=oo(e);return to(Re(o,t))},Do=(e,t,o)=>{const i=(o-t)/e+1;return Array.from({length:i},(o,i)=>t+i*e)},Oo=e=>{let t=[],o=[],i=e.points;if(void 0!==e.x1&&(i=[{x:e.x1,y:e.y1},{x:e.x2,y:e.y2}]),i){const e=i.map(oo),n=dt(e),r=e[0],a=e[e.length-1];t=[n.x,n.x+.5*n.width,n.x+n.width,r.x,a.x],o=[n.y,n.y+.5*n.height,n.y+n.height,r.y,a.y]}else if(e.text||void 0!==e.width||void 0!==e.rx){let i;if(e.text&&void 0===e.height){const t=hi(e.text,e);i=ht(e.x,e.y,t.width,t.height)}else i=void 0!==e.width?ct(e):ct({x:e.x-e.rx,y:e.y-e.ry,width:2*e.rx,height:2*e.ry});const n=It(i).map(oo),r=Math.abs(e.rotation)>0?kt(i,e.rotation).map(oo):n,a=dt(r),s=mt(a),l=.5*a.width,c=.5*a.height;t=[s.x-l,s.x,s.x+l],o=[s.y-c,s.y,s.y+c]}else if(void 0!==e.x){const i=oo(e);t=[i.x],o=[i.y]}return{x:t,y:o}},Bo=(e,t,o)=>{let i,n,r,a=Number.Infinity,s=null,l=null;for(let c=0;c<e.length;c++){n=e[c];for(let e=0;e<t.length;e++)r=t[e],i=Math.abs(n-r),i<o&&(null===l||i<a)&&(a=i,s=n,l=r)}return{origin:s,target:l}},Wo=(e,t,o,i,n)=>{const r={x:null,y:null},a={x:null,y:null},s=t.map(Oo);if(i>0){const e=oo({x:0,y:0}),t=oo({x:i,y:i}),o=oo({x:n.width,y:n.height}),r=t.x-e.x,a=Do(r,e.x,o.x),l=Do(r,e.y,o.y);s.push({x:a,y:l})}return s.forEach(t=>{const{snapTranslation:i,snapLine:n}=((e,t,o)=>{const i={x:null,y:null},n={x:null,y:null},r=Bo(e.x,t.x,o);null!==r.target&&(i.x=r.target,n.x=r.target-r.origin);const a=Bo(e.y,t.y,o);return null!==a.target&&(i.y=a.target,n.y=a.target-a.origin),{snapTranslation:n,snapLine:i}})(e,t,o);null!==i.x&&(null===a.x||Math.abs(i.x)<Math.abs(a.x))&&(a.x=i.x||0,r.x=n.x),null!==i.y&&(null===a.y||Math.abs(i.y)<Math.abs(a.y))&&(a.y=i.y||0,r.y=n.y)}),{snapTranslation:a,snapLines:r}},_o=(e,t)=>(null!==t.x&&(e.x+=t.x),null!==t.y&&(e.y+=t.y),e),Vo=(e,t,o,i)=>{const{snapThreshold:n=0,gridSize:r=0,gridRect:a,snapTargets:s=[]}=i||{};let l=null;if(Vi(e)){if(n){const i=An({...e},st),l=zo(Fi(t),o),c=zo(zi(t),o),d=Oo({...i,x1:l.x,y1:l.y,x2:c.x,y2:c.y}),{snapTranslation:u,snapLines:p}=Wo(d,s,n,r,a);_o(o,u),Io(p)}const i=zo(Fi(t),o),c=zo(zi(t),o);l={x1:i.x,y1:i.y,x2:c.x,y2:c.y}}else if(e.points){if(cn(Ii)&&ri(Ii,{selectedPoint:void 0}),n){const i=An({...e},st),l=Oo({...i,points:t.points.map(e=>zo(e,o))}),{snapTranslation:c,snapLines:d}=Wo(l,s,n,r,a);_o(o,c),Io(d)}l={points:t.points.map(e=>zo(e,o))}}else if(Wi(e)||Di(e)||_i(e)){if(n){const i=An({...e},st),l=zo(t,o),c=Oo({...i,...l}),{snapTranslation:d,snapLines:u}=Wo(c,s,n,r,a);_o(o,d),Io(u)}l=zo(t,o)}l&&(To(e,l,st),ii())},Ho={0:1,1:0,2:3,3:2},Uo={0:3,1:2,2:1,3:0},Go=(e,t,i,n,r)=>{const{shiftKey:a,snapThreshold:s=0,gridSize:l=0,gridRect:c,snapTargets:d=[],aspectRatio:u,beforeResizeShape:p=o}=r||{},h=s?(e,t,o)=>{const{snapTranslation:i,snapLines:n}=Wo(Oo(e),d,s,l,c);_o(t,i),Io(n);const r=zo(o(),t);e.x=r.x,e.y=r.y}:o;if(Vi(e)||Ni(e)&&jo(e,"pathClose")){const[o]=i,r=a?Mo:(e,t)=>t;let s,l,c;if(Vi(e))0===o?(s=()=>Fi(t),l=e=>r(zi(t),e),c=(e,t)=>{To(e,{x1:t.x,y1:t.y},st)}):1===o&&(s=()=>zi(t),l=e=>r(Fi(t),e),c=(e,t)=>{To(e,{x2:t.x,y2:t.y},st)});else{const e=t.points;s=()=>({...e[o]}),l=t=>{const i=e[ib(o-1,e)],n=e[ib(o+1,e)];r(i,t),r(n,t)},c=(e,t)=>{To(e,{points:e.points.map((e,i)=>o===i?t:e)},st)}}const d=zo(s(),n);h(d,n,s),l(d),c(e,d)}else if(Xi(e)||_i(e)||Di(e)){let o,a=!1,s=!1;if(_i(t))o=ut(t);else if(Xi(t))o=ct(t);else if(jo(t,"width")){a=!0,o=ct(t);const e=hi(t.text,t);o.height=e.height}else{s=!0,o=ct(t);const e=hi(t.text,t);o.width=e.width,o.height=e.height}let l=u;e.aspectRatio?l=e.aspectRatio:!r.shiftKey||a||s||(l=o.width/o.height);const c=ct(o),d=mt(c),m=e.rotation,g=It(c),$=kt(c,m);if(1===i.length){let t=i[0];e.flipX&&(t=Ho[t]),e.flipY&&(t=Uo[t]);const[o,r,a,s]=g,c=oo($[t]),u=Re({...c},n),f=to(u);h(f,n,()=>to(c));const y=be(f.x-$[t].x,f.y-$[t].y),b=we(ve(y),-m),x=be(g[t].x+b.x,g[t].y+b.y);let v;0===t&&(v=a),1===t&&(v=s),2===t&&(v=o),3===t&&(v=r);const S=dt([v,x]);if(l){const{width:e,height:t}=Pt(S,l),[o,i,n,r]=Rt(S);S.width=e,S.height=t,x.y<v.y&&(S.y=n-t),x.x<v.x&&(S.x=i-e)}const w=kt(S,m,d),k=Be(w),C=we(w[0],-m,k),T=we(w[2],-m,k),M=dt([C,T]);p(M),To(e,_i(e)?fe(M):M,st)}else{i=i.map(t=>(e.flipX&&(t=Ho[t]),e.flipY&&(t=Uo[t]),t));const[t,o]=i.map(e=>$[e]),r={x:t.x+.5*(o.x-t.x),y:t.y+.5*(o.y-t.y)},[s,c]=i.map(e=>g[e]),[u,p]=i.map(e=>{const t=e+2;return t<4?g[t]:g[t-4]}),f={x:u.x+.5*(p.x-u.x),y:u.y+.5*(p.y-u.y)},y=oo(r),b=Re({...y},n),x=to(b);h(x,n,()=>to(y));const v=be(x.x-r.x,x.y-r.y),S=we(ve(v),-m),w=Ie(ve(s),c),k=Pe(w,e=>1-Math.abs(Math.sign(e))),C=be(S.x*k.x,S.y*k.y);Re(s,C),Re(c,C);const T=dt(g);if(l){let e=T.width,t=T.height;0===k.y?t=e/l:e=t*l,T.width=e,T.height=t,0===k.y?T.y=f.y-.5*t:T.x=f.x-.5*e}const M=kt(T,m,d),P=Be(M),R=we(M[0],-m,P),I=we(M[2],-m,P),E=dt([R,I]);let A;_i(e)?A=fe(E):Xi(e)?A=E:a&&(A={x:E.x,y:E.y,width:E.width}),To(e,A,st)}}ii()};let Zo;const Xo=(e,t)=>{const o=e.points.filter((e,o)=>o!==t);To(e,{points:o,selectedPoint:void 0},st),ii()},Yo=()=>{if(Fe.length)return Fe.find(Zi)},qo=()=>{if(Fe.length)return Fe.findIndex(Zi)},Ko=()=>{if(xe.length)return xe.find(Zi)},ei=()=>{if(xe.length)return xe.findIndex(Zi)},ti=()=>{const e=Ko();if(e)return Qi(e),ii(),e},oi=()=>{if(!Ko())return;const e=[...xe];e.splice(ei(),1),Ye.set(e)},ii=()=>{Ye.set(xe)},ni=(e,t=[],o=!0)=>{t.filter(Boolean).forEach(t=>delete e[t]),o&&ii()},ri=(e,t,o=!0)=>{e=Object.assign(e,t),o&&ii()},ai=(e,t,o,i=!0)=>{e[t]=o,i&&ii()},si=(e,t=!0)=>{xe.forEach(t=>ri(t,e,!1)),t&&ii()},li=()=>[...xe].reverse().filter(Ui),ci=()=>[...xe].reverse().find(Ui),di=()=>!!ci(),ui=(e,t=!0,o=!1)=>{const i=xe.filter(e=>nn(e)&&on(e)),n=i.findIndex(t=>t===e),r=((e,t=!1)=>{if(!qt(e))return!1;Ye.set(xe.filter(t=>t!==e)),t||Lt(e)})(e,o);if(!1===r)return;if(mi=e,i.length-1<=0)return gi();if(!t)return!0;const a=n-1<0?i.length-1:n-1;return fi(i[a]),!0},pi=()=>{if(s){const e=[];return a.forEach((t,o)=>{if(!nn(t))return;ui(t,o===a.length-1,!0)&&e.push(t)}),void(e.length&&Dt())}const e=ci();e&&ui(e)};let mi;const gi=(e={})=>{const{storePrevious:t=!0}=e;Object.keys(Qn).forEach(e=>Qn[e]={});const o=$i();t&&(mi=o),si({isSelected:!1,isEditing:!1,_prerender:!1}),o&&At(o)},$i=()=>xe.find(Ui),fi=(e,t=!0,o=!1)=>{if(Zi(e))return;const i=$i()||mi,n=Ui(e);mi=void 0,Xt(i,e)&&(o||gi(),(e=>{e.isSelected=!0})(e),!n&&Et(e),t&&ii())},yi=e=>{jn&&jn.confirm&&e.isEditing&&jn.confirm();const t={isSelected:!1,isEditing:!1,_prerender:!1};e.selectedPoint>-1&&(t.selectedPoint=void 0),ri(e,t),At(e)},bi=e=>{ri(e,{isSelected:!0,isEditing:!0,_prerender:"inline"===bt})},xi=e=>{ri(e,{isSelected:!0,isEditing:!1,_prerender:!1})},vi=e=>{if(!e.length)return[];const t=e.filter(qt);return Ye.set(xe.filter(e=>!t.includes(e))),t},Si=e=>{const t=hi(e.text,e);return ht(e.x,e.y,e.width?Math.min(e.width,t.width):t.width,e.height?Math.min(e.height,t.height):t.height)},wi=e=>{if(Xi(e))return ct(e);if(_i(e))return ut(e);const t=Si(e);return t.width=Math.max(0,e.width||t.width),t},ki=(e,t,o=0,i=()=>!0)=>[...e].reverse().filter(i).map(e=>({shape:e,priority:1})).filter(e=>{const{shape:i}=e,n=An(Ri(i),st),r=o+.5*(n.strokeWidth||0);if(Wi(n))return Zt(t,r,n,i.rotation);if(Di(n)){const o=wi(n),a=Zt(t,r,o,i.rotation);let s=!1;if(a&&!Ui(i)){const a=Si(n);"right"!==i.textAlign||i.flipX||(a.x=o.x+o.width-a.width),"center"===i.textAlign&&(a.x=o.x+.5*o.width-.5*a.width),s=Zt(t,r,a,i.rotation,mt(o)),s||(e.priority=-1)}return a}return _i(n)?((e,t,o,i,n,r)=>{const a=Ht(be(o.x,o.y),o.rx,o.ry,i,n,r,12);return Gt(e,t,a)})(t,r,n,i.rotation,i.flipX,i.flipY):Vi(n)?jt(t,Math.max(16,r),Fi(n),zi(n)):Ni(n)&&n.pathClose?Gt(t,r,n.points):!!Ni(n)&&(1===n.points.length?ze(t,n.points[0])<r*r:Ut(t,Math.max(16,r),n.points))}).sort((e,t)=>e.priority<t.priority?1:e.priority>t.priority?-1:0).map(e=>e.shape),Ci=(e,t,o,i=0)=>{const n=Math.abs(i),r=et(t,o),a=ot(r,n),s=(({start:e,end:t},o)=>{if(0===o)return[be(e.x,e.y),be(e.x,e.y),be(t.x,t.y),be(t.x,t.y)];const i=Math.atan2(t.y-e.y,t.x-e.x),n=Math.sin(i)*o,r=Math.cos(i)*o;return[be(n+e.x,-r+e.y),be(-n+e.x,r+e.y),be(-n+t.x,r+t.y),be(n+t.x,-r+t.y)]})(a,n),l=e.filter(e=>{const t=An(Ri(e),st);if(Vi(t)||Ni(t)){const e=t.points?[...t.points]:[Fi(t),zi(t)];return!!Ot(a,e)}return((e,t)=>!!e.find(e=>Bt(e,t))||!!t.find(t=>Bt(t,e)))(s,((e,t=12)=>{if(Wi(e))return kt(e,e.rotation,mt(e));if(Di(e)){const t=wi(e);return kt(t,e.rotation,mt(t))}return _i(e)?Ht(be(e.x,e.y),e.rx,e.ry,e.rotation,e.flipX,e.flipY,t):[]})(t))});return l};let Ti,Mi,Pi,Ii,Ei,Ai,Li,ji=!1,Gi=!1,Yi=!1,qi=!1;const Ki=e=>{Li=e.map(e=>({shape:e,shapeOrigin:Ri(e),shapeOriginComputed:An(Ri(e),st)}))},hn=()=>{clearTimeout(Mi),Mi=void 0,i(156,qi=!1),Eo()};let mn=null;const gn=e=>{const t=No(e.rotation)&&0!==e.rotation;if(Wi(e)){const o=mt(e),i=It(e);return(e.flipX||e.flipY)&&We(i,e.flipX,e.flipY,o.x,o.y),t?_e(i,e.rotation,o.x,o.y):i}if(_i(e)){const o=e,i=It(ut(e));return(e.flipX||e.flipY)&&We(i,e.flipX,e.flipY,o.x,o.y),t?_e(i,e.rotation,o.x,o.y):i}if(Vi(e))return[Fi(e),zi(e)];if(Ni(e)){if(e.bitmap&&!jo(e,"pathClose")){const t=dt(e.points);t.x-=.5*e.strokeWidth,t.y-=.5*e.strokeWidth,t.width+=e.strokeWidth,t.height+=e.strokeWidth;return gn({...e,...t})}return[...e.points]}if(Di(e)){const o=wi(e),i=mt(o),n=It(o);return(e.flipX||e.flipY)&&We(n,e.flipX,e.flipY,i.x,i.y),t?_e(n,e.rotation,i.x,i.y):n}return[]},$n=e=>{const t=gn(e);let o,i;return e.flipY?(o=Be([t[0],t[1]]),i=Ce(be(t[1].x-t[2].x,t[1].y-t[2].y))):(o=Be([t[2],t[3]]),i=Ce(be(t[2].x-t[1].x,t[2].y-t[1].y))),Ae(i,20/nt),{origin:o,dir:i}};const fn=e=>t=>t.id===e,yn=e=>{const t=fn(e);return e=>e.filter((e=>t=>!e(t))(t))},bn=e=>{const t=fn(e),o=yn(e);return()=>Ge.update(e=>e.some(t)?o(e):e)},xn=e=>{const t=yn(e);return(...e)=>{Ge.update(o=>[...t(o),...e.filter(Boolean)])}},vn=bn(Lb),Sn=xn(Lb);let wn;const Cn="markup-manipulator-segment-"+Ue,Tn=bn(Cn),Mn=xn(Cn),Pn=(e,t)=>{const o=e[t],i=t-1<0?e[e.length-1]:e[t-1],n=t+1<e.length?e[t+1]:e[0],r=Ie(ve(i),o);Ce(r);const a=Re(Ae(r,10),o),s=Ie(ve(n),o);Ce(s);return[a,o,Re(Ae(s,10),o)]},Rn=()=>{i(157,wn=void 0),vn()},In="markup-multi-selection-segment-"+Ue,En=bn(In),Ln=xn(In),Fn=(e,t)=>{if(uo<=0)return e;if(t)return Eo(),e;const o=to(e),i=go(),{snapTranslation:r,snapLines:a}=Wo(Oo(o),i,uo,mo,n);return Io(a),_o(e,r),e},On=Fc(0);wr(e,On,e=>i(202,Le=e));const Bn=`markup-grid-line-${Ue}`,Wn=bn(Bn),_n=xn(Bn),Vn="markup-snap-line",Nn=bn(Vn),Hn=xn(Vn);let jn;yo.subscribe(e=>{"inline"===bt&&r&&r.isEditing&&"hidden"===e&&Yn()});const Un=e=>{i(9,jn.innerHTML=xb(e),jn)},Gn=e=>{const t=void 0===e.value?e.innerHTML:e.value,o="text"===r.format?mb(t).split(/<br>|<br\/>/g).join("\n").replace(/&nbsp;/g,String.fromCharCode(160)).replace(/&amp;/g,"&"):t;const i=Oi(r)&&!1!==r.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;return i},Zn=()=>{const e=Gn(jn),t=sn(r,e),o=!0===t?e:t;let i=j.x,n=j.y;if(!r.height){const e=kt({...G},r.rotation),t=hi(o,p),a=kt({x:i,y:n,...t},r.rotation),[s,,l]=e,[c,,d]=a;let u=s,h=c;r.flipX&&(u=l,h=d);const m=Ie(ve(u),h);i+=m.x,n+=m.y}To(r,{x:i,y:n,text:o},st),ii()},Xn=e=>{const{key:t,ctrlKey:o,metaKey:i,altKey:n}=e;return"Enter"===t&&(o||n||i)},Yn=()=>{d&&ti(),jn&&jn.confirm&&jn.confirm(),jn&&Zn(),xi(r),Mt(r)},qn=()=>{d?oi():(ri(r,{text:H.text,x:H.x,y:H.y}),xi(r))},Kn=(e,t,{flipX:o,flipY:i,rotation:n},r="top left")=>{let a,s;const[l,c,d,u]=kt(e,n),[p,h,m,g]=kt(t,n);if("top center"===r){a=Be(i?[u,d]:[l,c]),s=Be(i?[g,m]:[p,h])}else"top right"===r&&!o||"top left"===r&&o?(a=i?d:c,s=i?m:h):(a=i?u:l,s=i?g:p);return Ie(ve(a),s)},Jn=(e,t,o)=>be(y(e.x)?Jo(t.x+o.x,st.width):t.x+o.x,y(e.y)?Jo(t.y+o.y,st.height):t.y+o.y),Qn={},er=()=>Xo(r,r.selectedPoint),tr=()=>bi(r),or=(e,t,o)=>{const{width:i,height:n,...r}=o,a=hi(t.text,r),s=Kn(ht(o.x,o.y,e.width,e.height),ht(o.x,o.y,a.width,a.height),o,`top ${t.textAlign}`),l=!1!==o.disableNewline;ni(t,["width","height",l&&"textAlign"]),ri(t,{...Jn(t,o,s)})},ir=(e,t,o,i,n={})=>{const{height:r,...a}=o,s=Qe(hi(t.text,a),e=>Math.ceil(e)),l=Ze(n.width||o.width||i.width,s.height),c=n.textAlign||"left",d=Kn(ht(o.x,o.y,e.width,e.height),ht(o.x,o.y,l.width,l.height),o,`top ${c}`);ni(t,["height"]),ri(t,{...Jn(t,o,d),width:y(t.width)?Jo(l.width,st.width):l.width,textAlign:c})},nr=(e,t,o,i,n={})=>{const r=Ze(n.width||i.width,n.height||i.height),a=n.textAlign||"left",s=Kn(ht(o.x,o.y,e.width,e.height),ht(o.x,o.y,r.width,r.height),o,`top ${a}`);ri(t,{...Jn(t,o,s),width:y(t.width)?Jo(r.width,st.width):r.width,height:y(t.width)?Jo(r.height,st.height):r.height,textAlign:a})},rr=()=>{const e=Qe(hi(r.text,p),e=>Math.ceil(e)),t=jo(r,"height"),o=!t&&jo(r,"width"),i=r.id;let n=Qn[i];if(n||(Qn[i]={},n=Qn[i]),t){n.textAlign=r.textAlign,n.width=p.width,n.height=p.height;const t=Ze(p.width,p.height);ln(r,"auto-height")?ir(t,r,p,e,n):ln(r,"auto-width")&&or(t,r,p)}else if(o){n.textAlign=r.textAlign,n.width=p.width;const t=Ze(p.width,e.height);ln(r,"auto-width")?or(t,r,p):ln(r,"fixed-size")&&nr(t,r,p,e,n)}else{n.textAlign=r.textAlign||n.textAlign;const t=Ze(Math.ceil(e.width),Math.ceil(e.height));ln(r,"fixed-size")?nr(t,r,p,e,n):ln(r,"auto-height")&&ir(t,r,p,e,n)}},ar=e=>{e.stopPropagation();const t=r.flipX||!1;ai(r,"flipX",!t),Mt(r)},sr=e=>{e.stopPropagation();const t=r.flipY||!1;ai(r,"flipY",!t),Mt(r)},lr=e=>{ai(r,"opacity",e)},cr=e=>{lr(e),Mt(r)},dr=e=>{e.stopPropagation(),e.target.blur(),pi()},pr=e=>{e.stopPropagation();xe.findIndex(e=>e===r)!==xe.length-1&&(Ye.set(xe.filter(e=>e!==r).concat([r])),Mt(r))},hr=e=>{e.stopPropagation(),mr()},mr=()=>{const e=(s?a:[r]).filter(rn).map(e=>{const t=Ri(e);t.id=B();const o=be(50,-50);if(jo(t,"points")){const e=zn(t,["points"],st);e.points.forEach(e=>{e.x+=o.x,e.y+=o.y}),Dn(t,e,st)}else if(Vi(t)){const e=zn(t,["x1","y1","x2","y2"],st);e.x1+=o.x,e.y1+=o.y,e.x2+=o.x,e.y2+=o.y,Dn(t,e,st)}else{const e=zn(t,["x","y"],st);e.x+=50,e.y-=50,Dn(t,e,st)}return Ye.set([...xe,t]),Tt(t),t});if(e.length>1)return gi(),void e.forEach(e=>{fi(e,!0,!0)});fi(e[0])},gr=Fc(0,{stiffness:.2,damping:.7});wr(e,gr,e=>i(22,Se=e));let $r;const fr=(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},yr=(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 br=!1;let xr,kr=ye();const Cr=e=>{zt(e),i(157,wn=e)},Tr=e=>{fi(xe[e])};let Mr;function Pr(e){sm(e)&&e.target===Mr&&e.preventDefault()}ba(()=>{Nn(),Wn(),Tn(),vn(),Mr.removeEventListener("touchmove",Pr,!1)});return e.$$set=e=>{"uid"in e&&i(68,Ue=e.uid),"ui"in e&&i(69,Ge=e.ui),"disabled"in e&&i(0,Xe=e.disabled),"shapes"in e&&Ve(i(1,Ye=e.shapes)),"selection"in e&&je(i(2,qe=e.selection)),"offset"in e&&i(3,Ke=e.offset),"contextRotation"in e&&i(70,Je=e.contextRotation),"contextFlipX"in e&&i(71,tt=e.contextFlipX),"contextFlipY"in e&&i(72,it=e.contextFlipY),"contextZoom"in e&&i(73,nt=e.contextZoom),"active"in e&&i(74,rt=e.active),"opacity"in e&&i(75,at=e.opacity),"parentRect"in e&&i(76,st=e.parentRect),"rootRect"in e&&i(4,lt=e.rootRect),"utilRect"in e&&i(5,pt=e.utilRect),"hoverColor"in e&&i(77,gt=e.hoverColor),"caretColor"in e&&i(78,$t=e.caretColor),"gridColor"in e&&i(79,ft=e.gridColor),"snapColor"in e&&i(80,yt=e.snapColor),"textInputMode"in e&&i(6,bt=e.textInputMode),"oninteractionstart"in e&&i(81,xt=e.oninteractionstart),"oninteractionupdate"in e&&i(82,vt=e.oninteractionupdate),"oninteractionrelease"in e&&i(83,St=e.oninteractionrelease),"oninteractionend"in e&&i(84,wt=e.oninteractionend),"oninteractioncancel"in e&&i(85,Ct=e.oninteractioncancel),"onaddshape"in e&&i(86,Tt=e.onaddshape),"onupdateshape"in e&&i(87,Mt=e.onupdateshape),"onselectshape"in e&&i(88,Et=e.onselectshape),"onblurshape"in e&&i(89,At=e.onblurshape),"onremoveshape"in e&&i(90,Lt=e.onremoveshape),"ontapshape"in e&&i(91,Ft=e.ontapshape),"onhovershape"in e&&i(92,zt=e.onhovershape),"ontriggerhistorywrite"in e&&i(93,Dt=e.ontriggerhistorywrite),"onhovercanvas"in e&&i(94,Wt=e.onhovercanvas),"ontapcanvas"in e&&i(95,Vt=e.ontapcanvas),"onleavecanvas"in e&&i(96,Nt=e.onleavecanvas),"beforeSelectShape"in e&&i(97,Xt=e.beforeSelectShape),"beforeDeselectShape"in e&&i(98,Yt=e.beforeDeselectShape),"beforeRemoveShape"in e&&i(99,qt=e.beforeRemoveShape),"beforeUpdateShape"in e&&i(100,Kt=e.beforeUpdateShape),"willRenderShapeControls"in e&&i(101,Jt=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&i(102,Qt=e.willRenderShapeTextControls),"willStartInteraction"in e&&i(103,eo=e.willStartInteraction),"mapEditorPointToImagePoint"in e&&i(104,to=e.mapEditorPointToImagePoint),"mapImagePointToEditorPoint"in e&&i(105,oo=e.mapImagePointToEditorPoint),"eraseRadius"in e&&i(106,io=e.eraseRadius),"selectRadius"in e&&i(107,no=e.selectRadius),"enableButtonFlipVertical"in e&&i(108,ro=e.enableButtonFlipVertical),"enableTapToAddText"in e&&i(109,ao=e.enableTapToAddText),"enableMultiSelect"in e&&i(110,so=e.enableMultiSelect),"enableTextStyleControls"in e&&i(7,lo=e.enableTextStyleControls),"locale"in e&&i(8,co=e.locale),"snapThreshold"in e&&i(111,uo=e.snapThreshold),"snapPointer"in e&&i(112,po=e.snapPointer),"enableSnapToContext"in e&&i(113,ho=e.enableSnapToContext),"gridSize"in e&&i(114,mo=e.gridSize)},e.$$.update=()=>{var t,o;if(16384&e.$$.dirty[2]|2097152&e.$$.dirty[3]&&i(185,n=mo>0?{x:0,y:0,...st}:void 0),1&e.$$.dirty[0]|8192&e.$$.dirty[6]&&i(13,r=!Xe&&xe&&(Ko()||ci())),131072&e.$$.dirty[3]|8192&e.$$.dirty[6]&&i(177,a=so?xe.filter(Ui):[]),4194304&e.$$.dirty[5]&&i(176,s=a.length>1),16384&e.$$.dirty[2]|6291456&e.$$.dirty[5]&&i(198,l=s?a.map(e=>An(Ri(e),st)):[]),8192&e.$$.dirty[0]&&i(195,c=!!r),8192&e.$$.dirty[0]&&i(179,d=r&&Zi(r)),8192&e.$$.dirty[0]|16777216&e.$$.dirty[5]&&i(12,u=r&&!d?r.id:void 0),8208&e.$$.dirty[0]|16384&e.$$.dirty[2]&&i(16,p=lt&&r&&An(Ri(r),st)),8192&e.$$.dirty[0]|16777216&e.$$.dirty[5]&&i(160,h=!(!r||!d)),73728&e.$$.dirty[0]|8192&e.$$.dirty[2]&&i(193,m=r&&at&&gn(p)||[]),2097152&e.$$.dirty[5]|4096&e.$$.dirty[6]&&i(189,g=s?l.map(gn):[]),8192&e.$$.dirty[0]|2097152&e.$$.dirty[5]&&i(197,$=!s&&r&&(un(t=r)&&pn(t)&&!0!==t.disableResize&&(Xi(t)||Bi(t)||_i(t)||Vi(t)||Ni(t)&&jo(t,"pathClose")))&&!Hi(r)),8192&e.$$.dirty[0]|2097152&e.$$.dirty[5]&&i(19,f=!s&&r&&(e=>un(e)&&!0!==e.disableRotate&&(Xi(e)||jo(e,"text")||_i(e)))(r)&&!Hi(r)),8192&e.$$.dirty[0]&&i(17,b=r&&Di(r)&&!Bi(r)&&!Hi(r)&&!1===r.disableTextScale),8192&e.$$.dirty[0]|2048&e.$$.dirty[6]&&i(21,x=!!$&&function(e){return!!e&&(Di(e)&&!e.height?[[1,2],[3,0]]:!Vi(e)&&!Ni(e))}(r)),2105344&e.$$.dirty[0]|2048&e.$$.dirty[6]&&i(34,v=!!r&&(!Array.isArray(x)&&$)),6291456&e.$$.dirty[5]&&i(196,S=s?(e=>{const t=e.map(e=>gn(An(e,st))).flat(),o=dt(t);return It(o)})(a):[]),8192&e.$$.dirty[0]|2097152&e.$$.dirty[5]|128&e.$$.dirty[6]&&i(18,w=r&&m.length>1||s),4096&e.$$.dirty[3]|2097152&e.$$.dirty[5]|1152&e.$$.dirty[6]&&i(191,k=s?S.map(oo):m.map(oo)),8&e.$$.dirty[0]|32&e.$$.dirty[6]&&i(15,C=k.map(e=>be(e.x-Ke.x,e.y-Ke.y))),8192&e.$$.dirty[0]&&i(20,T=r&&r.points&&No(r.selectedPoint)?r.selectedPoint:-1),1048576&e.$$.dirty[0]&&i(169,M=T>=0),1081344&e.$$.dirty[0]|16384&e.$$.dirty[5]&&i(174,P=M?C[T]:void 0),8192&e.$$.dirty[0]|512&e.$$.dirty[6]&&i(33,R=c&&(Bi(r)?!jo(r,"disableNewline")||!r.disableNewline:!1===r.disableNewline)),4096&e.$$.dirty[3]|4&e.$$.dirty[5]&&(wn&&oo&&!Ui(wn)&&on(wn)?(e=>{const t=gn(An(Ri(e),st));if(!t)return;const o=t.map(oo);let i=!1;!0===e.pathClose?i=!0:Ni(e)?i=!jo(e,"pathClose"):o.length>2&&(i=!0);const n="hook"===e.selectionStyle,r=n?o.map((e,t,o)=>({id:Lb,points:Pn(o,t),strokeColor:[0,0,0,.1],strokeWidth:2})):[{id:Lb,points:o.map(e=>be(e.x+1,e.y+1)),strokeColor:[0,0,0,.1],strokeWidth:2,pathClose:i}],a=n?o.map((e,t,o)=>({id:Lb,points:Pn(o,t),strokeColor:gt,strokeWidth:2})):[{id:Lb,points:o,strokeColor:gt,strokeWidth:2,pathClose:i}];Sn(...r,...a)})(wn):vn()),884736&e.$$.dirty[0]|8192&e.$$.dirty[2]&&i(192,I=w&&f&&at&&C?(e=>{const t=$n(e),o=oo({x:t.origin.x+t.dir.x,y:t.origin.y+t.dir.y});return{origin:oo(t.origin),position:o}})(p):void 0),8&e.$$.dirty[0]|64&e.$$.dirty[6]&&i(32,E=I&&be(I.position.x-Ke.x,I.position.y-Ke.y)),491520&e.$$.dirty[0]|8192&e.$$.dirty[2]&&i(194,A=w&&b&&at&&C?(e=>{const t=gn(e);let o=2;e.flipX&&e.flipY?o=0:e.flipX?o=3:e.flipY&&(o=1);const i={...t[o]};return oo({x:i.x,y:i.y})})(p):void 0),8&e.$$.dirty[0]|256&e.$$.dirty[6]&&i(31,L=A&&be(A.x-Ke.x,A.y-Ke.y)),32768&e.$$.dirty[6]&&i(184,W=!!(Ee||[]).find(e=>[91,93,17].includes(e))),524288&e.$$.dirty[3]|536870912&e.$$.dirty[5]&&i(186,F=!(W||!po)),8192&e.$$.dirty[0]|8192&e.$$.dirty[2]|16777232&e.$$.dirty[5]|33&e.$$.dirty[6]&&r&&k&&at>0&&(r===wn&&Rn(),((e,t,o)=>{if(!on(t))return;const i=Ni(t),n=i&&jo(t,"pathClose"),r=n&&(e=>e.strokeWidth&&(e=>{const t=e.strokeColor;return!!t&&(3===t.length||t[3]>0)})(e))(t),a=Zi(t),s=Hi(t),l="hook"===t.selectionStyle,c=!0!==t.disableShowPoints,{selectionOpacity:d=1}=t;if(a&&i&&!n)return;const u=[],p=[...k],h=p[p.length-1],g=p[0],$=(s?.05:.1)*e*d,f=$>0,y=(s?.5:1)*e*d,b=y>0,x=[0,0,0],v=[1,1,1],S=s?1:1.5;Ee.includes(16)&&h&&o&&Mo(h,o);const w=p.length&&n&&a&&o?ze(g,o):1/0,C=p.length&&n&&a&&o?ze(h,o):1/0,T=w<=Ab,M=C<=Ab;!T&&o&&p.push(o);const P=p.length>1;let R=!1;!0===t.pathClose?R=!0:Ni(t)?R=Zi(t)?T:!jo(t,"pathClose"):p.length>2&&(R=!0),P&&f&&(l?u.push(...p.map((e,t,o)=>({id:Cn,points:Pn(o,t),strokeColor:x,opacity:$}))):u.push({id:Cn,points:p.map(e=>be(e.x+1,e.y+1)),pathClose:R,strokeColor:x,strokeWidth:2,opacity:$})),n&&f&&c&&u.push(...p.map(e=>({id:Cn,...e,rx:2*S,ry:2*S,backgroundColor:x,opacity:$}))),I&&f&&u.push({id:Cn,points:[be(I.origin.x+1,I.origin.y+1),be(I.position.x+1,I.position.y+1)],strokeColor:x,strokeWidth:2,opacity:$}),P&&b&&(l?u.push(...p.map((e,t,o)=>({id:Cn,points:Pn(o,t),strokeColor:v,strokeWidth:S,opacity:y}))):u.push({id:Cn,points:p,pathClose:R,strokeColor:v,strokeWidth:S,backgroundColor:a&&n&&t.backgroundColor&&t.backgroundColor[3]>0?t.backgroundColor:[0,0,0,0],opacity:y})),n&&c&&u.push(...p.map(e=>({id:Cn,...e,rx:3*S,ry:3*S,backgroundColor:[.5,.5,.5],strokeWidth:S,strokeColor:v}))),n&&a&&c&&k.length>=3&&u.push({...g,id:Cn,rx:S*(T?5:4),ry:S*(T?5:4),backgroundColor:T?gt:[.5,.5,.5],strokeWidth:S,strokeColor:v}),n&&a&&r&&c&&!T&&m.length>=2&&u.push({...h,id:Cn,rx:S*(M?5:4),ry:S*(M?5:4),backgroundColor:M?gt:[.5,.5,.5],strokeWidth:S,strokeColor:v}),I&&b&&!l&&u.push({id:Cn,points:[{x:I.origin.x,y:I.origin.y},{x:I.position.x,y:I.position.y}],strokeColor:v,strokeWidth:S,opacity:y}),Mn(...u)})(at,r,d&&Ni(r)?Fn({...xr},!F):void 0)),8192&e.$$.dirty[0]&&(r||(Rn(),Tn())),131072&e.$$.dirty[6]&&i(190,z=Fe.length&&Fe[Fe.length-1]._isDraft?Fe[Fe.length-1]:null),4&e.$$.dirty[0]|1073741824&e.$$.dirty[4]|8&e.$$.dirty[5]|16&e.$$.dirty[6]&&z&&z.points&&z.points.length>=1&&z.pathClose&&kr&&Fo&&qe.update(e=>e.map(e=>e.id!==z.id?e:{...e,pointerPoint:{...kr}})),4096&e.$$.dirty[3]|8&e.$$.dirty[6])if(g.length){En();const e=g.map(e=>({id:In,points:e.map(oo),strokeWidth:1,strokeColor:[1,1,1,.5],pathClose:!0}));Ln(...e)}else En();4&e.$$.dirty[5]&&i(187,D=!!wn),1&e.$$.dirty[5]&&i(188,O=!!Ii),16&e.$$.dirty[5]|7&e.$$.dirty[6]&&(!xr||O||D||Fn({...xr},!F)),131072&e.$$.dirty[2]|2101248&e.$$.dirty[3]|1073741824&e.$$.dirty[5]|65536&e.$$.dirty[6]&&mo>0&&n&&oo&&((e,t,o,i)=>{const n=oo({x:0,y:0}),r=oo({x:e,y:e}),a=oo({x:t.width,y:t.height}),s=r.x-n.x;if(On.set(s>6?1:0),i<=0)return Wn();const l=Do(s,n.x,a.x).map(e=>({id:Bn,opacity:i,points:[{x:e,y:n.y},{x:e,y:a.y}],strokeWidth:1,strokeColor:o})),c=Do(s,n.y,a.y).map(e=>({id:Bn,opacity:i,points:[{x:n.x,y:e},{x:a.x,y:e}],strokeWidth:1,strokeColor:o}));_n(...c,...l)})(mo,n,ft,Le),262144&e.$$.dirty[2]|4096&e.$$.dirty[3]|805306368&e.$$.dirty[4]|536870912&e.$$.dirty[5]&&oo&&(W?Nn():((e,t,o)=>{if(null===e&&null===t)return Nn();let i,n;null!==e&&(i={id:Vn,strokeColor:o,strokeWidth:1.5,points:[oo({x:e,y:0}),oo({x:e,y:st.height})]}),null!==t&&(n={id:Vn,strokeColor:o,strokeWidth:1.5,points:[oo({x:0,y:t}),oo({x:st.width,y:t})]}),Hn(i,n)})(Ao,Lo,yt)),4096&e.$$.dirty[2]&&(e=>{if(!e)return si({_prerender:!1});const t=xe.find(e=>e.isEditing);t&&ri(t,{_prerender:"inline"===bt})})(rt),32768&e.$$.dirty[6]&&Ee&&Ee.length&&(()=>{const[e]=Ee;8!==e&&46!==e||di()&&(r.isEditing||nn(r)&&(eu(document.activeElement)||(Ni(r)&&No(r.selectedPoint)?setTimeout(()=>Xo(r,r.selectedPoint),0):setTimeout(()=>pi(),0))))})(),576&e.$$.dirty[0]&&jn&&"inline"===bt&&jn.focus(),8192&e.$$.dirty[0]&&i(183,_=r&&Di(r)),8192&e.$$.dirty[0]|268435456&e.$$.dirty[5]&&i(14,V=_&&!1!==sn(r)&&Hi(r)),16384&e.$$.dirty[0]&&i(178,H=V?{...r}:void 0),16384&e.$$.dirty[2]|8388608&e.$$.dirty[5]&&i(180,j=H&&An({...H},st)),33554432&e.$$.dirty[5]&&i(182,U=j&&hi(j.text,j)),167772160&e.$$.dirty[5]&&(G=j&&ht(j.x,j.y,U.width,U.height)),24576&e.$$.dirty[0]&&i(28,Z=V?r.text:""),24592&e.$$.dirty[0]|16384&e.$$.dirty[2]&&i(181,X=lt&&r&&V&&An({...Ri(r),width:No(r.width)?Math.floor(r.width):void 0,height:No(r.height)?Math.floor(r.height):void 0},st)),16448&e.$$.dirty[0]|67108864&e.$$.dirty[5]&&i(30,Y=V&&((e,t)=>{const{textAlign:o="left",fontFamily:i="sans-serif",fontWeight:n="normal",fontStyle:r="normal",letterSpacing:a="normal",textShadowX:s=0,textShadowY:l=0,textShadowBlur:c=0,textShadowColor:d,textOutlineWidth:u=0,textOutlineColor:p}=e,h="!important",m=`caret-color:${K};text-align:${o}${h};font-family:${i}${h};font-weight:${n}${h};font-style:${r}${h};letter-spacing:${No(a)?a+"px":"normal"}${h}`;if("modal"===t)return m;const g=u?`;-webkit-text-stroke:${2*u}px ${Qo(p)} ${h}`:"",$=c||s||l?`;text-shadow:${s}px ${l}px ${c}px ${Qo(d)} ${h}`:"";let f=e.fontSize,y=1,b="";f>1e3&&N()&&(y=f/1e3,b=`transform-origin:0 0;transform:scale(${y})`,f=1e3);let x=e.lineHeight/y;const v=Qo(e.color),S=.5*Math.max(0,f-x);return`--font-scalar:${y};--bottom-inset:${S}px;padding:${S}px 0 0${h};color:${v}${h};font-size:${f}px${h};line-height:${x}px${h};${m};${b}${g}${$}`})(X,bt)),16392&e.$$.dirty[0]|2304&e.$$.dirty[2]|67108864&e.$$.dirty[5]&&i(29,q=V&&((e,t,o,i)=>{let n,a;e.width&&e.height?(n=mt(e),a=He(e)):(a=hi(r.text,p),a.width=p.width||a.width,n=be(e.x+.5*a.width,e.y+.5*a.height));const s=Math.max(0,e.fontSize-e.lineHeight)+e.lineHeight,l=oo(n);let c=l.x-t.x-.5*a.width,d=l.y-t.y-.5*a.height,u=e.flipX,h=e.flipY,m=e.rotation;tt&&it?(u=!u,h=!h):tt?(u=!u,m=-m):it&&(h=!h,m=-m),m+=i;const g=o*(u?-1:1),$=o*(h?-1:1);return`--line-height:${s}px;width:${a.width}px;height:${a.height}px;transform:translate(${c}px,${d}px) rotate(${m}rad) scale(${g}, ${$})`})(X,Ke,nt,Je)),65536&e.$$.dirty[2]&&(K=$t?Qo($t):"auto"),16960&e.$$.dirty[0]&&V&&jn&&"inline"===bt&&Un(Z),8192&e.$$.dirty[0]|1056&e.$$.dirty[5]&&i(165,J=r&&!h?r:J),1024&e.$$.dirty[5]&&i(167,Q=J&&an(J)),1024&e.$$.dirty[5]&&i(162,te=J&&ln(J)),1024&e.$$.dirty[5]&&i(164,oe=J&&rn(J)),1024&e.$$.dirty[5]&&i(163,ie=J&&nn(J)),2098176&e.$$.dirty[5]&&i(166,ne=!s&&J&&(e=>!0!==e.disableReorder)(J)),1024&e.$$.dirty[5]&&i(161,re=J&&!1!==sn(J)),1024&e.$$.dirty[5]&&i(168,ae=J&&jo(J,"backgroundImage")&&en(J,"opacity")),8256&e.$$.dirty[0]&&i(171,se=r&&"html"===r.format&&"inline"===bt),8192&e.$$.dirty[0]|65568&e.$$.dirty[5]&&i(175,le=r&&(!h||se)),1048578&e.$$.dirty[5]|16384&e.$$.dirty[6]&&gr.set(le&&!qi?1:0,{hard:!1===ke}),32768&e.$$.dirty[0]|1310720&e.$$.dirty[5]&&i(173,ce=le&&C.length?(o=dt(C),Pe(be(o.x+.5*o.width,o.y),Kd)):ce),1056&e.$$.dirty[0]|786432&e.$$.dirty[5]&&i(172,de=(P||ce)&&$r&&pt&&((e,t,o,i)=>{const n=e.x,r=e.y,a=n+e.width;let s=Math.max(t.x-.5*o.width,n),l=Math.max(t.y-o.height+i,r);return s+o.width>a&&(s=a-o.width),be(s,l)})(pt,P||ce,$r,-16)),131072&e.$$.dirty[5]&&i(27,ue=de?`translate(${de.x}px, ${de.y}px)`:void 0),4194304&e.$$.dirty[0]|131072&e.$$.dirty[5]&&i(26,pe=de?Se:void 0),16384&e.$$.dirty[0]&&i(170,he=V?"text":"shape"),12544&e.$$.dirty[0]|33536&e.$$.dirty[3]|131008&e.$$.dirty[5]|8192&e.$$.dirty[6]&&i(25,me="text"===he&&Qt&&se?wm(()=>Qt([["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",title:"Remove styles",label:[["span","T",{style:"font-size:1.25em;font-style:italic;font-family:Times New Roman;text-decoration:underline",textContent:"T"}],["span","x",{style:"position:relative;top:.175rem;",innerHTML:"&times;"}]]}]]]],u)):"shape"===he&&Jt&&u?wm(()=>Jt(M?[["div","epsilon",{class:"PinturaShapeControlsGroup"},[["Button","remove-point",{onclick:er,label:co.shapeTitleButtonRemove,icon:co.shapeIconButtonRemove,shortcut:["Backspace"],hideLabel:!0}]]]]:[ae&&["div","alpha",{class:"PinturaShapeControlsGroup"},[["ToggleSlider","adjust-opacity",{onrelease:cr,onchange:lr,step:.01,value:jo(r,"opacity")?r.opacity:1,label:(e,t,o)=>`${Math.round(e/o*100)}%`,min:0,max:1,direction:"x"}]]],["div","beta",{class:"PinturaShapeControlsGroup"},[Q&&["Button","flip-horizontal",{onclick:ar,label:co.shapeTitleButtonFlipHorizontal,icon:co.shapeIconButtonFlipHorizontal,hideLabel:!0}],Q&&ro&&["Button","flip-vertical",{onclick:sr,label:co.shapeTitleButtonFlipVertical,icon:co.shapeIconButtonFlipVertical,hideLabel:!0}],ne&&["Button","to-front",{onclick:pr,label:co.shapeTitleButtonMoveToFront,icon:co.shapeIconButtonMoveToFront,hideLabel:!0,disabled:xe[xe.length-1]===J}],oe&&["Button","duplicate",{onclick:hr,label:co.shapeTitleButtonDuplicate,icon:co.shapeIconButtonDuplicate,shortcut:["CMD","D"],hideLabel:!0}],ie&&["Button","remove",{onclick:dr,label:co.shapeTitleButtonRemove,icon:co.shapeIconButtonRemove,shortcut:["Backspace"],hideLabel:!0}]].filter(Boolean)],re&&te&&["div","gamma",{class:"PinturaShapeControlsGroup"},[["Button","text-layout",{onclick:rr,label:bu(yr,co,r),icon:bu(fr,co,r),hideLabel:!0}]]],re&&["div","delta",{class:"PinturaShapeControlsGroup"},[["Button","edit-text",{label:co.shapeLabelInputText,onclick:tr}]]]].filter(Boolean),u)):[]),256&e.$$.dirty[0]|8192&e.$$.dirty[6]&&i(24,$e=xe.filter(on).filter(e=>e.id).filter(e=>!Zi(e)).map(e=>({id:e.id,color:Di(e)?e.color:Vi(e)?e.strokeColor:e.backgroundColor,name:e.name||co[`shapeLabelTool${bs(kn(e))}`]}))),2048&e.$$.dirty[0]&&Mr&&Mr.addEventListener("touchmove",Pr,!1)},[Xe,Ye,qe,Ke,lt,pt,bt,lo,co,jn,$r,Mr,u,r,V,C,p,b,w,f,T,x,Se,br,$e,me,pe,ue,Z,q,Y,L,E,R,v,fo,Po,e=>{const{origin:t}=e.detail,o=so&&Ee.includes(16);Li=void 0,i(155,Ii=void 0),Ei=void 0,Ai=void 0,ji=!1,Pi=void 0,Gi=!1,Yi=!1,Eo(),clearTimeout(Mi),Mi=setTimeout(()=>i(156,qi=!0),250);const n=Ko();if(!n||Ni(n)&&jo(n,"pathClose")||ti(),Ti=to(ve(t)),n&&Ni(n)&&jo(n,"pathClose"))return xt(e);const l=ki(xe,Ti,no,e=>on(e)),c=l.length&&l.shift();if(r&&Hi(r))if(c!==r)Yn();else{const e=jo(r,"height"),t=!e&&jo(r,"width");if(e||t){const e=Ri(r),t=Ri(e);An(t,st);const o=Qe(hi(e.text,t),e=>Math.ceil(e)),i=Ze(t.width,t.height||o.height);or(i,e,t);const n=ki([{...e,strokeWidth:"5%"}],Ti,0);Yi=0===n.length}}if(r&&ao&&(Gi=!0),!c&&r&&Hi(r)&&yi(r),!eo(t))return;if(c&&Ui(c))return ji=!0,i(155,Ii=c),s?(o&&yi(c),void Ki(a)):(Ei=Ri(Ii),void(Ai=An(Ri(Ii),st)));Pi=Yo()?void 0:c||void 0;if(!xt(e)&&c){if(fi(c,!0,o),i(155,Ii=c),s)return Ki(a);Ei=Ri(Ii),Ai=An(Ri(Ii),st)}},e=>{hn(),Ct(e)},e=>{const{translation:t,ctrlKey:o,metaKey:i,shiftKey:r,position:s}=e.detail;if(Ii){if(!pn(Ii))return;if(Hi(Ii)){if(!Yi)return;Yn()}if(r){let e=Math.abs(t.x),o=Math.abs(t.y);"x"===mn&&(o-=64),"y"===mn&&(e-=64),e>o?(t.y=0,mn="x"):o>e&&(t.x=0,mn="y")}else mn=null;const e=o||i;if(Li){if(!a.every(pn))return;return void Li.forEach(({shape:e,shapeOriginComputed:o})=>{Vo(e,o,t,{...$o(0,mo,n,e)})})}return Vo(Ii,Ai,t,{...$o(e?0:uo,mo,n,Ii)})}vt(e)},e=>{if(hn(),Ii){if(!s){if(e.detail.isTap&&Ni(Ii)&&dn(Ii)){const{position:t}=e.detail,o=to(ve(t));return void((e,t)=>{const o=e.points,i=[];for(let e=0;e<o.length-1;e++)i.push([o[e],o[e+1]]);i.push([o[o.length-1],o[0]]);const n=i.findIndex(([e,o])=>jt(t,6,e,o));let r;const a=[];for(let e=0;e<i.length;e++)a.push(i[e][0]),e===n&&(r=e+1,a.push(t));To(e,{points:a,selectedPoint:r},st),ii()})(Ii,o)}e.detail.isTap&&ji&&Di(Ii)&&!1!==sn(Ii)&&bi(Ii)}}else St(e)},e=>{const t=Pi&&e.detail.isTap,o=so&&Ee.includes(16);if(e.detail.isTap&&setTimeout(()=>{Vt({target:Ii||Pi,position:Ti},0)}),Ii)return Ft(Ii),n=Ii,r=Ei,JSON.stringify(n)!==JSON.stringify(r)&&Mt(Ii),void i(155,Ii=void 0);var n,r;let a=!0;if(!o){const e=$i();a=!e||Yt(e,Pi||void 0),a&&gi({storePrevious:!1})}wt(e),a&&t&&fi(Pi,!0,o)},On,e=>{i(156,qi=!0),i(155,Ii=r),Ai=p},e=>{if(!Ii)return void i(156,qi=!1);const{translation:t,indexes:o,shiftKey:r,ctrlKey:a,metaKey:s,isNudge:l}=e.detail;Go(Ii,Ai,o,t,{shiftKey:!l&&r,...$o(a||s?0:uo,mo,n,Ii)}),cn(Ii)&&ze(t)>16&&ri(Ii,{selectedPoint:void 0})},e=>{if(!Ii)return void i(156,qi=!1);fi(Ii);const{isTap:t,translation:o,indexes:n}=e.detail;t&&(cn(Ii)&&ri(Ii,{selectedPoint:Ii.selectedPoint===n[0]?void 0:n[0]}),Ft(Ii)),i(155,Ii=void 0),i(156,qi=!1),Mt(r)},e=>{Zo=$n(p).origin,i(156,qi=!0),i(155,Ii=r),Ai=p},e=>{if(!Ii)return void i(156,qi=!1);const{translation:t,shiftKey:o}=e.detail;((e,t,o,i)=>{const n=wi(An(Ri(e),st)),r=mt(n),a=zo(Zo,o);let s=Te(a,r)+Math.PI/2;if(i.shiftKey){const e=Math.PI/16;s=e*Math.round(s/e)-Je%e}To(e,{rotation:s},st),ii()})(Ii,0,t,{shiftKey:o})},()=>{Ii?(fi(Ii),i(155,Ii=void 0),i(156,qi=!1),Mt(r)):i(156,qi=!1)},e=>{i(156,qi=!0),i(155,Ii=r),Ai=p},e=>{if(!Ii)return void i(156,qi=!1);const{translation:t,ctrlKey:o,metaKey:r}=e.detail;((e,t,o,i)=>{const n=ct(t),r=hi(t.text,t);n.width||(n.width=r.width),n.height||(n.height=r.height);let a=2;e.flipX&&e.flipY?a=0:e.flipX?a=3:e.flipY&&(a=1),Go(e,t,[a],o,{...i,aspectRatio:n.width/n.height,beforeResizeShape:e=>{const o=e.width/n.width;e.fontSize=t.fontSize*o,t.width||delete e.width,t.height||delete e.height}})})(Ii,Ai,t,{...$o(o||r?0:uo,mo,n,Ii)})},()=>{Ii?(fi(Ii),i(155,Ii=void 0),i(156,qi=!1),Mt(r)):i(156,qi=!1)},e=>{const{key:t}=e,o=/escape/i.test(t);if(/enter/i.test(t),di())return o?(e.preventDefault(),e.stopPropagation(),yi(r)):void(oe&&"d"===t&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.stopPropagation(),mr()))},e=>{const t=sn(r,e);return!0===t?e:t},Zn,e=>{const{target:t,key:o}=e,i=t.value||t.innerText,n=t.selectionStart||0,a=t.selectionEnd||i.length,s=i.substring(0,n)+o+i.substring(a);if(sn(r,s)!==s)return e.preventDefault()},e=>Oi(r)&&/enter/i.test(e.key)&&!1!==r.disableNewline?e.preventDefault():/arrow/i.test(e.code)?e.stopPropagation():/escape/i.test(e.key)?qn():void 0,Xn,e=>{if(Xn(e))return Yn()},Yn,qn,gr,e=>{const t=li();t&&(t.find(Hi)||t.find(e=>!pn(e))||t.forEach(t=>{i(155,Ii=t),Ai=An(Ri(Ii),st),Vo(Ii,Ai,e.detail)}))},e=>{i(23,br=!0)},({relatedTarget:e})=>{e&&e.classList.contains("shape-selector__button")||i(23,br=!1)},e=>{if("touch"===e.pointerType||"PinturaShapeEditor"!==e.target.className)return void Nt();(qi||Mi)&&Cr(void 0);const t=pb(e,lt);i(159,xr=ve(t));const o=Pe(to(t),e=>Math.round(e));if(Me(o,kr))return;if(i(158,kr=ve(o)),Wt(qi,t,o),qi||Mi)return;if(h||Yo())return;const[n]=ki(xe,o,0,on);n&&Zi(n)||Cr(n)},e=>{"touch"!==e.pointerType&&Nt()},Tr,Ue,Ge,Je,tt,it,nt,rt,at,st,gt,$t,ft,yt,xt,vt,St,wt,Ct,Tt,Mt,Et,At,Lt,Ft,zt,Dt,Wt,Vt,Nt,Xt,Yt,qt,Kt,Jt,Qt,eo,to,oo,io,no,ro,ao,so,uo,po,ho,mo,bo,xo,vo,So,wo,ko,Co,(e,t={})=>{let o,r,a;i(154,Fo=!1);let s=[],l=_i(e),c=Di(e),d="relative"===t.position;const u=t.interpolateInput,p=go(),h=e=>{if(!uo)return e;const t=to(e),{snapTranslation:o,snapLines:i}=Wo(Oo(t),p,uo,mo,n);return _o(e,o),Io(i),e},m=!!$i(),g=t.isSelection?qe:Ye,$="step"===t.inputMode;if(Ni(e)){if($){i(154,Fo=!0);let t=!1;const n=(e,o)=>{const i=xo(g),n=i.points,r=e&&be(vb(e.x,st.width),vb(e.y,st.height)),a=r&&oo(r);Ee.includes(16)&&a&&Mo(a,o);const s=to(o),l=n.length?n[0]:s,c=be(vb(l.x,st.width),vb(l.y,st.height)),u=oo(c),p=ze(u,o);if(!t&&1===n.length&&p<36)return So(g);if(n.length>2&&p<=Ab){i.pathClose=!0,delete i.pointerPoint,on(i)&&fi(i);const e=wo(g);return void Tt(e)}const h=i.strokeWidth&&i.strokeColor&&(void 0===i.strokeColor[3]||i.strokeColor[3]>0),m=ze(a,o);if(h&&!0!==i.pathClose&&n.length>1&&m<Ab){delete i.pointerPoint,i.pathClose=!1,i.backgroundColor=[0,0,0,0],on(i)&&fi(i);const e=wo(g);return void Tt(e)}return n.length>0&&m<100?void 0:d?Sb(s,st):s};return{start:e=>{const i=xo(g),{origin:s}=e.detail;if(r=4,o=h(ve(s)),a=ve(o),i){const e=i.points,t=e[e.length-1],r=n(t,o);return r&&(i.points=[...e,r]),void ko({points:i.points},g)}t=!0},update:e=>{if(!t)return;const i=xo(g);if(!i)return;const r=i.points[0],a=n(r,be(o.x+e.detail.translation.x,o.y+e.detail.translation.y));a&&(i.points[1]=a,ko({points:i.points},g))},release:e=>{e.detail.preventInertia()},cancel:()=>{So(g)},end:i=>{if(!t)return;const n=to(o),r=d?Sb(n,st):n,{isTap:a}=i.detail;if(a){if(ki(xe,n,0,on).length)return So(g)}vo({...e,points:[r]},g)}}}return{start:t=>{const{origin:i}=t.detail;r=4,o=ve(i),a=ve(o),s.push({...a});const n=to(o),l=d?Sb(n,st):n;vo({...e,points:[l]},g)},update:e=>{const t=xo(g);if(!t)return;const{translation:i}=e.detail,n=be(o.x+i.x,o.y+i.y),l=De(a,n);if(ge(l,5)<=r)return;const c=[],p=Te(n,a),h=r-l,m={x:a.x+h*Math.cos(p),y:a.y+h*Math.sin(p)};if(s.push({...m}),u&&t.points.length>1){const e=s.length,t=Math.ceil(l/10);let o=l/30;const i=s[e-3],n=s[e-2],r=s[e-1];s[e-4]||(o*=.1),c.push(..._t(i,n,r,t,o).slice(1,-1)),s.splice(e-1,0,...c)}c.push(m),a.x=m.x,a.y=m.y,ko({points:t.points.concat(c.map(e=>{const t=to(e);return d?Sb(t,st):t}))},g)},release:e=>e.detail.preventInertia(),cancel:()=>{So(g)},end:e=>{const t=xo(g);if(!t)return;if(e.detail.isTap){let e=!1;if(t.bitmap?(Pi&&(e=!0),m&&(e=!0)):e=!0,e)return So(g)}const o=wo(g);Tt(o)}}}return l||c||Wi(e)?{start:t=>{const{origin:i}=t.detail;o=h(ve(i));const n=to(o),r=d?Sb(n,st):n,a=-1*Ro(Je,tt,it),s={...e,rotation:a,...r};s.flipX=tt,s.flipY=it,delete s.position,s.opacity=0;(l?["rx","ry"]:["width","height"]).forEach(e=>{s[e]=d?"0%":0}),vo(s,g)},update:e=>{const t=xo(g);if(!t)return;t.opacity=1;let{aspectRatio:i}=t,{translation:n,shiftKey:r,ctrlKey:a}=e.detail;!i&&r&&(i=1);const s=h(be(o.x+n.x,o.y+n.y)),c=to(o),d=to(s);if(i){const e=dt([c,d]),t=Pt(e,i),o=d.x<c.x?-1:1,n=d.y<c.y?-1:1;d.x=c.x+t.width*o,d.y=c.y+t.height*n}const u={x:c.x+.5*(d.x-c.x),y:c.y+.5*(d.y-c.y)},p=Ro(Je,tt,it);we(c,p,u),we(d,p,u);const m=Math.min(c.x,d.x),$=Math.min(c.y,d.y);let f=Math.max(c.x,d.x)-m,y=Math.max(c.y,d.y)-$,b={};l?(a?(b.x=c.x,b.y=c.y):(b.x=m+.5*f,b.y=$+.5*y),b.rx=.5*f,b.ry=.5*y):(a?(b.x=c.x-.5*f,b.y=c.y-.5*y):(b.x=m,b.y=$),b.width=f,b.height=y),ko(b,g,(e,t)=>To(e,t,st))},release:e=>{e.detail.preventInertia()},cancel:()=>{So(g)},end:e=>{const t=xo(g);if(t){if(e.detail.isTap){if(Di(t)&&ao&&Gi)return So(g);if(!Di(t)||!ao||Pi)return So(g);delete t.width,delete t.height,!1!==t.disableNewline&&delete t.textAlign;const e=An({...t},st),i=hi(t.text,e),n=to({x:o.x,y:o.y-.5*i.height}),r=to({x:o.x+i.width,y:o.y+.5*i.height}),a={x:n.x+.5*(r.x-n.x),y:n.y+.5*(r.y-n.y)},s=Ro(Je,tt,it);we(n,s,a),we(r,s,a);let l=Math.min(n.x,r.x),c=Math.min(n.y,r.y);l<0&&(l=0),c<0&&(c=0),l+i.width>st.width&&(l=st.width-i.width),c+i.height>st.height&&(c=st.height-i.height),t.x=y(t.x)?Jo(l,st.width):l,t.y=y(t.y)?Jo(c,st.height):c}if(t.opacity=1,Di(t)){const e=An({...t},st);if(No(e.width)&&e.width<1||No(e.height)&&e.height<1)return So(g);Tt(t)}else{const e=wo(g);Tt(e)}on(t)&&fi(t),Di(t)&&bi(t)}}}:Vi(e)?{start:t=>{const{origin:i}=t.detail,n=to(h(i)),r=Pe(n,Kd);o=ve(i),vo({...e,x1:d?Jo(r.x,st.width):r.x,y1:d?Jo(r.y,st.height):r.y,x2:d?Jo(r.x,st.width):r.x,y2:d?Jo(r.y,st.height):r.y,opacity:0},g)},update:e=>{if(!xo(g))return;const{translation:t}=e.detail,i=h(Re(ve(o),t));if(Ee.includes(16)){const e=De(o,i),t=Te(o,i),n=Math.PI/4,r=n*Math.round(t/n);i.x=o.x+e*Math.cos(r),i.y=o.y+e*Math.sin(r)}const n=to(i);ko({x2:d?Jo(n.x,st.width):n.x,y2:d?Jo(n.y,st.height):n.y,opacity:1},g)},release:e=>e.detail.preventInertia(),cancel:()=>{So(g)},end:e=>{const t=xo(g);if(!t)return;if(e.detail.isTap)return So(g);t.opacity=1;const o=wo(g);Tt(o),on(t)&&fi(o)}}:void 0},()=>{let e,t;const o=io*io,i=(e,t,i=!1)=>{const n=ze(e,t);if(!i&&n<2)return!1;const r=xe.filter(tn);let a;a=n<o?ki(r,to(t),io):Ci(r,to(e),to(t),io);return vi(a).forEach(Lt),!0};return{start:o=>{e=be(Math.round(o.detail.origin.x),Math.round(o.detail.origin.y)),i(e,e,!0),t=e},update:o=>{const{translation:n}=o.detail,r=be(Math.round(e.x+n.x),Math.round(e.y+n.y));i(t,r)&&(t=ve(r))},release:e=>e.detail.preventInertia(),cancel:()=>{So(collection)},end:()=>{}}},Yo,qo,()=>{if(!Yo())return;const e=[...Fe];e.splice(qo(),1),qe.set(e)},Ko,ei,e=>{if(!Ko())return Ji(e),Co(e)},ti,oi,(e={})=>({id:B(),...e}),ii,ni,ri,ai,(e,t,o=!0)=>{xe.forEach(o=>ai(o,e,t,!1)),o&&ii()},si,li,ci,di,gi,fi,yi,bi,xi,vi,Si,wi,ki,Ci,Ao,Lo,Fo,Ii,qi,wn,kr,xr,h,re,te,ie,oe,J,ne,Q,ae,M,he,se,de,ce,P,le,s,a,H,d,j,X,U,_,W,n,F,D,O,g,z,k,I,m,A,c,S,$,l,xe,ke,Ee,Le,Fe,function(t){wa.call(this,e,t)},e=>Tr(e),function(e){Ca[e?"unshift":"push"](()=>{jn=e,i(9,jn)})},function(){Z=this.value,i(28,Z),i(14,V),i(13,r),i(183,_),i(0,Xe),i(199,xe)},e=>{const{key:t}=e;if("Enter"===t){if(Xn(e))return!0;if(!1===r.disableNewline)return!1}return!0},function(e){Ca[e?"unshift":"push"](()=>{jn=e,i(9,jn)})},()=>{Mr&&Mr.focus()},e=>i(10,$r=e.detail),function(e){Ca[e?"unshift":"push"](()=>{Mr=e,i(11,Mr)})},e=>pb(e,lt)]}class Db extends rs{constructor(e){super(),ns(this,e,zb,Eb,yr,{uid:68,ui:69,disabled:0,shapes:1,selection:2,offset:3,contextRotation:70,contextFlipX:71,contextFlipY:72,contextZoom:73,active:74,opacity:75,parentRect:76,rootRect:4,utilRect:5,hoverColor:77,caretColor:78,gridColor:79,snapColor:80,textInputMode:6,oninteractionstart:81,oninteractionupdate:82,oninteractionrelease:83,oninteractionend:84,oninteractioncancel:85,onaddshape:86,onupdateshape:87,onselectshape:88,onblurshape:89,onremoveshape:90,ontapshape:91,onhovershape:92,ontriggerhistorywrite:93,onhovercanvas:94,ontapcanvas:95,onleavecanvas:96,beforeSelectShape:97,beforeDeselectShape:98,beforeRemoveShape:99,beforeUpdateShape:100,willRenderShapeControls:101,willRenderShapeTextControls:102,willStartInteraction:103,mapEditorPointToImagePoint:104,mapImagePointToEditorPoint:105,eraseRadius:106,selectRadius:107,enableButtonFlipVertical:108,enableTapToAddText:109,enableMultiSelect:110,enableTextStyleControls:7,locale:8,snapThreshold:111,snapPointer:112,enableSnapToContext:113,gridSize:114,syncShapeCollection:115,getShapeDraft:116,addShapeDraft:117,discardShapeDraft:118,confirmShapeDraft:119,updateShapeDraft:120,addShape:121,createShape:122,eraseShape:123,getSelectionItemDraft:124,getSelectionItemDraftIndex:125,discardSelectionItemDraft:126,getMarkupItemDraft:127,getMarkupItemDraftIndex:128,addMarkupItemDraft:129,confirmMarkupItemDraft:130,discardMarkupItemDraft:131,createMarkupItem:132,syncShapes:133,removeMarkupShapeProps:134,updateMarkupShape:135,updateMarkupShapeProperty:136,updateMarkupItemsShapeProperty:137,updateMarkupShapeItems:138,getActiveMarkupItems:139,getActiveMarkupItem:140,hasActiveMarkupItem:141,blurShapes:142,selectShape:143,deselectMarkupItem:144,editMarkupItem:145,finishEditMarkupItem:146,removeMarkupItems:147,getTextShapeRect:148,getMarkupShapeRect:149,getShapesNearPosition:150,getShapesBetweenPoints:151},null,[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}get syncShapeCollection(){return this.$$.ctx[115]}get getShapeDraft(){return this.$$.ctx[116]}get addShapeDraft(){return this.$$.ctx[117]}get discardShapeDraft(){return this.$$.ctx[118]}get confirmShapeDraft(){return this.$$.ctx[119]}get updateShapeDraft(){return this.$$.ctx[120]}get addShape(){return this.$$.ctx[121]}get createShape(){return this.$$.ctx[122]}get eraseShape(){return this.$$.ctx[123]}get getSelectionItemDraft(){return this.$$.ctx[124]}get getSelectionItemDraftIndex(){return this.$$.ctx[125]}get discardSelectionItemDraft(){return this.$$.ctx[126]}get getMarkupItemDraft(){return this.$$.ctx[127]}get getMarkupItemDraftIndex(){return this.$$.ctx[128]}get addMarkupItemDraft(){return this.$$.ctx[129]}get confirmMarkupItemDraft(){return this.$$.ctx[130]}get discardMarkupItemDraft(){return this.$$.ctx[131]}get createMarkupItem(){return this.$$.ctx[132]}get syncShapes(){return this.$$.ctx[133]}get removeMarkupShapeProps(){return this.$$.ctx[134]}get updateMarkupShape(){return this.$$.ctx[135]}get updateMarkupShapeProperty(){return this.$$.ctx[136]}get updateMarkupItemsShapeProperty(){return this.$$.ctx[137]}get updateMarkupShapeItems(){return this.$$.ctx[138]}get getActiveMarkupItems(){return this.$$.ctx[139]}get getActiveMarkupItem(){return this.$$.ctx[140]}get hasActiveMarkupItem(){return this.$$.ctx[141]}get blurShapes(){return this.$$.ctx[142]}get selectShape(){return this.$$.ctx[143]}get deselectMarkupItem(){return this.$$.ctx[144]}get editMarkupItem(){return this.$$.ctx[145]}get finishEditMarkupItem(){return this.$$.ctx[146]}get removeMarkupItems(){return this.$$.ctx[147]}get getTextShapeRect(){return this.$$.ctx[148]}get getMarkupShapeRect(){return this.$$.ctx[149]}get getShapesNearPosition(){return this.$$.ctx[150]}get getShapesBetweenPoints(){return this.$$.ctx[151]}}function Ob(e){let t,o,i;return o=new Rh({props:{items:e[2]}}),{c(){t=Ur("ul"),ts(o.$$.fragment),Qr(t,"class","PinturaShapeStyleList")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};4&t&&(i.items=e[2]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function Bb(e){let t,o;return t=new Gh({props:{class:"PinturaShapeStyles",elasticity:e[0],$$slots:{default:[Wb]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1&o&&(i.elasticity=e[0]),524292&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Wb(e){let t,o,i;return o=new Rh({props:{items:e[2]}}),{c(){t=Ur("ul"),ts(o.$$.fragment),Qr(t,"class","PinturaShapeStyleList")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};4&t&&(i.items=e[2]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function _b(e){let t,o,i,n;const r=[Bb,Ob],a=[];function s(e,t){return e[1]?0:1}return o=s(e),i=a[o]=r[o](e),{c(){t=Ur("div"),i.c(),aa(t,"opacity",e[5]),aa(t,"pointer-events",e[4]),aa(t,"visibility",e[3])},m(e,i){Hr(e,t,i),a[o].m(t,null),n=!0},p(e,[n]){let l=o;o=s(e),o===l?a[o].p(e,n):(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha(),i=a[o],i?i.p(e,n):(i=a[o]=r[o](e),i.c()),ja(i,1),i.m(t,null)),32&n&&aa(t,"opacity",e[5]),16&n&&aa(t,"pointer-events",e[4]),8&n&&aa(t,"visibility",e[3])},i(e){n||(ja(i),n=!0)},o(e){Ua(i),n=!1},d(e){e&&jr(t),a[o].d()}}}function Vb(e,t,o){let i,n,r,a,s,l,c,d,{isActive:u=!1}=t,{controls:p=[]}=t,{locale:h}=t,{scrollElasticity:m}=t,{scrollEnable:g=!0}=t,{hideTitles:$=!1}=t,{willRenderControls:f=ee}=t;const y=Sa("redrawTrigger");wr(e,y,e=>o(16,l=e));const b=Sa("env");wr(e,b,e=>o(15,s=e));const x=Sa("isAnimated");wr(e,x,e=>o(18,d=e));const v=Fc(0,{stiffness:.25,damping:.9});return wr(e,v,e=>o(17,c=e)),e.$$set=e=>{"isActive"in e&&o(10,u=e.isActive),"controls"in e&&o(11,p=e.controls),"locale"in e&&o(12,h=e.locale),"scrollElasticity"in e&&o(0,m=e.scrollElasticity),"scrollEnable"in e&&o(1,g=e.scrollEnable),"hideTitles"in e&&o(13,$=e.hideTitles),"willRenderControls"in e&&o(14,f=e.willRenderControls)},e.$$.update=()=>{263168&e.$$.dirty&&v.set(u?1:0,{hard:!1===d}),131072&e.$$.dirty&&o(5,i=c),1024&e.$$.dirty&&o(4,n=u?"auto":"none"),131072&e.$$.dirty&&o(3,r=c<=0?"hidden":"visible"),129024&e.$$.dirty&&o(2,a=l&&f(p.map(e=>["ShapeStyle",e.id,{title:e.componentProps.title,locale:h,hideTitle:$,items:[[e.component,e.id,e.componentProps]]}]),s,()=>y.set({})))},[m,g,a,r,n,i,y,b,x,v,u,p,h,$,f,s,l,c,d]}class Nb extends rs{constructor(e){super(),ns(this,e,Vb,_b,yr,{isActive:10,controls:11,locale:12,scrollElasticity:0,scrollEnable:1,hideTitles:13,willRenderControls:14})}}function Hb(e,t,o){const i=e.slice();return i[15]=t[o].key,i[6]=t[o].controls,i[16]=t[o].isActive,i}function jb(e,t){let o,i,n;return i=new Nb({props:{isActive:t[16],controls:t[6],locale:t[1],scrollElasticity:t[2],scrollEnable:t[3],hideTitles:t[4],willRenderControls:t[5]}}),{key:e,first:null,c(){o=Yr(),ts(i.$$.fragment),this.first=o},m(e,t){Hr(e,o,t),os(i,e,t),n=!0},p(e,o){t=e;const n={};128&o&&(n.isActive=t[16]),128&o&&(n.controls=t[6]),2&o&&(n.locale=t[1]),4&o&&(n.scrollElasticity=t[2]),8&o&&(n.scrollEnable=t[3]),16&o&&(n.hideTitles=t[4]),32&o&&(n.willRenderControls=t[5]),i.$set(n)},i(e){n||(ja(i.$$.fragment,e),n=!0)},o(e){Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(i,e)}}}function Ub(e){let t,o,i,n=[],r=new Map,a=Xa(e[7]);const s=e=>e[15];for(let t=0;t<a.length;t+=1){let o=Hb(e,a,t),i=s(o);r.set(i,n[t]=jb(i,o))}return{c(){t=Ur("div");for(let e=0;e<n.length;e+=1)n[e].c();Qr(t,"class",o=ld(["PinturaShapeStyleEditor",!e[3]&&"PinturaShapeStyleEditorOverflow",e[0]]))},m(e,o){Hr(e,t,o);for(let e=0;e<n.length;e+=1)n[e]&&n[e].m(t,null);i=!0},p(e,[l]){190&l&&(a=Xa(e[7]),Na(),n=Ka(n,l,s,1,e,a,r,t,qa,jb,null,Hb),Ha()),(!i||9&l&&o!==(o=ld(["PinturaShapeStyleEditor",!e[3]&&"PinturaShapeStyleEditorOverflow",e[0]])))&&Qr(t,"class",o)},i(e){if(!i){for(let e=0;e<a.length;e+=1)ja(n[e]);i=!0}},o(e){for(let e=0;e<n.length;e+=1)Ua(n[e]);i=!1},d(e){e&&jr(t);for(let e=0;e<n.length;e+=1)n[e].d()}}}function Gb(e,t,o){let i,n,r,{class:a}=t,{controls:s={}}=t,{shapeProps:l}=t,{onchange:c}=t,{locale:d}=t,{scrollElasticity:u}=t,{scrollEnable:p=!0}=t,{hideTitles:h=!1}=t,{willRenderControls:m}=t;const g=[];return e.$$set=e=>{"class"in e&&o(0,a=e.class),"controls"in e&&o(6,s=e.controls),"shapeProps"in e&&o(8,l=e.shapeProps),"onchange"in e&&o(9,c=e.onchange),"locale"in e&&o(1,d=e.locale),"scrollElasticity"in e&&o(2,u=e.scrollElasticity),"scrollEnable"in e&&o(3,p=e.scrollEnable),"hideTitles"in e&&o(4,h=e.hideTitles),"willRenderControls"in e&&o(5,m=e.willRenderControls)},e.$$.update=()=>{64&e.$$.dirty&&o(11,i=Object.keys(s).filter(e=>s[e])),2304&e.$$.dirty&&o(10,n=l&&Object.keys(l).length&&i&&en(l)?(e=>{const t=i.filter(t=>t.split("_").every(t=>jo(e,t)&&en(e,t))).map(t=>{const o=(e.settings&&e.settings[t]||{}).control||t,i=t.split("_");let n=i.length>1?i.map(t=>e[t]):e[t];if(L(s[o])){const{title:i,component:r}=s[o](n,e=>{c({[t]:e})},{selectedShapeId:e.id});return{id:o,component:Rh,componentProps:{title:i,items:r}}}let[r,a]=s[o];if(y(r)&&s[r]){const e={...a};[r,a]=s[r],a={...a,...e}}const l=L(a.options)?a.options(e):a.options;return"RadioGroup"===r&&(a.selectedIndex=-1),L(a.formatValue)&&(n=a.formatValue(n)),{id:o,component:r,componentProps:{...a,options:l,locale:d,value:n,optionLabelClass:"PinturaButtonLabel",onchange:o=>{let n=I(o)&&!Uo(o)?o.value:o;L(a.formatValue)&&(n=a.formatValue(n)),a.onchange&&a.onchange(n,e);const r=i.length>1?i.reduce((e,t,o)=>({...e,[t]:Array.isArray(n)?n[o]:n}),{}):{[t]:n};c(r)}}}}).filter(Boolean);return t})(l):[]),1280&e.$$.dirty&&o(7,r=((e,t)=>{let o=g.find(t=>t.key===e);return o||(o={key:e,controls:t},g.push(o)),g.forEach(e=>e.isActive=!1),o.controls=t,o.isActive=!0,g})(l&&Object.keys(l).length?Object.keys(l).join("_"):"none",n||[]))},[a,d,u,p,h,m,s,r,l,c,n,i]}class Zb extends rs{constructor(e){super(),ns(this,e,Gb,Ub,yr,{class:0,controls:6,shapeProps:8,onchange:9,locale:1,scrollElasticity:2,scrollEnable:3,hideTitles:4,willRenderControls:5})}}var Xb=e=>/<svg /.test(e);function Yb(e){let t,o;return t=new Rh({props:{items:e[10]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function qb(e){let t,o,i,n;const r=[Jb,Kb],a=[];function s(e,t){return e[8]?0:1}return t=s(e),o=a[t]=r[t](e),{c(){o.c(),i=Yr()},m(e,o){a[t].m(e,o),Hr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?a[t].p(e,n):(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha(),o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),ja(o,1),o.m(i.parentNode,i))},i(e){n||(ja(o),n=!0)},o(e){Ua(o),n=!1},d(e){e&&jr(i),a[t].d(e)}}}function Kb(e){let t,o,i,n,r=e[10]&&Qb(e);return i=new Gh({props:{scrollAutoCancel:e[9],elasticity:e[0],$$slots:{default:[ex]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),r&&r.c(),o=Xr(),ts(i.$$.fragment),Qr(t,"class","PinturaShapePresetsFlat")},m(e,a){Hr(e,t,a),r&&r.m(t,null),_r(t,o),os(i,t,null),n=!0},p(e,n){e[10]?r?(r.p(e,n),1024&n&&ja(r,1)):(r=Qb(e),r.c(),ja(r,1),r.m(t,o)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha());const a={};512&n&&(a.scrollAutoCancel=e[9]),1&n&&(a.elasticity=e[0]),536871070&n&&(a.$$scope={dirty:n,ctx:e}),i.$set(a)},i(e){n||(ja(r),ja(i.$$.fragment,e),n=!0)},o(e){Ua(r),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(t),r&&r.d(),is(i)}}}function Jb(e){let t,o,i,n,r;o=new Gh({props:{elasticity:e[0],class:"PinturaShapePresetsGroups",$$slots:{default:[ax]},$$scope:{ctx:e}}});const a=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[11]},e[12]];let s={$$slots:{default:[lx,({panel:e,panelIsActive:t})=>({26:e,27:t}),({panel:e,panelIsActive:t})=>(e?67108864:0)|(t?134217728:0)]},$$scope:{ctx:e}};for(let e=0;e<a.length;e+=1)s=hr(s,a[e]);return n=new Rd({props:s}),{c(){t=Ur("div"),ts(o.$$.fragment),i=Xr(),ts(n.$$.fragment),Qr(t,"class","PinturaShapePresetsGrouped")},m(e,a){Hr(e,t,a),os(o,t,null),_r(t,i),os(n,t,null),r=!0},p(e,t){const i={};1&t&&(i.elasticity=e[0]),536876128&t&&(i.$$scope={dirty:t,ctx:e}),o.$set(i);const r=6144&t?Ja(a,[a[0],a[1],2048&t&&{panels:e[11]},4096&t&&Qa(e[12])]):{};738206239&t&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||(ja(o.$$.fragment,e),ja(n.$$.fragment,e),r=!0)},o(e){Ua(o.$$.fragment,e),Ua(n.$$.fragment,e),r=!1},d(e){e&&jr(t),is(o),is(n)}}}function Qb(e){let t,o;return t=new Rh({props:{items:e[10]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ex(e){let t,o;return t=new Xd({props:{items:e[7],onclickitem:e[1],ongrabitem:e[2],ondragitem:e[3],ondropitem:e[4]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};128&o&&(i.items=e[7]),2&o&&(i.onclickitem=e[1]),4&o&&(i.ongrabitem=e[2]),8&o&&(i.ondragitem=e[3]),16&o&&(i.ondropitem=e[4]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function tx(e){let t,o;return t=new Rh({props:{items:e[10]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ox(e){let t,o;return t=new Od({props:{$$slots:{default:[ix]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};805306368&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ix(e){let t,o=e[28].icon+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){268435456&i&&o!==(o=e[28].icon+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function nx(e){let t,o,i=e[28].label+"";return{c(){t=Ur("span"),o=Zr(i)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){268435456&t&&i!==(i=e[28].label+"")&&na(o,i)},d(e){e&&jr(t)}}}function rx(e){let t,o,i,n=e[28].icon&&ox(e),r=!e[28].hideLabel&&nx(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Yr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[28].icon?n?(n.p(e,i),268435456&i&&ja(n,1)):(n=ox(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[28].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=nx(e),r.c(),r.m(o.parentNode,o))},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}function ax(e){let t,o,i,n=e[10]&&tx(e);const r=[{class:"PinturaControlList"},{tabs:e[5]},e[12],{layout:"compact"}];let a={$$slots:{default:[rx,({tab:e})=>({28:e}),({tab:e})=>e?268435456:0]},$$scope:{ctx:e}};for(let e=0;e<r.length;e+=1)a=hr(a,r[e]);return o=new $d({props:a}),o.$on("select",e[18]),{c(){n&&n.c(),t=Xr(),ts(o.$$.fragment)},m(e,r){n&&n.m(e,r),Hr(e,t,r),os(o,e,r),i=!0},p(e,i){e[10]?n?(n.p(e,i),1024&i&&ja(n,1)):(n=tx(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha());const a=4128&i?Ja(r,[r[0],32&i&&{tabs:e[5]},4096&i&&Qa(e[12]),r[3]]):{};805306368&i&&(a.$$scope={dirty:i,ctx:e}),o.$set(a)},i(e){i||(ja(n),ja(o.$$.fragment,e),i=!0)},o(e){Ua(n),Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),n&&n.d(e),is(o,e)}}}function sx(e){let t,o;return t=new Xd({props:{items:e[13][e[26]].items,disabled:e[13][e[26]].disabled,onclickitem:e[1],ongrabitem:e[2],ondragitem:e[3],ondropitem:e[4]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};67117056&o&&(i.items=e[13][e[26]].items),67117056&o&&(i.disabled=e[13][e[26]].disabled),2&o&&(i.onclickitem=e[1]),4&o&&(i.ongrabitem=e[2]),8&o&&(i.ondragitem=e[3]),16&o&&(i.ondropitem=e[4]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function lx(e){let t,o;return t=new Gh({props:{scroll:e[27]?{scrollOffset:0,animate:!1}:void 0,scrollAutoCancel:e[9],elasticity:e[0],$$slots:{default:[sx]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};134217728&o&&(i.scroll=e[27]?{scrollOffset:0,animate:!1}:void 0),512&o&&(i.scrollAutoCancel=e[9]),1&o&&(i.elasticity=e[0]),603987998&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function cx(e){let t,o,i,n;const r=[qb,Yb],a=[];function s(e,t){return e[9]?0:e[10]?1:-1}return~(o=s(e))&&(i=a[o]=r[o](e)),{c(){t=Ur("div"),i&&i.c(),Qr(t,"class","PinturaShapePresetsPalette")},m(e,i){Hr(e,t,i),~o&&a[o].m(t,null),n=!0},p(e,[n]){let l=o;o=s(e),o===l?~o&&a[o].p(e,n):(i&&(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha()),~o?(i=a[o],i?i.p(e,n):(i=a[o]=r[o](e),i.c()),ja(i,1),i.m(t,null)):i=null)},i(e){n||(ja(i),n=!0)},o(e){Ua(i),n=!1},d(e){e&&jr(t),~o&&a[o].d()}}}function dx(e,t,i){let n,r,a,s,l,c,d,u,p,{locale:h}=t,{presets:m}=t,{scrollElasticity:g}=t,{enableSelectImage:$=!0}=t,{willRenderPresetToolbar:f=ee}=t,{onaddpreset:b=o}=t,{ongrabpreset:x}=t,{ondragpreset:v}=t,{ondroppreset:S}=t;const w=`presets-${B()}`,k=(e,t="")=>Xb(e)?e:Ho(e)?qo(e,t):`<img src="${e}" alt="${t}"/>`,C=e=>Y(Jt(e)),T=["src","alt","thumb","shape","id","mount","disabled"],M=e=>e.map(e=>(e=>Uo(e)&&y(e[0])&&Uo(e[1]))(e)?{...e[2],id:`${w}-${e[0].toLowerCase()}`,label:e[0],items:M(e[1])}:(e=>{let t,o,i,n,r,a,s,l=e;return y(e)?Ho(e)?(t=e,r=e,n=k(t,r)):(t=e,r=C(t),n=k(t,r)):(t=e.src,r=e.alt||(y(t)?C(t):y(e.thumb)?C(e.thumb):void 0),n=k(e.thumb||t,r),o=e.shape,a=e.mount,s=e.disabled,i=Object.keys(e).reduce((t,o)=>(T.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&&i(14,h=e.locale),"presets"in e&&i(15,m=e.presets),"scrollElasticity"in e&&i(0,g=e.scrollElasticity),"enableSelectImage"in e&&i(16,$=e.enableSelectImage),"willRenderPresetToolbar"in e&&i(17,f=e.willRenderPresetToolbar),"onaddpreset"in e&&i(1,b=e.onaddpreset),"ongrabpreset"in e&&i(2,x=e.ongrabpreset),"ondragpreset"in e&&i(3,v=e.ondragpreset),"ondroppreset"in e&&i(4,S=e.ondroppreset)},e.$$.update=()=>{32768&e.$$.dirty&&i(7,n=M(m)),128&e.$$.dirty&&i(9,r=n.length),640&e.$$.dirty&&i(8,a=r&&n.some(e=>!!e.items)),384&e.$$.dirty&&i(5,s=a&&n),384&e.$$.dirty&&i(13,l=a&&n.reduce((e,t)=>(e[t.id]=t,e),{})),96&e.$$.dirty&&i(6,c=c||s&&(s.find(e=>!e.disabled)||{}).id),64&e.$$.dirty&&i(12,d={name:w,selected:c}),32&e.$$.dirty&&i(11,u=s&&s.map(e=>e.id)),212994&e.$$.dirty&&i(10,p=h&&f([$&&["Button","browse",{label:h.shapeLabelButtonSelectSticker,icon:h.shapeIconButtonSelectSticker,onclick:()=>{Sm().then(e=>{e&&b(e)})}}]]))},[g,b,x,v,S,s,c,n,a,r,p,u,d,l,h,m,$,f,({detail:e})=>i(6,c=e)]}class ux extends rs{constructor(e){super(),ns(this,e,dx,cx,yr,{locale:14,presets:15,scrollElasticity:0,enableSelectImage:16,willRenderPresetToolbar:17,onaddpreset:1,ongrabpreset:2,ondragpreset:3,ondroppreset:4})}}function px(e){let t,o,i,n;return t=new Rh({props:{items:e[30]}}),i=new Zb({props:{locale:e[4],shapeProps:e[49],onchange:e[85],controls:e[9],scrollEnable:!1,hideTitles:!0,willRenderControls:e[165]}}),{c(){ts(t.$$.fragment),o=Xr(),ts(i.$$.fragment)},m(e,r){os(t,e,r),Hr(e,o,r),os(i,e,r),n=!0},p(e,o){const n={};1073741824&o[0]&&(n.items=e[30]),t.$set(n);const r={};16&o[0]&&(r.locale=e[4]),262144&o[1]&&(r.shapeProps=e[49]),512&o[0]&&(r.controls=e[9]),i.$set(r)},i(e){n||(ja(t.$$.fragment,e),ja(i.$$.fragment,e),n=!0)},o(e){Ua(t.$$.fragment,e),Ua(i.$$.fragment,e),n=!1},d(e){e&&jr(o),is(t,e),is(i,e)}}}function hx(e){let t,o,i;return o=new Ef({props:{$$slots:{default:[px]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"slot","header")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};1073742352&t[0]|262144&t[1]|268435456&t[6]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function mx(e){let t,o;const i=[{locale:e[4]},{ui:e[69]},{shapes:e[5]},{selection:e[58]},{uid:e[20]},{parentRect:e[37]},{rootRect:e[55]},{utilRect:e[39]},{offset:e[50]},{disabled:e[38]},{contextRotation:e[23]},{contextFlipX:e[24]},{contextFlipY:e[25]},{contextZoom:e[36]?e[36].scale:void 0},{active:e[35]},{opacity:e[56]},{hoverColor:e[57]},{caretColor:e[57]},{snapColor:e[57]},{gridColor:[1,1,1,.125]},{eraseRadius:e[47]},{selectRadius:e[6]},{enableButtonFlipVertical:e[10]},{enableMultiSelect:e[14]},{mapEditorPointToImagePoint:e[21]},{mapImagePointToEditorPoint:e[22]},{enableTapToAddText:e[13]},{textInputMode:e[8]},{snapThreshold:e[16]},{snapPointer:!e[48]},{enableSnapToContext:e[17]},{gridSize:e[15]},{willStartInteraction:e[95]},{oninteractionstart:e[79]},{oninteractionupdate:e[80]},{oninteractionrelease:e[81]},{oninteractionend:e[83]},{oninteractioncancel:e[82]},{onleavecanvas:e[87]},{onhovercanvas:e[86]},{onhovershape:e[89]},{ontapcanvas:e[88]},{onaddshape:e[156]},{onselectshape:e[157]},{onblurshape:e[158]},{ontapshape:e[159]},{onupdateshape:e[160]},{onremoveshape:e[161]},{ontriggerhistorywrite:e[162]},e[42]];let n={};for(let e=0;e<i.length;e+=1)n=hr(n,i[e]);return t=new Db({props:n}),e[163](t),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const n=66315632&o[0]|252381681&o[1]|255721600&o[2]|12&o[3]?Ja(i,[16&o[0]&&{locale:e[4]},128&o[2]&&{ui:e[69]},32&o[0]&&{shapes:e[5]},134217728&o[1]&&{selection:e[58]},1048576&o[0]&&{uid:e[20]},64&o[1]&&{parentRect:e[37]},16777216&o[1]&&{rootRect:e[55]},256&o[1]&&{utilRect:e[39]},524288&o[1]&&{offset:e[50]},128&o[1]&&{disabled:e[38]},8388608&o[0]&&{contextRotation:e[23]},16777216&o[0]&&{contextFlipX:e[24]},33554432&o[0]&&{contextFlipY:e[25]},32&o[1]&&{contextZoom:e[36]?e[36].scale:void 0},16&o[1]&&{active:e[35]},33554432&o[1]&&{opacity:e[56]},67108864&o[1]&&{hoverColor:e[57]},67108864&o[1]&&{caretColor:e[57]},67108864&o[1]&&{snapColor:e[57]},i[19],65536&o[1]&&{eraseRadius:e[47]},64&o[0]&&{selectRadius:e[6]},1024&o[0]&&{enableButtonFlipVertical:e[10]},16384&o[0]&&{enableMultiSelect:e[14]},2097152&o[0]&&{mapEditorPointToImagePoint:e[21]},4194304&o[0]&&{mapImagePointToEditorPoint:e[22]},8192&o[0]&&{enableTapToAddText:e[13]},256&o[0]&&{textInputMode:e[8]},65536&o[0]&&{snapThreshold:e[16]},131072&o[1]&&{snapPointer:!e[48]},131072&o[0]&&{enableSnapToContext:e[17]},32768&o[0]&&{gridSize:e[15]},4&o[3]&&{willStartInteraction:e[95]},131072&o[2]&&{oninteractionstart:e[79]},262144&o[2]&&{oninteractionupdate:e[80]},524288&o[2]&&{oninteractionrelease:e[81]},2097152&o[2]&&{oninteractionend:e[83]},1048576&o[2]&&{oninteractioncancel:e[82]},33554432&o[2]&&{onleavecanvas:e[87]},16777216&o[2]&&{onhovercanvas:e[86]},134217728&o[2]&&{onhovershape:e[89]},67108864&o[2]&&{ontapcanvas:e[88]},1&o[1]|8&o[3]&&{onaddshape:e[156]},1&o[1]&&{onselectshape:e[157]},1&o[1]&&{onblurshape:e[158]},1&o[1]&&{ontapshape:e[159]},1&o[1]|8&o[3]&&{onupdateshape:e[160]},1&o[1]|8&o[3]&&{onremoveshape:e[161]},8&o[3]&&{ontriggerhistorywrite:e[162]},2048&o[1]&&Qa(e[42])]):{};t.$set(n)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(o){e[163](null),is(t,o)}}}function gx(e){let t,o,i,n,r,a=e[51]&&mx(e);return{c(){t=Ur("div"),a&&a.c(),Qr(t,"slot","main"),aa(t,"cursor",e[46])},m(s,l){Hr(s,t,l),a&&a.m(t,null),e[164](t),i=!0,n||(r=[qr(t,"keydown",e[84]),Ar(o=ed.call(null,t,{disabled:!e[12]})),qr(t,"dropfiles",e[94]),Ar(qc.call(null,t)),qr(t,"measure",e[152])],n=!0)},p(e,i){e[51]?a?(a.p(e,i),1048576&i[1]&&ja(a,1)):(a=mx(e),a.c(),ja(a,1),a.m(t,null)):a&&(Na(),Ua(a,1,1,()=>{a=null}),Ha()),o&&fr(o.update)&&4096&i[0]&&o.update.call(null,{disabled:!e[12]}),32768&i[1]&&aa(t,"cursor",e[46])},i(e){i||(ja(a),i=!0)},o(e){Ua(a),i=!1},d(o){o&&jr(t),a&&a.d(),e[164](null),n=!1,$r(r)}}}function $x(e){let t,o;return t=new ux({props:{locale:e[4],presets:e[19],enableSelectImage:e[11],willRenderPresetToolbar:e[43],onaddpreset:e[93],ongrabpreset:e[90],ondragpreset:e[91],ondroppreset:e[92],scrollElasticity:e[44]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),524288&o[0]&&(i.presets=e[19]),2048&o[0]&&(i.enableSelectImage=e[11]),4096&o[1]&&(i.willRenderPresetToolbar=e[43]),8192&o[1]&&(i.scrollElasticity=e[44]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function fx(e){let t,o,i,n="stack"===e[7]&&yx(e),r=(e[53]&&e[34]||"row"===e[7])&&vx(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Yr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){"stack"===e[7]?n?(n.p(e,i),128&i[0]&&ja(n,1)):(n=yx(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[53]&&e[34]||"row"===e[7]?r?(r.p(e,i),128&i[0]|4194312&i[1]&&ja(r,1)):(r=vx(e),r.c(),ja(r,1),r.m(o.parentNode,o)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}function yx(e){let t,o,i,n;const r=[xx,bx],a=[];function s(e,t){return e[45]?0:1}return o=s(e),i=a[o]=r[o](e),{c(){t=Ur("div"),i.c(),Qr(t,"class","PinturaControlPanels")},m(e,i){Hr(e,t,i),a[o].m(t,null),n=!0},p(e,n){let l=o;o=s(e),o===l?a[o].p(e,n):(Na(),Ua(a[l],1,1,()=>{a[l]=null}),Ha(),i=a[o],i?i.p(e,n):(i=a[o]=r[o](e),i.c()),ja(i,1),i.m(t,null))},i(e){n||(ja(i),n=!0)},o(e){Ua(i),n=!1},d(e){e&&jr(t),a[o].d()}}}function bx(e){let t,o,i;return o=new Zb({props:{locale:e[4],shapeProps:e[49],onchange:e[85],controls:e[9],scrollElasticity:e[44],willRenderControls:e[18]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaControlPanel")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};16&t[0]&&(i.locale=e[4]),262144&t[1]&&(i.shapeProps=e[49]),512&t[0]&&(i.controls=e[9]),8192&t[1]&&(i.scrollElasticity=e[44]),262144&t[0]&&(i.willRenderControls=e[18]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function xx(e){let t,o,i;return o=new ux({props:{locale:e[4],presets:e[19],enableSelectImage:e[11],willRenderPresetToolbar:e[43],onaddpreset:e[93],ongrabpreset:e[90],ondragpreset:e[91],ondroppreset:e[92],scrollElasticity:e[44]}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"class","PinturaControlPanel")},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,t){const i={};16&t[0]&&(i.locale=e[4]),524288&t[0]&&(i.presets=e[19]),2048&t[0]&&(i.enableSelectImage=e[11]),4096&t[1]&&(i.willRenderPresetToolbar=e[43]),8192&t[1]&&(i.scrollElasticity=e[44]),o.$set(i)},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function vx(e){let t,o;return t=new Gh({props:{class:"PinturaControlListScroller",elasticity:e[44],$$slots:{default:[Px]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8192&o[1]&&(i.elasticity=e[44]),262801&o[0]|262154&o[1]|268435456&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Sx(e){let t,o;return t=new Xu({props:{locale:e[4],class:"PinturaControlList",optionClass:"PinturaControlListOption",layout:"row",options:e[32],selectedIndex:e[32].findIndex(e[153]),onchange:e[78],$$slots:{option:[Tx,({option:e})=>({213:e}),({option:e})=>[0,0,0,0,0,0,e?134217728:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),2&o[1]&&(i.options=e[32]),1&o[0]|2&o[1]&&(i.selectedIndex=e[32].findIndex(e[153])),16&o[0]|402653184&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function wx(e){let t,o;return t=new Od({props:{$$slots:{default:[kx]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]|402653184&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function kx(e){let t,o=(L(e[213].icon)?e[213].icon(e[4]):e[213].icon)+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){16&i[0]|134217728&i[6]&&o!==(o=(L(e[213].icon)?e[213].icon(e[4]):e[213].icon)+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function Cx(e){let t,o,i=(L(e[213].label)?e[213].label(e[4]):e[213].label)+"";return{c(){t=Ur("span"),o=Zr(i)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){16&t[0]|134217728&t[6]&&i!==(i=(L(e[213].label)?e[213].label(e[4]):e[213].label)+"")&&na(o,i)},d(e){e&&jr(t)}}}function Tx(e){let t,o,i,n=e[213].icon&&wx(e),r=!e[213].hideLabel&&Cx(e);return{c(){t=Ur("div"),n&&n.c(),o=Xr(),r&&r.c(),Qr(t,"slot","option")},m(e,a){Hr(e,t,a),n&&n.m(t,null),_r(t,o),r&&r.m(t,null),i=!0},p(e,i){e[213].icon?n?(n.p(e,i),134217728&i[6]&&ja(n,1)):(n=wx(e),n.c(),ja(n,1),n.m(t,o)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),e[213].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=Cx(e),r.c(),r.m(t,null))},i(e){i||(ja(n),i=!0)},o(e){Ua(n),i=!1},d(e){e&&jr(t),n&&n.d(),r&&r.d()}}}function Mx(e){let t,o;return t=new Zb({props:{locale:e[4],shapeProps:e[49],onchange:e[85],controls:e[9],scrollEnable:!1,hideTitles:!0,willRenderControls:e[154]}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),262144&o[1]&&(i.shapeProps=e[49]),512&o[0]&&(i.controls=e[9]),262144&o[0]&&(i.willRenderControls=e[154]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Px(e){let t,o,i,n=e[34]&&Sx(e),r="row"===e[7]&&Mx(e);return{c(){n&&n.c(),t=Xr(),r&&r.c(),o=Yr()},m(e,a){n&&n.m(e,a),Hr(e,t,a),r&&r.m(e,a),Hr(e,o,a),i=!0},p(e,i){e[34]?n?(n.p(e,i),8&i[1]&&ja(n,1)):(n=Sx(e),n.c(),ja(n,1),n.m(t.parentNode,t)):n&&(Na(),Ua(n,1,1,()=>{n=null}),Ha()),"row"===e[7]?r?(r.p(e,i),128&i[0]&&ja(r,1)):(r=Mx(e),r.c(),ja(r,1),r.m(o.parentNode,o)):r&&(Na(),Ua(r,1,1,()=>{r=null}),Ha())},i(e){i||(ja(n),ja(r),i=!0)},o(e){Ua(n),Ua(r),i=!1},d(e){e&&(jr(t),jr(o)),n&&n.d(e),r&&r.d(e)}}}function Rx(e){let t,o;return t=new Gh({props:{class:"PinturaControlListScroller",elasticity:e[44],$$slots:{default:[Lx]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8192&o[1]&&(i.elasticity=e[44]),134217744&o[0]|8388608&o[1]|268435456&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Ix(e){let t,o;return t=new Od({props:{$$slots:{default:[Ex]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]|402653184&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Ex(e){let t,o=(L(e[213].icon)?e[213].icon(e[4]):e[213].icon)+"";return{c(){t=Gr("g")},m(e,i){Hr(e,t,i),t.innerHTML=o},p(e,i){16&i[0]|134217728&i[6]&&o!==(o=(L(e[213].icon)?e[213].icon(e[4]):e[213].icon)+"")&&(t.innerHTML=o)},d(e){e&&jr(t)}}}function Ax(e){let t,o,i,n,r,a=(L(e[213].label)?e[213].label(e[4]):e[213].label)+"",s=e[213].icon&&Ix(e);return{c(){t=Ur("div"),s&&s.c(),o=Xr(),i=Ur("span"),n=Zr(a),Qr(t,"slot","option")},m(e,a){Hr(e,t,a),s&&s.m(t,null),_r(t,o),_r(t,i),_r(i,n),r=!0},p(e,i){e[213].icon?s?(s.p(e,i),134217728&i[6]&&ja(s,1)):(s=Ix(e),s.c(),ja(s,1),s.m(t,o)):s&&(Na(),Ua(s,1,1,()=>{s=null}),Ha()),(!r||16&i[0]|134217728&i[6])&&a!==(a=(L(e[213].label)?e[213].label(e[4]):e[213].label)+"")&&na(n,a)},i(e){r||(ja(s),r=!0)},o(e){Ua(s),r=!1},d(e){e&&jr(t),s&&s.d()}}}function Lx(e){let t,o;return t=new Xu({props:{locale:e[4],class:"PinturaControlList",optionClass:"PinturaControlListOption",layout:"row",options:e[54],selectedIndex:e[54].findIndex(e[155]),onchange:e[77],$$slots:{option:[Ax,({option:e})=>({213:e}),({option:e})=>[0,0,0,0,0,0,e?134217728:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),8388608&o[1]&&(i.options=e[54]),134217728&o[0]|8388608&o[1]&&(i.selectedIndex=e[54].findIndex(e[155])),16&o[0]|402653184&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Fx(e){let t,o,i,n,r;const a=[fx,$x],s=[];function l(e,t){return e[52]?0:e[45]?1:-1}~(o=l(e))&&(i=s[o]=a[o](e));let c=e[33]&&Rx(e);return{c(){t=Ur("div"),i&&i.c(),n=Xr(),c&&c.c(),Qr(t,"slot","footer"),aa(t,"transform",e[40])},m(e,i){Hr(e,t,i),~o&&s[o].m(t,null),_r(t,n),c&&c.m(t,null),r=!0},p(e,r){let d=o;o=l(e),o===d?~o&&s[o].p(e,r):(i&&(Na(),Ua(s[d],1,1,()=>{s[d]=null}),Ha()),~o?(i=s[o],i?i.p(e,r):(i=s[o]=a[o](e),i.c()),ja(i,1),i.m(t,n)):i=null),e[33]?c?(c.p(e,r),4&r[1]&&ja(c,1)):(c=Rx(e),c.c(),ja(c,1),c.m(t,null)):c&&(Na(),Ua(c,1,1,()=>{c=null}),Ha()),512&r[1]&&aa(t,"transform",e[40])},i(e){r||(ja(i),ja(c),r=!0)},o(e){Ua(i),Ua(c),r=!1},d(e){e&&jr(t),~o&&s[o].d(),c&&c.d()}}}function zx(e){let t,o;return t=new Uf({props:{hasHeader:e[41],$$slots:{footer:[Fx],main:[gx],header:[hx]},$$scope:{ctx:e}}}),t.$on("measure",e[166]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};1024&o[1]&&(i.hasHeader=e[41]),2080374769&o[0]|134216703&o[1]|268435456&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Dx(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,b,x,v,S,w,k,C,T,M,P,R,I,E,A,L,F,z,D,O,B,W,_,V,N,H,j,U,G,Z,X,Y,q,K,J,Q,te,oe,ie,ne,re,ae,se,le,ce,de,ue,pe,he,me,ge,$e,fe,ye,xe=ur,ve=()=>(xe(),xe=vr(Ie,e=>o(35,X=e)),Ie),Se=ur,we=()=>(Se(),Se=vr(ze,e=>o(145,J=e)),ze),ke=ur,Ce=()=>(ke(),ke=vr(xt,e=>o(37,ae=e)),xt),Te=ur,Me=()=>(Te(),Te=vr(Ae,e=>o(151,me=e)),Ae),Pe=ur,Re=()=>(Pe(),Pe=vr(Ee,e=>o(56,fe=e)),Ee);e.$$.on_destroy.push(()=>xe()),e.$$.on_destroy.push(()=>Se()),e.$$.on_destroy.push(()=>ke()),e.$$.on_destroy.push(()=>Te()),e.$$.on_destroy.push(()=>Pe());let{isActive:Ie}=t;ve();let{isActiveFraction:Ee}=t;Re();let{isVisible:Ae}=t;Me();let{stores:Le}=t,{locale:Fe={}}=t,{shapes:ze}=t;we();let{toolbar:Oe=[]}=t,{toolShapes:We={}}=t,{toolActive:_e}=t,{toolSelectRadius:Ve}=t,{toolRetainStyles:Ne=!1}=t,{toolbarLayout:He="stack"}=t,{textInputMode:je}=t,{shapeControls:Ue={}}=t,{enableButtonFlipVertical:Ge=!1}=t,{enablePresetSelectImage:Ze=!0}=t,{enablePresetDropImage:Xe=!0}=t,{enableSelectToolToAddShape:Ye=!1}=t,{enableAutoSelectMoveTool:qe=["line","arrow","path","rectangle","ellipse","text"]}=t,{enableTapToAddText:Ke=!1}=t,{enableMoveTool:Je=!1}=t,{enableViewTool:Qe=!1}=t,{enableToolShareStyles:et=!0}=t,{enableMultiSelect:tt=!1}=t,{gridSize:ot=0}=t,{snapThreshold:it=0}=t,{enableSnapToContext:nt=!0}=t,{willRenderHeaderTools:at=ee}=t,{willRenderPresetToolbar:st}=t,{willRenderShapeStyleControls:lt}=t,{willStartInteraction:ct}=t,{shapePresets:dt=[]}=t,{utilKey:ut}=t,{mapScreenPointToImagePoint:pt}=t,{mapImagePointToScreenPoint:ht}=t,{imageRotation:ft=0}=t,{imageFlipX:yt=!1}=t,{imageFlipY:bt=!1}=t,{parentRect:xt}=t;Ce();let{hooks:vt={}}=t;const St=Sa("selection");wr(e,St,e=>o(150,ue=e));const wt=Sa("isAnimated");wr(e,wt,e=>o(142,Y=e));const kt=Sa("elasticityMultiplier");wr(e,kt,e=>o(146,Q=e));const Ct=Sa("ui");wr(e,Ct,e=>o(177,pe=e));const Mt=Sa("keysPressed");let Pt;wr(e,Mt,e=>o(149,de=e));const{env:Rt,history:It,rootRect:Et,rootColorSecondary:At,enablePanInput:Lt,enablePanInputStatus:Ft,enableZoomInput:zt,stageRect:Dt,utilRectPadded:Ot,scrollElasticity:Bt,imageOverlayMarkup:Wt,imagePreviewModifiers:_t,imageCropRect:Vt,stageScalar:Nt,imageSelectionRect:Ht,imageTransformsInterpolated:jt,imageSelectionPan:Ut,imageSize:Gt,allowPan:Zt,allowZoom:Xt,allowZoomControls:Yt,allowPlayPause:qt}=Le;wr(e,Rt,e=>o(143,q=e)),wr(e,Et,e=>o(55,$e=e)),wr(e,At,e=>o(57,ye=e)),wr(e,Ft,e=>o(38,le=e)),wr(e,Dt,e=>o(147,te=e)),wr(e,Ot,e=>o(39,he=e)),wr(e,_t,e=>o(178,ge=e)),wr(e,Vt,e=>o(176,se=e)),wr(e,Nt,e=>o(174,ne=e)),wr(e,Ht,e=>o(175,re=e)),wr(e,jt,e=>o(36,oe=e)),wr(e,Ut,e=>o(173,ie=e)),wr(e,Gt,e=>o(148,ce=e));let Kt=0,Jt={};const Qt=e=>{const[t,o]=Pt[e];let i,n,r="relative"===o.position;const a=r?"0%":0,s=r?"0%":0;Wi(t)||Di(t)?(n=r?"20%":.2*ae.width,i=Ri(t),yn(i),bn(i),i.x=a,i.y=s,Dn(i,{width:n,height:n},ae)):_i(t)?(n=r?"10%":.1*ae.width,i=Ri(t),i.x=a,i.y=s,Dn(i,{rx:n,ry:n},ae)):Vi(t)&&(n=r?"10%":.1*ae.width,i=Ri(t),i.x1=a,i.y1=s,i.x2=a,i.y2=s),i&&Promise.resolve().then(()=>{fo(go(i,void 0,n))})},eo=e=>pt(pb(e,$e));let to,oo={};let io;let no;const ro=e=>{if(!(Ni(e)&&jo(e,"pathClose")))return;const t=[...e.strokeColor];t[3]=1,to.updateMarkupShape(e,{pathClose:!1,strokeColor:t},!1),to.removeMarkupShapeProps(e,["backgroundColor"],!1),to.confirmMarkupItemDraft(),to.selectShape(e),_("addshape",e),It.write()},ao=e=>{const t=Ri(e);return Object.assign(t,pe[ut]?pe[ut][_e]:{}),wn(t),t};let lo;const co=(e,t)=>{const o={};return Object.entries(e).forEach(([e,i])=>{jo(t,e)&&(o[e]=i)}),o},uo=(e,t)=>{if(No(e))return e;if(e.endsWith("%")){return parseFloat(e)/100*t.width}};let po,ho,mo;const go=(e,t,o)=>{let i=!1;t||(i=!0,t=W?pt(mt(te)):mt(se)),t.x-=ae.x||0,t.y-=ae.y||0,(yt||bt)&&(e.flipX=yt,e.flipY=bt);const n=to.getShapesNearPosition(J,t);if(i&&n.length){const e=.1*Math.min(se.width,se.height);t.x+=Math.round(-e+Math.random()*e*2),t.y+=Math.round(-e+Math.random()*e*2)}if(0!==ft&&(e.rotation=yt&&bt?-ft:yt||bt?ft:-ft),jo(e,"width")&&jo(e,"height")){const{width:o,height:i}=zn(e,["width","height"],ae);Dn(e,{x:t.x-.5*o,y:t.y-.5*i},ae)}else if(_i(e))Dn(e,{x:t.x,y:t.y},ae);else if(Vi(e)){const{x1:i,y1:n,x2:r,y2:a}=zn(e,["x1","y1","x2","y2"],ae),s=De(be(i,n),be(r,a)),l=y(o)?Cn(o,ae.width):s;Dn(e,{x1:t.x-l,y1:t.y+l,x2:t.x+l,y2:t.y-l},ae)}else if(Ni(e)){const{points:o}=zn(e,["points"],ae),i=Be(o);Dn(e,{points:o.map(e=>({x:e.x+t.x-i.x,y:e.y+t.y-i.y}))},ae)}return e},$o=(e,t)=>{const o=go(Li(e,se),t);return e.shape&&(jo(e.shape,"x")&&(o.x=e.shape.x),jo(e.shape,"y")&&(o.y=e.shape.y)),fo(o)},fo=e=>{const{beforeAddShape:t=()=>!0}=vt;if(t(e))return to.addShape(e),to.selectShape(e),_("addshape",e),It.write(),e};let yo=!1;const bo=()=>{It.write()};let xo;const vo=Sa("redrawTrigger");wr(e,vo,e=>o(144,K=e));const So=[],wo=Fc(Y?20:0);wr(e,wo,e=>o(141,Z=e));return e.$$set=e=>{"isActive"in e&&ve(o(1,Ie=e.isActive)),"isActiveFraction"in e&&Re(o(2,Ee=e.isActiveFraction)),"isVisible"in e&&Me(o(3,Ae=e.isVisible)),"stores"in e&&o(100,Le=e.stores),"locale"in e&&o(4,Fe=e.locale),"shapes"in e&&we(o(5,ze=e.shapes)),"toolbar"in e&&o(101,Oe=e.toolbar),"toolShapes"in e&&o(102,We=e.toolShapes),"toolActive"in e&&o(0,_e=e.toolActive),"toolSelectRadius"in e&&o(6,Ve=e.toolSelectRadius),"toolRetainStyles"in e&&o(103,Ne=e.toolRetainStyles),"toolbarLayout"in e&&o(7,He=e.toolbarLayout),"textInputMode"in e&&o(8,je=e.textInputMode),"shapeControls"in e&&o(9,Ue=e.shapeControls),"enableButtonFlipVertical"in e&&o(10,Ge=e.enableButtonFlipVertical),"enablePresetSelectImage"in e&&o(11,Ze=e.enablePresetSelectImage),"enablePresetDropImage"in e&&o(12,Xe=e.enablePresetDropImage),"enableSelectToolToAddShape"in e&&o(104,Ye=e.enableSelectToolToAddShape),"enableAutoSelectMoveTool"in e&&o(105,qe=e.enableAutoSelectMoveTool),"enableTapToAddText"in e&&o(13,Ke=e.enableTapToAddText),"enableMoveTool"in e&&o(106,Je=e.enableMoveTool),"enableViewTool"in e&&o(107,Qe=e.enableViewTool),"enableToolShareStyles"in e&&o(108,et=e.enableToolShareStyles),"enableMultiSelect"in e&&o(14,tt=e.enableMultiSelect),"gridSize"in e&&o(15,ot=e.gridSize),"snapThreshold"in e&&o(16,it=e.snapThreshold),"enableSnapToContext"in e&&o(17,nt=e.enableSnapToContext),"willRenderHeaderTools"in e&&o(109,at=e.willRenderHeaderTools),"willRenderPresetToolbar"in e&&o(110,st=e.willRenderPresetToolbar),"willRenderShapeStyleControls"in e&&o(18,lt=e.willRenderShapeStyleControls),"willStartInteraction"in e&&o(111,ct=e.willStartInteraction),"shapePresets"in e&&o(19,dt=e.shapePresets),"utilKey"in e&&o(20,ut=e.utilKey),"mapScreenPointToImagePoint"in e&&o(21,pt=e.mapScreenPointToImagePoint),"mapImagePointToScreenPoint"in e&&o(22,ht=e.mapImagePointToScreenPoint),"imageRotation"in e&&o(23,ft=e.imageRotation),"imageFlipX"in e&&o(24,yt=e.imageFlipX),"imageFlipY"in e&&o(25,bt=e.imageFlipY),"parentRect"in e&&Ce(o(26,xt=e.parentRect)),"hooks"in e&&o(112,vt=e.hooks)},e.$$.update=()=>{var t,ie,ne,re;if(33554432&e.$$.dirty[4]&&o(124,i=de.includes(18)),1049088&e.$$.dirty[3]&&(Pt&&We===Pt||o(113,Pt=We)),16&e.$$.dirty[1]&&Zt.set(X),16&e.$$.dirty[1]&&Xt.set(X),16&e.$$.dirty[1]&&Yt.set(X),256&e.$$.dirty[3]&&o(33,n=Array.isArray(Oe)&&Oe.length>1&&Array.isArray(Oe[0][1])),4&e.$$.dirty[1]|256&e.$$.dirty[3]&&o(54,r=n?Oe.map((e,t)=>[t,e[0]]):[]),134217728&e.$$.dirty[0]|4&e.$$.dirty[1]|256&e.$$.dirty[3]&&o(140,a=n?Oe[Kt][1]:Oe),524288&e.$$.dirty[0]|155648&e.$$.dirty[3]|65536&e.$$.dirty[4]&&o(32,s=((e,{willRenderPresetToolbar:t,shapePresets:o,enableViewTool:i,enableMoveTool:r})=>{let a=0!==o.length||t?e:e.filter(e=>"preset"!==e[0]);return n&&(a=[["move",e=>e.shapeLabelToolMove,{icon:e=>e.shapeIconToolMove}],["view",e=>e.shapeLabelToolView,{icon:e=>e.shapeIconToolView}],...a]),a=r?a:a.filter(e=>"move"!==e[0]),i?a:a.filter(e=>"view"!==e[0])})(a,{willRenderPresetToolbar:st,shapePresets:dt,enableMoveTool:Je,enableViewTool:Qe})),2&e.$$.dirty[1]&&o(138,d=!!s.length),1&e.$$.dirty[0]|2&e.$$.dirty[1]|16384&e.$$.dirty[4]&&d&&void 0===_e&&o(0,_e=s[0][0]),134217729&e.$$.dirty[0]|4&e.$$.dirty[1]|2097152&e.$$.dirty[3]|65536&e.$$.dirty[4]&&n&&o(114,Jt={...Jt,[Kt]:a.map(([e])=>e).includes(_e)?_e:Jt[Kt]||a[0][0]}),512&e.$$.dirty[0]&&o(137,l=!!Object.keys(Ue).length),2&e.$$.dirty[1]&&o(34,c=s.length>1),12&e.$$.dirty[1]&&o(53,u=c||n),1&e.$$.dirty[0]&&o(139,p=void 0!==_e),57344&e.$$.dirty[4]&&o(52,h=(!p||d)&&l),536870912&e.$$.dirty[0]&&o(31,_=xo&&(t=xo,(e,o)=>{t.dispatchEvent(dm(e,o))})),1&e.$$.dirty[0]|17&e.$$.dirty[1]&&X&&_&&_("selectcontrol",_e),16&e.$$.dirty[1]&&(X?Er(_t,ge[ut]={maskMarkupOpacity:.85},ge):delete ge[ut]),1&e.$$.dirty[0]|1048576&e.$$.dirty[3]&&o(136,m=_e&&Pt[_e]?Pt[_e][1]:void 0),4096&e.$$.dirty[4]&&o(125,g=m&&m.isSelection?"selection":"shapes"),3&e.$$.dirty[4]&&(e=>{if(!to)return;const t=to.getShapeDraft(St);t&&(e&&(io=t.drawMode),to.updateShapeDraft({drawMode:e?"subtract":io},St))})("selection"===g&&i),268435457&e.$$.dirty[0]&&_e&&to){const e=to.getMarkupItemDraft();e&&ro(e)}if(1&e.$$.dirty[0]&&_e&&to&&"move"!==_e&&to.blurShapes(),16&e.$$.dirty[1]|134217728&e.$$.dirty[4]&&o(51,$=me&&X),256&e.$$.dirty[1]|8388608&e.$$.dirty[4]&&o(50,f=he&&be(te.x-he.x,te.y-he.y)),512&e.$$.dirty[0]&&o(135,b=Object.keys(Ue)),16384&e.$$.dirty[0]|16&e.$$.dirty[1]|2097152&e.$$.dirty[4]&&o(122,x=tt?X&&J.filter(Ui):[]),536870912&e.$$.dirty[3]&&o(123,v=x.length>1),16&e.$$.dirty[1]|2097152&e.$$.dirty[4]&&o(119,S=X&&J.filter(Ui)[0]),16&e.$$.dirty[1]|2097152&e.$$.dirty[4]&&o(130,w=X&&J.find(e=>Gi(e))),16&e.$$.dirty[1]|2097152&e.$$.dirty[4]&&o(133,k=X&&J.find(e=>Zi(e))),1&e.$$.dirty[0]|16&e.$$.dirty[1]|1048576&e.$$.dirty[3]&&o(127,C=X&&Pt[_e]?ao(Pt[_e][0]):{}),1048576&e.$$.dirty[3]&&Pt&&o(115,oo={}),1&e.$$.dirty[0]|4227072&e.$$.dirty[3]|2056&e.$$.dirty[4]&&o(126,T=C&&Object.keys(C).reduce((e,t)=>{const o="disableStyle"===t,i="settings"===t,n=!!b.find(e=>e.split("_").includes(t));if(!o&&!i&&!n)return e;if(void 0===C[t])return e;if(!0===C.disableStyle)return e;if(C.disableStyle&&C.disableStyle.includes(t))return e;if("strokeWidth"===t&&Object.keys(oo).includes("strokeWidth")&&void 0===oo[t]&&jo(C,"points"))return e[t]=C[t],e;const{share:r=!0}=C.settings&&C.settings[t]||{},a=et&&r?oo:oo[_e]||{};return e[t]=jo(a,t)?a[t]:C[t],e},{})),1048577&e.$$.dirty[0]|1024&e.$$.dirty[3]|4&e.$$.dirty[4]&&(Ne?((e,t,o)=>{const i=pe[e],n=i?i[t]:{};Ct.set({...pe,[e]:{...i,[t]:{...n,...o}}})})(ut,_e,T):(ie=ut,Ct.set({[ie]:{}}))),16&e.$$.dirty[1]|67108864&e.$$.dirty[3]|67108868&e.$$.dirty[4]&&o(134,M=ue&&X?S||T:void 0),1610612736&e.$$.dirty[3]|1536&e.$$.dirty[4]&&o(49,P=v?function(e){const t={};return e.forEach(e=>{Object.entries(e).filter(([e])=>!e.startsWith("_")).forEach(([e,o])=>{jo(t,e)?"disableStyle"===e&&Uo(o)&&t[e].push(...o):t[e]=o})}),t}(x):M||k),1&e.$$.dirty[0]|8&e.$$.dirty[4]&&o(48,R=jo(C,"eraseRadius")||jo(C,"points")&&!jo(C,"pathClose")||"move"===_e||"view"===_e),64&e.$$.dirty[1]|8&e.$$.dirty[4]&&o(47,I=C&&void 0!==C.eraseRadius?uo(C.eraseRadius,ae):void 0),16&e.$$.dirty[1]|33554432&e.$$.dirty[4]&&o(131,E=X&&de.includes(32)),1&e.$$.dirty[0]|16&e.$$.dirty[1]&&o(132,A=X&&"view"===_e),384&e.$$.dirty[4]&&o(129,L=A||E),96&e.$$.dirty[4]&&o(128,F=!!L&&(!!w||eu(document.activeElement))),16&e.$$.dirty[1]|48&e.$$.dirty[4]&&Lt.set(!X||L&&!F),16&e.$$.dirty[1]|16&e.$$.dirty[4]&&zt.set(!X||!F),64&e.$$.dirty[1]|12&e.$$.dirty[4]&&o(120,z=C.cursorStyle?(({cursorStyle:e,cursorSize:t},o,i)=>{let n;const r=o[t];if(void 0===r?n=uo(t,i):No(r)?n=r:y(r)&&(n=Rn(t,o[t],i),"strokeWidth"===t&&(n*=.5)),!(n<=0||void 0===n))return{size:n,style:e}})(C,{...C,...T},ae):void 0),33554432&e.$$.dirty[3]|16777216&e.$$.dirty[4]&&o(121,D=mo&&(re=ce,(ne=mo).x>=0&&ne.y>=0&&ne.x<=re.width&&ne.y<=re.height)),1048576&e.$$.dirty[0]|160&e.$$.dirty[1]|427819008&e.$$.dirty[3]|3&e.$$.dirty[4])if(D&&!po&&z&&!le){const e=z.size*oe.scale,t={id:`cursor-${ut}`,x:ho.x,y:ho.y,strokeWidth:.5,strokeColor:[0,0,0]};"ellipse"===z.style&&(t.rx=e,t.ry=e);const o={strokeWidth:2.5,strokeColor:[1,1,1],opacity:.75},n=[{...t,...o},t];if("selection"===g&&i){const t=e,i=ho.x+t,r=ho.y+t+4,a={id:`cursor-${ut}`,strokeWidth:.75,strokeColor:[0,0,0],points:[{x:i,y:r},{x:i+4,y:r}]};n.push({...a,...o,strokeWidth:2,points:[{x:i-.5,y:r},{x:i+4.5,y:r}]},a)}(e=>{Wt.update(t=>[...t.filter(e=>e.id!==`cursor-${ut}`),...e])})(n)}else Wt.update(e=>e.filter(e=>e.id!==`cursor-${ut}`));1&e.$$.dirty[0]|128&e.$$.dirty[1]|478150656&e.$$.dirty[3]&&o(46,O=D?((e,t,o,i,n,r)=>{if(i)return n?"grabbing":"grab";if(e&&!t)return"none";if(!t)return"move"===r?"default":"crosshair";let a=t||o;return Ui(a)?Gi(a)?"modal"===je?"default":"text":!pn(a)||v&&!x.every(pn)?"default":"move":"default"})(z,po,S,le,false,_e):"default"),526337&e.$$.dirty[0]|131072&e.$$.dirty[3]&&o(45,B="preset"===_e&&(dt.length>0||Ze||st)),64&e.$$.dirty[1]&&(W=!jo(ae,"x")&&!jo(ae,"y")),4194304&e.$$.dirty[4]&&o(44,V=Q*Bt),131072&e.$$.dirty[3]|1572864&e.$$.dirty[4]&&o(43,N=K&&st?e=>wm(()=>st(e,$o,{...q},()=>vo.set({}))):ee),524288&e.$$.dirty[3]&&o(42,H=Object.keys(vt).reduce((e,t)=>("beforeAddShape"===t||void 0===vt[t]||(e[t]=vt[t]),e),{})),16&e.$$.dirty[1]&&(e=>{J&&ze.update(t=>t.map(t=>(t._prerender=!!e&&Gi(t),t)))})(X),65536&e.$$.dirty[3]|1572864&e.$$.dirty[4]&&o(30,j=K&&at([],q,()=>vo.set({}))),1073742336&e.$$.dirty[0]&&o(41,U=!!j.length||!!Object.keys(Ue).some(e=>So.includes(e))),16&e.$$.dirty[1]|262144&e.$$.dirty[4]&&Y&&wo.set(X?0:20),e.$$.dirty[4],131072&e.$$.dirty[4]&&o(40,G=Z?`translateY(${Z}px)`:"none")},qt.set(!1),[_e,Ie,Ee,Ae,Fe,ze,Ve,He,je,Ue,Ge,Ze,Xe,Ke,tt,ot,it,nt,lt,dt,ut,pt,ht,ft,yt,bt,xt,Kt,to,xo,j,_,s,n,c,X,oe,ae,le,he,G,U,H,N,V,B,O,I,R,P,f,$,h,u,r,$e,fe,ye,St,wt,kt,Ct,Mt,Rt,Et,At,Ft,Dt,Ot,Wt,_t,Vt,Nt,Ht,jt,Ut,Gt,({index:e},t)=>{o(27,Kt=e),o(0,_e=Jt[e])},({value:e},t)=>{o(0,_e=e),(Ye||/enter/i.test(t.key))&&Qt(e)},e=>{if("eraser"===_e)no=to.eraseShape();else if(_e&&Pt[_e]){const[e,t={}]=Pt[_e],o=Ri(e);yn(o),bn(o);const{drawMode:n}=M;"selection"===g&&"new"===n&&St.set([]);let r={};"selection"===g&&(_("selectiondown",[...ue]),i&&(io=o.drawMode,r.drawMode="subtract")),no=to.createShape({...o,...T,...r},t)}else no=void 0;return!!no&&(no.start(e),!0)},e=>!!no&&(no.update(e),!0),e=>!!no&&(no.release(e),!0),e=>!!no&&(no.cancel(e),no=void 0,!0),e=>{if(!no)return!1;if(no.end(e),no=void 0,"selection"===g){if(e.detail.isTap){const[e,t]=Pt[_e];e.bitmap||"step"===t.inputMode||St.set([])}_("selectionup",[...ue])}const t=to.getMarkupItemDraft(),i=Je&&(!0===qe||Array.isArray(qe)&&qe.includes(_e));return t&&!t.isEditing||!i||o(0,_e="move"),!0},e=>{const{key:t}=e,o=to.getMarkupItemDraft(),i=to.getSelectionItemDraft(),n=o||i;var r;/escape/i.test(t)&&n&&(e.preventDefault(),e.stopPropagation(),o?to.discardMarkupItemDraft():to.discardSelectionItemDraft(),no=void 0),/enter/i.test(t)&&n&&(e.preventDefault(),e.stopPropagation(),o?ro(o):((r=i).pointerPoint&&r.points.push(r.pointerPoint),to.confirmShapeDraft(St),_("selectionup",[...ue]),St.set([])),no=void 0)},function(e){Object.keys(e).forEach(t=>{const{retain:i=!0,share:n=!0}=C.settings&&C.settings[t]||{};i&&(et&&n?o(115,oo[t]=e[t],oo):(oo[_e]||o(115,oo[_e]={},oo),o(115,oo[_e][t]=e[t],oo)))}),_("selectstyle",e),S&&(v?x.forEach(t=>{to.updateMarkupShape(t,co(e,t))}):to.updateMarkupShape(S,e),clearTimeout(lo),lo=setTimeout(()=>{bo()},200))},(e,t,i)=>{o(117,ho=t),o(118,mo=i)},()=>{o(118,mo=void 0),o(117,ho=void 0)},e=>{_("markuptap",e)},e=>o(116,po=e),()=>{yo=!1},(e,t)=>{if(yo)return;const{beforeAddShape:o=()=>!0}=vt,i=eo(t),n=to.getMarkupItemDraft(),r=Tt(se,{x:i.x+(ae.x||0),y:i.y+(ae.y||0)});if(n&&!r&&to.discardMarkupItemDraft(),r){if(!n){const n=Li(e,se),r=go(n,i);return o(r)?(Ji(r),void to.addShape(r)):(yo=!0,void t.preventDefault())}Wi(n)&&(i.x-=.5*n.width,i.y-=.5*n.height),e.shape&&(jo(e.shape,"x")&&(i.x=e.shape.x),jo(e.shape,"y")&&(i.y=e.shape.y)),to.updateMarkupShape(n,i)}},(e,t)=>{if(yo)return;const o=eo(t);if(!Tt(se,{x:o.x+(ae.x||0),y:o.y+(ae.y||0)}))return void to.discardMarkupItemDraft();const i=to.confirmMarkupItemDraft();to.selectShape(i),_("addshape",i),It.write()},e=>$o(e),e=>{return t=e.detail.resources,o=eo(e.detail.event),t.filter(e=>so(e)).forEach(e=>$o(e,o));var t,o},e=>{if(!ct)return!0;const t=rt(re);return $t(t,1/ne),gt(t,ie),$t(t,oe.scale),ct(e,{...t,x:t.x+te.x,y:t.y+te.y})},bo,vo,So,wo,Le,Oe,We,Ne,Ye,qe,Je,Qe,et,at,st,ct,vt,Pt,Jt,oo,po,ho,mo,S,z,D,x,v,i,g,T,C,F,L,w,E,A,k,M,b,m,l,d,p,a,Z,Y,q,K,J,Q,te,ce,de,ue,me,function(t){wa.call(this,e,t)},e=>e[0]===_e,(e,t,o)=>{const i=e.filter(([,e])=>!So.includes(e));return lt?lt(i,t,o):i},e=>e[0]===Kt,e=>{Promise.resolve().then(()=>{_("addshape",e),bo()})},e=>{_("selectshape",e)},e=>{Promise.resolve().then(()=>{_("blurshape",e)})},e=>{_("tapshape",e)},e=>{_("updateshape",e),bo()},e=>{_("removeshape",e),bo()},()=>{bo()},function(e){Ca[e?"unshift":"push"](()=>{to=e,o(28,to)})},function(e){Ca[e?"unshift":"push"](()=>{xo=e,o(29,xo)})},e=>e.filter(([,e])=>So.includes(e)),function(t){wa.call(this,e,t)}]}class Ox extends rs{constructor(e){super(),ns(this,e,Dx,zx,yr,{isActive:1,isActiveFraction:2,isVisible:3,stores:100,locale:4,shapes:5,toolbar:101,toolShapes:102,toolActive:0,toolSelectRadius:6,toolRetainStyles:103,toolbarLayout:7,textInputMode:8,shapeControls:9,enableButtonFlipVertical:10,enablePresetSelectImage:11,enablePresetDropImage:12,enableSelectToolToAddShape:104,enableAutoSelectMoveTool:105,enableTapToAddText:13,enableMoveTool:106,enableViewTool:107,enableToolShareStyles:108,enableMultiSelect:14,gridSize:15,snapThreshold:16,enableSnapToContext:17,willRenderHeaderTools:109,willRenderPresetToolbar:110,willRenderShapeStyleControls:18,willStartInteraction:111,shapePresets:19,utilKey:20,mapScreenPointToImagePoint:21,mapImagePointToScreenPoint:22,imageRotation:23,imageFlipX:24,imageFlipY:25,parentRect:26,hooks:112},null,[-1,-1,-1,-1,-1,-1,-1])}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[100]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),Oa()}get shapes(){return this.$$.ctx[5]}set shapes(e){this.$$set({shapes:e}),Oa()}get toolbar(){return this.$$.ctx[101]}set toolbar(e){this.$$set({toolbar:e}),Oa()}get toolShapes(){return this.$$.ctx[102]}set toolShapes(e){this.$$set({toolShapes:e}),Oa()}get toolActive(){return this.$$.ctx[0]}set toolActive(e){this.$$set({toolActive:e}),Oa()}get toolSelectRadius(){return this.$$.ctx[6]}set toolSelectRadius(e){this.$$set({toolSelectRadius:e}),Oa()}get toolRetainStyles(){return this.$$.ctx[103]}set toolRetainStyles(e){this.$$set({toolRetainStyles:e}),Oa()}get toolbarLayout(){return this.$$.ctx[7]}set toolbarLayout(e){this.$$set({toolbarLayout:e}),Oa()}get textInputMode(){return this.$$.ctx[8]}set textInputMode(e){this.$$set({textInputMode:e}),Oa()}get shapeControls(){return this.$$.ctx[9]}set shapeControls(e){this.$$set({shapeControls:e}),Oa()}get enableButtonFlipVertical(){return this.$$.ctx[10]}set enableButtonFlipVertical(e){this.$$set({enableButtonFlipVertical:e}),Oa()}get enablePresetSelectImage(){return this.$$.ctx[11]}set enablePresetSelectImage(e){this.$$set({enablePresetSelectImage:e}),Oa()}get enablePresetDropImage(){return this.$$.ctx[12]}set enablePresetDropImage(e){this.$$set({enablePresetDropImage:e}),Oa()}get enableSelectToolToAddShape(){return this.$$.ctx[104]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),Oa()}get enableAutoSelectMoveTool(){return this.$$.ctx[105]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),Oa()}get enableTapToAddText(){return this.$$.ctx[13]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),Oa()}get enableMoveTool(){return this.$$.ctx[106]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),Oa()}get enableViewTool(){return this.$$.ctx[107]}set enableViewTool(e){this.$$set({enableViewTool:e}),Oa()}get enableToolShareStyles(){return this.$$.ctx[108]}set enableToolShareStyles(e){this.$$set({enableToolShareStyles:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[14]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}get gridSize(){return this.$$.ctx[15]}set gridSize(e){this.$$set({gridSize:e}),Oa()}get snapThreshold(){return this.$$.ctx[16]}set snapThreshold(e){this.$$set({snapThreshold:e}),Oa()}get enableSnapToContext(){return this.$$.ctx[17]}set enableSnapToContext(e){this.$$set({enableSnapToContext:e}),Oa()}get willRenderHeaderTools(){return this.$$.ctx[109]}set willRenderHeaderTools(e){this.$$set({willRenderHeaderTools:e}),Oa()}get willRenderPresetToolbar(){return this.$$.ctx[110]}set willRenderPresetToolbar(e){this.$$set({willRenderPresetToolbar:e}),Oa()}get willRenderShapeStyleControls(){return this.$$.ctx[18]}set willRenderShapeStyleControls(e){this.$$set({willRenderShapeStyleControls:e}),Oa()}get willStartInteraction(){return this.$$.ctx[111]}set willStartInteraction(e){this.$$set({willStartInteraction:e}),Oa()}get shapePresets(){return this.$$.ctx[19]}set shapePresets(e){this.$$set({shapePresets:e}),Oa()}get utilKey(){return this.$$.ctx[20]}set utilKey(e){this.$$set({utilKey:e}),Oa()}get mapScreenPointToImagePoint(){return this.$$.ctx[21]}set mapScreenPointToImagePoint(e){this.$$set({mapScreenPointToImagePoint:e}),Oa()}get mapImagePointToScreenPoint(){return this.$$.ctx[22]}set mapImagePointToScreenPoint(e){this.$$set({mapImagePointToScreenPoint:e}),Oa()}get imageRotation(){return this.$$.ctx[23]}set imageRotation(e){this.$$set({imageRotation:e}),Oa()}get imageFlipX(){return this.$$.ctx[24]}set imageFlipX(e){this.$$set({imageFlipX:e}),Oa()}get imageFlipY(){return this.$$.ctx[25]}set imageFlipY(e){this.$$set({imageFlipY:e}),Oa()}get parentRect(){return this.$$.ctx[26]}set parentRect(e){this.$$set({parentRect:e}),Oa()}get hooks(){return this.$$.ctx[112]}set hooks(e){this.$$set({hooks:e}),Oa()}}var Bx=(e,t,o,i,n,r,a,s,l)=>{const c=ve(e),d=.5*o.width,u=.5*o.height,p=.5*t.width,h=.5*t.height,m=n.x+i.x,g=n.y+i.y;s&&(c.x=o.width-c.x),l&&(c.y=o.height-c.y);const $=Math.cos(r),f=Math.sin(r);c.x-=d,c.y-=u;const y=c.x*$-c.y*f,b=c.x*f+c.y*$;c.x=d+y,c.y=u+b,c.x*=a,c.y*=a,c.x+=p,c.y+=h,c.x+=m,c.y+=g,c.x-=d*a,c.y-=u*a;const x=(n.x-m)*a,v=(n.y-g)*a,S=x*$-v*f,w=x*f+v*$;return c.x+=S,c.y+=w,c},Wx=(e,t,o,i,n,r,a,s,l)=>{const c=ve(e),d=qe(o),u=qe(t),p=be(n.x+i.x,n.y+i.y),h=Math.cos(r),m=Math.sin(r);c.x-=u.x,c.y-=u.y;const g=(n.x-p.x)*a,$=(n.y-p.y)*a,f=g*h-$*m,y=g*m+$*h;c.x-=f,c.y-=y,c.x-=p.x,c.y-=p.y,c.x/=a,c.y/=a;const b=c.x*h+c.y*m,x=c.x*m-c.y*h;return c.x=b,c.y=-x,c.x+=d.x,c.y+=d.y,s&&(c.x=o.width-c.x),l&&(c.y=o.height-c.y),c},_x=e=>"boolean"==typeof e;function Vx(e){let t,o,i;function n(t){e[61](t)}let r={utilKey:e[1],stores:e[5],locale:e[6],isActive:e[2],isActiveFraction:e[3],isVisible:e[4],mapScreenPointToImagePoint:e[46],mapImagePointToScreenPoint:e[45],imageRotation:e[47],imageFlipX:e[44],imageFlipY:e[43],shapes:e[49],toolbar:e[21]||e[7],toolShapes:e[22]||e[8],toolRetainStyles:e[9],enableSelectToolToAddShape:e[31],enableTapToAddText:e[32],enableViewTool:e[30],enableMoveTool:e[34],enableAutoSelectMoveTool:e[33],enableMultiSelect:e[35],snapThreshold:e[16],gridSize:No(e[18])?e[18]:e[15],enableSnapToContext:_x(e[19])?e[19]:e[17],enableToolShareStyles:e[13],shapeControls:e[23]||e[10],shapePresets:e[27],enableButtonFlipVertical:e[24],parentRect:e[50],enablePresetDropImage:e[26],enablePresetSelectImage:e[25],toolSelectRadius:e[11],textInputMode:e[12],willStartInteraction:e[14],willRenderPresetToolbar:e[28]||e[20],willRenderShapeStyleControls:e[29],hooks:{willRenderShapeControls:e[36],willRenderShapeTextControls:e[37],beforeAddShape:e[38],beforeRemoveShape:e[39],beforeDeselectShape:e[40],beforeSelectShape:e[41],beforeUpdateShape:e[42]}};return void 0!==e[0]&&(r.toolActive=e[0]),t=new Ox({props:r}),Ca.push(()=>es(t,"toolActive",n)),t.$on("measure",e[62]),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};32&i[0]&&(n.stores=e[5]),64&i[0]&&(n.locale=e[6]),4&i[0]&&(n.isActive=e[2]),8&i[0]&&(n.isActiveFraction=e[3]),16&i[0]&&(n.isVisible=e[4]),32768&i[1]&&(n.mapScreenPointToImagePoint=e[46]),16384&i[1]&&(n.mapImagePointToScreenPoint=e[45]),65536&i[1]&&(n.imageRotation=e[47]),8192&i[1]&&(n.imageFlipX=e[44]),4096&i[1]&&(n.imageFlipY=e[43]),2097280&i[0]&&(n.toolbar=e[21]||e[7]),4194560&i[0]&&(n.toolShapes=e[22]||e[8]),512&i[0]&&(n.toolRetainStyles=e[9]),1&i[1]&&(n.enableSelectToolToAddShape=e[31]),2&i[1]&&(n.enableTapToAddText=e[32]),1073741824&i[0]&&(n.enableViewTool=e[30]),8&i[1]&&(n.enableMoveTool=e[34]),4&i[1]&&(n.enableAutoSelectMoveTool=e[33]),16&i[1]&&(n.enableMultiSelect=e[35]),65536&i[0]&&(n.snapThreshold=e[16]),294912&i[0]&&(n.gridSize=No(e[18])?e[18]:e[15]),655360&i[0]&&(n.enableSnapToContext=_x(e[19])?e[19]:e[17]),8192&i[0]&&(n.enableToolShareStyles=e[13]),8389632&i[0]&&(n.shapeControls=e[23]||e[10]),134217728&i[0]&&(n.shapePresets=e[27]),16777216&i[0]&&(n.enableButtonFlipVertical=e[24]),67108864&i[0]&&(n.enablePresetDropImage=e[26]),33554432&i[0]&&(n.enablePresetSelectImage=e[25]),2048&i[0]&&(n.toolSelectRadius=e[11]),4096&i[0]&&(n.textInputMode=e[12]),16384&i[0]&&(n.willStartInteraction=e[14]),269484032&i[0]&&(n.willRenderPresetToolbar=e[28]||e[20]),536870912&i[0]&&(n.willRenderShapeStyleControls=e[29]),4064&i[1]&&(n.hooks={willRenderShapeControls:e[36],willRenderShapeTextControls:e[37],beforeAddShape:e[38],beforeRemoveShape:e[39],beforeDeselectShape:e[40],beforeSelectShape:e[41],beforeUpdateShape:e[42]}),!o&&1&i[0]&&(o=!0,n.toolActive=e[0],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function Nx(e,t,o){let i,n,r,a,s,l,c,d,u,p;let{isActive:h}=t,{isActiveFraction:m}=t,{isVisible:g}=t,{stores:$}=t,{locale:f={}}=t,{markupEditorToolbar:y}=t,{markupEditorToolStyles:b}=t,{markupEditorToolRetainStyles:x}=t,{markupEditorShapeStyleControls:v}=t,{markupEditorToolSelectRadius:S}=t,{markupEditorTextInputMode:w}=t,{markupEditorToolShareStyles:k}=t,{markupEditorWillStartInteraction:C}=t,{markupEditorGridSize:T=0}=t,{markupEditorSnapThreshold:M=0}=t,{markupEditorSnapToContext:P=!1}=t,{annotateGridSize:R}=t,{annotateSnapToContext:I}=t,{willRenderShapePresetToolbar:E}=t,{annotateTools:A}=t,{annotateToolShapes:L}=t,{annotateShapeControls:F}=t,{annotateActiveTool:z}=t,{annotateEnableButtonFlipVertical:D=!1}=t,{annotateEnableSelectImagePreset:O=!1}=t,{annotateEnableDropImagePreset:B=!0}=t,{annotatePresets:W=[]}=t,{annotateWillRenderShapePresetToolbar:_}=t,{annotateWillRenderShapeStyleControls:V}=t,{enableViewTool:N}=t,{enableSelectToolToAddShape:H}=t,{enableTapToAddText:j}=t,{enableAutoSelectMoveTool:U}=t,{enableMoveTool:G}=t,{enableMultiSelect:Z}=t,{willRenderShapeControls:X}=t,{willRenderShapeTextControls:Y}=t,{beforeAddShape:q}=t,{beforeRemoveShape:K}=t,{beforeDeselectShape:J}=t,{beforeSelectShape:Q}=t,{beforeUpdateShape:ee}=t;const{rootRect:te,imageAnnotation:oe,imageSize:ie,imageRotation:ne,imageFlipX:re,imageFlipY:ae,imageTransforms:se,imageTransformsInterpolated:le}=$;return wr(e,te,e=>o(59,d=e)),wr(e,ie,e=>o(58,c=e)),wr(e,ne,e=>o(47,p=e)),wr(e,re,e=>o(44,s=e)),wr(e,ae,e=>o(43,a=e)),wr(e,se,e=>o(60,u=e)),wr(e,le,e=>o(57,l=e)),e.$$set=e=>{"isActive"in e&&o(2,h=e.isActive),"isActiveFraction"in e&&o(3,m=e.isActiveFraction),"isVisible"in e&&o(4,g=e.isVisible),"stores"in e&&o(5,$=e.stores),"locale"in e&&o(6,f=e.locale),"markupEditorToolbar"in e&&o(7,y=e.markupEditorToolbar),"markupEditorToolStyles"in e&&o(8,b=e.markupEditorToolStyles),"markupEditorToolRetainStyles"in e&&o(9,x=e.markupEditorToolRetainStyles),"markupEditorShapeStyleControls"in e&&o(10,v=e.markupEditorShapeStyleControls),"markupEditorToolSelectRadius"in e&&o(11,S=e.markupEditorToolSelectRadius),"markupEditorTextInputMode"in e&&o(12,w=e.markupEditorTextInputMode),"markupEditorToolShareStyles"in e&&o(13,k=e.markupEditorToolShareStyles),"markupEditorWillStartInteraction"in e&&o(14,C=e.markupEditorWillStartInteraction),"markupEditorGridSize"in e&&o(15,T=e.markupEditorGridSize),"markupEditorSnapThreshold"in e&&o(16,M=e.markupEditorSnapThreshold),"markupEditorSnapToContext"in e&&o(17,P=e.markupEditorSnapToContext),"annotateGridSize"in e&&o(18,R=e.annotateGridSize),"annotateSnapToContext"in e&&o(19,I=e.annotateSnapToContext),"willRenderShapePresetToolbar"in e&&o(20,E=e.willRenderShapePresetToolbar),"annotateTools"in e&&o(21,A=e.annotateTools),"annotateToolShapes"in e&&o(22,L=e.annotateToolShapes),"annotateShapeControls"in e&&o(23,F=e.annotateShapeControls),"annotateActiveTool"in e&&o(0,z=e.annotateActiveTool),"annotateEnableButtonFlipVertical"in e&&o(24,D=e.annotateEnableButtonFlipVertical),"annotateEnableSelectImagePreset"in e&&o(25,O=e.annotateEnableSelectImagePreset),"annotateEnableDropImagePreset"in e&&o(26,B=e.annotateEnableDropImagePreset),"annotatePresets"in e&&o(27,W=e.annotatePresets),"annotateWillRenderShapePresetToolbar"in e&&o(28,_=e.annotateWillRenderShapePresetToolbar),"annotateWillRenderShapeStyleControls"in e&&o(29,V=e.annotateWillRenderShapeStyleControls),"enableViewTool"in e&&o(30,N=e.enableViewTool),"enableSelectToolToAddShape"in e&&o(31,H=e.enableSelectToolToAddShape),"enableTapToAddText"in e&&o(32,j=e.enableTapToAddText),"enableAutoSelectMoveTool"in e&&o(33,U=e.enableAutoSelectMoveTool),"enableMoveTool"in e&&o(34,G=e.enableMoveTool),"enableMultiSelect"in e&&o(35,Z=e.enableMultiSelect),"willRenderShapeControls"in e&&o(36,X=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(37,Y=e.willRenderShapeTextControls),"beforeAddShape"in e&&o(38,q=e.beforeAddShape),"beforeRemoveShape"in e&&o(39,K=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(40,J=e.beforeDeselectShape),"beforeSelectShape"in e&&o(41,Q=e.beforeSelectShape),"beforeUpdateShape"in e&&o(42,ee=e.beforeUpdateShape)},e.$$.update=()=>{536870912&e.$$.dirty[1]&&o(56,i=u?u.rotation.z:0),503328768&e.$$.dirty[1]&&o(46,n=e=>Wx(e,d,c,l.origin,l.translation,i,l.scale,s,a)),503328768&e.$$.dirty[1]&&o(45,r=e=>Bx(e,d,c,l.origin,l.translation,i,l.scale,s,a))},[z,"annotate",h,m,g,$,f,y,b,x,v,S,w,k,C,T,M,P,R,I,E,A,L,F,D,O,B,W,_,V,N,H,j,U,G,Z,X,Y,q,K,J,Q,ee,a,s,r,n,p,te,oe,ie,ne,re,ae,se,le,i,l,c,d,u,function(e){z=e,o(0,z)},function(t){wa.call(this,e,t)}]}var Hx={util:["annotate",class extends rs{constructor(e){super(),ns(this,e,Nx,Vx,yr,{name:1,isActive:2,isActiveFraction:3,isVisible:4,stores:5,locale:6,markupEditorToolbar:7,markupEditorToolStyles:8,markupEditorToolRetainStyles:9,markupEditorShapeStyleControls:10,markupEditorToolSelectRadius:11,markupEditorTextInputMode:12,markupEditorToolShareStyles:13,markupEditorWillStartInteraction:14,markupEditorGridSize:15,markupEditorSnapThreshold:16,markupEditorSnapToContext:17,annotateGridSize:18,annotateSnapToContext:19,willRenderShapePresetToolbar:20,annotateTools:21,annotateToolShapes:22,annotateShapeControls:23,annotateActiveTool:0,annotateEnableButtonFlipVertical:24,annotateEnableSelectImagePreset:25,annotateEnableDropImagePreset:26,annotatePresets:27,annotateWillRenderShapePresetToolbar:28,annotateWillRenderShapeStyleControls:29,enableViewTool:30,enableSelectToolToAddShape:31,enableTapToAddText:32,enableAutoSelectMoveTool:33,enableMoveTool:34,enableMultiSelect:35,willRenderShapeControls:36,willRenderShapeTextControls:37,beforeAddShape:38,beforeRemoveShape:39,beforeDeselectShape:40,beforeSelectShape:41,beforeUpdateShape:42},null,[-1,-1,-1])}get name(){return this.$$.ctx[1]}get isActive(){return this.$$.ctx[2]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[3]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[4]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[5]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[6]}set locale(e){this.$$set({locale:e}),Oa()}get markupEditorToolbar(){return this.$$.ctx[7]}set markupEditorToolbar(e){this.$$set({markupEditorToolbar:e}),Oa()}get markupEditorToolStyles(){return this.$$.ctx[8]}set markupEditorToolStyles(e){this.$$set({markupEditorToolStyles:e}),Oa()}get markupEditorToolRetainStyles(){return this.$$.ctx[9]}set markupEditorToolRetainStyles(e){this.$$set({markupEditorToolRetainStyles:e}),Oa()}get markupEditorShapeStyleControls(){return this.$$.ctx[10]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),Oa()}get markupEditorToolSelectRadius(){return this.$$.ctx[11]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),Oa()}get markupEditorTextInputMode(){return this.$$.ctx[12]}set markupEditorTextInputMode(e){this.$$set({markupEditorTextInputMode:e}),Oa()}get markupEditorToolShareStyles(){return this.$$.ctx[13]}set markupEditorToolShareStyles(e){this.$$set({markupEditorToolShareStyles:e}),Oa()}get markupEditorWillStartInteraction(){return this.$$.ctx[14]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),Oa()}get markupEditorGridSize(){return this.$$.ctx[15]}set markupEditorGridSize(e){this.$$set({markupEditorGridSize:e}),Oa()}get markupEditorSnapThreshold(){return this.$$.ctx[16]}set markupEditorSnapThreshold(e){this.$$set({markupEditorSnapThreshold:e}),Oa()}get markupEditorSnapToContext(){return this.$$.ctx[17]}set markupEditorSnapToContext(e){this.$$set({markupEditorSnapToContext:e}),Oa()}get annotateGridSize(){return this.$$.ctx[18]}set annotateGridSize(e){this.$$set({annotateGridSize:e}),Oa()}get annotateSnapToContext(){return this.$$.ctx[19]}set annotateSnapToContext(e){this.$$set({annotateSnapToContext:e}),Oa()}get willRenderShapePresetToolbar(){return this.$$.ctx[20]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),Oa()}get annotateTools(){return this.$$.ctx[21]}set annotateTools(e){this.$$set({annotateTools:e}),Oa()}get annotateToolShapes(){return this.$$.ctx[22]}set annotateToolShapes(e){this.$$set({annotateToolShapes:e}),Oa()}get annotateShapeControls(){return this.$$.ctx[23]}set annotateShapeControls(e){this.$$set({annotateShapeControls:e}),Oa()}get annotateActiveTool(){return this.$$.ctx[0]}set annotateActiveTool(e){this.$$set({annotateActiveTool:e}),Oa()}get annotateEnableButtonFlipVertical(){return this.$$.ctx[24]}set annotateEnableButtonFlipVertical(e){this.$$set({annotateEnableButtonFlipVertical:e}),Oa()}get annotateEnableSelectImagePreset(){return this.$$.ctx[25]}set annotateEnableSelectImagePreset(e){this.$$set({annotateEnableSelectImagePreset:e}),Oa()}get annotateEnableDropImagePreset(){return this.$$.ctx[26]}set annotateEnableDropImagePreset(e){this.$$set({annotateEnableDropImagePreset:e}),Oa()}get annotatePresets(){return this.$$.ctx[27]}set annotatePresets(e){this.$$set({annotatePresets:e}),Oa()}get annotateWillRenderShapePresetToolbar(){return this.$$.ctx[28]}set annotateWillRenderShapePresetToolbar(e){this.$$set({annotateWillRenderShapePresetToolbar:e}),Oa()}get annotateWillRenderShapeStyleControls(){return this.$$.ctx[29]}set annotateWillRenderShapeStyleControls(e){this.$$set({annotateWillRenderShapeStyleControls:e}),Oa()}get enableViewTool(){return this.$$.ctx[30]}set enableViewTool(e){this.$$set({enableViewTool:e}),Oa()}get enableSelectToolToAddShape(){return this.$$.ctx[31]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),Oa()}get enableTapToAddText(){return this.$$.ctx[32]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),Oa()}get enableAutoSelectMoveTool(){return this.$$.ctx[33]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),Oa()}get enableMoveTool(){return this.$$.ctx[34]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[35]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}get willRenderShapeControls(){return this.$$.ctx[36]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),Oa()}get willRenderShapeTextControls(){return this.$$.ctx[37]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),Oa()}get beforeAddShape(){return this.$$.ctx[38]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),Oa()}get beforeRemoveShape(){return this.$$.ctx[39]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),Oa()}get beforeDeselectShape(){return this.$$.ctx[40]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),Oa()}get beforeSelectShape(){return this.$$.ctx[41]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),Oa()}get beforeUpdateShape(){return this.$$.ctx[42]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),Oa()}}]};function jx(e){let t,o,i;function n(t){e[52](t)}let r={utilKey:e[1],stores:e[5],locale:e[6],isActive:e[2],isActiveFraction:e[3],isVisible:e[4],mapScreenPointToImagePoint:e[44],mapImagePointToScreenPoint:e[43],shapes:e[46],toolbar:e[20]||e[7],toolShapes:e[21]||e[8],toolRetainStyles:e[9],shapeControls:e[22]||e[10],shapePresets:e[26],enableSelectToolToAddShape:e[29],enableTapToAddText:e[30],enableViewTool:e[31],enableMoveTool:e[32],enableAutoSelectMoveTool:e[33],enableMultiSelect:e[34],snapThreshold:e[16],gridSize:No(e[18])?e[18]:e[15],enableSnapToContext:_x(e[19])?e[19]:e[17],enableToolShareStyles:e[13],enablePresetSelectImage:e[24],enablePresetDropImage:e[25],enableButtonFlipVertical:e[23],parentRect:e[45],toolSelectRadius:e[11],textInputMode:e[12],willStartInteraction:e[42],willRenderPresetToolbar:e[27]||e[14],willRenderShapeStyleControls:e[28],hooks:{willRenderShapeControls:e[35],willRenderShapeTextControls:e[36],beforeAddShape:e[37],beforeRemoveShape:e[38],beforeDeselectShape:e[39],beforeSelectShape:e[40],beforeUpdateShape:e[41]}};return void 0!==e[0]&&(r.toolActive=e[0]),t=new Ox({props:r}),Ca.push(()=>es(t,"toolActive",n)),t.$on("measure",e[53]),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};32&i[0]&&(n.stores=e[5]),64&i[0]&&(n.locale=e[6]),4&i[0]&&(n.isActive=e[2]),8&i[0]&&(n.isActiveFraction=e[3]),16&i[0]&&(n.isVisible=e[4]),8192&i[1]&&(n.mapScreenPointToImagePoint=e[44]),4096&i[1]&&(n.mapImagePointToScreenPoint=e[43]),1048704&i[0]&&(n.toolbar=e[20]||e[7]),2097408&i[0]&&(n.toolShapes=e[21]||e[8]),512&i[0]&&(n.toolRetainStyles=e[9]),4195328&i[0]&&(n.shapeControls=e[22]||e[10]),67108864&i[0]&&(n.shapePresets=e[26]),536870912&i[0]&&(n.enableSelectToolToAddShape=e[29]),1073741824&i[0]&&(n.enableTapToAddText=e[30]),1&i[1]&&(n.enableViewTool=e[31]),2&i[1]&&(n.enableMoveTool=e[32]),4&i[1]&&(n.enableAutoSelectMoveTool=e[33]),8&i[1]&&(n.enableMultiSelect=e[34]),65536&i[0]&&(n.snapThreshold=e[16]),294912&i[0]&&(n.gridSize=No(e[18])?e[18]:e[15]),655360&i[0]&&(n.enableSnapToContext=_x(e[19])?e[19]:e[17]),8192&i[0]&&(n.enableToolShareStyles=e[13]),16777216&i[0]&&(n.enablePresetSelectImage=e[24]),33554432&i[0]&&(n.enablePresetDropImage=e[25]),8388608&i[0]&&(n.enableButtonFlipVertical=e[23]),2048&i[0]&&(n.toolSelectRadius=e[11]),4096&i[0]&&(n.textInputMode=e[12]),2048&i[1]&&(n.willStartInteraction=e[42]),134234112&i[0]&&(n.willRenderPresetToolbar=e[27]||e[14]),268435456&i[0]&&(n.willRenderShapeStyleControls=e[28]),2032&i[1]&&(n.hooks={willRenderShapeControls:e[35],willRenderShapeTextControls:e[36],beforeAddShape:e[37],beforeRemoveShape:e[38],beforeDeselectShape:e[39],beforeSelectShape:e[40],beforeUpdateShape:e[41]}),!o&&1&i[0]&&(o=!0,n.toolActive=e[0],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function Ux(e,t,o){let i,n,r,a,s;let{isActive:l}=t,{isActiveFraction:c}=t,{isVisible:d}=t,{stores:u}=t,{locale:p={}}=t,{markupEditorToolbar:h}=t,{markupEditorToolStyles:m}=t,{markupEditorToolRetainStyles:g}=t,{markupEditorShapeStyleControls:$}=t,{markupEditorToolSelectRadius:f}=t,{markupEditorTextInputMode:y}=t,{markupEditorToolShareStyles:b}=t,{willRenderShapePresetToolbar:x}=t,{markupEditorGridSize:v}=t,{markupEditorSnapThreshold:S}=t,{markupEditorSnapToContext:w=!0}=t,{decorateGridSize:k}=t,{decorateSnapToContext:C}=t,{decorateTools:T}=t,{decorateToolShapes:M}=t,{decorateShapeControls:P}=t,{decorateActiveTool:R}=t,{decorateEnableButtonFlipVertical:I=!1}=t,{decorateEnableSelectImagePreset:E=!1}=t,{decorateEnableDropImagePreset:A=!0}=t,{decoratePresets:L=[]}=t,{decorateWillRenderShapePresetToolbar:F}=t,{decorateWillRenderShapeStyleControls:z}=t,{enableSelectToolToAddShape:D}=t,{enableTapToAddText:O}=t,{enableViewTool:B}=t,{enableMoveTool:W}=t,{enableAutoSelectMoveTool:_}=t,{enableMultiSelect:V}=t,{willRenderShapeControls:N}=t,{willRenderShapeTextControls:H}=t,{beforeAddShape:j}=t,{beforeRemoveShape:U}=t,{beforeDeselectShape:G}=t,{beforeSelectShape:Z}=t,{beforeUpdateShape:X}=t,{markupEditorWillStartInteraction:Y}=t;const{imageCropRect:q,imageDecoration:K,imageSelectionRectPresentation:J,imageTransformsInterpolated:Q}=u;return wr(e,J,e=>o(50,a=e)),wr(e,Q,e=>o(51,s=e)),e.$$set=e=>{"isActive"in e&&o(2,l=e.isActive),"isActiveFraction"in e&&o(3,c=e.isActiveFraction),"isVisible"in e&&o(4,d=e.isVisible),"stores"in e&&o(5,u=e.stores),"locale"in e&&o(6,p=e.locale),"markupEditorToolbar"in e&&o(7,h=e.markupEditorToolbar),"markupEditorToolStyles"in e&&o(8,m=e.markupEditorToolStyles),"markupEditorToolRetainStyles"in e&&o(9,g=e.markupEditorToolRetainStyles),"markupEditorShapeStyleControls"in e&&o(10,$=e.markupEditorShapeStyleControls),"markupEditorToolSelectRadius"in e&&o(11,f=e.markupEditorToolSelectRadius),"markupEditorTextInputMode"in e&&o(12,y=e.markupEditorTextInputMode),"markupEditorToolShareStyles"in e&&o(13,b=e.markupEditorToolShareStyles),"willRenderShapePresetToolbar"in e&&o(14,x=e.willRenderShapePresetToolbar),"markupEditorGridSize"in e&&o(15,v=e.markupEditorGridSize),"markupEditorSnapThreshold"in e&&o(16,S=e.markupEditorSnapThreshold),"markupEditorSnapToContext"in e&&o(17,w=e.markupEditorSnapToContext),"decorateGridSize"in e&&o(18,k=e.decorateGridSize),"decorateSnapToContext"in e&&o(19,C=e.decorateSnapToContext),"decorateTools"in e&&o(20,T=e.decorateTools),"decorateToolShapes"in e&&o(21,M=e.decorateToolShapes),"decorateShapeControls"in e&&o(22,P=e.decorateShapeControls),"decorateActiveTool"in e&&o(0,R=e.decorateActiveTool),"decorateEnableButtonFlipVertical"in e&&o(23,I=e.decorateEnableButtonFlipVertical),"decorateEnableSelectImagePreset"in e&&o(24,E=e.decorateEnableSelectImagePreset),"decorateEnableDropImagePreset"in e&&o(25,A=e.decorateEnableDropImagePreset),"decoratePresets"in e&&o(26,L=e.decoratePresets),"decorateWillRenderShapePresetToolbar"in e&&o(27,F=e.decorateWillRenderShapePresetToolbar),"decorateWillRenderShapeStyleControls"in e&&o(28,z=e.decorateWillRenderShapeStyleControls),"enableSelectToolToAddShape"in e&&o(29,D=e.enableSelectToolToAddShape),"enableTapToAddText"in e&&o(30,O=e.enableTapToAddText),"enableViewTool"in e&&o(31,B=e.enableViewTool),"enableMoveTool"in e&&o(32,W=e.enableMoveTool),"enableAutoSelectMoveTool"in e&&o(33,_=e.enableAutoSelectMoveTool),"enableMultiSelect"in e&&o(34,V=e.enableMultiSelect),"willRenderShapeControls"in e&&o(35,N=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(36,H=e.willRenderShapeTextControls),"beforeAddShape"in e&&o(37,j=e.beforeAddShape),"beforeRemoveShape"in e&&o(38,U=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(39,G=e.beforeDeselectShape),"beforeSelectShape"in e&&o(40,Z=e.beforeSelectShape),"beforeUpdateShape"in e&&o(41,X=e.beforeUpdateShape),"markupEditorWillStartInteraction"in e&&o(42,Y=e.markupEditorWillStartInteraction)},e.$$.update=()=>{1048576&e.$$.dirty[1]&&o(49,i=s?s.scale:1),786432&e.$$.dirty[1]&&o(44,n=e=>{const t=ve(e);return t.x-=a.x,t.y-=a.y,t.x/=i,t.y/=i,t}),786432&e.$$.dirty[1]&&o(43,r=e=>{const t=ve(e);return t.x*=i,t.y*=i,t.x+=a.x,t.y+=a.y,t})},[R,"decorate",l,c,d,u,p,h,m,g,$,f,y,b,x,v,S,w,k,C,T,M,P,I,E,A,L,F,z,D,O,B,W,_,V,N,H,j,U,G,Z,X,Y,r,n,q,K,J,Q,i,a,s,function(e){R=e,o(0,R)},function(t){wa.call(this,e,t)}]}var Gx={util:["decorate",class extends rs{constructor(e){super(),ns(this,e,Ux,jx,yr,{name:1,isActive:2,isActiveFraction:3,isVisible:4,stores:5,locale:6,markupEditorToolbar:7,markupEditorToolStyles:8,markupEditorToolRetainStyles:9,markupEditorShapeStyleControls:10,markupEditorToolSelectRadius:11,markupEditorTextInputMode:12,markupEditorToolShareStyles:13,willRenderShapePresetToolbar:14,markupEditorGridSize:15,markupEditorSnapThreshold:16,markupEditorSnapToContext:17,decorateGridSize:18,decorateSnapToContext:19,decorateTools:20,decorateToolShapes:21,decorateShapeControls:22,decorateActiveTool:0,decorateEnableButtonFlipVertical:23,decorateEnableSelectImagePreset:24,decorateEnableDropImagePreset:25,decoratePresets:26,decorateWillRenderShapePresetToolbar:27,decorateWillRenderShapeStyleControls:28,enableSelectToolToAddShape:29,enableTapToAddText:30,enableViewTool:31,enableMoveTool:32,enableAutoSelectMoveTool:33,enableMultiSelect:34,willRenderShapeControls:35,willRenderShapeTextControls:36,beforeAddShape:37,beforeRemoveShape:38,beforeDeselectShape:39,beforeSelectShape:40,beforeUpdateShape:41,markupEditorWillStartInteraction:42},null,[-1,-1])}get name(){return this.$$.ctx[1]}get isActive(){return this.$$.ctx[2]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[3]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[4]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[5]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[6]}set locale(e){this.$$set({locale:e}),Oa()}get markupEditorToolbar(){return this.$$.ctx[7]}set markupEditorToolbar(e){this.$$set({markupEditorToolbar:e}),Oa()}get markupEditorToolStyles(){return this.$$.ctx[8]}set markupEditorToolStyles(e){this.$$set({markupEditorToolStyles:e}),Oa()}get markupEditorToolRetainStyles(){return this.$$.ctx[9]}set markupEditorToolRetainStyles(e){this.$$set({markupEditorToolRetainStyles:e}),Oa()}get markupEditorShapeStyleControls(){return this.$$.ctx[10]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),Oa()}get markupEditorToolSelectRadius(){return this.$$.ctx[11]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),Oa()}get markupEditorTextInputMode(){return this.$$.ctx[12]}set markupEditorTextInputMode(e){this.$$set({markupEditorTextInputMode:e}),Oa()}get markupEditorToolShareStyles(){return this.$$.ctx[13]}set markupEditorToolShareStyles(e){this.$$set({markupEditorToolShareStyles:e}),Oa()}get willRenderShapePresetToolbar(){return this.$$.ctx[14]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),Oa()}get markupEditorGridSize(){return this.$$.ctx[15]}set markupEditorGridSize(e){this.$$set({markupEditorGridSize:e}),Oa()}get markupEditorSnapThreshold(){return this.$$.ctx[16]}set markupEditorSnapThreshold(e){this.$$set({markupEditorSnapThreshold:e}),Oa()}get markupEditorSnapToContext(){return this.$$.ctx[17]}set markupEditorSnapToContext(e){this.$$set({markupEditorSnapToContext:e}),Oa()}get decorateGridSize(){return this.$$.ctx[18]}set decorateGridSize(e){this.$$set({decorateGridSize:e}),Oa()}get decorateSnapToContext(){return this.$$.ctx[19]}set decorateSnapToContext(e){this.$$set({decorateSnapToContext:e}),Oa()}get decorateTools(){return this.$$.ctx[20]}set decorateTools(e){this.$$set({decorateTools:e}),Oa()}get decorateToolShapes(){return this.$$.ctx[21]}set decorateToolShapes(e){this.$$set({decorateToolShapes:e}),Oa()}get decorateShapeControls(){return this.$$.ctx[22]}set decorateShapeControls(e){this.$$set({decorateShapeControls:e}),Oa()}get decorateActiveTool(){return this.$$.ctx[0]}set decorateActiveTool(e){this.$$set({decorateActiveTool:e}),Oa()}get decorateEnableButtonFlipVertical(){return this.$$.ctx[23]}set decorateEnableButtonFlipVertical(e){this.$$set({decorateEnableButtonFlipVertical:e}),Oa()}get decorateEnableSelectImagePreset(){return this.$$.ctx[24]}set decorateEnableSelectImagePreset(e){this.$$set({decorateEnableSelectImagePreset:e}),Oa()}get decorateEnableDropImagePreset(){return this.$$.ctx[25]}set decorateEnableDropImagePreset(e){this.$$set({decorateEnableDropImagePreset:e}),Oa()}get decoratePresets(){return this.$$.ctx[26]}set decoratePresets(e){this.$$set({decoratePresets:e}),Oa()}get decorateWillRenderShapePresetToolbar(){return this.$$.ctx[27]}set decorateWillRenderShapePresetToolbar(e){this.$$set({decorateWillRenderShapePresetToolbar:e}),Oa()}get decorateWillRenderShapeStyleControls(){return this.$$.ctx[28]}set decorateWillRenderShapeStyleControls(e){this.$$set({decorateWillRenderShapeStyleControls:e}),Oa()}get enableSelectToolToAddShape(){return this.$$.ctx[29]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),Oa()}get enableTapToAddText(){return this.$$.ctx[30]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),Oa()}get enableViewTool(){return this.$$.ctx[31]}set enableViewTool(e){this.$$set({enableViewTool:e}),Oa()}get enableMoveTool(){return this.$$.ctx[32]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),Oa()}get enableAutoSelectMoveTool(){return this.$$.ctx[33]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[34]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}get willRenderShapeControls(){return this.$$.ctx[35]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),Oa()}get willRenderShapeTextControls(){return this.$$.ctx[36]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),Oa()}get beforeAddShape(){return this.$$.ctx[37]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),Oa()}get beforeRemoveShape(){return this.$$.ctx[38]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),Oa()}get beforeDeselectShape(){return this.$$.ctx[39]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),Oa()}get beforeSelectShape(){return this.$$.ctx[40]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),Oa()}get beforeUpdateShape(){return this.$$.ctx[41]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),Oa()}get markupEditorWillStartInteraction(){return this.$$.ctx[42]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),Oa()}}]};function Zx(e){let t,o;return t=new Ox({props:{stores:e[3],locale:e[4],isActive:e[0],isActiveFraction:e[1],isVisible:e[2],mapScreenPointToImagePoint:e[26],mapImagePointToScreenPoint:e[25],utilKey:"sticker",shapePresets:e[5],shapes:e[6]?e[35]:e[36],toolActive:"preset",imageFlipX:!!e[6]&&e[24],imageFlipY:!!e[6]&&e[23],imageRotation:e[6]?e[31]:0,parentRect:e[6]?e[37]:e[33],snapThreshold:e[29],gridSize:e[28],enableMultiSelect:e[12],enableSnapToContext:e[27],enablePresetDropImage:e[7],enablePresetSelectImage:e[30],enableButtonFlipVertical:e[10]||e[8],toolSelectRadius:e[15],willStartInteraction:e[22],willRenderPresetToolbar:e[11]||e[9]||e[16],hooks:{willRenderShapeControls:e[13],willRenderShapeTextControls:e[14],beforeAddShape:e[17],beforeRemoveShape:e[18],beforeDeselectShape:e[19],beforeSelectShape:e[20],beforeUpdateShape:e[21]}}}),t.$on("measure",e[61]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};8&o[0]&&(i.stores=e[3]),16&o[0]&&(i.locale=e[4]),1&o[0]&&(i.isActive=e[0]),2&o[0]&&(i.isActiveFraction=e[1]),4&o[0]&&(i.isVisible=e[2]),67108864&o[0]&&(i.mapScreenPointToImagePoint=e[26]),33554432&o[0]&&(i.mapImagePointToScreenPoint=e[25]),32&o[0]&&(i.shapePresets=e[5]),64&o[0]&&(i.shapes=e[6]?e[35]:e[36]),16777280&o[0]&&(i.imageFlipX=!!e[6]&&e[24]),8388672&o[0]&&(i.imageFlipY=!!e[6]&&e[23]),64&o[0]|1&o[1]&&(i.imageRotation=e[6]?e[31]:0),64&o[0]&&(i.parentRect=e[6]?e[37]:e[33]),536870912&o[0]&&(i.snapThreshold=e[29]),268435456&o[0]&&(i.gridSize=e[28]),4096&o[0]&&(i.enableMultiSelect=e[12]),134217728&o[0]&&(i.enableSnapToContext=e[27]),128&o[0]&&(i.enablePresetDropImage=e[7]),1073741824&o[0]&&(i.enablePresetSelectImage=e[30]),1280&o[0]&&(i.enableButtonFlipVertical=e[10]||e[8]),32768&o[0]&&(i.toolSelectRadius=e[15]),4194304&o[0]&&(i.willStartInteraction=e[22]),68096&o[0]&&(i.willRenderPresetToolbar=e[11]||e[9]||e[16]),4087808&o[0]&&(i.hooks={willRenderShapeControls:e[13],willRenderShapeTextControls:e[14],beforeAddShape:e[17],beforeRemoveShape:e[18],beforeDeselectShape:e[19],beforeSelectShape:e[20],beforeUpdateShape:e[21]}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Xx(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,y;let{isActive:b}=t,{isActiveFraction:x}=t,{isVisible:v}=t,{stores:S}=t,{locale:w={}}=t,{stickers:k=[]}=t,{stickerForceEnable:C=!1}=t,{stickerStickToImage:T=!1}=t,{stickerEnableSelectImagePreset:M=!0}=t,{stickerEnableDropImagePreset:P=!0}=t,{stickerEnableButtonFlipVertical:R=!1}=t,{stickerWillRenderShapePresetToolbar:I}=t,{stickerEnableSelectImage:E=!0}=t,{stickersEnableButtonFlipVertical:A=!1}=t,{stickersWillRenderShapePresetToolbar:L}=t,{markupEditorGridSize:F=0}=t,{markupEditorSnapThreshold:z=0}=t,{markupEditorSnapToContext:D=!1}=t,{enableMultiSelect:O}=t,{annotateGridSize:B}=t,{annotateSnapToContext:W}=t,{decorateGridSize:_}=t,{decorateSnapToContext:V}=t,{willRenderShapeControls:N}=t,{willRenderShapeTextControls:H}=t,{markupEditorToolSelectRadius:j}=t,{willRenderShapePresetToolbar:U}=t,{beforeAddShape:G}=t,{beforeRemoveShape:Z}=t,{beforeDeselectShape:X}=t,{beforeSelectShape:Y}=t,{beforeUpdateShape:q}=t,{markupEditorWillStartInteraction:K}=t;const{rootRect:J,imageCropRect:Q,imageSelectionRectPresentation:ee,imageAnnotation:te,imageDecoration:oe,imageSize:ie,imageTransforms:ne,imageTransformsInterpolated:re,imageRotation:ae,imageFlipX:se,imageFlipY:le}=S;return wr(e,J,e=>o(59,$=e)),wr(e,ee,e=>o(56,u=e)),wr(e,ie,e=>o(58,g=e)),wr(e,ne,e=>o(60,f=e)),wr(e,re,e=>o(57,m=e)),wr(e,ae,e=>o(31,y=e)),wr(e,se,e=>o(24,h=e)),wr(e,le,e=>o(23,p=e)),e.$$set=e=>{"isActive"in e&&o(0,b=e.isActive),"isActiveFraction"in e&&o(1,x=e.isActiveFraction),"isVisible"in e&&o(2,v=e.isVisible),"stores"in e&&o(3,S=e.stores),"locale"in e&&o(4,w=e.locale),"stickers"in e&&o(5,k=e.stickers),"stickerForceEnable"in e&&o(44,C=e.stickerForceEnable),"stickerStickToImage"in e&&o(6,T=e.stickerStickToImage),"stickerEnableSelectImagePreset"in e&&o(45,M=e.stickerEnableSelectImagePreset),"stickerEnableDropImagePreset"in e&&o(7,P=e.stickerEnableDropImagePreset),"stickerEnableButtonFlipVertical"in e&&o(8,R=e.stickerEnableButtonFlipVertical),"stickerWillRenderShapePresetToolbar"in e&&o(9,I=e.stickerWillRenderShapePresetToolbar),"stickerEnableSelectImage"in e&&o(46,E=e.stickerEnableSelectImage),"stickersEnableButtonFlipVertical"in e&&o(10,A=e.stickersEnableButtonFlipVertical),"stickersWillRenderShapePresetToolbar"in e&&o(11,L=e.stickersWillRenderShapePresetToolbar),"markupEditorGridSize"in e&&o(47,F=e.markupEditorGridSize),"markupEditorSnapThreshold"in e&&o(48,z=e.markupEditorSnapThreshold),"markupEditorSnapToContext"in e&&o(49,D=e.markupEditorSnapToContext),"enableMultiSelect"in e&&o(12,O=e.enableMultiSelect),"annotateGridSize"in e&&o(50,B=e.annotateGridSize),"annotateSnapToContext"in e&&o(51,W=e.annotateSnapToContext),"decorateGridSize"in e&&o(52,_=e.decorateGridSize),"decorateSnapToContext"in e&&o(53,V=e.decorateSnapToContext),"willRenderShapeControls"in e&&o(13,N=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(14,H=e.willRenderShapeTextControls),"markupEditorToolSelectRadius"in e&&o(15,j=e.markupEditorToolSelectRadius),"willRenderShapePresetToolbar"in e&&o(16,U=e.willRenderShapePresetToolbar),"beforeAddShape"in e&&o(17,G=e.beforeAddShape),"beforeRemoveShape"in e&&o(18,Z=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(19,X=e.beforeDeselectShape),"beforeSelectShape"in e&&o(20,Y=e.beforeSelectShape),"beforeUpdateShape"in e&&o(21,q=e.beforeUpdateShape),"markupEditorWillStartInteraction"in e&&o(22,K=e.markupEditorWillStartInteraction)},e.$$.update=()=>{67108864&e.$$.dirty[1]&&o(54,i=m?m.scale:1),536870912&e.$$.dirty[1]&&o(55,n=f?f.rotation.z:0),49152&e.$$.dirty[1]&&o(30,r=!1!==M&&E),131072&e.$$.dirty[1]&&o(29,a=z),64&e.$$.dirty[0]|2686976&e.$$.dirty[1]&&o(28,s=T?No(B)?B:F:No(_)?_:F),64&e.$$.dirty[0]|5505024&e.$$.dirty[1]&&o(27,l=T?_x(W)?W:D:_x(V)?V:D),25165888&e.$$.dirty[0]|528482304&e.$$.dirty[1]&&o(26,c=T?e=>Wx(e,$,g,m.origin,m.translation,n,m.scale,h,p):e=>{const t=ve(e);return t.x-=u.x,t.y-=u.y,t.x/=i,t.y/=i,t}),25165888&e.$$.dirty[0]|528482304&e.$$.dirty[1]&&o(25,d=T?e=>Bx(e,$,g,m.origin,m.translation,n,m.scale,h,p):e=>{const t=ve(e);return t.x*=i,t.y*=i,t.x+=u.x,t.y+=u.y,t})},[b,x,v,S,w,k,T,P,R,I,A,L,O,N,H,j,U,G,Z,X,Y,q,K,p,h,d,c,l,s,a,r,y,J,Q,ee,te,oe,ie,ne,re,ae,se,le,"sticker",C,M,E,F,z,D,B,W,_,V,i,n,u,m,g,$,f,function(t){wa.call(this,e,t)}]}var Yx={util:["sticker",class extends rs{constructor(e){super(),ns(this,e,Xx,Zx,yr,{name:43,isActive:0,isActiveFraction:1,isVisible:2,stores:3,locale:4,stickers:5,stickerForceEnable:44,stickerStickToImage:6,stickerEnableSelectImagePreset:45,stickerEnableDropImagePreset:7,stickerEnableButtonFlipVertical:8,stickerWillRenderShapePresetToolbar:9,stickerEnableSelectImage:46,stickersEnableButtonFlipVertical:10,stickersWillRenderShapePresetToolbar:11,markupEditorGridSize:47,markupEditorSnapThreshold:48,markupEditorSnapToContext:49,enableMultiSelect:12,annotateGridSize:50,annotateSnapToContext:51,decorateGridSize:52,decorateSnapToContext:53,willRenderShapeControls:13,willRenderShapeTextControls:14,markupEditorToolSelectRadius:15,willRenderShapePresetToolbar:16,beforeAddShape:17,beforeRemoveShape:18,beforeDeselectShape:19,beforeSelectShape:20,beforeUpdateShape:21,markupEditorWillStartInteraction:22},null,[-1,-1])}get name(){return this.$$.ctx[43]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[2]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[3]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),Oa()}get stickers(){return this.$$.ctx[5]}set stickers(e){this.$$set({stickers:e}),Oa()}get stickerForceEnable(){return this.$$.ctx[44]}set stickerForceEnable(e){this.$$set({stickerForceEnable:e}),Oa()}get stickerStickToImage(){return this.$$.ctx[6]}set stickerStickToImage(e){this.$$set({stickerStickToImage:e}),Oa()}get stickerEnableSelectImagePreset(){return this.$$.ctx[45]}set stickerEnableSelectImagePreset(e){this.$$set({stickerEnableSelectImagePreset:e}),Oa()}get stickerEnableDropImagePreset(){return this.$$.ctx[7]}set stickerEnableDropImagePreset(e){this.$$set({stickerEnableDropImagePreset:e}),Oa()}get stickerEnableButtonFlipVertical(){return this.$$.ctx[8]}set stickerEnableButtonFlipVertical(e){this.$$set({stickerEnableButtonFlipVertical:e}),Oa()}get stickerWillRenderShapePresetToolbar(){return this.$$.ctx[9]}set stickerWillRenderShapePresetToolbar(e){this.$$set({stickerWillRenderShapePresetToolbar:e}),Oa()}get stickerEnableSelectImage(){return this.$$.ctx[46]}set stickerEnableSelectImage(e){this.$$set({stickerEnableSelectImage:e}),Oa()}get stickersEnableButtonFlipVertical(){return this.$$.ctx[10]}set stickersEnableButtonFlipVertical(e){this.$$set({stickersEnableButtonFlipVertical:e}),Oa()}get stickersWillRenderShapePresetToolbar(){return this.$$.ctx[11]}set stickersWillRenderShapePresetToolbar(e){this.$$set({stickersWillRenderShapePresetToolbar:e}),Oa()}get markupEditorGridSize(){return this.$$.ctx[47]}set markupEditorGridSize(e){this.$$set({markupEditorGridSize:e}),Oa()}get markupEditorSnapThreshold(){return this.$$.ctx[48]}set markupEditorSnapThreshold(e){this.$$set({markupEditorSnapThreshold:e}),Oa()}get markupEditorSnapToContext(){return this.$$.ctx[49]}set markupEditorSnapToContext(e){this.$$set({markupEditorSnapToContext:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[12]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}get annotateGridSize(){return this.$$.ctx[50]}set annotateGridSize(e){this.$$set({annotateGridSize:e}),Oa()}get annotateSnapToContext(){return this.$$.ctx[51]}set annotateSnapToContext(e){this.$$set({annotateSnapToContext:e}),Oa()}get decorateGridSize(){return this.$$.ctx[52]}set decorateGridSize(e){this.$$set({decorateGridSize:e}),Oa()}get decorateSnapToContext(){return this.$$.ctx[53]}set decorateSnapToContext(e){this.$$set({decorateSnapToContext:e}),Oa()}get willRenderShapeControls(){return this.$$.ctx[13]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),Oa()}get willRenderShapeTextControls(){return this.$$.ctx[14]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),Oa()}get markupEditorToolSelectRadius(){return this.$$.ctx[15]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),Oa()}get willRenderShapePresetToolbar(){return this.$$.ctx[16]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),Oa()}get beforeAddShape(){return this.$$.ctx[17]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),Oa()}get beforeRemoveShape(){return this.$$.ctx[18]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),Oa()}get beforeDeselectShape(){return this.$$.ctx[19]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),Oa()}get beforeSelectShape(){return this.$$.ctx[20]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),Oa()}get beforeUpdateShape(){return this.$$.ctx[21]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),Oa()}get markupEditorWillStartInteraction(){return this.$$.ctx[22]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),Oa()}},({stickers:e,stickerEnableSelectImage:t,stickerEnableSelectImagePreset:o,stickerEnableDropImagePreset:i,stickerForceEnable:n})=>e&&e.length||t||o||i||n]};function qx(e){let t,o,i=(e[14](e[36].value)||"")+"";return{c(){t=new la(!1),o=Yr(),t.a=o},m(e,n){t.m(i,e,n),Hr(e,o,n)},p(e,o){32&o[1]&&i!==(i=(e[14](e[36].value)||"")+"")&&t.p(i)},i:ur,o:ur,d(e){e&&(jr(o),t.d())}}}function Kx(e){let t,o;return t=new Rh({props:{items:e[16](e[36].value)}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};32&o[1]&&(i.items=e[16](e[36].value)),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Jx(e){let t,o,i,n,r,a,s,l,c=(L(e[36].label)?e[36].label(e[1]):e[36].label)+"";const d=[Kx,qx],u=[];function p(e,t){return 32&t[1]&&(o=null),null==o&&(o=!!e[15](e[36].value)),o?0:1}return i=p(e,[-1,-1]),n=u[i]=d[i](e),{c(){t=Ur("div"),n.c(),r=Xr(),a=Ur("span"),s=Zr(c),Qr(t,"slot","option")},m(e,o){Hr(e,t,o),u[i].m(t,null),_r(t,r),_r(t,a),_r(a,s),l=!0},p(e,o){let a=i;i=p(e,o),i===a?u[i].p(e,o):(Na(),Ua(u[a],1,1,()=>{u[a]=null}),Ha(),n=u[i],n?n.p(e,o):(n=u[i]=d[i](e),n.c()),ja(n,1),n.m(t,r)),(!l||2&o[0]|32&o[1])&&c!==(c=(L(e[36].label)?e[36].label(e[1]):e[36].label)+"")&&na(s,c)},i(e){l||(ja(n),l=!0)},o(e){Ua(n),l=!1},d(e){e&&jr(t),u[i].d()}}}function Qx(e){let t,o;return t=new Xu({props:{locale:e[1],class:"PinturaControlList",layout:"row",options:e[2],selectedIndex:e[6],onchange:e[12],$$slots:{option:[Jx,({option:e})=>({36:e}),({option:e})=>[0,e?32:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};2&o[0]&&(i.locale=e[1]),4&o[0]&&(i.options=e[2]),64&o[0]&&(i.selectedIndex=e[6]),2&o[0]|96&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ev(e){let t,o,i,n,r;return o=new Zb({props:{locale:e[1],class:"PinturaControlPanels",shapeProps:e[4],onchange:e[13],controls:e[3],scrollElasticity:e[7]}}),n=new Gh({props:{elasticity:e[10],$$slots:{default:[Qx]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),ts(o.$$.fragment),i=Xr(),ts(n.$$.fragment),Qr(t,"slot","footer"),aa(t,"transform",e[5])},m(e,a){Hr(e,t,a),os(o,t,null),_r(t,i),os(n,t,null),r=!0},p(e,i){const r={};2&i[0]&&(r.locale=e[1]),16&i[0]&&(r.shapeProps=e[4]),8&i[0]&&(r.controls=e[3]),128&i[0]&&(r.scrollElasticity=e[7]),o.$set(r);const a={};70&i[0]|64&i[1]&&(a.$$scope={dirty:i,ctx:e}),n.$set(a),32&i[0]&&aa(t,"transform",e[5])},i(e){r||(ja(o.$$.fragment,e),ja(n.$$.fragment,e),r=!0)},o(e){Ua(o.$$.fragment,e),Ua(n.$$.fragment,e),r=!1},d(e){e&&jr(t),is(o),is(n)}}}function tv(e){let t,o;return t=new Uf({props:{$$slots:{footer:[ev]},$$scope:{ctx:e}}}),t.$on("measure",e[25]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};254&o[0]|64&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function ov(e,t,o){let i,n,r,a,s,l,c,d,u=ur,p=()=>(u(),u=vr(h,e=>o(22,s=e)),h);e.$$.on_destroy.push(()=>u());let{isActive:h}=t;p();let{stores:m}=t,{locale:g={}}=t,{frameStyles:$={}}=t,{frameOptions:f=[]}=t,{markupEditorShapeStyleControls:y}=t;const b=Sa("elasticityMultiplier");wr(e,b,e=>o(24,d=e));const{history:x,animation:v,scrollElasticity:S,imageFrame:w,allowPan:k,allowZoom:C,allowZoomControls:T,allowPlayPause:M}=m;wr(e,v,e=>o(23,l=e)),wr(e,w,e=>o(4,c=e));let P={};let R;const I=Fc(l?20:0);return wr(e,I,e=>o(21,a=e)),e.$$set=e=>{"isActive"in e&&p(o(0,h=e.isActive)),"stores"in e&&o(19,m=e.stores),"locale"in e&&o(1,g=e.locale),"frameStyles"in e&&o(20,$=e.frameStyles),"frameOptions"in e&&o(2,f=e.frameOptions),"markupEditorShapeStyleControls"in e&&o(3,y=e.markupEditorShapeStyleControls)},e.$$.update=()=>{4194304&e.$$.dirty[0]&&k.set(s),4194304&e.$$.dirty[0]&&C.set(s),4194304&e.$$.dirty[0]&&T.set(s),4194304&e.$$.dirty[0]&&s&&M.set(!0),16777216&e.$$.dirty[0]&&o(7,i=d*S),20&e.$$.dirty[0]&&o(6,n=c?f.findIndex(([e])=>e===c.id):0),12582912&e.$$.dirty[0]&&l&&I.set(s?0:20),2097152&e.$$.dirty[0]&&o(5,r=a?`translateY(${a}px)`:"none")},[h,g,f,y,c,r,n,i,b,v,S,w,({value:e})=>{const t=$[e];if(!t||!t.shape)return w.set(void 0),void x.write();const{shape:o}=t,i={id:e,...Ri(o),...Object.keys(P).reduce((e,t)=>o[t]?(e[t]=P[t],e):e,{})};w.set(i),x.write()},function(e){jo(e,"frameColor")&&(P.frameColor=e.frameColor),c&&(Dn(c,e),w.set(c),clearTimeout(R),R=setTimeout(()=>{x.write()},200))},e=>{const t=$[e];var o;if(t&&t.thumb)return o=t.thumb,/div/i.test(o)||Xb(o)?o:/rect|path|circle|line|<g>/i.test(o)?`<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" stroke-width="1" stroke="currentColor" fill="none" aria-hidden="true" focusable="false" stroke-linecap="round" stroke-linejoin="round">${o}</svg>`:`<img src="${o}" alt=""/>`},e=>{const t=$[e];return!(!t||!t.thumb)&&Uo(t.thumb)},e=>$[e].thumb,I,"frame",m,$,a,s,l,d,function(t){wa.call(this,e,t)}]}var iv={util:["frame",class extends rs{constructor(e){super(),ns(this,e,ov,tv,yr,{name:18,isActive:0,stores:19,locale:1,frameStyles:20,frameOptions:2,markupEditorShapeStyleControls:3},null,[-1,-1])}get name(){return this.$$.ctx[18]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get stores(){return this.$$.ctx[19]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),Oa()}get frameStyles(){return this.$$.ctx[20]}set frameStyles(e){this.$$set({frameStyles:e}),Oa()}get frameOptions(){return this.$$.ctx[2]}set frameOptions(e){this.$$set({frameOptions:e}),Oa()}get markupEditorShapeStyleControls(){return this.$$.ctx[3]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),Oa()}},({src:e})=>e&&!al(e)]};function nv(e){let t,o,i,n,r,a,s,l;return{c(){t=Ur("div"),o=Ur("input"),n=Xr(),r=Ur("label"),a=Zr(e[1]),Qr(o,"id",e[0]),Qr(o,"type","number"),Qr(o,"min","1"),Qr(o,"inputmode","numeric"),Qr(o,"pattern","[0-9]*"),Qr(o,"data-state",e[3]),Qr(o,"autocomplete","off"),Qr(o,"placeholder",e[4]),o.value=i=void 0===e[5]?"":e[7](e[5]+""),Qr(r,"for",e[0]),Qr(r,"title",e[2]),Qr(r,"aria-label",e[2]),Qr(t,"class","PinturaInputDimension")},m(i,c){Hr(i,t,c),_r(t,o),_r(t,n),_r(t,r),_r(r,a),s||(l=qr(o,"input",e[8]),s=!0)},p(e,[t]){1&t&&Qr(o,"id",e[0]),8&t&&Qr(o,"data-state",e[3]),16&t&&Qr(o,"placeholder",e[4]),160&t&&i!==(i=void 0===e[5]?"":e[7](e[5]+""))&&o.value!==i&&(o.value=i),2&t&&na(a,e[1]),1&t&&Qr(r,"for",e[0]),4&t&&Qr(r,"title",e[2]),4&t&&Qr(r,"aria-label",e[2])},i:ur,o:ur,d(e){e&&jr(t),s=!1,l()}}}function rv(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 av extends rs{constructor(e){super(),ns(this,e,rv,nv,yr,{id:0,label:1,title:2,state:3,placeholder:4,value:5,onchange:6,format:7})}}function sv(e){let t;return{c(){t=Gr("g")},m(o,i){Hr(o,t,i),t.innerHTML=e[2]},p(e,o){4&o&&(t.innerHTML=e[2])},d(e){e&&jr(t)}}}function lv(e){let t,o,i,n,r,a,s,l;return r=new Od({props:{$$slots:{default:[sv]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),o=Ur("input"),i=Xr(),n=Ur("label"),ts(r.$$.fragment),Qr(o,"id",e[0]),Qr(o,"class","implicit"),Qr(o,"type","checkbox"),o.checked=e[1],Qr(n,"for",e[0]),Qr(n,"title",e[3])},m(c,d){Hr(c,t,d),_r(t,o),_r(t,i),_r(t,n),os(r,n,null),a=!0,s||(l=qr(o,"change",e[5]),s=!0)},p(e,[t]){(!a||1&t)&&Qr(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)&&Qr(n,"for",e[0]),(!a||8&t)&&Qr(n,"title",e[3])},i(e){a||(ja(r.$$.fragment,e),a=!0)},o(e){Ua(r.$$.fragment,e),a=!1},d(e){e&&jr(t),is(r),s=!1,l()}}}function cv(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 dv extends rs{constructor(e){super(),ns(this,e,cv,lv,yr,{id:0,locked:1,icon:2,title:3,onchange:4})}}function uv(e){let t;return{c(){t=Zr("Save")},m(e,o){Hr(e,t,o)},d(e){e&&jr(t)}}}function pv(e){let t,o,i,n,r,a,s,l,c,d,u,p,h,m=e[1].resizeLabelFormCaption+"";return l=new Rh({props:{items:e[4]}}),d=new Dh({props:{type:"submit",class:"implicit",$$slots:{default:[uv]},$$scope:{ctx:e}}}),{c(){t=Ur("form"),o=Ur("div"),i=Ur("fieldset"),n=Ur("legend"),r=Zr(m),a=Xr(),s=Ur("div"),ts(l.$$.fragment),c=Xr(),ts(d.$$.fragment),Qr(n,"class","implicit"),Qr(s,"class","PinturaFieldsetInner"),Qr(o,"class","PinturaFormInner"),Qr(t,"slot","footer"),aa(t,"transform",e[3])},m(m,g){Hr(m,t,g),_r(t,o),_r(o,i),_r(i,n),_r(n,r),_r(i,a),_r(i,s),os(l,s,null),e[66](s),_r(o,c),os(d,o,null),u=!0,p||(h=[qr(s,"focusin",e[15]),qr(s,"focusout",e[16]),qr(t,"submit",Kr(e[17]))],p=!0)},p(e,o){(!u||2&o[0])&&m!==(m=e[1].resizeLabelFormCaption+"")&&na(r,m);const i={};16&o[0]&&(i.items=e[4]),l.$set(i);const n={};32&o[3]&&(n.$$scope={dirty:o,ctx:e}),d.$set(n),8&o[0]&&aa(t,"transform",e[3])},i(e){u||(ja(l.$$.fragment,e),ja(d.$$.fragment,e),u=!0)},o(e){Ua(l.$$.fragment,e),Ua(d.$$.fragment,e),u=!1},d(o){o&&jr(t),is(l),e[66](null),is(d),p=!1,$r(h)}}}function hv(e){let t,o;return t=new Uf({props:{$$slots:{footer:[pv]},$$scope:{ctx:e}}}),t.$on("measure",e[67]),{c(){ts(t.$$.fragment)},m(e,i){os(t,e,i),o=!0},p(e,o){const i={};30&o[0]|32&o[3]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function mv(e,t,o){let i,n,r,a,s,l,c,d,u,p,h,m,g,$,f,b,x,v,S,w,k,C,T,M,P,R,I,E,A,F,z=ur,D=()=>(z(),z=vr(W,e=>o(50,h=e)),W);e.$$.on_destroy.push(()=>z());const O=(e,t=0,o=9999)=>{if(y(e)&&!(e=e.replace(/\D/g,"")).length)return;const i=Math.round(e);return Number.isNaN(i)?void 0:Rs(i,t,o)};let{isActive:W}=t;D();let{stores:_}=t,{locale:V={}}=t,{resizeMinSize:N=Ze(1,1)}=t,{resizeMaxSize:H=Ze(9999,9999)}=t,{resizeAspectRatioLocked:j=!1}=t,{resizeEnableButtonLockAspectRatio:U=!0}=t,{resizeSizePresetOptions:G}=t,{resizeWidthPresetOptions:Z}=t,{resizeHeightPresetOptions:X}=t,{resizeWillRenderFooter:Y=ee}=t,{resizeFormatIconButtonMaintainAspectRatio:q=function(e){const{active:t,activeFraction:o}=e;return{active:t,activeFraction:3*(o-1)}}}=t;const K=Fc(0,{stiffness:.15,damping:.3});wr(e,K,e=>o(55,b=e));const{animation:J,imageSize:te,imageCropRect:oe,imageCropRectAspectRatio:ie,imageCropAspectRatio:ne,imageOutputSize:re,imageSelectionZoom:ae,imageSelectionPan:se,history:le,env:ce,allowPan:de,allowZoom:ue,allowZoomControls:pe,allowPlayPause:he}=_;wr(e,J,e=>o(51,m=e)),wr(e,te,e=>o(74,E=e)),wr(e,oe,e=>o(53,$=e)),wr(e,ie,e=>o(54,f=e)),wr(e,ne,e=>o(73,M=e)),wr(e,re,e=>o(62,T=e)),wr(e,ae,e=>o(75,A=e)),wr(e,se,e=>o(76,F=e)),wr(e,ce,e=>o(52,g=e));const me=B();let ge,$e,fe,be,xe,ve,Se=ye();const we=(e,t,o,i,n)=>null!=e&&o!==t?e>=i[t]&&e<=n[t]?"valid":"invalid":"undetermined",ke=(e,t,o)=>Math.round(null!=e?e/t:o.height),Ce=()=>{j&&$e&&fe&&("width"===be?o(40,fe=Math.round($e/f)):"height"===be?o(39,$e=Math.round(fe*f)):("width"===xe?o(40,fe=Math.round($e/f)):"height"===xe&&o(39,$e=Math.round(fe*f)),Te()))},Te=e=>{let t=O($e),i=O(fe),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?Q(n,r):f;let l=Ze(n,r);Je(H,l)||(l=Pt(H,s)),Je(l,N)||(l=Mt(N,s)),o(39,$e=null!=t?Math.round(l.width):void 0),o(40,fe=null!=i?Math.round(l.height):void 0)},Me=()=>{Te();const{width:e,height:t}=T||{};e===$e&&t===fe||($e||fe?($e&&fe&&Er(ne,M=$e/fe,M),Er(re,T=Ze($e,fe),T)):(Er(ne,M=E.width/E.height,M),Er(ne,M=void 0,M),Er(re,T=void 0,T)),le.write())},Pe=re.subscribe(e=>{if(!e)return o(39,$e=void 0),void o(40,fe=void 0);o(39,$e=e.width),o(40,fe=e.height),Te()}),Re=ne.subscribe(e=>{($e||fe)&&e&&($e&&fe&&Q($e,fe)!==e?(o(40,fe=$e/e),Te(e)):Te())}),Ie=e=>y(e[0])?(e[1]=e[1].map(Ie),e):No(e)?[e,""+e]:e,Ee=e=>{if(y(e[0]))return e[1]=e[1].map(Ee),e;let[t,o]=e;if(No(t)&&No(o)){const[e,i]=[t,o];o=`${e} &times; ${i}`,t=[e,i]}return[t,o]},Ae=ls();wr(e,Ae,e=>o(61,C=e));const Le=ls();wr(e,Le,e=>o(65,I=e));const Fe=ls();wr(e,Fe,e=>o(59,w=e));const ze=ls();wr(e,ze,e=>o(64,R=e));const De=ls();wr(e,De,e=>o(57,v=e));const Oe=ls();wr(e,Oe,e=>o(63,P=e));const Be=cs([re,Le],([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)});wr(e,Be,e=>o(60,k=e));const We=cs([re,ze],([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex(([t])=>!t&&!e||!!t&&e.width===t);o(i<0?0:i)});wr(e,We,e=>o(58,S=e));const _e=cs([re,Oe],([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex(([t])=>!t&&!e||!!t&&e.height===t);o(i<0?0:i)});let Ve,Ne;wr(e,_e,e=>o(56,x=e));const He=Sa("redrawTrigger"),je=Fc(m?20:0);return wr(e,je,e=>o(49,p=e)),ba(()=>{Pe(),Re()}),e.$$set=e=>{"isActive"in e&&D(o(0,W=e.isActive)),"stores"in e&&o(30,_=e.stores),"locale"in e&&o(1,V=e.locale),"resizeMinSize"in e&&o(31,N=e.resizeMinSize),"resizeMaxSize"in e&&o(32,H=e.resizeMaxSize),"resizeAspectRatioLocked"in e&&o(28,j=e.resizeAspectRatioLocked),"resizeEnableButtonLockAspectRatio"in e&&o(33,U=e.resizeEnableButtonLockAspectRatio),"resizeSizePresetOptions"in e&&o(34,G=e.resizeSizePresetOptions),"resizeWidthPresetOptions"in e&&o(35,Z=e.resizeWidthPresetOptions),"resizeHeightPresetOptions"in e&&o(36,X=e.resizeHeightPresetOptions),"resizeWillRenderFooter"in e&&o(37,Y=e.resizeWillRenderFooter),"resizeFormatIconButtonMaintainAspectRatio"in e&&o(38,q=e.resizeFormatIconButtonMaintainAspectRatio)},e.$$.update=()=>{524288&e.$$.dirty[1]&&de.set(!h),524288&e.$$.dirty[1]&&ue.set(!h),524288&e.$$.dirty[1]&&pe.set(!h),524288&e.$$.dirty[1]&&h&&he.set(!0),1073741832&e.$$.dirty[1]&&G&&(Er(Ae,C=G.map(Ee),C),Er(Le,I=fu(C),I)),1073741824&e.$$.dirty[1]&&o(48,a=!!C),536870912&e.$$.dirty[1]|8&e.$$.dirty[2]&&o(47,i=k>-1&&I[k][1]),268435472&e.$$.dirty[1]&&Z&&(Er(Fe,w=Z.map(Ie),w),Er(ze,R=fu(w),R)),268566528&e.$$.dirty[1]&&o(45,s=!a&&w),134217728&e.$$.dirty[1]|4&e.$$.dirty[2]&&o(46,n=S>-1&&R[S][1]),67108896&e.$$.dirty[1]&&X&&(Er(De,v=X.map(Ie),v),Er(Oe,P=fu(v),P)),67239936&e.$$.dirty[1]&&o(44,l=!a&&v),33554432&e.$$.dirty[1]|2&e.$$.dirty[2]&&o(43,r=x>-1&&P[x][1]),155648&e.$$.dirty[1]&&o(42,c=!a&&!s&&!l),268435458&e.$$.dirty[0]|2145648583&e.$$.dirty[1]&&o(4,d=He&&wm(()=>{return Y([a&&["Dropdown","size-presets",{label:i,options:C,onchange:e=>{return(t=e.value)&&!Ve&&(Ve={...$},Ne=M),t?(Er(ne,M=Q(t[0],t[1]),M),Er(re,T=Ue(t),T)):(Er(oe,$=Ve,$),Er(ne,M=Ne,M),Er(re,T=void 0,T),Ve=void 0,Ne=void 0),void le.write();var t},selectedIndex:k}],s&&["Dropdown","width-presets",{label:n,options:w,onchange:e=>{o(39,$e=e.value),Me()},selectedIndex:S}],s&&l&&["span","times",{class:"PinturaResizeLabel",innerHTML:"&times;"}],l&&["Dropdown","height-presets",{label:r,options:v,onchange:e=>{o(40,fe=e.value),Me()},selectedIndex:x}],c&&[av,"width-input",{id:`width-${me}`,title:V.resizeTitleInputWidth,label:V.resizeLabelInputWidth,placeholder:(e=O(fe),t=f,d=$,Math.round(null!=e?e*t:d.width)),value:$e,state:we(O($e),"width",be,N,H),onchange:e=>{o(39,$e=e),Ce()}}],c&&U&&[dv,"aspect-ratio-lock",{id:`aspect-ratio-lock-${me}`,title:V.resizeTitleButtonMaintainAspectRatio,icon:L(V.resizeIconButtonMaintainAspectRatio)?V.resizeIconButtonMaintainAspectRatio(j,b):jl(V.resizeIconButtonMaintainAspectRatio,q({active:j,activeFraction:b}),"{","}"),locked:j,onchange:e=>{o(28,j=e),Ce()}}],c&&[av,"height-input",{id:`height-${me}`,title:V.resizeTitleInputHeight,label:V.resizeLabelInputHeight,placeholder:ke(O($e),f,$),value:fe,state:we(O(fe),"height",be,N,H),onchange:e=>{o(40,fe=e),Ce()}}]].filter(Boolean),{...g},()=>He.set({}));var e,t,d}).filter(Boolean)),268435456&e.$$.dirty[0]&&K.set(j?1:0),1024&e.$$.dirty[1]&&be&&(xe=be),524288&e.$$.dirty[1]&&h&&(Se=F,ve=A),524288&e.$$.dirty[1]|1&e.$$.dirty[2]&&(h?setTimeout(()=>{return e=T,Er(se,F=ye(),F),void Er(ae,A=e&&$?e.width/$.width||e.height/$.height:1,A);var e},0):(Er(se,F=Se,F),Er(ae,A=ve,A))),1572864&e.$$.dirty[1]&&m&&je.set(h?0:20),262144&e.$$.dirty[1]&&o(3,u=p?`translateY(${p}px)`:"none")},[W,V,ge,u,d,K,J,te,oe,ie,ne,re,ae,se,ce,e=>{const t=e.target.id;/width/.test(t)?o(41,be="width"):/height/.test(t)?o(41,be="height"):/aspectRatio/i.test(t)?o(41,be="lock"):o(41,be=void 0)},e=>{ge.contains(e.relatedTarget)||Me(),o(41,be=void 0)},Me,Ae,Le,Fe,ze,De,Oe,Be,We,_e,je,j,"resize",_,N,H,U,G,Z,X,Y,q,$e,fe,be,c,r,l,s,n,i,a,p,h,m,g,$,f,b,x,v,S,w,k,C,T,P,R,I,function(e){Ca[e?"unshift":"push"](()=>{ge=e,o(2,ge)})},function(t){wa.call(this,e,t)}]}var gv={util:["resize",class extends rs{constructor(e){super(),ns(this,e,mv,hv,yr,{name:29,isActive:0,stores:30,locale:1,resizeMinSize:31,resizeMaxSize:32,resizeAspectRatioLocked:28,resizeEnableButtonLockAspectRatio:33,resizeSizePresetOptions:34,resizeWidthPresetOptions:35,resizeHeightPresetOptions:36,resizeWillRenderFooter:37,resizeFormatIconButtonMaintainAspectRatio:38},null,[-1,-1,-1,-1])}get name(){return this.$$.ctx[29]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get stores(){return this.$$.ctx[30]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),Oa()}get resizeMinSize(){return this.$$.ctx[31]}set resizeMinSize(e){this.$$set({resizeMinSize:e}),Oa()}get resizeMaxSize(){return this.$$.ctx[32]}set resizeMaxSize(e){this.$$set({resizeMaxSize:e}),Oa()}get resizeAspectRatioLocked(){return this.$$.ctx[28]}set resizeAspectRatioLocked(e){this.$$set({resizeAspectRatioLocked:e}),Oa()}get resizeEnableButtonLockAspectRatio(){return this.$$.ctx[33]}set resizeEnableButtonLockAspectRatio(e){this.$$set({resizeEnableButtonLockAspectRatio:e}),Oa()}get resizeSizePresetOptions(){return this.$$.ctx[34]}set resizeSizePresetOptions(e){this.$$set({resizeSizePresetOptions:e}),Oa()}get resizeWidthPresetOptions(){return this.$$.ctx[35]}set resizeWidthPresetOptions(e){this.$$set({resizeWidthPresetOptions:e}),Oa()}get resizeHeightPresetOptions(){return this.$$.ctx[36]}set resizeHeightPresetOptions(e){this.$$set({resizeHeightPresetOptions:e}),Oa()}get resizeWillRenderFooter(){return this.$$.ctx[37]}set resizeWillRenderFooter(e){this.$$set({resizeWillRenderFooter:e}),Oa()}get resizeFormatIconButtonMaintainAspectRatio(){return this.$$.ctx[38]}set resizeFormatIconButtonMaintainAspectRatio(e){this.$$set({resizeFormatIconButtonMaintainAspectRatio:e}),Oa()}}]};function $v(e){let t,o;return t=new Ox({props:{stores:e[3],locale:e[4],isActive:e[0],isActiveFraction:e[1],isVisible:e[2],mapScreenPointToImagePoint:e[10],mapImagePointToScreenPoint:e[9],enableMultiSelect:e[6],utilKey:"redact",imageRotation:e[11],imageFlipX:e[8],imageFlipY:e[7],shapes:e[12],toolbar:["rect"],toolShapes:{rectangle:[{x:0,y:0,width:0,height:0}]},toolActive:"rectangle",parentRect:e[14],enablePresetDropImage:!1,enablePresetSelectImage:!1,willStartInteraction:e[5],hooks:{willRenderShapeControls:e[26]}}}),t.$on("measure",e[27]),{c(){ts(t.$$.fragment)},m(e,i){os(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]),1024&o&&(i.mapScreenPointToImagePoint=e[10]),512&o&&(i.mapImagePointToScreenPoint=e[9]),64&o&&(i.enableMultiSelect=e[6]),2048&o&&(i.imageRotation=e[11]),256&o&&(i.imageFlipX=e[8]),128&o&&(i.imageFlipY=e[7]),32&o&&(i.willStartInteraction=e[5]),t.$set(i)},i(e){o||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function fv(e,t,o){let i,n,r,a,s,l,c,d,u,p;let{isActive:h}=t,{isActiveFraction:m}=t,{isVisible:g}=t,{stores:$}=t,{locale:f={}}=t,{markupEditorWillStartInteraction:y}=t,{enableMultiSelect:b}=t;const{imageRedaction:x,rootRect:v,imageSize:S,imageRotation:w,imageFlipX:k,imageFlipY:C,imageTransforms:T,imageTransformsInterpolated:M}=$;wr(e,v,e=>o(24,d=e)),wr(e,S,e=>o(23,c=e)),wr(e,w,e=>o(11,p=e)),wr(e,k,e=>o(8,s=e)),wr(e,C,e=>o(7,a=e)),wr(e,T,e=>o(25,u=e)),wr(e,M,e=>o(22,l=e));return e.$$set=e=>{"isActive"in e&&o(0,h=e.isActive),"isActiveFraction"in e&&o(1,m=e.isActiveFraction),"isVisible"in e&&o(2,g=e.isVisible),"stores"in e&&o(3,$=e.stores),"locale"in e&&o(4,f=e.locale),"markupEditorWillStartInteraction"in e&&o(5,y=e.markupEditorWillStartInteraction),"enableMultiSelect"in e&&o(6,b=e.enableMultiSelect)},e.$$.update=()=>{33554432&e.$$.dirty&&o(21,i=u?u.rotation.z:0),31457664&e.$$.dirty&&o(10,n=e=>Wx(e,d,c,l.origin,l.translation,i,l.scale,s,a)),31457664&e.$$.dirty&&o(9,r=e=>Bx(e,d,c,l.origin,l.translation,i,l.scale,s,a))},[h,m,g,$,f,y,b,a,s,r,n,p,x,v,S,w,k,C,T,M,"redact",i,l,c,d,u,e=>{const t=wg(e[0]);return Cg("to-front",t),e},function(t){wa.call(this,e,t)}]}var yv={util:["redact",class extends rs{constructor(e){super(),ns(this,e,fv,$v,yr,{name:20,isActive:0,isActiveFraction:1,isVisible:2,stores:3,locale:4,markupEditorWillStartInteraction:5,enableMultiSelect:6})}get name(){return this.$$.ctx[20]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[2]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[3]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),Oa()}get markupEditorWillStartInteraction(){return this.$$.ctx[5]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[6]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}},({src:e})=>e&&!al(e)]};function bv(e){let t;return{c(){t=Ur("div")},m(e,o){Hr(e,t,o)},p:ur,d(e){e&&jr(t)}}}function xv(e){let t,o,i,n;return{c(){t=Ur("div"),Qr(t,"class","PinturaFillTile")},m(r,a){Hr(r,t,a),i||(n=Ar(o=Mv.call(null,t,e[31].value)),i=!0)},p(e,t){o&&fr(o.update)&&1&t[1]&&o.update.call(null,e[31].value)},d(e){e&&jr(t),i=!1,n()}}}function vv(e){let t,o,i;return{c(){t=Ur("div"),o=Ur("img"),xr(o.src,i=e[31].value)||Qr(o,"src",i),Qr(o,"alt",""),Qr(o,"width","48"),Qr(o,"height","64"),Qr(t,"class","PinturaFillTile")},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){1&t[1]&&!xr(o.src,i=e[31].value)&&Qr(o,"src",i)},d(e){e&&jr(t)}}}function Sv(e){let t,o,i=(L(e[31].label)?e[31].label(e[1]):e[31].label)+"";return{c(){t=Ur("span"),o=Zr(i)},m(e,i){Hr(e,t,i),_r(t,o)},p(e,t){2&t[0]|1&t[1]&&i!==(i=(L(e[31].label)?e[31].label(e[1]):e[31].label)+"")&&na(o,i)},d(e){e&&jr(t)}}}function wv(e){let t,o,i,n;function r(e,t){return 1&t[1]&&(o=null),1&t[1]&&(i=null),null==o&&(o=!!y(e[31].value)),o?vv:(null==i&&(i=!!Uo(e[31].value)),i?xv:bv)}let a=r(e,[-1,-1]),s=a(e),l=e[31].label&&Sv(e);return{c(){t=Ur("div"),s.c(),n=Xr(),l&&l.c(),Qr(t,"slot","option")},m(e,o){Hr(e,t,o),s.m(t,null),_r(t,n),l&&l.m(t,null)},p(e,o){a===(a=r(e,o))&&s?s.p(e,o):(s.d(1),s=a(e),s&&(s.c(),s.m(t,n))),e[31].label?l?l.p(e,o):(l=Sv(e),l.c(),l.m(t,null)):l&&(l.d(1),l=null)},d(e){e&&jr(t),s.d(),l&&l.d()}}}function kv(e){let t,o;return t=new Xu({props:{locale:e[1],class:"PinturaControlList",layout:"row",options:e[2],selectedIndex:e[4],onchange:e[10],$$slots:{option:[wv,({option:e})=>({31:e}),({option:e})=>[0,e?1:0]]},$$scope:{ctx:e}}}),{c(){ts(t.$$.fragment)},m(e,i){os(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||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Cv(e){let t,o,i;return o=new Gh({props:{elasticity:e[5],$$slots:{default:[kv]},$$scope:{ctx:e}}}),{c(){t=Ur("div"),ts(o.$$.fragment),Qr(t,"slot","footer"),aa(t,"transform",e[3])},m(e,n){Hr(e,t,n),os(o,t,null),i=!0},p(e,i){const n={};32&i[0]&&(n.elasticity=e[5]),22&i[0]|2&i[1]&&(n.$$scope={dirty:i,ctx:e}),o.$set(n),8&i[0]&&aa(t,"transform",e[3])},i(e){i||(ja(o.$$.fragment,e),i=!0)},o(e){Ua(o.$$.fragment,e),i=!1},d(e){e&&jr(t),is(o)}}}function Tv(e){let t,o;return t=new Uf({props:{$$slots:{footer:[Cv]},$$scope:{ctx:e}}}),t.$on("measure",e[21]),{c(){ts(t.$$.fragment)},m(e,i){os(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||(ja(t.$$.fragment,e),o=!0)},o(e){Ua(t.$$.fragment,e),o=!1},d(e){is(t,e)}}}function Mv(e){const t=document.createElement("div");return e.append(t),{update(o){const[i,n,r,a]=o.map((e,t)=>t<3?Math.round(255*e):e);e.dataset.transparent=a<1,t.style.backgroundColor=`rgba(${i},${n},${r},${a})`}}}function Pv(e,t,o){let i,n,r,a,s,l,c,d,u,p,h=ur,m=()=>(h(),h=vr(g,e=>o(16,l=e)),g);e.$$.on_destroy.push(()=>h());let{isActive:g}=t;m();let{stores:$}=t,{locale:f={}}=t,{fillOptions:b=[]}=t;const x=e=>e.map(e=>(e=>Uo(e)&&y(e[0])&&Uo(e[1]))(e)?[e[0],x(e[1]),e[2]]:(e=>[Array.isArray(e)&&3===e.length?[...e,1]:e,void 0,{disabled:!1}])(e)),v=Sa("elasticityMultiplier");wr(e,v,e=>o(20,p=e));const{history:S,animation:w,scrollElasticity:k,imageBackgroundColor:C,imageBackgroundImage:T,allowPan:M,allowZoom:P,allowZoomControls:R,allowPlayPause:I}=$;wr(e,w,e=>o(17,c=e)),wr(e,C,e=>o(19,u=e)),wr(e,T,e=>o(18,d=e));const E=Fc(c?20:0);return wr(e,E,e=>o(15,s=e)),e.$$set=e=>{"isActive"in e&&m(o(0,g=e.isActive)),"stores"in e&&o(13,$=e.stores),"locale"in e&&o(1,f=e.locale),"fillOptions"in e&&o(14,b=e.fillOptions)},e.$$.update=()=>{16384&e.$$.dirty[0]&&o(2,i=x(b)),65536&e.$$.dirty[0]&&M.set(l),65536&e.$$.dirty[0]&&P.set(l),65536&e.$$.dirty[0]&&R.set(l),65536&e.$$.dirty[0]&&l&&I.set(!0),1048576&e.$$.dirty[0]&&o(5,n=p*k),786436&e.$$.dirty[0]&&o(4,r=i.findIndex(([e])=>d?e===d:Array.isArray(e)?Fs(e,u):void 0)||0),196608&e.$$.dirty[0]&&c&&E.set(l?0:20),32768&e.$$.dirty[0]&&o(3,a=s?`translateY(${s}px)`:"none")},[g,f,i,a,r,n,v,w,C,T,({value:e})=>{y(e)&&(Er(C,u=void 0,u),Er(T,d=e,d)),Uo(e)&&(Er(C,u=e,u),Er(T,d=void 0,d)),S.write()},E,"fill",$,b,s,l,c,d,u,p,function(t){wa.call(this,e,t)}]}var Rv={util:["fill",class extends rs{constructor(e){super(),ns(this,e,Pv,Tv,yr,{name:12,isActive:0,stores:13,locale:1,fillOptions:14},null,[-1,-1])}get name(){return this.$$.ctx[12]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),Oa()}get stores(){return this.$$.ctx[13]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),Oa()}get fillOptions(){return this.$$.ctx[14]}set fillOptions(e){this.$$set({fillOptions:e}),Oa()}},({src:e,fillOptions:t})=>e&&!al(e)&&t&&t.length]};function Iv(e){let t,o,i;function n(t){e[43](t)}let r={utilKey:"retouch",stores:e[4],locale:e[5],isActive:e[1],isActiveFraction:e[2],isVisible:e[3],mapScreenPointToImagePoint:e[27],mapImagePointToScreenPoint:e[26],imageRotation:e[28],imageFlipX:e[25],imageFlipY:e[24],toolbar:e[6],toolbarLayout:"stack",shapes:e[30],toolShapes:e[7],enableMultiSelect:e[23],enableViewTool:e[14],enableMoveTool:e[13],enableToolShareStyles:!1,shapeControls:e[8],enablePresetSelectImage:!1,enablePresetDropImage:!1,parentRect:e[31],willStartInteraction:e[12],willRenderHeaderTools:e[10]||e[17],willRenderShapeStyleControls:e[9],hooks:{willRenderShapeControls:e[11]||e[15],willRenderShapeTextControls:e[16],beforeAddShape:e[18],beforeRemoveShape:e[19],beforeDeselectShape:e[20],beforeSelectShape:e[21],beforeUpdateShape:e[22]}};return void 0!==e[0]&&(r.toolActive=e[0]),t=new Ox({props:r}),Ca.push(()=>es(t,"toolActive",n)),t.$on("measure",e[44]),{c(){ts(t.$$.fragment)},m(e,o){os(t,e,o),i=!0},p(e,i){const n={};16&i[0]&&(n.stores=e[4]),32&i[0]&&(n.locale=e[5]),2&i[0]&&(n.isActive=e[1]),4&i[0]&&(n.isActiveFraction=e[2]),8&i[0]&&(n.isVisible=e[3]),134217728&i[0]&&(n.mapScreenPointToImagePoint=e[27]),67108864&i[0]&&(n.mapImagePointToScreenPoint=e[26]),268435456&i[0]&&(n.imageRotation=e[28]),33554432&i[0]&&(n.imageFlipX=e[25]),16777216&i[0]&&(n.imageFlipY=e[24]),64&i[0]&&(n.toolbar=e[6]),128&i[0]&&(n.toolShapes=e[7]),8388608&i[0]&&(n.enableMultiSelect=e[23]),16384&i[0]&&(n.enableViewTool=e[14]),8192&i[0]&&(n.enableMoveTool=e[13]),256&i[0]&&(n.shapeControls=e[8]),4096&i[0]&&(n.willStartInteraction=e[12]),132096&i[0]&&(n.willRenderHeaderTools=e[10]||e[17]),512&i[0]&&(n.willRenderShapeStyleControls=e[9]),8226816&i[0]&&(n.hooks={willRenderShapeControls:e[11]||e[15],willRenderShapeTextControls:e[16],beforeAddShape:e[18],beforeRemoveShape:e[19],beforeDeselectShape:e[20],beforeSelectShape:e[21],beforeUpdateShape:e[22]}),!o&&1&i[0]&&(o=!0,n.toolActive=e[0],La(()=>o=!1)),t.$set(n)},i(e){i||(ja(t.$$.fragment,e),i=!0)},o(e){Ua(t.$$.fragment,e),i=!1},d(e){is(t,e)}}}function Ev(e,t,o){let i,n,r,a,s,l,c,d,u,p;let{isActive:h}=t,{isActiveFraction:m}=t,{isVisible:g}=t,{stores:$}=t,{locale:f={}}=t,{retouchTools:y}=t,{retouchToolShapes:b}=t,{retouchShapeControls:x}=t,{retouchActiveTool:v}=t,{retouchWillRenderShapeStyleControls:S}=t,{retouchWillRenderHeaderTools:w}=t,{retouchWillRenderShapeControls:k}=t,{markupEditorWillStartInteraction:C}=t,{retouchEnableMoveTool:T}=t,{retouchEnableViewTool:M}=t,{willRenderShapeControls:P}=t,{willRenderShapeTextControls:R}=t,{willRenderHeaderTools:I}=t,{beforeAddShape:E}=t,{beforeRemoveShape:A}=t,{beforeDeselectShape:L}=t,{beforeSelectShape:F}=t,{beforeUpdateShape:z}=t,{enableMultiSelect:D}=t;const{rootRect:O,imageManipulation:B,imageSize:W,imageRotation:_,imageFlipX:V,imageFlipY:N,imageTransforms:H,imageTransformsInterpolated:j}=$;return wr(e,O,e=>o(41,d=e)),wr(e,W,e=>o(40,c=e)),wr(e,_,e=>o(28,p=e)),wr(e,V,e=>o(25,s=e)),wr(e,N,e=>o(24,a=e)),wr(e,H,e=>o(42,u=e)),wr(e,j,e=>o(39,l=e)),e.$$set=e=>{"isActive"in e&&o(1,h=e.isActive),"isActiveFraction"in e&&o(2,m=e.isActiveFraction),"isVisible"in e&&o(3,g=e.isVisible),"stores"in e&&o(4,$=e.stores),"locale"in e&&o(5,f=e.locale),"retouchTools"in e&&o(6,y=e.retouchTools),"retouchToolShapes"in e&&o(7,b=e.retouchToolShapes),"retouchShapeControls"in e&&o(8,x=e.retouchShapeControls),"retouchActiveTool"in e&&o(0,v=e.retouchActiveTool),"retouchWillRenderShapeStyleControls"in e&&o(9,S=e.retouchWillRenderShapeStyleControls),"retouchWillRenderHeaderTools"in e&&o(10,w=e.retouchWillRenderHeaderTools),"retouchWillRenderShapeControls"in e&&o(11,k=e.retouchWillRenderShapeControls),"markupEditorWillStartInteraction"in e&&o(12,C=e.markupEditorWillStartInteraction),"retouchEnableMoveTool"in e&&o(13,T=e.retouchEnableMoveTool),"retouchEnableViewTool"in e&&o(14,M=e.retouchEnableViewTool),"willRenderShapeControls"in e&&o(15,P=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(16,R=e.willRenderShapeTextControls),"willRenderHeaderTools"in e&&o(17,I=e.willRenderHeaderTools),"beforeAddShape"in e&&o(18,E=e.beforeAddShape),"beforeRemoveShape"in e&&o(19,A=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(20,L=e.beforeDeselectShape),"beforeSelectShape"in e&&o(21,F=e.beforeSelectShape),"beforeUpdateShape"in e&&o(22,z=e.beforeUpdateShape),"enableMultiSelect"in e&&o(23,D=e.enableMultiSelect)},e.$$.update=()=>{2048&e.$$.dirty[1]&&o(38,i=u?u.rotation.z:0),50331648&e.$$.dirty[0]|1920&e.$$.dirty[1]&&o(27,n=e=>Wx(e,d,c,l.origin,l.translation,i,l.scale,s,a)),50331648&e.$$.dirty[0]|1920&e.$$.dirty[1]&&o(26,r=e=>Bx(e,d,c,l.origin,l.translation,i,l.scale,s,a))},[v,h,m,g,$,f,y,b,x,S,w,k,C,T,M,P,R,I,E,A,L,F,z,D,a,s,r,n,p,O,B,W,_,V,N,H,j,"retouch",i,l,c,d,u,function(e){v=e,o(0,v)},function(t){wa.call(this,e,t)}]}var Av={util:["retouch",class extends rs{constructor(e){super(),ns(this,e,Ev,Iv,yr,{name:37,isActive:1,isActiveFraction:2,isVisible:3,stores:4,locale:5,retouchTools:6,retouchToolShapes:7,retouchShapeControls:8,retouchActiveTool:0,retouchWillRenderShapeStyleControls:9,retouchWillRenderHeaderTools:10,retouchWillRenderShapeControls:11,markupEditorWillStartInteraction:12,retouchEnableMoveTool:13,retouchEnableViewTool:14,willRenderShapeControls:15,willRenderShapeTextControls:16,willRenderHeaderTools:17,beforeAddShape:18,beforeRemoveShape:19,beforeDeselectShape:20,beforeSelectShape:21,beforeUpdateShape:22,enableMultiSelect:23},null,[-1,-1])}get name(){return this.$$.ctx[37]}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$$set({isActive:e}),Oa()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),Oa()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$$set({isVisible:e}),Oa()}get stores(){return this.$$.ctx[4]}set stores(e){this.$$set({stores:e}),Oa()}get locale(){return this.$$.ctx[5]}set locale(e){this.$$set({locale:e}),Oa()}get retouchTools(){return this.$$.ctx[6]}set retouchTools(e){this.$$set({retouchTools:e}),Oa()}get retouchToolShapes(){return this.$$.ctx[7]}set retouchToolShapes(e){this.$$set({retouchToolShapes:e}),Oa()}get retouchShapeControls(){return this.$$.ctx[8]}set retouchShapeControls(e){this.$$set({retouchShapeControls:e}),Oa()}get retouchActiveTool(){return this.$$.ctx[0]}set retouchActiveTool(e){this.$$set({retouchActiveTool:e}),Oa()}get retouchWillRenderShapeStyleControls(){return this.$$.ctx[9]}set retouchWillRenderShapeStyleControls(e){this.$$set({retouchWillRenderShapeStyleControls:e}),Oa()}get retouchWillRenderHeaderTools(){return this.$$.ctx[10]}set retouchWillRenderHeaderTools(e){this.$$set({retouchWillRenderHeaderTools:e}),Oa()}get retouchWillRenderShapeControls(){return this.$$.ctx[11]}set retouchWillRenderShapeControls(e){this.$$set({retouchWillRenderShapeControls:e}),Oa()}get markupEditorWillStartInteraction(){return this.$$.ctx[12]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),Oa()}get retouchEnableMoveTool(){return this.$$.ctx[13]}set retouchEnableMoveTool(e){this.$$set({retouchEnableMoveTool:e}),Oa()}get retouchEnableViewTool(){return this.$$.ctx[14]}set retouchEnableViewTool(e){this.$$set({retouchEnableViewTool:e}),Oa()}get willRenderShapeControls(){return this.$$.ctx[15]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),Oa()}get willRenderShapeTextControls(){return this.$$.ctx[16]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),Oa()}get willRenderHeaderTools(){return this.$$.ctx[17]}set willRenderHeaderTools(e){this.$$set({willRenderHeaderTools:e}),Oa()}get beforeAddShape(){return this.$$.ctx[18]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),Oa()}get beforeRemoveShape(){return this.$$.ctx[19]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),Oa()}get beforeDeselectShape(){return this.$$.ctx[20]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),Oa()}get beforeSelectShape(){return this.$$.ctx[21]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),Oa()}get beforeUpdateShape(){return this.$$.ctx[22]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),Oa()}get enableMultiSelect(){return this.$$.ctx[23]}set enableMultiSelect(e){this.$$set({enableMultiSelect:e}),Oa()}},({src:e})=>e&&!al(e)]};const Lv='<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M18 6L6 18M6 6l12 12"></path></path></g>',Fv='<path fill="none" d="M9 15 L12 9 L15 15 M10 13.5 h3" stroke="currentColor" stroke-width=".125em"/>';var zv={labelReset:"Reset",labelDefault:"Default",labelAuto:"Auto",labelNone:"None",labelEdit:"Edit",labelClose:"Close",labelSupportError:"{features} not supported on this browser",labelMemoryError:"The browser ran out of memory",labelColor:"Color",labelWidth:"Width",labelSize:"Size",labelOffset:"Offset",labelAmount:"Amount",labelInset:"Inset",labelRadius:"Radius",labelColorPalette:"Color palette",labelSizeExtraSmall:"Extra small",labelSizeSmall:"Small",labelSizeMediumSmall:"Medium small",labelSizeMedium:"Medium",labelSizeMediumLarge:"Medium large",labelSizeLarge:"Large",labelSizeExtraLarge:"Extra large",labelButtonCancel:"Cancel",labelButtonUndo:"Undo",labelButtonRedo:"Redo",labelButtonRevert:"Revert",labelButtonExport:"Done",labelZoom:"Zoom",labelZoomIn:"Zoom in",labelZoomOut:"Zoom out",labelZoomFit:"Fit to view",labelZoomActual:"Actual size",iconZoomIn:'<path stroke="currentColor" stroke-width=".125em" d="M8 12 h8 M12 8 v8" />',iconZoomOut:'<path stroke="currentColor" stroke-width=".125em" d="M9 12 h6" />',iconSupportError:'<g fill="none" stroke="currentColor" stroke-width="2"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><g><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></g>',iconButtonClose:Lv,iconButtonRevert:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M7.388 18.538a8 8 0 10-2.992-9.03"/><path fill="currentColor" d="M2.794 11.696L2.37 6.714l5.088 3.18z"/><path d="M12 8v4M12 12l4 2"/></g>',iconButtonUndo:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M10 8h4c2.485 0 5 2 5 5s-2.515 5-5 5h-4"/><path fill="currentColor" d="M5 8l4-3v6z"/></g>',iconButtonRedo:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M14 8h-4c-2.485 0-5 2-5 5s2.515 5 5 5h4"/><path fill="currentColor" d="M19 8l-4-3v6z"/></g>',iconButtonExport:'<polyline points="20 6 9 17 4 12" fill="none" stroke="currentColor" stroke-width=".125em"></polyline>',statusLabelButtonClose:"Close",statusIconButtonClose:Lv,statusImageLoadNone:"Waiting for image",statusImageLoadMinSize:"Minimum image size is {minWidth} &times; {minHeight}",statusImageLoadPrepare:"Preparing image&hellip;",statusImageLoadBusy:"Loading image&hellip;",statusImageLoadError:"Error loading image",statusImageProcessBusy:"Processing image&hellip;",statusImageProcessError:"Error processing image",statusImageUploadBusy:"Uploading image&hellip;",statusImageUploadError:"Error uploading image"};const Dv={shapeLabelButtonSelectSticker:"Select image",shapeIconButtonSelectSticker:'<g fill="none" stroke="currentColor" stroke-width="0.0625em"><path d="M8 21 L15 11 L19 15"/><path d="M15 2 v5 h5"/><path d="M8 2 h8 l4 4 v12 q0 4 -4 4 h-8 q-4 0 -4 -4 v-12 q0 -4 4 -4z"/></g><circle fill="currentColor" cx="10" cy="8" r="1.5"/>',shapeIconButtonFlipHorizontal:'<g stroke="currentColor" stroke-width=".125em"><path fill="none" d="M6 6.5h5v11H6z"/><path fill="currentColor" d="M15 6.5h3v11h-3z"/><path d="M11 4v16" fill="currentColor"/></g>',shapeIconButtonFlipVertical:'<g stroke="currentColor" stroke-width=".125em"><rect x="7" y="8" width="11" height="5" fill="none"/><rect x="7" y="17" width="11" height="2" fill="currentColor"/><line x1="5" y1="13" x2="20" y2="13"/></g>',shapeIconButtonRemove:'<g fill="none" fill-rule="evenodd"><path stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7.5 7h9z"/><path d="M7.916 9h8.168a1 1 0 01.99 1.14l-.972 6.862a2 2 0 01-1.473 1.653c-.877.23-1.753.345-2.629.345-.876 0-1.752-.115-2.628-.345a2 2 0 01-1.473-1.653l-.973-6.862A1 1 0 017.916 9z" fill="currentColor"/><rect fill="currentColor" x="10" y="5" width="4" height="3" rx="1"/></g>',shapeIconButtonDuplicate:'<g fill="none" fill-rule="evenodd"><path d="M15 13.994V16a2 2 0 01-2 2H8a2 2 0 01-2-2v-5a2 2 0 012-2h2.142" stroke="currentColor" stroke-width=".125em"/><path d="M15 9V8a1 1 0 00-2 0v1h-1a1 1 0 000 2h1v1a1 1 0 002 0v-1h1a1 1 0 000-2h-1zm-4-4h6a2 2 0 012 2v6a2 2 0 01-2 2h-6a2 2 0 01-2-2V7a2 2 0 012-2z" fill="currentColor"/></g>',shapeIconButtonMoveToFront:'<g fill="none" fill-rule="evenodd"><rect fill="currentColor" x="11" y="13" width="8" height="2" rx="1"/><rect fill="currentColor" x="9" y="17" width="10" height="2" rx="1"/><path d="M11.364 8H10a5 5 0 000 10M12 6.5L14.5 8 12 9.5z" stroke="currentColor" stroke-width=".125em" stroke-linecap="round"/></g>',shapeIconButtonTextLayoutAutoWidth:`${Fv}`,shapeIconButtonTextLayoutAutoHeight:`<g fill="currentColor"><circle cx="4" cy="12" r="1.5"/><circle cx="20" cy="12" r="1.5"/></g>${Fv}`,shapeIconButtonTextLayoutFixedSize:`<g fill="currentColor"><circle cx="5" cy="6" r="1.5"/><circle cx="19" cy="6" r="1.5"/><circle cx="19" cy="19" r="1.5"/><circle cx="5" cy="19" r="1.5"/></g>${Fv}`,shapeTitleButtonTextLayoutAutoWidth:"Auto width",shapeTitleButtonTextLayoutAutoHeight:"Auto height",shapeTitleButtonTextLayoutFixedSize:"Fixed size",shapeTitleButtonFlipHorizontal:"Flip Horizontal",shapeTitleButtonFlipVertical:"Flip Vertical",shapeTitleButtonRemove:"Remove",shapeTitleButtonDuplicate:"Duplicate",shapeTitleButtonMoveToFront:"Move to front",shapeLabelInputText:"Edit text",shapeIconInputCancel:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M18 6L6 18M6 6l12 12"/></g>',shapeIconInputConfirm:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><polyline points="20 6 9 17 4 12"/></g>',shapeLabelInputCancel:"Cancel",shapeLabelInputConfirm:"Confirm",shapeLabelStrokeNone:"No outline",shapeLabelFontStyleNormal:"Normal",shapeLabelFontStyleBold:"Bold",shapeLabelFontStyleItalic:"Italic",shapeLabelFontStyleItalicBold:"Bold Italic",shapeTitleBackgroundColor:"Fill color",shapeTitleCornerRadius:"Corner radius",shapeTitleFontFamily:"Font",shapeTitleFontSize:"Font size",shapeTitleFontStyle:"Font style",shapeTitleLineHeight:"Line height",shapeTitleLineStart:"Start",shapeTitleLineEnd:"End",shapeTitleStrokeWidth:"Line width",shapeTitleStrokeColor:"Line color",shapeTitleLineDecorationBar:"Bar",shapeTitleLineDecorationCircle:"Circle",shapeTitleLineDecorationSquare:"Square",shapeTitleLineDecorationArrow:"Arrow",shapeTitleLineDecorationCircleSolid:"Circle solid",shapeTitleLineDecorationSquareSolid:"Square solid",shapeTitleLineDecorationArrowSolid:"Arrow solid",shapeIconLineDecorationBar:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H16"/><path d="M16,8 V16"/></g>',shapeIconLineDecorationCircle:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><circle fill="none" stroke-width=".125em" cx="16" cy="12" r="4"/></g>',shapeIconLineDecorationSquare:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><rect fill="none" stroke-width=".125em" x="12" y="8" width="8" height="8"/></g>',shapeIconLineDecorationArrow:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H16 M13,7 l6,5 l-6,5" fill="none"/></g>',shapeIconLineDecorationCircleSolid:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><circle fill="currentColor" cx="16" cy="12" r="4"/></g>',shapeIconLineDecorationSquareSolid:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><rect fill="currentColor" x="12" y="8" width="8" height="8"/></g>',shapeIconLineDecorationArrowSolid:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H16"/><path d="M13,7 l6,5 l-6,5z" fill="currentColor"/></g>',shapeTitleColorTransparent:"Transparent",shapeTitleColorWhite:"White",shapeTitleColorSilver:"Silver",shapeTitleColorGray:"Gray",shapeTitleColorBlack:"Black",shapeTitleColorNavy:"Navy",shapeTitleColorBlue:"Blue",shapeTitleColorAqua:"Aqua",shapeTitleColorTeal:"Teal",shapeTitleColorOlive:"Olive",shapeTitleColorGreen:"Green",shapeTitleColorYellow:"Yellow",shapeTitleColorOrange:"Orange",shapeTitleColorRed:"Red",shapeTitleColorMaroon:"Maroon",shapeTitleColorFuchsia:"Fuchsia",shapeTitleColorPurple:"Purple",shapeTitleTextOutline:"Text outline",shapeTitleTextOutlineWidth:"Width",shapeTitleTextShadow:"Text shadow",shapeTitleTextShadowBlur:"Blur",shapeTitleTextColor:"Font color",shapeTitleTextAlign:"Text align",shapeTitleTextAlignLeft:"Left align text",shapeTitleTextAlignCenter:"Center align text",shapeTitleTextAlignRight:"Right align text",shapeIconTextAlignLeft:'<g stroke-width=".125em" stroke="currentColor"><line x1="5" y1="8" x2="15" y2="8"/><line x1="5" y1="12" x2="19" y2="12"/><line x1="5" y1="16" x2="14" y2="16"/></g>',shapeIconTextAlignCenter:'<g stroke-width=".125em" stroke="currentColor"><line x1="7" y1="8" x2="17" y2="8"/><line x1="5" y1="12" x2="19" y2="12"/><line x1="8" y1="16" x2="16" y2="16"/></g>',shapeIconTextAlignRight:'<g stroke-width=".125em" stroke="currentColor"><line x1="9" y1="8" x2="19" y2="8"/><line x1="5" y1="12" x2="19" y2="12"/><line x1="11" y1="16" x2="19" y2="16"/></g>',shapeLabelToolMove:"Move",shapeLabelToolView:"View",shapeLabelToolSharpie:"Sharpie",shapeLabelToolEraser:"Eraser",shapeLabelToolPath:"Path",shapeLabelToolRectangle:"Rectangle",shapeLabelToolEllipse:"Ellipse",shapeLabelToolArrow:"Arrow",shapeLabelToolLine:"Line",shapeLabelToolText:"Text",shapeLabelToolPreset:"Stickers",shapeIconToolView:'<g stroke-width=".125em" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M10.98 9.703V2.567c0-1.19 1.19-1.785 1.784-1.785.595 0 1.784.595 1.784 1.785v3.568"/><path d="M14.548 9.703V4.35c0-1.19 1.19-1.784 1.784-1.784.595 0 1.784.594 1.784 1.784v2.973"/><path d="M18.116 10.244V7.271c0-1.19 1.19-1.784 1.784-1.784.595 0 1.785.595 1.785 1.784 0 1.19 0 8.92-1.19 12.488-1.19 3.569-10.704 4.758-13.678 0-2.973-4.757-2.973-4.757-4.163-6.541-1.189-1.784-1.153-2.974-.594-3.568.558-.595 1.784-1.19 2.973.594 1.277 1.916 2.07 2.907 2.379 2.974V5.487c0-1.19 1.19-1.784 1.784-1.784.595 0 1.784.595 1.784 1.784V8.46"/></g>',shapeIconToolMove:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M6 2 L6 19 L18 13 Z M13 18 L16 24" stroke="currentColor" stroke-width=".125em" fill="none" fill-rule="evenodd" stroke-linejoin="round"/></g>',shapeIconToolSharpie:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M2.025 5c5.616-2.732 8.833-3.857 9.65-3.374C12.903 2.351.518 12.666 2.026 14 3.534 15.334 16.536.566 17.73 2.566 18.924 4.566 3.98 17.187 4.831 18c.851.813 9.848-6 11.643-6 1.087 0-2.53 5.11-2.92 7-.086.41 3.323-1.498 4.773-1 .494.17.64 2.317 1.319 3 .439.443 1.332.776 2.679 1" stroke="currentColor" stroke-width=".125em" fill="none" fill-rule="evenodd" stroke-linejoin="round"/></g>',shapeIconToolEraser:'<g stroke-width=".125em" stroke="currentColor" stroke-linecap="round" fill="none"><g transform="translate(3, 15) rotate(-45)"><rect x="0" y="0" width="18" height="10" rx="3"/></g><line x1="11" y1="21" x2="18" y2="21"/><line x1="20" y1="21" x2="22" y2="21"/></g>',shapeIconToolPath:'<g stroke-width=".125em" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" fill="none"><circle cx="21" cy="3" r="2"/><circle cx="9" cy="9" r="2"/><circle cx="3" cy="21" r="2"/><path d="M19 4 11 8 M8 11 4 19"/></g>',shapeIconToolRectangle:'<g stroke-width=".125em" stroke="currentColor" fill="none"><rect x="1" y="1" width="22" height="22" rx="4"/></g>',shapeIconToolEllipse:'<g stroke-width=".125em" stroke="currentColor" fill="none"><circle cx="12" cy="12" r="11"/></g>',shapeIconToolArrow:'<g stroke-width=".125em" stroke="currentColor" fill="none"><line x1="20" y1="3" x2="6" y2="21"/><path d="m10 6 L21.5 1 L20 13.5" fill="currentColor" stroke="none"/></g>',shapeIconToolLine:'<g stroke-width=".125em" stroke="currentColor" fill="none"><line x1="20" y1="3" x2="6" y2="21"/></g>',shapeIconToolText:'<g stroke="none" fill="currentColor" transform="translate(6,0)"><path d="M8.14 20.085c.459 0 .901-.034 1.329-.102a8.597 8.597 0 001.015-.21v1.984c-.281.135-.695.247-1.242.336a9.328 9.328 0 01-1.477.133c-3.312 0-4.968-1.745-4.968-5.235V6.804H.344v-1.25l2.453-1.078L3.89.819h1.5v3.97h4.97v2.015H5.39v10.078c0 1.031.245 1.823.735 2.375s1.161.828 2.015.828z"/>',shapeIconToolPreset:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M12 22c2.773 0 1.189-5.177 3-7 1.796-1.808 7-.25 7-3 0-5.523-4.477-10-10-10S2 6.477 2 12s4.477 10 10 10z"></path><path d="M20 17c-3 3-5 5-8 5"></path></g>',shapeTitleSelectionMode:"Selection mode",shapeTitleBrushSize:"Brush size",shapeLabelSelectionModeNew:"New",shapeLabelSelectionModeAdd:"Add",shapeLabelSelectionModeSubtract:"Remove",shapeLabelToolSelectionBrush:"Brush",shapeLabelToolSelectionLassoo:"Lassoo",shapeLabelToolSelectionRectangle:"Rectangle marquee",shapeLabelToolSelectionEllipse:"Ellipse marquee",shapeLabelToolSelectionPolygon:"Polygon marquee",shapeIconSelectionModeNew:'<g fill="none" fill-rule="evenodd" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M6.5 17H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v1.5"/><rect width="12" height="12" x="9" y="9" fill="currentColor" fill-opacity=".25" rx="2"/></g>',shapeIconSelectionModeAdd:'<g fill="none" fill-rule="evenodd" stroke="currentColor"><path fill="currentColor" fill-opacity=".25" stroke-linecap="round" stroke-linejoin="round" d="M15 3a2 2 0 0 1 2 2v4h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2v-2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h10Z"/><path d="M13 15h4M15 13v4"/></g>',shapeIconSelectionModeSubtract:'<g fill="none" fill-rule="evenodd" stroke="currentColor"><path fill="currentColor" fill-opacity=".25" stroke-linecap="round" stroke-linejoin="round" d="M15 3a2 2 0 0 1 2 2v4h-6a2 2 0 0 0-1.995 1.85L9 11v6H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h10Z"/><rect width="12" height="12" x="9" y="9" stroke-linecap="round" stroke-linejoin="round" rx="2"/><path d="M13 15h4"/></g>',shapeIconToolSelectionBrush:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M2.025 5c5.616-2.732 8.833-3.857 9.65-3.374C12.903 2.351.518 12.666 2.026 14 3.534 15.334 16.536.566 17.73 2.566 18.924 4.566 3.98 17.187 4.831 18c.851.813 9.848-6 11.643-6 1.087 0-2.53 5.11-2.92 7-.086.41 3.323-1.498 4.773-1 .494.17.64 2.317 1.319 3 .439.443 1.332.776 2.679 1" stroke="currentColor" fill-rule="evenodd" stroke-linejoin="round"/></g>',shapeIconToolSelectionLassoo:'<g fill="none" fill-rule="evenodd" stroke-width=".125em" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M11.428 17.702a18.46 18.46 0 0 0 4.085-1.595c5.851-3.112 9.019-8.599 7.074-12.256-1.945-3.657-8.265-4.1-14.116-.988C2.619 5.974-.55 11.46 1.396 15.118c.63 1.186 1.72 2.033 3.105 2.532"/><ellipse cx="8" cy="18.5" rx="3.5" ry="2.833" transform="rotate(-15 8 18.5)"/><path stroke-linecap="round" d="M5 18c3.347 1.048 5.514 1.881 6.5 2.5.859.54 1.517.994 1.5 2.364"/></g>',shapeIconToolSelectionRectangle:'<g stroke-width=".125em" stroke="currentColor"><path d="M9 1 h6 m4 0 h4v4 m0 4 v6 m0 4 v4h-4 m-4 0 h-6 m-4 0 h-4v-4 m0 -4 v-6 m0 -4 v-4h4" fill="none" /></g>',shapeIconToolSelectionEllipse:'<path stroke-width=".125em" stroke="currentColor" d="M1.21 9.853a11.054 11.054 0 0 0 0 4.294m1.643 3.965a11.054 11.054 0 0 0 3.035 3.035m3.965 1.644a11.054 11.054 0 0 0 4.294 0m3.965-1.644a11.054 11.054 0 0 0 3.035-3.035m1.644-3.965a11.054 11.054 0 0 0 0-4.294m-1.644-3.965a11.054 11.054 0 0 0-3.035-3.035m-3.965-1.644a11.054 11.054 0 0 0-4.294 0M5.888 2.853a11.054 11.054 0 0 0-3.035 3.035"/>',shapeIconToolSelectionPolygon:'<g fill="none" stroke="currentColor" stroke-width=".125em"><path stroke-linecap="round" stroke-linejoin="round" d="M12 18h11V1L13 9 1 6l5 9 3 6v2"/><ellipse cx="8" cy="18.5" rx="3.5" ry="2.8" transform="rotate(-2 8 18)"/></g>'};var Ov={cropLabel:"Crop",cropIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M23 17H9a2 2 0 0 1-2-2v-5m0-3V1 M1 7h14a2 2 0 0 1 2 2v7m0 4v3"/></g>',cropIconButtonRecenter:'<path stroke="currentColor" fill="none" stroke-width="2" stroke-linejoin="bevel" d="M1.5 7.5v-6h6M1.5 16.5v6h6M22.5 16.5v6h-6M22.5 7.5v-6h-6"/><circle cx="12" cy="12" r="3.5" fill="currentColor" stroke="none"/>',cropIconButtonRotateLeft:'<g stroke="none" fill="currentColor"><path fill="none" d="M-1-1h582v402H-1z"/><rect x="3" rx="1" height="12" width="12" y="9"/><path d="M15 5h-1a5 5 0 015 5 1 1 0 002 0 7 7 0 00-7-7h-1.374l.747-.747A1 1 0 0011.958.84L9.603 3.194a1 1 0 000 1.415l2.355 2.355a1 1 0 001.415-1.414l-.55-.55H15z"/></g>',cropIconButtonRotateRight:'<g stroke="none" fill="currentColor"><path fill="none" d="M-1-1h582v402H-1z"/><path d="M11.177 5H10a5 5 0 00-5 5 1 1 0 01-2 0 7 7 0 017-7h1.374l-.747-.747A1 1 0 0112.042.84l2.355 2.355a1 1 0 010 1.415l-2.355 2.354a1 1 0 01-1.415-1.414l.55-.55z"/><rect rx="1" height="12" width="12" y="9" x="9"/></g>',cropIconButtonFlipVertical:'<g stroke="none" fill="currentColor"><path d="M19.993 12.143H7a1 1 0 0 1-1-1V5.994a1 1 0 0 1 1.368-.93l12.993 5.15a1 1 0 0 1-.368 1.93z"/><path d="M19.993 14a1 1 0 0 1 .368 1.93L7.368 21.078A1 1 0 0 1 6 20.148V15a1 1 0 0 1 1-1h12.993z" opacity=".6"/></g>',cropIconButtonFlipHorizontal:'<g stroke="none" fill="currentColor"><path d="M11.93 7.007V20a1 1 0 0 1-1 1H5.78a1 1 0 0 1-.93-1.368l5.15-12.993a1 1 0 0 1 1.929.368z"/><path d="M14 7.007V20a1 1 0 0 0 1 1h5.149a1 1 0 0 0 .93-1.368l-5.15-12.993A1 1 0 0 0 14 7.007z" opacity=".6"/></g>',cropIconSelectPreset:'<g fill="currentColor">\n <rect opacity="{a}" x="2" y="4" width="10" height="18" rx="1"/>\n <rect opacity="{b}" x="4" y="8" width="14" height="14" rx="1"/>\n <rect opacity="{c}" x="6" y="12" width="17" height="10" rx="1"/>\n </g>',cropIconCropBoundary:'<g fill="currentColor">\n <rect opacity="{a}" x="2" y="3" width="20" height="20" rx="1"/>\n <rect opacity="{b}" x="7" y="8" width="10" height="10" rx="1"/>\n <rect opacity="{c}" x="4" y="8" width="14" height="14" rx="1"/>\n <rect opacity="{d}" x="12" y="4" width="10" height="10" rx="1"/>\n </g>',cropLabelButtonRecenter:"Recenter",cropLabelButtonRotateLeft:"Rotate left",cropLabelButtonRotateRight:"Rotate right",cropLabelButtonFlipHorizontal:"Flip horizontal",cropLabelButtonFlipVertical:"Flip vertical",cropLabelSelectPreset:"Crop shape",cropLabelCropBoundary:"Crop boundary",cropLabelCropBoundaryEdge:"Edge of image",cropLabelCropBoundaryNone:"None",cropLabelTabRotation:"Rotation",cropLabelTabZoom:"Scale"},Bv={fillLabel:"Fill",fillIcon:'\n <g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em">\n <g transform="rotate(60, 12, 12)">\n <rect x="4" y="4" width="14" height="16" rx="3"/>\n </g>\n <path d="M21 13 L21 21"></path>\n <path d="M4.5 12.5 L19 12.5"></path>\n </g>\n '},Wv={resizeLabel:"Resize",resizeIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><rect x="2" y="12" width="10" height="10" rx="2"/><path d="M4 11.5V4a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5.5"/><path d="M14 10l3.365-3.365M14 6h4v4"/></g>',resizeLabelFormCaption:"Image output size",resizeLabelInputWidth:"w",resizeTitleInputWidth:"Width",resizeLabelInputHeight:"h",resizeTitleInputHeight:"Height",resizeTitleButtonMaintainAspectRatio:"Maintain aspect ratio",resizeIconButtonMaintainAspectRatio:'<defs><mask id="mask1" x="-2" y="-2" width="24" height="24"><rect x="0" y="0" width="24" height="10" fill="#fff" stroke="none"/></mask></defs><g fill="none" fill-rule="evenodd"><g mask="url(#mask1)"><path transform="translate(0 {activeFraction})" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" d="M9.401 10.205v-.804a2.599 2.599 0 0 1 5.198 0V17"/></g><rect fill="currentColor" x="7" y="10" width="10" height="7" rx="1.5"/></g>'},_v={frameLabel:"Frame",frameIcon:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em">\n <rect x="2" y="2" width="20" height="20" rx="4"/>\n <rect x="6" y="6" width="12" height="12" rx="1"/>\n </g>',frameLabelMatSharp:"Mat",frameLabelMatRound:"Bevel",frameLabelLineSingle:"Line",frameLabelLineMultiple:"Zebra",frameLabelEdgeSeparate:"Inset",frameLabelEdgeOverlap:"Plus",frameLabelEdgeCross:"Lumber",frameLabelCornerHooks:"Hook",frameLabelPolaroid:"Polaroid"},Vv={redactLabel:"Redact",redactIcon:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M 4 5 l 1 -1"/><path d="M 4 10 l 6 -6"/><path d="M 4 15 l 11 -11"/><path d="M 4 20 l 16 -16"/><path d="M 9 20 l 11 -11"/><path d="M 14 20 l 6 -6"/><path d="M 19 20 l 1 -1"/></g>'},Nv={retouchLabel:"Retouch",retouchIcon:'\n <g fill="none" fill-rule="evenodd"><path fill="currentColor" d="m17 6-2-1-2 1 1-2-1-2 2 1 2-1-1 2zM5.5 5.5 3 4 .5 5.5 2 3 .5.5 3 2 5.5.5 4 3zM9 21l-3-1.5L3 21l1.5-3L3 15l3 1.5L9 15l-1.5 3z"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m9.266 6.705 13.529 13.529c-.071.78-.34 1.371-.765 1.796-.425.425-1.015.694-1.796.765h0L6.705 9.266c.071-.78.34-1.371.765-1.796.425-.425 1.015-.694 1.796-.765h0Z"/><path stroke="currentColor" stroke-width="1.5" d="M12 9.5c-.657.323-1.157.657-1.5 1-.343.343-.677.843-1 1.5"/></g>\n '},Hv=(e,t)=>{const o=Object.getOwnPropertyDescriptors(e);Object.keys(o).forEach(i=>{o[i].get?Object.defineProperty(t,i,{get:()=>e[i],set:t=>e[i]=t}):t[i]=e[i]})},jv=e=>{const t={},{sub:i,pub:n}=ni();m()&&null!==document.doctype||console.warn("Browser is in quirks mode, add <!DOCTYPE html> to page to fix render issues");const r=Xs();Hv(r,t);const a=((e,t)=>{const o={},i=new Map,n=new cg({target:e,props:{stores:t,pluginComponents:Array.from($g)}});let r=!1;function a(e,t){return i.get(e)===t||(i.set(e,t),!1)}hg||(hg=new Set(Id(cg).filter(e=>!ug.includes(e)))),hg.forEach(e=>{Object.defineProperty(o,e,{get:()=>n[e],set:pg.includes(e)?t=>{a(e,t)||(n[e]={...n[e],...t})}:t=>{a(e,t)||(n[e]=t)}})}),Object.defineProperty(o,"previewImageData",{get:()=>n.imagePreviewCurrent}),mg.forEach(e=>{const t=gg[e],i=t[0];Object.defineProperty(o,e,{get:()=>n.pluginInterface[i][e],set:o=>{if(a(e,o))return;const i=t.reduce((t,i)=>(t[i]={...n.pluginOptions[i],[e]:o},t),{});n.pluginOptions={...n.pluginOptions,...i}}})}),Object.defineProperty(o,"element",{get:()=>n.root,set:()=>{}});const s=n.history;return xs(o,{on:(e,t)=>{if(r)return()=>{};if(/undo|redo|revert|writehistory/.test(e))return s.on(e,t);const o=[n.sub(e,t),n.$on(e,e=>t(e instanceof CustomEvent&&!e.detail?void 0:e))].filter(Boolean);return()=>o.forEach(e=>e())},updateImagePreview:e=>{n.imagePreviewSrc=e},close:()=>!r&&n.pub("close"),destroy:()=>{r||n&&(r=!0,n.$destroy())}}),Object.defineProperty(o,"history",{get:()=>({undo:()=>s.undo(),redo:()=>s.redo(),revert:()=>s.revert(),get:()=>s.get(),getCollapsed:()=>s.get().splice(0,s.index+1),set:e=>s.set(e),write:e=>s.write(e),get length(){return s.length()},get index(){return s.index},set index(e){s.index=e}})}),o})(e,r.stores);Hv(a,t);const s=["loadImage","processImage","abortProcessImage","abortLoadImage"].map(e=>a.on(e,t=>{const i=r[e](t&&t.detail);i instanceof Promise&&i.catch(o)})),l=(e,t)=>{const o=i(e,t),n=r.on(e,t),s=a.on(e,t);return()=>{o(),n(),s()}};t.handleEvent=o;const c=yg.map(e=>l(e,o=>t.handleEvent(e,o)));return xs(t,{on:l,updateImage:e=>new Promise((o,i)=>{const n=t.history.get(),a=t.history.index,s=t.imageState;r.loadImage(e).then(e=>{t.history.set(n),t.history.index=a,t.imageState=s,o(e)}).catch(i)}),close:()=>{n("close")},destroy:()=>{[...s,...c].forEach(e=>e()),a.destroy(),r.destroy(),n("destroy")}}),setTimeout(()=>n("init",t),0),t};const Uv="pintura-editor";var Gv=()=>new Promise(e=>{if(!Zv)return e([]);var t;t=Uv,document.createElement(t).constructor===HTMLElement&&customElements.define(Uv,Zv),customElements.whenDefined(Uv).then(()=>e(document.querySelectorAll(Uv)))});const Zv=m()&&class extends HTMLElement{static get observedAttributes(){return["src"]}constructor(){super(),this._editor=void 0,this._unsubs=void 0}attributeChangedCallback(e,t,o){this[e]=o}connectedCallback(){this._editor=jv(this),Hv(this._editor,this),this._editor.src=this.getAttribute("src"),this._unsubs=bg(this._editor,this)}disconnectedCallback(){this._editor.destroy(),this._unsubs.forEach(e=>e())}},Xv="pintura-editor";var Yv=(e,t={})=>{const o=y(e)?document.querySelector(e):e;if(!Yt(o))return;t.class=t.class?`${Xv} ${t.class}`:Xv;const i=jv(o);return Object.assign(i,t)};const{document:qv,window:Kv}=Wr;function Jv(e){let t,o,i,n,r;return Aa(e[32]),{c(){t=Xr(),o=Xr(),i=Ur("div"),Qr(i,"class",e[4]),Qr(i,"aria-modal","true"),Qr(i,"aria-label","Pintura"),Qr(i,"role","dialog"),Qr(i,"tabindex","-1"),aa(i,"--editor-modal",1),aa(i,"--viewport-pad-footer",e[5]),aa(i,"opacity",e[7]),aa(i,"height",e[14]?e[6]:void 0)},m(a,s){Hr(a,t,s),Hr(a,o,s),Hr(a,i,s),e[33](i),n||(r=[qr(Kv,"keydown",e[13]),qr(Kv,"orientationchange",e[16]),qr(Kv,"resize",e[32]),qr(qv,"readystatechange",e[15]),qr(qv.body,"focusin",function(){fr(!e[1]&&e[10])&&(!e[1]&&e[10]).apply(this,arguments)}),qr(qv.body,"focusout",function(){fr(e[2]&&e[11])&&(e[2]&&e[11]).apply(this,arguments)}),qr(qv.body,"keydown",e[9]),qr(i,"wheel",e[12],{passive:!1})],n=!0)},p(t,o){e=t,16&o[0]&&Qr(i,"class",e[4]),32&o[0]&&aa(i,"--viewport-pad-footer",e[5]),128&o[0]&&aa(i,"opacity",e[7]),64&o[0]&&aa(i,"height",e[14]?e[6]:void 0)},i:ur,o:ur,d(a){a&&(jr(t),jr(o),jr(i)),e[33](null),n=!1,$r(r)}}}const Qv=":not([disabled])";function eS(e,t,o){let i,n,r,a,s,l,c,d,u;const p=xa();let{root:h}=t,{preventZoomViewport:g=!0}=t,{preventScrollBodyIfNeeded:$=!0}=t,{preventFooterOverlapIfNeeded:f=!0}=t,{preventModalAutoFocus:y=!1}=t,{class:b}=t,v=!0,S=!1,w=!1,k=m()&&document.documentElement,C=m()&&document.body,T=m()&&document.head;const M=Fc(0,{precision:.001,damping:.5});wr(e,M,e=>o(31,u=e));const P=M.subscribe(e=>{w&&e>=1?(o(25,w=!1),o(1,v=!1),p("show")):S&&e<=0&&(o(24,S=!1),o(1,v=!0),p("hide"))});let R,I,E,A=!1;const L=()=>document.querySelector("meta[name=viewport]"),F=()=>Array.from(document.querySelectorAll("meta[name=theme-color]")),z=`button${Qv},textarea${Qv},input${Qv},select${Qv},[tabindex="0"]`,D=e=>"radio"===e.type?Array.from(h.querySelectorAll(`input[name="${e.name}"]`)):[e];let O;const B=(e,t)=>{const o=()=>{e()?t():requestAnimationFrame(o)};requestAnimationFrame(o)};let W,_=0;const V=!!m()&&!CSS.supports("height:100dvh");let N,H;const j=()=>{N||(N=x("div",{style:"position:fixed;height:100vh;top:0"}),C.append(N))};fa(()=>{y||h.focus(),f&&To()&&(j(),em()&&visualViewport.scale>1&&(o(0,h.style.left=`${visualViewport.offsetLeft}px`,h),o(0,h.style.top=`${visualViewport.offsetTop}px`,h)))}),ya(()=>{N&&(o(27,H=N.offsetHeight),N.remove(),N=void 0)});let U;const G=()=>k.style.setProperty("--pintura-document-height",`${window.innerHeight}px`);return ba(()=>{k.classList.remove("PinturaModalBodyLock"),P()}),e.$$set=e=>{"root"in e&&o(0,h=e.root),"preventZoomViewport"in e&&o(17,g=e.preventZoomViewport),"preventScrollBodyIfNeeded"in e&&o(18,$=e.preventScrollBodyIfNeeded),"preventFooterOverlapIfNeeded"in e&&o(19,f=e.preventFooterOverlapIfNeeded),"preventModalAutoFocus"in e&&o(20,y=e.preventModalAutoFocus),"class"in e&&o(21,b=e.class)},e.$$.update=()=>{50331650&e.$$.dirty[0]|1&e.$$.dirty[1]&&o(30,i=w||S?u:v?0:1),131072&e.$$.dirty[0]&&(n="width=device-width,height=device-height,initial-scale=1"+(g?",maximum-scale=1,user-scalable=0":"")),50331650&e.$$.dirty[0]&&o(28,r=!w&&!v&&!S),12&e.$$.dirty[0]&&(A||o(26,W=_)),1073741824&e.$$.dirty[0]&&o(7,a=i),67108864&e.$$.dirty[0]&&o(6,s=`${W}px`),134217736&e.$$.dirty[0]&&o(5,l=No(H)?"--viewport-pad-footer:"+(H>_?0:1):void 0),2097152&e.$$.dirty[0]&&o(4,c=ld(["pintura-editor","PinturaModal",b])),268435456&e.$$.dirty[0]&&(e=>{e?k.classList.add("PinturaDocumentStyles"):k.classList.remove("PinturaDocumentStyles")})(r),262144&e.$$.dirty[0]&&o(29,d=$&&To()&&/15_/.test(navigator.userAgent)),805306368&e.$$.dirty[0]&&d&&(e=>{e?(U=window.scrollY,k.classList.add("PinturaDocumentLock"),G(),window.addEventListener("resize",G)):(window.removeEventListener("resize",G),k.classList.remove("PinturaDocumentLock"),No(U)&&window.scrollTo(0,U),U=void 0)})(r)},[h,v,A,_,c,l,s,a,M,e=>{if("Tab"!==e.key)return;const t=document.activeElement,o=h.querySelectorAll(z),i=D(o[0]),n=D(o[o.length-1]);let r;e.shiftKey&&i.includes(t)?r=n[0]:!e.shiftKey&&n.includes(t)&&(r=i[0]),r&&(r.focus(),e.preventDefault())},e=>{eu(e.target)&&(o(2,A=!0),O=_)},e=>{if(eu(e.target))if(clearTimeout(void 0),O===_)o(2,A=!1);else{const e=_;B(()=>_!==e,()=>o(2,A=!1))}},e=>{e.target&&/PinturaStage/.test(e.target.className)&&e.preventDefault()},e=>{const{key:t}=e;if(!/escape/i.test(t))return;const o=e.target;if(o&&/input|textarea/i.test(o.nodeName))return;const i=document.querySelectorAll(".PinturaModal");i[i.length-1]===h&&p("close")},V,function(){o(3,_=window.innerHeight)},j,g,$,f,y,b,()=>{if(w||!v)return;o(25,w=!0);const e=L()||x("meta",{name:"viewport"});R=!R&&e.getAttribute("content"),e.setAttribute("content",n+(/cover/.test(R)?",viewport-fit=cover":"")),e.parentNode||T.append(e);const t=getComputedStyle(h).getPropertyValue("--color-background"),i=F();if(i.length)I=i.map(e=>e.getAttribute("content"));else{const e=x("meta",{name:"theme-color"});T.append(e),i.push(e)}i.forEach(e=>e.setAttribute("content",`rgb(${t})`)),clearTimeout(E),E=setTimeout(()=>M.set(1),250)},()=>{if(S||v)return;clearTimeout(E),o(24,S=!0);const e=L();R?e.setAttribute("content",R):e.remove();const t=F();I?t.forEach((e,t)=>{e.setAttribute("content",I[t])}):t.forEach(e=>e.remove()),M.set(0)},S,w,W,H,r,d,i,u,function(){o(3,_=Kv.innerHeight)},function(e){Ca[e?"unshift":"push"](()=>{h=e,o(0,h)})}]}class tS extends rs{constructor(e){super(),ns(this,e,eS,Jv,yr,{root:0,preventZoomViewport:17,preventScrollBodyIfNeeded:18,preventFooterOverlapIfNeeded:19,preventModalAutoFocus:20,class:21,show:22,hide:23},null,[-1,-1])}get root(){return this.$$.ctx[0]}set root(e){this.$$set({root:e}),Oa()}get preventZoomViewport(){return this.$$.ctx[17]}set preventZoomViewport(e){this.$$set({preventZoomViewport:e}),Oa()}get preventScrollBodyIfNeeded(){return this.$$.ctx[18]}set preventScrollBodyIfNeeded(e){this.$$set({preventScrollBodyIfNeeded:e}),Oa()}get preventFooterOverlapIfNeeded(){return this.$$.ctx[19]}set preventFooterOverlapIfNeeded(e){this.$$set({preventFooterOverlapIfNeeded:e}),Oa()}get preventModalAutoFocus(){return this.$$.ctx[20]}set preventModalAutoFocus(e){this.$$set({preventModalAutoFocus:e}),Oa()}get class(){return this.$$.ctx[21]}set class(e){this.$$set({class:e}),Oa()}get show(){return this.$$.ctx[22]}get hide(){return this.$$.ctx[23]}}const oS=(e,t,o,i=5,n)=>{const r=be(t.x-e.x,t.y-e.y),a=Ce(r),s=i*o;let l;l=n?.5*s:Math.ceil(.5*(s-1));const c=Ae(ve(a),l);return{anchor:ve(e),offset:c,normal:a,solid:n,size:s,sizeHalf:l}},iS=(e,t,o)=>{const{strokeWidth:i,strokeColor:n,strokeJoin:r,strokeCap:a,...s}=e,{anchor:l,offset:c,normal:d,solid:u,size:p,sizeHalf:h}=t,m=l.x,g=l.y,$=Ae(ve(d),p),f=be(m+$.x,g+$.y);if(Ae($,.55),u&&!e.bitmap){Re(o,c);const e=Ae(ve(d),.5*h);return[{...s,points:[be(m-e.x,g-e.y),be(f.x-$.y,f.y+$.x),be(f.x+$.y,f.y-$.x)],pathClose:!0,backgroundColor:n}]}const y=Ae((e=>{const t=e.x;return e.x=-e.y,e.y=t,e})(ve(d)),.5),b=be(m-y.x,g-y.y),x=be(m+y.x,g+y.y);return[{...s,points:[be(f.x+$.y,f.y-$.x),b,be(m,g),x,be(f.x-$.y,f.y+$.x)],backgroundColor:u?n:void 0,pathClose:u,strokeWidth:i,strokeColor:n,strokeJoin:r,strokeCap:a}]},nS=(e,t,o)=>{const{strokeWidth:i,strokeColor:n,...r}=e,{anchor:a,solid:s,offset:l,normal:c,sizeHalf:d}=t;return Re(o,l),s&&Re(o,Se(ve(c))),[{...r,x:a.x,y:a.y,rx:d,ry:d,backgroundColor:s?n:void 0,strokeWidth:s?void 0:i,strokeColor:s?void 0:n}]},rS=(e,t)=>{const{strokeWidth:o,strokeColor:i,strokeJoin:n,strokeCap:r,...a}=e,{anchor:s,offset:l}=t;return[{...a,points:[be(s.x-l.y,s.y+l.x),be(s.x+l.y,s.y-l.x)],strokeWidth:o,strokeColor:i,strokeJoin:n,strokeCap:r}]},aS=(e,t,o)=>{const{strokeWidth:i,strokeColor:n,...r}=e,{anchor:a,solid:s,offset:l,normal:c,sizeHalf:d}=t;return Re(o,l),[{...r,x:a.x-d,y:a.y-d,width:2*d,height:2*d,rotation:(u=c,Math.atan2(u.y,u.x)),backgroundColor:s?n:void 0,strokeWidth:s?void 0:i,strokeColor:s?void 0:n}];var u},sS=(e={})=>t=>{if(!t.lineStart&&!t.lineEnd)return;const o=[],{x1:i,y1:n,x2:r,y2:a,lineStart:s,lineEnd:l,strokeWidth:c,strokeColor:d,strokeJoin:u,strokeCap:p,strokeDash:h,lineStartScalar:m,lineEndScalar:g,bitmap:$,aboveFrame:f,opacity:y}=t,b=be(i,n),x=be(r,a),v=[b,x],S={bitmap:$,aboveFrame:f,opacity:y,strokeColor:d,strokeWidth:c,strokeJoin:u,strokeCap:p,lineStartScalar:m,lineEndScalar:g};if(s){const[t,i]=s.split("-"),n=e[t];if(n){const e=oS(b,x,c,m||g,!!i);o.push(...n(S,e,b))}}if(l){const[t,i]=l.split("-"),n=e[t];if(n){const e=oS(x,b,c,g,!!i);o.push(...n(S,e,x))}}return[{...S,strokeDash:h,points:v},...o]},lS=()=>({arrow:iS,circle:nS,square:aS,bar:rS}),cS=(e,t)=>{const o=parseFloat(e)*t;return y(e)?`${o}%`:o},dS=(e,t)=>y(e)?Cn(e,t):e,uS=e=>[{...e,frameStyle:"line",frameInset:0,frameOffset:0,frameSize:e.frameSize?cS(e.frameSize,2):"2.5%",frameRadius:e.frameRound?cS(e.frameSize,2):0}],pS=({width:e,height:t,frameImage:o,frameSize:i="15%",frameOutset:n=0,frameSlices:r={x1:.15,y1:.15,x2:.85,y2:.85}},{isPreview:a})=>{if(!o)return[];const s=Math.sqrt(e*t),l=dS(i,s),c=a?l:Math.round(l),d=c,u=dS(n,s),p=2*u,{x1:h,x2:m,y1:g,y2:$}=r,f={x0:0,y0:0,x1:c,y1:d,x2:e-c,y2:t-d,x3:e,y3:t,cw:c,ch:d,ew:e-c-c,eh:t-d-d},y=a?1:0,b=2*y,x=u>0,v={expandsCanvas:x,width:f.cw,height:f.ch,backgroundImage:o};return[{expandsCanvas:x,x:f.x1-y-u,y:f.y0-u,width:f.ew+b+p,height:f.ch,backgroundCorners:[{x:h,y:0},{x:m,y:0},{x:m,y:g},{x:h,y:g}],backgroundImage:o},{expandsCanvas:x,x:f.x1-y-u,y:f.y2+u,width:f.ew+b+p,height:f.ch,backgroundCorners:[{x:h,y:$},{x:m,y:$},{x:m,y:1},{x:h,y:1}],backgroundImage:o},{expandsCanvas:x,x:f.x0-u,y:f.y1-y-u,width:f.cw,height:f.eh+b+p,backgroundCorners:[{x:0,y:g},{x:h,y:g},{x:h,y:$},{x:0,y:$}],backgroundImage:o},{expandsCanvas:x,x:f.x2+u,y:f.y1-y-u,width:f.cw,height:f.eh+b+p,backgroundCorners:[{x:m,y:g},{x:1,y:g},{x:1,y:$},{x:m,y:$}],backgroundImage:o},{...v,x:f.x0-u,y:f.y0-u,backgroundCorners:[{x:0,y:0},{x:h,y:0},{x:h,y:g},{x:0,y:g}]},{...v,x:f.x2+u,y:f.y0-u,backgroundCorners:[{x:m,y:0},{x:1,y:0},{x:1,y:g},{x:m,y:g}]},{...v,x:f.x2+u,y:f.y2+u,backgroundCorners:[{x:m,y:$},{x:1,y:$},{x:1,y:1},{x:m,y:1}]},{...v,x:f.x0-u,y:f.y2+u,backgroundCorners:[{x:0,y:$},{x:h,y:$},{x:h,y:1},{x:0,y:1}]}]},hS=({x:e,y:t,width:o,height:i,frameInset:n="3.5%",frameSize:r=".25%",frameColor:a=[1,1,1],frameOffset:s="5%",frameAmount:l=1,frameRadius:c=0,expandsCanvas:d=!1},{isPreview:u})=>{const p=Math.sqrt(o*i);let h=dS(r,p);const m=dS(n,p),g=dS(s,p);let $=0;u||(h=Math.max(1,Math.round(h)),$=h%2==0?0:.5);const f=dS(cS(c,l),p);return new Array(l).fill(void 0).map((n,r)=>{const s=g*r;let l=e+m+s,c=t+m+s,p=e+o-m-s,y=t+i-m-s;u||(l=Math.round(l),c=Math.round(c),p=Math.round(p),y=Math.round(y));return{x:l+$,y:c+$,width:p-l,height:y-c,cornerRadius:f>0?f-s:0,strokeWidth:h,strokeColor:a,expandsCanvas:d}})},mS=({x:e,y:t,width:o,height:i,frameSize:n=".25%",frameOffset:r=0,frameInset:a="2.5%",frameColor:s=[1,1,1]},{isPreview:l})=>{const c=Math.sqrt(o*i);let d=dS(n,c),u=dS(a,c),p=dS(r,c),h=0;l||(d=Math.max(1,Math.round(d)),u=Math.round(u),p=Math.round(p),h=d%2==0?0:.5);const m=p-u,g=e+u+h,$=t+u+h,f=e+o-u-h,y=t+i-u-h;return[{points:[be(g+m,$),be(f-m,$)]},{points:[be(f,$+m),be(f,y-m)]},{points:[be(f-m,y),be(g+m,y)]},{points:[be(g,y-m),be(g,$+m)]}].map(e=>(e.strokeWidth=d,e.strokeColor=s,e))},gS=({x:e,y:t,width:o,height:i,frameSize:n=".25%",frameInset:r="2.5%",frameLength:a="2.5%",frameColor:s=[1,1,1]},{isPreview:l})=>{const c=Math.sqrt(o*i);let d=dS(n,c),u=dS(r,c),p=dS(a,c),h=0;l||(d=Math.max(1,Math.round(d)),u=Math.round(u),p=Math.round(p),h=d%2==0?0:.5);const m=e+u+h,g=t+u+h,$=e+o-u-h,f=t+i-u-h;return[{points:[be(m,g+p),be(m,g),be(m+p,g)]},{points:[be($-p,g),be($,g),be($,g+p)]},{points:[be($,f-p),be($,f),be($-p,f)]},{points:[be(m+p,f),be(m,f),be(m,f-p)]}].map(e=>(e.strokeWidth=d,e.strokeColor=s,e))},$S=({x:e,y:t,width:o,height:i,frameColor:n=[1,1,1]},{isPreview:r})=>{const a=Math.sqrt(o*i),s=.1*a;let l=.2*a,c=0;const d=.5*s;return r?c=1:l=Math.ceil(l),n.length=3,[{id:"border",x:e-d+c,y:t-d+c,width:o+s-2*c,height:i+l-2*c,frameStyle:"line",frameInset:0,frameOffset:0,frameSize:s,frameColor:n,expandsCanvas:!0},{id:"chin",x:e-d,y:i-c,width:o+s,height:l,backgroundColor:n,expandsCanvas:!0}].filter(Boolean)},fS=(e={})=>(t,o)=>{if(!jo(t,"frameStyle"))return;const i=t.frameStyle,n=e[i];if(!n)return;const{frameStyle:r,...a}=t;return n(a,o)},yS=()=>({solid:uS,hook:gS,line:hS,edge:mS,polaroid:$S,nine:pS}),bS=e=>{const t=(o,i={isPreview:!0})=>{const n=e.map(e=>{const n=e(o,i);if(n)return n.map(e=>t(e,i))}).filter(Boolean).flat();return n.length?n.flat().map((e,t)=>(e.id=o.id+"_"+t,e)):o};return t};"undefined"!=typeof window&&(e=>{if(!e)return;const[t,o,i,n]=[[108,111,99,97,116,105,111,110],[82,101,103,69,120,112],[116,101,115,116],[112,113,105,110,97,92,46,110,108,124,102,105,108,101,112,111,110,100,92,46,99,111,109]].map(e=>e.map(e=>String.fromCharCode(e)).join(""));e._3so2s47=new e[o](n)[i](e[t])})(window);const xS=Ol,vS=Wl,SS=(e,...t)=>(o,i)=>{var n;n=e,(Array.isArray(n)||L(n))&&(t=[e,...t]);const r=I(e)?e:{};r.testSrcSupport=!0,t=Array.isArray(t)?t.reduce((e,t)=>[...e,...Array.isArray(t)?[...t]:[t]],[]):t;for(let e=0;e<t.length;e++){const n=t[e](o,i,r);if(Array.isArray(n))return n}},wS=()=>({read:async(e,t)=>{const o=await p(e,{exif:[n]},[0,262144],t);return o&&o.exif&&o.exif[274]||1},apply:R}),kS=(e={})=>{const{blurAmount:t,dataSizeScalar:o,scrambleAmount:i,backgroundColor:n}=e;return(e,r)=>(async(e,t={})=>{if(!e)return;const{width:o,height:i,colorSpace:n="srgb"}=e,{dataSize:r=96,dataSizeScalar:a=1,scrambleAmount:s=4,blurAmount:l=6,outputFormat:c="canvas",backgroundColor:d=[0,0,0]}=t,u=Math.round(r*a),p=Math.min(u/o,u/i),h=Math.floor(o*p),m=Math.floor(i*p),g=x("canvas",{width:h,height:m}),$=g.getContext("2d",{willReadFrequently:!0,colorSpace:n});if(d.length=3,$.fillStyle=Qo(d),$.fillRect(0,0,h,m),w(e)){const t=x("canvas",{width:o,height:i});t.getContext("2d",{willReadFrequently:!0,colorSpace:n}).putImageData(e,0,0),$.drawImage(t,0,0,h,m),S(t)}else $.drawImage(e,0,0,h,m);const f=$.getImageData(0,0,h,m),y=[];if(s>0&&y.push([Mc,{amount:s}]),l>0)for(let e=0;e<l;e++)y.push([Oo,{matrix:Pc}]);let b;if(y.length){const e=(t,o)=>`(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(y,0)})(null, imageData)\n}`,o=await _(t,[{imageData:f,filterInstructions:y.map(e=>e[1])}],[f.data.buffer]);b=Fo(o)}else b=f;return"canvas"===c?($.putImageData(b,0,0),g):b})(e,{blurAmount:t,scrambleAmount:i,backgroundColor:n,...r,dataSizeScalar:o||r.dataSizeScalar})},CS=Xs,TS=L$,MS=E$,PS=Pf,RS={markupEditorToolbar:L$(),markupEditorToolStyles:E$(),markupEditorShapeStyleControls:Pf()},IS=fg,ES=Vy,AS=Xy,LS=ob,FS=Hx,zS=Gx,DS=Yx,OS=iv,BS=yv,WS=gv,_S=Rv,VS=Av,NS=i$,HS=Ng,jS=m$,US=zv,GS=Dv,ZS=Ov,XS=Bv,YS={filterLabel:"Filter",filterIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M18.347 9.907a6.5 6.5 0 1 0-1.872 3.306M3.26 11.574a6.5 6.5 0 1 0 2.815-1.417 M10.15 17.897A6.503 6.503 0 0 0 16.5 23a6.5 6.5 0 1 0-6.183-8.51"/></g>',filterLabelChrome:"Chrome",filterLabelFade:"Fade",filterLabelCold:"Cold",filterLabelWarm:"Warm",filterLabelPastel:"Pastel",filterLabelMonoDefault:"Mono",filterLabelMonoNoir:"Noir",filterLabelMonoWash:"Wash",filterLabelMonoStark:"Stark",filterLabelSepiaDefault:"Sepia",filterLabelSepiaBlues:"Blues",filterLabelSepiaRust:"Rust",filterLabelSepiaColor:"Color"},qS={finetuneLabel:"Finetune",finetuneIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M4 1v5.5m0 3.503V23M12 1v10.5m0 3.5v8M20 1v15.5m0 3.5v3M2 7h4M10 12h4M18 17h4"/></g>',finetuneLabelBrightness:"Brightness",finetuneLabelContrast:"Contrast",finetuneLabelSaturation:"Saturation",finetuneLabelExposure:"Exposure",finetuneLabelTemperature:"Temperature",finetuneLabelGamma:"Gamma",finetuneLabelClarity:"Clarity",finetuneLabelVignette:"Vignette"},KS=Wv,JS={decorateLabel:"Decorate",decorateIcon:'<g fill="none" fill-rule="evenodd"><path stroke="currentColor" stroke-width=".125em" stroke-linecap="round" stroke-linejoin="round" d="M12 18.5l-6.466 3.4 1.235-7.2-5.23-5.1 7.228-1.05L12 2l3.233 6.55 7.229 1.05-5.231 5.1 1.235 7.2z"/></g>'},QS={annotateLabel:"Annotate",annotateIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M17.086 2.914a2.828 2.828 0 1 1 4 4l-14.5 14.5-5.5 1.5 1.5-5.5 14.5-14.5z"/></g>'},ew={stickerLabel:"Sticker",stickerIcon:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M12 22c2.773 0 1.189-5.177 3-7 1.796-1.808 7-.25 7-3 0-5.523-4.477-10-10-10S2 6.477 2 12s4.477 10 10 10z"/><path d="M20 17c-3 3-5 5-8 5"/></g>'},tw=_v,ow=Vv,iw=Nv,nw=(e,t,o={})=>(y(t)?Array.from(document.querySelectorAll(t)):t).filter(Boolean).map(t=>e(t,A(o))),rw=Yv,aw=(e={},t)=>{const{sub:i,pub:n}=ni(),r={},a=((e={},t)=>new tS({target:t||document.body,props:{class:e.class,preventModalAutoFocus:e.preventModalAutoFocus,preventZoomViewport:e.preventZoomViewport,preventScrollBodyIfNeeded:e.preventScrollBodyIfNeeded,preventFooterOverlapIfNeeded:e.preventFooterOverlapIfNeeded}}))(e,t),s=()=>{a.hide&&a.hide()},l=()=>{a.show&&a.show()},c=jv(a.root);Hv(c,r),r.handleEvent=o,c.handleEvent=(e,t)=>{if("init"===e)return r.handleEvent(e,r);r.handleEvent(e,t)},c.on("close",async()=>{const{willClose:t}=e;if(!t)return s();await t()&&s()});const d=(e,t)=>/show|hide/.test(e)?i(e,t):c.on(e,t),u=["show","hide"].map(e=>d(e,t=>r.handleEvent(e,t))),p=()=>{u.forEach(e=>e()),s(),a.$destroy(),c.destroy()};return xs(r,{on:d,destroy:p,hide:s,show:l}),Object.defineProperty(r,"modal",{get:()=>a.root,set:()=>{}}),a.$on("close",c.close),a.$on("show",()=>n("show")),a.$on("hide",()=>{n("hide"),!1!==e.enableAutoDestroy&&p()}),!1!==e.enableAutoHide&&c.on("process",s),c.on("loadstart",l),!1!==e.enableButtonClose&&(e.enableButtonClose=!0),delete e.class,Object.assign(r,e),r},sw=(e,t)=>Yv(e,{...t,layout:"overlay"}),lw=bS,cw=(e=[])=>bS([fS(yS()),sS(lS()),...e]),dw=(e={})=>{let t,o,i;return Array.isArray(e.imageReader)||(t=e.imageReader,delete e.imageReader),Array.isArray(e.imageWriter)?o=vS():(o=L(e.imageWriter)?e.imageWriter:vS(e.imageWriter),delete e.imageWriter),L(e.imageScrambler)||(i=e.imageScrambler,delete e.imageScrambler),{imageReader:xS(t),imageWriter:o,imageOrienter:wS(),imageScrambler:kS(i)}},uw=(e,t={})=>{const o=dw(t),i="function"==typeof t.shapePreprocessor?t.shapePreprocessor:cw(t.shapePreprocessor);return delete t.shapePreprocessor,t=ds([{...o,shapePreprocessor:i,stickerStickToImage:!0},t]),Ys(e,t)},pw=(e={})=>{fg(ES,AS,LS,FS,zS,DS,OS,BS,WS,_S);const t=dw(e),o={...US,...GS,...ZS,...XS,...YS,...qS,...tw,...ow,...KS,...JS,...QS,...ew,...e.locale};delete e.locale;const i="function"==typeof e.shapePreprocessor?e.shapePreprocessor:cw(e.shapePreprocessor);if(delete e.shapePreprocessor,e.markupEditorShapeStyleControls){Object.entries(e.markupEditorShapeStyleControls).every(([e,t])=>/Options$/.test(e)||!Array.isArray(t))&&(e.markupEditorShapeStyleControls=PS({...e.markupEditorShapeStyleControls}))}if(e.markupEditorToolStyles){Object.values(e.markupEditorToolStyles).every(e=>!Array.isArray(e))&&(e.markupEditorToolStyles=Object.entries(e.markupEditorToolStyles).reduce((e,[t,o])=>(e[t]=I$(t,o),e),MS()))}return ds([{...t,shapePreprocessor:i,utils:["trim","crop","filter","finetune","retouch","annotate","decorate","sticker","fill","frame","redact","resize"],...NS,...HS,...jS,...RS,stickerStickToImage:!0,locale:o},e])},hw=async(e={})=>{const t=await Gv();return t.forEach(t=>Object.assign(t,A(e))),t},mw=(e,t)=>rw(e,pw(t)),gw=(e,t,o,i)=>new Promise(async(n,r)=>{const{format:a="canvas",backgroundColor:s=[0,0,0],foregroundColor:l=[1,1,1],scope:c="mask",padding:d=0,maxSize:u=t,targetSize:p,forceSquareCanvas:h=!1,precision:m=7}=i||{},{flipX:g,flipY:$,rotation:f}=o,y=Math.min(1,2048/t.width),b=Ye({...t},y),v=Ke({...t},f),S=Ke({...b},f),w={x:.5*(b.width-S.width),y:.5*(b.height-S.height),...S},k=void 0===l||0===l[3],C=k?[1,1,1]:l,T={imageAnnotation:e.map(e=>((e,t,o)=>{const i={...e};return _n(i,t),i.width||i.rx?i.backgroundColor=o:i.points&&!i.pathClose?(i.strokeJoin="round",i.strokeCap="round",i.strokeColor=o):i.points&&(i.backgroundColor=o,i.strokeColor=[0,0,0,0]),i})(e,y,C)),imageBackgroundColor:"image"===c?s:void 0,imageCropLimitToImage:!1,imageCrop:w,imageFlipX:g,imageFlipY:$,imageRotation:f,imageWriter:{format:"canvas"}},{dest:M}=await uw(x("canvas",b),{...T}),P=M.getContext("2d",{desynchronized:!0,willReadFrequently:!0});let R,I;{const e=Number.MAX_SAFE_INTEGER,{width:t,height:o}=M,i=P.getImageData(0,0,t,o).data;let n,r,a=Math.max(1,parseInt(m,10)),s=t-a,l=o-a,[c,d,p,h]=[e,-e,-e,e];for(n=0;n<=l;n+=a)for(r=0;r<=s;r+=a){i[4*(r+n*t)+3]<=32||(r<h?h=r:r>d&&(d=r),n<c?c=n:n>p&&(p=n))}const g=lt([c-m,d+m,p+m,h-m]),$=mt(g),f=Math.min(g.width,u.width),y=Math.min(g.height,u.height);R=ht($.x-.5*f,$.y-.5*y,f,y)}$t(R,1/y,ye());let E=d,A=d;if("mask"===c){const e=je(R);if(e.width+=2*E,e.height+=2*A,h){const t=Math.max(e.width,e.height);E+=.5*(t-e.width),A+=.5*(t-e.height),e.width=t,e.height=t}let t=1;p&&(t=Math.min(p.width/e.width,p.height/e.height,1)),Ye(e,t);const o=x("canvas",e),i=o.getContext("2d");i.fillStyle=Qo(s),i.fillRect(0,0,o.width,o.height),k&&(i.globalCompositeOperation="destination-out"),i.scale(t,t),i.drawImage(M,-R.x+E,-R.y+A,v.width,v.height),I=o}else I=M;const L=st(t);L.x+=.5*(v.width-t.width),L.y+=.5*(v.height-t.height);const[F]=kt(L,f),z=mt({...R}),D=be(z.x-F.x,z.y-F.y);R.x=Math.cos(f)*D.x+Math.sin(f)*D.y-.5*R.width,R.y=Math.cos(f)*D.y-Math.sin(f)*D.x-.5*R.height;const O={...R};if(O.x=R.x,O.y=R.y,O.flipX=!1,O.flipY=!1,O.backgroundCorners=void 0,g&&$?(O.flipX=!0,O.flipY=!0,O.rotation=-f):g?(O.flipX=!0,O.rotation=f):$?(O.flipY=!0,O.rotation=f):O.rotation=-f,g||$){const e={x:O.x+.5*O.width,y:O.y+.5*O.height};g&&(e.x=Math.abs(t.width-e.x),O.x=e.x-.5*O.width),$&&(e.y=Math.abs(t.height-e.y),O.y=e.y-.5*O.height)}if(E||A){const e=E/(R.width+2*E),t=A/(R.height+2*A);O.backgroundCorners=[{x:e,y:t},{x:1-e,y:t},{x:1-e,y:1-t},{x:e,y:1-t}],R.x-=E,R.y-=A,R.width+=2*E,R.height+=2*A}const B={canvas:I,rect:R,shape:O};"blob"!==a?n({...B,blob:void 0}):I.toBlob(e=>n({...B,blob:e}))});e.appendDefaultEditor=mw,e.appendDefaultEditors=(e,t)=>nw(mw,e,t),e.appendEditor=rw,e.appendEditors=(e,t)=>nw(rw,e,t),e.appendNode=(e,t)=>{if(vg(t))return t.push(e);t[3]=[...wg(t),e]},e.blobToFile=J,e.canvasToBlob=U,e.colorStringToColorArray=Kp,e.createDefaultColorOptions=F$,e.createDefaultFontFamilyOptions=V$,e.createDefaultFontScaleOptions=O$,e.createDefaultFontSizeOptions=z$,e.createDefaultFontStyleOptions=H$,e.createDefaultFrameStyles=yS,e.createDefaultImageOrienter=wS,e.createDefaultImageReader=xS,e.createDefaultImageScrambler=kS,e.createDefaultImageWriter=vS,e.createDefaultLineEndStyleOptions=_$,e.createDefaultLineEndStyles=lS,e.createDefaultLineHeightOptions=D$,e.createDefaultLineHeightScaleOptions=B$,e.createDefaultMediaWriter=SS,e.createDefaultShapePreprocessor=cw,e.createDefaultStrokeScaleOptions=W$,e.createDefaultStrokeWidthOptions=()=>[1,2,3,4,6,8,12,16,20,24,32,48,64],e.createDefaultTextAlignOptions=N$,e.createEditor=CS,e.createFrameStyleProcessor=fS,e.createLineEndProcessor=sS,e.createMarkupEditorBackgroundColorControl=af,e.createMarkupEditorBrushSizeControl=P$,e.createMarkupEditorColorControl=nf,e.createMarkupEditorColorOptions=j$,e.createMarkupEditorFontColorControl=sf,e.createMarkupEditorFontFamilyControl=tf,e.createMarkupEditorFontFamilyOptions=X$,e.createMarkupEditorFontScaleOptions=U$,e.createMarkupEditorFontSizeControl=yf,e.createMarkupEditorFontSizeOptions=e=>e.map(b$),e.createMarkupEditorFontStyleControl=mf,e.createMarkupEditorFontStyleOptions=Y$,e.createMarkupEditorLineEndStyleControl=hf,e.createMarkupEditorLineEndStyleOptions=q$,e.createMarkupEditorLineHeightControl=bf,e.createMarkupEditorLineHeightOptions=e=>e.map(b$),e.createMarkupEditorLineHeightScaleOptions=G$,e.createMarkupEditorLineStartStyleControl=pf,e.createMarkupEditorOptionControl=df,e.createMarkupEditorOptionsControl=(e,t={})=>["Dropdown",{...t,options:e}],e.createMarkupEditorSelectionModeControl=M$,e.createMarkupEditorSelectionToolStyles=(e,t)=>{const{tools:o=T$}=t||{},i=o.reduce((t,o)=>{const[i,n,r]=C$[o],a=I$(i,{...n,action:e},{...r,position:"absolute",isSelection:!0});return Object.assign(t,{[`selection-${o}-${e}`]:a})},{});return i},e.createMarkupEditorSelectionTools=(e,t)=>{const{tools:o=T$,hideLabel:i=!0}=t||{};return o.map(t=>[`selection-${t}-${e}`,y$(t,"shapeLabelToolSelection"),{hideLabel:i,icon:y$(t,"shapeIconToolSelection")}])},e.createMarkupEditorShapeStyleControls=PS,e.createMarkupEditorStrokeColorControl=lf,e.createMarkupEditorStrokeScaleOptions=Z$,e.createMarkupEditorStrokeWidthControl=cf,e.createMarkupEditorStrokeWidthOptions=e=>e.map(b$),e.createMarkupEditorTextAlignControl=xf,e.createMarkupEditorToolStyle=I$,e.createMarkupEditorToolStyles=MS,e.createMarkupEditorToolbar=TS,e.createNode=function(e,t,o,i){return Array.isArray(o)&&(i=o,o={}),[e,t,o||{},i||[]]},e.createRetouchShape=async(e,t,o,i,n,r)=>{const{retouches:a=[],maxSize:s=t,targetSize:l,padding:c=0,mimeType:d,foregroundColor:u,maskFormat:p="blob",imageFormat:h="blob",forceSquareCanvas:m=!1,didCreateDraft:g=()=>{}}=r||{},$=[...i],f=[...a],y=new AbortController,{blob:b,canvas:x,rect:v,shape:S}=await gw($,t,o,{scope:"mask",format:p,padding:c,maxSize:s,targetSize:l,forceSquareCanvas:m,foregroundColor:u}),w=((e,t={})=>({id:e,...t,selectionStyle:"hook",disableStyle:["backgroundColor","cornerRadius","opacity","strokeWidth","strokeColor"],disableFlip:!0,disableReorder:!0,disableMove:!0,disableRotate:!0,disableDuplicate:!0,disableSelect:!0}))(B(),{...S});var k;k=w,Object.assign(k,{status:"loading",cornerRadius:15,strokeWidth:1.5,strokeColor:[0,0,0,.25],backgroundColor:[0,0,0,.1],selectionOpacity:0}),g(w,{selection:$});let C={};(d||l||"canvas"===h)&&(C={imageWriter:{}},d&&(C.imageWriter.mimeType=d),l&&(C.imageWriter.targetSize=l),h&&(C.imageWriter.format=h));const{flipX:T,flipY:M,rotation:P}=o,{dest:R}=await uw(e,{imageFlipX:T,imageFlipY:M,imageRotation:P,imageCrop:v,imageManipulation:f,imageCropLimitToImage:!1,...C});let I;try{await n(R,b||x,{shape:w,controller:y}),I="ok"}catch{I="error"}return(e=>(Object.assign(e,{selectionOpacity:1,cornerRadius:0,strokeWidth:0,strokeColor:[0,0,0,0],backgroundColor:[0,0,0,0]}),"error"!==e.status&&delete e.status,e))({...w,status:I,disableSelect:!1})},e.createShapePreprocessor=lw,e.defineCustomElements=hw,e.defineDefaultCustomElements=e=>hw(pw(e)),e.degToRad=rc,e.dispatchEditorEvents=bg,e.effectBrightness=Yg,e.effectClarity=t$,e.effectContrast=qg,e.effectExposure=Jg,e.effectGamma=Qg,e.effectSaturation=Kg,e.effectTemperature=o$,e.effectVignette=e$,e.filterChrome=Rg,e.filterCold=Ag,e.filterFade=Ig,e.filterInvert=()=>[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],e.filterMonoDefault=Lg,e.filterMonoNoir=Fg,e.filterMonoStark=Dg,e.filterMonoWash=zg,e.filterPastel=Pg,e.filterSepiaBlues=Bg,e.filterSepiaColor=_g,e.filterSepiaDefault=Og,e.filterSepiaRust=Wg,e.filterWarm=Eg,e.findNode=Tg,e.frameEdgeCross=d$,e.frameEdgeOverlap=u$,e.frameEdgeSeparate=c$,e.frameHook=p$,e.frameLineMultiple=l$,e.frameLineSingle=s$,e.framePolaroid=h$,e.frameSolidRound=a$,e.frameSolidSharp=r$,e.getCropperDefaults=(e={})=>{fg(ES);const t=dw(e),o={...US,...ZS,...e.locale};return delete e.locale,ds([{...t,utils:["crop"],locale:o},e])},e.getEditorDefaults=pw,e.getEditorProps=()=>(()=>{const e=Us.map(Gs),t=ys.map(([e])=>e).filter(e=>!js.includes(e));return e.concat(t)})().concat((hg=new Set(Id(cg).filter(e=>!ug.includes(e))),[...hg,...mg])),e.getShapeById=(e,t)=>e.find(e=>e.id===t),e.getUniqueId=B,e.imageStateToCanvas=(e,t,o)=>{const i=co(e),{targetCanvas:n,targetSize:r,disableDraw:a=!1,shapePreprocessor:s,forceEvenSize:l=i}=o||{},c=n||document.createElement("canvas"),{crop:d,colorMatrix:u,convolutionMatrix:p}=t,h={width:i?e.videoWidth:e.width,height:i?e.videoHeight:e.height},{upscale:m=!1,fit:g="contain",width:$,height:f}=r||{};let y=1;y="contain"===g?Math.min(($||Number.MAX_SAFE_INTEGER)/d.width,(f||Number.MAX_SAFE_INTEGER)/d.height):Math.max(($||d.width)/d.width,(f||d.height)/d.height),m||(y=Math.min(y,1));const b="force"===g?$:Math.floor(d.width*y),v="force"===g?f:Math.floor(d.height*y),S=l?Tc(b):b,w=l?Tc(v):v,k=Cc(c,{alpha:!0});k.resize(S,w,1);const C=k.textureCreate();let T;k.setCanvasColor([0,0,0,0]),k.drawToCanvas(),k.disableMask(),k.disablePreviewStencil();{const e=Object.values(u||{}).filter(Boolean);e.length&&(T=cr(e))}const M={x:0,y:0,width:S,height:w},{origin:P,translation:R,rotation:I,scale:E}=_l(M,M,h,d,{x:0,y:0,width:S,height:w},y,{x:0,y:0},1,t.rotation,t.flipX,t.flipY),A=[h,P.x,P.y,R.x,R.y,I.x,I.y,I.z,E,T,1,p&&p.clarity,No(t.gamma)?t.gamma:1,t.vignette||0,[1,0,1,0,1,w,1,S],void 0,void 0,void 0,void 0,!1];let L=!1;const F=t.decoration.length||t.annotation.length,z=F&&k.textureCreate(),D=()=>{k.textureUpdate(C,e,{filterParam:k.textureFilterLinear,wrapParam:k.textureClamp})},O=()=>{D(),k.drawImage(C,...A),F&&L&&k.drawRect(M,0,!1,!1,[0,0,0,0],void 0,z)};return D(),!a&&O(),{canvas:c,prepare:async()=>{if(!F)return;const{dest:e}=await Ys(x("canvas",h),{shapePreprocessor:s,imageReader:[[async(e,t,o)=>{const{src:i}=e,n=parseInt(i.width,10),r=parseInt(i.height,10),a=await U(i);return{...e,dest:a,size:{width:n,height:r}}},"read-canvas"]],imageWriter:Wl({format:"canvas"}),imageState:{...t,redaction:[],frame:void 0,gamma:void 0,convolutionMatrix:void 0,colorMatrix:void 0,backgroundColor:[0,0,0,0],backgroundImage:void 0,trim:void 0,vignette:void 0,volume:void 0}});k.textureUpdate(z,e,{filterParam:k.textureFilterLinear,wrapParam:k.textureClamp}),L=!0,!a&&O()},redraw:O,destroy:()=>{k.release()}}},e.insertNodeAfter=(e,t,o)=>kg(e,t,o,e=>e+1),e.insertNodeBefore=(e,t,o)=>kg(e,t,o),e.isSupported=()=>(null===Xg&&(Xg=m()&&!("[object OperaMini]"===Object.prototype.toString.call(window.operamini))&&"visibilityState"in document&&"Promise"in window&&"File"in window&&"URL"in window&&"createObjectURL"in window.URL&&"performance"in window),Xg),e.legacyDataToImageState=(e,t,o={})=>{const i={};if(!((e={})=>{if("markup"in e||"color"in e||"filter"in e)return!0;const{crop:t}=e;return!(!t||!("flip"in t||"center"in t||"aspectRatio"in t||"rotation"in t))})(o))return o;if(o.crop&&Object.assign(i,Zg(t,o.crop)),o.markup){const e=Array.isArray(o.markup)?o.markup:Object.values(o.markup);i.decoration=e.map(e=>((e,t,o)=>{const i=Object.keys(o).reduce((t,i)=>{let n=o[i];return i=Hg[i]||i,/px$/.test(n)?n=jg(n):/^(?:x|y|left|right|top|bottom|width|height|fontSize|borderWidth|strokeWidth)$/.test(i)&&"number"==typeof n&&("strokeWidth"!==i&&"borderWidth"!==i&&"fontSize"!==i||(n=Math.min(e.width,e.height)*n+"px"),n=jg(n)),/color/i.test(i)&&n&&(n=Kp(n)),null===n&&(n=void 0),t[i]=n,t},{});if("line"===t&&(i.lineDecoration.length>=1&&(i.lineEnd="arrow"),2===i.lineDecoration.length&&(i.lineStart="arrow"),i.x1=i.x,i.y1=i.y,i.x2=Ug(i.x,i.width),i.y2=Ug(i.y,i.height),delete i.x,delete i.y,delete i.width,delete i.height,delete i.lineDecoration,delete i.lineStyle),"text"===t){if(!No(i.y)){const t=Math.min(e.width,e.height);i.y=t*(parseFloat(i.y)/100)}i.y=i.y-i.fontSize,delete i.width,delete i.height,delete i.borderStyle,i.lineHeight=i.lineHeight||"120%"}if("ellipse"===t){let t,o;if(/%$/.test(i.width)){t=parseFloat(i.width)/100,o=parseFloat(i.height)/100;const n=t*e.width,r=o*e.height;t=n/e.width*100,o=r/e.height*100}else t=i.width,o=i.height;i.rx=.5*t,i.ry=.5*o,/%$/.test(i.width)&&(i.rx+="%",i.ry+="%"),i.x=Ug(i.x,i.rx),i.y=Ug(i.y,i.ry),delete i.width,delete i.height,delete i.borderStyle}if("rect"===t&&delete i.borderStyle,"path"===t){let e,t=[];for(const o of i.points)e?ze(e,o)<1e-9||(t.push(o),e=o,e=o):(t.push(o),e=o);i.points=t.map(e=>({x:jg(e.x),y:jg(e.y)}))}return i})(i.crop||t,e[0],e[1]))}if(o.color||o.colors){const e=o.color||o.colors;Object.keys(e).filter(t=>e[t]).map(t=>[t,Array.isArray(e[t].matrix)?e[t].matrix:Object.values(e[t].matrix)]).forEach(([e,t])=>{i.colorMatrix||(i.colorMatrix={}),i.colorMatrix[e]=t})}if(o.filter||o.filters){const t=o.filters||o.filter;i.colorMatrix||(i.colorMatrix={});const n=e?e.filterFunctions:Vg;i.colorMatrix.filter="string"==typeof t&&n[t]?n[t]():t.matrix}const n=o.size?o.size:!!o.resize&&o.resize.size;return n&&n.width&&n.height&&(i.targetSize={width:n.width,height:n.height}),i},e.locale_en_gb=US,e.markup_editor_defaults=RS,e.markup_editor_locale_en_gb=GS,e.naturalAspectRatioToNumber=e=>{if(void 0===e||No(e))return e;if(!y(e))return!1;const t=e;if(!t.length)return;const[o,i]=t.split(/\/|:/g).map(e=>parseFloat(e.replace(/,/,"."))).filter(Boolean);return!!o&&(i?Math.abs(o/i):o)},e.openDefaultEditor=(e,t)=>aw(pw(e),t),e.openEditor=aw,e.overlayDefaultEditor=(e,t)=>sw(e,pw(t)),e.overlayEditor=sw,e.plugin_annotate=FS,e.plugin_annotate_locale_en_gb=QS,e.plugin_crop=ES,e.plugin_crop_locale_en_gb=ZS,e.plugin_decorate=zS,e.plugin_decorate_locale_en_gb=JS,e.plugin_fill=_S,e.plugin_fill_locale_en_gb=XS,e.plugin_filter=AS,e.plugin_filter_defaults=HS,e.plugin_filter_locale_en_gb=YS,e.plugin_finetune=LS,e.plugin_finetune_defaults=NS,e.plugin_finetune_locale_en_gb=qS,e.plugin_frame=OS,e.plugin_frame_defaults=jS,e.plugin_frame_locale_en_gb=tw,e.plugin_redact=BS,e.plugin_redact_locale_en_gb=ow,e.plugin_resize=WS,e.plugin_resize_locale_en_gb=KS,e.plugin_retouch=VS,e.plugin_retouch_locale_en_gb=iw,e.plugin_sticker=DS,e.plugin_sticker_locale_en_gb=ew,e.processDefaultImage=uw,e.processImage=Ys,e.removeNode=Cg,e.selectionToMask=gw,e.setPlugins=IS,e.shapeGetCenter=Vn,e.shapeGetLength=e=>{if(e.x1)return De(be(e.x1,e.y1),be(e.x2,e.y2))},e.shapeGetLevel=(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}},e.supportsWebGL=$m,e.updateNode=(e,t)=>{const[,,o]=e;Object.assign(o,t)},e.updateShapeById=(e,t,o)=>e.map(e=>e.id!==t?e:o(e)),Object.defineProperty(e,"__esModule",{value:!0})});