@nuralyui/document 0.0.4 → 0.0.5

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/bundle.js ADDED
@@ -0,0 +1,234 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ const t=window,i=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),e=new WeakMap;class o{constructor(t,i,e){if(this._$cssResult$=!0,e!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i}get styleSheet(){let t=this.o;const s=this.t;if(i&&void 0===t){const i=void 0!==s&&1===s.length;i&&(t=e.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&e.set(s,t))}return t}toString(){return this.cssText}}const n=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let i="";for(const s of t.cssRules)i+=s.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,s))(i)})(t):t
7
+ /**
8
+ * @license
9
+ * Copyright 2017 Google LLC
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */;var r;const h=window,l=h.trustedTypes,d=l?l.emptyScript:"",a=h.reactiveElementPolyfillSupport,c={toAttribute(t,i){switch(i){case Boolean:t=t?d:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},u=(t,i)=>i!==t&&(i==i||t==t),v={attribute:!0,type:String,converter:c,reflect:!1,hasChanged:u},p="finalized";class f extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var i;this.finalize(),(null!==(i=this.h)&&void 0!==i?i:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,s)=>{const e=this._$Ep(s,i);void 0!==e&&(this._$Ev.set(e,s),t.push(e))})),t}static createProperty(t,i=v){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const s="symbol"==typeof t?Symbol():"__"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e)}}static getPropertyDescriptor(t,i,s){return{get(){return this[i]},set(e){const o=this[t];this[i]=e,this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||v}static finalize(){if(this.hasOwnProperty(p))return!1;this[p]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of i)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const i=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)i.unshift(n(t))}else void 0!==t&&i.push(n(t));return i}static _$Ep(t,i){const s=i.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var i,s;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t))}removeController(t){var i;null===(i=this._$ES)||void 0===i||i.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i])}))}createRenderRoot(){var s;const e=null!==(s=this.shadowRoot)&&void 0!==s?s:this.attachShadow(this.constructor.shadowRootOptions);return((s,e)=>{i?s.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((i=>{const e=document.createElement("style"),o=t.litNonce;void 0!==o&&e.setAttribute("nonce",o),e.textContent=i.cssText,s.appendChild(e)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}))}attributeChangedCallback(t,i,s){this._$AK(t,s)}_$EO(t,i,s=v){var e;const o=this.constructor._$Ep(t,s);if(void 0!==o&&!0===s.reflect){const n=(void 0!==(null===(e=s.converter)||void 0===e?void 0:e.toAttribute)?s.converter:c).toAttribute(i,s.type);this._$El=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$El=null}}_$AK(t,i){var s;const e=this.constructor,o=e._$Ev.get(t);if(void 0!==o&&this._$El!==o){const t=e.getPropertyOptions(o),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(s=t.converter)||void 0===s?void 0:s.fromAttribute)?t.converter:c;this._$El=o,this[o]=n.fromAttribute(i,t.type),this._$El=null}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||u)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):e=!1),!this.isUpdatePending&&e&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,i)=>this[i]=t)),this._$Ei=void 0);let i=!1;const s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(s)):this._$Ek()}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(s)}willUpdate(t){}_$AE(t){var i;null===(i=this._$ES)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,i)=>this._$EO(i,this[i],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}
12
+ /**
13
+ * @license
14
+ * Copyright 2017 Google LLC
15
+ * SPDX-License-Identifier: BSD-3-Clause
16
+ */
17
+ var g;f[p]=!0,f.elementProperties=new Map,f.elementStyles=[],f.shadowRootOptions={mode:"open"},null==a||a({ReactiveElement:f}),(null!==(r=h.reactiveElementVersions)&&void 0!==r?r:h.reactiveElementVersions=[]).push("1.6.3");const m=window,b=m.trustedTypes,y=b?b.createPolicy("lit-html",{createHTML:t=>t}):void 0,w="$lit$",$=`lit$${(Math.random()+"").slice(9)}$`,x="?"+$,A=`<${x}>`,S=document,N=()=>S.createComment(""),j=t=>null===t||"object"!=typeof t&&"function"!=typeof t,E=Array.isArray,C="[ \t\n\f\r]",M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,k=/-->/g,D=/>/g,I=RegExp(`>|${C}(?:([^\\s"'>=/]+)(${C}*=${C}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),_=/'/g,z=/"/g,L=/^(?:script|style|textarea|title)$/i,U=Symbol.for("lit-noChange"),O=Symbol.for("lit-nothing"),T=new WeakMap,R=S.createTreeWalker(S,129,null,!1);function P(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==y?y.createHTML(i):i}class V{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let o=0,n=0;const r=t.length-1,h=this.parts,[l,d]=((t,i)=>{const s=t.length-1,e=[];let o,n=2===i?"<svg>":"",r=M;for(let i=0;i<s;i++){const s=t[i];let h,l,d=-1,a=0;for(;a<s.length&&(r.lastIndex=a,l=r.exec(s),null!==l);)a=r.lastIndex,r===M?"!--"===l[1]?r=k:void 0!==l[1]?r=D:void 0!==l[2]?(L.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=I):void 0!==l[3]&&(r=I):r===I?">"===l[0]?(r=null!=o?o:M,d=-1):void 0===l[1]?d=-2:(d=r.lastIndex-l[2].length,h=l[1],r=void 0===l[3]?I:'"'===l[3]?z:_):r===z||r===_?r=I:r===k||r===D?r=M:(r=I,o=void 0);const c=r===I&&t[i+1].startsWith("/>")?" ":"";n+=r===M?s+A:d>=0?(e.push(h),s.slice(0,d)+w+s.slice(d)+$+c):s+$+(-2===d?(e.push(void 0),i):c)}return[P(t,n+(t[s]||"<?>")+(2===i?"</svg>":"")),e]})(t,i);if(this.el=V.createElement(l,s),R.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=R.nextNode())&&h.length<r;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith(w)||i.startsWith($)){const s=d[n++];if(t.push(i),void 0!==s){const t=e.getAttribute(s.toLowerCase()+w).split($),i=/([.?@])?(.*)/.exec(s);h.push({type:1,index:o,name:i[2],strings:t,ctor:"."===i[1]?B:"?"===i[1]?F:"@"===i[1]?G:Q})}else h.push({type:6,index:o})}for(const i of t)e.removeAttribute(i)}if(L.test(e.tagName)){const t=e.textContent.split($),i=t.length-1;if(i>0){e.textContent=b?b.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],N()),R.nextNode(),h.push({type:2,index:++o});e.append(t[i],N())}}}else if(8===e.nodeType)if(e.data===x)h.push({type:2,index:o});else{let t=-1;for(;-1!==(t=e.data.indexOf($,t+1));)h.push({type:7,index:o}),t+=$.length-1}o++}}static createElement(t,i){const s=S.createElement("template");return s.innerHTML=t,s}}function Y(t,i,s=t,e){var o,n,r,h;if(i===U)return i;let l=void 0!==e?null===(o=s._$Co)||void 0===o?void 0:o[e]:s._$Cl;const d=j(i)?void 0:i._$litDirective$;return(null==l?void 0:l.constructor)!==d&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===d?l=void 0:(l=new d(t),l._$AT(t,s,e)),void 0!==e?(null!==(r=(h=s)._$Co)&&void 0!==r?r:h._$Co=[])[e]=l:s._$Cl=l),void 0!==l&&(i=Y(t,l._$AS(t,i.values),l,e)),i}class Z{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:S).importNode(s,!0);R.currentNode=o;let n=R.nextNode(),r=0,h=0,l=e[0];for(;void 0!==l;){if(r===l.index){let i;2===l.type?i=new H(n,n.nextSibling,this,t):1===l.type?i=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(i=new J(n,this,t)),this._$AV.push(i),l=e[++h]}r!==(null==l?void 0:l.index)&&(n=R.nextNode(),r++)}return R.currentNode=S,o}v(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class H{constructor(t,i,s,e){var o;this.type=2,this._$AH=O,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cp=null===(o=null==e?void 0:e.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===(null==t?void 0:t.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=Y(this,t,i),j(t)?t===O||null==t||""===t?(this._$AH!==O&&this._$AR(),this._$AH=O):t!==this._$AH&&t!==U&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>E(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==O&&j(this._$AH)?this._$AA.nextSibling.data=t:this.$(S.createTextNode(t)),this._$AH=t}g(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=V.createElement(P(e.h,e.h[0]),this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.v(s);else{const t=new Z(o,this),i=t.u(this.options);t.v(s),this.$(i),this._$AH=t}}_$AC(t){let i=T.get(t.strings);return void 0===i&&T.set(t.strings,i=new V(t)),i}T(t){E(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new H(this.k(N()),this.k(N()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cp=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class Q{constructor(t,i,s,e,o){this.type=1,this._$AH=O,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=O}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=Y(this,t,i,0),n=!j(t)||t!==this._$AH&&t!==U,n&&(this._$AH=t);else{const e=t;let r,h;for(t=o[0],r=0;r<o.length-1;r++)h=Y(this,e[s+r],i,r),h===U&&(h=this._$AH[r]),n||(n=!j(h)||h!==this._$AH[r]),h===O?t=O:t!==O&&(t+=(null!=h?h:"")+o[r+1]),this._$AH[r]=h}n&&!e&&this.j(t)}j(t){t===O?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class B extends Q{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===O?void 0:t}}const W=b?b.emptyScript:"";class F extends Q{constructor(){super(...arguments),this.type=4}j(t){t&&t!==O?this.element.setAttribute(this.name,W):this.element.removeAttribute(this.name)}}class G extends Q{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=Y(this,t,i,0))&&void 0!==s?s:O)===U)return;const e=this._$AH,o=t===O&&e!==O||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==O&&(e===O||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class J{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Y(this,t)}}const K=m.litHtmlPolyfillSupport;
18
+ /**
19
+ * @license
20
+ * Copyright 2017 Google LLC
21
+ * SPDX-License-Identifier: BSD-3-Clause
22
+ */
23
+ var q;null==K||K(V,H),(null!==(g=m.litHtmlVersions)&&void 0!==g?g:m.litHtmlVersions=[]).push("2.8.0");const X=window,tt=X.trustedTypes,it=tt?tt.createPolicy("lit-html",{createHTML:t=>t}):void 0,st="$lit$",et=`lit$${(Math.random()+"").slice(9)}$`,ot="?"+et,nt=`<${ot}>`,rt=document,ht=()=>rt.createComment(""),lt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,dt=Array.isArray,at="[ \t\n\f\r]",ct=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ut=/-->/g,vt=/>/g,pt=RegExp(`>|${at}(?:([^\\s"'>=/]+)(${at}*=${at}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),ft=/'/g,gt=/"/g,mt=/^(?:script|style|textarea|title)$/i,bt=(t=>(i,...s)=>({_$litType$:t,strings:i,values:s}))(1),yt=Symbol.for("lit-noChange"),wt=Symbol.for("lit-nothing"),$t=new WeakMap,xt=rt.createTreeWalker(rt,129,null,!1);function At(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==it?it.createHTML(i):i}const St=(t,i)=>{const s=t.length-1,e=[];let o,n=2===i?"<svg>":"",r=ct;for(let i=0;i<s;i++){const s=t[i];let h,l,d=-1,a=0;for(;a<s.length&&(r.lastIndex=a,l=r.exec(s),null!==l);)a=r.lastIndex,r===ct?"!--"===l[1]?r=ut:void 0!==l[1]?r=vt:void 0!==l[2]?(mt.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=pt):void 0!==l[3]&&(r=pt):r===pt?">"===l[0]?(r=null!=o?o:ct,d=-1):void 0===l[1]?d=-2:(d=r.lastIndex-l[2].length,h=l[1],r=void 0===l[3]?pt:'"'===l[3]?gt:ft):r===gt||r===ft?r=pt:r===ut||r===vt?r=ct:(r=pt,o=void 0);const c=r===pt&&t[i+1].startsWith("/>")?" ":"";n+=r===ct?s+nt:d>=0?(e.push(h),s.slice(0,d)+st+s.slice(d)+et+c):s+et+(-2===d?(e.push(void 0),i):c)}return[At(t,n+(t[s]||"<?>")+(2===i?"</svg>":"")),e]};class Nt{constructor({strings:t,_$litType$:i},s){let e;this.parts=[];let o=0,n=0;const r=t.length-1,h=this.parts,[l,d]=St(t,i);if(this.el=Nt.createElement(l,s),xt.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(e=xt.nextNode())&&h.length<r;){if(1===e.nodeType){if(e.hasAttributes()){const t=[];for(const i of e.getAttributeNames())if(i.endsWith(st)||i.startsWith(et)){const s=d[n++];if(t.push(i),void 0!==s){const t=e.getAttribute(s.toLowerCase()+st).split(et),i=/([.?@])?(.*)/.exec(s);h.push({type:1,index:o,name:i[2],strings:t,ctor:"."===i[1]?kt:"?"===i[1]?It:"@"===i[1]?_t:Mt})}else h.push({type:6,index:o})}for(const i of t)e.removeAttribute(i)}if(mt.test(e.tagName)){const t=e.textContent.split(et),i=t.length-1;if(i>0){e.textContent=tt?tt.emptyScript:"";for(let s=0;s<i;s++)e.append(t[s],ht()),xt.nextNode(),h.push({type:2,index:++o});e.append(t[i],ht())}}}else if(8===e.nodeType)if(e.data===ot)h.push({type:2,index:o});else{let t=-1;for(;-1!==(t=e.data.indexOf(et,t+1));)h.push({type:7,index:o}),t+=et.length-1}o++}}static createElement(t,i){const s=rt.createElement("template");return s.innerHTML=t,s}}function jt(t,i,s=t,e){var o,n,r,h;if(i===yt)return i;let l=void 0!==e?null===(o=s._$Co)||void 0===o?void 0:o[e]:s._$Cl;const d=lt(i)?void 0:i._$litDirective$;return(null==l?void 0:l.constructor)!==d&&(null===(n=null==l?void 0:l._$AO)||void 0===n||n.call(l,!1),void 0===d?l=void 0:(l=new d(t),l._$AT(t,s,e)),void 0!==e?(null!==(r=(h=s)._$Co)&&void 0!==r?r:h._$Co=[])[e]=l:s._$Cl=l),void 0!==l&&(i=jt(t,l._$AS(t,i.values),l,e)),i}class Et{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:rt).importNode(s,!0);xt.currentNode=o;let n=xt.nextNode(),r=0,h=0,l=e[0];for(;void 0!==l;){if(r===l.index){let i;2===l.type?i=new Ct(n,n.nextSibling,this,t):1===l.type?i=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(i=new zt(n,this,t)),this._$AV.push(i),l=e[++h]}r!==(null==l?void 0:l.index)&&(n=xt.nextNode(),r++)}return xt.currentNode=rt,o}v(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class Ct{constructor(t,i,s,e){var o;this.type=2,this._$AH=wt,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cp=null===(o=null==e?void 0:e.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===(null==t?void 0:t.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=jt(this,t,i),lt(t)?t===wt||null==t||""===t?(this._$AH!==wt&&this._$AR(),this._$AH=wt):t!==this._$AH&&t!==yt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>dt(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==wt&&lt(this._$AH)?this._$AA.nextSibling.data=t:this.$(rt.createTextNode(t)),this._$AH=t}g(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=Nt.createElement(At(e.h,e.h[0]),this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.v(s);else{const t=new Et(o,this),i=t.u(this.options);t.v(s),this.$(i),this._$AH=t}}_$AC(t){let i=$t.get(t.strings);return void 0===i&&$t.set(t.strings,i=new Nt(t)),i}T(t){dt(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new Ct(this.k(ht()),this.k(ht()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cp=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class Mt{constructor(t,i,s,e,o){this.type=1,this._$AH=wt,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=wt}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=jt(this,t,i,0),n=!lt(t)||t!==this._$AH&&t!==yt,n&&(this._$AH=t);else{const e=t;let r,h;for(t=o[0],r=0;r<o.length-1;r++)h=jt(this,e[s+r],i,r),h===yt&&(h=this._$AH[r]),n||(n=!lt(h)||h!==this._$AH[r]),h===wt?t=wt:t!==wt&&(t+=(null!=h?h:"")+o[r+1]),this._$AH[r]=h}n&&!e&&this.j(t)}j(t){t===wt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class kt extends Mt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===wt?void 0:t}}const Dt=tt?tt.emptyScript:"";class It extends Mt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==wt?this.element.setAttribute(this.name,Dt):this.element.removeAttribute(this.name)}}class _t extends Mt{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=jt(this,t,i,0))&&void 0!==s?s:wt)===yt)return;const e=this._$AH,o=t===wt&&e!==wt||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==wt&&(e===wt||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class zt{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){jt(this,t)}}const Lt=X.litHtmlPolyfillSupport;null==Lt||Lt(Nt,Ct),(null!==(q=X.litHtmlVersions)&&void 0!==q?q:X.litHtmlVersions=[]).push("2.8.0");
24
+ /**
25
+ * @license
26
+ * Copyright 2017 Google LLC
27
+ * SPDX-License-Identifier: BSD-3-Clause
28
+ */
29
+ var Ut,Ot;class Tt extends f{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,i;const s=super.createRenderRoot();return null!==(t=(i=this.renderOptions).renderBefore)&&void 0!==t||(i.renderBefore=s.firstChild),s}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let r=n._$litPart$;if(void 0===r){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=r=new Ct(i.insertBefore(ht(),t),t,void 0,null!=s?s:{})}return r._$AI(t),r})(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return yt}}Tt.finalized=!0,Tt._$litElement$=!0,null===(Ut=globalThis.litElementHydrateSupport)||void 0===Ut||Ut.call(globalThis,{LitElement:Tt});const Rt=globalThis.litElementPolyfillSupport;null==Rt||Rt({LitElement:Tt}),(null!==(Ot=globalThis.litElementVersions)&&void 0!==Ot?Ot:globalThis.litElementVersions=[]).push("3.3.3");
30
+ /**
31
+ * @license
32
+ * Copyright 2017 Google LLC
33
+ * SPDX-License-Identifier: BSD-3-Clause
34
+ */
35
+ const Pt=(t,i)=>"method"===i.kind&&i.descriptor&&!("value"in i.descriptor)?{...i,finisher(s){s.createProperty(i.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:i.key,initializer(){"function"==typeof i.initializer&&(this[i.key]=i.initializer.call(this))},finisher(s){s.createProperty(i.key,t)}},Vt=(t,i,s)=>{i.constructor.createProperty(s,t)};
36
+ /**
37
+ * @license
38
+ * Copyright 2017 Google LLC
39
+ * SPDX-License-Identifier: BSD-3-Clause
40
+ */function Yt(t){return(i,s)=>void 0!==s?Vt(t,i,s):Pt(t,i)
41
+ /**
42
+ * @license
43
+ * Copyright 2017 Google LLC
44
+ * SPDX-License-Identifier: BSD-3-Clause
45
+ */}function Zt(t){return Yt({...t,state:!0})}
46
+ /**
47
+ * @license
48
+ * Copyright 2021 Google LLC
49
+ * SPDX-License-Identifier: BSD-3-Clause
50
+ */var Ht;null===(Ht=window.HTMLSlotElement)||void 0===Ht||Ht.prototype.assignedElements;
51
+ /**
52
+ * @license
53
+ * Copyright 2017 Google LLC
54
+ * SPDX-License-Identifier: BSD-3-Clause
55
+ */
56
+ const Qt=1,Bt=t=>(...i)=>({_$litDirective$:t,values:i});class Wt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,i,s){this._$Ct=t,this._$AM=i,this._$Ci=s}_$AS(t,i){return this.update(t,i)}update(t,i){return this.render(...i)}}
57
+ /**
58
+ * @license
59
+ * Copyright 2018 Google LLC
60
+ * SPDX-License-Identifier: BSD-3-Clause
61
+ */const Ft=Bt(class extends Wt{constructor(t){var i;if(super(t),t.type!==Qt||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((i=>t[i])).join(" ")+" "}update(t,[i]){var s,e;if(void 0===this.it){this.it=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!(null===(s=this.nt)||void 0===s?void 0:s.has(t))&&this.it.add(t);return this.render(i)}const o=t.element.classList;this.it.forEach((t=>{t in i||(o.remove(t),this.it.delete(t))}));for(const t in i){const s=!!i[t];s===this.it.has(t)||(null===(e=this.nt)||void 0===e?void 0:e.has(t))||(s?(o.add(t),this.it.add(t)):(o.remove(t),this.it.delete(t)))}return U}}),Gt="important",Jt=" !"+Gt,Kt=Bt(class extends Wt{constructor(t){var i;if(super(t),t.type!==Qt||"style"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((i,s)=>{const e=t[s];return null==e?i:i+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`}),"")}update(t,[i]){const{style:s}=t.element;if(void 0===this.ht){this.ht=new Set;for(const t in i)this.ht.add(t);return this.render(i)}this.ht.forEach((t=>{null==i[t]&&(this.ht.delete(t),t.includes("-")?s.removeProperty(t):s[t]="")}));for(const t in i){const e=i[t];if(null!=e){this.ht.add(t);const i="string"==typeof e&&e.endsWith(Jt);t.includes("-")||i?s.setProperty(t,i?e.slice(0,-11):e,i?Gt:""):s[t]=e}}return U}}),qt=t=>class extends t{constructor(){super(...arguments),this.handleSystemThemeChange=()=>{this.closest("[data-theme]")||document.documentElement.hasAttribute("data-theme")||this.requestUpdate()}}connectedCallback(){super.connectedCallback(),this.setupThemeObserver(),this.setupDesignSystemObserver(),this.setupSystemThemeListener()}disconnectedCallback(){var t,i,s;super.disconnectedCallback(),null===(t=this.themeObserver)||void 0===t||t.disconnect(),null===(i=this.designSystemObserver)||void 0===i||i.disconnect(),null===(s=this.mediaQuery)||void 0===s||s.removeEventListener("change",this.handleSystemThemeChange)}get currentTheme(){var t,i;const s=(null===(t=this.closest("[data-theme]"))||void 0===t?void 0:t.getAttribute("data-theme"))||document.documentElement.getAttribute("data-theme");return s||((null===(i=window.matchMedia)||void 0===i?void 0:i.call(window,"(prefers-color-scheme: dark)").matches)?"dark":"light")}get currentDesignSystem(){var t;const i=(null===(t=this.closest("[design-system]"))||void 0===t?void 0:t.getAttribute("design-system"))||document.documentElement.getAttribute("design-system");return"carbon"===i?i:"default"}setupThemeObserver(){this.themeObserver=new MutationObserver((()=>{this.requestUpdate()})),this.themeObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}setupDesignSystemObserver(){this.designSystemObserver=new MutationObserver((()=>{this.requestUpdate()})),this.designSystemObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["design-system"]})}setupSystemThemeListener(){window.matchMedia&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.handleSystemThemeChange))}},Xt=()=>{var t;return void 0!==globalThis.litElementVersions||"undefined"!=typeof process&&"development"===(null===(t=process.env)||void 0===t?void 0:t.NODE_ENV)||"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname)},ti=t=>class extends t{constructor(){super(...arguments),this.requiredComponents=[]}validateDependencies(){if(Xt())for(const t of this.requiredComponents)if(!this.isComponentAvailable(t))throw new Error(`Required component "${t}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}. Example: import '@nuralyui/${t}';`)}validateDependenciesWithHandler(t){if(!Xt())return!0;let i=!0;for(const s of this.requiredComponents)if(!this.isComponentAvailable(s)){i=!1;const e=new Error(`Required component "${s}" is not registered. Please import and register the component before using ${this.tagName.toLowerCase()}.`);t?t(s,e):console.error(e.message)}return i}isComponentAvailable(t){return!!customElements.get(t)}getMissingDependencies(){return this.requiredComponents.filter((t=>!this.isComponentAvailable(t)))}areDependenciesAvailable(){return this.requiredComponents.every((t=>this.isComponentAvailable(t)))}addRequiredComponent(t){this.requiredComponents.includes(t)||this.requiredComponents.push(t)}removeRequiredComponent(t){const i=this.requiredComponents.indexOf(t);i>-1&&this.requiredComponents.splice(i,1)}},ii=t=>class extends t{dispatchCustomEvent(t,i){this.dispatchEvent(new CustomEvent(t,{detail:i,bubbles:!0,composed:!0}))}dispatchEventWithMetadata(t,i){var s;const e=Object.assign(Object.assign({},i),{timestamp:Date.now(),componentName:(null===(s=this.tagName)||void 0===s?void 0:s.toLowerCase())||"unknown"});this.dispatchCustomEvent(t,e)}dispatchInputEvent(t,i){const s=Object.assign({target:i.target||this,value:i.value,originalEvent:i.originalEvent},i);this.dispatchCustomEvent(t,s)}dispatchFocusEvent(t,i){const s=Object.assign({target:i.target||this,value:i.value,focused:i.focused,cursorPosition:i.cursorPosition,selectedText:i.selectedText},i);this.dispatchCustomEvent(t,s)}dispatchValidationEvent(t,i){var s;const e=Object.assign({target:i.target||this,value:i.value,isValid:null!==(s=i.isValid)&&void 0!==s&&s,error:i.error},i);this.dispatchCustomEvent(t,e)}dispatchActionEvent(t,i){const s=Object.assign({target:i.target||this,action:i.action,previousValue:i.previousValue,newValue:i.newValue},i);this.dispatchCustomEvent(t,s)}isReadonlyKeyAllowed(t){if(t.ctrlKey||t.metaKey){return["KeyA","KeyC"].includes(t.code)}return["Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)}isActivationKey(t){return"Enter"===t.key||" "===t.key}};
62
+ /**
63
+ * @license
64
+ * Copyright 2018 Google LLC
65
+ * SPDX-License-Identifier: BSD-3-Clause
66
+ */var si=((t,...i)=>{const e=1===t.length?t[0]:i.reduce(((i,s,e)=>i+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[e+1]),t[0]);return new o(e,t,s)})`
67
+ :host {
68
+ display: block;
69
+ }
70
+
71
+ .pdf-container {
72
+ display: flex;
73
+ flex-direction: column;
74
+ border: 1px solid #ccc;
75
+ border-radius: 4px;
76
+ overflow: hidden;
77
+ background-color: #f5f5f5;
78
+ position: relative;
79
+ }
80
+
81
+ .toolbar {
82
+ display: flex;
83
+ align-items: center;
84
+ padding: 8px;
85
+ background-color: #f0f0f0;
86
+ border-bottom: 1px solid #ddd;
87
+ gap: 8px;
88
+ }
89
+
90
+ .toolbar button {
91
+ background-color: #fff;
92
+ border: 1px solid #ccc;
93
+ border-radius: 4px;
94
+ padding: 4px 8px;
95
+ cursor: pointer;
96
+ font-size: 14px;
97
+ }
98
+
99
+ .toolbar button:hover {
100
+ background-color: #e6e6e6;
101
+ }
102
+
103
+ .toolbar button:disabled {
104
+ opacity: 0.5;
105
+ cursor: not-allowed;
106
+ }
107
+
108
+ .toolbar span {
109
+ margin: 0 4px;
110
+ font-size: 14px;
111
+ }
112
+
113
+ .canvas-container {
114
+ flex: 1;
115
+ overflow: auto;
116
+ display: flex;
117
+ justify-content: center;
118
+ align-items: flex-start;
119
+ background-color: #e0e0e0;
120
+ padding: 16px;
121
+ min-height: 200px;
122
+ }
123
+
124
+ canvas {
125
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
126
+ background-color: white;
127
+ }
128
+
129
+ .preview-modal {
130
+ position: fixed;
131
+ top: 0;
132
+ left: 0;
133
+ right: 0;
134
+ bottom: 0;
135
+ background-color: rgba(0, 0, 0, 0.8);
136
+ z-index: 1000;
137
+ display: flex;
138
+ justify-content: center;
139
+ align-items: center;
140
+ }
141
+
142
+ .preview-content {
143
+ position: relative;
144
+ display: flex;
145
+ flex-direction: column;
146
+ width: 90%;
147
+ height: 90%;
148
+ background-color: #f5f5f5;
149
+ border-radius: 8px;
150
+ overflow: hidden;
151
+ }
152
+
153
+ .preview-toolbar {
154
+ display: flex;
155
+ align-items: center;
156
+ padding: 12px;
157
+ background-color: #f0f0f0;
158
+ border-bottom: 1px solid #ddd;
159
+ gap: 12px;
160
+ }
161
+
162
+ .preview-toolbar button {
163
+ background-color: #fff;
164
+ border: 1px solid #ccc;
165
+ border-radius: 4px;
166
+ padding: 6px 12px;
167
+ cursor: pointer;
168
+ font-size: 16px;
169
+ }
170
+
171
+ .preview-toolbar span {
172
+ margin: 0 6px;
173
+ font-size: 16px;
174
+ }
175
+
176
+ .preview-close {
177
+ position: absolute;
178
+ top: 10px;
179
+ right: 10px;
180
+ background-color: transparent;
181
+ border: none;
182
+ font-size: 24px;
183
+ cursor: pointer;
184
+ z-index: 1010;
185
+ color: #333;
186
+ }
187
+
188
+ .preview-close:hover {
189
+ color: #000;
190
+ }
191
+
192
+ .preview-modal canvas {
193
+ max-width: 100%;
194
+ max-height: calc(100% - 60px); /* Account for toolbar height */
195
+ object-fit: contain;
196
+ margin: auto;
197
+ display: block;
198
+ flex: 1;
199
+ }
200
+ `,ei=function(t,i,s,e){for(var o,n=arguments.length,r=n<3?i:null===e?e=Object.getOwnPropertyDescriptor(i,s):e,h=t.length-1;h>=0;h--)(o=t[h])&&(r=(n<3?o(r):n>3?o(i,s,r):o(i,s))||r);return n>3&&r&&Object.defineProperty(i,s,r),r};let oi=class extends((t=>ti(qt(ii(t))))(Tt)){constructor(){super(...arguments),this.type="pdf",this.width="auto",this.height="500px",this.previewable=!1,this.block=!1,this.showPreview=!1,this.hasError=!1,this.defaultFallback="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIwIiBoZWlnaHQ9IjEyMCIgdmlld0JveD0iMCAwIDEyMCAxMjAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjEyMCIgaGVpZ2h0PSIxMjAiIGZpbGw9IiNFRkYxRjMiLz48cGF0aCBkPSJNNTkuNCA2Mi44VjgwLjRINDguMlY0MS42SDYzLjRDNjcuMSA0MS42IDcwLjEgNDIuNiA3Mi40IDQ0LjdDNzQuNyA0Ni44IDc1LjggNDkuNiA3NS44IDUzQzc1LjggNTYuNSA3NC43IDU5LjIgNzIuNCA2MS4zQzcwLjIgNjMuNCA2Ny4yIDY0LjQgNjMuNCA2NC40SDU5LjRWNjIuOFpNNTkuNCA1NC42SDYzLjRDNjUgNTQuNiA2Ni4zIDU0LjEgNjcuMiA1M0M2OC4xIDUxLjkgNjguNiA1MC42IDY4LjYgNDlDNjguNiA0Ny41IDY4LjEgNDYuMiA2Ny4yIDQ1LjFDNjYuMyA0NCA2NSA0My40IDYzLjQgNDMuNEg1OS40VjU0LjZaIiBmaWxsPSIjNjg3Nzg3Ii8+PC9zdmc+"}handleError(){this.hasError=!0,this.dispatchEvent(new CustomEvent("nr-document-error",{bubbles:!0,composed:!0,detail:{error:`Error loading document: ${this.src}`,src:this.src,type:this.type}}))}handleLoad(){this.dispatchEvent(new CustomEvent("nr-document-load",{bubbles:!0,composed:!0,detail:{src:this.src,type:this.type}}))}showPreviewModal(){this.previewable&&!this.hasError&&(this.showPreview=!0,this.dispatchEvent(new CustomEvent("nr-document-preview-open",{bubbles:!0,composed:!0,detail:{src:this.src,type:this.type}})))}closePreviewModal(){this.showPreview=!1,this.dispatchEvent(new CustomEvent("nr-document-preview-close",{bubbles:!0,composed:!0,detail:{src:this.src,type:this.type}}))}render(){const t={"document-container":!0,"document--error":this.hasError},i={width:"number"==typeof this.width?`${this.width}px`:this.width,height:"number"==typeof this.height?`${this.height}px`:this.height};return this.hasError?bt`
201
+ <div class=${Ft(t)} style=${Kt(i)}>
202
+ <div class="error-message">
203
+ <img class="error-icon" src=${this.defaultFallback} alt="Document error" />
204
+ <p>Unable to load document</p>
205
+ </div>
206
+ </div>
207
+ `:bt`
208
+ <div class=${Ft(t)} style=${Kt(i)}>
209
+ <iframe
210
+ class="document-iframe"
211
+ src=${this.src}
212
+ @error=${this.handleError}
213
+ @load=${this.handleLoad}
214
+ title="Document viewer"
215
+ ></iframe>
216
+ ${this.previewable?bt`
217
+ <button class="preview-button" @click=${this.showPreviewModal}>
218
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
219
+ <path d="M5.5 5.5A.5.5 0 0 1 6 6v3a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0V6z"/>
220
+ <path d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H2zM1 2a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2z"/>
221
+ </svg>
222
+ Fullscreen
223
+ </button>
224
+ `:""}
225
+ ${this.showPreview?bt`
226
+ <div class="preview-modal">
227
+ <div class="preview-header">
228
+ <button class="preview-close" @click=${this.closePreviewModal} aria-label="Close preview">×</button>
229
+ </div>
230
+ <iframe src=${this.src} title="Document viewer fullscreen"></iframe>
231
+ </div>
232
+ `:""}
233
+ </div>
234
+ `}};oi.styles=si,ei([Yt({type:String})],oi.prototype,"src",void 0),ei([Yt({type:String})],oi.prototype,"type",void 0),ei([Yt({type:String})],oi.prototype,"width",void 0),ei([Yt({type:String})],oi.prototype,"height",void 0),ei([Yt({type:Boolean})],oi.prototype,"previewable",void 0),ei([Yt({type:Boolean,reflect:!0})],oi.prototype,"block",void 0),ei([Zt()],oi.prototype,"showPreview",void 0),ei([Zt()],oi.prototype,"hasError",void 0),oi=ei([(t=>i=>"function"==typeof i?((t,i)=>(customElements.define(t,i),i))(t,i):((t,i)=>{const{kind:s,elements:e}=i;return{kind:s,elements:e,finisher(i){customElements.define(t,i)}}})(t,i))("nr-document")],oi);export{oi as NrDocumentElement};
@@ -1,17 +1,27 @@
1
1
  import { LitElement } from "lit";
2
- export declare class HyPdfViewer extends LitElement {
2
+ import { DocumentType } from "./document.types.js";
3
+ declare const NrDocumentElement_base: (new (...args: any[]) => import("../../shared/dependency-mixin.js").DependencyAware) & (new (...args: any[]) => import("../../shared/theme-mixin.js").ThemeAware) & (new (...args: any[]) => import("../../shared/event-handler-mixin.js").EventHandlerCapable) & typeof LitElement;
4
+ export declare class NrDocumentElement extends NrDocumentElement_base {
5
+ static styles: import("lit").CSSResult;
3
6
  src: string;
7
+ type: DocumentType;
4
8
  width: string;
5
9
  height: string;
6
- fallback: null;
7
10
  previewable: boolean;
8
- private isFullscreen;
9
- defaultFallBack: string;
10
- static styles: import("lit").CSSResult;
11
+ block: boolean;
12
+ private showPreview;
13
+ private hasError;
14
+ private readonly defaultFallback;
15
+ private handleError;
16
+ private handleLoad;
17
+ private showPreviewModal;
18
+ private closePreviewModal;
11
19
  render(): import("lit").TemplateResult<1>;
12
- _handleError(e: Event): void;
13
- _openFullscreen(): void;
14
- _closeFullscreen(): void;
15
- disconnectedCallback(): void;
16
20
  }
21
+ declare global {
22
+ interface HTMLElementTagNameMap {
23
+ 'nr-document': NrDocumentElement;
24
+ }
25
+ }
26
+ export {};
17
27
  //# sourceMappingURL=document.component.d.ts.map
@@ -4,223 +4,133 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { LitElement, html, css } from "lit";
7
+ import { html, LitElement } from "lit";
8
8
  import { customElement, property, state } from "lit/decorators.js";
9
- let HyPdfViewer = class HyPdfViewer extends LitElement {
9
+ import { classMap } from "lit/directives/class-map.js";
10
+ import { styleMap } from "lit/directives/style-map.js";
11
+ import { NuralyUIBaseMixin } from "../../shared/base-mixin.js";
12
+ import styles from "./document.style.js";
13
+ let NrDocumentElement = class NrDocumentElement extends NuralyUIBaseMixin(LitElement) {
10
14
  constructor() {
11
15
  super(...arguments);
16
+ this.type = "pdf" /* DocumentType.PDF */;
12
17
  this.width = 'auto';
13
- this.height = 'auto';
14
- this.fallback = null;
18
+ this.height = '500px';
15
19
  this.previewable = false;
16
- this.isFullscreen = false;
17
- this.defaultFallBack = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAxMjAgMTIwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KPHJlY3Qgd2lkdGg9IjEyMCIgaGVpZ2h0PSIxMjAiIGZpbGw9IiNFRkYxRjMiLz4NCjxwYXRoIGQ9Ik01OS40IDYyLjhWODAuNEg0OC4yVjQxLjZINjMuNEM2Ny4xIDQxLjYgNzAuMSA0Mi42IDcyLjQgNDQuN0M3NC43IDQ2LjggNzUuOCA0OS42IDc1LjggNTNDNzUuOCA1Ni41IDc0LjcgNTkuMiA3Mi40IDYxLjNDNzAuMiA2My40IDY3LjIgNjQuNCA2My40IDY0LjRINTkuNFY2Mi44Wk01OS40IDU0LjZINjMuNEM2NSA1NC42IDY2LjMgNTQuMSA2Ny4yIDUzQzY4LjEgNTEuOSA2OC42IDUwLjYgNjguNiA0OUM2OC42IDQ3LjUgNjguMSA0Ni4yIDY3LjIgNDUuMUM2Ni4zIDQ0IDY1IDQzLjQgNjMuNCA0My40SDU5LjRWNTQuNloiIGZpbGw9IiM2ODc3ODciLz4NCjwvc3ZnPg==';
20
+ this.block = false;
21
+ this.showPreview = false;
22
+ this.hasError = false;
23
+ this.defaultFallback = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIwIiBoZWlnaHQ9IjEyMCIgdmlld0JveD0iMCAwIDEyMCAxMjAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjEyMCIgaGVpZ2h0PSIxMjAiIGZpbGw9IiNFRkYxRjMiLz48cGF0aCBkPSJNNTkuNCA2Mi44VjgwLjRINDguMlY0MS42SDYzLjRDNjcuMSA0MS42IDcwLjEgNDIuNiA3Mi40IDQ0LjdDNzQuNyA0Ni44IDc1LjggNDkuNiA3NS44IDUzQzc1LjggNTYuNSA3NC43IDU5LjIgNzIuNCA2MS4zQzcwLjIgNjMuNCA2Ny4yIDY0LjQgNjMuNCA2NC40SDU5LjRWNjIuOFpNNTkuNCA1NC42SDYzLjRDNjUgNTQuNiA2Ni4zIDU0LjEgNjcuMiA1M0M2OC4xIDUxLjkgNjguNiA1MC42IDY4LjYgNDlDNjguNiA0Ny41IDY4LjEgNDYuMiA2Ny4yIDQ1LjFDNjYuMyA0NCA2NSA0My40IDYzLjQgNDMuNEg1OS40VjU0LjZaIiBmaWxsPSIjNjg3Nzg3Ii8+PC9zdmc+';
24
+ }
25
+ handleError() {
26
+ this.hasError = true;
27
+ this.dispatchEvent(new CustomEvent('nr-document-error', {
28
+ bubbles: true,
29
+ composed: true,
30
+ detail: { error: `Error loading document: ${this.src}`, src: this.src, type: this.type }
31
+ }));
32
+ }
33
+ handleLoad() {
34
+ this.dispatchEvent(new CustomEvent('nr-document-load', {
35
+ bubbles: true,
36
+ composed: true,
37
+ detail: { src: this.src, type: this.type }
38
+ }));
39
+ }
40
+ showPreviewModal() {
41
+ if (this.previewable && !this.hasError) {
42
+ this.showPreview = true;
43
+ this.dispatchEvent(new CustomEvent('nr-document-preview-open', {
44
+ bubbles: true,
45
+ composed: true,
46
+ detail: { src: this.src, type: this.type }
47
+ }));
48
+ }
49
+ }
50
+ closePreviewModal() {
51
+ this.showPreview = false;
52
+ this.dispatchEvent(new CustomEvent('nr-document-preview-close', {
53
+ bubbles: true,
54
+ composed: true,
55
+ detail: { src: this.src, type: this.type }
56
+ }));
18
57
  }
19
58
  render() {
59
+ const containerClasses = {
60
+ 'document-container': true,
61
+ 'document--error': this.hasError
62
+ };
63
+ const containerStyles = {
64
+ width: typeof this.width === 'number' ? `${this.width}px` : this.width,
65
+ height: typeof this.height === 'number' ? `${this.height}px` : this.height,
66
+ };
67
+ if (this.hasError) {
68
+ return html `
69
+ <div class=${classMap(containerClasses)} style=${styleMap(containerStyles)}>
70
+ <div class="error-message">
71
+ <img class="error-icon" src=${this.defaultFallback} alt="Document error" />
72
+ <p>Unable to load document</p>
73
+ </div>
74
+ </div>
75
+ `;
76
+ }
20
77
  return html `
21
- <div class="pdf-container" style="width:${this.width}; height:${this.height};">
22
- <iframe
23
- class="pdf-iframe"
24
- src="${this.src}"
25
- title="PDF Viewer"
26
- @error=${this._handleError}
78
+ <div class=${classMap(containerClasses)} style=${styleMap(containerStyles)}>
79
+ <iframe
80
+ class="document-iframe"
81
+ src=${this.src}
82
+ @error=${this.handleError}
83
+ @load=${this.handleLoad}
84
+ title="Document viewer"
27
85
  ></iframe>
28
-
29
86
  ${this.previewable ? html `
30
- <button class="preview-button" @click=${this._openFullscreen}>
31
- <svg width="14" height="14" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
32
- <path d="M5.5 1H1.5C1.22386 1 1 1.22386 1 1.5V5.5C1 5.77614 1.22386 6 1.5 6C1.77614 6 2 5.77614 2 5.5V2H5.5C5.77614 2 6 1.77614 6 1.5C6 1.22386 5.77614 1 5.5 1Z" fill="currentColor"/>
33
- <path d="M14.5 1H10.5C10.2239 1 10 1.22386 10 1.5C10 1.77614 10.2239 2 10.5 2H14V5.5C14 5.77614 14.2239 6 14.5 6C14.7761 6 15 5.77614 15 5.5V1.5C15 1.22386 14.7761 1 14.5 1Z" fill="currentColor"/>
34
- <path d="M5.5 14H2V10.5C2 10.2239 1.77614 10 1.5 10C1.22386 10 1 10.2239 1 10.5V14.5C1 14.7761 1.22386 15 1.5 15H5.5C5.77614 15 6 14.7761 6 14.5C6 14.2239 5.77614 14 5.5 14Z" fill="currentColor"/>
35
- <path d="M14.5 10C14.2239 10 14 10.2239 14 10.5V14H10.5C10.2239 14 10 14.2239 10 14.5C10 14.7761 10.2239 15 10.5 15H14.5C14.7761 15 15 14.7761 15 14.5V10.5C15 10.2239 14.7761 10 14.5 10Z" fill="currentColor"/>
87
+ <button class="preview-button" @click=${this.showPreviewModal}>
88
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
89
+ <path d="M5.5 5.5A.5.5 0 0 1 6 6v3a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0V6z"/>
90
+ <path d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H2zM1 2a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2z"/>
36
91
  </svg>
37
92
  Fullscreen
38
93
  </button>
39
94
  ` : ''}
40
- </div>
41
-
42
- ${this.isFullscreen ? html `
43
- <div class="fullscreen-overlay">
44
- <div class="fullscreen-header">
45
- <button class="close-button" @click=${this._closeFullscreen}>
46
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
47
- <path d="M12.5 3.5L3.5 12.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
48
- <path d="M12.5 12.5L3.5 3.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
49
- </svg>
50
- </button>
51
- </div>
52
- <div class="fullscreen-content">
53
- <iframe
54
- class="fullscreen-iframe"
55
- src="${this.src}"
56
- title="Fullscreen PDF"
57
- ></iframe>
95
+ ${this.showPreview ? html `
96
+ <div class="preview-modal">
97
+ <div class="preview-header">
98
+ <button class="preview-close" @click=${this.closePreviewModal} aria-label="Close preview">×</button>
99
+ </div>
100
+ <iframe src=${this.src} title="Document viewer fullscreen"></iframe>
58
101
  </div>
59
- </div>
60
- ` : ''}
102
+ ` : ''}
103
+ </div>
61
104
  `;
62
105
  }
63
- _handleError(e) {
64
- var _a;
65
- console.error('PDF loading error:', e);
66
- this.dispatchEvent(new CustomEvent('onError', {
67
- bubbles: true,
68
- composed: true,
69
- detail: {
70
- error: `Error loading PDF: PDF viewer not supported or file cannot be loaded`
71
- }
72
- }));
73
- // Show fallback image when error occurs
74
- const container = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.pdf-container');
75
- if (container) {
76
- const iframe = container.querySelector('iframe');
77
- if (iframe) {
78
- const img = document.createElement('img');
79
- img.src = this.fallback || this.defaultFallBack;
80
- img.alt = "PDF failed to load";
81
- img.style.width = "100%";
82
- img.style.height = "100%";
83
- img.style.objectFit = "contain";
84
- container.replaceChild(img, iframe);
85
- }
86
- }
87
- }
88
- _openFullscreen() {
89
- this.isFullscreen = true;
90
- // Prevent scrolling of the background when fullscreen is active
91
- document.body.style.overflow = 'hidden';
92
- }
93
- _closeFullscreen() {
94
- this.isFullscreen = false;
95
- // Restore scrolling when fullscreen is closed
96
- document.body.style.overflow = '';
97
- }
98
- // Clean up when component is removed
99
- disconnectedCallback() {
100
- super.disconnectedCallback();
101
- // Ensure body scrolling is restored if component is removed while in fullscreen
102
- if (this.isFullscreen) {
103
- document.body.style.overflow = '';
104
- }
105
- }
106
106
  };
107
- HyPdfViewer.styles = css `
108
- :host {
109
- display: block;
110
- }
111
-
112
- .pdf-container {
113
- position: relative;
114
- overflow: hidden;
115
- min-height: 100px;
116
- background-color: #f5f5f5;
117
- border: 1px solid #e0e0e0;
118
- }
119
-
120
- .pdf-iframe {
121
- border: none;
122
- display: block;
123
- width: 100%;
124
- height: 100%;
125
- }
126
-
127
- .preview-button {
128
- position: absolute;
129
- top: 10px;
130
- right: 10px;
131
- background-color: rgba(255, 255, 255, 0.8);
132
- border: 1px solid #ccc;
133
- border-radius: 4px;
134
- padding: 5px 10px;
135
- cursor: pointer;
136
- display: flex;
137
- align-items: center;
138
- font-family: system-ui, -apple-system, sans-serif;
139
- font-size: 12px;
140
- z-index: 10;
141
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
142
- }
143
-
144
- .preview-button:hover {
145
- background-color: rgba(255, 255, 255, 1);
146
- }
147
-
148
- .preview-button svg {
149
- margin-right: 4px;
150
- }
151
-
152
- .fullscreen-overlay {
153
- position: fixed;
154
- top: 0;
155
- left: 0;
156
- width: 100vw;
157
- height: 100vh;
158
- background-color: rgba(0, 0, 0, 0.95);
159
- z-index: 9999;
160
- display: flex;
161
- flex-direction: column;
162
- }
163
-
164
- .fullscreen-header {
165
- display: flex;
166
- justify-content: flex-end;
167
- padding: 16px;
168
- background-color: rgba(0, 0, 0, 0.4);
169
- }
170
-
171
- .close-button {
172
- background-color: white;
173
- border: none;
174
- border-radius: 4px;
175
- padding: 8px;
176
- cursor: pointer;
177
- display: flex;
178
- align-items: center;
179
- justify-content: center;
180
- width: 32px;
181
- height: 32px;
182
- box-shadow: 0 2px 4px rgba(0,0,0,0.2);
183
- }
184
-
185
- .close-button:hover {
186
- background-color: #f0f0f0;
187
- }
188
-
189
- .fullscreen-content {
190
- flex: 1;
191
- padding: 0;
192
- display: flex;
193
- align-items: center;
194
- justify-content: center;
195
- }
196
-
197
- .fullscreen-iframe {
198
- width: 100%;
199
- height: 100%;
200
- border: none;
201
- background-color: white;
202
- }
203
- `;
107
+ NrDocumentElement.styles = styles;
204
108
  __decorate([
205
- property()
206
- ], HyPdfViewer.prototype, "src", void 0);
109
+ property({ type: String })
110
+ ], NrDocumentElement.prototype, "src", void 0);
207
111
  __decorate([
208
- property()
209
- ], HyPdfViewer.prototype, "width", void 0);
112
+ property({ type: String })
113
+ ], NrDocumentElement.prototype, "type", void 0);
210
114
  __decorate([
211
- property()
212
- ], HyPdfViewer.prototype, "height", void 0);
115
+ property({ type: String })
116
+ ], NrDocumentElement.prototype, "width", void 0);
213
117
  __decorate([
214
- property({ type: Object })
215
- ], HyPdfViewer.prototype, "fallback", void 0);
118
+ property({ type: String })
119
+ ], NrDocumentElement.prototype, "height", void 0);
216
120
  __decorate([
217
121
  property({ type: Boolean })
218
- ], HyPdfViewer.prototype, "previewable", void 0);
122
+ ], NrDocumentElement.prototype, "previewable", void 0);
123
+ __decorate([
124
+ property({ type: Boolean, reflect: true })
125
+ ], NrDocumentElement.prototype, "block", void 0);
126
+ __decorate([
127
+ state()
128
+ ], NrDocumentElement.prototype, "showPreview", void 0);
219
129
  __decorate([
220
130
  state()
221
- ], HyPdfViewer.prototype, "isFullscreen", void 0);
222
- HyPdfViewer = __decorate([
223
- customElement('hy-document-viewer')
224
- ], HyPdfViewer);
225
- export { HyPdfViewer };
131
+ ], NrDocumentElement.prototype, "hasError", void 0);
132
+ NrDocumentElement = __decorate([
133
+ customElement('nr-document')
134
+ ], NrDocumentElement);
135
+ export { NrDocumentElement };
226
136
  //# sourceMappingURL=document.component.js.map