@htmlbricks/hb-stylus-paper 0.61.40 → 0.61.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/main.iife.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(mn){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const qi=1,Hi=2,zi=16,Wi=1,Bi=4,Ui=8,Vi=16,Gi=2,wn="[",Mr="[!",Pr="]",jt={},ve=Symbol(),Ji="http://www.w3.org/1999/xhtml",yn=!1;var kr=Array.isArray,Ki=Array.prototype.indexOf,Lr=Array.from,_r=Object.keys,Yt=Object.defineProperty,bt=Object.getOwnPropertyDescriptor,Zi=Object.getOwnPropertyDescriptors,Qi=Object.prototype,ea=Array.prototype,bn=Object.getPrototypeOf,En=Object.isExtensible;function xn(e){for(var t=0;t<e.length;t++)e[t]()}function ta(){var e,t,r=new Promise((i,a)=>{e=i,t=a});return{promise:r,resolve:e,reject:t}}const Te=2,jr=4,$n=8,Ft=16,et=32,ft=64,Sn=128,Me=256,pr=512,ye=1024,Pe=2048,ut=4096,Ye=8192,Et=16384,Yr=32768,Fr=65536,Tn=1<<17,ra=1<<18,Xt=1<<19,na=1<<20,Xr=1<<21,qr=1<<22,xt=1<<23,gr=Symbol("$state"),In=Symbol("legacy props"),ia=Symbol(""),Hr=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},An=3,Zt=8;function aa(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function sa(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function la(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function oa(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function fa(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function ua(e){throw new Error("https://svelte.dev/e/effect_orphan")}function ca(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function da(){throw new Error("https://svelte.dev/e/hydration_failed")}function va(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function ha(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function _a(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function pa(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function mr(e){console.warn("https://svelte.dev/e/hydration_mismatch")}let G=!1;function tt(e){G=e}let W;function ze(e){if(e===null)throw mr(),jt;return W=e}function wr(){return ze(vt(W))}function ct(e){if(G){if(vt(W)!==null)throw mr(),jt;W=e}}function zr(){for(var e=0,t=W;;){if(t.nodeType===Zt){var r=t.data;if(r===Pr){if(e===0)return t;e-=1}else(r===wn||r===Mr)&&(e+=1)}var i=vt(t);t.remove(),t=i}}function Dn(e){if(!e||e.nodeType!==Zt)throw mr(),jt;return e.data}function On(e){return e===this.v}function ga(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Nn(e){return!ga(e,this.v)}let ma=!1,ke=null;function yr(e){ke=e}function Rn(e,t=!1,r){ke={p:ke,c:null,e:null,s:e,x:null,l:null}}function Cn(e){var t=ke,r=t.e;if(r!==null){t.e=null;for(var i of r)ti(i)}return e!==void 0&&(t.x=e),ke=t.p,e??{}}function Mn(){return!0}const wa=new WeakMap;function ya(e){var t=k;if(t===null)return Y.f|=xt,e;if((t.f&Yr)===0){if((t.f&Sn)===0)throw!t.parent&&e instanceof Error&&Pn(e),e;t.b.error(e)}else Wr(e,t)}function Wr(e,t){for(;t!==null;){if((t.f&Sn)!==0)try{t.b.error(e);return}catch(r){e=r}t=t.parent}throw e instanceof Error&&Pn(e),e}function Pn(e){const t=wa.get(e);t&&(Yt(e,"message",{value:t.message}),Yt(e,"stack",{value:t.stack}))}let Br=[],Ur=[];function ba(){var e=Br;Br=[],xn(e)}function Ea(){var e=Ur;Ur=[],xn(e)}function xa(){Br.length>0&&ba(),Ur.length>0&&Ea()}function $a(){const e=k.b;return e===null&&aa(),e}function Vr(e){var t=Te|Pe,r=Y!==null&&(Y.f&Te)!==0?Y:null;return k===null||r!==null&&(r.f&Me)!==0?t|=Me:k.f|=Xt,{ctx:ke,deps:null,effects:null,equals:On,f:t,fn:e,reactions:null,rv:0,v:ve,wv:0,parent:r??k,ac:null}}function Sa(e,t){let r=k;r===null&&la();var i=r.b,a=void 0,s=Qt(ve),l=null,o=!Y;return Pa(()=>{try{var f=e();l&&Promise.resolve(f).catch(()=>{})}catch(h){f=Promise.reject(h)}var d=()=>f;a=l?.then(d,d)??Promise.resolve(f),l=a;var p=de,m=i.is_pending();o&&(i.update_pending_count(1),m||p.increment());const g=(h,c=void 0)=>{l=null,m||p.activate(),c?c!==Hr&&(s.f|=xt,$r(s,c)):((s.f&xt)!==0&&(s.f^=xt),$r(s,h)),o&&(i.update_pending_count(-1),m||p.decrement()),Yn()};if(a.then(g,h=>g(null,h||"unknown")),p)return()=>{queueMicrotask(()=>p.neuter())}}),new Promise(f=>{function d(p){function m(){p===a?f(s):d(a)}p.then(m,m)}d(a)})}function kn(e){const t=Vr(e);return t.equals=Nn,t}function Ln(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)We(t[r])}}function Ta(e){for(var t=e.parent;t!==null;){if((t.f&Te)===0)return t;t=t.parent}return null}function Gr(e){var t,r=k;_t(Ta(e));try{Ln(e),t=hi(e)}finally{_t(r)}return t}function jn(e){var t=Gr(e);if(e.equals(t)||(e.v=t,e.wv=di()),!Dt){var r=(pt||(e.f&Me)!==0)&&e.deps!==null?ut:ye;Ae(e,r)}}function Ia(e,t,r){const i=Vr;if(t.length===0){r(e.map(i));return}var a=de,s=k,l=Aa(),o=$a();Promise.all(t.map(f=>Sa(f))).then(f=>{a?.activate(),l();try{r([...e.map(i),...f])}catch(d){(s.f&Et)===0&&Wr(d,s)}a?.deactivate(),Yn()}).catch(f=>{o.error(f)})}function Aa(){var e=k,t=Y,r=ke,i=de;return function(){_t(e),Ue(t),yr(r),i?.activate()}}function Yn(){_t(null),Ue(null),yr(null)}const Jr=new Set;let de=null,Fn=new Set,br=[];function Xn(){const e=br.shift();br.length>0&&queueMicrotask(Xn),e()}let $t=[],Er=null,Kr=!1,xr=!1;class St{current=new Map;#t=new Map;#e=new Set;#r=0;#f=null;#u=!1;#i=[];#s=[];#a=[];#n=[];#l=[];#c=[];#d=[];skipped_effects=new Set;process(t){$t=[];for(const a of t)this.#h(a);if(this.#i.length===0&&this.#r===0){this.#v();var r=this.#a,i=this.#n;this.#a=[],this.#n=[],this.#l=[],de=null,Hn(r),Hn(i),de===null?de=this:Jr.delete(this),this.#f?.resolve()}else this.#o(this.#a),this.#o(this.#n),this.#o(this.#l);for(const a of this.#i)Wt(a);for(const a of this.#s)Wt(a);this.#i=[],this.#s=[]}#h(t){t.f^=ye;for(var r=t.first;r!==null;){var i=r.f,a=(i&(et|ft))!==0,s=a&&(i&ye)!==0,l=s||(i&Ye)!==0||this.skipped_effects.has(r);if(!l&&r.fn!==null){if(a)r.f^=ye;else if((i&jr)!==0)this.#n.push(r);else if((i&ye)===0)if((i&qr)!==0){var o=r.b?.is_pending()?this.#s:this.#i;o.push(r)}else Sr(r)&&((r.f&Ft)!==0&&this.#l.push(r),Wt(r));var f=r.first;if(f!==null){r=f;continue}}var d=r.parent;for(r=r.next;r===null&&d!==null;)r=d.next,d=d.parent}}#o(t){for(const r of t)((r.f&Pe)!==0?this.#c:this.#d).push(r),Ae(r,ye);t.length=0}capture(t,r){this.#t.has(t)||this.#t.set(t,r),this.current.set(t,t.v)}activate(){de=this}deactivate(){de=null;for(const t of Fn)if(Fn.delete(t),t(),de!==null)break}neuter(){this.#u=!0}flush(){$t.length>0?qn():this.#v(),de===this&&(this.#r===0&&Jr.delete(this),this.deactivate())}#v(){if(!this.#u)for(const t of this.#e)t();this.#e.clear()}increment(){this.#r+=1}decrement(){if(this.#r-=1,this.#r===0){for(const t of this.#c)Ae(t,Pe),qt(t);for(const t of this.#d)Ae(t,ut),qt(t);this.#a=[],this.#n=[],this.flush()}else this.deactivate()}add_callback(t){this.#e.add(t)}settled(){return(this.#f??=ta()).promise}static ensure(){if(de===null){const t=de=new St;Jr.add(de),xr||St.enqueue(()=>{de===t&&t.flush()})}return de}static enqueue(t){br.length===0&&queueMicrotask(Xn),br.unshift(t)}}function me(e){var t=xr;xr=!0;try{for(var r;;){if(xa(),$t.length===0&&(de?.flush(),$t.length===0))return Er=null,r;qn()}}finally{xr=t}}function qn(){var e=zt;Kr=!0;try{var t=0;for(oi(!0);$t.length>0;){var r=St.ensure();if(t++>1e3){var i,a;Da()}r.process($t),dt.clear()}}finally{Kr=!1,oi(e),Er=null}}function Da(){try{ca()}catch(e){Wr(e,Er)}}let Tt=null;function Hn(e){var t=e.length;if(t!==0){for(var r=0;r<t;){var i=e[r++];if((i.f&(Et|Ye))===0&&Sr(i)&&(Tt=[],Wt(i),i.deps===null&&i.first===null&&i.nodes_start===null&&(i.teardown===null&&i.ac===null?ai(i):i.fn=null),Tt?.length>0)){dt.clear();for(const a of Tt)Wt(a);Tt=[]}}Tt=null}}function qt(e){for(var t=Er=e;t.parent!==null;){t=t.parent;var r=t.f;if(Kr&&t===k&&(r&Ft)!==0)return;if((r&(ft|et))!==0){if((r&ye)===0)return;t.f^=ye}}$t.push(t)}const dt=new Map;function Qt(e,t){var r={f:0,v:e,reactions:null,equals:On,rv:0,wv:0};return r}function C(e,t){const r=Qt(e);return Ya(r),r}function zn(e,t=!1,r=!0){const i=Qt(e);return t||(i.equals=Nn),i}function _(e,t,r=!1){Y!==null&&(!Be||(Y.f&Tn)!==0)&&Mn()&&(Y.f&(Te|Ft|qr|Tn))!==0&&!it?.includes(e)&&pa();let i=r?rt(t):t;return $r(e,i)}function $r(e,t){if(!e.equals(t)){var r=e.v;Dt?dt.set(e,t):dt.set(e,r),e.v=t;var i=St.ensure();i.capture(e,r),(e.f&Te)!==0&&((e.f&Pe)!==0&&Gr(e),Ae(e,(e.f&Me)===0?ye:ut)),e.wv=di(),Wn(e,Pe),k!==null&&(k.f&ye)!==0&&(k.f&(et|ft))===0&&(Le===null?Fa([e]):Le.push(e))}return t}function er(e,t=1){var r=n(e),i=t===1?r++:r--;return _(e,r),i}function Zr(e){_(e,e.v+1)}function Wn(e,t){var r=e.reactions;if(r!==null)for(var i=r.length,a=0;a<i;a++){var s=r[a],l=s.f,o=(l&Pe)===0;o&&Ae(s,t),(l&Te)!==0?Wn(s,ut):o&&((l&Ft)!==0&&Tt!==null&&Tt.push(s),qt(s))}}function rt(e){if(typeof e!="object"||e===null||gr in e)return e;const t=bn(e);if(t!==Qi&&t!==ea)return e;var r=new Map,i=kr(e),a=C(0),s=Ot,l=o=>{if(Ot===s)return o();var f=Y,d=Ot;Ue(null),ci(s);var p=o();return Ue(f),ci(d),p};return i&&r.set("length",C(e.length)),new Proxy(e,{defineProperty(o,f,d){(!("value"in d)||d.configurable===!1||d.enumerable===!1||d.writable===!1)&&ha();var p=r.get(f);return p===void 0?p=l(()=>{var m=C(d.value);return r.set(f,m),m}):_(p,d.value,!0),!0},deleteProperty(o,f){var d=r.get(f);if(d===void 0){if(f in o){const p=l(()=>C(ve));r.set(f,p),Zr(a)}}else _(d,ve),Zr(a);return!0},get(o,f,d){if(f===gr)return e;var p=r.get(f),m=f in o;if(p===void 0&&(!m||bt(o,f)?.writable)&&(p=l(()=>{var h=rt(m?o[f]:ve),c=C(h);return c}),r.set(f,p)),p!==void 0){var g=n(p);return g===ve?void 0:g}return Reflect.get(o,f,d)},getOwnPropertyDescriptor(o,f){var d=Reflect.getOwnPropertyDescriptor(o,f);if(d&&"value"in d){var p=r.get(f);p&&(d.value=n(p))}else if(d===void 0){var m=r.get(f),g=m?.v;if(m!==void 0&&g!==ve)return{enumerable:!0,configurable:!0,value:g,writable:!0}}return d},has(o,f){if(f===gr)return!0;var d=r.get(f),p=d!==void 0&&d.v!==ve||Reflect.has(o,f);if(d!==void 0||k!==null&&(!p||bt(o,f)?.writable)){d===void 0&&(d=l(()=>{var g=p?rt(o[f]):ve,h=C(g);return h}),r.set(f,d));var m=n(d);if(m===ve)return!1}return p},set(o,f,d,p){var m=r.get(f),g=f in o;if(i&&f==="length")for(var h=d;h<m.v;h+=1){var c=r.get(h+"");c!==void 0?_(c,ve):h in o&&(c=l(()=>C(ve)),r.set(h+"",c))}if(m===void 0)(!g||bt(o,f)?.writable)&&(m=l(()=>C(void 0)),_(m,rt(d)),r.set(f,m));else{g=m.v!==ve;var v=l(()=>rt(d));_(m,v)}var x=Reflect.getOwnPropertyDescriptor(o,f);if(x?.set&&x.set.call(p,d),!g){if(i&&typeof f=="string"){var L=r.get("length"),y=Number(f);Number.isInteger(y)&&y>=L.v&&_(L,y+1)}Zr(a)}return!0},ownKeys(o){n(a);var f=Reflect.ownKeys(o).filter(m=>{var g=r.get(m);return g===void 0||g.v!==ve});for(var[d,p]of r)p.v!==ve&&!(d in o)&&f.push(d);return f},setPrototypeOf(){_a()}})}var Bn,Un,Vn,Gn;function Qr(){if(Bn===void 0){Bn=window,Un=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;Vn=bt(t,"firstChild").get,Gn=bt(t,"nextSibling").get,En(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),En(r)&&(r.__t=void 0)}}function It(e=""){return document.createTextNode(e)}function At(e){return Vn.call(e)}function vt(e){return Gn.call(e)}function ht(e,t){if(!G)return At(e);var r=At(W);if(r===null)r=W.appendChild(It());else if(t&&r.nodeType!==An){var i=It();return r?.before(i),ze(i),i}return ze(r),r}function K(e,t){if(!G){var r=At(e);return r instanceof Comment&&r.data===""?vt(r):r}return W}function Jn(e,t=1,r=!1){let i=G?W:e;for(var a;t--;)a=i,i=vt(i);if(!G)return i;if(r&&i?.nodeType!==An){var s=It();return i===null?a?.after(s):i.before(s),ze(s),s}return ze(i),i}function Kn(e){e.textContent=""}function Zn(){return!1}function Qn(e){var t=Y,r=k;Ue(null),_t(null);try{return e()}finally{Ue(t),_t(r)}}function Oa(e){k===null&&Y===null&&ua(),Y!==null&&(Y.f&Me)!==0&&k===null&&fa(),Dt&&oa()}function Na(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function nt(e,t,r,i=!0){var a=k;a!==null&&(a.f&Ye)!==0&&(e|=Ye);var s={ctx:ke,deps:null,nodes_start:null,nodes_end:null,f:e|Pe,first:null,fn:t,last:null,next:null,parent:a,b:a&&a.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(r)try{Wt(s),s.f|=Yr}catch(f){throw We(s),f}else t!==null&&qt(s);if(i){var l=s;if(r&&l.deps===null&&l.teardown===null&&l.nodes_start===null&&l.first===l.last&&(l.f&Xt)===0&&(l=l.first),l!==null&&(l.parent=a,a!==null&&Na(l,a),Y!==null&&(Y.f&Te)!==0&&(e&ft)===0)){var o=Y;(o.effects??=[]).push(l)}}return s}function ei(e){Oa();var t=k.f,r=!Y&&(t&et)!==0&&(t&Yr)===0;if(r){var i=ke;(i.e??=[]).push(e)}else return ti(e)}function ti(e){return nt(jr|na,e,!1)}function Ra(e){St.ensure();const t=nt(ft|Xt,e,!0);return()=>{We(t)}}function Ca(e){St.ensure();const t=nt(ft|Xt,e,!0);return(r={})=>new Promise(i=>{r.outro?en(t,()=>{We(t),i(void 0)}):(We(t),i(void 0))})}function Ma(e){return nt(jr,e,!1)}function Pa(e){return nt(qr|Xt,e,!0)}function ka(e,t=0){return nt($n|t,e,!0)}function he(e,t=[],r=[]){Ia(t,r,i=>{nt($n,()=>e(...i.map(n)),!0)})}function ri(e,t=0){var r=nt(Ft|t,e,!0);return r}function Ht(e,t=!0){return nt(et|Xt,e,!0,t)}function ni(e){var t=e.teardown;if(t!==null){const r=Dt,i=Y;fi(!0),Ue(null);try{t.call(null)}finally{fi(r),Ue(i)}}}function ii(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){const a=r.ac;a!==null&&Qn(()=>{a.abort(Hr)});var i=r.next;(r.f&ft)!==0?r.parent=null:We(r,t),r=i}}function La(e){for(var t=e.first;t!==null;){var r=t.next;(t.f&et)===0&&We(t),t=r}}function We(e,t=!0){var r=!1;(t||(e.f&ra)!==0)&&e.nodes_start!==null&&e.nodes_end!==null&&(ja(e.nodes_start,e.nodes_end),r=!0),ii(e,t&&!r),Tr(e,0),Ae(e,Et);var i=e.transitions;if(i!==null)for(const s of i)s.stop();ni(e);var a=e.parent;a!==null&&a.first!==null&&ai(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function ja(e,t){for(;e!==null;){var r=e===t?null:vt(e);e.remove(),e=r}}function ai(e){var t=e.parent,r=e.prev,i=e.next;r!==null&&(r.next=i),i!==null&&(i.prev=r),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=r))}function en(e,t){var r=[];tn(e,r,!0),si(r,()=>{We(e),t&&t()})}function si(e,t){var r=e.length;if(r>0){var i=()=>--r||t();for(var a of e)a.out(i)}else t()}function tn(e,t,r){if((e.f&Ye)===0){if(e.f^=Ye,e.transitions!==null)for(const l of e.transitions)(l.is_global||r)&&t.push(l);for(var i=e.first;i!==null;){var a=i.next,s=(i.f&Fr)!==0||(i.f&et)!==0;tn(i,t,s?r:!1),i=a}}}function rn(e){li(e,!0)}function li(e,t){if((e.f&Ye)!==0){e.f^=Ye,(e.f&ye)===0&&(Ae(e,Pe),qt(e));for(var r=e.first;r!==null;){var i=r.next,a=(r.f&Fr)!==0||(r.f&et)!==0;li(r,a?t:!1),r=i}if(e.transitions!==null)for(const s of e.transitions)(s.is_global||t)&&s.in()}}let zt=!1;function oi(e){zt=e}let Dt=!1;function fi(e){Dt=e}let Y=null,Be=!1;function Ue(e){Y=e}let k=null;function _t(e){k=e}let it=null;function Ya(e){Y!==null&&(it===null?it=[e]:it.push(e))}let be=null,Ie=0,Le=null;function Fa(e){Le=e}let ui=1,tr=0,Ot=tr;function ci(e){Ot=e}let pt=!1;function di(){return++ui}function Sr(e){var t=e.f;if((t&Pe)!==0)return!0;if((t&ut)!==0){var r=e.deps,i=(t&Me)!==0;if(r!==null){var a,s,l=(t&pr)!==0,o=i&&k!==null&&!pt,f=r.length;if((l||o)&&(k===null||(k.f&Et)===0)){var d=e,p=d.parent;for(a=0;a<f;a++)s=r[a],(l||!s?.reactions?.includes(d))&&(s.reactions??=[]).push(d);l&&(d.f^=pr),o&&p!==null&&(p.f&Me)===0&&(d.f^=Me)}for(a=0;a<f;a++)if(s=r[a],Sr(s)&&jn(s),s.wv>e.wv)return!0}(!i||k!==null&&!pt)&&Ae(e,ye)}return!1}function vi(e,t,r=!0){var i=e.reactions;if(i!==null&&!it?.includes(e))for(var a=0;a<i.length;a++){var s=i[a];(s.f&Te)!==0?vi(s,t,!1):t===s&&(r?Ae(s,Pe):(s.f&ye)!==0&&Ae(s,ut),qt(s))}}function hi(e){var t=be,r=Ie,i=Le,a=Y,s=pt,l=it,o=ke,f=Be,d=Ot,p=e.f;be=null,Ie=0,Le=null,pt=(p&Me)!==0&&(Be||!zt||Y===null),Y=(p&(et|ft))===0?e:null,it=null,yr(e.ctx),Be=!1,Ot=++tr,e.ac!==null&&(Qn(()=>{e.ac.abort(Hr)}),e.ac=null);try{e.f|=Xr;var m=e.fn,g=m(),h=e.deps;if(be!==null){var c;if(Tr(e,Ie),h!==null&&Ie>0)for(h.length=Ie+be.length,c=0;c<be.length;c++)h[Ie+c]=be[c];else e.deps=h=be;if(!pt||(p&Te)!==0&&e.reactions!==null)for(c=Ie;c<h.length;c++)(h[c].reactions??=[]).push(e)}else h!==null&&Ie<h.length&&(Tr(e,Ie),h.length=Ie);if(Mn()&&Le!==null&&!Be&&h!==null&&(e.f&(Te|ut|Pe))===0)for(c=0;c<Le.length;c++)vi(Le[c],e);return a!==null&&a!==e&&(tr++,Le!==null&&(i===null?i=Le:i.push(...Le))),(e.f&xt)!==0&&(e.f^=xt),g}catch(v){return ya(v)}finally{e.f^=Xr,be=t,Ie=r,Le=i,Y=a,pt=s,it=l,yr(o),Be=f,Ot=d}}function Xa(e,t){let r=t.reactions;if(r!==null){var i=Ki.call(r,e);if(i!==-1){var a=r.length-1;a===0?r=t.reactions=null:(r[i]=r[a],r.pop())}}r===null&&(t.f&Te)!==0&&(be===null||!be.includes(t))&&(Ae(t,ut),(t.f&(Me|pr))===0&&(t.f^=pr),Ln(t),Tr(t,0))}function Tr(e,t){var r=e.deps;if(r!==null)for(var i=t;i<r.length;i++)Xa(e,r[i])}function Wt(e){var t=e.f;if((t&Et)===0){Ae(e,ye);var r=k,i=zt;k=e,zt=!0;try{(t&Ft)!==0?La(e):ii(e),ni(e);var a=hi(e);e.teardown=typeof a=="function"?a:null,e.wv=ui;var s;yn&&ma&&(e.f&Pe)!==0&&e.deps}finally{zt=i,k=r}}}function n(e){var t=e.f,r=(t&Te)!==0;if(Y!==null&&!Be){var i=k!==null&&(k.f&Et)!==0;if(!i&&!it?.includes(e)){var a=Y.deps;if((Y.f&Xr)!==0)e.rv<tr&&(e.rv=tr,be===null&&a!==null&&a[Ie]===e?Ie++:be===null?be=[e]:(!pt||!be.includes(e))&&be.push(e));else{(Y.deps??=[]).push(e);var s=e.reactions;s===null?e.reactions=[Y]:s.includes(Y)||s.push(Y)}}}else if(r&&e.deps===null&&e.effects===null){var l=e,o=l.parent;o!==null&&(o.f&Me)===0&&(l.f^=Me)}if(Dt){if(dt.has(e))return dt.get(e);if(r){l=e;var f=l.v;return((l.f&ye)===0&&l.reactions!==null||_i(l))&&(f=Gr(l)),dt.set(l,f),f}}else r&&(l=e,Sr(l)&&jn(l));if((e.f&xt)!==0)throw e.v;return e.v}function _i(e){if(e.v===ve)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(dt.has(t)||(t.f&Te)!==0&&_i(t))return!0;return!1}function pi(e){var t=Be;try{return Be=!0,e()}finally{Be=t}}const qa=-7169;function Ae(e,t){e.f=e.f&qa|t}const gi=new Set,nn=new Set;function Ha(e){for(var t=0;t<e.length;t++)gi.add(e[t]);for(var r of nn)r(e)}let mi=null;function Ir(e){var t=this,r=t.ownerDocument,i=e.type,a=e.composedPath?.()||[],s=a[0]||e.target;mi=e;var l=0,o=mi===e&&e.__root;if(o){var f=a.indexOf(o);if(f!==-1&&(t===document||t===window)){e.__root=t;return}var d=a.indexOf(t);if(d===-1)return;f<=d&&(l=f)}if(s=a[l]||e.target,s!==t){Yt(e,"currentTarget",{configurable:!0,get(){return s||r}});var p=Y,m=k;Ue(null),_t(null);try{for(var g,h=[];s!==null;){var c=s.assignedSlot||s.parentNode||s.host||null;try{var v=s["__"+i];if(v!=null&&(!s.disabled||e.target===s))if(kr(v)){var[x,...L]=v;x.apply(s,[e,...L])}else v.call(s,e)}catch(y){g?h.push(y):g=y}if(e.cancelBubble||c===t||c===null)break;s=c}if(g){for(let y of h)queueMicrotask(()=>{throw y});throw g}}finally{e.__root=t,delete e.currentTarget,Ue(p),_t(m)}}}function wi(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function Nt(e,t){var r=k;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function za(e,t){var r=(t&Gi)!==0,i,a=!e.startsWith("<!>");return()=>{if(G)return Nt(W,null),W;i===void 0&&(i=wi(a?e:"<!>"+e));var s=r||Un?document.importNode(i,!0):i.cloneNode(!0);{var l=At(s),o=s.lastChild;Nt(l,o)}return s}}function Wa(e,t,r="svg"){var i=!e.startsWith("<!>"),a=`<${r}>${i?e:"<!>"+e}</${r}>`,s;return()=>{if(G)return Nt(W,null),W;if(!s){var l=wi(a),o=At(l);s=At(o)}var f=s.cloneNode(!0);return Nt(f,f),f}}function _e(e,t){return Wa(e,t,"svg")}function Q(){if(G)return Nt(W,null),W;var e=document.createDocumentFragment(),t=document.createComment(""),r=It();return e.append(t,r),Nt(t,r),e}function M(e,t){if(G){k.nodes_end=W,wr();return}e!==null&&e.before(t)}const Ba=["touchstart","touchmove"];function Ua(e){return Ba.includes(e)}function rr(e,t){var r=t==null?"":typeof t=="object"?t+"":t;r!==(e.__t??=e.nodeValue)&&(e.__t=r,e.nodeValue=r+"")}function yi(e,t){return bi(e,t)}function Va(e,t){Qr(),t.intro=t.intro??!1;const r=t.target,i=G,a=W;try{for(var s=At(r);s&&(s.nodeType!==Zt||s.data!==wn);)s=vt(s);if(!s)throw jt;tt(!0),ze(s),wr();const l=bi(e,{...t,anchor:s});if(W===null||W.nodeType!==Zt||W.data!==Pr)throw mr(),jt;return tt(!1),l}catch(l){if(l instanceof Error&&l.message.split(`
2
- `).some(o=>o.startsWith("https://svelte.dev/e/")))throw l;return l!==jt&&console.warn("Failed to hydrate: ",l),t.recover===!1&&da(),Qr(),Kn(r),tt(!1),yi(e,t)}finally{tt(i),ze(a)}}const Bt=new Map;function bi(e,{target:t,anchor:r,props:i={},events:a,context:s,intro:l=!0}){Qr();var o=new Set,f=m=>{for(var g=0;g<m.length;g++){var h=m[g];if(!o.has(h)){o.add(h);var c=Ua(h);t.addEventListener(h,Ir,{passive:c});var v=Bt.get(h);v===void 0?(document.addEventListener(h,Ir,{passive:c}),Bt.set(h,1)):Bt.set(h,v+1)}}};f(Lr(gi)),nn.add(f);var d=void 0,p=Ca(()=>{var m=r??t.appendChild(It());return Ht(()=>{if(s){Rn({});var g=ke;g.c=s}a&&(i.$$events=a),G&&Nt(m,null),d=e(m,i)||{},G&&(k.nodes_end=W),s&&Cn()}),()=>{for(var g of o){t.removeEventListener(g,Ir);var h=Bt.get(g);--h===0?(document.removeEventListener(g,Ir),Bt.delete(g)):Bt.set(g,h)}nn.delete(f),m!==r&&m.parentNode?.removeChild(m)}});return an.set(d,p),d}let an=new WeakMap;function Ga(e,t){const r=an.get(e);return r?(an.delete(e),r(t)):Promise.resolve()}function Ja(e){ke===null&&sa(),ei(()=>{const t=pi(e);if(typeof t=="function")return t})}function Z(e,t,r=!1){G&&wr();var i=e,a=null,s=null,l=ve,o=r?Fr:0,f=!1;const d=(h,c=!0)=>{f=!0,g(c,h)};var p=null;function m(){p!==null&&(p.lastChild.remove(),i.before(p),p=null);var h=l?a:s,c=l?s:a;h&&rn(h),c&&en(c,()=>{l?s=null:a=null})}const g=(h,c)=>{if(l===(l=h))return;let v=!1;if(G){const A=Dn(i)===Mr;!!l===A&&(i=zr(),ze(i),tt(!1),v=!0)}var x=Zn(),L=i;if(x&&(p=document.createDocumentFragment(),p.append(L=It())),l?a??=c&&Ht(()=>c(L)):s??=c&&Ht(()=>c(L)),x){var y=de,S=l?a:s,R=l?s:a;S&&y.skipped_effects.delete(S),R&&y.skipped_effects.add(R),y.add_callback(m)}else m();v&&tt(!0)};ri(()=>{f=!1,t(d),f||g(null,null)},o),G&&(i=W)}function Ka(e,t,r){for(var i=e.items,a=[],s=t.length,l=0;l<s;l++)tn(t[l].e,a,!0);var o=s>0&&a.length===0&&r!==null;if(o){var f=r.parentNode;Kn(f),f.append(r),i.clear(),Ve(e,t[0].prev,t[s-1].next)}si(a,()=>{for(var d=0;d<s;d++){var p=t[d];o||(i.delete(p.k),Ve(e,p.prev,p.next)),We(p.e,!o)}})}function Ei(e,t,r,i,a,s=null){var l=e,o={flags:t,items:new Map,first:null};G&&wr();var f=null,d=!1,p=new Map,m=kn(()=>{var v=r();return kr(v)?v:v==null?[]:Lr(v)}),g,h;function c(){Za(h,g,o,p,l,a,t,i,r),s!==null&&(g.length===0?f?rn(f):f=Ht(()=>s(l)):f!==null&&en(f,()=>{f=null}))}ri(()=>{h??=k,g=n(m);var v=g.length;if(d&&v===0)return;d=v===0;let x=!1;if(G){var L=Dn(l)===Mr;L!==(v===0)&&(l=zr(),ze(l),tt(!1),x=!0)}if(G){for(var y=null,S,R=0;R<v;R++){if(W.nodeType===Zt&&W.data===Pr){l=W,x=!0,tt(!1);break}var A=g[R],F=i(A,R);S=sn(W,o,y,null,A,F,R,a,t,r),o.items.set(F,S),y=S}v>0&&ze(zr())}if(G)v===0&&s&&(f=Ht(()=>s(l)));else if(Zn()){var $=new Set,ae=de;for(R=0;R<v;R+=1){A=g[R],F=i(A,R);var U=o.items.get(F)??p.get(F);U?xi(U,A,R):(S=sn(null,o,null,null,A,F,R,a,t,r,!0),p.set(F,S)),$.add(F)}for(const[z,ee]of o.items)$.has(z)||ae.skipped_effects.add(ee.e);ae.add_callback(c)}else c();x&&tt(!0),n(m)}),G&&(l=W)}function Za(e,t,r,i,a,s,l,o,f){var d=t.length,p=r.items,m=r.first,g=m,h,c=null,v=[],x=[],L,y,S,R;for(R=0;R<d;R+=1){if(L=t[R],y=o(L,R),S=p.get(y),S===void 0){var A=i.get(y);if(A!==void 0){i.delete(y),p.set(y,A);var F=c?c.next:g;Ve(r,c,A),Ve(r,A,F),ln(A,F,a),c=A}else{var $=g?g.e.nodes_start:a;c=sn($,r,c,c===null?r.first:c.next,L,y,R,s,l,f)}p.set(y,c),v=[],x=[],g=c.next;continue}if(xi(S,L,R),(S.e.f&Ye)!==0&&rn(S.e),S!==g){if(h!==void 0&&h.has(S)){if(v.length<x.length){var ae=x[0],U;c=ae.prev;var z=v[0],ee=v[v.length-1];for(U=0;U<v.length;U+=1)ln(v[U],ae,a);for(U=0;U<x.length;U+=1)h.delete(x[U]);Ve(r,z.prev,ee.next),Ve(r,c,z),Ve(r,ee,ae),g=ae,c=ee,R-=1,v=[],x=[]}else h.delete(S),ln(S,g,a),Ve(r,S.prev,S.next),Ve(r,S,c===null?r.first:c.next),Ve(r,c,S),c=S;continue}for(v=[],x=[];g!==null&&g.k!==y;)(g.e.f&Ye)===0&&(h??=new Set).add(g),x.push(g),g=g.next;if(g===null)continue;S=g}v.push(S),c=S,g=S.next}if(g!==null||h!==void 0){for(var we=h===void 0?[]:Lr(h);g!==null;)(g.e.f&Ye)===0&&we.push(g),g=g.next;var b=we.length;if(b>0){var T=null;Ka(r,we,T)}}e.first=r.first&&r.first.e,e.last=c&&c.e;for(var V of i.values())We(V.e);i.clear()}function xi(e,t,r,i){$r(e.v,t),e.i=r}function sn(e,t,r,i,a,s,l,o,f,d,p){var m=(f&qi)!==0,g=(f&zi)===0,h=m?g?zn(a,!1,!1):Qt(a):a,c=(f&Hi)===0?l:Qt(l),v={i:c,v:h,k:s,a:null,e:null,prev:r,next:i};try{if(e===null){var x=document.createDocumentFragment();x.append(e=It())}return v.e=Ht(()=>o(e,h,c,d),G),v.e.prev=r&&r.e,v.e.next=i&&i.e,r===null?p||(t.first=v):(r.next=v,r.e.next=v.e),i!==null&&(i.prev=v,i.e.prev=v.e),v}finally{}}function ln(e,t,r){for(var i=e.next?e.next.e.nodes_start:r,a=t?t.e.nodes_start:r,s=e.e.nodes_start;s!==null&&s!==i;){var l=vt(s);a.before(s),s=l}}function Ve(e,t,r){t===null?e.first=r:(t.next=r,t.e.next=r&&r.e),r!==null&&(r.prev=t,r.e.prev=t&&t.e)}function Qa(e,t){Ma(()=>{var r=e.getRootNode(),i=r.host?r:r.head??r.ownerDocument.head;if(!i.querySelector("#"+t.hash)){const a=document.createElement("style");a.id=t.hash,a.textContent=t.code,i.appendChild(a)}})}function es(e,t){return e==null?null:String(e)}function $i(e,t,r,i){var a=e.__style;if(G||a!==t){var s=es(t);(!G||s!==e.getAttribute("style"))&&(s==null?e.removeAttribute("style"):e.style.cssText=s),e.__style=t}return i}const ts=Symbol("is custom element"),rs=Symbol("is html");function N(e,t,r,i){var a=ns(e);G&&(a[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||a[t]!==(a[t]=r)&&(t==="loading"&&(e[ia]=r),r==null?e.removeAttribute(t):typeof r!="string"&&is(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function ns(e){return e.__attributes??={[ts]:e.nodeName.includes("-"),[rs]:e.namespaceURI===Ji}}var Si=new Map;function is(e){var t=e.getAttribute("is")||e.nodeName,r=Si.get(t);if(r)return r;Si.set(t,r=[]);for(var i,a=e,s=Element.prototype;s!==a;){i=Zi(a);for(var l in i)i[l].set&&r.push(l);a=bn(a)}return r}let Ar=!1;function as(e){var t=Ar;try{return Ar=!1,[e(),Ar]}finally{Ar=t}}function Ee(e,t,r,i){var a=(r&Ui)!==0,s=(r&Vi)!==0,l=i,o=!0,f=()=>(o&&(o=!1,l=s?pi(i):i),l),d;if(a){var p=gr in e||In in e;d=bt(e,t)?.set??(p&&t in e?y=>e[t]=y:void 0)}var m,g=!1;a?[m,g]=as(()=>e[t]):m=e[t],m===void 0&&i!==void 0&&(m=f(),d&&(va(),d(m)));var h;if(h=()=>{var y=e[t];return y===void 0?f():(o=!0,y)},(r&Bi)===0)return h;if(d){var c=e.$$legacy;return(function(y,S){return arguments.length>0?((!S||c||g)&&d(S?h():y),y):h()})}var v=!1,x=((r&Wi)!==0?Vr:kn)(()=>(v=!1,h()));a&&n(x);var L=k;return(function(y,S){if(arguments.length>0){const R=S?n(x):a?rt(y):y;return _(x,R),v=!0,l!==void 0&&(l=R),y}return Dt&&v||(L.f&Et)!==0?x.v:n(x)})}function ss(e){return new ls(e)}class ls{#t;#e;constructor(t){var r=new Map,i=(s,l)=>{var o=zn(l,!1,!1);return r.set(s,o),o};const a=new Proxy({...t.props||{},$$events:{}},{get(s,l){return n(r.get(l)??i(l,Reflect.get(s,l)))},has(s,l){return l===In?!0:(n(r.get(l)??i(l,Reflect.get(s,l))),Reflect.has(s,l))},set(s,l,o){return _(r.get(l)??i(l,o),o),Reflect.set(s,l,o)}});this.#e=(t.hydrate?Va:yi)(t.component,{target:t.target,anchor:t.anchor,props:a,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&me(),this.#t=a.$$events;for(const s of Object.keys(this.#e))s==="$set"||s==="$destroy"||s==="$on"||Yt(this,s,{get(){return this.#e[s]},set(l){this.#e[s]=l},enumerable:!0});this.#e.$set=s=>{Object.assign(a,s)},this.#e.$destroy=()=>{Ga(this.#e)}}$set(t){this.#e.$set(t)}$on(t,r){this.#t[t]=this.#t[t]||[];const i=(...a)=>r.call(this,...a);return this.#t[t].push(i),()=>{this.#t[t]=this.#t[t].filter(a=>a!==i)}}$destroy(){this.#e.$destroy()}}let Ti;typeof HTMLElement=="function"&&(Ti=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(e,t,r){super(),this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const i=this.$$c.$on(e,t);this.$$l_u.set(t,i)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(i){return a=>{const s=document.createElement("slot");i!=="default"&&(s.name=i),M(a,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},r=os(this);for(const i of this.$$s)i in r&&(i==="default"&&!this.$$d.children?(this.$$d.children=e(i),t.default=!0):t[i]=e(i));for(const i of this.attributes){const a=this.$$g_p(i.name);a in this.$$d||(this.$$d[a]=Dr(a,i.value,this.$$p_d,"toProp"))}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=ss({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=Ra(()=>{ka(()=>{this.$$r=!0;for(const i of _r(this.$$c)){if(!this.$$p_d[i]?.reflect)continue;this.$$d[i]=this.$$c[i];const a=Dr(i,this.$$d[i],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,a)}this.$$r=!1})});for(const i in this.$$l)for(const a of this.$$l[i]){const s=this.$$c.$on(i,a);this.$$l_u.set(a,s)}this.$$l={}}}attributeChangedCallback(e,t,r){this.$$r||(e=this.$$g_p(e),this.$$d[e]=Dr(e,r,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return _r(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Dr(e,t,r,i){const a=r[e]?.type;if(t=a==="Boolean"&&typeof t!="boolean"?t!=null:t,!i||!r[e])return t;if(i==="toAttribute")switch(a){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(a){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function os(e){const t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}function fs(e,t,r,i,a,s){let l=class extends Ti{constructor(){super(e,r,a),this.$$p_d=t}static get observedAttributes(){return _r(t).map(o=>(t[o].attribute||o).toLowerCase())}};return _r(t).forEach(o=>{Yt(l.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(f){f=Dr(o,f,t),this.$$d[o]=f;var d=this.$$c;if(d){var p=bt(d,o)?.get;p?d[o]=f:d.$set({[o]:f})}}})}),i.forEach(o=>{Yt(l.prototype,o,{get(){return this.$$c?.[o]}})}),e.element=l,l}function us(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ut={},on,Ii;function cs(){if(Ii)return on;Ii=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,o=/^\s+|\s+$/g,f=`
3
- `,d="/",p="*",m="",g="comment",h="declaration";on=function(v,x){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];x=x||{};var L=1,y=1;function S(b){var T=b.match(t);T&&(L+=T.length);var V=b.lastIndexOf(f);y=~V?b.length-V:y+b.length}function R(){var b={line:L,column:y};return function(T){return T.position=new A(b),ae(),T}}function A(b){this.start=b,this.end={line:L,column:y},this.source=x.source}A.prototype.content=v;function F(b){var T=new Error(x.source+":"+L+":"+y+": "+b);if(T.reason=b,T.filename=x.source,T.line=L,T.column=y,T.source=v,!x.silent)throw T}function $(b){var T=b.exec(v);if(T){var V=T[0];return S(V),v=v.slice(V.length),T}}function ae(){$(r)}function U(b){var T;for(b=b||[];T=z();)T!==!1&&b.push(T);return b}function z(){var b=R();if(!(d!=v.charAt(0)||p!=v.charAt(1))){for(var T=2;m!=v.charAt(T)&&(p!=v.charAt(T)||d!=v.charAt(T+1));)++T;if(T+=2,m===v.charAt(T-1))return F("End of comment missing");var V=v.slice(2,T-2);return y+=2,S(V),v=v.slice(T),y+=2,b({type:g,comment:V})}}function ee(){var b=R(),T=$(i);if(T){if(z(),!$(a))return F("property missing ':'");var V=$(s),te=b({type:h,property:c(T[0].replace(e,m)),value:V?c(V[0].replace(e,m)):m});return $(l),te}}function we(){var b=[];U(b);for(var T;T=ee();)T!==!1&&(b.push(T),U(b));return b}return ae(),we()};function c(v){return v?v.replace(o,m):m}return on}var Ai;function ds(){if(Ai)return Ut;Ai=1;var e=Ut&&Ut.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.default=r;var t=e(cs());function r(i,a){var s=null;if(!i||typeof i!="string")return s;var l=(0,t.default)(i),o=typeof a=="function";return l.forEach(function(f){if(f.type==="declaration"){var d=f.property,p=f.value;o?a(d,p,f):p&&(s=s||{},s[d]=p)}}),s}return Ut}var vs=ds();const Di=us(vs);Di.default;function Oi(e,t,r,i=a=>a){return e*i(.5-t*(.5-r))}function hs(e){return[-e[0],-e[1]]}function Fe(e,t){return[e[0]+t[0],e[1]+t[1]]}function je(e,t){return[e[0]-t[0],e[1]-t[1]]}function Xe(e,t){return[e[0]*t,e[1]*t]}function _s(e,t){return[e[0]/t,e[1]/t]}function nr(e){return[e[1],-e[0]]}function Ni(e,t){return e[0]*t[0]+e[1]*t[1]}function ps(e,t){return e[0]===t[0]&&e[1]===t[1]}function gs(e){return Math.hypot(e[0],e[1])}function ms(e){return e[0]*e[0]+e[1]*e[1]}function Ri(e,t){return ms(je(e,t))}function Ci(e){return _s(e,gs(e))}function ws(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function ir(e,t,r){let i=Math.sin(r),a=Math.cos(r),s=e[0]-t[0],l=e[1]-t[1],o=s*a-l*i,f=s*i+l*a;return[o+t[0],f+t[1]]}function fn(e,t,r){return Fe(e,Xe(je(t,e),r))}function Mi(e,t,r){return Fe(e,Xe(t,r))}var{min:Vt,PI:ys}=Math,Pi=.275,ar=ys+1e-4;function bs(e,t={}){let{size:r=16,smoothing:i=.5,thinning:a=.5,simulatePressure:s=!0,easing:l=D=>D,start:o={},end:f={},last:d=!1}=t,{cap:p=!0,easing:m=D=>D*(2-D)}=o,{cap:g=!0,easing:h=D=>--D*D*D+1}=f;if(e.length===0||r<=0)return[];let c=e[e.length-1].runningLength,v=o.taper===!1?0:o.taper===!0?Math.max(r,c):o.taper,x=f.taper===!1?0:f.taper===!0?Math.max(r,c):f.taper,L=Math.pow(r*i,2),y=[],S=[],R=e.slice(0,10).reduce((D,w)=>{let O=w.pressure;if(s){let q=Vt(1,w.distance/r),ue=Vt(1,1-q);O=Vt(1,D+(ue-D)*(q*Pi))}return(D+O)/2},e[0].pressure),A=Oi(r,a,e[e.length-1].pressure,l),F,$=e[0].vector,ae=e[0].point,U=ae,z=ae,ee=U,we=!1;for(let D=0;D<e.length;D++){let{pressure:w}=e[D],{point:O,vector:q,distance:ue,runningLength:re}=e[D];if(D<e.length-1&&c-re<3)continue;if(a){if(s){let qe=Vt(1,ue/r),at=Vt(1,1-qe);w=Vt(1,R+(at-R)*(qe*Pi))}A=Oi(r,a,w,l)}else A=r/2;F===void 0&&(F=A);let De=re<v?m(re/v):1,Or=c-re<x?h((c-re)/x):1;A=Math.max(.01,A*Math.min(De,Or));let sr=(D<e.length-1?e[D+1]:e[D]).vector,gt=D<e.length-1?Ni(q,sr):1,Nr=Ni(q,$)<0&&!we,lr=gt!==null&&gt<0;if(Nr||lr){let qe=Xe(nr($),A);for(let at=1/13,Ge=0;Ge<=1;Ge+=at)z=ir(je(O,qe),O,ar*Ge),y.push(z),ee=ir(Fe(O,qe),O,ar*-Ge),S.push(ee);ae=z,U=ee,lr&&(we=!0);continue}if(we=!1,D===e.length-1){let qe=Xe(nr(q),A);y.push(je(O,qe)),S.push(Fe(O,qe));continue}let or=Xe(nr(fn(sr,q,gt)),A);z=je(O,or),(D<=1||Ri(ae,z)>L)&&(y.push(z),ae=z),ee=Fe(O,or),(D<=1||Ri(U,ee)>L)&&(S.push(ee),U=ee),R=w,$=q}let b=e[0].point.slice(0,2),T=e.length>1?e[e.length-1].point.slice(0,2):Fe(e[0].point,[1,1]),V=[],te=[];if(e.length===1){if(!(v||x)||d){let D=Mi(b,Ci(nr(je(b,T))),-(F||A)),w=[];for(let O=1/13,q=O;q<=1;q+=O)w.push(ir(D,b,ar*2*q));return w}}else{if(!(v||x&&e.length===1))if(p)for(let w=1/13,O=w;O<=1;O+=w){let q=ir(S[0],b,ar*O);V.push(q)}else{let w=je(y[0],S[0]),O=Xe(w,.5),q=Xe(w,.51);V.push(je(b,O),je(b,q),Fe(b,q),Fe(b,O))}let D=nr(hs(e[e.length-1].vector));if(x||v&&e.length===1)te.push(T);else if(g){let w=Mi(T,D,A);for(let O=1/29,q=O;q<1;q+=O)te.push(ir(w,T,ar*3*q))}else te.push(Fe(T,Xe(D,A)),Fe(T,Xe(D,A*.99)),je(T,Xe(D,A*.99)),je(T,Xe(D,A)))}return y.concat(te,S.reverse(),V)}function Es(e,t={}){var r;let{streamline:i=.5,size:a=16,last:s=!1}=t;if(e.length===0)return[];let l=.15+(1-i)*.85,o=Array.isArray(e[0])?e:e.map(({x:h,y:c,pressure:v=.5})=>[h,c,v]);if(o.length===2){let h=o[1];o=o.slice(0,-1);for(let c=1;c<5;c++)o.push(fn(o[0],h,c/4))}o.length===1&&(o=[...o,[...Fe(o[0],[1,1]),...o[0].slice(2)]]);let f=[{point:[o[0][0],o[0][1]],pressure:o[0][2]>=0?o[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],d=!1,p=0,m=f[0],g=o.length-1;for(let h=1;h<o.length;h++){let c=s&&h===g?o[h].slice(0,2):fn(m.point,o[h],l);if(ps(m.point,c))continue;let v=ws(c,m.point);if(p+=v,h<g&&!d){if(p<a)continue;d=!0}m={point:c,pressure:o[h][2]>=0?o[h][2]:.5,vector:Ci(je(m.point,c)),distance:v,runningLength:p},f.push(m)}return f[0].vector=((r=f[1])==null?void 0:r.vector)||[0,0],f}function ki(e,t={}){return bs(Es(e,t),t)}function xs(e,t,r,i,a,s,l,o,f,d,p,m,g,h,c,v,x,L,y,S,R,A,F,$,ae,U,z,ee,we){if(_(t,e.pointerType,!0),_(r,e.buttons+" "+[e.pageX-n(i).left,e.pageY-n(i).top,e.pressure].toString()),a()==="draw"&&n(s)==="drawing"&&e.buttons===1&&!(e.pointerType==="pen"&&e.pressure===0))n(l)[n(o)].path=[...n(l)[n(o)].path||[],[e.pageX-n(i).left,e.pageY-n(i).top,e.pressure]],n(l)[n(o)].pathData=n(f),e.pageX-n(i).left<n(d)&&_(d,e.pageX-n(i).left),e.pageY-n(i).top<n(p)&&_(p,e.pageY-n(i).top),e.pageX-n(i).left>n(m)&&_(m,e.pageX-n(i).left),e.pageY-n(i).top>n(g)&&_(g,e.pageY-n(i).top),n(l)[n(o)].min=[n(d),n(p)],n(l)[n(o)].max=[n(m),n(g)];else if(n(s)==="erasing"&&(a()==="eraser"||a()==="draw"&&(e.pointerType==="pen"&&e.pressure===0&&e.buttons===1||e.buttons===32)))console.log("eraser move"),h(e);else if(a()==="select"&&n(s)==="selecting")_(c,e.pageX-n(i).left),_(v,e.pageY-n(i).top);else if(a()==="select"&&!n(x)){const b=e.pageX-n(i).left,T=e.pageY-n(i).top,V=b>n(L)&&b<n(c)&&T>n(y)&&T<n(v);V&&!n(S)?(_(S,!0),console.log("on select",n(S))):!V&&n(S)&&(_(S,!1),console.log("off select",n(S)))}else if(n(x)&&n(l)[n(o)].type==="multiplestroke"&&n(R)&&n(R).toString()===n(l)[n(o)].id){const b=[...n(l)],T=e.pageX-n(i).left,V=e.pageY-n(i).top,te=T-(n(A)||0),D=V-(n(F)||0);console.info("move selected strokes on multistrokes",n(A),n(F),te,D),b[n(o)]?.multipath?.forEach(w=>{let O;for(const ue of n(l).filter(re=>re.type==="multiplestroke").filter(re=>re.id!==n(l)[n(o)].id).sort((re,De)=>De.actionIndex-re.actionIndex)){const re=ue?.multipath?.find(De=>De.id===w.id);if(re){O=re;break}}O||(O=n(l).find(ue=>ue.id===w.id)),w.path?.forEach((ue,re)=>{re===0&&console.log("debug path ",ue[0],O?.path?.[re][0],n(l)),O?.path&&(ue[0]=O.path[re][0]+te),O?.path&&(ue[1]=O.path[re][1]+D)}),O?.max&&(w.max=[O.max[0]+te,O.max[1]+D]),O?.min&&(w.min=[O.min[0]+te,O.min[1]+D]);const q=ki(w.path||[],Object.assign({simulatePressure:n(t)!=="pen"},$()));w.pathData=ae(q)}),_(L,(n(U)||0)+te),_(y,(n(z)||0)+D),_(c,(n(ee)||0)+te),_(v,(n(we)||0)+D),_(l,[...b],!0)}}var $s=_e('<path stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"></path>'),Ss=_e('<image stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"></image>'),Ts=_e('<text stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"> </text>'),Is=_e('<path class="svelte-ofif3l"></path>'),As=_e('<image class="svelte-ofif3l"></image>'),Ds=_e('<text class="svelte-ofif3l"> </text>'),Os=_e('<path stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"></path>'),Ns=_e('<image stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"></image>'),Rs=_e('<text stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"> </text>'),Cs=_e('<path class="svelte-ofif3l"></path>'),Ms=_e('<image class="svelte-ofif3l"></image>'),Ps=_e('<text class="svelte-ofif3l"> </text>'),ks=_e('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),Ls=_e('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),js=_e('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),Ys=_e('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),Fs=_e("<g><!><!></g>"),Xs=za('<div id="debug" class="svelte-ofif3l"> </div> <div id="container"><svg class="svelte-ofif3l"><!></svg></div>',1);const qs={hash:"svelte-ofif3l",code:'@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");:host {font-family:"Roboto", sans-serif;}#debug.svelte-ofif3l {position:absolute;width:100%;height:30px;top:0px;z-index:10;}svg.svelte-ofif3l {position:absolute;top:0;left:0;width:100%;height:100%;touch-action:none;}'};function Li(e,t){Rn(t,!0),Qa(e,qs);function r(u,I){t.$$host.dispatchEvent(new CustomEvent(u,{detail:I}))}const i={size:6,thinning:.7,smoothing:.5,streamline:.5},a={paperSize:"A4"},s={zoom:{type:"fit",value:1},pan:{x:0,y:0},lockPan:!1,lockZoom:!1};let l=Ee(t,"id",7,""),o=Ee(t,"load_draw",7),f=Ee(t,"draw_id",23,()=>Math.random().toString(36)+Math.random().toString(36)+Date.now().toString()),d=Ee(t,"background_color",7,"rgb(255,255,255)"),p=Ee(t,"pen_color",7,"rgb(0,0,0)"),m=Ee(t,"insert_image",7,void 0),g=Ee(t,"insert_text",7),h=Ee(t,"pen_opacity",7,1),c=Ee(t,"options",7,i),v=Ee(t,"goto",7,void 0),x=Ee(t,"mode",7,"draw"),L=Ee(t,"debug",7,"no"),y=Ee(t,"save_as",7,void 0),S=Ee(t,"size",23,()=>Object.assign({},a)),R=Ee(t,"view",23,()=>Object.assign({},s)),A,F,$=C(0),ae=C(!1),U=C(0),z=C(void 0),ee=C(void 0),we=C(""),b=C(rt({})),T=C(0),V=C(void 0),te=C(void 0),D=C(void 0),w=C(rt([])),O=C(!1),q=C("idle"),ue=C(void 0),re=C(void 0),De=C(void 0),Or=C(void 0),sr=C(void 0),gt=C(!1),Nr=C(void 0),lr=C(void 0),or=C(void 0),qe=C(void 0),at=C(0),Ge=C(0),fr=C(0),ur=C(0),se=C(0),le=C(0),oe=C(0),fe=C(0);rt({});function ji(u){if(!u.length)return"";const I=u.reduce((P,[ne,B],J,E)=>{const[ie,X]=E[(J+1)%E.length];return P.push(ne,B,(ne+ie)/2,(B+X)/2),P},["M",...u[0],"Q"]);return I.push("Z"),I.join(" ")}function Hs(u){if(u)switch(u.type){case"json":const I=[];for(const P of n(w))if(P.visible){if(P.type==="stroke")P.actionIndex=0,I.push(P);else if(P.type==="multiplestroke")for(const ne of P.multipath?.filter(B=>B.visible)||[])ne.actionIndex=0,I.push(ne)}return Ws({type:"json",draw:I,id:l(),draw_id:f(),name:u.name,version:n(U)+1,size:S()||a});default:return console.error("unknown save type")}}function zs(u){r("drawLoaded",u)}function Ws(u){r("save",u)}function cr(u){r("historyIndex",u)}function Bs(u){r("changeIndex",u)}function Us(u){r("selection",u)}function Yi(u){r("startStroke",u)}function Vs(u){r("endStroke",u)}function Gs(u){r("imageLoaded",u)}function Js(u){r("txtLoaded",u)}function Ks(){if(!n(z))return console.error("no svg dom found");if(!n(ee))return console.error("no svg container found");switch(_(b,n(z).getBoundingClientRect(),!0),A||(A={}),A.containerWidth=n(ee).clientWidth,A.containerHeight=n(ee).clientHeight,A.drawWidth=n(z).clientWidth,A.drawHeight=n(z).clientHeight,S()?.paperSize){case"A3":A.paperWidth=297,A.paperHeight=420;break;case"A4":default:A.paperWidth=210,A.paperHeight=297;break}}function Zs(){if(console.log("svgDom",n(z)),n(b)||Ks(),o()&&typeof o()=="object"&&(!n(U)||n(U)<o().version||f()!==o().draw_id)&&(console.log("load_draw",o()),_(w,o().draw,!0),_($,n(w).length,!0),f(o().draw_id),_(U,o().version,!0),o(void 0),F=n(w).length,cr({index:n($),draw_id:f(),id:l(),start_index:F}),zs({index:n($),draw_id:f(),id:l(),start_index:F})),n(w)?.length&&y()&&(console.log("save_as",y()),Hs(y())),n(w)||(console.log("draw is empty"),_(w,[],!0)),x()&&x()!=="select"&&n(ue)){_(ue,0);const u=[...n(w)];u.forEach(I=>{I.selected=!1,I.type==="multiplestroke"&&I.multipath?.forEach(P=>{P.selected=!1})}),_(w,[...u],!0)}if(x()!=="select"&&(_(oe,0),_(fe,0),_(se,0),_(le,0)),typeof v()=="string"&&v(Number(v())),n(w).length||(_($,0),v(void 0)),n($)||_($,0),v()&&v()<0?_($,-1):(v()||v()===0)&&(F&&v()>F?v(F):v()>n(w).length&&v(n(w).length),_($,v()+0),v(void 0),Bs({index:n($),draw_id:f(),id:l(),start_index:F})),n($)<0?(_($,0),_(O,!0)):n($)>=0&&_(O,!1),m()){console.info("inserting object");let u=!1;switch(m().type){case"jpg":case"jpeg":case"png":Qs(m()),u=!0;break;case"svg":el(m()),u=!0;break;default:console.error("unknown insert_object type",m().type),u=!1}u&&Gs({ok:!0,draw_id:f(),id:l()})}g()&&(console.log("insert_text",g()),tl(g()),Js({ok:!0,draw_id:f(),id:l()})),_(re,ki(n(w)[n($)]?.path||[],Object.assign({simulatePressure:n(we)!=="pen"},c())),!0),_(De,ji(n(re)),!0),console.log("set index to",n($),"from goto",v(),"historyActions",n(w).length)}ei(()=>{console.log("recompute");let u=!1;if(typeof S()=="string")try{S(JSON.parse(S())),u=!0}catch(I){console.error("error parsing size json",I)}if(typeof R()=="string")try{R(JSON.parse(R())),u=!0}catch(I){console.error("error parsing view json",I)}if(typeof o()=="string"&&o()?.length)try{o(JSON.parse(o())),u=!0}catch(I){console.error("error parsing json",I)}else o()||o(void 0);if(typeof y()=="string"&&y()?.length)try{y(JSON.parse(y())),u=!0}catch(I){console.error("error parsing json",I)}if(L()!=="yes"&&L("no"),typeof h()=="string"&&h(Number(h())),typeof c()=="string"&&c()?.length)try{c(JSON.parse(c())),c()&&!c().size&&(c().size=i.size),c()&&!c().thinning&&(c().thinning=i.thinning),c()&&!c().smoothing&&(c().smoothing=i.smoothing),c()&&!c().streamline&&(c().streamline=i.streamline),u=!0}catch(I){console.error("error parsing json",I)}if(typeof m()=="string")try{m(JSON.parse(m())),u=!0}catch(I){console.error("error parsing insert_object json",I)}n(z)&&u&&Zs()});function Qs(u){const I=[...n(w)],P={id:Date.now().toString(),type:"image",actionIndex:n($),visible:!0,pathData:u?.base64};I.push(P),_(w,[...I],!0),er($)}function el(u){console.info(`inserting SVG ${u?.type}`)}function tl(u){console.info(`inserting Text ${u?.content}`)}function un(u){const I=u.target?.id?.split("_")?.[1];if(I){let P=[...n(w)],ne=P.find(B=>B.id===I&&B.visible);if(!ne)for(const B of P.filter(J=>J.type==="multiplestroke").sort((J,E)=>E.actionIndex-J.actionIndex)){const J=B?.multipath?.find(E=>E.id===I&&E.visible);if(J){ne=J;break}}ne&&(ne.visible=!1,ne.erasedAtIndex=n($),console.info("erase stroke",ne.id),P[P.length-1].type!=="eraser"?(P=P.slice(0,n($)+1),P.push({type:"eraser",visible:!0,id:Math.random().toString(36)+Math.random().toString(36)+Date.now().toString(),actionIndex:n(w).length}),P.forEach((B,J)=>{!B.visible&&B.erasedAtIndex&&B.erasedAtIndex>n($)&&(B.visible=!0,B.erasedAtIndex=void 0)}),_(w,[...P],!0),er($),cr({index:n($),draw_id:f(),id:l(),start_index:F})):_(w,[...P],!0))}}function rl(u){if(console.log("handlePointerDown"),_(we,u.pointerType,!0),_(T,u.buttons,!0),x()==="draw"&&u.buttons===1&&!(u.pointerType==="pen"&&u.pressure===0)){if(_(q,"drawing"),n($)!==n(w).length-1){const I=[...n(w)];I.forEach((P,ne)=>{!P.visible&&P.erasedAtIndex&&P.erasedAtIndex>n($)&&(P.visible=!0,P.erasedAtIndex=void 0)}),_(w,I,!0)}if(n(w)?.length&&n($)<n(w).length)if(n(O))_(w,[],!0),_(O,!1);else{er($);const I=[...n(w)];_(w,I.slice(0,n($)),!0)}cr({index:n($),draw_id:f(),id:l(),start_index:F}),console.log("setup stroke"),_(D,new Date,!0),_(te,Date.now().toString(),!0),_(at,u.pageX-n(b).left),_(Ge,u.pageY-n(b).top),_(fr,u.pageX-n(b).left),_(ur,u.pageY-n(b).top),n(V)||(_(V,n(D),!0),Yi({start:n(V),id:l(),draw_id:f(),stroke_id:n(te),index:n($)})),u.target.setPointerCapture(u.pointerId),n(w)?.length?(console.info("pushing draw"),_(w,[...n(w),{path:[[u.pageX-n(b).left,u.pageY-n(b).top,u.pressure]],color:p(),id:n(te),pathData:n(De),min:[n(at),n(Ge)],max:[n(fr),n(ur)],visible:!0,actionIndex:n(w).length,opacity:h(),type:"stroke"}],!0)):_(w,[{path:[[u.pageX-n(b).left,u.pageY-n(b).top,u.pressure]],color:p(),id:n(te),pathData:n(De),min:[n(at),n(Ge)],max:[n(fr),n(ur)],visible:!0,actionIndex:n(w).length,opacity:h(),type:"stroke"}],!0),Yi({start:n(D),stroke_id:n(te),index:n($),id:l(),draw_id:f()})}else if(x()==="eraser"||x()==="draw"&&(u.pointerType==="pen"&&u.pressure===0&&u.buttons===1||u.buttons===32))u.target.setPointerCapture(u.pointerId),_(q,"erasing"),console.log("eraser down"),un(u);else if(x()==="select"&&n(w).length){let I=!1;const P=u.pageX-n(b).left,ne=u.pageY-n(b).top;if(I=P>n(se)&&P<n(oe)&&ne>n(le)&&ne<n(fe),_(se,u.pageX-n(b).left),_(le,u.pageY-n(b).top),_(oe,u.pageX-n(b).left),_(fe,u.pageY-n(b).top),!n(gt)&&!n(ue)&&I){_(q,"idle"),_(ue,Date.now(),!0),console.info("set move mode");const B=[...n(w)];_(Or,u.pageX-n(b).left),_(sr,u.pageY-n(b).top),B.filter(ie=>ie.selected).forEach(ie=>{ie.visible=!1,ie.erasedAtIndex=n($)}),B.filter(ie=>ie.type==="multiplestroke").forEach(ie=>{ie.multipath?.filter(X=>X.selected).forEach(X=>{X.visible=!1,X.erasedAtIndex=n($)})});const J=[];for(const ie of B.filter(X=>X.type==="multiplestroke"))for(const X of ie.multipath?.filter(H=>H.selected)||[])J.push(JSON.parse(JSON.stringify(X))),X.visible=!1;const E=JSON.parse(JSON.stringify(n(w).filter(ie=>ie.selected))).concat(J);E.forEach(ie=>{ie.visible=!0}),B.push({multipath:E,id:n(ue).toString(),type:"multiplestroke",actionIndex:n($),visible:!0,min:[n(se),n(le)],max:[n(oe),n(fe)]}),n(w)[n(w).length-1].type==="multiplestroke"&&er($),_(w,[...B],!0),cr({index:n($),draw_id:f(),id:l(),start_index:F}),_(gt,!0),_(Nr,n(se),!0),_(lr,n(le),!0),_(or,n(oe),!0),_(qe,n(fe),!0)}else _(q,"selecting"),_(ue,0)}}function nl(u){if(_(T,u.buttons,!0),_(gt,!1),x()==="draw"&&n(q)==="drawing"){const I=new Date;if(!n(te)||!n(D)||!n(De))return console.error("no stroke id",n(te),n(D),n(De));Vs({end:I,stroke_id:n(te),start:n(D),min:[n(at),n(Ge)],max:[n(fr),n(ur)],pathData:n(De),pen_color:p(),index:n($),id:l(),draw_id:f()}),er($),cr({index:n($),draw_id:f(),id:l(),start_index:F})}else if(x()==="eraser"||x()==="draw"&&n(q)!=="drawing"&&(u.pointerType==="pen"&&u.pressure===0&&u.buttons===1||u.buttons===32))console.log("eraser up"),un(u);else if(x()==="select"){const I=[...n(w)];I.forEach(X=>{X.selected=!1,X.type==="multiplestroke"&&X.multipath?.forEach(H=>{H.selected=!1})}),_(w,[...I],!0),_(ue,0);const P=n(se)<n(oe)?n(se):n(oe),ne=n(le)<n(fe)?n(le):n(fe),B=n(se)>n(oe)?n(se):n(oe),J=n(le)>n(fe)?n(le):n(fe),E=I.filter(X=>!!(X.visible&&X.type==="stroke"&&X.min&&X.max&&X.min[0]>P&&X.min[1]>ne&&X.max[0]<B&&X.max[1]<J));let ie=!1;for(const X of I.filter(H=>H.type==="multiplestroke"))for(const H of X.multipath||[])H.visible&&H.type==="stroke"&&H.min&&H.max&&H.min[0]>P&&H.min[1]>ne&&H.max[0]<B&&H.max[1]<J&&(ie=!0);if(E.length>0||ie){for(const X of I.filter(H=>H.type==="multiplestroke"))for(const H of X?.multipath||[])H.visible&&H.min&&H.max&&H.min[0]>P&&H.min[1]>ne&&H.max[0]<B&&H.max[1]<J&&(H.selected=!0);for(const X of E)X.selected=!0;_(w,[...I],!0),console.log(E),Us({minX:n(se),minY:n(le),maxX:n(oe),maxY:n(fe),strokes:E,id:l(),draw_id:f()})}else _(se,0),_(le,0),_(oe,0),_(fe,0)}_(q,"idle"),u?.pointerId&&u.target?.releasePointerCapture?.(u.pointerId)}Ja(()=>{_(z,t.$$host?.shadowRoot?.querySelector("svg"),!0),_(ee,t.$$host?.shadowRoot?.querySelector("#container"),!0);let u=0;const I=setInterval(()=>{_(z,t.$$host?.shadowRoot?.querySelector("svg"),!0),n(z)?clearInterval(I):(u++,u>10?(clearInterval(I),console.warn("no canvas found on check "+u)):console.error("no canvas found on check "+u+" end"))},100);if(!n(z))return console.error("no canvas found on mount")});var il={get id(){return l()},set id(u=""){l(u),me()},get load_draw(){return o()},set load_draw(u){o(u),me()},get draw_id(){return f()},set draw_id(u=Math.random().toString(36)+Math.random().toString(36)+Date.now().toString()){f(u),me()},get background_color(){return d()},set background_color(u="rgb(255,255,255)"){d(u),me()},get pen_color(){return p()},set pen_color(u="rgb(0,0,0)"){p(u),me()},get insert_image(){return m()},set insert_image(u=void 0){m(u),me()},get insert_text(){return g()},set insert_text(u){g(u),me()},get pen_opacity(){return h()},set pen_opacity(u=1){h(u),me()},get options(){return c()},set options(u=i){c(u),me()},get goto(){return v()},set goto(u=void 0){v(u),me()},get mode(){return x()},set mode(u="draw"){x(u),me()},get debug(){return L()},set debug(u="no"){L(u),me()},get save_as(){return y()},set save_as(u=void 0){y(u),me()},get size(){return S()},set size(u=Object.assign({},a)){S(u),me()},get view(){return R()},set view(u=Object.assign({},s)){R(u),me()}},Fi=Xs(),Rr=K(Fi),al=ht(Rr);ct(Rr);var Xi=Jn(Rr,2),Gt=ht(Xi);Gt.__pointerdown=rl,Gt.__pointermove=[xs,we,T,b,x,q,w,$,De,at,Ge,fr,ur,un,oe,fe,gt,se,le,ae,ue,Or,sr,c,ji,Nr,lr,or,qe],Gt.__pointerup=nl;var sl=ht(Gt);{var ll=u=>{var I=Fs(),P=ht(I);Ei(P,17,()=>n(w),J=>J.id,(J,E,ie,X)=>{var H=Q(),mt=K(H);{var Je=dr=>{var Cr=Q(),cn=K(Cr);{var wt=yt=>{var Rt=Q(),vr=K(Rt);{var Ze=st=>{var Ct=Q(),Mt=K(Ct);{var j=xe=>{var ce=$s();he(()=>{N(ce,"id","path_"+n(E).id),N(ce,"d",n(E).pathData),N(ce,"fill",n(E).color),N(ce,"fill-opacity",n(E).opacity)}),M(xe,ce)},Jt=xe=>{var ce=Q(),Pt=K(ce);{var Kt=$e=>{var Se=Ss();he(()=>{N(Se,"id","path_"+n(E).id),N(Se,"href",n(E).pathData)}),M($e,Se)},hr=$e=>{var Se=Q(),Qe=K(Se);{var lt=He=>{var Oe=Ts(),kt=ht(Oe,!0);ct(Oe),he(()=>{N(Oe,"id","path_"+n(E).id),rr(kt,n(E).pathData)}),M(He,Oe)};Z(Qe,He=>{n(E).type==="text"&&He(lt)},!0)}M($e,Se)};Z(Pt,$e=>{n(E).type==="image"?$e(Kt):$e(hr,!1)},!0)}M(xe,ce)};Z(Mt,xe=>{n(E).type==="stroke"?xe(j):xe(Jt,!1)})}M(st,Ct)},pe=st=>{var Ct=Q(),Mt=K(Ct);{var j=xe=>{var ce=Is();he(()=>{N(ce,"id","path_"+n(E).id),N(ce,"d",n(E).pathData),N(ce,"fill",n(E).color),N(ce,"fill-opacity",n(E).opacity)}),M(xe,ce)},Jt=xe=>{var ce=Q(),Pt=K(ce);{var Kt=$e=>{var Se=As();he(()=>{N(Se,"id","path_"+n(E).id),N(Se,"href",n(E).pathData)}),M($e,Se)},hr=$e=>{var Se=Q(),Qe=K(Se);{var lt=He=>{var Oe=Ds(),kt=ht(Oe,!0);ct(Oe),he(()=>{N(Oe,"id","path_"+n(E).id),rr(kt,n(E).pathData)}),M(He,Oe)};Z(Qe,He=>{!n(E).selected&&n(E).type==="text"&&He(lt)},!0)}M($e,Se)};Z(Pt,$e=>{!n(E).selected&&n(E).type==="image"?$e(Kt):$e(hr,!1)},!0)}M(xe,ce)};Z(Mt,xe=>{!n(E).selected&&n(E).type==="stroke"?xe(j):xe(Jt,!1)},!0)}M(st,Ct)};Z(vr,st=>{n(E).selected?st(Ze):st(pe,!1)})}M(yt,Rt)},Ke=yt=>{var Rt=Q(),vr=K(Rt);{var Ze=pe=>{var st=Q(),Ct=K(st);Ei(Ct,17,()=>n(E).multipath,Mt=>Mt.id+n(E).id,(Mt,j)=>{var Jt=Q(),xe=K(Jt);{var ce=Pt=>{var Kt=Q(),hr=K(Kt);{var $e=Qe=>{var lt=Q(),He=K(lt);{var Oe=Ne=>{var ge=Os();he(()=>{N(ge,"id","path_"+n(j).id+"_"+n(E).id),N(ge,"d",n(j).pathData),N(ge,"fill",n(j).color),N(ge,"fill-opacity",n(j).opacity)}),M(Ne,ge)},kt=Ne=>{var ge=Q(),dn=K(ge);{var vn=Re=>{var Ce=Ns();he(()=>{N(Ce,"id","path_"+n(j).id+"_"+n(E).id),N(Ce,"href",n(j).pathData)}),M(Re,Ce)},hn=Re=>{var Ce=Q(),_n=K(Ce);{var pn=Lt=>{var ot=Rs(),gn=ht(ot,!0);ct(ot),he(()=>{N(ot,"id","path_"+n(j).id+"_"+n(E).id),rr(gn,n(j).pathData)}),M(Lt,ot)};Z(_n,Lt=>{n(j).type==="text"&&Lt(pn)},!0)}M(Re,Ce)};Z(dn,Re=>{n(j).type==="image"?Re(vn):Re(hn,!1)},!0)}M(Ne,ge)};Z(He,Ne=>{n(j).type==="stroke"?Ne(Oe):Ne(kt,!1)})}M(Qe,lt)},Se=Qe=>{var lt=Q(),He=K(lt);{var Oe=Ne=>{var ge=Cs();he(()=>{N(ge,"id","path_"+n(j).id+"_"+n(E).id),N(ge,"d",n(j).pathData),N(ge,"fill",n(j).color),N(ge,"fill-opacity",n(j).opacity)}),M(Ne,ge)},kt=Ne=>{var ge=Q(),dn=K(ge);{var vn=Re=>{var Ce=Ms();he(()=>{N(Ce,"id","path_"+n(j).id+"_"+n(E).id),N(Ce,"href",n(j).pathData)}),M(Re,Ce)},hn=Re=>{var Ce=Q(),_n=K(Ce);{var pn=Lt=>{var ot=Ps(),gn=ht(ot,!0);ct(ot),he(()=>{N(ot,"id","path_"+n(j).id+"_"+n(E).id),rr(gn,n(j).pathData)}),M(Lt,ot)};Z(_n,Lt=>{!n(j).selected&&n(j).type==="text"&&Lt(pn)},!0)}M(Re,Ce)};Z(dn,Re=>{!n(j).selected&&n(j).type==="image"?Re(vn):Re(hn,!1)},!0)}M(Ne,ge)};Z(He,Ne=>{!n(j).selected&&n(j).type==="stroke"?Ne(Oe):Ne(kt,!1)},!0)}M(Qe,lt)};Z(hr,Qe=>{n(j).selected?Qe($e):Qe(Se,!1)})}M(Pt,Kt)};Z(xe,Pt=>{n(j).actionIndex<=n($)&&!n(O)&&(n(j).visible||n(j).erasedAtIndex&&n(j).erasedAtIndex>n($))&&Pt(ce)})}M(Mt,Jt)}),M(pe,st)};Z(vr,pe=>{n(E).type==="multiplestroke"&&n(E).multipath&&pe(Ze)},!0)}M(yt,Rt)};Z(cn,yt=>{n(E).type==="stroke"||n(E).type==="image"||n(E).type==="text"?yt(wt):yt(Ke,!1)})}M(dr,Cr)};Z(mt,dr=>{n(E).actionIndex<=n($)&&!n(O)&&(n(E).visible||n(E).erasedAtIndex&&n(E).erasedAtIndex>n($))&&dr(Je)})}M(J,H)});var ne=Jn(P);{var B=J=>{var E=Q(),ie=K(E);{var X=mt=>{var Je=ks();he(()=>{N(Je,"x",n(se)),N(Je,"y",n(le)),N(Je,"width",n(oe)-n(se)),N(Je,"height",n(fe)-n(le))}),M(mt,Je)},H=mt=>{var Je=Q(),dr=K(Je);{var Cr=wt=>{var Ke=Ls();he(()=>{N(Ke,"x",n(oe)),N(Ke,"y",n(le)),N(Ke,"width",n(se)-n(oe)),N(Ke,"height",n(fe)-n(le))}),M(wt,Ke)},cn=wt=>{var Ke=Q(),yt=K(Ke);{var Rt=Ze=>{var pe=js();he(()=>{N(pe,"x",n(se)),N(pe,"y",n(fe)),N(pe,"width",n(oe)-n(se)),N(pe,"height",n(le)-n(fe))}),M(Ze,pe)},vr=Ze=>{var pe=Ys();he(()=>{N(pe,"x",n(oe)),N(pe,"y",n(fe)),N(pe,"width",n(se)-n(oe)),N(pe,"height",n(le)-n(fe))}),M(Ze,pe)};Z(yt,Ze=>{n(se)<n(oe)&&n(le)>n(fe)?Ze(Rt):Ze(vr,!1)},!0)}M(wt,Ke)};Z(dr,wt=>{n(se)>n(oe)&&n(le)<n(fe)?wt(Cr):wt(cn,!1)},!0)}M(mt,Je)};Z(ie,mt=>{n(se)<=n(oe)&&n(le)<=n(fe)?mt(X):mt(H,!1)})}M(J,E)};Z(ne,J=>{x()==="select"&&J(B)})}ct(I),M(u,I)};Z(sl,u=>{n(z)&&u(ll)})}return ct(Gt),ct(Xi),he(()=>{$i(Rr,`display:${L()==="yes"?"block":"none"}`),rr(al,`${n(we)??""} b: ${n(T)??""}`),$i(Gt,`background-color:${d()??""};cursor:${n(ae)===!0?"move":"default"}`)}),M(e,Fi),Cn(il)}Ha(["pointerdown","pointermove","pointerup"]),customElements.define("hb-stylus-paper",fs(Li,{id:{},load_draw:{},draw_id:{},background_color:{},pen_color:{},insert_image:{},insert_text:{},pen_opacity:{},options:{},goto:{},mode:{},debug:{},save_as:{},size:{},view:{}},[],[],!0)),mn.Component=Li,Object.defineProperty(mn,Symbol.toStringTag,{value:"Module"})})(this["stylus-paper"]=this["stylus-paper"]||{});
1
+ (function(wn){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const Wi=1,zi=2,Bi=16,Ui=1,Vi=4,Gi=8,Ji=16,Zi=2,yn="[",Pr="[!",Lr="]",Yt={},ve=Symbol(),Ki="http://www.w3.org/1999/xhtml",bn=!1;var kr=Array.isArray,Qi=Array.prototype.indexOf,jr=Array.from,pr=Object.keys,Ft=Object.defineProperty,bt=Object.getOwnPropertyDescriptor,ea=Object.getOwnPropertyDescriptors,ta=Object.prototype,ra=Array.prototype,En=Object.getPrototypeOf,xn=Object.isExtensible;function $n(e){for(var t=0;t<e.length;t++)e[t]()}function na(){var e,t,r=new Promise((i,a)=>{e=i,t=a});return{promise:r,resolve:e,reject:t}}const Te=2,Yr=4,Sn=8,Xt=16,et=32,ft=64,Tn=128,Me=256,gr=512,ye=1024,Pe=2048,ut=4096,Ye=8192,Et=16384,Fr=32768,Xr=65536,Dn=1<<17,ia=1<<18,qt=1<<19,aa=1<<20,qr=1<<21,Hr=1<<22,xt=1<<23,mr=Symbol("$state"),In=Symbol("legacy props"),sa=Symbol(""),Wr=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},An=3,Qt=8;function la(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function oa(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function fa(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function ua(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function ca(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function da(e){throw new Error("https://svelte.dev/e/effect_orphan")}function va(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ha(){throw new Error("https://svelte.dev/e/hydration_failed")}function _a(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function pa(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function ga(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function ma(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function wr(e){console.warn("https://svelte.dev/e/hydration_mismatch")}let G=!1;function tt(e){G=e}let z;function We(e){if(e===null)throw wr(),Yt;return z=e}function yr(){return We(vt(z))}function ct(e){if(G){if(vt(z)!==null)throw wr(),Yt;z=e}}function zr(){for(var e=0,t=z;;){if(t.nodeType===Qt){var r=t.data;if(r===Lr){if(e===0)return t;e-=1}else(r===yn||r===Pr)&&(e+=1)}var i=vt(t);t.remove(),t=i}}function On(e){if(!e||e.nodeType!==Qt)throw wr(),Yt;return e.data}function Nn(e){return e===this.v}function wa(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Rn(e){return!wa(e,this.v)}let ya=!1,Le=null;function br(e){Le=e}function Cn(e,t=!1,r){Le={p:Le,c:null,e:null,s:e,x:null,l:null}}function Mn(e){var t=Le,r=t.e;if(r!==null){t.e=null;for(var i of r)ri(i)}return e!==void 0&&(t.x=e),Le=t.p,e??{}}function Pn(){return!0}const ba=new WeakMap;function Ea(e){var t=L;if(t===null)return Y.f|=xt,e;if((t.f&Fr)===0){if((t.f&Tn)===0)throw!t.parent&&e instanceof Error&&Ln(e),e;t.b.error(e)}else Br(e,t)}function Br(e,t){for(;t!==null;){if((t.f&Tn)!==0)try{t.b.error(e);return}catch(r){e=r}t=t.parent}throw e instanceof Error&&Ln(e),e}function Ln(e){const t=ba.get(e);t&&(Ft(e,"message",{value:t.message}),Ft(e,"stack",{value:t.stack}))}let Ur=[],Vr=[];function xa(){var e=Ur;Ur=[],$n(e)}function $a(){var e=Vr;Vr=[],$n(e)}function Sa(){Ur.length>0&&xa(),Vr.length>0&&$a()}function Ta(){const e=L.b;return e===null&&la(),e}function Gr(e){var t=Te|Pe,r=Y!==null&&(Y.f&Te)!==0?Y:null;return L===null||r!==null&&(r.f&Me)!==0?t|=Me:L.f|=qt,{ctx:Le,deps:null,effects:null,equals:Nn,f:t,fn:e,reactions:null,rv:0,v:ve,wv:0,parent:r??L,ac:null}}function Da(e,t){let r=L;r===null&&fa();var i=r.b,a=void 0,s=er(ve),l=null,o=!Y;return ka(()=>{try{var f=e();l&&Promise.resolve(f).catch(()=>{})}catch(p){f=Promise.reject(p)}var c=()=>f;a=l?.then(c,c)??Promise.resolve(f),l=a;var h=de,m=i.is_pending();o&&(i.update_pending_count(1),m||h.increment());const _=(p,d=void 0)=>{l=null,m||h.activate(),d?d!==Wr&&(s.f|=xt,Sr(s,d)):((s.f&xt)!==0&&(s.f^=xt),Sr(s,p)),o&&(i.update_pending_count(-1),m||h.decrement()),Fn()};if(a.then(_,p=>_(null,p||"unknown")),h)return()=>{queueMicrotask(()=>h.neuter())}}),new Promise(f=>{function c(h){function m(){h===a?f(s):c(a)}h.then(m,m)}c(a)})}function kn(e){const t=Gr(e);return t.equals=Rn,t}function jn(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)ze(t[r])}}function Ia(e){for(var t=e.parent;t!==null;){if((t.f&Te)===0)return t;t=t.parent}return null}function Jr(e){var t,r=L;_t(Ia(e));try{jn(e),t=_i(e)}finally{_t(r)}return t}function Yn(e){var t=Jr(e);if(e.equals(t)||(e.v=t,e.wv=vi()),!At){var r=(pt||(e.f&Me)!==0)&&e.deps!==null?ut:ye;Ie(e,r)}}function Aa(e,t,r){const i=Gr;if(t.length===0){r(e.map(i));return}var a=de,s=L,l=Oa(),o=Ta();Promise.all(t.map(f=>Da(f))).then(f=>{a?.activate(),l();try{r([...e.map(i),...f])}catch(c){(s.f&Et)===0&&Br(c,s)}a?.deactivate(),Fn()}).catch(f=>{o.error(f)})}function Oa(){var e=L,t=Y,r=Le,i=de;return function(){_t(e),Ue(t),br(r),i?.activate()}}function Fn(){_t(null),Ue(null),br(null)}const Zr=new Set;let de=null,Xn=new Set,Er=[];function qn(){const e=Er.shift();Er.length>0&&queueMicrotask(qn),e()}let $t=[],xr=null,Kr=!1,$r=!1;class St{current=new Map;#t=new Map;#e=new Set;#r=0;#f=null;#u=!1;#i=[];#s=[];#a=[];#n=[];#l=[];#c=[];#d=[];skipped_effects=new Set;process(t){$t=[];for(const a of t)this.#h(a);if(this.#i.length===0&&this.#r===0){this.#v();var r=this.#a,i=this.#n;this.#a=[],this.#n=[],this.#l=[],de=null,Wn(r),Wn(i),de===null?de=this:Zr.delete(this),this.#f?.resolve()}else this.#o(this.#a),this.#o(this.#n),this.#o(this.#l);for(const a of this.#i)Bt(a);for(const a of this.#s)Bt(a);this.#i=[],this.#s=[]}#h(t){t.f^=ye;for(var r=t.first;r!==null;){var i=r.f,a=(i&(et|ft))!==0,s=a&&(i&ye)!==0,l=s||(i&Ye)!==0||this.skipped_effects.has(r);if(!l&&r.fn!==null){if(a)r.f^=ye;else if((i&Yr)!==0)this.#n.push(r);else if((i&ye)===0)if((i&Hr)!==0){var o=r.b?.is_pending()?this.#s:this.#i;o.push(r)}else Tr(r)&&((r.f&Xt)!==0&&this.#l.push(r),Bt(r));var f=r.first;if(f!==null){r=f;continue}}var c=r.parent;for(r=r.next;r===null&&c!==null;)r=c.next,c=c.parent}}#o(t){for(const r of t)((r.f&Pe)!==0?this.#c:this.#d).push(r),Ie(r,ye);t.length=0}capture(t,r){this.#t.has(t)||this.#t.set(t,r),this.current.set(t,t.v)}activate(){de=this}deactivate(){de=null;for(const t of Xn)if(Xn.delete(t),t(),de!==null)break}neuter(){this.#u=!0}flush(){$t.length>0?Hn():this.#v(),de===this&&(this.#r===0&&Zr.delete(this),this.deactivate())}#v(){if(!this.#u)for(const t of this.#e)t();this.#e.clear()}increment(){this.#r+=1}decrement(){if(this.#r-=1,this.#r===0){for(const t of this.#c)Ie(t,Pe),Ht(t);for(const t of this.#d)Ie(t,ut),Ht(t);this.#a=[],this.#n=[],this.flush()}else this.deactivate()}add_callback(t){this.#e.add(t)}settled(){return(this.#f??=na()).promise}static ensure(){if(de===null){const t=de=new St;Zr.add(de),$r||St.enqueue(()=>{de===t&&t.flush()})}return de}static enqueue(t){Er.length===0&&queueMicrotask(qn),Er.unshift(t)}}function me(e){var t=$r;$r=!0;try{for(var r;;){if(Sa(),$t.length===0&&(de?.flush(),$t.length===0))return xr=null,r;Hn()}}finally{$r=t}}function Hn(){var e=zt;Kr=!0;try{var t=0;for(fi(!0);$t.length>0;){var r=St.ensure();if(t++>1e3){var i,a;Na()}r.process($t),dt.clear()}}finally{Kr=!1,fi(e),xr=null}}function Na(){try{va()}catch(e){Br(e,xr)}}let Tt=null;function Wn(e){var t=e.length;if(t!==0){for(var r=0;r<t;){var i=e[r++];if((i.f&(Et|Ye))===0&&Tr(i)&&(Tt=[],Bt(i),i.deps===null&&i.first===null&&i.nodes_start===null&&(i.teardown===null&&i.ac===null?si(i):i.fn=null),Tt?.length>0)){dt.clear();for(const a of Tt)Bt(a);Tt=[]}}Tt=null}}function Ht(e){for(var t=xr=e;t.parent!==null;){t=t.parent;var r=t.f;if(Kr&&t===L&&(r&Xt)!==0)return;if((r&(ft|et))!==0){if((r&ye)===0)return;t.f^=ye}}$t.push(t)}const dt=new Map;function er(e,t){var r={f:0,v:e,reactions:null,equals:Nn,rv:0,wv:0};return r}function C(e,t){const r=er(e);return Xa(r),r}function zn(e,t=!1,r=!0){const i=er(e);return t||(i.equals=Rn),i}function g(e,t,r=!1){Y!==null&&(!Be||(Y.f&Dn)!==0)&&Pn()&&(Y.f&(Te|Xt|Hr|Dn))!==0&&!it?.includes(e)&&ma();let i=r?rt(t):t;return Sr(e,i)}function Sr(e,t){if(!e.equals(t)){var r=e.v;At?dt.set(e,t):dt.set(e,r),e.v=t;var i=St.ensure();i.capture(e,r),(e.f&Te)!==0&&((e.f&Pe)!==0&&Jr(e),Ie(e,(e.f&Me)===0?ye:ut)),e.wv=vi(),Bn(e,Pe),L!==null&&(L.f&ye)!==0&&(L.f&(et|ft))===0&&(ke===null?qa([e]):ke.push(e))}return t}function tr(e,t=1){var r=n(e),i=t===1?r++:r--;return g(e,r),i}function Qr(e){g(e,e.v+1)}function Bn(e,t){var r=e.reactions;if(r!==null)for(var i=r.length,a=0;a<i;a++){var s=r[a],l=s.f,o=(l&Pe)===0;o&&Ie(s,t),(l&Te)!==0?Bn(s,ut):o&&((l&Xt)!==0&&Tt!==null&&Tt.push(s),Ht(s))}}function rt(e){if(typeof e!="object"||e===null||mr in e)return e;const t=En(e);if(t!==ta&&t!==ra)return e;var r=new Map,i=kr(e),a=C(0),s=Ot,l=o=>{if(Ot===s)return o();var f=Y,c=Ot;Ue(null),di(s);var h=o();return Ue(f),di(c),h};return i&&r.set("length",C(e.length)),new Proxy(e,{defineProperty(o,f,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&pa();var h=r.get(f);return h===void 0?h=l(()=>{var m=C(c.value);return r.set(f,m),m}):g(h,c.value,!0),!0},deleteProperty(o,f){var c=r.get(f);if(c===void 0){if(f in o){const h=l(()=>C(ve));r.set(f,h),Qr(a)}}else g(c,ve),Qr(a);return!0},get(o,f,c){if(f===mr)return e;var h=r.get(f),m=f in o;if(h===void 0&&(!m||bt(o,f)?.writable)&&(h=l(()=>{var p=rt(m?o[f]:ve),d=C(p);return d}),r.set(f,h)),h!==void 0){var _=n(h);return _===ve?void 0:_}return Reflect.get(o,f,c)},getOwnPropertyDescriptor(o,f){var c=Reflect.getOwnPropertyDescriptor(o,f);if(c&&"value"in c){var h=r.get(f);h&&(c.value=n(h))}else if(c===void 0){var m=r.get(f),_=m?.v;if(m!==void 0&&_!==ve)return{enumerable:!0,configurable:!0,value:_,writable:!0}}return c},has(o,f){if(f===mr)return!0;var c=r.get(f),h=c!==void 0&&c.v!==ve||Reflect.has(o,f);if(c!==void 0||L!==null&&(!h||bt(o,f)?.writable)){c===void 0&&(c=l(()=>{var _=h?rt(o[f]):ve,p=C(_);return p}),r.set(f,c));var m=n(c);if(m===ve)return!1}return h},set(o,f,c,h){var m=r.get(f),_=f in o;if(i&&f==="length")for(var p=c;p<m.v;p+=1){var d=r.get(p+"");d!==void 0?g(d,ve):p in o&&(d=l(()=>C(ve)),r.set(p+"",d))}if(m===void 0)(!_||bt(o,f)?.writable)&&(m=l(()=>C(void 0)),g(m,rt(c)),r.set(f,m));else{_=m.v!==ve;var v=l(()=>rt(c));g(m,v)}var x=Reflect.getOwnPropertyDescriptor(o,f);if(x?.set&&x.set.call(h,c),!_){if(i&&typeof f=="string"){var k=r.get("length"),y=Number(f);Number.isInteger(y)&&y>=k.v&&g(k,y+1)}Qr(a)}return!0},ownKeys(o){n(a);var f=Reflect.ownKeys(o).filter(m=>{var _=r.get(m);return _===void 0||_.v!==ve});for(var[c,h]of r)h.v!==ve&&!(c in o)&&f.push(c);return f},setPrototypeOf(){ga()}})}var Un,Vn,Gn,Jn;function en(){if(Un===void 0){Un=window,Vn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;Gn=bt(t,"firstChild").get,Jn=bt(t,"nextSibling").get,xn(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),xn(r)&&(r.__t=void 0)}}function Dt(e=""){return document.createTextNode(e)}function It(e){return Gn.call(e)}function vt(e){return Jn.call(e)}function ht(e,t){if(!G)return It(e);var r=It(z);if(r===null)r=z.appendChild(Dt());else if(t&&r.nodeType!==An){var i=Dt();return r?.before(i),We(i),i}return We(r),r}function Z(e,t){if(!G){var r=It(e);return r instanceof Comment&&r.data===""?vt(r):r}return z}function Zn(e,t=1,r=!1){let i=G?z:e;for(var a;t--;)a=i,i=vt(i);if(!G)return i;if(r&&i?.nodeType!==An){var s=Dt();return i===null?a?.after(s):i.before(s),We(s),s}return We(i),i}function Kn(e){e.textContent=""}function Qn(){return!1}function ei(e){var t=Y,r=L;Ue(null),_t(null);try{return e()}finally{Ue(t),_t(r)}}function Ra(e){L===null&&Y===null&&da(),Y!==null&&(Y.f&Me)!==0&&L===null&&ca(),At&&ua()}function Ca(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function nt(e,t,r,i=!0){var a=L;a!==null&&(a.f&Ye)!==0&&(e|=Ye);var s={ctx:Le,deps:null,nodes_start:null,nodes_end:null,f:e|Pe,first:null,fn:t,last:null,next:null,parent:a,b:a&&a.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(r)try{Bt(s),s.f|=Fr}catch(f){throw ze(s),f}else t!==null&&Ht(s);if(i){var l=s;if(r&&l.deps===null&&l.teardown===null&&l.nodes_start===null&&l.first===l.last&&(l.f&qt)===0&&(l=l.first),l!==null&&(l.parent=a,a!==null&&Ca(l,a),Y!==null&&(Y.f&Te)!==0&&(e&ft)===0)){var o=Y;(o.effects??=[]).push(l)}}return s}function ti(e){Ra();var t=L.f,r=!Y&&(t&et)!==0&&(t&Fr)===0;if(r){var i=Le;(i.e??=[]).push(e)}else return ri(e)}function ri(e){return nt(Yr|aa,e,!1)}function Ma(e){St.ensure();const t=nt(ft|qt,e,!0);return()=>{ze(t)}}function Pa(e){St.ensure();const t=nt(ft|qt,e,!0);return(r={})=>new Promise(i=>{r.outro?tn(t,()=>{ze(t),i(void 0)}):(ze(t),i(void 0))})}function La(e){return nt(Yr,e,!1)}function ka(e){return nt(Hr|qt,e,!0)}function ja(e,t=0){return nt(Sn|t,e,!0)}function he(e,t=[],r=[]){Aa(t,r,i=>{nt(Sn,()=>e(...i.map(n)),!0)})}function ni(e,t=0){var r=nt(Xt|t,e,!0);return r}function Wt(e,t=!0){return nt(et|qt,e,!0,t)}function ii(e){var t=e.teardown;if(t!==null){const r=At,i=Y;ui(!0),Ue(null);try{t.call(null)}finally{ui(r),Ue(i)}}}function ai(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){const a=r.ac;a!==null&&ei(()=>{a.abort(Wr)});var i=r.next;(r.f&ft)!==0?r.parent=null:ze(r,t),r=i}}function Ya(e){for(var t=e.first;t!==null;){var r=t.next;(t.f&et)===0&&ze(t),t=r}}function ze(e,t=!0){var r=!1;(t||(e.f&ia)!==0)&&e.nodes_start!==null&&e.nodes_end!==null&&(Fa(e.nodes_start,e.nodes_end),r=!0),ai(e,t&&!r),Dr(e,0),Ie(e,Et);var i=e.transitions;if(i!==null)for(const s of i)s.stop();ii(e);var a=e.parent;a!==null&&a.first!==null&&si(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function Fa(e,t){for(;e!==null;){var r=e===t?null:vt(e);e.remove(),e=r}}function si(e){var t=e.parent,r=e.prev,i=e.next;r!==null&&(r.next=i),i!==null&&(i.prev=r),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=r))}function tn(e,t){var r=[];rn(e,r,!0),li(r,()=>{ze(e),t&&t()})}function li(e,t){var r=e.length;if(r>0){var i=()=>--r||t();for(var a of e)a.out(i)}else t()}function rn(e,t,r){if((e.f&Ye)===0){if(e.f^=Ye,e.transitions!==null)for(const l of e.transitions)(l.is_global||r)&&t.push(l);for(var i=e.first;i!==null;){var a=i.next,s=(i.f&Xr)!==0||(i.f&et)!==0;rn(i,t,s?r:!1),i=a}}}function nn(e){oi(e,!0)}function oi(e,t){if((e.f&Ye)!==0){e.f^=Ye,(e.f&ye)===0&&(Ie(e,Pe),Ht(e));for(var r=e.first;r!==null;){var i=r.next,a=(r.f&Xr)!==0||(r.f&et)!==0;oi(r,a?t:!1),r=i}if(e.transitions!==null)for(const s of e.transitions)(s.is_global||t)&&s.in()}}let zt=!1;function fi(e){zt=e}let At=!1;function ui(e){At=e}let Y=null,Be=!1;function Ue(e){Y=e}let L=null;function _t(e){L=e}let it=null;function Xa(e){Y!==null&&(it===null?it=[e]:it.push(e))}let be=null,De=0,ke=null;function qa(e){ke=e}let ci=1,rr=0,Ot=rr;function di(e){Ot=e}let pt=!1;function vi(){return++ci}function Tr(e){var t=e.f;if((t&Pe)!==0)return!0;if((t&ut)!==0){var r=e.deps,i=(t&Me)!==0;if(r!==null){var a,s,l=(t&gr)!==0,o=i&&L!==null&&!pt,f=r.length;if((l||o)&&(L===null||(L.f&Et)===0)){var c=e,h=c.parent;for(a=0;a<f;a++)s=r[a],(l||!s?.reactions?.includes(c))&&(s.reactions??=[]).push(c);l&&(c.f^=gr),o&&h!==null&&(h.f&Me)===0&&(c.f^=Me)}for(a=0;a<f;a++)if(s=r[a],Tr(s)&&Yn(s),s.wv>e.wv)return!0}(!i||L!==null&&!pt)&&Ie(e,ye)}return!1}function hi(e,t,r=!0){var i=e.reactions;if(i!==null&&!it?.includes(e))for(var a=0;a<i.length;a++){var s=i[a];(s.f&Te)!==0?hi(s,t,!1):t===s&&(r?Ie(s,Pe):(s.f&ye)!==0&&Ie(s,ut),Ht(s))}}function _i(e){var t=be,r=De,i=ke,a=Y,s=pt,l=it,o=Le,f=Be,c=Ot,h=e.f;be=null,De=0,ke=null,pt=(h&Me)!==0&&(Be||!zt||Y===null),Y=(h&(et|ft))===0?e:null,it=null,br(e.ctx),Be=!1,Ot=++rr,e.ac!==null&&(ei(()=>{e.ac.abort(Wr)}),e.ac=null);try{e.f|=qr;var m=e.fn,_=m(),p=e.deps;if(be!==null){var d;if(Dr(e,De),p!==null&&De>0)for(p.length=De+be.length,d=0;d<be.length;d++)p[De+d]=be[d];else e.deps=p=be;if(!pt||(h&Te)!==0&&e.reactions!==null)for(d=De;d<p.length;d++)(p[d].reactions??=[]).push(e)}else p!==null&&De<p.length&&(Dr(e,De),p.length=De);if(Pn()&&ke!==null&&!Be&&p!==null&&(e.f&(Te|ut|Pe))===0)for(d=0;d<ke.length;d++)hi(ke[d],e);return a!==null&&a!==e&&(rr++,ke!==null&&(i===null?i=ke:i.push(...ke))),(e.f&xt)!==0&&(e.f^=xt),_}catch(v){return Ea(v)}finally{e.f^=qr,be=t,De=r,ke=i,Y=a,pt=s,it=l,br(o),Be=f,Ot=c}}function Ha(e,t){let r=t.reactions;if(r!==null){var i=Qi.call(r,e);if(i!==-1){var a=r.length-1;a===0?r=t.reactions=null:(r[i]=r[a],r.pop())}}r===null&&(t.f&Te)!==0&&(be===null||!be.includes(t))&&(Ie(t,ut),(t.f&(Me|gr))===0&&(t.f^=gr),jn(t),Dr(t,0))}function Dr(e,t){var r=e.deps;if(r!==null)for(var i=t;i<r.length;i++)Ha(e,r[i])}function Bt(e){var t=e.f;if((t&Et)===0){Ie(e,ye);var r=L,i=zt;L=e,zt=!0;try{(t&Xt)!==0?Ya(e):ai(e),ii(e);var a=_i(e);e.teardown=typeof a=="function"?a:null,e.wv=ci;var s;bn&&ya&&(e.f&Pe)!==0&&e.deps}finally{zt=i,L=r}}}function n(e){var t=e.f,r=(t&Te)!==0;if(Y!==null&&!Be){var i=L!==null&&(L.f&Et)!==0;if(!i&&!it?.includes(e)){var a=Y.deps;if((Y.f&qr)!==0)e.rv<rr&&(e.rv=rr,be===null&&a!==null&&a[De]===e?De++:be===null?be=[e]:(!pt||!be.includes(e))&&be.push(e));else{(Y.deps??=[]).push(e);var s=e.reactions;s===null?e.reactions=[Y]:s.includes(Y)||s.push(Y)}}}else if(r&&e.deps===null&&e.effects===null){var l=e,o=l.parent;o!==null&&(o.f&Me)===0&&(l.f^=Me)}if(At){if(dt.has(e))return dt.get(e);if(r){l=e;var f=l.v;return((l.f&ye)===0&&l.reactions!==null||pi(l))&&(f=Jr(l)),dt.set(l,f),f}}else r&&(l=e,Tr(l)&&Yn(l));if((e.f&xt)!==0)throw e.v;return e.v}function pi(e){if(e.v===ve)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(dt.has(t)||(t.f&Te)!==0&&pi(t))return!0;return!1}function gi(e){var t=Be;try{return Be=!0,e()}finally{Be=t}}const Wa=-7169;function Ie(e,t){e.f=e.f&Wa|t}const mi=new Set,an=new Set;function za(e){for(var t=0;t<e.length;t++)mi.add(e[t]);for(var r of an)r(e)}let wi=null;function Ir(e){var t=this,r=t.ownerDocument,i=e.type,a=e.composedPath?.()||[],s=a[0]||e.target;wi=e;var l=0,o=wi===e&&e.__root;if(o){var f=a.indexOf(o);if(f!==-1&&(t===document||t===window)){e.__root=t;return}var c=a.indexOf(t);if(c===-1)return;f<=c&&(l=f)}if(s=a[l]||e.target,s!==t){Ft(e,"currentTarget",{configurable:!0,get(){return s||r}});var h=Y,m=L;Ue(null),_t(null);try{for(var _,p=[];s!==null;){var d=s.assignedSlot||s.parentNode||s.host||null;try{var v=s["__"+i];if(v!=null&&(!s.disabled||e.target===s))if(kr(v)){var[x,...k]=v;x.apply(s,[e,...k])}else v.call(s,e)}catch(y){_?p.push(y):_=y}if(e.cancelBubble||d===t||d===null)break;s=d}if(_){for(let y of p)queueMicrotask(()=>{throw y});throw _}}finally{e.__root=t,delete e.currentTarget,Ue(h),_t(m)}}}function yi(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function Nt(e,t){var r=L;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function Ba(e,t){var r=(t&Zi)!==0,i,a=!e.startsWith("<!>");return()=>{if(G)return Nt(z,null),z;i===void 0&&(i=yi(a?e:"<!>"+e));var s=r||Vn?document.importNode(i,!0):i.cloneNode(!0);{var l=It(s),o=s.lastChild;Nt(l,o)}return s}}function Ua(e,t,r="svg"){var i=!e.startsWith("<!>"),a=`<${r}>${i?e:"<!>"+e}</${r}>`,s;return()=>{if(G)return Nt(z,null),z;if(!s){var l=yi(a),o=It(l);s=It(o)}var f=s.cloneNode(!0);return Nt(f,f),f}}function _e(e,t){return Ua(e,t,"svg")}function Q(){if(G)return Nt(z,null),z;var e=document.createDocumentFragment(),t=document.createComment(""),r=Dt();return e.append(t,r),Nt(t,r),e}function M(e,t){if(G){L.nodes_end=z,yr();return}e!==null&&e.before(t)}const Va=["touchstart","touchmove"];function Ga(e){return Va.includes(e)}function nr(e,t){var r=t==null?"":typeof t=="object"?t+"":t;r!==(e.__t??=e.nodeValue)&&(e.__t=r,e.nodeValue=r+"")}function bi(e,t){return Ei(e,t)}function Ja(e,t){en(),t.intro=t.intro??!1;const r=t.target,i=G,a=z;try{for(var s=It(r);s&&(s.nodeType!==Qt||s.data!==yn);)s=vt(s);if(!s)throw Yt;tt(!0),We(s),yr();const l=Ei(e,{...t,anchor:s});if(z===null||z.nodeType!==Qt||z.data!==Lr)throw wr(),Yt;return tt(!1),l}catch(l){if(l instanceof Error&&l.message.split(`
2
+ `).some(o=>o.startsWith("https://svelte.dev/e/")))throw l;return l!==Yt&&console.warn("Failed to hydrate: ",l),t.recover===!1&&ha(),en(),Kn(r),tt(!1),bi(e,t)}finally{tt(i),We(a)}}const Ut=new Map;function Ei(e,{target:t,anchor:r,props:i={},events:a,context:s,intro:l=!0}){en();var o=new Set,f=m=>{for(var _=0;_<m.length;_++){var p=m[_];if(!o.has(p)){o.add(p);var d=Ga(p);t.addEventListener(p,Ir,{passive:d});var v=Ut.get(p);v===void 0?(document.addEventListener(p,Ir,{passive:d}),Ut.set(p,1)):Ut.set(p,v+1)}}};f(jr(mi)),an.add(f);var c=void 0,h=Pa(()=>{var m=r??t.appendChild(Dt());return Wt(()=>{if(s){Cn({});var _=Le;_.c=s}a&&(i.$$events=a),G&&Nt(m,null),c=e(m,i)||{},G&&(L.nodes_end=z),s&&Mn()}),()=>{for(var _ of o){t.removeEventListener(_,Ir);var p=Ut.get(_);--p===0?(document.removeEventListener(_,Ir),Ut.delete(_)):Ut.set(_,p)}an.delete(f),m!==r&&m.parentNode?.removeChild(m)}});return sn.set(c,h),c}let sn=new WeakMap;function Za(e,t){const r=sn.get(e);return r?(sn.delete(e),r(t)):Promise.resolve()}function Ka(e){Le===null&&oa(),ti(()=>{const t=gi(e);if(typeof t=="function")return t})}function K(e,t,r=!1){G&&yr();var i=e,a=null,s=null,l=ve,o=r?Xr:0,f=!1;const c=(p,d=!0)=>{f=!0,_(d,p)};var h=null;function m(){h!==null&&(h.lastChild.remove(),i.before(h),h=null);var p=l?a:s,d=l?s:a;p&&nn(p),d&&tn(d,()=>{l?s=null:a=null})}const _=(p,d)=>{if(l===(l=p))return;let v=!1;if(G){const I=On(i)===Pr;!!l===I&&(i=zr(),We(i),tt(!1),v=!0)}var x=Qn(),k=i;if(x&&(h=document.createDocumentFragment(),h.append(k=Dt())),l?a??=d&&Wt(()=>d(k)):s??=d&&Wt(()=>d(k)),x){var y=de,S=l?a:s,R=l?s:a;S&&y.skipped_effects.delete(S),R&&y.skipped_effects.add(R),y.add_callback(m)}else m();v&&tt(!0)};ni(()=>{f=!1,t(c),f||_(null,null)},o),G&&(i=z)}function Qa(e,t,r){for(var i=e.items,a=[],s=t.length,l=0;l<s;l++)rn(t[l].e,a,!0);var o=s>0&&a.length===0&&r!==null;if(o){var f=r.parentNode;Kn(f),f.append(r),i.clear(),Ve(e,t[0].prev,t[s-1].next)}li(a,()=>{for(var c=0;c<s;c++){var h=t[c];o||(i.delete(h.k),Ve(e,h.prev,h.next)),ze(h.e,!o)}})}function xi(e,t,r,i,a,s=null){var l=e,o={flags:t,items:new Map,first:null};G&&yr();var f=null,c=!1,h=new Map,m=kn(()=>{var v=r();return kr(v)?v:v==null?[]:jr(v)}),_,p;function d(){es(p,_,o,h,l,a,t,i,r),s!==null&&(_.length===0?f?nn(f):f=Wt(()=>s(l)):f!==null&&tn(f,()=>{f=null}))}ni(()=>{p??=L,_=n(m);var v=_.length;if(c&&v===0)return;c=v===0;let x=!1;if(G){var k=On(l)===Pr;k!==(v===0)&&(l=zr(),We(l),tt(!1),x=!0)}if(G){for(var y=null,S,R=0;R<v;R++){if(z.nodeType===Qt&&z.data===Lr){l=z,x=!0,tt(!1);break}var I=_[R],F=i(I,R);S=ln(z,o,y,null,I,F,R,a,t,r),o.items.set(F,S),y=S}v>0&&We(zr())}if(G)v===0&&s&&(f=Wt(()=>s(l)));else if(Qn()){var $=new Set,ae=de;for(R=0;R<v;R+=1){I=_[R],F=i(I,R);var U=o.items.get(F)??h.get(F);U?$i(U,I,R):(S=ln(null,o,null,null,I,F,R,a,t,r,!0),h.set(F,S)),$.add(F)}for(const[W,ee]of o.items)$.has(W)||ae.skipped_effects.add(ee.e);ae.add_callback(d)}else d();x&&tt(!0),n(m)}),G&&(l=z)}function es(e,t,r,i,a,s,l,o,f){var c=t.length,h=r.items,m=r.first,_=m,p,d=null,v=[],x=[],k,y,S,R;for(R=0;R<c;R+=1){if(k=t[R],y=o(k,R),S=h.get(y),S===void 0){var I=i.get(y);if(I!==void 0){i.delete(y),h.set(y,I);var F=d?d.next:_;Ve(r,d,I),Ve(r,I,F),on(I,F,a),d=I}else{var $=_?_.e.nodes_start:a;d=ln($,r,d,d===null?r.first:d.next,k,y,R,s,l,f)}h.set(y,d),v=[],x=[],_=d.next;continue}if($i(S,k,R),(S.e.f&Ye)!==0&&nn(S.e),S!==_){if(p!==void 0&&p.has(S)){if(v.length<x.length){var ae=x[0],U;d=ae.prev;var W=v[0],ee=v[v.length-1];for(U=0;U<v.length;U+=1)on(v[U],ae,a);for(U=0;U<x.length;U+=1)p.delete(x[U]);Ve(r,W.prev,ee.next),Ve(r,d,W),Ve(r,ee,ae),_=ae,d=ee,R-=1,v=[],x=[]}else p.delete(S),on(S,_,a),Ve(r,S.prev,S.next),Ve(r,S,d===null?r.first:d.next),Ve(r,d,S),d=S;continue}for(v=[],x=[];_!==null&&_.k!==y;)(_.e.f&Ye)===0&&(p??=new Set).add(_),x.push(_),_=_.next;if(_===null)continue;S=_}v.push(S),d=S,_=S.next}if(_!==null||p!==void 0){for(var we=p===void 0?[]:jr(p);_!==null;)(_.e.f&Ye)===0&&we.push(_),_=_.next;var b=we.length;if(b>0){var T=null;Qa(r,we,T)}}e.first=r.first&&r.first.e,e.last=d&&d.e;for(var V of i.values())ze(V.e);i.clear()}function $i(e,t,r,i){Sr(e.v,t),e.i=r}function ln(e,t,r,i,a,s,l,o,f,c,h){var m=(f&Wi)!==0,_=(f&Bi)===0,p=m?_?zn(a,!1,!1):er(a):a,d=(f&zi)===0?l:er(l),v={i:d,v:p,k:s,a:null,e:null,prev:r,next:i};try{if(e===null){var x=document.createDocumentFragment();x.append(e=Dt())}return v.e=Wt(()=>o(e,p,d,c),G),v.e.prev=r&&r.e,v.e.next=i&&i.e,r===null?h||(t.first=v):(r.next=v,r.e.next=v.e),i!==null&&(i.prev=v,i.e.prev=v.e),v}finally{}}function on(e,t,r){for(var i=e.next?e.next.e.nodes_start:r,a=t?t.e.nodes_start:r,s=e.e.nodes_start;s!==null&&s!==i;){var l=vt(s);a.before(s),s=l}}function Ve(e,t,r){t===null?e.first=r:(t.next=r,t.e.next=r&&r.e),r!==null&&(r.prev=t,r.e.prev=t&&t.e)}function ts(e,t){La(()=>{var r=e.getRootNode(),i=r.host?r:r.head??r.ownerDocument.head;if(!i.querySelector("#"+t.hash)){const a=document.createElement("style");a.id=t.hash,a.textContent=t.code,i.appendChild(a)}})}function rs(e,t){return e==null?null:String(e)}function Si(e,t,r,i){var a=e.__style;if(G||a!==t){var s=rs(t);(!G||s!==e.getAttribute("style"))&&(s==null?e.removeAttribute("style"):e.style.cssText=s),e.__style=t}return i}const ns=Symbol("is custom element"),is=Symbol("is html");function N(e,t,r,i){var a=as(e);G&&(a[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||a[t]!==(a[t]=r)&&(t==="loading"&&(e[sa]=r),r==null?e.removeAttribute(t):typeof r!="string"&&ss(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function as(e){return e.__attributes??={[ns]:e.nodeName.includes("-"),[is]:e.namespaceURI===Ki}}var Ti=new Map;function ss(e){var t=e.getAttribute("is")||e.nodeName,r=Ti.get(t);if(r)return r;Ti.set(t,r=[]);for(var i,a=e,s=Element.prototype;s!==a;){i=ea(a);for(var l in i)i[l].set&&r.push(l);a=En(a)}return r}let Ar=!1;function ls(e){var t=Ar;try{return Ar=!1,[e(),Ar]}finally{Ar=t}}function Ee(e,t,r,i){var a=(r&Gi)!==0,s=(r&Ji)!==0,l=i,o=!0,f=()=>(o&&(o=!1,l=s?gi(i):i),l),c;if(a){var h=mr in e||In in e;c=bt(e,t)?.set??(h&&t in e?y=>e[t]=y:void 0)}var m,_=!1;a?[m,_]=ls(()=>e[t]):m=e[t],m===void 0&&i!==void 0&&(m=f(),c&&(_a(),c(m)));var p;if(p=()=>{var y=e[t];return y===void 0?f():(o=!0,y)},(r&Vi)===0)return p;if(c){var d=e.$$legacy;return(function(y,S){return arguments.length>0?((!S||d||_)&&c(S?p():y),y):p()})}var v=!1,x=((r&Ui)!==0?Gr:kn)(()=>(v=!1,p()));a&&n(x);var k=L;return(function(y,S){if(arguments.length>0){const R=S?n(x):a?rt(y):y;return g(x,R),v=!0,l!==void 0&&(l=R),y}return At&&v||(k.f&Et)!==0?x.v:n(x)})}function os(e){return new fs(e)}class fs{#t;#e;constructor(t){var r=new Map,i=(s,l)=>{var o=zn(l,!1,!1);return r.set(s,o),o};const a=new Proxy({...t.props||{},$$events:{}},{get(s,l){return n(r.get(l)??i(l,Reflect.get(s,l)))},has(s,l){return l===In?!0:(n(r.get(l)??i(l,Reflect.get(s,l))),Reflect.has(s,l))},set(s,l,o){return g(r.get(l)??i(l,o),o),Reflect.set(s,l,o)}});this.#e=(t.hydrate?Ja:bi)(t.component,{target:t.target,anchor:t.anchor,props:a,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&me(),this.#t=a.$$events;for(const s of Object.keys(this.#e))s==="$set"||s==="$destroy"||s==="$on"||Ft(this,s,{get(){return this.#e[s]},set(l){this.#e[s]=l},enumerable:!0});this.#e.$set=s=>{Object.assign(a,s)},this.#e.$destroy=()=>{Za(this.#e)}}$set(t){this.#e.$set(t)}$on(t,r){this.#t[t]=this.#t[t]||[];const i=(...a)=>r.call(this,...a);return this.#t[t].push(i),()=>{this.#t[t]=this.#t[t].filter(a=>a!==i)}}$destroy(){this.#e.$destroy()}}let Di;typeof HTMLElement=="function"&&(Di=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(e,t,r){super(),this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const i=this.$$c.$on(e,t);this.$$l_u.set(t,i)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(i){return a=>{const s=document.createElement("slot");i!=="default"&&(s.name=i),M(a,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},r=us(this);for(const i of this.$$s)i in r&&(i==="default"&&!this.$$d.children?(this.$$d.children=e(i),t.default=!0):t[i]=e(i));for(const i of this.attributes){const a=this.$$g_p(i.name);a in this.$$d||(this.$$d[a]=Or(a,i.value,this.$$p_d,"toProp"))}for(const i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=os({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=Ma(()=>{ja(()=>{this.$$r=!0;for(const i of pr(this.$$c)){if(!this.$$p_d[i]?.reflect)continue;this.$$d[i]=this.$$c[i];const a=Or(i,this.$$d[i],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[i].attribute||i):this.setAttribute(this.$$p_d[i].attribute||i,a)}this.$$r=!1})});for(const i in this.$$l)for(const a of this.$$l[i]){const s=this.$$c.$on(i,a);this.$$l_u.set(a,s)}this.$$l={}}}attributeChangedCallback(e,t,r){this.$$r||(e=this.$$g_p(e),this.$$d[e]=Or(e,r,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return pr(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Or(e,t,r,i){const a=r[e]?.type;if(t=a==="Boolean"&&typeof t!="boolean"?t!=null:t,!i||!r[e])return t;if(i==="toAttribute")switch(a){case"Object":case"Array":return t==null?null:JSON.stringify(t);case"Boolean":return t?"":null;case"Number":return t??null;default:return t}else switch(a){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function us(e){const t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}function cs(e,t,r,i,a,s){let l=class extends Di{constructor(){super(e,r,a),this.$$p_d=t}static get observedAttributes(){return pr(t).map(o=>(t[o].attribute||o).toLowerCase())}};return pr(t).forEach(o=>{Ft(l.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(f){f=Or(o,f,t),this.$$d[o]=f;var c=this.$$c;if(c){var h=bt(c,o)?.get;h?c[o]=f:c.$set({[o]:f})}}})}),i.forEach(o=>{Ft(l.prototype,o,{get(){return this.$$c?.[o]}})}),e.element=l,l}function ds(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vt={},fn,Ii;function vs(){if(Ii)return fn;Ii=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,o=/^\s+|\s+$/g,f=`
3
+ `,c="/",h="*",m="",_="comment",p="declaration";fn=function(v,x){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];x=x||{};var k=1,y=1;function S(b){var T=b.match(t);T&&(k+=T.length);var V=b.lastIndexOf(f);y=~V?b.length-V:y+b.length}function R(){var b={line:k,column:y};return function(T){return T.position=new I(b),ae(),T}}function I(b){this.start=b,this.end={line:k,column:y},this.source=x.source}I.prototype.content=v;function F(b){var T=new Error(x.source+":"+k+":"+y+": "+b);if(T.reason=b,T.filename=x.source,T.line=k,T.column=y,T.source=v,!x.silent)throw T}function $(b){var T=b.exec(v);if(T){var V=T[0];return S(V),v=v.slice(V.length),T}}function ae(){$(r)}function U(b){var T;for(b=b||[];T=W();)T!==!1&&b.push(T);return b}function W(){var b=R();if(!(c!=v.charAt(0)||h!=v.charAt(1))){for(var T=2;m!=v.charAt(T)&&(h!=v.charAt(T)||c!=v.charAt(T+1));)++T;if(T+=2,m===v.charAt(T-1))return F("End of comment missing");var V=v.slice(2,T-2);return y+=2,S(V),v=v.slice(T),y+=2,b({type:_,comment:V})}}function ee(){var b=R(),T=$(i);if(T){if(W(),!$(a))return F("property missing ':'");var V=$(s),te=b({type:p,property:d(T[0].replace(e,m)),value:V?d(V[0].replace(e,m)):m});return $(l),te}}function we(){var b=[];U(b);for(var T;T=ee();)T!==!1&&(b.push(T),U(b));return b}return ae(),we()};function d(v){return v?v.replace(o,m):m}return fn}var Ai;function hs(){if(Ai)return Vt;Ai=1;var e=Vt&&Vt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.default=r;var t=e(vs());function r(i,a){var s=null;if(!i||typeof i!="string")return s;var l=(0,t.default)(i),o=typeof a=="function";return l.forEach(function(f){if(f.type==="declaration"){var c=f.property,h=f.value;o?a(c,h,f):h&&(s=s||{},s[c]=h)}}),s}return Vt}var _s=hs();const Oi=ds(_s);Oi.default;var Rt={},Ni;function ps(){if(Ni)return Rt;Ni=1,Object.defineProperty(Rt,"__esModule",{value:!0}),Rt.LanguageTranslator=void 0,Rt.getChildStyleToPass=e,Rt.addComponent=t;function e(i,a){var s,l,o="";try{if(i&&a?.length&&(!((s=Object.keys(i))===null||s===void 0)&&s.length)&&(!((l=a?.filter(function(_){return Object.keys(i).includes(_.name)}))===null||l===void 0)&&l.length))for(var f=function(_){var p=a?.filter(function(d){return d.name===_&&d.defaultValue!==i[_]});p&&(o+="".concat(_,":").concat(i[_],";"))},c=0,h=Object.keys(i);c<h.length;c++){var m=h[c];f(m)}}catch(_){console.error("error getting child style to pass",_)}finally{return o}}function t(i){var a,s=((a=i?.repoName.split("/"))===null||a===void 0?void 0:a[1])||i?.repoName;if(!s)throw new Error("wrong componentPath "+i?.repoName);if(!i?.version)throw new Error("wrong version "+i?.version);var l=i?.iifePath||"main.iife.js";if(!document.getElementById(s+"-script"))try{var o=document.createElement("script");if(o.id=s+"-script",o.src="https://cdn.jsdelivr.net/npm/".concat(i.repoName,"@").concat(i.version,"/").concat(l),i?.local)o.src="".concat(i.local);else if(location.href.includes("localhost:6006")){var f=s.split("-")[0];o.src="http://localhost:6006/webcomponents/".concat(s.replace(f+"-",""),"/").concat(l)}document.head.appendChild(o)}catch(c){console.warn(c)}}var r=(function(){function i(a){if(this.lang="",!a?.dictionary)throw new Error("no dictionary provided");this.dictionary=a.dictionary,this.setLang(a?.lang)}return i.prototype.setLang=function(a){a||(a=i.getDefaultLang()),this.lang=a},i.prototype.translateWord=function(a,s){return i.getDictionaryWord(a,this.dictionary,s||this.lang)},i.prototype.translateDate=function(a,s,l){return i.formatDate(a,s,l||this.lang)},i.getDefaultLang=function(){var a,s,l,o,f,c="en";return navigator?.languages&&(!((l=(s=(a=navigator.languages[0])===null||a===void 0?void 0:a.split("-")[0])===null||s===void 0?void 0:s.toLowerCase())===null||l===void 0)&&l.length)&&(c=(f=(o=navigator.languages[0])===null||o===void 0?void 0:o.split("-")[0])===null||f===void 0?void 0:f.toLowerCase()),c},i.getDictionaryWord=function(a,s,l){var o;if(!a)throw new Error("no wordKey provided");if(!s)throw new Error("no dictionary provided");if(l&&(!((o=s[l])===null||o===void 0)&&o[a]))return s[l][a];var f="",c=i.getDefaultLang();if(!l||c!==l){var h=s?.[c];h?.[a]&&(f=h[a])}return f},i.formatDate=function(a,s,l){if(!a)throw new Error("no date provided");if(typeof a.getMonth!="function")throw new Error("wrong date format");var o=new Intl.DateTimeFormat(l||i.getDefaultLang(),s);return o.format(a)},i})();return Rt.LanguageTranslator=r,Rt}ps();function Ri(e,t,r,i=a=>a){return e*i(.5-t*(.5-r))}function gs(e){return[-e[0],-e[1]]}function Fe(e,t){return[e[0]+t[0],e[1]+t[1]]}function je(e,t){return[e[0]-t[0],e[1]-t[1]]}function Xe(e,t){return[e[0]*t,e[1]*t]}function ms(e,t){return[e[0]/t,e[1]/t]}function ir(e){return[e[1],-e[0]]}function Ci(e,t){return e[0]*t[0]+e[1]*t[1]}function ws(e,t){return e[0]===t[0]&&e[1]===t[1]}function ys(e){return Math.hypot(e[0],e[1])}function bs(e){return e[0]*e[0]+e[1]*e[1]}function Mi(e,t){return bs(je(e,t))}function Pi(e){return ms(e,ys(e))}function Es(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function ar(e,t,r){let i=Math.sin(r),a=Math.cos(r),s=e[0]-t[0],l=e[1]-t[1],o=s*a-l*i,f=s*i+l*a;return[o+t[0],f+t[1]]}function un(e,t,r){return Fe(e,Xe(je(t,e),r))}function Li(e,t,r){return Fe(e,Xe(t,r))}var{min:Gt,PI:xs}=Math,ki=.275,sr=xs+1e-4;function $s(e,t={}){let{size:r=16,smoothing:i=.5,thinning:a=.5,simulatePressure:s=!0,easing:l=A=>A,start:o={},end:f={},last:c=!1}=t,{cap:h=!0,easing:m=A=>A*(2-A)}=o,{cap:_=!0,easing:p=A=>--A*A*A+1}=f;if(e.length===0||r<=0)return[];let d=e[e.length-1].runningLength,v=o.taper===!1?0:o.taper===!0?Math.max(r,d):o.taper,x=f.taper===!1?0:f.taper===!0?Math.max(r,d):f.taper,k=Math.pow(r*i,2),y=[],S=[],R=e.slice(0,10).reduce((A,w)=>{let O=w.pressure;if(s){let q=Gt(1,w.distance/r),ue=Gt(1,1-q);O=Gt(1,A+(ue-A)*(q*ki))}return(A+O)/2},e[0].pressure),I=Ri(r,a,e[e.length-1].pressure,l),F,$=e[0].vector,ae=e[0].point,U=ae,W=ae,ee=U,we=!1;for(let A=0;A<e.length;A++){let{pressure:w}=e[A],{point:O,vector:q,distance:ue,runningLength:re}=e[A];if(A<e.length-1&&d-re<3)continue;if(a){if(s){let qe=Gt(1,ue/r),at=Gt(1,1-qe);w=Gt(1,R+(at-R)*(qe*ki))}I=Ri(r,a,w,l)}else I=r/2;F===void 0&&(F=I);let Ae=re<v?m(re/v):1,Nr=d-re<x?p((d-re)/x):1;I=Math.max(.01,I*Math.min(Ae,Nr));let lr=(A<e.length-1?e[A+1]:e[A]).vector,gt=A<e.length-1?Ci(q,lr):1,Rr=Ci(q,$)<0&&!we,or=gt!==null&&gt<0;if(Rr||or){let qe=Xe(ir($),I);for(let at=1/13,Ge=0;Ge<=1;Ge+=at)W=ar(je(O,qe),O,sr*Ge),y.push(W),ee=ar(Fe(O,qe),O,sr*-Ge),S.push(ee);ae=W,U=ee,or&&(we=!0);continue}if(we=!1,A===e.length-1){let qe=Xe(ir(q),I);y.push(je(O,qe)),S.push(Fe(O,qe));continue}let fr=Xe(ir(un(lr,q,gt)),I);W=je(O,fr),(A<=1||Mi(ae,W)>k)&&(y.push(W),ae=W),ee=Fe(O,fr),(A<=1||Mi(U,ee)>k)&&(S.push(ee),U=ee),R=w,$=q}let b=e[0].point.slice(0,2),T=e.length>1?e[e.length-1].point.slice(0,2):Fe(e[0].point,[1,1]),V=[],te=[];if(e.length===1){if(!(v||x)||c){let A=Li(b,Pi(ir(je(b,T))),-(F||I)),w=[];for(let O=1/13,q=O;q<=1;q+=O)w.push(ar(A,b,sr*2*q));return w}}else{if(!(v||x&&e.length===1))if(h)for(let w=1/13,O=w;O<=1;O+=w){let q=ar(S[0],b,sr*O);V.push(q)}else{let w=je(y[0],S[0]),O=Xe(w,.5),q=Xe(w,.51);V.push(je(b,O),je(b,q),Fe(b,q),Fe(b,O))}let A=ir(gs(e[e.length-1].vector));if(x||v&&e.length===1)te.push(T);else if(_){let w=Li(T,A,I);for(let O=1/29,q=O;q<1;q+=O)te.push(ar(w,T,sr*3*q))}else te.push(Fe(T,Xe(A,I)),Fe(T,Xe(A,I*.99)),je(T,Xe(A,I*.99)),je(T,Xe(A,I)))}return y.concat(te,S.reverse(),V)}function Ss(e,t={}){var r;let{streamline:i=.5,size:a=16,last:s=!1}=t;if(e.length===0)return[];let l=.15+(1-i)*.85,o=Array.isArray(e[0])?e:e.map(({x:p,y:d,pressure:v=.5})=>[p,d,v]);if(o.length===2){let p=o[1];o=o.slice(0,-1);for(let d=1;d<5;d++)o.push(un(o[0],p,d/4))}o.length===1&&(o=[...o,[...Fe(o[0],[1,1]),...o[0].slice(2)]]);let f=[{point:[o[0][0],o[0][1]],pressure:o[0][2]>=0?o[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],c=!1,h=0,m=f[0],_=o.length-1;for(let p=1;p<o.length;p++){let d=s&&p===_?o[p].slice(0,2):un(m.point,o[p],l);if(ws(m.point,d))continue;let v=Es(d,m.point);if(h+=v,p<_&&!c){if(h<a)continue;c=!0}m={point:d,pressure:o[p][2]>=0?o[p][2]:.5,vector:Pi(je(m.point,d)),distance:v,runningLength:h},f.push(m)}return f[0].vector=((r=f[1])==null?void 0:r.vector)||[0,0],f}function ji(e,t={}){return $s(Ss(e,t),t)}function Ts(e,t,r,i,a,s,l,o,f,c,h,m,_,p,d,v,x,k,y,S,R,I,F,$,ae,U,W,ee,we){if(g(t,e.pointerType,!0),g(r,e.buttons+" "+[e.pageX-n(i).left,e.pageY-n(i).top,e.pressure].toString()),a()==="draw"&&n(s)==="drawing"&&e.buttons===1&&!(e.pointerType==="pen"&&e.pressure===0))n(l)[n(o)].path=[...n(l)[n(o)].path||[],[e.pageX-n(i).left,e.pageY-n(i).top,e.pressure]],n(l)[n(o)].pathData=n(f),e.pageX-n(i).left<n(c)&&g(c,e.pageX-n(i).left),e.pageY-n(i).top<n(h)&&g(h,e.pageY-n(i).top),e.pageX-n(i).left>n(m)&&g(m,e.pageX-n(i).left),e.pageY-n(i).top>n(_)&&g(_,e.pageY-n(i).top),n(l)[n(o)].min=[n(c),n(h)],n(l)[n(o)].max=[n(m),n(_)];else if(n(s)==="erasing"&&(a()==="eraser"||a()==="draw"&&(e.pointerType==="pen"&&e.pressure===0&&e.buttons===1||e.buttons===32)))console.log("eraser move"),p(e);else if(a()==="select"&&n(s)==="selecting")g(d,e.pageX-n(i).left),g(v,e.pageY-n(i).top);else if(a()==="select"&&!n(x)){const b=e.pageX-n(i).left,T=e.pageY-n(i).top,V=b>n(k)&&b<n(d)&&T>n(y)&&T<n(v);V&&!n(S)?(g(S,!0),console.log("on select",n(S))):!V&&n(S)&&(g(S,!1),console.log("off select",n(S)))}else if(n(x)&&n(l)[n(o)].type==="multiplestroke"&&n(R)&&n(R).toString()===n(l)[n(o)].id){const b=[...n(l)],T=e.pageX-n(i).left,V=e.pageY-n(i).top,te=T-(n(I)||0),A=V-(n(F)||0);console.info("move selected strokes on multistrokes",n(I),n(F),te,A),b[n(o)]?.multipath?.forEach(w=>{let O;for(const ue of n(l).filter(re=>re.type==="multiplestroke").filter(re=>re.id!==n(l)[n(o)].id).sort((re,Ae)=>Ae.actionIndex-re.actionIndex)){const re=ue?.multipath?.find(Ae=>Ae.id===w.id);if(re){O=re;break}}O||(O=n(l).find(ue=>ue.id===w.id)),w.path?.forEach((ue,re)=>{re===0&&console.log("debug path ",ue[0],O?.path?.[re][0],n(l)),O?.path&&(ue[0]=O.path[re][0]+te),O?.path&&(ue[1]=O.path[re][1]+A)}),O?.max&&(w.max=[O.max[0]+te,O.max[1]+A]),O?.min&&(w.min=[O.min[0]+te,O.min[1]+A]);const q=ji(w.path||[],Object.assign({simulatePressure:n(t)!=="pen"},$()));w.pathData=ae(q)}),g(k,(n(U)||0)+te),g(y,(n(W)||0)+A),g(d,(n(ee)||0)+te),g(v,(n(we)||0)+A),g(l,[...b],!0)}}var Ds=_e('<path stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"></path>'),Is=_e('<image stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"></image>'),As=_e('<text stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"> </text>'),Os=_e('<path class="svelte-ofif3l"></path>'),Ns=_e('<image class="svelte-ofif3l"></image>'),Rs=_e('<text class="svelte-ofif3l"> </text>'),Cs=_e('<path stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"></path>'),Ms=_e('<image stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"></image>'),Ps=_e('<text stroke-linecap="round" stroke="red" stroke-width="2" class="svelte-ofif3l"> </text>'),Ls=_e('<path class="svelte-ofif3l"></path>'),ks=_e('<image class="svelte-ofif3l"></image>'),js=_e('<text class="svelte-ofif3l"> </text>'),Ys=_e('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),Fs=_e('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),Xs=_e('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),qs=_e('<rect id="selector" fill="none" stroke="red" stroke-width="1"></rect>'),Hs=_e("<g><!><!></g>"),Ws=Ba('<div id="debug" class="svelte-ofif3l"> </div> <div id="container"><svg class="svelte-ofif3l"><!></svg></div>',1);const zs={hash:"svelte-ofif3l",code:'@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");:host {font-family:"Roboto", sans-serif;}#debug.svelte-ofif3l {position:absolute;width:100%;height:30px;top:0px;z-index:10;}svg.svelte-ofif3l {position:absolute;top:0;left:0;width:100%;height:100%;touch-action:none;}'};function Yi(e,t){Cn(t,!0),ts(e,zs);function r(u,D){t.$$host.dispatchEvent(new CustomEvent(u,{detail:D}))}const i={size:6,thinning:.7,smoothing:.5,streamline:.5},a={paperSize:"A4"},s={zoom:{type:"fit",value:1},pan:{x:0,y:0},lockPan:!1,lockZoom:!1};let l=Ee(t,"id",7,""),o=Ee(t,"load_draw",7),f=Ee(t,"draw_id",23,()=>Math.random().toString(36)+Math.random().toString(36)+Date.now().toString()),c=Ee(t,"background_color",7,"rgb(255,255,255)"),h=Ee(t,"pen_color",7,"rgb(0,0,0)"),m=Ee(t,"insert_image",7,void 0),_=Ee(t,"insert_text",7),p=Ee(t,"pen_opacity",7,1),d=Ee(t,"options",7,i),v=Ee(t,"goto",7,void 0),x=Ee(t,"mode",7,"draw"),k=Ee(t,"debug",7,"no"),y=Ee(t,"save_as",7,void 0),S=Ee(t,"size",23,()=>Object.assign({},a)),R=Ee(t,"view",23,()=>Object.assign({},s)),I,F,$=C(0),ae=C(!1),U=C(0),W=C(void 0),ee=C(void 0),we=C(""),b=C(rt({})),T=C(0),V=C(void 0),te=C(void 0),A=C(void 0),w=C(rt([])),O=C(!1),q=C("idle"),ue=C(void 0),re=C(void 0),Ae=C(void 0),Nr=C(void 0),lr=C(void 0),gt=C(!1),Rr=C(void 0),or=C(void 0),fr=C(void 0),qe=C(void 0),at=C(0),Ge=C(0),ur=C(0),cr=C(0),se=C(0),le=C(0),oe=C(0),fe=C(0);rt({});function Fi(u){if(!u.length)return"";const D=u.reduce((P,[ne,B],J,E)=>{const[ie,X]=E[(J+1)%E.length];return P.push(ne,B,(ne+ie)/2,(B+X)/2),P},["M",...u[0],"Q"]);return D.push("Z"),D.join(" ")}function Bs(u){if(u)switch(u.type){case"json":const D=[];for(const P of n(w))if(P.visible){if(P.type==="stroke")P.actionIndex=0,D.push(P);else if(P.type==="multiplestroke")for(const ne of P.multipath?.filter(B=>B.visible)||[])ne.actionIndex=0,D.push(ne)}return Vs({type:"json",draw:D,id:l(),draw_id:f(),name:u.name,version:n(U)+1,size:S()||a});default:return console.error("unknown save type")}}function Us(u){r("drawLoaded",u)}function Vs(u){r("save",u)}function dr(u){r("historyIndex",u)}function Gs(u){r("changeIndex",u)}function Js(u){r("selection",u)}function Xi(u){r("startStroke",u)}function Zs(u){r("endStroke",u)}function Ks(u){r("imageLoaded",u)}function Qs(u){r("txtLoaded",u)}function el(){if(!n(W))return console.error("no svg dom found");if(!n(ee))return console.error("no svg container found");switch(g(b,n(W).getBoundingClientRect(),!0),I||(I={}),I.containerWidth=n(ee).clientWidth,I.containerHeight=n(ee).clientHeight,I.drawWidth=n(W).clientWidth,I.drawHeight=n(W).clientHeight,S()?.paperSize){case"A3":I.paperWidth=297,I.paperHeight=420;break;case"A4":default:I.paperWidth=210,I.paperHeight=297;break}}function tl(){if(console.log("svgDom",n(W)),n(b)||el(),o()&&typeof o()=="object"&&(!n(U)||n(U)<o().version||f()!==o().draw_id)&&(console.log("load_draw",o()),g(w,o().draw,!0),g($,n(w).length,!0),f(o().draw_id),g(U,o().version,!0),o(void 0),F=n(w).length,dr({index:n($),draw_id:f(),id:l(),start_index:F}),Us({index:n($),draw_id:f(),id:l(),start_index:F})),n(w)?.length&&y()&&(console.log("save_as",y()),Bs(y())),n(w)||(console.log("draw is empty"),g(w,[],!0)),x()&&x()!=="select"&&n(ue)){g(ue,0);const u=[...n(w)];u.forEach(D=>{D.selected=!1,D.type==="multiplestroke"&&D.multipath?.forEach(P=>{P.selected=!1})}),g(w,[...u],!0)}if(x()!=="select"&&(g(oe,0),g(fe,0),g(se,0),g(le,0)),typeof v()=="string"&&v(Number(v())),n(w).length||(g($,0),v(void 0)),n($)||g($,0),v()&&v()<0?g($,-1):(v()||v()===0)&&(F&&v()>F?v(F):v()>n(w).length&&v(n(w).length),g($,v()+0),v(void 0),Gs({index:n($),draw_id:f(),id:l(),start_index:F})),n($)<0?(g($,0),g(O,!0)):n($)>=0&&g(O,!1),m()){console.info("inserting object");let u=!1;switch(m().type){case"jpg":case"jpeg":case"png":rl(m()),u=!0;break;case"svg":nl(m()),u=!0;break;default:console.error("unknown insert_object type",m().type),u=!1}u&&Ks({ok:!0,draw_id:f(),id:l()})}_()&&(console.log("insert_text",_()),il(_()),Qs({ok:!0,draw_id:f(),id:l()})),g(re,ji(n(w)[n($)]?.path||[],Object.assign({simulatePressure:n(we)!=="pen"},d())),!0),g(Ae,Fi(n(re)),!0),console.log("set index to",n($),"from goto",v(),"historyActions",n(w).length)}ti(()=>{console.log("recompute");let u=!1;if(typeof S()=="string")try{S(JSON.parse(S())),u=!0}catch(D){console.error("error parsing size json",D)}if(typeof R()=="string")try{R(JSON.parse(R())),u=!0}catch(D){console.error("error parsing view json",D)}if(typeof o()=="string"&&o()?.length)try{o(JSON.parse(o())),u=!0}catch(D){console.error("error parsing json",D)}else o()||o(void 0);if(typeof y()=="string"&&y()?.length)try{y(JSON.parse(y())),u=!0}catch(D){console.error("error parsing json",D)}if(k()!=="yes"&&k("no"),typeof p()=="string"&&p(Number(p())),typeof d()=="string"&&d()?.length)try{d(JSON.parse(d())),d()&&!d().size&&(d().size=i.size),d()&&!d().thinning&&(d().thinning=i.thinning),d()&&!d().smoothing&&(d().smoothing=i.smoothing),d()&&!d().streamline&&(d().streamline=i.streamline),u=!0}catch(D){console.error("error parsing json",D)}if(typeof m()=="string")try{m(JSON.parse(m())),u=!0}catch(D){console.error("error parsing insert_object json",D)}n(W)&&u&&tl()});function rl(u){const D=[...n(w)],P={id:Date.now().toString(),type:"image",actionIndex:n($),visible:!0,pathData:u?.base64};D.push(P),g(w,[...D],!0),tr($)}function nl(u){console.info(`inserting SVG ${u?.type}`)}function il(u){console.info(`inserting Text ${u?.content}`)}function cn(u){const D=u.target?.id?.split("_")?.[1];if(D){let P=[...n(w)],ne=P.find(B=>B.id===D&&B.visible);if(!ne)for(const B of P.filter(J=>J.type==="multiplestroke").sort((J,E)=>E.actionIndex-J.actionIndex)){const J=B?.multipath?.find(E=>E.id===D&&E.visible);if(J){ne=J;break}}ne&&(ne.visible=!1,ne.erasedAtIndex=n($),console.info("erase stroke",ne.id),P[P.length-1].type!=="eraser"?(P=P.slice(0,n($)+1),P.push({type:"eraser",visible:!0,id:Math.random().toString(36)+Math.random().toString(36)+Date.now().toString(),actionIndex:n(w).length}),P.forEach((B,J)=>{!B.visible&&B.erasedAtIndex&&B.erasedAtIndex>n($)&&(B.visible=!0,B.erasedAtIndex=void 0)}),g(w,[...P],!0),tr($),dr({index:n($),draw_id:f(),id:l(),start_index:F})):g(w,[...P],!0))}}function al(u){if(console.log("handlePointerDown"),g(we,u.pointerType,!0),g(T,u.buttons,!0),x()==="draw"&&u.buttons===1&&!(u.pointerType==="pen"&&u.pressure===0)){if(g(q,"drawing"),n($)!==n(w).length-1){const D=[...n(w)];D.forEach((P,ne)=>{!P.visible&&P.erasedAtIndex&&P.erasedAtIndex>n($)&&(P.visible=!0,P.erasedAtIndex=void 0)}),g(w,D,!0)}if(n(w)?.length&&n($)<n(w).length)if(n(O))g(w,[],!0),g(O,!1);else{tr($);const D=[...n(w)];g(w,D.slice(0,n($)),!0)}dr({index:n($),draw_id:f(),id:l(),start_index:F}),console.log("setup stroke"),g(A,new Date,!0),g(te,Date.now().toString(),!0),g(at,u.pageX-n(b).left),g(Ge,u.pageY-n(b).top),g(ur,u.pageX-n(b).left),g(cr,u.pageY-n(b).top),n(V)||(g(V,n(A),!0),Xi({start:n(V),id:l(),draw_id:f(),stroke_id:n(te),index:n($)})),u.target.setPointerCapture(u.pointerId),n(w)?.length?(console.info("pushing draw"),g(w,[...n(w),{path:[[u.pageX-n(b).left,u.pageY-n(b).top,u.pressure]],color:h(),id:n(te),pathData:n(Ae),min:[n(at),n(Ge)],max:[n(ur),n(cr)],visible:!0,actionIndex:n(w).length,opacity:p(),type:"stroke"}],!0)):g(w,[{path:[[u.pageX-n(b).left,u.pageY-n(b).top,u.pressure]],color:h(),id:n(te),pathData:n(Ae),min:[n(at),n(Ge)],max:[n(ur),n(cr)],visible:!0,actionIndex:n(w).length,opacity:p(),type:"stroke"}],!0),Xi({start:n(A),stroke_id:n(te),index:n($),id:l(),draw_id:f()})}else if(x()==="eraser"||x()==="draw"&&(u.pointerType==="pen"&&u.pressure===0&&u.buttons===1||u.buttons===32))u.target.setPointerCapture(u.pointerId),g(q,"erasing"),console.log("eraser down"),cn(u);else if(x()==="select"&&n(w).length){let D=!1;const P=u.pageX-n(b).left,ne=u.pageY-n(b).top;if(D=P>n(se)&&P<n(oe)&&ne>n(le)&&ne<n(fe),g(se,u.pageX-n(b).left),g(le,u.pageY-n(b).top),g(oe,u.pageX-n(b).left),g(fe,u.pageY-n(b).top),!n(gt)&&!n(ue)&&D){g(q,"idle"),g(ue,Date.now(),!0),console.info("set move mode");const B=[...n(w)];g(Nr,u.pageX-n(b).left),g(lr,u.pageY-n(b).top),B.filter(ie=>ie.selected).forEach(ie=>{ie.visible=!1,ie.erasedAtIndex=n($)}),B.filter(ie=>ie.type==="multiplestroke").forEach(ie=>{ie.multipath?.filter(X=>X.selected).forEach(X=>{X.visible=!1,X.erasedAtIndex=n($)})});const J=[];for(const ie of B.filter(X=>X.type==="multiplestroke"))for(const X of ie.multipath?.filter(H=>H.selected)||[])J.push(JSON.parse(JSON.stringify(X))),X.visible=!1;const E=JSON.parse(JSON.stringify(n(w).filter(ie=>ie.selected))).concat(J);E.forEach(ie=>{ie.visible=!0}),B.push({multipath:E,id:n(ue).toString(),type:"multiplestroke",actionIndex:n($),visible:!0,min:[n(se),n(le)],max:[n(oe),n(fe)]}),n(w)[n(w).length-1].type==="multiplestroke"&&tr($),g(w,[...B],!0),dr({index:n($),draw_id:f(),id:l(),start_index:F}),g(gt,!0),g(Rr,n(se),!0),g(or,n(le),!0),g(fr,n(oe),!0),g(qe,n(fe),!0)}else g(q,"selecting"),g(ue,0)}}function sl(u){if(g(T,u.buttons,!0),g(gt,!1),x()==="draw"&&n(q)==="drawing"){const D=new Date;if(!n(te)||!n(A)||!n(Ae))return console.error("no stroke id",n(te),n(A),n(Ae));Zs({end:D,stroke_id:n(te),start:n(A),min:[n(at),n(Ge)],max:[n(ur),n(cr)],pathData:n(Ae),pen_color:h(),index:n($),id:l(),draw_id:f()}),tr($),dr({index:n($),draw_id:f(),id:l(),start_index:F})}else if(x()==="eraser"||x()==="draw"&&n(q)!=="drawing"&&(u.pointerType==="pen"&&u.pressure===0&&u.buttons===1||u.buttons===32))console.log("eraser up"),cn(u);else if(x()==="select"){const D=[...n(w)];D.forEach(X=>{X.selected=!1,X.type==="multiplestroke"&&X.multipath?.forEach(H=>{H.selected=!1})}),g(w,[...D],!0),g(ue,0);const P=n(se)<n(oe)?n(se):n(oe),ne=n(le)<n(fe)?n(le):n(fe),B=n(se)>n(oe)?n(se):n(oe),J=n(le)>n(fe)?n(le):n(fe),E=D.filter(X=>!!(X.visible&&X.type==="stroke"&&X.min&&X.max&&X.min[0]>P&&X.min[1]>ne&&X.max[0]<B&&X.max[1]<J));let ie=!1;for(const X of D.filter(H=>H.type==="multiplestroke"))for(const H of X.multipath||[])H.visible&&H.type==="stroke"&&H.min&&H.max&&H.min[0]>P&&H.min[1]>ne&&H.max[0]<B&&H.max[1]<J&&(ie=!0);if(E.length>0||ie){for(const X of D.filter(H=>H.type==="multiplestroke"))for(const H of X?.multipath||[])H.visible&&H.min&&H.max&&H.min[0]>P&&H.min[1]>ne&&H.max[0]<B&&H.max[1]<J&&(H.selected=!0);for(const X of E)X.selected=!0;g(w,[...D],!0),console.log(E),Js({minX:n(se),minY:n(le),maxX:n(oe),maxY:n(fe),strokes:E,id:l(),draw_id:f()})}else g(se,0),g(le,0),g(oe,0),g(fe,0)}g(q,"idle"),u?.pointerId&&u.target?.releasePointerCapture?.(u.pointerId)}Ka(()=>{g(W,t.$$host?.shadowRoot?.querySelector("svg"),!0),g(ee,t.$$host?.shadowRoot?.querySelector("#container"),!0);let u=0;const D=setInterval(()=>{g(W,t.$$host?.shadowRoot?.querySelector("svg"),!0),n(W)?clearInterval(D):(u++,u>10?(clearInterval(D),console.warn("no canvas found on check "+u)):console.error("no canvas found on check "+u+" end"))},100);if(!n(W))return console.error("no canvas found on mount")});var ll={get id(){return l()},set id(u=""){l(u),me()},get load_draw(){return o()},set load_draw(u){o(u),me()},get draw_id(){return f()},set draw_id(u=Math.random().toString(36)+Math.random().toString(36)+Date.now().toString()){f(u),me()},get background_color(){return c()},set background_color(u="rgb(255,255,255)"){c(u),me()},get pen_color(){return h()},set pen_color(u="rgb(0,0,0)"){h(u),me()},get insert_image(){return m()},set insert_image(u=void 0){m(u),me()},get insert_text(){return _()},set insert_text(u){_(u),me()},get pen_opacity(){return p()},set pen_opacity(u=1){p(u),me()},get options(){return d()},set options(u=i){d(u),me()},get goto(){return v()},set goto(u=void 0){v(u),me()},get mode(){return x()},set mode(u="draw"){x(u),me()},get debug(){return k()},set debug(u="no"){k(u),me()},get save_as(){return y()},set save_as(u=void 0){y(u),me()},get size(){return S()},set size(u=Object.assign({},a)){S(u),me()},get view(){return R()},set view(u=Object.assign({},s)){R(u),me()}},qi=Ws(),Cr=Z(qi),ol=ht(Cr);ct(Cr);var Hi=Zn(Cr,2),Jt=ht(Hi);Jt.__pointerdown=al,Jt.__pointermove=[Ts,we,T,b,x,q,w,$,Ae,at,Ge,ur,cr,cn,oe,fe,gt,se,le,ae,ue,Nr,lr,d,Fi,Rr,or,fr,qe],Jt.__pointerup=sl;var fl=ht(Jt);{var ul=u=>{var D=Hs(),P=ht(D);xi(P,17,()=>n(w),J=>J.id,(J,E,ie,X)=>{var H=Q(),mt=Z(H);{var Je=vr=>{var Mr=Q(),dn=Z(Mr);{var wt=yt=>{var Ct=Q(),hr=Z(Ct);{var Ke=st=>{var Mt=Q(),Pt=Z(Mt);{var j=xe=>{var ce=Ds();he(()=>{N(ce,"id","path_"+n(E).id),N(ce,"d",n(E).pathData),N(ce,"fill",n(E).color),N(ce,"fill-opacity",n(E).opacity)}),M(xe,ce)},Zt=xe=>{var ce=Q(),Lt=Z(ce);{var Kt=$e=>{var Se=Is();he(()=>{N(Se,"id","path_"+n(E).id),N(Se,"href",n(E).pathData)}),M($e,Se)},_r=$e=>{var Se=Q(),Qe=Z(Se);{var lt=He=>{var Oe=As(),kt=ht(Oe,!0);ct(Oe),he(()=>{N(Oe,"id","path_"+n(E).id),nr(kt,n(E).pathData)}),M(He,Oe)};K(Qe,He=>{n(E).type==="text"&&He(lt)},!0)}M($e,Se)};K(Lt,$e=>{n(E).type==="image"?$e(Kt):$e(_r,!1)},!0)}M(xe,ce)};K(Pt,xe=>{n(E).type==="stroke"?xe(j):xe(Zt,!1)})}M(st,Mt)},pe=st=>{var Mt=Q(),Pt=Z(Mt);{var j=xe=>{var ce=Os();he(()=>{N(ce,"id","path_"+n(E).id),N(ce,"d",n(E).pathData),N(ce,"fill",n(E).color),N(ce,"fill-opacity",n(E).opacity)}),M(xe,ce)},Zt=xe=>{var ce=Q(),Lt=Z(ce);{var Kt=$e=>{var Se=Ns();he(()=>{N(Se,"id","path_"+n(E).id),N(Se,"href",n(E).pathData)}),M($e,Se)},_r=$e=>{var Se=Q(),Qe=Z(Se);{var lt=He=>{var Oe=Rs(),kt=ht(Oe,!0);ct(Oe),he(()=>{N(Oe,"id","path_"+n(E).id),nr(kt,n(E).pathData)}),M(He,Oe)};K(Qe,He=>{!n(E).selected&&n(E).type==="text"&&He(lt)},!0)}M($e,Se)};K(Lt,$e=>{!n(E).selected&&n(E).type==="image"?$e(Kt):$e(_r,!1)},!0)}M(xe,ce)};K(Pt,xe=>{!n(E).selected&&n(E).type==="stroke"?xe(j):xe(Zt,!1)},!0)}M(st,Mt)};K(hr,st=>{n(E).selected?st(Ke):st(pe,!1)})}M(yt,Ct)},Ze=yt=>{var Ct=Q(),hr=Z(Ct);{var Ke=pe=>{var st=Q(),Mt=Z(st);xi(Mt,17,()=>n(E).multipath,Pt=>Pt.id+n(E).id,(Pt,j)=>{var Zt=Q(),xe=Z(Zt);{var ce=Lt=>{var Kt=Q(),_r=Z(Kt);{var $e=Qe=>{var lt=Q(),He=Z(lt);{var Oe=Ne=>{var ge=Cs();he(()=>{N(ge,"id","path_"+n(j).id+"_"+n(E).id),N(ge,"d",n(j).pathData),N(ge,"fill",n(j).color),N(ge,"fill-opacity",n(j).opacity)}),M(Ne,ge)},kt=Ne=>{var ge=Q(),vn=Z(ge);{var hn=Re=>{var Ce=Ms();he(()=>{N(Ce,"id","path_"+n(j).id+"_"+n(E).id),N(Ce,"href",n(j).pathData)}),M(Re,Ce)},_n=Re=>{var Ce=Q(),pn=Z(Ce);{var gn=jt=>{var ot=Ps(),mn=ht(ot,!0);ct(ot),he(()=>{N(ot,"id","path_"+n(j).id+"_"+n(E).id),nr(mn,n(j).pathData)}),M(jt,ot)};K(pn,jt=>{n(j).type==="text"&&jt(gn)},!0)}M(Re,Ce)};K(vn,Re=>{n(j).type==="image"?Re(hn):Re(_n,!1)},!0)}M(Ne,ge)};K(He,Ne=>{n(j).type==="stroke"?Ne(Oe):Ne(kt,!1)})}M(Qe,lt)},Se=Qe=>{var lt=Q(),He=Z(lt);{var Oe=Ne=>{var ge=Ls();he(()=>{N(ge,"id","path_"+n(j).id+"_"+n(E).id),N(ge,"d",n(j).pathData),N(ge,"fill",n(j).color),N(ge,"fill-opacity",n(j).opacity)}),M(Ne,ge)},kt=Ne=>{var ge=Q(),vn=Z(ge);{var hn=Re=>{var Ce=ks();he(()=>{N(Ce,"id","path_"+n(j).id+"_"+n(E).id),N(Ce,"href",n(j).pathData)}),M(Re,Ce)},_n=Re=>{var Ce=Q(),pn=Z(Ce);{var gn=jt=>{var ot=js(),mn=ht(ot,!0);ct(ot),he(()=>{N(ot,"id","path_"+n(j).id+"_"+n(E).id),nr(mn,n(j).pathData)}),M(jt,ot)};K(pn,jt=>{!n(j).selected&&n(j).type==="text"&&jt(gn)},!0)}M(Re,Ce)};K(vn,Re=>{!n(j).selected&&n(j).type==="image"?Re(hn):Re(_n,!1)},!0)}M(Ne,ge)};K(He,Ne=>{!n(j).selected&&n(j).type==="stroke"?Ne(Oe):Ne(kt,!1)},!0)}M(Qe,lt)};K(_r,Qe=>{n(j).selected?Qe($e):Qe(Se,!1)})}M(Lt,Kt)};K(xe,Lt=>{n(j).actionIndex<=n($)&&!n(O)&&(n(j).visible||n(j).erasedAtIndex&&n(j).erasedAtIndex>n($))&&Lt(ce)})}M(Pt,Zt)}),M(pe,st)};K(hr,pe=>{n(E).type==="multiplestroke"&&n(E).multipath&&pe(Ke)},!0)}M(yt,Ct)};K(dn,yt=>{n(E).type==="stroke"||n(E).type==="image"||n(E).type==="text"?yt(wt):yt(Ze,!1)})}M(vr,Mr)};K(mt,vr=>{n(E).actionIndex<=n($)&&!n(O)&&(n(E).visible||n(E).erasedAtIndex&&n(E).erasedAtIndex>n($))&&vr(Je)})}M(J,H)});var ne=Zn(P);{var B=J=>{var E=Q(),ie=Z(E);{var X=mt=>{var Je=Ys();he(()=>{N(Je,"x",n(se)),N(Je,"y",n(le)),N(Je,"width",n(oe)-n(se)),N(Je,"height",n(fe)-n(le))}),M(mt,Je)},H=mt=>{var Je=Q(),vr=Z(Je);{var Mr=wt=>{var Ze=Fs();he(()=>{N(Ze,"x",n(oe)),N(Ze,"y",n(le)),N(Ze,"width",n(se)-n(oe)),N(Ze,"height",n(fe)-n(le))}),M(wt,Ze)},dn=wt=>{var Ze=Q(),yt=Z(Ze);{var Ct=Ke=>{var pe=Xs();he(()=>{N(pe,"x",n(se)),N(pe,"y",n(fe)),N(pe,"width",n(oe)-n(se)),N(pe,"height",n(le)-n(fe))}),M(Ke,pe)},hr=Ke=>{var pe=qs();he(()=>{N(pe,"x",n(oe)),N(pe,"y",n(fe)),N(pe,"width",n(se)-n(oe)),N(pe,"height",n(le)-n(fe))}),M(Ke,pe)};K(yt,Ke=>{n(se)<n(oe)&&n(le)>n(fe)?Ke(Ct):Ke(hr,!1)},!0)}M(wt,Ze)};K(vr,wt=>{n(se)>n(oe)&&n(le)<n(fe)?wt(Mr):wt(dn,!1)},!0)}M(mt,Je)};K(ie,mt=>{n(se)<=n(oe)&&n(le)<=n(fe)?mt(X):mt(H,!1)})}M(J,E)};K(ne,J=>{x()==="select"&&J(B)})}ct(D),M(u,D)};K(fl,u=>{n(W)&&u(ul)})}return ct(Jt),ct(Hi),he(()=>{Si(Cr,`display:${k()==="yes"?"block":"none"}`),nr(ol,`${n(we)??""} b: ${n(T)??""}`),Si(Jt,`background-color:${c()??""};cursor:${n(ae)===!0?"move":"default"}`)}),M(e,qi),Mn(ll)}za(["pointerdown","pointermove","pointerup"]),customElements.define("hb-stylus-paper",cs(Yi,{id:{},load_draw:{},draw_id:{},background_color:{},pen_color:{},insert_image:{},insert_text:{},pen_opacity:{},options:{},goto:{},mode:{},debug:{},save_as:{},size:{},view:{}},[],[],!0)),wn.Component=Yi,Object.defineProperty(wn,Symbol.toStringTag,{value:"Module"})})(this["stylus-paper"]=this["stylus-paper"]||{});
4
4
  //# sourceMappingURL=main.iife.js.map