@htmlbricks/hb-stylus-paper 0.65.22 → 0.66.0

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