@htmlbricks/hb-stylus-notebook 0.50.0 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/main.iife.js CHANGED
@@ -1,3 +1,4 @@
1
- var ai=Object.defineProperty;var xr=E=>{throw TypeError(E)};var oi=(E,N,T)=>N in E?ai(E,N,{enumerable:!0,configurable:!0,writable:!0,value:T}):E[N]=T;var G=(E,N,T)=>oi(E,typeof N!="symbol"?N+"":N,T),Sr=(E,N,T)=>N.has(E)||xr("Cannot "+T);var L=(E,N,T)=>(Sr(E,N,"read from private field"),T?T.call(E):N.get(E)),Tt=(E,N,T)=>N.has(E)?xr("Cannot add the same private member more than once"):N instanceof WeakSet?N.add(E):N.set(E,T),Ot=(E,N,T,Pe)=>(Sr(E,N,"write to private field"),Pe?Pe.call(E,T):N.set(E,T),T);(function(E){"use strict";var le,B;const N="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(N);const T=2,Pe="[",kr="]",Ne={},j=Symbol(),it=!1,U=2,xt=4,Ie=8,lt=16,ae=32,ve=64,Le=128,V=256,je=512,D=1024,oe=2048,he=4096,De=8192,Fe=16384,Rr=32768,Ar=65536,Cr=1<<19,St=1<<20,st=Symbol("$state"),Pr=Symbol("legacy props"),Ir=Symbol("");var kt=Array.isArray,Lr=Array.prototype.indexOf,jr=Array.from,Me=Object.keys,qe=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Dr=Object.getOwnPropertyDescriptors,Fr=Object.prototype,Mr=Array.prototype,Rt=Object.getPrototypeOf;function qr(e){for(var t=0;t<e.length;t++)e[t]()}let Ve=!1,at=[];function At(){Ve=!1;const e=at.slice();at=[],qr(e)}function Ct(e){Ve||(Ve=!0,queueMicrotask(At)),at.push(e)}function Vr(){Ve&&At()}function Pt(e){return e===this.v}function Yr(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Br(e){return!Yr(e,this.v)}function Hr(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ur(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Jr(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Gr(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Wr(){throw new Error("https://svelte.dev/e/hydration_failed")}function Xr(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Kr(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function zr(){throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function Zr(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let Qr=!1;function W(e,t){var r={f:0,v:e,reactions:null,equals:Pt,rv:0,wv:0};return r}function Y(e){return en(W(e))}function It(e,t=!1){const r=W(e);return t||(r.equals=Br),r}function en(e){return y!==null&&!X&&y.f&U&&(Z===null?un([e]):Z.push(e)),e}function b(e,t){return y!==null&&!X&&fr()&&y.f&(U|lt)&&(Z===null||!Z.includes(e))&&Zr(),tn(e,t)}function tn(e,t){return e.equals(t)||(e.v,e.v=t,e.wv=zt(),Lt(e,oe),w!==null&&w.f&D&&!(w.f&(ae|ve))&&(ne===null?fn([e]):ne.push(e))),t}function rn(e,t=1){var r=_(e),i=t===1?r++:r--;return b(e,r),i}function Lt(e,t){var r=e.reactions;if(r!==null)for(var i=r.length,n=0;n<i;n++){var l=r[n],s=l.f;s&oe||(ie(l,t),s&(D|V)&&(s&U?Lt(l,he):_t(l)))}}function jt(e){var t=U|oe,r=y!==null&&y.f&U?y:null;return w===null||r!==null&&r.f&V?t|=V:w.f|=St,{ctx:q,deps:null,effects:null,equals:Pt,f:t,fn:e,reactions:null,rv:0,v:null,wv:0,parent:r??w}}function Dt(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)fe(t[r])}}function nn(e){for(var t=e.parent;t!==null;){if(!(t.f&U))return t;t=t.parent}return null}function ln(e){var t,r=w;z(nn(e));try{Dt(e),t=Qt(e)}finally{z(r)}return t}function Ft(e){var t=ln(e),r=(ue||e.f&V)&&e.deps!==null?he:D;ie(e,r),e.equals(t)||(e.v=t,e.wv=zt())}function ot(e){console.warn("https://svelte.dev/e/hydration_mismatch")}let C=!1;function pe(e){C=e}let x;function $e(e){if(e===null)throw ot(),Ne;return x=e}function Mt(){return $e(me(x))}function qt(e){if(C){if(me(x)!==null)throw ot(),Ne;x=e}}function F(e,t=null,r){if(typeof e!="object"||e===null||st in e)return e;const i=Rt(e);if(i!==Fr&&i!==Mr)return e;var n=new Map,l=kt(e),s=W(0);l&&n.set("length",W(e.length));var u;return new Proxy(e,{defineProperty(f,a,o){(!("value"in o)||o.configurable===!1||o.enumerable===!1||o.writable===!1)&&Xr();var c=n.get(a);return c===void 0?(c=W(o.value),n.set(a,c)):b(c,F(o.value,u)),!0},deleteProperty(f,a){var o=n.get(a);if(o===void 0)a in f&&n.set(a,W(j));else{if(l&&typeof a=="string"){var c=n.get("length"),d=Number(a);Number.isInteger(d)&&d<c.v&&b(c,d)}b(o,j),Vt(s)}return!0},get(f,a,o){var $;if(a===st)return e;var c=n.get(a),d=a in f;if(c===void 0&&(!d||($=ge(f,a))!=null&&$.writable)&&(c=W(F(d?f[a]:j,u)),n.set(a,c)),c!==void 0){var v=_(c);return v===j?void 0:v}return Reflect.get(f,a,o)},getOwnPropertyDescriptor(f,a){var o=Reflect.getOwnPropertyDescriptor(f,a);if(o&&"value"in o){var c=n.get(a);c&&(o.value=_(c))}else if(o===void 0){var d=n.get(a),v=d==null?void 0:d.v;if(d!==void 0&&v!==j)return{enumerable:!0,configurable:!0,value:v,writable:!0}}return o},has(f,a){var v;if(a===st)return!0;var o=n.get(a),c=o!==void 0&&o.v!==j||Reflect.has(f,a);if(o!==void 0||w!==null&&(!c||(v=ge(f,a))!=null&&v.writable)){o===void 0&&(o=W(c?F(f[a],u):j),n.set(a,o));var d=_(o);if(d===j)return!1}return c},set(f,a,o,c){var P;var d=n.get(a),v=a in f;if(l&&a==="length")for(var $=o;$<d.v;$+=1){var h=n.get($+"");h!==void 0?b(h,j):$ in f&&(h=W(j),n.set($+"",h))}d===void 0?(!v||(P=ge(f,a))!=null&&P.writable)&&(d=W(void 0),b(d,F(o,u)),n.set(a,d)):(v=d.v!==j,b(d,F(o,u)));var S=Reflect.getOwnPropertyDescriptor(f,a);if(S!=null&&S.set&&S.set.call(c,o),!v){if(l&&typeof a=="string"){var A=n.get("length"),O=Number(a);Number.isInteger(O)&&O>=A.v&&b(A,O+1)}Vt(s)}return!0},ownKeys(f){_(s);var a=Reflect.ownKeys(f).filter(d=>{var v=n.get(d);return v===void 0||v.v!==j});for(var[o,c]of n)c.v!==j&&!(o in f)&&a.push(o);return a},setPrototypeOf(){Kr()}})}function Vt(e,t=1){b(e,e.v+t)}var Yt,Bt,Ht,Ut;function ut(){if(Yt===void 0){Yt=window,Bt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype;Ht=ge(t,"firstChild").get,Ut=ge(t,"nextSibling").get,e.__click=void 0,e.__className="",e.__attributes=null,e.__styles=null,e.__e=void 0,Text.prototype.__t=void 0}}function ft(e=""){return document.createTextNode(e)}function Te(e){return Ht.call(e)}function me(e){return Ut.call(e)}function Jt(e,t){if(!C)return Te(e);var r=Te(x);return r===null&&(r=x.appendChild(ft())),$e(r),r}function sn(e,t){if(!C){var r=Te(e);return r instanceof Comment&&r.data===""?me(r):r}return x}function re(e,t=1,r=!1){let i=C?x:e;for(var n;t--;)n=i,i=me(i);if(!C)return i;var l=i==null?void 0:i.nodeType;if(r&&l!==3){var s=ft();return i===null?n==null||n.after(s):i.before(s),$e(s),s}return $e(i),i}function an(e){e.textContent=""}const Gt=0,on=1;let Ye=!1,Be=Gt,Oe=!1,xe=null,ye=!1,ct=!1;function Wt(e){ye=e}function Xt(e){ct=e}let ce=[],we=0,ui=[],y=null,X=!1;function K(e){y=e}let w=null;function z(e){w=e}let Z=null;function un(e){Z=e}let k=null,M=0,ne=null;function fn(e){ne=e}let Kt=1,He=0,ue=!1;function zt(){return++Kt}function Ue(e){var c;var t=e.f;if(t&oe)return!0;if(t&he){var r=e.deps,i=(t&V)!==0;if(r!==null){var n,l,s=(t&je)!==0,u=i&&w!==null&&!ue,f=r.length;if(s||u){var a=e,o=a.parent;for(n=0;n<f;n++)l=r[n],(s||!((c=l==null?void 0:l.reactions)!=null&&c.includes(a)))&&(l.reactions??(l.reactions=[])).push(a);s&&(a.f^=je),u&&o!==null&&!(o.f&V)&&(a.f^=V)}for(n=0;n<f;n++)if(l=r[n],Ue(l)&&Ft(l),l.wv>e.wv)return!0}(!i||w!==null&&!ue)&&ie(e,D)}return!1}function cn(e,t){for(var r=t;r!==null;){if(r.f&Le)try{r.fn(e);return}catch{r.f^=Le}r=r.parent}throw Ye=!1,e}function dn(e){return(e.f&Fe)===0&&(e.parent===null||(e.parent.f&Le)===0)}function Je(e,t,r,i){if(Ye){if(r===null&&(Ye=!1),dn(t))throw e;return}r!==null&&(Ye=!0);{cn(e,t);return}}function Zt(e,t,r=!0){var i=e.reactions;if(i!==null)for(var n=0;n<i.length;n++){var l=i[n];l.f&U?Zt(l,t,!1):t===l&&(r?ie(l,oe):l.f&D&&ie(l,he),_t(l))}}function Qt(e){var v;var t=k,r=M,i=ne,n=y,l=ue,s=Z,u=q,f=X,a=e.f;k=null,M=0,ne=null,y=a&(ae|ve)?null:e,ue=(a&V)!==0&&(!ye||n===null||f),Z=null,ar(e.ctx),X=!1,He++;try{var o=(0,e.fn)(),c=e.deps;if(k!==null){var d;if(Ge(e,M),c!==null&&M>0)for(c.length=M+k.length,d=0;d<k.length;d++)c[M+d]=k[d];else e.deps=c=k;if(!ue)for(d=M;d<c.length;d++)((v=c[d]).reactions??(v.reactions=[])).push(e)}else c!==null&&M<c.length&&(Ge(e,M),c.length=M);if(fr()&&ne!==null&&!X&&c!==null&&!(e.f&(U|he|oe)))for(d=0;d<ne.length;d++)Zt(ne[d],e);return n!==null&&He++,o}finally{k=t,M=r,ne=i,y=n,ue=l,Z=s,ar(u),X=f}}function _n(e,t){let r=t.reactions;if(r!==null){var i=Lr.call(r,e);if(i!==-1){var n=r.length-1;n===0?r=t.reactions=null:(r[i]=r[n],r.pop())}}r===null&&t.f&U&&(k===null||!k.includes(t))&&(ie(t,he),t.f&(V|je)||(t.f^=je),Dt(t),Ge(t,0))}function Ge(e,t){var r=e.deps;if(r!==null)for(var i=t;i<r.length;i++)_n(e,r[i])}function dt(e){var t=e.f;if(!(t&Fe)){ie(e,D);var r=w,i=q;w=e;try{t&lt?Sn(e):ir(e),nr(e);var n=Qt(e);e.teardown=typeof n=="function"?n:null,e.wv=Kt;var l=e.deps,s;it&&Qr&&e.f&oe}catch(u){Je(u,e,r,i||e.ctx)}finally{w=r}}}function er(){if(we>1e3){we=0;try{Gr()}catch(e){if(xe!==null)Je(e,xe,null);else throw e}}we++}function tr(e){var t=e.length;if(t!==0){er();var r=ye;ye=!0;try{for(var i=0;i<t;i++){var n=e[i];n.f&D||(n.f^=D);var l=gn(n);vn(l)}}finally{ye=r}}}function vn(e){var t=e.length;if(t!==0)for(var r=0;r<t;r++){var i=e[r];if(!(i.f&(Fe|De)))try{Ue(i)&&(dt(i),i.deps===null&&i.first===null&&i.nodes_start===null&&(i.teardown===null?lr(i):i.fn=null))}catch(n){Je(n,i,null,i.ctx)}}}function hn(){if(Oe=!1,we>1001)return;const e=ce;ce=[],tr(e),Oe||(we=0,xe=null)}function _t(e){Be===Gt&&(Oe||(Oe=!0,queueMicrotask(hn))),xe=e;for(var t=e;t.parent!==null;){t=t.parent;var r=t.f;if(r&(ve|ae)){if(!(r&D))return;t.f^=D}}ce.push(t)}function gn(e){var t=[],r=e.first;e:for(;r!==null;){var i=r.f,n=(i&ae)!==0,l=n&&(i&D)!==0,s=r.next;if(!l&&!(i&De)){if(i&xt)t.push(r);else if(n)r.f^=D;else{var u=y;try{y=r,Ue(r)&&dt(r)}catch(o){Je(o,r,null,r.ctx)}finally{y=u}}var f=r.first;if(f!==null){r=f;continue}}if(s===null){let o=r.parent;for(;o!==null;){if(e===o)break e;var a=o.next;if(a!==null){r=a;continue e}o=o.parent}}r=s}return t}function Se(e){var t=Be,r=ce;try{er();const n=[];Be=on,ce=n,Oe=!1,tr(r);var i=e==null?void 0:e();return Vr(),(ce.length>0||n.length>0)&&Se(),we=0,xe=null,i}finally{Be=t,ce=r}}function _(e){var t=e.f,r=(t&U)!==0;if(y!==null&&!X){Z!==null&&Z.includes(e)&&zr();var i=y.deps;e.rv<He&&(e.rv=He,k===null&&i!==null&&i[M]===e?M++:k===null?k=[e]:(!ue||!k.includes(e))&&k.push(e))}else if(r&&e.deps===null&&e.effects===null){var n=e,l=n.parent;l!==null&&!(l.f&V)&&(n.f^=V)}return r&&(n=e,Ue(n)&&Ft(n)),e.v}function pn(e){var t=X;try{return X=!0,e()}finally{X=t}}const $n=-7169;function ie(e,t){e.f=e.f&$n|t}function mn(e){w===null&&y===null&&Jr(),y!==null&&y.f&V&&w===null&&Ur(),ct&&Hr()}function yn(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function de(e,t,r,i=!0){var n=(e&ve)!==0,l=w,s={ctx:q,deps:null,nodes_start:null,nodes_end:null,f:e|oe,first:null,fn:t,last:null,next:null,parent:n?null:l,prev:null,teardown:null,transitions:null,wv:0};if(r){var u=ye;try{Wt(!0),dt(s),s.f|=Rr}catch(o){throw fe(s),o}finally{Wt(u)}}else t!==null&&_t(s);var f=r&&s.deps===null&&s.first===null&&s.nodes_start===null&&s.teardown===null&&(s.f&(St|Le))===0;if(!f&&!n&&i&&(l!==null&&yn(s,l),y!==null&&y.f&U)){var a=y;(a.effects??(a.effects=[])).push(s)}return s}function wn(e){const t=de(Ie,null,!1);return ie(t,D),t.teardown=e,t}function bn(e){mn();var t=w!==null&&(w.f&ae)!==0&&q!==null&&!q.m;if(t){var r=q;(r.e??(r.e=[])).push({fn:e,effect:w,reaction:y})}else{var i=rr(e);return i}}function En(e){const t=de(ve,e,!0);return()=>{fe(t)}}function Nn(e){const t=de(ve,e,!0);return(r={})=>new Promise(i=>{r.outro?kn(t,()=>{fe(t),i(void 0)}):(fe(t),i(void 0))})}function rr(e){return de(xt,e,!1)}function Tn(e){return de(Ie,e,!0)}function Q(e,t=[],r=jt){const i=t.map(r);return On(()=>e(...i.map(_)))}function On(e,t=0){return de(Ie|lt|t,e,!0)}function xn(e,t=!0){return de(Ie|ae,e,!0,t)}function nr(e){var t=e.teardown;if(t!==null){const r=ct,i=y;Xt(!0),K(null);try{t.call(null)}finally{Xt(r),K(i)}}}function ir(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){var i=r.next;fe(r,t),r=i}}function Sn(e){for(var t=e.first;t!==null;){var r=t.next;t.f&ae||fe(t),t=r}}function fe(e,t=!0){var r=!1;if((t||e.f&Cr)&&e.nodes_start!==null){for(var i=e.nodes_start,n=e.nodes_end;i!==null;){var l=i===n?null:me(i);i.remove(),i=l}r=!0}ir(e,t&&!r),Ge(e,0),ie(e,Fe);var s=e.transitions;if(s!==null)for(const f of s)f.stop();nr(e);var u=e.parent;u!==null&&u.first!==null&&lr(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=null}function lr(e){var t=e.parent,r=e.prev,i=e.next;r!==null&&(r.next=i),i!==null&&(i.prev=r),t!==null&&(t.first===e&&(t.first=i),t.last===e&&(t.last=r))}function kn(e,t){var r=[];sr(e,r,!0),Rn(r,()=>{fe(e),t&&t()})}function Rn(e,t){var r=e.length;if(r>0){var i=()=>--r||t();for(var n of e)n.out(i)}else t()}function sr(e,t,r){if(!(e.f&De)){if(e.f^=De,e.transitions!==null)for(const s of e.transitions)(s.is_global||r)&&t.push(s);for(var i=e.first;i!==null;){var n=i.next,l=(i.f&Ar)!==0||(i.f&ae)!==0;sr(i,t,l?r:!1),i=n}}}let q=null;function ar(e){q=e}function or(e,t=!1,r){q={p:q,c:null,e:null,m:!1,s:e,x:null,l:null}}function ur(e){const t=q;if(t!==null){e!==void 0&&(t.x=e);const s=t.e;if(s!==null){var r=w,i=y;t.e=null;try{for(var n=0;n<s.length;n++){var l=s[n];z(l.effect),K(l.reaction),rr(l.fn)}}finally{z(r),K(i)}}q=t.p,t.m=!0}return e||{}}function fr(){return!0}const An=["touchstart","touchmove"];function Cn(e){return An.includes(e)}function Pn(e){var t=y,r=w;K(null),z(null);try{return e()}finally{K(t),z(r)}}const cr=new Set,vt=new Set;function In(e,t,r,i={}){function n(l){if(i.capture||ke.call(t,l),!l.cancelBubble)return Pn(()=>r==null?void 0:r.call(this,l))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Ct(()=>{t.addEventListener(e,n,i)}):t.addEventListener(e,n,i),n}function We(e,t,r,i,n){var l={capture:i,passive:n},s=In(e,t,r,l);(t===document.body||t===window||t===document)&&wn(()=>{t.removeEventListener(e,s,l)})}function Ln(e){for(var t=0;t<e.length;t++)cr.add(e[t]);for(var r of vt)r(e)}function ke(e){var O;var t=this,r=t.ownerDocument,i=e.type,n=((O=e.composedPath)==null?void 0:O.call(e))||[],l=n[0]||e.target,s=0,u=e.__root;if(u){var f=n.indexOf(u);if(f!==-1&&(t===document||t===window)){e.__root=t;return}var a=n.indexOf(t);if(a===-1)return;f<=a&&(s=f)}if(l=n[s]||e.target,l!==t){qe(e,"currentTarget",{configurable:!0,get(){return l||r}});var o=y,c=w;K(null),z(null);try{for(var d,v=[];l!==null;){var $=l.assignedSlot||l.parentNode||l.host||null;try{var h=l["__"+i];if(h!==void 0&&!l.disabled)if(kt(h)){var[S,...A]=h;S.apply(l,[e,...A])}else h.call(l,e)}catch(P){d?v.push(P):d=P}if(e.cancelBubble||$===t||$===null)break;l=$}if(d){for(let P of v)queueMicrotask(()=>{throw P});throw d}}finally{e.__root=t,delete e.currentTarget,K(o),z(c)}}}function jn(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function ht(e,t){var r=w;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function Dn(e,t){var r=(t&T)!==0,i,n=!e.startsWith("<!>");return()=>{if(C)return ht(x,null),x;i===void 0&&(i=jn(n?e:"<!>"+e));var l=r||Bt?document.importNode(i,!0):i.cloneNode(!0);{var s=Te(l),u=l.lastChild;ht(s,u)}return l}}function dr(e,t){if(C){w.nodes_end=x,Mt();return}e!==null&&e.before(t)}function _r(e,t){return vr(e,t)}function Fn(e,t){ut(),t.intro=t.intro??!1;const r=t.target,i=C,n=x;try{for(var l=Te(r);l&&(l.nodeType!==8||l.data!==Pe);)l=me(l);if(!l)throw Ne;pe(!0),$e(l),Mt();const s=vr(e,{...t,anchor:l});if(x===null||x.nodeType!==8||x.data!==kr)throw ot(),Ne;return pe(!1),s}catch(s){if(s===Ne)return t.recover===!1&&Wr(),ut(),an(r),pe(!1),_r(e,t);throw s}finally{pe(i),$e(n)}}const be=new Map;function vr(e,{target:t,anchor:r,props:i={},events:n,context:l,intro:s=!0}){ut();var u=new Set,f=c=>{for(var d=0;d<c.length;d++){var v=c[d];if(!u.has(v)){u.add(v);var $=Cn(v);t.addEventListener(v,ke,{passive:$});var h=be.get(v);h===void 0?(document.addEventListener(v,ke,{passive:$}),be.set(v,1)):be.set(v,h+1)}}};f(jr(cr)),vt.add(f);var a=void 0,o=Nn(()=>{var c=r??t.appendChild(ft());return xn(()=>{if(l){or({});var d=q;d.c=l}n&&(i.$$events=n),C&&ht(c,null),a=e(c,i)||{},C&&(w.nodes_end=x),l&&ur()}),()=>{var $;for(var d of u){t.removeEventListener(d,ke);var v=be.get(d);--v===0?(document.removeEventListener(d,ke),be.delete(d)):be.set(d,v)}vt.delete(f),c!==r&&(($=c.parentNode)==null||$.removeChild(c))}});return gt.set(a,o),a}let gt=new WeakMap;function Mn(e,t){const r=gt.get(e);return r?(gt.delete(e),r(t)):Promise.resolve()}function qn(e,t){Ct(()=>{var r=e.getRootNode(),i=r.host?r:r.head??r.ownerDocument.head;if(!i.querySelector("#"+t.hash)){const n=document.createElement("style");n.id=t.hash,n.textContent=t.code,i.appendChild(n)}})}function Vn(e,t,r,i){var n=e.__attributes??(e.__attributes={});C&&(n[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||n[t]!==(n[t]=r)&&(t==="style"&&"__styles"in e&&(e.__styles={}),t==="loading"&&(e[Ir]=r),r==null?e.removeAttribute(t):typeof r!="string"&&hr(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function R(e,t,r){var i=y,n=w;let l=C;C&&pe(!1),K(null),z(null);try{(pt.has(e.nodeName)||!customElements||customElements.get(e.tagName.toLowerCase())?hr(e).includes(t):r&&typeof r=="object")?e[t]=r:Vn(e,t,r==null?r:String(r))}finally{K(i),z(n),l&&pe(!0)}}var pt=new Map;function hr(e){var t=pt.get(e.nodeName);if(t)return t;pt.set(e.nodeName,t=[]);for(var r,i=e,n=Element.prototype;n!==i;){r=Dr(i);for(var l in r)r[l].set&&t.push(l);i=Rt(i)}return t}function $t(e,t,r,i){var n;n=e[t];var l=i,s=!0,u=!1,f=()=>(u=!0,s&&(s=!1,l=i),l);n===void 0&&i!==void 0&&(n=f());var a;a=()=>{var v=e[t];return v===void 0?f():(s=!0,u=!1,v)};var o=!1,c=It(n),d=jt(()=>{var v=a(),$=_(c);return o?(o=!1,$):c.v=v});return function(v,$){if(arguments.length>0){const h=$?_(d):v;return d.equals(h)||(o=!0,b(c,h),u&&l!==void 0&&(l=h),pn(()=>_(d))),v}return _(d)}}function Yn(e){return new Bn(e)}class Bn{constructor(t){Tt(this,le);Tt(this,B);var l;var r=new Map,i=(s,u)=>{var f=It(u);return r.set(s,f),f};const n=new Proxy({...t.props||{},$$events:{}},{get(s,u){return _(r.get(u)??i(u,Reflect.get(s,u)))},has(s,u){return u===Pr?!0:(_(r.get(u)??i(u,Reflect.get(s,u))),Reflect.has(s,u))},set(s,u,f){return b(r.get(u)??i(u,f),f),Reflect.set(s,u,f)}});Ot(this,B,(t.hydrate?Fn:_r)(t.component,{target:t.target,anchor:t.anchor,props:n,context:t.context,intro:t.intro??!1,recover:t.recover})),(!((l=t==null?void 0:t.props)!=null&&l.$$host)||t.sync===!1)&&Se(),Ot(this,le,n.$$events);for(const s of Object.keys(L(this,B)))s==="$set"||s==="$destroy"||s==="$on"||qe(this,s,{get(){return L(this,B)[s]},set(u){L(this,B)[s]=u},enumerable:!0});L(this,B).$set=s=>{Object.assign(n,s)},L(this,B).$destroy=()=>{Mn(L(this,B))}}$set(t){L(this,B).$set(t)}$on(t,r){L(this,le)[t]=L(this,le)[t]||[];const i=(...n)=>r.call(this,...n);return L(this,le)[t].push(i),()=>{L(this,le)[t]=L(this,le)[t].filter(n=>n!==i)}}$destroy(){L(this,B).$destroy()}}le=new WeakMap,B=new WeakMap;let gr;typeof HTMLElement=="function"&&(gr=class extends HTMLElement{constructor(t,r,i){super();G(this,"$$ctor");G(this,"$$s");G(this,"$$c");G(this,"$$cn",!1);G(this,"$$d",{});G(this,"$$r",!1);G(this,"$$p_d",{});G(this,"$$l",{});G(this,"$$l_u",new Map);G(this,"$$me");this.$$ctor=t,this.$$s=r,i&&this.attachShadow({mode:"open"})}addEventListener(t,r,i){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(r),this.$$c){const n=this.$$c.$on(t,r);this.$$l_u.set(r,n)}super.addEventListener(t,r,i)}removeEventListener(t,r,i){if(super.removeEventListener(t,r,i),this.$$c){const n=this.$$l_u.get(r);n&&(n(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(n){return l=>{const s=document.createElement("slot");n!=="default"&&(s.name=n),dr(l,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const r={},i=Hn(this);for(const n of this.$$s)n in i&&(n==="default"&&!this.$$d.children?(this.$$d.children=t(n),r.default=!0):r[n]=t(n));for(const n of this.attributes){const l=this.$$g_p(n.name);l in this.$$d||(this.$$d[l]=Xe(l,n.value,this.$$p_d,"toProp"))}for(const n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=Yn({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}}),this.$$me=En(()=>{Tn(()=>{var n;this.$$r=!0;for(const l of Me(this.$$c)){if(!((n=this.$$p_d[l])!=null&&n.reflect))continue;this.$$d[l]=this.$$c[l];const s=Xe(l,this.$$d[l],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[l].attribute||l):this.setAttribute(this.$$p_d[l].attribute||l,s)}this.$$r=!1})});for(const n in this.$$l)for(const l of this.$$l[n]){const s=this.$$c.$on(n,l);this.$$l_u.set(l,s)}this.$$l={}}}attributeChangedCallback(t,r,i){var n;this.$$r||(t=this.$$g_p(t),this.$$d[t]=Xe(t,i,this.$$p_d,"toProp"),(n=this.$$c)==null||n.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(t){return Me(this.$$p_d).find(r=>this.$$p_d[r].attribute===t||!this.$$p_d[r].attribute&&r.toLowerCase()===t)||t}});function Xe(e,t,r,i){var l;const n=(l=r[e])==null?void 0:l.type;if(t=n==="Boolean"&&typeof t!="boolean"?t!=null:t,!i||!r[e])return t;if(i==="toAttribute")switch(n){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(n){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function Hn(e){const t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}function Un(e,t,r,i,n,l){let s=class extends gr{constructor(){super(e,r,n),this.$$p_d=t}static get observedAttributes(){return Me(t).map(u=>(t[u].attribute||u).toLowerCase())}};return Me(t).forEach(u=>{qe(s.prototype,u,{get(){return this.$$c&&u in this.$$c?this.$$c[u]:this.$$d[u]},set(f){var c;f=Xe(u,f,t),this.$$d[u]=f;var a=this.$$c;if(a){var o=(c=ge(a,u))==null?void 0:c.get;o?a[u]=f:a.$set({[u]:f})}}})}),i.forEach(u=>{qe(s.prototype,u,{get(){var f;return(f=this.$$c)==null?void 0:f[u]}})}),e.element=s,s}const pr={version:"0.50.0-alpha.23"};function Jn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee={},mt,$r;function Gn(){if($r)return mt;$r=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,n=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,u=/^\s+|\s+$/g,f=`
2
- `,a="/",o="*",c="",d="comment",v="declaration";mt=function(h,S){if(typeof h!="string")throw new TypeError("First argument must be a string");if(!h)return[];S=S||{};var A=1,O=1;function P(m){var g=m.match(t);g&&(A+=g.length);var I=m.lastIndexOf(f);O=~I?m.length-I:O+m.length}function Ke(){var m={line:A,column:O};return function(g){return g.position=new ze(m),Qe(),g}}function ze(m){this.start=m,this.end={line:A,column:O},this.source=S.source}ze.prototype.content=h;function Ze(m){var g=new Error(S.source+":"+A+":"+O+": "+m);if(g.reason=m,g.filename=S.source,g.line=A,g.column=O,g.source=h,!S.silent)throw g}function _e(m){var g=m.exec(h);if(g){var I=g[0];return P(I),h=h.slice(I.length),g}}function Qe(){_e(r)}function et(m){var g;for(m=m||[];g=tt();)g!==!1&&m.push(g);return m}function tt(){var m=Ke();if(!(a!=h.charAt(0)||o!=h.charAt(1))){for(var g=2;c!=h.charAt(g)&&(o!=h.charAt(g)||a!=h.charAt(g+1));)++g;if(g+=2,c===h.charAt(g-1))return Ze("End of comment missing");var I=h.slice(2,g-2);return O+=2,P(I),h=h.slice(g),O+=2,m({type:d,comment:I})}}function rt(){var m=Ke(),g=_e(i);if(g){if(tt(),!_e(n))return Ze("property missing ':'");var I=_e(l),Ae=m({type:v,property:$(g[0].replace(e,c)),value:I?$(I[0].replace(e,c)):c});return _e(s),Ae}}function Re(){var m=[];et(m);for(var g;g=rt();)g!==!1&&(m.push(g),et(m));return m}return Qe(),Re()};function $(h){return h?h.replace(u,c):c}return mt}var mr;function Wn(){if(mr)return Ee;mr=1;var e=Ee&&Ee.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.default=r;var t=e(Gn());function r(i,n){var l=null;if(!i||typeof i!="string")return l;var s=(0,t.default)(i),u=typeof n=="function";return s.forEach(function(f){if(f.type==="declaration"){var a=f.property,o=f.value;u?n(a,o,f):o&&(l=l||{},l[a]=o)}}),l}return Ee}var Xn=Wn();const yr=Jn(Xn),Kn=yr.default||yr;function wr(e,t){var i,n;let r="";if(e&&(t!=null&&t.length)&&((i=Object.keys(e))!=null&&i.length)&&((n=t==null?void 0:t.filter(l=>Object.keys(e).includes(l.name)))!=null&&n.length))for(const l of Object.keys(e))(t==null?void 0:t.filter(u=>u.name===l&&u.defaultValue!==e[l]))&&(r+=`${l}:${e[l]};`);return r}function br(e){var i;const t=((i=e==null?void 0:e.repoName.split("/"))==null?void 0:i[1])||(e==null?void 0:e.repoName);if(!t)throw new Error("wrong componentPath "+(e==null?void 0:e.repoName));if(!(e!=null&&e.version))throw new Error("wrong version "+(e==null?void 0:e.version));const r=(e==null?void 0:e.iifePath)||"main.iife.js";if(!document.getElementById(t+"-script"))try{const n=document.createElement("script");n.id=t+"-script",n.src=`https://cdn.jsdelivr.net/npm/${e.repoName}@${e.version}/${r}`,e!=null&&e.local&&location.href.includes("localhost")&&(n.src=`${e.local}`),document.head.appendChild(n)}catch(n){console.warn(n)}}const yt={vars:[]},wt={vars:[{name:"--bs-primary",valueType:"color",theme:"bootstrap",defaultValue:"#07689f"},{name:"--bs-secondary",valueType:"color",theme:"bootstrap",defaultValue:"#c9d6df"},{name:"--bs-success",valueType:"color",theme:"bootstrap",defaultValue:"#11d3bc"},{name:"--bs-info",valueType:"color",theme:"bootstrap",defaultValue:"#a2d5f2"},{name:"--bs-warning",valueType:"color",theme:"bootstrap",defaultValue:"#ffc107"},{name:"--bs-danger",valueType:"color",theme:"bootstrap",defaultValue:"#f67280"}]};var zn=(e,t)=>t("eraser"),Zn=(e,t)=>t("select"),Qn=(e,t)=>t("draw"),ei=(e,t)=>t(),ti=(e,t)=>t(),ri=(e,t)=>t(),ni=Dn('<div part="controller" id="controller" class="svelte-14wiqdf"><button>clear</button> <button>select</button> <button>draw</button> <button>undo</button> <button>redo</button> <button>save</button> <button>brush</button> <br>load:<hb-input-file></hb-input-file> insert:<hb-input-file></hb-input-file></div> <div part="paper-container" id="paper-container" style="position:relative" class="svelte-14wiqdf"><hb-stylus-paper></hb-stylus-paper></div>',3);const ii={hash:"svelte-14wiqdf",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;position:absolute;width:100%;height:100%;display:block;display:grid;grid-template-areas:"header" "paper";grid-template-columns:1fr;grid-template-rows:auto 1fr;}#controller.svelte-14wiqdf {grid-area:header;}#paper-container.svelte-14wiqdf {grid-area:paper;background:green;}'};function Er(e,t){or(t,!0),qn(e,ii);let r=$t(t,"id",7,""),i=$t(t,"style"),n=$t(t,"load_draw"),l=Y("draw"),s=Y(F({})),u=Y(""),f=Y(""),a=Y(0),o=Y(void 0),c=Y(!1),d=Y(!1),v=Y(!1),$=Y(void 0),h=Y(void 0),S=Y(void 0),A;bn(()=>{var p;if(i()&&(b(s,F(Kn(i()))),b(u,F(wr(_(s),yt==null?void 0:yt.vars))),b(f,F(wr(_(s),wt==null?void 0:wt.vars)))),(_(o)===0||_(o))&&_(o)<_(a)?b(d,!0):b(d,!1),(_(a)||_(a)===0)&&_(v)&&(!_(o)||_(o)!==-1)&&(!A||A<_(a)&&(!_(o)||_(o)<A))?b(c,!0):b(c,!1),typeof n()=="string"&&((p=n())!=null&&p.length))try{n(JSON.parse(n()))}catch(ee){console.error("error parsing json",ee)}}),br({repoName:"@htmlbricks/hb-stylus-paper",version:pr.version}),br({repoName:"@htmlbricks/hb-input-file",version:pr.version});function O(p,ee){var te="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(p)),H=document.createElement("a");H.setAttribute("href",te),H.setAttribute("download",ee),document.body.appendChild(H),H.click(),H.remove()}function P(p){b(l,F(p))}function Ke(){console.log("ch",_(a),_(o)),_(a)>=0&&(!_(o)||_(o)>-1)&&(b(o,F(_(o)||_(o)===0?_(o)-1:_(a)-1)),console.log("undo",_(a),_(o)))}function ze(){console.log(_(a),_(o)),(_(o)||_(o)===0)&&_(o)<=_(a)&&(rn(o),console.log("redo",_(a),_(o)))}function Ze(p){_(v)||b(v,!0),console.log("h",p),b(a,p.index-1),p.start_index&&(A=p.start_index),b(o,void 0)}function _e(){b($,F({name:"test",type:"json"}))}function Qe(p){var te;const ee=(te=p.value)==null?void 0:te.name;if(ee){const H=new FileReader;H.readAsDataURL(p.value),H.onload=function(se){var Nt,Or;try{if(console.log("insert file",se.target,(Nt=se.target)==null?void 0:Nt.result),(Or=se.target)!=null&&Or.result){const si=se.target.result.toString().split(";")[0].split("/")[1];b(h,F({base64:se.target.result.toString(),type:si,name:ee}))}}catch{console.error("error loading file")}},H.onerror=function(se){console.error("error reading file")}}}function et(p){console.log("save",p),b($,void 0),O(p,p.name+".json")}function tt(p){if(console.log("file",p),p.value.name){const ee=new FileReader;ee.readAsText(p.value,"UTF-8"),ee.onload=function(te){var H,se;if((se=(H=te==null?void 0:te.target)==null?void 0:H.result)!=null&&se.toString())try{n(JSON.parse(te.target.result.toString()))}catch{console.error("error loading file")}},ee.onerror=function(te){console.error("error reading file")}}}var rt=ni(),Re=sn(rt),m=Jt(Re);m.__click=[zn,P];var g=re(m,2);g.__click=[Zn,P];var I=re(g,2);I.__click=[Qn,P];var Ae=re(I,2);Ae.__click=[ei,Ke];var bt=re(Ae,2);bt.__click=[ti,ze];var Et=re(bt,2);Et.__click=[ri,_e];var Nr=re(Et,2),Ce=re(Nr,4);R(Ce,"id","loadfile"),Q(()=>R(Ce,"style",_(f))),R(Ce,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"}));var nt=re(Ce,2);R(nt,"id","insertfile"),Q(()=>R(nt,"style",_(f))),R(nt,"schemaentry",JSON.stringify({label:"ciao"})),qt(Re);var Tr=re(Re,2),J=Jt(Tr);return R(J,"id","stylus-paper"),Q(()=>R(J,"goto",_(o))),Q(()=>R(J,"style",_(u))),R(J,"background_color","green"),Q(()=>R(J,"mode",_(l))),Q(()=>R(J,"save_as",_($)?JSON.stringify(_($)):"")),Q(()=>R(J,"load_draw",n()?JSON.stringify(n()):null)),Q(()=>R(J,"insert_image",_(h)?JSON.stringify(_(h)):null)),Q(()=>R(J,"insert_text",_(S)?JSON.stringify(_(S)):null)),qt(Tr),Q(()=>{Ae.disabled=!_(c),bt.disabled=!_(d),Et.disabled=!_(c),Nr.disabled=_(l)!=="draw"}),We("setValue",Ce,p=>tt(p.detail)),We("setValue",nt,p=>Qe(p.detail)),We("historyIndex",J,p=>Ze(p.detail)),We("save",J,p=>et(p.detail)),dr(e,rt),ur({get id(){return r()},set id(p=""){r(p),Se()},get style(){return i()},set style(p){i(p),Se()},get load_draw(){return n()},set load_draw(p){n(p),Se()}})}Ln(["click"]),customElements.define("hb-stylus-notebook",Un(Er,{id:{},style:{},load_draw:{}},[],[],!0)),E.Component=Er,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})})(this["stylus-notebook"]=this["stylus-notebook"]||{});
1
+ (function(xt){"use strict";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add("5");const Pr=2,Ir="[",Mr="]",Ne={},N=Symbol(),Lr="http://www.w3.org/1999/xhtml",Ot=!1;var kt=Array.isArray,jr=Array.prototype.indexOf,Dr=Array.from,Le=Object.keys,_e=Object.defineProperty,he=Object.getOwnPropertyDescriptor,Fr=Object.getOwnPropertyDescriptors,qr=Object.prototype,Ur=Array.prototype,Rt=Object.getPrototypeOf,At=Object.isExtensible;function Ct(e){for(var t=0;t<e.length;t++)e[t]()}function Yr(){var e,t,r=new Promise((n,i)=>{e=n,t=i});return{promise:r,resolve:e,reject:t}}const P=2,et=4,tt=8,Te=16,K=32,z=64,Pt=128,D=256,je=512,k=1024,Y=2048,Z=4096,ve=8192,ne=16384,rt=32768,Br=65536,It=1<<17,Hr=1<<18,pe=1<<19,Gr=1<<20,nt=1<<21,it=1<<22,ie=1<<23,st=Symbol("$state"),Jr=Symbol("legacy props"),Vr=Symbol(""),lt=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Wr=3,Mt=8;function Xr(){throw new Error("https://svelte.dev/e/await_outside_boundary")}function Kr(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function zr(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Zr(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Qr(e){throw new Error("https://svelte.dev/e/effect_orphan")}function en(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function tn(){throw new Error("https://svelte.dev/e/hydration_failed")}function rn(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function nn(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function sn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function at(e){console.warn("https://svelte.dev/e/hydration_mismatch")}let T=!1;function ge(e){T=e}let x;function we(e){if(e===null)throw at(),Ne;return x=e}function Lt(){return we(ye(x))}function jt(e){if(T){if(ye(x)!==null)throw at(),Ne;x=e}}function Dt(e){return e===this.v}function ln(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function an(e){return!ln(e,this.v)}let on=!1,B=null;function De(e){B=e}function Ft(e,t=!1,r){B={p:B,c:null,e:null,s:e,x:null,l:null}}function qt(e){var t=B,r=t.e;if(r!==null){t.e=null;for(var n of r)ir(n)}return e!==void 0&&(t.x=e),B=t.p,e??{}}function Ut(){return!0}const un=new WeakMap;function fn(e){var t=w;if(t===null)return m.f|=ie,e;if((t.f&rt)===0){if((t.f&Pt)===0)throw!t.parent&&e instanceof Error&&Yt(e),e;t.b.error(e)}else ot(e,t)}function ot(e,t){for(;t!==null;){if((t.f&Pt)!==0)try{t.b.error(e);return}catch(r){e=r}t=t.parent}throw e instanceof Error&&Yt(e),e}function Yt(e){const t=un.get(e);t&&(_e(e,"message",{value:t.message}),_e(e,"stack",{value:t.stack}))}let xe=[],ut=[];function Bt(){var e=xe;xe=[],Ct(e)}function cn(){var e=ut;ut=[],Ct(e)}function dn(e){xe.length===0&&queueMicrotask(Bt),xe.push(e)}function _n(){xe.length>0&&Bt(),ut.length>0&&cn()}function hn(){const e=w.b;return e===null&&Xr(),e}function Ht(e){var t=P|Y,r=m!==null&&(m.f&P)!==0?m:null;return w===null||r!==null&&(r.f&D)!==0?t|=D:w.f|=pe,{ctx:B,deps:null,effects:null,equals:Dt,f:t,fn:e,reactions:null,rv:0,v:N,wv:0,parent:r??w,ac:null}}function vn(e,t){let r=w;r===null&&Kr();var n=r.b,i=void 0,s=ht(N),a=null,o=!m;return An(()=>{try{var l=e();a&&Promise.resolve(l).catch(()=>{})}catch(h){l=Promise.reject(h)}var u=()=>l;i=a?.then(u,u)??Promise.resolve(l),a=i;var f=O,d=n.is_pending();o&&(n.update_pending_count(1),d||f.increment());const _=(h,v=void 0)=>{a=null,d||f.activate(),v?v!==lt&&(s.f|=ie,vt(s,v)):((s.f&ie)!==0&&(s.f^=ie),vt(s,h)),o&&(n.update_pending_count(-1),d||f.decrement()),Vt()};if(i.then(_,h=>_(null,h||"unknown")),f)return()=>{queueMicrotask(()=>f.neuter())}}),new Promise(l=>{function u(f){function d(){f===i?l(s):u(i)}f.then(d,d)}u(i)})}function Gt(e){var t=e.effects;if(t!==null){e.effects=null;for(var r=0;r<t.length;r+=1)ee(t[r])}}function pn(e){for(var t=e.parent;t!==null;){if((t.f&P)===0)return t;t=t.parent}return null}function ft(e){var t,r=w;G(pn(e));try{Gt(e),t=vr(e)}finally{G(r)}return t}function Jt(e){var t=ft(e);if(e.equals(t)||(e.v=t,e.wv=_r()),!ue){var r=(te||(e.f&D)!==0)&&e.deps!==null?Z:k;M(e,r)}}function gn(e,t,r){const n=Ht;if(t.length===0){r(e.map(n));return}var i=O,s=w,a=wn(),o=hn();Promise.all(t.map(l=>vn(l))).then(l=>{i?.activate(),a();try{r([...e.map(n),...l])}catch(u){(s.f&ne)===0&&ot(u,s)}i?.deactivate(),Vt()}).catch(l=>{o.error(l)})}function wn(){var e=w,t=m,r=B,n=O;return function(){G(e),F(t),De(r),n?.activate()}}function Vt(){G(null),F(null),De(null)}const ct=new Set;let O=null,Wt=new Set,Fe=[];function Xt(){const e=Fe.shift();Fe.length>0&&queueMicrotask(Xt),e()}let se=[],qe=null,dt=!1,Ue=!1;class le{current=new Map;#t=new Map;#e=new Set;#r=0;#u=null;#f=!1;#i=[];#l=[];#s=[];#n=[];#a=[];#c=[];#d=[];skipped_effects=new Set;process(t){se=[];for(const i of t)this.#h(i);if(this.#i.length===0&&this.#r===0){this.#_();var r=this.#s,n=this.#n;this.#s=[],this.#n=[],this.#a=[],O=null,zt(r),zt(n),O===null?O=this:ct.delete(this),this.#u?.resolve()}else this.#o(this.#s),this.#o(this.#n),this.#o(this.#a);for(const i of this.#i)be(i);for(const i of this.#l)be(i);this.#i=[],this.#l=[]}#h(t){t.f^=k;for(var r=t.first;r!==null;){var n=r.f,i=(n&(K|z))!==0,s=i&&(n&k)!==0,a=s||(n&ve)!==0||this.skipped_effects.has(r);if(!a&&r.fn!==null){if(i)r.f^=k;else if((n&et)!==0)this.#n.push(r);else if((n&k)===0)if((n&it)!==0){var o=r.b?.is_pending()?this.#l:this.#i;o.push(r)}else Ye(r)&&((r.f&Te)!==0&&this.#a.push(r),be(r));var l=r.first;if(l!==null){r=l;continue}}var u=r.parent;for(r=r.next;r===null&&u!==null;)r=u.next,u=u.parent}}#o(t){for(const r of t)((r.f&Y)!==0?this.#c:this.#d).push(r),M(r,k);t.length=0}capture(t,r){this.#t.has(t)||this.#t.set(t,r),this.current.set(t,t.v)}activate(){O=this}deactivate(){O=null;for(const t of Wt)if(Wt.delete(t),t(),O!==null)break}neuter(){this.#f=!0}flush(){se.length>0?Kt():this.#_(),O===this&&(this.#r===0&&ct.delete(this),this.deactivate())}#_(){if(!this.#f)for(const t of this.#e)t();this.#e.clear()}increment(){this.#r+=1}decrement(){if(this.#r-=1,this.#r===0){for(const t of this.#c)M(t,Y),Oe(t);for(const t of this.#d)M(t,Z),Oe(t);this.#s=[],this.#n=[],this.flush()}else this.deactivate()}add_callback(t){this.#e.add(t)}settled(){return(this.#u??=Yr()).promise}static ensure(){if(O===null){const t=O=new le;ct.add(O),Ue||le.enqueue(()=>{O===t&&t.flush()})}return O}static enqueue(t){Fe.length===0&&queueMicrotask(Xt),Fe.unshift(t)}}function _t(e){var t=Ue;Ue=!0;try{for(var r;;){if(_n(),se.length===0&&(O?.flush(),se.length===0))return qe=null,r;Kt()}}finally{Ue=t}}function Kt(){var e=$e;dt=!0;try{var t=0;for(ur(!0);se.length>0;){var r=le.ensure();if(t++>1e3){var n,i;mn()}r.process(se),Q.clear()}}finally{dt=!1,ur(e),qe=null}}function mn(){try{en()}catch(e){ot(e,qe)}}let ae=null;function zt(e){var t=e.length;if(t!==0){for(var r=0;r<t;){var n=e[r++];if((n.f&(ne|ve))===0&&Ye(n)&&(ae=[],be(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null&&n.ac===null?ar(n):n.fn=null),ae?.length>0)){Q.clear();for(const i of ae)be(i);ae=[]}}ae=null}}function Oe(e){for(var t=qe=e;t.parent!==null;){t=t.parent;var r=t.f;if(dt&&t===w&&(r&Te)!==0)return;if((r&(z|K))!==0){if((r&k)===0)return;t.f^=k}}se.push(t)}const Q=new Map;function ht(e,t){var r={f:0,v:e,reactions:null,equals:Dt,rv:0,wv:0};return r}function E(e,t){const r=ht(e);return Dn(r),r}function yn(e,t=!1,r=!0){const n=ht(e);return t||(n.equals=an),n}function b(e,t,r=!1){m!==null&&(!fe||(m.f&It)!==0)&&Ut()&&(m.f&(P|Te|it|It))!==0&&!W?.includes(e)&&sn();let n=r?me(t):t;return vt(e,n)}function vt(e,t){if(!e.equals(t)){var r=e.v;ue?Q.set(e,t):Q.set(e,r),e.v=t;var n=le.ensure();n.capture(e,r),(e.f&P)!==0&&((e.f&Y)!==0&&ft(e),M(e,(e.f&D)===0?k:Z)),e.wv=_r(),Zt(e,Y),w!==null&&(w.f&k)!==0&&(w.f&(K|z))===0&&(q===null?Fn([e]):q.push(e))}return t}function $n(e,t=1){var r=c(e),n=t===1?r++:r--;return b(e,r),n}function pt(e){b(e,e.v+1)}function Zt(e,t){var r=e.reactions;if(r!==null)for(var n=r.length,i=0;i<n;i++){var s=r[i],a=s.f,o=(a&Y)===0;o&&M(s,t),(a&P)!==0?Zt(s,Z):o&&((a&Te)!==0&&ae!==null&&ae.push(s),Oe(s))}}function me(e){if(typeof e!="object"||e===null||st in e)return e;const t=Rt(e);if(t!==qr&&t!==Ur)return e;var r=new Map,n=kt(e),i=E(0),s=ce,a=o=>{if(ce===s)return o();var l=m,u=ce;F(null),dr(s);var f=o();return F(l),dr(u),f};return n&&r.set("length",E(e.length)),new Proxy(e,{defineProperty(o,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&rn();var f=r.get(l);return f===void 0?f=a(()=>{var d=E(u.value);return r.set(l,d),d}):b(f,u.value,!0),!0},deleteProperty(o,l){var u=r.get(l);if(u===void 0){if(l in o){const f=a(()=>E(N));r.set(l,f),pt(i)}}else b(u,N),pt(i);return!0},get(o,l,u){if(l===st)return e;var f=r.get(l),d=l in o;if(f===void 0&&(!d||he(o,l)?.writable)&&(f=a(()=>{var h=me(d?o[l]:N),v=E(h);return v}),r.set(l,f)),f!==void 0){var _=c(f);return _===N?void 0:_}return Reflect.get(o,l,u)},getOwnPropertyDescriptor(o,l){var u=Reflect.getOwnPropertyDescriptor(o,l);if(u&&"value"in u){var f=r.get(l);f&&(u.value=c(f))}else if(u===void 0){var d=r.get(l),_=d?.v;if(d!==void 0&&_!==N)return{enumerable:!0,configurable:!0,value:_,writable:!0}}return u},has(o,l){if(l===st)return!0;var u=r.get(l),f=u!==void 0&&u.v!==N||Reflect.has(o,l);if(u!==void 0||w!==null&&(!f||he(o,l)?.writable)){u===void 0&&(u=a(()=>{var _=f?me(o[l]):N,h=E(_);return h}),r.set(l,u));var d=c(u);if(d===N)return!1}return f},set(o,l,u,f){var d=r.get(l),_=l in o;if(n&&l==="length")for(var h=u;h<d.v;h+=1){var v=r.get(h+"");v!==void 0?b(v,N):h in o&&(v=a(()=>E(N)),r.set(h+"",v))}if(d===void 0)(!_||he(o,l)?.writable)&&(d=a(()=>E(void 0)),b(d,me(u)),r.set(l,d));else{_=d.v!==N;var g=a(()=>me(u));b(d,g)}var L=Reflect.getOwnPropertyDescriptor(o,l);if(L?.set&&L.set.call(f,u),!_){if(n&&typeof l=="string"){var C=r.get("length"),S=Number(l);Number.isInteger(S)&&S>=C.v&&b(C,S+1)}pt(i)}return!0},ownKeys(o){c(i);var l=Reflect.ownKeys(o).filter(d=>{var _=r.get(d);return _===void 0||_.v!==N});for(var[u,f]of r)f.v!==N&&!(u in o)&&l.push(u);return l},setPrototypeOf(){nn()}})}var Qt,er,tr,rr;function gt(){if(Qt===void 0){Qt=window,er=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,r=Text.prototype;tr=he(t,"firstChild").get,rr=he(t,"nextSibling").get,At(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),At(r)&&(r.__t=void 0)}}function wt(e=""){return document.createTextNode(e)}function ke(e){return tr.call(e)}function ye(e){return rr.call(e)}function nr(e,t){if(!T)return ke(e);var r=ke(x);return r===null&&(r=x.appendChild(wt())),we(r),r}function bn(e,t){if(!T){var r=ke(e);return r instanceof Comment&&r.data===""?ye(r):r}return x}function J(e,t=1,r=!1){let n=T?x:e;for(var i;t--;)i=n,n=ye(n);if(!T)return n;if(r&&n?.nodeType!==Wr){var s=wt();return n===null?i?.after(s):n.before(s),we(s),s}return we(n),n}function En(e){e.textContent=""}function mt(e){var t=m,r=w;F(null),G(null);try{return e()}finally{F(t),G(r)}}function Sn(e){w===null&&m===null&&Qr(),m!==null&&(m.f&D)!==0&&w===null&&Zr(),ue&&zr()}function Nn(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function V(e,t,r,n=!0){var i=w;i!==null&&(i.f&ve)!==0&&(e|=ve);var s={ctx:B,deps:null,nodes_start:null,nodes_end:null,f:e|Y,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(r)try{be(s),s.f|=rt}catch(l){throw ee(s),l}else t!==null&&Oe(s);if(n){var a=s;if(r&&a.deps===null&&a.teardown===null&&a.nodes_start===null&&a.first===a.last&&(a.f&pe)===0&&(a=a.first),a!==null&&(a.parent=i,i!==null&&Nn(a,i),m!==null&&(m.f&P)!==0&&(e&z)===0)){var o=m;(o.effects??=[]).push(a)}}return s}function Tn(e){const t=V(tt,null,!1);return M(t,k),t.teardown=e,t}function xn(e){Sn();var t=w.f,r=!m&&(t&K)!==0&&(t&rt)===0;if(r){var n=B;(n.e??=[]).push(e)}else return ir(e)}function ir(e){return V(et|Gr,e,!1)}function On(e){le.ensure();const t=V(z|pe,e,!0);return()=>{ee(t)}}function kn(e){le.ensure();const t=V(z|pe,e,!0);return(r={})=>new Promise(n=>{r.outro?Ln(t,()=>{ee(t),n(void 0)}):(ee(t),n(void 0))})}function Rn(e){return V(et,e,!1)}function An(e){return V(it|pe,e,!0)}function Cn(e,t=0){return V(tt|t,e,!0)}function oe(e,t=[],r=[]){gn(t,r,n=>{V(tt,()=>e(...n.map(c)),!0)})}function Pn(e,t=!0){return V(K|pe,e,!0,t)}function sr(e){var t=e.teardown;if(t!==null){const r=ue,n=m;fr(!0),F(null);try{t.call(null)}finally{fr(r),F(n)}}}function lr(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){const i=r.ac;i!==null&&mt(()=>{i.abort(lt)});var n=r.next;(r.f&z)!==0?r.parent=null:ee(r,t),r=n}}function In(e){for(var t=e.first;t!==null;){var r=t.next;(t.f&K)===0&&ee(t),t=r}}function ee(e,t=!0){var r=!1;(t||(e.f&Hr)!==0)&&e.nodes_start!==null&&e.nodes_end!==null&&(Mn(e.nodes_start,e.nodes_end),r=!0),lr(e,t&&!r),Be(e,0),M(e,ne);var n=e.transitions;if(n!==null)for(const s of n)s.stop();sr(e);var i=e.parent;i!==null&&i.first!==null&&ar(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function Mn(e,t){for(;e!==null;){var r=e===t?null:ye(e);e.remove(),e=r}}function ar(e){var t=e.parent,r=e.prev,n=e.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),t!==null&&(t.first===e&&(t.first=n),t.last===e&&(t.last=r))}function Ln(e,t){var r=[];or(e,r,!0),jn(r,()=>{ee(e),t&&t()})}function jn(e,t){var r=e.length;if(r>0){var n=()=>--r||t();for(var i of e)i.out(n)}else t()}function or(e,t,r){if((e.f&ve)===0){if(e.f^=ve,e.transitions!==null)for(const a of e.transitions)(a.is_global||r)&&t.push(a);for(var n=e.first;n!==null;){var i=n.next,s=(n.f&Br)!==0||(n.f&K)!==0;or(n,t,s?r:!1),n=i}}}let $e=!1;function ur(e){$e=e}let ue=!1;function fr(e){ue=e}let m=null,fe=!1;function F(e){m=e}let w=null;function G(e){w=e}let W=null;function Dn(e){m!==null&&(W===null?W=[e]:W.push(e))}let R=null,I=0,q=null;function Fn(e){q=e}let cr=1,Re=0,ce=Re;function dr(e){ce=e}let te=!1;function _r(){return++cr}function Ye(e){var t=e.f;if((t&Y)!==0)return!0;if((t&Z)!==0){var r=e.deps,n=(t&D)!==0;if(r!==null){var i,s,a=(t&je)!==0,o=n&&w!==null&&!te,l=r.length;if((a||o)&&(w===null||(w.f&ne)===0)){var u=e,f=u.parent;for(i=0;i<l;i++)s=r[i],(a||!s?.reactions?.includes(u))&&(s.reactions??=[]).push(u);a&&(u.f^=je),o&&f!==null&&(f.f&D)===0&&(u.f^=D)}for(i=0;i<l;i++)if(s=r[i],Ye(s)&&Jt(s),s.wv>e.wv)return!0}(!n||w!==null&&!te)&&M(e,k)}return!1}function hr(e,t,r=!0){var n=e.reactions;if(n!==null&&!W?.includes(e))for(var i=0;i<n.length;i++){var s=n[i];(s.f&P)!==0?hr(s,t,!1):t===s&&(r?M(s,Y):(s.f&k)!==0&&M(s,Z),Oe(s))}}function vr(e){var t=R,r=I,n=q,i=m,s=te,a=W,o=B,l=fe,u=ce,f=e.f;R=null,I=0,q=null,te=(f&D)!==0&&(fe||!$e||m===null),m=(f&(K|z))===0?e:null,W=null,De(e.ctx),fe=!1,ce=++Re,e.ac!==null&&(mt(()=>{e.ac.abort(lt)}),e.ac=null);try{e.f|=nt;var d=e.fn,_=d(),h=e.deps;if(R!==null){var v;if(Be(e,I),h!==null&&I>0)for(h.length=I+R.length,v=0;v<R.length;v++)h[I+v]=R[v];else e.deps=h=R;if(!te||(f&P)!==0&&e.reactions!==null)for(v=I;v<h.length;v++)(h[v].reactions??=[]).push(e)}else h!==null&&I<h.length&&(Be(e,I),h.length=I);if(Ut()&&q!==null&&!fe&&h!==null&&(e.f&(P|Z|Y))===0)for(v=0;v<q.length;v++)hr(q[v],e);return i!==null&&i!==e&&(Re++,q!==null&&(n===null?n=q:n.push(...q))),(e.f&ie)!==0&&(e.f^=ie),_}catch(g){return fn(g)}finally{e.f^=nt,R=t,I=r,q=n,m=i,te=s,W=a,De(o),fe=l,ce=u}}function qn(e,t){let r=t.reactions;if(r!==null){var n=jr.call(r,e);if(n!==-1){var i=r.length-1;i===0?r=t.reactions=null:(r[n]=r[i],r.pop())}}r===null&&(t.f&P)!==0&&(R===null||!R.includes(t))&&(M(t,Z),(t.f&(D|je))===0&&(t.f^=je),Gt(t),Be(t,0))}function Be(e,t){var r=e.deps;if(r!==null)for(var n=t;n<r.length;n++)qn(e,r[n])}function be(e){var t=e.f;if((t&ne)===0){M(e,k);var r=w,n=$e;w=e,$e=!0;try{(t&Te)!==0?In(e):lr(e),sr(e);var i=vr(e);e.teardown=typeof i=="function"?i:null,e.wv=cr;var s;Ot&&on&&(e.f&Y)!==0&&e.deps}finally{$e=n,w=r}}}function c(e){var t=e.f,r=(t&P)!==0;if(m!==null&&!fe){var n=w!==null&&(w.f&ne)!==0;if(!n&&!W?.includes(e)){var i=m.deps;if((m.f&nt)!==0)e.rv<Re&&(e.rv=Re,R===null&&i!==null&&i[I]===e?I++:R===null?R=[e]:(!te||!R.includes(e))&&R.push(e));else{(m.deps??=[]).push(e);var s=e.reactions;s===null?e.reactions=[m]:s.includes(m)||s.push(m)}}}else if(r&&e.deps===null&&e.effects===null){var a=e,o=a.parent;o!==null&&(o.f&D)===0&&(a.f^=D)}if(ue){if(Q.has(e))return Q.get(e);if(r){a=e;var l=a.v;return((a.f&k)===0&&a.reactions!==null||pr(a))&&(l=ft(a)),Q.set(a,l),l}}else r&&(a=e,Ye(a)&&Jt(a));if((e.f&ie)!==0)throw e.v;return e.v}function pr(e){if(e.v===N)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Q.has(t)||(t.f&P)!==0&&pr(t))return!0;return!1}const Un=-7169;function M(e,t){e.f=e.f&Un|t}const gr=new Set,yt=new Set;function Yn(e,t,r,n={}){function i(s){if(n.capture||Ae.call(t,s),!s.cancelBubble)return mt(()=>r?.call(this,s))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?dn(()=>{t.addEventListener(e,i,n)}):t.addEventListener(e,i,n),i}function He(e,t,r,n,i){var s={capture:n,passive:i},a=Yn(e,t,r,s);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Tn(()=>{t.removeEventListener(e,a,s)})}function Bn(e){for(var t=0;t<e.length;t++)gr.add(e[t]);for(var r of yt)r(e)}let wr=null;function Ae(e){var t=this,r=t.ownerDocument,n=e.type,i=e.composedPath?.()||[],s=i[0]||e.target;wr=e;var a=0,o=wr===e&&e.__root;if(o){var l=i.indexOf(o);if(l!==-1&&(t===document||t===window)){e.__root=t;return}var u=i.indexOf(t);if(u===-1)return;l<=u&&(a=l)}if(s=i[a]||e.target,s!==t){_e(e,"currentTarget",{configurable:!0,get(){return s||r}});var f=m,d=w;F(null),G(null);try{for(var _,h=[];s!==null;){var v=s.assignedSlot||s.parentNode||s.host||null;try{var g=s["__"+n];if(g!=null&&(!s.disabled||e.target===s))if(kt(g)){var[L,...C]=g;L.apply(s,[e,...C])}else g.call(s,e)}catch(S){_?h.push(S):_=S}if(e.cancelBubble||v===t||v===null)break;s=v}if(_){for(let S of h)queueMicrotask(()=>{throw S});throw _}}finally{e.__root=t,delete e.currentTarget,F(f),G(d)}}}function Hn(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function $t(e,t){var r=w;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function Gn(e,t){var r=(t&Pr)!==0,n,i=!e.startsWith("<!>");return()=>{if(T)return $t(x,null),x;n===void 0&&(n=Hn(i?e:"<!>"+e));var s=r||er?document.importNode(n,!0):n.cloneNode(!0);{var a=ke(s),o=s.lastChild;$t(a,o)}return s}}function mr(e,t){if(T){w.nodes_end=x,Lt();return}e!==null&&e.before(t)}const Jn=["touchstart","touchmove"];function Vn(e){return Jn.includes(e)}function yr(e,t){return $r(e,t)}function Wn(e,t){gt(),t.intro=t.intro??!1;const r=t.target,n=T,i=x;try{for(var s=ke(r);s&&(s.nodeType!==Mt||s.data!==Ir);)s=ye(s);if(!s)throw Ne;ge(!0),we(s),Lt();const a=$r(e,{...t,anchor:s});if(x===null||x.nodeType!==Mt||x.data!==Mr)throw at(),Ne;return ge(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
2
+ `).some(o=>o.startsWith("https://svelte.dev/e/")))throw a;return a!==Ne&&console.warn("Failed to hydrate: ",a),t.recover===!1&&tn(),gt(),En(r),ge(!1),yr(e,t)}finally{ge(n),we(i)}}const Ee=new Map;function $r(e,{target:t,anchor:r,props:n={},events:i,context:s,intro:a=!0}){gt();var o=new Set,l=d=>{for(var _=0;_<d.length;_++){var h=d[_];if(!o.has(h)){o.add(h);var v=Vn(h);t.addEventListener(h,Ae,{passive:v});var g=Ee.get(h);g===void 0?(document.addEventListener(h,Ae,{passive:v}),Ee.set(h,1)):Ee.set(h,g+1)}}};l(Dr(gr)),yt.add(l);var u=void 0,f=kn(()=>{var d=r??t.appendChild(wt());return Pn(()=>{if(s){Ft({});var _=B;_.c=s}i&&(n.$$events=i),T&&$t(d,null),u=e(d,n)||{},T&&(w.nodes_end=x),s&&qt()}),()=>{for(var _ of o){t.removeEventListener(_,Ae);var h=Ee.get(_);--h===0?(document.removeEventListener(_,Ae),Ee.delete(_)):Ee.set(_,h)}yt.delete(l),d!==r&&d.parentNode?.removeChild(d)}});return bt.set(u,f),u}let bt=new WeakMap;function Xn(e,t){const r=bt.get(e);return r?(bt.delete(e),r(t)):Promise.resolve()}function Kn(e,t){Rn(()=>{var r=e.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+t.hash)){const i=document.createElement("style");i.id=t.hash,i.textContent=t.code,n.appendChild(i)}})}function zn(e,t){return e==null?null:String(e)}function Et(e,t,r,n){var i=e.__style;if(T||i!==t){var s=zn(t);(!T||s!==e.getAttribute("style"))&&(s==null?e.removeAttribute("style"):e.style.cssText=s),e.__style=t}return n}const Zn=Symbol("is custom element"),Qn=Symbol("is html");function ei(e,t,r,n){var i=ti(e);T&&(i[t]=e.getAttribute(t),t==="src"||t==="srcset"||t==="href"&&e.nodeName==="LINK")||i[t]!==(i[t]=r)&&(t==="loading"&&(e[Vr]=r),r==null?e.removeAttribute(t):typeof r!="string"&&br(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function U(e,t,r){var n=m,i=w;let s=T;T&&ge(!1),F(null),G(null);try{t!=="style"&&(St.has(e.getAttribute("is")||e.nodeName)||!customElements||customElements.get(e.getAttribute("is")||e.tagName.toLowerCase())?br(e).includes(t):r&&typeof r=="object")?e[t]=r:ei(e,t,r==null?r:String(r))}finally{F(n),G(i),s&&ge(!0)}}function ti(e){return e.__attributes??={[Zn]:e.nodeName.includes("-"),[Qn]:e.namespaceURI===Lr}}var St=new Map;function br(e){var t=e.getAttribute("is")||e.nodeName,r=St.get(t);if(r)return r;St.set(t,r=[]);for(var n,i=e,s=Element.prototype;s!==i;){n=Fr(i);for(var a in n)n[a].set&&r.push(a);i=Rt(i)}return r}function Er(e,t,r,n){var i=n,s=!0,a=()=>(s&&(s=!1,i=n),i),o;o=e[t],o===void 0&&n!==void 0&&(o=a());var l;l=()=>{var _=e[t];return _===void 0?a():(s=!0,_)};var u=!1,f=Ht(()=>(u=!1,l())),d=w;return(function(_,h){if(arguments.length>0){const v=h?c(f):_;return b(f,v),u=!0,i!==void 0&&(i=v),_}return ue&&u||(d.f&ne)!==0?f.v:c(f)})}function ri(e){return new ni(e)}class ni{#t;#e;constructor(t){var r=new Map,n=(s,a)=>{var o=yn(a,!1,!1);return r.set(s,o),o};const i=new Proxy({...t.props||{},$$events:{}},{get(s,a){return c(r.get(a)??n(a,Reflect.get(s,a)))},has(s,a){return a===Jr?!0:(c(r.get(a)??n(a,Reflect.get(s,a))),Reflect.has(s,a))},set(s,a,o){return b(r.get(a)??n(a,o),o),Reflect.set(s,a,o)}});this.#e=(t.hydrate?Wn:yr)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover}),(!t?.props?.$$host||t.sync===!1)&&_t(),this.#t=i.$$events;for(const s of Object.keys(this.#e))s==="$set"||s==="$destroy"||s==="$on"||_e(this,s,{get(){return this.#e[s]},set(a){this.#e[s]=a},enumerable:!0});this.#e.$set=s=>{Object.assign(i,s)},this.#e.$destroy=()=>{Xn(this.#e)}}$set(t){this.#e.$set(t)}$on(t,r){this.#t[t]=this.#t[t]||[];const n=(...i)=>r.call(this,...i);return this.#t[t].push(n),()=>{this.#t[t]=this.#t[t].filter(i=>i!==n)}}$destroy(){this.#e.$destroy()}}let Sr;typeof HTMLElement=="function"&&(Sr=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;constructor(e,t,r){super(),this.$$ctor=e,this.$$s=t,r&&this.attachShadow({mode:"open"})}addEventListener(e,t,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){const n=this.$$c.$on(e,t);this.$$l_u.set(t,n)}super.addEventListener(e,t,r)}removeEventListener(e,t,r){if(super.removeEventListener(e,t,r),this.$$c){const n=this.$$l_u.get(t);n&&(n(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(n){return i=>{const s=document.createElement("slot");n!=="default"&&(s.name=n),mr(i,s)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const t={},r=ii(this);for(const n of this.$$s)n in r&&(n==="default"&&!this.$$d.children?(this.$$d.children=e(n),t.default=!0):t[n]=e(n));for(const n of this.attributes){const i=this.$$g_p(n.name);i in this.$$d||(this.$$d[i]=Ge(i,n.value,this.$$p_d,"toProp"))}for(const n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=ri({component:this.$$ctor,target:this.shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=On(()=>{Cn(()=>{this.$$r=!0;for(const n of Le(this.$$c)){if(!this.$$p_d[n]?.reflect)continue;this.$$d[n]=this.$$c[n];const i=Ge(n,this.$$d[n],this.$$p_d,"toAttribute");i==null?this.removeAttribute(this.$$p_d[n].attribute||n):this.setAttribute(this.$$p_d[n].attribute||n,i)}this.$$r=!1})});for(const n in this.$$l)for(const i of this.$$l[n]){const s=this.$$c.$on(n,i);this.$$l_u.set(i,s)}this.$$l={}}}attributeChangedCallback(e,t,r){this.$$r||(e=this.$$g_p(e),this.$$d[e]=Ge(e,r,this.$$p_d,"toProp"),this.$$c?.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return Le(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function Ge(e,t,r,n){const i=r[e]?.type;if(t=i==="Boolean"&&typeof t!="boolean"?t!=null:t,!n||!r[e])return t;if(n==="toAttribute")switch(i){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(i){case"Object":case"Array":return t&&JSON.parse(t);case"Boolean":return t;case"Number":return t!=null?+t:t;default:return t}}function ii(e){const t={};return e.childNodes.forEach(r=>{t[r.slot||"default"]=!0}),t}function si(e,t,r,n,i,s){let a=class extends Sr{constructor(){super(e,r,i),this.$$p_d=t}static get observedAttributes(){return Le(t).map(o=>(t[o].attribute||o).toLowerCase())}};return Le(t).forEach(o=>{_e(a.prototype,o,{get(){return this.$$c&&o in this.$$c?this.$$c[o]:this.$$d[o]},set(l){l=Ge(o,l,t),this.$$d[o]=l;var u=this.$$c;if(u){var f=he(u,o)?.get;f?u[o]=l:u.$set({[o]:l})}}})}),n.forEach(o=>{_e(a.prototype,o,{get(){return this.$$c?.[o]}})}),e.element=a,a}const Nr={version:"0.60.0"};function li(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Se={},Nt,Tr;function ai(){if(Tr)return Nt;Tr=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,n=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,l=`
3
+ `,u="/",f="*",d="",_="comment",h="declaration";Nt=function(g,L){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];L=L||{};var C=1,S=1;function Je($){var p=$.match(t);p&&(C+=p.length);var A=$.lastIndexOf(l);S=~A?$.length-A:S+$.length}function Ve(){var $={line:C,column:S};return function(p){return p.position=new We($),Ke(),p}}function We($){this.start=$,this.end={line:C,column:S},this.source=L.source}We.prototype.content=g;function Xe($){var p=new Error(L.source+":"+C+":"+S+": "+$);if(p.reason=$,p.filename=L.source,p.line=C,p.column=S,p.source=g,!L.silent)throw p}function de($){var p=$.exec(g);if(p){var A=p[0];return Je(A),g=g.slice(A.length),p}}function Ke(){de(r)}function ze($){var p;for($=$||[];p=Ce();)p!==!1&&$.push(p);return $}function Ce(){var $=Ve();if(!(u!=g.charAt(0)||f!=g.charAt(1))){for(var p=2;d!=g.charAt(p)&&(f!=g.charAt(p)||u!=g.charAt(p+1));)++p;if(p+=2,d===g.charAt(p-1))return Xe("End of comment missing");var A=g.slice(2,p-2);return S+=2,Je(A),g=g.slice(p),S+=2,$({type:_,comment:A})}}function Pe(){var $=Ve(),p=de(n);if(p){if(Ce(),!de(i))return Xe("property missing ':'");var A=de(s),Ie=$({type:h,property:v(p[0].replace(e,d)),value:A?v(A[0].replace(e,d)):d});return de(a),Ie}}function Ze(){var $=[];ze($);for(var p;p=Pe();)p!==!1&&($.push(p),ze($));return $}return Ke(),Ze()};function v(g){return g?g.replace(o,d):d}return Nt}var xr;function oi(){if(xr)return Se;xr=1;var e=Se&&Se.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Se,"__esModule",{value:!0}),Se.default=r;var t=e(ai());function r(n,i){var s=null;if(!n||typeof n!="string")return s;var a=(0,t.default)(n),o=typeof i=="function";return a.forEach(function(l){if(l.type==="declaration"){var u=l.property,f=l.value;o?i(u,f,l):f&&(s=s||{},s[u]=f)}}),s}return Se}var ui=oi();const Or=li(ui);Or.default;function kr(e){const t=e?.repoName.split("/")?.[1]||e?.repoName;if(!t)throw new Error("wrong componentPath "+e?.repoName);if(!e?.version)throw new Error("wrong version "+e?.version);const r=e?.iifePath||"main.iife.js";if(!document.getElementById(t+"-script"))try{const n=document.createElement("script");if(n.id=t+"-script",n.src=`https://cdn.jsdelivr.net/npm/${e.repoName}@${e.version}/${r}`,e?.local)n.src=`${e.local}`;else if(location.href.includes("localhost:6006")){const i=t.split("-")[0];n.src=`http://localhost:6006/webcomponents/${t.replace(i+"-","")}/${r}`}document.head.appendChild(n)}catch(n){console.warn(n)}}var fi=(e,t)=>t("eraser"),ci=(e,t)=>t("select"),di=(e,t)=>t("draw"),_i=(e,t)=>t(),hi=(e,t)=>t(),vi=(e,t)=>t(),pi=Gn('<div part="controller" id="controller" class="svelte-14wiqdf"><button>clear</button> <button>select</button> <button>draw</button> <button>undo</button> <button>redo</button> <button>save</button> <button>brush</button> <br/>load:<hb-input-file></hb-input-file> insert:<hb-input-file></hb-input-file></div> <div part="paper-container" id="paper-container" style="position:relative" class="svelte-14wiqdf"><hb-stylus-paper></hb-stylus-paper></div>',3);const gi={hash:"svelte-14wiqdf",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;position:absolute;width:100%;height:100%;display:block;display:grid;grid-template-areas:"header" "paper";grid-template-columns:1fr;grid-template-rows:auto 1fr;}#controller.svelte-14wiqdf {grid-area:header;}#paper-container.svelte-14wiqdf {grid-area:paper;background:green;}'};function Rr(e,t){Ft(t,!0),Kn(e,gi);let r=Er(t,"id",7,""),n=Er(t,"load_draw"),i=E("draw");me({});let s=E(""),a=E(""),o=E(0),l=E(void 0),u=E(!1),f=E(!1),d=E(!1),_=E(void 0),h=E(void 0),v=E(void 0),g;xn(()=>{if((c(l)===0||c(l))&&c(l)<c(o)?b(f,!0):b(f,!1),(c(o)||c(o)===0)&&c(d)&&(!c(l)||c(l)!==-1)&&(!g||g<c(o)&&(!c(l)||c(l)<g))?b(u,!0):b(u,!1),typeof n()=="string"&&n()?.length)try{n(JSON.parse(n()))}catch(y){console.error("error parsing json",y)}}),kr({repoName:"@htmlbricks/hb-stylus-paper",version:Nr.version}),kr({repoName:"@htmlbricks/hb-input-file",version:Nr.version});function L(y,re){var X="data:text/json;charset=utf-8,"+encodeURIComponent(JSON.stringify(y)),j=document.createElement("a");j.setAttribute("href",X),j.setAttribute("download",re),document.body.appendChild(j),j.click(),j.remove()}function C(y){b(i,y,!0)}function S(){console.log("ch",c(o),c(l)),c(o)>=0&&(!c(l)||c(l)>-1)&&(b(l,c(l)||c(l)===0?c(l)-1:c(o)-1,!0),console.log("undo",c(o),c(l)))}function Je(){console.log(c(o),c(l)),(c(l)||c(l)===0)&&c(l)<=c(o)&&($n(l),console.log("redo",c(o),c(l)))}function Ve(y){c(d)||b(d,!0),console.log("h",y),b(o,y.index-1),y.start_index&&(g=y.start_index),b(l,void 0)}function We(){b(_,{name:"test",type:"json"},!0)}function Xe(y){const re=y.value?.name;if(re){const X=new FileReader;X.readAsDataURL(y.value),X.onload=function(j){try{if(console.log("insert file",j.target,j.target?.result),j.target?.result){const mi=j.target.result.toString().split(";")[0].split("/")[1];b(h,{base64:j.target.result.toString(),type:mi,name:re},!0)}}catch{console.error("error loading file")}},X.onerror=function(j){console.error("error reading file")}}}function de(y){console.log("save",y),b(_,void 0),L(y,y.name+".json")}function Ke(y){if(console.log("file",y),y.value.name){const re=new FileReader;re.readAsText(y.value,"UTF-8"),re.onload=function(X){if(X?.target?.result?.toString())try{n(JSON.parse(X.target.result.toString()))}catch{console.error("error loading file")}},re.onerror=function(X){console.error("error reading file")}}}var ze={get id(){return r()},set id(y=""){r(y),_t()},get load_draw(){return n()},set load_draw(y){n(y),_t()}},Ce=pi(),Pe=bn(Ce),Ze=nr(Pe);Ze.__click=[fi,C];var $=J(Ze,2);$.__click=[ci,C];var p=J($,2);p.__click=[di,C];var A=J(p,2);A.__click=[_i,S];var Ie=J(A,2);Ie.__click=[hi,Je];var Tt=J(Ie,2);Tt.__click=[vi,We];var Ar=J(Tt,2),Me=J(Ar,4);U(Me,"id","loadfile"),Et(Me,c(a)),U(Me,"schemaentry",JSON.stringify({label:"ciao",id:"xxxxxxx"}));var Qe=J(Me,2);U(Qe,"id","insertfile"),Et(Qe,c(a)),U(Qe,"schemaentry",JSON.stringify({label:"ciao"})),jt(Pe);var Cr=J(Pe,2),H=nr(Cr);return U(H,"id","stylus-paper"),oe(()=>U(H,"goto",c(l))),Et(H,c(s)),U(H,"background_color","green"),oe(()=>U(H,"mode",c(i))),oe(()=>U(H,"save_as",c(_)?JSON.stringify(c(_)):"")),oe(()=>U(H,"load_draw",n()?JSON.stringify(n()):null)),oe(()=>U(H,"insert_image",c(h)?JSON.stringify(c(h)):null)),oe(()=>U(H,"insert_text",c(v)?JSON.stringify(c(v)):null)),jt(Cr),oe(()=>{A.disabled=!c(u),Ie.disabled=!c(f),Tt.disabled=!c(u),Ar.disabled=c(i)!=="draw"}),He("setVal",Me,y=>Ke(y.detail)),He("setVal",Qe,y=>Xe(y.detail)),He("historyIndex",H,y=>Ve(y.detail)),He("save",H,y=>de(y.detail)),mr(e,Ce),qt(ze)}Bn(["click"]),customElements.define("hb-stylus-notebook",si(Rr,{id:{},load_draw:{}},[],[],!0)),xt.Component=Rr,Object.defineProperty(xt,Symbol.toStringTag,{value:"Module"})})(this["stylus-notebook"]=this["stylus-notebook"]||{});
3
4
  //# sourceMappingURL=main.iife.js.map