@htmlbricks/hb-stylus-paper 0.61.50 → 0.61.52

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