/*!
 * Pintura v8.71.2 - Test version
 * (c) 2018-2024 PQINA Inc. - All Rights Reserved
 * License: https://pqina.nl/pintura/license/
 * 
 * This version of Pintura is for testing purposes only.
 * Visit https://pqina.nl/pintura/ to obtain a commercial license.
 */
/* eslint-disable */

!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=[{value:65504,name:"jfif"},{value:65498,name:"sos"},{value:65505,subvalue:17784,name:"exif"},{value:65505,subvalue:26740,name:"xmp"},{value:65506,subvalue:19792,name:"mpf"}];var o=e=>{if(65496!==e.getUint16(0))return;const o=e.byteLength;let i,r=2,n=void 0;for(;r<o&&255===e.getUint8(r);){i=e.getUint16(r);const o=t.find((t=>t.value===i&&(!t.subvalue||t.subvalue===e.getUint16(r+2+2))));if(o){const{name:t}=o;n||(n={}),n[t]||(n[t]={offset:r,size:e.getUint16(r+2)})}if(65498===i)break;r+=2+e.getUint16(r+2)}return n};var i=(e,t,i)=>{if(!e)return;const r=new DataView(e),n=o(r);if(!n||!n.exif)return;const a=((e,t)=>{if(65505!==e.getUint16(t))return;const o=e.getUint16(t+2);if(t+=4,1165519206!==e.getUint32(t))return;t+=6;const i=e.getUint16(t);if(18761!==i&&19789!==i)return;const r=18761===i;if(t+=2,42!==e.getUint16(t,r))return;t+=e.getUint32(t+2,r);const n=i=>{const n=[];let a=t;const s=Math.min(e.byteLength,t+o-16);for(;a<s;a+=12){const t=a;e.getUint16(t,r)===i&&n.push(t)}return n};return{read:t=>{const o=n(t);if(o.length)return e.getUint16(o[0]+8,r)},write:(t,o)=>{const i=n(t);return!!i.length&&(i.forEach((t=>e.setUint16(t+8,o,r))),!0)}}})(r,n.exif.offset);return a?void 0===i?a.read(t):a.write(t,i):void 0};const r="__pqina_webapi__";var n=e=>window[r]?window[r][e]:window[e],a=(...e)=>{};const s={ArrayBuffer:"readAsArrayBuffer"};var l=async(e,t=[0,e.size],o)=>await((e,t=a,o={})=>new Promise(((i,r)=>{const{dataFormat:a=s.ArrayBuffer}=o,l=new(n("FileReader"));l.onload=()=>i(l.result),l.onerror=()=>r(l.error),l.onprogress=t,l[a](e)})))(e.slice(...t),o),c=async(e,t)=>{const o=await l(e,[0,262144],t);return i(o,274)||1};let d=null;var u=()=>(null===d&&(d="undefined"!=typeof window&&void 0!==window.document),d);let h=null;var p=()=>new Promise((e=>{if(null===h){const t="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=";let o=u()?new Image:{};return o.onload=()=>{h=1===o.naturalWidth,o=void 0,e(h)},void(o.src=t)}return e(h)})),m=e=>e.getContext("2d").getImageData(0,0,e.width,e.height),g=(e,t,o=[])=>{const i=document.createElement(e),r=Object.getOwnPropertyDescriptors(i.__proto__);for(const e in t)"style"===e?i.style.cssText=t[e]:r[e]&&r[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 $={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 f=e=>{e.width=1,e.height=1;const t=e.getContext("2d");t&&t.clearRect(0,0,1,1)},y=e=>"data"in e,b=e=>u()?RegExp(e).test(window.navigator.userAgent):void 0;let x=null;var v=()=>(null===x&&(x=b(/Android/)),x),w=(e,t)=>{const o=g("canvas",{width:e.width,height:e.height});return o.getContext("2d",t).drawImage(e,0,0),o},S=async(e,t=1)=>{const o=await p(),[i,r]=o||t<5?[e.width,e.height]:[e.height,e.width],n=g("canvas",{width:i,height:r}),a=n.getContext("2d",{willReadFrequently:!0});if(y(e)&&!o&&t>1){const t=g("canvas",{width:e.width,height:e.height});t.getContext("2d",{willReadFrequently:!0}).putImageData(e,0,0),e=t}if(!o&&t>1&&a.transform.apply(a,((e,t,o=-1)=>(-1===o&&(o=1),$[o](e,t)))(e.width,e.height,t)),y(e)){if(a.putImageData(e,0,0),v())return w(n)}else a.drawImage(e,0,0);return e instanceof HTMLCanvasElement&&f(e),n},k=async(e,t=1)=>1===t||await p()?e:m(await S(e,t)),C=e=>"object"==typeof e;const T=e=>e instanceof HTMLElement?e:C(e)?M(e):e,M=e=>{let t;return Array.isArray(e)?(t=[],e.forEach(((e,o)=>{t[o]=T(e)}))):(t={},Object.keys(e).forEach((o=>{const i=e[o];t[o]=T(i)}))),t};var R=e=>"string"==typeof e,P=e=>"function"==typeof e,E=(e,t)=>new Promise(((o,i)=>{const r=()=>o(((e,{width:t,height:o,canvasMemoryLimit:i,contextOptions:r})=>{let n=t||e.naturalWidth,a=o||e.naturalHeight;n||a||(n=300,a=150);const s=n*a;if(i&&s>i){const e=Math.sqrt(i)/Math.sqrt(s);n=Math.floor(n*e),a=Math.floor(a*e)}const l=g("canvas");return l.width=n,l.height=a,l.getContext("2d",r).drawImage(e,0,0,n,a),l})(e,t));e.complete&&e.width?r():(e.onload=r,e.onerror=()=>i(new Error("Failed to load image")))})),I=()=>"createImageBitmap"in window,A=e=>/svg/.test(e.type),L=()=>Math.random().toString(36).substring(2,9);const z=new Map;var F=(e,t,o)=>new Promise(((i,r)=>{const n=e.toString();let a=z.get(n);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,r=new Worker(o);a={url:o,worker:r,messages:i,terminationTimeout:void 0,terminate:()=>{clearTimeout(a.terminationTimeout),a.worker.terminate(),URL.revokeObjectURL(o),z.delete(n)}},r.onmessage=function(e){const{id:t,content:o,error:r}=e.data;if(clearTimeout(a.terminationTimeout),a.terminationTimeout=setTimeout((()=>{i.size>0||a.terminate()}),500),!i.has(t))return;const n=i.get(t);i.delete(t),null!=r?n.reject(r):n.resolve(o)},z.set(n,a)}const s=L();a.messages.set(s,{resolve:i,reject:r}),a.worker.postMessage({id:s,content:t},o)})),D=async(e,t)=>{const o=async()=>{const o=await(async(e,t)=>{const o=g("img",{src:URL.createObjectURL(e)}),i=await E(o,t);return URL.revokeObjectURL(o.src),i})(e,{canvasMemoryLimit:t,contextOptions:{willReadFrequently:!0}}),i=m(o);return f(o),i};if(v())return await o();let i;if(I()&&!A(e)&&"OffscreenCanvas"in window)try{i=await F(((e,t,o)=>{createImageBitmap(e).then((e=>{let i=e.width,r=e.height;const n=i*r;if(t&&n>t){const e=Math.sqrt(t)/Math.sqrt(n);i=Math.floor(i*e),r=Math.floor(r*e)}const a=new OffscreenCanvas(i,r),s=a.getContext("2d",{willReadFrequently:!0});s.drawImage(e,0,0,i,r);const l=s.getImageData(0,0,a.width,a.height);o(null,l)})).catch((e=>{o(e)}))}),[e,t])}catch(e){}return i&&i.width?i:await o()},O=(e,t,o)=>new Promise(((i,r)=>{try{e.toBlob((e=>{if(!e)return r(new Error("Failed to create blob"));i(e)}),t,o)}catch(e){r(e)}})),B=async(e,t,o)=>{const i=await S(e),r=await O(i,t,o);return f(i),r};const W={matroska:"mkv"};var _=e=>{const t=(e.match(/\/([a-z0-9]+)/)||[])[1];if(/^x/.test(t)){const[,t=""]=e.split("/x-");return W[t]}return t},V=e=>e.substr(0,e.lastIndexOf("."))||e;const N=/avif|bmp|gif|jpg|jpeg|jpe|jif|jfif|png|svg|tiff|webp/;var H=e=>{return e&&(t=(o=e,o.split(".").pop()).toLowerCase(),N.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(),r=e.type.length&&!/null|text/.test(e.type),a=r?e.type:o,s=((e,t)=>{const o=H(e);if(o===t)return e;const i=_(t)||o;return`${V(e)}.${i}`})(t,a);try{return new(n("File"))([e],s,{lastModified:i,type:r?e.type:a})}catch(t){const o=r?e.slice():e.slice(0,e.size,a);return o.lastModified=i,o.name=s,o}},U=(e,t)=>e/t,G=e=>e;const Z=Math.PI,X=Math.PI/2,Y=X/2;var q=e=>{const t=Math.abs(e)%Math.PI;return t>Y&&t<Math.PI-Y};const K={Top:"t",Right:"r",Bottom:"b",Left:"l",TopLeft:"tl",TopRight:"tr",BottomRight:"br",BottomLeft:"bl"},{Top:J,Right:Q,Bottom:ee,Left:te,TopLeft:oe,TopRight:ie,BottomRight:re,BottomLeft:ne}=K;var ae={[J]:[.5,0],[Q]:[1,.5],[ee]:[.5,1],[te]:[0,.5],[oe]:[0,0],[ie]:[1,0],[re]:[1,1],[ne]:[0,1]},se=(e,t=12)=>parseFloat(e.toFixed(t));const le=(e,t,o)=>o+(e-o)*t,ce=e=>({x:e.x+.5*e.width,y:e.y+.5*e.height,rx:.5*e.width,ry:.5*e.height}),de=()=>ue(0,0),ue=(e,t)=>({x:e,y:t}),he=e=>ue(e.pageX,e.pageY),pe=e=>ue(e.x,e.y),me=e=>(e.x=-e.x,e.y=-e.y,e),ge=(e,t,o=de())=>{const i=Math.cos(t),r=Math.sin(t),n=e.x-o.x,a=e.y-o.y;return e.x=o.x+i*n-r*a,e.y=o.y+r*n+i*a,e},$e=e=>Math.sqrt(e.x*e.x+e.y*e.y),fe=e=>{const t=Math.sqrt(e.x*e.x+e.y*e.y);return 0===t?de():(e.x/=t,e.y/=t,e)},ye=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),be=(e,t)=>e.x===t.x&&e.y===t.y,xe=(e,t)=>(e.x=t(e.x),e.y=t(e.y),e),ve=(e,t)=>(e.x+=t.x,e.y+=t.y,e),we=(e,t)=>(e.x-=t.x,e.y-=t.y,e),Se=(e,t)=>(e.x/=t,e.y/=t,e),ke=(e,t)=>(e.x*=t,e.y*=t,e),Ce=(e,t)=>e.x*t.x+e.y*t.y,Te=(e,t)=>e.x*t.y-e.y*t.x,Me=(e,t=de())=>{const o=e.x-t.x,i=e.y-t.y;return o*o+i*i},Re=(e,t=de())=>Math.sqrt(Me(e,t)),Pe=(e,t,o)=>(e.x=le(e.x,t,o.x),e.y=le(e.y,t,o.y),e),Ee=e=>{let t=0,o=0;return e.forEach((e=>{t+=e.x,o+=e.y})),ue(t/e.length,o/e.length)},Ie=(e,t,o,i,r)=>(e.forEach((e=>{e.x=t?i-(e.x-i):e.x,e.y=o?r-(e.y-r):e.y})),e),Ae=(e,t,o,i)=>{const r=Math.sin(t),n=Math.cos(t);return e.forEach((e=>{e.x-=o,e.y-=i;const t=e.x*n-e.y*r,a=e.x*r+e.y*n;e.x=o+t,e.y=i+a})),e},Le=(e,t)=>({width:e,height:t}),ze=e=>Le(e.width,e.height),Fe=e=>Le(e.width,e.height),De=e=>Le(e.width,e.height),Oe=e=>Le(e[0],e[1]),Be=e=>{return/img/i.test(e.nodeName)?Le((t=e).naturalWidth,t.naturalHeight):Fe(e);var t},We=(e,t)=>Le(e,t),_e=(e,t,o=G)=>o(e.width)===o(t.width)&&o(e.height)===o(t.height),Ve=(e,t)=>(e.width*=t,e.height*=t,e),Ne=e=>ue(.5*e.width,.5*e.height),He=(e,t)=>{const o=Math.abs(t),i=Math.abs(Math.cos(o)),r=Math.abs(Math.sin(o)),n=i*e.width+r*e.height,a=r*e.width+i*e.height;return e.width=n,e.height=a,e},je=(e,t)=>e.width>=t.width&&e.height>=t.height,Ue=(e,t)=>(e.width=t(e.width),e.height=t(e.height),e),Ge=(e,t)=>({start:e,end:t}),Ze=e=>Ge(pe(e.start),pe(e.end)),Xe=(e,t)=>{if(0===t)return e;const o=ue(e.start.x-e.end.x,e.start.y-e.end.y),i=fe(o),r=ke(i,t);return e.start.x+=r.x,e.start.y+=r.y,e.end.x-=r.x,e.end.y-=r.y,e},Ye=[ue(-1,-1),ue(-1,1),ue(1,1),ue(1,-1)],qe=(e,t,o,i)=>({x:e,y:t,width:o,height:i}),Ke=e=>qe(e.x,e.y,e.width,e.height),Je=()=>qe(0,0,0,0),Qe=e=>qe(0,0,e.width,e.height),et=e=>qe(e[3],e[0],e[1]-e[3],e[2]-e[0]),tt=e=>qe(e.x||0,e.y||0,e.width||0,e.height||0),ot=e=>{let t=e[0].x,o=e[0].x,i=e[0].y,r=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),r=Math.max(r,e.y)})),qe(t,i,o-t,r-i)},it=e=>nt(e.x-e.rx,e.y-e.ry,2*e.rx,2*e.ry),rt=(e,t)=>qe(e.x-.5*t.width,e.y-.5*t.height,t.width,t.height),nt=(e,t,o,i)=>qe(e,t,o,i),at=e=>ue(e.x+.5*e.width,e.y+.5*e.height),st=(e,t)=>(e.x+=t.x,e.y+=t.y,e),lt=(e,t,o)=>(o=o||at(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),ct=(e,t,o,i)=>{const r=(i.x-e.x)/e.width,n=(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-r*a,e.y=i.y-n*s,e.width=a,e.height=s,e},dt=(e,t)=>{const[o,i]=ae[t],r=o*e.width,n=i*e.height;return ue(e.x+r,e.y+n)},ut=(e,t)=>(e.x*=t,e.y*=t,e.width*=t,e.height*=t,e),ht=(e,t,o=G)=>o(e.x)===o(t.x)&&o(e.y)===o(t.y)&&o(e.width)===o(t.width)&&o(e.height)===o(t.height),pt=e=>U(e.width,e.height),mt=(e,t,o,i,r)=>(e.x=t,e.y=o,e.width=i,e.height=r,e),gt=(e,t)=>(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e),$t=(e,t,o)=>(o||(o=at(e)),wt(e).map((e=>ge(e,t,o)))),ft=(e,t)=>qe(.5*e.width-.5*t.width,.5*e.height-.5*t.height,t.width,t.height),yt=(e,t)=>!(t.x<e.x)&&(!(t.y<e.y)&&(!(t.x>e.x+e.width)&&!(t.y>e.y+e.height))),bt=(e,t,o=de())=>{if(0===e.width||0===e.height)return Je();const i=pt(e);t||(t=i);let r=e.width,n=e.height;return t>i?r=n*t:n=r/t,qe(o.x+.5*(e.width-r),o.y+.5*(e.height-n),r,n)},xt=(e,t=pt(e),o=de())=>{if(0===e.width||0===e.height)return Je();let i=e.width,r=i/t;return r>e.height&&(r=e.height,i=r*t),qe(o.x+.5*(e.width-i),o.y+.5*(e.height-r),i,r)},vt=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)],wt=e=>[ue(e.x,e.y),ue(e.x+e.width,e.y),ue(e.x+e.width,e.y+e.height),ue(e.x,e.y+e.height)],St=(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},kt=(e,t,o=at(e))=>wt(e).map(((e,i)=>{const r=Ye[i];return ue(le(e.x,1+r.x*t.x,o.x),le(e.y,1+r.y*t.y,o.y))})),Ct=e=>(e.x=0,e.y=0,e),Tt=e=>{const t=e[0],o=e[e.length-1];e=be(t,o)?e:[...e,t];const i=t.x,r=t.y;let n,a,s,l=0,c=0,d=0,u=0;const h=e.length;for(;c<h;c++)n=e[c],a=e[c+1>h-1?0:c+1],s=(n.y-r)*(a.x-i)-(a.y-r)*(n.x-i),l+=s,d+=(n.x+a.x-2*i)*s,u+=(n.y+a.y-2*r)*s;return s=3*l,ue(i+d/s,r+u/s)},Mt=(e,t)=>Rt(e.start,e.end,t.start,t.end),Rt=(e,t,o,i)=>{const r=(i.y-o.y)*(t.x-e.x)-(i.x-o.x)*(t.y-e.y);if(0===r)return;const n=((i.x-o.x)*(e.y-o.y)-(i.y-o.y)*(e.x-o.x))/r,a=((t.x-e.x)*(e.y-o.y)-(t.y-e.y)*(e.x-o.x))/r;return n<0||n>1||a<0||a>1?void 0:ue(e.x+n*(t.x-e.x),e.y+n*(t.y-e.y))},Pt=(e,t,{ignoreIdenticalLines:o=!1,breakOnIntersection:i=!1}={})=>{const r=t.length,n=[];for(let a=0;a<r-1;a++){if(o&&(be(e.start,t[a])||be(e.start,t[a+1])||be(e.end,t[a])||be(e.end,t[a+1])))continue;const r=Rt(e.start,e.end,t[a],t[a+1]);if(r){if(i)return[r];n.push(r)}}return n.length?n:void 0},Et=(e,t)=>{let o=0,i=0,r=!1;const n=t.length;for(o=0,i=n-1;o<n;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&&(r=!r);return r},It=e=>{const t=[];for(let o=0;o<e.length;o++){let i=o+1;i===e.length&&(i=0),t.push(Ge(pe(e[o]),pe(e[i])))}return t},At=(e,t=0)=>It(e).map((e=>Xe(e,t))),Lt=(e,t,o,i=0,r=!1,n=!1,a=12)=>{const s=[];for(let i=0;i<a;i++)s.push(ue(e.x+t*Math.cos(i*(2*Math.PI)/a),e.y+o*Math.sin(i*(2*Math.PI)/a)));return(r||n)&&Ie(s,r,n,e.x,e.y),i&&Ae(s,i,e.x,e.y),s},zt=(e,t,o,i)=>{const r=ue(e.x-o.x,e.y-o.y),n=ue(i.x-o.x,i.y-o.y),a=Ce(n,n);let s=Ce(r,n)/a;s=s<0?0:s,s=s>1?1:s;const l=ue(n.x*s+o.x-e.x,n.y*s+o.y-e.y);return Ce(l,l)<=t*t},Ft=(e,t,o)=>{const i=o.length;for(let r=0;r<i-1;r++)if(zt(e,t,o[r],o[r+1]))return!0;return!1},Dt=(e,t,o)=>!!Et(e,o)||(!!Ft(e,t,o)||zt(e,t,o[0],o[o.length-1])),Ot=(e,t,o,i,r)=>Dt(e,t,$t(o,i,r||at(o)));var Bt=(e,t)=>{const o=Qe(e),i=at(o),r=$t(o,t,i);return Ct(ot(r))},Wt=(e,t)=>e instanceof HTMLElement&&(!t||new RegExp(`^${t}$`,"i").test(e.nodeName)),_t=e=>e instanceof File,Vt=async(e,t,o)=>{const i=await O(e,t,o);return j(i,"canvas")},Nt=e=>e.split("/").pop().split(/\?|\#/).shift();const Ht=u()&&!!Node.prototype.replaceChildren?(e,t)=>e.replaceChildren(t):(e,t)=>{for(;e.lastChild;)e.removeChild(e.lastChild);void 0!==t&&e.append(t)},jt=u()&&g("div",{class:"PinturaMeasure",style:"position:absolute;left:0;top:0;width:99999px;height:0;pointer-events:none;contain:strict;margin:0;padding:0;"});let Ut;var Gt=e=>(Ht(jt,e),jt.parentNode||document.body.append(jt),clearTimeout(Ut),Ut=setTimeout((()=>{jt.remove()}),500),e);let Zt=null;var Xt=()=>(null===Zt&&(Zt=u()&&/^((?!chrome|android).)*(safari|iphone|ipad)/i.test(navigator.userAgent)),Zt),Yt=e=>new Promise(((t,o)=>{let i=!1;!e.parentNode&&Xt()&&(i=!0,e.style.cssText="position:absolute;visibility:hidden;pointer-events:none;left:0;top:0;width:0;height:0;",Gt(e));const r=()=>{const o=e.naturalWidth,r=e.naturalHeight;o&&r&&(i&&e.remove(),clearInterval(n),t({width:o,height:r}))};e.onerror=e=>{clearInterval(n),o(e)};const n=setInterval(r,1);r()})),qt=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)})),Kt=e=>/^image/.test(e.type),Jt=e=>new Promise((t=>{const o=R(e)?e:URL.createObjectURL(e),i=()=>{const e=new Image;e.src=o,t(e)};if(e instanceof Blob&&Kt(e))return i();const r=document.createElement("video");r.preload="metadata",r.onloadedmetadata=()=>t(r),r.onerror=i,r.src=o})),Qt=e=>"VIDEO"===e.nodeName,eo=async e=>{let t,o;t=e.src?e:await Jt(e);try{o=Qt(t)?await qt(t):await Yt(t)}finally{_t(e)&&URL.revokeObjectURL(t.src)}return o};var to=async e=>{const t=await eo(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=g("canvas",t);i.getContext("2d",{willReadFrequently:!0}).drawImage(o,0,0);const r=await O(i);return j(r,Nt(o.src))},oo=(e=0,t=!0)=>new(n("ProgressEvent"))("progress",{loaded:100*e,total:100,lengthComputable:t}),io=(e,t,o=(e=>e))=>e.getAllResponseHeaders().indexOf(t)>=0?o(e.getResponseHeader(t)):void 0,ro=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 no="URL_REQUEST";class ao extends Error{constructor(e,t,o){super(e),this.name="EditorError",this.code=t,this.metadata=o}}var so=(e,t)=>{const{headers:o={},credentials:i}=t||{};Object.entries(o).forEach((([t,o])=>e.setRequestHeader(t,o))),i&&(e.withCredentials="omit"!==i)},lo=(e,t,o)=>/^data:/.test(e)?(async(e,t="data-uri",o=a)=>{o(oo(0));const i=await fetch(e);o(oo(.33));const r=await i.blob();let n;Kt(r)||(n="image/"+(e.includes(",/9j/")?"jpeg":"png")),o(oo(.66));const s=j(r,t,n);return o(oo(1)),s})(e,void 0,t):((e,t,o)=>new Promise(((i,r)=>{const n=()=>r(new ao("Error fetching image",no,a)),a=new XMLHttpRequest;a.onprogress=t,a.onerror=n,a.onload=()=>{if(!a.response||a.status>=300||a.status<200)return n();const t=io(a,"Content-Type"),o=io(a,"Content-Disposition",ro)||Nt(e);i(j(a.response,o,t||H(o)))};const{willRequest:s}=o;Promise.resolve(s&&s(e,{resourceType:"image"})).then((t=>{if(!1===t)return r("Image load rejected");a.open("GET",e),so(a,t),a.responseType="blob",a.send()})).catch(console.error)})))(e,t,o),co=e=>e instanceof Blob&&!(e instanceof File),uo=e=>"close"in e,ho=async(e,t,o)=>{if(_t(e)||co(e))return e;if(R(e))return await lo(e,t,o);if(Wt(e,"canvas"))return await Vt(e);if(Wt(e,"img"))return await to(e);if(y(e)||uo(e))return await Vt(await S(e));throw new ao("Invalid image source","invalid-image-source")};let po=null;var mo=()=>(null===po&&(po=u()&&/^mac/i.test(navigator.platform)),po);let go=null;var $o=()=>(null===go&&(go=u()&&(b(/iPhone|iPad|iPod/)||mo()&&navigator.maxTouchPoints>=1)),go),fo=async(e,t=1)=>await p()||$o()||t<5?e:We(e.height,e.width),yo=e=>/jpeg/.test(e.type),bo=e=>{return"object"!=typeof(t=e)||t.constructor!=Object?e:JSON.stringify(e);var t},xo=(e,t=0,o)=>(0===t||(e.translate(o.x,o.y),e.rotate(t),e.translate(-o.x,-o.y)),e),vo=(e,t,o)=>(e.scale(t,o),e),wo=async(e,t={})=>{const{flipX:o,flipY:i,rotation:r,crop:n}=t,a=Fe(e),s=o||i,l=!!r,c=n&&(n.x||n.y||n.width||n.height),d=c&&ht(n,Qe(a)),u=c&&!d;if(!s&&!l&&!u)return e;let h,p=g("canvas",{width:e.width,height:e.height});if(p.getContext("2d",{willReadFrequently:!0}).putImageData(e,0,0),s){const e=g("canvas",{width:p.width,height:p.height}).getContext("2d",{willReadFrequently:!0});vo(e,o?-1:1,i?-1:1),e.drawImage(p,o?-p.width:0,i?-p.height:0),e.restore(),f(p),p=e.canvas}if(l){const e=Ue(De(ot($t(tt(p),r))),Math.floor),t=g("canvas",{width:n.width,height:n.height}).getContext("2d",{willReadFrequently:!0});((e,t,o)=>{e.translate(t,o)})(t,-n.x,-n.y),xo(t,r,Ne(e)),t.drawImage(p,.5*(e.width-p.width),.5*(e.height-p.height)),t.restore(),f(p),p=t.canvas}else if(u){return h=p.getContext("2d",{willReadFrequently:!0}).getImageData(n.x,n.y,n.width,n.height),f(p),h}return h=p.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,p.width,p.height),f(p),h},So=(e,t)=>{const{imageData:o,width:i,height:r}=e,n=o.width,a=o.height,s=Math.round(i),l=Math.round(r),c=o.data,d=new Uint8ClampedArray(s*l*4),u=n/s,h=a/l,p=Math.ceil(.5*u),m=Math.ceil(.5*h);for(let e=0;e<l;e++)for(let t=0;t<s;t++){const o=4*(t+e*s);let i=0,r=0,a=0,l=0,g=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))/m,s=(t+.5)*u,d=e*e;for(let e=Math.floor(t*u);e<(t+1)*u;e++){let t=Math.abs(s-(e+.5))/p;const u=Math.sqrt(d+t*t);if(u<-1||u>1)continue;if(i=2*u*u*u-3*u*u+1,i<=0)continue;t=4*(e+o*n);const h=c[t+3];f+=i*h,a+=i,h<255&&(i=i*h/250),l+=i*c[t],g+=i*c[t+1],$+=i*c[t+2],r+=i}}d[o]=l/r,d[o+1]=g/r,d[o+2]=$/r,d[o+3]=f/a}t(null,{data:d,width:s,height:l})},ko=e=>{if(e instanceof ImageData)return e;let t;try{t=new ImageData(e.width,e.height)}catch(o){t=g("canvas").getContext("2d").createImageData(e.width,e.height)}return t.data.set(e.data),t},Co=async(e,t={},o)=>{const{width:i,height:r,fit:n,upscale:a}=t;if(!i&&!r)return e;let s=i,l=r;if(i?r||(l=i):s=r,"force"!==n){const t=s/e.width,o=l/e.height;let i=1;if("cover"===n?i=Math.max(t,o):"contain"===n&&(i=Math.min(t,o)),i>1&&!1===a)return e;s=Math.round(e.width*i),l=Math.round(e.height*i)}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 F(So,[{imageData:e,width:s,height:l}],[e.data.buffer]),ko(e))},To=(e,t)=>{const{imageData:o,matrix:i}=e;if(!i)return t(null,o);const r=new Uint8ClampedArray(o.width*o.height*4),n=o.data,a=n.length,s=i[0],l=i[1],c=i[2],d=i[3],u=i[4],h=i[5],p=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],w=i[15],S=i[16],k=i[17],C=i[18],T=i[19];let M=0,R=0,P=0,E=0,I=0,A=0,L=0,z=0,F=0,D=0,O=0,B=0;for(;M<a;M+=4)R=n[M]/255,P=n[M+1]/255,E=n[M+2]/255,I=n[M+3]/255,A=R*s+P*l+E*c+I*d+u,L=R*h+P*p+E*m+I*g+$,z=R*f+P*y+E*b+I*x+v,F=R*w+P*S+E*k+I*C+T,D=Math.max(0,A*F)+(1-F),O=Math.max(0,L*F)+(1-F),B=Math.max(0,z*F)+(1-F),r[M]=255*Math.max(0,Math.min(1,D)),r[M+1]=255*Math.max(0,Math.min(1,O)),r[M+2]=255*Math.max(0,Math.min(1,B)),r[M+3]=255*I;t(null,{data:r,width:o.width,height:o.height})},Mo=(e,t)=>{const{imageData:o,matrix:i}=e;if(!i)return t(null,o);let r=i.reduce(((e,t)=>e+t));r=r<=0?1:r;const n=o.width,a=o.height,s=o.data;let l=0,c=0,d=0;const u=Math.round(Math.sqrt(i.length)),h=Math.floor(u/2);let p=0,m=0,g=0,$=0,f=0,y=0,b=0,x=0,v=0,w=0;const S=new Uint8ClampedArray(n*a*4);for(d=0;d<a;d++)for(c=0;c<n;c++){for(p=0,m=0,g=0,$=0,y=0;y<u;y++)for(f=0;f<u;f++)b=d+y-h,x=c+f-h,b<0&&(b=a-1),b>=a&&(b=0),x<0&&(x=n-1),x>=n&&(x=0),v=4*(b*n+x),w=i[y*u+f],p+=s[v]*w,m+=s[v+1]*w,g+=s[v+2]*w,$+=s[v+3]*w;S[l]=p/r,S[l+1]=m/r,S[l+2]=g/r,S[l+3]=$/r,l+=4}t(null,{data:S,width:n,height:a})},Ro=(e,t)=>{let{imageData:o,strength:i}=e;if(!i)return t(null,o);const r=new Uint8ClampedArray(o.width*o.height*4),n=o.width,a=o.height,s=o.data,l=(e,t)=>(c=e-w,d=t-S,Math.sqrt(c*c+d*d));let c,d,u,h,p,m,g,$,f,y,b,x=0,v=0,w=.5*n,S=.5*a,k=l(0,0);for(i>0?(u=0,h=0,p=0):(i=Math.abs(i),u=1,h=1,p=1),v=0;v<a;v++)for(x=0;x<n;x++)C=4*(x+v*n),T=s,M=r,R=l(x,v)*i/k,m=T[C]/255,g=T[C+1]/255,$=T[C+2]/255,f=T[C+3]/255,y=1-R,b=y*f+R,M[C]=(y*f*m+R*u)/b*255,M[C+1]=(y*f*g+R*h)/b*255,M[C+2]=(y*f*$+R*p)/b*255,M[C+3]=255*b;var C,T,M,R;t(null,{data:r,width:o.width,height:o.height})},Po=(e,t)=>{const{imageData:o,level:i,monochrome:r=!1}=e;if(!i)return t(null,o);const n=new Uint8ClampedArray(o.width*o.height*4),a=o.data,s=a.length;let l,c,d,u=0;const h=()=>255*(2*Math.random()-1)*i,p=r?()=>{const e=h();return[e,e,e]}:()=>[h(),h(),h()];for(;u<s;u+=4)[l,c,d]=p(),n[u]=a[u]+l,n[u+1]=a[u+1]+c,n[u+2]=a[u+2]+d,n[u+3]=a[u+3];t(null,{data:n,width:o.width,height:o.height})},Eo=(e,t)=>{const{imageData:o,level:i}=e;if(!i)return t(null,o);const r=new Uint8ClampedArray(o.width*o.height*4),n=o.data,a=n.length;let s,l,c,d=0;for(;d<a;d+=4)s=n[d]/255,l=n[d+1]/255,c=n[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),r[d+3]=n[d+3];t(null,{data:r,width:o.width,height:o.height})},Io=async(e,t={})=>{const{colorMatrix:o,convolutionMatrix:i,gamma:r,noise:n,vignette:a}=t,s=[];if(i&&s.push([Mo,{matrix:i.clarity}]),r>0&&s.push([Eo,{level:1/r}]),o&&!(e=>{const t=e.length;let o;const i=t>=20?6:t>=16?5:3;for(let r=0;r<t;r++){if(o=e[r],1===o&&r%i!=0)return!1;if(0!==o&&1!==o)return!1}return!0})(o)&&s.push([To,{matrix:o}]),(n>0||n<0)&&s.push([Po,{level:n}]),(a>0||a<0)&&s.push([Ro,{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 F(c,[{imageData:e,filterInstructions:s.map((e=>e[1]))}],[e.data.buffer]),ko(e)},Ao=e=>"number"==typeof e,Lo=e=>R(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),zo=(e,t)=>e.hasOwnProperty(t),Fo=e=>Array.isArray(e);let Do=64,Oo=102,Bo=112,Wo=!1;var _o=(e,t)=>(!Wo&&u()&&(/^win/i.test(navigator.platform)&&(Oo=103),($o()||mo())&&(Do=63.5,Oo=110,Bo=123),Wo=!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="${Do}" y="${Oo}" alignment-baseline="text-top" dominant-baseline="text-top" text-anchor="middle" font-size="${Bo}px">${e}</text></svg>`),Vo=e=>e instanceof Blob,No=(e,t)=>e/t*100+"%",Ho=e=>`rgba(${Math.round(255*e[0])}, ${Math.round(255*e[1])}, ${Math.round(255*e[2])}, ${Ao(e[3])?e[3]:1})`,jo=e=>Object.values(e).join("_");const Uo=async(e,t=0)=>{const o=g("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 Uo(e,t+16)},Go=new Map;var Zo=e=>new Promise(((t,o)=>{const i=new FileReader;i.onerror=()=>o(i.error),i.onload=()=>t(i.result),i.readAsDataURL(e)})),Xo=()=>{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)))}}};let Yo=null;var qo=()=>(null===Yo&&(Yo=b(/Firefox/)),Yo);const Ko=32,Jo=({color:e=[0,0,0],fontSize:t=16,fontFamily:o="sans-serif",fontVariant:i="normal",fontWeight:r="normal",fontStyle:n="normal",textAlign:a="left",letterSpacing:s="normal",lineHeight:l=20},c=1)=>`font-size:${t*c}px;font-style:${n};font-weight:${r};font-family:${o};font-variant:${i};line-height:${l*c}px;text-align:${a};letter-spacing:${Ao(s)?s+"px":"normal"};color:${Ho(e)};`,Qo=(e,t,o=1)=>{const{width:i,height:r,disableNewline:n}=t,a=!i,s=!1===n?((e="")=>e.split("\n").length)(e):void 0,l=a?"normal":"break-word",c=a&&!s?"nowrap":"pre-line";return`max-width:none;min-width:auto;width:${a?"auto":i*o+"px"};height:${r?r*o+"px":"auto"};margin-top:0;margin-bottom:0;padding-top:${(({fontSize:e=16,lineHeight:t=20}={})=>.5*Math.max(0,e-t))(t)*o}px;word-break:${l};word-wrap:normal;white-space:${c};`},ei=new Map,ti=e=>{const t=[];for(const o of Array.from(e.childNodes))o.nodeType===Node.TEXT_NODE?t.push(ii(o)):t.push(...ti(o));return t},oi="pointer-events:none;visibility:hidden;position:absolute;left:0;top:0;",ii=e=>{const t=e.nodeValue;if(!t)return[];const o=t.length,i=document.createRange();i.selectNodeContents(e);const r=[];for(let n=0;n<o;n++){i.setStart(e,0),i.setEnd(e,n+1);const o=i.getClientRects().length-1,a=t.charAt(n);r[o]?r[o]+=a:r.push(a)}const n=i.getClientRects();return r.map(((e,t)=>({rect:n[t],text:e})))},ri=new Map,ni=(e="",t)=>{const{width:o=0,height:i=0}=t;if(o&&i)return We(o,i);let{fontSize:r=16,fontFamily:n,lineHeight:a=20,fontWeight:s,fontStyle:l,fontVariant:c,letterSpacing:d}=t;const u=jo({text:e,fontFamily:n,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:r,letterSpacing:d,lineHeight:a,width:o});let h=ri.get(u);if(h)return h;let p=1;r>1e3&&qo()&&(p=r/1e3,r=1e3,a/=p);const m=Gt(g("pre",{contenteditable:"true",spellcheck:"false",style:`${oi}${Jo({...t,fontSize:r,lineHeight:a})};${Qo(e,t)}"`,innerHTML:e})).getBoundingClientRect();return h=Fe(m),h.height+=Math.max(0,r-a),h=Ue(h,(e=>e*p)),o&&(h.width=o),ri.set(u,h),h},ai=new Map,si=(e,t)=>new Promise(((o,i)=>{let r=ai.get(e);void 0===r&&(r=((e,t)=>{const{sub:o,pub:i}=Xo();let r,n;return Promise.resolve(t&&t(e,{resourceType:"stylesheet"})).then((t=>{if(!1===t)return n="requestPrevented",i("error",n);const{headers:o,credentials:a}=t||{};fetch(e,{headers:o,credentials:a}).then((e=>e.text())).then((e=>{r=e,i("load",r)})).catch((e=>{n=e,i("error",n)}))})),{sub:(e,t)=>"load"===e&&r?t(r):"error"===e&&n?t(n):void o(e,t)}})(e,t),ai.set(e,r)),r.sub("load",o),r.sub("error",i)})),li=async(e,t)=>{let o;try{o=await si(e,t)}catch(e){return[]}const i=g("style",{innerHTML:o,id:L()});document.head.append(i);const r=Array.from(document.styleSheets).find((e=>e.ownerNode.id===i.id));return i.remove(),Array.from(r.cssRules)},ci=new Map,di=async(e,t)=>{if(ci.has(e.href))return ci.get(e.href);let o;try{o=Array.from(e.cssRules);for(const e of(e=>e.filter((e=>e instanceof CSSImportRule)))(o)){const i=e.href;if(ci.has(i)){const e=ci.get(i);o=[...o,...e];continue}const r=await li(i,t);ci.set(i,r),o=[...o,...r]}}catch(i){const r=e.href;o=await li(r,t),ci.set(r,o)}return(e=>e.filter((e=>e instanceof CSSFontFaceRule)))(o)},ui=(e,t)=>e.style.getPropertyValue(t),hi=(e,t)=>{if(!e.style)return!1;return ui(e,"font-family").replace(/^"|"$/g,"")==t},pi=async(e,t)=>{const o=((e,t)=>{const o=[];for(const i of e)hi(i,t)&&o.push(i);return o})(await(async e=>{const t=Array.from(document.styleSheets).map((t=>di(t,e))),o=await Promise.all(t),i=[];return o.forEach((e=>i.push(...e))),i})(t),e);return o.length?o.map((e=>{const t=e.parentStyleSheet.href&&new URL(e.parentStyleSheet.href),o=t?t.origin+(e=>e.pathname.split("/").slice(0,-1).join("/"))(t)+"/":"",i=e.style.getPropertyValue("src").match(/url\("?(.*?)"?\)/)[1],r=Array.from(e.style).filter((e=>"src"!=e)).reduce(((t,o)=>t+=o+":"+ui(e,o)+";"),"");return[/^http/.test(i)?i:o+i,r]})):[]},mi=new Map,gi=new Map;var $i=async(e="",t)=>{if(!e.length)return;let{color:o,imageWidth:i=300,imageHeight:r=150,paddingTop:n=0,paddingRight:a=Ko,paddingBottom:s=0,paddingLeft:l=Ko,fontFamily:c,fontSize:d,pixelRatio:u=1,willRequest:h,outline:p,blur:m}=t,g=1,$="";d>1e3&&qo()&&(g=d/1e3,$=`transform-origin:0 0;transform:scale(${g})`);const f=u/g,y=(i+l+a)*u,b=(r+s+n)*u,x=await(async(e,t)=>{if(mi.get(e))return;let o=gi.get(e);if(!o){const r=await pi(e,t);if(!r.length)return void mi.set(e,!0);const n=[];for(const[e,t]of r){const o=await fetch(e).then((e=>e.blob())),r=!(i=o.type)||/woff2/.test(i)?"woff2":/woff/.test(i)?"woff":/ttf|truetype/.test(i)?"truetype":/otf|opentype/.test(i)?"opentype":/svg/.test(i)?"svg":"woff2",a=await Zo(o);n.push(`@font-face { src:url(${a}) format('${r}');${t};font-display:block; }`)}o=n.join(""),gi.set(e,o)}var i;return o})(c,h);const v=e.replace(/%/g,"%25").replace(/#/g,"%23").replace(/&nbsp;/g," ").replace(/&(?!#\d{4};|[a-z]+;)/gi,"&amp;").replace(/<br>|\n/g,"<br/>"),w=`top:${n*f}px;right:${a*f}px;bottom:${s*f}px;left:${l*f}px`;let S=o,k="",C="";if(p||m){const e=Ho(o);p&&(S=[0,0,0,0],k=`-webkit-text-stroke: ${2*p*f}px ${e}`),m&&(Xt()?C=`filter:blur(${m*f*.4}px)`:(S=[0,0,0,0],C=`text-shadow: 0 0 ${m*f}px ${e}`))}return((e,{safariCacheKey:t="*"}={})=>new Promise(((o,i)=>{const r=new Image;r.onerror=()=>i(new Error("Failed to load SVG")),r.onload=()=>{if(!Xt()||!e.includes("@font-face")||Go.has(t))return o(r);Uo(r).then((()=>{Go.set(t,!0),o(r)}))},r.src="data:image/svg+xml,"+e})))(`<svg xmlns="http://www.w3.org/2000/svg" width="${y}" height="${b}" viewBox="0 0 ${y} ${b}"><foreignObject x="0" y="0" width="${y}" height="${b}"><div xmlns="http://www.w3.org/1999/xhtml">${x?`<style>${x}</style>`:""}<pre contenteditable="true" spellcheck="false" style="position:absolute;${w};${Jo({...t,color:S,fontSize:d},f)};${Qo(e,t,f)};${$};${k};${C}">${v}</pre></div></foreignObject></svg>`,{safariCacheKey:c})};const fi=e=>{const t={...e};return M(t)},yi=(e,t={})=>{const o=pt(e);let i,r;const n=t.width||t.rx,a=t.height||t.ry;if(n&&a)return ze(t);if(n||a){i=parseFloat(n||Number.MAX_SAFE_INTEGER),r=parseFloat(a||Number.MAX_SAFE_INTEGER);const e=Math.min(i,r);R(n)||R(a)?(i=e+"%",r=e*o+"%"):(i=e,r=e)}else{const e=10;i=e+"%",r=e*o+"%"}return{[(t.width?"width":t.rx?"rx":void 0)||"width"]:i,[(t.width?"height":t.rx?"ry":void 0)||"height"]:r}},bi=(e,t={})=>{return{width:void 0,height:void 0,...t,aspectRatio:1,backgroundImage:(o=_o(e),"data:image/svg+xml,"+o.replace("<","%3C").replace(">","%3E"))};var o},xi=(e,t={})=>({backgroundColor:[0,0,0,0],...Ri(t)?{}:{width:void 0,height:void 0,aspectRatio:void 0},...t,backgroundImage:R(e)?e:Vo(e)?URL.createObjectURL(e):e}),vi=(e,t)=>{let o;if(R(e)||Vo(e)){const i={...yi(t),backgroundSize:"contain"};o=Lo(e)?bi(e,i):xi(e,i)}else if(e.src){const i=yi(t,e.shape||e),r={...e.shape,...i};if(e.width&&e.height&&!zo(r,"aspectRatio")){const e=gr(i,"width",t),o=gr(i,"height",t);r.aspectRatio=U(e,o)}r.backgroundSize||e.shape||e.width&&e.height||(r.backgroundSize="contain"),o=Lo(e.src)?bi(e.src,r):xi(e.src,r)}else e.shape&&(o=fi(e.shape));return zo(o,"backgroundImage")&&(zo(o,"backgroundColor")||(o.backgroundColor=[0,0,0,0]),zo(o,"disableStyle")||(o.disableStyle=["cornerRadius","backgroundColor","strokeColor","strokeWidth"])),t?pr(o,t):o},wi=e=>ue(e.x1,e.y1),Si=e=>ue(e.x2,e.y2),ki=e=>zo(e,"text"),Ci=e=>ki(e)&&!(Bi(e)||zo(e,"width")),Ti=e=>ki(e)&&(Bi(e)||zo(e,"width")),Mi=e=>!ki(e)&&Wi(e),Ri=e=>zo(e,"rx"),Pi=e=>zo(e,"x1"),Ei=e=>zo(e,"points"),Ii=e=>ki(e)&&e.isEditing,Ai=e=>!zo(e,"opacity")||e.opacity>0,Li=e=>e.isSelected,zi=e=>e.isEditing,Fi=e=>e._isDraft,Di=e=>zo(e,"width")&&zo(e,"height"),Oi=e=>{const t=zo(e,"right"),o=zo(e,"bottom");return t||o},Bi=e=>(zo(e,"x")||zo(e,"left"))&&zo(e,"right")||(zo(e,"y")||zo(e,"top"))&&zo(e,"bottom"),Wi=e=>Di(e)||Bi(e),_i=e=>(e._isDraft=!0,e),Vi=e=>(e._isDraft=!1,e),Ni=(e,t)=>!0!==e.disableStyle&&(!Fo(e.disableStyle)||!t||!e.disableStyle.includes(t)),Hi=e=>!0!==e.disableSelect,ji=e=>!0!==e.disableRemove,Ui=e=>!e.disableFlip&&(!Fi(e)&&!Oi(e)&&(e=>zo(e,"backgroundImage")||zo(e,"text"))(e)),Gi=(e,t)=>!!ki(e)&&(!0!==e.disableInput&&(P(e.disableInput)?e.disableInput(null!=t?t:e.text):t||!0)),Zi=(e,t)=>!0!==e.disableTextLayout&&(!Fo(e.disableTextLayout)||!t||!e.disableTextLayout.includes(t)),Xi=e=>!0!==e.disableManipulate&&!Fi(e)&&!Oi(e),Yi=e=>Xi(e)&&!0!==e.disableMove,qi=e=>(delete e.left,delete e.right,delete e.top,delete e.bottom,e),Ki=e=>(delete e.rotation,e),Ji=e=>(e.strokeWidth=e.strokeWidth||1,e.strokeColor=e.strokeColor||[0,0,0],e),Qi=e=>(e.backgroundColor=e.backgroundColor?e.backgroundColor:e.strokeWidth||e.backgroundImage?void 0:[0,0,0],e),er=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};`))},tr=e=>{if(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",e.textShadow){const[t,o,i,r]=e.textShadow;e.textShadowX=t,e.textShadowY=o,e.textShadowBlur=i,e.textShadowColor=r,delete e.textShadow}if(e.textOutline){const[t,o]=e.textOutline;e.textOutlineWidth=t,e.textOutlineColor=o,delete e.textOutline}return"html"===e.format?er(e):(e=>{er(e);let t=e.text;t=t.replace(/</g,"&gt;"),t=t.replace(/>/g,"&lt;"),e.text=t})(e),Ci(e)?or(e):ir(e)},or=e=>(!1!==e.disableNewline&&(delete e.textAlign,e.text=e.text.replace(/\n/g," ")),qi(e)),ir=e=>(e.textAlign=e.textAlign||"left",e),rr=e=>((e=>{R(e.id)||(e.id=L()),zo(e,"rotation")||(e.rotation=0),zo(e,"opacity")||(e.opacity=1),zo(e,"disableErase")||(e.disableErase=!0)})(e),ki(e)?tr(e):Mi(e)?(e=>{e.cornerRadius=e.cornerRadius||0,e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],Qi(e)})(e):Ei(e)?(e=>{Ji(e),Ki(e),zo(e,"pathClose")||(e.disableResize=!0,zo(e,"disableMove")||(e.disableMove=!0)),qi(e)})(e):Pi(e)?(e=>{Ji(e),e.lineStart=e.lineStart||void 0,e.lineEnd=e.lineEnd||void 0,Ki(e),qi(e)})(e):Ri(e)&&(e=>{e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],Qi(e)})(e),e),nr=e=>ki(e)?"text":Mi(e)?"rectangle":Ei(e)?"path":Pi(e)?"line":Ri(e)?"ellipse":void 0,ar=(e,t)=>parseFloat(e)/100*t,sr=new RegExp(/^x|left|right|^width|rx|fontSize|eraseRadius|feather|cornerRadius|strokeWidth|strokeDash/,"i"),lr=new RegExp(/^y|top|bottom|^height|ry/,"i"),cr=(e,t,{width:o,height:i})=>{if(Array.isArray(t))return t.map((t=>(C(t)&&hr(t,{width:o,height:i}),R(t)&&(t=cr(e,t,{width:o,height:i})),t)));if("string"!=typeof t)return t;if(!t.endsWith("%"))return t;const r=parseFloat(t)/100;return sr.test(e)?se(o*r,6):lr.test(e)?se(i*r,6):t},dr=cr,ur=["lineHeight","textOutlineWidth","textShadowX","textShadowY","textShadowBlur"],hr=(e,t)=>{Object.entries(e).map((([o,i])=>{e[o]=cr(o,i,t)})),e.text&&ur.filter((t=>R(e[t]))).forEach((t=>{var o,i;e[t]=(o=e[t],i=e.fontSize,Math.round(i*(parseFloat(o)/100)))}))},pr=(e,t)=>(hr(e,t),xr(e,t),e),mr=(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},gr=(e,t,o)=>Array.isArray(e[t])?e[t].map((e=>Object.entries(e).reduce(((e,[t,i])=>(e[t]=R(i)?ar(i,mr(t,o)):i,e)),{}))):R(e[t])?ar(e[t],mr(t,o)):e[t],$r=(e,t,o)=>t.reduce(((t,i)=>{const r=gr(e,i,o);return t[i]=r,t}),{}),fr=(e,t,o)=>(Object.keys(t).forEach((i=>((e,t,o,i)=>{if(!R(e[t]))return e[t]=o,e;const r=mr(t,i);return e[t]=void 0===r?o:No(o,r),e})(e,i,t[i],o))),e),yr=(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,r,n]=(e=>{const t=Je(),o=e.strokeWidth||0;if(Mi(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(Pi(e)){const{x1:i,y1:r,x2:n,y2:a}=e,s=Math.abs(Math.min(i,n)),l=Math.abs(Math.max(i,n)),c=Math.abs(Math.min(r,a)),d=Math.abs(Math.min(r,a));t.x=s+.5*o,t.y=l+.5*o,t.width=l-s+o,t.height=d-c+o}else Ri(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&&zo(e,"rotation")&&$t(t,e.rotation),vt(t)})(t);return e.top=Math.min(o,e.top),e.left=Math.min(n,e.left),e.bottom=Math.max(r,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},br=(e,t,o)=>{const i=fi(e);pr(i,t);const r=o(i);return Array.isArray(r)?r:[r]},xr=(e,t)=>{if(zo(e,"left")&&(e.x=e.left),zo(e,"right")&&!R(e.right)){const o=t.width-e.right;zo(e,"left")?(e.x=e.left,e.width=Math.max(0,o-e.left)):zo(e,"width")&&(e.x=o-e.width)}if(zo(e,"top")&&(e.y=e.top),zo(e,"bottom")&&!R(e.bottom)){const o=t.height-e.bottom;zo(e,"top")?(e.y=e.top,e.height=Math.max(0,o-e.top)):zo(e,"height")&&(e.y=o-e.height)}return e},vr=(e,t)=>(Ei(e)&&e.points.filter((e=>Ao(e.x))).forEach((e=>{e.x*=t,e.y*=t})),Pi(e)&&Ao(e.x1)&&(e.x1*=t,e.y1*=t,e.x2*=t,e.y2*=t),Ao(e.x)&&Ao(e.y)&&(e.x*=t,e.y*=t),Ao(e.width)&&Ao(e.height)&&(e.width*=t,e.height*=t),Ao(e.rx)&&Ao(e.ry)&&(e.rx*=t,e.ry*=t),(e=>Ao(e.strokeWidth)&&e.strokeWidth>0)(e)&&(e.strokeWidth*=t),ki(e)&&(e._scale=t,Ao(e.fontSize)&&(e.fontSize*=t),Ao(e.lineHeight)&&(e.lineHeight*=t),Ao(e.width)&&!Ao(e.height)&&(e.width*=t)),zo(e,"cornerRadius")&&Ao(e.cornerRadius)&&(e.cornerRadius*=t),e),wr=e=>{if(Mi(e))return ue(e.x+.5*e.width,e.y+.5*e.height);if(Ri(e))return ue(e.x,e.y);if(e.text){if(Ti(e)){const t=e.height||ni(e.text,e).height;return ue(e.x+.5*e.width,e.y+.5*t)}const t=ni(e.text,e);return ue(e.x+.5*t.width,e.y+.5*t.height)}return Ei(e)?Ee(e.points):Pi(e)?Ee([wi(e),Si(e)]):void 0};var Sr=e=>/canvas/i.test(e.nodeName),kr=(e,t)=>new Promise(((o,i)=>{let r=e,n=!1;const a=()=>{n||(n=!0,P(t)&&Promise.resolve().then((()=>t(We(r.naturalWidth,r.naturalHeight)))))};if(r.src||(r=new Image,R(e)&&new URL(e,location.href).origin!==location.origin&&(r.crossOrigin="anonymous"),r.src=R(e)?e:URL.createObjectURL(e)),r.complete)return a(),o(r);P(t)&&Yt(r).then(a).catch(i),r.onload=()=>{a(),o(r)},r.onerror=()=>i(new Error("Failed to load image"))}));const Cr=new Map([]),Tr=(e,t={})=>new Promise(((o,i)=>{const{onMetadata:r=a,onLoad:n=o,onError:s=i,onComplete:l=a}=t;let c=Cr.get(e);if(c||(c={loading:!1,complete:!1,error:!1,image:void 0,size:void 0,bus:Xo()},Cr.set(e,c)),c.bus.sub("meta",r),c.bus.sub("load",n),c.bus.sub("error",s),c.bus.sub("complete",l),Sr(e)){const t=e,o=t.cloneNode();c.complete=!0,c.image=o,c.size=Be(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=Xo());c.loading||(c.loading=!0,kr(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=Xo()})))})),Mr=(e,t,o,i)=>e.drawImage(t,o.x,o.x,o.width,o.height,i.x,i.y,i.width,i.height);var Rr=async(e,t,o,i,r=Mr,n)=>{e.save(),e.clip(),await r(e,t,o,i,n),e.restore()};const Pr=(e,t,o,i,r)=>{const n=Ke(e);if(i){const e=St(ot(i),se);return e.x*=o.width,e.width*=o.width,e.y*=o.height,e.height*=o.height,{srcRect:e,destRect:n}}const a=nt(0,0,o.width,o.height);if("contain"===t){const t=xt(e,pt(a));n.width=t.width,n.height=t.height,r?(n.x+=r.x,n.y+=r.y):(n.x+=t.x,n.y+=t.y)}else if("cover"===t){const e=bt(n,a.width/a.height);n.width=e.width,n.height=e.height,r?(n.x+=r.x,n.y+=r.y):(n.x+=e.x,n.y+=e.y)}else t?(n.width=t.width,n.height=t.height,r&&(n.x+=r.x,n.y+=r.y)):r&&(n.width=o.width,n.height=o.height,n.x+=r.x,n.y+=r.y);return{srcRect:a,destRect:n}},Er=(e,t)=>(t.cornerRadius>0?((e,t,o,i,r,n)=>{i<2*n&&(n=i/2),r<2*n&&(n=r/2),e.beginPath(),e.moveTo(t+n,o),e.arcTo(t+i,o,t+i,o+r,n),e.arcTo(t+i,o+r,t,o+r,n),e.arcTo(t,o+r,t,o,n),e.arcTo(t,o,t+i,o,n),e.closePath()})(e,t.x,t.y,t.width,t.height,t.cornerRadius):e.rect(t.x,t.y,t.width,t.height),e),Ir=(e,t)=>(t.backgroundColor&&e.fill(),e),Ar=(e,t)=>(t.strokeWidth&&e.stroke(),e);var Lr=async(e,t,o={})=>{const{drawImage:i}=o;if(e.lineWidth=t.strokeWidth?t.strokeWidth:1,e.strokeStyle=t.strokeColor?Ho(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Ho(t.backgroundColor):"none",e.globalAlpha=t.opacity,t.backgroundImage){let o;if(o=Sr(t.backgroundImage)?t.backgroundImage:await Tr(t.backgroundImage),Er(e,t),Ir(e,t),"repeat"===t.backgroundRepeat){const r=t.backgroundPosition||{x:0,y:0},{srcRect:n,destRect:a}=Pr(t,t.backgroundSize||Be(o),Be(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,n,{...a,x:0,y:0});const c=e.createPattern(s,"repeat");e.fillStyle=c,e.save(),e.beginPath(),e.rect(t.x+r.x,t.y+r.y,t.width-r.x,t.height-r.y),e.clip(),e.translate(a.x+r.x,a.y+r.y),e.fill(),f(s),e.restore()}else{const{srcRect:r,destRect:n}=Pr(t,t.backgroundSize,Be(o),t.backgroundCorners,t.backgroundPosition);await Rr(e,o,r,n,i,{feather:t.feather})}return e.beginPath(),Er(e,t),Ar(e,t),[]}return Er(e,t),Ir(e,t),Ar(e,t),[]},zr=async(e,t,o={})=>new Promise((async(i,r)=>{const{drawImage:n}=o;if(e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Ho(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Ho(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 Tr(t.backgroundImage)}catch(e){r(e)}const a=nt(t.x-t.rx,t.y-t.ry,2*t.rx,2*t.ry),{srcRect:s,destRect:l}=Pr(a,t.backgroundSize,Be(o),t.backgroundCorners,t.backgroundPosition);await Rr(e,o,s,l,n),t.strokeWidth&&e.stroke(),i([])}else t.strokeWidth&&e.stroke(),i([])})),Fr=async(e,t,o)=>{const i=t.width&&t.height?Fe(t):ni(t.text,t),r={x:t.x,y:t.y,width:i.width,height:i.height};if(Lr(e,{...t,...r,options:o}),!t.text.length)return[];const{textOutlineWidth:n=0,textShadowX:a=0,textShadowY:s=0,textShadowBlur:l=0,textShadowColor:c,outline:d,blur:u,...h}=t;return t.height&&(e.rect(r.x-n+Math.min(a,0),r.y-n+Math.min(s,0),r.width+n+n+Math.abs(a)+l,r.height+n+Math.abs(s)+l),e.save(),e.clip()),(a||s||l)&&(e.save(),e.translate(a,s),await Dr(e,r,t,{...o,paddingLeft:Ko+l,paddingRight:Ko+l,paddingTop:l,paddingBottom:l,shapeExtendedProps:{color:c,blur:l}}),e.restore()),n&&await Dr(e,r,t,{...o,paddingLeft:Ko+n,paddingRight:Ko+n,paddingTop:n,paddingBottom:n,shapeExtendedProps:{color:t.textOutlineColor,outline:n}}),t.height&&e.restore(),await Dr(e,r,h,{...o,paddingLeft:Ko,paddingRight:Ko,paddingTop:0,paddingBottom:0}),[]};const Dr=async(e,t,o,i)=>{const{willRequest:r,shapeExtendedProps:n,paddingLeft:a,paddingRight:s,paddingTop:l,paddingBottom:c}=i,d=await $i(o.text,{...o,...n,...t,paddingLeft:a,paddingRight:s,paddingTop:l,paddingBottom:c,imageWidth:t.width,imageHeight:t.height,willRequest:r});e.drawImage(d,o.x-a,o.y-l,d.width,d.height)};var Or=async(e,t)=>new Promise((async o=>{e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Ho(t.strokeColor):"none",e.globalAlpha=t.opacity;let i=wi(t),r=Si(t);e.moveTo(i.x,i.y),e.lineTo(r.x,r.y),t.strokeWidth&&e.stroke(),o([])})),Br=async(e,t)=>new Promise(((o,i)=>{if(t.bitmap&&1===t.points.length)return void zr(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?Ho(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Ho(t.backgroundColor):"none",e.globalAlpha=t.opacity;const{points:r}=t;e.lineCap=t.strokeCap,e.lineJoin=t.strokeJoin,e.setLineDash(t.strokeDash||[]),t.pathClose&&e.beginPath(),e.moveTo(r[0].x,r[0].y);const n=r.length;for(let t=1;t<n;t++)e.lineTo(r[t].x,r[t].y);t.pathClose&&e.closePath(),t.strokeWidth&&e.stroke(),t.backgroundColor&&e.fill(),o([])})),Wr=(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 _r=async(e,t,o)=>{e.globalCompositeOperation="subtract"===t.drawMode?"destination-out":"source-over";const i=wr(t);let r;if(xo(e,t.rotation,i),Wr(e,t.flipX,t.flipY,i),Mi(t)?r=Lr:Ri(t)?r=zr:Pi(t)?r=Or:Ei(t)?r=Br:ki(t)&&(r=Fr),r){const i=await r(e,t,o);if(!i.length)return[];return[t,...await Vr(e,i,o)]}return[]};var Vr=async(e,t,o)=>{let i=[];for(const r of t)e.save(),e.beginPath(),i=[...i,...await _r(e,r,o)],e.restore();return i},Nr=async(e,t={})=>{const{shapes:o=[],contextBounds:i=e,transform:r=a,drawImage:n,willRequest:s,canvasMemoryLimit:l,computeShape:c=G,preprocessShape:d=G}=t;if(!o.length)return e;const u=g("canvas");u.width=i.width,u.height=i.height;const h=u.getContext("2d",{willReadFrequently:!0});h.putImageData(e,i.x||0,i.y||0);const p=o.map(fi).map(c).map(d).flat();r(h),await Vr(h,p,{drawImage:n,canvasMemoryLimit:l,willRequest:s});const m=h.getImageData(0,0,u.width,u.height);return f(u),m},Hr=async(e,t={})=>{const{backgroundColor:o,backgroundImage:i}=t,r=!(!o||o&&0===o[3]);if(!i&&!r)return e;const n=g("canvas");n.width=e.width,n.height=e.height;const a=n.getContext("2d",{willReadFrequently:!0});if(a.putImageData(e,0,0),a.globalCompositeOperation="destination-over",r&&(a.fillStyle=Ho(o),a.fillRect(0,0,n.width,n.height)),i){let t;t=Sr(i)?i:await Tr(i);const{srcRect:o,destRect:r}=Pr({x:0,y:0,width:e.width,height:e.height},"cover",{width:t.width,height:t.height});a.drawImage(t,o.x,o.y,o.width,o.height,r.x,r.y,r.width,r.height)}const s=a.getImageData(0,0,n.width,n.height);return f(n),s},jr=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()):[],Ur=(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}),r=i.width*i.height;return((e,t=2)=>Math.round(e*t)/t)(Math.max(.5,.5+(1-r/o)/2),5)};function Gr(){}const Zr=e=>e;function Xr(e,t){for(const o in t)e[o]=t[o];return e}function Yr(e){return e()}function qr(){return Object.create(null)}function Kr(e){e.forEach(Yr)}function Jr(e){return"function"==typeof e}function Qr(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function en(e,...t){if(null==e)return Gr;const o=e.subscribe(...t);return o.unsubscribe?()=>o.unsubscribe():o}function tn(e){let t;return en(e,(e=>t=e))(),t}function on(e,t,o){e.$$.on_destroy.push(en(t,o))}function rn(e,t,o,i){if(e){const r=nn(e,t,o,i);return e[0](r)}}function nn(e,t,o,i){return e[1]&&i?Xr(o.ctx.slice(),e[1](i(t))):o.ctx}function an(e,t,o,i){if(e[2]&&i){const r=e[2](i(o));if(void 0===t.dirty)return r;if("object"==typeof r){const e=[],o=Math.max(t.dirty.length,r.length);for(let i=0;i<o;i+=1)e[i]=t.dirty[i]|r[i];return e}return t.dirty|r}return t.dirty}function sn(e,t,o,i,r,n){if(r){const a=nn(t,o,i,n);e.p(a,r)}}function ln(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 cn(e){const t={};for(const o in e)"$"!==o[0]&&(t[o]=e[o]);return t}function dn(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 un(e,t,o){return e.set(o),t}function hn(e){return e&&Jr(e.destroy)?e.destroy:Gr}const pn="undefined"!=typeof window;let mn=pn?()=>window.performance.now():()=>Date.now(),gn=pn?e=>requestAnimationFrame(e):Gr;const $n=new Set;function fn(e){$n.forEach((t=>{t.c(e)||($n.delete(t),t.f())})),0!==$n.size&&gn(fn)}function yn(e){let t;return 0===$n.size&&gn(fn),{promise:new Promise((o=>{$n.add(t={c:e,f:o})})),abort(){$n.delete(t)}}}function bn(e,t){e.appendChild(t)}function xn(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function vn(e){const t=kn("style");return function(e,t){bn(e.head||e,t),t.sheet}(xn(e),t),t.sheet}function wn(e,t,o){e.insertBefore(t,o||null)}function Sn(e){e.parentNode.removeChild(e)}function kn(e){return document.createElement(e)}function Cn(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Tn(e){return document.createTextNode(e)}function Mn(){return Tn(" ")}function Rn(){return Tn("")}function Pn(e,t,o,i){return e.addEventListener(t,o,i),()=>e.removeEventListener(t,o,i)}function En(e){return function(t){return t.preventDefault(),e.call(this,t)}}function In(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function An(e,t,o){null==o?e.removeAttribute(t):e.getAttribute(t)!==o&&e.setAttribute(t,o)}function Ln(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?e[i]=t[i]:An(e,i,t[i])}function zn(e,t){Object.keys(t).forEach((o=>{!function(e,t,o){t in e?e[t]="boolean"==typeof e[t]&&""===o||o:An(e,t,o)}(e,o,t[o])}))}function Fn(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function Dn(e,t){e.value=null==t?"":t}function On(e,t,{bubbles:o=!1,cancelable:i=!1}={}){const r=document.createEvent("CustomEvent");return r.initCustomEvent(e,o,i,t),r}class Bn{constructor(e=!1){this.is_svg=!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=Cn(t.nodeName):this.e=kn(t.nodeName),this.t=t,this.c(e)),this.i(o)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)wn(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(Sn)}}function Wn(e,t){return new e(t)}const _n=new Map;let Vn,Nn=0;function Hn(e,t,o,i,r,n,a,s=0){const l=16.666/i;let c="{\n";for(let e=0;e<=1;e+=l){const i=t+(o-t)*n(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}`,h=xn(e),{stylesheet:p,rules:m}=_n.get(h)||function(e,t){const o={stylesheet:vn(t),rules:{}};return _n.set(e,o),o}(h,e);m[u]||(m[u]=!0,p.insertRule(`@keyframes ${u} ${d}`,p.cssRules.length));const g=e.style.animation||"";return e.style.animation=`${g?g+", ":""}${u} ${i}ms linear ${r}ms 1 both`,Nn+=1,u}function jn(e,t){const o=(e.style.animation||"").split(", "),i=o.filter(t?e=>e.indexOf(t)<0:e=>-1===e.indexOf("__svelte")),r=o.length-i.length;r&&(e.style.animation=i.join(", "),Nn-=r,Nn||gn((()=>{Nn||(_n.forEach((e=>{const{ownerNode:t}=e.stylesheet;t&&Sn(t)})),_n.clear())})))}function Un(e){Vn=e}function Gn(){if(!Vn)throw new Error("Function called outside component initialization");return Vn}function Zn(e){Gn().$$.on_mount.push(e)}function Xn(e){Gn().$$.after_update.push(e)}function Yn(e){Gn().$$.on_destroy.push(e)}function qn(){const e=Gn();return(t,o,{cancelable:i=!1}={})=>{const r=e.$$.callbacks[t];if(r){const n=On(t,o,{cancelable:i});return r.slice().forEach((t=>{t.call(e,n)})),!n.defaultPrevented}return!0}}function Kn(e,t){return Gn().$$.context.set(e,t),t}function Jn(e){return Gn().$$.context.get(e)}function Qn(e,t){const o=e.$$.callbacks[t.type];o&&o.slice().forEach((e=>e.call(this,t)))}const ea=[],ta=[],oa=[],ia=[],ra=Promise.resolve();let na=!1;function aa(){na||(na=!0,ra.then(pa))}function sa(){return aa(),ra}function la(e){oa.push(e)}function ca(e){ia.push(e)}const da=new Set;let ua,ha=0;function pa(){const e=Vn;do{for(;ha<ea.length;){const e=ea[ha];ha++,Un(e),ma(e.$$)}for(Un(null),ea.length=0,ha=0;ta.length;)ta.pop()();for(let e=0;e<oa.length;e+=1){const t=oa[e];da.has(t)||(da.add(t),t())}oa.length=0}while(ea.length);for(;ia.length;)ia.pop()();na=!1,da.clear(),Un(e)}function ma(e){if(null!==e.fragment){e.update(),Kr(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(la)}}function ga(e,t,o){e.dispatchEvent(On(`${t?"intro":"outro"}${o}`))}const $a=new Set;let fa;function ya(){fa={r:0,c:[],p:fa}}function ba(){fa.r||Kr(fa.c),fa=fa.p}function xa(e,t){e&&e.i&&($a.delete(e),e.i(t))}function va(e,t,o,i){if(e&&e.o){if($a.has(e))return;$a.add(e),fa.c.push((()=>{$a.delete(e),i&&(o&&e.d(1),i())})),e.o(t)}else i&&i()}const wa={duration:0};function Sa(e,t,o,i){let r=t(e,o),n=i?0:1,a=null,s=null,l=null;function c(){l&&jn(e,l)}function d(e,t){const o=e.b-n;return t*=Math.abs(o),{a:n,b:e.b,d:o,duration:t,start:e.start,end:e.start+t,group:e.group}}function u(t){const{delay:o=0,duration:i=300,easing:u=Zr,tick:h=Gr,css:p}=r||wa,m={start:mn()+o,b:t};t||(m.group=fa,fa.r+=1),a||s?s=m:(p&&(c(),l=Hn(e,n,t,i,o,u,p)),t&&h(0,1),a=d(m,i),la((()=>ga(e,t,"start"))),yn((t=>{if(s&&t>s.start&&(a=d(s,i),s=null,ga(e,a.b,"start"),p&&(c(),l=Hn(e,n,a.b,a.duration,0,u,r.css))),a)if(t>=a.end)h(n=a.b,1-n),ga(e,a.b,"end"),s||(a.b?c():--a.group.r||Kr(a.group.c)),a=null;else if(t>=a.start){const e=t-a.start;n=a.a+a.d*u(e/a.duration),h(n,1-n)}return!(!a&&!s)})))}return{run(e){Jr(r)?(ua||(ua=Promise.resolve(),ua.then((()=>{ua=null}))),ua).then((()=>{r=r(),u(e)})):u(e)},end(){c(),a=s=null}}}const ka="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function Ca(e,t){e.d(1),t.delete(e.key)}function Ta(e,t){va(e,1,1,(()=>{t.delete(e.key)}))}function Ma(e,t,o,i,r,n,a,s,l,c,d,u){let h=e.length,p=n.length,m=h;const g={};for(;m--;)g[e[m].key]=m;const $=[],f=new Map,y=new Map;for(m=p;m--;){const e=u(r,n,m),s=o(e);let l=a.get(s);l?i&&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 b=new Set,x=new Set;function v(e){xa(e,1),e.m(s,d),a.set(e.key,e),d=e.first,p--}for(;h&&p;){const t=$[p-1],o=e[h-1],i=t.key,r=o.key;t===o?(d=t.first,h--,p--):f.has(r)?!a.has(i)||b.has(i)?v(t):x.has(r)?h--:y.get(i)>y.get(r)?(x.add(i),v(t)):(b.add(r),h--):(l(o,a),h--)}for(;h--;){const t=e[h];f.has(t.key)||l(t,a)}for(;p;)v($[p-1]);return $}function Ra(e,t){const o={},i={},r={$$scope:1};let n=e.length;for(;n--;){const a=e[n],s=t[n];if(s){for(const e in a)e in s||(i[e]=1);for(const e in s)r[e]||(o[e]=s[e],r[e]=1);e[n]=s}else for(const e in a)r[e]=1}for(const e in i)e in o||(o[e]=void 0);return o}function Pa(e){return"object"==typeof e&&null!==e?e:{}}function Ea(e,t,o){const i=e.$$.props[t];void 0!==i&&(e.$$.bound[i]=o,o(e.$$.ctx[i]))}function Ia(e){e&&e.c()}function Aa(e,t,o,i){const{fragment:r,after_update:n}=e.$$;r&&r.m(t,o),i||la((()=>{const t=e.$$.on_mount.map(Yr).filter(Jr);e.$$.on_destroy?e.$$.on_destroy.push(...t):Kr(t),e.$$.on_mount=[]})),n.forEach(la)}function La(e,t){const o=e.$$;null!==o.fragment&&(Kr(o.on_destroy),o.fragment&&o.fragment.d(t),o.on_destroy=o.fragment=null,o.ctx=[])}function za(e,t,o,i,r,n,a,s=[-1]){const l=Vn;Un(e);const c=e.$$={fragment:null,ctx:[],props:n,update:Gr,not_equal:r,bound:qr(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:qr(),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 n=i.length?i[0]:o;return c.ctx&&r(c.ctx[t],c.ctx[t]=n)&&(!c.skip_bound&&c.bound[t]&&c.bound[t](n),d&&function(e,t){-1===e.$$.dirty[0]&&(ea.push(e),aa(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(e,t)),o})):[],c.update(),d=!0,Kr(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(Sn)}else c.fragment&&c.fragment.c();t.intro&&xa(e.$$.fragment),Aa(e,t.target,t.anchor,t.customElement),pa()}Un(l)}class Fa{$destroy(){La(this,1),this.$destroy=Gr}$on(e,t){if(!Jr(t))return Gr;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 Da=[];function Oa(e,t){return{subscribe:Ba(e,t).subscribe}}function Ba(e,t=Gr){let o;const i=new Set;function r(t){if(Qr(e,t)&&(e=t,o)){const t=!Da.length;for(const t of i)t[1](),Da.push(t,e);if(t){for(let e=0;e<Da.length;e+=2)Da[e][0](Da[e+1]);Da.length=0}}}return{set:r,update:function(t){r(t(e))},subscribe:function(n,a=Gr){const s=[n,a];return i.add(s),1===i.size&&(o=t(r)||Gr),n(e),()=>{i.delete(s),0===i.size&&(o(),o=null)}}}}function Wa(e,t,o){const i=!Array.isArray(e),r=i?[e]:e,n=t.length<2;return Oa(o,(e=>{let o=!1;const a=[];let s=0,l=Gr;const c=()=>{if(s)return;l();const o=t(i?a[0]:a,e);n?e(o):l=Jr(o)?o:Gr},d=r.map(((e,t)=>en(e,(e=>{a[t]=e,s&=~(1<<t),o&&c()}),(()=>{s|=1<<t}))));return o=!0,c(),function(){Kr(d),l()}}))}var _a=e=>e.reduce(((e,t)=>Object.assign(e,t)),{});const Va=e=>({updateValue:e}),Na=e=>({defaultValue:e}),Ha=e=>({store:e}),ja=e=>({store:(t,o)=>Wa(...e(o))}),Ua=e=>({store:(t,o)=>{const[i,r,n=(()=>!1)]=e(o);let a,s=!0;return Wa(i,((e,t)=>{r(e,(e=>{!s&&n(a,e)||(a=e,s=!1,t(e))}))}))}}),Ga=e=>({store:(t,o)=>{const[i,r={},n]=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);n&&e.sort(n),a=[...e],h(e)};Object.entries(r).map((([e,t])=>t.subscribe((t=>{s[e]=t,t&&d()}))));const{subscribe:u,set:h}=Ba(t||[]);return{set:c,update:e=>c(e(a)),subscribe:u}}});var Za=e=>{const t={},o={};return e.forEach((([e,...i])=>{const r=_a(i),n=t[e]=((e,t,o)=>{const{store:i=(e=>Ba(e)),defaultValue:r=a,updateValue:n}=o,s=i(r(),t,e),{subscribe:l,update:c=a}=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}))},h=n?n(e):G;return s.set=e=>c((t=>h(e,t,u))),s.defaultValue=r,s})(o,t,r),s={get:()=>tn(n),set:n.set};Object.defineProperty(o,e,s)})),{stores:t,accessors:o}};var Xa=[["src",Ha((()=>{let e;const{subscribe:t,set:o}=Ba(),i=t=>{e!==t&&(e=t,o(e))};return{set:i,subscribe:t,update:t=>i(t(e))}}))],["imageReader"],["imageWriter"],["imageScrambler"],["imageRedactionRendering",Na((()=>"pixelated"))],["images",Na((()=>[]))],["shapePreprocessor"],["willRequestResource"],["willRequest"]],Ya=e=>e.charAt(0).toUpperCase()+e.slice(1),qa=(e,t)=>{Object.keys(t).forEach((o=>{const i=P(t[o])?{value:t[o],writable:!1}:t[o];Object.defineProperty(e,o,i)}))};const Ka=(e,t)=>{let o,i,r,n,a,s,l,c,d,u;const h=t.length;for(o=0;o<h;o++)if(i=t[o],r=t[o+1>h-1?0:o+1],n=i.x-e.x,a=i.y-e.y,s=r.x-e.x,l=r.y-e.y,c=n-s,d=a-l,u=c*a-d*n,u<-1e-5)return!1;return!0},Ja=1e4;var Qa=(e,t)=>{const o=It(t),i=de();wt(e).forEach((e=>{ve(e,i),Ka(e,t)||o.forEach((t=>{const o=Math.atan2(t.start.y-t.end.y,t.start.x-t.end.x),r=Math.sin(Math.PI-o)*Ja,n=Math.cos(Math.PI-o)*Ja,a=ue(e.x+r,e.y+n),s=Xe(Ze(t),Ja),l=Mt(Ge(e,a),s);l&&ve(i,we(pe(l),e))}))}));const r=Ke(e);ve(r,i);return!!wt(r).every((e=>Ka(e,t)))&&(gt(e,r),!0)},es=(e,t)=>{const o=wt(e),i=At(t,5),r=at(e),n=[];o.forEach((e=>{const t=((e,t)=>{if(0===t)return e;const o=ue(e.start.x-e.end.x,e.start.y-e.end.y),i=fe(o),r=ke(i,t);return e.end.x+=r.x,e.end.y+=r.y,e})(Ge(pe(r),pe(e)),1e6);let o=!1;i.map(Ze).forEach((e=>{const i=Mt(t,e);i&&!o&&(n.push(i),o=!0)}))}));const a=Re(n[0],n[2])<Re(n[1],n[3])?[n[0],n[2]]:[n[1],n[3]],s=ot(a);return s.width<e.width&&(gt(e,s),!0)},ts=(e,t,o={x:0,y:0})=>{const i=Qe(e),r=at(i),n=kt(i,o,r).map((e=>ge(e,t,r))),a=ot(n);return n.map((e=>we(e,a)))},os=(e,t=0,o=pt(e))=>{let i,r;if(0!==t){const n=Math.atan2(1,o),a=Math.sign(t)*t,s=a%Math.PI,l=a%X;let c;c=s>Y&&s<X+Y?l>Y?a:X-l:l>Y?X-l:a;const d=Math.min(Math.abs(e.height/Math.sin(n+c)),Math.abs(e.width/Math.cos(n-c)));i=Math.cos(n)*d,r=i/o}else i=e.width,r=i/o,r>e.height&&(r=e.height,i=r*o);return We(i,r)},is=(e,t,o,i,r,n,a,s)=>{const l=ze(a),c=ze(s),d=se(Math.max(t.width/c.width,t.height/c.height)),u=se(Math.min(t.width/l.width,t.height/l.height)),h=Ke(t);if(u<1||d>1){const o=at(e),i=at(t),r=u<1?u:d,n=(i.x+o.x)/2,a=(i.y+o.y)/2,s=h.width/r,l=h.height/r;mt(h,n-.5*s,a-.5*l,s,l)}return n?(((e,t,o=0,i=de(),r)=>{if(Ao(o)&&0!==o||i.x||i.y){const r=pt(e),n=ts(t,o,i),a=os(t,o,r);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)}Qa(e,n),es(e,n)&&Qa(e,n)}else{const o=pt(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=at(e),n=xt(e,o);n.width=Math.max(r.width,n.width),n.height=Math.max(r.height,n.height),n.x=i.x-.5*n.width,n.y=i.y-.5*n.height,gt(e,n)}})(h,o,i,r,l),{crop:h}):{crop:h}},rs=(e,t,o)=>{const i=Qe(e),r=at(i),n=$t(i,o,r),a=at(Ct(ot(n))),s=at(t),l=ge(s,-o,a),c=we(l,a),d=xe(ve(r,c),se);return nt(d.x-.5*t.width,d.y-.5*t.height,t.width,t.height)},ns=(e,t,o)=>Math.max(t,Math.min(e,o));const as=["cropLimitToImage","cropMinSize","cropMaxSize","cropAspectRatio","flipX","flipY","rotation","crop","colorMatrix","convolutionMatrix","gamma","vignette","manipulation","redaction","annotation","decoration","selection","frame","backgroundColor","backgroundImage","targetSize","metadata","trim","volume","minDuration","maxDuration"],ss=e=>Fo(e)?e.map(ss):co(e)||_t(e)?e:C(e)?{...e}:e,ls=e=>e.map((e=>Object.entries(e).reduce(((e,[t,o])=>(t.startsWith("_")||(e[t]=o),e)),{})));const cs=(e,t)=>e===t;var ds=(e,t,o=cs)=>{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 us=(e,t,o)=>{const i=xe(at(e),(e=>se(e,8))),r=Qe(t),n=at(r),a=$t(r,o,n),s=xe(Ne(ot(a)),(e=>se(e,8))),l=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y);return l<1&&c<1},hs=(e,t,o,i,r)=>{if(!r)return[-1/0,1/0];const n=Math.max(o.width/i.width,o.height/i.height),a=We(i.width*n,i.height*n),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),h=u-Math.acos(d/s),p=Math.asin(c/s)-u;if(Number.isNaN(h)&&Number.isNaN(p))return[-1/0,1/0];const m=Number.isNaN(h)?p:Number.isNaN(p)?h:Math.min(h,p);return[-m,m]},ps=(e,t)=>{const{context:o,props:i}=t;return e._isFormatted||((e=rr(e))._isFormatted=!0,Object.assign(e,i)),e._isDraft||!Bi(e)||e._context&&ht(o,e._context)||(xr(e,o),e._context={...o}),e},ms=(e,t)=>(e._isFormatted||(e.disableMove=!0,e.disableSelect=!0,e.disableResize=!0,e.disableRotate=!0),ps(e,t));var gs=[["file"],["size"],["loadState"],["processState"],["aspectRatio",ja((({size:e})=>[e,e=>e?pt(e):void 0]))],["perspectiveX",Na((()=>0))],["perspectiveY",Na((()=>0))],["perspective",ja((({perspectiveX:e,perspectiveY:t})=>[[e,t],([e,t])=>({x:e,y:t})]))],["rotation",Na((()=>0)),Va((e=>(t,o,i)=>{if(t===o)return t;const{loadState:r,size:n,rotationRange:a,cropMinSize:s,cropMaxSize:l,crop:c,perspective:d,cropLimitToImage:u,cropOrigin:h}=e;if(!c||!r||!r.beforeComplete)return t;const p=u&&((e,t,o)=>{const i=os(t,o,pt(e));return _e(Ue(i,Math.round),Ue(ze(e),Math.round))})(c,n,o),m=u&&us(c,n,o),g=((e,t,o,i,r,n,a,s,l,c)=>{const d=ze(l),u=ze(c);a&&(u.width=Math.min(c.width,r.width),u.height=Math.min(c.height,r.height));let h=!1;const p=(t,o)=>{const l=rs(r,i,t),c=Qe(r),m=at(c),g=kt(c,n,m),$=we(pe(m),Tt(g)),f=ge(at(l),o,m),y=we(pe(m),f);g.forEach((e=>ge(e,o,m)));const b=ot(g),x=Tt(g),v=ve(we(we(x,y),b),$),w=nt(v.x-.5*l.width,v.y-.5*l.height,l.width,l.height);if(s&&lt(w,s.width/w.width),a){const e=ts(r,o,n);es(w,e)}const S=se(Math.min(w.width/d.width,w.height/d.height),8),k=se(Math.max(w.width/u.width,w.height/u.height),8);return(S<1||k>1)&&se(Math.abs(o-t))===se(Math.PI/2)&&!h?(h=!0,p(e,e+Math.sign(o-t)*Math.PI)):{rotation:o,crop:St(w,(e=>se(e,8)))}},m=Math.sign(t)*Math.round(Math.abs(t)/X)*X,g=ns(t,m+o[0],m+o[1]);return p(e,g)})(o,t,a,c,n,d,u,h,s,l);if(p&&m){const e=os(n,t,pt(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=St(g.crop,(e=>se(e,8)))})),g.rotation}))],["flipX",Na((()=>!1))],["flipY",Na((()=>!1))],["flip",ja((({flipX:e,flipY:t})=>[[e,t],([e,t])=>({x:e,y:t})]))],["isRotatedSideways",Ua((({rotation:e})=>[[e],([e],t)=>t(q(e)),(e,t)=>e!==t]))],["crop",Va((e=>(t,o=t)=>{const{loadState:i,size:r,cropMinSize:n,cropMaxSize:a,cropLimitToImage:s,cropAspectRatio:l,rotation:c,perspective:d}=e;if(!t&&!o||!i||!i.beforeComplete)return t;t||(t=Qe(os(r,c,l||pt(r))));const u=is(o,t,r,c,d,s,n,a),h=St(u.crop,(e=>se(e,8)));return ht(o,h)?o:h}))],["cropAspectRatio",Va((e=>(t,o)=>{const{loadState:i,crop:r,size:n,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(!r||!i||!i.beforeComplete)return l;const c=o?Math.abs(t-o):1;if(us(r,n,a)&&s&&c>=.1){const o=((e,t)=>{const o=e.width,i=e.height;return q(t)&&(e.width=i,e.height=o),e})(ze(n),a);e.crop=St(xt(Qe(o),t),se)}else{const t={width:r.height*l,height:r.height},o=.5*(r.width-t.width),i=.5*(r.height-t.height);e.crop=St(nt(r.x+o,r.y+i,t.width,t.height),se)}return l}))],["cropOrigin"],["cropMinSize",Na((()=>({width:1,height:1})))],["cropMaxSize",Na((()=>({width:32768,height:32768})))],["cropLimitToImage",Na((()=>!0)),Va((e=>(t,o,i)=>{const{crop:r}=e;return r?(!o&&t&&i((()=>e.crop=Ke(e.crop))),t):t}))],["cropSize",Ua((({crop:e})=>[[e],([e],t)=>{e&&t(We(e.width,e.height))},(e,t)=>_e(e,t)]))],["cropRectAspectRatio",ja((({cropSize:e})=>[[e],([e],t)=>{e&&t(se(pt(e),5))}]))],["cropRange",Ua((({size:e,rotation:t,cropRectAspectRatio:o,cropMinSize:i,cropMaxSize:r,cropLimitToImage:n})=>[[e,t,o,i,r,n],([e,t,o,i,r,n],a)=>{if(!e)return;a(((e,t,o,i,r,n)=>{const a=ze(i),s=ze(r);return n?[a,Ue(os(e,t,o),Math.round)]:[a,s]})(e,t,o,i,r,n))},(e,t)=>ds(e,t)]))],["rotationRange",Ua((({size:e,isRotatedSideways:t,cropMinSize:o,cropSize:i,cropLimitToImage:r})=>[[e,t,o,i,r],([e,t,o,i,r],n)=>{if(!e||!i)return;n(hs(e,t,o,i,r))},(e,t)=>ds(e,t)]))],["backgroundColor",Va((()=>e=>((e=[0,0,0,0],t=1)=>4===e.length?e:[...e,t])(e)))],["backgroundImage"],["targetSize"],["colorMatrix"],["convolutionMatrix"],["gamma"],["noise"],["vignette"],["duration"],["minDuration",Na((()=>1/24))],["maxDuration",Na((()=>1/0))],["trim"],["volume",Na((()=>1))],["redaction",Ga((({size:e})=>[ps,{context:e}]))],["manipulation",Ga((({size:e})=>[ps,{context:e}]))],["annotation",Ga((({size:e})=>[ps,{context:e}]))],["decoration",Ga((({crop:e})=>[ps,{context:e}]))],["selection",Ga((({size:e})=>[ms,{context:e}]))],["frame",Va((()=>e=>{if(!e)return;const t={frameStyle:void 0,x:0,y:0,width:"100%",height:"100%",disableStyle:["backgroundColor","strokeColor","strokeWidth"]};return R(e)?t.frameStyle=e:Object.assign(t,e),t}))],["metadata"],["state",Ha(((e,t,o)=>{const i=as.map((e=>t[e]));let r=!1;const n=Ba({}),{subscribe:a}=Wa([...i,n],((e,t)=>{if(r)return;const o=as.reduce(((t,o,i)=>(t[o]=ss(e[i]),t)),{});o.crop&&St(o.crop,Math.round),o.manipulation=o.manipulation&&ls(o.manipulation),o.redaction=o.redaction&&ls(o.redaction),o.annotation=o.annotation&&ls(o.annotation),o.decoration=o.decoration&&ls(o.decoration),o.selection=o.selection&&ls(o.selection),t(o)})),s=e=>{e&&(r=!0,o.cropOrigin=void 0,as.filter((t=>zo(e,t))).forEach((t=>{const i=e[t];o[t]=null===i?void 0:ss(i)})),r=!1,n.set({}))};return{set:s,update:e=>s(e(null)),subscribe:a}}))]],$s=async(e,t,o={},i)=>{const{ontaskstart:r,ontaskprogress:n,ontaskend:s,token:l}=i;let c=!1;const d={cancel:a};l.cancel=()=>{c=!0,d.cancel()};for(const[i,a]of t.entries()){if(c)return;const[t,l]=a;r(i,l);try{e=await t(e,{...o,taskCancelToken:d},(e=>n(i,l,e)))}catch(e){throw c=!0,e}s(i,l)}return e};const fs=["loadstart","loadabort","loaderror","loadprogress","load","processstart","processabort","processerror","processprogress","process"],ys=["flip","cropOrigin","isRotatedSideways","perspective","perspectiveX","perspectiveY","cropRange"],bs=["images"],xs=gs.map((([e])=>e)).filter((e=>!ys.includes(e))),vs=e=>"image"+Ya(e),ws=e=>zo(e,"crop");var Ss=()=>{const{stores:e,accessors:t}=Za(Xa),{sub:o,pub:i}=Xo(),r=()=>t.images?t.images[0]:{};let n={};const s={};xs.forEach((e=>{Object.defineProperty(t,vs(e),{get:()=>{const t=r();if(t)return t.accessors[e]},set:t=>{n[vs(e)]=t,s[vs(e)]=t;const o=r();o&&(o.accessors[e]=t)}})}));const l=()=>t.images&&t.images[0],c=e.src.subscribe((e=>{if(!e)return t.images=[];t.imageReader&&(t.images.length&&(n={}),u(e))})),d=e.imageReader.subscribe((e=>{e&&(t.images.length||t.src&&u(t.src))})),u=e=>{Promise.resolve().then((()=>p(e,n))).catch((()=>{}))};let h;const p=(e,o={})=>new Promise(((r,c)=>{let d=l();const u=!(!1===o.cropLimitToImage||!1===o.imageCropLimitToImage||!1===s.imageCropLmitedToImage),p=o.cropMinSize||o.imageCropMinSize||s.imageCropMinSize,m=u?p:d&&d.accessors.cropMinSize,$=o.minDuration||o.imageMinDuration;d&&g(),d=(({minSize:e={width:1,height:1},minDuration:t=0}={})=>{const{stores:o,accessors:i}=Za(gs),{pub:r,sub:n}=Xo(),s=(e,t)=>{const o=()=>i[e]||{},n=t=>{i[e]={...o(),...t,timeStamp:Date.now()}},a=()=>o().error,s=e=>{a()||(n({error:e}),r(t+"error",{...o()}))};return{start(){r(t+"start")},onabort(){n({abort:!0}),r(t+"abort",{...o()})},ontaskstart(e,i){a()||(n({index:e,task:i,taskProgress:void 0,taskLengthComputable:void 0}),r(t+"taskstart",{...o()}))},ontaskprogress(e,i,s){a()||(n({index:e,task:i,taskProgress:s.loaded/s.total,taskLengthComputable:s.lengthComputable}),r(t+"taskprogress",{...o()}),r(t+"progress",{...o()}))},ontaskend(e,i){a()||(n({index:e,task:i}),r(t+"taskend",{...o()}))},ontaskerror(e){s(e)},error(e){s(e)},beforeComplete(e){a()||(n({beforeComplete:!0}),r("before"+t,e))},complete(e){a()||(n({complete:!0}),r(t,e))}}};return qa(i,{read:(o,{reader:r},n={})=>{if(!r)return;Object.assign(i,{file:void 0,size:void 0,loadState:void 0});let l={cancel:a},c=!1;const d=s("loadState","load"),u={token:l,...d},h={src:o,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(h,r,n,u);if(c)return d.onabort();const{size:a,duration:s,dest:p}=o||{};if(!a||!a.width||!a.height)throw new ao("Image size missing","IMAGE_SIZE_MISSING",o);if(s>0&&s<t)throw new ao("Video too short","VIDEO_TOO_SHORT",{...o,minDuration:t});if(a.width<e.width||a.height<e.height)throw new ao("Image too small","IMAGE_TOO_SMALL",{...o,minWidth:e.width,minHeight:e.height});Object.assign(i,{file:p,size:a,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(!i.loadState.complete)return;i.processState=void 0;const o=s("processState","process"),r={src:i.file,imageState:i.state,dest:void 0};if(P(e)&&(e=e(i.file,i.state)),!e)return o.start(),void o.complete(r);let n={cancel:a},l=!1;const c=t,d={token:n,...o};return Promise.resolve().then((async()=>{try{if(o.start(),l)return o.onabort();const t=await $s(r,e,c,d);if(l)return o.onabort();o.complete(t)}catch(e){o.error(e)}finally{n=void 0}})),()=>{l=!0,n&&n.cancel()}},on:n}),{accessors:i,stores:o}})({minSize:m,minDuration:$}),fs.map((e=>{return d.accessors.on(e,(t=e,e=>i(t,e)));var t}));const f=()=>{n={},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(ws(o))return void(t.imageState=o);if(!o.imageCrop){const t=e.accessors.size,i=o.imageRotation||0,r=He(ze(t),i),n=Qe(r);n.width=se(Math.abs(n.width),6),n.height=se(Math.abs(n.height),6);const a=o.imageCropAspectRatio||(o.imageCropLimitToImage?pt(t):pt(n));let s;o.imageCropLimitToImage?s=xt(n,a):(s=bt(n,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=>zo(o,e))).forEach((e=>{t[e]=o[e],delete o[e]}));const r=Object.keys(o).filter((e=>!i.includes(e))).reduce(((e,t)=>(e[t]=o[t],e)),{});Object.assign(t,r)})(d,o)))),t.images=[d],o.imageReader&&(t.imageReader=o.imageReader),o.imageWriter&&(t.imageWriter=o.imageWriter),h=d.accessors.read(e,{reader:t.imageReader},{willRequest:t.willRequest})}));let m;const g=()=>{const e=l();e&&(h&&h(),e.accessors.loadState=void 0,t.images=[])};return Object.defineProperty(t,"stores",{get:()=>e}),qa(t,{on:o,loadImage:p,abortLoadImage:()=>{h&&h(),t.images=[]},editImage:(e,o)=>new Promise(((i,r)=>{p(e,o).then((()=>{const{images:e}=t,o=e[0],n=()=>{a(),s()},a=o.accessors.on("processerror",(e=>{n(),r(e)})),s=o.accessors.on("process",(e=>{n(),i(e)}))})).catch(r)})),removeImage:g,processImage:(e,o)=>new Promise(((i,r)=>{try{const n=[],a=()=>{m=void 0,n.forEach((e=>e()))};(async()=>{if((e=>R(e)||Vo(e)||Wt(e))(e))try{await p(e,o)}catch(e){r(e)}else e&&(ws(e)?t.imageState=e:Object.assign(t,e));const s=l();if(!s)return r("no image");n.push(s.accessors.on("processerror",(e=>{a(),r(e)}))),n.push(s.accessors.on("processabort",(()=>{a(),r({name:"AbortError"})}))),n.push(s.accessors.on("process",(e=>{a(),i(e)}))),m=s.accessors.write(t.imageWriter,{redactionRenderStyle:t.imageRedactionRendering,shapePreprocessor:t.shapePreprocessor||G,imageScrambler:t.imageScrambler,willRequest:t.willRequest,willRequestResource:t.willRequestResource})})()}catch(e){r(e)}})),abortProcessImage:()=>{const e=l();e&&(m&&m(),e.accessors.processState=void 0)},destroy:()=>{c&&c(),d&&d()}}),t};const ks=(e,t)=>{const{processImage:o}=Ss();return o(e,t)};var Cs=()=>Xt()?$o()?/15_|16_/.test(navigator.userAgent)?14745600:16777216:/15_/.test(navigator.userAgent)?16777216:1/0:1/0,Ts=(e,t)=>Object.keys(e).filter((e=>!t.includes(e))).reduce(((t,o)=>(t[o]=e[o],t)),{}),Ms=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 Rs=({imageDataResizer:e,canvasMemoryLimit:t}={})=>async(o,i,r,n,a)=>{r.width=Math.max(r.width,1),r.height=Math.max(r.height,1),n.width=Math.max(n.width,1),n.height=Math.max(n.height,1);const{dest:s}=await ks(i,{imageReader:il(),imageWriter:nl({format:"canvas",targetSize:{...n,upscale:!0},imageDataResizer:e,canvasMemoryLimit:t}),imageCrop:r}),{feather:l=0}=a||{};if(l>0){const e=g("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 r=s.getContext("2d");r.globalCompositeOperation="destination-in",r.drawImage(e,0,0),f(e)}o.drawImage(s,n.x,n.y,n.width,n.height),f(s)},Ps=(e,t=((...e)=>e),o)=>async(i,r,n)=>{n(oo(0,!1));let a=!1;const s=await e(...t(i,r,(e=>{a=!0,n(e)})));return o&&o(i,s),a||n(oo(1,!1)),i},Es=({willRequest:e,srcProp:t="src",destProp:o="dest"}={})=>[Ps(ho,((o,i,r)=>[o[t],r,{...i,willRequest:e}]),((e,t)=>e[o]=t)),"any-to-file"],Is=({srcProp:e="dest",destProp:t="dest"}={})=>[Ps((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 Jt(e);/video/i.test(o.nodeName)&&(t="video");const i={type:t+"/unknown"};return _t(e)?new File([e],e.name,{...i,lastModified:e.lastModified}):new Blob([e],i)}return e}),(t=>[t[e]]),((e,o)=>e[t]=o)),"any-to-file"],As=({srcProp:e="src",destProp:t="size"}={})=>[Ps(eo,(t=>[t[e]]),((e,o)=>e[t]=o)),"read-image-size"],Ls=async e=>{const t=await Jt(e);if(Qt(t))return await(e=>new Promise(((t,o)=>{const i=()=>{Ms(e).then((()=>{t(e.duration)}))};if(e.readyState>=1)return i();e.onloadedmetadata=i,e.onerror=()=>o(e.error)})))(t)},zs=({srcProp:e="src",destProp:t="duration"}={})=>[Ps(Ls,(t=>[t[e]]),((e,o)=>e[t]=o)),"read-media-duration"],Fs=({srcSize:e="size",srcOrientation:t="orientation",destSize:o="size"}={})=>[Ps(fo,(o=>[o[e],o[t]]),((e,t)=>e[o]=t)),"image-size-match-orientation"],Ds=({srcProp:e="src",destProp:t="head"}={})=>[Ps(((e,t)=>yo(e)?l(e,t):void 0),(t=>[t[e],[0,262144],onprogress]),((e,o)=>e[t]=o)),"read-image-head"],Os=({srcProp:e="head",destProp:t="orientation"}={})=>[Ps(i,(t=>[t[e],274]),((e,o=1)=>e[t]=o)),"read-exif-orientation-tag"],Bs=({srcProp:e="head"}={})=>[Ps(i,(t=>[t[e],274,1])),"clear-exif-orientation-tag"],Ws=({srcImageSize:e="size",srcCanvasSize:t="imageData",srcImageState:o="imageState",destImageSize:i="size",destScalar:r="scalar"}={})=>[Ps(((e,t)=>[Math.min(t.width/e.width,t.height/e.height),Fe(t)]),(i=>[i[e],i[t],i[o]]),((e,[t,o])=>{e[r]=t,e[i]=o})),"calculate-canvas-scalar"],_s=({srcProp:e="src",destProp:t="imageData",canvasMemoryLimit:o}={})=>[Ps(D,(t=>[t[e],o]),((e,o)=>e[t]=o)),"blob-to-image-data"],Vs=({srcImageData:e="imageData",srcOrientation:t="orientation"}={})=>[Ps(k,(o=>[o[e],o[t]]),((e,t)=>e.imageData=t)),"image-data-match-orientation"],Ns=({srcImageData:e="imageData",srcImageState:t="imageState"}={})=>[Ps(Hr,(o=>[o[e],{backgroundColor:o[t].backgroundColor,backgroundImage:o[t].backgroundImage}]),((e,t)=>e.imageData=t)),"image-data-fill"],Hs=({srcImageData:e="imageData",srcImageState:t="imageState",destScalar:o="scalar"}={})=>[Ps(wo,(i=>{const r=i[o];let{crop:n}=i[t];return n&&1!==r&&(n=lt(Ke(n),r,de())),[i[e],{crop:n,rotation:i[t].rotation,flipX:i[t].flipX,flipY:i[t].flipY}]}),((e,t)=>e.imageData=t)),"image-data-crop"],js=({targetSize:e={width:void 0,height:void 0,fit:void 0,upscale:void 0},imageDataResizer:t,srcProp:o="imageData",srcImageState:i="imageState",destImageScaledSize:r="imageScaledSize"})=>[Ps(Co,(r=>{const n=Math.min(e.width||Number.MAX_SAFE_INTEGER,r[i].targetSize&&r[i].targetSize.width||Number.MAX_SAFE_INTEGER),a=Math.min(e.height||Number.MAX_SAFE_INTEGER,r[i].targetSize&&r[i].targetSize.height||Number.MAX_SAFE_INTEGER);return[r[o],{width:n,height:a,fit:e.fit||"contain",upscale:(s=r[i],!!(s.targetSize&&s.targetSize.width||s.targetSize&&s.targetSize.height)||(e.upscale||!1))},t];var s}),((e,t)=>{_e(e.imageData,t)||(e[r]=Fe(t)),e.imageData=t})),"image-data-resize"],Us=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData"}={})=>[Ps(Io,(o=>{const{colorMatrix:i}=o[t],r=i&&Object.keys(i).map((e=>i[e])).filter(Boolean);return[o[e],{colorMatrix:r&&jr(r),convolutionMatrix:o[t].convolutionMatrix,gamma:o[t].gamma,noise:o[t].noise,vignette:o[t].vignette}]}),((e,t)=>e[o]=t)),"image-data-filter"],Gs=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destScalar:i="scalar"}={})=>[Ps((async(e,t,o,i,r,n)=>{if(!t||!i.length)return e;let a;try{const r={dataSizeScalar:Ur(e,i)};o&&o[3]>0&&(r.backgroundColor=[...o]),a=await t(e,r)}catch(e){}const s=g("canvas");s.width=e.width,s.height=e.height;const l=s.getContext("2d",{willReadFrequently:!0});if(l.putImageData(e,0,0),"auto"===n){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=nt(e.x,e.y,e.width,e.height);ut(t,r);const o=$t(Ke(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),f(a);const d=l.getImageData(0,0,s.width,s.height);return f(s),d}),((o,{imageScrambler:r,redactionRenderStyle:n})=>[o[e],r,o[t].backgroundColor,o[t].redaction,o[i],n]),((e,t)=>e[o]=t)),"image-data-redact"],Zs=({srcImageData:e="imageData",srcSize:t="size",srcImageState:o="imageState",srcShapes:i="annotation",destImageData:r="imageData",destImageScaledSize:n="imageScaledSize",destScalar:a="scalar",imageDataResizer:s,canvasMemoryLimit:l}={})=>[Ps(Nr,((r,{shapePreprocessor:c,willRequestResource:d,willRequest:u})=>{const h=r[o][i];if(!h.length)return[r[e]];const p=r[a],{crop:m}=r[o],g=r[t];let $=p;const f=r[n];f&&($=Math.min(f.width/m.width,f.height/m.height));const y={width:g.width/p,height:g.height/p};return[r[e],{shapes:h,computeShape:e=>(e=pr(e,y),e=Ts(e,["left","right","top","bottom"]),e=vr(e,$)),transform:e=>{const i=r[t],{rotation:s=0,flipX:l,flipY:c,cropLimitToImage:d}=r[o],u=r[a],{crop:h=Qe(i)}=r[o],p=r[n],m=p?Math.min(p.width/h.width,p.height/h.height):1,g={width:i.width/u*m,height:i.height/u*m},$=Bt(g,s),f=$.width,y=$.height,b=.5*g.width-.5*f,x=.5*g.height-.5*y,v=Ne(g);e.translate(-b,-x),e.translate(-h.x*m,-h.y*m),e.translate(v.x,v.y),e.rotate(s),e.translate(-v.x,-v.y),e.scale(l?-1:1,c?-1:1),e.translate(l?-g.width:0,c?-g.height:0),d&&(e.rect(0,0,g.width,g.height),e.clip())},drawImage:Rs({imageDataResizer:s,canvasMemoryLimit:l}),preprocessShape:e=>c(e,{isPreview:!1,...r[o]}),canvasMemoryLimit:l,willRequest:u||d}]}),((e,t)=>e[r]=t)),"image-data-annotate"],Xs=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destImageScaledSize:i="imageScaledSize",imageDataResizer:r,canvasMemoryLimit:n,destScalar:a="scalar"}={})=>[Ps(Nr,((o,{shapePreprocessor:s,willRequestResource:l,willRequest:c})=>{let{decoration:d}=o[t];if("undefined"!=typeof window&&(e=>{if(e&&e._clpdx4s)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:r,height:n}=o[t].crop,a=n/15;d=[...d,{x:.5*-a,y:.5*-a,width:1.5*r,height:1.25*n,text:Array(50).fill(i).join(""),fontWeight:900,lineHeight:a,fontSize:a,color:[1,1,1,.05]}]})(window),!d.length)return[o[e]];let u=o[a];const{crop:h}=o[t],p=o[i];if(p){const e=Math.min(p.width/h.width,p.height/h.height);u=e}return[o[e],{shapes:d,drawImage:Rs({imageDataResizer:r,canvasMemoryLimit:n}),computeShape:e=>(e=pr(e,h),e=Ts(e,["left","right","top","bottom"]),e=vr(e,u)),preprocessShape:e=>s(e,{isPreview:!1,...o[t]}),canvasMemoryLimit:n,willRequest:c||l}]}),((e,t)=>e[o]=t)),"image-data-decorate"],Ys=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destImageScaledSize:i="imageScaledSize",imageDataResizer:r,canvasMemoryLimit:n,destScalar:a="scalar"}={})=>[Ps(Nr,((o,{shapePreprocessor:s,willRequestResource:l,willRequest:c})=>{const d=o[t].frame;if(!d)return[o[e]];const u=o[a];let{crop:h}=o[t];h&&1!==u&&(h=lt(Ke(h),u,de()));const p={...h},m=yr(br(d,p,s),p);p.x=Math.abs(m.left),p.y=Math.abs(m.top),p.width+=Math.abs(m.left)+Math.abs(m.right),p.height+=Math.abs(m.top)+Math.abs(m.bottom);const g=o[i],$=g?Math.min(g.width/h.width,g.height/h.height):1;return ut(p,$),p.x=Math.floor(p.x),p.y=Math.floor(p.y),p.width=Math.floor(p.width),p.height=Math.floor(p.height),[o[e],{shapes:[d],contextBounds:p,computeShape:t=>pr(t,o[e]),transform:e=>{e.translate(p.x,p.y)},drawImage:Rs({imageDataResizer:r,canvasMemoryLimit:n}),preprocessShape:e=>s(e,{isPreview:!1,...o[t]}),canvasMemoryLimit:n,willRequest:c||l}]}),((e,t)=>e[o]=t)),"image-data-frame"],qs=({mimeType:e,quality:t,srcImageData:o="imageData",srcFile:i="src",destBlob:r="blob"}={})=>[Ps(B,(r=>[r[o],e||H(r[i].name)||r[i].type,t]),((e,t)=>e[r]=t)),"image-data-to-blob"],Ks=({srcImageData:e="imageData",srcOrientation:t="orientation",destCanvas:o="dest"}={})=>[Ps(S,(o=>[o[e],o[t]]),((e,t)=>e[o]=t)),"image-data-to-canvas"],Js=async(e,t)=>{if(!yo(e)||!t)return e;const i=new DataView(t),r=o(i);if(!r||!r.exif)return e;const n=["exif","mpf","xmp"].reduce(((e,t)=>r[t]?Math.max(e,r[t].offset+r[t].size):e),0);return((e,t,o=[0,e.size])=>t?new Blob([t,e.slice(...o)],{type:e.type}):e)(e,t.slice(0,n+2),[20])},Qs=(e="blob",t="head",o="blob")=>[Ps(Js,(o=>[o[e],o[t]]),((e,t)=>e[o]=t)),"blob-write-image-head"],el=({renameFile:e,srcBlob:t="blob",srcFile:o="src",destFile:i="dest",defaultFilename:r}={})=>[Ps(j,(i=>[i[t],e?e(i[o]):i[o].name||`${r}.${_(i[t].type)}`]),((e,t)=>e[i]=t)),"blob-to-file"],tl=({url:e="./",dataset:t=(e=>[["dest",e.dest,e.dest.name],["imageState",e.imageState]]),destStore:o="store",credentials:i,headers:r={}})=>[Ps((async(t,o)=>await((e,t,o)=>new Promise(((i,r)=>{const{token:n={},beforeSend:s=a,onprogress:l=a}=o;n.cancel=()=>c.abort();const c=new XMLHttpRequest;c.upload.onprogress=l,c.onload=()=>c.status>=200&&c.status<300?i(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(bo)),e)),new FormData))})))(e,t,{onprogress:o,beforeSend:e=>so(e,{headers:r,credentials:i})})),((e,o,i)=>[t(e),i]),((e,t)=>e[o]=t)),"store"],ol=e=>[Ps((t=>e&&e.length?(Object.keys(t).forEach((o=>{e.includes(o)||delete t[o]})),t):t)),"prop-filter"],il=(e={})=>{const{orientImage:t=!0,outputProps:o=["src","dest","size","duration"],preprocessImageFile:i,request:r={}}=e;return[Es({willRequest:()=>r}),Is(),i&&[Ps(i,((e,t,o)=>[e.dest,t,o]),((e,t)=>e.dest=t)),"preprocess-image-file"],As({srcProp:"dest"}),zs({srcProp:"dest"}),t&&Ds({srcProp:"dest"}),t&&Os(),t&&Fs(),ol(o)].filter(Boolean)},rl=e=>e&&(R(e)?tl({url:e}):P(e)?[e,"store"]:tl(e)),nl=(e={})=>(t,o,i={})=>{if(!Kt(t))return;let{canvasMemoryLimit:r=Cs(),orientImage:n=!0,copyImageHead:a=!0,mimeType:s,quality:l,renameFile:c,targetSize:d,imageDataResizer:u,store:h,format:p="file",outputProps:m=["src","dest","imageState","store"],preprocessImageSource:g,preprocessImageState:$,postprocessImageData:f,postprocessImageBlob:y}={...e,...i};return"blob"===p&&(p="file"),[g&&[Ps(g,((e,t,o)=>[e.src,t,o,e.imageState]),((e,t)=>e.src=t)),"preprocess-image-source"],(n||a)&&Ds(),n&&Os(),As(),$&&[Ps($,((e,t,o,i)=>[e.imageState,t,o,{size:e.size,orientation:e.orientation}]),((e,t)=>e.imageState=t)),"preprocess-image-state"],_s({canvasMemoryLimit:r}),n&&Fs(),n&&Vs(),Ws(),Gs(),Hs(),js({imageDataResizer:u,targetSize:d}),Zs({imageDataResizer:u,canvasMemoryLimit:r,srcShapes:"manipulation"}),Us(),Ns(),Zs({imageDataResizer:u,canvasMemoryLimit:r,srcShapes:"annotation"}),Xs({imageDataResizer:u,canvasMemoryLimit:r}),Ys({imageDataResizer:u,canvasMemoryLimit:r}),f&&[Ps(f,((e,t,o)=>[e.imageData,t,o]),((e,t)=>e.imageData=t)),"postprocess-image-data"],"file"===p?qs({mimeType:s,quality:l}):"canvas"===p?Ks():[e=>(e.dest=e.imageData,e)],"file"===p&&n&&Bs(),"file"===p&&a&&Qs(),y&&[Ps(y,(({blob:e,imageData:t,src:o},i,r)=>[{blob:e,imageData:t,src:o},i,r]),((e,t)=>e.blob=t)),"postprocess-image-file"],"file"===p&&el({defaultFilename:"image",renameFile:c}),"file"===p?rl(h):P(h)&&[h,"store"],ol(m)].filter(Boolean)};var al=(e,t,o,i,r,n,a,s,l,c,d)=>{if(!(e&&t&&o&&i&&s))return;s*=n;const u=Ct(Ke(t)),h=at(u),p=at(e),m=Qe(o),g=at(m),$=rs(o,i,l),f=at($),y=we(pe(g),f),b=we(pe(p),h);y.x+=b.x,y.y+=b.y;const x=me(pe(y));x.x+=b.x,x.y+=b.y;const v=at(st(st(Ke(r),a),e)),w=we(v,p);return ve(y,w),{origin:x,translation:y,rotation:{x:d?Math.PI:0,y:c?Math.PI:0,z:l},scale:s}};let sl=null;var ll=()=>{if(null===sl)if("WebGL2RenderingContext"in window){let e;try{e=g("canvas"),sl=!!e.getContext("webgl2")}catch(e){sl=!1}e&&f(e),e=void 0}else sl=!1;return sl},cl=e=>0==(e&e-1),dl=(e,t={},o="",i="")=>Object.keys(t).filter((e=>!C(t[e]))).reduce(((e,r)=>e.replace(new RegExp(o+r+i),t[r])),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);"},hl={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));"},pl=(e,t,o)=>{const i=e.createShader(o),r=((e,t,o)=>(t=dl(t,o===e.VERTEX_SHADER?ul:hl,"##").trim(),ll()?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,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||console.error(e.getShaderInfoLog(i)),i},ml=(e,t,o,i,r)=>{const n=pl(e,t,e.VERTEX_SHADER),a=pl(e,o,e.FRAGMENT_SHADER),s=e.createProgram();e.attachShader(s,n),e.attachShader(s,a),e.linkProgram(s);const l={};return i.forEach((t=>{l[t]=e.getAttribLocation(s,t)})),r.forEach((t=>{l[t]=e.getUniformLocation(s,t)})),{program:s,locations:l,destroy(){e.detachShader(s,n),e.detachShader(s,a),e.deleteShader(n),e.deleteShader(a),e.deleteProgram(s)}}},gl=e=>"VIDEO"!==e.nodeName&&(!!ll()||cl(e.width)&&cl(e.height)),$l=(e,t,o,i)=>(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,gl(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),gl(t)&&e.generateMipmap(e.TEXTURE_2D)})(e,o,i),e.bindTexture(e.TEXTURE_2D,null),t),fl=(e,t=1)=>e?[e[0],e[1],e[2],Ao(e[3])?t*e[3]:t]:[0,0,0,0],yl=()=>{const e=new Float32Array(16);return e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},bl=(e,t,o,i,r,n,a)=>{const s=1/(t-o),l=1/(i-r),c=1/(n-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]=(r+i)*l,e[14]=(a+n)*c,e[15]=1},xl=(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]},vl=(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},wl=(e,t)=>{const o=Math.sin(t),i=Math.cos(t),r=e[4],n=e[5],a=e[6],s=e[7],l=e[8],c=e[9],d=e[10],u=e[11];e[4]=r*i+l*o,e[5]=n*i+c*o,e[6]=a*i+d*o,e[7]=s*i+u*o,e[8]=l*i-r*o,e[9]=c*i-n*o,e[10]=d*i-a*o,e[11]=u*i-s*o},Sl=(e,t)=>{const o=Math.sin(t),i=Math.cos(t),r=e[0],n=e[1],a=e[2],s=e[3],l=e[8],c=e[9],d=e[10],u=e[11];e[0]=r*i-l*o,e[1]=n*i-c*o,e[2]=a*i-d*o,e[3]=s*i-u*o,e[8]=r*o+l*i,e[9]=n*o+c*i,e[10]=a*o+d*i,e[11]=s*o+u*i},kl=(e,t)=>{const o=Math.sin(t),i=Math.cos(t),r=e[0],n=e[1],a=e[2],s=e[3],l=e[4],c=e[5],d=e[6],u=e[7];e[0]=r*i+l*o,e[1]=n*i+c*o,e[2]=a*i+d*o,e[3]=s*i+u*o,e[4]=l*i-r*o,e[5]=c*i-n*o,e[6]=d*i-a*o,e[7]=u*i-s*o};var Cl=e=>e*Math.PI/180,Tl=(e,t)=>ll()?e.getContext("webgl2",t):e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const Ml=(e,t)=>{const o=e.length;return t>=o?e[t%o]:t<0?e[t%o+o]:e[t]},Rl=(e,t,o,i)=>{const r=ue(o.x-t.x,o.y-t.y),n=ue(i.x-o.x,i.y-o.y),a=ue(t.x-i.x,t.y-i.y),s=ue(e.x-t.x,e.y-t.y),l=ue(e.x-o.x,e.y-o.y),c=ue(e.x-i.x,e.y-i.y),d=Te(r,s),u=Te(n,l),h=Te(a,c);return d<=0&&u<=0&&h<=0},Pl=e=>{if(e.length<3)return[];if((e=>{const t=e.length;for(let o=0;o<t;o++){const t=Ge(e[o],Ml(e,o+1));if(Pt(t,e,{ignoreIdenticalLines:!0,breakOnIntersection:!0}))return!0}return!1})(e))return[];(e=>{let t,o,i,r,n,a=0;const s=e.length;for(t=0;t<s;t++)o=e[t],i=e[(t+1)%s],r=i.x-o.x,n=(i.y+o.y)/2,a+=r*n;return a})(e)<0&&e.reverse();const t=e.length,o=[...Array(t).keys()],i=[];let r,n,a,s,l,c,d,u,h,p,m,g,$=128;for(;o.length>3;){if($<=0)return[];for($--,r=0;r<o.length;r++)if(a=o[r],s=Ml(o,r-1),l=Ml(o,r+1),c=e[a],d=e[s],u=e[l],h=ue(d.x-c.x,d.y-c.y),p=ue(u.x-c.x,u.y-c.y),!(Te(h,p)<0)){for(m=!0,n=0;n<t;n++)if(n!==a&&n!==s&&n!==l&&(g=e[n],Rl(g,d,c,u))){m=!1;break}if(m){i.push([d,c,u]),o.splice(r,1);break}}}return i.push([e[o[0]],e[o[1]],e[o[2]]]),i},El=(e,t,o,i,r)=>{const n=fe(ue(i.x-o.x,i.y-o.y)),a=fe(ue(r.x-i.x,r.y-i.y)),s=fe(ue(n.x+a.x,n.y+a.y)),l=ue(-s.y,s.x),c=ue(-n.y,n.x),d=Math.min(1/Ce(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},Il=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},Al=(e,t=0,o,i)=>{const r=wt(e),n=e.x+.5*e.width,a=e.y+.5*e.height;return(o||i)&&Ie(r,o,i,n,a),0!==t&&Ae(r,t,n,a),r},Ll=(e,t,o,i,r)=>{const n=Math.min(20,Math.max(4,Math.round(i/2)));let a=0,s=0,l=0,c=0,d=0;for(;d<n;d++)a=d/n,s=r*X+a*X,l=i*Math.cos(s),c=i*Math.sin(s),e.push(ue(t+l,o+c))};let zl=null;var Fl=()=>{if(null!==zl)return zl;let e=g("canvas");const t=Tl(e);return zl=t?t.getParameter(t.MAX_TEXTURE_SIZE):void 0,f(e),e=void 0,zl},Dl=()=>u()&&!!window.chrome;const Ol=new Float32Array([0,1,0,0,1,1,1,0]),Bl=new Float32Array([1,0,0,0,1,1,0,1]),Wl=u()&&qo(),_l=[0,0,0,0,1,0,0,0,0],Vl=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],Nl=[0,0,0,0],Hl=[0,0,0,0],jl=(e,t,o,i,r)=>{if(!o||!i)return Ol;let n=i.x/o.width,a=i.y/o.height,s=e/o.width/r,l=t/o.height/r;s-=n,l-=a;return new Float32Array([-n,l,-n,-a,s,l,s,-a])};var Ul=(e,t={})=>{const{alpha:o=!1}=t,i={width:0,height:0},r={width:0,height:0},n=Fl()||1024;let a,s,l;const c=yl(),d=yl();let u,h,p,m,g,$,y,b,x,v=0,w=0,S=0,k=1;const C=new Map([]),T=()=>{P.stencilOp(P.KEEP,P.KEEP,P.KEEP),P.stencilFunc(P.ALWAYS,1,255),P.stencilMask(255)},M=Cl(30),R=Math.tan(M/2),P=Tl(e,{alpha:o,antialias:!1,premultipliedAlpha:!0,stencil:!0});if(!P)return;P.getExtension("OES_standard_derivatives"),P.disable(P.DEPTH_TEST),P.enable(P.STENCIL_TEST),P.enable(P.BLEND),P.blendFunc(P.ONE,P.ONE_MINUS_SRC_ALPHA),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!(!o&&qo())),T();const E=P.createTexture();P.bindTexture(P.TEXTURE_2D,E),P.texImage2D(P.TEXTURE_2D,0,P.RGBA,1,1,0,P.RGBA,P.UNSIGNED_BYTE,new Uint8Array(Nl)),C.set(0,E);const I=P.createTexture();C.set(2,I);const A=P.createFramebuffer(),L=P.createTexture();C.set(1,L);const z=P.createFramebuffer(),F=ml(P,"\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){return(c*m)+(o*c.a);}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 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;}vec4 blendPremultipliedAlpha(vec4 back,vec4 front){return front+(back*(1.0-front.a));}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=P.createBuffer(),O=P.createBuffer();P.bindBuffer(P.ARRAY_BUFFER,O),P.bufferData(P.ARRAY_BUFFER,Ol,P.STATIC_DRAW);const B=P.createBuffer();P.bindBuffer(P.ARRAY_BUFFER,B),P.bufferData(P.ARRAY_BUFFER,Bl,P.STATIC_DRAW);const W=ml(P,"#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"]),_=P.createBuffer();Dl()&&(P.bindBuffer(P.ARRAY_BUFFER,_),P.bufferData(P.ARRAY_BUFFER,1,P.DYNAMIC_DRAW));const V=(e,t,o,i=!1)=>{const{program:r,locations:n}=W;P.useProgram(r),P.enableVertexAttribArray(n.aPosition),P.enableVertexAttribArray(n.aNormal),P.enableVertexAttribArray(n.aMiter);const a=((e,t)=>{let o,i,r,n=0;const a=e.length,s=new Float32Array(10*(t?a+1:a)),l=e[0],c=e[a-1];for(n=0;n<a;n++)o=e[n-1],i=e[n],r=e[n+1],o||(o=t?c:ue(i.x+(i.x-r.x),i.y+(i.y-r.y))),r||(r=t?l:ue(i.x+(i.x-o.x),i.y+(i.y-o.y))),El(s,10*n,o,i,r);return t&&El(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;P.uniform1f(n.uWidth,t),P.uniform1f(n.uSharpness,l),P.uniform4fv(n.uColor,o),P.uniformMatrix4fv(n.uMatrix,!1,u),P.uniform4f(n.uCanvasColor,v,w,S,k),P.uniform1fv(n.uMaskBounds,y),P.uniform1f(n.uMaskOpacity,$),P.bindBuffer(P.ARRAY_BUFFER,_),P.bufferData(P.ARRAY_BUFFER,a,P.STATIC_DRAW),P.vertexAttribPointer(n.aPosition,2,P.FLOAT,!1,s,0),P.vertexAttribPointer(n.aNormal,2,P.FLOAT,!1,s,c),P.vertexAttribPointer(n.aMiter,1,P.FLOAT,!1,s,d),P.drawArrays(P.TRIANGLE_STRIP,0,a.length/5),P.disableVertexAttribArray(n.aPosition),P.disableVertexAttribArray(n.aNormal),P.disableVertexAttribArray(n.aMiter)},N=ml(P,"\n##head\nvoid main(){\n##matrix\n}","\n##head\n##mask\nuniform vec4 uColor;uniform vec4 uCanvasColor;void main(){vec4 fillColor=uColor;\n##maskapply\nfillColor.rgb*=fillColor.a;fillColor.rgb*=m;fillColor.rgb+=(1.0-m)*(uCanvasColor.rgb*fillColor.a);fragColor=fillColor;}",["aPosition"],["uColor","uCanvasColor","uMatrix","uMaskBounds","uMaskOpacity"]),H=P.createBuffer(),j=ml(P,"\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"]),G=P.createBuffer(),Z=P.createBuffer(),X=P.createBuffer(),Y=ml(P,"\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 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*uRadius.x)*(vTexCoordDouble.x*uRadius.x),(vTexCoordDouble.y*uRadius.y)*(vTexCoordDouble.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","uRepeat","uColor","uCanvasColor","uMatrix","uRadius","uInverted","uMaskBounds","uMaskOpacity"]),q=P.createBuffer(),K=P.createBuffer(),J=new Map,Q={2:{width:0,height:0},1:{width:0,height:0}},ee=(e,t,o,r=1)=>{const a=Math.min(Math.min(4096,n)/o.width,Math.min(4096,n)/o.height,r),l=Math.floor(a*o.width),c=Math.floor(a*o.height);_e(o,Q[e])?P.bindFramebuffer(P.FRAMEBUFFER,t):(P.bindTexture(P.TEXTURE_2D,C.get(e)),P.texImage2D(P.TEXTURE_2D,0,P.RGBA,l,c,0,P.RGBA,P.UNSIGNED_BYTE,null),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_MIN_FILTER,P.LINEAR),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_S,P.CLAMP_TO_EDGE),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_T,P.CLAMP_TO_EDGE),P.bindFramebuffer(P.FRAMEBUFFER,t),P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,C.get(e),0),Q[e]=o);const h=o.width*s,p=o.height*s;var m,g;bl(d,0,h,p,0,-1,1),xl(d,0,p,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,P.viewport(0,0,l,c),P.colorMask(!0,!0,!0,!0),P.clearColor(0,0,0,0),P.clear(P.COLOR_BUFFER_BIT),x=[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}=J.get(e);i instanceof HTMLCanvasElement&&(o||i.dataset.retain||f(i)),J.delete(e),P.deleteTexture(e)},oe=e=>J.get(e).isRotatedVideo;return{drawPath:(e,t=0,o=!1,i=!1,r,n,a,l,c)=>{if(e.length<2)return;const d=e.map((e=>({x:e.x*s,y:e.y*s}))),h=r*s;if(h>0&&V(d,h,fl(n,c),a),d.length<3||!l||0===l[3]||!a)return;const p=Pl(d),m=new Float32Array(6*p.length);p.forEach((([e,t,o],i)=>{const r=6*i;m[r+0]=e.x,m[r+1]=e.y,m[r+2]=t.x,m[r+3]=t.y,m[r+4]=o.x,m[r+5]=o.y})),((e,t)=>{const{program:o,locations:i}=N;P.useProgram(o),P.enableVertexAttribArray(i.aPosition),P.uniform4fv(i.uColor,t),P.uniformMatrix4fv(i.uMatrix,!1,u),P.uniform1fv(i.uMaskBounds,y),P.uniform1f(i.uMaskOpacity,$),P.uniform4f(i.uCanvasColor,v,w,S,k),P.bindBuffer(P.ARRAY_BUFFER,H),P.bufferData(P.ARRAY_BUFFER,e,P.STATIC_DRAW),P.vertexAttribPointer(i.aPosition,2,P.FLOAT,!1,0,0),P.drawArrays(P.TRIANGLES,0,e.length/2),P.disableVertexAttribArray(i.aPosition)})(m,fl(l,c))},drawRect:(e,t=0,o=!1,i=!1,r,n,a,l,c,d=!1,h,p,m,g,f,b=1/s,C,T)=>{const M=ut(Ke(e),s),R=r.map((t=>((e,t)=>Math.floor(ns(e,0,Math.min(.5*(t.width-1),.5*(t.height-1)))))(t||0,e))).map((e=>e*s));if(n||a){const e=Ke(M);e.x-=.5,e.y-=.5,e.width+=1,e.height+=1;const r=Al(e,t,o,i),p=Il(r);let m;C&&(m=fl(C),0===m[3]&&(m[3]=.001));const I=l&&d?[e.width/l.width,e.height/l.height]:[1,1];((e,t,o,i,r,n=E,a,l=1,c=Nl,d=Ol,h=x,p=1,m)=>{const{program:g,locations:f}=j;P.useProgram(g),P.enableVertexAttribArray(f.aPosition),P.enableVertexAttribArray(f.aTexCoord),P.enableVertexAttribArray(f.aRectCoord),P.uniform4fv(f.uColor,r),P.uniform2fv(f.uSize,[t,o]),P.uniform2fv(f.uPosition,[e[2],e[3]]),P.uniform2fv(f.uRepeat,a),P.uniform1i(f.uInverted,m?1:0),P.uniform1fv(f.uCornerRadius,i),P.uniform4f(f.uCanvasColor,v,w,S,k),P.uniform1fv(f.uMaskFeather,h.map(((e,t)=>t%2==0?e:e*s))),P.uniform1fv(f.uMaskBounds,y),P.uniform1f(f.uMaskOpacity,$),P.uniform1f(f.uEdgeFeather,Math.max(0,p)),P.uniformMatrix4fv(f.uMatrix,!1,u),P.uniform1i(f.uTexture,4),P.uniform4fv(f.uTextureColor,c),P.uniform1f(f.uTextureOpacity,l),P.activeTexture(P.TEXTURE0+4),P.bindTexture(P.TEXTURE_2D,n),P.bindBuffer(P.ARRAY_BUFFER,Z),P.bufferData(P.ARRAY_BUFFER,d,P.STATIC_DRAW),P.vertexAttribPointer(f.aTexCoord,2,P.FLOAT,!1,0,0),P.bindBuffer(P.ARRAY_BUFFER,X),P.bufferData(P.ARRAY_BUFFER,Ol,P.STATIC_DRAW),P.vertexAttribPointer(f.aRectCoord,2,P.FLOAT,!1,0,0),P.bindBuffer(P.ARRAY_BUFFER,G),P.bufferData(P.ARRAY_BUFFER,e,P.STATIC_DRAW),P.vertexAttribPointer(f.aPosition,2,P.FLOAT,!1,0,0),P.drawArrays(P.TRIANGLE_STRIP,0,e.length/2),P.disableVertexAttribArray(f.aPosition),P.disableVertexAttribArray(f.aTexCoord),P.disableVertexAttribArray(f.aRectCoord)})(p,e.width,e.height,R,fl(n,g),a,I,g,m,h?new Float32Array(h):jl(e.width,e.height,l,c,s),f,b*s,T)}p&&(p=Math.min(p,M.width,M.height),V(((e,t,o,i,r,n,a,s)=>{const l=[];if(n.every((e=>0===e)))l.push(ue(e,t),ue(e+o,t),ue(e+o,t+i),ue(e,t+i));else{const[r,a,s,c]=n,d=e,u=e+o,h=t,p=t+i;l.push(ue(d+r,h)),Ll(l,u-a,h+a,a,-1),l.push(ue(u,h+a)),Ll(l,u-c,p-c,c,0),l.push(ue(u-c,p)),Ll(l,d+s,p-s,s,1),l.push(ue(d,p-s)),Ll(l,d+r,h+r,r,2)}return(a||s)&&Ie(l,a,s,e+.5*o,t+.5*i),r&&Ae(l,r,e+.5*o,t+.5*i),l})(M.x,M.y,M.width,M.height,t,R,o,i),p*s,fl(m,g),!0))},drawEllipse:(e,t,o,i,r,n,a,l,c,d,h,p,m,g,f)=>{const b=ut(nt(e.x-t,e.y-o,2*t,2*o),s);if(a||l){const e=Ke(b);e.x-=.5,e.y-=.5,e.width+=1,e.height+=1;const t=Al(e,i,r,n);((e,t,o,i,r=E,n=Ol,a=1,s=!1)=>{const{program:l,locations:c}=Y;P.useProgram(l),P.enableVertexAttribArray(c.aPosition),P.enableVertexAttribArray(c.aTexCoord),P.uniformMatrix4fv(c.uMatrix,!1,u),P.uniform2fv(c.uRadius,[.5*t,.5*o]),P.uniform1i(c.uInverted,s?1:0),P.uniform4fv(c.uColor,i),P.uniform4f(c.uCanvasColor,v,w,S,k),P.uniform2fv(c.uRepeat,[1,1]),P.uniform1fv(c.uMaskBounds,y),P.uniform1f(c.uMaskOpacity,$),P.uniform1i(c.uTexture,4),P.uniform1f(c.uTextureOpacity,a),P.activeTexture(P.TEXTURE0+4),P.bindTexture(P.TEXTURE_2D,r),P.bindBuffer(P.ARRAY_BUFFER,K),P.bufferData(P.ARRAY_BUFFER,n,P.STATIC_DRAW),P.vertexAttribPointer(c.aTexCoord,2,P.FLOAT,!1,0,0),P.bindBuffer(P.ARRAY_BUFFER,q),P.bufferData(P.ARRAY_BUFFER,e,P.STATIC_DRAW),P.vertexAttribPointer(c.aPosition,2,P.FLOAT,!1,0,0),P.drawArrays(P.TRIANGLE_STRIP,0,e.length/2),P.disableVertexAttribArray(c.aPosition),P.disableVertexAttribArray(c.aTexCoord)})(Il(t),e.width,e.height,fl(a,g),l,h?new Float32Array(h):jl(e.width,e.height,c,d,s),g,f)}p&&V(((e,t,o,i,r,n,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 Lt(ue(e+s,t+l),s,l,r,n,a,d)})(b.x,b.y,b.width,b.height,i,r,n),p*s,fl(m,g),!0)},drawImage:(e,t,o,r,n,l,c,d,u,h,p=Vl,m=1,g,f=1,x=0,v=b,w=Hl,S=Nl,k=!1,T=!1,E=!0)=>{const I=t.width*s,A=t.height*s,L=-.5*I,z=.5*A,W=.5*I,_=-.5*A,V=new Float32Array([L,_,0,L,z,0,W,_,0,W,z,0]);P.bindBuffer(P.ARRAY_BUFFER,D),P.bufferData(P.ARRAY_BUFFER,V,P.STATIC_DRAW);const N=t.height/2/R*(i.height/t.height)*-1;n*=s,l*=s,o*=s,r*=s;const{program:H,locations:j}=F,U=yl();((e,t,o,i,r)=>{const n=1/Math.tan(t/2),a=1/(i-r);e[0]=n/o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(r+i)*a,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*r*i*a,e[15]=0})(U,M,a,1,2*-N),xl(U,n,-l,N),xl(U,o,-r,0),kl(U,-u),vl(U,h),xl(U,-o,r,0),Sl(U,d),wl(U,c),P.useProgram(H),P.enableVertexAttribArray(j.aPosition),P.enableVertexAttribArray(j.aTexCoord),P.uniform1i(j.uTexture,3),P.uniform2f(j.uTextureSize,t.width,t.height),P.activeTexture(P.TEXTURE0+3),P.bindTexture(P.TEXTURE_2D,e);const G=T?1:0,Z=C.get(G);P.uniform1i(j.uTextureBlend,G),P.activeTexture(P.TEXTURE0+G),P.bindTexture(P.TEXTURE_2D,Z);const X=k?2:0,Y=C.get(X);P.uniform1i(j.uTextureOverlay,X),P.activeTexture(P.TEXTURE0+X),P.bindTexture(P.TEXTURE_2D,Y),P.bindBuffer(P.ARRAY_BUFFER,D),P.vertexAttribPointer(j.aPosition,3,P.FLOAT,!1,0,0);const q=Wl&&oe(e);let K;P.bindBuffer(P.ARRAY_BUFFER,q?B:O),P.vertexAttribPointer(j.aTexCoord,2,P.FLOAT,!1,0,0),P.uniformMatrix4fv(j.uMatrix,!1,U),P.uniform4fv(j.uOverlayColor,S),!g||ds(g,_l)?(g=_l,K=-1):(K=g.reduce(((e,t)=>e+t),0),K=K<=0?1:K),P.uniform1fv(j.uClarityKernel,g),P.uniform1f(j.uClarityKernelWeight,K),P.uniform1f(j.uColorGamma,1/f),P.uniform1f(j.uColorVignette,x),P.uniform1i(j.uAntialias,E?1:0),P.uniform4f(j.uColorOffset,p[4],p[9],p[14],p[19]),P.uniformMatrix4fv(j.uColorMatrix,!1,[p[0],p[1],p[2],p[3],p[5],p[6],p[7],p[8],p[10],p[11],p[12],p[13],p[15],p[16],p[17],p[18]]),P.uniform1f(j.uOpacity,m),P.uniform1f(j.uMaskOpacity,$),P.uniform1fv(j.uMaskBounds,y),P.uniform1fv(j.uMaskCornerRadius,w.map((e=>e*s))),P.uniform1fv(j.uMaskFeather,v.map(((e,t)=>t%2==0?e:e*s))),P.drawArrays(P.TRIANGLE_STRIP,0,4),P.disableVertexAttribArray(j.aPosition),P.disableVertexAttribArray(j.aTexCoord)},textureFilterNearest:P.NEAREST,textureFilterLinear:P.LINEAR,textureClamp:P.CLAMP_TO_EDGE,textureRepeat:P.REPEAT,textureCreate:()=>P.createTexture(),textureUpdate:(e,t,o)=>(J.set(e,{src:t,options:o,isRotatedVideo:"VIDEO"===t.nodeName&&(t.dataset&&90==t.dataset.rotation||270==t.dataset.rotation)}),$l(P,e,t,o)),textureGetSize:e=>{const{src:t,options:o}=J.get(e),i=Fe(t);return o.scalar?Ue(i,(e=>e/o.scalar)):i},textureDelete:te,enablePreviewStencil:()=>{P.stencilOp(P.KEEP,P.KEEP,P.REPLACE),P.stencilFunc(P.ALWAYS,1,255),P.stencilMask(255)},applyPreviewStencil:()=>{P.stencilFunc(P.EQUAL,1,255),P.stencilMask(0)},disablePreviewStencil:T,setCanvasColor(e){v=e[0],w=e[1],S=e[2],k=o?e[3]:1,P.clear(P.COLOR_BUFFER_BIT)},resetCanvasMatrix:()=>{bl(c,0,i.width,i.height,0,-1,1)},updateCanvasMatrix(e,t,o,r,n){const a=e.width,l=e.height,d=i.width*(.5/s),u=i.height*(.5/s),h={x:d+(o.x+t.x),y:u+(o.y+t.y)},p={x:h.x-t.x,y:h.y-t.y},m=.5*a,g=.5*l;ge(p,n.z,h),Pe(p,r,h);xl(c,(p.x-m)*s,(p.y-g)*s,0),xl(c,m*s,g*s,0),kl(c,n.z);const $=n.x>Math.PI/2;wl(c,$?Math.PI:0);const f=n.y>Math.PI/2;Sl(c,f?Math.PI:0),vl(c,r),xl(c,-m*s,-g*s,0)},drawToCanvas(){P.bindFramebuffer(P.FRAMEBUFFER,null),u=c,P.viewport(0,0,P.drawingBufferWidth,P.drawingBufferHeight),P.colorMask(!0,!0,!0,!0),P.clearColor(v,w,S,k),P.clear(P.COLOR_BUFFER_BIT),x=[1,0,1,0,1,i.width,1,i.width]},drawToImageBlendBuffer(e,t){ee(1,z,e,t)},drawToImageOverlayBuffer(e,t){ee(2,A,e,t)},enableMask(e,t){const o=e.x*s,r=e.y*s,n=e.width*s,a=e.height*s;g=o,p=g+n,h=i.height-r,m=i.height-(r+a),$=1-t,y=[h,p,m,g]},disableMask(){g=0,p=i.width,h=i.height,m=0,$=1,y=[h,p,m,g]},resize:(t,o,n)=>{s=n,l=1===s?.75:1,r.width=t,r.height=o,i.width=t*s,i.height=o*s,a=U(i.width,i.height),e.width=i.width,e.height=i.height,bl(c,0,i.width,i.height,0,-1,1),b=[1,0,1,0,1,r.width,1,r.width]},release(){Array.from(J.keys()).forEach((e=>te(e,{forceRelease:!0}))),J.clear(),C.forEach((e=>{P.deleteTexture(e)})),C.clear(),F.destroy(),W.destroy(),N.destroy(),j.destroy(),Y.destroy(),e.width=1,e.height=1,e=void 0}}},Gl=e=>e%2==0?e:e+1;var Zl=(e,t)=>{const{imageData:o,amount:i=1}=e,r=Math.round(2*Math.max(1,i)),n=Math.round(.5*r),a=o.width,s=o.height,l=new Uint8ClampedArray(a*s*4),c=o.data;let d,u,h,p,m,g=0,$=0,f=0;const y=a*s*4-4;for(h=0;h<s;h++)for(d=crypto.getRandomValues(new Uint8ClampedArray(s)),u=0;u<a;u++)p=d[h]/255,$=0,f=0,p<.5&&($=4*(-n+Math.round(Math.random()*r))),p>.5&&(f=(-n+Math.round(Math.random()*r))*(4*a)),m=Math.min(Math.max(0,g+$+f),y),l[g]=c[m],l[g+1]=c[m+1],l[g+2]=c[m+2],l[g+3]=c[m+3],g+=4;t(null,{data:l,width:o.width,height:o.height})};const Xl=[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625];function Yl(e){return Math.sqrt(1- --e*e)}function ql(e){return"[object Date]"===Object.prototype.toString.call(e)}function Kl(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)=>Kl(e[o],t)));return e=>o.map((t=>t(e)))}if("object"===o){if(!e||!t)throw new Error("Object cannot be null");if(ql(e)&&ql(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]=Kl(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 Jl(e,t={}){const o=Ba(e);let i,r=e;function n(n,a){if(null==e)return o.set(e=n),Promise.resolve();r=n;let s=i,l=!1,{delay:c=0,duration:d=400,easing:u=Zr,interpolate:h=Kl}=Xr(Xr({},t),a);if(0===d)return s&&(s.abort(),s=null),o.set(e=r),Promise.resolve();const p=mn()+c;let m;return i=yn((t=>{if(t<p)return!0;l||(m=h(e,n),"function"==typeof d&&(d=d(e,n)),l=!0),s&&(s.abort(),s=null);const i=t-p;return i>d?(o.set(e=n),!1):(o.set(e=m(u(i/d))),!0)})),i.promise}return{set:n,update:(t,o)=>n(t(r,e),o),subscribe:o.subscribe}}function Ql(e,t,o,i){if("number"==typeof o){const r=i-o,n=(o-t)/(e.dt||1/60),a=(n+(e.opts.stiffness*r-e.opts.damping*n)*e.inv_mass)*e.dt;return Math.abs(a)<e.opts.precision&&Math.abs(r)<e.opts.precision?i:(e.settled=!1,o+a)}if(Fo(o))return o.map(((r,n)=>Ql(e,t[n],o[n],i[n])));if("object"==typeof o){const r={};for(const n in o)r[n]=Ql(e,t[n],o[n],i[n]);return r}throw new Error(`Cannot spring ${typeof o} values`)}function ec(e,t={}){const o=Ba(e),{stiffness:i=.15,damping:r=.8,precision:n=.01}=t;let a,s,l,c=e,d=e,u=1,h=0,p=!1;function m(t,i={}){d=t;const r=l={};if(null==e||i.hard||g.stiffness>=1&&g.damping>=1)return p=!0,a=null,c=t,o.set(e=d),Promise.resolve();if(i.soft){const e=!0===i.soft?.5:+i.soft;h=1/(60*e),u=0}if(!s){a=null,p=!1;const t={inv_mass:void 0,opts:g,settled:!0,dt:void 0};s=yn((i=>{if(null===a&&(a=i),p)return p=!1,s=null,!1;u=Math.min(u+h,1),t.inv_mass=u,t.opts=g,t.settled=!0,t.dt=60*(i-a)/1e3;const r=Ql(t,c,e,d);return a=i,c=e,o.set(e=r),t.settled&&(s=null),!t.settled}))}return new Promise((e=>{s.promise.then((()=>{r===l&&e()}))}))}const g={set:m,update:(t,o)=>m(t(d,e),o),subscribe:o.subscribe,stiffness:i,damping:r,precision:n};return g}var tc=Oa(!1,(e=>{const t=window.matchMedia("(prefers-reduced-motion:reduce)"),o=()=>e(t.matches);return o(),t.addListener(o),()=>t.removeListener(o)})),oc=()=>"ResizeObserver"in window;const ic=Je(),rc=(e,t,o,i,r)=>{e.rect||(e.rect=Je());const n=e.rect;mt(ic,t,o,i,r),ht(n,ic)||(gt(n,ic),e.dispatchEvent(new CustomEvent("measure",{detail:n})))},nc=Math.round,ac=e=>{const t=e.getBoundingClientRect();uc&&rc(e,nc(t.x),nc(t.y),nc(t.width),nc(t.height))},sc=e=>{uc&&rc(e,e.offsetLeft,e.offsetTop,e.offsetWidth,e.offsetHeight)},lc=[];let cc,dc,uc=void 0;function hc(){lc.length?(lc.forEach((e=>e.measure(e))),uc=requestAnimationFrame(hc)):uc=void 0}let pc=new Map([]),mc=0,gc=0;var $c=(e,t={})=>{const{observePosition:o=!1,observeViewRect:i=!1,once:r=!1,disabled:n=!1,isMeasureRoot:a=!1}=t;if(oc()&&a&&(dc||(dc=new ResizeObserver((e=>{e.forEach((e=>{pc.set(e.target,e.contentRect)}));const t=Array.from(pc.values()).some((({width:e,height:t})=>e>0&&t>0));t?t&&!1===uc&&hc():(uc&&cancelAnimationFrame(uc),uc=!1)}))),dc.observe(e),mc++),!n)return!oc()||o||i?(e.measure=i?ac:sc,lc.push(e),void 0===uc&&(uc=requestAnimationFrame(hc)),e.measure(e),{destroy(){a&&dc&&(pc.delete(e),dc.unobserve(e),mc--,0===mc&&(dc.disconnect(),dc=void 0));const t=lc.indexOf(e);lc.splice(t,1),delete e.measure}}):(cc||(cc=new ResizeObserver((e=>{e.forEach((e=>{uc&&sc(e.target)}))}))),cc.observe(e),sc(e),r?cc.unobserve(e):gc++,{destroy(){a&&dc&&(pc.delete(e),dc.unobserve(e),mc--,0===mc&&(dc.disconnect(),dc=void 0)),r||(cc.unobserve(e),gc--,0===gc&&(cc.disconnect(),cc=void 0))}})},fc=e=>{let t=!1;const o={pointerdown:()=>{t=!1},keydown:()=>{t=!0},keyup:()=>{t=!1},focus:e=>{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 yc=async e=>new Promise((t=>{if("file"===e.kind)return t(e.getAsFile());e.getAsString(t)}));var bc=(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([]);Promise.all(Array.from(i).map(yc)).then((e=>{t(e.filter((e=>Vo(e)&&Kt(e)||/^http/.test(e))))})).catch(o)})))(o);e.dispatchEvent(new CustomEvent("dropfiles",{detail:{event:o,resources:i},...t}))}catch(e){}};return e.addEventListener("drop",i),e.addEventListener("dragover",o),{destroy(){e.removeEventListener("drop",i),e.removeEventListener("dragover",o)}}};let xc=null;var vc=()=>{if(null===xc)if(u()){const e=g("canvas");xc=!Tl(e,{failIfMajorPerformanceCaveat:!0}),f(e)}else xc=!1;return xc},wc=e=>e instanceof WebGLTexture,Sc=([e,t,o,i])=>[i.x,i.y,e.x,e.y,o.x,o.y,t.x,t.y];function kc(e){let t,o,i,r;return{c(){t=kn("div"),o=kn("canvas"),An(t,"class","PinturaCanvas")},m(n,a){wn(n,t,a),bn(t,o),e[36](o),i||(r=[Pn(o,"measure",e[37]),hn($c.call(null,o))],i=!0)},p:Gr,i:Gr,o:Gr,d(o){o&&Sn(t),e[36](null),i=!1,Kr(r)}}}function Cc(e,t,o){let i,r,n,s,l,c,d;const h=[0,0,0,0],p=de(),m=u()&&(e=>{const t=.5*e,o=g("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),$=qn();let b,{isAnimated:x}=t,{isTransparent:v}=t,{maskRect:w}=t,{maskOpacity:S=1}=t,{maskFrameOpacity:k=.95}=t,{maskMarkupOpacity:C=1}=t,{clipAnnotationsToImage:T=!0}=t,{pixelRatio:M=1}=t,{textPixelRatio:P=M}=t,{backgroundColor:E}=t,{willRender:I=G}=t,{didRender:A=G}=t,{willRequest:L}=t,{loadImageData:z=G}=t,{enableGrid:F=!1}=t,{gridColors:D}=t,{gridSize:O}=t,{gridOpacity:B=0}=t,{images:W=[]}=t,{interfaceImages:_=[]}=t,{selectionColor:V}=t,N=null,H=null,j=null;const Z=(e,t)=>e.set(t,{hard:!x}),X={precision:1e-4*.01};let Y=0;const q=Jl(void 0,{duration:0});on(e,q,(e=>o(35,d=e)));const K=ec(1,X);on(e,K,(e=>o(34,l=e)));const J=ec(1,X);on(e,J,(e=>o(50,n=e)));const Q=Ba();on(e,Q,(e=>o(52,c=e)));const ee=Ba();on(e,ee,(e=>o(51,s=e)));const te={},oe=(e,t)=>{let o=te[e.id];const i=Math.min(1,2048/t.width);let r=o?o.element:g("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||!(!Mi(o)||Mi(i)&&ht(o,i))||!(!Ri(o)||Ri(i)&&o.x===i.x&&o.y===i.y&&o.rx===i.rx&&o.ry===i.ry)||!(!Ei(o)||Ei(i)&&i.points.length===o.points.length)})(o,e.actions)){r=r.cloneNode(),((e,t,o)=>{const{selectionColor:i=[1,1,1],scalar:r=1}=o||{};let n=!1;for(const o of t){const t="subtract"===o.drawMode;if(t&&!n)continue;e.globalCompositeOperation=t?"destination-out":"source-over",e.save(),e.beginPath();const a=wr(o);vo(e,r,r),xo(e,o.rotation,a),Wr(e,o.flipX,o.flipY,a),o.width?Lr(e,{...o,backgroundColor:i}):o.points?Br(e,Object.assign({},o,o.pathClose?{backgroundColor:i,strokeColor:[0,0,0,0]}:{strokeColor:i,strokeJoin:"round",strokeCap:"round"})):o.rx&&zr(e,{...o,backgroundColor:i,strokeColor:[0,0,0,0],strokeJoin:"round",strokeCap:"round"}),e.restore(),n=!0}})(r.getContext("2d"),e.actions,{selectionColor:[1,0,1],scalar:i});const t=e.actions.length;te[e.id]={total:t,last:{...e.actions[t-1]},element:r}}return{x:0,y:0,...t,fillColor:e.color||[1,1,1],backgroundImage:r}};let ie;const re=()=>{cancelAnimationFrame(ie),ie=requestAnimationFrame((()=>{Ce=!0,ze=0,r()}))},ne=new Map([]),ae=new Map([]),se=(e,t)=>({filterParam:"pixelated"===e?N.textureFilterNearest:N.textureFilterLinear,wrapParam:"repeat"===t?N.textureRepeat:N.textureClamp}),le=(e,t,o)=>{if(!ne.has(e)){ne.set(e,e);const r=se(t,o);if(!R(i=e)&&(uo(i)||y(i)||Sr(i)||Qt(i))){const t=N.textureCreate();N.textureUpdate(t,e,r),ne.set(e,t)}else z(e).then((t=>{if(!N||!t)return;const o=N.textureCreate();N.textureUpdate(o,t,r),ne.set(e,o),re()})).catch((t=>{ne.set(e,t)}))}var i,r;if(Qt(e)&&((r=e).currentTime>0&&!r.paused&&!r.ended&&r.readyState>2||"true"===e.dataset.redraw)){const i=ne.get(e),r=se(t,o);return N.textureUpdate(i,e,r),e.dataset.redraw=!1,i}return ne.get(e)},ce=(e,t={})=>{const o=t.id||e.id;if(!e.text.length)return void ae.delete(o);let{text:i,textAlign:r,fontFamily:n,fontSize:a=16,fontWeight:s,fontVariant:l,fontStyle:c,letterSpacing:d,lineHeight:u=a,width:h,height:p}=e,{outline:m=0,blur:$=0,paddingTop:f=0,paddingRight:y=Ko,paddingBottom:b=0,paddingLeft:x=Ko}=t;h=Ao(h)?Math.floor(h):h,p=Ao(p)?Math.floor(p):p;const{textSize:v,signature:w}=((e="",t)=>{let{width:o=0,height:i="auto",fontSize:r,fontFamily:n,lineHeight:a,fontWeight:s,fontStyle:l,fontVariant:c,letterSpacing:d}=t;const u=jo({text:e,fontFamily:n,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:r,lineHeight:a,letterSpacing:d,width:o,height:i});let h=ei.get(u);if(h)return h;let p=1;r>1e3&&qo()&&(p=r/1e3,r=1e3,a*=p);const m=Gt(g("pre",{contenteditable:"true",spellcheck:"false",style:`${oi}${Jo({fontFamily:n,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:r,letterSpacing:d,lineHeight:a})};${Qo(e,t)}"`,innerHTML:e})),$=m.getBoundingClientRect();return h={signature:ti(m).flat().map((e=>e.text)).join("_;_"),textSize:Ue(Fe($),(e=>Math.ceil(e*p)))},ei.set(u,h),m.remove(),h})(i,{...e,width:h,height:p}),S=jo({text:i,textAlign:r,fontFamily:n,fontSize:a,fontWeight:s,fontVariant:l,fontStyle:c,lineHeight:u,letterSpacing:d,outline:m,blur:$,signature:w});if(!ne.has(S)){ne.set(S,i);const e=Math.ceil(v.width),t=Math.ceil(v.height/u)*u;if(0===e||0===t)return;const g=Fl(),w=Math.min(1,(g-(x+y)*P)/(e*P),(g-(f+b)*P)/(t*P));$i(i,{fontSize:a,fontFamily:n,fontWeight:s,fontVariant:l,fontStyle:c,letterSpacing:d,textAlign:r,lineHeight:u,width:h,height:p,imageWidth:e,imageHeight:t,paddingLeft:x,paddingTop:f,paddingRight:y,paddingBottom:b,pixelRatio:P*w,willRequest:L,outline:m,blur:$,color:[1,0,1]}).then((e=>{if(!N)return;const t=N.textureCreate();N.textureUpdate(t,e,{filterParam:N.textureFilterLinear,wrapParam:N.textureClamp,scalar:w}),ne.set(S,t),ae.set(o,t),re()})).catch(console.error)}const k=ne.get(S);return wc(k)?k:ae.get(o)},he=new Map,pe=(e,t)=>{let o;if(e.backgroundImage)o=le(e.backgroundImage,e.backgroundImageRendering,"repeat"===e.backgroundRepeat?"repeat":void 0);else if(R(e.text)){if(e.width&&e.width<1||e.height&&e.height<1)return;o=ce(e,t)}else e.bitmap&&e.points&&(o=(e=>{const{id:t,points:o,strokeWidth:i,strokeCap:r,strokeJoin:n,strokeColor:a}=e;let s=ne.get(t),l=he.get(t);const c=jo({points:o.map((e=>`${e.x},${e.y}`)).join(","),strokeWidth:i,strokeCap:r,strokeJoin:n,strokeColor:a});if(l){const{hash:e}=l;if(ne.has(t)){if(c===e)return ne.get(t)}else l=void 0}if(!l){const o=g("canvas",{width:1,height:1});l={canvas:o,hash:void 0},he.set(e.id,l),s=N.textureCreate(),N.textureUpdate(s,o,{filterParam:N.textureFilterLinear,wrapParam:N.textureClamp}),ne.set(t,s)}const{canvas:d}=l,u=Math.ceil(e.strokeWidth),h=ot(o),p=Math.floor(h.x)-.5*u,m=Math.floor(h.y)-.5*u,$=Math.ceil(h.width+u),f=Math.ceil(h.height+u);d.width=Math.max($,1),d.height=Math.max(f,1);const y=d.getContext("2d");return y.clearRect(0,0,d.width,d.height),$>=1&&f>=1&&(y.translate(-p,-m),Br(y,e),y.resetTransform()),N.textureUpdate(s,d,{filterParam:N.textureFilterLinear,wrapParam:N.textureClamp}),he.set(t,{canvas:d,hash:c}),ne.get(t)})(e));return o},me=({texture:e,size:t,origin:o,translation:i,rotation:r,scale:n,colorMatrix:a,opacity:s,convolutionMatrix:l,gamma:c,vignette:d,maskFeather:u,maskCornerRadius:h,overlayColor:p,enableOverlay:m,enableManipulation:g,enableAntialiasing:$})=>{let f=0,y=0;if(1===M){const e=Math.abs(1-n)<Number.EPSILON;f=e&&H%2!=0?.5:0,y=e&&j%2!=0?.5:0}return N.drawImage(e,t,o.x,o.y,i.x+f,i.y+y,r.x,r.y,r.z,n,a,ns(s,0,1),l,c,d,u,h,p,m,g,$),e},$e=(e,t,o,i,r,n,a,s,l)=>{const c={...t},d={width:r.width/P*o,height:r.height/P*o},u=ue(0,0),h={width:d.width,height:d.height};return c.x-=l*o,c.y-=n*o,e.width?(c.height=c.height?c.height+n*o/i:d.height,c.width+=(l+a)*o/i,"center"===e.textAlign?u.x=.5*(c.width-h.width/i):"right"===e.textAlign&&(u.x=c.width-h.width/i)):(c.width=d.width,c.height=d.height),{rect:c,backgroundPosition:u,backgroundSize:h}},fe=(e=[],t)=>{e.forEach((e=>{let o=pe(e);const i="loading"===e.status||e.backgroundImage&&o===e.backgroundImage;i&&re();const r="error"===e.status||e.backgroundImage&&o instanceof Error;let n=wc(o)?o:void 0;const a=e._scale||1,s=e._translate||p,l=e.strokeWidth&&e.strokeWidth*a,c=!!e.width,d=!c&&R(e.text)&&n,u=Fo(e.points),h=Ri(e);if(u){const i=e.points.map((e=>ue(e.x*a+s.x,e.y*a+s.y)));if(e.bitmap){o&&t.push(o);const r=ot(i),s=Math.ceil(e.strokeWidth*a);N.drawRect({x:Math.floor(r.x)-.5*s,y:Math.floor(r.y)-.5*s,width:Math.ceil(r.width+s),height:Math.ceil(r.height+s)},e.rotation,e.flipX,e.flipY,[0,0,0,0],void 0,n,void 0,void 0,void 0,void 0,void 0,void 0,e.opacity,void 0,void 0,!1,!1)}else N.drawPath(i,e.rotation,e.flipX,e.flipY,l,e.strokeColor,e.pathClose,e.backgroundColor,e.opacity)}else if(h){let c=e.x,d=e.y;c*=a,d*=a,c+=s.x,d+=s.y;const u=ue(c,d);N.drawEllipse(u,e.rx*a,e.ry*a,e.rotation,e.flipX,e.flipY,e.backgroundColor,n,void 0,void 0,e.backgroundCorners&&Sc(e.backgroundCorners),l,e.strokeColor,e.opacity,e.inverted),o&&t.push(o),(i||r)&&(e.backgroundColor||e.strokeColor&&e.strokeWidth||N.drawEllipse(u,e.rx*a,e.ry*a,e.rotation,e.flipX,e.flipY,r?[1,0,0,.25*e.opacity]:[0,0,0,.25*e.opacity]),r&&Se(u),i&&we(u))}else if(d||c){const c=n&&N.textureGetSize(n);let d,u,h,p=e.fillColor,m=e.backgroundColor,g=e.strokeColor,$=[e.cornerRadius,e.cornerRadius,e.cornerRadius,e.cornerRadius].map((e=>e*a));d=e.width?tt(e):{x:e.x,y:e.y,...c},a&&s&&(d.x*=a,d.y*=a,d.x+=s.x,d.y+=s.y,d.width*=a,d.height*=a),o&&t.push(o);const{backgroundRepeat:f="no-repeat"}=e;if(c)if(e.backgroundImage&&(e.backgroundSize||e.backgroundPosition||e.backgroundRepeat)){const t=U(c.width,c.height);if("repeat"===e.backgroundRepeat&&(u={...c},h={x:0,y:0}),"contain"===e.backgroundSize){const o=xt(d,t,d);u=De(o),h=e.backgroundPosition?e.backgroundPosition:ue(.5*(d.width-u.width),.5*(d.height-u.height))}else if("cover"===e.backgroundSize){const o=bt(d,t,d);u=De(o),e.backgroundPosition?h=e.backgroundPosition:(h=ue(o.x,o.y),h=ue(.5*(d.width-u.width),.5*(d.height-u.height)))}else e.backgroundSize?(u=e.backgroundSize,h=e.backgroundPosition||{x:0,y:0}):e.backgroundPosition&&(u={...c},h=e.backgroundPosition)}else if(e.text){const o={...d};if(e.backgroundColor||e.strokeColor){m=void 0,g=void 0;const t={width:c.width/P*a,height:c.height/P*a},o=(e.width||t.width-2*Ko)*a,i=(e.height||t.height)*a;N.drawRect({...d,width:o,height:i},e.rotation,e.flipX,e.flipY,$,e.backgroundColor,void 0,void 0,void 0,!1,void 0,l,e.strokeColor,e.opacity,void 0,void 0,void 0,e.inverted)}let i=1;e.fontSize>1e3&&qo()&&(i=e.fontSize/1e3),p=e.color||[0,0,0],e._prerender&&(p[3]=0);const r=$e(e,o,a,i,c,0,Ko,0,Ko);d=r.rect,h=r.backgroundPosition,u=r.backgroundSize;const{textShadowX:n,textShadowY:s,textShadowBlur:f}=e;if(n||s||f){const r=Math.ceil(.5*f),l=r,c=Math.max(Ko,r),u=r,h=Math.max(Ko,r),p=pe(e,{id:e.id+"shadow",blur:f,paddingTop:l,paddingRight:c,paddingBottom:u,paddingLeft:h});if(p&&!e._prerender){t.push(p);const r=N.textureGetSize(p),{rect:u,backgroundPosition:m,backgroundSize:g}=$e(e,o,a,i,r,l,c,0,h),$=at(d),f=at(u);f.x+=n,f.y+=s;const y=ge(f,e.rotation,$),b={x:y.x-.5*u.width,y:y.y-.5*u.height,width:u.width,height:u.height};e.height&&(b.height-=s),N.drawRect(b,e.rotation,e.flipX,e.flipY,[0,0,0,0],void 0,p,g,m,!1,void 0,void 0,void 0,e.opacity,void 0,0,e.textShadowColor)}}if(e.textOutlineWidth){const r=Math.ceil(.5*e.textOutlineWidth),n=r,s=Ko+r,l=r,c=Ko+r,d=pe(e,{id:e.id+"outline",outline:e.textOutlineWidth,paddingTop:n,paddingRight:s,paddingBottom:l,paddingLeft:c});if(d&&!e._prerender){const r=N.textureGetSize(d);t.push(d);const{rect:l,backgroundPosition:u,backgroundSize:h}=$e(e,o,a,i,r,n,s,0,c);N.drawRect(l,e.rotation,e.flipX,e.flipY,[0,0,0,0],void 0,d,h,u,!1,void 0,void 0,void 0,e.opacity,void 0,0,e.textOutlineColor)}}}if(N.drawRect(d,e.rotation,e.flipX,e.flipY,$,m,n,u,h,"repeat"===f,e.backgroundCorners&&Sc(e.backgroundCorners),l,g,e.opacity,void 0,e.feather,p,e.inverted),i||r){e.backgroundColor&&0!==e.backgroundColor[3]||e.strokeColor&&e.strokeWidth||N.drawRect(d,e.rotation,e.flipX,e.flipY,$,r?[1,.2549,.2118,.25*e.opacity]:[0,0,0,.25*e.opacity]);const t=at(d);r&&Se(t),i&&we(t)}}else o&&t.push(o)}))};let ye=0;const be=[{x:-5,y:-5},{x:5,y:5}],xe=[{x:5,y:-5},{x:-5,y:5}],ve=Lt({x:0,y:0},10,10,0,!1,!1,16);ve.length=9;const we=e=>{ye=Date.now()/50,N.drawEllipse(e,15,15,0,!1,!1,[0,0,0,.5]);const t=Ae(ve.map((t=>({x:t.x+e.x,y:t.y+e.y}))),ye,e.x,e.y);N.drawPath(t,0,!1,!1,2,[1,1,1])},Se=e=>{N.drawEllipse(e,13,13,0,!1,!1,[1,.2549,.2118,.75]);const t=be.map((t=>({x:t.x+e.x,y:t.y+e.y}))),o=xe.map((t=>({x:t.x+e.x,y:t.y+e.y})));N.drawPath(t,0,!1,!1,3,[1,1,1]),N.drawPath(o,0,!1,!1,3,[1,1,1])},ke=(e,t,o,i,r,n)=>N.drawRect(t,0,!1,!1,h,h,e,i,o,!0,void 0,0,void 0,n,void 0,void 0,r);let Ce=!1,Te=!0,Me=!1;const Re=[],Pe=[],Ee=[],Ie=()=>{Ee.length=0;const e=W[0],{manipulationShapes:t,manipulationShapesDirty:o,annotationShapes:i,annotationShapesDirty:r,interfaceShapes:a,decorationShapes:u,frameShapes:p,selectionShapes:g}=I({opacity:e.opacity,rotation:e.rotation,scale:e.scale,images:W,size:We(H,j),backgroundColor:[...d],selectionRect:c}),$=[...d],f=c,y=ns(l,0,1),b=s,x=Math.abs(e.rotation.x/Math.PI*2-1),S=Math.abs(e.rotation.y/Math.PI*2-1),k=x<.99||S<.99,M={...e.size},R=e.backgroundColor,E=e.backgroundImage,L=t.length>0,z=i.length>0,U=R[3]>0,G=!!T&&C>=1;if(y<1&&U){const e=$[0],t=$[1],o=$[2],i=1-y,r=R[0]*i,n=R[1]*i,a=R[2]*i,s=1-i;$[0]=r+e*s,$[1]=n+t*s,$[2]=a+o*s,$[3]=1}N.setCanvasColor(v?h:$);L&&(o||Ce)?(N.disableMask(),N.drawToImageBlendBuffer(M),Re.length=0,fe(t,Re)):L||(Re.length=0),Ee.push(...Re),Te&&(N.drawToImageOverlayBuffer(M,P),Te=!1);if(k?(z&&(r||Ce)||!Me?(N.disableMask(),N.drawToImageOverlayBuffer(M,P),Pe.length=0,fe(i,Pe)):z||(Pe.length=0),Me=!0):Me=!1,N.drawToCanvas(),N.enableMask(f,y),F&&O>=1&&2===D.length&&B&&((e,t,o,i,r)=>{const n=We(t,t),a=le(m,"pixelated","repeat"),s=ue(-e.x%t,-e.y%t),l=ue(s.x+.5*n.width,s.y);ke(a,e,s,n,o,r),ke(a,e,l,n,i,r)})(f,O,D[0],D[1],B),U&&N.drawRect(f,0,!1,!1,h,R),E){N.enableMask(f,1);const e=Math.max(w.width/E.width,w.height/E.height),t=E.width*e,o=E.height*e,i={x:w.x+.5*w.width-.5*t,y:w.y+.5*w.height-.5*o,width:t,height:o};N.drawRect(i,0,!1,!1,h,h,le(E,"linear")),N.enableMask(f,y)}if(G&&N.enablePreviewStencil(),Ee.push(...[...W].reverse().map((e=>me({...e,texture:le(e.data),enableOverlay:k&&z,enableManipulation:L,enableAntialiasing:!0,mask:f,maskOpacity:y,overlayColor:b})))),N.enableMask(f,C),k||(G&&N.applyPreviewStencil(),N.resetCanvasMatrix(),N.updateCanvasMatrix(M,e.origin,e.translation,e.scale,e.rotation),Pe.length=0,fe(i,Pe),G&&N.disablePreviewStencil()),Ee.push(...Pe),N.resetCanvasMatrix(),N.enableMask(f,C),fe(u,Ee),p.length){N.enableMask(f,1);const e=p.filter((e=>!e.expandsCanvas)),t=p.filter((e=>e.expandsCanvas));e.length&&fe(e,Ee),t.length&&(N.enableMask({x:f.x+.5,y:f.y+.5,width:f.width-1,height:f.height-1},n),fe(t,Ee))}if(V&&g.length&&!k){N.resetCanvasMatrix(),N.updateCanvasMatrix(M,e.origin,e.translation,e.scale,e.rotation);const t=[...V];t[3]=.5;const o=[{id:"selection",color:t,actions:[...g]}].map((e=>oe(e,M)));fe(o,Ee),N.resetCanvasMatrix()}N.disableMask(),fe(a,Ee),_.forEach((e=>{if(N.enableMask(e.mask,e.maskOpacity),e.backgroundColor){const t=E&&bt({...e.mask},E.width/E.height),o=E&&le(E,"linear");N.drawRect(e.mask,0,!1,!1,e.maskCornerRadius,e.backgroundColor,o,t,t,void 0,void 0,void 0,void 0,e.opacity,e.maskFeather),o&&Ee.push(o)}const t=me({...e,texture:le(e.data),enableAntialiasing:!1,translation:{x:e.translation.x+e.offset.x-.5*H,y:e.translation.y+e.offset.y-.5*j}});Ee.push(t)})),N.disableMask(),(e=>{ne.forEach(((t,o)=>{!e.find((e=>e===t))&&wc(t)&&(Array.from(ae.values()).includes(t)||(ne.delete(o),N.textureDelete(t)))}))})(Ee),A(),Ce=!1};let Le,ze=0;const Oe=()=>{clearTimeout(Le);const e=Date.now();e-ze<48?Le=setTimeout(Oe,48):(ze=e,Ie())};Xn((()=>r())),Zn((()=>o(30,N=Ul(b,{alpha:v})))),Yn((()=>{N&&(he.forEach((({canvas:e})=>f(e))),he.clear(),N.release(),o(30,N=void 0),o(0,b=void 0))}));return e.$$set=e=>{"isAnimated"in e&&o(9,x=e.isAnimated),"isTransparent"in e&&o(10,v=e.isTransparent),"maskRect"in e&&o(11,w=e.maskRect),"maskOpacity"in e&&o(12,S=e.maskOpacity),"maskFrameOpacity"in e&&o(13,k=e.maskFrameOpacity),"maskMarkupOpacity"in e&&o(14,C=e.maskMarkupOpacity),"clipAnnotationsToImage"in e&&o(15,T=e.clipAnnotationsToImage),"pixelRatio"in e&&o(16,M=e.pixelRatio),"textPixelRatio"in e&&o(17,P=e.textPixelRatio),"backgroundColor"in e&&o(18,E=e.backgroundColor),"willRender"in e&&o(19,I=e.willRender),"didRender"in e&&o(20,A=e.didRender),"willRequest"in e&&o(21,L=e.willRequest),"loadImageData"in e&&o(22,z=e.loadImageData),"enableGrid"in e&&o(23,F=e.enableGrid),"gridColors"in e&&o(24,D=e.gridColors),"gridSize"in e&&o(25,O=e.gridSize),"gridOpacity"in e&&o(26,B=e.gridOpacity),"images"in e&&o(27,W=e.images),"interfaceImages"in e&&o(28,_=e.interfaceImages),"selectionColor"in e&&o(29,V=e.selectionColor)},e.$$.update=()=>{if(1&e.$$.dirty[0]&&b){const e=getComputedStyle(b).getPropertyValue("--color-transition-duration");o(31,Y=(e=>{let t=parseFloat(e);return/^[0-9]+s$/.test(e)?1e3*t:t})(e))}262656&e.$$.dirty[0]|1&e.$$.dirty[1]&&E&&q.set(E,{duration:x?Y:0}),4096&e.$$.dirty[0]&&Z(K,Ao(S)?S:1),8192&e.$$.dirty[0]&&Z(J,Ao(k)?k:1),2048&e.$$.dirty[0]&&w&&Q.set(w),24&e.$$.dirty[1]&&d&&ee.set([d[0],d[1],d[2],ns(l,0,1)]),1207959558&e.$$.dirty[0]&&o(33,i=!!(N&&H&&j&&W.length)),1073807366&e.$$.dirty[0]&&H&&j&&N&&(ze=0,N.resize(H,j,M)),4&e.$$.dirty[1]&&o(32,r=i?vc()?Oe:Ie:a),6&e.$$.dirty[1]&&i&&r&&r()},[b,H,j,$,q,K,J,Q,ee,x,v,w,S,k,C,T,M,P,E,I,A,L,z,F,D,O,B,W,_,V,N,Y,r,i,l,d,function(e){ta[e?"unshift":"push"]((()=>{b=e,o(0,b)}))},e=>{o(1,H=e.detail.width),o(2,j=e.detail.height),$("measure",{width:H,height:j})}]}class Tc extends Fa{constructor(e){super(),za(this,e,Cc,kc,Qr,{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,loadImageData:22,enableGrid:23,gridColors:24,gridSize:25,gridOpacity:26,images:27,interfaceImages:28,selectionColor:29},null,[-1,-1,-1])}}var Mc=(e,t=Boolean,o=" ")=>e.filter(t).join(o);function Rc(e,t,o){const i=e.slice();return i[17]=t[o],i}const Pc=e=>({tab:4&e}),Ec=e=>({tab:e[17]});function Ic(e){let t,o,i,r=[],n=new Map,a=e[2];const s=e=>e[17].id;for(let t=0;t<a.length;t+=1){let o=Rc(e,a,t),i=s(o);n.set(i,r[t]=Ac(i,o))}return{c(){t=kn("ul");for(let e=0;e<r.length;e+=1)r[e].c();An(t,"class",o=Mc(["PinturaTabList",e[0]])),An(t,"role","tablist"),An(t,"data-layout",e[1])},m(o,n){wn(o,t,n);for(let e=0;e<r.length;e+=1)r[e].m(t,null);e[14](t),i=!0},p(e,l){1124&l&&(a=e[2],ya(),r=Ma(r,l,s,1,e,a,n,t,Ta,Ac,null,Rc),ba()),(!i||1&l&&o!==(o=Mc(["PinturaTabList",e[0]])))&&An(t,"class",o),(!i||2&l)&&An(t,"data-layout",e[1])},i(e){if(!i){for(let e=0;e<a.length;e+=1)xa(r[e]);i=!0}},o(e){for(let e=0;e<r.length;e+=1)va(r[e]);i=!1},d(o){o&&Sn(t);for(let e=0;e<r.length;e+=1)r[e].d();e[14](null)}}}function Ac(e,t){let o,i,r,n,a,s,l,c,d,u;const h=t[11].default,p=rn(h,t,t[10],Ec);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=kn("li"),i=kn("button"),p&&p.c(),n=Mn(),An(i,"type","button"),i.disabled=r=t[17].disabled,An(o,"role","tab"),An(o,"aria-controls",a=t[17].href.substr(1)),An(o,"id",s=t[17].tabId),An(o,"aria-selected",l=t[17].selected),this.first=o},m(e,t){wn(e,o,t),bn(o,i),p&&p.m(i,null),bn(o,n),c=!0,d||(u=[Pn(i,"keydown",m),Pn(i,"click",g)],d=!0)},p(e,n){t=e,p&&p.p&&(!c||1028&n)&&sn(p,h,t,t[10],c?an(h,t[10],n,Pc):ln(t[10]),Ec),(!c||4&n&&r!==(r=t[17].disabled))&&(i.disabled=r),(!c||4&n&&a!==(a=t[17].href.substr(1)))&&An(o,"aria-controls",a),(!c||4&n&&s!==(s=t[17].tabId))&&An(o,"id",s),(!c||4&n&&l!==(l=t[17].selected))&&An(o,"aria-selected",l)},i(e){c||(xa(p,e),c=!0)},o(e){va(p,e),c=!1},d(e){e&&Sn(o),p&&p.d(e),d=!1,Kr(u)}}}function Lc(e){let t,o,i=e[4]&&Ic(e);return{c(){i&&i.c(),t=Rn()},m(e,r){i&&i.m(e,r),wn(e,t,r),o=!0},p(e,[o]){e[4]?i?(i.p(e,o),16&o&&xa(i,1)):(i=Ic(e),i.c(),xa(i,1),i.m(t.parentNode,t)):i&&(ya(),va(i,1,1,(()=>{i=null})),ba())},i(e){o||(xa(i),o=!0)},o(e){va(i),o=!1},d(e){i&&i.d(e),e&&Sn(t)}}}function zc(e,t,o){let i,r,n,{$$slots:a={},$$scope:s}=t,{class:l}=t,{name:c}=t,{selected:d}=t,{tabs:u=[]}=t,{layout:h}=t;const p=qn(),m=e=>{const t=n.querySelectorAll('[role="tab"] button')[e];t&&t.focus()},g=(e,t)=>{e.preventDefault(),e.stopPropagation(),p("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,h=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,r=i.length>1)},[l,h,i,n,r,g,$,c,d,u,s,a,(e,t)=>$(t,e.id),(e,t)=>g(t,e.id),function(e){ta[e?"unshift":"push"]((()=>{n=e,o(3,n)}))}]}class Fc extends Fa{constructor(e){super(),za(this,e,zc,Lc,Qr,{class:0,name:7,selected:8,tabs:9,layout:1})}}const Dc=e=>({panel:16&e}),Oc=e=>({panel:e[4][0].id,panelIsActive:!0});function Bc(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].tabindex,i[18]=t[o].labelledBy,i[19]=t[o].isActive,i[20]=t[o].hidden,i[3]=t[o].visible,i}const Wc=e=>({panel:16&e,panelIsActive:16&e}),_c=e=>({panel:e[14],panelIsActive:e[19]});function Vc(e){let t,o,i,r,n,a;const s=e[11].default,l=rn(s,e,e[10],Oc);return{c(){t=kn("div"),o=kn("div"),l&&l.c(),An(o,"class",i=Mc([e[1]])),An(t,"class",e[0]),An(t,"style",e[2])},m(i,s){wn(i,t,s),bn(t,o),l&&l.m(o,null),r=!0,n||(a=[Pn(t,"measure",e[13]),hn($c.call(null,t))],n=!0)},p(e,n){l&&l.p&&(!r||1040&n)&&sn(l,s,e,e[10],r?an(s,e[10],n,Dc):ln(e[10]),Oc),(!r||2&n&&i!==(i=Mc([e[1]])))&&An(o,"class",i),(!r||1&n)&&An(t,"class",e[0]),(!r||4&n)&&An(t,"style",e[2])},i(e){r||(xa(l,e),r=!0)},o(e){va(l,e),r=!1},d(e){e&&Sn(t),l&&l.d(e),n=!1,Kr(a)}}}function Nc(e){let t,o,i,r,n,a=[],s=new Map,l=e[4];const c=e=>e[14];for(let t=0;t<l.length;t+=1){let o=Bc(e,l,t),i=c(o);s.set(i,a[t]=jc(i,o))}return{c(){t=kn("div");for(let e=0;e<a.length;e+=1)a[e].c();An(t,"class",o=Mc(["PinturaTabPanels",e[0]])),An(t,"style",e[2])},m(o,s){wn(o,t,s);for(let e=0;e<a.length;e+=1)a[e].m(t,null);i=!0,r||(n=[Pn(t,"measure",e[12]),hn($c.call(null,t,{observePosition:!0}))],r=!0)},p(e,r){1042&r&&(l=e[4],ya(),a=Ma(a,r,c,1,e,l,s,t,Ta,jc,null,Bc),ba()),(!i||1&r&&o!==(o=Mc(["PinturaTabPanels",e[0]])))&&An(t,"class",o),(!i||4&r)&&An(t,"style",e[2])},i(e){if(!i){for(let e=0;e<l.length;e+=1)xa(a[e]);i=!0}},o(e){for(let e=0;e<a.length;e+=1)va(a[e]);i=!1},d(e){e&&Sn(t);for(let e=0;e<a.length;e+=1)a[e].d();r=!1,Kr(n)}}}function Hc(e){let t;const o=e[11].default,i=rn(o,e,e[10],_c);return{c(){i&&i.c()},m(e,o){i&&i.m(e,o),t=!0},p(e,r){i&&i.p&&(!t||1040&r)&&sn(i,o,e,e[10],t?an(o,e[10],r,Wc):ln(e[10]),_c)},i(e){t||(xa(i,e),t=!0)},o(e){va(i,e),t=!1},d(e){i&&i.d(e)}}}function jc(e,t){let o,i,r,n,a,s,l,c,d,u=t[15]&&Hc(t);return{key:e,first:null,c(){o=kn("div"),u&&u.c(),i=Mn(),An(o,"class",r=Mc(["PinturaTabPanel",t[1]])),o.hidden=n=t[20],An(o,"id",a=t[16]),An(o,"tabindex",s=t[17]),An(o,"aria-labelledby",l=t[18]),An(o,"data-inert",c=!t[3]),this.first=o},m(e,t){wn(e,o,t),u&&u.m(o,null),bn(o,i),d=!0},p(e,h){(t=e)[15]?u?(u.p(t,h),16&h&&xa(u,1)):(u=Hc(t),u.c(),xa(u,1),u.m(o,i)):u&&(ya(),va(u,1,1,(()=>{u=null})),ba()),(!d||2&h&&r!==(r=Mc(["PinturaTabPanel",t[1]])))&&An(o,"class",r),(!d||16&h&&n!==(n=t[20]))&&(o.hidden=n),(!d||16&h&&a!==(a=t[16]))&&An(o,"id",a),(!d||16&h&&s!==(s=t[17]))&&An(o,"tabindex",s),(!d||16&h&&l!==(l=t[18]))&&An(o,"aria-labelledby",l),(!d||16&h&&c!==(c=!t[3]))&&An(o,"data-inert",c)},i(e){d||(xa(u),d=!0)},o(e){va(u),d=!1},d(e){e&&Sn(o),u&&u.d()}}}function Uc(e){let t,o,i,r;const n=[Nc,Vc],a=[];function s(e,t){return e[5]?0:1}return t=s(e),o=a[t]=n[t](e),{c(){o.c(),i=Rn()},m(e,o){a[t].m(e,o),wn(e,i,o),r=!0},p(e,[r]){let l=t;t=s(e),t===l?a[t].p(e,r):(ya(),va(a[l],1,1,(()=>{a[l]=null})),ba(),o=a[t],o?o.p(e,r):(o=a[t]=n[t](e),o.c()),xa(o,1),o.m(i.parentNode,i))},i(e){r||(xa(o),r=!0)},o(e){va(o),r=!1},d(e){a[t].d(e),e&&Sn(i)}}}function Gc(e,t,o){let i,r,{$$slots:n={},$$scope:a}=t,{class:s}=t,{name:l}=t,{selected:c}=t,{panelClass:d}=t,{panels:u=[]}=t,{visible:h}=t,{style:p}=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,h=e.visible),"style"in e&&o(2,p=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=h?-1!==h.indexOf(e):t;return{id:e,panelId:`panel-${l}-${e}`,labelledBy:`tab-${l}-${e}`,isActive:t,hidden:!t,visible:i,tabindex:t?0:-1,shouldDraw:t||m[e]}}))),16&e.$$.dirty&&o(5,r=i.length>1)},[s,d,p,h,i,r,l,c,u,m,a,n,function(t){Qn.call(this,e,t)},function(t){Qn.call(this,e,t)}]}class Zc extends Fa{constructor(e){super(),za(this,e,Gc,Uc,Qr,{class:0,name:6,selected:7,panelClass:1,panels:8,visible:3,style:2})}}var Xc=e=>{const t=Object.getOwnPropertyDescriptors(e.prototype);return Object.keys(t).filter((e=>!!t[e].get))};function Yc(e){let t,o,i,r;const n=[e[4]];function a(t){e[22](t)}var s=e[10];function l(e){let t={};for(let e=0;e<n.length;e+=1)t=Xr(t,n[e]);return void 0!==e[2]&&(t.name=e[2]),{props:t}}return s&&(t=Wn(s,l(e)),ta.push((()=>Ea(t,"name",a))),e[23](t),t.$on("measure",e[11])),{c(){t&&Ia(t.$$.fragment),i=Rn()},m(e,o){t&&Aa(t,e,o),wn(e,i,o),r=!0},p(e,r){const c=16&r[0]?Ra(n,[Pa(e[4])]):{};if(!o&&4&r[0]&&(o=!0,c.name=e[2],ca((()=>o=!1))),s!==(s=e[10])){if(t){ya();const e=t;va(e.$$.fragment,1,0,(()=>{La(e,1)})),ba()}s?(t=Wn(s,l(e)),ta.push((()=>Ea(t,"name",a))),e[23](t),t.$on("measure",e[11]),Ia(t.$$.fragment),xa(t.$$.fragment,1),Aa(t,i.parentNode,i)):t=null}else s&&t.$set(c)},i(e){r||(t&&xa(t.$$.fragment,e),r=!0)},o(e){t&&va(t.$$.fragment,e),r=!1},d(o){e[23](null),o&&Sn(i),t&&La(t,o)}}}function qc(e){let t,o,i,r=e[5]&&Yc(e);return{c(){t=kn("div"),r&&r.c(),An(t,"data-util",e[2]),An(t,"class",o=Mc(["PinturaUtilPanel",e[1]])),An(t,"style",e[6])},m(o,n){wn(o,t,n),r&&r.m(t,null),e[24](t),i=!0},p(e,n){e[5]?r?(r.p(e,n),32&n[0]&&xa(r,1)):(r=Yc(e),r.c(),xa(r,1),r.m(t,null)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),(!i||4&n[0])&&An(t,"data-util",e[2]),(!i||2&n[0]&&o!==(o=Mc(["PinturaUtilPanel",e[1]])))&&An(t,"class",o),(!i||64&n[0])&&An(t,"style",e[6])},i(e){i||(xa(r),i=!0)},o(e){va(r),i=!1},d(o){o&&Sn(t),r&&r.d(),e[24](null)}}}function Kc(e,t,o){let i,r,n,a,s,l;const c=qn();let{isActive:d=!0}=t,{stores:u}=t,{content:h}=t,{component:p}=t,{locale:m}=t,{class:g}=t;const $=Jn("isAnimated");let f;on(e,$,(e=>o(21,l=e)));const y=ec(0),b=Wa(y,(e=>ns(e,0,1)));on(e,b,(e=>o(20,s=e)));let x=!d;const v=Ba(d);on(e,v,(e=>o(25,a=e)));const w={isActive:Wa(v,(async(e,t)=>{if(!e)return t(e);await sa(),t(e)})),isActiveFraction:Wa(b,(e=>e)),isVisible:Wa(b,(e=>e>0))},S=h.view,k=Xc(S),C=Object.keys(h.props||{}).reduce(((e,t)=>k.includes(t)?(e[t]=h.props[t],e):e),{}),T=Object.keys(w).reduce(((e,t)=>k.includes(t)?(e[t]=w[t],e):e),{});let M,R;const P=e=>{o(17,f={...e.detail}),I&&d&&c("measure",{...f})};Kn("measurable",$c);const E=Gn().$$.context;let I=!1;return Zn((()=>{if(o(19,I=!0),n)return;o(0,p=new S({target:R,props:{...r},context:E})),o(2,M=p.name);const e=p.$on("measure",P);return()=>{e(),p.$destroy()}})),e.$$set=e=>{"isActive"in e&&o(12,d=e.isActive),"stores"in e&&o(13,u=e.stores),"content"in e&&o(14,h=e.content),"component"in e&&o(0,p=e.component),"locale"in e&&o(15,m=e.locale),"class"in e&&o(1,g=e.class)},e.$$.update=()=>{135169&e.$$.dirty[0]&&f&&d&&p&&c("measure",f),2101248&e.$$.dirty[0]&&y.set(d?1:0,{hard:!1===l}),1310720&e.$$.dirty[0]&&(s<=0&&!x?o(18,x=!0):s>0&&x&&o(18,x=!1)),786432&e.$$.dirty[0]&&I&&c(x?"hide":"show"),1048576&e.$$.dirty[0]&&c("fade",s),1048576&e.$$.dirty[0]&&o(6,i=s<1?"opacity: "+s:void 0),4096&e.$$.dirty[0]&&un(v,a=d,a),40960&e.$$.dirty[0]&&o(4,r={...C,...T,stores:u,locale:m})},o(5,n=!k.includes("external")),[p,g,M,R,r,n,i,$,b,v,S,P,d,u,h,m,y,f,x,I,s,l,function(e){M=e,o(2,M)},function(e){ta[e?"unshift":"push"]((()=>{p=e,o(0,p)}))},function(e){ta[e?"unshift":"push"]((()=>{R=e,o(3,R)}))}]}class Jc extends Fa{constructor(e){super(),za(this,e,Kc,qc,Qr,{isActive:12,stores:13,content:14,component:0,locale:15,class:1,opacity:16},null,[-1,-1])}get opacity(){return this.$$.ctx[16]}}function Qc(e){let t,o,i;const r=e[5].default,n=rn(r,e,e[4],null);return{c(){t=Cn("svg"),n&&n.c(),An(t,"class",e[3]),An(t,"style",e[2]),An(t,"width",e[0]),An(t,"height",e[1]),An(t,"viewBox",o="0 0 "+e[0]+"\n    "+e[1]),An(t,"xmlns","http://www.w3.org/2000/svg"),An(t,"aria-hidden","true"),An(t,"focusable","false"),An(t,"stroke-linecap","round"),An(t,"stroke-linejoin","round")},m(e,o){wn(e,t,o),n&&n.m(t,null),i=!0},p(e,[a]){n&&n.p&&(!i||16&a)&&sn(n,r,e,e[4],i?an(r,e[4],a,null):ln(e[4]),null),(!i||8&a)&&An(t,"class",e[3]),(!i||4&a)&&An(t,"style",e[2]),(!i||1&a)&&An(t,"width",e[0]),(!i||2&a)&&An(t,"height",e[1]),(!i||3&a&&o!==(o="0 0 "+e[0]+"\n    "+e[1]))&&An(t,"viewBox",o)},i(e){i||(xa(n,e),i=!0)},o(e){va(n,e),i=!1},d(e){e&&Sn(t),n&&n.d(e)}}}function ed(e,t,o){let{$$slots:i={},$$scope:r}=t,{width:n=24}=t,{height:a=24}=t,{style:s}=t,{class:l}=t;return e.$$set=e=>{"width"in e&&o(0,n=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,r=e.$$scope)},[n,a,s,l,r,i]}class td extends Fa{constructor(e){super(),za(this,e,ed,Qc,Qr,{width:0,height:1,style:2,class:3})}}var od=(e,t)=>t===e.target||t.contains(e.target),id=(e,t,o)=>{return(R(t)?t:e)+(o?` (${i=o,i.map((e=>"CMD"===e?mo()?"⌘":"Ctrl":e)).join("+")})`:"");var i};function rd(e){let t,o;return t=new td({props:{class:"PinturaButtonIcon",$$slots:{default:[nd]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};536870920&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function nd(e){let t;return{c(){t=Cn("g")},m(o,i){wn(o,t,i),t.innerHTML=e[3]},p(e,o){8&o&&(t.innerHTML=e[3])},d(e){e&&Sn(t)}}}function ad(e){let t;return{c(){t=kn("span"),An(t,"class",e[11])},m(o,i){wn(o,t,i),t.innerHTML=e[0]},p(e,o){1&o&&(t.innerHTML=e[0]),2048&o&&An(t,"class",e[11])},d(e){e&&Sn(t)}}}function sd(e){let t,o,i,r,n;const a=e[27].default,s=rn(a,e,e[29],null),l=s||function(e){let t,o,i,r=e[3]&&rd(e),n=e[0]&&ad(e);return{c(){t=kn("span"),r&&r.c(),o=Mn(),n&&n.c(),An(t,"class",e[13])},m(e,a){wn(e,t,a),r&&r.m(t,null),bn(t,o),n&&n.m(t,null),i=!0},p(e,a){e[3]?r?(r.p(e,a),8&a&&xa(r,1)):(r=rd(e),r.c(),xa(r,1),r.m(t,o)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),e[0]?n?n.p(e,a):(n=ad(e),n.c(),n.m(t,null)):n&&(n.d(1),n=null),(!i||8192&a)&&An(t,"class",e[13])},i(e){i||(xa(r),i=!0)},o(e){va(r),i=!1},d(e){e&&Sn(t),r&&r.d(),n&&n.d()}}}(e);return{c(){t=kn("button"),l&&l.c(),An(t,"type",e[6]),An(t,"style",e[4]),t.disabled=e[5],An(t,"class",e[12]),An(t,"title",o=id(e[0],e[1],e[2]))},m(o,a){wn(o,t,a),l&&l.m(t,null),e[28](t),i=!0,r||(n=[Pn(t,"keydown",(function(){Jr(e[8])&&e[8].apply(this,arguments)})),Pn(t,"click",(function(){Jr(e[7])&&e[7].apply(this,arguments)})),Pn(t,"pointerdown",(function(){Jr(e[14])&&e[14].apply(this,arguments)})),hn(e[9].call(null,t))],r=!0)},p(r,[n]){e=r,s?s.p&&(!i||536870912&n)&&sn(s,a,e,e[29],i?an(a,e[29],n,null):ln(e[29]),null):l&&l.p&&(!i||10249&n)&&l.p(e,i?n:-1),(!i||64&n)&&An(t,"type",e[6]),(!i||16&n)&&An(t,"style",e[4]),(!i||32&n)&&(t.disabled=e[5]),(!i||4096&n)&&An(t,"class",e[12]),(!i||7&n&&o!==(o=id(e[0],e[1],e[2])))&&An(t,"title",o)},i(e){i||(xa(l,e),i=!0)},o(e){va(l,e),i=!1},d(o){o&&Sn(t),l&&l.d(o),e[28](null),r=!1,Kr(n)}}}function ld(e,t,o){let i,r,n,s,l,c,{$$slots:d={},$$scope:u}=t,{class:h}=t,{label:p}=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:w="button"}=t,{onclick:S}=t,{onkeydown:k}=t,{onhold:C}=t,{action:T=(()=>{})}=t,{holdThreshold:M=500}=t,{holdSpeedUpFactor:R=.5}=t,{holdSpeedMin:P=20}=t;const E=e=>{o(25,c=setTimeout((()=>{C(),E(Math.max(e*R,P))}),e))};let I;return e.$$set=e=>{"class"in e&&o(15,h=e.class),"label"in e&&o(0,p=e.label),"title"in e&&o(1,m=e.title),"shortcut"in e&&o(2,g=e.shortcut),"labelClass"in e&&o(16,$=e.labelClass),"innerClass"in e&&o(17,f=e.innerClass),"hideLabel"in e&&o(18,y=e.hideLabel),"icon"in e&&o(3,b=e.icon),"style"in e&&o(4,x=e.style),"disabled"in e&&o(5,v=e.disabled),"type"in e&&o(6,w=e.type),"onclick"in e&&o(7,S=e.onclick),"onkeydown"in e&&o(8,k=e.onkeydown),"onhold"in e&&o(19,C=e.onhold),"action"in e&&o(9,T=e.action),"holdThreshold"in e&&o(20,M=e.holdThreshold),"holdSpeedUpFactor"in e&&o(21,R=e.holdSpeedUpFactor),"holdSpeedMin"in e&&o(22,P=e.holdSpeedMin),"$$scope"in e&&o(29,u=e.$$scope)},e.$$.update=()=>{101187584&e.$$.dirty&&o(26,r=C?()=>{c&&(clearTimeout(c),o(25,c=void 0),document.documentElement.removeEventListener("pointerup",r))}:a),68681728&e.$$.dirty&&o(14,i=C?()=>{document.documentElement.addEventListener("pointerup",r),E(M)}:a),131072&e.$$.dirty&&o(13,n=Mc(["PinturaButtonInner",f])),294912&e.$$.dirty&&o(12,s=Mc(["PinturaButton",y&&"PinturaButtonIconOnly",h])),327680&e.$$.dirty&&o(11,l=Mc([y?"implicit":"PinturaButtonLabel",$]))},[p,m,g,b,x,v,w,S,k,T,I,l,s,n,i,h,$,f,y,C,M,R,P,e=>od(e,I),()=>I,c,r,d,function(e){ta[e?"unshift":"push"]((()=>{I=e,o(10,I)}))},u]}class cd extends Fa{constructor(e){super(),za(this,e,ld,sd,Qr,{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 dd=(e,t)=>{const o=e.findIndex(t);if(o>=0)return e.splice(o,1)};const ud=80;var hd=(e,t={})=>{const{inertia:o=!1,inertiaDurationMultiplier:i=ud,shouldStartInteraction:r=(()=>!0),pinch:n=!1,multiTouch:a,getEventPosition:s=(e=>ue(e.clientX,e.clientY)),observeKeys:l=!1}=t;function c(t,o){e.dispatchEvent(new CustomEvent(t,{detail:o}))}function d(){w&&w(),w=void 0}const u=[],h=e=>0===e.timeStamp?Date.now():e.timeStamp,p=()=>{const e=pe(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=Ee(e.map((e=>e.position)));return{center:t,distance:((e,t)=>e.reduce(((e,o)=>e+Re(t,o.position)),0)/e.length)(e,t),velocity:Ee(e.map((e=>e.velocity))),translation:Ee(e.map((e=>e.translation)))}};let b,x,v,w,S,k,C,T,M=0,R=void 0;e.addEventListener("pointerdown",L);const P=["Meta","Control","Alt","Shift"];function E(e){if(!P.includes(e.key))return;const{metaKey:t,ctrlKey:o,altKey:i,shiftKey:r}=e;A({metaKey:t,ctrlKey:o,altKey:i,shiftKey:r})}let I=Date.now();const A=e=>{const t=pe(u[0].translation);let o=C;if(n&&f()){o*=Re(u[0].position,u[1].position)/S,ve(t,u[1].translation)}ve(t,k);const i=Date.now();i-I<16||(I=i,c("interactionupdate",{position:p(),translation:t,scalar:n?o:void 0,isMultiTouching:f(),...e}))};function L(t){if(!f()&&!(e=>Ao(e.button)&&0!==e.button)(t)&&r(t,e))if(d(),(e=>{const t=h(e),o={timeStamp:t,timeStampInitial:t,position:s(e),origin:s(e),velocity:de(),velocityHistory:[],velocityAverage:de(),translation:de(),interactionState:void 0,event:e};u.push(o),o.interactionState=y(u)})(t),l&&(window.addEventListener("keydown",E),window.addEventListener("keyup",E)),$())document.documentElement.addEventListener("pointermove",z),document.documentElement.addEventListener("pointerup",F),document.documentElement.addEventListener("pointercancel",F),document.addEventListener("visibilitychange",O),T=!1,C=1,k=de(),S=void 0,c("interactionstart",{origin:pe(g(t).origin)});else if(n)T=!0,S=Re(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 z(e){e.preventDefault(),(e=>{const t=g(e);if(!t)return;const o=h(e),i=s(e),r=Math.max(1,o-t.timeStamp);t.velocity.x=(i.x-t.position.x)/r,t.velocity.y=(i.y-t.position.y)/r,t.velocityHistory.push(pe(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)),de()),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:r=!1}=l?e:{};A({metaKey:t,ctrlKey:o,altKey:i,shiftKey:r})}function F(e){if(!g(e))return;const t=p(),r=(e=>{const t=dd(u,(t=>t.event.pointerId===e.pointerId));if(t)return t[0]})(e);if(n&&$()){const e=Re(u[0].position,r.position);C*=e/S,k.x+=u[0].translation.x+r.translation.x,k.y+=u[0].translation.y+r.translation.y,m(u[0])}let a=!1,s=!1;if(!T&&r){const e=performance.now(),t=e-r.timeStampInitial,o=Me(r.translation);a=o<64&&t<300,s=!!(R&&a&&e-M<700&&Me(R,r.position)<128),a&&(R=pe(r.position),M=e)}if(u.length>0)return;W();const l=pe(r.translation),d=pe(r.velocityAverage);let h=!1;c("interactionrelease",{isTap:a,isDoubleTap:s,position:t,translation:l,scalar:C,preventInertia:()=>h=!0});const f=Re(d);if(h||!o||f<.25)return B(l,{isTap:a,isDoubleTap:s});x=pe(t),v=pe(l),b=Jl(pe(l),{easing:Yl,duration:f*i}),b.set({x:l.x+50*d.x,y:l.y+50*d.y}).then((()=>{w&&B(tn(b),{isTap:a,isDoubleTap:s})})),w=b.subscribe(D)}function D(e){e&&c("interactionupdate",{position:ue(x.x+(e.x-v.x),x.y+(e.y-v.y)),translation:e,scalar:n?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:n?C:void 0})}function W(){l&&window.removeEventListener("keydown",E),l&&window.removeEventListener("keyup",E),document.documentElement.removeEventListener("pointermove",z),document.documentElement.removeEventListener("pointerup",F),document.documentElement.removeEventListener("pointercancel",F),document.addEventListener("visibilitychange",O)}return{destroy(){d(),e.removeEventListener("pointerdown",L)}}},pd=(e,t={})=>{const{direction:o,shiftMultiplier:i=10,bubbles:r=!1,preventDefault:n=!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 h=c?i:1;a&&t.stopPropagation(),n&&t.preventDefault(),e.dispatchEvent(new CustomEvent("nudge",{bubbles:r,detail:ue((/left/i.test(o)?-1:/right/i.test(o)?1:0)*h,(/up/i.test(o)?-1:/down/i.test(o)?1:0)*h)}))};return e.addEventListener("keydown",c),{destroy(){e.removeEventListener("keydown",c)}}};function md(e,t){return t?t*Math.sign(e)*Math.log10(1+Math.abs(e)/t):e}const gd=(e,t,o)=>{if(!t||!o)return{...e};const i=e.x+md(t.x-e.x,o),r=e.x+e.width+md(t.x+t.width-(e.x+e.width),o),n=e.y+md(t.y-e.y,o);return{x:i,y:n,width:r-i,height:e.y+e.height+md(t.y+t.height-(e.y+e.height),o)-n}},$d=(e,t,o)=>t&&o?ue(e.x+md(t.x-e.x,o),e.y+md(t.y-e.y,o)):{...e};var fd=(e,t)=>{if(e)return/em/.test(e)?16*parseInt(e,10):/px/.test(e)?parseInt(e,10):void 0},yd=e=>{let t=e.detail||0;const{deltaX:o,deltaY:i,wheelDelta:r,wheelDeltaX:n,wheelDeltaY:a}=e;return Ao(n)&&Math.abs(n)>Math.abs(a)?t=n/-120:Ao(o)&&Math.abs(o)>Math.abs(i)?t=o/20:(r||a)&&(t=(r||a)/-120),t||(t=i/20),(qo()||Xt())&&(t*=2),t};function bd(e){let t,o,i,r,n,a,s;const l=e[36].default,c=rn(l,e,e[35],null);return{c(){t=kn("div"),o=kn("div"),c&&c.c(),An(o,"style",e[5]),An(t,"class",i=Mc(["PinturaScrollable",e[0]])),An(t,"style",e[4]),An(t,"data-direction",e[1]),An(t,"data-state",e[6])},m(i,l){wn(i,t,l),bn(t,o),c&&c.m(o,null),e[38](t),n=!0,a||(s=[Pn(o,"interactionstart",e[8]),Pn(o,"interactionupdate",e[10]),Pn(o,"interactionend",e[11]),Pn(o,"interactionrelease",e[9]),hn(hd.call(null,o,{inertia:!0})),Pn(o,"measure",e[37]),hn($c.call(null,o)),Pn(t,"wheel",e[13],{passive:!1}),Pn(t,"scroll",e[15]),Pn(t,"focusin",e[14]),Pn(t,"nudge",e[16]),Pn(t,"measure",e[12]),hn($c.call(null,t,{observePosition:!0})),hn(r=pd.call(null,t,{direction:"x"===e[1]?"horizontal":"vertical",stopKeydownPropagation:!1}))],a=!0)},p(e,a){c&&c.p&&(!n||16&a[1])&&sn(c,l,e,e[35],n?an(l,e[35],a,null):ln(e[35]),null),(!n||32&a[0])&&An(o,"style",e[5]),(!n||1&a[0]&&i!==(i=Mc(["PinturaScrollable",e[0]])))&&An(t,"class",i),(!n||16&a[0])&&An(t,"style",e[4]),(!n||2&a[0])&&An(t,"data-direction",e[1]),(!n||64&a[0])&&An(t,"data-state",e[6]),r&&Jr(r.update)&&2&a[0]&&r.update.call(null,{direction:"x"===e[1]?"horizontal":"vertical",stopKeydownPropagation:!1})},i(e){n||(xa(c,e),n=!0)},o(e){va(c,e),n=!1},d(o){o&&Sn(t),c&&c.d(o),e[38](null),a=!1,Kr(s)}}}function xd(e,t,o){let i,r,n,s,l,c,d,u,{$$slots:h={},$$scope:p}=t;const m=qn();let g,$,f,y,b="idle",x=ec(0);on(e,x,(e=>o(34,u=e)));let v,{class:w}=t,{scrollBlockInteractionDist:S=5}=t,{scrollStep:k=10}=t,{scrollFocusMargin:C=64}=t,{scrollDirection:T="x"}=t,{scrollAutoCancel:M=!1}=t,{elasticity:R=0}=t,{onscroll:P=a}=t,{maskFeatherSize:E}=t,{maskFeatherStartOpacity:I}=t,{maskFeatherEndOpacity:A}=t,{scroll:L}=t,z="",F=!0;const D=x.subscribe((e=>{const t=de();t[T]=e,P(t)})),O=e=>Math.max(Math.min(0,e),f[i]-$[i]);let B,W,_;const V=(e,t={})=>{const{elastic:i=!1,animate:r=!1,preventScrollState:n=!1}=t;Math.abs(e-g)>S&&"idle"===b&&!y&&!n&&o(27,b="scrolling");const a=O(e),s=i&&R&&!y?a+md(e-a,R):a;let l=!0;r?l=!1:F||(l=!y),F=!1,x.set(s,{hard:l}).then((e=>{y&&(F=!0)}))};Yn((()=>{D()}));return e.$$set=e=>{"class"in e&&o(0,w=e.class),"scrollBlockInteractionDist"in e&&o(20,S=e.scrollBlockInteractionDist),"scrollStep"in e&&o(21,k=e.scrollStep),"scrollFocusMargin"in e&&o(22,C=e.scrollFocusMargin),"scrollDirection"in e&&o(1,T=e.scrollDirection),"scrollAutoCancel"in e&&o(23,M=e.scrollAutoCancel),"elasticity"in e&&o(24,R=e.elasticity),"onscroll"in e&&o(25,P=e.onscroll),"maskFeatherSize"in e&&o(19,E=e.maskFeatherSize),"maskFeatherStartOpacity"in e&&o(17,I=e.maskFeatherStartOpacity),"maskFeatherEndOpacity"in e&&o(18,A=e.maskFeatherEndOpacity),"scroll"in e&&o(26,L=e.scroll),"$$scope"in e&&o(35,p=e.$$scope)},e.$$.update=()=>{if(2&e.$$.dirty[0]&&o(31,i="x"===T?"width":"height"),2&e.$$.dirty[0]&&o(29,r=T.toUpperCase()),8&e.$$.dirty[0]&&o(33,n=v&&getComputedStyle(v)),8&e.$$.dirty[0]|4&e.$$.dirty[1]&&o(32,s=n&&fd(n.getPropertyValue("--scrollable-feather-size"))),268828676&e.$$.dirty[0]|11&e.$$.dirty[1]&&null!=u&&f&&null!=s&&$){const e=-1*u/s,t=-(f[i]-$[i]-u)/s;o(17,I=ns(1-e,0,1)),o(18,A=ns(1-t,0,1)),o(19,E=s),o(4,z=`--scrollable-feather-start-opacity: ${I};--scrollable-feather-end-opacity: ${A}`)}67108872&e.$$.dirty[0]&&v&&void 0!==L&&(Ao(L)?V(L):V(L.scrollOffset,L)),268435460&e.$$.dirty[0]|1&e.$$.dirty[1]&&o(30,l=f&&$?$[i]>f[i]:void 0),1207959552&e.$$.dirty[0]&&o(6,c=Mc([b,l?"overflows":void 0])),1610612736&e.$$.dirty[0]|8&e.$$.dirty[1]&&o(5,d=l?`transform: translate${r}(${u}px)`:void 0)},[w,T,$,v,z,d,c,x,()=>{l&&(W=!1,B=!0,_=ue(0,0),y=!1,o(27,b="idle"),g=tn(x))},({detail:e})=>{l&&(y=!0,o(27,b="idle"))},({detail:e})=>{l&&(W||B&&(B=!1,Me(e.translation)<.1)||(!M||"x"!==T||(e=>{const t=xe(ue(e.x-_.x,e.y-_.y),Math.abs);_=pe(e);const o=Me(t),i=t.x-t.y;return!(o>1&&i<-.5)})(e.translation)?V(g+e.translation[T],{elastic:!0}):W=!0))},({detail:e})=>{if(!l)return;if(W)return;const t=g+e.translation[T],o=O(t);F=!1,x.set(o).then((e=>{y&&(F=!0)}))},({detail:e})=>{o(28,f=e),m("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=yd(e)*(t?-1:1),i=tn(x);V(i+o*k,{animate:!0})},e=>{if(!l)return;if(!y)return;let t=e.target;e.target.classList.contains("implicit")&&(t=t.parentNode);const o=t["x"===T?"offsetLeft":"offsetTop"],r=o+t["x"===T?"offsetWidth":"offsetHeight"],n=tn(x),a=C+E;n+o<a?V(-o+a):n+r>f[i]-a&&V(f[i]-r-a,{animate:!0})},()=>{o(3,v["x"===T?"scrollLeft":"scrollTop"]=0,v)},({detail:e})=>{if(v.querySelector("[data-focus-visible]"))return;const t=-2*e[T],o=tn(x);V(o+t*k,{animate:!0,preventScrollState:!0})},I,A,E,S,k,C,M,R,P,L,b,f,r,l,i,s,n,u,p,h,e=>o(2,$=e.detail),function(e){ta[e?"unshift":"push"]((()=>{v=e,o(3,v)}))}]}class vd extends Fa{constructor(e){super(),za(this,e,xd,bd,Qr,{class:0,scrollBlockInteractionDist:20,scrollStep:21,scrollFocusMargin:22,scrollDirection:1,scrollAutoCancel:23,elasticity:24,onscroll:25,maskFeatherSize:19,maskFeatherStartOpacity:17,maskFeatherEndOpacity:18,scroll:26},null,[-1,-1])}}function wd(e,{delay:t=0,duration:o=400,easing:i=Zr}={}){const r=+getComputedStyle(e).opacity;return{delay:t,duration:o,easing:i,css:e=>"opacity: "+e*r}}function Sd(e){let t,o,i,r,n;return{c(){t=kn("span"),An(t,"class","PinturaStatusMessage")},m(o,a){wn(o,t,a),t.innerHTML=e[0],i=!0,r||(n=[Pn(t,"measure",(function(){Jr(e[1])&&e[1].apply(this,arguments)})),hn($c.call(null,t))],r=!0)},p(o,[r]){e=o,(!i||1&r)&&(t.innerHTML=e[0])},i(e){i||(la((()=>{o||(o=Sa(t,wd,{duration:500},!0)),o.run(1)})),i=!0)},o(e){o||(o=Sa(t,wd,{duration:500},!1)),o.run(0),i=!1},d(e){e&&Sn(t),e&&o&&o.end(),r=!1,Kr(n)}}}function kd(e,t,o){let{text:i}=t,{onmeasure:r=a}=t;return e.$$set=e=>{"text"in e&&o(0,i=e.text),"onmeasure"in e&&o(1,r=e.onmeasure)},[i,r]}class Cd extends Fa{constructor(e){super(),za(this,e,kd,Sd,Qr,{text:0,onmeasure:1})}}function Td(e){let t,o,i,r,n,a,s,l,c;return{c(){t=kn("span"),o=Cn("svg"),i=Cn("g"),r=Cn("circle"),n=Cn("circle"),a=Mn(),s=kn("span"),l=Tn(e[3]),An(r,"class","PinturaProgressIndicatorBar"),An(r,"r","8.5"),An(r,"cx","10"),An(r,"cy","10"),An(r,"stroke-linecap","round"),An(r,"opacity",".25"),An(n,"class","PinturaProgressIndicatorFill"),An(n,"r","8.5"),An(n,"stroke-dasharray",e[2]),An(n,"cx","10"),An(n,"cy","10"),An(n,"transform","rotate(-90) translate(-20)"),An(i,"fill","none"),An(i,"stroke","currentColor"),An(i,"stroke-width","2.5"),An(i,"stroke-linecap","round"),An(i,"opacity",e[1]),An(o,"width","20"),An(o,"height","20"),An(o,"viewBox","0 0 20 20"),An(o,"xmlns","http://www.w3.org/2000/svg"),An(o,"aria-hidden","true"),An(o,"focusable","false"),An(s,"class","implicit"),An(t,"class","PinturaProgressIndicator"),An(t,"data-status",e[0]),An(t,"style",c="opacity:"+e[4])},m(e,c){wn(e,t,c),bn(t,o),bn(o,i),bn(i,r),bn(i,n),bn(t,a),bn(t,s),bn(s,l)},p(e,[o]){4&o&&An(n,"stroke-dasharray",e[2]),2&o&&An(i,"opacity",e[1]),8&o&&Fn(l,e[3]),1&o&&An(t,"data-status",e[0]),16&o&&c!==(c="opacity:"+e[4])&&An(t,"style",c)},i:Gr,o:Gr,d(e){e&&Sn(t)}}}function Md(e,t,o){let i,r,n,a,s,l,c;const d=qn();let{progress:u}=t,{min:h=0}=t,{max:p=100}=t,{labelBusy:m="Busy"}=t,{opacity:g}=t;const $=ec(g,{precision:.01});on(e,$,(e=>o(4,c=e)));const f=ec(0,{precision:.01}),y=ec(0,{precision:.01});on(e,y,(e=>o(13,s=e)));const b=Wa([f],(e=>ns(e,h,p)));on(e,b,(e=>o(14,l=e)));const x=b.subscribe((e=>{1===u&&Math.round(e)>=100&&d("complete")}));return Zn((()=>{y.set(1)})),Yn((()=>{x()})),e.$$set=e=>{"progress"in e&&o(8,u=e.progress),"min"in e&&o(9,h=e.min),"max"in e&&o(10,p=e.max),"labelBusy"in e&&o(11,m=e.labelBusy),"opacity"in e&&o(12,g=e.opacity)},e.$$.update=()=>{4096&e.$$.dirty&&Ao(g)&&$.set(g),256&e.$$.dirty&&u&&u!==1/0&&f.set(100*u),18688&e.$$.dirty&&o(3,i=u===1/0?m:Math.round(l)+"%"),16640&e.$$.dirty&&o(2,r=u===1/0?"26.5 53":l/100*53+" 53"),8192&e.$$.dirty&&o(1,n=s),256&e.$$.dirty&&o(0,a=u===1/0?"busy":"loading")},[a,n,r,i,c,$,y,b,u,h,p,m,g,s,l]}class Rd extends Fa{constructor(e){super(),za(this,e,Md,Td,Qr,{progress:8,min:9,max:10,labelBusy:11,opacity:12})}}function Pd(e){let t,o,i;const r=e[5].default,n=rn(r,e,e[4],null);return{c(){t=kn("span"),n&&n.c(),An(t,"class",o="PinturaStatusAside "+e[0]),An(t,"style",e[1])},m(e,o){wn(e,t,o),n&&n.m(t,null),i=!0},p(e,[a]){n&&n.p&&(!i||16&a)&&sn(n,r,e,e[4],i?an(r,e[4],a,null):ln(e[4]),null),(!i||1&a&&o!==(o="PinturaStatusAside "+e[0]))&&An(t,"class",o),(!i||2&a)&&An(t,"style",e[1])},i(e){i||(xa(n,e),i=!0)},o(e){va(n,e),i=!1},d(e){e&&Sn(t),n&&n.d(e)}}}function Ed(e,t,o){let i,{$$slots:r={},$$scope:n}=t,{offset:a=0}=t,{opacity:s=0}=t,{class:l}=t;return e.$$set=e=>{"offset"in e&&o(2,a=e.offset),"opacity"in e&&o(3,s=e.opacity),"class"in e&&o(0,l=e.class),"$$scope"in e&&o(4,n=e.$$scope)},e.$$.update=()=>{12&e.$$.dirty&&o(1,i=`transform:translateX(${a}px);opacity:${s}`)},[l,i,a,s,n,r]}class Id extends Fa{constructor(e){super(),za(this,e,Ed,Pd,Qr,{offset:2,opacity:3,class:0})}}const{document:Ad}=ka;function Ld(e){let t,o,i,r;return{c(){t=Mn(),o=kn("button"),An(o,"class","PinturaImageButton"),An(o,"type","button"),An(o,"title",e[1]),o.disabled=e[2]},m(n,a){wn(n,t,a),wn(n,o,a),o.innerHTML=e[0],e[11](o),i||(r=[Pn(Ad.body,"load",e[5],!0),Pn(Ad.body,"error",e[6],!0),Pn(o,"pointerdown",e[4])],i=!0)},p(e,[t]){1&t&&(o.innerHTML=e[0]),2&t&&An(o,"title",e[1]),4&t&&(o.disabled=e[2])},i:Gr,o:Gr,d(n){n&&Sn(t),n&&Sn(o),e[11](null),i=!1,Kr(r)}}}function zd(e,t,o){let i,{html:r}=t,{title:n}=t,{onclick:s}=t,{disabled:l=!1}=t,{ongrab:c=a}=t,{ondrag:d=a}=t,{ondrop:u=a}=t;const h=e=>Me(p,ue(e.pageX,e.pageY))<256;let p;const m=e=>{document.documentElement.removeEventListener("pointermove",g),document.documentElement.removeEventListener("pointerup",m);const t=ue(e.pageX,e.pageY);if(Me(p,t)<32)return s(e);h(e)||u(e)},g=e=>{h(e)||d(e)},$=e=>i&&i.contains(e)&&"IMG"===e.nodeName;return e.$$set=e=>{"html"in e&&o(0,r=e.html),"title"in e&&o(1,n=e.title),"onclick"in e&&o(7,s=e.onclick),"disabled"in e&&o(2,l=e.disabled),"ongrab"in e&&o(8,c=e.ongrab),"ondrag"in e&&o(9,d=e.ondrag),"ondrop"in e&&o(10,u=e.ondrop)},e.$$.update=()=>{8&e.$$.dirty&&i&&i.querySelector("img")&&o(3,i.dataset.loader=!0,i)},[r,n,l,i,e=>{p=ue(e.pageX,e.pageY),c(e),document.documentElement.addEventListener("pointermove",g),document.documentElement.addEventListener("pointerup",m)},({target:e})=>{$(e)&&o(3,i.dataset.load=!0,i)},({target:e})=>{$(e)&&o(3,i.dataset.error=!0,i)},s,c,d,u,function(e){ta[e?"unshift":"push"]((()=>{i=e,o(3,i)}))}]}class Fd extends Fa{constructor(e){super(),za(this,e,zd,Ld,Qr,{html:0,title:1,onclick:7,disabled:2,ongrab:8,ondrag:9,ondrop:10})}}function Dd(e,t,o){const i=e.slice();return i[14]=t[o],i}function Od(e,t){let o,i,r,n,a,s,l;function c(){return t[10](t[14])}function d(...e){return t[11](t[14],...e)}function u(...e){return t[12](t[14],...e)}function h(...e){return t[13](t[14],...e)}return i=new Fd({props:{onclick:c,ongrab:d,ondrag:u,ondrop:h,disabled:t[1]||t[14].disabled,title:t[14].title,html:t[14].thumb}}),{key:e,first:null,c(){o=kn("li"),Ia(i.$$.fragment),r=Mn(),An(o,"style",t[6]),this.first=o},m(e,c){wn(e,o,c),Aa(i,o,null),bn(o,r),a=!0,s||(l=hn(n=t[8].call(null,o,t[14])),s=!0)},p(e,r){t=e;const s={};5&r&&(s.onclick=c),9&r&&(s.ongrab=d),17&r&&(s.ondrag=u),33&r&&(s.ondrop=h),3&r&&(s.disabled=t[1]||t[14].disabled),1&r&&(s.title=t[14].title),1&r&&(s.html=t[14].thumb),i.$set(s),(!a||64&r)&&An(o,"style",t[6]),n&&Jr(n.update)&&1&r&&n.update.call(null,t[14])},i(e){a||(xa(i.$$.fragment,e),a=!0)},o(e){va(i.$$.fragment,e),a=!1},d(e){e&&Sn(o),La(i),s=!1,l()}}}function Bd(e){let t,o,i=[],r=new Map,n=e[0];const a=e=>e[14].id;for(let t=0;t<n.length;t+=1){let o=Dd(e,n,t),s=a(o);r.set(s,i[t]=Od(s,o))}return{c(){t=kn("ul");for(let e=0;e<i.length;e+=1)i[e].c();An(t,"class","PinturaImageButtonList")},m(e,r){wn(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);o=!0},p(e,[o]){127&o&&(n=e[0],ya(),i=Ma(i,o,a,1,e,n,r,t,Ta,Od,null,Dd),ba())},i(e){if(!o){for(let e=0;e<n.length;e+=1)xa(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)va(i[e]);o=!1},d(e){e&&Sn(t);for(let e=0;e<i.length;e+=1)i[e].d()}}}function Wd(e,t,o){let i,r,{items:n}=t,{disabled:a}=t,{onclickitem:s}=t,{ongrabitem:l}=t,{ondragitem:c}=t,{ondropitem:d}=t;const u=ec(0,{stiffness:.25,damping:.9});on(e,u,(e=>o(9,r=e)));Zn((()=>u.set(1)));return e.$$set=e=>{"items"in e&&o(0,n=e.items),"disabled"in e&&o(1,a=e.disabled),"onclickitem"in e&&o(2,s=e.onclickitem),"ongrabitem"in e&&o(3,l=e.ongrabitem),"ondragitem"in e&&o(4,c=e.ondragitem),"ondropitem"in e&&o(5,d=e.ondropitem)},e.$$.update=()=>{512&e.$$.dirty&&o(6,i="opacity:"+r)},[n,a,s,l,c,d,i,u,(e,t)=>t.mount&&t.mount(e.firstChild,t),r,e=>s(e.id),(e,t)=>l&&l(e.id,t),(e,t)=>c&&c(e.id,t),(e,t)=>d&&d(e.id,t)]}class _d extends Fa{constructor(e){super(),za(this,e,Wd,Bd,Qr,{items:0,disabled:1,onclickitem:2,ongrabitem:3,ondragitem:4,ondropitem:5})}}var Vd=()=>u()&&window.devicePixelRatio||1;let Nd=null;var Hd=e=>(null===Nd&&(Nd=1===Vd()?Math.round:e=>e),Nd(e)),jd=(e,t={})=>{if(e){if(t.preventScroll&&Xt()){const t=document.body.scrollTop;return e.focus(),void(document.body.scrollTop=t)}e.focus(t)}},Ud=e=>/date|email|number|search|text|url/.test(e.type),Gd=e=>(e=>/textarea/i.test(e.nodeName))(e)||Ud(e)||e.isContentEditable;const Zd=e=>({}),Xd=e=>({}),Yd=e=>({}),qd=e=>({});function Kd(e){let t,o;const i=[e[7]];let r={$$slots:{default:[Qd]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)r=Xr(r,i[e]);return t=new cd({props:r}),e[44](t),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const r=128&o[0]?Ra(i,[Pa(e[7])]):{};131072&o[1]&&(r.$$scope={dirty:o,ctx:e}),t.$set(r)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(o){e[44](null),La(t,o)}}}function Jd(e){let t,o;const i=[e[7]];let r={};for(let e=0;e<i.length;e+=1)r=Xr(r,i[e]);return t=new cd({props:r}),e[43](t),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const r=128&o[0]?Ra(i,[Pa(e[7])]):{};t.$set(r)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(o){e[43](null),La(t,o)}}}function Qd(e){let t;const o=e[42].label,i=rn(o,e,e[48],qd);return{c(){i&&i.c()},m(e,o){i&&i.m(e,o),t=!0},p(e,r){i&&i.p&&(!t||131072&r[1])&&sn(i,o,e,e[48],t?an(o,e[48],r,Yd):ln(e[48]),qd)},i(e){t||(xa(i,e),t=!0)},o(e){va(i,e),t=!1},d(e){i&&i.d(e)}}}function eu(e){let t,o,i,r,n,a,s;const l=e[42].details,c=rn(l,e,e[48],Xd);return{c(){t=kn("div"),c&&c.c(),o=Mn(),i=kn("span"),An(i,"class","PinturaPanelTip"),An(i,"style",e[10]),An(t,"class",r=Mc(["PinturaPanel","pintura-editor-panel",e[2]])),An(t,"tabindex","-1"),An(t,"style",e[11])},m(r,l){wn(r,t,l),c&&c.m(t,null),bn(t,o),bn(t,i),e[45](t),n=!0,a||(s=[Pn(t,"close",e[46]),Pn(t,"keydown",e[18]),Pn(t,"measure",e[47]),hn($c.call(null,t))],a=!0)},p(e,o){c&&c.p&&(!n||131072&o[1])&&sn(c,l,e,e[48],n?an(l,e[48],o,Zd):ln(e[48]),Xd),(!n||1024&o[0])&&An(i,"style",e[10]),(!n||4&o[0]&&r!==(r=Mc(["PinturaPanel","pintura-editor-panel",e[2]])))&&An(t,"class",r),(!n||2048&o[0])&&An(t,"style",e[11])},i(e){n||(xa(c,e),n=!0)},o(e){va(c,e),n=!1},d(o){o&&Sn(t),c&&c.d(o),e[45](null),a=!1,Kr(s)}}}function tu(e){let t,o,i,r,n,a,s,l,c;const d=[Jd,Kd],u=[];function h(e,t){return e[1]?0:1}o=h(e),i=u[o]=d[o](e);let p=e[6]&&eu(e);return{c(){t=Mn(),i.c(),r=Mn(),p&&p.c(),n=Mn(),a=Rn()},m(i,d){wn(i,t,d),u[o].m(i,d),wn(i,r,d),p&&p.m(i,d),wn(i,n,d),wn(i,a,d),s=!0,l||(c=[Pn(document.body,"pointerdown",(function(){Jr(e[9])&&e[9].apply(this,arguments)})),Pn(document.body,"pointerup",(function(){Jr(e[8])&&e[8].apply(this,arguments)}))],l=!0)},p(t,a){let s=o;o=h(e=t),o===s?u[o].p(e,a):(ya(),va(u[s],1,1,(()=>{u[s]=null})),ba(),i=u[o],i?i.p(e,a):(i=u[o]=d[o](e),i.c()),xa(i,1),i.m(r.parentNode,r)),e[6]?p?(p.p(e,a),64&a[0]&&xa(p,1)):(p=eu(e),p.c(),xa(p,1),p.m(n.parentNode,n)):p&&(ya(),va(p,1,1,(()=>{p=null})),ba())},i(e){s||(xa(i),xa(p),xa(false),s=!0)},o(e){va(i),va(p),va(false),s=!1},d(e){e&&Sn(t),u[o].d(e),e&&Sn(r),p&&p.d(e),e&&Sn(n),e&&Sn(a),l=!1,Kr(c)}}}let ou=12;function iu(e,t,o){let i,r,n,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,{$$slots:w={},$$scope:S}=t,{buttonClass:k}=t,{buttonLabel:C}=t,{buttonLabelClass:T}=t,{buttonHideLabel:M}=t,{buttonIcon:R}=t,{buttonTitle:P}=t,{panelClass:E}=t,{isActive:I=!1}=t,{onshow:A=(({panel:e})=>jd(e,{preventScroll:!0}))}=t,{onhide:L=a}=t;const z=Jn("isAnimated");on(e,z,(e=>o(41,v=e)));const F=Jn("rootPortal");on(e,F,(e=>o(36,$=e)));const D=Jn("rootRect");let O,B,W;on(e,D,(e=>o(40,x=e)));const _=()=>o(26,W=i&&i.getBoundingClientRect());let V=de(),N=ec(0);on(e,N,(e=>o(38,y=e)));let H=de();const j=Ba({x:0,y:0});on(e,j,(e=>o(37,f=e)));const U=ec(-5,{stiffness:.1,damping:.35,precision:.001});on(e,U,(e=>o(39,b=e)));const G=e=>od(e,$)||B.isEventTarget(e);let Z,X,Y=!1;const q=e=>{Gd(e.target)||(I||_(),o(30,X=e),o(0,I=!I))},K=e=>{/down/i.test(e.key)&&(o(0,I=!0),o(30,X=e))};Yn((()=>{if(!$)return;if(!Z)return;const e=Z;sa().then((()=>{e.parentNode&&e.remove()}))}));return e.$$set=e=>{"buttonClass"in e&&o(19,k=e.buttonClass),"buttonLabel"in e&&o(1,C=e.buttonLabel),"buttonLabelClass"in e&&o(20,T=e.buttonLabelClass),"buttonHideLabel"in e&&o(21,M=e.buttonHideLabel),"buttonIcon"in e&&o(22,R=e.buttonIcon),"buttonTitle"in e&&o(23,P=e.buttonTitle),"panelClass"in e&&o(2,E=e.panelClass),"isActive"in e&&o(0,I=e.isActive),"onshow"in e&&o(24,A=e.onshow),"onhide"in e&&o(25,L=e.onhide),"$$scope"in e&&o(48,S=e.$$scope)},e.$$.update=()=>{if(16&e.$$.dirty[0]&&(i=B&&B.getElement()),536870913&e.$$.dirty[0]&&o(8,m=I?e=>{Y&&(o(29,Y=!1),G(e)||o(0,I=!1))}:void 0),1&e.$$.dirty[0]|1024&e.$$.dirty[1]&&N.set(I?1:0,{hard:!1===v}),1&e.$$.dirty[0]|1024&e.$$.dirty[1]&&U.set(I?0:-5,{hard:!1===v}),256&e.$$.dirty[1]&&o(33,r=1-b/-5),1&e.$$.dirty[0]|512&e.$$.dirty[1]&&x&&I&&_(),67108873&e.$$.dirty[0]|512&e.$$.dirty[1]&&x&&O&&W&&I){let e=W.x-x.x+.5*W.width-.5*O.width,t=W.y-x.y+W.height;const i=ou,r=ou,n=x.width-ou,a=x.height-ou,s=e,l=t,c=s+O.width,d=l+O.height;if(s<i&&(o(28,H.x=s-i,H),e=i),c>n&&(o(28,H.x=c-n,H),e=n-O.width),d>a){o(27,V.y=-1,V);r<t-O.height-W.height?(o(28,H.y=0,H),t-=O.height+W.height):(o(28,H.y=t-(d-a),H),t-=d-a)}else o(27,V.y=1,V);un(j,f=xe(ue(e,t),Hd),f)}128&e.$$.dirty[1]&&o(6,n=y>0),128&e.$$.dirty[1]&&o(35,s=y<1),134217728&e.$$.dirty[0]|320&e.$$.dirty[1]&&o(34,l=`translateX(${Math.round(f.x)+V.x*ou}px) translateY(${Math.round(f.y)+V.y*ou+V.y*b}px)`),152&e.$$.dirty[1]&&o(11,c=s?`opacity: ${y}; pointer-events: ${y<1?"none":"all"}; transform: ${l};`:"transform: "+l),4&e.$$.dirty[1]&&o(31,d=.5+.5*r),4&e.$$.dirty[1]&&o(32,u=r),402653192&e.$$.dirty[0]|67&e.$$.dirty[1]&&o(10,h=f&&O&&`opacity:${u};transform:scaleX(${d})rotate(45deg);top:${V.y<0?H.y+O.height:0}px;left:${H.x+.5*O.width}px`),1&e.$$.dirty[0]&&o(9,p=I?e=>{G(e)||o(29,Y=!0)}:void 0),96&e.$$.dirty[0]|32&e.$$.dirty[1]&&n&&$&&Z&&Z.parentNode!==$&&$.append(Z),1&e.$$.dirty[0]&&(I||o(30,X=void 0)),1090519137&e.$$.dirty[0]&&I&&n&&Z&&A({e:X,panel:Z}),33554497&e.$$.dirty[0]&&n&&!I&&L(),16252930&e.$$.dirty[0]&&o(7,g={label:C,icon:R,class:Mc(["PinturaPanelButton",k]),onkeydown:K,onclick:q,hideLabel:M,labelClass:T,title:P})},[I,C,E,O,B,Z,n,g,m,p,h,c,z,F,D,N,j,U,e=>{/esc/i.test(e.key)&&(o(0,I=!1),i.focus())},k,T,M,R,P,A,L,W,V,H,Y,X,d,u,r,l,s,$,f,y,b,x,v,w,function(e){ta[e?"unshift":"push"]((()=>{B=e,o(4,B)}))},function(e){ta[e?"unshift":"push"]((()=>{B=e,o(4,B)}))},function(e){ta[e?"unshift":"push"]((()=>{Z=e,o(5,Z)}))},e=>{e.stopPropagation(),o(0,I=!1)},e=>o(3,O=Fe(e.detail)),S]}class ru extends Fa{constructor(e){super(),za(this,e,iu,tu,Qr,{buttonClass:19,buttonLabel:1,buttonLabelClass:20,buttonHideLabel:21,buttonIcon:22,buttonTitle:23,panelClass:2,isActive:0,onshow:24,onhide:25},null,[-1,-1])}}var nu={Up:38,Down:40,Left:37,Right:39};function au(e){let t,o,i,r,n,a,s,l;const c=e[15].default,d=rn(c,e,e[14],null);return{c(){t=kn("li"),o=kn("input"),i=Mn(),r=kn("label"),d&&d.c(),An(o,"type","radio"),An(o,"class","implicit"),An(o,"id",e[7]),An(o,"name",e[0]),o.value=e[3],o.disabled=e[6],o.hidden=e[5],o.checked=e[4],An(r,"for",e[7]),An(r,"title",e[2]),An(t,"class",n=Mc(["PinturaRadioGroupOption",e[1]])),An(t,"data-hidden",e[5]),An(t,"data-disabled",e[6]),An(t,"data-selected",e[4])},m(n,c){wn(n,t,c),bn(t,o),bn(t,i),bn(t,r),d&&d.m(r,null),a=!0,s||(l=[Pn(o,"change",In(e[16])),Pn(o,"keydown",e[9]),Pn(o,"click",e[10])],s=!0)},p(e,[i]){(!a||128&i)&&An(o,"id",e[7]),(!a||1&i)&&An(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||16384&i)&&sn(d,c,e,e[14],a?an(c,e[14],i,null):ln(e[14]),null),(!a||128&i)&&An(r,"for",e[7]),(!a||4&i)&&An(r,"title",e[2]),(!a||2&i&&n!==(n=Mc(["PinturaRadioGroupOption",e[1]])))&&An(t,"class",n),(!a||32&i)&&An(t,"data-hidden",e[5]),(!a||64&i)&&An(t,"data-disabled",e[6]),(!a||16&i)&&An(t,"data-selected",e[4])},i(e){a||(xa(d,e),a=!0)},o(e){va(d,e),a=!1},d(e){e&&Sn(t),d&&d.d(e),s=!1,Kr(l)}}}function su(e,t,o){let i,r,{$$slots:n={},$$scope:a}=t,{name:s}=t,{class:l}=t,{label:c}=t,{id:d}=t,{value:u}=t,{checked:h}=t,{onkeydown:p}=t,{onclick:m}=t,{hidden:g=!1}=t,{disabled:$=!1}=t;const f=Object.values(nu),y=Jn("keysPressed");on(e,y,(e=>o(17,r=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(2,c=e.label),"id"in e&&o(11,d=e.id),"value"in e&&o(3,u=e.value),"checked"in e&&o(4,h=e.checked),"onkeydown"in e&&o(12,p=e.onkeydown),"onclick"in e&&o(13,m=e.onclick),"hidden"in e&&o(5,g=e.hidden),"disabled"in e&&o(6,$=e.disabled),"$$scope"in e&&o(14,a=e.$$scope)},e.$$.update=()=>{2049&e.$$.dirty&&o(7,i=`${s}-${d}`)},[s,l,c,u,h,g,$,i,y,e=>{p(e)},e=>{r.some((e=>f.includes(e)))||m(e)},d,p,m,a,n,function(t){Qn.call(this,e,t)}]}class lu extends Fa{constructor(e){super(),za(this,e,su,au,Qr,{name:0,class:1,label:2,id:11,value:3,checked:4,onkeydown:12,onclick:13,hidden:5,disabled:6})}}var cu=(e=[])=>e.reduce(((e,t)=>(Fo(t)?Fo(t[1]):!!t.options)?e.concat(Fo(t)?t[1]:t.options):(e.push(t),e)),[]);const du=(e,t,o)=>{let i;return Fo(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 uu=(e,t,o)=>P(e)?e(t,o):e;const hu=(e,t)=>e.map((([e,o,i])=>{if(Fo(o))return[uu(e,t),hu(o,t)];{const r=[e,uu(o,t)];if(i){let e={...i};i.icon&&(e.icon=uu(i.icon,t)),r.push(e)}return r}}));var pu=(e,t)=>hu(e,t),mu=(e,t)=>Array.isArray(e)&&Array.isArray(t)?ds(e,t):e===t;function gu(e,t,o){const i=e.slice();return i[27]=t[o],i}const $u=e=>({option:1024&e[0]}),fu=e=>({option:e[27]});function yu(e,t,o){const i=e.slice();return i[27]=t[o],i}const bu=e=>({option:1024&e[0]}),xu=e=>({option:e[27]}),vu=e=>({option:1024&e[0]}),wu=e=>({option:e[27]});function Su(e){let t,o,i,r,n,a=[],s=new Map,l=e[1]&&ku(e),c=e[10];const d=e=>e[27].id;for(let t=0;t<c.length;t+=1){let o=gu(e,c,t),i=d(o);s.set(i,a[t]=Du(i,o))}return{c(){t=kn("fieldset"),l&&l.c(),o=Mn(),i=kn("ul");for(let e=0;e<a.length;e+=1)a[e].c();An(i,"class","PinturaRadioGroupOptions"),An(t,"class",r=Mc(["PinturaRadioGroup",e[3]])),An(t,"data-layout",e[5]),An(t,"title",e[7])},m(e,r){wn(e,t,r),l&&l.m(t,null),bn(t,o),bn(t,i);for(let e=0;e<a.length;e+=1)a[e].m(i,null);n=!0},p(e,u){e[1]?l?l.p(e,u):(l=ku(e),l.c(),l.m(t,o)):l&&(l.d(1),l=null),8419153&u[0]&&(c=e[10],ya(),a=Ma(a,u,d,1,e,c,s,i,Ta,Du,null,gu),ba()),(!n||8&u[0]&&r!==(r=Mc(["PinturaRadioGroup",e[3]])))&&An(t,"class",r),(!n||32&u[0])&&An(t,"data-layout",e[5]),(!n||128&u[0])&&An(t,"title",e[7])},i(e){if(!n){for(let e=0;e<c.length;e+=1)xa(a[e]);n=!0}},o(e){for(let e=0;e<a.length;e+=1)va(a[e]);n=!1},d(e){e&&Sn(t),l&&l.d();for(let e=0;e<a.length;e+=1)a[e].d()}}}function ku(e){let t,o,i;return{c(){t=kn("legend"),o=Tn(e[1]),An(t,"class",i=e[2]&&"implicit")},m(e,i){wn(e,t,i),bn(t,o)},p(e,r){2&r[0]&&Fn(o,e[1]),4&r[0]&&i!==(i=e[2]&&"implicit")&&An(t,"class",i)},d(e){e&&Sn(t)}}}function Cu(e){let t,o;return t=new lu({props:{name:e[4],label:e[27].label,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:[Eu]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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.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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Tu(e){let t,o,i,r,n,a,s=[],l=new Map;const c=e[22].group,d=rn(c,e,e[23],wu),u=d||function(e){let t,o,i=e[27].label+"";return{c(){t=kn("span"),o=Tn(i),An(t,"class","PinturaRadioGroupOptionGroupLabel")},m(e,i){wn(e,t,i),bn(t,o)},p(e,t){1024&t[0]&&i!==(i=e[27].label+"")&&Fn(o,i)},d(e){e&&Sn(t)}}}(e);let h=e[27].options;const p=e=>e[27].id;for(let t=0;t<h.length;t+=1){let o=yu(e,h,t),i=p(o);l.set(i,s[t]=Fu(i,o))}return{c(){t=kn("li"),u&&u.c(),o=Mn(),i=kn("ul");for(let e=0;e<s.length;e+=1)s[e].c();r=Mn(),An(i,"class","PinturaRadioGroupOptions"),An(t,"class",n=Mc(["PinturaRadioGroupOptionGroup",e[9]]))},m(e,n){wn(e,t,n),u&&u.m(t,null),bn(t,o),bn(t,i);for(let e=0;e<s.length;e+=1)s[e].m(i,null);bn(t,r),a=!0},p(e,o){d?d.p&&(!a||8389632&o[0])&&sn(d,c,e,e[23],a?an(c,e[23],o,vu):ln(e[23]),wu):u&&u.p&&(!a||1024&o[0])&&u.p(e,a?o:[-1,-1]),8418641&o[0]&&(h=e[27].options,ya(),s=Ma(s,o,p,1,e,h,l,i,Ta,Fu,null,yu),ba()),(!a||512&o[0]&&n!==(n=Mc(["PinturaRadioGroupOptionGroup",e[9]])))&&An(t,"class",n)},i(e){if(!a){xa(u,e);for(let e=0;e<h.length;e+=1)xa(s[e]);a=!0}},o(e){va(u,e);for(let e=0;e<s.length;e+=1)va(s[e]);a=!1},d(e){e&&Sn(t),u&&u.d(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function Mu(e){let t,o;return t=new td({props:{$$slots:{default:[Ru]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Ru(e){let t,o=e[27].icon+"";return{c(){t=Cn("g")},m(e,i){wn(e,t,i),t.innerHTML=o},p(e,i){1024&i[0]&&o!==(o=e[27].icon+"")&&(t.innerHTML=o)},d(e){e&&Sn(t)}}}function Pu(e){let t,o,i=e[27].label+"";return{c(){t=kn("span"),o=Tn(i),An(t,"class",e[6])},m(e,i){wn(e,t,i),bn(t,o)},p(e,r){1024&r[0]&&i!==(i=e[27].label+"")&&Fn(o,i),64&r[0]&&An(t,"class",e[6])},d(e){e&&Sn(t)}}}function Eu(e){let t;const o=e[22].option,i=rn(o,e,e[23],fu),r=i||function(e){let t,o,i,r=e[27].icon&&Mu(e),n=!e[27].hideLabel&&Pu(e);return{c(){r&&r.c(),t=Mn(),n&&n.c(),o=Mn()},m(e,a){r&&r.m(e,a),wn(e,t,a),n&&n.m(e,a),wn(e,o,a),i=!0},p(e,i){e[27].icon?r?(r.p(e,i),1024&i[0]&&xa(r,1)):(r=Mu(e),r.c(),xa(r,1),r.m(t.parentNode,t)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),e[27].hideLabel?n&&(n.d(1),n=null):n?n.p(e,i):(n=Pu(e),n.c(),n.m(o.parentNode,o))},i(e){i||(xa(r),i=!0)},o(e){va(r),i=!1},d(e){r&&r.d(e),e&&Sn(t),n&&n.d(e),e&&Sn(o)}}}(e);return{c(){r&&r.c()},m(e,o){r&&r.m(e,o),t=!0},p(e,n){i?i.p&&(!t||8389632&n[0])&&sn(i,o,e,e[23],t?an(o,e[23],n,$u):ln(e[23]),fu):r&&r.p&&(!t||1088&n[0])&&r.p(e,t?n:[-1,-1])},i(e){t||(xa(r,e),t=!0)},o(e){va(r,e),t=!1},d(e){r&&r.d(e)}}}function Iu(e){let t,o;return t=new td({props:{$$slots:{default:[Au]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Au(e){let t,o=e[27].icon+"";return{c(){t=Cn("g")},m(e,i){wn(e,t,i),t.innerHTML=o},p(e,i){1024&i[0]&&o!==(o=e[27].icon+"")&&(t.innerHTML=o)},d(e){e&&Sn(t)}}}function Lu(e){let t,o,i=e[27].label+"";return{c(){t=kn("span"),o=Tn(i),An(t,"class",e[6])},m(e,i){wn(e,t,i),bn(t,o)},p(e,r){1024&r[0]&&i!==(i=e[27].label+"")&&Fn(o,i),64&r[0]&&An(t,"class",e[6])},d(e){e&&Sn(t)}}}function zu(e){let t;const o=e[22].option,i=rn(o,e,e[23],xu),r=i||function(e){let t,o,i,r=e[27].icon&&Iu(e),n=!e[27].hideLabel&&Lu(e);return{c(){r&&r.c(),t=Mn(),n&&n.c(),o=Mn()},m(e,a){r&&r.m(e,a),wn(e,t,a),n&&n.m(e,a),wn(e,o,a),i=!0},p(e,i){e[27].icon?r?(r.p(e,i),1024&i[0]&&xa(r,1)):(r=Iu(e),r.c(),xa(r,1),r.m(t.parentNode,t)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),e[27].hideLabel?n&&(n.d(1),n=null):n?n.p(e,i):(n=Lu(e),n.c(),n.m(o.parentNode,o))},i(e){i||(xa(r),i=!0)},o(e){va(r),i=!1},d(e){r&&r.d(e),e&&Sn(t),n&&n.d(e),e&&Sn(o)}}}(e);return{c(){r&&r.c()},m(e,o){r&&r.m(e,o),t=!0},p(e,n){i?i.p&&(!t||8389632&n[0])&&sn(i,o,e,e[23],t?an(o,e[23],n,bu):ln(e[23]),xu):r&&r.p&&(!t||1088&n[0])&&r.p(e,t?n:[-1,-1])},i(e){t||(xa(r,e),t=!0)},o(e){va(r,e),t=!1},d(e){r&&r.d(e)}}}function Fu(e,t){let o,i,r;return i=new lu({props:{name:t[4],label:t[27].label,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:[zu]},$$scope:{ctx:t}}}),{key:e,first:null,c(){o=Rn(),Ia(i.$$.fragment),this.first=o},m(e,t){wn(e,o,t),Aa(i,e,t),r=!0},p(e,o){t=e;const r={};16&o[0]&&(r.name=t[4]),1024&o[0]&&(r.label=t[27].label),1024&o[0]&&(r.id=t[27].id),1024&o[0]&&(r.value=t[27].value),1024&o[0]&&(r.disabled=t[27].disabled),1024&o[0]&&(r.hidden=t[27].hidden),256&o[0]&&(r.class=t[8]),1025&o[0]&&(r.checked=t[12](t[27])===t[0]),1024&o[0]&&(r.onkeydown=t[13](t[27])),1024&o[0]&&(r.onclick=t[14](t[27])),8389696&o[0]&&(r.$$scope={dirty:o,ctx:t}),i.$set(r)},i(e){r||(xa(i.$$.fragment,e),r=!0)},o(e){va(i.$$.fragment,e),r=!1},d(e){e&&Sn(o),La(i,e)}}}function Du(e,t){let o,i,r,n,a;const s=[Tu,Cu],l=[];function c(e,t){return e[27].options?0:1}return i=c(t),r=l[i]=s[i](t),{key:e,first:null,c(){o=Rn(),r.c(),n=Rn(),this.first=o},m(e,t){wn(e,o,t),l[i].m(e,t),wn(e,n,t),a=!0},p(e,o){let a=i;i=c(t=e),i===a?l[i].p(t,o):(ya(),va(l[a],1,1,(()=>{l[a]=null})),ba(),r=l[i],r?r.p(t,o):(r=l[i]=s[i](t),r.c()),xa(r,1),r.m(n.parentNode,n))},i(e){a||(xa(r),a=!0)},o(e){va(r),a=!1},d(e){e&&Sn(o),l[i].d(e),e&&Sn(n)}}}function Ou(e){let t,o,i,r=e[11].length&&Su(e);return{c(){r&&r.c(),t=Mn(),o=Rn()},m(e,n){r&&r.m(e,n),wn(e,t,n),wn(e,o,n),i=!0},p(e,o){e[11].length?r?(r.p(e,o),2048&o[0]&&xa(r,1)):(r=Su(e),r.c(),xa(r,1),r.m(t.parentNode,t)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba())},i(e){i||(xa(r),xa(false),i=!0)},o(e){va(r),va(false),i=!1},d(e){r&&r.d(e),e&&Sn(t),e&&Sn(o)}}}function Bu(e,t,o){let i,r,n,{$$slots:a={},$$scope:s}=t;const l=qn();let{label:c}=t,{hideLabel:d=!0}=t,{class:u}=t,{name:h="radio-group-"+L()}=t,{selectedIndex:p=-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:w}=t,{optionClass:S}=t,{optionGroupClass:k}=t;const C=e=>n.findIndex((t=>t.id===e.id)),T=(e,t)=>{o(0,p=C(e));const i={index:p,...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,h=e.name),"selectedIndex"in e&&o(0,p=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,w=e.locale),"optionClass"in e&&o(8,S=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=pu(y?m.filter(y):m,w)),133120&e.$$.dirty[0]&&o(10,r=((e=[],t)=>{let o=0;return e.map((e=>(o++,Fo(e)?Fo(e[1])?{id:o,label:e[0],options:e[1].map((e=>du(e,++o,t)))}:du(e,o,t):e.options?{id:e.id||o,label:e.label,options:e.options.map((e=>du(e,++o,t)))}:du(e,o,t))))})(i,f)),1024&e.$$.dirty[0]&&o(21,n=cu(r)),2654209&e.$$.dirty[0]&&p<0&&(o(0,p=n.findIndex((e=>mu(e.value,b)))),p<0&&o(0,p=(e=>e.findIndex((e=>void 0===e[0])))(m)))},[p,c,d,u,h,$,x,v,S,k,r,i,C,e=>t=>{var o;(o=t.key,/enter| /i.test(o))&&T(e,t)},e=>t=>{T(e,t)},m,g,f,y,b,w,n,a,s]}class Wu extends Fa{constructor(e){super(),za(this,e,Bu,Ou,Qr,{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 _u(e){let t,o,i,r,n,a,s,l,c,d;return{c(){t=kn("div"),o=kn("button"),i=Tn("▲"),n=Mn(),a=kn("button"),s=Tn("▼"),An(o,"type","button"),An(o,"tabindex","-1"),An(o,"aria-label",r="increase "+e[7]),An(a,"type","button"),An(a,"tabindex","-1"),An(a,"aria-label",l="decrease "+e[7]),An(t,"class","PinturaInputSpinners")},m(r,l){wn(r,t,l),bn(t,o),bn(o,i),bn(t,n),bn(t,a),bn(a,s),c||(d=[Pn(o,"click",e[17]),Pn(a,"click",e[18])],c=!0)},p(e,t){128&t&&r!==(r="increase "+e[7])&&An(o,"aria-label",r),128&t&&l!==(l="decrease "+e[7])&&An(a,"aria-label",l)},d(e){e&&Sn(t),c=!1,Kr(d)}}}function Vu(e){let t,o,i,r,n,a,s="number"===e[1]&&e[9]&&_u(e);return{c(){t=kn("div"),o=kn("input"),r=Mn(),s&&s.c(),An(o,"class","PinturaInputField"),An(o,"title",e[7]),An(o,"type",e[1]),An(o,"min",e[4]),An(o,"max",e[5]),An(o,"step",e[6]),An(o,"inputmode",e[3]),o.value=i=e[14]?e[13]:e[0],An(o,"style",e[11]),An(o,"placeholder",e[8]),An(o,"maxlength",e[12]),o.disabled=e[2],An(o,"spellcheck","false"),An(o,"autocorrect","off"),An(o,"autocapitalize","off"),An(t,"class","PinturaInput")},m(i,l){wn(i,t,l),bn(t,o),e[26](o),bn(t,r),s&&s.m(t,null),n||(a=[Pn(o,"input",e[16]),Pn(o,"blur",(function(){Jr(e[14]&&e[15])&&(e[14]&&e[15]).apply(this,arguments)})),Pn(o,"keydown",e[19]),Pn(o,"keyup",e[20])],n=!0)},p(r,[n]){e=r,128&n&&An(o,"title",e[7]),2&n&&An(o,"type",e[1]),16&n&&An(o,"min",e[4]),32&n&&An(o,"max",e[5]),64&n&&An(o,"step",e[6]),8&n&&An(o,"inputmode",e[3]),24577&n&&i!==(i=e[14]?e[13]:e[0])&&o.value!==i&&(o.value=i),2048&n&&An(o,"style",e[11]),256&n&&An(o,"placeholder",e[8]),4096&n&&An(o,"maxlength",e[12]),4&n&&(o.disabled=e[2]),"number"===e[1]&&e[9]?s?s.p(e,n):(s=_u(e),s.c(),s.m(t,null)):s&&(s.d(1),s=null)},i:Gr,o:Gr,d(o){o&&Sn(t),e[26](null),s&&s.d(),n=!1,Kr(a)}}}function Nu(e,t,o){let i,r,n,s,l,c,d,{value:u}=t,{type:h="text"}=t,{disabled:p=!1}=t,{inputmode:m}=t,{min:g}=t,{max:$}=t,{step:f}=t,{onchange:y=a}=t,{onkeydown:b=a}=t,{title:x}=t,{stepMultiplier:v=10}=t,{placeholder:w}=t,{enableSpinButtons:S=!0}=t;const k=()=>{let e=c.value;return"number"===h&&(e="numeric"===m?parseInt(e,10):parseFloat(e),!Ao(e)||Number.isNaN(e)?e=g||0:i&&(e=ns(e,g,$))),e};let C=u;const T=()=>{const e=ns(k()+(d?f*v:f),g,$);e!==u&&(o(24,C=e),o(0,u=e),y(u))},M=()=>{const e=ns(k()-(d?f*v:f),g,$);e!==u&&(o(24,C=e),o(0,u=e),y(u))};return e.$$set=e=>{"value"in e&&o(0,u=e.value),"type"in e&&o(1,h=e.type),"disabled"in e&&o(2,p=e.disabled),"inputmode"in e&&o(3,m=e.inputmode),"min"in e&&o(4,g=e.min),"max"in e&&o(5,$=e.max),"step"in e&&o(6,f=e.step),"onchange"in e&&o(21,y=e.onchange),"onkeydown"in e&&o(22,b=e.onkeydown),"title"in e&&o(7,x=e.title),"stepMultiplier"in e&&o(23,v=e.stepMultiplier),"placeholder"in e&&o(8,w=e.placeholder),"enableSpinButtons"in e&&o(9,S=e.enableSpinButtons)},e.$$.update=()=>{48&e.$$.dirty&&o(14,i=Ao(g)&&Ao($)),16778241&e.$$.dirty&&o(13,r=c===document.activeElement?C:u),32&e.$$.dirty&&o(25,n=$?($+"").length:void 0),33554440&e.$$.dirty&&o(12,s="numeric"===m&&n?n:void 0),33554432&e.$$.dirty&&o(11,l=n?`min-width:${n}em`:void 0)},[u,h,p,m,g,$,f,x,w,S,c,l,s,r,i,()=>{o(24,C=k()),y(u)},()=>{o(24,C=c.value),y(k())},T,M,e=>{d=e.shiftKey,b(e);const{key:t}=e;/up|down/i.test(t)&&(/up/i.test(t)&&T(),/down/i.test(t)&&M(),e.preventDefault(),e.stopPropagation())},e=>{const{key:t}=e;/up|down/i.test(t)&&(e.preventDefault(),e.stopPropagation())},y,b,v,C,n,function(e){ta[e?"unshift":"push"]((()=>{c=e,o(10,c)}))}]}class Hu extends Fa{constructor(e){super(),za(this,e,Nu,Vu,Qr,{value:0,type:1,disabled:2,inputmode:3,min:4,max:5,step:6,onchange:21,onkeydown:22,title:7,stepMultiplier:23,placeholder:8,enableSpinButtons:9})}}const ju=e=>({}),Uu=e=>({});function Gu(e){let t,o,i,r,n=(e[2]||e[21])+"",a=e[6]&&Xu(e);return{c(){a&&a.c(),t=Mn(),o=kn("span"),An(o,"class",i=Mc(["PinturaButtonLabel",e[3],e[5]&&"implicit"]))},m(e,i){a&&a.m(e,i),wn(e,t,i),wn(e,o,i),o.innerHTML=n,r=!0},p(e,s){e[6]?a?(a.p(e,s),64&s[0]&&xa(a,1)):(a=Xu(e),a.c(),xa(a,1),a.m(t.parentNode,t)):a&&(ya(),va(a,1,1,(()=>{a=null})),ba()),(!r||2097156&s[0])&&n!==(n=(e[2]||e[21])+"")&&(o.innerHTML=n),(!r||40&s[0]&&i!==(i=Mc(["PinturaButtonLabel",e[3],e[5]&&"implicit"])))&&An(o,"class",i)},i(e){r||(xa(a),r=!0)},o(e){va(a),r=!1},d(e){a&&a.d(e),e&&Sn(t),e&&Sn(o)}}}function Zu(e){let t,o;return t=new Hu({props:{value:e[10],onchange:e[17],type:"number",inputmode:"numeric",min:e[8].reduce(nh,1/0),max:e[8].reduce(ah,-1/0),enableSpinButtons:!1}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};1024&o[0]&&(i.value=e[10]),131072&o[0]&&(i.onchange=e[17]),256&o[0]&&(i.min=e[8].reduce(nh,1/0)),256&o[0]&&(i.max=e[8].reduce(ah,-1/0)),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Xu(e){let t,o;return t=new td({props:{class:"PinturaButtonIcon",$$slots:{default:[Yu]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};536870976&o[0]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Yu(e){let t;return{c(){t=Cn("g")},m(o,i){wn(o,t,i),t.innerHTML=e[6]},p(e,o){64&o[0]&&(t.innerHTML=e[6])},d(e){e&&Sn(t)}}}function qu(e){let t,o,i,r,n,a;const s=[Zu,Gu],l=[];function c(e,t){return e[18]?0:1}return o=c(e),i=l[o]=s[o](e),{c(){t=kn("span"),i.c(),An(t,"slot","label"),An(t,"title",r=uu(e[1],e[16])),An(t,"class",n=Mc(["PinturaButtonInner",e[18]&&"PinturaComboBox",e[4]]))},m(e,i){wn(e,t,i),l[o].m(t,null),a=!0},p(e,d){let u=o;o=c(e),o===u?l[o].p(e,d):(ya(),va(l[u],1,1,(()=>{l[u]=null})),ba(),i=l[o],i?i.p(e,d):(i=l[o]=s[o](e),i.c()),xa(i,1),i.m(t,null)),(!a||65538&d[0]&&r!==(r=uu(e[1],e[16])))&&An(t,"title",r),(!a||262160&d[0]&&n!==(n=Mc(["PinturaButtonInner",e[18]&&"PinturaComboBox",e[4]])))&&An(t,"class",n)},i(e){a||(xa(i),a=!0)},o(e){va(i),a=!1},d(e){e&&Sn(t),l[o].d()}}}function Ku(e){let t,o,i=e[31].label+"";return{c(){t=kn("span"),o=Tn(i),An(t,"slot","group")},m(e,i){wn(e,t,i),bn(t,o)},p(e,t){1&t[1]&&i!==(i=e[31].label+"")&&Fn(o,i)},d(e){e&&Sn(t)}}}function Ju(e){let t,o;return t=new td({props:{style:P(e[14])?e[14](e[31].value):e[14],$$slots:{default:[Qu]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};16384&o[0]|1&o[1]&&(i.style=P(e[14])?e[14](e[31].value):e[14]),536870912&o[0]|1&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Qu(e){let t,o=e[31].icon+"";return{c(){t=Cn("g")},m(e,i){wn(e,t,i),t.innerHTML=o},p(e,i){1&i[1]&&o!==(o=e[31].icon+"")&&(t.innerHTML=o)},d(e){e&&Sn(t)}}}function eh(e){let t,o,i,r,n,a=e[31].label+"",s=e[31].sublabel&&th(e);return{c(){t=kn("span"),o=new Bn(!1),i=Mn(),s&&s.c(),o.a=i,An(t,"style",r=P(e[15])?e[15](e[31].value):e[15]),An(t,"class",n=Mc(["PinturaDropdownOptionLabel",e[11]]))},m(e,r){wn(e,t,r),o.m(a,t),bn(t,i),s&&s.m(t,null)},p(e,i){1&i[1]&&a!==(a=e[31].label+"")&&o.p(a),e[31].sublabel?s?s.p(e,i):(s=th(e),s.c(),s.m(t,null)):s&&(s.d(1),s=null),32768&i[0]|1&i[1]&&r!==(r=P(e[15])?e[15](e[31].value):e[15])&&An(t,"style",r),2048&i[0]&&n!==(n=Mc(["PinturaDropdownOptionLabel",e[11]]))&&An(t,"class",n)},d(e){e&&Sn(t),s&&s.d()}}}function th(e){let t,o=e[31].sublabel+"";return{c(){t=kn("span"),An(t,"class","PinturaDropdownOptionSublabel")},m(e,i){wn(e,t,i),t.innerHTML=o},p(e,i){1&i[1]&&o!==(o=e[31].sublabel+"")&&(t.innerHTML=o)},d(e){e&&Sn(t)}}}function oh(e){let t,o,i,r=e[31].icon&&Ju(e),n=!e[31].hideLabel&&eh(e);return{c(){t=kn("span"),r&&r.c(),o=Mn(),n&&n.c(),An(t,"slot","option")},m(e,a){wn(e,t,a),r&&r.m(t,null),bn(t,o),n&&n.m(t,null),i=!0},p(e,i){e[31].icon?r?(r.p(e,i),1&i[1]&&xa(r,1)):(r=Ju(e),r.c(),xa(r,1),r.m(t,o)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),e[31].hideLabel?n&&(n.d(1),n=null):n?n.p(e,i):(n=eh(e),n.c(),n.m(t,null))},i(e){i||(xa(r),i=!0)},o(e){va(r),i=!1},d(e){e&&Sn(t),r&&r.d(),n&&n.d()}}}function ih(e){let t,o,i,r,n,a;const s=e[27].controls,l=rn(s,e,e[29],Uu);return i=new Wu({props:{class:"PinturaOptionsList PinturaScrollableContent",name:e[7],value:e[10],selectedIndex:e[9],optionFilter:e[12],optionMapper:e[13],optionLabelClass:Mc(["PinturaDropdownOptionLabel",e[11]]),optionGroupClass:"PinturaListOptionGroup",optionClass:"PinturaListOption",options:e[19],onchange:e[22],$$slots:{option:[oh,({option:e})=>({31:e}),({option:e})=>[0,e?1:0]],group:[Ku,({option:e})=>({31:e}),({option:e})=>[0,e?1:0]]},$$scope:{ctx:e}}}),{c(){t=kn("div"),l&&l.c(),o=Mn(),Ia(i.$$.fragment),An(t,"slot","details"),An(t,"class","PinturaOptionsListWrapper")},m(s,c){wn(s,t,c),l&&l.m(t,null),bn(t,o),Aa(i,t,null),r=!0,n||(a=Pn(t,"keydown",e[24]),n=!0)},p(e,t){l&&l.p&&(!r||536870912&t[0])&&sn(l,s,e,e[29],r?an(s,e[29],t,ju):ln(e[29]),Uu);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=Mc(["PinturaDropdownOptionLabel",e[11]])),524288&t[0]&&(o.options=e[19]),536922112&t[0]|1&t[1]&&(o.$$scope={dirty:t,ctx:e}),i.$set(o)},i(e){r||(xa(l,e),xa(i.$$.fragment,e),r=!0)},o(e){va(l,e),va(i.$$.fragment,e),r=!1},d(e){e&&Sn(t),l&&l.d(e),La(i),n=!1,a()}}}function rh(e){let t,o,i;function r(t){e[28](t)}let n={onshow:e[23],buttonClass:Mc(["PinturaDropdownButton",e[0],e[5]&&"PinturaDropdownIconOnly"]),$$slots:{details:[ih],label:[qu]},$$scope:{ctx:e}};return void 0!==e[20]&&(n.isActive=e[20]),t=new ru({props:n}),ta.push((()=>Ea(t,"isActive",r))),{c(){Ia(t.$$.fragment)},m(e,o){Aa(t,e,o),i=!0},p(e,i){const r={};33&i[0]&&(r.buttonClass=Mc(["PinturaDropdownButton",e[0],e[5]&&"PinturaDropdownIconOnly"])),540016638&i[0]&&(r.$$scope={dirty:i,ctx:e}),!o&&1048576&i[0]&&(o=!0,r.isActive=e[20],ca((()=>o=!1))),t.$set(r)},i(e){i||(xa(t.$$.fragment,e),i=!0)},o(e){va(t.$$.fragment,e),i=!1},d(e){La(t,e)}}}const nh=(e,[t])=>t<e?t:e,ah=(e,[t])=>t>e?t:e;function sh(e,t,o){let i,r,{$$slots:n={},$$scope:s}=t,{class:l}=t,{title:c}=t,{label:d}=t,{labelClass:u}=t,{innerClass:h}=t,{hideLabel:p=!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:w}=t,{optionLabelStyle:S}=t,{locale:k}=t,{onchange:C=a}=t,{onload:T=a}=t,{ondestroy:M=a}=t,{enableInput:R=!1}=t;let P;return Zn((()=>T({options:$}))),Yn((()=>M({options:$}))),e.$$set=e=>{"class"in e&&o(0,l=e.class),"title"in e&&o(1,c=e.title),"label"in e&&o(2,d=e.label),"labelClass"in e&&o(3,u=e.labelClass),"innerClass"in e&&o(4,h=e.innerClass),"hideLabel"in e&&o(5,p=e.hideLabel),"icon"in e&&o(6,m=e.icon),"name"in e&&o(7,g=e.name),"options"in e&&o(8,$=e.options),"selectedIndex"in e&&o(9,f=e.selectedIndex),"value"in e&&o(10,y=e.value),"optionLabelClass"in e&&o(11,b=e.optionLabelClass),"optionFilter"in e&&o(12,x=e.optionFilter),"optionMapper"in e&&o(13,v=e.optionMapper),"optionIconStyle"in e&&o(14,w=e.optionIconStyle),"optionLabelStyle"in e&&o(15,S=e.optionLabelStyle),"locale"in e&&o(16,k=e.locale),"onchange"in e&&o(17,C=e.onchange),"onload"in e&&o(25,T=e.onload),"ondestroy"in e&&o(26,M=e.ondestroy),"enableInput"in e&&o(18,R=e.enableInput),"$$scope"in e&&o(29,s=e.$$scope)},e.$$.update=()=>{65792&e.$$.dirty[0]&&o(19,i=k?pu($,k):$),525312&e.$$.dirty[0]&&o(21,r=i.reduce(((e,t)=>{if(e)return e;const o=Array.isArray(t)?t:[t,t],[i,r]=o;return mu(i,y)?r:void 0}),void 0)||(e=>{const t=e.find((e=>void 0===e[0]));if(t)return t[1]})(i)||y)},[l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,S,k,C,R,i,P,r,e=>{o(21,r=e.value),C(e),o(20,P=!1)},({e:e,panel:t})=>{if(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()},T,M,n,function(e){P=e,o(20,P)},s]}class lh extends Fa{constructor(e){super(),za(this,e,sh,rh,Qr,{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:16,onchange:17,onload:25,ondestroy:26,enableInput:18},null,[-1,-1])}}function ch(e){let t;return{c(){t=kn("div"),An(t,"slot","details")},m(o,i){wn(o,t,i),e[14](t)},p:Gr,d(o){o&&Sn(t),e[14](null)}}}function dh(e){let t,o,i;function r(t){e[15](t)}let n={buttonLabel:e[0],buttonClass:e[1],buttonIcon:e[2],buttonHideLabel:e[3],buttonTitle:e[4],buttonLabelClass:e[5],onshow:e[6],onhide:e[7],$$slots:{details:[ch]},$$scope:{ctx:e}};return void 0!==e[9]&&(n.isActive=e[9]),t=new ru({props:n}),ta.push((()=>Ea(t,"isActive",r))),{c(){Ia(t.$$.fragment)},m(e,o){Aa(t,e,o),i=!0},p(e,[i]){const r={};1&i&&(r.buttonLabel=e[0]),2&i&&(r.buttonClass=e[1]),4&i&&(r.buttonIcon=e[2]),8&i&&(r.buttonHideLabel=e[3]),16&i&&(r.buttonTitle=e[4]),32&i&&(r.buttonLabelClass=e[5]),64&i&&(r.onshow=e[6]),128&i&&(r.onhide=e[7]),65792&i&&(r.$$scope={dirty:i,ctx:e}),!o&&512&i&&(o=!0,r.isActive=e[9],ca((()=>o=!1))),t.$set(r)},i(e){i||(xa(t.$$.fragment,e),i=!0)},o(e){va(t.$$.fragment,e),i=!1},d(e){La(t,e)}}}function uh(e,t,o){let{buttonLabel:i}=t,{buttonClass:r}=t,{buttonIcon:n}=t,{buttonHideLabel:s}=t,{buttonTitle:l}=t,{buttonLabelClass:c}=t,{root:d}=t,{ondestroy:u=a}=t,{onshow:h=a}=t,{onhide:p=a}=t;let m,g=!1;return Yn(u),e.$$set=e=>{"buttonLabel"in e&&o(0,i=e.buttonLabel),"buttonClass"in e&&o(1,r=e.buttonClass),"buttonIcon"in e&&o(2,n=e.buttonIcon),"buttonHideLabel"in e&&o(3,s=e.buttonHideLabel),"buttonTitle"in e&&o(4,l=e.buttonTitle),"buttonLabelClass"in e&&o(5,c=e.buttonLabelClass),"root"in e&&o(10,d=e.root),"ondestroy"in e&&o(11,u=e.ondestroy),"onshow"in e&&o(6,h=e.onshow),"onhide"in e&&o(7,p=e.onhide)},e.$$.update=()=>{1280&e.$$.dirty&&m&&d&&m.firstChild!==d&&(m.hasChildNodes()?m.replaceChild(d,m.firstChild):m.append(d))},[i,r,n,s,l,c,h,p,m,g,d,u,()=>o(9,g=!1),()=>o(9,g=!0),function(e){ta[e?"unshift":"push"]((()=>{m=e,o(8,m)}))},function(e){g=e,o(9,g)}]}class hh extends Fa{constructor(e){super(),za(this,e,uh,dh,Qr,{buttonLabel:0,buttonClass:1,buttonIcon:2,buttonHideLabel:3,buttonTitle:4,buttonLabelClass:5,root:10,ondestroy:11,onshow:6,onhide:7,hide:12,show:13})}get hide(){return this.$$.ctx[12]}get show(){return this.$$.ctx[13]}}var ph=(e,t,o)=>(e-t)/(o-t);const mh=e=>({}),gh=e=>({});function $h(e){let t,o,i,r,n,a,s,l;return o=new td({props:{$$slots:{default:[fh]},$$scope:{ctx:e}}}),n=new td({props:{$$slots:{default:[yh]},$$scope:{ctx:e}}}),{c(){t=kn("button"),Ia(o.$$.fragment),i=Mn(),r=kn("button"),Ia(n.$$.fragment),An(t,"type","button"),An(t,"aria-label","Increase"),An(r,"type","button"),An(r,"aria-label","Decrease")},m(c,d){wn(c,t,d),Aa(o,t,null),wn(c,i,d),wn(c,r,d),Aa(n,r,null),a=!0,s||(l=[Pn(t,"pointerdown",e[20](1)),Pn(r,"pointerdown",e[20](-1))],s=!0)},p(e,t){const i={};128&t[1]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i);const r={};128&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){a||(xa(o.$$.fragment,e),xa(n.$$.fragment,e),a=!0)},o(e){va(o.$$.fragment,e),va(n.$$.fragment,e),a=!1},d(e){e&&Sn(t),La(o),e&&Sn(i),e&&Sn(r),La(n),s=!1,Kr(l)}}}function fh(e){let t;return{c(){t=Cn("path"),An(t,"d","M8 12 h8 M12 8 v8")},m(e,o){wn(e,t,o)},p:Gr,d(e){e&&Sn(t)}}}function yh(e){let t;return{c(){t=Cn("path"),An(t,"d","M9 12 h6")},m(e,o){wn(e,t,o)},p:Gr,d(e){e&&Sn(t)}}}function bh(e){let t,o,i,r,n,a,s,l,c,d,u,h,p,m,g,$,f;const y=e[36].default,b=rn(y,e,e[38],null),x=e[36].knob,v=rn(x,e,e[38],gh);let w=e[9]&&$h(e);return{c(){t=kn("div"),o=kn("div"),i=kn("input"),n=Mn(),a=kn("div"),b&&b.c(),l=Mn(),c=kn("div"),d=kn("div"),v&&v.c(),p=Mn(),w&&w.c(),An(i,"type","range"),An(i,"id",e[3]),An(i,"min",e[0]),An(i,"max",e[1]),An(i,"step",e[2]),i.value=e[14],An(i,"style",r=e[10]?"pointer-events:none":""),An(a,"class",s=Mc(["PinturaSliderTrack",e[5]])),An(a,"style",e[4]),An(d,"class",u=Mc(["PinturaSliderKnob",e[7]])),An(d,"style",e[6]),An(c,"class","PinturaSliderKnobController"),An(c,"style",e[17]),An(o,"class","PinturaSliderControl"),An(o,"style",h="--slider-position:"+Math.round(e[15])),An(t,"class",m=Mc(["PinturaSlider",e[12]])),An(t,"data-direction",e[8])},m(r,s){wn(r,t,s),bn(t,o),bn(o,i),e[37](i),bn(o,n),bn(o,a),b&&b.m(a,null),bn(o,l),bn(o,c),bn(c,d),v&&v.m(d,null),bn(t,p),w&&w.m(t,null),g=!0,$||(f=[Pn(i,"input",e[18]),Pn(i,"nudge",e[19]),hn(pd.call(null,i)),Pn(o,"pointerdown",(function(){Jr(e[11]&&e[13])&&(e[11]&&e[13]).apply(this,arguments)}))],$=!0)},p(n,l){e=n,(!g||8&l[0])&&An(i,"id",e[3]),(!g||1&l[0])&&An(i,"min",e[0]),(!g||2&l[0])&&An(i,"max",e[1]),(!g||4&l[0])&&An(i,"step",e[2]),(!g||16384&l[0])&&(i.value=e[14]),(!g||1024&l[0]&&r!==(r=e[10]?"pointer-events:none":""))&&An(i,"style",r),b&&b.p&&(!g||128&l[1])&&sn(b,y,e,e[38],g?an(y,e[38],l,null):ln(e[38]),null),(!g||32&l[0]&&s!==(s=Mc(["PinturaSliderTrack",e[5]])))&&An(a,"class",s),(!g||16&l[0])&&An(a,"style",e[4]),v&&v.p&&(!g||128&l[1])&&sn(v,x,e,e[38],g?an(x,e[38],l,mh):ln(e[38]),gh),(!g||128&l[0]&&u!==(u=Mc(["PinturaSliderKnob",e[7]])))&&An(d,"class",u),(!g||64&l[0])&&An(d,"style",e[6]),(!g||131072&l[0])&&An(c,"style",e[17]),(!g||32768&l[0]&&h!==(h="--slider-position:"+Math.round(e[15])))&&An(o,"style",h),e[9]?w?(w.p(e,l),512&l[0]&&xa(w,1)):(w=$h(e),w.c(),xa(w,1),w.m(t,null)):w&&(ya(),va(w,1,1,(()=>{w=null})),ba()),(!g||4096&l[0]&&m!==(m=Mc(["PinturaSlider",e[12]])))&&An(t,"class",m),(!g||256&l[0])&&An(t,"data-direction",e[8])},i(e){g||(xa(b,e),xa(v,e),xa(w),g=!0)},o(e){va(b,e),va(v,e),va(w),g=!1},d(o){o&&Sn(t),e[37](null),b&&b.d(o),v&&v.d(o),w&&w.d(),$=!1,Kr(f)}}}function xh(e,t,o){let i,r,n,s,l,c,d,u,h,p,m,g,$,f,y,{$$slots:b={},$$scope:x}=t,{min:v=0}=t,{max:w=100}=t,{step:S=1}=t,{id:k}=t,{value:C=0}=t,{valueMin:T}=t,{valueMax:M}=t,{trackStyle:P}=t,{trackClass:E}=t,{knobStyle:I}=t,{knobClass:A}=t,{ongrab:L=a}=t,{onchange:z=a}=t,{onrelease:F=a}=t,{onexceed:D=a}=t,{direction:O="x"}=t,{getValue:B=G}=t,{setValue:W=G}=t,{enableSpinButtons:_=!0}=t,{enableForceUseKnob:V=!1}=t,{enableStopPropagation:N=!0}=t,{enablePointerdownListener:H=!0}=t,{maxInteractionDistance:j=6}=t,{class:U}=t;const Z=e=>W(((e,t)=>(t=1/t,Math.round(e*t)/t))(ns(e,v,w),S),C),X=(e,t,i={})=>{const{grabbed:n=!1,released:a=!1}=i,s=Z(v+e/t*r),l=T||v,c=M||w;o(21,C=R(s)?s:ns(s,l,c)),y!==s&&(y=s,!R(s)&&(s<l||s>c)&&D(C,s),C!==f&&(f=C,n&&L(C),z(C),a&&F(C)))};let Y;const q=e=>{const t=e[u]-$;X(g+t,m)},K=e=>{m=void 0,document.documentElement.removeEventListener("pointermove",q),document.documentElement.removeEventListener("pointerup",K),z(C),F(C)},J=()=>{o(21,C=Z(i+ee*S)),z(C)};let Q,ee=1,te=!1;const oe=e=>{clearTimeout(Q),te||J(),F(C),document.removeEventListener("pointerup",oe)};return e.$$set=e=>{"min"in e&&o(0,v=e.min),"max"in e&&o(1,w=e.max),"step"in e&&o(2,S=e.step),"id"in e&&o(3,k=e.id),"value"in e&&o(21,C=e.value),"valueMin"in e&&o(22,T=e.valueMin),"valueMax"in e&&o(23,M=e.valueMax),"trackStyle"in e&&o(4,P=e.trackStyle),"trackClass"in e&&o(5,E=e.trackClass),"knobStyle"in e&&o(6,I=e.knobStyle),"knobClass"in e&&o(7,A=e.knobClass),"ongrab"in e&&o(24,L=e.ongrab),"onchange"in e&&o(25,z=e.onchange),"onrelease"in e&&o(26,F=e.onrelease),"onexceed"in e&&o(27,D=e.onexceed),"direction"in e&&o(8,O=e.direction),"getValue"in e&&o(28,B=e.getValue),"setValue"in e&&o(29,W=e.setValue),"enableSpinButtons"in e&&o(9,_=e.enableSpinButtons),"enableForceUseKnob"in e&&o(10,V=e.enableForceUseKnob),"enableStopPropagation"in e&&o(30,N=e.enableStopPropagation),"enablePointerdownListener"in e&&o(11,H=e.enablePointerdownListener),"maxInteractionDistance"in e&&o(31,j=e.maxInteractionDistance),"class"in e&&o(12,U=e.class),"$$scope"in e&&o(38,x=e.$$scope)},e.$$.update=()=>{270532608&e.$$.dirty[0]&&o(14,i=void 0!==C?B(C):0),3&e.$$.dirty[0]&&(r=w-v),16387&e.$$.dirty[0]&&o(33,n=ph(i,v,w)),4&e.$$.dirty[1]&&o(15,s=100*n),256&e.$$.dirty[0]&&o(34,l=O.toUpperCase()),256&e.$$.dirty[0]&&o(35,c="x"===O?"Width":"Height"),16&e.$$.dirty[1]&&(d="offset"+c),e.$$.dirty[1],8&e.$$.dirty[1]&&(u="page"+l),32768&e.$$.dirty[0]|8&e.$$.dirty[1]&&o(17,h=`transform: translate${l}(${s}%)`)},[v,w,S,k,P,E,I,A,O,_,V,H,U,e=>{let t=!1;N&&e.stopPropagation(),clearTimeout(Y);const o=p.getBoundingClientRect();if(m=p[d],$=e[u],g=$-o[O],V){if(Math.abs(g-n*m)>j)return;t=!0,e.stopPropagation()}return document.activeElement!==p&&p.focus(),X(g,m,{grabbed:!0}),document.documentElement.addEventListener("pointermove",q),document.documentElement.addEventListener("pointerup",K),t},i,s,p,h,e=>{m||(o(21,C=W(parseFloat(e.target.value))),C!==f&&(f=C,z(C)))},e=>{const t=p[d];X(i/r*t+e.detail[O],t),clearTimeout(Y),Y=setTimeout((()=>{F(C)}),250)},e=>t=>{clearTimeout(Y),ee=e,te=!1,Q=setInterval((()=>{te=!0,J()}),100),document.addEventListener("pointercancel",oe),document.addEventListener("pointerup",oe)},C,T,M,L,z,F,D,B,W,N,j,e=>{const t=p.getBoundingClientRect(),o=e[u]-t[O],i=p[d];return Math.abs(o-n*i)},n,l,c,b,function(e){ta[e?"unshift":"push"]((()=>{p=e,o(16,p)}))},x]}class vh extends Fa{constructor(e){super(),za(this,e,xh,bh,Qr,{min:0,max:1,step:2,id:3,value:21,valueMin:22,valueMax:23,trackStyle:4,trackClass:5,knobStyle:6,knobClass:7,ongrab:24,onchange:25,onrelease:26,onexceed:27,direction:8,getValue:28,setValue:29,enableSpinButtons:9,enableForceUseKnob:10,enableStopPropagation:30,enablePointerdownListener:11,maxInteractionDistance:31,class:12,eventDistanceToKnob:32,handlePointerDown:13},null,[-1,-1])}get eventDistanceToKnob(){return this.$$.ctx[32]}get handlePointerDown(){return this.$$.ctx[13]}}function wh(e){let t,o;return t=new td({props:{class:"PinturaButtonIcon",$$slots:{default:[Sh]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};1048580&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Sh(e){let t;return{c(){t=Cn("g")},m(o,i){wn(o,t,i),t.innerHTML=e[2]},p(e,o){4&o&&(t.innerHTML=e[2])},d(e){e&&Sn(t)}}}function kh(e){let t,o,i=uu(e[8],e[6])+"";return{c(){t=kn("span"),o=Tn(i),An(t,"class","PinturaButtonLabelPrefix")},m(e,i){wn(e,t,i),bn(t,o)},p(e,t){320&t&&i!==(i=uu(e[8],e[6])+"")&&Fn(o,i)},d(e){e&&Sn(t)}}}function Ch(e){let t,o,i,r,n,a,s,l,c,d=e[2]&&wh(e),u=e[8]&&kh(e);return{c(){t=kn("span"),d&&d.c(),o=Mn(),u&&u.c(),i=Mn(),r=kn("span"),n=Tn(e[9]),An(r,"class",a=Mc(["PinturaButtonLabel",e[3],e[5]&&"implicit"])),An(t,"slot","label"),An(t,"title",s=uu(e[1],e[6])),An(t,"class",l=Mc(["PinturaButtonInner",e[4]]))},m(e,a){wn(e,t,a),d&&d.m(t,null),bn(t,o),u&&u.m(t,null),bn(t,i),bn(t,r),bn(r,n),c=!0},p(e,h){e[2]?d?(d.p(e,h),4&h&&xa(d,1)):(d=wh(e),d.c(),xa(d,1),d.m(t,o)):d&&(ya(),va(d,1,1,(()=>{d=null})),ba()),e[8]?u?u.p(e,h):(u=kh(e),u.c(),u.m(t,i)):u&&(u.d(1),u=null),(!c||512&h)&&Fn(n,e[9]),(!c||40&h&&a!==(a=Mc(["PinturaButtonLabel",e[3],e[5]&&"implicit"])))&&An(r,"class",a),(!c||66&h&&s!==(s=uu(e[1],e[6])))&&An(t,"title",s),(!c||16&h&&l!==(l=Mc(["PinturaButtonInner",e[4]])))&&An(t,"class",l)},i(e){c||(xa(d),c=!0)},o(e){va(d),c=!1},d(e){e&&Sn(t),d&&d.d(),u&&u.d()}}}function Th(e){let t,o,i,r,n;const a=[e[12],{value:e[7]},{onchange:e[11]}];let s={};for(let e=0;e<a.length;e+=1)s=Xr(s,a[e]);return o=new vh({props:s}),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"slot","details")},m(a,s){wn(a,t,s),Aa(o,t,null),i=!0,r||(n=Pn(t,"keydown",e[10]),r=!0)},p(e,t){const i=6272&t?Ra(a,[4096&t&&Pa(e[12]),128&t&&{value:e[7]},2048&t&&{onchange:e[11]}]):{};o.$set(i)},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o),r=!1,n()}}}function Mh(e){let t,o;return t=new ru({props:{panelClass:"PinturaSliderPanel",buttonClass:Mc(["PinturaSliderButton",e[0],e[5]&&"PinturaSliderIconOnly"]),$$slots:{details:[Th],label:[Ch]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,[o]){const i={};33&o&&(i.buttonClass=Mc(["PinturaSliderButton",e[0],e[5]&&"PinturaSliderIconOnly"])),1053694&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Rh(e,t,o){const i=["class","title","label","icon","labelClass","innerClass","hideLabel","locale","value","onchange","labelPrefix"];let r=dn(t,i),{class:n}=t,{title:s}=t,{label:l=Math.round}=t,{icon:c}=t,{labelClass:d}=t,{innerClass:u}=t,{hideLabel:h=!1}=t,{locale:p}=t,{value:m}=t,{onchange:g=a}=t,{labelPrefix:$}=t;const{min:f,max:y,getValue:b=G}=r;let x;const v=e=>o(9,x=(e=>P(l)?l(b(e),f,y,e):l)(e));return e.$$set=e=>{t=Xr(Xr({},t),cn(e)),o(12,r=dn(t,i)),"class"in e&&o(0,n=e.class),"title"in e&&o(1,s=e.title),"label"in e&&o(13,l=e.label),"icon"in e&&o(2,c=e.icon),"labelClass"in e&&o(3,d=e.labelClass),"innerClass"in e&&o(4,u=e.innerClass),"hideLabel"in e&&o(5,h=e.hideLabel),"locale"in e&&o(6,p=e.locale),"value"in e&&o(7,m=e.value),"onchange"in e&&o(14,g=e.onchange),"labelPrefix"in e&&o(8,$=e.labelPrefix)},e.$$.update=()=>{8320&e.$$.dirty&&v(m)},[n,s,c,d,u,h,p,m,$,x,e=>{/tab/i.test(e.key)&&e.preventDefault()},e=>{v(e),g(e)},r,l,g]}class Ph extends Fa{constructor(e){super(),za(this,e,Rh,Mh,Qr,{class:0,title:1,label:13,icon:2,labelClass:3,innerClass:4,hideLabel:5,locale:6,value:7,onchange:14,labelPrefix:8})}}function Eh(e){let t,o,i=uu(e[0],e[1])+"";return{c(){t=kn("span"),o=Tn(i),An(t,"class",e[3])},m(e,i){wn(e,t,i),bn(t,o)},p(e,r){3&r&&i!==(i=uu(e[0],e[1])+"")&&Fn(o,i),8&r&&An(t,"class",e[3])},d(e){e&&Sn(t)}}}function Ih(e){let t,o,i,r,n=e[0]&&Eh(e);return i=new up({props:{items:e[2]}}),{c(){t=kn("li"),n&&n.c(),o=Mn(),Ia(i.$$.fragment),An(t,"class","PinturaShapeStyle")},m(e,a){wn(e,t,a),n&&n.m(t,null),bn(t,o),Aa(i,t,null),r=!0},p(e,[r]){e[0]?n?n.p(e,r):(n=Eh(e),n.c(),n.m(t,o)):n&&(n.d(1),n=null);const a={};4&r&&(a.items=e[2]),i.$set(a)},i(e){r||(xa(i.$$.fragment,e),r=!0)},o(e){va(i.$$.fragment,e),r=!1},d(e){e&&Sn(t),n&&n.d(),La(i)}}}function Ah(e,t,o){let i,{title:r}=t,{locale:n}=t,{items:a}=t,{hideTitle:s=!1}=t;return e.$$set=e=>{"title"in e&&o(0,r=e.title),"locale"in e&&o(1,n=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":""))},[r,n,a,i,s]}class Lh extends Fa{constructor(e){super(),za(this,e,Ah,Ih,Qr,{title:0,locale:1,items:2,hideTitle:4})}}var zh=(e,t,o)=>{let i,r,n;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,r=d,n=l;break;case 1:i=c,r=o,n=l;break;case 2:i=l,r=o,n=d;break;case 3:i=l,r=c,n=o;break;case 4:i=d,r=l,n=o;break;case 5:i=o,r=l,n=c}return[i,r,n]};function Fh(e){let t,o,i;return{c(){t=kn("div"),o=kn("span"),An(t,"class","PinturaColorPreview"),An(t,"title",e[0]),An(t,"style",i="--color:"+e[1])},m(e,i){wn(e,t,i),bn(t,o)},p(e,[o]){1&o&&An(t,"title",e[0]),2&o&&i!==(i="--color:"+e[1])&&An(t,"style",i)},i:Gr,o:Gr,d(e){e&&Sn(t)}}}function Dh(e,t,o){let i,{color:r}=t,{title:n}=t;return e.$$set=e=>{"color"in e&&o(2,r=e.color),"title"in e&&o(0,n=e.title)},e.$$.update=()=>{4&e.$$.dirty&&o(1,i=r?Ho(r):"transparent")},[n,i,r]}class Oh extends Fa{constructor(e){super(),za(this,e,Dh,Fh,Qr,{color:2,title:0})}}var Bh=e=>(e=e.trim(),/^rgba/.test(e)?e.substr(5).split(",").map(parseFloat).map(((e,t)=>e/(3===t?1:255))):/^rgb/.test(e)?e.substr(4).split(",").map(parseFloat).map((e=>e/255)):/^#/.test(e)?(e=>{const[,t,o,i,r]=e.split("");e=e.length>=4&&e.length<=5?`#${t}${t}${o}${o}${i}${i}${r?`${r}${r}`:""}`:e;const[n,a,s,l,c]=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(e)||[];if(n)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);function Wh(e){let t,o;return{c(){t=kn("span"),o=Tn(e[0])},m(e,i){wn(e,t,i),bn(t,o)},p(e,t){1&t[0]&&Fn(o,e[0])},d(e){e&&Sn(t)}}}function _h(e){let t,o,i,r;o=new Oh({props:{color:e[4],title:uu(e[8],e[10])}});let n=!e[9]&&Wh(e);return{c(){t=kn("span"),Ia(o.$$.fragment),i=Mn(),n&&n.c(),An(t,"slot","label"),An(t,"class","PinturaButtonLabel")},m(e,a){wn(e,t,a),Aa(o,t,null),bn(t,i),n&&n.m(t,null),r=!0},p(e,i){const r={};16&i[0]&&(r.color=e[4]),1280&i[0]&&(r.title=uu(e[8],e[10])),o.$set(r),e[9]?n&&(n.d(1),n=null):n?n.p(e,i):(n=Wh(e),n.c(),n.m(t,null))},i(e){r||(xa(o.$$.fragment,e),r=!0)},o(e){va(o.$$.fragment,e),r=!1},d(e){e&&Sn(t),La(o),n&&n.d()}}}function Vh(e){let t,o,i,r,n,a,s,l,c,d,u,h,p,m;c=new vh({props:{class:"PinturaHuePicker",knobStyle:"background-color:"+e[20],onchange:e[26],value:e[15],min:0,max:1,step:.01}});let g=e[11]&&Nh(e),$=e[14]&&Hh(e);return{c(){t=kn("div"),o=kn("div"),i=kn("div"),r=kn("div"),l=Mn(),Ia(c.$$.fragment),d=Mn(),g&&g.c(),u=Mn(),$&&$.c(),An(r,"role","button"),An(r,"aria-label","Saturation slider"),An(r,"class","PinturaPickerKnob"),An(r,"tabindex","0"),An(r,"style",n=`background-color:${e[19]};`),An(i,"class","PinturaPickerKnobController"),An(i,"style",a=`transform:translate(${e[24]}%,${e[23]}%)`),An(o,"class","PinturaSaturationPicker"),An(o,"style",s="background-color: "+e[20]),An(t,"class","PinturaPicker")},m(n,a){wn(n,t,a),bn(t,o),bn(o,i),bn(i,r),e[37](o),bn(t,l),Aa(c,t,null),bn(t,d),g&&g.m(t,null),bn(t,u),$&&$.m(t,null),h=!0,p||(m=[Pn(r,"nudge",e[29]),hn(pd.call(null,r,{preventDefault:!0})),Pn(o,"pointerdown",e[28])],p=!0)},p(e,l){(!h||524288&l[0]&&n!==(n=`background-color:${e[19]};`))&&An(r,"style",n),(!h||25165824&l[0]&&a!==(a=`transform:translate(${e[24]}%,${e[23]}%)`))&&An(i,"style",a),(!h||1048576&l[0]&&s!==(s="background-color: "+e[20]))&&An(o,"style",s);const d={};1048576&l[0]&&(d.knobStyle="background-color:"+e[20]),32768&l[0]&&(d.value=e[15]),c.$set(d),e[11]?g?(g.p(e,l),2048&l[0]&&xa(g,1)):(g=Nh(e),g.c(),xa(g,1),g.m(t,u)):g&&(ya(),va(g,1,1,(()=>{g=null})),ba()),e[14]?$?$.p(e,l):($=Hh(e),$.c(),$.m(t,null)):$&&($.d(1),$=null)},i(e){h||(xa(c.$$.fragment,e),xa(g),h=!0)},o(e){va(c.$$.fragment,e),va(g),h=!1},d(o){o&&Sn(t),e[37](null),La(c),g&&g.d(),$&&$.d(),p=!1,Kr(m)}}}function Nh(e){let t,o;return t=new vh({props:{class:"PinturaOpacityPicker",knobStyle:"background-color:"+e[17],trackStyle:`background-image:linear-gradient(to right,${e[18]},${e[19]})`,onchange:e[27],value:e[16],min:0,max:1,step:.01}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};131072&o[0]&&(i.knobStyle="background-color:"+e[17]),786432&o[0]&&(i.trackStyle=`background-image:linear-gradient(to right,${e[18]},${e[19]})`),65536&o[0]&&(i.value=e[16]),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Hh(e){let t,o,i;return{c(){t=kn("input"),An(t,"class","PinturaColorPickerInput"),An(t,"type","text"),t.value=e[22]},m(r,n){wn(r,t,n),o||(i=Pn(t,"input",e[30]),o=!0)},p(e,o){4194304&o[0]&&t.value!==e[22]&&(t.value=e[22])},d(e){e&&Sn(t),o=!1,i()}}}function jh(e){let t,o;return t=new Wu({props:{label:uu(e[10].labelColorPalette,e[10]),class:Mc(["PinturaColorPresets",e[9]?"PinturaColorPresetsGrid":"PinturaColorPresetsList"]),hideLabel:!1,name:e[1],value:e[4],optionGroupClass:"PinturaListOptionGroup",optionClass:"PinturaListOption",options:e[2].map(e[38]),selectedIndex:e[3],optionMapper:e[7],optionLabelClass:e[6],onchange:e[39],$$slots:{option:[Zh,({option:e})=>({51:e}),({option:e})=>[0,e?1048576:0]],group:[Uh,({option:e})=>({51:e}),({option:e})=>[0,e?1048576:0]]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};1024&o[0]&&(i.label=uu(e[10].labelColorPalette,e[10])),512&o[0]&&(i.class=Mc(["PinturaColorPresets",e[9]?"PinturaColorPresetsGrid":"PinturaColorPresetsList"])),2&o[0]&&(i.name=e[1]),16&o[0]&&(i.value=e[4]),1028&o[0]&&(i.options=e[2].map(e[38])),8&o[0]&&(i.selectedIndex=e[3]),128&o[0]&&(i.optionMapper=e[7]),64&o[0]&&(i.optionLabelClass=e[6]),512&o[0]|3145728&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Uh(e){let t,o,i=e[51].label+"";return{c(){t=kn("span"),o=Tn(i),An(t,"slot","group")},m(e,i){wn(e,t,i),bn(t,o)},p(e,t){1048576&t[1]&&i!==(i=e[51].label+"")&&Fn(o,i)},d(e){e&&Sn(t)}}}function Gh(e){let t,o,i=e[51].label+"";return{c(){t=kn("span"),o=Tn(i),An(t,"class","PinturaButtonLabel")},m(e,i){wn(e,t,i),bn(t,o)},p(e,t){1048576&t[1]&&i!==(i=e[51].label+"")&&Fn(o,i)},d(e){e&&Sn(t)}}}function Zh(e){let t,o,i,r;o=new Oh({props:{title:e[51].label,color:e[51].value}});let n=!e[9]&&Gh(e);return{c(){t=kn("span"),Ia(o.$$.fragment),i=Mn(),n&&n.c(),An(t,"slot","option")},m(e,a){wn(e,t,a),Aa(o,t,null),bn(t,i),n&&n.m(t,null),r=!0},p(e,i){const r={};1048576&i[1]&&(r.title=e[51].label),1048576&i[1]&&(r.color=e[51].value),o.$set(r),e[9]?n&&(n.d(1),n=null):n?n.p(e,i):(n=Gh(e),n.c(),n.m(t,null))},i(e){r||(xa(o.$$.fragment,e),r=!0)},o(e){va(o.$$.fragment,e),r=!1},d(e){e&&Sn(t),La(o),n&&n.d()}}}function Xh(e){let t,o,i,r=e[13]&&Vh(e),n=e[12]&&jh(e);return{c(){t=kn("div"),r&&r.c(),o=Mn(),n&&n.c(),An(t,"slot","details"),An(t,"class","PinturaColorPickerPanel")},m(e,a){wn(e,t,a),r&&r.m(t,null),bn(t,o),n&&n.m(t,null),i=!0},p(e,i){e[13]?r?(r.p(e,i),8192&i[0]&&xa(r,1)):(r=Vh(e),r.c(),xa(r,1),r.m(t,o)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),e[12]?n?(n.p(e,i),4096&i[0]&&xa(n,1)):(n=jh(e),n.c(),xa(n,1),n.m(t,null)):n&&(ya(),va(n,1,1,(()=>{n=null})),ba())},i(e){i||(xa(r),xa(n),i=!0)},o(e){va(r),va(n),i=!1},d(e){e&&Sn(t),r&&r.d(),n&&n.d()}}}function Yh(e){let t,o;return t=new ru({props:{buttonClass:Mc(["PinturaColorPickerButton",e[5]]),$$slots:{details:[Xh],label:[_h]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};32&o[0]&&(i.buttonClass=Mc(["PinturaColorPickerButton",e[5]])),33554399&o[0]|2097152&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function qh(e,t,o){let i,r,n,a,s,l,c,d,u,h,p,m,g,$,{label:f}=t,{name:y}=t,{options:b=[]}=t,{selectedIndex:x=-1}=t,{value:v}=t,{buttonClass:w}=t,{optionLabelClass:S}=t,{optionMapper:k}=t,{onchange:C}=t,{title:T}=t,{hidePresetLabel:M=!0}=t,{locale:R}=t,{enableOpacity:E=!0}=t,{enablePresets:I=!0}=t,{enablePicker:A=!0}=t,{enableInput:L=!1}=t;const z=(e,t)=>{if(u=[e[0],e[1],e[2]],t){let t=((e,t,o)=>{let i=Math.max(e,t,o),r=i-Math.min(e,t,o),n=r&&(i==e?(t-o)/r:i==t?2+(o-e)/r:4+(e-t)/r);return[60*(n<0?n+6:n)/360,i&&r/i,i]})(...u);o(15,s=t[0]),o(32,l=t[1]),o(33,c=t[2]),o(16,d=Ao(e[3])?e[3]:1)}o(17,h=Ho(e)),o(18,p=Ho([...u,0])),o(19,m=Ho([...u,1])),o(20,g=Ho(zh(s,1,1)))},F=()=>{const e=[...zh(s,l,c),d];z(e),C(e)},D=e=>{const t=3===e.length?[...e,1]:e;z(t,!0),C(t)},O=(e,t)=>{const i=ns(e.x/t.width,0,1),r=ns(e.y/t.height,0,1);var n;n=1-r,o(32,l=i),o(33,c=n),0===d&&o(16,d=1),F()};let B,W,_,V;const N=e=>{const t=we(he(e),V);O(ve(pe(_),t),W)},H=e=>{W=void 0,document.documentElement.removeEventListener("pointermove",N),document.documentElement.removeEventListener("pointerup",H)};let j;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,w=e.buttonClass),"optionLabelClass"in e&&o(6,S=e.optionLabelClass),"optionMapper"in e&&o(7,k=e.optionMapper),"onchange"in e&&o(31,C=e.onchange),"title"in e&&o(8,T=e.title),"hidePresetLabel"in e&&o(9,M=e.hidePresetLabel),"locale"in e&&o(10,R=e.locale),"enableOpacity"in e&&o(11,E=e.enableOpacity),"enablePresets"in e&&o(12,I=e.enablePresets),"enablePicker"in e&&o(13,A=e.enablePicker),"enableInput"in e&&o(14,L=e.enableInput)},e.$$.update=()=>{16&e.$$.dirty[0]|8&e.$$.dirty[1]&&(!v||$&&ds(v,$)||(o(34,$=[...v]),z(v,!0))),2&e.$$.dirty[1]&&o(24,i=100*l),4&e.$$.dirty[1]&&o(23,r=100-100*c),16&e.$$.dirty[1]&&o(36,n=!!j&&(j.length>=4&&j.length<=5)),18448&e.$$.dirty[0]|32&e.$$.dirty[1]&&o(22,a=L&&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,E,n):void 0)},[f,y,b,x,v,w,S,k,T,M,R,E,I,A,L,s,d,h,p,m,g,B,a,r,i,D,e=>{o(15,s=e),0===d&&o(16,d=1),F()},e=>{o(16,d=e),F()},e=>{e.stopPropagation(),W=We(B.offsetWidth,B.offsetHeight),_=(e=>ue(e.offsetX,e.offsetY))(e),V=he(e),O(_,W),document.documentElement.addEventListener("pointermove",N),document.documentElement.addEventListener("pointerup",H)},e=>{W=We(B.offsetWidth,B.offsetHeight);const t=i/100*W.width,o=r/100*W.height;O({x:t+e.detail.x,y:o+e.detail.y},W)},e=>{const{value:t}=e.target,i=t.length;if(!t.startsWith("#")||i<4||6===i||8===i||i>9)return;if(!E&&i>7)return;const r=Bh(t);r&&(o(35,j=t),z(r),C(r))},C,l,c,$,j,n,function(e){ta[e?"unshift":"push"]((()=>{B=e,o(21,B)}))},([e,t])=>[e,P(t)?t(R):t],e=>D(e.value)]}class Kh extends Fa{constructor(e){super(),za(this,e,qh,Yh,Qr,{label:0,name:1,options:2,selectedIndex:3,value:4,buttonClass:5,optionLabelClass:6,optionMapper:7,onchange:31,title:8,hidePresetLabel:9,locale:10,enableOpacity:11,enablePresets:12,enablePicker:13,enableInput:14},null,[-1,-1])}}function Jh(e){let t,o,i;return o=new up({props:{items:e[0]}}),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"class","PinturaShorthandControl PinturaShapeStyle")},m(e,r){wn(e,t,r),Aa(o,t,null),i=!0},p(e,[t]){const i={};1&t&&(i.items=e[0]),o.$set(i)},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o)}}}function Qh(e,t,o){let i,r,{value:n}=t,{onchange:a}=t,{controls:s=[]}=t;return e.$$set=e=>{o(6,t=Xr(Xr({},t),cn(e))),"value"in e&&o(1,n=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,r=s.map(((e,t)=>{const[o,r,s]=e;return[o,r,{...i,...s,value:n[t],onchange:e=>{const o=[...n];o[t]=e,a(o)}}]})))},t=cn(t),[r,n,a,s,i]}class ep extends Fa{constructor(e){super(),za(this,e,Qh,Jh,Qr,{value:1,onchange:2,controls:3})}}function tp(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 op(e){let t,o,i;const r=[e[10]];var n=e[3][e[9]]||e[9];function a(e){let t={};for(let e=0;e<r.length;e+=1)t=Xr(t,r[e]);return{props:t}}return n&&(t=Wn(n,a())),{c(){t&&Ia(t.$$.fragment),o=Rn()},m(e,r){t&&Aa(t,e,r),wn(e,o,r),i=!0},p(e,i){const s=4&i?Ra(r,[Pa(e[10])]):{};if(n!==(n=e[3][e[9]]||e[9])){if(t){ya();const e=t;va(e.$$.fragment,1,0,(()=>{La(e,1)})),ba()}n?(t=Wn(n,a()),Ia(t.$$.fragment),xa(t.$$.fragment,1),Aa(t,o.parentNode,o)):t=null}else n&&t.$set(s)},i(e){i||(t&&xa(t.$$.fragment,e),i=!0)},o(e){t&&va(t.$$.fragment,e),i=!1},d(e){e&&Sn(o),t&&La(t,e)}}}function ip(e){let t,o=e[9],i=e[9]&&sp(e);return{c(){i&&i.c(),t=Rn()},m(e,o){i&&i.m(e,o),wn(e,t,o)},p(e,r){e[9]?o?Qr(o,e[9])?(i.d(1),i=sp(e),i.c(),i.m(t.parentNode,t)):i.p(e,r):(i=sp(e),i.c(),i.m(t.parentNode,t)):o&&(i.d(1),i=null),o=e[9]},i:Gr,o(e){va(i)},d(e){e&&Sn(t),i&&i.d(e)}}}function rp(e){let t,o,i=e[10].innerHTML+"";return{c(){t=new Bn(!1),o=Rn(),t.a=o},m(e,r){t.m(i,e,r),wn(e,o,r)},p(e,o){4&o&&i!==(i=e[10].innerHTML+"")&&t.p(i)},i:Gr,o:Gr,d(e){e&&Sn(o),e&&t.d()}}}function np(e){let t,o=e[10].textContent+"";return{c(){t=Tn(o)},m(e,o){wn(e,t,o)},p(e,i){4&i&&o!==(o=e[10].textContent+"")&&Fn(t,o)},i:Gr,o:Gr,d(e){e&&Sn(t)}}}function ap(e){let t,o;return t=new up({props:{items:e[2],discardEmptyItems:!0}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};4&o&&(i.items=e[2]),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function sp(e){let t,o,i,r,n;const a=[ap,np,rp],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=Xr(d,c[e]);return{c(){t=kn(e[9]),i&&i.c(),r=Mn(),/-/.test(e[9])?zn(t,d):Ln(t,d)},m(e,i){wn(e,t,i),~o&&s[o].m(t,null),bn(t,r),n=!0},p(e,n){let u=o;o=l(e),o===u?~o&&s[o].p(e,n):(i&&(ya(),va(s[u],1,1,(()=>{s[u]=null})),ba()),~o?(i=s[o],i?i.p(e,n):(i=s[o]=a[o](e),i.c()),xa(i,1),i.m(t,r)):i=null),d=Ra(c,[4&n&&e[4](e[10])]),/-/.test(e[9])?zn(t,d):Ln(t,d)},i(e){n||(xa(i),n=!0)},o(e){va(i),n=!1},d(e){e&&Sn(t),~o&&s[o].d()}}}function lp(e,t){let o,i,r,n,a,s;const l=[ip,op],c=[];function d(e,t){return 4&t&&(i=null),null==i&&(i=!e[5](e[9])),i?0:1}return r=d(t,-1),n=c[r]=l[r](t),{key:e,first:null,c(){o=Rn(),n.c(),a=Rn(),this.first=o},m(e,t){wn(e,o,t),c[r].m(e,t),wn(e,a,t),s=!0},p(e,o){let i=r;r=d(t=e,o),r===i?c[r].p(t,o):(ya(),va(c[i],1,1,(()=>{c[i]=null})),ba(),n=c[r],n?n.p(t,o):(n=c[r]=l[r](t),n.c()),xa(n,1),n.m(a.parentNode,a))},i(e){s||(xa(n),s=!0)},o(e){va(n),s=!1},d(e){e&&Sn(o),c[r].d(e),e&&Sn(a)}}}function cp(e){let t,o,i=[],r=new Map,n=e[2];const a=e=>e[0]+e[1];for(let t=0;t<n.length;t+=1){let o=tp(e,n,t),s=a(o);r.set(s,i[t]=lp(s,o))}return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=Rn()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);wn(e,t,r),o=!0},p(e,[o]){62&o&&(n=e[2],ya(),i=Ma(i,o,a,1,e,n,r,t.parentNode,Ta,lp,t,tp),ba())},i(e){if(!o){for(let e=0;e<n.length;e+=1)xa(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)va(i[e]);o=!1},d(e){for(let t=0;t<i.length;t+=1)i[t].d(e);e&&Sn(t)}}}function dp(e,t,o){let i,r,{items:n}=t,{discardEmptyItems:a=!0}=t,{key:s=""}=t;const l={Button:cd,ImageButton:Fd,ImageButtonList:_d,Dropdown:lh,RadioGroup:Wu,Input:Hu,Panel:hh,ProgressIndicator:Rd,ShapeStyle:Lh,ToggleSlider:Ph,ColorPicker:Kh,ShorthandControl:ep},c=e=>!R(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,n=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,r=(n&&a?n.filter(d):n)||[])},[s,i,r,l,(e={})=>{const{textContent:t,innerHTML:o,...i}=e;return i},c,n,a]}class up extends Fa{constructor(e){super(),za(this,e,dp,cp,Qr,{items:6,discardEmptyItems:7,key:0})}}let hp=null;var pp=e=>{if(null===hp&&(hp=u()&&"visualViewport"in window),!hp)return!1;const t=visualViewport.height,o=()=>{e(visualViewport.height<t?"visible":"hidden")};return visualViewport.addEventListener("resize",o),()=>visualViewport.removeEventListener("resize",o)};function mp(e){let t,o;const i=[{onclick:e[1]},e[3]];let r={};for(let e=0;e<i.length;e+=1)r=Xr(r,i[e]);return t=new cd({props:r}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const r=10&o[0]?Ra(i,[2&o[0]&&{onclick:e[1]},8&o[0]&&Pa(e[3])]):{};t.$set(r)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function gp(e){let t,o;const i=[{onclick:e[0]},{class:"PinturaInputFormButtonConfirm"},e[2]];let r={};for(let e=0;e<i.length;e+=1)r=Xr(r,i[e]);return t=new cd({props:r}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const r=5&o[0]?Ra(i,[1&o[0]&&{onclick:e[0]},i[1],4&o[0]&&Pa(e[2])]):{};t.$set(r)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function $p(e){let t,o,i,r,n,a,s,l,c=e[3]&&mp(e);const d=e[24].default,u=rn(d,e,e[23],null);let h=e[2]&&gp(e);return{c(){t=kn("div"),o=kn("div"),c&&c.c(),i=Mn(),r=kn("div"),u&&u.c(),n=Mn(),h&&h.c(),An(r,"class","PinturaInputFormFields"),An(o,"class","PinturaInputFormInner"),An(t,"class","PinturaInputForm"),An(t,"data-layout",e[4]),An(t,"style",e[6])},m(d,p){wn(d,t,p),bn(t,o),c&&c.m(o,null),bn(o,i),bn(o,r),u&&u.m(r,null),bn(o,n),h&&h.m(o,null),e[25](t),a=!0,s||(l=[Pn(r,"keydown",e[10]),Pn(t,"focusin",e[7]),Pn(t,"focusout",e[8]),Pn(t,"measure",e[9]),hn($c.call(null,t))],s=!0)},p(e,r){e[3]?c?(c.p(e,r),8&r[0]&&xa(c,1)):(c=mp(e),c.c(),xa(c,1),c.m(o,i)):c&&(ya(),va(c,1,1,(()=>{c=null})),ba()),u&&u.p&&(!a||8388608&r[0])&&sn(u,d,e,e[23],a?an(d,e[23],r,null):ln(e[23]),null),e[2]?h?(h.p(e,r),4&r[0]&&xa(h,1)):(h=gp(e),h.c(),xa(h,1),h.m(o,null)):h&&(ya(),va(h,1,1,(()=>{h=null})),ba()),(!a||16&r[0])&&An(t,"data-layout",e[4]),(!a||64&r[0])&&An(t,"style",e[6])},i(e){a||(xa(c),xa(u,e),xa(h),a=!0)},o(e){va(c),va(u,e),va(h),a=!1},d(o){o&&Sn(t),c&&c.d(),u&&u.d(o),h&&h.d(),e[25](null),s=!1,Kr(l)}}}function fp(e,t,o){let i,r,n,a,s,{$$slots:l={},$$scope:c}=t,{onconfirm:d}=t,{oncancel:u}=t,{autoFocus:h=!0}=t,{autoPositionCursor:p=!0}=t,{buttonConfirm:m}=t,{buttonCancel:g}=t,{layout:$="stack"}=t,{parentRect:f}=t,{align:y}=t,{justify:b}=t,{parentMargin:x=16}=t,{panelOffset:w=de()}=t,S=!1,k=void 0,C=void 0,T="",M=0;const R=()=>{const e=s.querySelector("input, textarea");e.focus(),M>=1||e.select()},P=()=>{S=!0,I||!$o()&&!v()||o(19,T="top:1em;bottom:auto;"),$o()&&(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)})(s),o(20,M=1)};let E;const I=pp((e=>{n?"hidden"!==e||S?(clearTimeout(C),C=void 0,o(19,T=`top:${visualViewport.height-k.height-w.y}px`),"visible"===e?(o(5,s.dataset.stick=!0,s),R(),P()):(S=!1,o(20,M=0))):R():o(19,T="top: 4.5em; bottom: auto")}));return Zn((()=>{h&&R()})),Yn((()=>{I&&I()})),e.$$set=e=>{"onconfirm"in e&&o(0,d=e.onconfirm),"oncancel"in e&&o(1,u=e.oncancel),"autoFocus"in e&&o(11,h=e.autoFocus),"autoPositionCursor"in e&&o(12,p=e.autoPositionCursor),"buttonConfirm"in e&&o(2,m=e.buttonConfirm),"buttonCancel"in e&&o(3,g=e.buttonCancel),"layout"in e&&o(4,$=e.layout),"parentRect"in e&&o(13,f=e.parentRect),"align"in e&&o(14,y=e.align),"justify"in e&&o(15,b=e.justify),"parentMargin"in e&&o(16,x=e.parentMargin),"panelOffset"in e&&o(17,w=e.panelOffset),"$$scope"in e&&o(23,c=e.$$scope)},e.$$.update=()=>{385024&e.$$.dirty[0]&&o(21,i=f&&k?((e,t,o,i,r)=>{let n,a;return n="center"===i?e.x+.5*e.width-.5*t.width:"right"===i?e.x+e.width-t.width-r:e.x+r,a="center"===o?e.y+.5*e.height-.5*t.height:"bottom"===o?e.y+e.height-t.height-r:e.y+r,`left:${n}px;top:${a}px;right:auto;bottom:auto;`})(f,k,y,b,x):void 0),32&e.$$.dirty[0]&&o(22,r=s&&getComputedStyle(s)),4194304&e.$$.dirty[0]&&(n=r&&"1"===r.getPropertyValue("--editor-modal")),3670016&e.$$.dirty[0]&&o(6,a=`opacity:${M};${i||T}`)},[d,u,m,g,$,s,a,e=>{var t;((e=>/textarea/i.test(e))(e.target)||Ud(e.target))&&(E=Date.now(),p&&((t=e.target).selectionStart=t.selectionEnd=t.value.length),clearTimeout(C),C=setTimeout(P,200))},e=>{Date.now()-E>50||(e.stopPropagation(),R())},({detail:e})=>{o(18,k={width:e.width,height:e.height})},e=>"Enter"===e.key?d():"Escape"===e.key?u():void 0,h,p,f,y,b,x,w,k,T,M,i,r,c,l,function(e){ta[e?"unshift":"push"]((()=>{s=e,o(5,s)}))}]}class yp extends Fa{constructor(e){super(),za(this,e,fp,$p,Qr,{onconfirm:0,oncancel:1,autoFocus:11,autoPositionCursor:12,buttonConfirm:2,buttonCancel:3,layout:4,parentRect:13,align:14,justify:15,parentMargin:16,panelOffset:17},null,[-1,-1])}}const bp=["aspectRatio","isRotatedSideways","flip","cropSize"],xp=gs.map((([e])=>e)).filter((e=>!bp.includes(e)));var vp=(e,t)=>new CustomEvent("ping",{detail:{type:e,data:t},cancelable:!0,bubbles:!0}),wp=(e,t)=>(t?dl(e,t):e).replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase(),Sp=(e,t=G)=>{const{subscribe:o,set:i}=Ba(void 0);return{subscribe:o,destroy:((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)))).destroy}},kp=e=>/video/.test(e.type);var Cp=(e,t,o)=>new Promise(((i,r)=>{(async()=>{kp(e)&&i(await(e=>new Promise(((t,o)=>{const i=g("video");i.onseeked=()=>{const e=g("canvas");qt(i).then((({width:o,height:r})=>{e.width=o,e.height=r;const n=e.getContext("2d",{willReadFrequently:!0}),a=()=>{n.drawImage(i,0,0,e.width,e.height);const o=n.getImageData(0,0,e.width,e.height);f(e),URL.revokeObjectURL(i.src),t(o)};Xt()?setTimeout(a,16):a()}))},i.onloadeddata=()=>{i.currentTime=0},i.onerror=e=>{console.error(e),o(i.error)},i.src=URL.createObjectURL(e),i.load()})))(e));const n=await t.read(e),a=e=>D(e,o).then((e=>t.apply(e,n))).then(i).catch(r);if(A(e)||!I()||Xt()||$o())return a(e);let s;try{s=await F(((e,t)=>createImageBitmap(e).then((e=>t(null,e))).catch(t)),[e])}catch(e){}s&&s.width?await p()?Dl()&&n>1?i(await(async e=>m(await S(e)))(s)):i(s):i(t.apply(s,n)):a(e)})()})),Tp=(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),r=i*e.width,n=i*e.height,a=g("canvas",{width:r,height:n}),s=a.getContext("2d",{willReadFrequently:!0}),l=y(e)?await S(e):e;s.drawImage(l,0,0,r,n),o(m(a))}));let Mp=null;var Rp=()=>{if(null===Mp){let e=g("canvas");Mp=!!Tl(e),f(e),e=void 0}return Mp};const Pp=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],Ep={precision:1e-4},Ip={precision:.01*Ep.precision};var Ap=()=>{const e=[],t=[],o=[],i=()=>{t.forEach((e=>e(o)))},r=t=>{t.unsub=t.subscribe((r=>((t,r)=>{const n=e.indexOf(t);n<0||(o[n]=r,i())})(t,r))),i()};return{get length(){return e.length},clear:()=>{e.forEach((e=>e.unsub())),e.length=0,o.length=0},unshift:t=>{e.unshift(t),r(t)},get:t=>e[t],push:t=>{e.push(t),r(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)})}},Lp=e=>e[0]<.25&&e[1]<.25&&e[2]<.25,zp=(e={})=>new Promise((t=>{const{accept:o="image/*"}=e,i=g("input",{style:"position:absolute;visibility:hidden;width:0;height:0;",type:"file",accept:o}),r=()=>{const[e]=i.files;i.parentNode&&i.remove(),i.removeEventListener("change",r),t(e)};i.addEventListener("change",r),$o()&&document.body.append(i),i.click()})),Fp=e=>{try{return e()}catch(e){console.error(e)}},Dp=([e,t])=>e+.5*(t-e),Op=e=>Math.round(100*e),Bp=e=>ue(e.clientX,e.clientY),Wp=(e,t,o)=>{const i=Bp(e);return we(we(i,t),o)};function _p(e,t,o){let i,r,n,a,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,{root:S}=t,{locale:k}=t,{stores:C}=t,{allowPan:T=!0}=t,{allowZoom:M=!0}=t,{enablePan:R=!0}=t,{enableZoom:P=!0}=t,{enableZoomControls:E=P}=t,{enableZoomInput:I=!0}=t,{enablePanInput:A=!0}=t,{enablePanLimit:L=!0}=t,{panLimitGutterScalar:z=0}=t,{zoomOptions:F=[.25,.5,1,1.25,1.5,2,3,4,6,8,16]}=t,{zoomAdjustStep:D=.25}=t,{zoomAdjustFactor:O=.1}=t,{zoomAdjustWheelFactor:B=1}=t,{elasticity:W=5}=t,{imageSelectionRectCentered:_}=t,{imageSelectionRectScalar:V}=t,{zoomLevel:N=null}=t,{zoomControls:H}=t,{zoomMultiTouching:j=!1}=t;const{isAnimated:U,isInteracting:G,rootRect:Z,stageRect:X,stageScalar:Y,imageSelectionPan:q,imageSelectionZoom:K,imageSelectionStageFitScalar:J,imageSelectionRect:Q,imageSelectionStoredState:ee,imagePreviewUpscale:te}=C;on(e,U,(e=>o(68,v=e))),on(e,G,(e=>o(67,b=e))),on(e,Z,(e=>o(65,f=e))),on(e,X,(e=>o(64,$=e))),on(e,Y,(e=>o(45,x=e))),on(e,q,(e=>o(63,p=e))),on(e,K,(e=>o(42,h=e))),on(e,J,(e=>o(43,m=e))),on(e,Q,(e=>o(66,y=e))),on(e,ee,(e=>o(69,w=e))),on(e,te,(e=>o(44,g=e)));let oe=!1,ie=void 0,re=void 0,ne=void 0,ae=void 0;const se=e=>{const t=S.querySelector(".PinturaMain > .PinturaUtilMain")||S.querySelector('div[tabindex="0"] .PinturaUtilMain');return!!t&&(!!t.contains(e.target)&&!Gd(e.target))},le=(e={})=>{const{pan:t=p,zoom:o=h}=e;un(ee,w={translation:t,zoom:o},w)},ce=()=>p&&0===p.x&&0===p.y,he=()=>{un(K,h=void 0,h),ce()||un(q,p=de(),p),ge.set(void 0,{hard:!0})},me=()=>{he(),le()},ge=ec(void 0,{precision:.01});ge.subscribe((e=>{if(void 0===e)return un(K,h=void 0,h),void(ce()||un(q,p=de(),p));const t=h;e<=1?ce()||un(q,p=de(),p):e<=t&&un(q,p=ke(p,.8),p),un(K,h=e,h)}));const fe=e=>{ge.update((t=>{const o=e(t||m);return le({zoom:o}),o}))},ye=e=>{e?ge.set(e,{hard:!1===v}):(e=void 0,ge.set(void 0,{hard:!0})),un(K,h=e,h),le({zoom:e})},be=(e,t)=>{const o=V*t,i={..._},r=1-ns(z,0,1);lt(i,o<r?o:r);const n={..._};lt(n,o),st(n,e);const a={...n};return n.x>i.x&&(a.x=i.x),n.y>i.y&&(a.y=i.y),n.x+n.width<i.x+i.width&&(a.x=i.x+i.width-n.width),n.y+n.height<i.y+i.height&&(a.y=i.y+i.height-n.height),we(at(a),at(i))},xe=({translation:e,zoom:t=1,elastify:o=!0})=>{if(!ie)return;let i=e;const r=ue(ie.x+i.x,ie.y+i.y);if(!L)return r;const n=be(r,t);return o?$d(n,r,W):n};let ve,Ce;const Te=()=>{Ce=void 0,un(G,b=!0,b),o(33,oe=A),ve=!1,ne=!1,ie={...p},re=g?h||m:n?h||1:h||m},Me=e=>{const{scalar:t,translation:r,isMultiTouching:n}=e.detail;if(!ie||!n&&!A)return;n&&ke(r,.5),(A||n)&&(ve=!0),j||o(12,j=n);const a=i?ns(re*t,s,l):1,c=xe({translation:r,zoom:a,elastify:!0}),d=$e(c);ae=$e(p),ne=d<ae,i&&K.set(a),q.set(c),Ce=j&&{translation:e.detail.translation,scalar:t}},Re=e=>{un(G,b=!1,b),o(33,oe=!1),o(12,j=!1),ne&&ae<50&&(ie=void 0,re=void 0,q.set(de()))},Pe=e=>{un(G,b=!1,b),o(33,oe=!1),o(12,j=!1),Promise.resolve().then((()=>{if(ve&&ie){const t=Ce||e.detail,o=i?ns(re*t.scalar,s,l):1,r=xe({elastify:!1,translation:t.translation,zoom:o});q.set(r)}ie=void 0,re=void 0,A&&e.detail.isDoubleTap&&me(),le()}))};let Ee,Ie=Date.now(),Ae=0,Le=!1,ze=!1;const Fe=e=>{if(!se(e))return;if(e.preventDefault(),e.stopPropagation(),ze)return;clearTimeout(Ee);const t=yd(e),o=Date.now(),i=o-Ie;Ie=o;const r=Math.abs(t/i)>.2;Ae=r?Ae+1:0;const n=1+-1*t*B/(r?50:100),a=Wp(e,f,$);De(a,n,{isZoomingFast:r})},De=(e,t,{isZoomingFast:o})=>{const i=g?h||m:n?h||1:h||m,r=i*t,a=de(),c=p,d=g?m:n?1:m,u=Math.abs(r-d),$=r<i,f=i>d&&$||i<d&&r>i,b=Ae>=5;if(o||(Le=!1),Ae>0&&!Le&&(Le=f),b&&Le)return me(),ze=!0,void setTimeout((()=>{ze=!1}),100);if(b)return;!o&&f&&u<=.05&&(Ee=setTimeout((()=>{me()}),250)),un(K,h=ns(r,s,l),h);const x=Ke(y);lt(x,i),st(x,c);const v=at(x),w=Ke(x);lt(w,h-i+1,e);const S=at(w),k=Se(we(S,v),i);((e,t,o)=>{e.x=t,e.y=o})(a,c.x+k.x,c.y+k.y),un(q,p=$&&o?ke(pe(p),.85):be(a,i),p),le()},Oe=e=>(e?"add":"remove")+"EventListener";let Be,We,_e,Ve;const Ne=e=>{e.preventDefault(),We={...p},Ve=Ke(y),_e=Wp(e,f,$),Be=g?h||m:n?h||1:h||m},He=e=>{e.preventDefault(),un(K,h=ns(e.scale*Be,s,l),h);const t=Ke(Ve);lt(t,Be),st(t,We);const o=at(t),i=Ke(t);lt(i,h-Be+1,_e);const r=at(i),n=Se(we(r,o),Be),a={x:We.x+n.x,y:We.y+n.y};un(q,p=be(a,h),p)},je=e=>{e.preventDefault()},Ue=e=>{S[Oe(e)]("wheel",Fe),$o()||(S[Oe(e)]("gesturestart",Ne),S[Oe(e)]("gesturechange",He),S[Oe(e)]("gestureend",je))},Ge=e=>{const t=Oe(e);S[t]("interactionstart",Te),S[t]("interactionupdate",Me),S[t]("interactionrelease",Re),S[t]("interactionend",Pe)};let Ze;return Zn((()=>{Ze=hd(S,{drag:!0,pinch:!0,inertia:!0,inertiaDurationMultiplier:10,shouldStartInteraction:se})})),Yn((()=>{Ue(!1),Ge(!1),Ze.destroy(),Ze=void 0})),e.$$set=e=>{"root"in e&&o(13,S=e.root),"locale"in e&&o(14,k=e.locale),"stores"in e&&o(15,C=e.stores),"allowPan"in e&&o(16,T=e.allowPan),"allowZoom"in e&&o(17,M=e.allowZoom),"enablePan"in e&&o(18,R=e.enablePan),"enableZoom"in e&&o(19,P=e.enableZoom),"enableZoomControls"in e&&o(20,E=e.enableZoomControls),"enableZoomInput"in e&&o(21,I=e.enableZoomInput),"enablePanInput"in e&&o(22,A=e.enablePanInput),"enablePanLimit"in e&&o(23,L=e.enablePanLimit),"panLimitGutterScalar"in e&&o(24,z=e.panLimitGutterScalar),"zoomOptions"in e&&o(25,F=e.zoomOptions),"zoomAdjustStep"in e&&o(26,D=e.zoomAdjustStep),"zoomAdjustFactor"in e&&o(27,O=e.zoomAdjustFactor),"zoomAdjustWheelFactor"in e&&o(28,B=e.zoomAdjustWheelFactor),"elasticity"in e&&o(29,W=e.elasticity),"imageSelectionRectCentered"in e&&o(30,_=e.imageSelectionRectCentered),"imageSelectionRectScalar"in e&&o(31,V=e.imageSelectionRectScalar),"zoomLevel"in e&&o(32,N=e.zoomLevel),"zoomControls"in e&&o(11,H=e.zoomControls),"zoomMultiTouching"in e&&o(12,j=e.zoomMultiTouching)},e.$$.update=()=>{var t,$;2752512&e.$$.dirty[0]&&o(35,i=M&&P&&I),327680&e.$$.dirty[0]&&o(34,r=T&&R),196608&e.$$.dirty[0]&&(T||M?(un(K,h=P?w.zoom:void 0,h),un(q,p=R?pe(w.translation):ce()?p:de(),p),ge.set(h)):he()),16384&e.$$.dirty[1]&&(n=x>=1),33570816&e.$$.dirty[0]|28672&e.$$.dirty[1]&&o(39,a=[(g||x<1)&&[m,Op(m)+"%",{sublabel:k.labelZoomFit}],...F.map((e=>[e,Op(e)+"%"]))].filter(Boolean).map((e=>(1===e[0]&&(e[2]={sublabel:k.labelZoomActual}),e))).sort(((e,t)=>{const o=e[0]||m,i=t[0]||m;return o<i?-1:i<o?1:0}))),4352&e.$$.dirty[1]&&o(37,s=Math.min(a.reduce(((e,[t])=>t<e?t:e),Number.MAX_SAFE_INTEGER),m)),256&e.$$.dirty[1]&&o(36,l=a.reduce(((e,[t])=>t>e?t:e),Number.MIN_SAFE_INTEGER)),2&e.$$.dirty[1]&&null!==N&&ye(N),30720&e.$$.dirty[1]&&o(41,d=h||(g||x<1?m:1)),1280&e.$$.dirty[1]&&o(38,(t=a.map((([e])=>e)),$=d,c=t.findIndex((e=>e===$)))),1024&e.$$.dirty[1]&&o(40,u=Op(d)+"%"),202522624&e.$$.dirty[0]|3040&e.$$.dirty[1]&&o(11,H=(M||M)&&E?[["Button","zoom-out",{hideLabel:!0,label:k.labelZoomOut,icon:k.iconZoomOut,disabled:h===s,onclick:()=>fe((e=>Math.max(s,e-D))),onhold:()=>fe((e=>Math.max(s,e*(1-O))))}],["Dropdown","zoom-level",{label:u,labelClass:"PinturaFixedWidthCharacters",options:a,selectedIndex:c,onchange:e=>ye(e.value)}],["Button","zoom-in",{hideLabel:!0,label:k.labelZoomIn,icon:k.iconZoomIn,disabled:h===l,onclick:()=>fe((e=>Math.min(l,e+D))),onhold:()=>fe((e=>Math.min(l,e*(1+O))))}]]:[]),8192&e.$$.dirty[0]|16&e.$$.dirty[1]&&S&&Ue(i),8192&e.$$.dirty[0]|8&e.$$.dirty[1]&&S&&Ge(r),4202496&e.$$.dirty[0]|12&e.$$.dirty[1]&&S&&S.style.setProperty("--cursor",r&&A?oe?"grabbing":"grab":"")},[U,G,Z,X,Y,q,K,J,Q,ee,te,H,j,S,k,C,T,M,R,P,E,I,A,L,z,F,D,O,B,W,_,V,N,oe,r,i,l,s,c,a,u,d,h,m,g,x]}class Vp extends Fa{constructor(e){super(),za(this,e,_p,null,Qr,{root:13,locale:14,stores:15,allowPan:16,allowZoom:17,enablePan:18,enableZoom:19,enableZoomControls:20,enableZoomInput:21,enablePanInput:22,enablePanLimit:23,panLimitGutterScalar:24,zoomOptions:25,zoomAdjustStep:26,zoomAdjustFactor:27,zoomAdjustWheelFactor:28,elasticity:29,imageSelectionRectCentered:30,imageSelectionRectScalar:31,zoomLevel:32,zoomControls:11,zoomMultiTouching:12},null,[-1,-1,-1,-1])}}const Np=e=>new Promise((t=>{const o=new FileReader;o.onload=()=>t(o.result),o.readAsArrayBuffer(e)})),Hp=1836476516,jp=(e,t=0,o=e.byteLength)=>{const i=[],r=t+o;for(;t<r;){const o=e.getUint32(t);if(o<0)break;const r=e.getUint32(t+4);if(i.push({type:r,size:o,offset:t,bodyOffset:t+8,bodySize:o-8}),o<8)break;t+=o}return i},Up=(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,r=-1;for(let n=t;n<o;n++)if(i||1953653099!==e.getUint32(n)||(i=!0,n+=4),i&&64==e.getUint8(n)){r=n;break}if(r<0)return 0;const n=e.getUint32(r-28),a=e.getUint32(r-20),s=e.getUint32(r-32),l=e.getUint32(r-16);return 65536===n&&4294901760===a?90:4294901760===s&&4294901760===l?180:4294901760===n&&65536===a?270:0})(e,o,t):1903435808===i?(e=>{const t=jp(e).find((e=>1836019574===e.type));if(!t)return 0;const o=jp(e,t.bodyOffset,t.bodySize);o.filter((e=>1953653099===e.type)).forEach((t=>{o.push(...jp(e,t.bodyOffset,t.bodySize))}));const i=[Hp,1953196132],r=o.filter((e=>i.includes(e.type)));for(const{type:t,bodyOffset:o}of r){const i=e.getUint8(o);let r=o+4;r+=t===Hp?32:36,r+=1===i?12:0;const n=e.getInt32(r),a=e.getInt32(r+4);if(0===n&&a>0)return 90;if(n<0&&0===a)return 180;if(0===n&&a<0)return 270}return 0})(e):0},{window:Gp}=ka;function Zp(e){let t,o,i,r=e[42]&&Xp(e),n=e[39]&&im(e);return{c(){r&&r.c(),t=Mn(),n&&n.c(),o=Rn()},m(e,a){r&&r.m(e,a),wn(e,t,a),n&&n.m(e,a),wn(e,o,a),i=!0},p(e,i){e[42]?r?(r.p(e,i),2048&i[1]&&xa(r,1)):(r=Xp(e),r.c(),xa(r,1),r.m(t.parentNode,t)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),e[39]?n?(n.p(e,i),256&i[1]&&xa(n,1)):(n=im(e),n.c(),xa(n,1),n.m(o.parentNode,o)):n&&(ya(),va(n,1,1,(()=>{n=null})),ba())},i(e){i||(xa(r),xa(n),i=!0)},o(e){va(r),va(n),i=!1},d(e){r&&r.d(e),e&&Sn(t),n&&n.d(e),e&&Sn(o)}}}function Xp(e){let t,o,i,r,n,a;const s=[qp,Yp],l=[];function c(e,t){return e[40]?0:e[35]?1:-1}return~(i=c(e))&&(r=l[i]=s[i](e)),{c(){t=kn("div"),o=kn("p"),r&&r.c(),An(o,"style",e[73]),An(t,"class","PinturaStatus"),An(t,"style",n="opacity: "+e[55])},m(e,r){wn(e,t,r),bn(t,o),~i&&l[i].m(o,null),a=!0},p(e,d){let u=i;i=c(e),i===u?~i&&l[i].p(e,d):(r&&(ya(),va(l[u],1,1,(()=>{l[u]=null})),ba()),~i?(r=l[i],r?r.p(e,d):(r=l[i]=s[i](e),r.c()),xa(r,1),r.m(o,null)):r=null),(!a||2048&d[2])&&An(o,"style",e[73]),(!a||16777216&d[1]&&n!==(n="opacity: "+e[55]))&&An(t,"style",n)},i(e){a||(xa(r),a=!0)},o(e){va(r),a=!1},d(e){e&&Sn(t),~i&&l[i].d()}}}function Yp(e){let t,o,i,r;t=new Cd({props:{text:e[35].text||"",onmeasure:e[214]}});let n=e[35].aside&&Kp(e);return{c(){Ia(t.$$.fragment),o=Mn(),n&&n.c(),i=Rn()},m(e,a){Aa(t,e,a),wn(e,o,a),n&&n.m(e,a),wn(e,i,a),r=!0},p(e,o){const r={};16&o[1]&&(r.text=e[35].text||""),t.$set(r),e[35].aside?n?(n.p(e,o),16&o[1]&&xa(n,1)):(n=Kp(e),n.c(),xa(n,1),n.m(i.parentNode,i)):n&&(ya(),va(n,1,1,(()=>{n=null})),ba())},i(e){r||(xa(t.$$.fragment,e),xa(n),r=!0)},o(e){va(t.$$.fragment,e),va(n),r=!1},d(e){La(t,e),e&&Sn(o),n&&n.d(e),e&&Sn(i)}}}function qp(e){let t,o,i,r;return t=new Cd({props:{text:e[40],onmeasure:e[214]}}),i=new Id({props:{class:"PinturaStatusIcon",offset:e[83],opacity:e[84],$$slots:{default:[om]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment),o=Mn(),Ia(i.$$.fragment)},m(e,n){Aa(t,e,n),wn(e,o,n),Aa(i,e,n),r=!0},p(e,o){const r={};512&o[1]&&(r.text=e[40]),t.$set(r);const n={};2097152&o[2]&&(n.offset=e[83]),4194304&o[2]&&(n.opacity=e[84]),8&o[0]|536870912&o[18]&&(n.$$scope={dirty:o,ctx:e}),i.$set(n)},i(e){r||(xa(t.$$.fragment,e),xa(i.$$.fragment,e),r=!0)},o(e){va(t.$$.fragment,e),va(i.$$.fragment,e),r=!1},d(e){La(t,e),e&&Sn(o),La(i,e)}}}function Kp(e){let t,o;return t=new Id({props:{class:"PinturaStatusButton",offset:e[83],opacity:e[84],$$slots:{default:[em]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};2097152&o[2]&&(i.offset=e[83]),4194304&o[2]&&(i.opacity=e[84]),16&o[1]|536870912&o[18]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Jp(e){let t,o;return t=new Rd({props:{progress:e[35].progressIndicator.progress}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Qp(e){let t,o;const i=[e[35].closeButton,{hideLabel:!0}];let r={};for(let e=0;e<i.length;e+=1)r=Xr(r,i[e]);return t=new cd({props:r}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const r=16&o[1]?Ra(i,[Pa(e[35].closeButton),i[1]]):{};t.$set(r)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function em(e){let t,o,i,r=e[35].progressIndicator.visible&&Jp(e),n=e[35].closeButton&&e[35].text&&Qp(e);return{c(){r&&r.c(),t=Mn(),n&&n.c(),o=Rn()},m(e,a){r&&r.m(e,a),wn(e,t,a),n&&n.m(e,a),wn(e,o,a),i=!0},p(e,i){e[35].progressIndicator.visible?r?(r.p(e,i),16&i[1]&&xa(r,1)):(r=Jp(e),r.c(),xa(r,1),r.m(t.parentNode,t)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),e[35].closeButton&&e[35].text?n?(n.p(e,i),16&i[1]&&xa(n,1)):(n=Qp(e),n.c(),xa(n,1),n.m(o.parentNode,o)):n&&(ya(),va(n,1,1,(()=>{n=null})),ba())},i(e){i||(xa(r),xa(n),i=!0)},o(e){va(r),va(n),i=!1},d(e){r&&r.d(e),e&&Sn(t),n&&n.d(e),e&&Sn(o)}}}function tm(e){let t,o=e[3].iconSupportError+"";return{c(){t=Cn("g")},m(e,i){wn(e,t,i),t.innerHTML=o},p(e,i){8&i[0]&&o!==(o=e[3].iconSupportError+"")&&(t.innerHTML=o)},d(e){e&&Sn(t)}}}function om(e){let t,o;return t=new td({props:{$$slots:{default:[tm]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};8&o[0]|536870912&o[18]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function im(e){let t,o,i,r,n,a,s,l,c,d,u,h,p,m,g=e[10]&&rm(e),$=e[46]&&e[45]&&nm(e);const f=[dm,cm],y=[];function b(e,t){return e[46]?0:1}function x(t){e[427](t)}function v(t){e[428](t)}function w(t){e[429](t)}i=b(e),r=y[i]=f[i](e),a=new Tc({props:{isAnimated:e[54],isTransparent:e[20],pixelRatio:e[58],textPixelRatio:e[6],backgroundColor:e[57],maskRect:e[59],maskOpacity:e[74]?e[74].maskOpacity:1,maskMarkupOpacity:e[7],maskFrameOpacity:e[5],clipAnnotationsToImage:e[86],images:e[56],interfaceImages:e[87],loadImageData:e[28],enableGrid:e[11],gridSize:e[88],gridColors:[e[89],e[90]],gridOpacity:e[91],selectionColor:e[92],willRequest:e[82]||e[93],willRender:e[424],didRender:e[425]}});let S={root:e[2],locale:e[3],stores:e[200],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:$m*e[8]};return void 0!==e[0]&&(S.zoomLevel=e[0]),void 0!==e[33]&&(S.zoomControls=e[33]),void 0!==e[34]&&(S.zoomMultiTouching=e[34]),d=new Vp({props:S}),ta.push((()=>Ea(d,"zoomLevel",x))),ta.push((()=>Ea(d,"zoomControls",v))),ta.push((()=>Ea(d,"zoomMultiTouching",w))),{c(){g&&g.c(),t=Mn(),$&&$.c(),o=Mn(),r.c(),n=Mn(),Ia(a.$$.fragment),s=Mn(),l=kn("div"),c=Mn(),Ia(d.$$.fragment),An(l,"class","PinturaRootPortal")},m(r,u){g&&g.m(r,u),wn(r,t,u),$&&$.m(r,u),wn(r,o,u),y[i].m(r,u),wn(r,n,u),Aa(a,r,u),wn(r,s,u),wn(r,l,u),e[426](l),wn(r,c,u),Aa(d,r,u),m=!0},p(e,s){e[10]?g?(g.p(e,s),1024&s[0]&&xa(g,1)):(g=rm(e),g.c(),xa(g,1),g.m(t.parentNode,t)):g&&(ya(),va(g,1,1,(()=>{g=null})),ba()),e[46]&&e[45]?$?($.p(e,s),49152&s[1]&&xa($,1)):($=nm(e),$.c(),xa($,1),$.m(o.parentNode,o)):$&&(ya(),va($,1,1,(()=>{$=null})),ba());let l=i;i=b(e),i===l?y[i].p(e,s):(ya(),va(y[l],1,1,(()=>{y[l]=null})),ba(),r=y[i],r?r.p(e,s):(r=y[i]=f[i](e),r.c()),xa(r,1),r.m(n.parentNode,n));const c={};8388608&s[1]&&(c.isAnimated=e[54]),1048576&s[0]&&(c.isTransparent=e[20]),134217728&s[1]&&(c.pixelRatio=e[58]),64&s[0]&&(c.textPixelRatio=e[6]),67108864&s[1]&&(c.backgroundColor=e[57]),268435456&s[1]&&(c.maskRect=e[59]),4096&s[2]&&(c.maskOpacity=e[74]?e[74].maskOpacity:1),128&s[0]&&(c.maskMarkupOpacity=e[7]),32&s[0]&&(c.maskFrameOpacity=e[5]),16777216&s[2]&&(c.clipAnnotationsToImage=e[86]),33554432&s[1]&&(c.images=e[56]),33554432&s[2]&&(c.interfaceImages=e[87]),268435456&s[0]&&(c.loadImageData=e[28]),2048&s[0]&&(c.enableGrid=e[11]),67108864&s[2]&&(c.gridSize=e[88]),402653184&s[2]&&(c.gridColors=[e[89],e[90]]),536870912&s[2]&&(c.gridOpacity=e[91]),1073741824&s[2]&&(c.selectionColor=e[92]),1048576&s[2]|1&s[3]&&(c.willRequest=e[82]||e[93]),512&s[0]|541982784&s[1]|2&s[3]&&(c.willRender=e[424]),124&s[2]&&(c.didRender=e[425]),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=$m*e[8]),!u&&1&s[0]&&(u=!0,m.zoomLevel=e[0],ca((()=>u=!1))),!h&&4&s[1]&&(h=!0,m.zoomControls=e[33],ca((()=>h=!1))),!p&&8&s[1]&&(p=!0,m.zoomMultiTouching=e[34],ca((()=>p=!1))),d.$set(m)},i(e){m||(xa(g),xa($),xa(r),xa(a.$$.fragment,e),xa(d.$$.fragment,e),m=!0)},o(e){va(g),va($),va(r),va(a.$$.fragment,e),va(d.$$.fragment,e),m=!1},d(r){g&&g.d(r),r&&Sn(t),$&&$.d(r),r&&Sn(o),y[i].d(r),r&&Sn(n),La(a,r),r&&Sn(s),r&&Sn(l),e[426](null),r&&Sn(c),La(d,r)}}}function rm(e){let t,o,i,r,n;return o=new up({props:{items:e[70]}}),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"class","PinturaNav PinturaNavTools")},m(a,s){wn(a,t,s),Aa(o,t,null),i=!0,r||(n=[Pn(t,"measure",e[411]),hn($c.call(null,t))],r=!0)},p(e,t){const i={};256&t[2]&&(i.items=e[70]),o.$set(i)},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o),r=!1,Kr(n)}}}function nm(e){let t,o,i;return o=new vd({props:{elasticity:e[8]*ym,scrollDirection:e[76]?"y":"x",$$slots:{default:[lm]},$$scope:{ctx:e}}}),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"class","PinturaNav PinturaNavMain")},m(e,r){wn(e,t,r),Aa(o,t,null),i=!0},p(e,t){const i={};256&t[0]&&(i.elasticity=e[8]*ym),16384&t[2]&&(i.scrollDirection=e[76]?"y":"x"),8192&t[1]|393216&t[2]|536870912&t[18]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o)}}}function am(e){let t,o=e[586].icon+"";return{c(){t=Cn("g")},m(e,i){wn(e,t,i),t.innerHTML=o},p(e,i){268435456&i[18]&&o!==(o=e[586].icon+"")&&(t.innerHTML=o)},d(e){e&&Sn(t)}}}function sm(e){let t,o,i,r,n,a=e[586].label+"";return t=new td({props:{$$slots:{default:[am]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment),o=Mn(),i=kn("span"),r=Tn(a)},m(e,a){Aa(t,e,a),wn(e,o,a),wn(e,i,a),bn(i,r),n=!0},p(e,o){const i={};805306368&o[18]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i),(!n||268435456&o[18])&&a!==(a=e[586].label+"")&&Fn(r,a)},i(e){n||(xa(t.$$.fragment,e),n=!0)},o(e){va(t.$$.fragment,e),n=!1},d(e){La(t,e),e&&Sn(o),e&&Sn(i)}}}function lm(e){let t,o;const i=[e[80],{tabs:e[79]}];let r={$$slots:{default:[sm,({tab:e})=>({586:e}),({tab:e})=>[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e?268435456:0]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)r=Xr(r,i[e]);return t=new Fc({props:r}),t.$on("select",e[412]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const r=393216&o[2]?Ra(i,[262144&o[2]&&Pa(e[80]),131072&o[2]&&{tabs:e[79]}]):{};805306368&o[18]&&(r.$$scope={dirty:o,ctx:e}),t.$set(r)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function cm(e){let t,o,i;function r(t){e[420](t)}let n={class:"PinturaMain",content:{...e[47].find(e[419]),props:e[27][e[44]]},locale:e[3],stores:e[200]};return void 0!==e[1][e[44]]&&(n.component=e[1][e[44]]),t=new Jc({props:n}),ta.push((()=>Ea(t,"component",r))),t.$on("measure",e[226]),t.$on("show",e[421]),t.$on("hide",e[422]),t.$on("fade",e[423]),{c(){Ia(t.$$.fragment)},m(e,o){Aa(t,e,o),i=!0},p(e,i){const r={};134217728&i[0]|73728&i[1]&&(r.content={...e[47].find(e[419]),props:e[27][e[44]]}),8&i[0]&&(r.locale=e[3]),!o&&2&i[0]|8192&i[1]&&(o=!0,r.component=e[1][e[44]],ca((()=>o=!1))),t.$set(r)},i(e){i||(xa(t.$$.fragment,e),i=!0)},o(e){va(t.$$.fragment,e),i=!1},d(e){La(t,e)}}}function dm(e){let t,o;const i=[{class:"PinturaMain"},{visible:e[63]},e[80],{panels:e[78]}];let r={$$slots:{default:[um,({panel:e,panelIsActive:t})=>({584:e,585:t}),({panel:e,panelIsActive:t})=>[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(e?67108864:0)|(t?134217728:0)]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)r=Xr(r,i[e]);return t=new Zc({props:r}),t.$on("measure",e[418]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const r=327682&o[2]?Ra(i,[i[0],2&o[2]&&{visible:e[63]},262144&o[2]&&Pa(e[80]),65536&o[2]&&{panels:e[78]}]):{};134217738&o[0]|65664&o[1]|2&o[2]|738197504&o[18]&&(r.$$scope={dirty:o,ctx:e}),t.$set(r)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function um(e){let t,o,i;function r(...t){return e[413](e[584],...t)}function n(t){e[414](t,e[584])}let a={content:{...e[47].find(r),props:e[27][e[584]]},locale:e[3],isActive:e[585],stores:e[200]};return void 0!==e[1][e[584]]&&(a.component=e[1][e[584]]),t=new Jc({props:a}),ta.push((()=>Ea(t,"component",n))),t.$on("measure",e[226]),t.$on("show",(function(){return e[415](e[584])})),t.$on("hide",(function(){return e[416](e[584])})),t.$on("fade",(function(...t){return e[417](e[584],...t)})),{c(){Ia(t.$$.fragment)},m(e,o){Aa(t,e,o),i=!0},p(i,n){e=i;const a={};134217728&n[0]|65536&n[1]|67108864&n[18]&&(a.content={...e[47].find(r),props:e[27][e[584]]}),8&n[0]&&(a.locale=e[3]),134217728&n[18]&&(a.isActive=e[585]),!o&&2&n[0]|67108864&n[18]&&(o=!0,a.component=e[1][e[584]],ca((()=>o=!1))),t.$set(a)},i(e){i||(xa(t.$$.fragment,e),i=!0)},o(e){va(t.$$.fragment,e),i=!1},d(e){La(t,e)}}}function hm(e){let t,o;return{c(){t=kn("span"),An(t,"class","PinturaEditorOverlay"),An(t,"style",o="opacity:"+e[102])},m(e,o){wn(e,t,o)},p(e,i){512&i[3]&&o!==(o="opacity:"+e[102])&&An(t,"style",o)},d(e){e&&Sn(t)}}}function pm(e){let t,o;const i=[{layout:"row"},{parentRect:e[51]},e[61]];let r={$$slots:{default:[mm]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)r=Xr(r,i[e]);return t=new yp({props:r}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const r=1074790400&o[1]?Ra(i,[i[0],1048576&o[1]&&{parentRect:e[51]},1073741824&o[1]&&Pa(e[61])]):{};1073741824&o[1]|1&o[2]|536870912&o[18]&&(r.$$scope={dirty:o,ctx:e}),t.$set(r)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function mm(e){let t,o,i;return{c(){t=kn("input"),t.value=o=e[61].text,An(t,"placeholder",i=e[61].placeholder),An(t,"type","text"),An(t,"spellcheck","false"),An(t,"autocorrect","off"),An(t,"autocapitalize","off")},m(o,i){wn(o,t,i),e[430](t)},p(e,r){1073741824&r[1]&&o!==(o=e[61].text)&&t.value!==o&&(t.value=o),1073741824&r[1]&&i!==(i=e[61].placeholder)&&An(t,"placeholder",i)},d(o){o&&Sn(t),e[430](null)}}}function gm(e){let t,o,i,r,n,s;la(e[410]);let l=e[41]&&Zp(e),c=e[102]>0&&hm(e),d=e[61]&&pm(e);return{c(){t=kn("div"),l&&l.c(),o=Mn(),c&&c.c(),i=Mn(),d&&d.c(),An(t,"id",e[4]),An(t,"class",e[77]),An(t,"data-env",e[75]),An(t,"dir",e[12])},m(u,h){wn(u,t,h),l&&l.m(t,null),bn(t,o),c&&c.m(t,null),bn(t,i),d&&d.m(t,null),e[431](t),r=!0,n||(s=[Pn(Gp,"keydown",e[217]),Pn(Gp,"keyup",e[218]),Pn(Gp,"blur",e[219]),Pn(Gp,"paste",e[223]),Pn(Gp,"resize",e[410]),Pn(t,"ping",(function(){Jr(e[69])&&e[69].apply(this,arguments)})),Pn(t,"contextmenu",e[220]),Pn(t,"touchstart",e[215],{passive:!1}),Pn(t,"touchmove",(function(){Jr(e[72])&&e[72].apply(this,arguments)})),Pn(t,"pointermove",(function(){Jr(e[71])&&e[71].apply(this,arguments)})),Pn(t,"transitionend",e[205]),Pn(t,"dropfiles",e[221]),Pn(t,"measure",e[432]),Pn(t,"click",(function(){Jr(e[43]?e[222]:a)&&(e[43]?e[222]:a).apply(this,arguments)})),hn($c.call(null,t,{observeViewRect:!0,isMeasureRoot:!0})),hn(fc.call(null,t)),hn(bc.call(null,t))],n=!0)},p(n,a){(e=n)[41]?l?(l.p(e,a),1024&a[1]&&xa(l,1)):(l=Zp(e),l.c(),xa(l,1),l.m(t,o)):l&&(ya(),va(l,1,1,(()=>{l=null})),ba()),e[102]>0?c?c.p(e,a):(c=hm(e),c.c(),c.m(t,i)):c&&(c.d(1),c=null),e[61]?d?(d.p(e,a),1073741824&a[1]&&xa(d,1)):(d=pm(e),d.c(),xa(d,1),d.m(t,null)):d&&(ya(),va(d,1,1,(()=>{d=null})),ba()),(!r||16&a[0])&&An(t,"id",e[4]),(!r||32768&a[2])&&An(t,"class",e[77]),(!r||8192&a[2])&&An(t,"data-env",e[75]),(!r||4096&a[0])&&An(t,"dir",e[12])},i(e){r||(xa(l),xa(d),r=!0)},o(e){va(l),va(d),r=!1},d(o){o&&Sn(t),l&&l.d(),c&&c.d(),d&&d.d(),e[431](null),n=!1,Kr(s)}}}const $m=1,fm="stage-overlay",ym=10;function bm(e,t,o){let i,r,n,s,l,c,d,u,h,p,g,$,y,b,x,S,k,C,T,M,P,E,I,A,z,F,D,O,B,W,_,V,N,H,j,U,Z,X,Y,q,K,J,Q,ee,te,oe,ie,re,ne,ae,le,ce,he,pe,me,ge,$e,fe,ye,be,ve,we,Se,ke,Ce,Te,Me,Re,Pe,Ee,Ie,Ae,Le,ze,Fe,De,Oe,Be,_e,Ve,Ne,He,je,Ue,Ge,Ze,Xe,Ye,qe,et,tt,it,rt,at,ct,dt,mt,gt,yt,bt,wt,kt,Tt,Mt,Rt,Pt,Et,It,At,Lt,zt,Ft,Dt,Ot,Bt,Vt,Nt,Ht,jt,Ut,Gt,Zt,Yt,qt,Kt,Jt,Qt,eo,to,oo,io,ro,no,ao,so,lo,uo,ho,po,mo,go,fo,yo,bo,xo,vo,wo,So,ko,Co,To,Mo,Ro,Po,Eo,Io,Lo,zo,Fo,Do,Oo,Bo,Wo,_o,No,Ho,jo,Uo,Go,Zo,Yo,Ko,Jo,Qo,ei,ti,oi,ii,ri,ni,ai,si,li,ci,di,ui,hi,pi,mi,gi,$i,yi,bi,xi,vi,wi,Si,Ti,Mi,Ri,Ei,Ii,Li,zi,Fi,Di,Oi,Bi,Wi=Gr,_i=Gr;on(e,tc,(e=>o(398,Yo=e))),e.$$.on_destroy.push((()=>Wi())),e.$$.on_destroy.push((()=>_i()));const Vi=Xo(),Ni=qn();let Hi,ji,{class:Ui}=t,{layout:Gi}=t,{stores:Zi}=t,{locale:Xi}=t,{id:Yi}=t,{util:qi}=t,{utils:Ki}=t,{animations:Ji="auto"}=t,{disabled:Qi=!1}=t,{status:er}=t,{previewUpscale:tr=!1}=t,{previewPad:or=!1}=t,{previewMaskOpacity:ir=.95}=t,{previewImageDataMaxSize:rr}=t,{previewImageTextPixelRatio:nr}=t,{markupMaskOpacity:ar=1}=t,{zoomMaskOpacity:sr=.85}=t,{elasticityMultiplier:lr=10}=t,{willRevert:cr=(()=>Promise.resolve(!0))}=t,{willProcessImage:dr=(()=>Promise.resolve(!0))}=t,{willRenderCanvas:ur=G}=t,{willRenderToolbar:hr=G}=t,{willSetHistoryInitialState:mr=G}=t,{enableButtonExport:gr=!0}=t,{enableButtonRevert:$r=!0}=t,{enableNavigateHistory:fr=!0}=t,{enableToolbar:xr=!0}=t,{enableUtils:vr=!0}=t,{enableButtonClose:wr=!1}=t,{enableDropImage:kr=!1}=t,{enablePasteImage:Cr=!1}=t,{enableBrowseImage:Tr=!1}=t,{enableTransparencyGrid:Mr=!1}=t,{layoutDirectionPreference:Rr="auto"}=t,{layoutHorizontalUtilsPreference:Pr="left"}=t,{layoutVerticalUtilsPreference:Er="bottom"}=t,{layoutVerticalToolbarPreference:Ir="top"}=t,{layoutVerticalControlGroupsPreference:Ar="bottom"}=t,{layoutVerticalControlTabsPreference:Lr="bottom"}=t,{textDirection:zr}=t,{markupEditorZoomLevel:Fr=null}=t,{markupEditorZoomLevels:Dr}=t,{markupEditorZoomAdjustStep:Or}=t,{markupEditorZoomAdjustFactor:Br}=t,{markupEditorZoomAdjustWheelFactor:Wr}=t,{markupEditorInteractionMode:_r=!1}=t,{muteAudio:Vr=!0}=t,{willSetMediaInitialTimeOffset:Nr=((e,t)=>e*Dp(t[0]))}=t,{enablePan:Hr=!0}=t,{enableZoom:Zr=!0}=t,{enableZoomControls:Xr=!0}=t,{enableZoomInput:Yr}=t,{enablePanInput:qr}=t,{enableCanvasAlpha:Kr=!1}=t,{enablePanLimit:Jr}=t,{panLimitGutterScalar:Qr}=t,{zoomPresetOptions:rn=[.25,.5,1,1.25,1.5,2,3,4,6,8,16]}=t,{zoomAdjustStep:nn=.25}=t,{zoomAdjustFactor:an=.1}=t,{zoomAdjustWheelFactor:sn=1}=t,{zoomLevel:ln=null}=t;let{imagePreviewSrc:cn}=t,{imageOrienter:dn={read:()=>1,apply:e=>e}}=t,{pluginComponents:hn}=t,{pluginOptions:pn={}}=t;const mn=Vi.sub,gn={};let{root:$n}=t;const fn=()=>{mt.setAttribute("data-redraw","true"),_n.set({})},yn=Ba(!0);on(e,yn,(e=>o(464,Nt=e)));const bn=Ba(void 0);on(e,bn,(e=>o(406,di=e)));const xn=Ba(0);on(e,xn,(e=>o(407,ui=e)));const vn=Ba(0),wn=Ba(!1),Sn=e=>{wn.set("play"===e.type),Vi.pub(e.type)};let kn,Cn;let Tn,Mn,Rn=!1;const Pn=()=>{if(!r||!In())return;Mn=u,un(bn,di=void 0,di);const e=mt;Rn=!1;const t=1/24,o=On();(Math.abs(c*o-ui*o)<=t||o-o*ui<=t)&&un(xn,ui=l,ui),Wn(On()*ui),e.play().catch((()=>{}));const i=()=>{In()||(Tn=requestAnimationFrame(i),un(xn,ui=Bn()/On(),ui),Mn>=0&&ui>=c&&(un(xn,ui=c,ui),En()),u>-1&&(Rn=!0),Rn&&-1===u&&h>0&&(un(xn,ui=s[h][0],ui),Wn(ui*On())),fn())};i()},En=()=>{r&&!In()&&(un(bn,di=void 0,di),Mn=void 0,mt.pause(),cancelAnimationFrame(Tn),fn())},In=()=>mt&&mt.paused,An=()=>{if(r)return In()?Pn():En()},Ln=()=>{if(!r)return;mt.muted=!0},zn=()=>{if(!r)return;mt.muted=!1},Fn=()=>{r&&un(Dn,ci=!ci,ci)},Dn=Ba(Vr);on(e,Dn,(e=>o(405,ci=e)));const On=()=>{if(r)return mt.duration},Bn=()=>{if(!r)return;return mt.currentTime},Wn=e=>{if(!r)return;mt.currentTime=e,vn.set(e)};Kn("previewcontrols",{play:Pn,pause:En,togglePlayPause:An,mute:Ln,unmute:zn,toggleMute:Fn,setCurrentTime:Wn,getCurrentTime:Bn,getDuration:On,currentTime:vn,frameOffset:xn,framePeekOffset:bn,isPlaying:wn,isMuted:Dn});const _n=Ba({});on(e,_n,(e=>o(53,Ut=e))),Kn("redrawTrigger",_n);const Vn=Ba(lr);on(e,Vn,(e=>o(480,si=e))),Kn("elasticityMultiplier",Vn);let Nn=[];const Hn=ec();on(e,Hn,(e=>o(102,Bi=e)));const jn=Fl()||1024,Un=We(jn,jn),Gn=Cs(),Zn=e=>Promise.resolve(ai&&ai(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=>Cp(e,dn,Gn))).then((e=>Tp(e,$)))}));let{imageSourceToImageData:Xn=(e=>R(e)?Zn(e):Wt(e)?new Promise((t=>t(m(e)))):co(e)||_t(e)?Cp(e,dn,Gn).then((e=>Tp(e,$))):void 0)}=t;const Jn=(()=>{let e,t;const o=xp.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=xp.map((e=>i.stores[e].subscribe((t=>{o[e].publish(t)}))))},stores:o,destroy:()=>{e&&e.forEach((e=>e()))}}})(),{file:Qn,size:ea,duration:oa,trim:ia,volume:ra,minDuration:na,maxDuration:aa,loadState:sa,processState:la,cropAspectRatio:ca,cropLimitToImage:da,crop:ua,cropMinSize:ha,cropMaxSize:pa,cropRange:ma,cropOrigin:ga,cropRectAspectRatio:$a,rotation:fa,rotationRange:ya,targetSize:ba,flipX:xa,flipY:va,backgroundColor:wa,backgroundImage:Sa,colorMatrix:ka,convolutionMatrix:Ca,gamma:Ta,vignette:Ma,noise:Ra,decoration:Pa,annotation:Ea,manipulation:Ia,redaction:Aa,frame:La,selection:za,state:Fa}=Jn.stores;on(e,Qn,(e=>o(382,mo=e))),on(e,ea,(e=>o(355,bt=e))),on(e,oa,(e=>o(408,hi=e))),on(e,ia,(e=>o(403,ni=e))),on(e,ra,(e=>o(404,li=e))),on(e,aa,(e=>o(409,pi=e))),on(e,sa,(e=>o(374,oo=e))),on(e,la,(e=>o(373,to=e))),on(e,ca,(e=>o(477,Jo=e))),on(e,da,(e=>o(86,yi=e))),on(e,ua,(e=>o(393,zo=e))),on(e,fa,(e=>o(358,Tt=e))),on(e,xa,(e=>o(357,kt=e))),on(e,va,(e=>o(356,wt=e))),on(e,wa,(e=>o(364,Ot=e))),on(e,Pa,(e=>o(49,yt=e))),on(e,Ea,(e=>o(50,Mt=e))),on(e,Ia,(e=>o(361,zt=e))),on(e,Aa,(e=>o(362,Ft=e))),on(e,La,(e=>o(48,gt=e))),on(e,za,(e=>o(60,oi=e))),on(e,Fa,(e=>o(466,yo=e)));const Da=(e,t,o=0)=>new Promise(((i,r)=>{if(kp(e)){return void(qo()?(async e=>{const t=await Np(e),o=new DataView(t);return Up(o)})(e):Promise.resolve()).then((t=>{const o=document.createElement("video");o.onerror=()=>console.error(o.error),o.playsInline=!0,o.preload="auto",o.onloadeddata=()=>{o.onloadeddata=void 0,o.dataset.rotation=t||"0",Ms(o).then((()=>{const e=Nr(o.duration,ni||[[0,1]]);e>0?(o.onseeked=()=>{o.onseeked=void 0,i(o)},o.currentTime=e):(o.currentTime=e,i(o))}))},o.src=URL.createObjectURL(e),o.load()}))}let n,a=!1;t.cancel=()=>a=!0;const s=Date.now();Xn(e).then((e=>{const t=Date.now()-s;clearTimeout(n),n=setTimeout((()=>{a||i(e)}),Math.max(0,o-t))})).catch(r)})),{images:_a,shapePreprocessor:Va,imageScrambler:Na,imageRedactionRendering:Ha,willRequest:ja,willRequestResource:Ua}=Zi;let Ga;on(e,_a,(e=>o(402,ri=e))),on(e,Va,(e=>o(401,ii=e))),on(e,Na,(e=>o(365,Bt=e))),on(e,Ha,(e=>o(363,Dt=e))),on(e,ja,(e=>o(82,ai=e))),on(e,Ua,(e=>o(93,Mi=e)));const Za=Wa(Sa,((e,t)=>{if(!e)return t(void 0);Ga&&(Ga.cancel(),Ga=void 0),Ga={cancel:a},Da(e,Ga).then(t).catch((e=>{}))})),Xa=Fa.subscribe((e=>Vi.pub("update",e))),Ya=Ba();Kn("ui",Ba({})),Kn("selection",za);const qa=Ba(!0);on(e,qa,(e=>o(95,Ei=e)));const Ka=Ba(!0);on(e,Ka,(e=>o(97,Li=e)));const Ja=Ba(!0);on(e,Ja,(e=>o(400,ti=e)));const Qa=Ba(!0);on(e,Qa,(e=>o(478,Qo=e)));const es=Ba(!0);on(e,es,(e=>o(98,zi=e)));const ts=Ba();on(e,ts,(e=>o(99,Fi=e)));const os=Ba();on(e,os,(e=>o(479,ei=e)));const is=Wa([os,Qa],(()=>void 0!==ei?ei:Qo));on(e,is,(e=>o(96,Ii=e)));const rs=Ba([0,0,0]);on(e,rs,(e=>o(57,So=e)));const as=Ba([1,1,1]);on(e,as,(e=>o(462,Lt=e)));const ss=ec([1,1,1]);on(e,ss,(e=>o(461,At=e)));const ls=Ba();on(e,ls,(e=>o(92,Ti=e)));const cs=Ba(),us=Ba();on(e,us,(e=>o(52,Ht=e)));const hs=Ba();on(e,hs,(e=>o(359,Pt=e)));const ps=Ba(Je());on(e,ps,(e=>o(81,bo=e)));const ms=Ba(0);on(e,ms,(e=>o(399,Ko=e)));const gs=Ba(Je());on(e,gs,(e=>o(85,$i=e)));const $s=Ba();on(e,$s,(e=>o(459,dt=e)));const fs=Sp("(pointer: fine)",(e=>e?"pointer-fine":"pointer-coarse"));on(e,fs,(e=>o(380,ho=e)));const ys=Sp("(hover: hover)",(e=>e?"pointer-hover":"pointer-no-hover"));on(e,ys,(e=>o(379,uo=e)));const bs=Ba(!1),xs=Ba(!1);on(e,xs,(e=>o(360,It=e)));const vs=Oa(void 0,(e=>{const t=ec(0),o=[xs.subscribe((e=>{t.set(e?1:0)})),t.subscribe(e)];return()=>o.forEach((e=>e()))}));on(e,vs,(e=>o(460,Et=e)));const ws=Ba();on(e,ws,(e=>o(465,ao=e)));const Ss=Ba();let ks;on(e,Ss,(e=>o(54,Zt=e))),Kn("isAnimated",Ss);const Ts=Ba(tr);on(e,Ts,(e=>o(383,go=e)));const Rs=Ba(!1);on(e,Rs,(e=>o(471,Bo=e))),Kn("imageIsStatic",Rs);const Ps=Ba();on(e,Ps,(e=>o(472,Wo=e)));const Es=Ba();on(e,Es,(e=>o(469,Do=e)));const Is=Oa(void 0,(e=>{const t=Ba(void 0),o=[ua.subscribe((()=>{if(!zo)return;if(Bo)return t.set(Ke(zo));const e=gd(zo,Do,5*lr);t.set(e)})),t.subscribe(e)];return()=>o.forEach((e=>e()))})),As=Ba();on(e,As,(e=>o(468,Lo=e)));const Ls=Ba();on(e,Ls,(e=>o(470,Oo=e)));const zs=Ba(void 0);on(e,zs,(e=>o(475,Uo=e)));const Fs=Ba(de());on(e,Fs,(e=>o(476,Go=e)));const Ds=(e,t)=>{if(!t||!e)return{top:0,right:0,bottom:0,left:0};const o=br(t,e,y),i=yr(o,e);return{top:Math.abs(i.top),right:Math.abs(i.right),bottom:Math.abs(i.bottom),left:Math.abs(i.left)}},Os=Ba({}),Bs=Wa([$s,ps,gs,Os],(([e,t,o,i],r)=>{if(!e)return r(void 0);let n=0;1!==O.length||p||"bottom"===Ir||(n=o.y+o.height),r(nt(e.x+t.x,e.y+t.y+n,e.width,e.height))}));let Ws={left:0,right:0,top:0,bottom:0};const _s=Ba(!1),Vs=Wa([_s,La,Bs,xs],(([e,t,o,i],r)=>{if(!o)return r({left:0,right:0,top:0,bottom:0});if(!e)return;const n=Math.min(o.width,o.height),a=Ds({width:n,height:n},t);se(Ws.top,4)===se(a.top,4)&&se(Ws.bottom,4)===se(a.bottom,4)&&se(Ws.right,4)===se(a.right,4)&&se(Ws.left,4)===se(a.left,4)||(Ws=a,r(a))}));on(e,Vs,(e=>o(391,Po=e)));const Ns=Wa([_s,Vs],(([e,t],o)=>{if(!e)return o(!1);o(Object.values(t).some((e=>e>0)))}));on(e,Ns,(e=>o(392,Eo=e)));const Hs=Wa([_s,$s,Ns,Vs],(([e,t,o,i],r)=>{if(t)return e&&o?void r(nt(t.x+i.left,t.y+i.top,t.width-i.left-i.right,t.height-i.top-i.bottom)):r({...t})})),js=Wa([Bs,Ns,Vs],(([e,t,o],i)=>e?t?void i(nt(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)));on(e,js,(e=>o(51,Rt=e)));const Us=Wa([Rs,ea,fa],(([e,t,o],i)=>{if(!e||!t)return i(void 0);const r=Qe(t);i($t(r,o))})),Gs=Wa([Us],(([e],t)=>{if(!e)return t(void 0);const o=ot(e);t(Ct(o))}));on(e,Gs,(e=>o(394,Fo=e)));const Zs=Wa([js,ua,Gs,Ts],(([e,t,o,i],r)=>{if(!e||!t||!(!Wo&&!Do))return;const{width:n,height:a}=o||t,s=Math.min(e.width/n,e.height/a);r(i?s:Math.min(1,s))}));on(e,Zs,(e=>o(395,No=e)));Kn("imageStaticVisualCorners",Wa([Rs,ea,fa,js,$s,Zs],(([e,t,o,i,r,n],a)=>{if(!(e&&i&&r&&t))return a(void 0);const s=Qe(t),l=Ct(lt(s,n)),c=ft(i,l);l.x=c.x,l.y=c.y;a($t(l,o))})));const Xs=Ba(void 0);on(e,Xs,(e=>o(397,Zo=e)));const Ys=Wa([ua,js],(([e,t])=>{if(t&&e)return Math.min(t.width/e.width,t.height/e.height)})),qs=Wa([ua,As],(([e,t])=>e&&t?Math.min(e.width/t.width,e.height/t.height):1));on(e,qs,(e=>o(101,Oi=e)));const Ks=Wa([Xs,qs],(([e,t])=>e&&t?t*e:1));on(e,Ks,(e=>o(474,Ho=e)));const Js=Ba(de());on(e,Js,(e=>o(396,jo=e)));const Qs=Ba({scalar:Ho,translation:jo}),el=()=>{Qs.set({scalar:void 0,translation:de()})},tl=Oa(void 0,(e=>{const t=ec(void 0,{precision:1e-4}),o=1===Vd()?e=>St(e,Math.round):G,i=()=>{if(!Lo)return;const e=It||!ao;if(Bo){const o=Ke(Lo);return st(o,Go),st(o,Rt),t.set(o,{hard:e})}const i=gd(Lo,Uo,$m*lr);i.width<0&&(i.width=0,i.x=Lo.x),i.height<0&&(i.height=0,i.y=Lo.y),st(i,Rt),st(i,jo),lt(i,Ho),!e&&o(i),t.set(i,{hard:e})},r=[js.subscribe(i),As.subscribe(i),Ks.subscribe(i),Js.subscribe(i),La.subscribe(i),t.subscribe(e)];return()=>r.forEach((e=>e()))}));on(e,tl,(e=>o(59,Ro=e)));const ol=Ba(1);on(e,ol,(e=>o(467,Io=e)));const il=()=>{if(!zo||!Rt)return;let e=ut(Ke(zo),No||1);const t=ft(Rt,ut(Ke(Fo),No));st(e,t);const o=dt.width/e.width,i=dt.height/e.height,r=Math.min(1,o,i);ol.set(r),lt(e,r),((e,t)=>{const[o,i,r,n]=vt(e);o<t.y&&(e.y=Math.max(t.y,e.y)),i>t.width&&(e.x=t.width-e.width),r>t.height&&(e.y=t.height-e.height),n<t.x&&(e.x=Math.max(t.x,e.x))})(e,{...dt,x:0,y:0}),As.set(e)},rl=Wa([js,Zs,ua,ea],(([e,t,o,i],r)=>{e&&(o||i)&&r(nl(e,t||1,o||i))}));on(e,rl,(e=>o(100,Di=e)));const nl=(e,t,o)=>o.width<=e.width&&o.height<=e.height?ft(e,ut(Ke(o),t)):xt(e,pt(o));let sl,ll;const cl=e=>{if(p&&sl&&ht(sl,e)&&ll===No)return;if(Bo)return il();sl=e,ll=No;const t=nl(e,No,zo||bt);As.set(t)};let ul=!1;const hl=Zs.subscribe((e=>{!ul&&void 0!==e&&zo&&(cl(Rt),ul=!0)})),pl=js.subscribe((e=>{e&&void 0!==No&&zo&&cl(e)})),ml=Rs.subscribe((e=>{!e&&Rt&&cl(Rt)}));let gl;const $l=Ls.subscribe((e=>{if(!e)return gl=void 0,void un(Ps,Wo=void 0,Wo);gl=_o;const t=Ke(zo);Ps.set(t)})),fl=As.subscribe((e=>{if(!e||!Oo)return;const t=(o=Ke(e),i=Oo,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,gl);const r=((e,t)=>(e.x+=t.x,e.y+=t.y,e.width+=t.width,e.height+=t.height,e))(Ke(Wo),t);ua.set(r)})),yl=ua.subscribe((e=>{if(!e||!Lo)return;if(Bo)return void(Oo||il());if(It||Oo||Do)return;const t=pt(Lo),o=pt(e);if(se(t,6)===se(o,6))return;const{width:i,height:r}=Fo||zo,n=Math.min(Rt.width/i,Rt.height/r),a=We(e.width*n,e.height*n),s=.5*(Lo.width-a.width),l=.5*(Lo.height-a.height),c=nt(Lo.x+s,Lo.y+l,a.width,a.height);As.set(c)})),bl=Wa([Zs,ua,As,Rs],(([e,t,o,i],r)=>{if(!e||!t||!o)return;if(i)return r(Io);const n=o.width/t.width,a=o.height/t.height;r(Math.max(n,a)/e)})),xl=Wa([Zs,bl],(([e,t],o)=>{if(!t)return;o(e*t)}));on(e,xl,(e=>o(473,_o=e)));let vl={left:0,right:0,top:0,bottom:0};const wl=Wa([La,As],(([e,t],o)=>{if(!t)return o(vl);const i=Ds(t,e);se(vl.top,4)===se(i.top,4)&&se(vl.bottom,4)===se(i.bottom,4)&&se(vl.right,4)===se(i.right,4)&&se(vl.left,4)===se(i.left,4)||(vl=i,o(i))})),Sl=Wa([wl],(([e],t)=>{t(Object.values(e).some((e=>e>0)))})),kl=ec(.075,{stiffness:.03,damping:.4,precision:.001}),Cl=Wa([ss,rs,kl,tl,Ks,La,Sl,wl,Ns],(([e,t,o,i,r,n,a,s,l],c)=>{if(!i||p)return c([]);let{x:d,y:u,width:h,height:m}=i;d+=.5,u+=.5,h-=.5,m-=.5;const g=[];if(n){if(a){let{left:e,right:o,top:i,bottom:n}=s;e*=r,o*=r,i*=r,n*=r;const a=Lp(t)?[1,1,1,.125]:[0,0,0,.075];g.push({x:d-e-.5,y:u-i-.5,width:h+e+o+1,height:m+i+n+1,strokeWidth:1,strokeColor:a,opacity:l?1:.5})}const i=Lp(e);n&&n.frameColor&&Lp(n.frameColor)||i||(g.push({x:d-1,y:u-1,width:h+2,height:m+2,strokeWidth:2,strokeColor:[0,0,0,.1],opacity:o}),g.push({x:d+1,y:u+1,width:h-2,height:m-2,strokeWidth:2,strokeColor:[0,0,0,.1],opacity:o}))}c([...g,{x:d,y:u,width:h,height:m,strokeWidth:1,strokeColor:e,opacity:o}])})),Tl=Ba([]);on(e,Tl,(e=>o(385,xo=e)));const Ml=Wa([Cl,Tl],(([e,t],o)=>{o([...e,...t])}));on(e,Ml,(e=>o(94,Ri=e)));const Rl=ec(0,{precision:.001});on(e,Rl,(e=>o(387,wo=e)));const Pl=ec();on(e,Pl,(e=>o(390,To=e)));const El=ec();on(e,El,(e=>o(389,Co=e)));const Il=ec();on(e,Il,(e=>o(388,ko=e)));const Al=ec();on(e,Al,(e=>o(386,vo=e)));const Ll=Ba(!1);on(e,Ll,(e=>o(372,eo=e)));const zl=Ba();let Ol;on(e,zl,(e=>o(375,io=e)));const Bl=Wa([Ll,zl],(([e,t],i)=>{if(!e||!t)return void i(void 0);if(Ol&&(Ol.cancel(),o(282,Ol=void 0)),Sr(t))return i(w(t));const r=ac.length?0:Zt?250:0;o(282,Ol={cancel:a}),Da(t,Ol,r).then(i).catch((e=>{un(sa,oo.error=e,oo)})).finally((()=>{o(282,Ol=void 0)}))}));Wi(),Wi=en(Bl,(e=>o(354,mt=e)));let{imagePreviewCurrent:Wl}=t;const _l=Ba({});on(e,_l,(e=>o(377,so=e)));const Vl=Ba([]);on(e,Vl,(e=>o(87,bi=e)));const Nl=Wa([js,hs,ea,Is,As,xl,fa,xa,va,Ks,Js,bs],(([e,t,o,i,r,n,a,s,l,c,d,u],h)=>{if(!e||!r)return;const p=al(e,t,o,i,r,c,d,n,a,s,l);!u&&z(p),h(p)}));on(e,Nl,(e=>o(378,lo=e)));const Hl=Wa([ka,Ca,Ta,Ma,Ra],(([e,t,o,i,r],n)=>{const a=e&&Object.keys(e).map((t=>e[t])).filter(Boolean);n({gamma:o||void 0,vignette:i||void 0,noise:r||void 0,convolutionMatrix:t||void 0,colorMatrix:a&&a.length&&jr(a)})}));let jl,Ul;const Gl=(()=>{if(!$o())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})(),Zl=Ba({});on(e,Zl,(e=>o(366,jt=e))),Kn("env",Zl);const Xl=Vd(),Yl=Oa(Xl,(e=>{const t=()=>e(Vd()),o=matchMedia(`(resolution: ${Xl}dppx)`);return o.addListener(t),()=>o.removeListener(t)}));on(e,Yl,(e=>o(58,Mo=e)));const ql=((e,t)=>{const{sub:o,pub:i}=Xo(),r=[],n=Ba(0),a=[],s=()=>a.forEach((e=>e({index:tn(n),length:r.length}))),l={get index(){return tn(n)},set index(e){e=Number.isInteger(e)?e:0,e=ns(e,0,r.length-1),n.set(e),t(r[l.index]),s()},get state(){return r[r.length-1]},length:()=>r.length,undo(){const e=l.index--;return i("undo",e),e},redo(){const e=l.index++;return i("redo",l.index),e},revert(){r.length=1,l.index=0,i("revert")},write(o){o&&t({...e(),...o});const a=e(),c=r[r.length-1];JSON.stringify(a)!==JSON.stringify(c)&&(r.length=l.index+1,r.push(a),n.set(r.length-1),s(),i("writehistory"))},set(e={}){r.length=0,l.index=0;const t=Array.isArray(e)?e:[e];r.push(...t),l.index=r.length-1},get:()=>[...r],subscribe:e=>(a.push(e),e({index:l.index,length:r.length}),()=>a.splice(a.indexOf(e),1)),on:o};return l})((()=>yo),(e=>{un(Fa,yo=e,yo),ps.set(bo)}));_i(),_i=en(ql,(e=>o(384,fo=e)));const Kl=()=>{const e={x:0,y:0,...bt},t=St(xt(e,yo.cropAspectRatio),Math.round),o=mr({...yo,rotation:0,crop:t},yo),i=[o];JSON.stringify(o)!==JSON.stringify(yo)&&i.push({...yo}),ql.set(i)},Ql=sa.subscribe((e=>{e&&e.complete&&Kl()})),oc=()=>cr().then((e=>e&&ql.revert())),ic=Ba(!1);on(e,ic,(e=>o(367,Gt=e)));const rc=()=>{un(ic,Gt=!0,Gt),dr().then((e=>{if(!e)return void un(ic,Gt=!1,Gt);let t;t=Lc.subscribe((e=>{1===e&&(t&&t(),Ni("processImage"))}))}))},nc=la.subscribe((e=>{if(!e)return void un(ic,Gt=!1,Gt);un(ic,Gt=!0,Gt);const{complete:t,abort:o}=e;(t||o)&&un(ic,Gt=!1,Gt)})),ac=Ap();on(e,ac,(e=>o(56,ro=e)));const sc=Wa([ac],(([e],t)=>{if(!e.length)return t();const{origin:o,translation:i,rotation:r,scale:n}=e[0];t({origin:o,translation:i,rotation:r,scale:n})})),lc=Ba();on(e,lc,(e=>o(381,po=e)));let cc,dc=[];const uc=Ba(),hc=Ba(),pc=Wa([Xs,hc,Zs,Ys],(([e,t,o,i])=>e||(t||o<1?i:1))),mc={...Zi,imageFile:Qn,imageSize:ea,mediaDuration:oa,mediaMinDuration:na,mediaMaxDuration:aa,mediaTrim:ia,imageBackgroundColor:wa,imageBackgroundImage:Sa,imageCropAspectRatio:ca,imageCropMinSize:ha,imageCropMaxSize:pa,imageCropLimitToImage:da,imageCropRect:ua,imageCropRectOrigin:ga,imageCropRectSnapshot:Ps,imageCropRectAspectRatio:$a,imageCropRange:ma,imageRotation:fa,imageRotationRange:ya,imageFlipX:xa,imageFlipY:va,imageOutputSize:ba,imageColorMatrix:ka,imageConvolutionMatrix:Ca,imageGamma:Ta,imageVignette:Ma,imageNoise:Ra,imageManipulation:Ia,imageDecoration:Pa,imageAnnotation:Ea,imageRedaction:Aa,imageFrame:La,imagePreview:Bl,imagePreviewSource:zl,imageTransforms:Nl,imagePreviewModifiers:_l,history:ql,animation:ws,pixelRatio:Yl,elasticityMultiplier:lr,scrollElasticity:ym,rangeInputElasticity:5,redrawTrigger:_n,pointerAccuracy:fs,pointerHoverable:ys,env:Zl,rootRect:hs,stageRect:js,stageRectBase:Bs,stageRecenter:Os,stageScalar:Zs,stagePadding:Vs,stagePadded:Ns,presentationScalar:xl,imagePreviewUpscale:hc,utilRect:$s,utilRectPadded:Hs,allowPlayPause:yn,allowPan:qa,allowZoom:Ka,allowZoomControls:Ja,enableZoomInput:es,enablePanInput:Qa,enablePanInputStatus:is,imageSelectionMultiTouching:uc,rootBackgroundColor:rs,rootForegroundColor:as,rootLineColor:ss,rootColorSecondary:cs,imageOutlineOpacity:kl,utilTools:lc,imageSelectionPan:Js,imageSelectionZoom:Xs,imageSelectionZoomCurrent:pc,imageSelectionStageFitScalar:Ys,imageSelectionStoredState:Qs,imageOverlayMarkup:Tl,interfaceImages:Vl,isInteracting:xs,isTransformingImage:bs,isInteractingFraction:vs,imageCropRectIntent:Es,imageCropRectPresentation:Is,imageSelectionRect:As,imageSelectionRectIntent:zs,imageSelectionRectPresentation:tl,imageSelectionRectSnapshot:Ls,imageScalar:bl,imageTransformsInterpolated:sc,imageEffects:Hl};delete mc.image;const gc="util-"+L();let $c=[];const fc=e=>B.find((([t])=>e===t));let yc=[],bc=$o();const xc=(e,t,o)=>{let i=ye.getPropertyValue(e);i=o?o(i):/^[0-9]+$/.test(i)?parseFloat(i):void 0,t.set(i,{hard:!Zt})},wc=(e,t,o=!1)=>{const i=(e=>{const t=ye.getPropertyValue(e);return Bh(t)})(e);i&&0!==i[3]&&(o||(i.length=3),t.set(i,{hard:!Zt}))},Sc=Ba();on(e,Sc,(e=>o(88,xi=e)));const kc=Ba();on(e,kc,(e=>o(89,vi=e)));const Cc=Ba();on(e,Cc,(e=>o(90,wi=e)));const Tc=ec(0,{damping:.9});on(e,Tc,(e=>o(91,Si=e)));const Rc=()=>{wc("color",as),wc(Kr?"--color-background":"background-color",rs),wc("outline-color",ss),wc("--color-primary",ls),wc("--color-secondary",cs),wc("--grid-color-even",kc,!0),wc("--grid-color-odd",Cc,!0),xc("--grid-size",Sc),xc("--editor-inset-top",ms,(e=>parseInt(e,10)))},Pc=Wa([Nl,Hl,wa,Za],(([e,t,o,i])=>e&&{...e,...t,backgroundColor:o,backgroundImage:i}));on(e,Pc,(e=>o(376,no=e)));const Ec=()=>{const e=ac.length?void 0:{resize:1.05},t=((e,t,o={})=>{const{resize:i=1,opacity:r=0}=o,n={opacity:[ec(r,{...Ep,stiffness:.1}),G],resize:[ec(i,{...Ep,stiffness:.1}),G],translation:[ec(void 0,Ep),G],rotation:[ec(void 0,Ip),G],origin:[ec(void 0,Ep),G],scale:[ec(void 0,Ip),G],gamma:[ec(void 0,Ip),e=>e||1],vignette:[ec(void 0,Ip),e=>e||0],colorMatrix:[ec([...Pp],Ep),e=>e||[...Pp]],convolutionMatrix:[Ba(void 0),e=>e&&e.clarity||void 0],backgroundColor:[ec(void 0,Ep),(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:[Ba(void 0),G]},a=Object.entries(n).map((([e,t])=>[e,t[0]])),s=a.map((([,e])=>e)),l=Object.entries(n).reduce(((e,[t,o])=>{const[i,r]=o;return e[t]=(e,o)=>i.set(r(e,c[t],(e=>{i.set(e,{hard:!0})})),o),e}),{});let c;const d=Wa(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})(mt,bt,e);ac.unshift(t),Ic(no)},Ic=e=>{ac.forEach(((t,o)=>{const i=0===o?1:0;t.set({...e,opacity:i,resize:1},ao)}))};let Ac;const Lc=Jl(void 0,{duration:500});let zc;on(e,Lc,(e=>o(55,Jt=e)));const Fc=Ba(!1);let Dc;on(e,Fc,(e=>o(371,Qt=e)));const Oc=ec(void 0,{stiffness:.1,damping:.7,precision:.25});on(e,Oc,(e=>o(83,mi=e)));const Bc=ec(0,{stiffness:.1,precision:.05});on(e,Bc,(e=>o(84,gi=e)));const Wc=ec(0,{stiffness:.02,damping:.5,precision:.25});on(e,Wc,(e=>o(369,qt=e)));const _c=ec(void 0,{stiffness:.02,damping:.5,precision:.25});on(e,_c,(e=>o(370,Kt=e)));const Vc=ec(void 0,{stiffness:.02,damping:.5,precision:.25});let Nc;on(e,Vc,(e=>o(368,Yt=e)));const Hc=()=>{Ni("abortLoadImage")},jc=()=>{Ni("abortProcessImage"),un(ic,Gt=!1,Gt)},Uc=e=>{e.target&&"true"===e.target.dataset.touchScroll||e.preventDefault()},Gc=Gl?e=>{const t=e.touches?e.touches[0]:e;t.pageX>20&&t.pageX<window.innerWidth-20||Uc(e)}:a,Zc=Ba([]);on(e,Zc,(e=>o(463,Vt=e))),Kn("keysPressed",Zc);const Xc=e=>{!e||Vo(e)&&!(e=>/^image/.test(e.type)&&!/svg/.test(e.type))(e)||!Vo(e)&&!/^http/.test(e)||Ni("loadImage",e)},Yc=e=>{e&&Xc(e)};let qc=void 0;let Kc,Jc=[];const Qc=Ba();Kn("rootPortal",Qc),Kn("rootRect",hs);const ed=()=>({foregroundColor:[...Lt],lineColor:[...At],utilVisibility:{...N},isInteracting:It,isInteractingFraction:Et,rootRect:Ke(Pt),stageRect:Ke(Rt),manipulationShapesDirty:yd,annotationShapesDirty:pd,decorationShapesDirty:$d,frameShapesDirty:fd}),td=(e,t,o)=>pr(e,We(t.width/o,t.height/o)),od=(e,t,o)=>{var i;return e._translate=ue((i=t).x,i.y),e._scale=o,e},id=e=>{const t=[];return e.forEach((e=>t.push(rd(e)))),t.filter(Boolean)},rd=e=>Pi(e)?(e.points=[ue(e.x1,e.y1),ue(e.x2,e.y2)],e):(!(e=>ki(e)&&!e.text.length)(e)||e.backgroundColor&&0!==e.backgroundColor[3]||(Ci(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 nd,ad=[],sd=[],ld=[],cd=[],dd=[],ud={};const hd=(e,t,o,i,r,n,a)=>{const{manipulationShapesDirty:s,annotationShapesDirty:l,decorationShapesDirty:c,frameShapesDirty:d,selectionRect:u,scale:h}=e,p=nd!==h,m=p||!ht(ud,u);m&&(nd=h,ud=u),s&&(ld=t.filter(Ai).map(fi).map((e=>pr(e,bt)))),(l||o!==Mt)&&(ad=o.filter(Ai).map(fi).sort(((e,t)=>e.alwaysOnTop?1:t.alwaysOnTop?-1:0)).map((e=>pr(e,bt)))),(p||md||l||o!==Mt)&&(sd=id(ad.map((e=>y(e,{flipX:kt,flipY:wt,rotation:Tt,scale:h,context:Qe(bt)}))).flat())),(c||i!==yt||m)&&(cd=id(i.filter(Ai).map(fi).sort(((e,t)=>e.alwaysOnTop?1:t.alwaysOnTop?-1:0)).map((e=>td(e,u,h))).map((e=>y(e,{context:u}))).flat().map((e=>od(e,u,h))))),(d||n!==gt||m)&&(dd=n?id([n].map(fi).map((e=>td(e,u,h))).map(y).flat().map((e=>od(e,u,h)))):[]);let g=id(r.filter(Ai));return"undefined"!=typeof window&&(e=>{if(e&&e._clpdx4s)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:ld,annotationShapesDirty:l,annotationShapes:sd,decorationShapesDirty:c,decorationShapes:cd,frameShapesDirty:d,frameShapes:dd,interfaceShapes:g,selectionShapes:a.map(fi).map((e=>pr(e,bt)))}};let pd=!0;let md=!0;let $d=!0;let fd=!0;let yd=!0;Yn((()=>{En(),mt&&R(mt.src)&&/^blob:/.test(mt.src)&&URL.revokeObjectURL(mt.src),Xa(),pl(),hl(),ml(),$l(),fl(),yl(),Ql(),nc(),fs.destroy(),ys.destroy(),Jn.destroy(),ac.clear(),ad.length=0,sd.length=0,ld.length=0,cd.length=0,dd.length=0;try{o(228,Wl=void 0),o(283,Ac=void 0)}catch(e){}}));return e.$$set=e=>{"class"in e&&o(229,Ui=e.class),"layout"in e&&o(230,Gi=e.layout),"stores"in e&&o(231,Zi=e.stores),"locale"in e&&o(3,Xi=e.locale),"id"in e&&o(4,Yi=e.id),"util"in e&&o(232,qi=e.util),"utils"in e&&o(233,Ki=e.utils),"animations"in e&&o(234,Ji=e.animations),"disabled"in e&&o(235,Qi=e.disabled),"status"in e&&o(227,er=e.status),"previewUpscale"in e&&o(236,tr=e.previewUpscale),"previewPad"in e&&o(237,or=e.previewPad),"previewMaskOpacity"in e&&o(5,ir=e.previewMaskOpacity),"previewImageDataMaxSize"in e&&o(238,rr=e.previewImageDataMaxSize),"previewImageTextPixelRatio"in e&&o(6,nr=e.previewImageTextPixelRatio),"markupMaskOpacity"in e&&o(7,ar=e.markupMaskOpacity),"zoomMaskOpacity"in e&&o(239,sr=e.zoomMaskOpacity),"elasticityMultiplier"in e&&o(8,lr=e.elasticityMultiplier),"willRevert"in e&&o(240,cr=e.willRevert),"willProcessImage"in e&&o(241,dr=e.willProcessImage),"willRenderCanvas"in e&&o(9,ur=e.willRenderCanvas),"willRenderToolbar"in e&&o(242,hr=e.willRenderToolbar),"willSetHistoryInitialState"in e&&o(243,mr=e.willSetHistoryInitialState),"enableButtonExport"in e&&o(244,gr=e.enableButtonExport),"enableButtonRevert"in e&&o(245,$r=e.enableButtonRevert),"enableNavigateHistory"in e&&o(246,fr=e.enableNavigateHistory),"enableToolbar"in e&&o(10,xr=e.enableToolbar),"enableUtils"in e&&o(247,vr=e.enableUtils),"enableButtonClose"in e&&o(248,wr=e.enableButtonClose),"enableDropImage"in e&&o(249,kr=e.enableDropImage),"enablePasteImage"in e&&o(250,Cr=e.enablePasteImage),"enableBrowseImage"in e&&o(251,Tr=e.enableBrowseImage),"enableTransparencyGrid"in e&&o(11,Mr=e.enableTransparencyGrid),"layoutDirectionPreference"in e&&o(252,Rr=e.layoutDirectionPreference),"layoutHorizontalUtilsPreference"in e&&o(253,Pr=e.layoutHorizontalUtilsPreference),"layoutVerticalUtilsPreference"in e&&o(254,Er=e.layoutVerticalUtilsPreference),"layoutVerticalToolbarPreference"in e&&o(255,Ir=e.layoutVerticalToolbarPreference),"layoutVerticalControlGroupsPreference"in e&&o(256,Ar=e.layoutVerticalControlGroupsPreference),"layoutVerticalControlTabsPreference"in e&&o(257,Lr=e.layoutVerticalControlTabsPreference),"textDirection"in e&&o(12,zr=e.textDirection),"markupEditorZoomLevel"in e&&o(258,Fr=e.markupEditorZoomLevel),"markupEditorZoomLevels"in e&&o(13,Dr=e.markupEditorZoomLevels),"markupEditorZoomAdjustStep"in e&&o(14,Or=e.markupEditorZoomAdjustStep),"markupEditorZoomAdjustFactor"in e&&o(15,Br=e.markupEditorZoomAdjustFactor),"markupEditorZoomAdjustWheelFactor"in e&&o(16,Wr=e.markupEditorZoomAdjustWheelFactor),"markupEditorInteractionMode"in e&&o(259,_r=e.markupEditorInteractionMode),"muteAudio"in e&&o(260,Vr=e.muteAudio),"willSetMediaInitialTimeOffset"in e&&o(261,Nr=e.willSetMediaInitialTimeOffset),"enablePan"in e&&o(17,Hr=e.enablePan),"enableZoom"in e&&o(18,Zr=e.enableZoom),"enableZoomControls"in e&&o(262,Xr=e.enableZoomControls),"enableZoomInput"in e&&o(19,Yr=e.enableZoomInput),"enablePanInput"in e&&o(263,qr=e.enablePanInput),"enableCanvasAlpha"in e&&o(20,Kr=e.enableCanvasAlpha),"enablePanLimit"in e&&o(21,Jr=e.enablePanLimit),"panLimitGutterScalar"in e&&o(22,Qr=e.panLimitGutterScalar),"zoomPresetOptions"in e&&o(23,rn=e.zoomPresetOptions),"zoomAdjustStep"in e&&o(24,nn=e.zoomAdjustStep),"zoomAdjustFactor"in e&&o(25,an=e.zoomAdjustFactor),"zoomAdjustWheelFactor"in e&&o(26,sn=e.zoomAdjustWheelFactor),"zoomLevel"in e&&o(0,ln=e.zoomLevel),"imagePreviewSrc"in e&&o(266,cn=e.imagePreviewSrc),"imageOrienter"in e&&o(267,dn=e.imageOrienter),"pluginComponents"in e&&o(268,hn=e.pluginComponents),"pluginOptions"in e&&o(27,pn=e.pluginOptions),"root"in e&&o(2,$n=e.root),"imageSourceToImageData"in e&&o(28,Xn=e.imageSourceToImageData),"imagePreviewCurrent"in e&&o(228,Wl=e.imagePreviewCurrent)},e.$$.update=()=>{if(1&e.$$.dirty[0]|1024&e.$$.dirty[8]&&o(0,ln=null===ln?Fr:ln),2&e.$$.dirty[0]|1048576&e.$$.dirty[8]){let e=!1;hn.forEach((([t])=>{gn[t]||(o(1,gn[t]={},gn),e=!0)})),e&&o(280,Nn=[...hn])}var t,m,v,w;if(8&e.$$.dirty[0]|65536&e.$$.dirty[7]|2&e.$$.dirty[9]&&o(335,O=Xi&&Nn.length?Ki||Nn.map((([e])=>e)):[]),134217728&e.$$.dirty[0]|2&e.$$.dirty[9]|33554432&e.$$.dirty[10]|1024&e.$$.dirty[12]&&o(336,B=((e,t,o,i)=>{const r=t.filter((([t])=>e.includes(t))).filter((([e,{isSupported:t}])=>t({...i,...o[e]}))).map((([e,t])=>[e,t.Component]));return ds(r,$c,((e,t)=>e[0]===t[0]&&e[1]===t[1]))?$c:($c=r,r)})(O,Nn,pn,{src:mo})),67108864&e.$$.dirty[10]&&o(291,W=B.length),8&e.$$.dirty[0]|4096&e.$$.dirty[9]|33554432&e.$$.dirty[10]&&o(47,_=W&&O.map((e=>{const t=fc(e);if(t)return{id:e,view:t[1],tabIcon:Xi[e+"Icon"],tabLabel:Xi[e+"Label"]}})).filter(Boolean)||[]),65536&e.$$.dirty[1]&&o(353,i=!!_.find((e=>"trim"===e.id))),12288&e.$$.dirty[11]|32&e.$$.dirty[13]&&o(290,r=!!(hi&&mt&&i)),32768&e.$$.dirty[7]|4096&e.$$.dirty[9]&&o(44,V=W&&qi&&"string"==typeof qi&&fc(qi)?qi:W>0?B[0][0]:void 0),8192&e.$$.dirty[1]|2048&e.$$.dirty[9]&&r&&V&&En(),2048&e.$$.dirty[9]|8192&e.$$.dirty[11]&&(r?(mt.addEventListener("play",Sn),mt.addEventListener("pause",Sn)):mt&&"video"===mt.nodeName&&(mt.removeEventListener("play",Sn),mt.removeEventListener("pause",Sn))),2048&e.$$.dirty[9]&&r&&xn.set(Bn()/On()),24&e.$$.dirty[13]&&(e=>{if(!In())return;const t=Date.now();if(Cn&&t-Cn<16)return;Cn=t;const o=hi*e;if(o.toFixed(1)===kn)return;kn=o.toFixed(1);const i=mt,r=()=>{i.removeEventListener("seeked",r),fn()};i.addEventListener("seeked",r),((e,t)=>{e.fastSeek&&e.fastSeek(t),e.currentTime=t})(i,o)})(di||ui),16&e.$$.dirty[13]&&o(351,n=ui&&se(ui,6)),97&e.$$.dirty[13]&&o(349,s=ni||[[0,Math.min(hi,pi)/hi]]),256&e.$$.dirty[11]&&(l=s[0][0]),256&e.$$.dirty[11]&&(c=s[s.length-1][1]),256&e.$$.dirty[11]&&o(352,d=s.map((([e,t])=>[se(e,6),se(t,6)]))),3072&e.$$.dirty[11]&&o(350,u=d.findIndex((([e,t])=>n>=e&&n<=t))),3584&e.$$.dirty[11]&&(h=-1===u&&d.findIndex(((e,t,o)=>{const i=o[t-1];return i?n<=e[0]&&n>=i[1]:n<=e[0]}))),4096&e.$$.dirty[8]&&Dn.set(Vr),8192&e.$$.dirty[11]|4&e.$$.dirty[13]&&(mt&&ci?Ln():zn()),8192&e.$$.dirty[11]|2&e.$$.dirty[13]&&mt&&(e=>{if(!r)return;mt.volume=Math.min(1,e)})(li),256&e.$$.dirty[0]&&un(Vn,si=lr,si),8192&e.$$.dirty[7]&&o(345,p="overlay"===Gi),1073741824&e.$$.dirty[7]|16&e.$$.dirty[11]&&o(45,g=vr&&!p),134217730&e.$$.dirty[0]&&pn&&Object.entries(pn).forEach((([e,t])=>{Object.entries(t).forEach((([t,i])=>{gn[e]&&o(1,gn[e][t]=i,gn)}))})),262144&e.$$.dirty[7]&&Hn.set(Qi?1:0),2097152&e.$$.dirty[7]&&($=rr?(t=rr,m=Un,We(Math.min(t.width,m.width),Math.min(t.height,m.height))):Un),1073741824&e.$$.dirty[12]&&Jn.update(ri[0]),536870912&e.$$.dirty[12]&&(y=ii?(e,t)=>ii(e,{flipX:void 0,flipY:void 0,rotation:void 0,...t,isPreview:!0}):G),536870912&e.$$.dirty[1]&&Array.isArray(oi)&&Ni("selectionchange",[...oi]),16384&e.$$.dirty[8]|268435456&e.$$.dirty[12]&&ts.set(ti&&Xr),34816&e.$$.dirty[8]&&os.set("pan"===_r||qr),2097152&e.$$.dirty[1]&&Ht&&hs.set(nt(Ht.x,Ht.y,Ht.width,Ht.height)),262160&e.$$.dirty[11]|4&e.$$.dirty[12]&&Pt&&p&&oo&&oo.complete&&(()=>{const e=Jo,t=pt(Pt);e&&e===t||(ca.set(pt(Pt)),Kl())})(),33554432&e.$$.dirty[10]&&o(46,Z=O.length>1),32768&e.$$.dirty[1]&&(Z||ps.set(Je())),1024&e.$$.dirty[0]|134217728&e.$$.dirty[12]&&(xr||gs.set(nt(0,Ko,0,0))),524352&e.$$.dirty[11]&&o(348,x=!It&&b),67108864&e.$$.dirty[12]&&o(346,S=!Yo),2097152&e.$$.dirty[1]&&o(292,qe=Ht&&Ht.width>0&&Ht.height>0),8&e.$$.dirty[0]|12288&e.$$.dirty[9]&&o(41,et=qe&&Xi&&!!W),1024&e.$$.dirty[1]&&setTimeout((()=>o(281,ks=et)),1),131072&e.$$.dirty[7]|4&e.$$.dirty[9]|160&e.$$.dirty[11]&&un(ws,ao="always"===Ji?x:"never"!==Ji&&(x&&ks&&S),ao),131072&e.$$.dirty[7]|96&e.$$.dirty[11]&&un(Ss,Zt="always"===Ji?b:"never"!==Ji&&(b&&S),Zt),524288&e.$$.dirty[7]|16&e.$$.dirty[11]&&Ts.set(tr||p),1048576&e.$$.dirty[7]&&_s.set(or),4&e.$$.dirty[0]|41943040&e.$$.dirty[12]&&$n&&($n.dispatchEvent(vp("markupzoom",Zo)),$n.dispatchEvent(vp("zoom",Ao(Zo)?Zo:No))),4&e.$$.dirty[0]|16777216&e.$$.dirty[12]&&$n&&($n.dispatchEvent(vp("markuppan",jo)),$n.dispatchEvent(vp("pan",jo))),2097152&e.$$.dirty[12]&&zo&&el(),4194304&e.$$.dirty[12]&&Fo&&il(),8396800&e.$$.dirty[1]&&V&&kl.set(.075,{hard:!Zt}),4194304&e.$$.dirty[7]&&o(343,k=sr),1572864&e.$$.dirty[12]&&o(344,C=Eo?-Math.max(...Object.values(Po)):0),277872640&e.$$.dirty[1]|12&e.$$.dirty[11]&&Ro){let e=Ro.x-Rt.x,t=Rt.x+Rt.width-(Ro.x+Ro.width),o=Ro.y-Rt.y,i=Rt.y+Rt.height-(Ro.y+Ro.height),r=Math.min(e,o,t,i);Rl.set(r>C?0:Math.min(k,Math.abs(r/64)),{hard:!Zt})}if(134217728&e.$$.dirty[1]&&o(342,T=.55/Mo),9437184&e.$$.dirty[1]|2&e.$$.dirty[11]&&Rt&&Pl.set({x:0,y:Rt.y,width:Rt.x<64?0:Rt.x,height:Rt.height+T},{hard:!Zt}),9437184&e.$$.dirty[1]|262146&e.$$.dirty[11]&&Rt&&El.set({x:0,y:0,width:Pt.width,height:Rt.y+T},{hard:!Zt}),9437184&e.$$.dirty[1]|262146&e.$$.dirty[11]&&Rt){let e=Rt.x+Rt.width,t=Pt.width-(Rt.x+Rt.width);t<64&&(e+=t,t=0),Il.set({x:e,y:Rt.y,width:t,height:Rt.height+T},{hard:!Zt})}if(9437184&e.$$.dirty[1]|262144&e.$$.dirty[11]&&Rt&&Al.set({x:0,y:Rt.y+Rt.height,width:Pt.width,height:Pt.height-(Rt.y+Rt.height)},{hard:!Zt}),67108864&e.$$.dirty[1]|294912&e.$$.dirty[12]&&o(338,M=To&&{id:fm,backgroundColor:So,opacity:wo,...To}),67108864&e.$$.dirty[1]|163840&e.$$.dirty[12]&&o(341,P=Co&&{id:fm,backgroundColor:So,opacity:wo,...Co}),67108864&e.$$.dirty[1]|98304&e.$$.dirty[12]&&o(340,E=ko&&{id:fm,backgroundColor:So,opacity:wo,...ko}),67108864&e.$$.dirty[1]|49152&e.$$.dirty[12]&&o(339,I=vo&&{id:fm,backgroundColor:So,opacity:wo,...vo}),1879048192&e.$$.dirty[10]|1&e.$$.dirty[11]&&o(337,A=[P,E,I,M].filter(Boolean)),134217728&e.$$.dirty[10]|8192&e.$$.dirty[12]&&A&&xo&&Tl.update((e=>[...e.filter((e=>e.id!==fm)),...A])),262144&e.$$.dirty[8]|1024&e.$$.dirty[12]&&zl.set(cn||(mo||void 0)),4&e.$$.dirty[0]|2048&e.$$.dirty[7]|8192&e.$$.dirty[11]&&(o(228,Wl=mt),mt&&$n.dispatchEvent(vp("loadpreview",Wl))),8&e.$$.dirty[12]&&io&&(Js.set(de()),Xs.set(void 0),el(),Vl.set([])),4096&e.$$.dirty[12]&&o(296,F=fo.index>0),4096&e.$$.dirty[12]&&o(295,D=fo.index<fo.length-1),8&e.$$.dirty[1]&&uc.set(cc),2048&e.$$.dirty[12]&&hc.set(go),8192&e.$$.dirty[1]&&Ya.set(V),65664&e.$$.dirty[1]&&o(38,N=_.reduce(((e,t)=>(e[t.id]=N&&N[t.id]||0,e)),{})),8192&e.$$.dirty[1]&&o(80,H={name:gc,selected:V}),65536&e.$$.dirty[1]&&o(79,j=_.map((e=>({id:e.id,icon:e.tabIcon,label:e.tabLabel})))),65536&e.$$.dirty[1]&&o(78,U=_.map((e=>e.id))),4096&e.$$.dirty[7]&&o(77,X=Mc(["PinturaRoot","PinturaRootComponent",Ui])),262144&e.$$.dirty[11]&&o(331,Y=Pt&&(Pt.width>1e3?"wide":Pt.width<600?"narrow":void 0)),262144&e.$$.dirty[11]&&o(318,q=Pt&&(Pt.width<=320||Pt.height<=460)),262144&e.$$.dirty[11]&&o(330,K=Pt&&(Pt.height>1e3?"tall":Pt.height<600?"short":void 0)),4&e.$$.dirty[0]&&o(298,J=$n&&$n.parentNode&&$n.parentNode.classList.contains("PinturaModal")),1&e.$$.dirty[1]|524288&e.$$.dirty[9]|262144&e.$$.dirty[11]&&o(323,Q=J&&Pt&&jl>Pt.width),2&e.$$.dirty[1]|524288&e.$$.dirty[9]|262144&e.$$.dirty[11]&&o(322,ee=J&&Pt&&Ul>Pt.height),12288&e.$$.dirty[10]&&o(324,te=Q&&ee),1048576&e.$$.dirty[0]&&o(321,oe=Kr),2097152&e.$$.dirty[10]&&o(293,ie="narrow"===Y),16&e.$$.dirty[8]|262144&e.$$.dirty[11]&&o(332,(v=Pt,w=Rr,re=Pt?"auto"===w?v.width>v.height?"landscape":"portrait":"horizontal"===w?v.width<500?"portrait":"landscape":"vertical"===w?v.height<400?"landscape":"portrait":void 0:"landscape")),4194304&e.$$.dirty[10]&&o(76,ne="landscape"===re),16384&e.$$.dirty[9]|1048576&e.$$.dirty[10]&&o(320,ae=ie||"short"===K),1&e.$$.dirty[1]|262144&e.$$.dirty[11]&&o(319,le=bc&&Pt&&jl===Pt.width&&!Gl),4&e.$$.dirty[1]|512&e.$$.dirty[12]&&o(294,ce=[...po||[],...dc].filter(Boolean)),32&e.$$.dirty[8]&&o(329,he="has-navigation-preference-"+Pr),64&e.$$.dirty[8]&&o(328,pe="has-navigation-preference-"+Er),128&e.$$.dirty[8]&&o(325,me="has-toolbar-preference-"+Ir),256&e.$$.dirty[8]&&o(327,ge="has-controlgroups-preference-"+Ar),512&e.$$.dirty[8]&&o(326,$e="has-controltabs-preference-"+Lr),262144&e.$$.dirty[11]&&o(334,fe=void 0!==Pt&&Pt.width>0&&Pt.height>0),4&e.$$.dirty[0]|16777216&e.$$.dirty[10]&&o(333,ye=fe&&$n&&getComputedStyle($n)),8388608&e.$$.dirty[10]&&ye&&Rc(),1024&e.$$.dirty[0]|8437760&e.$$.dirty[1]|270336&e.$$.dirty[7]|524288&e.$$.dirty[9]|8388352&e.$$.dirty[10]|33554432&e.$$.dirty[11]|384&e.$$.dirty[12]&&Zl.set({...jt,layoutMode:Gi,orientation:re,horizontalSpace:Y,verticalSpace:K,navigationHorizontalPreference:he,navigationVerticalPreference:pe,controlGroupsVerticalPreference:ge,controlTabsVerticalpreference:$e,toolbarVerticalPreference:me,isModal:J,isDisabled:Qi,isCentered:te,isCenteredHorizontally:Q,isCenteredVertically:ee,isAnimated:Zt,isTransparent:oe,pointerAccuracy:ho,pointerHoverable:uo,isCompact:ae,hasSwipeNavigation:le,hasLimitedSpace:q,hasToolbar:xr,hasNavigation:Z&&g,isIOS:bc,browserVersion:Dl()?"chrome-"+(navigator.userAgent.match(/Chrome\/([0-9]+)/)||[])[1]:void 0}),33554432&e.$$.dirty[11]&&o(75,be=Object.entries(jt).map((([e,t])=>/^is|has/.test(e)?t?wp(e):void 0:t)).filter(Boolean).join(" ")),8192&e.$$.dirty[1]&&V&&lc.set([]),96&e.$$.dirty[12]&&o(74,ve=lo&&Object.entries(so).filter((([,e])=>null!=e)).reduce(((e,[,t])=>e={...e,...t}),{})),4&e.$$.dirty[12]&&o(315,Ce=oo&&"any-to-file"===oo.task),32&e.$$.dirty[10]&&Ce&&ac&&ac.clear(),16&e.$$.dirty[12]&&o(317,we=!!no&&!!no.translation),16&e.$$.dirty[9]|128&e.$$.dirty[10]|8192&e.$$.dirty[11]&&we&&mt&&mt!==Ac&&(o(283,Ac=mt),Ec()),128&e.$$.dirty[10]|16&e.$$.dirty[12]&&we&&Ic(no),33554432&e.$$.dirty[1]&&ro&&ro.length>1){let e=[];ac.forEach(((t,o)=>{0!==o&&t.get().opacity<=0&&e.push(t)})),e.forEach((e=>ac.remove(e)))}if(8&e.$$.dirty[0]|64&e.$$.dirty[10]&&o(40,ke=Xi&&Se.length&&Xi.labelSupportError(Se)),4&e.$$.dirty[12]&&o(307,Te=oo&&!!oo.error),4&e.$$.dirty[12]&&o(43,Me=!oo||!oo.complete&&void 0===oo.task),4&e.$$.dirty[12]&&o(308,Re=oo&&(oo.taskLengthComputable?oo.taskProgress:1/0)),32&e.$$.dirty[10]&&Ce&&un(Ll,eo=!1,eo),8388608&e.$$.dirty[1]|32&e.$$.dirty[9]|4&e.$$.dirty[12]&&oo&&oo.complete){const e=Zt?250:0;clearTimeout(zc),o(284,zc=setTimeout((()=>{un(Ll,eo=!0,eo)}),e))}if(4096&e.$$.dirty[1]|268435456&e.$$.dirty[9]|5&e.$$.dirty[12]&&o(312,Pe=oo&&!Te&&!Me&&!eo),8&e.$$.dirty[9]|8192&e.$$.dirty[11]|8&e.$$.dirty[12]&&o(311,Ee=!(!io||mt&&!Ol)),8388608&e.$$.dirty[1]|1&e.$$.dirty[12])if(eo){setTimeout((()=>Tc.set(1)),Zt?500:0)}else Tc.set(0);if(67108864&e.$$.dirty[11]|2&e.$$.dirty[12]&&o(306,Ie=!!(Gt||to&&void 0!==to.progress&&!to.complete)),134217728&e.$$.dirty[9]&&Ie&&En(),4096&e.$$.dirty[1]|4&e.$$.dirty[12]&&o(309,Ae=oo&&!(oo.error||Me)),8&e.$$.dirty[0]|4&e.$$.dirty[12]&&o(310,Le=Xi&&(oo?!oo.complete||oo.error?dl(Xi.statusLabelLoadImage(oo),oo.error&&oo.error.metadata,"{","}"):Xi.statusLabelLoadImage({progress:1/0,task:"blob-to-bitmap"}):Xi.statusLabelLoadImage(oo))),8&e.$$.dirty[0]|2&e.$$.dirty[12]&&o(305,ze=to&&Xi&&Xi.statusLabelProcessImage(to)),2&e.$$.dirty[12]&&o(303,Fe=to&&(to.taskLengthComputable?to.taskProgress:1/0)),2&e.$$.dirty[12]&&o(304,De=to&&!to.error),2&e.$$.dirty[12]&&o(302,Oe=!(!to||!to.error)),8&e.$$.dirty[0]|4096&e.$$.dirty[1]|1024&e.$$.dirty[7]|2139095040&e.$$.dirty[9]|7&e.$$.dirty[10])if(er){let e,t,i,r,n;R(er)&&(e=er),Ao(er)?t=er:Array.isArray(er)&&([e,t,n]=er,!1===t&&(r=!0),Ao(t)&&(i=!0)),o(35,Dc=(e||t)&&{text:e,aside:r||i,progressIndicator:{visible:i,progress:t},closeButton:r&&{label:Xi.statusLabelButtonClose,icon:Xi.statusIconButtonClose,onclick:n||(()=>o(227,er=void 0))}})}else o(35,Dc=Xi&&Me||Te||Pe||Ee?{text:Le,aside:Te||Ae,progressIndicator:{visible:Ae,progress:Re},closeButton:Te&&{label:Xi.statusLabelButtonClose,icon:Xi.statusIconButtonClose,onclick:Hc}}:Xi&&Ie&&ze?{text:ze,aside:Oe||De,progressIndicator:{visible:De,progress:Fe},closeButton:Oe&&{label:Xi.statusLabelButtonClose,icon:Xi.statusIconButtonClose,onclick:jc}}:void 0);if(1024&e.$$.dirty[7]&&o(314,Be=void 0!==er),8388608&e.$$.dirty[1]|524288&e.$$.dirty[9]|2&e.$$.dirty[12]&&J&&to&&to.complete&&(Fc.set(!0),setTimeout((()=>Fc.set(!1)),Zt?100:0)),4&e.$$.dirty[0]|8192&e.$$.dirty[1]|1&e.$$.dirty[12]&&eo&&$n&&$n.dispatchEvent(vp("selectutil",V)),4608&e.$$.dirty[1]|402653184&e.$$.dirty[9]|22&e.$$.dirty[10]|1073741824&e.$$.dirty[11]&&o(313,_e=Qt||ke||Me||Te||Pe||Ee||Ie||Be),8&e.$$.dirty[10]&&un(Lc,Jt=_e?1:0,Jt),8388608&e.$$.dirty[1]|8&e.$$.dirty[10]&&Lc.set(_e?1:0,{duration:Zt?500:1}),16777216&e.$$.dirty[1]&&o(42,Ve=Jt>0),16&e.$$.dirty[1]&&o(301,Ne=!(!Dc||!Dc.aside)),8390672&e.$$.dirty[1]|4194368&e.$$.dirty[9]|536870912&e.$$.dirty[11]&&Ve&&Dc){clearTimeout(Nc);const e={hard:!1===Zt};if(Ne){const t=!!Dc.error||!Zt;Bc.set(1,e),Oc.set(Kt,{hard:t}),o(285,Nc=setTimeout((()=>{Wc.set(16,e)}),1))}else Bc.set(0,e),o(285,Nc=setTimeout((()=>{Wc.set(0,e)}),1))}if(2048&e.$$.dirty[1]&&(Ve||(Vc.set(void 0,{hard:!0}),Oc.set(void 0,{hard:!0}),Wc.set(0,{hard:!0}))),268435456&e.$$.dirty[11]&&o(300,He=.5*qt),2097152&e.$$.dirty[9]|134217728&e.$$.dirty[11]&&o(73,je=`transform: translateX(${Yt-He}px)`),512&e.$$.dirty[1]|8192&e.$$.dirty[11]&&o(39,ct=mt&&!ke),256&e.$$.dirty[1]|1572864&e.$$.dirty[9]&&o(297,Ge=Ue&&(ct||J)?Uc:a),262144&e.$$.dirty[9]&&o(72,Ze=Ge),262144&e.$$.dirty[9]&&o(71,Xe=Ge),8&e.$$.dirty[0]|4194304&e.$$.dirty[1]|973078528&e.$$.dirty[7]|1&e.$$.dirty[8]|245760&e.$$.dirty[9]|33554432&e.$$.dirty[11]&&o(70,Ye=Xi&&Ut&&Fp((()=>hr([["div","alpha",{class:"PinturaNavGroup"},[["div","alpha-set",{class:"PinturaNavSet"},[wr&&["Button","close",{label:Xi.labelClose,icon:Xi.iconButtonClose,onclick:()=>Ni("close"),hideLabel:!0}],$r&&["Button","revert",{label:Xi.labelButtonRevert,icon:Xi.iconButtonRevert,disabled:!F,onclick:oc,hideLabel:!0}]]]]],["div","beta",{class:"PinturaNavGroup PinturaNavGroupFloat"},[fr&&["div","history",{class:"PinturaNavSet"},[["Button","undo",{label:Xi.labelButtonUndo,icon:Xi.iconButtonUndo,disabled:!F,onclick:ql.undo,hideLabel:!0}],["Button","redo",{label:Xi.labelButtonRedo,icon:Xi.iconButtonRedo,disabled:!D,onclick:ql.redo,hideLabel:!0}]]],ce.length&&["div","plugin-tools",{class:"PinturaNavSet"},ce.filter(Boolean).map((([e,t,o])=>[e,t,{...o}]))]]],["div","gamma",{class:"PinturaNavGroup"},[gr&&["Button","export",{label:Xi.labelButtonExport,icon:ie&&Xi.iconButtonExport,class:"PinturaButtonExport",onclick:rc,hideLabel:ie}]]]],{...jt},(()=>_n.set({})))))),2097152&e.$$.dirty[11]&&o(289,tt=Ft&&!!Ft.length),1024&e.$$.dirty[9]|2113536&e.$$.dirty[11]&&o(288,it=tt&&Ur(bt,Ft)),1536&e.$$.dirty[9]|25174016&e.$$.dirty[11]&&tt&&((e,t,i,r)=>{if(!t)return;const n={dataSizeScalar:i};r&&r[3]>0&&(n.backgroundColor=[...r]),t(e,n).then((e=>{qc&&f(qc),o(286,qc=e)}))})(mt,Bt,it,Ot),128&e.$$.dirty[9]|6307840&e.$$.dirty[11]&&Ft&&qc&&bt){const{width:e,height:t}=bt,i=Xt()?"pixelated":"auto"===Dt?"auto":"pixelated";o(287,Jc=Ft.map((o=>{const r=nt(o.x,o.y,o.width,o.height),n=$t(Ke(r),o.rotation).map((o=>ue(o.x/e,o.y/t)));return{...o,id:"redaction",flipX:!1,flipY:!1,cornerRadius:0,strokeWidth:0,strokeColor:void 0,backgroundColor:[0,0,0,0],backgroundImage:qc,backgroundImageRendering:i,backgroundCorners:n}})))}256&e.$$.dirty[9]|1048576&e.$$.dirty[11]&&o(37,rt=[...Jc,...zt||[]]),32&e.$$.dirty[1]&&Kc&&Qc.set(Kc),4&e.$$.dirty[0]|256&e.$$.dirty[1]&&ct&&$n.dispatchEvent(vp("ready")),524288&e.$$.dirty[1]&&o(64,pd=!0),245760&e.$$.dirty[11]&&o(65,md=!0),262144&e.$$.dirty[1]&&o(66,$d=!0),131072&e.$$.dirty[1]&&o(67,fd=!0),64&e.$$.dirty[1]&&o(68,yd=!0)},o(347,b=!vc()),z=1===Vd()?e=>{e&&(xe(e.origin,Math.round),xe(e.translation,Math.round))}:G,o(316,Se=[!Rp()&&"WebGL"].filter(Boolean)),o(299,Ue=$o()||v()&&qo()),o(69,at=((e,t=!0)=>o=>{"ping"===o.type&&(t&&o.stopPropagation(),e(o.detail.type,o.detail.data))})(Vi.pub)),[ln,gn,$n,Xi,Yi,ir,nr,ar,lr,ur,xr,Mr,zr,Dr,Or,Br,Wr,Hr,Zr,Yr,Kr,Jr,Qr,rn,nn,an,sn,pn,Xn,Bl,ql,jl,Ul,dc,cc,Dc,Kc,rt,N,ct,ke,et,Ve,Me,V,g,Z,_,gt,yt,Mt,Rt,Ht,Ut,Zt,Jt,ro,So,Mo,Ro,oi,Hi,ji,yc,pd,md,$d,fd,yd,at,Ye,Xe,Ze,je,ve,be,ne,X,U,j,H,bo,ai,mi,gi,$i,yi,bi,xi,vi,wi,Si,Ti,Mi,Ri,Ei,Ii,Li,zi,Fi,Di,Oi,Bi,yn,bn,xn,Dn,_n,Vn,Hn,Qn,ea,oa,ia,ra,aa,sa,la,ca,da,ua,fa,xa,va,wa,Pa,Ea,Ia,Aa,La,za,Fa,_a,Va,Na,Ha,ja,Ua,qa,Ka,Ja,Qa,es,ts,os,is,rs,as,ss,ls,us,hs,ps,ms,gs,$s,fs,ys,xs,vs,ws,Ss,Ts,Rs,Ps,Es,As,Ls,zs,Fs,Vs,Ns,js,Gs,Zs,Xs,qs,Ks,Js,tl,ol,rl,xl,Tl,Ml,Rl,Pl,El,Il,Al,Ll,zl,_l,Vl,Nl,Zl,Yl,ic,ac,lc,mc,Sc,kc,Cc,Tc,({target:e,propertyName:t})=>{e===$n&&/background|outline/.test(t)&&ye&&Rc()},Pc,Lc,Fc,Oc,Bc,Wc,_c,Vc,e=>{const t=!(!Dc||!Dc.closeButton)||!Zt;_c.set(e.detail.width,{hard:t}),Vc.set(Math.round(.5*-e.detail.width),{hard:t})},Gc,Zc,e=>{const{keyCode:t,metaKey:o,ctrlKey:i,shiftKey:n}=e;if(9===t&&Qi)return void e.preventDefault();if(e.target&&32===t&&$n.contains(e.target)&&!Gd(e.target)&&(Nt&&r&&An(),e.preventDefault()),90===t&&(o||i))return void(n&&o?ql.redo():ql.undo());if(89===t&&i)return void ql.redo();if(229===t)return;const a=new Set([...Vt,t]);Zc.set(Array.from(a))},({key:e,keyCode:t})=>{if("Meta"===e)return Zc.set([]);Zc.set(Vt.filter((e=>e!==t)))},()=>{Zc.set([])},e=>{Gd(e.target)||e.preventDefault()},e=>{kr&&Xc(e.detail.resources[0])},()=>{Tr&&zp().then(Yc)},e=>{if(!Cr)return;const t=ns((window.innerWidth-Math.abs(Pt.x))/Pt.width,0,1),o=ns((window.innerHeight-Math.abs(Pt.y))/Pt.height,0,1);t<.75&&o<.75||Xc((e.clipboardData||window.clipboardData).files[0])},ed,hd,e=>{dt&&ht(e.detail,dt)||un($s,dt=e.detail,dt)},er,Wl,Ui,Gi,Zi,qi,Ki,Ji,Qi,tr,or,rr,sr,cr,dr,hr,mr,gr,$r,fr,vr,wr,kr,Cr,Tr,Rr,Pr,Er,Ir,Ar,Lr,Fr,_r,Vr,Nr,Xr,qr,()=>o(61,Hi=void 0),(e,t,i)=>{const{text:r="",placeholder:n="",autoClose:a=!0,align:s="top",justify:l="center",buttonConfirm:c,buttonCancel:d}=i;o(61,Hi={align:s,justify:l,text:r,placeholder:n,buttonConfirm:c,buttonCancel:d,onconfirm:()=>{e(ji.value),a&&o(61,Hi=void 0)},oncancel:()=>{t(void 0),o(61,Hi=void 0)}})},cn,dn,hn,mn,Pn,En,In,An,Ln,zn,Fn,On,Bn,Wn,Nn,ks,Ol,Ac,zc,Nc,qc,Jc,it,tt,r,W,qe,ie,ce,D,F,Ge,J,Ue,He,Ne,Oe,Fe,De,ze,Ie,Te,Re,Ae,Le,Ee,Pe,_e,Be,Ce,Se,we,q,le,ae,oe,ee,Q,te,me,$e,ge,pe,he,K,Y,re,ye,fe,O,B,A,M,I,E,P,T,k,C,p,S,b,x,s,u,n,d,i,mt,bt,wt,kt,Tt,Pt,It,zt,Ft,Dt,Ot,Bt,jt,Gt,Yt,qt,Kt,Qt,eo,to,oo,io,no,so,lo,uo,ho,po,mo,go,fo,xo,vo,wo,ko,Co,To,Po,Eo,zo,Fo,No,jo,Zo,Yo,Ko,ti,ii,ri,ni,li,ci,di,ui,hi,pi,function(){o(31,jl=Gp.innerWidth),o(32,Ul=Gp.innerHeight)},e=>un(gs,$i=e.detail,$i),({detail:e})=>o(44,V=e),(e,t)=>t.id===e,function(t,i){e.$$.not_equal(gn[i],t)&&(gn[i]=t,o(1,gn),o(268,hn),o(27,pn))},e=>o(63,yc=yc.concat(e)),e=>o(63,yc=yc.filter((t=>t!==e))),(e,{detail:t})=>o(38,N[e]=t,N),e=>un(ps,bo=e.detail,bo),e=>e.id===V,function(t){e.$$.not_equal(gn[V],t)&&(gn[V]=t,o(1,gn),o(268,hn),o(27,pn))},()=>o(63,yc=yc.concat(V)),()=>o(63,yc=yc.filter((e=>e!==V))),({detail:e})=>o(38,N[V]=e,N),e=>{const t={...e,...ed()},{annotationShapes:o,decorationShapes:i,interfaceShapes:r,frameShapes:n,selectionShapes:a}=ur({annotationShapes:Mt,decorationShapes:yt,interfaceShapes:Ri,frameShapes:gt,selectionShapes:oi},t);return hd(t,rt,o,i,r,n,a)},()=>{o(64,pd=!1),o(65,md=!1),o(66,$d=!1),o(67,fd=!1),o(68,yd=!1)},function(e){ta[e?"unshift":"push"]((()=>{Kc=e,o(36,Kc)}))},function(e){ln=e,o(0,ln),o(258,Fr)},function(e){dc=e,o(33,dc)},function(e){cc=e,o(34,cc)},function(e){ta[e?"unshift":"push"]((()=>{ji=e,o(62,ji)}))},function(e){ta[e?"unshift":"push"]((()=>{$n=e,o(2,$n)}))},e=>un(us,Ht=e.detail,Ht)]}class xm extends Fa{constructor(e){super(),za(this,e,bm,gm,Qr,{class:229,layout:230,stores:231,locale:3,id:4,util:232,utils:233,animations:234,disabled:235,status:227,previewUpscale:236,previewPad:237,previewMaskOpacity:5,previewImageDataMaxSize:238,previewImageTextPixelRatio:6,markupMaskOpacity:7,zoomMaskOpacity:239,elasticityMultiplier:8,willRevert:240,willProcessImage:241,willRenderCanvas:9,willRenderToolbar:242,willSetHistoryInitialState:243,enableButtonExport:244,enableButtonRevert:245,enableNavigateHistory:246,enableToolbar:10,enableUtils:247,enableButtonClose:248,enableDropImage:249,enablePasteImage:250,enableBrowseImage:251,enableTransparencyGrid:11,layoutDirectionPreference:252,layoutHorizontalUtilsPreference:253,layoutVerticalUtilsPreference:254,layoutVerticalToolbarPreference:255,layoutVerticalControlGroupsPreference:256,layoutVerticalControlTabsPreference:257,textDirection:12,markupEditorZoomLevel:258,markupEditorZoomLevels:13,markupEditorZoomAdjustStep:14,markupEditorZoomAdjustFactor:15,markupEditorZoomAdjustWheelFactor:16,markupEditorInteractionMode:259,muteAudio:260,willSetMediaInitialTimeOffset:261,enablePan:17,enableZoom:18,enableZoomControls:262,enableZoomInput:19,enablePanInput:263,enableCanvasAlpha:20,enablePanLimit:21,panLimitGutterScalar:22,zoomPresetOptions:23,zoomAdjustStep:24,zoomAdjustFactor:25,zoomAdjustWheelFactor:26,zoomLevel:0,hideTextInput:264,showTextInput:265,imagePreviewSrc:266,imageOrienter:267,pluginComponents:268,pluginOptions:27,sub:269,pluginInterface:1,root:2,play:270,pause:271,isPaused:272,togglePlayPause:273,mute:274,unmute:275,toggleMute:276,getDuration:277,getCurrentTime:278,setCurrentTime:279,imageSourceToImageData:28,imagePreview:29,imagePreviewCurrent:228,history:30},null,[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}get class(){return this.$$.ctx[229]}set class(e){this.$$set({class:e}),pa()}get layout(){return this.$$.ctx[230]}set layout(e){this.$$set({layout:e}),pa()}get stores(){return this.$$.ctx[231]}set stores(e){this.$$set({stores:e}),pa()}get locale(){return this.$$.ctx[3]}set locale(e){this.$$set({locale:e}),pa()}get id(){return this.$$.ctx[4]}set id(e){this.$$set({id:e}),pa()}get util(){return this.$$.ctx[232]}set util(e){this.$$set({util:e}),pa()}get utils(){return this.$$.ctx[233]}set utils(e){this.$$set({utils:e}),pa()}get animations(){return this.$$.ctx[234]}set animations(e){this.$$set({animations:e}),pa()}get disabled(){return this.$$.ctx[235]}set disabled(e){this.$$set({disabled:e}),pa()}get status(){return this.$$.ctx[227]}set status(e){this.$$set({status:e}),pa()}get previewUpscale(){return this.$$.ctx[236]}set previewUpscale(e){this.$$set({previewUpscale:e}),pa()}get previewPad(){return this.$$.ctx[237]}set previewPad(e){this.$$set({previewPad:e}),pa()}get previewMaskOpacity(){return this.$$.ctx[5]}set previewMaskOpacity(e){this.$$set({previewMaskOpacity:e}),pa()}get previewImageDataMaxSize(){return this.$$.ctx[238]}set previewImageDataMaxSize(e){this.$$set({previewImageDataMaxSize:e}),pa()}get previewImageTextPixelRatio(){return this.$$.ctx[6]}set previewImageTextPixelRatio(e){this.$$set({previewImageTextPixelRatio:e}),pa()}get markupMaskOpacity(){return this.$$.ctx[7]}set markupMaskOpacity(e){this.$$set({markupMaskOpacity:e}),pa()}get zoomMaskOpacity(){return this.$$.ctx[239]}set zoomMaskOpacity(e){this.$$set({zoomMaskOpacity:e}),pa()}get elasticityMultiplier(){return this.$$.ctx[8]}set elasticityMultiplier(e){this.$$set({elasticityMultiplier:e}),pa()}get willRevert(){return this.$$.ctx[240]}set willRevert(e){this.$$set({willRevert:e}),pa()}get willProcessImage(){return this.$$.ctx[241]}set willProcessImage(e){this.$$set({willProcessImage:e}),pa()}get willRenderCanvas(){return this.$$.ctx[9]}set willRenderCanvas(e){this.$$set({willRenderCanvas:e}),pa()}get willRenderToolbar(){return this.$$.ctx[242]}set willRenderToolbar(e){this.$$set({willRenderToolbar:e}),pa()}get willSetHistoryInitialState(){return this.$$.ctx[243]}set willSetHistoryInitialState(e){this.$$set({willSetHistoryInitialState:e}),pa()}get enableButtonExport(){return this.$$.ctx[244]}set enableButtonExport(e){this.$$set({enableButtonExport:e}),pa()}get enableButtonRevert(){return this.$$.ctx[245]}set enableButtonRevert(e){this.$$set({enableButtonRevert:e}),pa()}get enableNavigateHistory(){return this.$$.ctx[246]}set enableNavigateHistory(e){this.$$set({enableNavigateHistory:e}),pa()}get enableToolbar(){return this.$$.ctx[10]}set enableToolbar(e){this.$$set({enableToolbar:e}),pa()}get enableUtils(){return this.$$.ctx[247]}set enableUtils(e){this.$$set({enableUtils:e}),pa()}get enableButtonClose(){return this.$$.ctx[248]}set enableButtonClose(e){this.$$set({enableButtonClose:e}),pa()}get enableDropImage(){return this.$$.ctx[249]}set enableDropImage(e){this.$$set({enableDropImage:e}),pa()}get enablePasteImage(){return this.$$.ctx[250]}set enablePasteImage(e){this.$$set({enablePasteImage:e}),pa()}get enableBrowseImage(){return this.$$.ctx[251]}set enableBrowseImage(e){this.$$set({enableBrowseImage:e}),pa()}get enableTransparencyGrid(){return this.$$.ctx[11]}set enableTransparencyGrid(e){this.$$set({enableTransparencyGrid:e}),pa()}get layoutDirectionPreference(){return this.$$.ctx[252]}set layoutDirectionPreference(e){this.$$set({layoutDirectionPreference:e}),pa()}get layoutHorizontalUtilsPreference(){return this.$$.ctx[253]}set layoutHorizontalUtilsPreference(e){this.$$set({layoutHorizontalUtilsPreference:e}),pa()}get layoutVerticalUtilsPreference(){return this.$$.ctx[254]}set layoutVerticalUtilsPreference(e){this.$$set({layoutVerticalUtilsPreference:e}),pa()}get layoutVerticalToolbarPreference(){return this.$$.ctx[255]}set layoutVerticalToolbarPreference(e){this.$$set({layoutVerticalToolbarPreference:e}),pa()}get layoutVerticalControlGroupsPreference(){return this.$$.ctx[256]}set layoutVerticalControlGroupsPreference(e){this.$$set({layoutVerticalControlGroupsPreference:e}),pa()}get layoutVerticalControlTabsPreference(){return this.$$.ctx[257]}set layoutVerticalControlTabsPreference(e){this.$$set({layoutVerticalControlTabsPreference:e}),pa()}get textDirection(){return this.$$.ctx[12]}set textDirection(e){this.$$set({textDirection:e}),pa()}get markupEditorZoomLevel(){return this.$$.ctx[258]}set markupEditorZoomLevel(e){this.$$set({markupEditorZoomLevel:e}),pa()}get markupEditorZoomLevels(){return this.$$.ctx[13]}set markupEditorZoomLevels(e){this.$$set({markupEditorZoomLevels:e}),pa()}get markupEditorZoomAdjustStep(){return this.$$.ctx[14]}set markupEditorZoomAdjustStep(e){this.$$set({markupEditorZoomAdjustStep:e}),pa()}get markupEditorZoomAdjustFactor(){return this.$$.ctx[15]}set markupEditorZoomAdjustFactor(e){this.$$set({markupEditorZoomAdjustFactor:e}),pa()}get markupEditorZoomAdjustWheelFactor(){return this.$$.ctx[16]}set markupEditorZoomAdjustWheelFactor(e){this.$$set({markupEditorZoomAdjustWheelFactor:e}),pa()}get markupEditorInteractionMode(){return this.$$.ctx[259]}set markupEditorInteractionMode(e){this.$$set({markupEditorInteractionMode:e}),pa()}get muteAudio(){return this.$$.ctx[260]}set muteAudio(e){this.$$set({muteAudio:e}),pa()}get willSetMediaInitialTimeOffset(){return this.$$.ctx[261]}set willSetMediaInitialTimeOffset(e){this.$$set({willSetMediaInitialTimeOffset:e}),pa()}get enablePan(){return this.$$.ctx[17]}set enablePan(e){this.$$set({enablePan:e}),pa()}get enableZoom(){return this.$$.ctx[18]}set enableZoom(e){this.$$set({enableZoom:e}),pa()}get enableZoomControls(){return this.$$.ctx[262]}set enableZoomControls(e){this.$$set({enableZoomControls:e}),pa()}get enableZoomInput(){return this.$$.ctx[19]}set enableZoomInput(e){this.$$set({enableZoomInput:e}),pa()}get enablePanInput(){return this.$$.ctx[263]}set enablePanInput(e){this.$$set({enablePanInput:e}),pa()}get enableCanvasAlpha(){return this.$$.ctx[20]}set enableCanvasAlpha(e){this.$$set({enableCanvasAlpha:e}),pa()}get enablePanLimit(){return this.$$.ctx[21]}set enablePanLimit(e){this.$$set({enablePanLimit:e}),pa()}get panLimitGutterScalar(){return this.$$.ctx[22]}set panLimitGutterScalar(e){this.$$set({panLimitGutterScalar:e}),pa()}get zoomPresetOptions(){return this.$$.ctx[23]}set zoomPresetOptions(e){this.$$set({zoomPresetOptions:e}),pa()}get zoomAdjustStep(){return this.$$.ctx[24]}set zoomAdjustStep(e){this.$$set({zoomAdjustStep:e}),pa()}get zoomAdjustFactor(){return this.$$.ctx[25]}set zoomAdjustFactor(e){this.$$set({zoomAdjustFactor:e}),pa()}get zoomAdjustWheelFactor(){return this.$$.ctx[26]}set zoomAdjustWheelFactor(e){this.$$set({zoomAdjustWheelFactor:e}),pa()}get zoomLevel(){return this.$$.ctx[0]}set zoomLevel(e){this.$$set({zoomLevel:e}),pa()}get hideTextInput(){return this.$$.ctx[264]}get showTextInput(){return this.$$.ctx[265]}get imagePreviewSrc(){return this.$$.ctx[266]}set imagePreviewSrc(e){this.$$set({imagePreviewSrc:e}),pa()}get imageOrienter(){return this.$$.ctx[267]}set imageOrienter(e){this.$$set({imageOrienter:e}),pa()}get pluginComponents(){return this.$$.ctx[268]}set pluginComponents(e){this.$$set({pluginComponents:e}),pa()}get pluginOptions(){return this.$$.ctx[27]}set pluginOptions(e){this.$$set({pluginOptions:e}),pa()}get sub(){return this.$$.ctx[269]}get pluginInterface(){return this.$$.ctx[1]}get root(){return this.$$.ctx[2]}set root(e){this.$$set({root:e}),pa()}get play(){return this.$$.ctx[270]}get pause(){return this.$$.ctx[271]}get isPaused(){return this.$$.ctx[272]}get togglePlayPause(){return this.$$.ctx[273]}get mute(){return this.$$.ctx[274]}get unmute(){return this.$$.ctx[275]}get toggleMute(){return this.$$.ctx[276]}get getDuration(){return this.$$.ctx[277]}get getCurrentTime(){return this.$$.ctx[278]}get setCurrentTime(){return this.$$.ctx[279]}get imageSourceToImageData(){return this.$$.ctx[28]}set imageSourceToImageData(e){this.$$set({imageSourceToImageData:e}),pa()}get imagePreview(){return this.$$.ctx[29]}get imagePreviewCurrent(){return this.$$.ctx[228]}set imagePreviewCurrent(e){this.$$set({imagePreviewCurrent:e}),pa()}get history(){return this.$$.ctx[30]}}"undefined"!=typeof window&&(e=>{if(e&&e._clpdx4s)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,118,97,108,105,100,32,108,105,99,101,110,115,101,46]].map((e=>e.map((e=>String.fromCharCode(e))).join("")));e&&e[t]&&e[t][o](i)})(window);const vm=["klass","stores","isVisible","isActive","isActiveFraction","locale"],wm=["history","klass","stores","navButtons","pluginComponents","pluginInterface","pluginOptions","sub","imagePreviewSrc","imagePreview","imagePreviewCurrent"],Sm=["locale"];let km;const Cm=new Set([]),Tm={},Mm=new Map,Rm=(...e)=>{e.filter((e=>!!e.util)).forEach((e=>{const[t,o,i=(()=>!0)]=e.util;Mm.has(t)||(Mm.set(t,{Component:o,isSupported:i}),Xc(o).filter((e=>!vm.includes(e))).forEach((e=>{Cm.add(e),Tm[e]?Tm[e].push(t):Tm[e]=[t]})))}))};var Pm=[...fs,"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 Em=(e,t,o={})=>{const{prefix:i="pintura:"}=o;return Pm.map((o=>e.on(o,(e=>Wt(t)?((e,t,o)=>e.dispatchEvent(new CustomEvent(t,{detail:o,bubbles:!0,cancelable:!0})))(t,`${i}${o}`,e):t(o,e)))))};const Im=e=>R(e[0]),Am=e=>!Im(e),Lm=e=>e[1],zm=e=>e[3]||[];const Fm=(e,t,o,i=(e=>e))=>{const r=Bm(t,o),n=r.findIndex((e=>Lm(e)===t));var a,s,l;a=r,s=i(n),l=e,a.splice(s,0,l)},Dm=(e,t)=>{const o=Bm(e,t);return dd(o,(t=>Lm(t)===e)),o},Om=(e,t)=>{if(t&&t.length){if(Im(t)){if(Lm(t)===e)return t;const o=Om(e,zm(t));if(o)return o}if(Am(t))for(const o of t){const t=Om(e,o);if(t)return t}}},Bm=(e,t)=>{if(Am(t)){if(t.find((t=>Lm(t)===e)))return t;const o=t.find((t=>Bm(e,zm(t))));return o&&o[3]}return Bm(e,zm(t))},Wm=()=>[.75,.25,.25,0,0,.25,.75,.25,0,0,.25,.25,.75,0,0,0,0,0,1,0],_m=()=>[1.398,-.316,.065,-.273,.201,-.051,1.278,-.08,-.273,.201,-.051,.119,1.151,-.29,.215,0,0,0,1,0],Vm=()=>[1.073,-.015,.092,-.115,-.017,.107,.859,.184,-.115,-.017,.015,.077,1.104,-.115,-.017,0,0,0,1,0],Nm=()=>[1.06,0,0,0,0,0,1.01,0,0,0,0,0,.93,0,0,0,0,0,1,0],Hm=()=>[1.1,0,0,0,-.1,0,1.1,0,0,-.1,0,0,1.2,0,-.1,0,0,0,1,0],jm=()=>[.212,.715,.114,0,0,.212,.715,.114,0,0,.212,.715,.114,0,0,0,0,0,1,0],Um=()=>[.15,1.3,-.25,.1,-.2,.15,1.3,-.25,.1,-.2,.15,1.3,-.25,.1,-.2,0,0,0,1,0],Gm=()=>[.163,.518,.084,-.01,.208,.163,.529,.082,-.02,.21,.171,.529,.084,0,.214,0,0,0,1,0],Zm=()=>[.338,.991,.117,.093,-.196,.302,1.049,.096,.078,-.196,.286,1.016,.146,.101,-.196,0,0,0,1,0],Xm=()=>[.393,.768,.188,0,0,.349,.685,.167,0,0,.272,.533,.13,0,0,0,0,0,1,0],Ym=()=>[.289,.62,.185,0,.077,.257,.566,.163,0,.115,.2,.43,.128,0,.188,0,0,0,1,0],qm=()=>[.269,.764,.172,.05,.1,.239,.527,.152,0,.176,.186,.4,.119,0,.159,0,0,0,1,0],Km=()=>[.547,.764,.134,0,-.147,.281,.925,.12,0,-.135,.225,.558,.33,0,-.113,0,0,0,1,0],Jm={chrome:_m,fade:Vm,pastel:Wm,cold:Hm,warm:Nm,monoDefault:jm,monoWash:Gm,monoNoir:Um,monoStark:Zm,sepiaDefault:Xm,sepiaRust:qm,sepiaBlues:Ym,sepiaColor:Km};var Qm={filterFunctions:Jm,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 eg={borderColor:"strokeColor",borderWidth:"strokeWidth",lineWidth:"strokeWidth",fontColor:"color",lineColor:"strokeColor",src:"backgroundImage",fit:"backgroundSize"},tg=e=>0===e||"0%"===e||"0px"===e?0:/px$/.test(e)?parseInt(e,10):/\%$/.test(e)?e:e<=1?100*e+"%":void 0,og=(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},ig=(e,t)=>{const o=e,i=t,r=1.5707963267948966-t,n=Math.sin(1.5707963267948966),a=Math.sin(i),s=Math.sin(r),l=Math.cos(r),c=o/n;return ue(l*(c*a),l*(c*s))},rg=(e,{flip:t,aspectRatio:o,rotation:i,center:r,zoom:n,scaleToFit:a})=>{const s={flipX:!1,flipY:!1},l=!r||r&&.5===r.x&&.5===r.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,r=t;let n=1,a=i;a>r&&(a=r,n=a/i);const s=Math.max(1/n,r/a),l=e.width/(o*s*n);return{width:l,height:l*t}})(e,o,n),h=l?e:((e,t)=>{const o=t.x>.5?1-t.x:t.x,i=t.y>.5?1-t.y:t.y;return We(2*o*e.width,2*i*e.height)})(e,d?r:{x:.5,y:.5}),p=((e,t)=>{let o=e.width,i=o*t;i>e.height&&(i=e.height,o=i/t);const r=.5*(e.width-o),n=.5*(e.height-i);return nt(r,n,o,i)})(e,o);if((o||!l||n)&&(s.crop=xt(Qe(h),c)),"number"==typeof i&&null!==i&&0!==i){null!=i&&(s.rotation=i);const t=((e,t)=>{const o=e.width,i=e.height,r=ig(o,t),n=ig(i,t),a=ue(e.x+Math.abs(r.x),e.y-Math.abs(r.y)),s=ue(e.x+e.width+Math.abs(n.y),e.y+Math.abs(n.x)),l=ue(e.x-Math.abs(n.y),e.y+e.height-Math.abs(n.x));return{width:Re(a,s),height:Re(a,l)}})(p,i),o=Math.max(t.width/h.width,t.height/h.height),n=ue(r.x*e.width,r.y*e.height),a=Bt(e,i),l=Ne(a),c=ue(.5*(a.width-e.width),.5*(a.height-e.height)),d=$t({x:c.x+n.x-u.width/o*.5,y:c.y+n.y-u.height/o*.5,width:u.width/o,height:u.height/o},i),m=Ae(d.map(pe),i,l.x,l.y),g=at(ot(m)),$=Ae(m.map(pe),-2*i,g.x,g.y);s.crop=ot($)}else null!=n&&lt(s.crop,1/n);return d||(s.cropLimitToImage=!1),s};let ng=null;const ag={base:0,min:-.25,max:.25,getLabel:e=>Op(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]})))},sg={base:1,min:.5,max:1.5,getLabel:e=>Op(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]})))},lg={base:1,min:0,max:2,getLabel:e=>Op(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]})))},cg={base:1,min:.5,max:1.5,getLabel:e=>Op(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]})))},dg={base:1,min:.15,max:4,getLabel:e=>Op(e<1?(e-.15)/.85-1:(e-1)/3),getStore:({imageGamma:e})=>e},ug={base:0,min:-1,max:1,getStore:({imageVignette:e})=>e},hg={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]})))}},pg={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 mg={finetuneControlConfiguration:{gamma:dg,brightness:ag,contrast:sg,saturation:lg,exposure:cg,temperature:pg,clarity:hg,vignette:ug},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],!vc()&&["clarity",e=>e.finetuneLabelClarity],["vignette",e=>e.finetuneLabelVignette]].filter(Boolean)};const gg={shape:{frameColor:[1,1,1],frameStyle:"solid",frameSize:"2.5%"},thumb:'<rect stroke-width="5" x="0" y="0" width="100%" height="100%"/>'},$g={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%"/>'},fg={shape:{frameColor:[1,1,1],frameStyle:"line",frameInset:"2.5%",frameSize:".3125%",frameRadius:0},thumb:'<div style="top:.5em;left:.5em;right:.5em;bottom:.5em;box-shadow:inset 0 0 0 1px currentColor"></div>'},yg={shape:{frameColor:[1,1,1],frameStyle:"line",frameAmount:2,frameInset:"2.5%",frameSize:".3125%",frameOffset:"1.25%",frameRadius:0},thumb:'<div style="top:.75em;left:.75em;right:.75em;bottom:.75em; outline: 3px double"></div>'},bg={shape:{frameColor:[1,1,1],frameStyle:"edge",frameInset:"2.5%",frameOffset:"5%",frameSize:".3125%"},thumb:'<div style="top:.75em;left:.5em;bottom:.75em;border-left:1px solid"></div><div style="top:.75em;right:.5em;bottom:.75em;border-right:1px solid"></div><div style="top:.5em;left:.75em;right:.75em;border-top:1px solid"></div><div style="bottom:.5em;left:.75em;right:.75em;border-bottom:1px solid"></div>'},xg={shape:{frameColor:[1,1,1],frameStyle:"edge",frameInset:"2.5%",frameSize:".3125%"},thumb:'<div style="top:-.5em;left:.5em;right:.5em;bottom:-.5em; box-shadow: inset 0 0 0 1px currentColor"></div><div style="top:.5em;left:-.5em;right:-.5em;bottom:.5em;box-shadow:inset 0 0 0 1px currentColor"></div>'},vg={shape:{frameColor:[1,1,1],frameStyle:"edge",frameOffset:"1.5%",frameSize:".3125%"},thumb:'<div style="top:.3125em;left:.5em;bottom:.3125em;border-left:1px solid"></div><div style="top:.3125em;right:.5em;bottom:.3125em;border-right:1px solid"></div><div style="top:.5em;left:.3125em;right:.3125em;border-top:1px solid"></div><div style="bottom:.5em;left:.3125em;right:.3125em;border-bottom:1px solid"></div>'},wg={shape:{frameColor:[1,1,1],frameStyle:"hook",frameInset:"2.5%",frameSize:".3125%",frameLength:"5%"},thumb:'<div style="top:.5em;left:.5em;width:.75em;height:.75em; border-left: 1px solid;border-top: 1px solid;"></div><div style="top:.5em;right:.5em;width:.75em;height:.75em; border-right: 1px solid;border-top: 1px solid;"></div><div style="bottom:.5em;left:.5em;width:.75em;height:.75em; border-left: 1px solid;border-bottom: 1px solid;"></div><div style="bottom:.5em;right:.5em;width:.75em;height:.75em; border-right: 1px solid;border-bottom: 1px solid;"></div>'},Sg={shape:{frameColor:[1,1,1],frameStyle:"polaroid"},thumb:'<rect stroke-width="20%" x="-5%" y="-5%" width="110%" height="96%"/>'};var kg={frameStyles:{solidSharp:gg,solidRound:$g,lineSingle:fg,lineMultiple:yg,edgeSeparate:bg,edgeCross:xg,edgeOverlap:vg,hook:wg,polaroid:Sg},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]]},Cg=e=>e.charAt(0).toUpperCase()+e.slice(1);let Tg=null;var Mg=()=>{if(null===Tg)if(u())try{Tg=!1===document.fonts.check("16px TestNonExistingFont")}catch(e){Tg=!1}else Tg=!1;return Tg};const Rg=(e,t)=>o=>o[t?`${t}${Cg(e)}`:e],Pg=e=>[e,""+e],Eg=(e,t)=>o=>[e[o],Rg(o,t)],Ig=e=>Array.isArray(e)&&e.every(Ao)?e.map(Pg):e,Ag=[1,.2549,.2118],Lg="0.5%",zg=[1,1,1,0],Fg={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"],pathClose:!0}],rectangle:["rectangle",{disableStyle:["backgroundColor","strokeWidth","strokeColor","cornerRadius"],drawMode:"add"}],ellipse:["ellipse",{disableStyle:["backgroundColor","strokeWidth","strokeColor"],drawMode:"add"}]},Dg=["brush","lassoo","rectangle","ellipse"],Og=e=>{const{hideLabel:t=!0}=e||{};return f$(["new","add","subtract"].map((e=>[e,Rg(e,"shapeLabelSelectionMode"),{icon:Rg(e,"shapeIconSelectionMode"),hideLabel:t}])),{title:e=>e.shapeTitleSelectionMode,layout:"radio"})},Bg=e=>$$(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}"/>`}),Wg={eraser:()=>({eraseRadius:8,cursorStyle:"ellipse",cursorSize:"eraseRadius"}),path:()=>({points:[]}),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"})},_g=(e,t={},o)=>{if(!Wg[e])return;const{position:i="relative",inputMode:r="drag",isSelection:n=!1}=o||{};return[{...Wg[e](),...t},{position:i,inputMode:r,isSelection:n}]},Vg=e=>({sharpie:_g("path",{bitmap:!0,strokeJoin:"round",strokeCap:"round",strokeWidth:Lg,strokeColor:[...Ag],cursorStyle:"ellipse",cursorSize:"strokeWidth",disableErase:!1,disableResize:!0,disableMove:!0}),eraser:_g("eraser"),path:_g("path",{pathClose:void 0,strokeWidth:Lg,strokeColor:[...Ag],backgroundColor:[0,0,0,0]},{inputMode:"step"}),line:_g("line",{strokeColor:[...Ag],strokeWidth:Lg}),arrow:_g("line",{lineStart:"none",lineEnd:"arrow-solid",strokeColor:[...Ag],strokeWidth:Lg}),rectangle:_g("rectangle",{strokeColor:[...zg],backgroundColor:[...Ag]}),ellipse:_g("ellipse",{strokeColor:[...zg],backgroundColor:[...Ag]}),text:_g("text",{color:[...Ag],fontSize:"2%"}),...e}),Ng=(e,t,o)=>[e,t||Rg(e,"shapeLabelTool"),{icon:Rg(e,"shapeIconTool"),...o}],Hg=(e=["move","view","sharpie","eraser","path","line","arrow","rectangle","ellipse","text","preset"])=>e.map((e=>R(e)?Ng(e):Array.isArray(e)?C(e[1])?Ng(e[0],void 0,e[1]):Ng(e[0],e[1],e[2]):void 0)).filter(Boolean),jg=()=>({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]}),Ug=()=>[16,18,20,24,30,36,48,64,72,96,128,144],Gg=Ug,Zg=()=>({extraSmall:"2%",small:"4%",mediumSmall:"8%",medium:"10%",mediumLarge:"15%",large:"20%",extraLarge:"25%"}),Xg=()=>({extraSmall:"40%",small:"60%",mediumSmall:"100%",medium:"120%",mediumLarge:"140%",large:"180%",extraLarge:"220%"}),Yg=()=>({extraSmall:"0.25%",small:"0.5%",mediumSmall:"1%",medium:"1.75%",mediumLarge:"2.5%",large:"3.5%",extraLarge:"5%"}),qg=()=>["bar","arrow","arrowSolid","circle","circleSolid","square","squareSolid"],Kg=()=>[["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"]],Jg=()=>["left","center","right"],Qg=()=>[["normal","bold"],["italic","normal"],["italic","bold"]],e$=e=>Object.keys(e).map(Eg(e,"shapeTitleColor")),t$=e=>Object.keys(e).map(Eg(e,"labelSize")),o$=e=>Object.keys(e).map(Eg(e,"labelSize")),i$=e=>Object.keys(e).map(Eg(e,"labelSize")),r$=e=>[...e],n$=e=>e.map((e=>[e,t=>t["shapeLabelFontStyle"+e.filter((e=>"normal"!==e)).map(Cg).join("")]])),a$=e=>e.map((e=>[wp(e),t=>t["shapeTitleLineDecoration"+Cg(e)],{icon:t=>t["shapeIconLineDecoration"+Cg(e)]}])),s$=(e,t)=>{const{defaultKey:o,defaultValue:i,defaultOptions:r}=t||{},n=[];return o&&(n[0]=[i,e=>e[o],{...r}]),[...n,...e]},l$=e=>e.split(",").map((e=>e.trim())).some((e=>document.fonts.check("16px "+e))),c$=(e={})=>["ToggleSlider",{...e}],d$="PinturaFontTest",u$=(e,t={defaultKey:"labelDefault"})=>["Dropdown",{title:e=>e.shapeTitleFontFamily,onload:({options:e=[]})=>{Mg()&&e.map((([e])=>e)).filter(Boolean).filter((e=>!l$(e))).forEach((e=>{const t="PinturaFontTest-"+e.replace(/[^a-zA-Z0-9]+/g,"").toLowerCase();document.getElementById(t)||document.body.append(g("span",{textContent:" ",id:t,class:d$,style:`font-family:${e};font-size:0;color:transparent;`}))}))},ondestroy:()=>{if(!Mg())return;document.querySelectorAll(".PinturaFontTest").forEach((e=>e.remove()))},optionLabelStyle:e=>"font-family: "+e,options:s$(e,t),optionFilter:e=>{if(!Mg())return!0;const[t]=e;if(!t)return!0;return l$(t)}}],h$=(e,t={})=>["ColorPicker",{options:s$(e),...t}],p$=(e,t={})=>h$(e,{title:e=>e.labelColor,...t}),m$=(e,t={})=>h$(e,{title:e=>e.shapeTitleBackgroundColor,...t}),g$=(e,t={})=>h$(e,{title:e=>e.shapeTitleStrokeColor,options:s$(e),buttonClass:"PinturaColorPickerButtonStroke",onchange:(e,o)=>{const i=o.strokeWidth;(Ao(i)||R(i)?parseFloat(i):0)>0||(o.strokeWidth=t&&t.defaultStrokeWidth||"0.5%")},...t}),$$=(e,t)=>{const{title:o,optionHideLabel:i=!1,layout:r,optionIcon:n=!1}=t||{},a=Ig(e),s=e.map((([e])=>R(e)?parseFloat(e):e)),l=Math.max(...s),c=Math.min(...s),d=l-c;return["radio"===r?"RadioGroup":"Dropdown",{title:!1===o?void 0:o||(e=>e.shapeTitleStrokeWidth),options:e=>{const o=t?a.map((e=>{const[t,o,r={}]=e,a=R(t)?parseFloat(t):t,s=(a-c)/d;let l=void 0;return"line"===n?l=`<path stroke="currentColor" stroke-linecap="square" stroke-width="${.1+.875*s}em" d="M3,12 H20"/>`:"dot"===n?l=`<circle fill="currentColor" cx="12" cy="12" r="${2+8*s}"/>`:R(n)?l=n:P(n)&&(l=n(a,s)),[t,o,{icon:l,hideLabel:i,...r}]})):a;return zo(e,"backgroundColor")?s$(o,{defaultKey:"shapeLabelStrokeNone"}):s$(o)},onchange:(e,t)=>{if(!e)return;const o=t.strokeColor||[];if(o[3])return;const i=[...o];i[3]=1,t.strokeColor=i}}]},f$=(e,t)=>{const{title:o,layout:i}=t||{};return["radio"===i?"RadioGroup":"Dropdown",{title:o,options:s$(e)}]},y$=(e,t,o)=>["Dropdown",{title:e=>e[t],options:s$(e,{defaultKey:"labelNone",defaultOptions:{icon:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H14"/></g>'}}),optionIconStyle:o}],b$=e=>y$(e,"shapeTitleLineStart","transform: scaleX(-1)"),x$=e=>y$(e,"shapeTitleLineEnd"),v$=e=>h$(e,{title:e=>e.shapeTitleTextColor,options:s$(e)}),w$=e=>["Dropdown",{title:e=>e.shapeTitleFontStyle,optionLabelStyle:e=>e&&`font-style:${e[0]};font-weight:${e[1]}`,options:s$(e,{defaultKey:"shapeLabelFontStyleNormal"})}],S$=e=>["ShorthandControl",e],k$=(e,t,o,i)=>{i||e.find((([e])=>e===o))||(i={defaultKey:"labelAuto",defaultValue:o});const r=Ig(e);return["Dropdown",{title:t,options:s$(r,i),...i}]},C$=(e,t)=>k$(e,(e=>e.shapeTitleFontSize),"4%",t),T$=(e,t)=>k$(e,(e=>e.shapeTitleLineHeight),"120%",t),M$=e=>["RadioGroup",{title:e=>e.shapeTitleTextAlign,options:s$(e)}],R$={colorOptions:()=>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]}),lineEndStyleOptions:()=>a$(["bar","arrow","arrowSolid","circle","circleSolid","square","squareSolid"]),fontFamilyOptions:()=>r$([["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:()=>n$([["normal","bold"],["italic","normal"],["italic","bold"]]),textAlignOptions:()=>["left","center","right"].map((e=>[e,t=>t["shapeTitleTextAlign"+Cg(e)],{hideLabel:!0,icon:t=>t["shapeIconTextAlign"+Cg(e)]}])),strokeWidthOptions:()=>i$({extraSmall:"0.25%",small:"0.5%",mediumSmall:"1%",medium:"1.75%",mediumLarge:"2.5%",large:"3.5%",extraLarge:"5%"}),brushSizeOptions:()=>i$(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:()=>t$({extraSmall:"2%",small:"4%",mediumSmall:"8%",medium:"10%",mediumLarge:"15%",large:"20%",extraLarge:"25%"}),lineHeightOptions:()=>o$({extraSmall:"40%",small:"60%",mediumSmall:"100%",medium:"120%",mediumLarge:"140%",large:"180%",extraLarge:"220%"})},P$=new Intl.NumberFormat("default",{minimumFractionDigits:1,maximumFractionDigits:1}),E$=(e,t)=>R(t)?e+"%":e,I$=(e,t,o,i)=>R(i)?Math.round(e/o*100)+"%":""+P$.format(e),A$={getValue:e=>parseFloat(e),setValue:E$,label:I$,step:.05,labelClass:"PinturaPercentageLabel"},L$={factory:S$,options:{title:"Text shadow",controls:[["ToggleSlider","x",{...A$,min:-100,max:100,labelPrefix:"X"}],["ToggleSlider","y",{...A$,min:-100,max:100,labelPrefix:"Y"}],["ToggleSlider","blur",{...A$,min:0,max:25,labelPrefix:e=>e.shapeTitleTextShadowBlur}],["ColorPicker","color",{enablePresets:!1}]]}},z$={defaultColor:{factory:p$,items:"colorOptions"},defaultNumber:{factory:c$},defaultPercentage:{factory:c$,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:m$},strokeColor:{items:"colorOptions",factory:g$},strokeWidth:{items:"strokeWidthOptions",factory:$$},brushSize:{items:"brushSizeOptions",factory:Bg},drawMode:{factory:Og},lineStart:{items:"lineEndStyleOptions",factory:b$},lineEnd:{items:"lineEndStyleOptions",factory:x$},color:{items:"colorOptions",factory:v$},fontFamily:{items:"fontFamilyOptions",factory:u$},fontStyle_fontWeight:{items:"fontStyleOptions",factory:w$},fontSize:{items:"fontSizeOptions",factory:C$},lineHeight:{items:"lineHeightOptions",factory:T$},textAlign:{items:"textAlignOptions",factory:M$},textShadowX_textShadowY_textShadowBlur_textShadowColor:L$,textOutlineWidth_textOutlineColor:{factory:S$,options:{title:"Text outline",controls:[["ToggleSlider","width",{getValue:e=>parseFloat(e),setValue:E$,label:I$,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}}},F$=(e={})=>{const t={...z$,...e},o={};return Object.entries(t).forEach((([e,i])=>{if(!/Options$/.test(e))if(z$[e]&&C(i)&&!Fo(i)){const{component:i,factory:r,items:n,options:a={}}=t[e];if(R(r))o[e]=[r,a];else{const s=z$[e].items;let l=R(s)?t[s]||R$[s]():void 0;R(n)&&R$[n]?l=t[n]?t[n].every((e=>!Array.isArray(e)))?t[n].map((e=>[e,e])):t[n]:R$[n]():(n||a.items)&&(l=n||a.items);let c=r||z$[e].factory;P(c)?o[e]=l?c(l,a):c(a):i&&(o[e]=[i,{...a,items:n}])}}else o[e]=i})),o};function D$(e){let t,o,i,r,n;const a=e[7].default,s=rn(a,e,e[6],null);return{c(){t=kn("div"),o=kn("div"),s&&s.c(),An(o,"class","PinturaToolbarInner"),An(t,"class","PinturaToolbar"),An(t,"data-layout",e[1]),An(t,"data-overflow",e[0])},m(a,l){wn(a,t,l),bn(t,o),s&&s.m(o,null),i=!0,r||(n=[Pn(o,"measure",e[3]),hn($c.call(null,o)),Pn(t,"measure",e[2]),hn($c.call(null,t))],r=!0)},p(e,[o]){s&&s.p&&(!i||64&o)&&sn(s,a,e,e[6],i?an(a,e[6],o,null):ln(e[6]),null),(!i||2&o)&&An(t,"data-layout",e[1]),(!i||1&o)&&An(t,"data-overflow",e[0])},i(e){i||(xa(s,e),i=!0)},o(e){va(s,e),i=!1},d(e){e&&Sn(t),s&&s.d(e),r=!1,Kr(n)}}}function O$(e,t,o){let i,r,{$$slots:n={},$$scope:a}=t,s=0,l=0,c=0;const d=()=>{o(0,r="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")},[r,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,r||d()},l,c,a,n]}class B$ extends Fa{constructor(e){super(),za(this,e,O$,D$,Qr,{})}}function W$(e){let t,o,i,r;const n=e[5].default,a=rn(n,e,e[4],null);return{c(){t=kn("div"),a&&a.c(),An(t,"class",e[0])},m(n,s){wn(n,t,s),a&&a.m(t,null),o=!0,i||(r=[Pn(t,"measure",(function(){Jr(e[1]&&e[3])&&(e[1]&&e[3]).apply(this,arguments)})),hn(e[2].call(null,t))],i=!0)},p(i,[r]){e=i,a&&a.p&&(!o||16&r)&&sn(a,n,e,e[4],o?an(n,e[4],r,null):ln(e[4]),null),(!o||1&r)&&An(t,"class",e[0])},i(e){o||(xa(a,e),o=!0)},o(e){va(a,e),o=!1},d(e){e&&Sn(t),a&&a.d(e),i=!1,Kr(r)}}}function _$(e,t,o){let{$$slots:i={},$$scope:r}=t;const n=qn();let{class:a=null}=t;const s=Jn("measurable");let l=!1;return Zn((()=>o(1,l=!0))),e.$$set=e=>{"class"in e&&o(0,a=e.class),"$$scope"in e&&o(4,r=e.$$scope)},[a,l,s,({detail:e})=>n("measure",e),r,i]}class V$ extends Fa{constructor(e){super(),za(this,e,_$,W$,Qr,{class:0})}}const N$=e=>({}),H$=e=>({}),j$=e=>({}),U$=e=>({}),G$=e=>({}),Z$=e=>({});function X$(e){let t,o;const i=e[4].header,r=rn(i,e,e[3],Z$);return{c(){t=kn("div"),r&&r.c(),An(t,"class","PinturaUtilHeader")},m(e,i){wn(e,t,i),r&&r.m(t,null),o=!0},p(e,t){r&&r.p&&(!o||8&t)&&sn(r,i,e,e[3],o?an(i,e[3],t,G$):ln(e[3]),Z$)},i(e){o||(xa(r,e),o=!0)},o(e){va(r,e),o=!1},d(e){e&&Sn(t),r&&r.d(e)}}}function Y$(e){let t,o;const i=e[4].footer,r=rn(i,e,e[3],H$);return{c(){t=kn("div"),r&&r.c(),An(t,"class","PinturaUtilFooter")},m(e,i){wn(e,t,i),r&&r.m(t,null),o=!0},p(e,t){r&&r.p&&(!o||8&t)&&sn(r,i,e,e[3],o?an(i,e[3],t,N$):ln(e[3]),H$)},i(e){o||(xa(r,e),o=!0)},o(e){va(r,e),o=!1},d(e){e&&Sn(t),r&&r.d(e)}}}function q$(e){let t,o,i,r,n,a,s=e[1]&&X$(e);const l=e[4].main,c=rn(l,e,e[3],U$),d=c||function(e){let t,o;return t=new V$({props:{class:"PinturaStage"}}),t.$on("measure",e[5]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p:Gr,i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}(e);let u=e[2]&&Y$(e);return{c(){s&&s.c(),t=Mn(),o=kn("div"),d&&d.c(),i=Mn(),u&&u.c(),r=Mn(),n=Rn(),An(o,"class","PinturaUtilMain")},m(l,c){s&&s.m(l,c),wn(l,t,c),wn(l,o,c),d&&d.m(o,null),e[6](o),wn(l,i,c),u&&u.m(l,c),wn(l,r,c),wn(l,n,c),a=!0},p(e,[o]){e[1]?s?(s.p(e,o),2&o&&xa(s,1)):(s=X$(e),s.c(),xa(s,1),s.m(t.parentNode,t)):s&&(ya(),va(s,1,1,(()=>{s=null})),ba()),c&&c.p&&(!a||8&o)&&sn(c,l,e,e[3],a?an(l,e[3],o,j$):ln(e[3]),U$),e[2]?u?(u.p(e,o),4&o&&xa(u,1)):(u=Y$(e),u.c(),xa(u,1),u.m(r.parentNode,r)):u&&(ya(),va(u,1,1,(()=>{u=null})),ba())},i(e){a||(xa(s),xa(d,e),xa(u),xa(false),a=!0)},o(e){va(s),va(d,e),va(u),va(false),a=!1},d(a){s&&s.d(a),a&&Sn(t),a&&Sn(o),d&&d.d(a),e[6](null),a&&Sn(i),u&&u.d(a),a&&Sn(r),a&&Sn(n)}}}function K$(e,t,o){let{$$slots:i={},$$scope:r}=t,{hasHeader:n=!!t.$$slots.header}=t,{hasFooter:a=!!t.$$slots.footer}=t,{root:s}=t;return e.$$set=e=>{o(7,t=Xr(Xr({},t),cn(e))),"hasHeader"in e&&o(1,n=e.hasHeader),"hasFooter"in e&&o(2,a=e.hasFooter),"root"in e&&o(0,s=e.root),"$$scope"in e&&o(3,r=e.$$scope)},t=cn(t),[s,n,a,r,i,function(t){Qn.call(this,e,t)},function(e){ta[e?"unshift":"push"]((()=>{s=e,o(0,s)}))}]}class J$ extends Fa{constructor(e){super(),za(this,e,K$,q$,Qr,{hasHeader:1,hasFooter:2,root:0})}}function Q$(e){let t,o;return{c(){t=kn("div"),An(t,"class","PinturaRangeInputMeter"),An(t,"style",o=`transform: translateX(${e[9].x-e[11].x}px) translateY(${e[9].y-e[11].y}px)`)},m(o,i){wn(o,t,i),t.innerHTML=e[7]},p(e,i){128&i[0]&&(t.innerHTML=e[7]),512&i[0]&&o!==(o=`transform: translateX(${e[9].x-e[11].x}px) translateY(${e[9].y-e[11].y}px)`)&&An(t,"style",o)},d(e){e&&Sn(t)}}}function ef(e){let t,o,i,r,n,a,s,l,c,d,u,h=e[9]&&Q$(e);return{c(){t=kn("div"),o=kn("span"),i=Mn(),r=kn("button"),n=Tn(e[1]),s=Mn(),l=kn("div"),h&&h.c(),An(o,"class","PinturaRangeInputValue"),An(r,"class","PinturaRangeInputReset"),An(r,"type","button"),r.disabled=a=e[0]===e[2],An(l,"class","PinturaRangeInputInner"),An(l,"style",e[8]),An(l,"data-value-limited",e[5]),An(t,"class","PinturaRangeInput"),An(t,"tabindex","0")},m(a,p){wn(a,t,p),bn(t,o),o.innerHTML=e[3],bn(t,i),bn(t,r),bn(r,n),bn(t,s),bn(t,l),h&&h.m(l,null),d||(u=[Pn(r,"click",e[16]),Pn(l,"interactionstart",e[12]),Pn(l,"interactionupdate",e[14]),Pn(l,"interactionend",e[15]),Pn(l,"interactionrelease",e[13]),hn(c=hd.call(null,l,{inertia:e[6]})),Pn(l,"measure",e[36]),hn($c.call(null,l)),Pn(t,"wheel",e[18],{passive:!1}),Pn(t,"nudge",e[19]),hn(pd.call(null,t,{direction:"horizontal",preventDefault:!0}))],d=!0)},p(e,t){8&t[0]&&(o.innerHTML=e[3]),2&t[0]&&Fn(n,e[1]),5&t[0]&&a!==(a=e[0]===e[2])&&(r.disabled=a),e[9]?h?h.p(e,t):(h=Q$(e),h.c(),h.m(l,null)):h&&(h.d(1),h=null),256&t[0]&&An(l,"style",e[8]),32&t[0]&&An(l,"data-value-limited",e[5]),c&&Jr(c.update)&&64&t[0]&&c.update.call(null,{inertia:e[6]})},i:Gr,o:Gr,d(e){e&&Sn(t),h&&h.d(),d=!1,Kr(u)}}}function tf(e,t,o){let i,r,n,s,l,c,d,u,h,{labelReset:p="Reset"}=t,{direction:m="x"}=t,{min:g=0}=t,{max:$=1}=t,{base:f=g}=t,{value:y=0}=t,{valueLabel:b=0}=t,{valueMin:x}=t,{valueMax:v}=t,{oninputstart:w=a}=t,{oninputmove:S=a}=t,{oninputend:k=a}=t,{elasticity:C=0}=t,{nudgeMultiplier:T}=t,{step:M=8}=t;const R=Jn("isAnimated");on(e,R,(e=>o(6,u=e)));const P=(e,t,o)=>Math.ceil((e-o)/t)*t+o;let E,I,A;const L={x:2,y:0},z=(e,t,o)=>`M ${e-o} ${t} a ${o} ${o} 0 1 0 0 -1`;let F,D=void 0,O=!1,B={snap:!1,elastic:!1};const W=(e,t,o)=>{const i=e[m]+t[m],r=ns(i,F[1][m],F[0][m]),n=C?r+md(i-r,C):r,a=o.elastic?n:r,s=ue(0,0);return s[m]=a,_.set(s,{hard:o.snap}),ns(N(s,m),g,$)},_=ec();on(e,_,(e=>o(9,h=e)));const V=(e,t)=>{const o=.5*(E[t]-s[t])-(ph(e,g,$)*s[t]-.5*s[t]);return{x:"x"===t?o:0,y:"y"===t?o:0}},N=(e,t)=>{const o=-(e[t]-.5*E[t])/s[t];return g+o*i},H=_.subscribe((e=>{e&&D&&S(ns(N(e,m),g,$))})),j=e=>{const t=[V(null!=x?x:g,m),V(null!=v?v:$,m)],o={x:"x"===m?h.x+e:0,y:"y"===m?h.y+e:0},i=ns(o[m],t[1][m],t[0][m]),r={...h,[m]:i};un(_,h=r,h);const n=ns(N(r,m),g,$);w(),S(n),k(n)};Yn((()=>{H()}));return e.$$set=e=>{"labelReset"in e&&o(1,p=e.labelReset),"direction"in e&&o(20,m=e.direction),"min"in e&&o(21,g=e.min),"max"in e&&o(22,$=e.max),"base"in e&&o(2,f=e.base),"value"in e&&o(0,y=e.value),"valueLabel"in e&&o(3,b=e.valueLabel),"valueMin"in e&&o(23,x=e.valueMin),"valueMax"in e&&o(24,v=e.valueMax),"oninputstart"in e&&o(25,w=e.oninputstart),"oninputmove"in e&&o(26,S=e.oninputmove),"oninputend"in e&&o(27,k=e.oninputend),"elasticity"in e&&o(28,C=e.elasticity),"nudgeMultiplier"in e&&o(29,T=e.nudgeMultiplier),"step"in e&&o(30,M=e.step)},e.$$.update=()=>{if(6291456&e.$$.dirty[0]&&o(32,i=$-g),10485760&e.$$.dirty[0]&&o(34,r=null!=x?Math.max(x,g):g),20971520&e.$$.dirty[0]&&o(33,n=null!=v?Math.min(v,$):$),6291460&e.$$.dirty[0]&&o(35,l=ph(f,g,$)),16&e.$$.dirty[0]|16&e.$$.dirty[1]&&E){const e=.5*E.y;let t,i=40*l,r="",n=E.y,a="";for(let o=0;o<=40;o++){const n=L.x+10*o,s=e;r+=z(n,s,o%5==0?2:.75)+" ",t=n+L.x,o===i&&(a=`<path d="M${n} ${s-4} l2 3 l-2 -1 l-2 1 z"/>`)}o(7,I=`<svg width="${t}" height="${n}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${t} ${n}" aria-hidden="true" focusable="false">\n        ${a}\n        <rect rx="4" ry="4" y="${e-4}"" height="8"/>\n        <path fill-rule="evenodd" d="${r.trim()}"/></svg>`),o(31,A={x:t-2*L.x,y:n})}16&e.$$.dirty[0]|1&e.$$.dirty[1]&&(s=E&&A),6291456&e.$$.dirty[0]|12&e.$$.dirty[1]&&o(5,c=r!==g||n!==$),32&e.$$.dirty[0]|12&e.$$.dirty[1]&&o(8,d=c?function(e,t){const o=1/40,i=ph(e,g,$),r=ph(t,g,$);return`--range-mask-from:${100*se(P(i,o,0)-.0125)}%;--range-mask-to:${100*se(P(r,o,0)-.0125)}%`}(r,n):""),1048657&e.$$.dirty[0]|2&e.$$.dirty[1]&&i&&E&&E.x&&E.y&&_.set(V(y,m),{hard:!1===u})},[y,p,f,b,E,c,u,I,d,h,R,L,()=>{O=!1,D=tn(_),F=[V(null!=x?x:g,m),V(null!=v?v:$,m)],w()},()=>{O=!0},({detail:e})=>{B.snap=!O,B.elastic=!O,W(D,e.translation,B)},({detail:e})=>{B.snap=!1,B.elastic=!1;const t=W(D,e.translation,B);if(D=void 0,F=void 0,Math.abs(t-f)<.01)return k(f);k(t)},()=>{o(0,y=ns(f,r,n)),w(),k(y)},_,e=>{e.preventDefault(),e.stopPropagation();const t=yd(e)*M;j(t)},({detail:e})=>{j(e[m]*Math.abs(T||8))},m,g,$,x,v,w,S,k,C,T,M,A,i,n,r,l,e=>o(4,E=(e=>ue(e.width,e.height))(e.detail))]}class of extends Fa{constructor(e){super(),za(this,e,tf,ef,Qr,{labelReset:1,direction:20,min:21,max:22,base:2,value:0,valueLabel:3,valueMin:23,valueMax:24,oninputstart:25,oninputmove:26,oninputend:27,elasticity:28,nudgeMultiplier:29,step:30},null,[-1,-1])}}var rf={[J]:e=>({x:e.x,y:e.y}),[ie]:e=>({x:e.x+e.width,y:e.y}),[Q]:e=>({x:e.x+e.width,y:e.y}),[re]:e=>({x:e.x+e.width,y:e.y+e.height}),[ee]:e=>({x:e.x,y:e.y+e.height}),[ne]:e=>({x:e.x,y:e.y+e.height}),[te]:e=>({x:e.x,y:e.y}),[oe]:e=>({x:e.x,y:e.y})};function nf(e,t,o){const i=e.slice();return i[14]=t[o].key,i[15]=t[o].translate,i[16]=t[o].scale,i[17]=t[o].type,i[18]=t[o].opacity,i}function af(e,t){let o,i,r,n,a,s,l,c;return{key:e,first:null,c(){o=kn("div"),An(o,"role","button"),An(o,"aria-label",i=`Drag ${t[17]} ${t[14]}`),An(o,"tabindex",r="edge"===t[17]?-1:0),An(o,"class","PinturaRectManipulator"),An(o,"data-direction",n=t[14]),An(o,"data-shape",a=""+("edge"===t[17]?"edge":""+t[0])),An(o,"style",s=`--tx:${t[15].x};--ty:${t[15].y};--sx:${t[16].x};--sy:${t[16].y};opacity:${t[18]}`),this.first=o},m(e,i){wn(e,o,i),l||(c=[Pn(o,"nudge",(function(){Jr(t[6](t[14]))&&t[6](t[14]).apply(this,arguments)})),hn(pd.call(null,o,{preventDefault:!0})),Pn(o,"interactionstart",(function(){Jr(t[5]("resizestart",t[14]))&&t[5]("resizestart",t[14]).apply(this,arguments)})),Pn(o,"interactionupdate",(function(){Jr(t[5]("resizemove",t[14]))&&t[5]("resizemove",t[14]).apply(this,arguments)})),Pn(o,"interactionend",(function(){Jr(t[5]("resizeend",t[14]))&&t[5]("resizeend",t[14]).apply(this,arguments)})),hn(hd.call(null,o))],l=!0)},p(e,l){t=e,2&l&&i!==(i=`Drag ${t[17]} ${t[14]}`)&&An(o,"aria-label",i),2&l&&r!==(r="edge"===t[17]?-1:0)&&An(o,"tabindex",r),2&l&&n!==(n=t[14])&&An(o,"data-direction",n),3&l&&a!==(a=""+("edge"===t[17]?"edge":""+t[0]))&&An(o,"data-shape",a),2&l&&s!==(s=`--tx:${t[15].x};--ty:${t[15].y};--sx:${t[16].x};--sy:${t[16].y};opacity:${t[18]}`)&&An(o,"style",s)},d(e){e&&Sn(o),l=!1,Kr(c)}}}function sf(e){let t,o=[],i=new Map,r=e[1];const n=e=>e[14];for(let t=0;t<r.length;t+=1){let a=nf(e,r,t),s=n(a);i.set(s,o[t]=af(s,a))}return{c(){for(let e=0;e<o.length;e+=1)o[e].c();t=Rn()},m(e,i){for(let t=0;t<o.length;t+=1)o[t].m(e,i);wn(e,t,i)},p(e,[a]){99&a&&(r=e[1],o=Ma(o,a,n,1,e,r,i,t.parentNode,Ca,af,t,nf))},i:Gr,o:Gr,d(e){for(let t=0;t<o.length;t+=1)o[t].d(e);e&&Sn(t)}}}function lf(e,t,o){let i,r,n,a,{rect:s=null}=t,{visible:l=!1}=t,{style:c}=t;const d=Jn("isAnimated");on(e,d,(e=>o(11,a=e)));const u=ec(void 0,{precision:1e-4,stiffness:.2,damping:.4});on(e,u,(e=>o(10,n=e)));const h=ec(0,{precision:.001});let p;on(e,h,(e=>o(9,r=e)));const m=qn();return e.$$set=e=>{"rect"in e&&o(7,s=e.rect),"visible"in e&&o(8,l=e.visible),"style"in e&&o(0,c=e.style)},e.$$.update=()=>{2304&e.$$.dirty&&u.set(l?1:.5,{hard:!1===a}),2304&e.$$.dirty&&h.set(l?1:0,{hard:!1===a}),1664&e.$$.dirty&&o(1,i=Object.keys(K).map(((e,t)=>{const o=K[e],i=rf[o](s),a=1===o.length?"edge":"corner",l="corner"===a;return{key:o,type:a,scale:{x:/^(t|b)$/.test(o)?s.width:l?ns(n,.5,1.25):1,y:/^(r|l)$/.test(o)?s.height:l?ns(n,.5,1.25):1},translate:{x:i.x,y:i.y},opacity:r}})))},[c,i,d,u,h,(e,t)=>({detail:o})=>{p&&t!==p||"resizestart"!==e&&void 0===p||("resizestart"===e&&(p=t),"resizeend"===e&&(p=void 0),m(e,{direction:t,translation:o&&o.translation}))},e=>({detail:t})=>{m("resizestart",{direction:e,translation:{x:0,y:0}}),m("resizemove",{direction:e,translation:t}),m("resizeend",{direction:e,translation:{x:0,y:0}})},s,l,r,n,a]}class cf extends Fa{constructor(e){super(),za(this,e,lf,sf,Qr,{rect:7,visible:8,style:0})}}var df=e=>{function t(t,o){e.dispatchEvent(new CustomEvent(t,{detail:o}))}const o=o=>{o.preventDefault(),e.addEventListener("gesturechange",i),e.addEventListener("gestureend",r),t("gesturedown")},i=e=>{e.preventDefault(),t("gestureupdate",e.scale)},r=e=>{t("gestureup",e.scale),e.preventDefault(),n()},n=()=>{e.removeEventListener("gesturechange",i),e.removeEventListener("gestureend",r)};return e.addEventListener("gesturestart",o),{destroy:()=>{n(),e.removeEventListener("gesturestart",o)}}},uf={[J]:ee,[Q]:te,[ee]:J,[te]:Q,[oe]:re,[ie]:ne,[re]:oe,[ne]:ie},hf=e=>{const t=e===te||e===Q,o=e===J||e===ee;return[e===Q||e===ie||e===re,e===te||e===ne||e===oe,e===J||e===ie||e===oe,e===ee||e===re||e===ne,t,o,t||o]},pf=(e,t,o,i={})=>{const{target:r,translate:n}=t,{aspectRatio:a,minSize:s,maxSize:l}=i,c=ae[uf[r]],d=ve(ue(e.x,e.y),ue(c[0]*e.width,c[1]*e.height)),u=ae[r],h=ve(Ke(e),ue(u[0]*e.width,u[1]*e.height)),[p,m,g,$,f,y,b]=hf(r);let x=n.x,v=n.y;f?v=0:y&&(x=0);const{inner:w,outer:S}=mf(d,r,o,{aspectRatio:a,minSize:s,maxSize:l});let[k,C,T,M]=vt(e);if(p?M=d.x:m&&(C=d.x),$?k=d.y:g&&(T=d.y),p){const e=w.x+w.width,t=S.x+S.width;C=ns(h.x+x,e,t)}else if(m){const e=S.x,t=w.x;M=ns(h.x+x,e,t)}if($){const e=w.y+w.height,t=S.y+S.height;T=ns(h.y+v,e,t)}else if(g){const e=S.y,t=w.y;k=ns(h.y+v,e,t)}if(M>w.x&&(M=w.x),C<w.x+w.width&&(C=w.x+w.width),k>w.y&&(k=w.y),T<w.y+w.height&&(T=w.y+w.height),M<S.x){const e=S.x-M;M=S.x,C+=e}if(C>S.x+S.width){const e=C-(S.x+S.width);C=S.x+S.width,M-=e}if(k<S.y){const e=S.y-k;k=S.y,T+=e}if(T>S.y+S.height){const e=T-(S.y+S.height);T=S.y+S.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=ue(h.x+x-d.x,h.y+v-d.y);r===ie?(e.x=Math.max(0,e.x),e.y=Math.min(0,e.y)):r===re?(e.x=Math.max(0,e.x),e.y=Math.max(0,e.y)):r===ne?(e.x=Math.min(0,e.x),e.y=Math.max(0,e.y)):r===oe&&(e.x=Math.min(0,e.x),e.y=Math.min(0,e.y));const t=$e(e),o=$e(ue(w.width,w.height)),i=$e(ue(S.width,S.height)),n=ns(t,o,i),s=ue(a,1),l=ke(fe(s),n);r===ie?(C=d.x+l.x,k=d.y-l.y):r===re?(C=d.x+l.x,T=d.y+l.y):r===ne?(M=d.x-l.x,T=d.y+l.y):r===oe&&(M=d.x-l.x,k=d.y-l.y)}return nt(M,k,C-M,T-k)};const mf=(e,t,o,i)=>{const{aspectRatio:r,minSize:n,maxSize:a}=i,s=t===Q||t===ie||t===re,l=t===te||t===ne||t===oe,c=t===J||t===ie||t===oe,d=t===ee||t===re||t===ne,u=t===te||t===Q,h=t===J||t===ee,p=Ke(o);s?(p.x=e.x,p.width-=e.x):l&&(p.width=e.x),d?(p.y=e.y,p.height-=e.y):c&&(p.height=e.y);const m=((e,t)=>qe(0,0,e,t))(Math.min(p.width,a.width),Math.min(p.height,a.height));if(r)if(u){const t=Math.min(e.y,o.height-e.y);m.height=Math.min(2*t,m.height)}else if(h){const t=Math.min(e.x,o.width-e.x);m.width=Math.min(2*t,m.width)}const g=r?De(bt(Qe(n),r)):n,$=r?De(xt(m,r)):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):h&&(f=e.x-.5*g.width,y=e.x+.5*g.width);const v=ot([ue(f,b),ue(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):h&&(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:ot([ue(f,b),ue(y,x)])}};var gf=e=>180*e/Math.PI;function $f(e){let t,o,i;return o=new of({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(gf(e[11]))+"&deg;",oninputstart:e[2],oninputmove:e[17],oninputend:e[18]}}),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"class","PinturaImageRotator")},m(e,r){wn(e,t,r),Aa(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(gf(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||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o)}}}function ff(e,t,o){let i,r,n,s,l,c,d,{rotation:u}=t,{valueMin:h}=t,{valueMax:p}=t,{oninputstart:m=a}=t,{oninputmove:g=a}=t,{oninputend:$=a}=t,{elasticity:f=0}=t,{labelReset:y}=t,{rotationMin:b}=t,{rotationMax:x}=t;return e.$$set=e=>{"rotation"in e&&o(13,u=e.rotation),"valueMin"in e&&o(0,h=e.valueMin),"valueMax"in e&&o(1,p=e.valueMax),"oninputstart"in e&&o(2,m=e.oninputstart),"oninputmove"in e&&o(3,g=e.oninputmove),"oninputend"in e&&o(4,$=e.oninputend),"elasticity"in e&&o(5,f=e.elasticity),"labelReset"in e&&o(6,y=e.labelReset),"rotationMin"in e&&o(14,b=e.rotationMin),"rotationMax"in e&&o(15,x=e.rotationMax)},e.$$.update=()=>{16384&e.$$.dirty&&o(9,i=b+1e-9),32768&e.$$.dirty&&o(10,r=x-1e-9),1536&e.$$.dirty&&o(12,n=i+.5*(r-i)),32768&e.$$.dirty&&o(16,s=2*x),8192&e.$$.dirty&&o(8,l=Math.sign(u)),73728&e.$$.dirty&&o(7,c=Math.round(Math.abs(u)/s)*s),8576&e.$$.dirty&&o(11,d=u-l*c)},[h,p,m,g,$,f,y,c,l,i,r,d,n,u,b,x,s,e=>g(l*c+e),e=>$(l*c+e)]}class yf extends Fa{constructor(e){super(),za(this,e,ff,$f,Qr,{rotation:13,valueMin:0,valueMax:1,oninputstart:2,oninputmove:3,oninputend:4,elasticity:5,labelReset:6,rotationMin:14,rotationMax:15})}}function bf(e){let t,o,i,r,n;return{c(){t=kn("div"),o=kn("p"),i=Tn(e[0]),r=Tn(" × "),n=Tn(e[1]),An(t,"class","PinturaImageInfo")},m(e,a){wn(e,t,a),bn(t,o),bn(o,i),bn(o,r),bn(o,n)},p(e,[t]){1&t&&Fn(i,e[0]),2&t&&Fn(n,e[1])},i:Gr,o:Gr,d(e){e&&Sn(t)}}}function xf(e,t,o){let{width:i}=t,{height:r}=t;return e.$$set=e=>{"width"in e&&o(0,i=e.width),"height"in e&&o(1,r=e.height)},[i,r]}class vf extends Fa{constructor(e){super(),za(this,e,xf,bf,Qr,{width:0,height:1})}}function wf(e){let t,o;return t=new Wu({props:{class:"PinturaPresetListFilter",layout:"row",options:e[8],selectedIndex:e[7],onchange:e[10]}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Sf(e){let t,o;return t=new lh({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:[wf]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}const kf='fill="none" stroke="currentColor"';function Cf(e,t,o){let i,r,n,{icon:s}=t,{label:l}=t,{labelClass:c}=t,{hideLabel:d}=t,{options:u}=t,{selectedIndex:h}=t,{onchange:p}=t,{optionMapper:m}=t,{filter:g="landscape"}=t,{onfilterchange:$=a}=t;const f=(e,t,o,i,r)=>`\n    <rect ${kf} x="${e}" y="${t}" width="${o}" height="${i}" rx="${r}"/>`,y=(e,t)=>`<path ${kf} d="M${e} ${t} l2 2 l3 -4"/>`;return e.$$set=e=>{"icon"in e&&o(0,s=e.icon),"label"in e&&o(1,l=e.label),"labelClass"in e&&o(2,c=e.labelClass),"hideLabel"in e&&o(3,d=e.hideLabel),"options"in e&&o(12,u=e.options),"selectedIndex"in e&&o(4,h=e.selectedIndex),"onchange"in e&&o(5,p=e.onchange),"optionMapper"in e&&o(6,m=e.optionMapper),"filter"in e&&o(11,g=e.filter),"onfilterchange"in e&&o(13,$=e.onfilterchange)},e.$$.update=()=>{6144&e.$$.dirty&&o(9,i=((e,t)=>(e||[]).map((e=>R(e[0])?(e[1]=e[1].map(t),e):t(e))))(u,(e=>t=>{const[o,i,r={}]=t;return Ao(o)&&(r.hidden="landscape"===e?o<1:o>1),[o,i,r]})(g))),2048&e.$$.dirty&&o(7,r="landscape"===g?0:1),128&e.$$.dirty&&o(8,n=[["landscape","Landscape",{hideLabel:!0,icon:f(2,6,19,12,2)+(0===r?y(9,12):"")}],["portrait","Portrait",{hideLabel:!0,icon:f(5,3,13,18,2)+(1===r?y(9,12):"")}]])},[s,l,c,d,h,p,m,r,n,i,e=>{o(11,g=e.value),$(e.value)},g,u,$]}class Tf extends Fa{constructor(e){super(),za(this,e,Cf,Sf,Qr,{icon:0,label:1,labelClass:2,hideLabel:3,options:12,selectedIndex:4,onchange:5,optionMapper:6,filter:11,onfilterchange:13})}}const Mf=e=>xe(e,(e=>se(e,6))),Rf=e=>St(e,(e=>se(e,6))),Pf=(e,t,o=1e-4)=>Math.abs(e-t)<o;var Ef=(e,t,o,i,r={})=>{const{aspectRatio:n}=r;e=Rf(e),i=i.map(Mf);const a=dt(e,uf[o.target]),s=xe(a,(e=>se(e,6))),l=n?bt(r.minSize,n):r.minSize,c=n?xt(r.maxSize,n):r.maxSize,d=dt(t,o.target);if(Re(d,a)<1){t=Ke(e);const o=Math.min(l.width/e.width,l.height/e.height);lt(t,o,a)}t=ct(Ke(t),l,c,a);let u=Ke(t);t=Rf(t);const h=At(i,1),p=wt(e),m=wt(t),g=p.findIndex((e=>be(xe(e,(e=>se(e,6))),s))),$=e=>h.map((t=>Mt(t,e))).filter(Boolean).pop();if(n){const t=m.map(((e,t)=>{if(t===g)return;const o=ue(a.x-e.x,a.y-e.y);fe(o),ke(o,.5);const i=ue(a.x-o.x,a.y-o.y),r=Ge(i,Mf(e)),n=$(r);if(!n)return;const s=p[t];return{intersection:n,cornerDist:Re(a,s),intersectionDist:Re(a,n)}})).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=Ke(e),lt(u,o,a)}}else{const e=1===o.target.length,r=!(i[0].y===i[1].y||i[0].x===i[1].x),n=p.map(((t,o)=>{if(o===g)return;const i=m[o],n=!Pf(i.x,s.x)&&!Pf(i.y,s.y);if(!e&&!r&&n)return;if(e&&(Pf(i.x,s.x)||Pf(i.y,s.y)))return;const l=pe(e?t:a),c=we(pe(l),i);fe(c),ke(c,.5),e?ve(l,c):we(l,c);const d=Ge(l,i),u=$(d);return u||void 0})).filter(Boolean);if(n.length){const[e,i,r,l]=hf(o.target);let[c,d,h,p]=vt(t);n.forEach((({x:t,y:o})=>{const n=se(t,6),a=se(o,6);r&&!Pf(a,s.y)&&(c=Math.max(c,o)),e&&!Pf(n,s.x)&&(d=Math.min(d,t)),l&&!Pf(a,s.y)&&(h=Math.min(h,o)),i&&!Pf(n,s.x)&&(p=Math.max(p,t))})),u=et([c,d,h,p]),lt(u,.9999,a)}}return ct(u,l,c,a),u};function If(e){let t,o;return t=new up({props:{items:e[11]}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};2048&o[0]&&(i.items=e[11]),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Af(e){let t,o,i;return o=new B$({props:{$$slots:{default:[If]},$$scope:{ctx:e}}}),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"slot","header")},m(e,r){wn(e,t,r),Aa(o,t,null),i=!0},p(e,t){const i={};2048&t[0]|1&t[7]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o)}}}function Lf(e){let t,o;return t=new cd({props:{onclick:e[87],label:e[4].cropLabelButtonRecenter,icon:e[4].cropIconButtonRecenter,class:"PinturaButtonCenter",disabled:!e[9],hideLabel:!0,style:`opacity: ${e[29]}; transform: translate3d(${e[30].x}px, ${e[30].y}px, 0)`}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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]),1610612736&o[0]&&(i.style=`opacity: ${e[29]}; transform: translate3d(${e[30].x}px, ${e[30].y}px, 0)`),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function zf(e){let t,o;return t=new cf({props:{rect:e[8],visible:e[12],style:e[1]}}),t.$on("resizestart",e[67]),t.$on("resizemove",e[68]),t.$on("resizeend",e[69]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};256&o[0]&&(i.rect=e[8]),4096&o[0]&&(i.visible=e[12]),2&o[0]&&(i.style=e[1]),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Ff(e){let t,o;return t=new vf({props:{width:Math.round(e[13].width),height:Math.round(e[13].height)}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};8192&o[0]&&(i.width=Math.round(e[13].width)),8192&o[0]&&(i.height=Math.round(e[13].height)),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Df(e){let t,o,i,r,n,a,s,l,c=e[21]&&e[10]&&Lf(e),d=e[21]&&zf(e),u=e[22]&&Ff(e);return{c(){t=kn("div"),o=kn("div"),c&&c.c(),i=Mn(),d&&d.c(),n=Mn(),u&&u.c(),An(o,"class","PinturaStage"),An(t,"slot","main")},m(h,p){wn(h,t,p),bn(t,o),c&&c.m(o,null),bn(o,i),d&&d.m(o,null),e[161](o),bn(t,n),u&&u.m(t,null),a=!0,s||(l=[hn($c.call(null,o)),Pn(o,"measure",e[159]),Pn(o,"wheel",(function(){Jr(e[2]&&e[86])&&(e[2]&&e[86]).apply(this,arguments)}),{passive:!1}),Pn(o,"interactionstart",e[73]),Pn(o,"interactionupdate",e[74]),Pn(o,"interactionrelease",e[76]),Pn(o,"interactionend",e[75]),hn(r=hd.call(null,o,{drag:!0,inertia:!0,pinch:e[2],shouldStartInteraction:Gf,getEventPosition:e[162]})),Pn(o,"gesturedown",e[83]),Pn(o,"gestureupdate",e[84]),Pn(o,"gestureup",e[85]),hn(df.call(null,o))],s=!0)},p(n,a){(e=n)[21]&&e[10]?c?(c.p(e,a),2098176&a[0]&&xa(c,1)):(c=Lf(e),c.c(),xa(c,1),c.m(o,i)):c&&(ya(),va(c,1,1,(()=>{c=null})),ba()),e[21]?d?(d.p(e,a),2097152&a[0]&&xa(d,1)):(d=zf(e),d.c(),xa(d,1),d.m(o,null)):d&&(ya(),va(d,1,1,(()=>{d=null})),ba()),r&&Jr(r.update)&&16777220&a[0]&&r.update.call(null,{drag:!0,inertia:!0,pinch:e[2],shouldStartInteraction:Gf,getEventPosition:e[162]}),e[22]?u?(u.p(e,a),4194304&a[0]&&xa(u,1)):(u=Ff(e),u.c(),xa(u,1),u.m(t,null)):u&&(ya(),va(u,1,1,(()=>{u=null})),ba())},i(e){a||(xa(c),xa(d),xa(u),a=!0)},o(e){va(c),va(d),va(u),a=!1},d(o){o&&Sn(t),c&&c.d(),d&&d.d(),e[161](null),u&&u.d(),s=!1,Kr(l)}}}function Of(e){let t,o,i,r;const n=[{class:"PinturaControlList"},{tabs:e[7]},e[18]];let a={$$slots:{default:[Bf,({tab:e})=>({216:e}),({tab:e})=>[0,0,0,0,0,0,e?1073741824:0]]},$$scope:{ctx:e}};for(let e=0;e<n.length;e+=1)a=Xr(a,n[e]);t=new Fc({props:a}),t.$on("select",e[160]);const s=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[17]},e[18]];let l={$$slots:{default:[Vf,({panel:e})=>({215:e}),({panel:e})=>[0,0,0,0,0,0,e?536870912:0]]},$$scope:{ctx:e}};for(let e=0;e<s.length;e+=1)l=Xr(l,s[e]);return i=new Zc({props:l}),{c(){Ia(t.$$.fragment),o=Mn(),Ia(i.$$.fragment)},m(e,n){Aa(t,e,n),wn(e,o,n),Aa(i,e,n),r=!0},p(e,o){const r=262272&o[0]?Ra(n,[n[0],128&o[0]&&{tabs:e[7]},262144&o[0]&&Pa(e[18])]):{};1073741824&o[6]|1&o[7]&&(r.$$scope={dirty:o,ctx:e}),t.$set(r);const a=393216&o[0]?Ra(s,[s[0],s[1],131072&o[0]&&{panels:e[17]},262144&o[0]&&Pa(e[18])]):{};511721496&o[0]|536870912&o[6]|1&o[7]&&(a.$$scope={dirty:o,ctx:e}),i.$set(a)},i(e){r||(xa(t.$$.fragment,e),xa(i.$$.fragment,e),r=!0)},o(e){va(t.$$.fragment,e),va(i.$$.fragment,e),r=!1},d(e){La(t,e),e&&Sn(o),La(i,e)}}}function Bf(e){let t,o,i=e[216].label+"";return{c(){t=kn("span"),o=Tn(i)},m(e,i){wn(e,t,i),bn(t,o)},p(e,t){1073741824&t[6]&&i!==(i=e[216].label+"")&&Fn(o,i)},d(e){e&&Sn(t)}}}function Wf(e){let t,o;return t=new of({props:{elasticity:e[25]*e[43],base:Uf,min:e[23],max:jf,valueMin:e[27][0],valueMax:e[27][1],value:e[28],labelReset:e[4].labelReset,valueLabel:Math.round(100*e[28])+"%",oninputstart:e[80],oninputmove:e[81],oninputend:e[82]}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};33554432&o[0]&&(i.elasticity=e[25]*e[43]),8388608&o[0]&&(i.min=e[23]),134217728&o[0]&&(i.valueMin=e[27][0]),134217728&o[0]&&(i.valueMax=e[27][1]),268435456&o[0]&&(i.value=e[28]),16&o[0]&&(i.labelReset=e[4].labelReset),268435456&o[0]&&(i.valueLabel=Math.round(100*e[28])+"%"),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function _f(e){let t,o;return t=new yf({props:{elasticity:e[25]*e[43],rotation:e[14],labelReset:e[4].labelReset,valueMin:e[26][0],valueMax:e[26][1],rotationMin:-e[3],rotationMax:e[3],oninputstart:e[70],oninputmove:e[71],oninputend:e[72]}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};33554432&o[0]&&(i.elasticity=e[25]*e[43]),16384&o[0]&&(i.rotation=e[14]),16&o[0]&&(i.labelReset=e[4].labelReset),67108864&o[0]&&(i.valueMin=e[26][0]),67108864&o[0]&&(i.valueMax=e[26][1]),8&o[0]&&(i.rotationMin=-e[3]),8&o[0]&&(i.rotationMax=e[3]),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Vf(e){let t,o,i,r;const n=[_f,Wf],a=[];function s(e,t){return e[215]===e[92]+"-rotation"?0:e[215]===e[92]+"-zoom"?1:-1}return~(t=s(e))&&(o=a[t]=n[t](e)),{c(){o&&o.c(),i=Rn()},m(e,o){~t&&a[t].m(e,o),wn(e,i,o),r=!0},p(e,r){let l=t;t=s(e),t===l?~t&&a[t].p(e,r):(o&&(ya(),va(a[l],1,1,(()=>{a[l]=null})),ba()),~t?(o=a[t],o?o.p(e,r):(o=a[t]=n[t](e),o.c()),xa(o,1),o.m(i.parentNode,i)):o=null)},i(e){r||(xa(o),r=!0)},o(e){va(o),r=!1},d(e){~t&&a[t].d(e),e&&Sn(i)}}}function Nf(e){let t,o,i=e[19]&&Of(e);return{c(){t=kn("div"),i&&i.c(),An(t,"slot","footer"),An(t,"style",e[16])},m(e,r){wn(e,t,r),i&&i.m(t,null),o=!0},p(e,r){e[19]?i?(i.p(e,r),524288&r[0]&&xa(i,1)):(i=Of(e),i.c(),xa(i,1),i.m(t,null)):i&&(ya(),va(i,1,1,(()=>{i=null})),ba()),(!o||65536&r[0])&&An(t,"style",e[16])},i(e){o||(xa(i),o=!0)},o(e){va(i),o=!1},d(e){e&&Sn(t),i&&i.d()}}}function Hf(e){let t,o,i;function r(t){e[163](t)}let n={hasHeader:e[20],$$slots:{footer:[Nf],main:[Df],header:[Af]},$$scope:{ctx:e}};return void 0!==e[15]&&(n.root=e[15]),t=new J$({props:n}),ta.push((()=>Ea(t,"root",r))),t.$on("measure",e[164]),{c(){Ia(t.$$.fragment)},m(e,o){Aa(t,e,o),i=!0},p(e,i){const r={};1048576&i[0]&&(r.hasHeader=e[20]),2146402302&i[0]|1&i[7]&&(r.$$scope={dirty:i,ctx:e}),!o&&32768&i[0]&&(o=!0,r.root=e[15],ca((()=>o=!1))),t.$set(r)},i(e){i||(xa(t.$$.fragment,e),i=!0)},o(e){va(t.$$.fragment,e),i=!1},d(e){La(t,e)}}}const jf=1,Uf=0,Gf=(e,t)=>e.target===t;function Zf(e,t,o){let i,r,n,a,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,S,k,C,T,M,R,P,E,I,A,z,F,D,O,B,W,_,V,N,H,j,Z,X,K,J,Q,ee,te,le,ce,de,he,ge,ye,xe,Se,Ce,Te,Me,Re,Pe,Ee,Ie,Ae,Le,Fe,Be,_e,Ge,Ze,Xe,Ye=Gr,qe=()=>(Ye(),Ye=en(Je,(e=>o(12,I=e))),Je);e.$$.on_destroy.push((()=>Ye()));let{isActive:Je}=t;qe();let{stores:et}=t,{cropImageSelectionCornerStyle:tt="circle"}=t,{cropWillRenderImageSelectionGuides:ot=((e,t)=>{const o="rotate"==e;return{rows:o?5:3,cols:o?5:3,opacity:.25*t}})}=t,{cropAutoCenterImageSelectionTimeout:it}=t,{cropEnableZoomMatchImageAspectRatio:ct=!0}=t,{cropEnableRotateMatchImageAspectRatio:dt="never"}=t,{cropEnableRotationInput:mt=!0}=t,{cropEnableZoom:gt=!0}=t,{cropEnableZoomInput:$t=!0}=t,{cropEnableZoomAutoHide:wt=!0}=t,{cropEnableImageSelection:kt=!0}=t,{cropEnableInfoIndicator:Ct=!1}=t,{cropEnableZoomTowardsWheelPosition:Tt=!0}=t,{cropEnableLimitWheelInputToCropSelection:Mt=!0}=t,{cropEnableCenterImageSelection:Rt=!0}=t,{cropEnableButtonRotateLeft:Pt=!0}=t,{cropEnableButtonRotateRight:Et=!1}=t,{cropEnableButtonFlipHorizontal:It=!0}=t,{cropEnableButtonFlipVertical:At=!1}=t,{cropSelectPresetOptions:Lt}=t,{cropEnableSelectPreset:zt=!0}=t,{cropEnableFilterMatchAspectRatio:Ft=!0}=t,{cropSelectPresetFilter:Dt=!1}=t,{cropEnableButtonToggleCropLimit:Ot=!1}=t,{cropWillRenderTools:Bt=G}=t,{cropActiveTransformTool:Wt="rotation"}=t,{cropMinimizeToolbar:_t="auto"}=t,{cropInteractionFocus:Vt="image"}=t,{cropRotationRange:Nt=Y}=t,{cropMaskOpacity:Ht=.85}=t,{locale:jt={}}=t;const Ut=Jn("isAnimated");on(e,Ut,(e=>o(138,A=e)));const Gt=Jn("elasticityMultiplier");on(e,Gt,(e=>o(25,Fe=e)));const Zt=Jn("redrawTrigger");on(e,Zt,(e=>o(158,Le=e)));const Xt=Jn("imageIsStatic");on(e,Xt,(e=>o(144,_=e)));const Yt=Jn("imageStaticVisualCorners");on(e,Yt,(e=>o(179,Ce=e)));let qt="idle";const Kt=Ba();on(e,Kt,(e=>o(155,Ee=e)));const Jt=()=>void 0===xe,Qt=e=>1/e,eo=e=>{Ft&&Dt!==e&&(o(94,Dt=e),xe&&1!==xe&&to()&&un(_o,xe=Qt(xe),xe))},to=()=>{if(1===xe||!i)return!1;const e=Qt(xe);return!!cu(Ee).find((([t])=>t===e))},oo=(e,t,o)=>q(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),io=()=>(Jt()||"always"===dt&&to())&&((e,t,o)=>{const i=Ue(He(ze(t),o),(e=>Math.abs(Math.round(e)))),r=Ne(i),n=at(e);return be(r,n)})(V,ee,te)&&oo(V,ee,te),ro=e=>{if("never"!==dt&&io()){un(To,te+=e,te);const t=q(te),o=t?ee.height:ee.width,i=t?ee.width:ee.height;un(Do,V=nt(0,0,o,i),V),Jt()||un(_o,xe=U(o,i),xe)}else un(To,te+=e,te)},{history:no,env:ao,isInteracting:so,isInteractingFraction:lo,isTransformingImage:co,rootRect:uo,stageRect:ho,utilRect:po,utilRectPadded:mo,rootLineColor:go,allowPan:$o,allowZoom:fo,allowPlayPause:yo,rangeInputElasticity:bo,presentationScalar:xo,utilTools:vo,imagePreviewModifiers:wo,imageOutlineOpacity:So,imageFlipX:ko,imageFlipY:Co,imageRotation:To,imageRotationRange:Mo,imageOutputSize:Ro,imageSelectionRect:Po,imageSelectionRectSnapshot:Eo,imageSelectionRectIntent:Io,imageSelectionRectPresentation:Ao,imageCropRectIntent:Lo,imageCropRectOrigin:zo,imageCropRect:Do,imageCropMinSize:Oo,imageCropMaxSize:Bo,imageCropRange:Wo,imageCropAspectRatio:_o,imageCropLimitToImage:Vo,imageSize:No,imageScalar:Ho,imageOverlayMarkup:jo,stagePadded:Uo,stageRecenter:Go}=et;let Zo;on(e,ao,(e=>o(139,z=e))),on(e,so,(e=>o(143,W=e))),on(e,co,(e=>o(172,J=e))),on(e,uo,(e=>o(24,de=e))),on(e,ho,(e=>o(150,K=e))),on(e,mo,(e=>o(147,j=e))),on(e,xo,(e=>o(146,H=e))),on(e,vo,(e=>o(181,Me=e))),on(e,wo,(e=>o(171,O=e))),on(e,ko,(e=>o(157,Ae=e))),on(e,Co,(e=>o(156,Ie=e))),on(e,To,(e=>o(14,te=e))),on(e,Mo,(e=>o(26,Be=e))),on(e,Ro,(e=>o(182,Re=e))),on(e,Po,(e=>o(149,X=e))),on(e,Eo,(e=>o(148,Z=e))),on(e,Io,(e=>o(180,Te=e))),on(e,Ao,(e=>o(142,B=e))),on(e,Lo,(e=>o(174,he=e))),on(e,zo,(e=>o(176,ye=e))),on(e,Do,(e=>o(13,V=e))),on(e,Oo,(e=>o(153,ce=e))),on(e,Bo,(e=>o(178,Se=e))),on(e,Wo,(e=>o(175,ge=e))),on(e,_o,(e=>o(177,xe=e))),on(e,Vo,(e=>o(152,le=e))),on(e,No,(e=>o(151,ee=e))),on(e,Ho,(e=>o(145,N=e))),on(e,Uo,(e=>o(141,D=e)));const Xo=(e,t)=>{const o={target:e,translate:t},i=Ve(ze(ce),H),r=Ve(ze(Se),H);let n=pf(Z,o,{...j,x:0,y:0},{aspectRatio:xe,minSize:i,maxSize:r});if(n=((e,t,o)=>{const[i,r,n,a]=vt(e),s={...e};if(i<t.y&&(e.height=e.height-(t.y-i),e.y=t.y),r>t.x+t.width&&(e.width=t.x+t.width-e.x),n>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 ut(s,t)}return e})(n,{...j,x:0,y:0},xe),!le)return{boundsLimited:n,boundsIntent:n};let a=Ef(Z,n,o,Ce,{aspectRatio:xe,minSize:i,maxSize:r});return{boundsLimited:a,boundsIntent:a}},Yo=(e,t)=>{const o={target:e,translate:t},i=Ve(ze(ce),H),r=Ve(ze(Se),H),n=((e,t,o={})=>{const{target:i,translate:r}=t,{aspectRatio:n,minSize:a}=o,s=ae[uf[i]],l=ve(Ke(e),ue(s[0]*e.width,s[1]*e.height)),c=ae[i],d=ve(Ke(e),ue(c[0]*e.width,c[1]*e.height)),[u,h,p,m,g,$,f]=hf(i);let y=r.x,b=r.y;g?b=0:$&&(y=0);let[x,v,w,S]=vt(e);if(u?S=l.x:h&&(v=l.x),m?x=l.y:p&&(w=l.y),u?v=d.x+y:h&&(S=d.x+y),m?w=d.y+b:p&&(x=d.y+b),a&&g&&w-x<a.height){const e=a.height-(w-x);x-=.5*e,w+=.5*e}if(a&&$&&v-S<a.width){const e=a.width-(v-S);S-=.5*e,v+=.5*e}if(n)if(f){let e=v-S,t=w-x;g?(t=e/n,x=l.y-.5*t,w=l.y+.5*t):$&&(e=t*n,S=l.x-.5*e,v=l.x+.5*e)}else{const e=ue(d.x+y-l.x,d.y+b-l.y);i===ie?(e.x=Math.max(0,e.x),e.y=Math.min(0,e.y)):i===re?(e.x=Math.max(0,e.x),e.y=Math.max(0,e.y)):i===ne?(e.x=Math.min(0,e.x),e.y=Math.max(0,e.y)):i===oe&&(e.x=Math.min(0,e.x),e.y=Math.min(0,e.y));const t=$e(e),o=ue(n,1),r=ke(fe(o),t);i===ie?(v=l.x+r.x,x=l.y-r.y):i===re?(v=l.x+r.x,w=l.y+r.y):i===ne?(S=l.x-r.x,w=l.y+r.y):i===oe&&(S=l.x-r.x,x=l.y-r.y)}return nt(S,x,v-S,w-x)})(Z,o,{aspectRatio:xe,minSize:i});return{boundsLimited:pf(Z,o,{...j,x:0,y:0},{aspectRatio:xe,minSize:i,maxSize:r}),boundsIntent:n}};let qo=void 0,Ko=void 0;const Jo=({translation:e,scalar:t})=>{_&&(t=1,e=me(pe(e)));const o=Math.min(X.width/V.width,X.height/V.height),i=ke(pe(e),1/o);let r;if(Ko){const t=we(pe(Ko),e);Ko=e,r=st(Ke(V),t)}else r=st(Ke(qo),me(pe(i))),void 0!==t&&lt(r,1/t);un(Lo,he=r,he),un(Do,V=r,V)},Qo=Wa([Wo,Do],(([e,t],o)=>{if(!t)return;const[i,r]=e,n=pt(t);o([De(St(bt(i,n),se)),De(St(xt(r,n),se))])}));on(e,Qo,(e=>o(173,Q=e)));const ei=Wa([No,Vo,Oo,Bo,Wo,To],(([e,t,o,i,r,n],a)=>{if(!e)return;const s=r[0],l=r[1];let c,d;t?(c=((e,t,o)=>q(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,n),d=Math.min(s.width/o.width,s.height/o.height)):(c=-1,d=1);a([c,d].map((e=>se(e))))}));on(e,ei,(e=>o(27,_e=e)));const ti=Wa([No,Do,Wo,To],(([e,t,o,i],r)=>{if(!e||!t)return r(0);let n;const a=o[0],s=o[1],l=t.width,c=t.height,d=pt(t),u=q(i)?We(e.height,e.width):e,h=xt(u,d);if(l<=h.width||c<=h.height){const e=h.width-a.width,t=h.height-a.height;n=0===e||0===t?1:1-Math.min((l-a.width)/e,(c-a.height)/t)}else{const e=s.width-h.width,t=s.height-h.height,o=xt({width:e,height:t},d);n=-Math.min((l-h.width)/o.width,(c-h.height)/o.height)}r(n)}));on(e,ti,(e=>o(28,Ge=e)));const oi=e=>{const t=pt(qo);let o,i,r;const n=q(te)?We(ee.height,ee.width):ee,a=xt(n,t);if(e>=0){const n=a.width-ge[0].width,s=a.height-ge[0].height;o=a.width-n*e,i=a.height-s*e,r=bt({width:o,height:i},t)}else{const n=ge[1].width-a.width,s=ge[1].height-a.height;o=a.width+n*-e,i=a.height+s*-e,r=xt({width:o,height:i},t)}o=r.width,i=r.height;const s=qo.x+.5*qo.width-.5*o,l=qo.y+.5*qo.height-.5*i;un(Do,V={x:s,y:l,width:o,height:i},V)};let ii;const ri=e=>{const t=lt(Ke(ii),1/e);un(Lo,he=t,he),un(Do,V=t,V)};let ni;const ai=()=>{Go.set({})};let si;const li=ec(0,{precision:1e-4});on(e,li,(e=>o(29,Ze=e)));const ci=ec();on(e,ci,(e=>o(30,Xe=e)));const di=Wa([_o,Ro,Kt],(([e,t,o],r)=>{if(!i)return;const n=cu(o),a=[...n].map((e=>e[0])).sort(((e,t)=>Fo(e[0])&&!Fo(t[0])?1:-1)).find((o=>{if(Fo(o)&&t){const[i,r]=o,n=t.width===i&&t.height===r,a=e===U(i,r);return n&&a}return o===e}));if(!a)return r(void 0);r(n.map((e=>e[0])).findIndex((e=>Fo(e)?ds(e,a):e===a)))}));on(e,di,(e=>o(154,Pe=e)));const ui=(e,t)=>{if(!i||-1===e||void 0===e)return;const o=cu(t)[e][0];return o?Fo(o)?U(o[0],o[1]):o:void 0},hi=Wa([go,Ao,lo],(([e,t,o],i)=>{const{rows:r,cols:n,opacity:a}=ot(qt,o);if(!t||a<=0)return i([]);const{x:s,y:l,width:c,height:d}=t,u=c/n,h=d/r,p=[];for(let t=1;t<=r-1;t++){const o=l+h*t;p.push({id:"image-selection-guide-row-"+t,points:[ue(s,o),ue(s+c,o)],opacity:a,strokeWidth:1,strokeColor:e})}for(let t=1;t<=n-1;t++){const o=s+u*t;p.push({id:"image-selection-guide-col-"+t,points:[ue(o,l),ue(o,l+d)],opacity:a,strokeWidth:1,strokeColor:e})}i(p)}));on(e,hi,(e=>o(140,F=e)));const pi="crop-"+L();let mi,gi=pi+"-"+(mt?Wt:"zoom"),$i=gi,fi=void 0;const yi=ec(A?20:0);on(e,yi,(e=>o(137,E=e)));return e.$$set=e=>{"isActive"in e&&qe(o(0,Je=e.isActive)),"stores"in e&&o(96,et=e.stores),"cropImageSelectionCornerStyle"in e&&o(1,tt=e.cropImageSelectionCornerStyle),"cropWillRenderImageSelectionGuides"in e&&o(97,ot=e.cropWillRenderImageSelectionGuides),"cropAutoCenterImageSelectionTimeout"in e&&o(98,it=e.cropAutoCenterImageSelectionTimeout),"cropEnableZoomMatchImageAspectRatio"in e&&o(99,ct=e.cropEnableZoomMatchImageAspectRatio),"cropEnableRotateMatchImageAspectRatio"in e&&o(100,dt=e.cropEnableRotateMatchImageAspectRatio),"cropEnableRotationInput"in e&&o(101,mt=e.cropEnableRotationInput),"cropEnableZoom"in e&&o(2,gt=e.cropEnableZoom),"cropEnableZoomInput"in e&&o(102,$t=e.cropEnableZoomInput),"cropEnableZoomAutoHide"in e&&o(103,wt=e.cropEnableZoomAutoHide),"cropEnableImageSelection"in e&&o(104,kt=e.cropEnableImageSelection),"cropEnableInfoIndicator"in e&&o(105,Ct=e.cropEnableInfoIndicator),"cropEnableZoomTowardsWheelPosition"in e&&o(106,Tt=e.cropEnableZoomTowardsWheelPosition),"cropEnableLimitWheelInputToCropSelection"in e&&o(107,Mt=e.cropEnableLimitWheelInputToCropSelection),"cropEnableCenterImageSelection"in e&&o(108,Rt=e.cropEnableCenterImageSelection),"cropEnableButtonRotateLeft"in e&&o(109,Pt=e.cropEnableButtonRotateLeft),"cropEnableButtonRotateRight"in e&&o(110,Et=e.cropEnableButtonRotateRight),"cropEnableButtonFlipHorizontal"in e&&o(111,It=e.cropEnableButtonFlipHorizontal),"cropEnableButtonFlipVertical"in e&&o(112,At=e.cropEnableButtonFlipVertical),"cropSelectPresetOptions"in e&&o(113,Lt=e.cropSelectPresetOptions),"cropEnableSelectPreset"in e&&o(114,zt=e.cropEnableSelectPreset),"cropEnableFilterMatchAspectRatio"in e&&o(115,Ft=e.cropEnableFilterMatchAspectRatio),"cropSelectPresetFilter"in e&&o(94,Dt=e.cropSelectPresetFilter),"cropEnableButtonToggleCropLimit"in e&&o(116,Ot=e.cropEnableButtonToggleCropLimit),"cropWillRenderTools"in e&&o(117,Bt=e.cropWillRenderTools),"cropActiveTransformTool"in e&&o(118,Wt=e.cropActiveTransformTool),"cropMinimizeToolbar"in e&&o(119,_t=e.cropMinimizeToolbar),"cropInteractionFocus"in e&&o(120,Vt=e.cropInteractionFocus),"cropRotationRange"in e&&o(3,Nt=e.cropRotationRange),"cropMaskOpacity"in e&&o(121,Ht=e.cropMaskOpacity),"locale"in e&&o(4,jt=e.locale)},e.$$.update=()=>{4096&e.$$.dirty[0]|134217728&e.$$.dirty[3]&&Xt.set("selection"===Vt&&I),1048576&e.$$.dirty[3]&&o(128,i=Lt&&Array.isArray(Lt)&&Lt.length),1048576&e.$$.dirty[3]|16&e.$$.dirty[4]&&Kt.set(i?Lt:[]),4096&e.$$.dirty[0]&&I&&So.set(1),4096&e.$$.dirty[0]&&$o.set(!I),4096&e.$$.dirty[0]&&fo.set(!I),4096&e.$$.dirty[0]&&I&&yo.set(!0),32768&e.$$.dirty[4]&&o(123,p="overlay"===z.layoutMode),1075838976&e.$$.dirty[3]&&o(127,v=zt&&!p),41943040&e.$$.dirty[4]&&o(136,l=j&&X&&ft(j,X)),33558528&e.$$.dirty[4]&&o(134,c=!(!X||!l)),33559552&e.$$.dirty[4]&&o(132,d=c&&ht(X,l,(e=>se(e,5)))),16400&e.$$.dirty[0]|26148866&e.$$.dirty[3]|2013298968&e.$$.dirty[4]|15&e.$$.dirty[5]&&o(11,r=Le&&Bt([Pt&&["Button","rotate-left",{label:jt.cropLabelButtonRotateLeft,labelClass:"PinturaToolbarContentWide",icon:jt.cropIconButtonRotateLeft,onclick:()=>{ro(-Math.PI/2),no.write()}}],Et&&["Button","rotate-right",{label:jt.cropLabelButtonRotateRight,labelClass:"PinturaToolbarContentWide",icon:jt.cropIconButtonRotateRight,onclick:()=>{ro(Math.PI/2),no.write()}}],It&&["Button","flip-horizontal",{label:jt.cropLabelButtonFlipHorizontal,labelClass:"PinturaToolbarContentWide",icon:jt.cropIconButtonFlipHorizontal,onclick:()=>{q(te)?un(Co,Ie=!Ie,Ie):un(ko,Ae=!Ae,Ae),no.write()}}],At&&["Button","flip-vertical",{label:jt.cropLabelButtonFlipVertical,labelClass:"PinturaToolbarContentWide",icon:jt.cropIconButtonFlipVertical,onclick:()=>{q(te)?un(ko,Ae=!Ae,Ae):un(Co,Ie=!Ie,Ie),no.write()}}],v&&i&&[!1===Dt?"Dropdown":Tf,"select-preset",{icon:uu(jt.cropIconSelectPreset,jt,ui(Pe,Ee)),label:uu(jt.cropLabelSelectPreset,jt,ui(Pe,Ee)),labelClass:"PinturaToolbarContentWide",options:Ee,filter:Dt,onfilterchange:eo,selectedIndex:Pe,onchange:({value:e})=>{Fo(e)?(un(_o,xe=U(e[0],e[1]),xe),un(Ro,Re=Oe(e),Re)):un(_o,xe=e,xe),d&&ai(),no.write()},optionMapper:e=>{let t=!1;const o=Fo(e.value)?e.value[0]/e.value[1]:e.value;if(o){const e=os(ee,te,o);t=e.width<ce.width||e.height<ce.height}return e.icon=((e,t={})=>{const{width:o=24,height:i=24,bounds:r=16,radius:n=3}=t;let a,s,l,c,d=Fo(e)?U(e[0],e[1]):e,u=!!d;return d=u?d:1,l=d>1?r:d*r,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="${n}"/>`})(e.value,{bounds:14}),{...e,disabled:t}}}],Ot&&["Dropdown","select-crop-limit",{icon:uu(jt.cropIconCropBoundary,jt,le),label:jt.cropLabelCropBoundary,labelClass:"PinturaToolbarContentWide",onchange:({value:e})=>{un(Vo,le=e,le),no.write()},options:[[!0,jt.cropLabelCropBoundaryEdge,{icon:uu(jt.cropIconCropBoundary,jt,!0)}],[!1,jt.cropLabelCropBoundaryNone,{icon:uu(jt.cropIconCropBoundary,jt,!1)}]]}]].filter(Boolean),z,(()=>Zt.set({}))).filter(Boolean)),6144&e.$$.dirty[0]|1140850688&e.$$.dirty[3]|32768&e.$$.dirty[4]&&un(vo,Me=I&&"never"!==_t&&("always"===_t||"short"===z.verticalSpace||p)?r.map((([e,t,o])=>Array.isArray(o)?[e,t,o]:[e,t,{...o,hideLabel:!0}])):[],Me),268435456&e.$$.dirty[4]&&o(23,n=le?0:-1),75497472&e.$$.dirty[4]&&o(129,a=j&&ue(-(K.x-j.x),-(K.y-j.y))),262176&e.$$.dirty[4]&&o(130,s=B&&ue(Hd(B.x+.5*B.width+a.x),Hd(B.y+.5*B.height+a.y))),16777216&e.$$.dirty[4]&&o(133,u=null!=Z),8392704&e.$$.dirty[4]&&o(135,h=j&&l&&(l.height===j.height||l.width===j.width)),6293504&e.$$.dirty[4]&&o(131,m=!h&&H<1&&N<1),1920&e.$$.dirty[4]&&o(9,g=c&&!u&&(!d||m)),8192&e.$$.dirty[0]|1073745920&e.$$.dirty[3]&&o(22,$=Ct&&!!V&&!p),262176&e.$$.dirty[4]&&o(8,b=B&&a&&{x:B.x+a.x,y:B.y+a.y,width:B.width,height:B.height}),256&e.$$.dirty[0]|1073743872&e.$$.dirty[3]&&o(21,f=kt&&!!b&&!p),32800&e.$$.dirty[3]|1048640&e.$$.dirty[4]&&o(10,y=Rt&&!!s&&!it&&!_),512&e.$$.dirty[0]|536870944&e.$$.dirty[3]|524288&e.$$.dirty[4]&&g&&it&&!W&&(clearTimeout(si),o(122,si=setTimeout(ai,it))),536870912&e.$$.dirty[3]|524288&e.$$.dirty[4]&&W&&clearTimeout(si),1536&e.$$.dirty[0]|16384&e.$$.dirty[4]&&li.set(y&&g?1:0,{hard:!1===A}),16448&e.$$.dirty[4]&&ci.set(s,{hard:!1===A}),4096&e.$$.dirty[0]|131072&e.$$.dirty[4]&&(I&&!D?(un(wo,O.crop={maskOpacity:Ht,maskMarkupOpacity:Ht},O),wo.set(O)):(delete O.crop,wo.set(O))),65536&e.$$.dirty[4]&&F&&jo.update((e=>{const t=e.filter((e=>!/^image\-selection\-guide/.test(e.id)));return I?[...t,...F]:t})),32768&e.$$.dirty[4]&&o(126,x="short"!==z.verticalSpace),1140850688&e.$$.dirty[3]|4&e.$$.dirty[4]&&o(20,w="never"===_t&&!p||x&&"always"!==_t),4&e.$$.dirty[0]|512&e.$$.dirty[3]&&o(125,S=gt&&$t),1024&e.$$.dirty[3]|6&e.$$.dirty[4]&&o(124,k=wt?x&&S:S),256&e.$$.dirty[3]|1&e.$$.dirty[4]&&o(19,C=mt||k),1&e.$$.dirty[4]&&(k||o(5,$i=gi)),32&e.$$.dirty[0]&&o(18,T={name:pi,selected:$i}),16&e.$$.dirty[0]|256&e.$$.dirty[3]|1&e.$$.dirty[4]&&o(7,M=[mt&&{id:pi+"-rotation",label:jt.cropLabelTabRotation},k&&{id:pi+"-zoom",label:jt.cropLabelTabZoom}].filter(Boolean)),128&e.$$.dirty[0]&&o(17,R=M.map((e=>e.id))),64&e.$$.dirty[0]|1073741824&e.$$.dirty[3]&&mi&&!mi.children.length&&p&&mi.dispatchEvent(new CustomEvent("measure",{detail:mi.rect})),4096&e.$$.dirty[0]|16384&e.$$.dirty[4]&&A&&yi.set(I?0:20),8192&e.$$.dirty[4]&&o(16,P=E?`transform: translateY(${E}px)`:void 0)},[Je,tt,gt,Nt,jt,$i,mi,M,b,g,y,r,I,V,te,fi,P,R,T,C,w,f,$,n,de,Fe,Be,_e,Ge,Ze,Xe,Ut,Gt,Zt,Xt,Yt,Kt,ao,so,co,uo,ho,mo,bo,xo,vo,wo,ko,Co,To,Mo,Ro,Po,Eo,Io,Ao,Lo,zo,Do,Oo,Bo,Wo,_o,Vo,No,Ho,Uo,()=>{qt="select",un(so,W=!0,W),un(Eo,Z=Ke(X),Z),Zo=_?Xo:Yo},({detail:e})=>{const{boundsLimited:t,boundsIntent:o}=Zo(e.direction,e.translation);un(co,J=!0,J),un(Io,Te=o,Te),un(Po,X=t,X)},({detail:e})=>{const{boundsLimited:t}=Zo(e.direction,e.translation);un(co,J=!1,J),un(so,W=!1,W),un(Io,Te=void 0,Te),$e(e.translation)&&(un(Po,X=t,X),no.write()),un(Eo,Z=void 0,Z),qt=void 0},()=>{qt="rotate",un(so,W=!0,W),un(zo,ye=Ke(V),ye)},e=>{un(co,J=!0,J),un(To,te=e,te)},e=>{un(co,J=!1,J),un(so,W=!1,W),un(To,te=e,te),no.write(),un(zo,ye=void 0,ye)},()=>{qt="pan",Ko=void 0,un(so,W=!0,W),qo=Ke(V)},({detail:e})=>{un(co,J=!0,J),Jo(e)},({detail:e})=>{un(co,J=!1,J),un(so,W=!1,W),($e(e.translation)>0||0!==e.scalar)&&(Jo(e),no.write()),un(Lo,he=void 0,he),qo=void 0},({detail:{translation:e}})=>{_&&(e=me(pe(e))),Ko=e,un(so,W=!1,W)},Qo,ei,ti,()=>{qt="zoom",un(so,W=!0,W),qo=Ke(V)},e=>{un(co,J=!1,J),oi(e)},e=>{oi(e),no.write(),un(co,J=!1,J),un(so,W=!1,W),qo=void 0},()=>{qt="zoom",qo||(ii=Ke(V),un(so,W=!0,W))},({detail:e})=>{ii&&(un(co,J=!0,J),ri(e))},({detail:e})=>{ii&&(un(co,J=!1,J),un(so,W=!1,W),ri(e),un(Lo,he=void 0,he),ii=void 0,no.write())},e=>{const t=Wp(e,de,K);if(Mt&&!yt(X,t))return;qt="zoom",un(so,W=!0,W),un(co,J=!0,J),e.preventDefault(),e.stopPropagation();const o=yd(e),i=1+o/100,r=Ke(V),n=1===Math.min(V.width/ce.width,V.height/ce.height);if(ct&&le){const e=oo(V,ee,te);if(Jt()&&e&&o>0&&d){un(so,W=!1,W),un(co,J=!1,J);const e=q(te)?Qe({height:ee.width,width:ee.height}):Qe(ee);if(ht(r,e))return;if(clearTimeout(ni),ht(no.state.crop,e))return;return un(Do,V=e,V),void no.write()}}let a=at(V);if(Tt&&"selection"!==Vt&&o<0&&!n){const e=we(pe(t),X),o=Math.min(X.width/V.width,X.height/V.height),i=lt(Ke(X),1.1);a=yt(i,t)?ve(Ke(V),ke(e,1/o)):a}let s=lt(Ke(V),i,a);if(je(Q[1],s)||(s=rt(at(s),Q[1])),je(s,Q[0])||(s=rt(at(s),Q[0])),ht(r,s,se))return un(so,W=!1,W),void un(co,J=!1,J);un(Do,V=St(s,(e=>se(e,5))),V),un(so,W=!1,W),un(co,J=!1,J),clearTimeout(ni),ni=setTimeout((()=>{no.write()}),500)},ai,li,ci,di,hi,pi,yi,Dt,"crop",et,ot,it,ct,dt,mt,$t,wt,kt,Ct,Tt,Mt,Rt,Pt,Et,It,At,Lt,zt,Ft,Ot,Bt,Wt,_t,Vt,Ht,si,p,k,S,x,v,i,a,s,m,d,u,c,h,l,E,A,z,F,D,B,W,_,N,H,j,Z,X,K,ee,le,ce,Pe,Ee,Ie,Ae,Le,function(t){Qn.call(this,e,t)},({detail:e})=>o(5,$i=e),function(e){ta[e?"unshift":"push"]((()=>{mi=e,o(6,mi)}))},e=>Bp(e),function(e){fi=e,o(15,fi)},function(t){Qn.call(this,e,t)}]}var Xf={util:["crop",class extends Fa{constructor(e){super(),za(this,e,Zf,Hf,Qr,{name:95,isActive:0,stores:96,cropImageSelectionCornerStyle:1,cropWillRenderImageSelectionGuides:97,cropAutoCenterImageSelectionTimeout:98,cropEnableZoomMatchImageAspectRatio:99,cropEnableRotateMatchImageAspectRatio:100,cropEnableRotationInput:101,cropEnableZoom:2,cropEnableZoomInput:102,cropEnableZoomAutoHide:103,cropEnableImageSelection:104,cropEnableInfoIndicator:105,cropEnableZoomTowardsWheelPosition:106,cropEnableLimitWheelInputToCropSelection:107,cropEnableCenterImageSelection:108,cropEnableButtonRotateLeft:109,cropEnableButtonRotateRight:110,cropEnableButtonFlipHorizontal:111,cropEnableButtonFlipVertical:112,cropSelectPresetOptions:113,cropEnableSelectPreset:114,cropEnableFilterMatchAspectRatio:115,cropSelectPresetFilter:94,cropEnableButtonToggleCropLimit:116,cropWillRenderTools:117,cropActiveTransformTool:118,cropMinimizeToolbar:119,cropInteractionFocus:120,cropRotationRange:3,cropMaskOpacity:121,locale:4},null,[-1,-1,-1,-1,-1,-1,-1,-1])}get name(){return this.$$.ctx[95]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),pa()}get stores(){return this.$$.ctx[96]}set stores(e){this.$$set({stores:e}),pa()}get cropImageSelectionCornerStyle(){return this.$$.ctx[1]}set cropImageSelectionCornerStyle(e){this.$$set({cropImageSelectionCornerStyle:e}),pa()}get cropWillRenderImageSelectionGuides(){return this.$$.ctx[97]}set cropWillRenderImageSelectionGuides(e){this.$$set({cropWillRenderImageSelectionGuides:e}),pa()}get cropAutoCenterImageSelectionTimeout(){return this.$$.ctx[98]}set cropAutoCenterImageSelectionTimeout(e){this.$$set({cropAutoCenterImageSelectionTimeout:e}),pa()}get cropEnableZoomMatchImageAspectRatio(){return this.$$.ctx[99]}set cropEnableZoomMatchImageAspectRatio(e){this.$$set({cropEnableZoomMatchImageAspectRatio:e}),pa()}get cropEnableRotateMatchImageAspectRatio(){return this.$$.ctx[100]}set cropEnableRotateMatchImageAspectRatio(e){this.$$set({cropEnableRotateMatchImageAspectRatio:e}),pa()}get cropEnableRotationInput(){return this.$$.ctx[101]}set cropEnableRotationInput(e){this.$$set({cropEnableRotationInput:e}),pa()}get cropEnableZoom(){return this.$$.ctx[2]}set cropEnableZoom(e){this.$$set({cropEnableZoom:e}),pa()}get cropEnableZoomInput(){return this.$$.ctx[102]}set cropEnableZoomInput(e){this.$$set({cropEnableZoomInput:e}),pa()}get cropEnableZoomAutoHide(){return this.$$.ctx[103]}set cropEnableZoomAutoHide(e){this.$$set({cropEnableZoomAutoHide:e}),pa()}get cropEnableImageSelection(){return this.$$.ctx[104]}set cropEnableImageSelection(e){this.$$set({cropEnableImageSelection:e}),pa()}get cropEnableInfoIndicator(){return this.$$.ctx[105]}set cropEnableInfoIndicator(e){this.$$set({cropEnableInfoIndicator:e}),pa()}get cropEnableZoomTowardsWheelPosition(){return this.$$.ctx[106]}set cropEnableZoomTowardsWheelPosition(e){this.$$set({cropEnableZoomTowardsWheelPosition:e}),pa()}get cropEnableLimitWheelInputToCropSelection(){return this.$$.ctx[107]}set cropEnableLimitWheelInputToCropSelection(e){this.$$set({cropEnableLimitWheelInputToCropSelection:e}),pa()}get cropEnableCenterImageSelection(){return this.$$.ctx[108]}set cropEnableCenterImageSelection(e){this.$$set({cropEnableCenterImageSelection:e}),pa()}get cropEnableButtonRotateLeft(){return this.$$.ctx[109]}set cropEnableButtonRotateLeft(e){this.$$set({cropEnableButtonRotateLeft:e}),pa()}get cropEnableButtonRotateRight(){return this.$$.ctx[110]}set cropEnableButtonRotateRight(e){this.$$set({cropEnableButtonRotateRight:e}),pa()}get cropEnableButtonFlipHorizontal(){return this.$$.ctx[111]}set cropEnableButtonFlipHorizontal(e){this.$$set({cropEnableButtonFlipHorizontal:e}),pa()}get cropEnableButtonFlipVertical(){return this.$$.ctx[112]}set cropEnableButtonFlipVertical(e){this.$$set({cropEnableButtonFlipVertical:e}),pa()}get cropSelectPresetOptions(){return this.$$.ctx[113]}set cropSelectPresetOptions(e){this.$$set({cropSelectPresetOptions:e}),pa()}get cropEnableSelectPreset(){return this.$$.ctx[114]}set cropEnableSelectPreset(e){this.$$set({cropEnableSelectPreset:e}),pa()}get cropEnableFilterMatchAspectRatio(){return this.$$.ctx[115]}set cropEnableFilterMatchAspectRatio(e){this.$$set({cropEnableFilterMatchAspectRatio:e}),pa()}get cropSelectPresetFilter(){return this.$$.ctx[94]}set cropSelectPresetFilter(e){this.$$set({cropSelectPresetFilter:e}),pa()}get cropEnableButtonToggleCropLimit(){return this.$$.ctx[116]}set cropEnableButtonToggleCropLimit(e){this.$$set({cropEnableButtonToggleCropLimit:e}),pa()}get cropWillRenderTools(){return this.$$.ctx[117]}set cropWillRenderTools(e){this.$$set({cropWillRenderTools:e}),pa()}get cropActiveTransformTool(){return this.$$.ctx[118]}set cropActiveTransformTool(e){this.$$set({cropActiveTransformTool:e}),pa()}get cropMinimizeToolbar(){return this.$$.ctx[119]}set cropMinimizeToolbar(e){this.$$set({cropMinimizeToolbar:e}),pa()}get cropInteractionFocus(){return this.$$.ctx[120]}set cropInteractionFocus(e){this.$$set({cropInteractionFocus:e}),pa()}get cropRotationRange(){return this.$$.ctx[3]}set cropRotationRange(e){this.$$set({cropRotationRange:e}),pa()}get cropMaskOpacity(){return this.$$.ctx[121]}set cropMaskOpacity(e){this.$$set({cropMaskOpacity:e}),pa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),pa()}}]};function Yf(e){let t,o,i,r,n,a,s,l=e[77],c=(P(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),h=()=>e[52](null,l);return{c(){t=kn("div"),o=kn("div"),i=Mn(),r=kn("span"),n=Tn(c),An(o,"class",Qf),An(t,"slot","option"),An(t,"class","PinturaFilterOption")},m(e,l){wn(e,t,l),bn(t,o),u(),bn(t,i),bn(t,r),bn(r,n),a||(s=[Pn(o,"measure",d),hn($c.call(null,o))],a=!0)},p(t,o){l!==(e=t)[77]&&(h(),l=e[77],u()),4&o[0]|32768&o[2]&&c!==(c=(P(e[77].label)?e[77].label(e[2]):e[77].label)+"")&&Fn(n,c)},d(e){e&&Sn(t),h(),a=!1,Kr(s)}}}function qf(e){let t,o;return t=new Wu({props:{locale:e[2],layout:"row",options:e[3],selectedIndex:e[12],onchange:e[32],$$slots:{option:[Yf,({option:e})=>({77:e}),({option:e})=>[0,0,e?32768:0]]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Kf(e){let t,o,i,r,n,a,s,l;function c(t){e[54](t)}function d(t){e[55](t)}function u(t){e[56](t)}let h={elasticity:e[13]*e[19],onscroll:e[53],$$slots:{default:[qf]},$$scope:{ctx:e}};return void 0!==e[4]&&(h.maskFeatherStartOpacity=e[4]),void 0!==e[5]&&(h.maskFeatherEndOpacity=e[5]),void 0!==e[6]&&(h.maskFeatherSize=e[6]),o=new vd({props:h}),ta.push((()=>Ea(o,"maskFeatherStartOpacity",c))),ta.push((()=>Ea(o,"maskFeatherEndOpacity",d))),ta.push((()=>Ea(o,"maskFeatherSize",u))),o.$on("measure",e[57]),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"slot","footer"),An(t,"style",e[11])},m(i,r){wn(i,t,r),Aa(o,t,null),a=!0,s||(l=[Pn(t,"transitionend",e[30]),Pn(t,"measure",e[58]),hn($c.call(null,t,{observePosition:!0}))],s=!0)},p(e,s){const l={};8192&s[0]&&(l.elasticity=e[13]*e[19]),128&s[0]&&(l.onscroll=e[53]),5132&s[0]|65536&s[2]&&(l.$$scope={dirty:s,ctx:e}),!i&&16&s[0]&&(i=!0,l.maskFeatherStartOpacity=e[4],ca((()=>i=!1))),!r&&32&s[0]&&(r=!0,l.maskFeatherEndOpacity=e[5],ca((()=>r=!1))),!n&&64&s[0]&&(n=!0,l.maskFeatherSize=e[6],ca((()=>n=!1))),o.$set(l),(!a||2048&s[0])&&An(t,"style",e[11])},i(e){a||(xa(o.$$.fragment,e),a=!0)},o(e){va(o.$$.fragment,e),a=!1},d(e){e&&Sn(t),La(o),s=!1,Kr(l)}}}function Jf(e){let t,o;return t=new J$({props:{$$slots:{footer:[Kf]},$$scope:{ctx:e}}}),t.$on("measure",e[59]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}let Qf="PinturaFilterPreview";function ey(e,t,o){let i,r,n,a,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,S=Gr,k=()=>(S(),S=en(R,(e=>o(43,d=e))),R),C=Gr,T=()=>(C(),C=en(M,(e=>o(49,b=e))),M);e.$$.on_destroy.push((()=>S())),e.$$.on_destroy.push((()=>C()));let{isActive:M}=t;T();let{isActiveFraction:R}=t;k();let{stores:E}=t,{locale:I}=t,{filterFunctions:A}=t,{filterOptions:L}=t;const z=Jn("elasticityMultiplier");on(e,z,(e=>o(13,w=e)));const{history:F,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}=E;on(e,D,(e=>o(60,u=e))),on(e,O,(e=>o(48,y=e))),on(e,B,(e=>o(47,f=e))),on(e,W,(e=>o(50,x=e))),on(e,V,(e=>o(62,p=e))),on(e,N,(e=>o(42,c=e))),on(e,Z,(e=>o(61,h=e))),on(e,X,(e=>o(44,m=e))),on(e,Y,(e=>o(40,s=e)));const ee=Ba({});on(e,ee,(e=>o(46,$=e)));const te=(e,t)=>un(ee,$[e.value]=t,$),oe=Wa(ee,(e=>{if(!e[void 0])return;const t=e[void 0];return v&&_e(v,t)?v:ze(t)}));on(e,oe,(e=>o(63,v=e)));const ie=Wa([M,oe,H,V,j,U,G],(([e,t,o,i,r,n,a],s)=>{if(!e||!t||!i)return g;const l=Qe(i),c=at(l),d=rs(i,o,r),u=at(d),h=we(pe(c),u),p=me(pe(h)),m=Math.max(t.width/o.width,t.height/o.height);s({origin:p,translation:h,rotation:{x:a?Math.PI:0,y:n?Math.PI:0,z:r},scale:m})}));on(e,ie,(e=>o(45,g=e)));const re=ec(x?20:0);let ne;on(e,re,(e=>o(39,a=e)));const ae={};let se,le,ce,de,he,ge,$e={x:0,y:0};const fe=Ba([]);on(e,fe,(e=>o(41,l=e)));const ye=e=>{const t={...e,data:c,size:p,offset:{...e.offset},mask:{...e.mask},backgroundColor:h};return t.opacity=d,t.offset.y+=a,t.mask.y+=a,t.id="filter",t},be=()=>u.filter((e=>"filter"!==e.id));Yn((()=>{D.set([])}));return e.$$set=e=>{"isActive"in e&&T(o(0,M=e.isActive)),"isActiveFraction"in e&&k(o(1,R=e.isActiveFraction)),"stores"in e&&o(34,E=e.stores),"locale"in e&&o(2,I=e.locale),"filterFunctions"in e&&o(35,A=e.filterFunctions),"filterOptions"in e&&o(3,L=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=cu(L)),640&e.$$.dirty[1]&&o(12,r=((e,t)=>{if(!e||!e.filter||!t)return 0;const o=e.filter;return t.findIndex((([e])=>{if(!A[e])return!1;const t=A[e]();return ds(t,o)}))})(s,i)),786432&e.$$.dirty[1]&&x&&re.set(b?0:20),512&e.$$.dirty[0]|458752&e.$$.dirty[1]&&b&&f&&y&&ge&&o(37,he={x:y.x-f.x,y:y.y-f.y+ge.y}),496&e.$$.dirty[0]|58096&e.$$.dirty[1]&&g&&he&&$e&&de&&ne){const e=he.x+de.x+$e.x,t=he.y,o=de.x+he.x,r=o+de.width;fe.set(i.map((([i],n)=>{const a=$[i],l=$e.x+a.x,c=l+a.width;if(c<0||l>de.width)return!1;const d=e+a.x,u=t+a.y,h=(e=>({origin:pe(e.origin),translation:pe(e.translation),rotation:{...e.rotation},scale:e.scale}))(g);h.offset=ue(.5*a.width+d,.5*a.height+u);h.maskOpacity=1,h.mask=nt(d+0,u,a.width+0,a.height),h.maskFeather=[1,0,1,0,1,r,1,r],l<ce&&se<1&&(h.maskFeather[0]=se,h.maskFeather[1]=o,h.maskFeather[2]=1,h.maskFeather[3]=o+ce),c>de.width-ce&&le<1&&(h.maskFeather[4]=le,h.maskFeather[5]=r-ce,h.maskFeather[6]=1,h.maskFeather[7]=r),h.maskCornerRadius=ne[i];let p=s&&Object.keys(s).filter((e=>"filter"!=e)).map((e=>s[e]))||[];return P(A[i])&&p.push(A[i]()),h.colorMatrix=p.length?jr(p):void 0,h.gamma=m,h})).filter(Boolean))}if(7424&e.$$.dirty[1])if(d>0&&l){const e=[...be(),...l.map(ye)];D.set(e)}else D.set(be());256&e.$$.dirty[1]&&o(11,n=a?`transform: translateY(${a}px)`:void 0)},[M,R,I,L,se,le,ce,$e,de,ge,ae,n,r,w,z,D,O,B,W,_,V,N,Z,X,Y,ee,te,oe,ie,re,e=>{e.target.className===Qf&&o(36,ne=Object.keys(ae).reduce(((e,t)=>{const o=ae[t],i=getComputedStyle(o),r=["top-left","top-right","bottom-left","bottom-right"].map((e=>i.getPropertyValue(`border-${e}-radius`))).map(fd).map((e=>1.25*e));return e[t]=r,e}),{}))},fe,({value:e})=>{un(Y,s={...s,filter:P(A[e])?A[e]():void 0},s),F.write()},"filter",E,A,ne,he,i,a,s,l,c,d,m,g,$,f,y,b,x,(e,t)=>te(e,t.detail),function(e,t){ta[e?"unshift":"push"]((()=>{ae[t.value]=e,o(10,ae)}))},e=>o(7,$e=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,ge=e.detail),function(t){Qn.call(this,e,t)}]}var ty={util:["filter",class extends Fa{constructor(e){super(),za(this,e,ey,Jf,Qr,{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}),pa()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),pa()}get stores(){return this.$$.ctx[34]}set stores(e){this.$$set({stores:e}),pa()}get locale(){return this.$$.ctx[2]}set locale(e){this.$$set({locale:e}),pa()}get filterFunctions(){return this.$$.ctx[35]}set filterFunctions(e){this.$$set({filterFunctions:e}),pa()}get filterOptions(){return this.$$.ctx[3]}set filterOptions(e){this.$$set({filterOptions:e}),pa()}}]};function oy(e){let t,o,i=e[43].label+"";return{c(){t=kn("span"),o=Tn(i)},m(e,i){wn(e,t,i),bn(t,o)},p(e,t){4096&t[1]&&i!==(i=e[43].label+"")&&Fn(o,i)},d(e){e&&Sn(t)}}}function iy(e){let t,o;const i=[{class:"PinturaControlList"},{tabs:e[1]},e[5]];let r={$$slots:{default:[oy,({tab:e})=>({43:e}),({tab:e})=>[0,e?4096:0]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)r=Xr(r,i[e]);return t=new Fc({props:r}),t.$on("select",e[24]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const r=34&o[0]?Ra(i,[i[0],2&o[0]&&{tabs:e[1]},32&o[0]&&Pa(e[5])]):{};12288&o[1]&&(r.$$scope={dirty:o,ctx:e}),t.$set(r)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function ry(e){let t,o;const i=[e[7][e[42]]];let r={};for(let e=0;e<i.length;e+=1)r=Xr(r,i[e]);return t=new of({props:r}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const r=128&o[0]|2048&o[1]?Ra(i,[Pa(e[7][e[42]])]):{};t.$set(r)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function ny(e){let t,o,i,r,n;o=new vd({props:{elasticity:e[6]*e[9],class:"PinturaControlListScroller",$$slots:{default:[iy]},$$scope:{ctx:e}}});const a=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[4]},e[5]];let s={$$slots:{default:[ry,({panel:e})=>({42:e}),({panel:e})=>[0,e?2048:0]]},$$scope:{ctx:e}};for(let e=0;e<a.length;e+=1)s=Xr(s,a[e]);return r=new Zc({props:s}),{c(){t=kn("div"),Ia(o.$$.fragment),i=Mn(),Ia(r.$$.fragment),An(t,"slot","footer"),An(t,"style",e[3])},m(e,a){wn(e,t,a),Aa(o,t,null),bn(t,i),Aa(r,t,null),n=!0},p(e,i){const s={};64&i[0]&&(s.elasticity=e[6]*e[9]),38&i[0]|8192&i[1]&&(s.$$scope={dirty:i,ctx:e}),o.$set(s);const l=48&i[0]?Ra(a,[a[0],a[1],16&i[0]&&{panels:e[4]},32&i[0]&&Pa(e[5])]):{};128&i[0]|10240&i[1]&&(l.$$scope={dirty:i,ctx:e}),r.$set(l),(!n||8&i[0])&&An(t,"style",e[3])},i(e){n||(xa(o.$$.fragment,e),xa(r.$$.fragment,e),n=!0)},o(e){va(o.$$.fragment,e),va(r.$$.fragment,e),n=!1},d(e){e&&Sn(t),La(o),La(r)}}}function ay(e){let t,o;return t=new J$({props:{$$slots:{footer:[ny]},$$scope:{ctx:e}}}),t.$on("measure",e[25]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};254&o[0]|8192&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function sy(e,t,o){let i,r,n,a,s,l,c,d,u,h,p,m=Gr,g=()=>(m(),m=en(f,(e=>o(21,c=e))),f);e.$$.on_destroy.push((()=>m()));let{stores:$}=t,{isActive:f}=t;g();let{locale:y={}}=t,{finetuneControlConfiguration:b}=t,{finetuneOptions:x}=t,{finetuneNudgePrecision:v}=t;const{history:w,animation:S,scrollElasticity:k,rangeInputElasticity:C,imageColorMatrix:T,imageConvolutionMatrix:M,imageGamma:R,imageVignette:E,imageNoise:I,allowPan:A,allowZoom:z,allowZoomControls:F,allowPlayPause:D}=$;on(e,S,(e=>o(22,d=e)));const O={imageColorMatrix:T,imageConvolutionMatrix:M,imageGamma:R,imageVignette:E,imageNoise:I},B=Jn("elasticityMultiplier");on(e,B,(e=>o(6,h=e)));const W="finetune-"+L(),_=Ba({});on(e,_,(e=>o(23,u=e)));const V=Ba({});on(e,V,(e=>o(7,p=e)));let N=[];const H=ec(d?20:0);on(e,H,(e=>o(20,l=e)));return e.$$set=e=>{"stores"in e&&o(15,$=e.stores),"isActive"in e&&g(o(0,f=e.isActive)),"locale"in e&&o(16,y=e.locale),"finetuneControlConfiguration"in e&&o(17,b=e.finetuneControlConfiguration),"finetuneOptions"in e&&o(18,x=e.finetuneOptions),"finetuneNudgePrecision"in e&&o(19,v=e.finetuneNudgePrecision)},e.$$.update=()=>{var t;2097152&e.$$.dirty[0]&&A.set(c),2097152&e.$$.dirty[0]&&z.set(c),2097152&e.$$.dirty[0]&&F.set(c),2097152&e.$$.dirty[0]&&c&&D.set(!0),327680&e.$$.dirty[0]&&o(1,i=x?x.map((([e,t])=>({id:e,label:P(t)?t(y):t}))):[]),2&e.$$.dirty[0]&&o(2,r=i.length&&i[0].id),4&e.$$.dirty[0]&&o(5,n={name:W,selected:r}),2&e.$$.dirty[0]&&o(4,a=i.map((e=>e.id))),131072&e.$$.dirty[0]&&b&&(t=b,N&&N.forEach((e=>e())),N=a.map((e=>{const{getStore:o,getValue:i=G}=t[e];return o(O).subscribe((t=>{const o=null!=t?i(t):t;un(_,u={...u,[e]:o},u)}))}))),8519680&e.$$.dirty[0]&&b&&u&&un(V,p=Object.keys(u).reduce(((e,t)=>{const{base:o,min:i,max:r,getLabel:n,getStore:a,setValue:s=((e,t)=>e.set(t))}=b[t],l=a(O),c=null!=u[t]?u[t]:o;return e[t]={base:o,min:i,max:r,value:c,valueLabel:n?n(c,i,r,r-i):Math.round(100*c),oninputmove:e=>{s(l,e)},oninputend:e=>{s(l,e),w.write()},elasticity:h*C,labelReset:y.labelReset,nudgeMultiplier:v},e}),{}),p),6291456&e.$$.dirty[0]&&d&&H.set(c?0:20),1048576&e.$$.dirty[0]&&o(3,s=l?`transform: translateY(${l}px)`:void 0)},[f,i,r,s,a,n,h,p,S,k,B,_,V,H,"finetune",$,y,b,x,v,l,c,d,u,({detail:e})=>o(2,r=e),function(t){Qn.call(this,e,t)}]}var ly={util:["finetune",class extends Fa{constructor(e){super(),za(this,e,sy,ay,Qr,{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}),pa()}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),pa()}get locale(){return this.$$.ctx[16]}set locale(e){this.$$set({locale:e}),pa()}get finetuneControlConfiguration(){return this.$$.ctx[17]}set finetuneControlConfiguration(e){this.$$set({finetuneControlConfiguration:e}),pa()}get finetuneOptions(){return this.$$.ctx[18]}set finetuneOptions(e){this.$$set({finetuneOptions:e}),pa()}get finetuneNudgePrecision(){return this.$$.ctx[19]}set finetuneNudgePrecision(e){this.$$set({finetuneNudgePrecision:e}),pa()}}]},cy=(e,t)=>{const o=t.length;return e<0?e%o+o:e>=o?e%o:e};function dy(e,t,o){const i=e.slice();return i[45]=t[o].key,i[46]=t[o].index,i[47]=t[o].translate,i[48]=t[o].scale,i[12]=t[o].rotate,i[49]=t[o].dir,i[50]=t[o].center,i[51]=t[o].type,i[2]=t[o].visible,i}function uy(e){let t,o;return{c(){t=kn("div"),An(t,"class","PinturaShapeManipulator"),An(t,"data-control","point"),An(t,"style",o=`pointer-events:none;transform: translate3d(${e[50].x}px, ${e[50].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[4]}`)},m(e,o){wn(e,t,o)},p(e,i){56&i[0]&&o!==(o=`pointer-events:none;transform: translate3d(${e[50].x}px, ${e[50].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[4]}`)&&An(t,"style",o)},d(e){e&&Sn(t)}}}function hy(e,t){let o,i,r,n,a,s,l,c,d;function u(...e){return t[17](t[46],...e)}let h="edge"===t[51]&&t[2]&&uy(t);return{key:e,first:null,c(){o=kn("div"),s=Mn(),h&&h.c(),l=Rn(),An(o,"role","button"),An(o,"aria-label",i=`Drag ${t[51]} ${t[45]}`),An(o,"tabindex",r="edge"===t[51]?-1:0),An(o,"class","PinturaShapeManipulator"),An(o,"data-control",n=t[51]),An(o,"style",a=`cursor:${t[49]?t[49]+"-resize":"move"};opacity:${t[4]};--tx:${t[47].x};--ty:${t[47].y};--r:${"edge"===t[51]?t[12]:0}rad;--sx:${"point"===t[51]?t[5]:t[48].x};--sy:${"point"===t[51]?t[5]:t[48].y};`),this.first=o},m(e,i){wn(e,o,i),wn(e,s,i),h&&h.m(e,i),wn(e,l,i),c||(d=[Pn(o,"nudge",u),hn(pd.call(null,o,{preventDefault:!0})),Pn(o,"interactionstart",(function(){Jr(t[9]("start",t[46]))&&t[9]("start",t[46]).apply(this,arguments)})),Pn(o,"interactionupdate",(function(){Jr(t[9]("move",t[46]))&&t[9]("move",t[46]).apply(this,arguments)})),Pn(o,"interactionend",(function(){Jr(t[9]("end",t[46]))&&t[9]("end",t[46]).apply(this,arguments)})),hn(hd.call(null,o,{observeKeys:!0}))],c=!0)},p(e,s){t=e,8&s[0]&&i!==(i=`Drag ${t[51]} ${t[45]}`)&&An(o,"aria-label",i),8&s[0]&&r!==(r="edge"===t[51]?-1:0)&&An(o,"tabindex",r),8&s[0]&&n!==(n=t[51])&&An(o,"data-control",n),56&s[0]&&a!==(a=`cursor:${t[49]?t[49]+"-resize":"move"};opacity:${t[4]};--tx:${t[47].x};--ty:${t[47].y};--r:${"edge"===t[51]?t[12]:0}rad;--sx:${"point"===t[51]?t[5]:t[48].x};--sy:${"point"===t[51]?t[5]:t[48].y};`)&&An(o,"style",a),"edge"===t[51]&&t[2]?h?h.p(t,s):(h=uy(t),h.c(),h.m(l.parentNode,l)):h&&(h.d(1),h=null)},d(e){e&&Sn(o),e&&Sn(s),h&&h.d(e),e&&Sn(l),c=!1,Kr(d)}}}function py(e){let t,o,i,r;return{c(){t=kn("div"),An(t,"role","button"),An(t,"aria-label","Drag rotator"),An(t,"tabindex","0"),An(t,"class","PinturaShapeManipulator"),An(t,"data-control","rotate"),An(t,"style",o=`transform: translate3d(${e[0].x}px, ${e[0].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[4]}`)},m(o,n){wn(o,t,n),i||(r=[Pn(t,"nudge",e[11]),hn(pd.call(null,t,{preventDefault:!0})),Pn(t,"interactionstart",e[12]("start")),Pn(t,"interactionupdate",e[12]("move")),Pn(t,"interactionend",e[12]("end")),hn(hd.call(null,t,{observeKeys:!0}))],i=!0)},p(e,i){49&i[0]&&o!==(o=`transform: translate3d(${e[0].x}px, ${e[0].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[4]}`)&&An(t,"style",o)},d(e){e&&Sn(t),i=!1,Kr(r)}}}function my(e){let t,o,i=[],r=new Map,n=e[3];const a=e=>e[45];for(let t=0;t<n.length;t+=1){let o=dy(e,n,t),s=a(o);r.set(s,i[t]=hy(s,o))}let s=e[1]&&py(e);return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=Mn(),s&&s.c(),o=Rn()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);wn(e,t,r),s&&s.m(e,r),wn(e,o,r)},p(e,l){1592&l[0]&&(n=e[3],i=Ma(i,l,a,1,e,n,r,t.parentNode,Ca,hy,t,dy)),e[1]?s?s.p(e,l):(s=py(e),s.c(),s.m(o.parentNode,o)):s&&(s.d(1),s=null)},i:Gr,o:Gr,d(e){for(let t=0;t<i.length;t+=1)i[t].d(e);e&&Sn(t),s&&s.d(e),e&&Sn(o)}}}function gy(e,t,o){let i,r,n,a;const s=qn(),l=.5*Y,c=X-l,d=X+l,u=-X,h=u-l,p=u+l,m=Z-l,g=-Z+l,$=l,f=-l,y=X-Y,b=y-l,x=y+l,v=Z-Y,w=v-l,S=v+l,k=u-Y,C=k+l,T=k-l,M=u+Y,R=M+l,P=M-l;let{visible:E=!1}=t,{points:I=[]}=t,{rotatorPoint:A}=t,{enableDragEdges:L=!0}=t,{enableDragPoints:z=!0}=t,{enableRotatePoints:F=!0}=t;const D=Jn("isAnimated");on(e,D,(e=>o(16,r=e)));const O=ec(.5,{precision:1e-4,stiffness:.3,damping:.7});on(e,O,(e=>o(5,a=e)));const B=ec(0,{precision:.001,stiffness:.3,damping:.7});on(e,B,(e=>o(4,n=e)));const W=e=>{let t="";return(e<=d&&e>=c||e>=h&&e<=p)&&(t="ns"),(e<=g||e>=m||e>=f&&e<=$)&&(t="ew"),(e>=w&&e<=S||e<=R&&e>=P)&&(t="nesw"),(e>=b&&e<=x||e<=C&&e>=T)&&(t="nwse"),t},_=(e,t)=>{s("resizestart",{indexes:e,translation:de()}),s("resizemove",{indexes:e,translation:t}),s("resizeend",{indexes:e,translation:de()})};return e.$$set=e=>{"visible"in e&&o(2,E=e.visible),"points"in e&&o(13,I=e.points),"rotatorPoint"in e&&o(0,A=e.rotatorPoint),"enableDragEdges"in e&&o(14,L=e.enableDragEdges),"enableDragPoints"in e&&o(15,z=e.enableDragPoints),"enableRotatePoints"in e&&o(1,F=e.enableRotatePoints)},e.$$.update=()=>{65540&e.$$.dirty[0]&&O.set(E?1:.5,{hard:!1===r}),65540&e.$$.dirty[0]&&B.set(E?1:0,{hard:!1===r}),8192&e.$$.dirty[0]&&o(3,i=((e,t)=>{let o=0;const i=Ee(e),r=[],n=e.length;for(;o<n;o++){const t=cy(o-1,e),n=cy(o+1,e),a=e[t],s=e[o],l=e[n],c=Math.atan2(l.y-s.y,l.x-s.x);if(z){const e=fe(ue(a.x-s.x,a.y-s.y)),t=fe(ue(l.x-s.x,l.y-s.y)),i=ue(e.x+t.x,e.y+t.y),n=L?z&&W(Math.atan2(i.y,i.x)):void 0;r.push({index:[o],key:"point-"+o,type:"point",scale:{x:1,y:1},translate:{x:s.x,y:s.y},angle:void 0,rotate:F,center:s,dir:n})}if(!L)continue;if(Array.isArray(L)&&!L.some((([e,t])=>o===e&&n===t)))continue;const d=ue(s.x+.5*(l.x-s.x),s.y+.5*(l.y-s.y));r.push({index:[o,n],key:"edge-"+o,type:"edge",scale:{x:Re(s,l),y:1},translate:{x:s.x,y:s.y},angle:c,rotate:c,center:d,visible:Array.isArray(L),dir:W(Math.atan2(i.y-d.y,i.x-d.x))})}return r})(I))},[A,F,E,i,n,a,D,O,B,(e,t)=>({detail:o})=>{const i=o&&o.translation?o.translation:ue(0,0);s("resize"+e,{...o,indexes:t,translation:i})},_,({detail:e})=>{s("rotatestart",{translation:de()}),s("rotatemove",{translation:e}),s("rotateend",{translation:de()})},e=>({detail:t})=>{const o=t&&t.translation?t.translation:ue(0,0);s("rotate"+e,{...t,translation:o})},I,L,z,r,(e,{detail:t})=>_(e,t)]}class $y extends Fa{constructor(e){super(),za(this,e,gy,my,Qr,{visible:2,points:13,rotatorPoint:0,enableDragEdges:14,enableDragPoints:15,enableRotatePoints:1},null,[-1,-1])}}var fy=(e,t)=>{const o=Bp(e);return we(o,t)},yy=e=>document.createTextNode(e),by=e=>(Xt()&&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 xy(e){let t,o;return{c(){t=kn("pre"),An(t,"class","PinturaContentEditable"),An(t,"style",o=e[7]+";position:absolute;z-index:-1;pointer-events:none;")},m(o,i){wn(o,t,i),t.innerHTML=e[0]},p(e,i){1&i[0]&&(t.innerHTML=e[0]),128&i[0]&&o!==(o=e[7]+";position:absolute;z-index:-1;pointer-events:none;")&&An(t,"style",o)},d(e){e&&Sn(t)}}}function vy(e){let t,o,i,r,n,a,s=e[8]&&xy(e);return{c(){s&&s.c(),t=Mn(),o=kn("pre"),An(o,"class","PinturaContentEditable"),An(o,"data-wrap-content",i=e[4]||e[5]?"wrap":"nowrap"),An(o,"contenteditable",""),An(o,"spellcheck",e[1]),An(o,"autocorrect",e[2]),An(o,"autocapitalize",e[3]),An(o,"style",r=e[8]?e[15](e[7]):e[7])},m(i,r){s&&s.m(i,r),wn(i,t,r),wn(i,o,r),e[26](o),n||(a=[Pn(o,"input",e[13]),Pn(o,"compositionend",e[12]),Pn(o,"paste",e[14]),Pn(o,"keydown",e[10]),Pn(o,"keyup",e[11]),Pn(o,"blur",e[9])],n=!0)},p(e,n){e[8]?s?s.p(e,n):(s=xy(e),s.c(),s.m(t.parentNode,t)):s&&(s.d(1),s=null),48&n[0]&&i!==(i=e[4]||e[5]?"wrap":"nowrap")&&An(o,"data-wrap-content",i),2&n[0]&&An(o,"spellcheck",e[1]),4&n[0]&&An(o,"autocorrect",e[2]),8&n[0]&&An(o,"autocapitalize",e[3]),384&n[0]&&r!==(r=e[8]?e[15](e[7]):e[7])&&An(o,"style",r)},i:Gr,o:Gr,d(i){s&&s.d(i),i&&Sn(t),i&&Sn(o),e[26](null),n=!1,Kr(a)}}}function wy(e,t,o){let i,r,{spellcheck:n="false"}=t,{autocorrect:s="off"}=t,{autocapitalize:l="off"}=t,{wrapLines:c=!0}=t,{allowNewline:d=!0}=t,{textFormat:u="text"}=t,{formatInput:h=G}=t,{formatPaste:p=G}=t,{style:m}=t,{innerHTML:$}=t,{oninput:f=a}=t,{enableTextStyleShortcuts:y=!1}=t;const b=()=>{if(!v)return;const e=document.createRange();e.selectNodeContents(v);const t=R();t.removeAllRanges(),t.addRange(e)},x=qn();let v;document.execCommand("defaultParagraphSeparator",!1,"br");const w=e=>e.replace(/<\/?(?:i|b|em|u|s|strike|strong|font)>/,"").replace(/style=".*?"/g,"").replace(/\n/gim,"<br>"),S=()=>{o(0,$=v.innerHTML);const e=by($);x("input",e),f(e),requestAnimationFrame((()=>v&&v.scrollTo(0,0)))},k=()=>{P(v);const e="html"===u?v.innerHTML:w(v.innerHTML);o(6,v.innerHTML=h(e),v),E(v),S()},C={b:"bold",i:"italic",u:"underline",s:"strikethrough"},T=e=>{const t=g("span");return t.dataset.bookmark=e,t},M=(e,t,o)=>{const i=T(o);if(e.nodeType===Node.TEXT_NODE){const r=e.textContent;if("start"===o){const o=yy(r.substr(0,t)),n=yy(r.substr(t));e.replaceWith(o,i,n)}else{const o=yy(r.substr(0,t)),n=yy(r.substr(t));e.replaceWith(o,i,n)}}else e.nodeType===Node.ELEMENT_NODE&&e.insertBefore(i,e.childNodes[t])},R=()=>{const e=v.getRootNode();return"getSelection"in e?e.getSelection():document.getSelection()},P=e=>{const t=R();if(!t.getRangeAt||!t.rangeCount)return;const o=t.getRangeAt(0),{startOffset:i,endOffset:r,startContainer:n,endContainer:a}=o;if(e.contains(o.startContainer)&&e.contains(o.endContainer))if(n.nodeType===Node.TEXT_NODE&&n===a){const e=n.textContent,t=e.substr(0,i),o=T("start"),a=r-i>0?e.substr(i,r):"",s=T("end"),l=e.substr(r);n.replaceWith(t,o,a,s,l)}else M(n,i,"start"),M(a,r+(n===a?1:0),"end")},E=e=>{const t=I(e,"start"),o=I(e,"end");if(!t||!o)return;const i=document.createRange();i.setStart(t,0),i.setEnd(o,0);const r=R();r.removeAllRanges(),r.addRange(i),t.remove(),o.remove()},I=(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=I(i,t);if(e)return e}}};let A;return e.$$set=e=>{"spellcheck"in e&&o(1,n=e.spellcheck),"autocorrect"in e&&o(2,s=e.autocorrect),"autocapitalize"in e&&o(3,l=e.autocapitalize),"wrapLines"in e&&o(4,c=e.wrapLines),"allowNewline"in e&&o(5,d=e.allowNewline),"textFormat"in e&&o(16,u=e.textFormat),"formatInput"in e&&o(17,h=e.formatInput),"formatPaste"in e&&o(18,p=e.formatPaste),"style"in e&&o(19,m=e.style),"innerHTML"in e&&o(0,$=e.innerHTML),"oninput"in e&&o(20,f=e.oninput),"enableTextStyleShortcuts"in e&&o(21,y=e.enableTextStyleShortcuts)},e.$$.update=()=>{var t;if(64&e.$$.dirty[0]&&o(25,i=!!v),33554433&e.$$.dirty[0]&&i&&$&&(t=$)!==v.innerHTML&&(o(6,v.innerHTML=t,v),v===document.activeElement&&b()),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";o(7,A=m+";overflow:visible;"+e)}else o(7,A=m);524288&e.$$.dirty[0]&&o(8,r=m.includes("text-stroke"))},[$,n,s,l,c,d,v,A,r,()=>{x("blur")},e=>{if(/escape/i.test(e.code))return e.stopPropagation(),void x("cancel");const t=e.ctrlKey||e.metaKey;if("html"===u&&t&&/b|i|u|s/.test(e.key))return y&&(e=>{const t=C[e];t&&document.execCommand(t)})(e.key),void e.preventDefault();/enter/i.test(e.code)&&(e.stopPropagation(),e.isComposing||(t?x("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:w(t),i=p(o);if(!i.length)return;const r=R().getRangeAt(0);r.deleteContents(),r.insertNode(document.createTextNode(i)),S()},e=>e.replace("-webkit-text-stroke","--text-stroke").replace("text-shadow","--text-shadow"),u,h,p,m,f,y,()=>k(),()=>v&&v.focus(),b,i,function(e){ta[e?"unshift":"push"]((()=>{v=e,o(6,v)}))}]}class Sy extends Fa{constructor(e){super(),za(this,e,wy,vy,Qr,{spellcheck:1,autocorrect:2,autocapitalize:3,wrapLines:4,allowNewline:5,textFormat:16,formatInput:17,formatPaste:18,style: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}),pa()}get autocorrect(){return this.$$.ctx[2]}set autocorrect(e){this.$$set({autocorrect:e}),pa()}get autocapitalize(){return this.$$.ctx[3]}set autocapitalize(e){this.$$set({autocapitalize:e}),pa()}get wrapLines(){return this.$$.ctx[4]}set wrapLines(e){this.$$set({wrapLines:e}),pa()}get allowNewline(){return this.$$.ctx[5]}set allowNewline(e){this.$$set({allowNewline:e}),pa()}get textFormat(){return this.$$.ctx[16]}set textFormat(e){this.$$set({textFormat:e}),pa()}get formatInput(){return this.$$.ctx[17]}set formatInput(e){this.$$set({formatInput:e}),pa()}get formatPaste(){return this.$$.ctx[18]}set formatPaste(e){this.$$set({formatPaste:e}),pa()}get style(){return this.$$.ctx[19]}set style(e){this.$$set({style:e}),pa()}get innerHTML(){return this.$$.ctx[0]}set innerHTML(e){this.$$set({innerHTML:e}),pa()}get oninput(){return this.$$.ctx[20]}set oninput(e){this.$$set({oninput:e}),pa()}get enableTextStyleShortcuts(){return this.$$.ctx[21]}set enableTextStyleShortcuts(e){this.$$set({enableTextStyleShortcuts:e}),pa()}get confirm(){return this.$$.ctx[22]}get focus(){return this.$$.ctx[23]}get select(){return this.$$.ctx[24]}}const ky=["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 Cy=e=>e=((e,t=ky)=>(t.forEach((({tag:t,placeholderOpen:o,placeholderClose:i})=>{e=e.replace(o,`<${t}>`).replace(i,`</${t}>`)})),e))(e=(e=((e,t=ky)=>(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>")),Ty=(e,t)=>R(e)?parseFloat(e)/100*t:e,My=(e,t)=>({x:No(e.x,t.width),y:No(e.y,t.height)});function Ry(e,t,o){const i=e.slice();return i[276]=t[o],i[278]=o,i}function Py(e,t){let o,i,r,n,a,s,l,c,d,u,h,p=t[276].name+"";function m(){return t[180](t[278])}return r=new Oh({props:{color:t[276].color}}),{key:e,first:null,c(){o=kn("li"),i=kn("button"),Ia(r.$$.fragment),n=Mn(),a=kn("span"),s=Tn(p),c=Mn(),An(i,"class","PinturaShapeListItem"),An(i,"type","button"),An(i,"aria-label",l="Select shape "+t[276].name),this.first=o},m(e,t){wn(e,o,t),bn(o,i),Aa(r,i,null),bn(i,n),bn(i,a),bn(a,s),bn(o,c),d=!0,u||(h=Pn(i,"click",m),u=!0)},p(e,o){t=e;const n={};1048576&o[0]&&(n.color=t[276].color),r.$set(n),(!d||1048576&o[0])&&p!==(p=t[276].name+"")&&Fn(s,p),(!d||1048576&o[0]&&l!==(l="Select shape "+t[276].name))&&An(i,"aria-label",l)},i(e){d||(xa(r.$$.fragment,e),d=!0)},o(e){va(r.$$.fragment,e),d=!1},d(e){e&&Sn(o),La(r),u=!1,h()}}}function Ey(e){let t,o;return t=new $y({props:{visible:!0,points:e[12],rotatorPoint:e[26],enableDragEdges:e[16],enableDragPoints:e[28],enableRotatePoints:e[14]}}),t.$on("resizestart",e[37]),t.$on("resizemove",e[38]),t.$on("resizeend",e[39]),t.$on("rotatestart",e[40]),t.$on("rotatemove",e[41]),t.$on("rotateend",e[42]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};4096&o[0]&&(i.points=e[12]),67108864&o[0]&&(i.rotatorPoint=e[26]),65536&o[0]&&(i.enableDragEdges=e[16]),268435456&o[0]&&(i.enableDragPoints=e[28]),16384&o[0]&&(i.enableRotatePoints=e[14]),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Iy(e){let t,o,i,r;const n=[Ly,Ay],a=[];function s(e,t){return"modal"===e[4]?0:"inline"===e[4]?1:-1}return~(t=s(e))&&(o=a[t]=n[t](e)),{c(){o&&o.c(),i=Rn()},m(e,o){~t&&a[t].m(e,o),wn(e,i,o),r=!0},p(e,r){let l=t;t=s(e),t===l?~t&&a[t].p(e,r):(o&&(ya(),va(a[l],1,1,(()=>{a[l]=null})),ba()),~t?(o=a[t],o?o.p(e,r):(o=a[t]=n[t](e),o.c()),xa(o,1),o.m(i.parentNode,i)):o=null)},i(e){r||(xa(o),r=!0)},o(e){va(o),r=!1},d(e){~t&&a[t].d(e),e&&Sn(i)}}}function Ay(e){let t,o,i,r,n,a={formatInput:e[44],wrapLines:!!e[13].width,textFormat:e[13].format,enableTextStyleShortcuts:e[5],allowNewline:e[27],style:e[25]};return o=new Sy({props:a}),e[183](o),o.$on("input",e[45]),o.$on("keyup",e[48]),o.$on("cancel",e[50]),o.$on("confirm",e[49]),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"class","PinturaInlineInput"),An(t,"style",e[24])},m(a,s){wn(a,t,s),Aa(o,t,null),i=!0,r||(n=Pn(t,"focusout",e[184]),r=!0)},p(e,r){const n={};8192&r[0]&&(n.wrapLines=!!e[13].width),8192&r[0]&&(n.textFormat=e[13].format),32&r[0]&&(n.enableTextStyleShortcuts=e[5]),134217728&r[0]&&(n.allowNewline=e[27]),33554432&r[0]&&(n.style=e[25]),o.$set(n),(!i||16777216&r[0])&&An(t,"style",e[24])},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(i){i&&Sn(t),e[183](null),La(o),r=!1,n()}}}function Ly(e){let t,o;return t=new yp({props:{panelOffset:e[2],onconfirm:e[49],oncancel:e[50],buttonCancel:{icon:e[6].shapeIconInputCancel,label:e[6].shapeLabelInputCancel},buttonConfirm:{icon:e[6].shapeLabelInputConfirm,label:e[6].shapeIconInputConfirm,hideLabel:!0},$$slots:{default:[zy]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};4&o[0]&&(i.panelOffset=e[2]),64&o[0]&&(i.buttonCancel={icon:e[6].shapeIconInputCancel,label:e[6].shapeLabelInputCancel}),64&o[0]&&(i.buttonConfirm={icon:e[6].shapeLabelInputConfirm,label:e[6].shapeIconInputConfirm,hideLabel:!0}),41943296&o[0]|1&o[9]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function zy(e){let t,o,i;return{c(){t=kn("textarea"),An(t,"spellcheck","false"),An(t,"autocorrect","off"),An(t,"autocapitalize","off"),An(t,"style",e[25])},m(r,n){wn(r,t,n),e[181](t),Dn(t,e[23]),o||(i=[Pn(t,"keydown",e[47]),Pn(t,"keypress",e[46]),Pn(t,"keyup",e[48]),Pn(t,"input",e[45]),Pn(t,"input",e[182])],o=!0)},p(e,o){33554432&o[0]&&An(t,"style",e[25]),8388608&o[0]&&Dn(t,e[23])},d(r){r&&Sn(t),e[181](null),o=!1,Kr(i)}}}function Fy(e){let t,o,i,r,n;return o=new up({props:{items:e[21],key:e[10]}}),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"class","PinturaShapeControls"),An(t,"style",e[22])},m(a,s){wn(a,t,s),Aa(o,t,null),i=!0,r||(n=[Pn(t,"measure",e[185]),hn($c.call(null,t))],r=!0)},p(e,r){const n={};2097152&r[0]&&(n.items=e[21]),1024&r[0]&&(n.key=e[10]),o.$set(n),(!i||4194304&r[0])&&An(t,"style",e[22])},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o),r=!1,Kr(n)}}}function Dy(e){let t,o,i,r,n,s,l,c,d,u,h=[],p=new Map,m=e[20];const g=e=>e[276].id;for(let t=0;t<m.length;t+=1){let o=Ry(e,m,t),i=g(o);p.set(i,h[t]=Py(i,o))}let $=e[15]&&Ey(e),f=e[11]&&Iy(e),y=e[17]>0&&Fy(e);return{c(){t=kn("div"),o=kn("nav"),i=kn("ul");for(let e=0;e<h.length;e+=1)h[e].c();r=Mn(),$&&$.c(),n=Mn(),f&&f.c(),s=Mn(),y&&y.c(),An(o,"class","PinturaShapeList"),An(o,"data-visible",e[18]),An(t,"class","PinturaShapeEditor"),An(t,"tabindex","0")},m(p,m){wn(p,t,m),bn(t,o),bn(o,i);for(let e=0;e<h.length;e+=1)h[e].m(i,null);bn(t,r),$&&$.m(t,null),bn(t,n),f&&f.m(t,null),bn(t,s),y&&y.m(t,null),e[186](t),c=!0,d||(u=[Pn(o,"focusin",e[53]),Pn(o,"focusout",e[54]),Pn(t,"keydown",(function(){Jr(e[0]?a:e[43])&&(e[0]?a:e[43]).apply(this,arguments)})),Pn(t,"nudge",(function(){Jr(e[0]?a:e[52])&&(e[0]?a:e[52]).apply(this,arguments)})),Pn(t,"measure",e[179]),Pn(t,"pointermove",(function(){Jr(e[0]?a:e[55])&&(e[0]?a:e[55]).apply(this,arguments)})),Pn(t,"pointerleave",(function(){Jr(e[0]?a:e[56])&&(e[0]?a:e[56]).apply(this,arguments)})),Pn(t,"interactionstart",(function(){Jr(e[0]?a:e[31])&&(e[0]?a:e[31]).apply(this,arguments)})),Pn(t,"interactionupdate",(function(){Jr(e[0]?a:e[33])&&(e[0]?a:e[33]).apply(this,arguments)})),Pn(t,"interactioncancel",(function(){Jr(e[0]?a:e[32])&&(e[0]?a:e[32]).apply(this,arguments)})),Pn(t,"interactionrelease",(function(){Jr(e[0]?a:e[34])&&(e[0]?a:e[34]).apply(this,arguments)})),Pn(t,"interactionend",(function(){Jr(e[0]?a:e[35])&&(e[0]?a:e[35]).apply(this,arguments)})),hn($c.call(null,t)),hn(pd.call(null,t)),hn(l=hd.call(null,t,{drag:!0,inertia:!0,multiTouch:!1,observeKeys:!0,shouldStartInteraction:Wy,getEventPosition:e[187]}))],d=!0)},p(r,a){e=r,1048706&a[0]&&(m=e[20],ya(),h=Ma(h,a,g,1,e,m,p,i,Ta,Py,null,Ry),ba()),(!c||262144&a[0])&&An(o,"data-visible",e[18]),e[15]?$?($.p(e,a),32768&a[0]&&xa($,1)):($=Ey(e),$.c(),xa($,1),$.m(t,n)):$&&(ya(),va($,1,1,(()=>{$=null})),ba()),e[11]?f?(f.p(e,a),2048&a[0]&&xa(f,1)):(f=Iy(e),f.c(),xa(f,1),f.m(t,s)):f&&(ya(),va(f,1,1,(()=>{f=null})),ba()),e[17]>0?y?(y.p(e,a),131072&a[0]&&xa(y,1)):(y=Fy(e),y.c(),xa(y,1),y.m(t,null)):y&&(ya(),va(y,1,1,(()=>{y=null})),ba()),l&&Jr(l.update)&&8&a[0]&&l.update.call(null,{drag:!0,inertia:!0,multiTouch:!1,observeKeys:!0,shouldStartInteraction:Wy,getEventPosition:e[187]})},i(e){if(!c){for(let e=0;e<m.length;e+=1)xa(h[e]);xa($),xa(f),xa(y),c=!0}},o(e){for(let e=0;e<h.length;e+=1)va(h[e]);va($),va(f),va(y),c=!1},d(o){o&&Sn(t);for(let e=0;e<h.length;e+=1)h[e].d();$&&$.d(),f&&f.d(),y&&y.d(),e[186](null),d=!1,Kr(u)}}}const Oy=256,By="markup-hover",Wy=(e,t)=>e.target===t;function _y(e,t,o){let i,r,n,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,S,k,C,T,M,P,E,I,A,z,F,D,O,B,W,_,V,N,H,j,U,Z,X,Y,q,K,J,Q,ee,te,oe,ie,re,ne,ae,le=Gr,he=()=>(le(),le=en(Ce,(e=>o(175,oe=e))),Ce);e.$$.on_destroy.push((()=>le()));let{uid:me=L()}=t,{ui:$e}=t,{disabled:Se=!1}=t,{shapes:Ce}=t;he();let{selection:Te}=t,{offset:Pe}=t,{contextRotation:Le=0}=t,{contextFlipX:ze=!1}=t,{contextFlipY:De=!1}=t,{contextZoom:Oe=1}=t,{active:Be=!1}=t,{opacity:_e=1}=t,{parentRect:Ve}=t,{rootRect:Ne}=t,{utilRect:He}=t,{hoverColor:je}=t,{caretColor:Ze}=t,{gridColor:Ye}=t,{snapColor:qe}=t,{textInputMode:Ke="inline"}=t,{oninteractionstart:Je=a}=t,{oninteractionupdate:Qe=a}=t,{oninteractionrelease:et=a}=t,{oninteractionend:rt=a}=t,{oninteractioncancel:st=a}=t,{onaddshape:lt=a}=t,{onupdateshape:ct=a}=t,{onselectshape:dt=a}=t,{onblurshape:ut=a}=t,{onremoveshape:ht=a}=t,{ontapshape:pt=a}=t,{onhovershape:mt=a}=t,{onhovercanvas:gt=a}=t,{ontapcanvas:ft=a}=t,{onleavecanvas:yt=a}=t,{beforeSelectShape:bt=(()=>!0)}=t,{beforeDeselectShape:St=(()=>!0)}=t,{beforeRemoveShape:kt=(()=>!0)}=t,{beforeUpdateShape:Ct=((e,t)=>t)}=t,{willRenderShapeControls:Tt=G}=t,{willRenderShapeTextControls:Mt=G}=t,{willStartInteraction:Rt=((e,t)=>!0)}=t,{mapEditorPointToImagePoint:It}=t,{mapImagePointToEditorPoint:At}=t,{eraseRadius:Bt}=t,{selectRadius:Wt}=t,{enableButtonFlipVertical:_t=!1}=t,{enableTapToAddText:Vt=!0}=t,{enableTextStyleControls:Nt=!0}=t,{locale:Ht}=t,{snapThreshold:jt=0}=t,{snapPointer:Ut=!0}=t,{enableSnapToContext:Gt=!0}=t,{gridSize:Zt=0}=t;const Xt=e=>{if(0===jt)return[];let t;return Gt&&(t={...Ve,x:0,y:0}),[...oe.filter((t=>t!==e)).filter((e=>!Fi(e))).map((e=>pr({...e},Ve))),t].filter(Boolean)},Yt=(e,t,o,i)=>0===e?{snapTargets:[]}:{snapThreshold:e,gridSize:t,gridRect:o,snapTargets:Xt(i)},qt=Jn("isAnimated");on(e,qt,(e=>o(176,re=e)));const Kt=e=>e.set(tn(e)),Jt=e=>tn(e).find(Fi),Qt=(e,t)=>{if(!Jt(t))return _i(e),io(e,t)},eo=e=>{Jt(e)&&e.update((e=>e.filter((e=>!Fi(e)))))},to=e=>{const t=Jt(e);if(t)return Vi(t),Kt(e),t},oo=(e,t,o=((e,t)=>({...e,...t})))=>{Jt(t)&&t.update((t=>t.map((t=>Fi(t)?o(t,e):t))))},io=(e,t=Ce)=>(t.update((t=>[...t,e])),e),ro=(e,t,o)=>{const i=Ct({...e},t,{...o});return fr(e,i,o),e},no=(e,t)=>{const o=Re(e,t),i=ye(e,t),r=Math.PI/8,n=r*Math.round(i/r)-Le%r;t.x=e.x+o*Math.cos(n),t.y=e.y+o*Math.sin(n)},ao=Jn("keysPressed");on(e,ao,(e=>o(177,ne=e)));const so=(e,t,o)=>0===e||t&&o?e:t||o?-e:e,lo=e=>{if(null===e.x&&null===e.y)return co();e.x&&o(138,uo=It({x:e.x,y:0}).x),e.y&&o(139,ho=It({x:0,y:e.y}).y)},co=()=>{o(138,uo=null),o(139,ho=null)};let uo=null,ho=null;const po=(e,t)=>{const o=At(e);return It(ve(o,t))},mo=(e,t,o)=>{const i=(o-t)/e+1;return Array.from({length:i},((o,i)=>t+i*e))},go=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(At),r=ot(e),n=e[0],a=e[e.length-1];t=[r.x,r.x+.5*r.width,r.x+r.width,n.x,a.x],o=[r.y,r.y+.5*r.height,r.y+r.height,n.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=ni(e.text,e);i=nt(e.x,e.y,t.width,t.height)}else i=void 0!==e.width?tt(e):tt({x:e.x-e.rx,y:e.y-e.ry,width:2*e.rx,height:2*e.ry});const r=wt(i).map(At),n=Math.abs(e.rotation)>0?$t(i,e.rotation).map(At):r,a=ot(n),s=at(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=At(e);t=[i.x],o=[i.y]}return{x:t,y:o}},$o=(e,t,o)=>{let i,r,n,a=Number.Infinity,s=null,l=null;for(let c=0;c<e.length;c++){r=e[c];for(let e=0;e<t.length;e++)n=t[e],i=Math.abs(r-n),i<o&&(null===l||i<a)&&(a=i,s=r,l=n)}return{origin:s,target:l}},fo=(e,t,o,i,r)=>{const n={x:null,y:null},a={x:null,y:null},s=t.map(go);if(i>0){const e=At({x:0,y:0}),t=At({x:i,y:i}),o=At({x:r.width,y:r.height}),n=t.x-e.x,a=mo(n,e.x,o.x),l=mo(n,e.y,o.y);s.push({x:a,y:l})}return s.forEach((t=>{const{snapTranslation:i,snapLine:r}=((e,t,o)=>{const i={x:null,y:null},r={x:null,y:null},n=$o(e.x,t.x,o);null!==n.target&&(i.x=n.target,r.x=n.target-n.origin);const a=$o(e.y,t.y,o);return null!==a.target&&(i.y=a.target,r.y=a.target-a.origin),{snapTranslation:r,snapLine:i}})(e,t,o);null!==i.x&&(null===a.x||Math.abs(i.x)<Math.abs(a.x))&&(a.x=i.x||0,n.x=r.x),null!==i.y&&(null===a.y||Math.abs(i.y)<Math.abs(a.y))&&(a.y=i.y||0,n.y=r.y)})),{snapTranslation:a,snapLines:n}},yo=(e,t)=>(null!==t.x&&(e.x+=t.x),null!==t.y&&(e.y+=t.y),e),bo=(e,t,o,i)=>{const{snapThreshold:r=0,gridSize:n=0,gridRect:a,snapTargets:s=[]}=i||{};let l=null;if(Pi(e)){if(r){const i=pr({...e},Ve),l=po(wi(t),o),c=po(Si(t),o),d=go({...i,x1:l.x,y1:l.y,x2:c.x,y2:c.y}),{snapTranslation:u,snapLines:h}=fo(d,s,r,n,a);yo(o,u),lo(h)}const i=po(wi(t),o),c=po(Si(t),o);l={x1:i.x,y1:i.y,x2:c.x,y2:c.y}}else if(e.points){if(r){const i=pr({...e},Ve),l=go({...i,points:t.points.map((e=>po(e,o)))}),{snapTranslation:c,snapLines:d}=fo(l,s,r,n,a);yo(o,c),lo(d)}l={points:t.points.map((e=>po(e,o)))}}else if(Mi(e)||ki(e)||Ri(e)){if(r){const i=pr({...e},Ve),l=po(t,o),c=go({...i,...l}),{snapTranslation:d,snapLines:u}=fo(c,s,r,n,a);yo(o,d),lo(u)}l=po(t,o)}l&&(ro(e,l,Ve),Mo())},xo={0:1,1:0,2:3,3:2},vo={0:3,1:2,2:1,3:0};let wo;const So=()=>{if(oe.length)return oe.find(Fi)},ko=()=>{if(oe.length)return oe.findIndex(Fi)},Co=()=>{const e=So();if(e)return Vi(e),Mo(),e},To=()=>{if(!So())return;const e=[...oe];e.splice(ko(),1),Ce.set(e)},Mo=()=>{Ce.set(oe)},Ro=(e,t=[],o=!0)=>{t.filter(Boolean).forEach((t=>delete e[t])),o&&Mo()},Po=(e,t,o=!0)=>{e=Object.assign(e,t),o&&Mo()},Eo=(e,t,o,i=!0)=>{e[t]=o,i&&Mo()},Io=(e,t=!0)=>{oe.forEach((t=>Po(t,e,!1))),t&&Mo()},Lo=()=>[...oe].reverse().find(Li),Fo=()=>!!Lo(),Do=e=>{if(!kt(e))return!1;Ce.set(oe.filter((t=>t!==e))),ht(e)},Oo=()=>{const e=Lo();if(!e)return;const t=oe.filter((e=>ji(e)&&Hi(e))),o=t.findIndex((t=>t===e));if(!1===Do(e))return;if(Bo=e,t.length-1<=0)return Wo();const i=o-1<0?t.length-1:o-1;Vo(t[i])};let Bo=void 0;const Wo=(e={})=>{const{storePrevious:t=!0}=e;Object.keys(ur).forEach((e=>ur[e]={}));const o=_o();t&&(Bo=o),Io({isSelected:!1,isEditing:!1,_prerender:!1}),o&&ut(o)},_o=()=>oe.find(Li),Vo=(e,t=!0)=>{if(Fi(e))return;const o=_o()||Bo,i=Li(e);Bo=void 0,bt(o,e)&&(Wo(),(e=>{e.isSelected=!0})(e),!i&&dt(e),t&&Mo())},jo=e=>{or&&or.confirm&&e.isEditing&&or.confirm(),Po(e,{isSelected:!1,isEditing:!1,_prerender:!1}),ut(e)},Uo=e=>{Po(e,{isSelected:!0,isEditing:!0,_prerender:"inline"===Ke})},Go=e=>{Po(e,{isSelected:!0,isEditing:!1,_prerender:!1})},Zo=e=>{if(!e.length)return[];const t=e.filter(kt);return Ce.set(oe.filter((e=>!t.includes(e)))),t},Xo=e=>{const t=ni(e.text,e);return nt(e.x,e.y,e.width?Math.min(e.width,t.width):t.width,e.height?Math.min(e.height,t.height):t.height)},Yo=e=>{if(Di(e))return tt(e);if(Ri(e))return it(e);const t=Xo(e);return t.width=Math.max(10,e.width||t.width),t},Ko=(e,t,o=0,i=(()=>!0))=>[...e].reverse().filter(i).map((e=>({shape:e,priority:1}))).filter((e=>{const{shape:i}=e,r=pr(fi(i),Ve),n=o+.5*(r.strokeWidth||0);if(Mi(r))return Ot(t,n,r,i.rotation);if(ki(r)){const o=Yo(r),a=Ot(t,n,o,i.rotation);let s=!1;if(a&&!Li(i)){const a=Xo(r);"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=Ot(t,n,a,i.rotation,at(o)),s||(e.priority=-1)}return a}return Ri(r)?((e,t,o,i,r,n)=>{const a=Lt(ue(o.x,o.y),o.rx,o.ry,i,r,n,12);return Dt(e,t,a)})(t,n,r,i.rotation,i.flipX,i.flipY):Pi(r)?zt(t,Math.max(16,n),wi(r),Si(r)):Ei(r)&&r.pathClose?Dt(t,n,r.points):!!Ei(r)&&(1===r.points.length?Me(t,r.points[0])<n*n:Ft(t,Math.max(16,n),r.points))})).sort(((e,t)=>e.priority<t.priority?1:e.priority>t.priority?-1:0)).map((e=>e.shape)),Jo=(e,t,o,i=0)=>{const r=Math.abs(i),n=Ge(t,o),a=Xe(n,r),s=(({start:e,end:t},o)=>{if(0===o)return[ue(e.x,e.y),ue(e.x,e.y),ue(t.x,t.y),ue(t.x,t.y)];const i=Math.atan2(t.y-e.y,t.x-e.x),r=Math.sin(i)*o,n=Math.cos(i)*o;return[ue(r+e.x,-n+e.y),ue(-r+e.x,n+e.y),ue(-r+t.x,n+t.y),ue(r+t.x,-n+t.y)]})(a,r);return e.filter((e=>{const t=pr(fi(e),Ve);if(Pi(t)||Ei(t)){const e=t.points?[...t.points]:[wi(t),Si(t)];return!!Pt(a,e)}return((e,t)=>!!e.find((e=>Et(e,t)))||!!t.find((t=>Et(t,e))))(s,((e,t=12)=>{if(Mi(e))return $t(e,e.rotation,at(e));if(ki(e)){const t=Yo(e);return $t(t,e.rotation,at(t))}return Ri(e)?Lt(ue(e.x,e.y),e.rx,e.ry,e.rotation,e.flipX,e.flipY,t):[]})(t))}))};let Qo=void 0,ei=void 0,ti=void 0,oi=void 0,ii=void 0,ri=void 0,ai=!1,si=!1,li=!1;const ci=()=>{clearTimeout(ei),ei=void 0,o(141,li=!1),co()};let di=null;const ui=e=>{const t=Ao(e.rotation)&&0!==e.rotation;if(Mi(e)){if(e.width<1&&e.height<1)return;const o=at(e),i=wt(e);return(e.flipX||e.flipY)&&Ie(i,e.flipX,e.flipY,o.x,o.y),t?Ae(i,e.rotation,o.x,o.y):i}if(Ri(e)){if(e.rx<1&&e.ry<1)return;const o=e,i=wt(it(e));return(e.flipX||e.flipY)&&Ie(i,e.flipX,e.flipY,o.x,o.y),t?Ae(i,e.rotation,o.x,o.y):i}if(Pi(e))return[wi(e),Si(e)];if(Ei(e)){if(e.bitmap&&!e.pathClose){const t=ot(e.points);t.x-=.5*e.strokeWidth,t.y-=.5*e.strokeWidth,t.width+=e.strokeWidth,t.height+=e.strokeWidth;return ui({...e,...t})}return[...e.points]}if(ki(e)){if(e.width<5&&e.height<5)return;const o=Yo(e);o.width=Math.max(10,o.width);const i=at(o),r=wt(o);return(e.flipX||e.flipY)&&Ie(r,e.flipX,e.flipY,i.x,i.y),t?Ae(r,e.rotation,i.x,i.y):r}return[]},hi=e=>{const t=ui(e);let o,i;return e.flipY?(o=Ee([t[0],t[1]]),i=fe(ue(t[1].x-t[2].x,t[1].y-t[2].y))):(o=Ee([t[2],t[3]]),i=fe(ue(t[2].x-t[1].x,t[2].y-t[1].y))),ke(i,20/Oe),{origin:o,dir:i}},pi=e=>t=>t.id===e,mi=e=>{const t=pi(e);return e=>e.filter((e=>t=>!e(t))(t))},gi=e=>{const t=pi(e),o=mi(e);return()=>$e.update((e=>e.some(t)?o(e):e))},$i=e=>{const t=mi(e);return(...e)=>{$e.update((o=>[...t(o),...e.filter(Boolean)]))}},yi=gi(By),bi=$i(By);let xi;const vi="markup-manipulator-segment-"+me,Ai=(e,t)=>{const o=e[t],i=t-1<0?e[e.length-1]:e[t-1],r=t+1<e.length?e[t+1]:e[0],n=we(pe(i),o);fe(n);const a=ve(ke(n,10),o),s=we(pe(r),o);fe(s);return[a,o,ve(ke(s,10),o)]},zi=gi(vi),Oi=$i(vi),Bi=(e,t)=>{if(jt<=0)return e;if(t)return co(),e;const o=It(e),r=Xt(),{snapTranslation:n,snapLines:a}=fo(go(o),r,jt,Zt,i);return lo(a),yo(e,n),e},Wi=ec(0);on(e,Wi,(e=>o(178,ae=e)));const qi="markup-grid-line-"+me,Ki=gi(qi),Ji=$i(qi),Qi="markup-snap-line",er=gi(Qi),tr=$i(Qi);let or;const ir=e=>{o(8,or.innerHTML=Cy(e),or)},rr=e=>{const t=void 0===e.value?e.innerHTML:e.value,o="text"===r.format?by(t).split(/<br>|<br\/>/g).join("\n").replace(/&nbsp;/g,String.fromCharCode(160)).replace(/&amp;/g,"&"):t;return Ci(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},ar=()=>{const e=rr(or),t=Gi(r,e),o=!0===t?e:t;let i=E.x,n=E.y;if(!r.height){const e=$t({...A},r.rotation),t=ni(o,c),a=$t({x:i,y:n,...t},r.rotation),[s,,l]=e,[d,,u]=a;let h=s,p=d;r.flipX&&(h=l,p=u);const m=we(pe(h),p);i+=m.x,n+=m.y}Po(r,{x:R(P.x)?No(i,Ve.width):i,y:R(P.y)?No(n,Ve.height):n,text:o})},sr=()=>{let e=s;s&&Co(),or&&or.confirm&&or.confirm(),ar(),Go(r),e?lt(r):ct(r)},lr=()=>{s?To():(Po(r,{text:P.text,x:P.x,y:P.y}),Go(r))},cr=(e,t,{flipX:o,flipY:i,rotation:r},n="top left")=>{let a,s;const[l,c,d,u]=$t(e,r),[h,p,m,g]=$t(t,r);if("top center"===n){a=Ee(i?[u,d]:[l,c]),s=Ee(i?[g,m]:[h,p])}else"top right"===n&&!o||"top left"===n&&o?(a=i?d:c,s=i?m:p):(a=i?u:l,s=i?g:h);return we(pe(a),s)},dr=(e,t,o)=>ue(R(e.x)?No(t.x+o.x,Ve.width):t.x+o.x,R(e.y)?No(t.y+o.y,Ve.height):t.y+o.y),ur={},hr=()=>Uo(r),mr=()=>{const e=Ue(ni(r.text,c),(e=>Math.ceil(e))),t=zo(r,"height"),o=!t&&zo(r,"width"),i=r.id;let n=ur[i];n||(ur[i]={},n=ur[i]);const a=e=>{const{width:t,...o}=c,i=ni(r.text,o),n=cr(nt(c.x,c.y,e.width,e.height),nt(c.x,c.y,i.width,i.height),c,"top "+r.textAlign),a=!1!==c.disableNewline;Ro(r,["width","height",a&&"textAlign"]),Po(r,{...dr(r,c,n)})},s=t=>{const o=We(n.width||c.width||e.width,e.height),i=n.textAlign||"left",a=cr(nt(c.x,c.y,t.width,t.height),nt(c.x,c.y,o.width,o.height),c,"top "+i);Ro(r,["height"]),Po(r,{...dr(r,c,a),width:R(r.width)?No(o.width,Ve.width):o.width,textAlign:i})},l=t=>{const o=We(n.width||e.width,n.height||e.height),i=n.textAlign||"left",a=cr(nt(c.x,c.y,t.width,t.height),nt(c.x,c.y,o.width,o.height),c,"top "+i);Po(r,{...dr(r,c,a),width:R(r.width)?No(o.width,Ve.width):o.width,height:R(r.width)?No(o.height,Ve.height):o.height,textAlign:i})};if(t){n.textAlign=r.textAlign,n.width=c.width,n.height=c.height;const e=We(c.width,c.height);Zi(r,"auto-height")?s(e):Zi(r,"auto-width")&&a(e)}else if(o){n.textAlign=r.textAlign,n.width=c.width;const t=We(c.width,e.height);Zi(r,"auto-width")?a(t):Zi(r,"fixed-size")&&l(t)}else{n.textAlign=r.textAlign;const t=We(Math.ceil(e.width),Math.ceil(e.height));Zi(r,"fixed-size")?l(t):Zi(r,"auto-height")&&s(t)}},gr=e=>{e.stopPropagation();const t=r.flipX||!1;Eo(r,"flipX",!t),ct(r)},yr=e=>{e.stopPropagation();const t=r.flipY||!1;Eo(r,"flipY",!t),ct(r)},br=e=>{Eo(r,"opacity",e)},xr=e=>{br(e),ct(r)},vr=e=>{e.stopPropagation(),e.target.blur(),Oo()},wr=e=>{e.stopPropagation();oe.findIndex((e=>e===r))!==oe.length-1&&(Ce.set(oe.filter((e=>e!==r)).concat([r])),ct(r))},Sr=e=>{e.stopPropagation(),kr()},kr=()=>{const e=fi(r);e.id=L();const t=ue(50,-50);if(zo(e,"points")){const o=$r(e,["points"],Ve);o.points.forEach((e=>{e.x+=t.x,e.y+=t.y})),fr(e,o,Ve)}else if(Pi(e)){const o=$r(e,["x1","y1","x2","y2"],Ve);o.x1+=t.x,o.y1+=t.y,o.x2+=t.x,o.y2+=t.y,fr(e,o,Ve)}else{const t=$r(e,["x","y"],Ve);t.x+=50,t.y-=50,fr(e,t,Ve)}Ce.set([...oe,e]),lt(e),Vo(e)},Cr=ec(0,{stiffness:.2,damping:.7});let Tr;on(e,Cr,(e=>o(17,ie=e)));const Mr=(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},Rr=(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 Pr=!1;let Er=de(),Ir=void 0;const Ar=e=>{mt(e),o(142,xi=e)};let Lr;Yn((()=>{er(),Ki(),zi(),yi()}));return e.$$set=e=>{"uid"in e&&o(57,me=e.uid),"ui"in e&&o(58,$e=e.ui),"disabled"in e&&o(0,Se=e.disabled),"shapes"in e&&he(o(1,Ce=e.shapes)),"selection"in e&&o(59,Te=e.selection),"offset"in e&&o(2,Pe=e.offset),"contextRotation"in e&&o(60,Le=e.contextRotation),"contextFlipX"in e&&o(61,ze=e.contextFlipX),"contextFlipY"in e&&o(62,De=e.contextFlipY),"contextZoom"in e&&o(63,Oe=e.contextZoom),"active"in e&&o(64,Be=e.active),"opacity"in e&&o(65,_e=e.opacity),"parentRect"in e&&o(66,Ve=e.parentRect),"rootRect"in e&&o(3,Ne=e.rootRect),"utilRect"in e&&o(67,He=e.utilRect),"hoverColor"in e&&o(68,je=e.hoverColor),"caretColor"in e&&o(69,Ze=e.caretColor),"gridColor"in e&&o(70,Ye=e.gridColor),"snapColor"in e&&o(71,qe=e.snapColor),"textInputMode"in e&&o(4,Ke=e.textInputMode),"oninteractionstart"in e&&o(72,Je=e.oninteractionstart),"oninteractionupdate"in e&&o(73,Qe=e.oninteractionupdate),"oninteractionrelease"in e&&o(74,et=e.oninteractionrelease),"oninteractionend"in e&&o(75,rt=e.oninteractionend),"oninteractioncancel"in e&&o(76,st=e.oninteractioncancel),"onaddshape"in e&&o(77,lt=e.onaddshape),"onupdateshape"in e&&o(78,ct=e.onupdateshape),"onselectshape"in e&&o(79,dt=e.onselectshape),"onblurshape"in e&&o(80,ut=e.onblurshape),"onremoveshape"in e&&o(81,ht=e.onremoveshape),"ontapshape"in e&&o(82,pt=e.ontapshape),"onhovershape"in e&&o(83,mt=e.onhovershape),"onhovercanvas"in e&&o(84,gt=e.onhovercanvas),"ontapcanvas"in e&&o(85,ft=e.ontapcanvas),"onleavecanvas"in e&&o(86,yt=e.onleavecanvas),"beforeSelectShape"in e&&o(87,bt=e.beforeSelectShape),"beforeDeselectShape"in e&&o(88,St=e.beforeDeselectShape),"beforeRemoveShape"in e&&o(89,kt=e.beforeRemoveShape),"beforeUpdateShape"in e&&o(90,Ct=e.beforeUpdateShape),"willRenderShapeControls"in e&&o(91,Tt=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(92,Mt=e.willRenderShapeTextControls),"willStartInteraction"in e&&o(93,Rt=e.willStartInteraction),"mapEditorPointToImagePoint"in e&&o(94,It=e.mapEditorPointToImagePoint),"mapImagePointToEditorPoint"in e&&o(95,At=e.mapImagePointToEditorPoint),"eraseRadius"in e&&o(96,Bt=e.eraseRadius),"selectRadius"in e&&o(97,Wt=e.selectRadius),"enableButtonFlipVertical"in e&&o(98,_t=e.enableButtonFlipVertical),"enableTapToAddText"in e&&o(99,Vt=e.enableTapToAddText),"enableTextStyleControls"in e&&o(5,Nt=e.enableTextStyleControls),"locale"in e&&o(6,Ht=e.locale),"snapThreshold"in e&&o(100,jt=e.snapThreshold),"snapPointer"in e&&o(101,Ut=e.snapPointer),"enableSnapToContext"in e&&o(102,Gt=e.enableSnapToContext),"gridSize"in e&&o(103,Zt=e.gridSize)},e.$$.update=()=>{var t,a;16&e.$$.dirty[2]|1024&e.$$.dirty[3]&&o(166,i=Zt>0?{x:0,y:0,...Ve}:void 0),1&e.$$.dirty[0]|1048576&e.$$.dirty[5]&&o(146,r=!Se&&oe&&(So()||Lo())),4194304&e.$$.dirty[4]&&o(173,n=!!r),4194304&e.$$.dirty[4]&&o(160,s=r&&Fi(r)),4194304&e.$$.dirty[4]|32&e.$$.dirty[5]&&o(10,l=r&&!s?r.id:void 0),8&e.$$.dirty[0]|16&e.$$.dirty[2]|4194304&e.$$.dirty[4]&&o(13,c=Ne&&r&&pr(fi(r),Ve)),4194304&e.$$.dirty[4]|32&e.$$.dirty[5]&&o(144,d=!(!r||!s)),8192&e.$$.dirty[0]|8&e.$$.dirty[2]|4194304&e.$$.dirty[4]&&o(172,u=r&&_e&&ui(c)||[]),4194304&e.$$.dirty[4]&&o(174,h=r&&(Xi(t=r)&&Yi(t)&&!0!==t.disableResize&&(Di(t)||Ti(t)||Ri(t)||Pi(t)||Ei(t)&&zo(t,"pathClose")))&&!Ii(r)),4194304&e.$$.dirty[4]&&o(14,p=r&&(e=>Xi(e)&&!0!==e.disableRotate&&(Di(e)||zo(e,"text")||Ri(e)))(r)&&!Ii(r)),4194304&e.$$.dirty[4]|524288&e.$$.dirty[5]&&o(16,m=h&&zo(r,"text")&&!r.height?[[1,2],[3,0]]:(!r||!Pi(r)&&!Ei(r))&&h),65536&e.$$.dirty[0]|4194304&e.$$.dirty[4]|524288&e.$$.dirty[5]&&o(28,g=!!r&&(!Array.isArray(m)&&h)),4194304&e.$$.dirty[4]|131072&e.$$.dirty[5]&&o(15,$=r&&u.length>1),4&e.$$.dirty[3]|131072&e.$$.dirty[5]&&o(170,f=u.map(At)),4&e.$$.dirty[0]|32768&e.$$.dirty[5]&&o(12,y=f.map((e=>ue(e.x-Pe.x,e.y-Pe.y)))),4194304&e.$$.dirty[4]|262144&e.$$.dirty[5]&&o(27,b=n&&(Ti(r)?!zo(r,"disableNewline")||!r.disableNewline:!1===r.disableNewline)),4&e.$$.dirty[3]|262144&e.$$.dirty[4]&&(xi&&At&&!Li(xi)&&Hi(xi)?(e=>{const t=ui(pr(fi(e),Ve));if(!t)return;const o=t.map(At),i=!!e.pathClose||!(!e.bitmap&&(Ei(e)||Pi(e))),r="hook"===e.selectionStyle,n=r?o.map(((e,t,o)=>({id:By,points:Ai(o,t),strokeColor:[0,0,0,.1],strokeWidth:2}))):[{id:By,points:o.map((e=>ue(e.x+1,e.y+1))),strokeColor:[0,0,0,.1],strokeWidth:2,pathClose:i}],a=r?o.map(((e,t,o)=>({id:By,points:Ai(o,t),strokeColor:je,strokeWidth:2}))):[{id:By,points:o,strokeColor:je,strokeWidth:2,pathClose:i}];bi(...n,...a)})(xi):yi()),61440&e.$$.dirty[0]|8&e.$$.dirty[2]&&o(171,x=$&&p&&_e&&y&&(e=>{const t=hi(e),o=At({x:t.origin.x+t.dir.x,y:t.origin.y+t.dir.y});return{origin:At(t.origin),position:o}})(c)),4&e.$$.dirty[0]|65536&e.$$.dirty[5]&&o(26,v=x&&ue(x.position.x-Pe.x,x.position.y-Pe.y)),4194304&e.$$.dirty[5]&&o(165,C=!!(ne||[]).find((e=>[91,93,17].includes(e)))),256&e.$$.dirty[3]|1024&e.$$.dirty[5]&&o(167,w=!(C||!Ut)),8&e.$$.dirty[2]|4718592&e.$$.dirty[4]|36896&e.$$.dirty[5]&&r&&f&&_e>0&&((e,t,o)=>{if(!Hi(t))return;const i=Ei(t),r=i&&zo(t,"pathClose"),n=r&&(e=>e.strokeWidth&&((e,t)=>{const o=e.strokeColor;return!!o&&(3===o.length||o[3]>0)})(e))(t),a=Fi(t),s=Ii(t),l="hook"===t.selectionStyle,{selectionOpacity:c=1}=t;if(a&&i&&!r)return;const d=[],h=[...f],p=h[h.length-1],m=h[0],g=(s?.05:.1)*e*c,$=g>0,y=(s?.5:1)*e*c,b=y>0,v=[0,0,0],w=[1,1,1],S=s?1:1.5;ne.includes(16)&&p&&o&&no(p,o);const k=h.length&&r&&a&&o?Me(m,o):1/0,C=h.length&&r&&a&&o?Me(p,o):1/0,T=k<=Oy,M=C<=Oy;!T&&o&&h.push(o);const R=h.length>1,P=!!t.pathClose||!(!t.bitmap&&(Ei(t)||Pi(t)))||h.length>2&&T;R&&$&&(l?d.push(...h.map(((e,t,o)=>({id:vi,points:Ai(o,t),strokeColor:v,strokeWidth:2,opacity:g})))):d.push({id:vi,points:h.map((e=>ue(e.x+1,e.y+1))),pathClose:P,strokeColor:v,strokeWidth:2,opacity:g})),r&&$&&d.push(...h.map((e=>({id:vi,...e,rx:2*S,ry:2*S,backgroundColor:v,opacity:g})))),x&&$&&d.push({id:vi,points:[ue(x.origin.x+1,x.origin.y+1),ue(x.position.x+1,x.position.y+1)],strokeColor:v,strokeWidth:2,opacity:g}),R&&b&&(l?d.push(...h.map(((e,t,o)=>({id:vi,points:Ai(o,t),strokeColor:w,strokeWidth:S,opacity:y})))):d.push({id:vi,points:h,pathClose:P,strokeColor:w,strokeWidth:S,backgroundColor:a&&r&&t.backgroundColor&&t.backgroundColor[3]>0?t.backgroundColor:[0,0,0,0],opacity:y})),r&&d.push(...h.map((e=>({id:vi,...e,rx:3*S,ry:3*S,backgroundColor:[.5,.5,.5],strokeWidth:S,strokeColor:w})))),r&&a&&f.length>=3&&d.push({...m,id:vi,rx:S*(T?5:4),ry:S*(T?5:4),backgroundColor:T?je:[.5,.5,.5],strokeWidth:S,strokeColor:w}),r&&a&&n&&!T&&u.length>=2&&d.push({...p,id:vi,rx:S*(M?5:4),ry:S*(M?5:4),backgroundColor:M?je:[.5,.5,.5],strokeWidth:S,strokeColor:w}),x&&b&&!l&&d.push({id:vi,points:[{x:x.origin.x,y:x.origin.y},{x:x.position.x,y:x.position.y}],strokeColor:w,strokeWidth:S,opacity:y}),Oi(...d)})(_e,r,s&&Ei(r)?Bi({...Ir},!w):void 0),4194304&e.$$.dirty[4]&&(r||zi()),262144&e.$$.dirty[4]&&o(168,S=!!xi),65536&e.$$.dirty[4]&&o(169,k=!!oi),524288&e.$$.dirty[4]|28672&e.$$.dirty[5]&&(!Ir||k||S||Bi({...Ir},!w)),256&e.$$.dirty[2]|1028&e.$$.dirty[3]|8390656&e.$$.dirty[5]&&Zt>0&&i&&At&&((e,t,o,i)=>{const r=At({x:0,y:0}),n=At({x:e,y:e}),a=At({x:t.width,y:t.height}),s=n.x-r.x;if(Wi.set(s>6?1:0),i<=0)return Ki();const l=mo(s,r.x,a.x).map((e=>({id:qi,opacity:i,points:[{x:e,y:r.y},{x:e,y:a.y}],strokeWidth:1,strokeColor:o}))),c=mo(s,r.y,a.y).map((e=>({id:qi,opacity:i,points:[{x:r.x,y:e},{x:a.x,y:e}],strokeWidth:1,strokeColor:o})));Ji(...c,...l)})(Zt,i,Ye,ae),512&e.$$.dirty[2]|4&e.$$.dirty[3]|49152&e.$$.dirty[4]|1024&e.$$.dirty[5]&&At&&(C?er():((e,t,o)=>{if(null===e&&null===t)return er();let i,r;null!==e&&(i={id:Qi,strokeColor:o,strokeWidth:1.5,points:[At({x:e,y:0}),At({x:e,y:Ve.height})]}),null!==t&&(r={id:Qi,strokeColor:o,strokeWidth:1.5,points:[At({x:0,y:t}),At({x:Ve.width,y:t})]}),tr(i,r)})(uo,ho,qe)),4&e.$$.dirty[2]&&(e=>{if(!e)return Io({_prerender:!1});const t=oe.find((e=>e.isEditing));t&&Po(t,{_prerender:"inline"===Ke})})(Be),4194304&e.$$.dirty[5]&&ne&&ne.length&&(()=>{const[e]=ne;8!==e&&46!==e||Fo()&&(r.isEditing||setTimeout((()=>Oo()),0))})(),272&e.$$.dirty[0]&&or&&"inline"===Ke&&or.focus(),4194304&e.$$.dirty[4]&&o(164,T=r&&ki(r)),4194304&e.$$.dirty[4]|512&e.$$.dirty[5]&&o(11,M=T&&!1!==Gi(r)&&Ii(r)),2048&e.$$.dirty[0]&&o(159,P=M?{...r}:void 0),16&e.$$.dirty[2]|16&e.$$.dirty[5]&&o(161,E=P&&pr({...P},Ve)),64&e.$$.dirty[5]&&o(163,I=E&&ni(E.text,E)),320&e.$$.dirty[5]&&(A=E&&nt(E.x,E.y,I.width,I.height)),2048&e.$$.dirty[0]|4194304&e.$$.dirty[4]&&o(23,z=M?r.text:""),2056&e.$$.dirty[0]|16&e.$$.dirty[2]|4194304&e.$$.dirty[4]&&o(162,F=Ne&&r&&M&&pr({...fi(r),width:Ao(r.width)?Math.floor(r.width):void 0,height:Ao(r.height)?Math.floor(r.height):void 0},Ve)),2064&e.$$.dirty[0]|128&e.$$.dirty[5]&&o(25,D=M&&((e,t)=>{const{textAlign:o="left",fontFamily:i="sans-serif",fontWeight:r="normal",fontStyle:n="normal",letterSpacing:a="normal",textShadowX:s=0,textShadowY:l=0,textShadowBlur:c=0,textShadowColor:d,textOutlineWidth:u=0,textOutlineColor:h}=e,p="!important",m=`caret-color:${B};text-align:${o}${p};font-family:${i}${p};font-weight:${r}${p};font-style:${n}${p};letter-spacing:${Ao(a)?a+"px":"normal"}${p}`;if("modal"===t)return m;const g=u?`;-webkit-text-stroke:${2*u}px ${Ho(h)} ${p}`:"",$=c||s||l?`;text-shadow:${s}px ${l}px ${c}px ${Ho(d)} ${p}`:"";let f=e.fontSize,y=1,b="";f>1e3&&qo()&&(y=f/1e3,b=`transform-origin:0 0;transform:scale(${y})`,f=1e3);let x=e.lineHeight/y;const v=Ho(e.color),w=.5*Math.max(0,f-x);return`--font-scalar:${y};--bottom-inset:${w}px;padding:${w}px 0 0${p};color:${v}${p};font-size:${f}px${p};line-height:${x}px${p};${m};${b}${g}${$}`})(F,Ke)),2052&e.$$.dirty[0]|536870912&e.$$.dirty[1]|2&e.$$.dirty[2]|128&e.$$.dirty[5]&&o(24,O=M&&((e,t,o,i)=>{let n,a;e.width&&e.height?(n=at(e),a=Fe(e)):(a=ni(r.text,c),a.width=c.width||a.width,n=ue(e.x+.5*a.width,e.y+.5*a.height));const s=Math.max(0,e.fontSize-e.lineHeight)+e.lineHeight,l=At(n);let d=l.x-t.x-.5*a.width,u=l.y-t.y-.5*a.height,h=e.flipX,p=e.flipY,m=e.rotation;ze&&De?(h=!h,p=!p):ze?(h=!h,m=-m):De&&(p=!p,m=-m),m+=i;const g=o*(h?-1:1),$=o*(p?-1:1);return`--line-height:${s}px;width:${a.width}px;height:${a.height}px;transform:translate(${d}px,${u}px) rotate(${m}rad) scale(${g}, ${$})`})(F,Pe,Oe,Le)),128&e.$$.dirty[2]&&(B=Ho(Ze)),2320&e.$$.dirty[0]&&M&&or&&"inline"===Ke&&ir(z),72351744&e.$$.dirty[4]&&o(150,W=r&&!d?r:W),67108864&e.$$.dirty[4]&&o(152,_=W&&Ui(W)),67108864&e.$$.dirty[4]&&o(147,V=W&&Zi(W)),67108864&e.$$.dirty[4]&&o(149,N=W&&(e=>!0!==e.disableDuplicate&&Yi(e))(W)),67108864&e.$$.dirty[4]&&o(148,H=W&&ji(W)),67108864&e.$$.dirty[4]&&o(151,j=W&&(e=>!0!==e.disableReorder)(W)),67108864&e.$$.dirty[4]&&o(145,U=W&&!1!==Gi(W)),67108864&e.$$.dirty[4]&&o(153,Z=W&&zo(W,"backgroundImage")&&Ni(W,"opacity")),4194304&e.$$.dirty[4]&&o(155,X=r&&"html"===r.format),5242880&e.$$.dirty[4]|1&e.$$.dirty[5]&&o(158,Y=r&&(!d||X)),131072&e.$$.dirty[4]|2097160&e.$$.dirty[5]&&Cr.set(Y&&!li?1:0,{hard:!1===re}),4096&e.$$.dirty[0]|12&e.$$.dirty[5]&&o(157,q=Y&&y.length?(a=ot(y),xe(ue(a.x+.5*a.width,a.y),Hd)):q),512&e.$$.dirty[0]|32&e.$$.dirty[2]|4&e.$$.dirty[5]&&o(156,K=q&&Tr&&He&&(e=>{const t=He.x,o=He.y,i=t+He.width;let r=Math.max(e.x-.5*Tr.width,t),n=Math.max(e.y-Tr.height-16,o);return r+Tr.width>i&&(r=i-Tr.width),ue(r,n)})(q)),131072&e.$$.dirty[0]|2&e.$$.dirty[5]&&o(22,J=K&&`transform: translate(${K.x}px, ${K.y}px);opacity:${ie}`),2048&e.$$.dirty[0]&&o(154,Q=M?"text":"shape"),1088&e.$$.dirty[0]|1610612736&e.$$.dirty[2]|32&e.$$.dirty[3]|2145386496&e.$$.dirty[4]|1048577&e.$$.dirty[5]&&o(21,ee="text"===Q&&Mt&&X?Fp((()=>Mt([["div","text-styles",{class:"PinturaShapeControlsGroup"},[...[["bold",{label:"B",style:"font-weight:900;",title:"Bold",shortcut:["CMD","B"]}],["italic",{label:"I",style:"font-family:Times New Roman;font-style:italic;",title:"Italic",shortcut:["CMD","I"]}],["underline",{label:"U",style:"text-decoration:underline;",title:"Underline",shortcut:["CMD","U"]}],["strikeThrough",{label:"S",style:"text-decoration:line-through;",title:"Strikethrough",shortcut:["CMD","S"]}]].map((([e,t])=>["Button","style-"+e,{onclick:()=>document.execCommand(e),...t,style:"font-size:1.25em;text-underline-offset:1px;text-decoration-thickness:1.5px;font-weight:400;"+t.style}]))]],["div","text-reset",{class:"PinturaShapeControlsGroup"},[["Button","style-reset",{onclick:()=>document.execCommand("removeFormat"),style:"font-weight:400;",label:'<span style="font-size:1.25em;font-style:italic;font-family:Times New Roman;text-decoration:underline;">T</span><span style="position:relative;top:.175rem;">&times;</span>',title:"Remove styles"}]]]],l))):"shape"===Q&&Tt&&l?Fp((()=>Tt([Z&&["div","alpha",{class:"PinturaShapeControlsGroup"},[["ToggleSlider","adjust-opacity",{onrelease:xr,onchange:br,step:.01,value:zo(r,"opacity")?r.opacity:1,label:(e,t,o)=>Math.round(e/o*100)+"%",min:0,max:1,direction:"x"}]]],["div","beta",{class:"PinturaShapeControlsGroup"},[_&&["Button","flip-horizontal",{onclick:gr,label:Ht.shapeTitleButtonFlipHorizontal,icon:Ht.shapeIconButtonFlipHorizontal,hideLabel:!0}],_&&_t&&["Button","flip-vertical",{onclick:yr,label:Ht.shapeTitleButtonFlipVertical,icon:Ht.shapeIconButtonFlipVertical,hideLabel:!0}],j&&["Button","to-front",{onclick:wr,label:Ht.shapeTitleButtonMoveToFront,icon:Ht.shapeIconButtonMoveToFront,hideLabel:!0,disabled:oe[oe.length-1]===W}],N&&["Button","duplicate",{onclick:Sr,label:Ht.shapeTitleButtonDuplicate,icon:Ht.shapeIconButtonDuplicate,shortcut:["CMD","D"],hideLabel:!0}],H&&["Button","remove",{onclick:vr,label:Ht.shapeTitleButtonRemove,icon:Ht.shapeIconButtonRemove,shortcut:["Backspace"],hideLabel:!0}]].filter(Boolean)],U&&V&&["div","gamma",{class:"PinturaShapeControlsGroup"},[["Button","text-layout",{onclick:mr,label:uu(Rr,Ht,r),icon:uu(Mr,Ht,r),hideLabel:!0}]]],U&&["div","delta",{class:"PinturaShapeControlsGroup"},[["Button","edit-text",{label:Ht.shapeLabelInputText,onclick:hr}]]]].filter(Boolean),l))):[]),64&e.$$.dirty[0]|1048576&e.$$.dirty[5]&&o(20,te=oe.filter(Hi).filter((e=>e.id)).filter((e=>!Fi(e))).map((e=>({id:e.id,color:ki(e)?e.color:Pi(e)?e.strokeColor:e.backgroundColor,name:e.name||Ht["shapeLabelTool"+Ya(nr(e))]}))))},[Se,Ce,Pe,Ne,Ke,Nt,Ht,Vo,or,Tr,l,M,y,c,p,$,m,ie,Pr,Lr,te,ee,J,z,O,D,v,b,g,qt,ao,e=>{const{origin:t}=e.detail;o(140,oi=void 0),ii=void 0,ri=void 0,ai=!1,ti=void 0,si=!1,co(),clearTimeout(ei),ei=setTimeout((()=>o(141,li=!0)),250);const i=So();if(!i||Ei(i)&&zo(i,"pathClose")||Co(),Qo=It(pe(t)),i&&Ei(i)&&zo(i,"pathClose"))return Je(e);const n=Ko(oe,Qo,Wt,(e=>Hi(e))),a=n.length&&n.shift();if(r&&Ii(r)&&(sr(),Vt&&(si=!0)),!a&&r&&Ii(r)&&jo(r),!Rt(t))return;if(a&&Li(a))return ai=!0,o(140,oi=a),ii=fi(oi),void(ri=pr(fi(oi),Ve));ti=a||void 0;!Je(e)&&a&&(Vo(a),o(140,oi=a),ii=fi(oi),ri=pr(fi(oi),Ve))},e=>{ci(),st(e)},e=>{const{translation:t,ctrlKey:o,metaKey:r,shiftKey:n,position:a}=e.detail;if(oi){if(!Yi(oi))return;if(Ii(oi))return;if(n){let e=Math.abs(t.x),o=Math.abs(t.y);"x"===di&&(o-=64),"y"===di&&(e-=64),e>o?(t.y=0,di="x"):o>e&&(t.x=0,di="y")}else di=null;return bo(oi,ri,t,{...Yt(o||r?0:jt,Zt,i,oi)})}Qe(e)},e=>{ci(),oi?Ii(oi)?lr():e.detail.isTap&&ai&&ki(oi)&&!1!==Gi(oi)&&Uo(oi):et(e)},e=>{const t=ti&&e.detail.isTap;if(e.detail.isTap&&setTimeout((()=>{ft({target:oi||ti,position:Qo},0)})),oi)return pt(oi),i=oi,r=ii,JSON.stringify(i)!==JSON.stringify(r)&&ct(oi),void o(140,oi=void 0);var i,r;const n=_o(),a=!n||St(n,ti||void 0);a&&Wo({storePrevious:!1}),rt(e),a&&t&&Vo(ti)},Wi,e=>{o(141,li=!0),o(140,oi=r),ri=c},e=>{if(!oi)return void o(141,li=!1);const{translation:t,indexes:r,shiftKey:n,ctrlKey:s,metaKey:l}=e.detail;((e,t,o,i,r)=>{const{snapThreshold:n=0,gridSize:s=0,gridRect:l,snapTargets:c=[]}=r||{},d=n?(e,t,o)=>{const{snapTranslation:i,snapLines:r}=fo(go(e),c,n,s,l);yo(t,i),lo(r);const a=po(o(),t);e.x=a.x,e.y=a.y}:a;if(Pi(e)||Ei(e)&&zo(e,"pathClose")){const[r]=o,n=ne.includes(16)?no:(e,t)=>t;let a,s,l;if(Pi(e))0===r?(a=()=>wi(t),s=e=>n(Si(t),e),l=(e,t)=>{e.x1=t.x,e.y1=t.y}):1===r&&(a=()=>Si(t),s=e=>n(wi(t),e),l=(e,t)=>{e.x2=t.x,e.y2=t.y});else{const e=t.points;a=()=>({...e[r]}),s=t=>{const o=e[cy(r-1,e)],i=e[cy(r+1,e)];n(o,t),n(i,t)},l=(e,t)=>e.points[r]=t}const c=po(a(),i);d(c,i,a),s(c),l(e,c)}else if(Di(e)||Ri(e)||Ti(e)){let n,a,s=!1;if(Ri(e))n=it(t);else if(Di(e))n=tt(t);else{s=!0,n=tt(t);const e=ni(t.text,t);n.height=e.height}e.aspectRatio?a=e.aspectRatio:r.shiftKey&&!s&&(a=n.width/n.height);const l=tt(n),c=at(l),u=e.rotation,h=wt(l),p=$t(l,u);if(1===o.length){let t=o[0];e.flipX&&(t=xo[t]),e.flipY&&(t=vo[t]);const[r,n,s,l]=h,m=At(p[t]),g=ve({...m},i),$=It(g);d($,i,(()=>It(m)));const f=ue($.x-p[t].x,$.y-p[t].y),y=ge(pe(f),-u),b=ue(h[t].x+y.x,h[t].y+y.y);let x;0===t&&(x=s),1===t&&(x=l),2===t&&(x=r),3===t&&(x=n);const v=ot([x,b]);if(a){const{width:e,height:t}=xt(v,a),[o,i,r,n]=vt(v);v.width=e,v.height=t,b.y<x.y&&(v.y=r-t),b.x<x.x&&(v.x=i-e)}const w=$t(v,u,c),S=Ee(w),k=ge(w[0],-u,S),C=ge(w[2],-u,S),T=ot([k,C]);ro(e,Ri(e)?ce(T):T,Ve)}else{o=o.map((t=>(e.flipX&&(t=xo[t]),e.flipY&&(t=vo[t]),t)));const[t,r]=o.map((e=>p[e])),n={x:t.x+.5*(r.x-t.x),y:t.y+.5*(r.y-t.y)},[l,m]=o.map((e=>h[e])),[g,$]=o.map((e=>{const t=e+2;return t<4?h[t]:h[t-4]})),f={x:g.x+.5*($.x-g.x),y:g.y+.5*($.y-g.y)},y=At(n),b=ve({...y},i),x=It(b);d(x,i,(()=>It(y)));const v=ue(x.x-n.x,x.y-n.y),w=ge(pe(v),-u),S=we(pe(l),m),k=xe(S,(e=>1-Math.abs(Math.sign(e)))),C=ue(w.x*k.x,w.y*k.y);ve(l,C),ve(m,C);const T=ot(h);if(a){let e=T.width,t=T.height;0===k.y?t=e/a:e=t*a,T.width=e,T.height=t,0===k.y?T.y=f.y-.5*t:T.x=f.x-.5*e}const M=$t(T,u,c),R=Ee(M),P=ge(M[0],-u,R),E=ge(M[2],-u,R),I=ot([P,E]);let A;Ri(e)?A=ce(I):Di(e)?A=I:s&&(A={x:I.x,y:I.y,width:I.width}),ro(e,A,Ve)}}Mo()})(oi,ri,r,t,{shiftKey:n,...Yt(s||l?0:jt,Zt,i,oi)})},e=>{if(!oi)return void o(141,li=!1);Vo(oi);const{isTap:t}=e.detail;t&&pt(oi),o(140,oi=void 0),o(141,li=!1),ct(r)},e=>{wo=hi(c).origin,o(141,li=!0),o(140,oi=r),ri=c},e=>{if(!oi)return void o(141,li=!1);const{translation:t,shiftKey:i}=e.detail;((e,t,o,i)=>{const r=Yo(pr(fi(e),Ve)),n=at(r),a=po(wo,o);let s=ye(a,n)+Math.PI/2;if(i.shiftKey){const e=Math.PI/16;s=e*Math.round(s/e)-Le%e}ro(e,{rotation:s},Ve),Mo()})(oi,0,t,{shiftKey:i})},()=>{oi?(Vo(oi),o(140,oi=void 0),o(141,li=!1),ct(r)):o(141,li=!1)},e=>{const{key:t}=e,o=/escape/i.test(t);if(Fo())return o?(e.preventDefault(),e.stopPropagation(),jo(r)):void(N&&"d"===t&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.stopPropagation(),kr()))},e=>{const t=Gi(r,e);return!0===t?e:t},ar,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(Gi(r,s)!==s)return e.preventDefault()},e=>Ci(r)&&/enter/i.test(e.code)&&!1!==r.disableNewline?e.preventDefault():/arrow/i.test(e.code)?e.stopPropagation():/escape/i.test(e.key)?lr():void 0,e=>{const{key:t,ctrlKey:o,altKey:i}=e;if(/enter/i.test(t)&&(o||i))return sr()},sr,lr,Cr,e=>{const t=Lo();t&&(Ii(t)||Yi(t)&&(o(140,oi=t),ri=pr(fi(oi),Ve),bo(oi,ri,e.detail)))},e=>{o(18,Pr=!0)},({relatedTarget:e})=>{e&&e.classList.contains("shape-selector__button")||o(18,Pr=!1)},e=>{if("touch"===e.pointerType||"PinturaShapeEditor"!==e.target.className)return void yt();(li||ei)&&Ar(void 0);const t=fy(e,Ne);o(143,Ir=pe(t));const i=xe(It(t),(e=>Math.round(e)));if(be(i,Er))return;if(Er=pe(i),gt(li,t,i),li||ei)return;if(d)return;const[r]=Ko(oe,i,0,Hi);r&&Fi(r)||Ar(r)},e=>{"touch"!==e.pointerType&&yt()},me,$e,Te,Le,ze,De,Oe,Be,_e,Ve,He,je,Ze,Ye,qe,Je,Qe,et,rt,st,lt,ct,dt,ut,ht,pt,mt,gt,ft,yt,bt,St,kt,Ct,Tt,Mt,Rt,It,At,Bt,Wt,_t,Vt,jt,Ut,Gt,Zt,Kt,Jt,Qt,eo,to,oo,io,(e,t={})=>{let o,r,n,a=Ri(e),s=ki(e),l="relative"===t.position;const c=Xt(),d=e=>{if(!jt)return e;const t=It(e),{snapTranslation:o,snapLines:r}=fo(go(t),c,jt,Zt,i);return yo(e,o),lo(r),e},u=!!_o(),h=t.isSelection?Te:Ce,p="step"===t.inputMode;if(Ei(e)){if(p){let t=!1;const i=(e,o)=>{const i=Jt(h),r=e&&ue(Ty(e.x,Ve.width),Ty(e.y,Ve.height)),n=r&&At(r);ne.includes(16)&&n&&no(n,o);const a=It(o),s=i.points.length?i.points[0]:a,c=ue(Ty(s.x,Ve.width),Ty(s.y,Ve.height)),d=At(c),u=Me(d,o);if(!t&&1===i.points.length&&u<36)return eo(h);if(i.points.length>2&&u<=Oy){i.pathClose=!0,Hi(i)&&Vo(i);const e=to(h);return void lt(e)}const p=i.strokeWidth&&i.strokeColor&&(void 0===i.strokeColor[3]||i.strokeColor[3]>0),m=Me(n,o);if(p&&i.points.length>1&&m<Oy){i.pathClose=!1,i.backgroundColor=[0,0,0,0],Hi(i)&&Vo(i);const e=to(h);lt(e)}else if(!(i.points.length>0&&m<100))return l?My(a,Ve):a};return{start:e=>{const a=Jt(h),{origin:s}=e.detail;if(r=4,o=d(pe(s)),n=pe(o),a){const e=a.points[a.points.length-1],t=i(e,o);return t&&(a.points=[...a.points,t]),void oo({points:a.points},h)}t=!0},update:e=>{if(!t)return;const r=Jt(h);if(!r)return;const n=r.points[0],a=i(n,ue(o.x+e.detail.translation.x,o.y+e.detail.translation.y));a&&(r.points[1]=a,oo({points:r.points},h))},release:e=>e.detail.preventInertia(),end:i=>{if(!t)return;const r=It(o),n=l?My(r,Ve):r,{isTap:a}=i.detail;if(a){if(Ko(oe,r,0,Hi).length)return eo(h)}Qt({...e,points:[n]},h)}}}return{start:t=>{const{origin:i}=t.detail;r=4,o=pe(i),n=pe(o);const a=It(o),s=l?My(a,Ve):a;Qt({...e,points:[s]},h)},update:e=>{const t=Jt(h),{translation:i}=e.detail,a=ue(o.x+i.x,o.y+i.y),s=Re(n,a);if(se(s,5)<=r)return;const c=ye(a,n),d=r-s;n.x+=d*Math.cos(c),n.y+=d*Math.sin(c);const u=It(n),p=l?My(u,Ve):u;oo({points:t.points.concat(p)},h)},release:e=>e.detail.preventInertia(),cancel:()=>{eo(h)},end:e=>{const t=Jt(h);if(e.detail.isTap){let e=!1;if(t.bitmap?(ti&&(e=!0),u&&(e=!0)):e=!0,e)return eo(h)}const o=to(h);lt(o)}}}return a||s||Mi(e)?{start:t=>{const{origin:i}=t.detail;o=d(pe(i));const r=It(o),n=l?My(r,Ve):r,s=-1*so(Le,ze,De),c={...e,rotation:s,...n};c.flipX=ze,c.flipY=De,delete c.position,c.opacity=0;(a?["rx","ry"]:["width","height"]).forEach((e=>{c[e]=l?"0%":0})),Qt(c,h)},update:e=>{const t=Jt(h);t.opacity=1;let{aspectRatio:i}=t,{translation:r,shiftKey:n,ctrlKey:s}=e.detail;!i&&n&&(i=1);const l=d(ue(o.x+r.x,o.y+r.y)),c=It(o),u=It(l);if(i){const e=ot([c,u]),t=xt(e,i);u.x=c.x+t.width,u.y=c.y+t.height}const p={x:c.x+.5*(u.x-c.x),y:c.y+.5*(u.y-c.y)},m=so(Le,ze,De);ge(c,m,p),ge(u,m,p);const g=Math.min(c.x,u.x),$=Math.min(c.y,u.y);let f=Math.max(c.x,u.x)-g,y=Math.max(c.y,u.y)-$,b={};a?(s?(b.x=c.x,b.y=c.y):(b.x=g+.5*f,b.y=$+.5*y),b.rx=.5*f,b.ry=.5*y):(s?(b.x=c.x-.5*f,b.y=c.y-.5*y):(b.x=g,b.y=$),b.width=f,b.height=y),oo(b,h,((e,t)=>ro(e,t,Ve)))},release:e=>{e.detail.preventInertia()},cancel:e=>{eo(h)},end:e=>{const t=Jt(h);if(e.detail.isTap){if(ki(t)&&Vt&&si)return eo(h);if(!ki(t)||!Vt||ti)return eo(h);delete t.width,delete t.height,!1!==t.disableNewline&&delete t.textAlign;const e=pr({...t},Ve),i=ni(t.text,e),r=It({x:o.x,y:o.y-.5*i.height}),n=It({x:o.x+i.width,y:o.y+.5*i.height}),a={x:r.x+.5*(n.x-r.x),y:r.y+.5*(n.y-r.y)},s=so(Le,ze,De);ge(r,s,a),ge(n,s,a);let l=Math.min(r.x,n.x),c=Math.min(r.y,n.y);l<0&&(l=0),c<0&&(c=0),l+i.width>Ve.width&&(l=Ve.width-i.width),c+i.height>Ve.height&&(c=Ve.height-i.height),t.x=R(t.x)?No(l,Ve.width):l,t.y=R(t.y)?No(c,Ve.height):c}if(t.opacity=1,!ki(t)){const e=to(h);lt(e)}Hi(t)&&Vo(t),ki(t)&&Uo(t)}}:Pi(e)?{start:t=>{const{origin:i}=t.detail,r=It(d(i)),n=xe(r,Hd);o=pe(i),Qt({...e,x1:l?No(n.x,Ve.width):n.x,y1:l?No(n.y,Ve.height):n.y,x2:l?No(n.x,Ve.width):n.x,y2:l?No(n.y,Ve.height):n.y,opacity:0},h)},update:e=>{const{translation:t}=e.detail,i=d(ve(pe(o),t));if(ne.includes(16)){const e=Re(o,i),t=ye(o,i),r=Math.PI/4,n=r*Math.round(t/r);i.x=o.x+e*Math.cos(n),i.y=o.y+e*Math.sin(n)}const r=It(i);oo({x2:l?No(r.x,Ve.width):r.x,y2:l?No(r.y,Ve.height):r.y,opacity:1},h)},release:e=>e.detail.preventInertia(),cancel:e=>{eo(h)},end:e=>{const t=Jt(h);if(e.detail.isTap)return eo(h);t.opacity=1;const o=to(h);lt(o),Hi(t)&&Vo(o)}}:void 0},()=>{let e,t;const o=Bt*Bt,i=(e,t,i=!1)=>{const r=Me(e,t);if(!i&&r<2)return!1;const n=oe.filter((e=>!e.disableErase));let a;a=r<o?Ko(oe,It(t),Bt):Jo(n,It(e),It(t),Bt);return Zo(a).forEach(ht),!0};return{start:o=>{e=ue(Math.round(o.detail.origin.x),Math.round(o.detail.origin.y)),i(e,e,!0),t=e},update:o=>{const{translation:r}=o.detail,n=ue(Math.round(e.x+r.x),Math.round(e.y+r.y));i(t,n)&&(t=pe(n))},release:e=>e.detail.preventInertia(),end:()=>{}}},So,ko,e=>{if(!So())return _i(e),io(e)},Co,To,(e={})=>({id:L(),...e}),Mo,Ro,Po,Eo,(e,t,o=!0)=>{oe.forEach((o=>Eo(o,e,t,!1))),o&&Mo()},Io,Lo,Fo,Do,Oo,Wo,jo,Uo,Go,Zo,Xo,Yo,Ko,Jo,uo,ho,oi,li,xi,Ir,d,U,r,V,H,N,W,j,_,Z,Q,X,K,q,Y,P,s,E,F,I,T,C,i,w,S,k,f,x,u,n,h,oe,re,ne,ae,function(t){Qn.call(this,e,t)},e=>Vo(Ce[e]),function(e){ta[e?"unshift":"push"]((()=>{or=e,o(8,or)}))},function(){z=this.value,o(23,z),o(11,M),o(146,r),o(164,T),o(0,Se),o(175,oe)},function(e){ta[e?"unshift":"push"]((()=>{or=e,o(8,or)}))},()=>{Lr&&Lr.focus()},e=>o(9,Tr=e.detail),function(e){ta[e?"unshift":"push"]((()=>{Lr=e,o(19,Lr)}))},e=>fy(e,Ne)]}class Vy extends Fa{constructor(e){super(),za(this,e,_y,Dy,Qr,{uid:57,ui:58,disabled:0,shapes:1,selection:59,offset:2,contextRotation:60,contextFlipX:61,contextFlipY:62,contextZoom:63,active:64,opacity:65,parentRect:66,rootRect:3,utilRect:67,hoverColor:68,caretColor:69,gridColor:70,snapColor:71,textInputMode:4,oninteractionstart:72,oninteractionupdate:73,oninteractionrelease:74,oninteractionend:75,oninteractioncancel:76,onaddshape:77,onupdateshape:78,onselectshape:79,onblurshape:80,onremoveshape:81,ontapshape:82,onhovershape:83,onhovercanvas:84,ontapcanvas:85,onleavecanvas:86,beforeSelectShape:87,beforeDeselectShape:88,beforeRemoveShape:89,beforeUpdateShape:90,willRenderShapeControls:91,willRenderShapeTextControls:92,willStartInteraction:93,mapEditorPointToImagePoint:94,mapImagePointToEditorPoint:95,eraseRadius:96,selectRadius:97,enableButtonFlipVertical:98,enableTapToAddText:99,enableTextStyleControls:5,locale:6,snapThreshold:100,snapPointer:101,enableSnapToContext:102,gridSize:103,syncShapeCollection:104,getShapeDraft:105,addShapeDraft:106,discardShapeDraft:107,confirmShapeDraft:108,updateShapeDraft:109,addShape:110,createShape:111,eraseShape:112,getMarkupItemDraft:113,getMarkupItemDraftIndex:114,addMarkupItemDraft:115,confirmMarkupItemDraft:116,discardMarkupItemDraft:117,createMarkupItem:118,syncShapes:119,removeMarkupShapeProps:120,updateMarkupShape:121,updateMarkupShapeProperty:122,updateMarkupItemsShapeProperty:123,updateMarkupShapeItems:124,getActiveMarkupItem:125,hasActiveMarkupItem:126,removeShape:127,removeActiveMarkupItem:128,blurShapes:129,selectShape:7,deselectMarkupItem:130,editMarkupItem:131,finishEditMarkupItem:132,removeMarkupItems:133,getTextShapeRect:134,getMarkupShapeRect:135,getShapesNearPosition:136,getShapesBetweenPoints:137},null,[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}get syncShapeCollection(){return this.$$.ctx[104]}get getShapeDraft(){return this.$$.ctx[105]}get addShapeDraft(){return this.$$.ctx[106]}get discardShapeDraft(){return this.$$.ctx[107]}get confirmShapeDraft(){return this.$$.ctx[108]}get updateShapeDraft(){return this.$$.ctx[109]}get addShape(){return this.$$.ctx[110]}get createShape(){return this.$$.ctx[111]}get eraseShape(){return this.$$.ctx[112]}get getMarkupItemDraft(){return this.$$.ctx[113]}get getMarkupItemDraftIndex(){return this.$$.ctx[114]}get addMarkupItemDraft(){return this.$$.ctx[115]}get confirmMarkupItemDraft(){return this.$$.ctx[116]}get discardMarkupItemDraft(){return this.$$.ctx[117]}get createMarkupItem(){return this.$$.ctx[118]}get syncShapes(){return this.$$.ctx[119]}get removeMarkupShapeProps(){return this.$$.ctx[120]}get updateMarkupShape(){return this.$$.ctx[121]}get updateMarkupShapeProperty(){return this.$$.ctx[122]}get updateMarkupItemsShapeProperty(){return this.$$.ctx[123]}get updateMarkupShapeItems(){return this.$$.ctx[124]}get getActiveMarkupItem(){return this.$$.ctx[125]}get hasActiveMarkupItem(){return this.$$.ctx[126]}get removeShape(){return this.$$.ctx[127]}get removeActiveMarkupItem(){return this.$$.ctx[128]}get blurShapes(){return this.$$.ctx[129]}get selectShape(){return this.$$.ctx[7]}get deselectMarkupItem(){return this.$$.ctx[130]}get editMarkupItem(){return this.$$.ctx[131]}get finishEditMarkupItem(){return this.$$.ctx[132]}get removeMarkupItems(){return this.$$.ctx[133]}get getTextShapeRect(){return this.$$.ctx[134]}get getMarkupShapeRect(){return this.$$.ctx[135]}get getShapesNearPosition(){return this.$$.ctx[136]}get getShapesBetweenPoints(){return this.$$.ctx[137]}}function Ny(e){let t,o,i;return o=new up({props:{items:e[2]}}),{c(){t=kn("ul"),Ia(o.$$.fragment),An(t,"class","PinturaShapeStyleList")},m(e,r){wn(e,t,r),Aa(o,t,null),i=!0},p(e,t){const i={};4&t&&(i.items=e[2]),o.$set(i)},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o)}}}function Hy(e){let t,o;return t=new vd({props:{class:"PinturaShapeStyles",elasticity:e[0],$$slots:{default:[jy]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};1&o&&(i.elasticity=e[0]),131076&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function jy(e){let t,o,i;return o=new up({props:{items:e[2]}}),{c(){t=kn("ul"),Ia(o.$$.fragment),An(t,"class","PinturaShapeStyleList")},m(e,r){wn(e,t,r),Aa(o,t,null),i=!0},p(e,t){const i={};4&t&&(i.items=e[2]),o.$set(i)},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o)}}}function Uy(e){let t,o,i,r;const n=[Hy,Ny],a=[];function s(e,t){return e[1]?0:1}return o=s(e),i=a[o]=n[o](e),{c(){t=kn("div"),i.c(),An(t,"style",e[3])},m(e,i){wn(e,t,i),a[o].m(t,null),r=!0},p(e,[l]){let c=o;o=s(e),o===c?a[o].p(e,l):(ya(),va(a[c],1,1,(()=>{a[c]=null})),ba(),i=a[o],i?i.p(e,l):(i=a[o]=n[o](e),i.c()),xa(i,1),i.m(t,null)),(!r||8&l)&&An(t,"style",e[3])},i(e){r||(xa(i),r=!0)},o(e){va(i),r=!1},d(e){e&&Sn(t),a[o].d()}}}function Gy(e,t,o){let i,r,n,a,s,l,{isActive:c=!1}=t,{controls:d=[]}=t,{locale:u}=t,{scrollElasticity:h}=t,{scrollEnable:p=!0}=t,{hideTitles:m=!1}=t,{willRenderControls:g=G}=t;const $=Jn("redrawTrigger");on(e,$,(e=>o(14,a=e)));const f=Jn("env");on(e,f,(e=>o(13,n=e)));const y=Jn("isAnimated");on(e,y,(e=>o(16,l=e)));const b=ec(0,{stiffness:.25,damping:.9});return on(e,b,(e=>o(15,s=e))),e.$$set=e=>{"isActive"in e&&o(8,c=e.isActive),"controls"in e&&o(9,d=e.controls),"locale"in e&&o(10,u=e.locale),"scrollElasticity"in e&&o(0,h=e.scrollElasticity),"scrollEnable"in e&&o(1,p=e.scrollEnable),"hideTitles"in e&&o(11,m=e.hideTitles),"willRenderControls"in e&&o(12,g=e.willRenderControls)},e.$$.update=()=>{65792&e.$$.dirty&&b.set(c?1:0,{hard:!1===l}),33024&e.$$.dirty&&o(3,i=`opacity:${s};${c?"":"pointer-events:none;"}${s<=0?"visibility:hidden":""}`),32256&e.$$.dirty&&o(2,r=a&&g(d.map((e=>["ShapeStyle",e.id,{title:e.componentProps.title,locale:u,hideTitle:m,items:[[e.component,e.id,e.componentProps]]}])),n,(()=>$.set({}))))},[h,p,r,i,$,f,y,b,c,d,u,m,g,n,a,s,l]}class Zy extends Fa{constructor(e){super(),za(this,e,Gy,Uy,Qr,{isActive:8,controls:9,locale:10,scrollElasticity:0,scrollEnable:1,hideTitles:11,willRenderControls:12})}}function Xy(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 Yy(e,t){let o,i,r;return i=new Zy({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=Rn(),Ia(i.$$.fragment),this.first=o},m(e,t){wn(e,o,t),Aa(i,e,t),r=!0},p(e,o){t=e;const r={};128&o&&(r.isActive=t[16]),128&o&&(r.controls=t[6]),2&o&&(r.locale=t[1]),4&o&&(r.scrollElasticity=t[2]),8&o&&(r.scrollEnable=t[3]),16&o&&(r.hideTitles=t[4]),32&o&&(r.willRenderControls=t[5]),i.$set(r)},i(e){r||(xa(i.$$.fragment,e),r=!0)},o(e){va(i.$$.fragment,e),r=!1},d(e){e&&Sn(o),La(i,e)}}}function qy(e){let t,o,i,r=[],n=new Map,a=e[7];const s=e=>e[15];for(let t=0;t<a.length;t+=1){let o=Xy(e,a,t),i=s(o);n.set(i,r[t]=Yy(i,o))}return{c(){t=kn("div");for(let e=0;e<r.length;e+=1)r[e].c();An(t,"class",o=Mc(["PinturaShapeStyleEditor",!e[3]&&"PinturaShapeStyleEditorOverflow",e[0]]))},m(e,o){wn(e,t,o);for(let e=0;e<r.length;e+=1)r[e].m(t,null);i=!0},p(e,[l]){190&l&&(a=e[7],ya(),r=Ma(r,l,s,1,e,a,n,t,Ta,Yy,null,Xy),ba()),(!i||9&l&&o!==(o=Mc(["PinturaShapeStyleEditor",!e[3]&&"PinturaShapeStyleEditorOverflow",e[0]])))&&An(t,"class",o)},i(e){if(!i){for(let e=0;e<a.length;e+=1)xa(r[e]);i=!0}},o(e){for(let e=0;e<r.length;e+=1)va(r[e]);i=!1},d(e){e&&Sn(t);for(let e=0;e<r.length;e+=1)r[e].d()}}}function Ky(e,t,o){let i,r,n,{class:a}=t,{controls:s={}}=t,{shape:l}=t,{onchange:c}=t,{locale:d}=t,{scrollElasticity:u}=t,{scrollEnable:h=!0}=t,{hideTitles:p=!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),"shape"in e&&o(8,l=e.shape),"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,h=e.scrollEnable),"hideTitles"in e&&o(4,p=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,r=l&&Object.keys(l).length&&i&&Ni(l)?(e=>i.filter((t=>t.split("_").every((t=>zo(e,t)&&Ni(e,t))))).map((t=>{const o=(e.settings&&e.settings[t]||{}).control||t,i=t.split("_"),r=i.length>1?i.map((t=>e[t])):e[t];if(P(s[o])){const{title:i,component:n}=s[o](r,(e=>{c({[t]:e})}),{selectedShapeId:e.id});return{id:o,component:up,componentProps:{title:i,items:n}}}let[n,a]=s[o];if(R(n)&&s[n]){const e={...a};[n,a]=s[n],a={...a,...e}}const l=P(a.options)?a.options(e):a.options;return{id:o,component:n,componentProps:{...a,options:l,locale:d,value:r,optionLabelClass:"PinturaButtonLabel",onchange:o=>{const r=C(o)&&!Fo(o)?o.value:o;a.onchange&&a.onchange(r,e);const n=i.length>1?i.reduce(((e,t,o)=>({...e,[t]:Array.isArray(r)?r[o]:r})),{}):{[t]:r};c(n)}}}})).filter(Boolean))(l):[]),1280&e.$$.dirty&&o(7,n=((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",r||[]))},[a,d,u,h,p,m,s,n,l,c,r,i]}class Jy extends Fa{constructor(e){super(),za(this,e,Ky,qy,Qr,{class:0,controls:6,shape:8,onchange:9,locale:1,scrollElasticity:2,scrollEnable:3,hideTitles:4,willRenderControls:5})}}var Qy=e=>/<svg /.test(e);function eb(e){let t,o;return t=new up({props:{items:e[10]}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function tb(e){let t,o,i,r;const n=[ib,ob],a=[];function s(e,t){return e[8]?0:1}return t=s(e),o=a[t]=n[t](e),{c(){o.c(),i=Rn()},m(e,o){a[t].m(e,o),wn(e,i,o),r=!0},p(e,r){let l=t;t=s(e),t===l?a[t].p(e,r):(ya(),va(a[l],1,1,(()=>{a[l]=null})),ba(),o=a[t],o?o.p(e,r):(o=a[t]=n[t](e),o.c()),xa(o,1),o.m(i.parentNode,i))},i(e){r||(xa(o),r=!0)},o(e){va(o),r=!1},d(e){a[t].d(e),e&&Sn(i)}}}function ob(e){let t,o,i,r,n=e[10]&&rb(e);return i=new vd({props:{scrollAutoCancel:e[9],elasticity:e[0],$$slots:{default:[nb]},$$scope:{ctx:e}}}),{c(){t=kn("div"),n&&n.c(),o=Mn(),Ia(i.$$.fragment),An(t,"class","PinturaShapePresetsFlat")},m(e,a){wn(e,t,a),n&&n.m(t,null),bn(t,o),Aa(i,t,null),r=!0},p(e,r){e[10]?n?(n.p(e,r),1024&r&&xa(n,1)):(n=rb(e),n.c(),xa(n,1),n.m(t,o)):n&&(ya(),va(n,1,1,(()=>{n=null})),ba());const a={};512&r&&(a.scrollAutoCancel=e[9]),1&r&&(a.elasticity=e[0]),536871070&r&&(a.$$scope={dirty:r,ctx:e}),i.$set(a)},i(e){r||(xa(n),xa(i.$$.fragment,e),r=!0)},o(e){va(n),va(i.$$.fragment,e),r=!1},d(e){e&&Sn(t),n&&n.d(),La(i)}}}function ib(e){let t,o,i,r,n;o=new vd({props:{elasticity:e[0],class:"PinturaShapePresetsGroups",$$slots:{default:[ub]},$$scope:{ctx:e}}});const a=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[11]},e[12]];let s={$$slots:{default:[pb,({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=Xr(s,a[e]);return r=new Zc({props:s}),{c(){t=kn("div"),Ia(o.$$.fragment),i=Mn(),Ia(r.$$.fragment),An(t,"class","PinturaShapePresetsGrouped")},m(e,a){wn(e,t,a),Aa(o,t,null),bn(t,i),Aa(r,t,null),n=!0},p(e,t){const i={};1&t&&(i.elasticity=e[0]),536876128&t&&(i.$$scope={dirty:t,ctx:e}),o.$set(i);const n=6144&t?Ra(a,[a[0],a[1],2048&t&&{panels:e[11]},4096&t&&Pa(e[12])]):{};738206239&t&&(n.$$scope={dirty:t,ctx:e}),r.$set(n)},i(e){n||(xa(o.$$.fragment,e),xa(r.$$.fragment,e),n=!0)},o(e){va(o.$$.fragment,e),va(r.$$.fragment,e),n=!1},d(e){e&&Sn(t),La(o),La(r)}}}function rb(e){let t,o;return t=new up({props:{items:e[10]}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function nb(e){let t,o;return t=new _d({props:{items:e[7],onclickitem:e[1],ongrabitem:e[2],ondragitem:e[3],ondropitem:e[4]}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function ab(e){let t,o;return t=new up({props:{items:e[10]}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function sb(e){let t,o;return t=new td({props:{$$slots:{default:[lb]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};805306368&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function lb(e){let t,o=e[28].icon+"";return{c(){t=Cn("g")},m(e,i){wn(e,t,i),t.innerHTML=o},p(e,i){268435456&i&&o!==(o=e[28].icon+"")&&(t.innerHTML=o)},d(e){e&&Sn(t)}}}function cb(e){let t,o,i=e[28].label+"";return{c(){t=kn("span"),o=Tn(i)},m(e,i){wn(e,t,i),bn(t,o)},p(e,t){268435456&t&&i!==(i=e[28].label+"")&&Fn(o,i)},d(e){e&&Sn(t)}}}function db(e){let t,o,i,r=e[28].icon&&sb(e),n=!e[28].hideLabel&&cb(e);return{c(){r&&r.c(),t=Mn(),n&&n.c(),o=Rn()},m(e,a){r&&r.m(e,a),wn(e,t,a),n&&n.m(e,a),wn(e,o,a),i=!0},p(e,i){e[28].icon?r?(r.p(e,i),268435456&i&&xa(r,1)):(r=sb(e),r.c(),xa(r,1),r.m(t.parentNode,t)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),e[28].hideLabel?n&&(n.d(1),n=null):n?n.p(e,i):(n=cb(e),n.c(),n.m(o.parentNode,o))},i(e){i||(xa(r),i=!0)},o(e){va(r),i=!1},d(e){r&&r.d(e),e&&Sn(t),n&&n.d(e),e&&Sn(o)}}}function ub(e){let t,o,i,r=e[10]&&ab(e);const n=[{class:"PinturaControlList"},{tabs:e[5]},e[12],{layout:"compact"}];let a={$$slots:{default:[db,({tab:e})=>({28:e}),({tab:e})=>e?268435456:0]},$$scope:{ctx:e}};for(let e=0;e<n.length;e+=1)a=Xr(a,n[e]);return o=new Fc({props:a}),o.$on("select",e[18]),{c(){r&&r.c(),t=Mn(),Ia(o.$$.fragment)},m(e,n){r&&r.m(e,n),wn(e,t,n),Aa(o,e,n),i=!0},p(e,i){e[10]?r?(r.p(e,i),1024&i&&xa(r,1)):(r=ab(e),r.c(),xa(r,1),r.m(t.parentNode,t)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba());const a=4128&i?Ra(n,[n[0],32&i&&{tabs:e[5]},4096&i&&Pa(e[12]),n[3]]):{};805306368&i&&(a.$$scope={dirty:i,ctx:e}),o.$set(a)},i(e){i||(xa(r),xa(o.$$.fragment,e),i=!0)},o(e){va(r),va(o.$$.fragment,e),i=!1},d(e){r&&r.d(e),e&&Sn(t),La(o,e)}}}function hb(e){let t,o;return t=new _d({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(){Ia(t.$$.fragment)},m(e,i){Aa(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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function pb(e){let t,o;return t=new vd({props:{scroll:e[27]?{scrollOffset:0,animate:!1}:void 0,scrollAutoCancel:e[9],elasticity:e[0],$$slots:{default:[hb]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function mb(e){let t,o,i,r;const n=[tb,eb],a=[];function s(e,t){return e[9]?0:e[10]?1:-1}return~(o=s(e))&&(i=a[o]=n[o](e)),{c(){t=kn("div"),i&&i.c(),An(t,"class","PinturaShapePresetsPalette")},m(e,i){wn(e,t,i),~o&&a[o].m(t,null),r=!0},p(e,[r]){let l=o;o=s(e),o===l?~o&&a[o].p(e,r):(i&&(ya(),va(a[l],1,1,(()=>{a[l]=null})),ba()),~o?(i=a[o],i?i.p(e,r):(i=a[o]=n[o](e),i.c()),xa(i,1),i.m(t,null)):i=null)},i(e){r||(xa(i),r=!0)},o(e){va(i),r=!1},d(e){e&&Sn(t),~o&&a[o].d()}}}function gb(e,t,o){let i,r,n,s,l,c,d,u,h,{locale:p}=t,{presets:m}=t,{scrollElasticity:g}=t,{enableSelectImage:$=!0}=t,{willRenderPresetToolbar:f=G}=t,{onaddpreset:y=a}=t,{ongrabpreset:b}=t,{ondragpreset:x}=t,{ondroppreset:v}=t;const w="presets-"+L(),S=(e,t="")=>Qy(e)?e:Lo(e)?_o(e,t):`<img src="${e}" alt="${t}"/>`,k=e=>V(Nt(e)),C=["src","alt","thumb","shape","id","mount","disabled"],T=e=>e.map((e=>(e=>Fo(e)&&R(e[0])&&Fo(e[1]))(e)?{...e[2],id:`${w}-${e[0].toLowerCase()}`,label:e[0],items:T(e[1])}:(e=>{let t,o,i,r,n,a,s,l=e;return R(e)?Lo(e)?(t=e,n=e,r=S(t,n)):(t=e,n=k(t),r=S(t,n)):(t=e.src,n=e.alt||(R(t)?k(t):R(e.thumb)?k(e.thumb):void 0),r=S(e.thumb||t,n),o=e.shape,a=e.mount,s=e.disabled,i=Object.keys(e).reduce(((t,o)=>(C.includes(o)||(t[o]=e[o]),t)),{})),{id:l,src:t,thumb:r,shape:o,shapeProps:i,alt:n,title:n,mount:a,disabled:s}})(e)));return e.$$set=e=>{"locale"in e&&o(14,p=e.locale),"presets"in e&&o(15,m=e.presets),"scrollElasticity"in e&&o(0,g=e.scrollElasticity),"enableSelectImage"in e&&o(16,$=e.enableSelectImage),"willRenderPresetToolbar"in e&&o(17,f=e.willRenderPresetToolbar),"onaddpreset"in e&&o(1,y=e.onaddpreset),"ongrabpreset"in e&&o(2,b=e.ongrabpreset),"ondragpreset"in e&&o(3,x=e.ondragpreset),"ondroppreset"in e&&o(4,v=e.ondroppreset)},e.$$.update=()=>{32768&e.$$.dirty&&o(7,i=T(m)),128&e.$$.dirty&&o(9,r=i.length),640&e.$$.dirty&&o(8,n=r&&i.some((e=>!!e.items))),384&e.$$.dirty&&o(5,s=n&&i),384&e.$$.dirty&&o(13,l=n&&i.reduce(((e,t)=>(e[t.id]=t,e)),{})),96&e.$$.dirty&&o(6,c=c||s&&(s.find((e=>!e.disabled))||{}).id),64&e.$$.dirty&&o(12,d={name:w,selected:c}),32&e.$$.dirty&&o(11,u=s&&s.map((e=>e.id))),212994&e.$$.dirty&&o(10,h=p&&f([$&&["Button","browse",{label:p.shapeLabelButtonSelectSticker,icon:p.shapeIconButtonSelectSticker,onclick:()=>{zp().then((e=>{e&&y(e)}))}}]]))},[g,y,b,x,v,s,c,i,n,r,h,u,d,l,p,m,$,f,({detail:e})=>o(6,c=e)]}class $b extends Fa{constructor(e){super(),za(this,e,gb,mb,Qr,{locale:14,presets:15,scrollElasticity:0,enableSelectImage:16,willRenderPresetToolbar:17,onaddpreset:1,ongrabpreset:2,ondragpreset:3,ondroppreset:4})}}function fb(e){let t,o,i,r;return t=new up({props:{items:e[29]}}),i=new Jy({props:{locale:e[4],shape:e[31]||e[49],onchange:e[86],controls:e[9],scrollEnable:!1,hideTitles:!0,willRenderControls:e[163]}}),{c(){Ia(t.$$.fragment),o=Mn(),Ia(i.$$.fragment)},m(e,n){Aa(t,e,n),wn(e,o,n),Aa(i,e,n),r=!0},p(e,o){const r={};536870912&o[0]&&(r.items=e[29]),t.$set(r);const n={};16&o[0]&&(n.locale=e[4]),262145&o[1]&&(n.shape=e[31]||e[49]),512&o[0]&&(n.controls=e[9]),i.$set(n)},i(e){r||(xa(t.$$.fragment,e),xa(i.$$.fragment,e),r=!0)},o(e){va(t.$$.fragment,e),va(i.$$.fragment,e),r=!1},d(e){La(t,e),e&&Sn(o),La(i,e)}}}function yb(e){let t,o,i;return o=new B$({props:{$$slots:{default:[fb]},$$scope:{ctx:e}}}),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"slot","header")},m(e,r){wn(e,t,r),Aa(o,t,null),i=!0},p(e,t){const i={};536871440&t[0]|262145&t[1]|262144&t[6]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o)}}}function bb(e){let t,o;const i=[{locale:e[4]},{ui:e[69]},{shapes:e[5]},{selection:e[58]},{uid:e[19]},{parentRect:e[37]},{rootRect:e[55]},{utilRect:e[39]},{offset:e[50]},{disabled:e[38]},{contextRotation:e[22]},{contextFlipX:e[23]},{contextFlipY:e[24]},{contextZoom:e[36].scale},{active:e[35]},{opacity:e[56]},{hoverColor:e[57]},{caretColor:e[57]},{gridColor:[1,1,1,.125]},{snapColor:e[57]},{eraseRadius:e[47]},{selectRadius:e[6]},{enableButtonFlipVertical:e[10]},{mapEditorPointToImagePoint:e[20]},{mapImagePointToEditorPoint:e[21]},{enableTapToAddText:e[13]},{textInputMode:e[8]},{snapThreshold:e[15]},{snapPointer:!e[48]},{enableSnapToContext:e[16]},{gridSize:e[14]},{willStartInteraction:e[96]},{oninteractionstart:e[80]},{oninteractionupdate:e[81]},{oninteractionrelease:e[82]},{oninteractionend:e[84]},{oninteractioncancel:e[83]},{onleavecanvas:e[88]},{onhovercanvas:e[87]},{onhovershape:e[90]},{ontapcanvas:e[89]},{onaddshape:e[155]},{onselectshape:e[156]},{onblurshape:e[157]},{ontapshape:e[158]},{onupdateshape:e[159]},{onremoveshape:e[160]},e[42]];let r={};for(let e=0;e<i.length;e+=1)r=Xr(r,i[e]);return t=new Vy({props:r}),e[161](t),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const r=1106896240&o[0]|252381680&o[1]|511443072&o[2]|24&o[3]?Ra(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]},524288&o[0]&&{uid:e[19]},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]},4194304&o[0]&&{contextRotation:e[22]},8388608&o[0]&&{contextFlipX:e[23]},16777216&o[0]&&{contextFlipY:e[24]},32&o[1]&&{contextZoom:e[36].scale},16&o[1]&&{active:e[35]},33554432&o[1]&&{opacity:e[56]},67108864&o[1]&&{hoverColor:e[57]},67108864&o[1]&&{caretColor:e[57]},i[18],67108864&o[1]&&{snapColor:e[57]},65536&o[1]&&{eraseRadius:e[47]},64&o[0]&&{selectRadius:e[6]},1024&o[0]&&{enableButtonFlipVertical:e[10]},1048576&o[0]&&{mapEditorPointToImagePoint:e[20]},2097152&o[0]&&{mapImagePointToEditorPoint:e[21]},8192&o[0]&&{enableTapToAddText:e[13]},256&o[0]&&{textInputMode:e[8]},32768&o[0]&&{snapThreshold:e[15]},131072&o[1]&&{snapPointer:!e[48]},65536&o[0]&&{enableSnapToContext:e[16]},16384&o[0]&&{gridSize:e[14]},8&o[3]&&{willStartInteraction:e[96]},262144&o[2]&&{oninteractionstart:e[80]},524288&o[2]&&{oninteractionupdate:e[81]},1048576&o[2]&&{oninteractionrelease:e[82]},4194304&o[2]&&{oninteractionend:e[84]},2097152&o[2]&&{oninteractioncancel:e[83]},67108864&o[2]&&{onleavecanvas:e[88]},33554432&o[2]&&{onhovercanvas:e[87]},268435456&o[2]&&{onhovershape:e[90]},134217728&o[2]&&{ontapcanvas:e[89]},1073741824&o[0]|16&o[3]&&{onaddshape:e[155]},1073741824&o[0]&&{onselectshape:e[156]},1073741824&o[0]&&{onblurshape:e[157]},1073741824&o[0]&&{ontapshape:e[158]},1073741824&o[0]|16&o[3]&&{onupdateshape:e[159]},1073741824&o[0]|16&o[3]&&{onremoveshape:e[160]},2048&o[1]&&Pa(e[42])]):{};t.$set(r)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(o){e[161](null),La(t,o)}}}function xb(e){let t,o,i,r,n,s=e[51]&&bb(e);return{c(){t=kn("div"),s&&s.c(),An(t,"slot","main"),An(t,"style",o="cursor:"+e[46])},m(o,l){wn(o,t,l),s&&s.m(t,null),e[162](t),i=!0,r||(n=[Pn(t,"keydown",e[85]),hn(bc.call(null,t)),Pn(t,"dropfiles",(function(){Jr(e[12]?e[95]:a)&&(e[12]?e[95]:a).apply(this,arguments)})),hn($c.call(null,t)),Pn(t,"measure",e[151])],r=!0)},p(r,n){(e=r)[51]?s?(s.p(e,n),1048576&n[1]&&xa(s,1)):(s=bb(e),s.c(),xa(s,1),s.m(t,null)):s&&(ya(),va(s,1,1,(()=>{s=null})),ba()),(!i||32768&n[1]&&o!==(o="cursor:"+e[46]))&&An(t,"style",o)},i(e){i||(xa(s),i=!0)},o(e){va(s),i=!1},d(o){o&&Sn(t),s&&s.d(),e[162](null),r=!1,Kr(n)}}}function vb(e){let t,o;return t=new $b({props:{locale:e[4],presets:e[18],enableSelectImage:e[11],willRenderPresetToolbar:e[43],onaddpreset:e[94],ongrabpreset:e[91],ondragpreset:e[92],ondroppreset:e[93],scrollElasticity:e[44]}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),262144&o[0]&&(i.presets=e[18]),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||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function wb(e){let t,o,i,r="stack"===e[7]&&Sb(e),n=(e[53]&&e[34]||"row"===e[7])&&Tb(e);return{c(){r&&r.c(),t=Mn(),n&&n.c(),o=Rn()},m(e,a){r&&r.m(e,a),wn(e,t,a),n&&n.m(e,a),wn(e,o,a),i=!0},p(e,i){"stack"===e[7]?r?(r.p(e,i),128&i[0]&&xa(r,1)):(r=Sb(e),r.c(),xa(r,1),r.m(t.parentNode,t)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),e[53]&&e[34]||"row"===e[7]?n?(n.p(e,i),128&i[0]|4194312&i[1]&&xa(n,1)):(n=Tb(e),n.c(),xa(n,1),n.m(o.parentNode,o)):n&&(ya(),va(n,1,1,(()=>{n=null})),ba())},i(e){i||(xa(r),xa(n),i=!0)},o(e){va(r),va(n),i=!1},d(e){r&&r.d(e),e&&Sn(t),n&&n.d(e),e&&Sn(o)}}}function Sb(e){let t,o,i,r;const n=[Cb,kb],a=[];function s(e,t){return e[45]?0:1}return o=s(e),i=a[o]=n[o](e),{c(){t=kn("div"),i.c(),An(t,"class","PinturaControlPanels")},m(e,i){wn(e,t,i),a[o].m(t,null),r=!0},p(e,r){let l=o;o=s(e),o===l?a[o].p(e,r):(ya(),va(a[l],1,1,(()=>{a[l]=null})),ba(),i=a[o],i?i.p(e,r):(i=a[o]=n[o](e),i.c()),xa(i,1),i.m(t,null))},i(e){r||(xa(i),r=!0)},o(e){va(i),r=!1},d(e){e&&Sn(t),a[o].d()}}}function kb(e){let t,o,i;return o=new Jy({props:{locale:e[4],shape:e[31]||e[49],onchange:e[86],controls:e[9],scrollElasticity:e[44],willRenderControls:e[17]}}),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"class","PinturaControlPanel")},m(e,r){wn(e,t,r),Aa(o,t,null),i=!0},p(e,t){const i={};16&t[0]&&(i.locale=e[4]),262145&t[1]&&(i.shape=e[31]||e[49]),512&t[0]&&(i.controls=e[9]),8192&t[1]&&(i.scrollElasticity=e[44]),131072&t[0]&&(i.willRenderControls=e[17]),o.$set(i)},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o)}}}function Cb(e){let t,o,i;return o=new $b({props:{locale:e[4],presets:e[18],enableSelectImage:e[11],willRenderPresetToolbar:e[43],onaddpreset:e[94],ongrabpreset:e[91],ondragpreset:e[92],ondroppreset:e[93],scrollElasticity:e[44]}}),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"class","PinturaControlPanel")},m(e,r){wn(e,t,r),Aa(o,t,null),i=!0},p(e,t){const i={};16&t[0]&&(i.locale=e[4]),262144&t[0]&&(i.presets=e[18]),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||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o)}}}function Tb(e){let t,o;return t=new vd({props:{class:"PinturaControlListScroller",elasticity:e[44],$$slots:{default:[Lb]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};8192&o[1]&&(i.elasticity=e[44]),131729&o[0]|262155&o[1]|262144&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Mb(e){let t,o;return t=new Wu({props:{locale:e[4],class:"PinturaControlList",optionClass:"PinturaControlListOption",layout:"row",options:e[32],selectedIndex:e[32].findIndex(e[152]),onchange:e[79],$$slots:{option:[Ib,({option:e})=>({203:e}),({option:e})=>[0,0,0,0,0,0,e?131072:0]]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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[152])),16&o[0]|393216&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Rb(e){let t,o;return t=new td({props:{$$slots:{default:[Pb]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};16&o[0]|393216&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Pb(e){let t,o=(P(e[203].icon)?e[203].icon(e[4]):e[203].icon)+"";return{c(){t=Cn("g")},m(e,i){wn(e,t,i),t.innerHTML=o},p(e,i){16&i[0]|131072&i[6]&&o!==(o=(P(e[203].icon)?e[203].icon(e[4]):e[203].icon)+"")&&(t.innerHTML=o)},d(e){e&&Sn(t)}}}function Eb(e){let t,o,i=(P(e[203].label)?e[203].label(e[4]):e[203].label)+"";return{c(){t=kn("span"),o=Tn(i)},m(e,i){wn(e,t,i),bn(t,o)},p(e,t){16&t[0]|131072&t[6]&&i!==(i=(P(e[203].label)?e[203].label(e[4]):e[203].label)+"")&&Fn(o,i)},d(e){e&&Sn(t)}}}function Ib(e){let t,o,i,r=e[203].icon&&Rb(e),n=!e[203].hideLabel&&Eb(e);return{c(){t=kn("div"),r&&r.c(),o=Mn(),n&&n.c(),An(t,"slot","option")},m(e,a){wn(e,t,a),r&&r.m(t,null),bn(t,o),n&&n.m(t,null),i=!0},p(e,i){e[203].icon?r?(r.p(e,i),131072&i[6]&&xa(r,1)):(r=Rb(e),r.c(),xa(r,1),r.m(t,o)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),e[203].hideLabel?n&&(n.d(1),n=null):n?n.p(e,i):(n=Eb(e),n.c(),n.m(t,null))},i(e){i||(xa(r),i=!0)},o(e){va(r),i=!1},d(e){e&&Sn(t),r&&r.d(),n&&n.d()}}}function Ab(e){let t,o;return t=new Jy({props:{locale:e[4],shape:e[31]||e[49],onchange:e[86],controls:e[9],scrollEnable:!1,hideTitles:!0,willRenderControls:e[153]}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),262145&o[1]&&(i.shape=e[31]||e[49]),512&o[0]&&(i.controls=e[9]),131072&o[0]&&(i.willRenderControls=e[153]),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Lb(e){let t,o,i,r=e[34]&&Mb(e),n="row"===e[7]&&Ab(e);return{c(){r&&r.c(),t=Mn(),n&&n.c(),o=Rn()},m(e,a){r&&r.m(e,a),wn(e,t,a),n&&n.m(e,a),wn(e,o,a),i=!0},p(e,i){e[34]?r?(r.p(e,i),8&i[1]&&xa(r,1)):(r=Mb(e),r.c(),xa(r,1),r.m(t.parentNode,t)):r&&(ya(),va(r,1,1,(()=>{r=null})),ba()),"row"===e[7]?n?(n.p(e,i),128&i[0]&&xa(n,1)):(n=Ab(e),n.c(),xa(n,1),n.m(o.parentNode,o)):n&&(ya(),va(n,1,1,(()=>{n=null})),ba())},i(e){i||(xa(r),xa(n),i=!0)},o(e){va(r),va(n),i=!1},d(e){r&&r.d(e),e&&Sn(t),n&&n.d(e),e&&Sn(o)}}}function zb(e){let t,o;return t=new vd({props:{class:"PinturaControlListScroller",elasticity:e[44],$$slots:{default:[Bb]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};8192&o[1]&&(i.elasticity=e[44]),67108880&o[0]|8388608&o[1]|262144&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Fb(e){let t,o;return t=new td({props:{$$slots:{default:[Db]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};16&o[0]|393216&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Db(e){let t,o=(P(e[203].icon)?e[203].icon(e[4]):e[203].icon)+"";return{c(){t=Cn("g")},m(e,i){wn(e,t,i),t.innerHTML=o},p(e,i){16&i[0]|131072&i[6]&&o!==(o=(P(e[203].icon)?e[203].icon(e[4]):e[203].icon)+"")&&(t.innerHTML=o)},d(e){e&&Sn(t)}}}function Ob(e){let t,o,i,r,n,a=(P(e[203].label)?e[203].label(e[4]):e[203].label)+"",s=e[203].icon&&Fb(e);return{c(){t=kn("div"),s&&s.c(),o=Mn(),i=kn("span"),r=Tn(a),An(t,"slot","option")},m(e,a){wn(e,t,a),s&&s.m(t,null),bn(t,o),bn(t,i),bn(i,r),n=!0},p(e,i){e[203].icon?s?(s.p(e,i),131072&i[6]&&xa(s,1)):(s=Fb(e),s.c(),xa(s,1),s.m(t,o)):s&&(ya(),va(s,1,1,(()=>{s=null})),ba()),(!n||16&i[0]|131072&i[6])&&a!==(a=(P(e[203].label)?e[203].label(e[4]):e[203].label)+"")&&Fn(r,a)},i(e){n||(xa(s),n=!0)},o(e){va(s),n=!1},d(e){e&&Sn(t),s&&s.d()}}}function Bb(e){let t,o;return t=new Wu({props:{locale:e[4],class:"PinturaControlList",optionClass:"PinturaControlListOption",layout:"row",options:e[54],selectedIndex:e[54].findIndex(e[154]),onchange:e[78],$$slots:{option:[Ob,({option:e})=>({203:e}),({option:e})=>[0,0,0,0,0,0,e?131072:0]]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),8388608&o[1]&&(i.options=e[54]),67108864&o[0]|8388608&o[1]&&(i.selectedIndex=e[54].findIndex(e[154])),16&o[0]|393216&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Wb(e){let t,o,i,r,n;const a=[wb,vb],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]&&zb(e);return{c(){t=kn("div"),i&&i.c(),r=Mn(),c&&c.c(),An(t,"slot","footer"),An(t,"style",e[40])},m(e,i){wn(e,t,i),~o&&s[o].m(t,null),bn(t,r),c&&c.m(t,null),n=!0},p(e,d){let u=o;o=l(e),o===u?~o&&s[o].p(e,d):(i&&(ya(),va(s[u],1,1,(()=>{s[u]=null})),ba()),~o?(i=s[o],i?i.p(e,d):(i=s[o]=a[o](e),i.c()),xa(i,1),i.m(t,r)):i=null),e[33]?c?(c.p(e,d),4&d[1]&&xa(c,1)):(c=zb(e),c.c(),xa(c,1),c.m(t,null)):c&&(ya(),va(c,1,1,(()=>{c=null})),ba()),(!n||512&d[1])&&An(t,"style",e[40])},i(e){n||(xa(i),xa(c),n=!0)},o(e){va(i),va(c),n=!1},d(e){e&&Sn(t),~o&&s[o].d(),c&&c.d()}}}function _b(e){let t,o;return t=new J$({props:{hasHeader:e[41],$$slots:{footer:[Wb],main:[xb],header:[yb]},$$scope:{ctx:e}}}),t.$on("measure",e[164]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};1024&o[1]&&(i.hasHeader=e[41]),2113929201&o[0]|134216703&o[1]|262144&o[6]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Vb(e,t,o){let i,r,n,a,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,S,k,C,T,M,P,E,I,A,L,z,F,D,O,B,W,_,V,N,H,j,U,Z,X,Y,q,K,J,Q,ee,te,oe,ie,re,ne,ae,se,le,ce,de,he,pe,me,ge,$e,fe,ye=Gr,be=()=>(ye(),ye=en(Pe,(e=>o(35,U=e))),Pe),xe=Gr,ve=()=>(xe(),xe=en(Fe,(e=>o(142,q=e))),Fe),we=Gr,Se=()=>(we(),we=en(mt,(e=>o(37,ie=e))),mt),ke=Gr,Ce=()=>(ke(),ke=en(Ae,(e=>o(149,pe=e))),Ae),Te=Gr,Me=()=>(Te(),Te=en(Ie,(e=>o(56,$e=e))),Ie);e.$$.on_destroy.push((()=>ye())),e.$$.on_destroy.push((()=>xe())),e.$$.on_destroy.push((()=>we())),e.$$.on_destroy.push((()=>ke())),e.$$.on_destroy.push((()=>Te()));let{isActive:Pe}=t;be();let{isActiveFraction:Ie}=t;Me();let{isVisible:Ae}=t;Ce();let{stores:Le}=t,{locale:ze={}}=t,{shapes:Fe}=t;ve();let{toolbar:De=[]}=t,{toolShapes:Oe={}}=t,{toolActive:Be}=t,{toolSelectRadius:We}=t,{toolRetainStyles:_e=!1}=t,{toolbarLayout:Ve="stack"}=t,{textInputMode:Ne}=t,{shapeControls:He={}}=t,{enableButtonFlipVertical:je=!1}=t,{enablePresetSelectImage:Ue=!0}=t,{enablePresetDropImage:Ge=!0}=t,{enableSelectToolToAddShape:Ze=!1}=t,{enableAutoSelectMoveTool:Xe=["line","arrow","path","rectangle","ellipse","text"]}=t,{enableTapToAddText:Ye=!1}=t,{enableMoveTool:qe=!1}=t,{enableViewTool:Ke=!1}=t,{enableToolShareStyles:Je=!0}=t,{gridSize:Qe=0}=t,{snapThreshold:et=0}=t,{enableSnapToContext:tt=!0}=t,{willRenderHeaderTools:ot=G}=t,{willRenderPresetToolbar:it}=t,{willRenderShapeStyleControls:rt}=t,{willStartInteraction:nt}=t,{shapePresets:st=[]}=t,{utilKey:lt}=t,{mapScreenPointToImagePoint:ct}=t,{mapImagePointToScreenPoint:dt}=t,{imageRotation:ut=0}=t,{imageFlipX:ht=!1}=t,{imageFlipY:pt=!1}=t,{parentRect:mt}=t;Se();let{hooks:gt={}}=t;const $t=Jn("selection");on(e,$t,(e=>o(148,ce=e)));const ft=Jn("isAnimated");on(e,ft,(e=>o(139,Z=e)));const bt=Jn("elasticityMultiplier");on(e,bt,(e=>o(143,K=e)));const xt=Jn("ui");on(e,xt,(e=>o(174,de=e)));const vt=Jn("keysPressed");let wt;on(e,vt,(e=>o(146,se=e)));const{env:St,history:kt,rootRect:Ct,rootColorSecondary:Tt,enablePanInput:Mt,enablePanInputStatus:Rt,enableZoomInput:Pt,stageRect:Et,utilRectPadded:It,scrollElasticity:At,imageOverlayMarkup:Lt,imagePreviewModifiers:zt,imageCropRect:Ft,shapePreprocessor:Dt,stageScalar:Ot,imageSelectionRect:Bt,imageTransformsInterpolated:Wt,imageSelectionPan:_t,imageSize:Vt,allowPan:Nt,allowZoom:Ht,allowZoomControls:jt,allowPlayPause:Ut}=Le;on(e,St,(e=>o(140,X=e))),on(e,Ct,(e=>o(55,ge=e))),on(e,Tt,(e=>o(57,fe=e))),on(e,Rt,(e=>o(38,ne=e))),on(e,Et,(e=>o(144,J=e))),on(e,It,(e=>o(39,he=e))),on(e,zt,(e=>o(150,me=e))),on(e,Ft,(e=>o(173,re=e))),on(e,Dt,(e=>o(147,le=e))),on(e,Ot,(e=>o(171,te=e))),on(e,Bt,(e=>o(172,oe=e))),on(e,Wt,(e=>o(36,Q=e))),on(e,_t,(e=>o(170,ee=e))),on(e,Vt,(e=>o(145,ae=e)));let Gt=0,Zt={};const Xt=e=>{const[t,o]=wt[e];let i,r,n="relative"===o.position;const a=n?"0%":0,s=n?"0%":0;Mi(t)||ki(t)?(r=n?"20%":.2*ie.width,i=fi(t),i.x=a,i.y=s,fr(i,{width:r,height:r},ie)):Ri(t)?(r=n?"10%":.1*ie.width,i=fi(t),i.x=a,i.y=s,fr(i,{rx:r,ry:r},ie)):Pi(t)&&(r=n?"10%":.1*ie.width,i=fi(t),i.x1=a,i.y1=s,i.x2=a,i.y2=s),i&&Promise.resolve().then((()=>{lo(ao(i,void 0,r))}))},Yt=e=>ct(fy(e,ge));let qt,Kt,Jt={};let Qt;const eo=e=>{if(!(Ei(e)&&zo(e,"pathClose")))return;const t=[...e.strokeColor];t[3]=1,qt.updateMarkupShape(e,{pathClose:!1,strokeColor:t},!1),qt.removeMarkupShapeProps(e,["backgroundColor"],!1),qt.confirmMarkupItemDraft(),qt.selectShape(e)};let to;const oo=(e,t)=>{if(Ao(e))return e;if(e.endsWith("%")){return parseFloat(e)/100*t.width}};let io=void 0,ro=void 0,no=void 0;const ao=(e,t,o)=>{let i=!1;t||(i=!0,t=D?ct(at(J)):at(re)),t.x-=ie.x||0,t.y-=ie.y||0,(ht||pt)&&(e.flipX=ht,e.flipY=pt);const r=qt.getShapesNearPosition(q,t);if(i&&r.length){const e=.1*Math.min(re.width,re.height);t.x+=Math.round(-e+Math.random()*e*2),t.y+=Math.round(-e+Math.random()*e*2)}if(0!==ut&&(e.rotation=ht&&pt?-ut:ht||pt?ut:-ut),zo(e,"width")&&zo(e,"height")){const{width:o,height:i}=$r(e,["width","height"],ie);fr(e,{x:t.x-.5*o,y:t.y-.5*i},ie)}else if(Ri(e))fr(e,{x:t.x,y:t.y},ie);else if(Pi(e)){const{x1:i,y1:r,x2:n,y2:a}=$r(e,["x1","y1","x2","y2"],ie),s=Re(ue(i,r),ue(n,a)),l=R(o)?ar(o,ie.width):s;fr(e,{x1:t.x-l,y1:t.y+l,x2:t.x+l,y2:t.y-l},ie)}else if(Ei(e)){const{points:o}=$r(e,["points"],ie),i=Ee(o);fr(e,{points:o.map((e=>({x:e.x+t.x-i.x,y:e.y+t.y-i.y})))},ie)}return e},so=(e,t)=>{const o=ao(vi(e,re),t);return e.shape&&(zo(e.shape,"x")&&(o.x=e.shape.x),zo(e.shape,"y")&&(o.y=e.shape.y)),lo(o)},lo=e=>{const{beforeAddShape:t=(()=>!0)}=gt;if(t(e))return qt.addShape(e),qt.selectShape(e),O("addshape",e),kt.write(),e};let co=!1;const uo=()=>{kt.write()};let ho;const po=Jn("redrawTrigger");on(e,po,(e=>o(141,Y=e)));const mo=[],go=ec(Z?20:0);on(e,go,(e=>o(138,j=e)));return e.$$set=e=>{"isActive"in e&&be(o(1,Pe=e.isActive)),"isActiveFraction"in e&&Me(o(2,Ie=e.isActiveFraction)),"isVisible"in e&&Ce(o(3,Ae=e.isVisible)),"stores"in e&&o(101,Le=e.stores),"locale"in e&&o(4,ze=e.locale),"shapes"in e&&ve(o(5,Fe=e.shapes)),"toolbar"in e&&o(102,De=e.toolbar),"toolShapes"in e&&o(103,Oe=e.toolShapes),"toolActive"in e&&o(0,Be=e.toolActive),"toolSelectRadius"in e&&o(6,We=e.toolSelectRadius),"toolRetainStyles"in e&&o(104,_e=e.toolRetainStyles),"toolbarLayout"in e&&o(7,Ve=e.toolbarLayout),"textInputMode"in e&&o(8,Ne=e.textInputMode),"shapeControls"in e&&o(9,He=e.shapeControls),"enableButtonFlipVertical"in e&&o(10,je=e.enableButtonFlipVertical),"enablePresetSelectImage"in e&&o(11,Ue=e.enablePresetSelectImage),"enablePresetDropImage"in e&&o(12,Ge=e.enablePresetDropImage),"enableSelectToolToAddShape"in e&&o(105,Ze=e.enableSelectToolToAddShape),"enableAutoSelectMoveTool"in e&&o(106,Xe=e.enableAutoSelectMoveTool),"enableTapToAddText"in e&&o(13,Ye=e.enableTapToAddText),"enableMoveTool"in e&&o(107,qe=e.enableMoveTool),"enableViewTool"in e&&o(108,Ke=e.enableViewTool),"enableToolShareStyles"in e&&o(109,Je=e.enableToolShareStyles),"gridSize"in e&&o(14,Qe=e.gridSize),"snapThreshold"in e&&o(15,et=e.snapThreshold),"enableSnapToContext"in e&&o(16,tt=e.enableSnapToContext),"willRenderHeaderTools"in e&&o(110,ot=e.willRenderHeaderTools),"willRenderPresetToolbar"in e&&o(111,it=e.willRenderPresetToolbar),"willRenderShapeStyleControls"in e&&o(17,rt=e.willRenderShapeStyleControls),"willStartInteraction"in e&&o(112,nt=e.willStartInteraction),"shapePresets"in e&&o(18,st=e.shapePresets),"utilKey"in e&&o(19,lt=e.utilKey),"mapScreenPointToImagePoint"in e&&o(20,ct=e.mapScreenPointToImagePoint),"mapImagePointToScreenPoint"in e&&o(21,dt=e.mapImagePointToScreenPoint),"imageRotation"in e&&o(22,ut=e.imageRotation),"imageFlipX"in e&&o(23,ht=e.imageFlipX),"imageFlipY"in e&&o(24,pt=e.imageFlipY),"parentRect"in e&&Se(o(25,mt=e.parentRect)),"hooks"in e&&o(113,gt=e.hooks)},e.$$.update=()=>{var t,ee,te,oe;if(4194304&e.$$.dirty[4]&&o(123,i=se.includes(18)),2098176&e.$$.dirty[3]&&(wt&&Oe===wt||o(114,wt=Oe)),16&e.$$.dirty[1]&&Nt.set(U),16&e.$$.dirty[1]&&Ht.set(U),16&e.$$.dirty[1]&&jt.set(U),512&e.$$.dirty[3]&&o(33,r=Array.isArray(De)&&De.length>1&&Array.isArray(De[0][1])),4&e.$$.dirty[1]|512&e.$$.dirty[3]&&o(54,n=r?De.map(((e,t)=>[t,e[0]])):[]),67108864&e.$$.dirty[0]|4&e.$$.dirty[1]|512&e.$$.dirty[3]&&o(137,a=r?De[Gt][1]:De),262144&e.$$.dirty[0]|311296&e.$$.dirty[3]|8192&e.$$.dirty[4]&&o(32,s=((e,{willRenderPresetToolbar:t,shapePresets:o,enableViewTool:i,enableMoveTool:n})=>{let a=0!==o.length||t?e:e.filter((e=>"preset"!==e[0]));return r&&(a=[["move",e=>e.shapeLabelToolMove,{icon:e=>e.shapeIconToolMove}],["view",e=>e.shapeLabelToolView,{icon:e=>e.shapeIconToolView}],...a]),a=n?a:a.filter((e=>"move"!==e[0])),i?a:a.filter((e=>"view"!==e[0]))})(a,{willRenderPresetToolbar:it,shapePresets:st,enableMoveTool:qe,enableViewTool:Ke})),2&e.$$.dirty[1]&&o(135,d=!!s.length),1&e.$$.dirty[0]|2&e.$$.dirty[1]|2048&e.$$.dirty[4]&&d&&void 0===Be&&o(0,Be=s[0][0]),67108865&e.$$.dirty[0]|4&e.$$.dirty[1]|4194304&e.$$.dirty[3]|8192&e.$$.dirty[4]&&r&&o(115,Zt={...Zt,[Gt]:a.map((([e])=>e)).includes(Be)?Be:Zt[Gt]||a[0][0]}),512&e.$$.dirty[0]&&o(134,l=!!Object.keys(He).length),2&e.$$.dirty[1]&&o(34,c=s.length>1),12&e.$$.dirty[1]&&o(53,u=c||r),1&e.$$.dirty[0]&&o(136,h=void 0!==Be),7168&e.$$.dirty[4]&&o(52,p=(!h||d)&&l),268435456&e.$$.dirty[0]&&o(30,O=ho&&(t=ho,(e,o)=>{t.dispatchEvent(vp(e,o))})),1073741825&e.$$.dirty[0]|16&e.$$.dirty[1]&&U&&O&&O("selectcontrol",Be),524288&e.$$.dirty[0]|16&e.$$.dirty[1]|67108864&e.$$.dirty[4]&&(U?un(zt,me[lt]={maskMarkupOpacity:.85},me):delete me[lt]),1&e.$$.dirty[0]|2097152&e.$$.dirty[3]&&o(133,m=Be&&wt[Be]?wt[Be][1]:void 0),512&e.$$.dirty[4]&&o(124,g=m&&m.isSelection?"selection":"shapes"),1073741824&e.$$.dirty[3]|1&e.$$.dirty[4]&&(e=>{if(!qt)return;const t=qt.getShapeDraft($t);t&&(e&&(Kt=t.drawMode),qt.updateShapeDraft({drawMode:e?"subtract":Kt},$t))})("selection"===g&&i),134217729&e.$$.dirty[0]&&Be&&qt){const e=qt.getMarkupItemDraft();e&&eo(e)}if(1&e.$$.dirty[0]&&Be&&qt&&"move"!==Be&&qt.blurShapes(),16&e.$$.dirty[1]|33554432&e.$$.dirty[4]&&o(51,$=pe&&U),256&e.$$.dirty[1]|1048576&e.$$.dirty[4]&&o(50,f=he&&ue(J.x-he.x,J.y-he.y)),512&e.$$.dirty[0]&&o(132,y=Object.keys(He)),16&e.$$.dirty[1]|262144&e.$$.dirty[4]&&o(120,b=U&&q.filter(Li)[0]),16&e.$$.dirty[1]|262144&e.$$.dirty[4]&&o(129,x=U&&q.find((e=>zi(e)))),16&e.$$.dirty[1]|262144&e.$$.dirty[4]&&o(49,v=U&&q.find((e=>Fi(e)))),1&e.$$.dirty[0]|16&e.$$.dirty[1]|2097152&e.$$.dirty[3]&&o(126,w=U&&wt[Be]?rr(fi({...wt[Be][0],...de[lt]?de[lt][Be]:{}})):{}),2097152&e.$$.dirty[3]&&wt&&o(116,Jt={}),1&e.$$.dirty[0]|8454144&e.$$.dirty[3]|260&e.$$.dirty[4]&&o(125,S=w&&Object.keys(w).reduce(((e,t)=>{const o="disableStyle"===t,i="settings"===t,r=!!y.find((e=>e.split("_").includes(t)));if(!o&&!i&&!r)return e;if(void 0===w[t])return e;if(!0===w.disableStyle)return e;if(w.disableStyle&&w.disableStyle.includes(t))return e;if("strokeWidth"===t&&void 0===Jt[t]&&zo(w,"points"))return e[t]=w[t],e;const{share:n=!0}=w.settings&&w.settings[t]||{},a=Je&&n?Jt:Jt[Be]||{};return e[t]=zo(a,t)?a[t]:w[t],e}),{})),e.$$.dirty[4],524289&e.$$.dirty[0]|2048&e.$$.dirty[3]|2&e.$$.dirty[4]&&(_e?((e,t,o)=>{const i=de[e],r=i?i[t]:{};xt.set({...de,[e]:{...i,[t]:{...r,...o}}})})(lt,Be,S):(ee=lt,xt.set({[ee]:{}}))),16&e.$$.dirty[1]|134217728&e.$$.dirty[3]|16777218&e.$$.dirty[4]&&o(31,k=ce&&U?b||S:void 0),1&e.$$.dirty[1]|8388608&e.$$.dirty[4]&&k&&k.lineEnd&&!le&&console.warn("Set shapePreprocessor property to draw lineStart and lineEnd styles.\nhttps://pqina.nl/pintura/docs/v8/api/exports/#createshapepreprocessor"),1&e.$$.dirty[0]|4&e.$$.dirty[4]&&o(48,C=zo(w,"eraseRadius")||zo(w,"points")&&!zo(w,"pathClose")||"move"===Be||"view"===Be),64&e.$$.dirty[1]|4&e.$$.dirty[4]&&o(47,T=w&&void 0!==w.eraseRadius?oo(w.eraseRadius,ie):void 0),16&e.$$.dirty[1]|4194304&e.$$.dirty[4]&&o(130,M=U&&se.includes(32)),1&e.$$.dirty[0]|16&e.$$.dirty[1]&&o(131,P=U&&"view"===Be),192&e.$$.dirty[4]&&o(128,E=P||M),48&e.$$.dirty[4]&&o(127,I=!!E&&(!!x||Gd(document.activeElement))),16&e.$$.dirty[1]|24&e.$$.dirty[4]&&Mt.set(!U||E&&!I),16&e.$$.dirty[1]|8&e.$$.dirty[4]&&Pt.set(!U||!I),64&e.$$.dirty[1]|6&e.$$.dirty[4]&&o(121,A=w.cursorStyle?(({cursorStyle:e,cursorSize:t},o,i)=>{let r;const n=o[t];if(void 0===n?r=oo(t,i):Ao(n)?r=n:R(n)&&(r=dr(t,o[t],i),"strokeWidth"===t&&(r*=.5)),!(r<=0||void 0===r))return{size:r,style:e}})(w,{...w,...S},ie):void 0),67108864&e.$$.dirty[3]|2097152&e.$$.dirty[4]&&o(122,L=no&&(oe=ae,(te=no).x>=0&&te.y>=0&&te.x<=oe.width&&te.y<=oe.height)),524288&e.$$.dirty[0]|160&e.$$.dirty[1]|1929379840&e.$$.dirty[3]|1&e.$$.dirty[4])if(L&&!io&&A&&!ne){const e=A.size*Q.scale,t={id:"cursor-"+lt,x:ro.x,y:ro.y,strokeWidth:.5,strokeColor:[0,0,0]};"ellipse"===A.style&&(t.rx=e,t.ry=e);const o={strokeWidth:2.5,strokeColor:[1,1,1],opacity:.75},r=[{...t,...o},t];if("selection"===g&&i){const t=e,i=ro.x+t,n=ro.y+t+4,a={id:"cursor-"+lt,strokeWidth:.75,strokeColor:[0,0,0],points:[{x:i,y:n},{x:i+4,y:n}]};r.push({...a,...o,strokeWidth:2,points:[{x:i-.5,y:n},{x:i+4.5,y:n}]},a)}(e=>{Lt.update((t=>[...t.filter((e=>e.id!=="cursor-"+lt)),...e]))})(r)}else Lt.update((e=>e.filter((e=>e.id!=="cursor-"+lt))));1&e.$$.dirty[0]|128&e.$$.dirty[1]|956301312&e.$$.dirty[3]&&o(46,z=L?((e,t,o,i,r,n)=>{if(i)return r?"grabbing":"grab";if(e&&!t)return"none";if(!t)return"move"===n?"default":"crosshair";let a=t||o;return Li(a)?zi(a)?"modal"===Ne?"default":"text":Yi(a)?"move":"default":"default"})(A,io,b,ne,false,Be):"default"),264193&e.$$.dirty[0]|262144&e.$$.dirty[3]&&o(45,F="preset"===Be&&(st.length>0||Ue||it)),64&e.$$.dirty[1]&&(D=!zo(ie,"x")&&!zo(ie,"y")),524288&e.$$.dirty[4]&&o(44,B=K*At),262144&e.$$.dirty[3]|196608&e.$$.dirty[4]&&o(43,W=Y&&it?e=>Fp((()=>it(e,so,{...X},(()=>po.set({}))))):G),1048576&e.$$.dirty[3]&&o(42,_=Object.keys(gt).reduce(((e,t)=>("beforeAddShape"===t||void 0===gt[t]||(e[t]=gt[t]),e)),{})),16&e.$$.dirty[1]&&(e=>{q&&Fe.update((t=>t.map((t=>(t._prerender=!!e&&zi(t),t)))))})(U),131072&e.$$.dirty[3]|196608&e.$$.dirty[4]&&o(29,V=Y&&ot([],X,(()=>po.set({})))),536871424&e.$$.dirty[0]&&o(41,N=!!V.length||!!Object.keys(He).some((e=>mo.includes(e)))),16&e.$$.dirty[1]|32768&e.$$.dirty[4]&&Z&&go.set(U?0:20),16384&e.$$.dirty[4]&&o(40,H=j?`transform: translateY(${j}px)`:void 0)},Ut.set(!1),[Be,Pe,Ie,Ae,ze,Fe,We,Ve,Ne,He,je,Ue,Ge,Ye,Qe,et,tt,rt,st,lt,ct,dt,ut,ht,pt,mt,Gt,qt,ho,V,O,k,s,r,c,U,Q,ie,ne,he,H,N,_,W,B,F,z,T,C,v,f,$,p,u,n,ge,$e,fe,$t,ft,bt,xt,vt,St,Ct,Tt,Rt,Et,It,Lt,zt,Ft,Dt,Ot,Bt,Wt,_t,Vt,({index:e},t)=>{o(26,Gt=e),o(0,Be=Zt[e])},({value:e},t)=>{o(0,Be=e),(Ze||/enter/i.test(t.key))&&Xt(e)},e=>{if("eraser"===Be)Qt=qt.eraseShape();else if(Be&&wt[Be]){const[e,t={}]=wt[Be],{drawMode:o}=k;"selection"===g&&"new"===o&&$t.set([]);let r={};"selection"===g&&(O("selectiondown",[...ce]),i&&(Kt=e.drawMode,r.drawMode="subtract")),Qt=qt.createShape({...e,...S,...r},t)}else Qt=void 0;return!!Qt&&(Qt.start(e),!0)},e=>!!Qt&&(Qt.update(e),!0),e=>!!Qt&&(Qt.release(e),!0),e=>!!Qt&&(Qt.cancel(e),Qt=void 0,!0),e=>{if(!Qt)return!1;if(Qt.end(e),Qt=void 0,"selection"===g){if(e.detail.isTap){const[e]=wt[Be];e.bitmap||$t.set([])}O("selectionup",[...ce])}const t=qt.getMarkupItemDraft(),i=qe&&(!0===Xe||Array.isArray(Xe)&&Xe.includes(Be));return t&&!t.isEditing||!i||o(0,Be="move"),!0},e=>{const{key:t}=e,o=qt.getMarkupItemDraft();/escape/i.test(t)&&o&&(e.preventDefault(),e.stopPropagation(),qt.discardMarkupItemDraft(),Qt=void 0),/enter/i.test(t)&&o&&(e.preventDefault(),e.stopPropagation(),eo(o),Qt=void 0)},function(e){Object.keys(e).forEach((t=>{const{retain:i=!0,share:r=!0}=w.settings&&w.settings[t]||{};i&&(Je&&r?o(116,Jt[t]=e[t],Jt):(Jt[Be]||o(116,Jt[Be]={},Jt),o(116,Jt[Be][t]=e[t],Jt)))})),O("selectstyle",e),b&&(qt.updateMarkupShape(b,e),clearTimeout(to),to=setTimeout((()=>{uo()}),200))},(e,t,i)=>{o(118,ro=t),o(119,no=i)},()=>{o(119,no=void 0),o(118,ro=void 0)},e=>{O("markuptap",e)},e=>o(117,io=e),()=>{co=!1},(e,t)=>{if(co)return;const{beforeAddShape:o=(()=>!0)}=gt,i=Yt(t),r=qt.getMarkupItemDraft(),n=yt(re,{x:i.x+(ie.x||0),y:i.y+(ie.y||0)});if(r&&!n&&qt.discardMarkupItemDraft(),n){if(!r){const r=vi(e,re),n=ao(r,i);return o(n)?(_i(n),void qt.addShape(n)):(co=!0,void t.preventDefault())}Mi(r)&&(i.x-=.5*r.width,i.y-=.5*r.height),e.shape&&(zo(e.shape,"x")&&(i.x=e.shape.x),zo(e.shape,"y")&&(i.y=e.shape.y)),qt.updateMarkupShape(r,i)}},(e,t)=>{if(co)return;const o=Yt(t);if(!yt(re,{x:o.x+(ie.x||0),y:o.y+(ie.y||0)}))return void qt.discardMarkupItemDraft();const i=qt.confirmMarkupItemDraft();qt.selectShape(i),O("addshape",i),kt.write()},e=>so(e),e=>{return t=e.detail.resources,o=Yt(e.detail.event),t.forEach((e=>so(e,o)));var t,o},e=>{if(!nt)return!0;const t=rectClone(oe);return rectScale(t,1/te),rectTranslate(t,ee),rectScale(t,Q.scale),nt(e,{...t,x:t.x+J.x,y:t.y+J.y})},uo,po,mo,go,Le,De,Oe,_e,Ze,Xe,qe,Ke,Je,ot,it,nt,gt,wt,Zt,Jt,io,ro,no,b,A,L,i,g,S,w,I,E,x,M,P,y,m,l,d,h,a,j,Z,X,Y,q,K,J,ae,se,le,ce,pe,me,function(t){Qn.call(this,e,t)},e=>e[0]===Be,(e,t,o)=>{const i=e.filter((([,e])=>!mo.includes(e)));return rt?rt(i,t,o):i},e=>e[0]===Gt,e=>{Promise.resolve().then((()=>{O("addshape",e),uo()}))},e=>{O("selectshape",e)},e=>{Promise.resolve().then((()=>{O("blurshape",e)}))},e=>{O("tapshape",e)},e=>{O("updateshape",e),uo()},e=>{O("removeshape",e),uo()},function(e){ta[e?"unshift":"push"]((()=>{qt=e,o(27,qt)}))},function(e){ta[e?"unshift":"push"]((()=>{ho=e,o(28,ho)}))},e=>e.filter((([,e])=>mo.includes(e))),function(t){Qn.call(this,e,t)}]}class Nb extends Fa{constructor(e){super(),za(this,e,Vb,_b,Qr,{isActive:1,isActiveFraction:2,isVisible:3,stores:101,locale:4,shapes:5,toolbar:102,toolShapes:103,toolActive:0,toolSelectRadius:6,toolRetainStyles:104,toolbarLayout:7,textInputMode:8,shapeControls:9,enableButtonFlipVertical:10,enablePresetSelectImage:11,enablePresetDropImage:12,enableSelectToolToAddShape:105,enableAutoSelectMoveTool:106,enableTapToAddText:13,enableMoveTool:107,enableViewTool:108,enableToolShareStyles:109,gridSize:14,snapThreshold:15,enableSnapToContext:16,willRenderHeaderTools:110,willRenderPresetToolbar:111,willRenderShapeStyleControls:17,willStartInteraction:112,shapePresets:18,utilKey:19,mapScreenPointToImagePoint:20,mapImagePointToScreenPoint:21,imageRotation:22,imageFlipX:23,imageFlipY:24,parentRect:25,hooks:113},null,[-1,-1,-1,-1,-1,-1,-1])}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$$set({isActive:e}),pa()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),pa()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$$set({isVisible:e}),pa()}get stores(){return this.$$.ctx[101]}set stores(e){this.$$set({stores:e}),pa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),pa()}get shapes(){return this.$$.ctx[5]}set shapes(e){this.$$set({shapes:e}),pa()}get toolbar(){return this.$$.ctx[102]}set toolbar(e){this.$$set({toolbar:e}),pa()}get toolShapes(){return this.$$.ctx[103]}set toolShapes(e){this.$$set({toolShapes:e}),pa()}get toolActive(){return this.$$.ctx[0]}set toolActive(e){this.$$set({toolActive:e}),pa()}get toolSelectRadius(){return this.$$.ctx[6]}set toolSelectRadius(e){this.$$set({toolSelectRadius:e}),pa()}get toolRetainStyles(){return this.$$.ctx[104]}set toolRetainStyles(e){this.$$set({toolRetainStyles:e}),pa()}get toolbarLayout(){return this.$$.ctx[7]}set toolbarLayout(e){this.$$set({toolbarLayout:e}),pa()}get textInputMode(){return this.$$.ctx[8]}set textInputMode(e){this.$$set({textInputMode:e}),pa()}get shapeControls(){return this.$$.ctx[9]}set shapeControls(e){this.$$set({shapeControls:e}),pa()}get enableButtonFlipVertical(){return this.$$.ctx[10]}set enableButtonFlipVertical(e){this.$$set({enableButtonFlipVertical:e}),pa()}get enablePresetSelectImage(){return this.$$.ctx[11]}set enablePresetSelectImage(e){this.$$set({enablePresetSelectImage:e}),pa()}get enablePresetDropImage(){return this.$$.ctx[12]}set enablePresetDropImage(e){this.$$set({enablePresetDropImage:e}),pa()}get enableSelectToolToAddShape(){return this.$$.ctx[105]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),pa()}get enableAutoSelectMoveTool(){return this.$$.ctx[106]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),pa()}get enableTapToAddText(){return this.$$.ctx[13]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),pa()}get enableMoveTool(){return this.$$.ctx[107]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),pa()}get enableViewTool(){return this.$$.ctx[108]}set enableViewTool(e){this.$$set({enableViewTool:e}),pa()}get enableToolShareStyles(){return this.$$.ctx[109]}set enableToolShareStyles(e){this.$$set({enableToolShareStyles:e}),pa()}get gridSize(){return this.$$.ctx[14]}set gridSize(e){this.$$set({gridSize:e}),pa()}get snapThreshold(){return this.$$.ctx[15]}set snapThreshold(e){this.$$set({snapThreshold:e}),pa()}get enableSnapToContext(){return this.$$.ctx[16]}set enableSnapToContext(e){this.$$set({enableSnapToContext:e}),pa()}get willRenderHeaderTools(){return this.$$.ctx[110]}set willRenderHeaderTools(e){this.$$set({willRenderHeaderTools:e}),pa()}get willRenderPresetToolbar(){return this.$$.ctx[111]}set willRenderPresetToolbar(e){this.$$set({willRenderPresetToolbar:e}),pa()}get willRenderShapeStyleControls(){return this.$$.ctx[17]}set willRenderShapeStyleControls(e){this.$$set({willRenderShapeStyleControls:e}),pa()}get willStartInteraction(){return this.$$.ctx[112]}set willStartInteraction(e){this.$$set({willStartInteraction:e}),pa()}get shapePresets(){return this.$$.ctx[18]}set shapePresets(e){this.$$set({shapePresets:e}),pa()}get utilKey(){return this.$$.ctx[19]}set utilKey(e){this.$$set({utilKey:e}),pa()}get mapScreenPointToImagePoint(){return this.$$.ctx[20]}set mapScreenPointToImagePoint(e){this.$$set({mapScreenPointToImagePoint:e}),pa()}get mapImagePointToScreenPoint(){return this.$$.ctx[21]}set mapImagePointToScreenPoint(e){this.$$set({mapImagePointToScreenPoint:e}),pa()}get imageRotation(){return this.$$.ctx[22]}set imageRotation(e){this.$$set({imageRotation:e}),pa()}get imageFlipX(){return this.$$.ctx[23]}set imageFlipX(e){this.$$set({imageFlipX:e}),pa()}get imageFlipY(){return this.$$.ctx[24]}set imageFlipY(e){this.$$set({imageFlipY:e}),pa()}get parentRect(){return this.$$.ctx[25]}set parentRect(e){this.$$set({parentRect:e}),pa()}get hooks(){return this.$$.ctx[113]}set hooks(e){this.$$set({hooks:e}),pa()}}var Hb=(e,t,o,i,r,n,a,s,l)=>{const c=pe(e),d=.5*o.width,u=.5*o.height,h=.5*t.width,p=.5*t.height,m=r.x+i.x,g=r.y+i.y;s&&(c.x=o.width-c.x),l&&(c.y=o.height-c.y);const $=Math.cos(n),f=Math.sin(n);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+=h,c.y+=p,c.x+=m,c.y+=g,c.x-=d*a,c.y-=u*a;const x=(r.x-m)*a,v=(r.y-g)*a,w=x*$-v*f,S=x*f+v*$;return c.x+=w,c.y+=S,c},jb=(e,t,o,i,r,n,a,s,l)=>{const c=pe(e),d=Ne(o),u=Ne(t),h=ue(r.x+i.x,r.y+i.y),p=Math.cos(n),m=Math.sin(n);c.x-=u.x,c.y-=u.y;const g=(r.x-h.x)*a,$=(r.y-h.y)*a,f=g*p-$*m,y=g*m+$*p;c.x-=f,c.y-=y,c.x-=h.x,c.y-=h.y,c.x/=a,c.y/=a;const b=c.x*p+c.y*m,x=c.x*m-c.y*p;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},Ub=e=>"boolean"==typeof e;function Gb(e){let t,o,i;function r(t){e[58](t)}let n={utilKey:"annotate",stores:e[4],locale:e[5],isActive:e[1],isActiveFraction:e[2],isVisible:e[3],mapScreenPointToImagePoint:e[43],mapImagePointToScreenPoint:e[42],imageRotation:e[44],imageFlipX:e[41],imageFlipY:e[40],shapes:e[46],toolbar:e[20]||e[6],toolShapes:e[21]||e[7],toolRetainStyles:e[8],enableSelectToolToAddShape:e[29],enableTapToAddText:e[30],enableViewTool:e[28],enableMoveTool:e[32],enableAutoSelectMoveTool:e[31],snapThreshold:e[15],gridSize:Ao(e[17])?e[17]:e[14],enableSnapToContext:Ub(e[18])?e[18]:e[16],enableToolShareStyles:e[12],shapeControls:e[22]||e[9],shapePresets:e[26],enableButtonFlipVertical:e[23],parentRect:e[47],enablePresetDropImage:e[25],enablePresetSelectImage:e[24],toolSelectRadius:e[10],textInputMode:e[11],willStartInteraction:e[13],willRenderPresetToolbar:e[27]||e[19],hooks:{willRenderShapeControls:e[33],willRenderShapeTextControls:e[34],beforeAddShape:e[35],beforeRemoveShape:e[36],beforeDeselectShape:e[37],beforeSelectShape:e[38],beforeUpdateShape:e[39]}};return void 0!==e[0]&&(n.toolActive=e[0]),t=new Nb({props:n}),ta.push((()=>Ea(t,"toolActive",r))),t.$on("measure",e[59]),{c(){Ia(t.$$.fragment)},m(e,o){Aa(t,e,o),i=!0},p(e,i){const r={};16&i[0]&&(r.stores=e[4]),32&i[0]&&(r.locale=e[5]),2&i[0]&&(r.isActive=e[1]),4&i[0]&&(r.isActiveFraction=e[2]),8&i[0]&&(r.isVisible=e[3]),4096&i[1]&&(r.mapScreenPointToImagePoint=e[43]),2048&i[1]&&(r.mapImagePointToScreenPoint=e[42]),8192&i[1]&&(r.imageRotation=e[44]),1024&i[1]&&(r.imageFlipX=e[41]),512&i[1]&&(r.imageFlipY=e[40]),1048640&i[0]&&(r.toolbar=e[20]||e[6]),2097280&i[0]&&(r.toolShapes=e[21]||e[7]),256&i[0]&&(r.toolRetainStyles=e[8]),536870912&i[0]&&(r.enableSelectToolToAddShape=e[29]),1073741824&i[0]&&(r.enableTapToAddText=e[30]),268435456&i[0]&&(r.enableViewTool=e[28]),2&i[1]&&(r.enableMoveTool=e[32]),1&i[1]&&(r.enableAutoSelectMoveTool=e[31]),32768&i[0]&&(r.snapThreshold=e[15]),147456&i[0]&&(r.gridSize=Ao(e[17])?e[17]:e[14]),327680&i[0]&&(r.enableSnapToContext=Ub(e[18])?e[18]:e[16]),4096&i[0]&&(r.enableToolShareStyles=e[12]),4194816&i[0]&&(r.shapeControls=e[22]||e[9]),67108864&i[0]&&(r.shapePresets=e[26]),8388608&i[0]&&(r.enableButtonFlipVertical=e[23]),33554432&i[0]&&(r.enablePresetDropImage=e[25]),16777216&i[0]&&(r.enablePresetSelectImage=e[24]),1024&i[0]&&(r.toolSelectRadius=e[10]),2048&i[0]&&(r.textInputMode=e[11]),8192&i[0]&&(r.willStartInteraction=e[13]),134742016&i[0]&&(r.willRenderPresetToolbar=e[27]||e[19]),508&i[1]&&(r.hooks={willRenderShapeControls:e[33],willRenderShapeTextControls:e[34],beforeAddShape:e[35],beforeRemoveShape:e[36],beforeDeselectShape:e[37],beforeSelectShape:e[38],beforeUpdateShape:e[39]}),!o&&1&i[0]&&(o=!0,r.toolActive=e[0],ca((()=>o=!1))),t.$set(r)},i(e){i||(xa(t.$$.fragment,e),i=!0)},o(e){va(t.$$.fragment,e),i=!1},d(e){La(t,e)}}}function Zb(e,t,o){let i,r,n,a,s,l,c,d,u;let{isActive:h}=t,{isActiveFraction:p}=t,{isVisible:m}=t,{stores:g}=t,{locale:$={}}=t,{markupEditorToolbar:f}=t,{markupEditorToolStyles:y}=t,{markupEditorToolRetainStyles:b}=t,{markupEditorShapeStyleControls:x}=t,{markupEditorToolSelectRadius:v}=t,{markupEditorTextInputMode:w}=t,{markupEditorToolShareStyles:S}=t,{markupEditorWillStartInteraction:k}=t,{markupEditorGridSize:C=0}=t,{markupEditorSnapThreshold:T=0}=t,{markupEditorSnapToContext:M=!1}=t,{annotateGridSize:R}=t,{annotateSnapToContext:P}=t,{willRenderShapePresetToolbar:E}=t,{annotateTools:I}=t,{annotateToolShapes:A}=t,{annotateShapeControls:L}=t,{annotateActiveTool:z}=t,{annotateEnableButtonFlipVertical:F=!1}=t,{annotateEnableSelectImagePreset:D=!1}=t,{annotateEnableDropImagePreset:O=!0}=t,{annotatePresets:B=[]}=t,{annotateWillRenderShapePresetToolbar:W}=t,{enableViewTool:_}=t,{enableSelectToolToAddShape:V}=t,{enableTapToAddText:N}=t,{enableAutoSelectMoveTool:H}=t,{enableMoveTool:j}=t,{willRenderShapeControls:U}=t,{willRenderShapeTextControls:G}=t,{beforeAddShape:Z}=t,{beforeRemoveShape:X}=t,{beforeDeselectShape:Y}=t,{beforeSelectShape:q}=t,{beforeUpdateShape:K}=t;const{rootRect:J,imageAnnotation:Q,imageSize:ee,imageRotation:te,imageFlipX:oe,imageFlipY:ie,imageTransforms:re,imageTransformsInterpolated:ne}=g;return on(e,J,(e=>o(57,d=e))),on(e,ee,(e=>o(56,c=e))),on(e,te,(e=>o(44,u=e))),on(e,oe,(e=>o(41,a=e))),on(e,ie,(e=>o(40,n=e))),on(e,re,(e=>o(55,l=e))),on(e,ne,(e=>o(54,s=e))),e.$$set=e=>{"isActive"in e&&o(1,h=e.isActive),"isActiveFraction"in e&&o(2,p=e.isActiveFraction),"isVisible"in e&&o(3,m=e.isVisible),"stores"in e&&o(4,g=e.stores),"locale"in e&&o(5,$=e.locale),"markupEditorToolbar"in e&&o(6,f=e.markupEditorToolbar),"markupEditorToolStyles"in e&&o(7,y=e.markupEditorToolStyles),"markupEditorToolRetainStyles"in e&&o(8,b=e.markupEditorToolRetainStyles),"markupEditorShapeStyleControls"in e&&o(9,x=e.markupEditorShapeStyleControls),"markupEditorToolSelectRadius"in e&&o(10,v=e.markupEditorToolSelectRadius),"markupEditorTextInputMode"in e&&o(11,w=e.markupEditorTextInputMode),"markupEditorToolShareStyles"in e&&o(12,S=e.markupEditorToolShareStyles),"markupEditorWillStartInteraction"in e&&o(13,k=e.markupEditorWillStartInteraction),"markupEditorGridSize"in e&&o(14,C=e.markupEditorGridSize),"markupEditorSnapThreshold"in e&&o(15,T=e.markupEditorSnapThreshold),"markupEditorSnapToContext"in e&&o(16,M=e.markupEditorSnapToContext),"annotateGridSize"in e&&o(17,R=e.annotateGridSize),"annotateSnapToContext"in e&&o(18,P=e.annotateSnapToContext),"willRenderShapePresetToolbar"in e&&o(19,E=e.willRenderShapePresetToolbar),"annotateTools"in e&&o(20,I=e.annotateTools),"annotateToolShapes"in e&&o(21,A=e.annotateToolShapes),"annotateShapeControls"in e&&o(22,L=e.annotateShapeControls),"annotateActiveTool"in e&&o(0,z=e.annotateActiveTool),"annotateEnableButtonFlipVertical"in e&&o(23,F=e.annotateEnableButtonFlipVertical),"annotateEnableSelectImagePreset"in e&&o(24,D=e.annotateEnableSelectImagePreset),"annotateEnableDropImagePreset"in e&&o(25,O=e.annotateEnableDropImagePreset),"annotatePresets"in e&&o(26,B=e.annotatePresets),"annotateWillRenderShapePresetToolbar"in e&&o(27,W=e.annotateWillRenderShapePresetToolbar),"enableViewTool"in e&&o(28,_=e.enableViewTool),"enableSelectToolToAddShape"in e&&o(29,V=e.enableSelectToolToAddShape),"enableTapToAddText"in e&&o(30,N=e.enableTapToAddText),"enableAutoSelectMoveTool"in e&&o(31,H=e.enableAutoSelectMoveTool),"enableMoveTool"in e&&o(32,j=e.enableMoveTool),"willRenderShapeControls"in e&&o(33,U=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(34,G=e.willRenderShapeTextControls),"beforeAddShape"in e&&o(35,Z=e.beforeAddShape),"beforeRemoveShape"in e&&o(36,X=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(37,Y=e.beforeDeselectShape),"beforeSelectShape"in e&&o(38,q=e.beforeSelectShape),"beforeUpdateShape"in e&&o(39,K=e.beforeUpdateShape)},e.$$.update=()=>{125830656&e.$$.dirty[1]&&o(43,i=e=>jb(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,n)),125830656&e.$$.dirty[1]&&o(42,r=e=>Hb(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,n))},[z,h,p,m,g,$,f,y,b,x,v,w,S,k,C,T,M,R,P,E,I,A,L,F,D,O,B,W,_,V,N,H,j,U,G,Z,X,Y,q,K,n,a,r,i,u,J,Q,ee,te,oe,ie,re,ne,"annotate",s,l,c,d,function(e){z=e,o(0,z)},function(t){Qn.call(this,e,t)}]}var Xb={util:["annotate",class extends Fa{constructor(e){super(),za(this,e,Zb,Gb,Qr,{name:53,isActive:1,isActiveFraction:2,isVisible:3,stores:4,locale:5,markupEditorToolbar:6,markupEditorToolStyles:7,markupEditorToolRetainStyles:8,markupEditorShapeStyleControls:9,markupEditorToolSelectRadius:10,markupEditorTextInputMode:11,markupEditorToolShareStyles:12,markupEditorWillStartInteraction:13,markupEditorGridSize:14,markupEditorSnapThreshold:15,markupEditorSnapToContext:16,annotateGridSize:17,annotateSnapToContext:18,willRenderShapePresetToolbar:19,annotateTools:20,annotateToolShapes:21,annotateShapeControls:22,annotateActiveTool:0,annotateEnableButtonFlipVertical:23,annotateEnableSelectImagePreset:24,annotateEnableDropImagePreset:25,annotatePresets:26,annotateWillRenderShapePresetToolbar:27,enableViewTool:28,enableSelectToolToAddShape:29,enableTapToAddText:30,enableAutoSelectMoveTool:31,enableMoveTool:32,willRenderShapeControls:33,willRenderShapeTextControls:34,beforeAddShape:35,beforeRemoveShape:36,beforeDeselectShape:37,beforeSelectShape:38,beforeUpdateShape:39},null,[-1,-1])}get name(){return this.$$.ctx[53]}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$$set({isActive:e}),pa()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),pa()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$$set({isVisible:e}),pa()}get stores(){return this.$$.ctx[4]}set stores(e){this.$$set({stores:e}),pa()}get locale(){return this.$$.ctx[5]}set locale(e){this.$$set({locale:e}),pa()}get markupEditorToolbar(){return this.$$.ctx[6]}set markupEditorToolbar(e){this.$$set({markupEditorToolbar:e}),pa()}get markupEditorToolStyles(){return this.$$.ctx[7]}set markupEditorToolStyles(e){this.$$set({markupEditorToolStyles:e}),pa()}get markupEditorToolRetainStyles(){return this.$$.ctx[8]}set markupEditorToolRetainStyles(e){this.$$set({markupEditorToolRetainStyles:e}),pa()}get markupEditorShapeStyleControls(){return this.$$.ctx[9]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),pa()}get markupEditorToolSelectRadius(){return this.$$.ctx[10]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),pa()}get markupEditorTextInputMode(){return this.$$.ctx[11]}set markupEditorTextInputMode(e){this.$$set({markupEditorTextInputMode:e}),pa()}get markupEditorToolShareStyles(){return this.$$.ctx[12]}set markupEditorToolShareStyles(e){this.$$set({markupEditorToolShareStyles:e}),pa()}get markupEditorWillStartInteraction(){return this.$$.ctx[13]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),pa()}get markupEditorGridSize(){return this.$$.ctx[14]}set markupEditorGridSize(e){this.$$set({markupEditorGridSize:e}),pa()}get markupEditorSnapThreshold(){return this.$$.ctx[15]}set markupEditorSnapThreshold(e){this.$$set({markupEditorSnapThreshold:e}),pa()}get markupEditorSnapToContext(){return this.$$.ctx[16]}set markupEditorSnapToContext(e){this.$$set({markupEditorSnapToContext:e}),pa()}get annotateGridSize(){return this.$$.ctx[17]}set annotateGridSize(e){this.$$set({annotateGridSize:e}),pa()}get annotateSnapToContext(){return this.$$.ctx[18]}set annotateSnapToContext(e){this.$$set({annotateSnapToContext:e}),pa()}get willRenderShapePresetToolbar(){return this.$$.ctx[19]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),pa()}get annotateTools(){return this.$$.ctx[20]}set annotateTools(e){this.$$set({annotateTools:e}),pa()}get annotateToolShapes(){return this.$$.ctx[21]}set annotateToolShapes(e){this.$$set({annotateToolShapes:e}),pa()}get annotateShapeControls(){return this.$$.ctx[22]}set annotateShapeControls(e){this.$$set({annotateShapeControls:e}),pa()}get annotateActiveTool(){return this.$$.ctx[0]}set annotateActiveTool(e){this.$$set({annotateActiveTool:e}),pa()}get annotateEnableButtonFlipVertical(){return this.$$.ctx[23]}set annotateEnableButtonFlipVertical(e){this.$$set({annotateEnableButtonFlipVertical:e}),pa()}get annotateEnableSelectImagePreset(){return this.$$.ctx[24]}set annotateEnableSelectImagePreset(e){this.$$set({annotateEnableSelectImagePreset:e}),pa()}get annotateEnableDropImagePreset(){return this.$$.ctx[25]}set annotateEnableDropImagePreset(e){this.$$set({annotateEnableDropImagePreset:e}),pa()}get annotatePresets(){return this.$$.ctx[26]}set annotatePresets(e){this.$$set({annotatePresets:e}),pa()}get annotateWillRenderShapePresetToolbar(){return this.$$.ctx[27]}set annotateWillRenderShapePresetToolbar(e){this.$$set({annotateWillRenderShapePresetToolbar:e}),pa()}get enableViewTool(){return this.$$.ctx[28]}set enableViewTool(e){this.$$set({enableViewTool:e}),pa()}get enableSelectToolToAddShape(){return this.$$.ctx[29]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),pa()}get enableTapToAddText(){return this.$$.ctx[30]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),pa()}get enableAutoSelectMoveTool(){return this.$$.ctx[31]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),pa()}get enableMoveTool(){return this.$$.ctx[32]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),pa()}get willRenderShapeControls(){return this.$$.ctx[33]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),pa()}get willRenderShapeTextControls(){return this.$$.ctx[34]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),pa()}get beforeAddShape(){return this.$$.ctx[35]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),pa()}get beforeRemoveShape(){return this.$$.ctx[36]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),pa()}get beforeDeselectShape(){return this.$$.ctx[37]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),pa()}get beforeSelectShape(){return this.$$.ctx[38]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),pa()}get beforeUpdateShape(){return this.$$.ctx[39]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),pa()}}]};function Yb(e){let t,o,i;function r(t){e[50](t)}let n={stores:e[4],locale:e[5],isActive:e[1],isActiveFraction:e[2],isVisible:e[3],mapScreenPointToImagePoint:e[41],mapImagePointToScreenPoint:e[40],utilKey:"decorate",shapes:e[43],toolbar:e[19]||e[6],toolShapes:e[20]||e[7],toolRetainStyles:e[8],shapeControls:e[21]||e[9],shapePresets:e[25],enableSelectToolToAddShape:e[27],enableTapToAddText:e[28],enableViewTool:e[29],enableMoveTool:e[30],enableAutoSelectMoveTool:e[31],snapThreshold:e[15],gridSize:Ao(e[17])?e[17]:e[14],enableSnapToContext:Ub(e[18])?e[18]:e[16],enableToolShareStyles:e[12],enablePresetSelectImage:e[23],enablePresetDropImage:e[24],enableButtonFlipVertical:e[22],parentRect:e[42],toolSelectRadius:e[10],textInputMode:e[11],willStartInteraction:e[39],willRenderPresetToolbar:e[26]||e[13],hooks:{willRenderShapeControls:e[32],willRenderShapeTextControls:e[33],beforeAddShape:e[34],beforeRemoveShape:e[35],beforeDeselectShape:e[36],beforeSelectShape:e[37],beforeUpdateShape:e[38]}};return void 0!==e[0]&&(n.toolActive=e[0]),t=new Nb({props:n}),ta.push((()=>Ea(t,"toolActive",r))),t.$on("measure",e[51]),{c(){Ia(t.$$.fragment)},m(e,o){Aa(t,e,o),i=!0},p(e,i){const r={};16&i[0]&&(r.stores=e[4]),32&i[0]&&(r.locale=e[5]),2&i[0]&&(r.isActive=e[1]),4&i[0]&&(r.isActiveFraction=e[2]),8&i[0]&&(r.isVisible=e[3]),1024&i[1]&&(r.mapScreenPointToImagePoint=e[41]),512&i[1]&&(r.mapImagePointToScreenPoint=e[40]),524352&i[0]&&(r.toolbar=e[19]||e[6]),1048704&i[0]&&(r.toolShapes=e[20]||e[7]),256&i[0]&&(r.toolRetainStyles=e[8]),2097664&i[0]&&(r.shapeControls=e[21]||e[9]),33554432&i[0]&&(r.shapePresets=e[25]),134217728&i[0]&&(r.enableSelectToolToAddShape=e[27]),268435456&i[0]&&(r.enableTapToAddText=e[28]),536870912&i[0]&&(r.enableViewTool=e[29]),1073741824&i[0]&&(r.enableMoveTool=e[30]),1&i[1]&&(r.enableAutoSelectMoveTool=e[31]),32768&i[0]&&(r.snapThreshold=e[15]),147456&i[0]&&(r.gridSize=Ao(e[17])?e[17]:e[14]),327680&i[0]&&(r.enableSnapToContext=Ub(e[18])?e[18]:e[16]),4096&i[0]&&(r.enableToolShareStyles=e[12]),8388608&i[0]&&(r.enablePresetSelectImage=e[23]),16777216&i[0]&&(r.enablePresetDropImage=e[24]),4194304&i[0]&&(r.enableButtonFlipVertical=e[22]),1024&i[0]&&(r.toolSelectRadius=e[10]),2048&i[0]&&(r.textInputMode=e[11]),256&i[1]&&(r.willStartInteraction=e[39]),67117056&i[0]&&(r.willRenderPresetToolbar=e[26]||e[13]),254&i[1]&&(r.hooks={willRenderShapeControls:e[32],willRenderShapeTextControls:e[33],beforeAddShape:e[34],beforeRemoveShape:e[35],beforeDeselectShape:e[36],beforeSelectShape:e[37],beforeUpdateShape:e[38]}),!o&&1&i[0]&&(o=!0,r.toolActive=e[0],ca((()=>o=!1))),t.$set(r)},i(e){i||(xa(t.$$.fragment,e),i=!0)},o(e){va(t.$$.fragment,e),i=!1},d(e){La(t,e)}}}function qb(e,t,o){let i,r,n,a,s;let{isActive:l}=t,{isActiveFraction:c}=t,{isVisible:d}=t,{stores:u}=t,{locale:h={}}=t,{markupEditorToolbar:p}=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:w}=t,{markupEditorSnapToContext:S=!0}=t,{decorateGridSize:k}=t,{decorateSnapToContext:C}=t,{decorateTools:T}=t,{decorateToolShapes:M}=t,{decorateShapeControls:R}=t,{decorateActiveTool:P}=t,{decorateEnableButtonFlipVertical:E=!1}=t,{decorateEnableSelectImagePreset:I=!1}=t,{decorateEnableDropImagePreset:A=!0}=t,{decoratePresets:L=[]}=t,{decorateWillRenderShapePresetToolbar:z}=t,{enableSelectToolToAddShape:F}=t,{enableTapToAddText:D}=t,{enableViewTool:O}=t,{enableMoveTool:B}=t,{enableAutoSelectMoveTool:W}=t,{willRenderShapeControls:_}=t,{willRenderShapeTextControls:V}=t,{beforeAddShape:N}=t,{beforeRemoveShape:H}=t,{beforeDeselectShape:j}=t,{beforeSelectShape:U}=t,{beforeUpdateShape:G}=t,{markupEditorWillStartInteraction:Z}=t;const{imageCropRect:X,imageDecoration:Y,imageSelectionRectPresentation:q,imageTransformsInterpolated:K}=u;return on(e,q,(e=>o(48,a=e))),on(e,K,(e=>o(49,s=e))),e.$$set=e=>{"isActive"in e&&o(1,l=e.isActive),"isActiveFraction"in e&&o(2,c=e.isActiveFraction),"isVisible"in e&&o(3,d=e.isVisible),"stores"in e&&o(4,u=e.stores),"locale"in e&&o(5,h=e.locale),"markupEditorToolbar"in e&&o(6,p=e.markupEditorToolbar),"markupEditorToolStyles"in e&&o(7,m=e.markupEditorToolStyles),"markupEditorToolRetainStyles"in e&&o(8,g=e.markupEditorToolRetainStyles),"markupEditorShapeStyleControls"in e&&o(9,$=e.markupEditorShapeStyleControls),"markupEditorToolSelectRadius"in e&&o(10,f=e.markupEditorToolSelectRadius),"markupEditorTextInputMode"in e&&o(11,y=e.markupEditorTextInputMode),"markupEditorToolShareStyles"in e&&o(12,b=e.markupEditorToolShareStyles),"willRenderShapePresetToolbar"in e&&o(13,x=e.willRenderShapePresetToolbar),"markupEditorGridSize"in e&&o(14,v=e.markupEditorGridSize),"markupEditorSnapThreshold"in e&&o(15,w=e.markupEditorSnapThreshold),"markupEditorSnapToContext"in e&&o(16,S=e.markupEditorSnapToContext),"decorateGridSize"in e&&o(17,k=e.decorateGridSize),"decorateSnapToContext"in e&&o(18,C=e.decorateSnapToContext),"decorateTools"in e&&o(19,T=e.decorateTools),"decorateToolShapes"in e&&o(20,M=e.decorateToolShapes),"decorateShapeControls"in e&&o(21,R=e.decorateShapeControls),"decorateActiveTool"in e&&o(0,P=e.decorateActiveTool),"decorateEnableButtonFlipVertical"in e&&o(22,E=e.decorateEnableButtonFlipVertical),"decorateEnableSelectImagePreset"in e&&o(23,I=e.decorateEnableSelectImagePreset),"decorateEnableDropImagePreset"in e&&o(24,A=e.decorateEnableDropImagePreset),"decoratePresets"in e&&o(25,L=e.decoratePresets),"decorateWillRenderShapePresetToolbar"in e&&o(26,z=e.decorateWillRenderShapePresetToolbar),"enableSelectToolToAddShape"in e&&o(27,F=e.enableSelectToolToAddShape),"enableTapToAddText"in e&&o(28,D=e.enableTapToAddText),"enableViewTool"in e&&o(29,O=e.enableViewTool),"enableMoveTool"in e&&o(30,B=e.enableMoveTool),"enableAutoSelectMoveTool"in e&&o(31,W=e.enableAutoSelectMoveTool),"willRenderShapeControls"in e&&o(32,_=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(33,V=e.willRenderShapeTextControls),"beforeAddShape"in e&&o(34,N=e.beforeAddShape),"beforeRemoveShape"in e&&o(35,H=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(36,j=e.beforeDeselectShape),"beforeSelectShape"in e&&o(37,U=e.beforeSelectShape),"beforeUpdateShape"in e&&o(38,G=e.beforeUpdateShape),"markupEditorWillStartInteraction"in e&&o(39,Z=e.markupEditorWillStartInteraction)},e.$$.update=()=>{262144&e.$$.dirty[1]&&o(47,i=s?s.scale:1),196608&e.$$.dirty[1]&&o(41,r=e=>{const t=pe(e);return t.x-=a.x,t.y-=a.y,t.x/=i,t.y/=i,t}),196608&e.$$.dirty[1]&&o(40,n=e=>{const t=pe(e);return t.x*=i,t.y*=i,t.x+=a.x,t.y+=a.y,t})},[P,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,S,k,C,T,M,R,E,I,A,L,z,F,D,O,B,W,_,V,N,H,j,U,G,Z,n,r,X,Y,q,K,"decorate",i,a,s,function(e){P=e,o(0,P)},function(t){Qn.call(this,e,t)}]}var Kb={util:["decorate",class extends Fa{constructor(e){super(),za(this,e,qb,Yb,Qr,{name:46,isActive:1,isActiveFraction:2,isVisible:3,stores:4,locale:5,markupEditorToolbar:6,markupEditorToolStyles:7,markupEditorToolRetainStyles:8,markupEditorShapeStyleControls:9,markupEditorToolSelectRadius:10,markupEditorTextInputMode:11,markupEditorToolShareStyles:12,willRenderShapePresetToolbar:13,markupEditorGridSize:14,markupEditorSnapThreshold:15,markupEditorSnapToContext:16,decorateGridSize:17,decorateSnapToContext:18,decorateTools:19,decorateToolShapes:20,decorateShapeControls:21,decorateActiveTool:0,decorateEnableButtonFlipVertical:22,decorateEnableSelectImagePreset:23,decorateEnableDropImagePreset:24,decoratePresets:25,decorateWillRenderShapePresetToolbar:26,enableSelectToolToAddShape:27,enableTapToAddText:28,enableViewTool:29,enableMoveTool:30,enableAutoSelectMoveTool:31,willRenderShapeControls:32,willRenderShapeTextControls:33,beforeAddShape:34,beforeRemoveShape:35,beforeDeselectShape:36,beforeSelectShape:37,beforeUpdateShape:38,markupEditorWillStartInteraction:39},null,[-1,-1])}get name(){return this.$$.ctx[46]}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$$set({isActive:e}),pa()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),pa()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$$set({isVisible:e}),pa()}get stores(){return this.$$.ctx[4]}set stores(e){this.$$set({stores:e}),pa()}get locale(){return this.$$.ctx[5]}set locale(e){this.$$set({locale:e}),pa()}get markupEditorToolbar(){return this.$$.ctx[6]}set markupEditorToolbar(e){this.$$set({markupEditorToolbar:e}),pa()}get markupEditorToolStyles(){return this.$$.ctx[7]}set markupEditorToolStyles(e){this.$$set({markupEditorToolStyles:e}),pa()}get markupEditorToolRetainStyles(){return this.$$.ctx[8]}set markupEditorToolRetainStyles(e){this.$$set({markupEditorToolRetainStyles:e}),pa()}get markupEditorShapeStyleControls(){return this.$$.ctx[9]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),pa()}get markupEditorToolSelectRadius(){return this.$$.ctx[10]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),pa()}get markupEditorTextInputMode(){return this.$$.ctx[11]}set markupEditorTextInputMode(e){this.$$set({markupEditorTextInputMode:e}),pa()}get markupEditorToolShareStyles(){return this.$$.ctx[12]}set markupEditorToolShareStyles(e){this.$$set({markupEditorToolShareStyles:e}),pa()}get willRenderShapePresetToolbar(){return this.$$.ctx[13]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),pa()}get markupEditorGridSize(){return this.$$.ctx[14]}set markupEditorGridSize(e){this.$$set({markupEditorGridSize:e}),pa()}get markupEditorSnapThreshold(){return this.$$.ctx[15]}set markupEditorSnapThreshold(e){this.$$set({markupEditorSnapThreshold:e}),pa()}get markupEditorSnapToContext(){return this.$$.ctx[16]}set markupEditorSnapToContext(e){this.$$set({markupEditorSnapToContext:e}),pa()}get decorateGridSize(){return this.$$.ctx[17]}set decorateGridSize(e){this.$$set({decorateGridSize:e}),pa()}get decorateSnapToContext(){return this.$$.ctx[18]}set decorateSnapToContext(e){this.$$set({decorateSnapToContext:e}),pa()}get decorateTools(){return this.$$.ctx[19]}set decorateTools(e){this.$$set({decorateTools:e}),pa()}get decorateToolShapes(){return this.$$.ctx[20]}set decorateToolShapes(e){this.$$set({decorateToolShapes:e}),pa()}get decorateShapeControls(){return this.$$.ctx[21]}set decorateShapeControls(e){this.$$set({decorateShapeControls:e}),pa()}get decorateActiveTool(){return this.$$.ctx[0]}set decorateActiveTool(e){this.$$set({decorateActiveTool:e}),pa()}get decorateEnableButtonFlipVertical(){return this.$$.ctx[22]}set decorateEnableButtonFlipVertical(e){this.$$set({decorateEnableButtonFlipVertical:e}),pa()}get decorateEnableSelectImagePreset(){return this.$$.ctx[23]}set decorateEnableSelectImagePreset(e){this.$$set({decorateEnableSelectImagePreset:e}),pa()}get decorateEnableDropImagePreset(){return this.$$.ctx[24]}set decorateEnableDropImagePreset(e){this.$$set({decorateEnableDropImagePreset:e}),pa()}get decoratePresets(){return this.$$.ctx[25]}set decoratePresets(e){this.$$set({decoratePresets:e}),pa()}get decorateWillRenderShapePresetToolbar(){return this.$$.ctx[26]}set decorateWillRenderShapePresetToolbar(e){this.$$set({decorateWillRenderShapePresetToolbar:e}),pa()}get enableSelectToolToAddShape(){return this.$$.ctx[27]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),pa()}get enableTapToAddText(){return this.$$.ctx[28]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),pa()}get enableViewTool(){return this.$$.ctx[29]}set enableViewTool(e){this.$$set({enableViewTool:e}),pa()}get enableMoveTool(){return this.$$.ctx[30]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),pa()}get enableAutoSelectMoveTool(){return this.$$.ctx[31]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),pa()}get willRenderShapeControls(){return this.$$.ctx[32]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),pa()}get willRenderShapeTextControls(){return this.$$.ctx[33]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),pa()}get beforeAddShape(){return this.$$.ctx[34]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),pa()}get beforeRemoveShape(){return this.$$.ctx[35]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),pa()}get beforeDeselectShape(){return this.$$.ctx[36]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),pa()}get beforeSelectShape(){return this.$$.ctx[37]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),pa()}get beforeUpdateShape(){return this.$$.ctx[38]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),pa()}get markupEditorWillStartInteraction(){return this.$$.ctx[39]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),pa()}}]};function Jb(e){let t,o;return t=new Nb({props:{stores:e[3],locale:e[4],isActive:e[0],isActiveFraction:e[1],isVisible:e[2],mapScreenPointToImagePoint:e[25],mapImagePointToScreenPoint:e[24],utilKey:"sticker",shapePresets:e[5],shapes:e[6]?e[34]:e[35],toolActive:"preset",imageFlipX:!!e[6]&&e[23],imageFlipY:!!e[6]&&e[22],imageRotation:e[6]?e[30]:0,parentRect:e[6]?e[36]:e[32],snapThreshold:e[28],gridSize:e[27],enableSnapToContext:e[26],enablePresetDropImage:e[7],enablePresetSelectImage:e[29],enableButtonFlipVertical:e[10]||e[8],toolSelectRadius:e[14],willStartInteraction:e[21],willRenderPresetToolbar:e[11]||e[9]||e[15],hooks:{willRenderShapeControls:e[12],willRenderShapeTextControls:e[13],beforeAddShape:e[16],beforeRemoveShape:e[17],beforeDeselectShape:e[18],beforeSelectShape:e[19],beforeUpdateShape:e[20]}}}),t.$on("measure",e[59]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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]),33554432&o[0]&&(i.mapScreenPointToImagePoint=e[25]),16777216&o[0]&&(i.mapImagePointToScreenPoint=e[24]),32&o[0]&&(i.shapePresets=e[5]),64&o[0]&&(i.shapes=e[6]?e[34]:e[35]),8388672&o[0]&&(i.imageFlipX=!!e[6]&&e[23]),4194368&o[0]&&(i.imageFlipY=!!e[6]&&e[22]),1073741888&o[0]&&(i.imageRotation=e[6]?e[30]:0),64&o[0]&&(i.parentRect=e[6]?e[36]:e[32]),268435456&o[0]&&(i.snapThreshold=e[28]),134217728&o[0]&&(i.gridSize=e[27]),67108864&o[0]&&(i.enableSnapToContext=e[26]),128&o[0]&&(i.enablePresetDropImage=e[7]),536870912&o[0]&&(i.enablePresetSelectImage=e[29]),1280&o[0]&&(i.enableButtonFlipVertical=e[10]||e[8]),16384&o[0]&&(i.toolSelectRadius=e[14]),2097152&o[0]&&(i.willStartInteraction=e[21]),35328&o[0]&&(i.willRenderPresetToolbar=e[11]||e[9]||e[15]),2043904&o[0]&&(i.hooks={willRenderShapeControls:e[12],willRenderShapeTextControls:e[13],beforeAddShape:e[16],beforeRemoveShape:e[17],beforeDeselectShape:e[18],beforeSelectShape:e[19],beforeUpdateShape:e[20]}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Qb(e,t,o){let i,r,n,a,s,l,c,d,u,h,p,m,g,$,f;let{isActive:y}=t,{isActiveFraction:b}=t,{isVisible:x}=t,{stores:v}=t,{locale:w={}}=t,{stickers:S=[]}=t,{stickerForceEnable:k=!1}=t,{stickerStickToImage:C=!1}=t,{stickerEnableSelectImagePreset:T=!0}=t,{stickerEnableDropImagePreset:M=!0}=t,{stickerEnableButtonFlipVertical:R=!1}=t,{stickerWillRenderShapePresetToolbar:P}=t,{stickerEnableSelectImage:E=!0}=t,{stickersEnableButtonFlipVertical:I=!1}=t,{stickersWillRenderShapePresetToolbar:A}=t,{markupEditorGridSize:L=0}=t,{markupEditorSnapThreshold:z=0}=t,{markupEditorSnapToContext:F=!1}=t,{annotateGridSize:D}=t,{annotateSnapToContext:O}=t,{decorateGridSize:B}=t,{decorateSnapToContext:W}=t,{willRenderShapeControls:_}=t,{willRenderShapeTextControls:V}=t,{markupEditorToolSelectRadius:N}=t,{willRenderShapePresetToolbar:H}=t,{beforeAddShape:j}=t,{beforeRemoveShape:U}=t,{beforeDeselectShape:G}=t,{beforeSelectShape:Z}=t,{beforeUpdateShape:X}=t,{markupEditorWillStartInteraction:Y}=t;const{rootRect:q,imageCropRect:K,imageSelectionRectPresentation:J,imageAnnotation:Q,imageDecoration:ee,imageSize:te,imageTransforms:oe,imageTransformsInterpolated:ie,imageRotation:re,imageFlipX:ne,imageFlipY:ae}=v;return on(e,q,(e=>o(58,$=e))),on(e,J,(e=>o(54,d=e))),on(e,te,(e=>o(57,g=e))),on(e,oe,(e=>o(56,m=e))),on(e,ie,(e=>o(55,p=e))),on(e,re,(e=>o(30,f=e))),on(e,ne,(e=>o(23,h=e))),on(e,ae,(e=>o(22,u=e))),e.$$set=e=>{"isActive"in e&&o(0,y=e.isActive),"isActiveFraction"in e&&o(1,b=e.isActiveFraction),"isVisible"in e&&o(2,x=e.isVisible),"stores"in e&&o(3,v=e.stores),"locale"in e&&o(4,w=e.locale),"stickers"in e&&o(5,S=e.stickers),"stickerForceEnable"in e&&o(43,k=e.stickerForceEnable),"stickerStickToImage"in e&&o(6,C=e.stickerStickToImage),"stickerEnableSelectImagePreset"in e&&o(44,T=e.stickerEnableSelectImagePreset),"stickerEnableDropImagePreset"in e&&o(7,M=e.stickerEnableDropImagePreset),"stickerEnableButtonFlipVertical"in e&&o(8,R=e.stickerEnableButtonFlipVertical),"stickerWillRenderShapePresetToolbar"in e&&o(9,P=e.stickerWillRenderShapePresetToolbar),"stickerEnableSelectImage"in e&&o(45,E=e.stickerEnableSelectImage),"stickersEnableButtonFlipVertical"in e&&o(10,I=e.stickersEnableButtonFlipVertical),"stickersWillRenderShapePresetToolbar"in e&&o(11,A=e.stickersWillRenderShapePresetToolbar),"markupEditorGridSize"in e&&o(46,L=e.markupEditorGridSize),"markupEditorSnapThreshold"in e&&o(47,z=e.markupEditorSnapThreshold),"markupEditorSnapToContext"in e&&o(48,F=e.markupEditorSnapToContext),"annotateGridSize"in e&&o(49,D=e.annotateGridSize),"annotateSnapToContext"in e&&o(50,O=e.annotateSnapToContext),"decorateGridSize"in e&&o(51,B=e.decorateGridSize),"decorateSnapToContext"in e&&o(52,W=e.decorateSnapToContext),"willRenderShapeControls"in e&&o(12,_=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(13,V=e.willRenderShapeTextControls),"markupEditorToolSelectRadius"in e&&o(14,N=e.markupEditorToolSelectRadius),"willRenderShapePresetToolbar"in e&&o(15,H=e.willRenderShapePresetToolbar),"beforeAddShape"in e&&o(16,j=e.beforeAddShape),"beforeRemoveShape"in e&&o(17,U=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(18,G=e.beforeDeselectShape),"beforeSelectShape"in e&&o(19,Z=e.beforeSelectShape),"beforeUpdateShape"in e&&o(20,X=e.beforeUpdateShape),"markupEditorWillStartInteraction"in e&&o(21,Y=e.markupEditorWillStartInteraction)},e.$$.update=()=>{16777216&e.$$.dirty[1]&&o(53,i=p?p.scale:1),24576&e.$$.dirty[1]&&o(29,r=!1!==T&&E),65536&e.$$.dirty[1]&&o(28,n=z),64&e.$$.dirty[0]|1343488&e.$$.dirty[1]&&o(27,a=C?Ao(D)?D:L:Ao(B)?B:L),64&e.$$.dirty[0]|2752512&e.$$.dirty[1]&&o(26,s=C?Ub(O)?O:F:Ub(W)?W:F),12582976&e.$$.dirty[0]|264241152&e.$$.dirty[1]&&o(25,l=C?e=>jb(e,$,g,p.origin,p.translation,m.rotation.z,p.scale,h,u):e=>{const t=pe(e);return t.x-=d.x,t.y-=d.y,t.x/=i,t.y/=i,t}),12582976&e.$$.dirty[0]|264241152&e.$$.dirty[1]&&o(24,c=C?e=>Hb(e,$,g,p.origin,p.translation,m.rotation.z,p.scale,h,u):e=>{const t=pe(e);return t.x*=i,t.y*=i,t.x+=d.x,t.y+=d.y,t})},[y,b,x,v,w,S,C,M,R,P,I,A,_,V,N,H,j,U,G,Z,X,Y,u,h,c,l,s,a,n,r,f,q,K,J,Q,ee,te,oe,ie,re,ne,ae,"sticker",k,T,E,L,z,F,D,O,B,W,i,d,p,m,g,$,function(t){Qn.call(this,e,t)}]}var ex={util:["sticker",class extends Fa{constructor(e){super(),za(this,e,Qb,Jb,Qr,{name:42,isActive:0,isActiveFraction:1,isVisible:2,stores:3,locale:4,stickers:5,stickerForceEnable:43,stickerStickToImage:6,stickerEnableSelectImagePreset:44,stickerEnableDropImagePreset:7,stickerEnableButtonFlipVertical:8,stickerWillRenderShapePresetToolbar:9,stickerEnableSelectImage:45,stickersEnableButtonFlipVertical:10,stickersWillRenderShapePresetToolbar:11,markupEditorGridSize:46,markupEditorSnapThreshold:47,markupEditorSnapToContext:48,annotateGridSize:49,annotateSnapToContext:50,decorateGridSize:51,decorateSnapToContext:52,willRenderShapeControls:12,willRenderShapeTextControls:13,markupEditorToolSelectRadius:14,willRenderShapePresetToolbar:15,beforeAddShape:16,beforeRemoveShape:17,beforeDeselectShape:18,beforeSelectShape:19,beforeUpdateShape:20,markupEditorWillStartInteraction:21},null,[-1,-1])}get name(){return this.$$.ctx[42]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),pa()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),pa()}get isVisible(){return this.$$.ctx[2]}set isVisible(e){this.$$set({isVisible:e}),pa()}get stores(){return this.$$.ctx[3]}set stores(e){this.$$set({stores:e}),pa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),pa()}get stickers(){return this.$$.ctx[5]}set stickers(e){this.$$set({stickers:e}),pa()}get stickerForceEnable(){return this.$$.ctx[43]}set stickerForceEnable(e){this.$$set({stickerForceEnable:e}),pa()}get stickerStickToImage(){return this.$$.ctx[6]}set stickerStickToImage(e){this.$$set({stickerStickToImage:e}),pa()}get stickerEnableSelectImagePreset(){return this.$$.ctx[44]}set stickerEnableSelectImagePreset(e){this.$$set({stickerEnableSelectImagePreset:e}),pa()}get stickerEnableDropImagePreset(){return this.$$.ctx[7]}set stickerEnableDropImagePreset(e){this.$$set({stickerEnableDropImagePreset:e}),pa()}get stickerEnableButtonFlipVertical(){return this.$$.ctx[8]}set stickerEnableButtonFlipVertical(e){this.$$set({stickerEnableButtonFlipVertical:e}),pa()}get stickerWillRenderShapePresetToolbar(){return this.$$.ctx[9]}set stickerWillRenderShapePresetToolbar(e){this.$$set({stickerWillRenderShapePresetToolbar:e}),pa()}get stickerEnableSelectImage(){return this.$$.ctx[45]}set stickerEnableSelectImage(e){this.$$set({stickerEnableSelectImage:e}),pa()}get stickersEnableButtonFlipVertical(){return this.$$.ctx[10]}set stickersEnableButtonFlipVertical(e){this.$$set({stickersEnableButtonFlipVertical:e}),pa()}get stickersWillRenderShapePresetToolbar(){return this.$$.ctx[11]}set stickersWillRenderShapePresetToolbar(e){this.$$set({stickersWillRenderShapePresetToolbar:e}),pa()}get markupEditorGridSize(){return this.$$.ctx[46]}set markupEditorGridSize(e){this.$$set({markupEditorGridSize:e}),pa()}get markupEditorSnapThreshold(){return this.$$.ctx[47]}set markupEditorSnapThreshold(e){this.$$set({markupEditorSnapThreshold:e}),pa()}get markupEditorSnapToContext(){return this.$$.ctx[48]}set markupEditorSnapToContext(e){this.$$set({markupEditorSnapToContext:e}),pa()}get annotateGridSize(){return this.$$.ctx[49]}set annotateGridSize(e){this.$$set({annotateGridSize:e}),pa()}get annotateSnapToContext(){return this.$$.ctx[50]}set annotateSnapToContext(e){this.$$set({annotateSnapToContext:e}),pa()}get decorateGridSize(){return this.$$.ctx[51]}set decorateGridSize(e){this.$$set({decorateGridSize:e}),pa()}get decorateSnapToContext(){return this.$$.ctx[52]}set decorateSnapToContext(e){this.$$set({decorateSnapToContext:e}),pa()}get willRenderShapeControls(){return this.$$.ctx[12]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),pa()}get willRenderShapeTextControls(){return this.$$.ctx[13]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),pa()}get markupEditorToolSelectRadius(){return this.$$.ctx[14]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),pa()}get willRenderShapePresetToolbar(){return this.$$.ctx[15]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),pa()}get beforeAddShape(){return this.$$.ctx[16]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),pa()}get beforeRemoveShape(){return this.$$.ctx[17]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),pa()}get beforeDeselectShape(){return this.$$.ctx[18]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),pa()}get beforeSelectShape(){return this.$$.ctx[19]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),pa()}get beforeUpdateShape(){return this.$$.ctx[20]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),pa()}get markupEditorWillStartInteraction(){return this.$$.ctx[21]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),pa()}},({stickers:e,stickerEnableSelectImage:t,stickerEnableSelectImagePreset:o,stickerEnableDropImagePreset:i,stickerForceEnable:r})=>e&&e.length||t||o||i||r]};function tx(e){let t,o,i,r,n,a=(e[14](e[34].value)||"")+"",s=(P(e[34].label)?e[34].label(e[1]):e[34].label)+"";return{c(){t=kn("div"),o=new Bn(!1),i=Mn(),r=kn("span"),n=Tn(s),o.a=i,An(t,"slot","option")},m(e,s){wn(e,t,s),o.m(a,t),bn(t,i),bn(t,r),bn(r,n)},p(e,t){8&t[1]&&a!==(a=(e[14](e[34].value)||"")+"")&&o.p(a),2&t[0]|8&t[1]&&s!==(s=(P(e[34].label)?e[34].label(e[1]):e[34].label)+"")&&Fn(n,s)},d(e){e&&Sn(t)}}}function ox(e){let t,o;return t=new Wu({props:{locale:e[1],class:"PinturaControlList",layout:"row",options:e[2],selectedIndex:e[6],onchange:e[12],$$slots:{option:[tx,({option:e})=>({34:e}),({option:e})=>[0,e?8:0]]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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]|24&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function ix(e){let t,o,i,r,n;return o=new Jy({props:{locale:e[1],class:"PinturaControlPanels",shape:e[4],onchange:e[13],controls:e[3],scrollElasticity:e[7]}}),r=new vd({props:{elasticity:e[10],$$slots:{default:[ox]},$$scope:{ctx:e}}}),{c(){t=kn("div"),Ia(o.$$.fragment),i=Mn(),Ia(r.$$.fragment),An(t,"slot","footer"),An(t,"style",e[5])},m(e,a){wn(e,t,a),Aa(o,t,null),bn(t,i),Aa(r,t,null),n=!0},p(e,i){const a={};2&i[0]&&(a.locale=e[1]),16&i[0]&&(a.shape=e[4]),8&i[0]&&(a.controls=e[3]),128&i[0]&&(a.scrollElasticity=e[7]),o.$set(a);const s={};70&i[0]|16&i[1]&&(s.$$scope={dirty:i,ctx:e}),r.$set(s),(!n||32&i[0])&&An(t,"style",e[5])},i(e){n||(xa(o.$$.fragment,e),xa(r.$$.fragment,e),n=!0)},o(e){va(o.$$.fragment,e),va(r.$$.fragment,e),n=!1},d(e){e&&Sn(t),La(o),La(r)}}}function rx(e){let t,o;return t=new J$({props:{$$slots:{footer:[ix]},$$scope:{ctx:e}}}),t.$on("measure",e[23]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};254&o[0]|16&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function nx(e,t,o){let i,r,n,a,s,l,c,d,u=Gr,h=()=>(u(),u=en(p,(e=>o(20,s=e))),p);e.$$.on_destroy.push((()=>u()));let{isActive:p}=t;h();let{stores:m}=t,{locale:g={}}=t,{frameStyles:$={}}=t,{frameOptions:f=[]}=t,{markupEditorShapeStyleControls:y}=t;const b=Jn("elasticityMultiplier");on(e,b,(e=>o(22,d=e)));const{history:x,animation:v,scrollElasticity:w,imageFrame:S,allowPan:k,allowZoom:C,allowZoomControls:T,allowPlayPause:M}=m;on(e,v,(e=>o(21,l=e))),on(e,S,(e=>o(4,c=e)));let R={};let P;const E=ec(l?20:0);return on(e,E,(e=>o(19,a=e))),e.$$set=e=>{"isActive"in e&&h(o(0,p=e.isActive)),"stores"in e&&o(17,m=e.stores),"locale"in e&&o(1,g=e.locale),"frameStyles"in e&&o(18,$=e.frameStyles),"frameOptions"in e&&o(2,f=e.frameOptions),"markupEditorShapeStyleControls"in e&&o(3,y=e.markupEditorShapeStyleControls)},e.$$.update=()=>{1048576&e.$$.dirty[0]&&k.set(s),1048576&e.$$.dirty[0]&&C.set(s),1048576&e.$$.dirty[0]&&T.set(s),1048576&e.$$.dirty[0]&&s&&M.set(!0),4194304&e.$$.dirty[0]&&o(7,i=d*w),20&e.$$.dirty[0]&&o(6,r=c?f.findIndex((([e])=>e===c.id)):0),3145728&e.$$.dirty[0]&&l&&E.set(s?0:20),524288&e.$$.dirty[0]&&o(5,n=a?`transform: translateY(${a}px)`:void 0)},[p,g,f,y,c,n,r,i,b,v,w,S,({value:e})=>{const t=$[e];if(!t||!t.shape)return S.set(void 0),void x.write();const{shape:o}=t,i={id:e,...fi(o),...Object.keys(R).reduce(((e,t)=>o[t]?(e[t]=R[t],e):e),{})};S.set(i),x.write()},function(e){zo(e,"frameColor")&&(R.frameColor=e.frameColor),c&&(fr(c,e),S.set(c),clearTimeout(P),P=setTimeout((()=>{x.write()}),200))},e=>{const t=$[e];var o;if(t&&t.thumb)return o=t.thumb,/div/i.test(o)||Qy(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,"frame",m,$,a,s,l,d,function(t){Qn.call(this,e,t)}]}var ax={util:["frame",class extends Fa{constructor(e){super(),za(this,e,nx,rx,Qr,{name:16,isActive:0,stores:17,locale:1,frameStyles:18,frameOptions:2,markupEditorShapeStyleControls:3},null,[-1,-1])}get name(){return this.$$.ctx[16]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),pa()}get stores(){return this.$$.ctx[17]}set stores(e){this.$$set({stores:e}),pa()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),pa()}get frameStyles(){return this.$$.ctx[18]}set frameStyles(e){this.$$set({frameStyles:e}),pa()}get frameOptions(){return this.$$.ctx[2]}set frameOptions(e){this.$$set({frameOptions:e}),pa()}get markupEditorShapeStyleControls(){return this.$$.ctx[3]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),pa()}},({src:e})=>e&&!kp(e)]};function sx(e){let t,o,i,r,n,a,s,l;return{c(){t=kn("div"),o=kn("input"),r=Mn(),n=kn("label"),a=Tn(e[1]),An(o,"id",e[0]),An(o,"type","number"),An(o,"min","1"),An(o,"inputmode","numeric"),An(o,"pattern","[0-9]*"),An(o,"data-state",e[3]),An(o,"autocomplete","off"),An(o,"placeholder",e[4]),o.value=i=void 0===e[5]?"":e[7](e[5]+""),An(n,"for",e[0]),An(n,"title",e[2]),An(n,"aria-label",e[2]),An(t,"class","PinturaInputDimension")},m(i,c){wn(i,t,c),bn(t,o),bn(t,r),bn(t,n),bn(n,a),s||(l=Pn(o,"input",e[8]),s=!0)},p(e,[t]){1&t&&An(o,"id",e[0]),8&t&&An(o,"data-state",e[3]),16&t&&An(o,"placeholder",e[4]),160&t&&i!==(i=void 0===e[5]?"":e[7](e[5]+""))&&o.value!==i&&(o.value=i),2&t&&Fn(a,e[1]),1&t&&An(n,"for",e[0]),4&t&&An(n,"title",e[2]),4&t&&An(n,"aria-label",e[2])},i:Gr,o:Gr,d(e){e&&Sn(t),s=!1,l()}}}function lx(e,t,o){let{id:i}=t,{label:r}=t,{title:n}=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,r=e.label),"title"in e&&o(2,n=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,r,n,a,s,l,c,d,e=>c(d(e.currentTarget.value))]}class cx extends Fa{constructor(e){super(),za(this,e,lx,sx,Qr,{id:0,label:1,title:2,state:3,placeholder:4,value:5,onchange:6,format:7})}}function dx(e){let t;return{c(){t=Cn("g")},m(o,i){wn(o,t,i),t.innerHTML=e[2]},p(e,o){4&o&&(t.innerHTML=e[2])},d(e){e&&Sn(t)}}}function ux(e){let t,o,i,r,n,a,s,l;return n=new td({props:{$$slots:{default:[dx]},$$scope:{ctx:e}}}),{c(){t=kn("div"),o=kn("input"),i=Mn(),r=kn("label"),Ia(n.$$.fragment),An(o,"id",e[0]),An(o,"class","implicit"),An(o,"type","checkbox"),o.checked=e[1],An(r,"for",e[0]),An(r,"title",e[3])},m(c,d){wn(c,t,d),bn(t,o),bn(t,i),bn(t,r),Aa(n,r,null),a=!0,s||(l=Pn(o,"change",e[5]),s=!0)},p(e,[t]){(!a||1&t)&&An(o,"id",e[0]),(!a||2&t)&&(o.checked=e[1]);const i={};68&t&&(i.$$scope={dirty:t,ctx:e}),n.$set(i),(!a||1&t)&&An(r,"for",e[0]),(!a||8&t)&&An(r,"title",e[3])},i(e){a||(xa(n.$$.fragment,e),a=!0)},o(e){va(n.$$.fragment,e),a=!1},d(e){e&&Sn(t),La(n),s=!1,l()}}}function hx(e,t,o){let{id:i}=t,{locked:r}=t,{icon:n}=t,{title:a}=t,{onchange:s}=t;return e.$$set=e=>{"id"in e&&o(0,i=e.id),"locked"in e&&o(1,r=e.locked),"icon"in e&&o(2,n=e.icon),"title"in e&&o(3,a=e.title),"onchange"in e&&o(4,s=e.onchange)},[i,r,n,a,s,e=>s(e.currentTarget.checked)]}class px extends Fa{constructor(e){super(),za(this,e,hx,ux,Qr,{id:0,locked:1,icon:2,title:3,onchange:4})}}function mx(e){let t;return{c(){t=Tn("Save")},m(e,o){wn(e,t,o)},d(e){e&&Sn(t)}}}function gx(e){let t,o,i,r,n,a,s,l,c,d,u,h,p,m=e[1].resizeLabelFormCaption+"";return l=new up({props:{items:e[4]}}),d=new cd({props:{type:"submit",class:"implicit",$$slots:{default:[mx]},$$scope:{ctx:e}}}),{c(){t=kn("form"),o=kn("div"),i=kn("fieldset"),r=kn("legend"),n=Tn(m),a=Mn(),s=kn("div"),Ia(l.$$.fragment),c=Mn(),Ia(d.$$.fragment),An(r,"class","implicit"),An(s,"class","PinturaFieldsetInner"),An(o,"class","PinturaFormInner"),An(t,"slot","footer"),An(t,"style",e[3])},m(m,g){wn(m,t,g),bn(t,o),bn(o,i),bn(i,r),bn(r,n),bn(i,a),bn(i,s),Aa(l,s,null),e[65](s),bn(o,c),Aa(d,o,null),u=!0,h||(p=[Pn(s,"focusin",e[15]),Pn(s,"focusout",e[16]),Pn(t,"submit",En(e[17]))],h=!0)},p(e,o){(!u||2&o[0])&&m!==(m=e[1].resizeLabelFormCaption+"")&&Fn(n,m);const i={};16&o[0]&&(i.items=e[4]),l.$set(i);const r={};16&o[3]&&(r.$$scope={dirty:o,ctx:e}),d.$set(r),(!u||8&o[0])&&An(t,"style",e[3])},i(e){u||(xa(l.$$.fragment,e),xa(d.$$.fragment,e),u=!0)},o(e){va(l.$$.fragment,e),va(d.$$.fragment,e),u=!1},d(o){o&&Sn(t),La(l),e[65](null),La(d),h=!1,Kr(p)}}}function $x(e){let t,o;return t=new J$({props:{$$slots:{footer:[gx]},$$scope:{ctx:e}}}),t.$on("measure",e[66]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};30&o[0]|16&o[3]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function fx(e,t,o){let i,r,n,a,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,S,k,C,T,M,P,E,I,A,z,F=Gr,D=()=>(F(),F=en(B,(e=>o(49,p=e))),B);e.$$.on_destroy.push((()=>F()));const O=(e,t=0,o=9999)=>{if(R(e)&&!(e=e.replace(/\D/g,"")).length)return;const i=Math.round(e);return Number.isNaN(i)?void 0:ns(i,t,o)};let{isActive:B}=t;D();let{stores:W}=t,{locale:_={}}=t,{resizeMinSize:V=We(1,1)}=t,{resizeMaxSize:N=We(9999,9999)}=t,{resizeAspectRatioLocked:H=!1}=t,{resizeEnableButtonLockAspectRatio:j=!0}=t,{resizeSizePresetOptions:Z}=t,{resizeWidthPresetOptions:X}=t,{resizeHeightPresetOptions:Y}=t,{resizeWillRenderFooter:q=G}=t;const K=ec(0,{stiffness:.15,damping:.3});on(e,K,(e=>o(54,y=e)));const{animation:J,imageSize:Q,imageCropRect:ee,imageCropRectAspectRatio:te,imageCropAspectRatio:oe,imageOutputSize:ie,imageSelectionZoom:re,imageSelectionPan:ne,history:ae,env:se,allowPan:le,allowZoom:ce,allowZoomControls:ue,allowPlayPause:he}=W;on(e,J,(e=>o(50,m=e))),on(e,Q,(e=>o(73,I=e))),on(e,ee,(e=>o(52,$=e))),on(e,te,(e=>o(53,f=e))),on(e,oe,(e=>o(72,T=e))),on(e,ie,(e=>o(61,C=e))),on(e,re,(e=>o(74,A=e))),on(e,ne,(e=>o(75,z=e))),on(e,se,(e=>o(51,g=e)));const pe=L();let me,ge,$e,fe,ye,be,xe=de();const ve=(e,t,o,i,r)=>null!=e&&o!==t?e>=i[t]&&e<=r[t]?"valid":"invalid":"undetermined",we=(e,t,o)=>Math.round(null!=e?e/t:o.height),Se=()=>{H&&ge&&$e&&("width"===fe?o(39,$e=Math.round(ge/f)):"height"===fe?o(38,ge=Math.round($e*f)):("width"===ye?o(39,$e=Math.round(ge/f)):"height"===ye&&o(38,ge=Math.round($e*f)),ke()))},ke=e=>{let t=O(ge),i=O($e),r=t,n=i,a=r&&n,s=e||f;if(!r&&!n)return;r&&!n?n=Math.round(r/s):n&&!r&&(r=Math.round(n*s)),s=e||a?U(r,n):f;let l=We(r,n);je(N,l)||(l=xt(N,s)),je(l,V)||(l=bt(V,s)),o(38,ge=null!=t?Math.round(l.width):void 0),o(39,$e=null!=i?Math.round(l.height):void 0)},Ce=()=>{ke();const{width:e,height:t}=C||{};e===ge&&t===$e||(ge||$e?(ge&&$e&&un(oe,T=ge/$e,T),un(ie,C=We(ge,$e),C)):(un(oe,T=I.width/I.height,T),un(oe,T=void 0,T),un(ie,C=void 0,C)),ae.write())},Te=ie.subscribe((e=>{if(!e)return o(38,ge=void 0),void o(39,$e=void 0);o(38,ge=e.width),o(39,$e=e.height),ke()})),Me=oe.subscribe((e=>{(ge||$e)&&e&&(ge&&$e&&U(ge,$e)!==e?(o(39,$e=ge/e),ke(e)):ke())})),Re=e=>R(e[0])?(e[1]=e[1].map(Re),e):Ao(e)?[e,""+e]:e,Pe=e=>{if(R(e[0]))return e[1]=e[1].map(Pe),e;let[t,o]=e;if(Ao(t)&&Ao(o)){const[e,i]=[t,o];o=`${e} &times; ${i}`,t=[e,i]}return[t,o]},Ee=Ba();on(e,Ee,(e=>o(60,k=e)));const Ie=Ba();on(e,Ie,(e=>o(64,E=e)));const Ae=Ba();on(e,Ae,(e=>o(58,w=e)));const Le=Ba();on(e,Le,(e=>o(63,P=e)));const ze=Ba();on(e,ze,(e=>o(56,x=e)));const Fe=Ba();on(e,Fe,(e=>o(62,M=e)));const De=Wa([ie,Ie],(([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)}));on(e,De,(e=>o(59,S=e)));const Be=Wa([ie,Le],(([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex((([t])=>!t&&!e||!!t&&e.width===t));o(i<0?0:i)}));on(e,Be,(e=>o(57,v=e)));const _e=Wa([ie,Fe],(([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex((([t])=>!t&&!e||!!t&&e.height===t));o(i<0?0:i)}));on(e,_e,(e=>o(55,b=e)));let Ve=void 0,Ne=void 0;const He=Jn("redrawTrigger"),Ue=ec(m?20:0);return on(e,Ue,(e=>o(48,h=e))),Yn((()=>{Te(),Me()})),e.$$set=e=>{"isActive"in e&&D(o(0,B=e.isActive)),"stores"in e&&o(30,W=e.stores),"locale"in e&&o(1,_=e.locale),"resizeMinSize"in e&&o(31,V=e.resizeMinSize),"resizeMaxSize"in e&&o(32,N=e.resizeMaxSize),"resizeAspectRatioLocked"in e&&o(28,H=e.resizeAspectRatioLocked),"resizeEnableButtonLockAspectRatio"in e&&o(33,j=e.resizeEnableButtonLockAspectRatio),"resizeSizePresetOptions"in e&&o(34,Z=e.resizeSizePresetOptions),"resizeWidthPresetOptions"in e&&o(35,X=e.resizeWidthPresetOptions),"resizeHeightPresetOptions"in e&&o(36,Y=e.resizeHeightPresetOptions),"resizeWillRenderFooter"in e&&o(37,q=e.resizeWillRenderFooter)},e.$$.update=()=>{var t;262144&e.$$.dirty[1]&&le.set(!p),262144&e.$$.dirty[1]&&ce.set(!p),262144&e.$$.dirty[1]&&ue.set(!p),262144&e.$$.dirty[1]&&p&&he.set(!0),536870920&e.$$.dirty[1]&&Z&&(un(Ee,k=Z.map(Pe),k),un(Ie,E=cu(k),E)),536870912&e.$$.dirty[1]&&o(47,a=!!k),268435456&e.$$.dirty[1]|4&e.$$.dirty[2]&&o(46,i=S>-1&&E[S][1]),134217744&e.$$.dirty[1]&&X&&(un(Ae,w=X.map(Re),w),un(Le,P=cu(w),P)),134283264&e.$$.dirty[1]&&o(44,s=!a&&w),67108864&e.$$.dirty[1]|2&e.$$.dirty[2]&&o(45,r=v>-1&&P[v][1]),33554464&e.$$.dirty[1]&&Y&&(un(ze,x=Y.map(Re),x),un(Fe,M=cu(x),M)),33619968&e.$$.dirty[1]&&o(43,l=!a&&x),16777216&e.$$.dirty[1]|1&e.$$.dirty[2]&&o(42,n=b>-1&&M[b][1]),77824&e.$$.dirty[1]&&o(41,c=!a&&!s&&!l),268435458&e.$$.dirty[0]|1072824263&e.$$.dirty[1]&&o(4,d=He&&Fp((()=>{return q([a&&["Dropdown","size-presets",{label:i,options:k,onchange:e=>{return(t=e.value)&&!Ve&&(Ve={...$},Ne=T),t?(un(oe,T=U(t[0],t[1]),T),un(ie,C=Oe(t),C)):(un(ee,$=Ve,$),un(oe,T=Ne,T),un(ie,C=void 0,C),Ve=void 0,Ne=void 0),void ae.write();var t},selectedIndex:S}],s&&["Dropdown","width-presets",{label:r,options:w,onchange:e=>{o(38,ge=e.value),Ce()},selectedIndex:v}],s&&l&&["span","times",{class:"PinturaResizeLabel",innerHTML:"&times;"}],l&&["Dropdown","height-presets",{label:n,options:x,onchange:e=>{o(39,$e=e.value),Ce()},selectedIndex:b}],c&&[cx,"width-input",{id:"width-"+pe,title:_.resizeTitleInputWidth,label:_.resizeLabelInputWidth,placeholder:(e=O($e),t=f,d=$,Math.round(null!=e?e*t:d.width)),value:ge,state:ve(O(ge),"width",fe,V,N),onchange:e=>{o(38,ge=e),Se()}}],c&&j&&[px,"aspect-ratio-lock",{id:"aspect-ratio-lock-"+pe,title:_.resizeTitleButtonMaintainAspectRatio,icon:R(_.resizeIconButtonMaintainAspectRatio)?_.resizeIconButtonMaintainAspectRatio:_.resizeIconButtonMaintainAspectRatio(H,y),locked:H,onchange:e=>{o(28,H=e),Se()}}],c&&[cx,"height-input",{id:"height-"+pe,title:_.resizeTitleInputHeight,label:_.resizeLabelInputHeight,placeholder:we(O(ge),f,$),value:$e,state:ve(O($e),"height",fe,V,N),onchange:e=>{o(39,$e=e),Se()}}]].filter(Boolean),{...g},(()=>He.set({})));var e,t,d})).filter(Boolean)),268435456&e.$$.dirty[0]&&K.set(H?1:0),512&e.$$.dirty[1]&&fe&&(ye=fe),262144&e.$$.dirty[1]&&p&&(xe=z,be=A),1074003968&e.$$.dirty[1]&&(p?(t=C,un(ne,z=de(),z),un(re,A=t&&$?t.width/$.width||t.height/$.height:1,A)):(un(ne,z=xe,z),un(re,A=be,A))),786432&e.$$.dirty[1]&&m&&Ue.set(p?0:20),131072&e.$$.dirty[1]&&o(3,u=h?`transform: translateY(${h}px)`:void 0)},[B,_,me,u,d,K,J,Q,ee,te,oe,ie,re,ne,se,e=>{const t=e.target.id;/width/.test(t)?o(40,fe="width"):/height/.test(t)?o(40,fe="height"):/aspectRatio/i.test(t)?o(40,fe="lock"):o(40,fe=void 0)},e=>{me.contains(e.relatedTarget)||Ce(),o(40,fe=void 0)},Ce,Ee,Ie,Ae,Le,ze,Fe,De,Be,_e,Ue,H,"resize",W,V,N,j,Z,X,Y,q,ge,$e,fe,c,n,l,s,r,i,a,h,p,m,g,$,f,y,b,x,v,w,S,k,C,M,P,E,function(e){ta[e?"unshift":"push"]((()=>{me=e,o(2,me)}))},function(t){Qn.call(this,e,t)}]}var yx={util:["resize",class extends Fa{constructor(e){super(),za(this,e,fx,$x,Qr,{name:29,isActive:0,stores:30,locale:1,resizeMinSize:31,resizeMaxSize:32,resizeAspectRatioLocked:28,resizeEnableButtonLockAspectRatio:33,resizeSizePresetOptions:34,resizeWidthPresetOptions:35,resizeHeightPresetOptions:36,resizeWillRenderFooter:37},null,[-1,-1,-1,-1])}get name(){return this.$$.ctx[29]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),pa()}get stores(){return this.$$.ctx[30]}set stores(e){this.$$set({stores:e}),pa()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),pa()}get resizeMinSize(){return this.$$.ctx[31]}set resizeMinSize(e){this.$$set({resizeMinSize:e}),pa()}get resizeMaxSize(){return this.$$.ctx[32]}set resizeMaxSize(e){this.$$set({resizeMaxSize:e}),pa()}get resizeAspectRatioLocked(){return this.$$.ctx[28]}set resizeAspectRatioLocked(e){this.$$set({resizeAspectRatioLocked:e}),pa()}get resizeEnableButtonLockAspectRatio(){return this.$$.ctx[33]}set resizeEnableButtonLockAspectRatio(e){this.$$set({resizeEnableButtonLockAspectRatio:e}),pa()}get resizeSizePresetOptions(){return this.$$.ctx[34]}set resizeSizePresetOptions(e){this.$$set({resizeSizePresetOptions:e}),pa()}get resizeWidthPresetOptions(){return this.$$.ctx[35]}set resizeWidthPresetOptions(e){this.$$set({resizeWidthPresetOptions:e}),pa()}get resizeHeightPresetOptions(){return this.$$.ctx[36]}set resizeHeightPresetOptions(e){this.$$set({resizeHeightPresetOptions:e}),pa()}get resizeWillRenderFooter(){return this.$$.ctx[37]}set resizeWillRenderFooter(e){this.$$set({resizeWillRenderFooter:e}),pa()}},({src:e})=>e&&!kp(e)]};function bx(e){let t,o;return t=new Nb({props:{stores:e[3],locale:e[4],isActive:e[0],isActiveFraction:e[1],isVisible:e[2],mapScreenPointToImagePoint:e[9],mapImagePointToScreenPoint:e[8],utilKey:"redact",imageRotation:e[10],imageFlipX:e[7],imageFlipY:e[6],shapes:e[11],toolbar:["rect"],toolShapes:{rectangle:[{x:0,y:0,width:0,height:0}]},toolActive:"rectangle",parentRect:e[13],enablePresetDropImage:!1,enablePresetSelectImage:!1,willStartInteraction:e[5],hooks:{willRenderShapeControls:e[24]}}}),t.$on("measure",e[25]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,[o]){const i={};8&o&&(i.stores=e[3]),16&o&&(i.locale=e[4]),1&o&&(i.isActive=e[0]),2&o&&(i.isActiveFraction=e[1]),4&o&&(i.isVisible=e[2]),512&o&&(i.mapScreenPointToImagePoint=e[9]),256&o&&(i.mapImagePointToScreenPoint=e[8]),1024&o&&(i.imageRotation=e[10]),128&o&&(i.imageFlipX=e[7]),64&o&&(i.imageFlipY=e[6]),32&o&&(i.willStartInteraction=e[5]),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function xx(e,t,o){let i,r,n,a,s,l,c,d,u;let{isActive:h}=t,{isActiveFraction:p}=t,{isVisible:m}=t,{stores:g}=t,{locale:$={}}=t,{markupEditorWillStartInteraction:f}=t;const{imageRedaction:y,rootRect:b,imageSize:x,imageRotation:v,imageFlipX:w,imageFlipY:S,imageTransforms:k,imageTransformsInterpolated:C}=g;on(e,b,(e=>o(23,d=e))),on(e,x,(e=>o(22,c=e))),on(e,v,(e=>o(10,u=e))),on(e,w,(e=>o(7,a=e))),on(e,S,(e=>o(6,n=e))),on(e,k,(e=>o(21,l=e))),on(e,C,(e=>o(20,s=e)));return e.$$set=e=>{"isActive"in e&&o(0,h=e.isActive),"isActiveFraction"in e&&o(1,p=e.isActiveFraction),"isVisible"in e&&o(2,m=e.isVisible),"stores"in e&&o(3,g=e.stores),"locale"in e&&o(4,$=e.locale),"markupEditorWillStartInteraction"in e&&o(5,f=e.markupEditorWillStartInteraction)},e.$$.update=()=>{15728832&e.$$.dirty&&o(9,i=e=>jb(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,n)),15728832&e.$$.dirty&&o(8,r=e=>Hb(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,n))},[h,p,m,g,$,f,n,a,r,i,u,y,b,x,v,w,S,k,C,"redact",s,l,c,d,e=>{const t=zm(e[0]);return Dm("to-front",t),e},function(t){Qn.call(this,e,t)}]}var vx={util:["redact",class extends Fa{constructor(e){super(),za(this,e,xx,bx,Qr,{name:19,isActive:0,isActiveFraction:1,isVisible:2,stores:3,locale:4,markupEditorWillStartInteraction:5})}get name(){return this.$$.ctx[19]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),pa()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),pa()}get isVisible(){return this.$$.ctx[2]}set isVisible(e){this.$$set({isVisible:e}),pa()}get stores(){return this.$$.ctx[3]}set stores(e){this.$$set({stores:e}),pa()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),pa()}get markupEditorWillStartInteraction(){return this.$$.ctx[5]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),pa()}},({src:e})=>e&&!kp(e)]};function wx(e){let t,o,i=(P(e[32].label)?e[32].label(e[1]):e[32].label)+"";return{c(){t=kn("span"),o=Tn(i)},m(e,i){wn(e,t,i),bn(t,o)},p(e,t){2&t[0]|2&t[1]&&i!==(i=(P(e[32].label)?e[32].label(e[1]):e[32].label)+"")&&Fn(o,i)},d(e){e&&Sn(t)}}}function Sx(e){let t,o,i,r=(e[11](e[32].value)||"")+"",n=e[32].label&&wx(e);return{c(){t=kn("div"),o=new Bn(!1),i=Mn(),n&&n.c(),o.a=i,An(t,"slot","option")},m(e,a){wn(e,t,a),o.m(r,t),bn(t,i),n&&n.m(t,null)},p(e,i){2&i[1]&&r!==(r=(e[11](e[32].value)||"")+"")&&o.p(r),e[32].label?n?n.p(e,i):(n=wx(e),n.c(),n.m(t,null)):n&&(n.d(1),n=null)},d(e){e&&Sn(t),n&&n.d()}}}function kx(e){let t,o;return t=new Wu({props:{locale:e[1],class:"PinturaControlList",layout:"row",options:e[2],selectedIndex:e[4],onchange:e[10],$$slots:{option:[Sx,({option:e})=>({32:e}),({option:e})=>[0,e?2:0]]},$$scope:{ctx:e}}}),{c(){Ia(t.$$.fragment)},m(e,i){Aa(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]|6&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Cx(e){let t,o,i;return o=new vd({props:{elasticity:e[5],$$slots:{default:[kx]},$$scope:{ctx:e}}}),{c(){t=kn("div"),Ia(o.$$.fragment),An(t,"slot","footer"),An(t,"style",e[3])},m(e,r){wn(e,t,r),Aa(o,t,null),i=!0},p(e,r){const n={};32&r[0]&&(n.elasticity=e[5]),22&r[0]|4&r[1]&&(n.$$scope={dirty:r,ctx:e}),o.$set(n),(!i||8&r[0])&&An(t,"style",e[3])},i(e){i||(xa(o.$$.fragment,e),i=!0)},o(e){va(o.$$.fragment,e),i=!1},d(e){e&&Sn(t),La(o)}}}function Tx(e){let t,o;return t=new J$({props:{$$slots:{footer:[Cx]},$$scope:{ctx:e}}}),t.$on("measure",e[22]),{c(){Ia(t.$$.fragment)},m(e,i){Aa(t,e,i),o=!0},p(e,o){const i={};62&o[0]|4&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(xa(t.$$.fragment,e),o=!0)},o(e){va(t.$$.fragment,e),o=!1},d(e){La(t,e)}}}function Mx(e,t,o){let i,r,n,a,s,l,c,d,u,h,p=Gr,m=()=>(p(),p=en(g,(e=>o(17,l=e))),g);e.$$.on_destroy.push((()=>p()));let{isActive:g}=t;m();let{stores:$}=t,{locale:f={}}=t,{fillOptions:y=[]}=t;const b=e=>e.map((e=>(e=>Fo(e)&&R(e[0])&&Fo(e[1]))(e)?[e[0],b(e[1]),e[2]]:(e=>[Array.isArray(e)&&3===e.length?[...e,1]:e,void 0,{disabled:!1}])(e))),x=Jn("elasticityMultiplier");on(e,x,(e=>o(21,h=e)));const{history:v,animation:w,scrollElasticity:S,imageBackgroundColor:k,imageBackgroundImage:C,allowPan:T,allowZoom:M,allowZoomControls:P,allowPlayPause:E}=$;on(e,w,(e=>o(18,c=e))),on(e,k,(e=>o(20,u=e))),on(e,C,(e=>o(19,d=e)));const I=ec(c?20:0);return on(e,I,(e=>o(16,s=e))),e.$$set=e=>{"isActive"in e&&m(o(0,g=e.isActive)),"stores"in e&&o(14,$=e.stores),"locale"in e&&o(1,f=e.locale),"fillOptions"in e&&o(15,y=e.fillOptions)},e.$$.update=()=>{32768&e.$$.dirty[0]&&o(2,i=b(y)),131072&e.$$.dirty[0]&&T.set(l),131072&e.$$.dirty[0]&&M.set(l),131072&e.$$.dirty[0]&&P.set(l),131072&e.$$.dirty[0]&&l&&E.set(!0),2097152&e.$$.dirty[0]&&o(5,r=h*S),1572868&e.$$.dirty[0]&&o(4,n=i.findIndex((([e])=>d?e===d:Array.isArray(e)?ds(e,u):void 0))||0),393216&e.$$.dirty[0]&&c&&I.set(l?0:20),65536&e.$$.dirty[0]&&o(3,a=s?`transform: translateY(${s}px)`:void 0)},[g,f,i,a,n,r,x,w,k,C,({value:e})=>{R(e)&&(un(k,u=void 0,u),un(C,d=e,d)),Fo(e)&&(un(k,u=e,u),un(C,d=void 0,d)),v.write()},e=>{if(R(e))return`<div class="PinturaFillTile"><img src="${e}" alt="" width="48" height="64"/></div>`;if(Fo(e)){const[t,o,i,r]=e.map(((e,t)=>t<3?Math.round(255*e):e));return`<div class="PinturaFillTile" data-transparent="${r<1}"><div style="background-color:rgba(${t},${o},${i},${r})"></div></div>`}return"<div></div>"},I,"fill",$,y,s,l,c,d,u,h,function(t){Qn.call(this,e,t)}]}var Rx={util:["fill",class extends Fa{constructor(e){super(),za(this,e,Mx,Tx,Qr,{name:13,isActive:0,stores:14,locale:1,fillOptions:15},null,[-1,-1])}get name(){return this.$$.ctx[13]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),pa()}get stores(){return this.$$.ctx[14]}set stores(e){this.$$set({stores:e}),pa()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),pa()}get fillOptions(){return this.$$.ctx[15]}set fillOptions(e){this.$$set({fillOptions:e}),pa()}},({src:e,fillOptions:t})=>e&&!kp(e)&&t&&t.length]};function Px(e){let t,o,i;function r(t){e[41](t)}let n={utilKey:"retouch",stores:e[4],locale:e[5],isActive:e[1],isActiveFraction:e[2],isVisible:e[3],mapScreenPointToImagePoint:e[26],mapImagePointToScreenPoint:e[25],imageRotation:e[27],imageFlipX:e[24],imageFlipY:e[23],toolbar:e[6],toolbarLayout:"stack",shapes:e[29],toolShapes:e[7],enableViewTool:e[14],enableMoveTool:e[13],enableToolShareStyles:!1,shapeControls:e[8],enablePresetSelectImage:!1,enablePresetDropImage:!1,parentRect:e[30],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]&&(n.toolActive=e[0]),t=new Nb({props:n}),ta.push((()=>Ea(t,"toolActive",r))),t.$on("measure",e[42]),{c(){Ia(t.$$.fragment)},m(e,o){Aa(t,e,o),i=!0},p(e,i){const r={};16&i[0]&&(r.stores=e[4]),32&i[0]&&(r.locale=e[5]),2&i[0]&&(r.isActive=e[1]),4&i[0]&&(r.isActiveFraction=e[2]),8&i[0]&&(r.isVisible=e[3]),67108864&i[0]&&(r.mapScreenPointToImagePoint=e[26]),33554432&i[0]&&(r.mapImagePointToScreenPoint=e[25]),134217728&i[0]&&(r.imageRotation=e[27]),16777216&i[0]&&(r.imageFlipX=e[24]),8388608&i[0]&&(r.imageFlipY=e[23]),64&i[0]&&(r.toolbar=e[6]),128&i[0]&&(r.toolShapes=e[7]),16384&i[0]&&(r.enableViewTool=e[14]),8192&i[0]&&(r.enableMoveTool=e[13]),256&i[0]&&(r.shapeControls=e[8]),4096&i[0]&&(r.willStartInteraction=e[12]),132096&i[0]&&(r.willRenderHeaderTools=e[10]||e[17]),512&i[0]&&(r.willRenderShapeStyleControls=e[9]),8226816&i[0]&&(r.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,r.toolActive=e[0],ca((()=>o=!1))),t.$set(r)},i(e){i||(xa(t.$$.fragment,e),i=!0)},o(e){va(t.$$.fragment,e),i=!1},d(e){La(t,e)}}}function Ex(e,t,o){let i,r,n,a,s,l,c,d,u;let{isActive:h}=t,{isActiveFraction:p}=t,{isVisible:m}=t,{stores:g}=t,{locale:$={}}=t,{retouchTools:f}=t,{retouchToolShapes:y}=t,{retouchShapeControls:b}=t,{retouchActiveTool:x}=t,{retouchWillRenderShapeStyleControls:v}=t,{retouchWillRenderHeaderTools:w}=t,{retouchWillRenderShapeControls:S}=t,{markupEditorWillStartInteraction:k}=t,{retouchEnableMoveTool:C}=t,{retouchEnableViewTool:T}=t,{willRenderShapeControls:M}=t,{willRenderShapeTextControls:R}=t,{willRenderHeaderTools:P}=t,{beforeAddShape:E}=t,{beforeRemoveShape:I}=t,{beforeDeselectShape:A}=t,{beforeSelectShape:L}=t,{beforeUpdateShape:z}=t;const{rootRect:F,imageManipulation:D,imageSize:O,imageRotation:B,imageFlipX:W,imageFlipY:_,imageTransforms:V,imageTransformsInterpolated:N}=g;return on(e,F,(e=>o(40,d=e))),on(e,O,(e=>o(39,c=e))),on(e,B,(e=>o(27,u=e))),on(e,W,(e=>o(24,a=e))),on(e,_,(e=>o(23,n=e))),on(e,V,(e=>o(38,l=e))),on(e,N,(e=>o(37,s=e))),e.$$set=e=>{"isActive"in e&&o(1,h=e.isActive),"isActiveFraction"in e&&o(2,p=e.isActiveFraction),"isVisible"in e&&o(3,m=e.isVisible),"stores"in e&&o(4,g=e.stores),"locale"in e&&o(5,$=e.locale),"retouchTools"in e&&o(6,f=e.retouchTools),"retouchToolShapes"in e&&o(7,y=e.retouchToolShapes),"retouchShapeControls"in e&&o(8,b=e.retouchShapeControls),"retouchActiveTool"in e&&o(0,x=e.retouchActiveTool),"retouchWillRenderShapeStyleControls"in e&&o(9,v=e.retouchWillRenderShapeStyleControls),"retouchWillRenderHeaderTools"in e&&o(10,w=e.retouchWillRenderHeaderTools),"retouchWillRenderShapeControls"in e&&o(11,S=e.retouchWillRenderShapeControls),"markupEditorWillStartInteraction"in e&&o(12,k=e.markupEditorWillStartInteraction),"retouchEnableMoveTool"in e&&o(13,C=e.retouchEnableMoveTool),"retouchEnableViewTool"in e&&o(14,T=e.retouchEnableViewTool),"willRenderShapeControls"in e&&o(15,M=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(16,R=e.willRenderShapeTextControls),"willRenderHeaderTools"in e&&o(17,P=e.willRenderHeaderTools),"beforeAddShape"in e&&o(18,E=e.beforeAddShape),"beforeRemoveShape"in e&&o(19,I=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(20,A=e.beforeDeselectShape),"beforeSelectShape"in e&&o(21,L=e.beforeSelectShape),"beforeUpdateShape"in e&&o(22,z=e.beforeUpdateShape)},e.$$.update=()=>{25165824&e.$$.dirty[0]|960&e.$$.dirty[1]&&o(26,i=e=>jb(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,n)),25165824&e.$$.dirty[0]|960&e.$$.dirty[1]&&o(25,r=e=>Hb(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,n))},[x,h,p,m,g,$,f,y,b,v,w,S,k,C,T,M,R,P,E,I,A,L,z,n,a,r,i,u,F,D,O,B,W,_,V,N,"retouch",s,l,c,d,function(e){x=e,o(0,x)},function(t){Qn.call(this,e,t)}]}var Ix={util:["retouch",class extends Fa{constructor(e){super(),za(this,e,Ex,Px,Qr,{name:36,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},null,[-1,-1])}get name(){return this.$$.ctx[36]}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$$set({isActive:e}),pa()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),pa()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$$set({isVisible:e}),pa()}get stores(){return this.$$.ctx[4]}set stores(e){this.$$set({stores:e}),pa()}get locale(){return this.$$.ctx[5]}set locale(e){this.$$set({locale:e}),pa()}get retouchTools(){return this.$$.ctx[6]}set retouchTools(e){this.$$set({retouchTools:e}),pa()}get retouchToolShapes(){return this.$$.ctx[7]}set retouchToolShapes(e){this.$$set({retouchToolShapes:e}),pa()}get retouchShapeControls(){return this.$$.ctx[8]}set retouchShapeControls(e){this.$$set({retouchShapeControls:e}),pa()}get retouchActiveTool(){return this.$$.ctx[0]}set retouchActiveTool(e){this.$$set({retouchActiveTool:e}),pa()}get retouchWillRenderShapeStyleControls(){return this.$$.ctx[9]}set retouchWillRenderShapeStyleControls(e){this.$$set({retouchWillRenderShapeStyleControls:e}),pa()}get retouchWillRenderHeaderTools(){return this.$$.ctx[10]}set retouchWillRenderHeaderTools(e){this.$$set({retouchWillRenderHeaderTools:e}),pa()}get retouchWillRenderShapeControls(){return this.$$.ctx[11]}set retouchWillRenderShapeControls(e){this.$$set({retouchWillRenderShapeControls:e}),pa()}get markupEditorWillStartInteraction(){return this.$$.ctx[12]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),pa()}get retouchEnableMoveTool(){return this.$$.ctx[13]}set retouchEnableMoveTool(e){this.$$set({retouchEnableMoveTool:e}),pa()}get retouchEnableViewTool(){return this.$$.ctx[14]}set retouchEnableViewTool(e){this.$$set({retouchEnableViewTool:e}),pa()}get willRenderShapeControls(){return this.$$.ctx[15]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),pa()}get willRenderShapeTextControls(){return this.$$.ctx[16]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),pa()}get willRenderHeaderTools(){return this.$$.ctx[17]}set willRenderHeaderTools(e){this.$$set({willRenderHeaderTools:e}),pa()}get beforeAddShape(){return this.$$.ctx[18]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),pa()}get beforeRemoveShape(){return this.$$.ctx[19]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),pa()}get beforeDeselectShape(){return this.$$.ctx[20]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),pa()}get beforeSelectShape(){return this.$$.ctx[21]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),pa()}get beforeUpdateShape(){return this.$$.ctx[22]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),pa()}},({src:e})=>e&&!kp(e)]};const Ax='<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>',Lx='<path fill="none" d="M9 15 L12 9 L15 15 M10 13.5 h3" stroke="currentColor" stroke-width=".125em"/>';var zx={labelReset:"Reset",labelDefault:"Default",labelAuto:"Auto",labelNone:"None",labelEdit:"Edit",labelClose:"Close",labelSupportError:e=>e.join(", ")+" 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",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:Ax,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:Ax,statusLabelLoadImage:e=>e&&e.task?e.error?"IMAGE_TOO_SMALL"===e.error.code?"Minimum image size is {minWidth} &times; {minHeight}":"Error loading image":"blob-to-bitmap"===e.task?"Preparing image&hellip;":"Loading image&hellip;":"Waiting for image",statusLabelProcessImage:e=>{if(e&&e.task)return"store"===e.task?e.error?"Error uploading image":"Uploading image&hellip;":e.error?"Error processing image":"Processing image&hellip;"}};const Fx={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:""+Lx,shapeIconButtonTextLayoutAutoHeight:'<g fill="currentColor"><circle cx="4" cy="12" r="1.5"/><circle cx="20" cy="12" r="1.5"/></g>'+Lx,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>'+Lx,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",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"/>'};var Dx={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:(e,t)=>{const[o,i,r]=t?[t<1?1:.3,1===t?.85:.5,t>1?1:.3]:[.2,.3,.4];return`<g fill="currentColor">\n            <rect opacity="${o}" x="2" y="4" width="10" height="18" rx="1"/>\n            <rect opacity="${i}" x="4" y="8" width="14" height="14" rx="1"/>\n            <rect opacity="${r}" x="6" y="12" width="17" height="10" rx="1"/>\n        </g>`},cropIconCropBoundary:(e,t)=>{const[o,i,r,n]=t?[.3,1,0,0]:[0,0,.3,1];return`<g fill="currentColor">\n            <rect opacity="${o}" x="2" y="3" width="20" height="20" rx="1"/>\n            <rect opacity="${i}" x="7" y="8" width="10" height="10" rx="1"/>\n            <rect opacity="${r}" x="4" y="8" width="14" height="14" rx="1"/>\n            <rect opacity="${n}" 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"},Ox={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    '},Bx={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"},Wx={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>'},_x={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    '},Vx=(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]}))},Nx=e=>{const t={},{sub:o,pub:i}=Xo();u()&&null!==document.doctype||console.warn("Browser is in quirks mode, add <!DOCTYPE html> to page to fix render issues");const r=Ss();Vx(r,t);const n=((e,t)=>{const o={},i=new xm({target:e,props:{stores:t,pluginComponents:Array.from(Mm)}});let r=!1;const n=()=>{r||(u()&&window.removeEventListener("pagehide",n),i&&(r=!0,i.$destroy()))};km||(km=new Set(Xc(xm).filter((e=>!wm.includes(e))))),km.forEach((e=>{Object.defineProperty(o,e,{get:()=>i[e],set:Sm.includes(e)?t=>{i[e]={...i[e],...t}}:t=>i[e]=t})})),Object.defineProperty(o,"previewImageData",{get:()=>i.imagePreviewCurrent}),Cm.forEach((e=>{const t=Tm[e],r=t[0];Object.defineProperty(o,e,{get:()=>i.pluginInterface[r][e],set:o=>{const r=t.reduce(((t,r)=>(t[r]={...i.pluginOptions[r],[e]:o},t)),{});i.pluginOptions={...i.pluginOptions,...r}}})})),Object.defineProperty(o,"element",{get:()=>i.root,set:()=>{}});const a=i.history;return qa(o,{on:(e,t)=>{if(r)return()=>{};if(/undo|redo|revert|writehistory/.test(e))return a.on(e,t);const o=[i.sub(e,t),i.$on(e,(e=>t(e instanceof CustomEvent&&!e.detail?void 0:e)))].filter(Boolean);return()=>o.forEach((e=>e()))},updateImagePreview:e=>{i.imagePreviewSrc=e},close:()=>!r&&i.pub("close"),destroy:n}),Object.defineProperty(o,"history",{get:()=>({undo:()=>a.undo(),redo:()=>a.redo(),revert:()=>a.revert(),get:()=>a.get(),getCollapsed:()=>a.get().splice(0,a.index+1),set:e=>a.set(e),write:e=>a.write(e),get length(){return a.length()},get index(){return a.index},set index(e){a.index=e}})}),u()&&window.addEventListener("pagehide",n),o})(e,r.stores);Vx(n,t);const s=["loadImage","processImage","abortProcessImage","abortLoadImage"].map((e=>n.on(e,(t=>{const o=r[e](t&&t.detail);o instanceof Promise&&o.catch(a)})))),l=(e,t)=>{const i=o(e,t),a=r.on(e,t),s=n.on(e,t);return()=>{i(),a(),s()}};t.handleEvent=a;const c=Pm.map((e=>l(e,(o=>t.handleEvent(e,o)))));return qa(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:()=>{i("close")},destroy:()=>{[...s,...c].forEach((e=>e())),n.destroy(),r.destroy(),i("destroy")}}),setTimeout((()=>i("init",t)),0),t};const Hx="pintura-editor";var jx=()=>new Promise((e=>{if(!Ux)return e([]);var t;t=Hx,document.createElement(t).constructor===HTMLElement&&customElements.define(Hx,Ux),customElements.whenDefined(Hx).then((()=>e(document.querySelectorAll(Hx))))}));const Ux=u()&&class extends HTMLElement{constructor(){super(),this._editor=void 0,this._unsubs=void 0}static get observedAttributes(){return["src"]}attributeChangedCallback(e,t,o){this[e]=o}connectedCallback(){this._editor=Nx(this),Vx(this._editor,this),this._editor.src=this.getAttribute("src"),this._unsubs=Em(this._editor,this)}disconnectedCallback(){this._editor.destroy(),this._unsubs.forEach((e=>e()))}},Gx="pintura-editor";var Zx=(e,t={})=>{const o=R(e)?document.querySelector(e):e;if(!Wt(o))return;t.class=t.class?"pintura-editor "+t.class:Gx;const i=Nx(o);return Object.assign(i,t)};const{document:Xx,window:Yx}=ka;function qx(e){let t,o,i,r;return la(e[27]),{c(){t=Mn(),o=kn("div"),An(o,"class",e[4]),An(o,"style",e[5])},m(n,a){wn(n,t,a),wn(n,o,a),e[28](o),i||(r=[Pn(Yx,"keydown",e[10]),Pn(Yx,"orientationchange",e[11]),Pn(Yx,"resize",e[27]),Pn(Xx.body,"focusin",(function(){Jr(!e[1]&&e[7])&&(!e[1]&&e[7]).apply(this,arguments)})),Pn(Xx.body,"focusout",(function(){Jr(e[2]&&e[8])&&(e[2]&&e[8]).apply(this,arguments)})),Pn(o,"wheel",e[9],{passive:!1})],i=!0)},p(t,i){e=t,16&i[0]&&An(o,"class",e[4]),32&i[0]&&An(o,"style",e[5])},i:Gr,o:Gr,d(n){n&&Sn(t),n&&Sn(o),e[28](null),i=!1,Kr(r)}}}function Kx(e,t,o){let i,r,n,a,s,l,c,d;const h=qn();let{root:p}=t,{preventZoomViewport:m=!0}=t,{preventScrollBodyIfNeeded:$=!0}=t,{preventFooterOverlapIfNeeded:f=!0}=t,{class:y}=t,b=!0,x=!1,v=!1,w=u()&&document.documentElement,S=u()&&document.body,k=u()&&document.head;const C=ec(0,{precision:.001,damping:.5});on(e,C,(e=>o(26,d=e)));const T=C.subscribe((e=>{v&&e>=1?(o(19,v=!1),o(1,b=!1),h("show")):x&&e<=0&&(o(18,x=!1),o(1,b=!0),h("hide"))}));let M=!1,R=void 0,P=void 0,E=void 0;const I=()=>document.querySelector("meta[name=viewport]"),A=()=>Array.from(document.querySelectorAll("meta[name=theme-color]"));let L;const z=(e,t)=>{const o=()=>{e()?t():requestAnimationFrame(o)};requestAnimationFrame(o)};let F,D,O=0,B=void 0;const W=()=>{D||(D=g("div",{style:"position:fixed;height:100vh;top:0"}),S.append(D))};Zn((()=>{f&&$o()&&W()})),Xn((()=>{D&&(o(21,B=D.offsetHeight),D.remove(),D=void 0)}));let _=void 0;const V=()=>w.style.setProperty("--pintura-document-height",window.innerHeight+"px");return Yn((()=>{w.classList.remove("PinturaModalBodyLock"),T()})),e.$$set=e=>{"root"in e&&o(0,p=e.root),"preventZoomViewport"in e&&o(12,m=e.preventZoomViewport),"preventScrollBodyIfNeeded"in e&&o(13,$=e.preventScrollBodyIfNeeded),"preventFooterOverlapIfNeeded"in e&&o(14,f=e.preventFooterOverlapIfNeeded),"class"in e&&o(15,y=e.class)},e.$$.update=()=>{67895298&e.$$.dirty[0]&&o(25,i=v||x?d:b?0:1),4096&e.$$.dirty[0]&&(r="width=device-width,height=device-height,initial-scale=1"+(m?",maximum-scale=1,user-scalable=0":"")),786434&e.$$.dirty[0]&&o(22,n=!v&&!b&&!x),12&e.$$.dirty[0]&&(M||o(20,F=O)),2097160&e.$$.dirty[0]&&o(24,a=Ao(B)?"--viewport-pad-footer:"+(B>O?0:1):""),51380224&e.$$.dirty[0]&&o(5,s=`opacity:${i};height:${F}px;--editor-modal:1;${a}`),32768&e.$$.dirty[0]&&o(4,l=Mc(["pintura-editor","PinturaModal",y])),8192&e.$$.dirty[0]&&o(23,c=$&&$o()&&/15_/.test(navigator.userAgent)),12582912&e.$$.dirty[0]&&c&&(e=>{e?(_=window.scrollY,w.classList.add("PinturaDocumentLock"),V(),window.addEventListener("resize",V)):(window.removeEventListener("resize",V),w.classList.remove("PinturaDocumentLock"),Ao(_)&&window.scrollTo(0,_),_=void 0)})(n)},[p,b,M,O,l,s,C,e=>{Gd(e.target)&&(o(2,M=!0),L=O)},e=>{if(Gd(e.target))if(clearTimeout(undefined),L===O)o(2,M=!1);else{const e=O;z((()=>O!==e),(()=>o(2,M=!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]===p&&h("close")},W,m,$,f,y,()=>{if(v||!b)return;o(19,v=!0);const e=I()||g("meta",{name:"viewport"});R=!R&&e.getAttribute("content"),e.setAttribute("content",r+(/cover/.test(R)?",viewport-fit=cover":"")),e.parentNode||k.append(e);const t=getComputedStyle(p).getPropertyValue("--color-background"),i=A();if(i.length)P=i.map((e=>e.getAttribute("content")));else{const e=g("meta",{name:"theme-color"});k.append(e),i.push(e)}i.forEach((e=>e.setAttribute("content",`rgb(${t})`))),clearTimeout(E),E=setTimeout((()=>C.set(1)),250)},()=>{if(x||b)return;clearTimeout(E),o(18,x=!0);const e=I();R?e.setAttribute("content",R):e.remove();const t=A();P?t.forEach(((e,t)=>{e.setAttribute("content",P[t])})):t.forEach((e=>e.remove())),C.set(0)},x,v,F,B,n,c,a,i,d,function(){o(3,O=Yx.innerHeight)},function(e){ta[e?"unshift":"push"]((()=>{p=e,o(0,p)}))}]}class Jx extends Fa{constructor(e){super(),za(this,e,Kx,qx,Qr,{root:0,preventZoomViewport:12,preventScrollBodyIfNeeded:13,preventFooterOverlapIfNeeded:14,class:15,show:16,hide:17},null,[-1,-1])}get root(){return this.$$.ctx[0]}set root(e){this.$$set({root:e}),pa()}get preventZoomViewport(){return this.$$.ctx[12]}set preventZoomViewport(e){this.$$set({preventZoomViewport:e}),pa()}get preventScrollBodyIfNeeded(){return this.$$.ctx[13]}set preventScrollBodyIfNeeded(e){this.$$set({preventScrollBodyIfNeeded:e}),pa()}get preventFooterOverlapIfNeeded(){return this.$$.ctx[14]}set preventFooterOverlapIfNeeded(e){this.$$set({preventFooterOverlapIfNeeded:e}),pa()}get class(){return this.$$.ctx[15]}set class(e){this.$$set({class:e}),pa()}get show(){return this.$$.ctx[16]}get hide(){return this.$$.ctx[17]}}const Qx=(e,t,o,i)=>{const r=ue(t.x-e.x,t.y-e.y),n=fe(r),a=5*o;let s;s=i?.5*a:Math.ceil(.5*(a-1));const l=ke(pe(n),s);return{anchor:pe(e),offset:l,normal:n,solid:i,size:a,sizeHalf:s}},ev=({anchor:e,solid:t,normal:o,offset:i,size:r,sizeHalf:n,strokeWidth:a,strokeColor:s,strokeJoin:l,strokeCap:c,bitmap:d},u)=>{const h=e.x,p=e.y,m=ke(pe(o),r),g=ue(h+m.x,p+m.y);if(ke(m,.55),t){ve(u,i);const e=ke(pe(o),.5*n);return[{points:[ue(h-e.x,p-e.y),ue(g.x-m.y,g.y+m.x),ue(g.x+m.y,g.y-m.x)],pathClose:!0,backgroundColor:s}]}{const e=ke((e=>{const t=e.x;return e.x=-e.y,e.y=t,e})(pe(o)),.5),t=ue(h-e.x,p-e.y),i=ue(h+e.x,p+e.y);return[{points:[ue(g.x+m.y,g.y-m.x),t,ue(h,p),i,ue(g.x-m.y,g.y+m.x)],pathClose:!1,strokeWidth:a,strokeColor:s,strokeJoin:l,strokeCap:c,bitmap:d}]}},tv=({anchor:e,solid:t,offset:o,normal:i,sizeHalf:r,strokeWidth:n,strokeColor:a},s)=>(ve(s,o),t&&ve(s,me(pe(i))),[{x:e.x,y:e.y,rx:r,ry:r,backgroundColor:t?a:void 0,strokeWidth:t?void 0:n,strokeColor:t?void 0:a}]),ov=({anchor:e,offset:t,strokeWidth:o,strokeColor:i,strokeJoin:r,strokeCap:n,bitmap:a})=>[{points:[ue(e.x-t.y,e.y+t.x),ue(e.x+t.y,e.y-t.x)],strokeWidth:o,strokeColor:i,strokeJoin:r,strokeCap:n,bitmap:a}],iv=({anchor:e,solid:t,offset:o,normal:i,sizeHalf:r,strokeWidth:n,strokeColor:a},s)=>{return ve(s,o),[{x:e.x-r,y:e.y-r,width:2*r,height:2*r,rotation:(l=i,Math.atan2(l.y,l.x)),backgroundColor:t?a:void 0,strokeWidth:t?void 0:n,strokeColor:t?void 0:a}];var l},rv=(e={})=>t=>{if(!t.lineStart&&!t.lineEnd)return;const o=[],{lineStart:i,lineEnd:r,strokeWidth:n,strokeColor:a,strokeJoin:s,strokeCap:l,bitmap:c}=t,d=ue(t.x1,t.y1),u=ue(t.x2,t.y2),h=[d,u];if(i){const[t,r]=i.split("-"),h=e[t];if(h){const e=Qx(d,u,n,!!r);o.push(...h({...e,strokeColor:a,strokeWidth:n,strokeJoin:s,strokeCap:l,bitmap:c},d))}}if(r){const[t,i]=r.split("-"),h=e[t];if(h){const e=Qx(u,d,n,!!i);o.push(...h({...e,strokeColor:a,strokeWidth:n,strokeJoin:s,strokeCap:l,bitmap:c},u))}}return[{points:h,strokeWidth:n,strokeColor:a,strokeJoin:s,strokeCap:l,bitmap:c},...o]},nv=()=>({arrow:ev,circle:tv,square:iv,bar:ov}),av=(e,t)=>{const o=parseFloat(e)*t;return R(e)?o+"%":o},sv=(e,t)=>R(e)?ar(e,t):e,lv=e=>[{...e,frameStyle:"line",frameInset:0,frameOffset:0,frameSize:e.frameSize?av(e.frameSize,2):"2.5%",frameRadius:e.frameRound?av(e.frameSize,2):0}],cv=({width:e,height:t,frameImage:o,frameSize:i="15%",frameOutset:r=0,frameSlices:n={x1:.15,y1:.15,x2:.85,y2:.85}},{isPreview:a})=>{if(!o)return[];const s=Math.sqrt(e*t),l=sv(i,s),c=a?l:Math.round(l),d=c,u=sv(r,s),h=2*u,{x1:p,x2:m,y1:g,y2:$}=n,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+h,height:f.ch,backgroundCorners:[{x:p,y:0},{x:m,y:0},{x:m,y:g},{x:p,y:g}],backgroundImage:o},{expandsCanvas:x,x:f.x1-y-u,y:f.y2+u,width:f.ew+b+h,height:f.ch,backgroundCorners:[{x:p,y:$},{x:m,y:$},{x:m,y:1},{x:p,y:1}],backgroundImage:o},{expandsCanvas:x,x:f.x0-u,y:f.y1-y-u,width:f.cw,height:f.eh+b+h,backgroundCorners:[{x:0,y:g},{x:p,y:g},{x:p,y:$},{x:0,y:$}],backgroundImage:o},{expandsCanvas:x,x:f.x2+u,y:f.y1-y-u,width:f.cw,height:f.eh+b+h,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:p,y:0},{x:p,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:p,y:$},{x:p,y:1},{x:0,y:1}]}]},dv=({x:e,y:t,width:o,height:i,frameInset:r="3.5%",frameSize:n=".25%",frameColor:a=[1,1,1],frameOffset:s="5%",frameAmount:l=1,frameRadius:c=0,expandsCanvas:d=!1},{isPreview:u})=>{const h=Math.sqrt(o*i);let p=sv(n,h);const m=sv(r,h),g=sv(s,h);let $=0;u||(p=Math.max(1,Math.round(p)),$=p%2==0?0:.5);const f=sv(av(c,l),h);return new Array(l).fill(void 0).map(((r,n)=>{const s=g*n;let l=e+m+s,c=t+m+s,h=e+o-m-s,y=t+i-m-s;u||(l=Math.round(l),c=Math.round(c),h=Math.round(h),y=Math.round(y));return{x:l+$,y:c+$,width:h-l,height:y-c,cornerRadius:f>0?f-s:0,strokeWidth:p,strokeColor:a,expandsCanvas:d}}))},uv=({x:e,y:t,width:o,height:i,frameSize:r=".25%",frameOffset:n=0,frameInset:a="2.5%",frameColor:s=[1,1,1]},{isPreview:l})=>{const c=Math.sqrt(o*i);let d=sv(r,c),u=sv(a,c),h=sv(n,c),p=0;l||(d=Math.max(1,Math.round(d)),u=Math.round(u),h=Math.round(h),p=d%2==0?0:.5);const m=h-u,g=e+u+p,$=t+u+p,f=e+o-u-p,y=t+i-u-p;return[{points:[ue(g+m,$),ue(f-m,$)]},{points:[ue(f,$+m),ue(f,y-m)]},{points:[ue(f-m,y),ue(g+m,y)]},{points:[ue(g,y-m),ue(g,$+m)]}].map((e=>(e.strokeWidth=d,e.strokeColor=s,e)))},hv=({x:e,y:t,width:o,height:i,frameSize:r=".25%",frameInset:n="2.5%",frameLength:a="2.5%",frameColor:s=[1,1,1]},{isPreview:l})=>{const c=Math.sqrt(o*i);let d=sv(r,c),u=sv(n,c),h=sv(a,c),p=0;l||(d=Math.max(1,Math.round(d)),u=Math.round(u),h=Math.round(h),p=d%2==0?0:.5);const m=e+u+p,g=t+u+p,$=e+o-u-p,f=t+i-u-p;return[{points:[ue(m,g+h),ue(m,g),ue(m+h,g)]},{points:[ue($-h,g),ue($,g),ue($,g+h)]},{points:[ue($,f-h),ue($,f),ue($-h,f)]},{points:[ue(m+h,f),ue(m,f),ue(m,f-h)]}].map((e=>(e.strokeWidth=d,e.strokeColor=s,e)))},pv=({x:e,y:t,width:o,height:i,frameColor:r=[1,1,1]},{isPreview:n})=>{const a=Math.sqrt(o*i),s=.1*a;let l=.2*a,c=0;const d=.5*s;return n?c=1:l=Math.ceil(l),r.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:r,expandsCanvas:!0},{id:"chin",x:e-d,y:i-c,width:o+s,height:l,backgroundColor:r,expandsCanvas:!0}].filter(Boolean)},mv=(e={})=>(t,o)=>{if(!zo(t,"frameStyle"))return;const i=t.frameStyle,r=e[i];if(!r)return;const{frameStyle:n,...a}=t;return r(a,o)},gv=()=>({solid:lv,hook:hv,line:dv,edge:uv,polaroid:pv,nine:cv}),$v=e=>{const t=(o,i={isPreview:!0})=>{const r=e.map((e=>{const r=e(o,i);if(r)return r.map((e=>t(e,i)))})).filter(Boolean).flat();return r.length?r.flat().map(((e,t)=>(e.id=o.id+"_"+t,e))):o};return t};"undefined"!=typeof window&&(e=>{if(!e)return;const[t,o,i,r]=[[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]].map((e=>e.map((e=>String.fromCharCode(e))).join("")));e._clpdx4s=new e[o](r)[i](e[t])})(window);const fv=il,yv=nl,bv=(e,...t)=>(o,i)=>{var r;r=e,(Array.isArray(r)||P(r))&&(t=[e,...t]);const n=C(e)?e:{};t=Array.isArray(t)?t.reduce(((e,t)=>[...e,...Array.isArray(t)?[...t]:[t]]),[]):t;for(let e=0;e<t.length;e++){const r=t[e](o,i,n);if(Array.isArray(r))return r}},xv=()=>({read:c,apply:k}),vv=(e={})=>{const{blurAmount:t,dataSizeScalar:o,scrambleAmount:i,backgroundColor:r}=e;return(e,n)=>(async(e,t={})=>{if(!e)return;const{width:o,height:i}=e,{dataSize:r=96,dataSizeScalar:n=1,scrambleAmount:a=4,blurAmount:s=6,outputFormat:l="canvas",backgroundColor:c=[0,0,0]}=t,d=Math.round(r*n),u=Math.min(d/o,d/i),h=Math.floor(o*u),p=Math.floor(i*u),m=g("canvas",{width:h,height:p}),$=m.getContext("2d",{willReadFrequently:!0});if(c.length=3,$.fillStyle=Ho(c),$.fillRect(0,0,h,p),y(e)){const t=g("canvas",{width:o,height:i});t.getContext("2d",{willReadFrequently:!0}).putImageData(e,0,0),$.drawImage(t,0,0,h,p),f(t)}else $.drawImage(e,0,0,h,p);const b=$.getImageData(0,0,h,p),x=[];if(a>0&&x.push([Zl,{amount:a}]),s>0)for(let e=0;e<s;e++)x.push([Mo,{matrix:Xl}]);let v;if(x.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(x,0)})(null, imageData)\n}`,o=await F(t,[{imageData:b,filterInstructions:x.map((e=>e[1]))}],[b.data.buffer]);v=ko(o)}else v=b;return"canvas"===l?($.putImageData(v,0,0),m):v})(e,{blurAmount:t,scrambleAmount:i,backgroundColor:r,...n,dataSizeScalar:o||n.dataSizeScalar})},wv=Ss,Sv=Hg,kv=Vg,Cv=F$,Tv={markupEditorToolbar:Hg(),markupEditorToolStyles:Vg(),markupEditorShapeStyleControls:F$()},Mv=Rm,Rv=Xf,Pv=ty,Ev=ly,Iv=Xb,Av=Kb,Lv=ex,zv=ax,Fv=vx,Dv=yx,Ov=Rx,Bv=Ix,Wv=mg,_v=Qm,Vv=kg,Nv=zx,Hv=Fx,jv=Dx,Uv=Ox,Gv={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"},Zv={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"},Xv={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 aspectratio",resizeIconButtonMaintainAspectRatio:(e,t)=>`<defs><mask id="mask1" x="0" y="0" 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 ${3*(t-1)})" 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>`},Yv={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>'},qv={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>'},Kv={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>'},Jv=Bx,Qv=Wx,ew=_x,tw=(e,t,o={})=>(R(t)?Array.from(document.querySelectorAll(t)):t).filter(Boolean).map((t=>e(t,M(o)))),ow=Zx,iw=(e={},t)=>{const{sub:o,pub:i}=Xo(),r={},n=((e={},t)=>new Jx({target:t||document.body,props:{class:e.class,preventZoomViewport:e.preventZoomViewport,preventScrollBodyIfNeeded:e.preventScrollBodyIfNeeded,preventFooterOverlapIfNeeded:e.preventFooterOverlapIfNeeded}}))(e,t),s=()=>{n.hide&&n.hide()},l=()=>{n.show&&n.show()},c=Nx(n.root);Vx(c,r),r.handleEvent=a,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)?o(e,t):c.on(e,t),u=["show","hide"].map((e=>d(e,(t=>r.handleEvent(e,t))))),h=()=>{u.forEach((e=>e())),s(),n.$destroy(),c.destroy()};return qa(r,{on:d,destroy:h,hide:s,show:l}),Object.defineProperty(r,"modal",{get:()=>n.root,set:()=>{}}),n.$on("close",c.close),n.$on("show",(()=>i("show"))),n.$on("hide",(()=>{i("hide"),!1!==e.enableAutoDestroy&&h()})),!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},rw=(e,t)=>Zx(e,{...t,layout:"overlay"}),nw=$v,aw=(e=[])=>$v([mv(gv()),rv(nv()),...e]),sw=(e={})=>{let t,o=void 0;Array.isArray(e.imageReader)||(o=e.imageReader,delete e.imageReader),Array.isArray(e.imageWriter)?t=yv():(t=P(e.imageWriter)?e.imageWriter:yv(e.imageWriter),delete e.imageWriter);let i=void 0;return P(e.imageScrambler)||(i=e.imageScrambler,delete e.imageScrambler),{imageReader:fv(o),imageWriter:t,imageOrienter:xv(),imageScrambler:vv(i)}},lw=(e,t={})=>{const o=sw(t),i="function"==typeof t.shapePreprocessor?t.shapePreprocessor:aw(t.shapePreprocessor);return delete t.shapePreprocessor,t=_a([{...o,shapePreprocessor:i,stickerStickToImage:!0},t]),ks(e,t)},cw=(e={})=>{Rm(Rv,Pv,Ev,Iv,Av,Lv,zv,Fv,Dv,Ov);const t=sw(e),o={...Nv,...Hv,...jv,...Uv,...Gv,...Zv,...Jv,...Qv,...Xv,...Yv,...qv,...Kv,...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=Cv({...e.markupEditorShapeStyleControls}))}return _a([{...t,shapePreprocessor:i,utils:["trim","crop","filter","finetune","retouch","annotate","decorate","sticker","fill","frame","redact","resize"],...Wv,..._v,...Vv,...Tv,stickerStickToImage:!0,locale:o},e])},dw=async(e={})=>{const t=await jx();return t.forEach((t=>Object.assign(t,M(e)))),t},uw=(e,t)=>ow(e,cw(t)),hw=(e,t,o,i)=>new Promise((async(r,n)=>{const{format:a="canvas",backgroundColor:s=[0,0,0],foregroundColor:l=[1,1,1],scope:c="mask",padding:d=0,maxSize:u=t,targetSize:h,forceSquareCanvas:p=!1,precision:m=7}=i||{},{flipX:$,flipY:f,rotation:y}=o,b=Math.min(1,2048/t.width),x=Ve({...t},b),v=He({...t},y),w=He({...x},y),S={x:.5*(x.width-w.width),y:.5*(x.height-w.height),...w},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 vr(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,b,C))),imageBackgroundColor:"image"===c?[0,0,0]:void 0,imageCropLimitToImage:!1,imageCrop:S,imageFlipX:$,imageFlipY:f,imageRotation:y,imageWriter:{format:"canvas"}},{dest:M}=await lw(g("canvas",x),{...T}),R=M.getContext("2d",{desynchronized:!0,willReadFrequently:!0});let P,E;{const e=Number.MAX_SAFE_INTEGER,{width:t,height:o}=M,i=R.getImageData(0,0,t,o).data;let r,n,a=Math.max(1,parseInt(m,10)),s=t-a,l=o-a,[c,d,h,p]=[e,-e,-e,e];for(r=0;r<=l;r+=a)for(n=0;n<=s;n+=a){i[4*(n+r*t)+3]<=32||(n<p?p=n:n>d&&(d=n),r<c?c=r:r>h&&(h=r))}const g=et([c-m,d+m,h+m,p-m]),$=at(g),f=Math.min(g.width,u.width),y=Math.min(g.height,u.height);P=nt($.x-.5*f,$.y-.5*y,f,y)}lt(P,1/b,de());let I=d,A=d;if("mask"===c){const e=De(P);if(e.width+=2*I,e.height+=2*A,p){const t=Math.max(e.width,e.height);I+=.5*(t-e.width),A+=.5*(t-e.height),e.width=t,e.height=t}let t=1;h&&(t=Math.min(h.width/e.width,h.height/e.height,1)),Ve(e,t);const o=g("canvas",e),i=o.getContext("2d");i.fillStyle=Ho(s),i.fillRect(0,0,o.width,o.height),k&&(i.globalCompositeOperation="destination-out"),i.scale(t,t),i.drawImage(M,-P.x+I,-P.y+A,v.width,v.height),E=o}else E=M;const L=Qe(t);L.x+=.5*(v.width-t.width),L.y+=.5*(v.height-t.height);const[z]=$t(L,y),F=at({...P}),D=ue(F.x-z.x,F.y-z.y);P.x=Math.cos(y)*D.x+Math.sin(y)*D.y-.5*P.width,P.y=Math.cos(y)*D.y-Math.sin(y)*D.x-.5*P.height;const O={...P};if(O.x=P.x,O.y=P.y,$&&f?(O.flipX=!0,O.flipY=!0,O.rotation=-y):$?(O.flipX=!0,O.rotation=y):f?(O.flipY=!0,O.rotation=y):O.rotation=-y,$||f){const e={x:O.x+.5*O.width,y:O.y+.5*O.height};$&&(e.x=Math.abs(t.width-e.x),O.x=e.x-.5*O.width),f&&(e.y=Math.abs(t.height-e.y),O.y=e.y-.5*O.height)}if(I||A){const e=I/(P.width+2*I),t=A/(P.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}],P.x-=I,P.y-=A,P.width+=2*I,P.height+=2*A}const B={canvas:E,rect:P,shape:O};"blob"!==a?r({...B,blob:void 0}):E.toBlob((e=>r({...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(Am(t))return t.push(e);t[3]=[...zm(t),e]},e.blobToFile=j,e.canvasToBlob=O,e.colorStringToColorArray=Bh,e.createDefaultColorOptions=jg,e.createDefaultFontFamilyOptions=Kg,e.createDefaultFontScaleOptions=Zg,e.createDefaultFontSizeOptions=Ug,e.createDefaultFontStyleOptions=Qg,e.createDefaultFrameStyles=gv,e.createDefaultImageOrienter=xv,e.createDefaultImageReader=fv,e.createDefaultImageScrambler=vv,e.createDefaultImageWriter=yv,e.createDefaultLineEndStyleOptions=qg,e.createDefaultLineEndStyles=nv,e.createDefaultLineHeightOptions=Gg,e.createDefaultLineHeightScaleOptions=Xg,e.createDefaultMediaWriter=bv,e.createDefaultShapePreprocessor=aw,e.createDefaultStrokeScaleOptions=Yg,e.createDefaultStrokeWidthOptions=()=>[1,2,3,4,6,8,12,16,20,24,32,48,64],e.createDefaultTextAlignOptions=Jg,e.createEditor=wv,e.createFrameStyleProcessor=mv,e.createLineEndProcessor=rv,e.createMarkupEditorBackgroundColorControl=m$,e.createMarkupEditorBrushSizeControl=Bg,e.createMarkupEditorColorControl=p$,e.createMarkupEditorColorOptions=e$,e.createMarkupEditorFontColorControl=v$,e.createMarkupEditorFontFamilyControl=u$,e.createMarkupEditorFontFamilyOptions=r$,e.createMarkupEditorFontScaleOptions=t$,e.createMarkupEditorFontSizeControl=C$,e.createMarkupEditorFontSizeOptions=e=>e.map(Pg),e.createMarkupEditorFontStyleControl=w$,e.createMarkupEditorFontStyleOptions=n$,e.createMarkupEditorLineEndStyleControl=x$,e.createMarkupEditorLineEndStyleOptions=a$,e.createMarkupEditorLineHeightControl=T$,e.createMarkupEditorLineHeightOptions=e=>e.map(Pg),e.createMarkupEditorLineHeightScaleOptions=o$,e.createMarkupEditorLineStartStyleControl=b$,e.createMarkupEditorOptionControl=f$,e.createMarkupEditorOptionsControl=(e,t={})=>["Dropdown",{...t,options:e}],e.createMarkupEditorSelectionModeControl=Og,e.createMarkupEditorSelectionToolStyles=(e,t)=>{const{tools:o=Dg}=t||{};return o.reduce(((t,o)=>{const[i,r]=Fg[o],n=_g(i,{...r,action:e},{position:"absolute",isSelection:!0});return Object.assign(t,{[`selection-${o}-${e}`]:n})}),{})},e.createMarkupEditorSelectionTools=(e,t)=>{const{tools:o=Dg,hideLabel:i=!0}=t||{};return o.map((t=>[`selection-${t}-${e}`,Rg(t,"shapeLabelToolSelection"),{hideLabel:i,icon:Rg(t,"shapeIconToolSelection")}]))},e.createMarkupEditorShapeStyleControls=Cv,e.createMarkupEditorStrokeColorControl=g$,e.createMarkupEditorStrokeScaleOptions=i$,e.createMarkupEditorStrokeWidthControl=$$,e.createMarkupEditorStrokeWidthOptions=e=>e.map(Pg),e.createMarkupEditorTextAlignControl=M$,e.createMarkupEditorToolStyle=_g,e.createMarkupEditorToolStyles=kv,e.createMarkupEditorToolbar=Sv,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,r,n)=>{const{retouches:a=[],maxSize:s=t,targetSize:l,padding:c=0,mimeType:d,foregroundColor:u,maskFormat:h="blob",imageFormat:p="blob",forceSquareCanvas:m=!1,didCreateDraft:g=(()=>{})}=n||{},$=[...i],f=[...a],y=new AbortController,{blob:b,canvas:x,rect:v,shape:w}=await hw($,t,o,{scope:"mask",format:h,padding:c,maxSize:s,targetSize:l,forceSquareCanvas:m,foregroundColor:u}),S=((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}))(L(),{...w});var k;k=S,Object.assign(k,{status:"loading",cornerRadius:15,strokeWidth:1.5,strokeColor:[0,0,0,.25],backgroundColor:[0,0,0,.1],selectionOpacity:0}),g(S,{selection:$});let C={};(d||l||"canvas"===p)&&(C={imageWriter:{}},d&&(C.imageWriter.mimeType=d),l&&(C.imageWriter.targetSize=l),p&&(C.imageWriter.format=p));const{flipX:T,flipY:M,rotation:R}=o,{dest:P}=await lw(e,{imageFlipX:T,imageFlipY:M,imageRotation:R,imageCrop:v,imageManipulation:f,imageCropLimitToImage:!1,...C});let E;try{await r(P,b||x,{shape:S,controller:y}),E="ok"}catch{E="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))({...S,status:E,disableSelect:!1})},e.createShapePreprocessor=nw,e.defineCustomElements=dw,e.defineDefaultCustomElements=e=>dw(cw(e)),e.degToRad=Cl,e.dispatchEditorEvents=Em,e.effectBrightness=ag,e.effectClarity=hg,e.effectContrast=sg,e.effectExposure=cg,e.effectGamma=dg,e.effectSaturation=lg,e.effectTemperature=pg,e.effectVignette=ug,e.filterChrome=_m,e.filterCold=Hm,e.filterFade=Vm,e.filterInvert=()=>[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],e.filterMonoDefault=jm,e.filterMonoNoir=Um,e.filterMonoStark=Zm,e.filterMonoWash=Gm,e.filterPastel=Wm,e.filterSepiaBlues=Ym,e.filterSepiaColor=Km,e.filterSepiaDefault=Xm,e.filterSepiaRust=qm,e.filterWarm=Nm,e.findNode=Om,e.frameEdgeCross=xg,e.frameEdgeOverlap=vg,e.frameEdgeSeparate=bg,e.frameHook=wg,e.frameLineMultiple=yg,e.frameLineSingle=fg,e.framePolaroid=Sg,e.frameSolidRound=$g,e.frameSolidSharp=gg,e.getEditorDefaults=cw,e.getEditorProps=()=>(()=>{const e=xs.map(vs),t=Xa.map((([e])=>e)).filter((e=>!bs.includes(e)));return e.concat(t)})().concat((km=new Set(Xc(xm).filter((e=>!wm.includes(e)))),[...km,...Cm])),e.getShapeById=(e,t)=>e.find((e=>e.id===t)),e.getUniqueId=L,e.imageStateToCanvas=(e,t,o)=>{const{targetCanvas:i,targetSize:r,disableDraw:n=!1,shapePreprocessor:a}=o||{},s=i||document.createElement("canvas"),{crop:l,colorMatrix:c,convolutionMatrix:d}=t,u=Qt(e),h={width:u?e.videoWidth:e.width,height:u?e.videoHeight:e.height},{upscale:p=!1,fit:m="contain",width:$,height:f}=r||{};let y=1;"contain"===m?y=Math.min(($||Number.MAX_SAFE_INTEGER)/l.width,(f||Number.MAX_SAFE_INTEGER)/l.height):"cover"===m&&(y=Math.max(($||l.width)/l.width,(f||l.height)/l.height)),p||(y=Math.min(y,1));const b=Math.floor(l.width*y),x=Math.floor(l.height*y),v=u?Gl(b):b,w=u?Gl(x):x,S=Ul(s,{alpha:!0});S.resize(v,w,1);const k=S.textureCreate();let C;S.setCanvasColor([0,0,0,0]),S.drawToCanvas(),S.disableMask(),S.disablePreviewStencil();{const e=Object.values(c||{}).filter(Boolean);e.length&&(C=jr(e))}const T={x:0,y:0,width:v,height:w},{origin:M,translation:R,rotation:P,scale:E}=al(T,T,h,l,{x:0,y:0,width:v,height:w},y,{x:0,y:0},1,t.rotation,t.flipX,t.flipY),I=[h,M.x,M.y,R.x,R.y,P.x,P.y,P.z,E,C,1,d&&d.clarity,Ao(t.gamma)?t.gamma:1,t.vignette||0,[1,0,1,0,1,w,1,v],void 0,void 0,void 0,void 0,!1];let A=!1;const L=t.decoration.length||t.annotation.length,z=L&&S.textureCreate(),F=()=>{S.textureUpdate(k,e,{filterParam:S.textureFilterLinear,wrapParam:S.textureClamp})},D=()=>{F(),S.drawImage(k,...I),L&&A&&S.drawRect(T,0,!1,!1,[0,0,0,0],void 0,z)};return F(),!n&&D(),{canvas:s,prepare:async()=>{if(!L)return;const{dest:e}=await ks(g("canvas",h),{shapePreprocessor:a,imageReader:[[async(e,t,o)=>{const{src:i}=e,r=parseInt(i.width,10),n=parseInt(i.height,10),a=await O(i);return{...e,dest:a,size:{width:r,height:n}}},"read-canvas"]],imageWriter:nl({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}});S.textureUpdate(z,e,{filterParam:S.textureFilterLinear,wrapParam:S.textureClamp}),A=!0,!n&&D()},redraw:D,destroy:()=>{S.release()}}},e.insertNodeAfter=(e,t,o)=>Fm(e,t,o,(e=>e+1)),e.insertNodeBefore=(e,t,o)=>Fm(e,t,o),e.isSupported=()=>(null===ng&&(ng=u()&&!("[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),ng),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,rg(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 r=o[i];return i=eg[i]||i,/px$/.test(r)?r=tg(r):/^(?:x|y|left|right|top|bottom|width|height|fontSize|borderWidth|strokeWidth)$/.test(i)&&"number"==typeof r&&("strokeWidth"!==i&&"borderWidth"!==i&&"fontSize"!==i||(r=Math.min(e.width,e.height)*r+"px"),r=tg(r)),/color/i.test(i)&&r&&(r=Bh(r)),null===r&&(r=void 0),t[i]=r,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=og(i.x,i.width),i.y2=og(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(!Ao(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 r=t*e.width,n=o*e.height;t=r/e.width*100,o=n/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=og(i.x,i.rx),i.y=og(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?Me(e,o)<1e-9||(t.push(o),e=o,e=o):(t.push(o),e=o);i.points=t.map((e=>({x:tg(e.x),y:tg(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 r=e?e.filterFunctions:Jm;i.colorMatrix.filter="string"==typeof t&&r[t]?r[t]():t.matrix}const r=o.size?o.size:!!o.resize&&o.resize.size;return r&&r.width&&r.height&&(i.targetSize={width:r.width,height:r.height}),i},e.locale_en_gb=Nv,e.markup_editor_defaults=Tv,e.markup_editor_locale_en_gb=Hv,e.naturalAspectRatioToNumber=e=>{if(void 0===e||Ao(e))return e;if(!R(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)=>rw(e,cw(t)),e.overlayEditor=rw,e.plugin_annotate=Iv,e.plugin_annotate_locale_en_gb=qv,e.plugin_crop=Rv,e.plugin_crop_locale_en_gb=jv,e.plugin_decorate=Av,e.plugin_decorate_locale_en_gb=Yv,e.plugin_fill=Ov,e.plugin_fill_locale_en_gb=Uv,e.plugin_filter=Pv,e.plugin_filter_defaults=_v,e.plugin_filter_locale_en_gb=Gv,e.plugin_finetune=Ev,e.plugin_finetune_defaults=Wv,e.plugin_finetune_locale_en_gb=Zv,e.plugin_frame=zv,e.plugin_frame_defaults=Vv,e.plugin_frame_locale_en_gb=Jv,e.plugin_redact=Fv,e.plugin_redact_locale_en_gb=Qv,e.plugin_resize=Dv,e.plugin_resize_locale_en_gb=Xv,e.plugin_retouch=Bv,e.plugin_retouch_locale_en_gb=ew,e.plugin_sticker=Lv,e.plugin_sticker_locale_en_gb=Kv,e.processDefaultImage=lw,e.processImage=ks,e.removeNode=Dm,e.selectionToMask=hw,e.setPlugins=Mv,e.shapeGetCenter=wr,e.shapeGetLength=e=>{if(e.x1)return Re(ue(e.x1,e.y1),ue(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 r=-t.rotation;return!o&&!i||o&&i||(r=-r),{flipX:o,flipY:i,rotation:r}},e.supportsWebGL=Rp,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})}));
