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