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