@eldrex/papyr-animate 3.0.3 → 3.1.1

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.
@@ -1,6 +1,6 @@
1
- (()=>{let l=null,o=!1,d=["html","head","body","title","div","span","p","h1","h2","h3","h4","h5","h6","button","a","img","input","textarea","select","option","optgroup","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","td","th","caption","colgroup","col","form","label","fieldset","legend","datalist","output","section","article","header","footer","nav","aside","main","pre","code","hr","br","strong","em","small","mark","sub","sup","i","b","u","s","tt","cite","address","blockquote","audio","video","source","track","picture","embed","iframe","canvas","svg","details","summary","dialog","menu","menuitem","template","slot"],a=null,p=("undefined"==typeof document&&(a={documentElement:{style:{setProperty(){}},setAttribute(){}},body:{appendChild(){},setAttribute(){}},head:{appendChild(){}},createElement(e){return{tagName:e.toUpperCase(),attributes:{},style:{setProperty(e,t){this[e]=t}},classList:{_classes:[],add(e){this._classes.includes(e)||this._classes.push(e)},remove(t){this._classes=this._classes.filter(e=>e!==t)},contains(e){return this._classes.includes(e)}},childNodes:[],appendChild(e){this.childNodes.push(e),e&&"object"==typeof e&&(e.parentNode=this)},insertBefore(e,t){t=this.childNodes.indexOf(t);-1!==t?this.childNodes.splice(t,0,e):this.childNodes.push(e),e&&"object"==typeof e&&(e.parentNode=this)},removeChild(t){this.childNodes=this.childNodes.filter(e=>e!==t)},setAttribute(e,t){this.attributes[e]=t},getAttribute(e){return this.attributes[e]},removeAttribute(e){delete this.attributes[e]},hasAttribute(e){return e in this.attributes},addEventListener(){},removeEventListener(){},get innerHTML(){var e=Object.entries(this.attributes).map(([e,t])=>e+`="${t}"`).join(" "),t=Object.entries(this.style).filter(([e])=>"function"!=typeof this.style[e]).map(([e,t])=>e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+t).join("; "),e=[0<this.classList._classes.length?`class="${this.classList._classes.join(" ")}"`:"",e,t?`style="${t}"`:""].filter(Boolean).join(" "),t=this.childNodes.map(e=>"string"==typeof e?e:e.innerHTML||e.text||"").join("");return`<${this.tagName.toLowerCase()}${e?" "+e:""}>${t}</${this.tagName.toLowerCase()}>`}}},createTextNode(e){return{nodeType:3,text:e,get innerHTML(){return e}}},createDocumentFragment(){return{nodeType:11,childNodes:[],appendChild(e){this.childNodes.push(e)},get innerHTML(){return this.childNodes.map(e=>"string"==typeof e?e:e.innerHTML||e.text||"").join("")}}},querySelector(){return null},getElementById(){return null}}),e=>!(!e||"object"!=typeof e)&&("undefined"!=typeof Element&&e instanceof Element||"undefined"!=typeof DocumentFragment&&e instanceof DocumentFragment||"string"==typeof e.tagName&&"function"==typeof e.appendChild||1===e.nodeType||11===e.nodeType)),c={flex:{display:"flex"},block:{display:"block"},inline:{display:"inline"},"inline-flex":{display:"inline-flex"},grid:{display:"grid"},hidden:{display:"none"},center:{justifyContent:"center",alignItems:"center"},"items-center":{alignItems:"center"},"justify-between":{justifyContent:"space-between"},"flex-col":{flexDirection:"column"},"flex-row":{flexDirection:"row"},"flex-wrap":{flexWrap:"wrap"},"rounded-sm":{borderRadius:"2px"},rounded:{borderRadius:"4px"},"rounded-md":{borderRadius:"6px"},"rounded-lg":{borderRadius:"8px"},"rounded-xl":{borderRadius:"12px"},"rounded-2xl":{borderRadius:"16px"},"rounded-full":{borderRadius:"9999px"},"shadow-sm":{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},shadow:{boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)"},"shadow-md":{boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"},"shadow-lg":{boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},"shadow-xl":{boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"},"w-full":{width:"100%"},"h-full":{height:"100%"}},t=null,n=()=>{if(!t){if("undefined"==typeof document)return null;let e=null;(e="function"==typeof document.querySelector?document.querySelector("#papyr-dynamic-utilities"):e)||"function"==typeof document.createElement&&((e=document.createElement("style")).id="papyr-dynamic-utilities",document.head)&&"function"==typeof document.head.appendChild&&document.head.appendChild(e),t=e?e.sheet||e:null}return t},i=new Set,u=(t,e)=>{var r=n();if(r){t=t+` { ${e} }`;if(!i.has(t))if(i.add(t),r.insertRule)try{r.insertRule(t,r.cssRules.length)}catch(e){r.textContent+="\n"+t}else r.textContent+="\n"+t}},y=new Map,f=[];class h{constructor(e){this.kernel=e,this.listeners=new Map}on(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}off(e,t){this.listeners.has(e)&&this.listeners.set(e,this.listeners.get(e).filter(e=>e!==t))}emit(e,t){this.listeners.has(e)&&this.listeners.get(e).forEach(e=>{try{e(t)}catch(e){this.kernel.diagnostics.reportError(e)}})}}class g{constructor(e){this.kernel=e,this.states=new Set}register(e){this.states.add(e)}list(){return Array.from(this.states)}dump(){let t={},r=0;return this.states.forEach(e=>{t["state_"+r++]=e.value}),t}}class m{constructor(e){this.kernel=e,this.registered=new Set}register(e){this.registered.add(e)}list(){return Array.from(this.registered).filter(e=>{if("undefined"!=typeof document){if("function"==typeof document.contains)return document.contains(e);if(document.body&&"function"==typeof document.body.contains)return document.body.contains(e)}return!0}).map(e=>({tag:e.tagName?e.tagName.toLowerCase():"unknown",id:e.id||"",classes:e.className||""}))}}class b{constructor(e){this.kernel=e,this.installed=new Map}register(e){e&&"object"==typeof e&&(this.installed.set(e.name,e),"function"==typeof e.install&&e.install(this.kernel),e.hooks)&&"function"==typeof e.hooks.onInit&&e.hooks.onInit()}resolve(e){return this.installed.get(e)}list(){return Array.from(this.installed.keys()).map(e=>{e=this.installed.get(e);return{name:e.name,version:e.version||"1.0.0"}})}triggerHook(t,...r){this.installed.forEach(e=>{if(e.hooks&&"function"==typeof e.hooks[t])try{e.hooks[t](...r)}catch(e){this.kernel.diagnostics.reportError(e)}})}}class v{constructor(e){this.kernel=e,this.routes=[],this.intent=null}}class w{constructor(e){this.kernel=e,this.errors=[],this.listeners=new Map,this.updateCounts=new Map,this.warnedStates=new Set}on(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}emit(e,t){this.listeners.has(e)&&this.listeners.get(e).forEach(e=>e(t))}reportError(e){e={type:"error",message:e.message||String(e),timestamp:(new Date).toISOString(),stack:e.stack||""};this.errors.push(e),this.kernel.events.emit("error",e)}trackUpdate(e,t,r){var o=(this.updateCounts.get(e)||0)+1;this.updateCounts.set(e,o),100<o&&!this.warnedStates.has(e)&&(this.warnedStates.add(e),this.emit("performance",{type:"High Re-renders",message:`State variable updated ${o} times, potential infinite re-render loop detected!`,state:e,count:o}))}}function e(){let s="undefined"!=typeof document?document:a;function l(a,...e){if(o&&!d.includes(a)){let r=1/0,o="";d.forEach(e=>{var t=((r,o)=>{var e=r<o?r+","+o:o+","+r;if(y.has(e))return y.get(e);var a=[];for(let t=0;t<=r.length;t++){var n=[t];for(let e=1;e<=o.length;e++)n.push(0===t?e:Math.min(a[t-1][e]+1,n[e-1]+1,a[t-1][e-1]+(r[t-1]===o[e-1]?0:1)));a.push(n)}var t=a[r.length][o.length];return y.set(e,t),t})(a,e);t<r&&(r=t,o=e)});var t=`Unknown tag "${a}".`+(r<3?` Did you mean "${o}"?`:"");console.warn("PapyrWarning: "+t),l.diagnostics.errors.push({type:"warning",message:t,timestamp:(new Date).toISOString()}),"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("papyr-warning",{detail:{tag:a,suggestion:r<3?o:""}}))}let i;if(a&&"script"===a.toLowerCase()){let r=(i=s.createElement(a)).setAttribute;i.setAttribute=function(e,t){e&&"src"===e.toLowerCase()&&l.security&&"function"==typeof l.security.shouldBlockScript&&l.security.shouldBlockScript(t)?console.warn("Papyr Security Kernel: Blocked tracking script from "+t):r.apply(this,arguments)},Object.defineProperty(i,"src",{set(e){l.security&&"function"==typeof l.security.shouldBlockScript&&l.security.shouldBlockScript(e)?console.warn("Papyr Security Kernel: Blocked tracking script from "+e):r.call(i,"src",e)},get(){return i.getAttribute("src")},configurable:!0})}else i=s.createElement(a);l.components.register(i);let n=r=>{if(null!=r)if("object"==typeof r&&"function"==typeof r.subscribe||"function"==typeof r)(e=>{var t=s.createTextNode("");i.appendChild(t);let n=[t],r=!1,o=e=>{if(!r){r=!0;try{let t=[],r=e=>{null!=e&&!1!==e&&(p(e)?t.push(e):Array.isArray(e)?e.forEach(r):"function"==typeof e?r(e()):t.push(s.createTextNode(String(e))))},o=(r(e),0===t.length&&t.push(s.createTextNode("")),n[0]),a=o.parentNode;a&&(t.forEach(e=>{a.insertBefore(e,o)}),n.forEach(e=>{e.parentNode===a&&("function"==typeof a.removeChild?a.removeChild(e):"function"==typeof e.remove&&e.remove())}),n=t)}finally{r=!1}}},a;e&&"function"==typeof e.subscribe?a=e.subscribe(o):"function"==typeof e&&(a=l.effect(()=>{o(e())})),a&&(i._cleanups||(i._cleanups=[]),i._cleanups.push(a))})(r);else if(p(r))i.appendChild(r);else if(Array.isArray(r))r.forEach(n);else{var e,r=String(r),o=r.includes(":")&&!r.startsWith("http://")&&!r.startsWith("https://");if(r.startsWith(".")||r.startsWith("#")){let e=r,t="";o&&(a=r.indexOf(":"),e=r.substring(0,a),t=r.substring(a+1));var a=e.match(/[.#][^.#]+/g);a&&a.forEach(e=>{e.startsWith("#")?i.id=e.slice(1).trim():e.startsWith(".")&&e.slice(1).trim().split(/\s+/).forEach(e=>{e&&i.classList.add(e)})}),o&&i.appendChild(s.createTextNode(t))}else o&&(a=r.indexOf(":"),o=r.substring(0,a),[e,...a]=r.split(":"),a=a.join(":"),d.includes(o.toLowerCase()))?((o=s.createElement(o)).textContent=a,i.appendChild(o)):i.appendChild(s.createTextNode(r))}};return a&&"button"===a.toLowerCase()&&i.classList.add("papyr-btn"),e.forEach(e=>{null===e||"object"!=typeof e||p(e)||Array.isArray(e)||"function"==typeof e.subscribe?n(e):(e.style&&Object.entries(e.style).forEach(([t,e])=>{let r=e=>{t.startsWith("--")?i.style.setProperty(t,String(e)):"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&(i.style[t]=e)},o;e&&"function"==typeof e.subscribe?o=e.subscribe(r):"function"==typeof e?o=l.effect(()=>{r(e())}):r(e),o&&(i._cleanups||(i._cleanups=[]),i._cleanups.push(o))}),e.data&&Object.assign(i.dataset,e.data),e.attrs&&Object.assign(i,e.attrs),Object.entries(e).forEach(([o,r])=>{if(!["style","data","attrs"].includes(o))if("onMounted"===o)i._onMounted=r;else if("onUnmounted"===o)i._onUnmounted=r;else if("onUpdated"===o){i._onUpdated=r;var e=new MutationObserver(()=>{try{i._onUpdated(i)}catch(e){l.diagnostics.reportError(e)}});e.observe(i,{attributes:!0,childList:!0,subtree:!1}),i._updateObserver=e}else if("on"===o&&"object"==typeof r&&null!==r)Object.entries(r).forEach(([e,t])=>{i.addEventListener(e,t)});else if(o.startsWith("on")){e=o.slice(2).toLowerCase();i.addEventListener(e,r)}else if(o.startsWith("--"))i.style.setProperty(o,String(r));else if("paper"===o||"papyr"===o){let e=e=>{var a;a=i,(e=e)&&(Array.isArray(e)?e:String(e).split(/\s+/)).forEach(e=>{e=e.trim();if(e)if(e.includes(":")){var t=e.split(":");if(2===t.length){var r=t[0],t=t[1],r={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"}[r],o=c[t]?c:"undefined"!=typeof paperUtilities?paperUtilities:{};if(r&&o[t]){let e=a._papyrUniqueClass;e||(e="papyr-u-"+Math.random().toString(36).substring(2,8),a.classList.add(e),a._papyrUniqueClass=e);o=Object.entries(o[t]).map(([e,t])=>e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+`: ${t};`).join(" "),t=`@media (min-width: ${r})`;u(t,`.${e} { ${o} }`)}}}else{r=c[e]?c:"undefined"!=typeof paperUtilities?paperUtilities:{};r[e]?Object.entries(r[e]).forEach(([e,t])=>{a.style[e]=t}):a.classList.add(e)}})},t;r&&"function"==typeof r.subscribe?t=r.subscribe(e):"function"==typeof r?t=l.effect(()=>{e(r())}):e(r),t&&(i._cleanups||(i._cleanups=[]),i._cleanups.push(t))}else{let e=e=>{var t,r;"class"===o||"className"===o?(r=e,t=Array.isArray(r)?r.filter(Boolean).join(" "):"object"==typeof r&&null!==r?Object.keys(r).filter(e=>r[e]).join(" "):String(r),i._prevReactiveClasses&&i._prevReactiveClasses.forEach(e=>{e&&i.classList.remove(e)}),i._prevReactiveClasses=[],t&&t.split(" ").forEach(e=>{e&&(i.classList.add(e),i._prevReactiveClasses.push(e))})):o in i&&"__proto__"!==o&&"constructor"!==o&&"prototype"!==o?"boolean"==typeof e?(i[o]=e)?i.setAttribute(o,""):i.removeAttribute(o):i[o]=e:null==e||!1===e?i.removeAttribute(o):i.setAttribute(o,String(e))},t;r&&"function"==typeof r.subscribe?t=r.subscribe(e):"function"==typeof r?t=l.effect(()=>{e(r())}):e(r),t&&(i._cleanups||(i._cleanups=[]),i._cleanups.push(t))}}))}),l.plugins.triggerHook("onRender",i),i}l.state=new g(l);let t=new m(l);Object.defineProperty(l,"components",{get(){return t},set(e){e&&"object"==typeof e?Object.assign(t,e):console.warn("Papyr: Attempted to set papyr.components to a non-object value, ignored.")},configurable:!0}),l.events=new h(l),l.plugins=new b(l),l.runtime=new v(l),l.diagnostics=new w(l),l.on=(e,t)=>l.events.on(e,t),l.off=(e,t)=>l.events.off(e,t),l.emit=(e,t)=>l.events.emit(e,t),l.exportContext=()=>({components:l.components.list(),state:l.state.dump(),routes:l.runtime.routes||[],errors:l.diagnostics.errors,plugins:l.plugins.list()}),l.use=e=>("function"==typeof e?e(l):e&&"object"==typeof e&&l.plugins.register(e),l),l.theme=e=>(e&&void 0!==s&&Object.entries(e).forEach(([e,t])=>{s.documentElement&&s.documentElement.style&&(s.documentElement.style.setProperty("--papyr-"+e,t),s.documentElement.style.setProperty("--"+e,t))}),l),l.plugin=e=>l.use(e),d.forEach(t=>{l[t]=(...e)=>l(t,...e)}),l.flex={row:(...e)=>l("div",".flex-row",...e),col:(...e)=>l("div",".flex-col",...e),center:(...e)=>l("div",".flex-center",...e),between:(...e)=>l("div",".flex-between",...e),around:(...e)=>l("div",".flex-around",...e),wrap:(...e)=>l("div",".flex-wrap",...e)},l.grid=(...e)=>l("div",".grid",...e),l.container=(...e)=>l("div",".container",...e),l.row=(...e)=>l("div",".row",...e),l.col=(...e)=>l("div",".col",...e);l.component=class{constructor(){if(void 0===this.render)throw new Error("PapyrComponent must implement a render() method")}},l.errorBoundary=(e,t)=>{try{return e()}catch(e){if(l.diagnostics.reportError(e),"function"==typeof t)try{return t(e)}catch(e){return l.div(".papyr-error-fallback","Component failed to render.")}return l.div(".papyr-error-fallback",{style:{padding:"12px",background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)",borderRadius:"8px",color:"#fca5a5",fontSize:"0.85rem"}},"⚠️ Component Rendering Error: "+e.message)}},l.validate=n=>e=>{var t,r,o,a=Object.create(null);for(t in n)"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&Object.prototype.hasOwnProperty.call(n,t)&&(r=n[t],o=e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,!r.required||null!=o&&""!==o||(a[t]="Required field"),r.type)&&typeof o!==r.type&&(a[t]="Must be of type "+r.type);return Object.keys(a).length?a:null},l.inspect=e=>{var t=s.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},l.mount=(e,t)=>{e=s.querySelector(e);return e&&(e.innerHTML="",e.appendChild(t)),e},l.ready=e=>{"undefined"!=typeof document&&"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()},l.debug=e=>{(o=e)&&console.log("📄 Papyr Debug Mode Enabled.")},l.delay=t=>new Promise(e=>setTimeout(e,t)),l.copy=e=>navigator.clipboard.writeText(e),l.fragment=(...e)=>{let t=s.createDocumentFragment();return e.forEach(e=>{Array.isArray(e)?e.forEach(e=>{e instanceof Element?t.appendChild(e):t.appendChild(s.createTextNode(String(e)))}):e instanceof Element||e instanceof DocumentFragment?t.appendChild(e):null!=e&&t.appendChild(s.createTextNode(String(e)))}),t},l.html=e=>{var t=s.createElement("template");return t.innerHTML=e.trim(),t.content.cloneNode(!0)},l.fadeIn=(e,t=400)=>{e.style.opacity="0",e.style.transition=`opacity ${t}ms ease`,requestAnimationFrame(()=>{e.style.opacity="1"})},l.fadeOut=(e,t=400)=>{e.style.opacity="1",e.style.transition=`opacity ${t}ms ease`,requestAnimationFrame(()=>{e.style.opacity="0"}),setTimeout(()=>e.remove(),t)},l.animate=(e,t,r=400)=>{e.style.transition=`all ${r}ms cubic-bezier(0.4, 0, 0.2, 1)`,requestAnimationFrame(()=>{Object.assign(e.style,t)})},l.loadFramework=e=>{var t,r="papyr-fw-"+e;document.getElementById(r)||("tailwind"===e?((t=document.createElement("script")).id=r,t.src="https://cdn.tailwindcss.com",document.head.appendChild(t)):"bootstrap"===e&&((t=document.createElement("link")).id=r,t.rel="stylesheet",t.href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css",(e=s.getElementById("papyr-complete-styles")||s.querySelector('link[href*="styles.css"]')||s.querySelector("style"))&&e.parentNode?e.parentNode.insertBefore(t,e):s.head&&s.head.appendChild(t),s&&s.documentElement&&s.documentElement.setAttribute("data-bs-theme","dark"),s)&&s.body&&s.body.setAttribute("data-bs-theme","dark"))},l.init=(e={})=>{e.privacy&&(l.security&&"function"==typeof l.security.setTier?l.security.setTier(e.privacy):l._initialPrivacy=e.privacy),void 0!==e.debug&&l.debug(e.debug)};let e="undefined"!=typeof window?window.papyr:null;if(l.noConflict=()=>("undefined"!=typeof window&&(window.papyr=e),l),(l.el=l).ssr=e=>e?(e="function"==typeof e?e():e).innerHTML||String(e):"",l.ssr.render=e=>l.ssr(e),f.forEach(e=>{try{e(l)}catch(e){console.error("Error during core initialization",e)}}),"undefined"!=typeof window&&"undefined"!=typeof MutationObserver&&"undefined"!=typeof document){let e=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(1===e.nodeType){let t=e=>{if(e._onMounted&&!e._isMounted){e._isMounted=!0;try{e._onMounted(e)}catch(e){l.diagnostics.reportError(e)}}Array.from(e.children||[]).forEach(t)};t(e)}}),e.removedNodes.forEach(e=>{if(1===e.nodeType)if("function"==typeof l._cleanupElement)l._cleanupElement(e);else{let t=e=>{if(e._cleanups&&(e._cleanups.forEach(e=>{if("function"==typeof e)try{e()}catch(e){l.diagnostics.reportError(e)}}),e._cleanups=[]),e._onUnmounted){e._isMounted=!1;try{e._onUnmounted(e)}catch(e){l.diagnostics.reportError(e)}}Array.from(e.children||[]).forEach(t)};t(e)}})})});var r=()=>{document.body&&e.observe(document.body,{childList:!0,subtree:!0})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",r):r()}return l}"undefined"!=typeof module&&module.exports?module.exports=e:"undefined"!=typeof window&&(window.createPapyr=e);{let a=Object.create(null),n=["_ga","_gid","_fbp","_uid_tracking_id","tracking","analytics","pixel","adsense"],i=null,t=null,l=null;"undefined"!=typeof window&&window.localStorage&&("function"==typeof localStorage.setItem&&(i=localStorage.setItem.bind(localStorage)),"function"==typeof localStorage.getItem&&(t=localStorage.getItem.bind(localStorage)),"function"==typeof localStorage.removeItem)&&(l=localStorage.removeItem.bind(localStorage)),f.push(s=>{s.security={_isActive:!0,currentTier:"default",hasConsent:!1,_scriptsBlocked:!1,setTier(e){"high"===(this.currentTier=e)&&this.blockThirdPartyScripts()},setConsent(e){if(this.hasConsent=!!e,e)try{i&&Object.entries(a).forEach(([e,t])=>{i(e,t)}),a=Object.create(null)}catch(e){}else try{if(l){var r=[];for(let e=0;e<localStorage.length;e++){var o=localStorage.key(e);if(o){let t=o.toLowerCase();n.some(e=>t.includes(e))&&r.push(o)}}r.forEach(e=>l(e))}}catch(e){}},shouldBlockScript(t){var e;return"none"!==this.currentTier&&!(!t||"string"!=typeof t||(e=["analytics","pixel","doubleclick","google-analytics","adsense","ad-tracker","facebook.net","adnxs"].some(e=>t.toLowerCase().includes(e)),("high"!==this.currentTier||!e)&&("default"!==this.currentTier||this.hasConsent||!e)))},blockThirdPartyScripts(){if("undefined"!=typeof document&&!this._scriptsBlocked){this._scriptsBlocked=!0;let r=document.createElement;document.createElement=function(e,t){let o=r.call(document,e,t);if(e&&"script"===e.toLowerCase()){let r=o.setAttribute;o.setAttribute=function(e,t){e&&"src"===e.toLowerCase()&&s.security.shouldBlockScript(t)?console.warn("Papyr Security Kernel: Blocked tracking script from "+t):r.apply(this,arguments)},Object.defineProperty(o,"src",{set(e){s.security.shouldBlockScript(e)?console.warn("Papyr Security Kernel: Blocked tracking script from "+e):r.call(o,"src",e)},get(){return o.getAttribute("src")},configurable:!0})}return o}}},shouldSandboxStorage(t){return"none"!==this.currentTier&&("high"===this.currentTier||!this.hasConsent&&n.some(e=>t.toLowerCase().includes(e)))},sanitize(e){if(!this._isActive||"string"!=typeof e)return e;let o=e;if("undefined"!=typeof window&&"undefined"!=typeof DOMParser)try{var n=(new DOMParser).parseFromString(e,"text/html");let t=["div","span","p","h1","h2","h3","h4","h5","h6","button","a","img","ul","ol","li","table","thead","tbody","tr","td","th","form","label","input","textarea","select","option","pre","code","strong","em","small","hr","br","canvas","svg","path","rect","circle"],a=["class","style","id","href","src","alt","title","placeholder","type","name","value","checked","disabled","rows","cols","width","height","viewBox","d","role","aria-live","aria-modal","aria-labelledby","tabindex","aria-label"],r=o=>{var e;1===o.nodeType&&(e=o.tagName.toLowerCase(),t.includes(e)&&"script"!==e?(Array.from(o.attributes).forEach(e=>{var t=e.name.toLowerCase(),r=e.value.toLowerCase().trim();a.includes(t)&&!t.startsWith("on")&&!r.includes("javascript:")||o.removeAttribute(e.name)}),Array.from(o.childNodes).forEach(r)):o.parentNode.removeChild(o))};Array.from(n.body.childNodes).forEach(r),o=n.body.innerHTML}catch(e){}return o!==e&&"undefined"!=typeof DOMParser||(o=(o=(o=(o=(o=(o=e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"")).replace(/\s+on\w+\s*=\s*"[^"]*"/gi,"")).replace(/\s+on\w+\s*=\s*'[^']*'/gi,"")).replace(/\s+on\w+\s*=\s*\w+/gi,"")).replace(/href\s*=\s*['"]\s*javascript:[^'"]*['"]/gi,'href="#"')).replace(/src\s*=\s*['"]\s*javascript:[^'"]*['"]/gi,'src=""')),e!==o&&s.warn&&s.warn("Papyr Security Interceptor blocked a potential XSS payload."),o},use(e){"disable"===e&&(this._isActive=!1,s.warn)&&s.warn("Papyr Security Kernel DISABLED. You are vulnerable to XSS.")},encrypt(e,t){if(!e)return e;var r="undefined"!=typeof window?unescape(encodeURIComponent(e)):Buffer.from(e,"utf8").toString("binary");let o="",a=0;for(let e=0;e<r.length;e++){var n=t.charCodeAt(e%t.length)+e+a&255,n=r.charCodeAt(e)^n;o+=String.fromCharCode(n),a=n}return"undefined"!=typeof window?window.btoa(o):Buffer.from(o,"binary").toString("base64")},decrypt(e,o){if(!e)return e;try{var a="undefined"!=typeof window?window.atob(e):Buffer.from(e,"base64").toString("binary");let t="",r=0;for(let e=0;e<a.length;e++){var n=o.charCodeAt(e%o.length)+e+r&255,i=a.charCodeAt(e)^n;t+=String.fromCharCode(i),r=a.charCodeAt(e)}return"undefined"!=typeof window?decodeURIComponent(escape(t)):Buffer.from(t,"binary").toString("utf8")}catch(e){return s.warn&&s.warn("Papyr Security: Decryption failed (invalid key or corrupted data)."),null}},async encryptAsync(r,o){if("undefined"==typeof window||!window.crypto||!window.crypto.subtle)return this.encrypt(r,o);try{var e=new TextEncoder,a=window.crypto.getRandomValues(new Uint8Array(16)),n=window.crypto.getRandomValues(new Uint8Array(12)),i=await window.crypto.subtle.importKey("raw",e.encode(o),"PBKDF2",!1,["deriveKey"]),s=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:a,iterations:1e5,hash:"SHA-256"},i,{name:"AES-GCM",length:256},!1,["encrypt"]),l=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},s,e.encode(r)),d=new Uint8Array(a.length+n.length+l.byteLength);d.set(a,0),d.set(n,a.length),d.set(new Uint8Array(l),a.length+n.length);let t="";for(let e=0;e<d.byteLength;e++)t+=String.fromCharCode(d[e]);return window.btoa(t)}catch(e){return console.error("Papyr Security: Async Encryption failed, falling back to sync.",e),this.encrypt(r,o)}},async decryptAsync(t,r){if("undefined"==typeof window||!window.crypto||!window.crypto.subtle)return this.decrypt(t,r);try{var o=window.atob(t),a=new Uint8Array(o.length);for(let e=0;e<o.length;e++)a[e]=o.charCodeAt(e);var e=a.slice(0,16),n=a.slice(16,28),i=a.slice(28),s=new TextEncoder,l=await window.crypto.subtle.importKey("raw",s.encode(r),"PBKDF2",!1,["deriveKey"]),d=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:e,iterations:1e5,hash:"SHA-256"},l,{name:"AES-GCM",length:256},!1,["decrypt"]),p=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:n},d,i);return(new TextDecoder).decode(p)}catch(e){return console.error("Papyr Security: Async Decryption failed, falling back to sync.",e),this.decrypt(t,r)}}},s.safeGet=(e,t)=>{if(e&&"object"==typeof e){if("__proto__"===t||"constructor"===t||"prototype"===t)throw new Error("Security Violation: Unsafe property access");return e[t]}}}),"undefined"!=typeof window&&window.localStorage&&(localStorage.setItem=function(e,t){window.papyr&&window.papyr.security&&window.papyr.security.shouldSandboxStorage(e)?e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(a[e]=t):i&&i(e,t)},localStorage.getItem=function(e){return window.papyr&&window.papyr.security&&window.papyr.security.shouldSandboxStorage(e)?e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Object.prototype.hasOwnProperty.call(a,e)?a[e]:null:t?t(e):null},localStorage.removeItem=function(e){window.papyr&&window.papyr.security&&window.papyr.security.shouldSandboxStorage(e)?e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Object.prototype.hasOwnProperty.call(a,e)&&delete a[e]:l&&l(e)})}f.push(p=>{let c=e=>!(!e||"object"!=typeof e)&&("undefined"!=typeof Element&&e instanceof Element||"undefined"!=typeof DocumentFragment&&e instanceof DocumentFragment||"string"==typeof e.tagName&&"function"==typeof e.appendChild||1===e.nodeType||11===e.nodeType),u=e=>{if(e){if(e._cleanups&&(e._cleanups.forEach(e=>{if("function"==typeof e)try{e()}catch(e){p.diagnostics.reportError(e)}}),e._cleanups=[]),e._onUnmounted){e._isMounted=!1;try{e._onUnmounted(e)}catch(e){p.diagnostics.reportError(e)}}if(e._updateObserver)try{e._updateObserver.disconnect()}catch(e){}Array.from(e.children||[]).forEach(u)}},i=(p._cleanupElement=u,(e,n)=>null===e||"object"!=typeof e||c(e)?e:new Proxy(e,{get(t,e,r){let o=Reflect.get(t,e,r);return Array.isArray(t)&&"function"==typeof o&&["push","pop","splice","shift","unshift","sort","reverse"].includes(e)?function(...e){e=o.apply(t,e);return n(),e}:null===o||"object"!=typeof o||c(o)?o:i(o,n)},set(e,t,r,o){var a=e[t],e=Reflect.set(e,t,r,o);return a!==r&&n(),e}})),s=(p.state=r=>{let o=new Set,e=()=>{p.diagnostics.trackUpdate(a,r,r),Array.from(o).forEach(e=>e(r)),p.plugins.triggerHook("onUpdate",a)},a={_subscribers:o,get value(){return l&&(o.add(l),"function"==typeof l._addDep)&&l._addDep(a),i(r,e)},set value(t){var e;(r!==t||"object"==typeof t&&null!==t)&&(e=r,r=t,p.diagnostics.trackUpdate(a,t,e),Array.from(o).forEach(e=>e(t)),p.plugins.triggerHook("onUpdate",a))},subscribe(e){return o.add(e),e(r),()=>o.delete(e)},dump(){return r}};return p.state.register(a),a},p.state.states=new Set,p.state.register=e=>p.state.states.add(e),p.state.list=()=>Array.from(p.state.states),p.state.dump=()=>{let t={},r=0;return p.state.states.forEach(e=>{t["state_"+r++]=e.value}),t},[]);p.computed=e=>{let t=new Set,r,o=!0,a=()=>{o=!0,Array.from(t).forEach(e=>e(n.value))},n=(a._deps=new Set,a._addDep=e=>{a._deps.add(e)},{_subscribers:t,get value(){if(o){a._deps.forEach(e=>{e._subscribers&&e._subscribers.delete(a)}),a._deps.clear(),s.push(a),l=a;try{r=e(),o=!1}catch(e){p.diagnostics.reportError(e)}finally{s.pop(),l=s[s.length-1]||null}}return l&&(t.add(l),"function"==typeof l._addDep)&&l._addDep(n),r},subscribe(e){return t.add(e),e(n.value),()=>{t.delete(e),0===t.size&&(a._deps.forEach(e=>{e._subscribers&&e._subscribers.delete(a)}),a._deps.clear(),o=!0)}}});return n},p.effect=e=>{let t=()=>{t._deps.forEach(e=>{e._subscribers&&e._subscribers.delete(t)}),t._deps.clear(),s.push(t),l=t;try{e()}catch(e){p.diagnostics.reportError(e)}finally{s.pop(),l=s[s.length-1]||null}};return t._deps=new Set,t._addDep=e=>{t._deps.add(e)},t(),()=>{t._deps.forEach(e=>{e._subscribers&&e._subscribers.delete(t)}),t._deps.clear()}},p.if=(e,t,r)=>{let o=p.div({style:{display:"contents"}}),a=null,n=void 0;var i,s=e=>{var e=!!e;e!==n&&(n=e,o.childNodes&&Array.from(o.childNodes).forEach(u),o.innerHTML="",(e=e?t:r)?(a="function"==typeof e?e():e,o.appendChild(a)):a=null)};let l;return e&&"function"==typeof e.subscribe?l=e.subscribe(s):"function"==typeof e?(i=p.computed(()=>!!e()),l=i.subscribe(s)):s(!!e),l&&(o._cleanups||(o._cleanups=[]),o._cleanups.push(l)),o},p.for=(e,l)=>{let r=p.div({style:{display:"contents"}}),d=new Map;var t,o=e=>{if(Array.isArray(e)){let n=new Set,i=[],s=new Map;e.forEach((e,t)=>{var r=e&&"object"==typeof e&&void 0!==e.id?e.id:e,o=(s.get(r)||0)+1,r=(s.set(r,o),1===o?r:"object"==typeof r?"dup::"+o:r+"::dup::"+o),o=(n.add(r),d.get(r));let a;o&&o.item===e?a=o.el:(o&&u(o.el),(a=l(e,t))&&11===a.nodeType&&"undefined"!=typeof document&&((t=document.createElement("span")).style.display="contents",t.appendChild(a),a=t),c(a)&&(d.set(r,{el:a,item:e}),o)&&o.el&&o.el.parentNode&&o.el.parentNode.replaceChild(a,o.el)),c(a)&&i.push(a)}),d.forEach((e,t)=>{n.has(t)||(u(e.el),e.el.parentNode===r&&("function"==typeof r.removeChild?r.removeChild(e.el):"function"==typeof e.el.remove&&e.el.remove()),d.delete(t))}),i.forEach((e,t)=>{t=r.children?r.children[t]:null;t!==e&&(t?r.insertBefore(e,t):r.appendChild(e))})}else r.innerHTML="",d.clear()};return e&&"function"==typeof e.subscribe?(t=e.subscribe(o),r._cleanups||(r._cleanups=[]),r._cleanups.push(t)):o(e),r},p.signal=p.state,p.watch=(e,a)=>{if(e&&"function"==typeof e.subscribe){let r=!0,o;return e.subscribe(e=>{var t=o;o=e,r?(r=!1,a(e,void 0)):a(e,t)})}if("function"==typeof e){e=p.computed(e);let r=!0,o;return e.subscribe(e=>{var t=o;o=e,r?(r=!1,a(e,void 0)):a(e,t)})}},p.bind=(a,n)=>{if(a){let t="checkbox"===a.type,e=n.subscribe(e=>{t?a.checked=!!e:a.value=null!=e?e:""}),r=e=>{t?n.value=e.target.checked:"number"===a.type||"range"===a.type?n.value=parseFloat(e.target.value)||0:n.value=e.target.value},o=t?"change":"input";a.addEventListener(o,r),a._cleanups||(a._cleanups=[]),a._cleanups.push(()=>{e(),a.removeEventListener(o,r)})}},p.model=t=>({value:()=>t.value,oninput:e=>{"checkbox"===e.target.type?t.value=e.target.checked:"number"===e.target.type||"range"===e.target.type?t.value=parseFloat(e.target.value)||0:t.value=e.target.value}}),p.plugin=e=>p.use(e)}),f.push(o=>{let r=[],n=o.state(null),i=o.state({}),a=(o.route=(e,t)=>{e=e.startsWith("#")?e.substring(1):e;r.push({path:e,regex:new RegExp("^"+e.replace(/:\w+/g,"([^/]+)")+"$"),keys:(e.match(/:\w+/g)||[]).map(e=>e.slice(1)),componentFn:t}),o.runtime.routes=r},o.navigate=e=>{"undefined"!=typeof window&&(window.location.hash=e.startsWith("#")?e:"#"+e)},"undefined"!=typeof window&&window.addEventListener("hashchange",()=>{var e,t=window.location.hash.slice(1)||"/";let a=!1;for(e of r){let o=t.match(e.regex);if(o){let r={};e.keys.forEach((e,t)=>{r[e]=o[t+1]}),i.value=r,n.value=e.componentFn,a=!0;break}}a||(n.value=()=>o.div("404 - Route Not Found"))}),o.useParams=()=>i,o.router=()=>{"undefined"!=typeof window&&0<r.length&&!n.value&&window.dispatchEvent(new Event("hashchange"));let t=o.if(n,()=>{var e=n.value;return e&&e.prototype&&"function"==typeof o.component&&e.prototype instanceof o.component?(new e).render():"function"==typeof e?e():o.div()},()=>o.div());return"undefined"!=typeof document&&setTimeout(()=>{var e=document.querySelector(".papyr-main-content");e&&!e.contains(t)&&(e.innerHTML="",e.appendChild(t))},0),t},[]),s=o.state(null),l=o.state({}),d=()=>{if("undefined"!=typeof window){var t,r=window.location.pathname||"/";let e=!1;for(t of a){let o=r.match(t.regex);if(o){let r={};t.keys.forEach((e,t)=>{r[e]=o[t+1]}),l.value=r,s.value=t.componentFn,e=!0;break}}e||(s.value=()=>o.div("404 - Page Not Found"))}};o.page=(e,t)=>{if(void 0===e)return o.pageRouter();a.push({path:e,regex:new RegExp("^"+e.replace(/:\w+/g,"([^/]+)")+"$"),keys:(e.match(/:\w+/g)||[]).map(e=>e.slice(1)),componentFn:t}),"undefined"!=typeof window&&0<a.length&&!s.value&&setTimeout(d,10)},o.page.navigate=e=>{"undefined"!=typeof window&&(window.history.pushState(null,"",e),d())},o.usePageParams=()=>l,o.pageRouter=()=>{"undefined"!=typeof window&&0<a.length&&!s.value&&d();let t=o.if(s,()=>{var e=s.value;return e&&e.prototype&&"function"==typeof o.component&&e.prototype instanceof o.component?(new e).render():"function"==typeof e?e():o.div()},()=>o.div());return"undefined"!=typeof document&&setTimeout(()=>{var e=document.querySelector(".papyr-main-content");e&&!e.contains(t)&&(e.innerHTML="",e.appendChild(t))},0),t},"undefined"!=typeof window&&(window.addEventListener("popstate",d),window.addEventListener("click",e=>{var t=e.target.closest("a");t&&t.href&&t.origin===window.location.origin&&!t.hash&&!t.getAttribute("download")&&"_blank"!==t.target&&(e.preventDefault(),o.page.navigate(t.pathname+t.search))}))}),f.push(a=>{let r=e=>e.reduce((e,t)=>e.concat(Array.isArray(t)?r(t):t),[]),n=e=>{e=e&&"function"==typeof e.subscribe?e.value:e;return Array.isArray(e)?e.reduce((e,t)=>e+Number(t||0),0):Number(e||0)};a.math={sum:(...e)=>a.computed(()=>r(e).reduce((e,t)=>e+n(t),0)),sub:(e,t)=>a.computed(()=>n(e)-n(t)),mul:(...t)=>a.computed(()=>{var e=r(t);return 0===e.length?0:e.reduce((e,t)=>{t=t&&"function"==typeof t.subscribe?t.value:t;return Array.isArray(t)?e*t.reduce((e,t)=>e*Number(null==t?1:t),1):e*(null==t?1:Number(t))},1)}),div:(t,r)=>a.computed(()=>{var e=n(r);return 0===e?0:n(t)/e}),avg:(...t)=>a.computed(()=>{var e=r(t);return 0===e.length?0:e.reduce((e,t)=>e+n(t),0)/e.length}),percent:(t,r)=>a.computed(()=>{var e=n(r);return 0===e?0:n(t)/e*100}),round:(r,o=0)=>a.computed(()=>{var e=n(r),t=n(o),t=Math.pow(10,t);return Math.round(e*t)/t})}}),f.push(d=>{let t=a=>new Promise((r,o)=>{if("undefined"==typeof window||!window.indexedDB)return o(new Error("IndexedDB not supported"));var e=window.indexedDB.open("papyr_database");e.onsuccess=e=>{var t,e=e.target.result;e.objectStoreNames.contains(a)?r(e):(t=e.version+1,e.close(),(e=window.indexedDB.open("papyr_database",t)).onupgradeneeded=e=>{e.target.result.createObjectStore(a,{keyPath:"id"})},e.onsuccess=e=>{r(e.target.result)},e.onerror=e=>o(e))},e.onerror=e=>o(e),e.onupgradeneeded=e=>{e=e.target.result;e.objectStoreNames.contains(a)||e.createObjectStore(a,{keyPath:"id"})}}),o=(d.db=(i,e="local")=>{let o={local:{get:()=>{try{var e=localStorage.getItem("papyr_db_"+i);return e?JSON.parse(e):[]}catch(e){return console.error("PapyrDB [local] get error:",e),[]}},insert:e=>{try{var t=o.local.get();t.push(e),localStorage.setItem("papyr_db_"+i,JSON.stringify(t))}catch(e){console.error("PapyrDB [local] insert error:",e)}},update:(t,r)=>{try{var e=o.local.get().map(e=>e.id===t?{...e,...r}:e);localStorage.setItem("papyr_db_"+i,JSON.stringify(e))}catch(e){console.error("PapyrDB [local] update error:",e)}},delete:t=>{try{var e=o.local.get().filter(e=>e.id!==t);localStorage.setItem("papyr_db_"+i,JSON.stringify(e))}catch(e){console.error("PapyrDB [local] delete error:",e)}},clear:()=>{try{localStorage.removeItem("papyr_db_"+i)}catch(e){console.error("PapyrDB [local] clear error:",e)}}},session:{get:()=>{try{var e=sessionStorage.getItem("papyr_db_"+i);return e?JSON.parse(e):[]}catch(e){return console.error("PapyrDB [session] get error:",e),[]}},insert:e=>{try{var t=o.session.get();t.push(e),sessionStorage.setItem("papyr_db_"+i,JSON.stringify(t))}catch(e){console.error("PapyrDB [session] insert error:",e)}},update:(t,r)=>{try{var e=o.session.get().map(e=>e.id===t?{...e,...r}:e);sessionStorage.setItem("papyr_db_"+i,JSON.stringify(e))}catch(e){console.error("PapyrDB [session] update error:",e)}},delete:t=>{try{var e=o.session.get().filter(e=>e.id!==t);sessionStorage.setItem("papyr_db_"+i,JSON.stringify(e))}catch(e){console.error("PapyrDB [session] delete error:",e)}},clear:()=>{try{sessionStorage.removeItem("papyr_db_"+i)}catch(e){console.error("PapyrDB [session] clear error:",e)}}},indexeddb:{getAsync:()=>new Promise(r=>{t(i).then(t=>{try{let e=t.transaction(i,"readonly").objectStore(i).getAll();e.onsuccess=()=>{t.close(),r(e.result||[])},e.onerror=()=>{t.close(),r([])}}catch(e){t.close(),r([])}}).catch(()=>r([]))}),insertAsync:o=>new Promise(r=>{t(i).then(t=>{try{var e=t.transaction(i,"readwrite").objectStore(i);e.put(o).onsuccess=()=>{t.close(),r()},e.put(o).onerror=()=>{t.close(),r()}}catch(e){console.error("PapyrDB [indexeddb] insert error:",e),t.close(),r()}}).catch(()=>r())}),updateAsync:(e,n)=>new Promise(a=>{t(i).then(o=>{try{let t=o.transaction(i,"readwrite").objectStore(i),r=t.get(e);r.onsuccess=()=>{var e=r.result;e?(e={...e,...n},t.put(e).onsuccess=()=>{o.close(),a()},t.put(e).onerror=()=>{o.close(),a()}):(o.close(),a())},r.onerror=()=>{o.close(),a()}}catch(e){console.error("PapyrDB [indexeddb] update error:",e),o.close(),a()}}).catch(()=>a())}),deleteAsync:o=>new Promise(r=>{t(i).then(t=>{try{var e=t.transaction(i,"readwrite").objectStore(i);e.delete(o).onsuccess=()=>{t.close(),r()},e.delete(o).onerror=()=>{t.close(),r()}}catch(e){console.error("PapyrDB [indexeddb] delete error:",e),t.close(),r()}}).catch(()=>r())}),clearAsync:()=>new Promise(r=>{t(i).then(t=>{try{var e=t.transaction(i,"readwrite").objectStore(i);e.clear().onsuccess=()=>{t.close(),r()},e.clear().onerror=()=>{t.close(),r()}}catch(e){console.error("PapyrDB [indexeddb] clear error:",e),t.close(),r()}}).catch(()=>r())})},sqlite:{getAsync:()=>new Promise(o=>{if("undefined"!=typeof window&&window.sqlitePlugin)try{window.sqlitePlugin.openDatabase({name:"papyr.db",location:"default"}).transaction(e=>{e.executeSql(`CREATE TABLE IF NOT EXISTS ${i} (id TEXT PRIMARY KEY, data TEXT)`),e.executeSql("SELECT data FROM "+i,[],(e,t)=>{var r=[];for(let e=0;e<t.rows.length;e++)try{r.push(JSON.parse(t.rows.item(e).data))}catch(e){}o(r)},()=>o([]))},()=>o([]))}catch(e){o([])}else if("undefined"!=typeof window&&window.SQL&&window.papyrSQLiteDB)try{var e=window.papyrSQLiteDB,r=(e.run(`CREATE TABLE IF NOT EXISTS ${i} (id TEXT PRIMARY KEY, data TEXT)`),e.exec("SELECT data FROM "+i));let t=[];r&&r[0]&&r[0].values&&r[0].values.forEach(e=>{try{t.push(JSON.parse(e[0]))}catch(e){}}),o(t)}catch(e){o([])}else o([])}),insertAsync:r=>new Promise(t=>{if("undefined"!=typeof window&&window.sqlitePlugin)try{window.sqlitePlugin.openDatabase({name:"papyr.db",location:"default"}).transaction(e=>{e.executeSql(`CREATE TABLE IF NOT EXISTS ${i} (id TEXT PRIMARY KEY, data TEXT)`),e.executeSql(`INSERT OR REPLACE INTO ${i} (id, data) VALUES (?, ?)`,[r.id,JSON.stringify(r)])},()=>t(),()=>t())}catch(e){t()}else if("undefined"!=typeof window&&window.SQL&&window.papyrSQLiteDB)try{var e=window.papyrSQLiteDB;e.run(`CREATE TABLE IF NOT EXISTS ${i} (id TEXT PRIMARY KEY, data TEXT)`),e.run(`INSERT OR REPLACE INTO ${i} (id, data) VALUES (?, ?)`,[r.id,JSON.stringify(r)]),t()}catch(e){t()}else t()}),updateAsync:(a,n)=>new Promise(o=>{if("undefined"!=typeof window&&window.sqlitePlugin)try{window.sqlitePlugin.openDatabase({name:"papyr.db",location:"default"}).transaction(e=>{e.executeSql(`SELECT data FROM ${i} WHERE id = ?`,[a],(e,t)=>{if(0<t.rows.length)try{var r={...JSON.parse(t.rows.item(0).data),...n};e.executeSql(`INSERT OR REPLACE INTO ${i} (id, data) VALUES (?, ?)`,[a,JSON.stringify(r)],()=>o())}catch(e){o()}else o()},()=>o())},()=>o())}catch(e){o()}else if("undefined"!=typeof window&&window.SQL&&window.papyrSQLiteDB)try{var e,t=window.papyrSQLiteDB,r=t.exec(`SELECT data FROM ${i} WHERE id = '${a}'`);r&&r[0]&&r[0].values&&r[0].values[0]&&(e={...JSON.parse(r[0].values[0][0]),...n},t.run(`INSERT OR REPLACE INTO ${i} (id, data) VALUES (?, ?)`,[a,JSON.stringify(e)])),o()}catch(e){o()}else o()}),deleteAsync:r=>new Promise(t=>{if("undefined"!=typeof window&&window.sqlitePlugin)try{window.sqlitePlugin.openDatabase({name:"papyr.db",location:"default"}).transaction(e=>{e.executeSql(`DELETE FROM ${i} WHERE id = ?`,[r])},()=>t(),()=>t())}catch(e){t()}else if("undefined"!=typeof window&&window.SQL&&window.papyrSQLiteDB)try{window.papyrSQLiteDB.run(`DELETE FROM ${i} WHERE id = ?`,[r]),t()}catch(e){t()}else t()}),clearAsync:()=>new Promise(t=>{if("undefined"!=typeof window&&window.sqlitePlugin)try{window.sqlitePlugin.openDatabase({name:"papyr.db",location:"default"}).transaction(e=>{e.executeSql("DELETE FROM "+i)},()=>t(),()=>t())}catch(e){t()}else if("undefined"!=typeof window&&window.SQL&&window.papyrSQLiteDB)try{window.papyrSQLiteDB.run("DELETE FROM "+i),t()}catch(e){t()}else t()})}},a=(Object.keys(d.db.drivers).forEach(t=>{try{o[t]=d.db.drivers[t](i)}catch(e){console.error(`Failed to initialize custom db driver ${t}:`,e)}}),"local"!==e&&"session"!==e&&o[e]),n=e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Object.prototype.hasOwnProperty.call(o,e)?o[e]:o.local,s=d.state([]),r=[],l=(a?n.getAsync().then(t=>{s.value=t,r.forEach(e=>e(t))}):s.value=n.get(),()=>{r.forEach(e=>e(s.value))});return{state:s,list(){return s.value},async listAsync(){var e;return a?(e=await n.getAsync(),s.value=e):s.value},find(t){return s.value.find(e=>e.id===t)},async findAsync(t){var e;return a&&(e=await n.getAsync(),s.value=e),s.value.find(e=>e.id===t)},query(e={}){let t=[...s.value];if("function"==typeof e.filter?t=t.filter(e.filter):e.filter&&"object"==typeof e.filter&&(t=t.filter(r=>Object.entries(e.filter).every(([e,t])=>"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&!!Object.prototype.hasOwnProperty.call(r,e)&&r[e]===t))),e.sort){let{field:a,direction:n="asc"}=e.sort;t.sort((e,t)=>{if("__proto__"===a||"constructor"===a||"prototype"===a)return 0;let r=Object.prototype.hasOwnProperty.call(e,a)?e[a]:void 0,o=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;return"string"==typeof r&&(r=r.toLowerCase()),"string"==typeof o&&(o=o.toLowerCase()),r<o?"asc"===n?-1:1:r>o?"asc"===n?1:-1:0})}var r=e.offset||0,o=void 0!==e.limit?e.limit:t.length;return t.slice(r,r+o)},async queryAsync(e={}){var t;return a&&(t=await n.getAsync(),s.value=t),this.query(e)},insert(e){e={id:Date.now().toString(36)+Math.random().toString(36).substr(2,5),createdAt:(new Date).toISOString(),...e};return s.value=[...s.value,e],a?n.insertAsync(e).catch(e=>console.error("PapyrDBError:",e)):n.insert(e),l(),e},async insertAsync(e){e={id:Date.now().toString(36)+Math.random().toString(36).substr(2,5),createdAt:(new Date).toISOString(),...e};return s.value=[...s.value,e],a?await n.insertAsync(e):n.insert(e),l(),e},update(t,r){s.value=s.value.map(e=>e.id===t?{...e,...r,updatedAt:(new Date).toISOString()}:e);var e=this.find(t);e&&(a?n.updateAsync(t,e).catch(e=>console.error("PapyrDBError:",e)):n.update(t,e)),l()},async updateAsync(t,r){s.value=s.value.map(e=>e.id===t?{...e,...r,updatedAt:(new Date).toISOString()}:e);var e=this.find(t);e&&(a?await n.updateAsync(t,e):n.update(t,e)),l()},delete(t){s.value=s.value.filter(e=>e.id!==t),a?n.deleteAsync(t).catch(e=>console.error("PapyrDBError:",e)):n.delete(t),l()},async deleteAsync(t){s.value=s.value.filter(e=>e.id!==t),a?await n.deleteAsync(t):n.delete(t),l()},clear(){s.value=[],a?n.clearAsync().catch(e=>console.error("PapyrDBError:",e)):n.clear(),l()},async clearAsync(){s.value=[],a?await n.clearAsync():n.clear(),l()},watch(t){return r.push(t),t(s.value),()=>r=r.filter(e=>e!==t)},async transaction(e){var r,t=JSON.stringify(s.value),o={_ops:[],insert(e){e={id:Date.now().toString(36)+Math.random().toString(36).substr(2,5),createdAt:(new Date).toISOString(),...e};return this._ops.push({type:"insert",record:e}),e},update(e,t){this._ops.push({type:"update",id:e,data:t})},delete(e){this._ops.push({type:"delete",id:e})}};try{await e(o);for(let t of o._ops)"insert"===t.type?(a?await n.insertAsync(t.record):n.insert(t.record),s.value=[...s.value,t.record]):"update"===t.type?(s.value=s.value.map(e=>e.id===t.id?{...e,...t.data,updatedAt:(new Date).toISOString()}:e),(r=s.value.find(e=>e.id===t.id))&&(a?await n.updateAsync(t.id,r):n.update(t.id,r))):"delete"===t.type&&(s.value=s.value.filter(e=>e.id!==t.id),a?await n.deleteAsync(t.id):n.delete(t.id));l()}catch(e){throw s.value=JSON.parse(t),l(),e}}}},d.db.drivers={},d.db.registerDriver=(e,t)=>{"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(d.db.drivers[e]=t)},(e,t)=>{if(void 0===t){var r=localStorage.getItem(e);if(null==r)return null;try{return JSON.parse(r)}catch(e){return r}}null===t?localStorage.removeItem(e):localStorage.setItem(e,"object"==typeof t?JSON.stringify(t):String(t))}),a=(o.set=(e,t)=>o(e,t),o.get=e=>o(e),o.remove=e=>localStorage.removeItem(e),o.clear=()=>localStorage.clear(),o.secureSet=(e,t,r)=>{if(!d.security)return console.error("PapyrError: Security module not loaded.");localStorage.setItem(e,d.security.encrypt(JSON.stringify(t),r))},o.secureGet=(e,t)=>{if(!d.security)return console.error("PapyrError: Security module not loaded.");e=localStorage.getItem(e);if(!e)return null;try{return JSON.parse(d.security.decrypt(e,t))}catch(e){return null}},o.secureSetAsync=async(e,t,r)=>{if(!d.security||"function"!=typeof d.security.encryptAsync)return o.secureSet(e,t,r);t=await d.security.encryptAsync(JSON.stringify(t),r);localStorage.setItem(e,t)},o.secureGetAsync=async(e,t)=>{if(!d.security||"function"!=typeof d.security.decryptAsync)return o.secureGet(e,t);e=localStorage.getItem(e);if(!e)return null;try{var r=await d.security.decryptAsync(e,t);return JSON.parse(r)}catch(e){return null}},d.storage=o,(e,t)=>{if(void 0===t){var r=sessionStorage.getItem(e);if(null==r)return null;try{return JSON.parse(r)}catch(e){return r}}null===t?sessionStorage.removeItem(e):sessionStorage.setItem(e,"object"==typeof t?JSON.stringify(t):String(t))});a.set=(e,t)=>a(e,t),a.get=e=>a(e),a.remove=e=>sessionStorage.removeItem(e),a.clear=()=>sessionStorage.clear(),a.secureSet=(e,t,r)=>{if(!d.security)return console.error("PapyrError: Security module not loaded.");sessionStorage.setItem(e,d.security.encrypt(JSON.stringify(t),r))},a.secureGet=(e,t)=>{if(!d.security)return console.error("PapyrError: Security module not loaded.");e=sessionStorage.getItem(e);if(!e)return null;try{return JSON.parse(d.security.decrypt(e,t))}catch(e){return null}},a.secureSetAsync=async(e,t,r)=>{if(!d.security||"function"!=typeof d.security.encryptAsync)return a.secureSet(e,t,r);t=await d.security.encryptAsync(JSON.stringify(t),r);sessionStorage.setItem(e,t)},a.secureGetAsync=async(e,t)=>{if(!d.security||"function"!=typeof d.security.decryptAsync)return a.secureGet(e,t);e=sessionStorage.getItem(e);if(!e)return null;try{var r=await d.security.decryptAsync(e,t);return JSON.parse(r)}catch(e){return null}},d.session=a,d.data={local:e=>d.db(e,"local"),session:e=>d.db(e,"session"),indexed:e=>d.db(e,"indexeddb"),remote:e=>d.db(e,"firebase")},d.drafts={save(e,t){d.storage.set("papyr_draft_"+e,{data:t,timestamp:Date.now()})},restore(e){e=d.storage.get("papyr_draft_"+e);return e?e.data:null},clear(e){d.storage.remove("papyr_draft_"+e)}},d.continuity={_intervals:new Map,enable(e={}){let{key:r="default",target:o=null,interval:t=5e3,onSave:a=null}=e;this._intervals.has(r)||((e=()=>{let e=null;var t;"function"==typeof o?e=o():o&&"object"==typeof o&&void 0!==o.value?e=o.value:o&&"string"==typeof o&&(t=document.querySelector(o))&&(e="checkbox"===t.type?t.checked:t.value),null!==e&&(d.drafts.save(r,e),"function"==typeof a)&&a(e)})(),e=setInterval(e,t),this._intervals.set(r,e))},disable(e="default"){var t=this._intervals.get(e);t&&(clearInterval(t),this._intervals.delete(e))},restore(e={}){var{key:e="default",target:t=null,onRestore:r=null}=e,e=d.drafts.restore(e);return null!==e?("function"==typeof r?r(e):t&&"object"==typeof t&&void 0!==t.value?t.value=e:t&&"string"==typeof t&&(r=document.querySelector(t))&&("checkbox"===r.type?r.checked=!!e:r.value=e),e):null}},d.offline={_queue:[],_isOnline:"undefined"==typeof navigator||navigator.onLine,_syncListeners:new Set,enable(e={}){var{onSync:e=null}=e,e=(e&&this._syncListeners.add(e),"undefined"!=typeof window&&(window.addEventListener("online",()=>{this._isOnline=!0,this.sync()}),window.addEventListener("offline",()=>{this._isOnline=!1})),d.storage.get("papyr_offline_queue"));Array.isArray(e)&&(this._queue=e),this._isOnline&&this.sync()},queueWrite(e,t,r){this._queue.push({id:Date.now().toString(36)+Math.random().toString(36).substr(2,5),action:e,collection:t,data:r,timestamp:Date.now()}),d.storage.set("papyr_offline_queue",this._queue),this._isOnline&&this.sync()},async sync(){if(this._isOnline&&0!==this._queue.length){var t,e=[...this._queue];this._queue=[],d.storage.remove("papyr_offline_queue");for(t of e)for(var r of this._syncListeners)try{await r(t)}catch(e){console.error("Offline sync error, pushing back to queue:",e),this._queue.push(t),d.storage.set("papyr_offline_queue",this._queue)}}}},d.retry=async(e,t={})=>{var{retries:r=3,delay:t=1e3,factor:o=2,onError:a=null}=t;let n=t;for(let t=0;t<r;t++)try{return await e()}catch(e){if(a&&a(e,t+1),t===r-1)throw e;await new Promise(e=>setTimeout(e,n)),n*=o}}}),f.push(r=>{r.crud=(e,t=[])=>{let a=r.state((()=>{try{return r.storage(e)||t}catch(e){return t}})()),o=()=>{try{r.storage(e,a.value)}catch(e){console.warn("PapyrStorageWarning: LocalStorage sync failed.",e)}};return{state:a,list(){return a.value},query(e={}){let t=[...a.value];if("function"==typeof e.filter?t=t.filter(e.filter):e.filter&&"object"==typeof e.filter&&(t=t.filter(r=>Object.entries(e.filter).every(([e,t])=>"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&!!Object.prototype.hasOwnProperty.call(r,e)&&r[e]===t))),e.sort){let{field:a,direction:n="asc"}=e.sort;t.sort((e,t)=>{if("__proto__"===a||"constructor"===a||"prototype"===a)return 0;let r=Object.prototype.hasOwnProperty.call(e,a)?e[a]:void 0,o=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;return"string"==typeof r&&(r=r.toLowerCase()),"string"==typeof o&&(o=o.toLowerCase()),r<o?"asc"===n?-1:1:r>o?"asc"===n?1:-1:0})}var r=e.offset||0,o=void 0!==e.limit?e.limit:t.length;return t.slice(r,r+o)},create(e){e={id:Date.now().toString(36)+Math.random().toString(36).substr(2,5),createdAt:(new Date).toISOString(),...e};return a.value=[...a.value,e],o(),e},read(t){return a.value.find(e=>e.id===t)},findById(e){return this.read(e)},update(t,r){a.value=a.value.map(e=>e.id===t?{...e,...r,updatedAt:(new Date).toISOString()}:e),o()},delete(t){a.value=a.value.filter(e=>e.id!==t),o()},clear(){a.value=[],o()}}}}),f.push(r=>{class e{constructor(e={}){Object.assign(this,e)}save(){var e=this.constructor.name.toLowerCase()+"s";return this.id?r.db(e).update(this.id,this):(e=r.db(e).insert(this),this.id=e.id),this}delete(){var e=this.constructor.name.toLowerCase()+"s";this.id&&r.db(e).delete(this.id)}static create(e){return new this(e).save()}static find(e){var t=this.name.toLowerCase()+"s",t=r.db(t).find(e);return t?new this(t):null}static all(){var e=this.name.toLowerCase()+"s";return r.db(e).state.value.map(e=>new this(e))}static watch(t){var e=this.name.toLowerCase()+"s";return r.db(e).watch(e=>{t(e.map(e=>new this(e)))})}}function t(t){if(!new.target)return{value:()=>t.value,oninput:e=>{"checkbox"===e.target.type?t.value=e.target.checked:"number"===e.target.type||"range"===e.target.type?t.value=parseFloat(e.target.value)||0:t.value=e.target.value}};Object.assign(this,t||{})}Object.setPrototypeOf(t,e),t.prototype=Object.create(e.prototype),r.model=t.prototype.constructor=t}),f.push(n=>{n.auth={user:n.state(null),_config:{provider:"local"},_providers:{},use(e){return this._config.provider=e,this._providers[e]||this},registerProvider(e,t){"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(this._providers[e]=t)},async _hashPassword(t){var e;if("undefined"!=typeof window&&window.crypto&&window.crypto.subtle)return e=(new TextEncoder).encode(t),e=await window.crypto.subtle.digest("SHA-256",e),Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join("");let r=0;for(let e=0;e<t.length;e++){var o=t.charCodeAt(e);r=(r<<5)-r+o,r&=r}return"sha256_poly_"+Math.abs(r).toString(16)},init(e){var t,r;this._config={...this._config,...e},"local"===this._config.provider&&(e=n.storage.get("auth_token"))&&(r=n.storage.get("papyr_auth_sessions")||{},(r=e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Object.prototype.hasOwnProperty.call(r,e)?r[e]:null)&&(t="object"==typeof r?r.username:r,!((r="object"==typeof r?r.expiresAt:null)&&Date.now()>r))&&(r=n.storage.get("papyr_auth_users")||{},r=t&&"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&Object.prototype.hasOwnProperty.call(r,t)?r[t]:null)?this.user.value={id:r.id,username:t,token:e}:this.logout())},async login(t){if("local"!==this._config.provider)return(r=this._providers[this._config.provider])&&"function"==typeof r.login?(r=await r.login(t),this.user.value=r):Promise.reject(new Error(`Auth provider "${this._config.provider}" is not registered or does not support login.`));if(!t.username||!t.password)return Promise.reject(new Error("Authentication failed: Username and password are required."));var r=n.storage.get("papyr_auth_lockouts")||{},o=t.username&&"__proto__"!==t.username&&"constructor"!==t.username&&"prototype"!==t.username&&Object.prototype.hasOwnProperty.call(r,t.username)?r[t.username]:null;if(o&&5<=o.failedCount&&Date.now()<o.lockedUntil)return e=Math.ceil((o.lockedUntil-Date.now())/6e4),Promise.reject(new Error(`Account locked: Too many failed login attempts. Try again in ${e} minutes.`));var e=n.storage.get("papyr_auth_users")||{},e=t.username&&"__proto__"!==t.username&&"constructor"!==t.username&&"prototype"!==t.username&&Object.prototype.hasOwnProperty.call(e,t.username)?e[t.username]:null;if(!e)return Promise.reject(new Error("Authentication failed: Username does not exist."));var a=await this._hashPassword(t.password);if(e.passwordHash!==a){a=(o?o.failedCount:0)+1;let e=null;return 5<=a&&(e=Date.now()+9e5),t.username&&"__proto__"!==t.username&&"constructor"!==t.username&&"prototype"!==t.username&&(r[t.username]={failedCount:a,lockedUntil:e}),n.storage.set("papyr_auth_lockouts",r),5<=a?Promise.reject(new Error("Account locked: Too many failed login attempts. Locked for 15 minutes.")):Promise.reject(new Error(`Authentication failed: Incorrect password. ${5-a} attempts remaining.`))}t.username&&"__proto__"!==t.username&&"constructor"!==t.username&&"prototype"!==t.username&&Object.prototype.hasOwnProperty.call(r,t.username)&&(delete r[t.username],n.storage.set("papyr_auth_lockouts",r));o="local_session_"+Math.random().toString(36).substr(2,9),a=n.storage.get("papyr_auth_sessions")||{},o&&"__proto__"!=o&&"constructor"!=o&&"prototype"!=o&&(a[o]={username:t.username,expiresAt:Date.now()+72e5}),n.storage.set("papyr_auth_sessions",a),n.storage.set("auth_token",o),r={id:e.id,username:t.username,token:o};return this.user.value=r},async register(e){var t,r,o;return"local"===this._config.provider?e.username&&e.password?e.password.length<8?Promise.reject(new Error("Registration failed: Password must be at least 8 characters long.")):(r=n.storage.get("papyr_auth_users")||{},Object.prototype.hasOwnProperty.call(r,e.username)?Promise.reject(new Error("Registration failed: Username already exists.")):(t=await this._hashPassword(e.password),e.username&&"__proto__"!==e.username&&"constructor"!==e.username&&"prototype"!==e.username&&(r[e.username]={id:Date.now(),username:e.username,passwordHash:t}),n.storage.set("papyr_auth_users",r),t="local_session_"+Math.random().toString(36).substr(2,9),o=n.storage.get("papyr_auth_sessions")||{},t&&"__proto__"!=t&&"constructor"!=t&&"prototype"!=t&&(o[t]={username:e.username,expiresAt:Date.now()+72e5}),n.storage.set("papyr_auth_sessions",o),n.storage.set("auth_token",t),o=e.username&&"__proto__"!==e.username&&"constructor"!==e.username&&"prototype"!==e.username&&Object.prototype.hasOwnProperty.call(r,e.username)?r[e.username].id:Date.now(),this.user.value={id:o,username:e.username,token:t})):Promise.reject(new Error("Registration failed: Username and password are required.")):(r=this._providers[this._config.provider])&&"function"==typeof r.register?(o=await r.register(e),this.user.value=o):Promise.reject(new Error(`Auth provider "${this._config.provider}" is not registered or does not support registration.`))},logout(){var e,t;return"local"===this._config.provider?((t=n.storage.get("auth_token"))&&(e=n.storage.get("papyr_auth_sessions")||{},t)&&"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&(delete e[t],n.storage.set("papyr_auth_sessions",e)),n.storage.set("auth_token",null),this.user.value=null,Promise.resolve()):(t=this._providers[this._config.provider])&&"function"==typeof t.logout?Promise.resolve(t.logout()).then(()=>{this.user.value=null}):(this.user.value=null,Promise.resolve())}}}),f.push(e=>{e.payments={_gateways:{},_config:{provider:"stripe"},use(e){return this._config=this._config||{},this._config.provider=e,this._gateways[e]||this},register(e,t){"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(this._gateways[e]=t)},resolve(e){return this._gateways[e]},async checkout(e,t){var r=this.resolve(e);return r?"function"!=typeof r.checkout?Promise.reject(new Error(`Payment gateway "${e}" does not implement checkout().`)):r.checkout(t):Promise.reject(new Error(`Payment gateway "${e}" is not registered.`))}}}),f.push(a=>{a.api={async get(t,e={}){try{var r=await fetch(t,{method:"GET",headers:{Accept:"application/json",...e}});if(r.ok)return await r.json();throw new Error("HTTP error! Status: "+r.status)}catch(e){throw a.warn&&a.warn("papyr.api.get failed for "+t,e),e}},async post(t,e,r={}){try{var o=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...r},body:JSON.stringify(e)});if(o.ok)return await o.json();throw new Error("HTTP error! Status: "+o.status)}catch(e){throw a.warn&&a.warn("papyr.api.post failed for "+t,e),e}}},a.cloud={_providers:{},_config:{provider:"vercel"},register(e,t){"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(this._providers[e]=t)},use(e){return this._config=this._config||{},this._config.provider=e,this._providers[e]||this}}}),f.push(t=>{t.log=(...e)=>{console.log("%c Papyr Log ","background: #3b82f6; color: white; border-radius: 4px; font-weight: bold; padding: 2px 4px;",...e)},t.warn=(...e)=>{console.warn("%c Papyr Warning ","background: #f59e0b; color: white; border-radius: 4px; font-weight: bold; padding: 2px 4px;",...e),t.diagnostics.errors.push({type:"warning",message:e.map(String).join(" "),timestamp:(new Date).toISOString()})}}),"undefined"==typeof window||window.papyr||(window.papyr=e());var r,s=e();"undefined"!=typeof window?window.papyr=s:"undefined"!=typeof global&&(global.papyr=s);let x=s;if(void 0===x)console.warn("Papyr core not detected. Official plugins require papyr core to run.");else{let s={bolt:'<path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',lock:'<rect x="3" y="11" width="18" height="11" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/><path d="M7 11V7a5 5 0 0110 0v4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',unlock:'<rect x="3" y="11" width="18" height="11" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/><path d="M7 11V7a5 5 0 019.9-1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',todo:'<path d="M9 11l3 3L22 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><rect x="3" y="4" width="18" height="18" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/>',home:'<path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><path d="M9 22V12h6v10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',book:'<path d="M2 3h6a4 4 0 014 4v14a3 3 0 00-3-3H2zM22 3h-6a4 4 0 00-4 4v14a3 3 0 013-3h7z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',users:'<path d="M17 21v-2a4 4 0 00-3-3H5a4 4 0 00-4 4v2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><circle cx="9" cy="7" r="4" stroke="currentColor" stroke-width="2" fill="none"/><path d="M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',folder:'<path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',search:'<circle cx="11" cy="11" r="8" stroke="currentColor" stroke-width="2" fill="none"/><path d="M21 21l-4.35-4.35" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',external:'<path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6M15 3h6v6M10 14L21 3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',image:'<rect x="3" y="3" width="18" height="18" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/><circle cx="8.5" cy="8.5" r="1.5" fill="currentColor"/><path d="M21 15l-5-5L5 21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',bell:'<path d="M18 8A6 6 0 006 8c0 7-3 9-3 9h18s-3-2-3-9M13.73 21a2 2 0 01-3.46 0" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',check:'<path d="M22 11.08V12a10 10 0 11-5.93-9.14M22 4L12 14.01l-3-3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',info:'<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none"/><path d="M12 16v-4M12 8h.01" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',alert:'<path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><path d="M12 9v4M12 17h.01" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',terminal:'<path d="M4 17l6-6-6-6M12 19h8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',copy:'<rect x="9" y="9" width="13" height="13" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',palette:'<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 14 3 16 4.5 17C5.5 17.6667 5.5 19 4 20C3 20.6667 3 22 5 22C6.5 22 8 21.5 9 20C9.66667 19.3333 10.3333 19 11 19C11.6667 19 12 20 12 22Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',code:'<path d="M16 18l6-6-6-6M8 6L2 12l6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',database:'<ellipse cx="12" cy="5" rx="9" ry="3" stroke="currentColor" stroke-width="2" fill="none"/><path d="M3 5v6c0 1.66 4 3 9 3s9-1.34 9-3V5M3 11v6c0 1.66 4 3 9 3s9-1.34 9-3v-6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',github:'<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 00-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0020 4.77 5.07 5.07 0 0019.91 1S18.73.65 16 2.48a13.38 13.38 0 00-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 005 4.77a5.44 5.44 0 00-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 009 18.13V22" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',settings:'<circle cx="12" cy="12" r="3" stroke="currentColor" stroke-width="2" fill="none"/><path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 11-2.83 2.83l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 11-2.83-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 112.83-2.83l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 112.83 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',package:'<path d="M21 16V8a2 2 0 00-1-1.73l-7-4a2 2 0 00-2 0l-7 4A2 2 0 003 8v8a2 2 0 001 1.73l7 4a2 2 0 002 0l7-4A2 2 0 0021 16z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><path d="M3.27 6.96L12 12.01l8.73-5.05M12 22.08V12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',refresh:'<path d="M21.5 2v6h-6M21.34 15.57a10 10 0 11-.57-8.38l5.67-5.67" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',arrowRight:'<path d="M5 12h14M12 5l7 7-7 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',arrowLeft:'<path d="M19 12H5M12 19l-7-7 7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',star:'<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',plus:'<path d="M12 5v14M5 12h14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',trash:'<path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2M10 11v6M14 11v6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',edit:'<path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7M18.5 2.5a2.121 2.121 0 113 3L12 15l-4 1 1-4 9.5-9.5z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',eye:'<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><circle cx="12" cy="12" r="3" stroke="currentColor" stroke-width="2" fill="none"/>',calendar:'<rect x="3" y="4" width="18" height="18" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/><path d="M16 2v4M8 2v4M3 10h18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',save:'<path d="M19 21H5a2 2 0 01-2-2V5a2 2 0 01-2-2h11l5 5v11a2 2 0 01-2 2z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><path d="M17 21v-8H7v8M7 3v5h8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',user:'<path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2" stroke="currentColor" stroke-width="2" fill="none"/><circle cx="12" cy="7" r="4" stroke="currentColor" stroke-width="2" fill="none"/>'},i=(x.icon=(e,t={})=>{var r=t.size||16,o=t.color||"currentColor",a=t.strokeWidth||2,n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("width",String(r)),n.setAttribute("height",String(r)),n.setAttribute("viewBox","0 0 24 24"),n.style.display="inline-block",n.style.verticalAlign="middle",n.style.color=o,t.style&&Object.assign(n.style,t.style),t.class&&n.setAttribute("class",t.class);let i=e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Object.prototype.hasOwnProperty.call(s,e)?s[e]:"";return 2!==a&&(i=i.replace(/stroke-width="2"/g,`stroke-width="${a}"`)),n.innerHTML=i,n},x.autoComplete=(r,o)=>{let a;var e,t=Array.isArray(r);(a=t?(e="string"==typeof o?o:"Search...",x.input("text",e,{style:{width:"100%"}})):"string"==typeof r?x.input("text",r,{style:{width:"100%"}}):r)&&"function"==typeof a.addEventListener||(e="string"==typeof o?o:"string"==typeof r?r:"Search...",(a=document.createElement("input")).type="text",a.placeholder=e,a.style.width="100%",a.className="input-text");let n=x.ul(".suggestions"),i=x.div(".autocomplete",a,n),s;return t?a.addEventListener("input",e=>{let t=e.target.value.toLowerCase().trim();n.innerHTML="",t&&r.filter(e=>e.toLowerCase().includes(t)).slice(0,5).forEach(t=>{var e=x.li(t,{on:{click:()=>{a.value=t,n.innerHTML="";var e=new CustomEvent("select",{detail:t}),e=(i.dispatchEvent(e),new CustomEvent("change",{detail:t}));i.dispatchEvent(e)}}});n.appendChild(e)})}):a.addEventListener("input",async e=>{clearTimeout(s);let t=e.target.value;t.length<2?n.innerHTML="":s=setTimeout(async()=>{try{var e=await(await fetch(""+o+t)).json();n.innerHTML="",(Array.isArray(e)?e:e.results||e.products||e.data||[]).slice(0,5).forEach(t=>{let r=t.title||t.name||t.username||t;var e=x.li(r,{on:{click:()=>{a.value=r,n.innerHTML="",x.onSuggestion&&x.onSuggestion(t);var e=new CustomEvent("select",{detail:t}),e=(i.dispatchEvent(e),new CustomEvent("change",{detail:r}));i.dispatchEvent(e)}}});n.appendChild(e)})}catch(e){console.error(e)}},300)}),document.addEventListener("click",e=>{i.contains(e.target)||(n.innerHTML="")}),i},x.form=(...t)=>{if(0<t.length&&Array.isArray(t[0])){let[e,r]=t,a=x("form",".papyr-form"),n=[];e.forEach(e=>{var t=x.div(".form-field"),r=x.label(e.label,{for:e.name});let o;"select"===e.type?(o=x.select({name:e.name,id:e.name}),e.options.forEach(e=>{o.appendChild(x.option(e,{value:e,textContent:e}))})):o="textarea"===e.type?x.textarea("",{name:e.name,id:e.name,rows:e.rows||3,placeholder:e.placeholder||""}):x.input("",{type:e.type||"text",name:e.name,id:e.name,placeholder:e.placeholder||""}),t.appendChild(r),t.appendChild(o),a.appendChild(t),n.push(o)});var o=x.button("Submit",{type:"submit",class:"btn-primary"});return a.appendChild(o),a.addEventListener("submit",e=>{e.preventDefault();let t=Object.create(null);n.forEach(e=>{e.name&&"__proto__"!==e.name&&"constructor"!==e.name&&"prototype"!==e.name&&(t[e.name]=e.value)}),r&&r(t)}),a}return x("form",...t)},x.card=(...e)=>{var t,r,o,a;return!(0<e.length&&"object"==typeof e[0])||e[0]instanceof Element||e[0]instanceof DocumentFragment||Array.isArray(e[0])||"function"==typeof e[0].subscribe?([a,o,r]=e,a=a?"string"==typeof a?x.h3(a,".card-title"):a:null,o=o?"string"==typeof o?x.div(o,".card-content"):o:null,t=[],a&&t.push(a),o&&t.push(o),r&&(a="string"==typeof r?x.div(r,".card-footer"):r,t.push(a)),x.div(".papyr-card",...t)):([o,...r]=e,a=(o={...o}).interactive,delete o.interactive,a&&(o.interactive="true"),x("div",".papyr-card",o,...r))},x.title=(...e)=>x("h1",".papyr-title",...e),x.muted=(...e)=>x("p",".papyr-muted",...e),x.modal=(e,t="Modal")=>{let r={},o=!1;null===e||"object"!=typeof e||e instanceof Element||e instanceof DocumentFragment?(r={content:e,title:"string"==typeof t?t:"Modal"},o=!0):r={...e};t=r.title||"Modal",e=r.content||"";let a=r.animation||"glass-pop",n=r.onClose,i=x.div({style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(2, 6, 23, 0.65)",backdropFilter:"blur(12px)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:9998,opacity:0,transition:"opacity 0.3s ease"},on:{click:e=>{e.target===i&&u()}}});var s="papyr-modal-"+Math.random().toString(36).substring(2,9);let l=x.div(".papyr-card.papyr-modal-box",{id:s,role:"dialog","aria-modal":"true","aria-labelledby":s+"-title",tabIndex:-1,style:{padding:"24px",width:"90%",maxWidth:"450px",background:"rgba(15, 23, 42, 0.65)",border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"24px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.5)",transform:"glass-pop"===a?"scale(0.9) translateY(10px)":"translateY(50px)",transition:"transform 0.4s cubic-bezier(0.16, 1, 0.3, 1)"}},x.flex.between(x.h3(t,{id:s+"-title",style:{margin:0,color:"#fff",fontSize:"1.25rem",fontWeight:"600"}}),x.button("×",{class:"close-btn",ariaLabel:"Close Dialog",on:{click:()=>u()},style:{background:"transparent",border:"none",color:"#94a3b8",fontSize:"24px",cursor:"pointer",padding:"0 4px",lineLight:1}})),x.div({style:{marginTop:"16px",color:"#cbd5e1",fontSize:"0.95rem",lineHeight:"1.5"}},e)),d=(i.appendChild(l),"undefined"!=typeof document?document.activeElement:null),p=e=>{var t,r;"Tab"===e.key&&0!==(r=l.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).length&&(t=r[0],r=r[r.length-1],e.shiftKey?document.activeElement===t&&(r.focus(),e.preventDefault()):document.activeElement===r&&(t.focus(),e.preventDefault()))},c=e=>{"Escape"===e.key&&u()};t=()=>{"undefined"!=typeof document&&(document.body.appendChild(i),i.offsetHeight,i.style.opacity="1",l.style.transform="glass-pop"===a?"scale(1) translateY(0)":"translateY(0)",setTimeout(()=>{var e=l.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');(e||l).focus()},100),document.addEventListener("keydown",c),l.addEventListener("keydown",p))};let u=()=>{i.style.opacity="0",l.style.transform="glass-pop"===a?"scale(0.9) translateY(10px)":"translateY(50px)",document.removeEventListener("keydown",c),l.removeEventListener("keydown",p),setTimeout(()=>{i.remove(),d&&"function"==typeof d.focus&&d.focus(),n&&n()},300)};return o?(i.show=t,i.hide=u,i):(t(),{close:u})},x.modal.alert=(e,t="Alert")=>{"undefined"!=typeof window&&window.alert&&window.alert(t+`
1
+ !function(){let y=null,o=!1,p=["html","head","body","title","div","span","p","h1","h2","h3","h4","h5","h6","button","a","img","input","textarea","select","option","optgroup","ul","ol","li","dl","dt","dd","table","thead","tbody","tfoot","tr","td","th","caption","colgroup","col","form","label","fieldset","legend","datalist","output","section","article","header","footer","nav","aside","main","pre","code","hr","br","strong","em","small","mark","sub","sup","i","b","u","s","tt","cite","address","blockquote","audio","video","source","track","picture","embed","iframe","canvas","svg","details","summary","dialog","menu","menuitem","template","slot"],a=null;"undefined"==typeof document&&(a={documentElement:{style:{setProperty(){}},setAttribute(){}},body:{appendChild(){},setAttribute(){}},head:{appendChild(){}},createElement(e){return{tagName:e.toUpperCase(),attributes:{},style:{setProperty(e,t){"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Reflect.set(this,e,t)}},classList:{_classes:[],add(e){this._classes.includes(e)||this._classes.push(e)},remove(t){this._classes=this._classes.filter(e=>e!==t)},contains(e){return this._classes.includes(e)}},childNodes:[],appendChild(e){this.childNodes.push(e),e&&"object"==typeof e&&(e.parentNode=this)},insertBefore(e,t){t=this.childNodes.indexOf(t);-1!==t?this.childNodes.splice(t,0,e):this.childNodes.push(e),e&&"object"==typeof e&&(e.parentNode=this)},removeChild(t){this.childNodes=this.childNodes.filter(e=>e!==t)},setAttribute(e,t){"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Reflect.set(this.attributes,e,t)},getAttribute(e){if("__proto__"!==e&&"constructor"!==e&&"prototype"!==e)return Reflect.get(this.attributes,e)},removeAttribute(e){"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Reflect.deleteProperty(this.attributes,e)},hasAttribute(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Reflect.has(this.attributes,e)},addEventListener(){},removeEventListener(){},get innerHTML(){var e=Object.entries(this.attributes).map(([e,t])=>e+`="${t}"`).join(" "),t=Object.entries(this.style).filter(([e])=>"function"!=typeof Reflect.get(this.style,e)).map(([e,t])=>e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+t).join("; "),e=[0<this.classList._classes.length?`class="${this.classList._classes.join(" ")}"`:"",e,t?`style="${t}"`:""].filter(Boolean).join(" "),t=this.childNodes.map(e=>"string"==typeof e?e:e.innerHTML||e.text||"").join("");return`<${this.tagName.toLowerCase()}${e?" "+e:""}>${t}</${this.tagName.toLowerCase()}>`}}},createTextNode(e){return{nodeType:3,text:e,get innerHTML(){return e}}},createDocumentFragment(){return{nodeType:11,childNodes:[],appendChild(e){this.childNodes.push(e)},get innerHTML(){return this.childNodes.map(e=>"string"==typeof e?e:e.innerHTML||e.text||"").join("")}}},querySelector(){return null},getElementById(){return null}});let d=e=>!(!e||"object"!=typeof e)&&("undefined"!=typeof Element&&e instanceof Element||"undefined"!=typeof DocumentFragment&&e instanceof DocumentFragment||"string"==typeof e.tagName&&"function"==typeof e.appendChild||1===e.nodeType||11===e.nodeType),n={flex:{display:"flex"},block:{display:"block"},inline:{display:"inline"},"inline-flex":{display:"inline-flex"},grid:{display:"grid"},hidden:{display:"none"},center:{justifyContent:"center",alignItems:"center"},"items-center":{alignItems:"center"},"justify-between":{justifyContent:"space-between"},"flex-col":{flexDirection:"column"},"flex-row":{flexDirection:"row"},"flex-wrap":{flexWrap:"wrap"},"rounded-sm":{borderRadius:"2px"},rounded:{borderRadius:"4px"},"rounded-md":{borderRadius:"6px"},"rounded-lg":{borderRadius:"8px"},"rounded-xl":{borderRadius:"12px"},"rounded-2xl":{borderRadius:"16px"},"rounded-full":{borderRadius:"9999px"},"shadow-sm":{boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},shadow:{boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)"},"shadow-md":{boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"},"shadow-lg":{boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},"shadow-xl":{boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"},"w-full":{width:"100%"},"h-full":{height:"100%"}},t=null,i=()=>{if(!t){if("undefined"==typeof document)return null;let e=null;(e="function"==typeof document.querySelector?document.querySelector("#papyr-dynamic-utilities"):e)||"function"==typeof document.createElement&&((e=document.createElement("style")).id="papyr-dynamic-utilities",document.head)&&"function"==typeof document.head.appendChild&&document.head.appendChild(e),t=e?e.sheet||e:null}return t},s=new Set,l=(t,e)=>{var r=i();if(r){t=t+` { ${e} }`;if(!s.has(t))if(s.add(t),r.insertRule)try{r.insertRule(t,r.cssRules.length)}catch(e){r.textContent+="\n"+t}else r.textContent+="\n"+t}},c=(a,e)=>{e&&(Array.isArray(e)?e:String(e).split(/\s+/)).forEach(e=>{e=e.trim();if(e)if(e.includes(":")){var t=e.split(":");if(2===t.length){var r=t[0],t=t[1],r={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"}[r],o=n[t]?n:"undefined"!=typeof paperUtilities?paperUtilities:{};if(r&&o[t]){let e=a._papyrUniqueClass;e||(e="papyr-u-"+Math.random().toString(36).substring(2,8),a.classList.add(e),a._papyrUniqueClass=e);o=Object.entries(Reflect.get(o,t)).map(([e,t])=>e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+`: ${t};`).join(" "),t=`@media (min-width: ${r})`;l(t,`.${e} { ${o} }`)}}}else{r=Reflect.get(n,e)?n:"undefined"!=typeof paperUtilities?paperUtilities:{},t=Reflect.get(r,e);t?Object.entries(t).forEach(([e,t])=>{"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Reflect.set(a.style,e,t)}):a.classList.add(e)}})},u=new Map;let f=[];class h{constructor(e){this.kernel=e,this.listeners=new Map}on(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}off(e,t){this.listeners.has(e)&&this.listeners.set(e,this.listeners.get(e).filter(e=>e!==t))}emit(e,t){this.listeners.has(e)&&this.listeners.get(e).forEach(e=>{try{e(t)}catch(e){this.kernel.diagnostics.reportError(e)}})}}class g{constructor(e){this.kernel=e,this.states=new Set}register(e){this.states.add(e)}list(){return Array.from(this.states)}dump(){let t={},r=0;return this.states.forEach(e=>{Reflect.set(t,"state_"+r++,e.value)}),t}}class m{constructor(e){this.kernel=e,this.registered=new Set}register(e){this.registered.add(e)}list(){return Array.from(this.registered).filter(e=>{if("undefined"!=typeof document){if("function"==typeof document.contains)return document.contains(e);if(document.body&&"function"==typeof document.body.contains)return document.body.contains(e)}return!0}).map(e=>({tag:e.tagName?e.tagName.toLowerCase():"unknown",id:e.id||"",classes:e.className||""}))}}class b{constructor(e){this.kernel=e,this.installed=new Map}register(e){e&&"object"==typeof e&&(this.installed.set(e.name,e),"function"==typeof e.install&&e.install(this.kernel),e.hooks)&&"function"==typeof e.hooks.onInit&&e.hooks.onInit()}resolve(e){return this.installed.get(e)}list(){return Array.from(this.installed.keys()).map(e=>{e=this.installed.get(e);return{name:e.name,version:e.version||"1.0.0"}})}triggerHook(t,...r){this.installed.forEach(e=>{if(e.hooks&&"__proto__"!==t&&"constructor"!==t&&"prototype"!==t){e=Reflect.get(e.hooks,t);if("function"==typeof e)try{e(...r)}catch(e){this.kernel.diagnostics.reportError(e)}}})}}class v{constructor(e){this.kernel=e,this.routes=[],this.intent=null}}class w{constructor(e){this.kernel=e,this.errors=[],this.listeners=new Map,this.updateCounts=new Map,this.warnedStates=new Set}on(e,t){this.listeners.has(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t)}emit(e,t){this.listeners.has(e)&&this.listeners.get(e).forEach(e=>e(t))}reportError(e){e={type:"error",message:e.message||String(e),timestamp:(new Date).toISOString(),stack:e.stack||""};this.errors.push(e),this.kernel.events.emit("error",e)}trackUpdate(e,t,r){var o=(this.updateCounts.get(e)||0)+1;this.updateCounts.set(e,o),100<o&&!this.warnedStates.has(e)&&(this.warnedStates.add(e),this.emit("performance",{type:"High Re-renders",message:`State variable updated ${o} times, potential infinite re-render loop detected!`,state:e,count:o}))}}function e(){let s="undefined"!=typeof document?document:a;function l(a,...e){if(o&&!p.includes(a)){let r=1/0,o="";p.forEach(e=>{var t=((r,o)=>{var e=r<o?r+","+o:o+","+r;if(u.has(e))return u.get(e);var a=r.length,n=o.length;let i=new Int32Array(n+1),s=new Int32Array(n+1);for(let e=0;e<=n;e++)i[e]=e;for(let t=1;t<=a;t++){s[0]=t;for(let e=1;e<=n;e++)s[e]=Math.min(i[e]+1,s[e-1]+1,i[e-1]+(r[t-1]===o[e-1]?0:1));var l=i;i=s,s=l}var t=i[n];return u.set(e,t),t})(a,e);t<r&&(r=t,o=e)});var t=`Unknown tag "${a}".`+(r<3?` Did you mean "${o}"?`:"");console.warn("PapyrWarning: "+t),l.diagnostics.errors.push({type:"warning",message:t,timestamp:(new Date).toISOString()}),"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("papyr-warning",{detail:{tag:a,suggestion:r<3?o:""}}))}let i;if(a&&"script"===a.toLowerCase()){let r=(i=s.createElement(a)).setAttribute;i.setAttribute=function(e,t){e&&"src"===e.toLowerCase()&&l.security&&"function"==typeof l.security.shouldBlockScript&&l.security.shouldBlockScript(t)?console.warn("Papyr Security Kernel: Blocked tracking script from "+t):r.apply(this,arguments)},Object.defineProperty(i,"src",{set(e){l.security&&"function"==typeof l.security.shouldBlockScript&&l.security.shouldBlockScript(e)?console.warn("Papyr Security Kernel: Blocked tracking script from "+e):r.call(i,"src",e)},get(){return i.getAttribute("src")},configurable:!0})}else i=s.createElement(a);l.components.register(i);let n=r=>{if(null!=r)if("object"==typeof r&&"function"==typeof r.subscribe||"function"==typeof r)(e=>{var t=s.createTextNode("");i.appendChild(t);let n=[t],r=!1,o=e=>{if(!r){r=!0;try{let t=[],r=e=>{null!=e&&!1!==e&&(d(e)?t.push(e):Array.isArray(e)?e.forEach(r):"function"==typeof e?r(e()):t.push(s.createTextNode(String(e))))},o=(r(e),0===t.length&&t.push(s.createTextNode("")),n[0]),a=o.parentNode;a&&(t.forEach(e=>{a.insertBefore(e,o)}),n.forEach(e=>{e.parentNode===a&&("function"==typeof a.removeChild?a.removeChild(e):"function"==typeof e.remove&&e.remove())}),n=t)}finally{r=!1}}},a;e&&"function"==typeof e.subscribe?a=e.subscribe(o):"function"==typeof e&&(a=l.effect(()=>{o(e())})),a&&(i._cleanups||(i._cleanups=[]),i._cleanups.push(a))})(r);else if(d(r))i.appendChild(r);else if(Array.isArray(r))r.forEach(n);else{var e,r=String(r),o=r.includes(":")&&!r.startsWith("http://")&&!r.startsWith("https://");if(r.startsWith(".")||r.startsWith("#")){let e=r,t="";o&&(a=r.indexOf(":"),e=r.substring(0,a),t=r.substring(a+1));var a=e.match(/[.#][^.#]+/g);a&&a.forEach(e=>{e.startsWith("#")?i.id=e.slice(1).trim():e.startsWith(".")&&e.slice(1).trim().split(/\s+/).forEach(e=>{e&&i.classList.add(e)})}),o&&i.appendChild(s.createTextNode(t))}else o&&(a=r.indexOf(":"),o=r.substring(0,a),[e,...a]=r.split(":"),a=a.join(":"),p.includes(o.toLowerCase()))?((o=s.createElement(o)).textContent=a,i.appendChild(o)):i.appendChild(s.createTextNode(r))}};return a&&"button"===a.toLowerCase()&&i.classList.add("papyr-btn"),e.forEach(e=>{null===e||"object"!=typeof e||d(e)||Array.isArray(e)||"function"==typeof e.subscribe?n(e):(e.style&&Object.entries(e.style).forEach(([t,e])=>{let r=e=>{t.startsWith("--")?i.style.setProperty(t,String(e)):"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&Reflect.set(i.style,t,e)},o;e&&"function"==typeof e.subscribe?o=e.subscribe(r):"function"==typeof e?o=l.effect(()=>{r(e())}):r(e),o&&(i._cleanups||(i._cleanups=[]),i._cleanups.push(o))}),e.data&&Object.assign(i.dataset,e.data),e.attrs&&Object.assign(i,e.attrs),Object.entries(e).forEach(([o,r])=>{if(!["style","data","attrs"].includes(o))if("onMounted"===o)i._onMounted=r;else if("onUnmounted"===o)i._onUnmounted=r;else if("onUpdated"===o){i._onUpdated=r;var e=new MutationObserver(()=>{try{i._onUpdated(i)}catch(e){l.diagnostics.reportError(e)}});e.observe(i,{attributes:!0,childList:!0,subtree:!1}),i._updateObserver=e}else if("on"===o&&"object"==typeof r&&null!==r)Object.entries(r).forEach(([e,t])=>{i.addEventListener(e,t)});else if(o.startsWith("on")){e=o.slice(2).toLowerCase();i.addEventListener(e,r)}else if(o.startsWith("--"))i.style.setProperty(o,String(r));else if("paper"===o||"papyr"===o){let e=e=>{c(i,e)},t;r&&"function"==typeof r.subscribe?t=r.subscribe(e):"function"==typeof r?t=l.effect(()=>{e(r())}):e(r),t&&(i._cleanups||(i._cleanups=[]),i._cleanups.push(t))}else{let e=e=>{var t,r;"class"===o||"className"===o?(r=e,t=Array.isArray(r)?r.filter(Boolean).join(" "):"object"==typeof r&&null!==r?Object.keys(r).filter(e=>Reflect.get(r,e)).join(" "):String(r),i._prevReactiveClasses&&i._prevReactiveClasses.forEach(e=>{e&&i.classList.remove(e)}),i._prevReactiveClasses=[],t&&t.split(" ").forEach(e=>{e&&(i.classList.add(e),i._prevReactiveClasses.push(e))})):o in i&&"__proto__"!==o&&"constructor"!==o&&"prototype"!==o?"boolean"==typeof e?(Reflect.set(i,o,e),e?i.setAttribute(o,""):i.removeAttribute(o)):Reflect.set(i,o,e):null==e||!1===e?i.removeAttribute(o):i.setAttribute(o,String(e))},t;r&&"function"==typeof r.subscribe?t=r.subscribe(e):"function"==typeof r?t=l.effect(()=>{e(r())}):e(r),t&&(i._cleanups||(i._cleanups=[]),i._cleanups.push(t))}}))}),l.plugins.triggerHook("onRender",i),i}l.state=new g(l);let t=new m(l);Object.defineProperty(l,"components",{get(){return t},set(e){e&&"object"==typeof e?Object.assign(t,e):console.warn("Papyr: Attempted to set papyr.components to a non-object value, ignored.")},configurable:!0}),l.events=new h(l),l.plugins=new b(l),l.runtime=new v(l),l.diagnostics=new w(l),l.on=(e,t)=>l.events.on(e,t),l.off=(e,t)=>l.events.off(e,t),l.emit=(e,t)=>l.events.emit(e,t),l.exportContext=()=>({components:l.components?l.components.list():[],state:l.state?l.state.dump():{},routes:l.runtime&&l.runtime.routes||[],errors:l.diagnostics?l.diagnostics.errors:[],plugins:l.plugins?l.plugins.list():[],power:l.power?{state:l.power.state?l.power.state.value:"unknown",fps:l.power.fps?l.power.fps.value:0,targetFps:l.power.targetFps?l.power.targetFps.value:0,battery:l.power.battery?{level:l.power.battery.level?l.power.battery.level.value:1,charging:!l.power.battery.charging||l.power.battery.charging.value}:{}}:{},gateways:l.gateway?l.gateway.list():[],diagnostics:l.diagnostics?{updateCounts:Array.from(l.diagnostics.updateCounts||[]).map(([e,t])=>({key:e,count:t}))}:{}}),l.use=e=>("function"==typeof e?e(l):e&&"object"==typeof e&&l.plugins.register(e),l),l.theme=e=>{if(e&&void 0!==s)if("string"==typeof e){var r=["liquid","material","minimal","enterprise"],o=e.toLowerCase();if(r.includes(o)){let t=s.documentElement||s.body;t&&t.classList&&(r.forEach(e=>t.classList.remove("papyr-theme-"+e)),t.classList.add("papyr-theme-"+o))}}else"object"==typeof e&&Object.entries(e).forEach(([e,t])=>{s.documentElement&&s.documentElement.style&&(s.documentElement.style.setProperty("--papyr-"+e,t),s.documentElement.style.setProperty("--"+e,t))});return l},l.plugin=e=>l.use(e),p.forEach(t=>{l[t]=(...e)=>l(t,...e)}),l.flex={row:(...e)=>l("div",".flex-row",...e),col:(...e)=>l("div",".flex-col",...e),center:(...e)=>l("div",".flex-center",...e),between:(...e)=>l("div",".flex-between",...e),around:(...e)=>l("div",".flex-around",...e),wrap:(...e)=>l("div",".flex-wrap",...e)},l.grid=(...e)=>l("div",".grid",...e),l.container=(...e)=>l("div",".container",...e),l.row=(...e)=>l("div",".row",...e),l.col=(...e)=>l("div",".col",...e);l.component=class{constructor(){if(void 0===this.render)throw new Error("PapyrComponent must implement a render() method")}},l.py={state:(e,t)=>l.state(e,t),computed:e=>l.computed(e),effect:e=>l.effect(e),Box:(...e)=>{let t={},r=e;!e[0]||"object"!=typeof e[0]||e[0].tagName||e[0]._subscribers||e[0].value||(t=e[0],r=e.slice(1));e={style:{display:"flex",flexDirection:t.direction||"column",padding:"number"==typeof t.padding?t.padding+"px":t.padding,margin:"number"==typeof t.margin?t.margin+"px":t.margin,gap:"number"==typeof t.gap?t.gap+"px":t.gap,alignItems:t.align||"stretch",justifyContent:t.justify||"flex-start",background:t.bg,color:t.color,borderRadius:"number"==typeof t.radius?t.radius+"px":t.radius,...t.style},class:t.class,id:t.id};return t.on_click&&(e.onClick=t.on_click),l.div(e,...r)},Text:(e,t={})=>{var r={style:{fontSize:"number"==typeof t.size?t.size+"px":t.size,color:t.color,fontWeight:t.weight,lineHeight:t.line_height,letterSpacing:t.kerning,...t.style},class:t.class,id:t.id};return t.on_click&&(r.onClick=t.on_click),l.span(r,e)},Button:(e,t,r={})=>{r={style:{padding:r.padding||"8px 16px",borderRadius:r.radius||"8px",background:r.bg,color:r.color,...r.style},class:r.class,id:r.id};return r.onClick=t,l.button(r,e)},Input:(t={})=>{var e={style:{padding:t.padding||"8px 12px",borderRadius:t.radius||"6px",border:t.border,...t.style},class:t.class,id:t.id,type:t.type||"text",placeholder:t.placeholder||"",value:void 0!==t.value?t.value:""};return t.on_change&&(e.onInput=e=>t.on_change(e.target.value,e)),l.input(e)}},l.errorBoundary=(e,t)=>{try{return e()}catch(e){if(l.diagnostics.reportError(e),"function"==typeof t)try{return t(e)}catch(e){return l.div(".papyr-error-fallback","Component failed to render.")}return l.div(".papyr-error-fallback",{style:{padding:"12px",background:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)",borderRadius:"8px",color:"#fca5a5",fontSize:"0.85rem"}},"⚠️ Component Rendering Error: "+e.message)}},l.validate=n=>e=>{var t,r,o,a=Object.create(null);for(t in n)"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&Object.prototype.hasOwnProperty.call(n,t)&&(r=n[t],o=e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,!r.required||null!=o&&""!==o||(a[t]="Required field"),r.type)&&typeof o!==r.type&&(a[t]="Must be of type "+r.type);return Object.keys(a).length?a:null},l.inspect=e=>{var t=s.createElement("div");return t.appendChild(e.cloneNode(!0)),t.innerHTML},l.mount=(e,t)=>{e=s.querySelector(e);return e&&(e.innerHTML="",e.appendChild(t)),e},l.ready=e=>{"undefined"!=typeof document&&"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()},l.debug=e=>{(o=e)&&console.log("📄 Papyr Debug Mode Enabled.")},l.delay=t=>new Promise(e=>setTimeout(e,t)),l.copy=e=>navigator.clipboard.writeText(e),l.fragment=(...e)=>{let t=s.createDocumentFragment();return e.forEach(e=>{Array.isArray(e)?e.forEach(e=>{e instanceof Element?t.appendChild(e):t.appendChild(s.createTextNode(String(e)))}):e instanceof Element||e instanceof DocumentFragment?t.appendChild(e):null!=e&&t.appendChild(s.createTextNode(String(e)))}),t},l.html=e=>{var t=s.createElement("template");return t.innerHTML=e.trim(),t.content.cloneNode(!0)},l.fadeIn=(e,t=400)=>{e.style.opacity="0",e.style.transition=`opacity ${t}ms ease`,requestAnimationFrame(()=>{e.style.opacity="1"})},l.fadeOut=(e,t=400)=>{e.style.opacity="1",e.style.transition=`opacity ${t}ms ease`,requestAnimationFrame(()=>{e.style.opacity="0"}),setTimeout(()=>e.remove(),t)},l.animate=(e,t,r=400)=>{e.style.transition=`all ${r}ms cubic-bezier(0.4, 0, 0.2, 1)`,requestAnimationFrame(()=>{Object.assign(e.style,t)})},l.loadFramework=e=>{var t,r="papyr-fw-"+e;document.getElementById(r)||("tailwind"===e?((t=document.createElement("script")).id=r,t.src="https://cdn.tailwindcss.com",document.head.appendChild(t)):"bootstrap"===e&&((t=document.createElement("link")).id=r,t.rel="stylesheet",t.href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css",(e=s.getElementById("papyr-complete-styles")||s.querySelector('link[href*="styles.css"]')||s.querySelector("style"))&&e.parentNode?e.parentNode.insertBefore(t,e):s.head&&s.head.appendChild(t),s&&s.documentElement&&s.documentElement.setAttribute("data-bs-theme","dark"),s)&&s.body&&s.body.setAttribute("data-bs-theme","dark"))},l.init=(e={})=>{e.privacy&&(l.security&&"function"==typeof l.security.setTier?l.security.setTier(e.privacy):l._initialPrivacy=e.privacy),void 0!==e.debug&&l.debug(e.debug)};let e="undefined"!=typeof window?window.papyr:null;if(l.noConflict=()=>("undefined"!=typeof window&&(window.papyr=e),l),(l.el=l).ssr=e=>e?(e="function"==typeof e?e():e).innerHTML||String(e):"",l.ssr.render=e=>l.ssr(e),f.forEach(e=>{try{e(l)}catch(e){console.error("Error during core initialization",e)}}),"undefined"!=typeof window&&"undefined"!=typeof MutationObserver&&"undefined"!=typeof document){let e=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(1===e.nodeType){let t=e=>{if(e._onMounted&&!e._isMounted){e._isMounted=!0;try{e._onMounted(e)}catch(e){l.diagnostics.reportError(e)}}Array.from(e.children||[]).forEach(t)};t(e)}}),e.removedNodes.forEach(e=>{if(1===e.nodeType)if("function"==typeof l._cleanupElement)l._cleanupElement(e);else{let t=e=>{if(e._cleanups&&(e._cleanups.forEach(e=>{if("function"==typeof e)try{e()}catch(e){l.diagnostics.reportError(e)}}),e._cleanups=[]),e._onUnmounted){e._isMounted=!1;try{e._onUnmounted(e)}catch(e){l.diagnostics.reportError(e)}}Array.from(e.children||[]).forEach(t)};t(e)}})})});var r=()=>{document.body&&e.observe(document.body,{childList:!0,subtree:!0})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",r):r()}return l}"undefined"!=typeof module&&module.exports?module.exports=e:"undefined"!=typeof window&&(window.createPapyr=e);{let a=Object.create(null),n=["_ga","_gid","_fbp","_uid_tracking_id","tracking","analytics","pixel","adsense"],i=null,t=null,l=null;"undefined"!=typeof window&&window.localStorage&&("function"==typeof localStorage.setItem&&(i=localStorage.setItem.bind(localStorage)),"function"==typeof localStorage.getItem&&(t=localStorage.getItem.bind(localStorage)),"function"==typeof localStorage.removeItem)&&(l=localStorage.removeItem.bind(localStorage)),f.push(s=>{s.security={_isActive:!0,currentTier:"default",hasConsent:!1,_scriptsBlocked:!1,setTier(e){"high"===(this.currentTier=e)&&this.blockThirdPartyScripts()},setConsent(e){if(this.hasConsent=!!e,e)try{i&&Object.entries(a).forEach(([e,t])=>{i(e,t)}),a=Object.create(null)}catch(e){}else try{if(l){var r=[];for(let e=0;e<localStorage.length;e++){var o=localStorage.key(e);if(o){let t=o.toLowerCase();n.some(e=>t.includes(e))&&r.push(o)}}r.forEach(e=>l(e))}}catch(e){}},shouldBlockScript(t){var e;return"none"!==this.currentTier&&!(!t||"string"!=typeof t||(e=["analytics","pixel","doubleclick","google-analytics","adsense","ad-tracker","facebook.net","adnxs"].some(e=>t.toLowerCase().includes(e)),("high"!==this.currentTier||!e)&&("default"!==this.currentTier||this.hasConsent||!e)))},blockThirdPartyScripts(){if("undefined"!=typeof document&&!this._scriptsBlocked){this._scriptsBlocked=!0;let r=document.createElement;document.createElement=function(e,t){let o=r.call(document,e,t);if(e&&"script"===e.toLowerCase()){let r=o.setAttribute;o.setAttribute=function(e,t){e&&"src"===e.toLowerCase()&&s.security.shouldBlockScript(t)?console.warn("Papyr Security Kernel: Blocked tracking script from "+t):r.apply(this,arguments)},Object.defineProperty(o,"src",{set(e){s.security.shouldBlockScript(e)?console.warn("Papyr Security Kernel: Blocked tracking script from "+e):r.call(o,"src",e)},get(){return o.getAttribute("src")},configurable:!0})}return o}}},shouldSandboxStorage(t){return"none"!==this.currentTier&&("high"===this.currentTier||!this.hasConsent&&n.some(e=>t.toLowerCase().includes(e)))},sanitize(e){if(!this._isActive||"string"!=typeof e)return e;let o=e;if("undefined"!=typeof window&&"undefined"!=typeof DOMParser)try{var n=(new DOMParser).parseFromString(e,"text/html");let t=["div","span","p","h1","h2","h3","h4","h5","h6","button","a","img","ul","ol","li","table","thead","tbody","tr","td","th","form","label","input","textarea","select","option","pre","code","strong","em","small","hr","br","canvas","svg","path","rect","circle"],a=["class","style","id","href","src","alt","title","placeholder","type","name","value","checked","disabled","rows","cols","width","height","viewBox","d","role","aria-live","aria-modal","aria-labelledby","tabindex","aria-label"],r=o=>{var e;1===o.nodeType&&(e=o.tagName.toLowerCase(),t.includes(e)&&"script"!==e?(Array.from(o.attributes).forEach(e=>{var t=e.name.toLowerCase(),r=e.value.toLowerCase().trim();a.includes(t)&&!t.startsWith("on")&&!r.includes("javascript:")||o.removeAttribute(e.name)}),Array.from(o.childNodes).forEach(r)):o.parentNode.removeChild(o))};Array.from(n.body.childNodes).forEach(r),o=n.body.innerHTML}catch(e){}return o!==e&&"undefined"!=typeof DOMParser||(o=(o=(o=(o=(o=(o=e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"")).replace(/\s+on\w+\s*=\s*"[^"]*"/gi,"")).replace(/\s+on\w+\s*=\s*'[^']*'/gi,"")).replace(/\s+on\w+\s*=\s*\w+/gi,"")).replace(/href\s*=\s*['"]\s*javascript:[^'"]*['"]/gi,'href="#"')).replace(/src\s*=\s*['"]\s*javascript:[^'"]*['"]/gi,'src=""')),e!==o&&s.warn&&s.warn("Papyr Security Interceptor blocked a potential XSS payload."),o},use(e){"disable"===e&&(this._isActive=!1,s.warn)&&s.warn("Papyr Security Kernel DISABLED. You are vulnerable to XSS.")},encrypt(e,t){if(!e)return e;var r="undefined"!=typeof window?unescape(encodeURIComponent(e)):Buffer.from(e,"utf8").toString("binary");let o="",a=0;for(let e=0;e<r.length;e++){var n=t.charCodeAt(e%t.length)+e+a&255,n=r.charCodeAt(e)^n;o+=String.fromCharCode(n),a=n}return"undefined"!=typeof window?window.btoa(o):Buffer.from(o,"binary").toString("base64")},decrypt(e,o){if(!e)return e;try{var a="undefined"!=typeof window?window.atob(e):Buffer.from(e,"base64").toString("binary");let t="",r=0;for(let e=0;e<a.length;e++){var n=o.charCodeAt(e%o.length)+e+r&255,i=a.charCodeAt(e)^n;t+=String.fromCharCode(i),r=a.charCodeAt(e)}return"undefined"!=typeof window?decodeURIComponent(escape(t)):Buffer.from(t,"binary").toString("utf8")}catch(e){return s.warn&&s.warn("Papyr Security: Decryption failed (invalid key or corrupted data)."),null}},async encryptAsync(r,o){if("undefined"==typeof window||!window.crypto||!window.crypto.subtle)return this.encrypt(r,o);try{var e=new TextEncoder,a=window.crypto.getRandomValues(new Uint8Array(16)),n=window.crypto.getRandomValues(new Uint8Array(12)),i=await window.crypto.subtle.importKey("raw",e.encode(o),"PBKDF2",!1,["deriveKey"]),s=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:a,iterations:1e5,hash:"SHA-256"},i,{name:"AES-GCM",length:256},!1,["encrypt"]),l=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},s,e.encode(r)),p=new Uint8Array(a.length+n.length+l.byteLength);p.set(a,0),p.set(n,a.length),p.set(new Uint8Array(l),a.length+n.length);let t="";for(let e=0;e<p.byteLength;e++)t+=String.fromCharCode(p[e]);return window.btoa(t)}catch(e){return console.error("Papyr Security: Async Encryption failed, falling back to sync.",e),this.encrypt(r,o)}},async decryptAsync(t,r){if("undefined"==typeof window||!window.crypto||!window.crypto.subtle)return this.decrypt(t,r);try{var o=window.atob(t),a=new Uint8Array(o.length);for(let e=0;e<o.length;e++)a[e]=o.charCodeAt(e);var e=a.slice(0,16),n=a.slice(16,28),i=a.slice(28),s=new TextEncoder,l=await window.crypto.subtle.importKey("raw",s.encode(r),"PBKDF2",!1,["deriveKey"]),p=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:e,iterations:1e5,hash:"SHA-256"},l,{name:"AES-GCM",length:256},!1,["decrypt"]),d=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:n},p,i);return(new TextDecoder).decode(d)}catch(e){return console.error("Papyr Security: Async Decryption failed, falling back to sync.",e),this.decrypt(t,r)}}},s.safeGet=(e,t)=>{if(e&&"object"==typeof e){if("__proto__"===t||"constructor"===t||"prototype"===t)throw new Error("Security Violation: Unsafe property access");return e[t]}}}),"undefined"!=typeof window&&window.localStorage&&(localStorage.setItem=function(e,t){window.papyr&&window.papyr.security&&window.papyr.security.shouldSandboxStorage(e)?e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(a[e]=t):i&&i(e,t)},localStorage.getItem=function(e){return window.papyr&&window.papyr.security&&window.papyr.security.shouldSandboxStorage(e)?e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Object.prototype.hasOwnProperty.call(a,e)?a[e]:null:t?t(e):null},localStorage.removeItem=function(e){window.papyr&&window.papyr.security&&window.papyr.security.shouldSandboxStorage(e)?e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Object.prototype.hasOwnProperty.call(a,e)&&delete a[e]:l&&l(e)})}f.push(d=>{let o=new Set,a=!1,i=(e,t)=>{o.add({sub:e,val:t}),a||(a=!0,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(r):setTimeout(r,0))},r=()=>{let r=new Map;o.forEach(({sub:e,val:t})=>{r.set(e,t)}),o.clear(),a=!1,r.forEach((e,t)=>{try{t(e)}catch(e){d.diagnostics.reportError(e)}})},c=e=>!(!e||"object"!=typeof e)&&("undefined"!=typeof Element&&e instanceof Element||"undefined"!=typeof DocumentFragment&&e instanceof DocumentFragment||"string"==typeof e.tagName&&"function"==typeof e.appendChild||1===e.nodeType||11===e.nodeType),u=e=>{if(e){if(e._cleanups&&(e._cleanups.forEach(e=>{if("function"==typeof e)try{e()}catch(e){d.diagnostics.reportError(e)}}),e._cleanups=[]),e._onUnmounted){e._isMounted=!1;try{e._onUnmounted(e)}catch(e){d.diagnostics.reportError(e)}}if(e._updateObserver)try{e._updateObserver.disconnect()}catch(e){}Array.from(e.children||[]).forEach(u)}},s=(d._cleanupElement=u,(e,n)=>null===e||"object"!=typeof e||c(e)?e:new Proxy(e,{get(t,e,r){let o=Reflect.get(t,e,r);return Array.isArray(t)&&"function"==typeof o&&["push","pop","splice","shift","unshift","sort","reverse"].includes(e)?function(...e){e=o.apply(t,e);return n(),e}:null===o||"object"!=typeof o||c(o)?o:s(o,n)},set(e,t,r,o){var a=e[t],e=Reflect.set(e,t,r,o);return a!==r&&n(),e}}));class n{constructor(e=.05,t=.5){this.q=e,this.r=t,this.p=1,this.x=null,this.v=0}update(e,t){var r;null===this.x?this.x=e:(this.x=this.x+this.v*(t=t<=0?.016:t),this.p=this.p+this.q,r=this.p/(this.p+this.r),e-=this.x,this.x=this.x+r*e,this.v=this.v+r*(e/t-this.v),this.p=(1-r)*this.p)}predict(e){return null===this.x?0:this.x+this.v*e}}class l{constructor(e,t={}){this.options=t,this.filters={},this.lastTime=("undefined"!=typeof performance?performance:Date).now(),this.initialize(e)}initialize(t){let r=this.options.processNoise||.05,o=this.options.measurementNoise||.5;"number"==typeof t?this.filters.root=new n(r,o):Array.isArray(t)?t.forEach((e,t)=>{"number"==typeof e&&(this.filters[t]=new n(r,o))}):t&&"object"==typeof t&&Object.keys(t).forEach(e=>{"number"==typeof t[e]&&(this.filters[e]=new n(r,o))})}update(t){var e=("undefined"!=typeof performance?performance:Date).now();let r=(e-this.lastTime)/1e3,o=(this.lastTime=e,this.options.processNoise||.05),a=this.options.measurementNoise||.5;"number"==typeof t?(this.filters.root||(this.filters.root=new n(o,a)),this.filters.root.update(t,r)):Array.isArray(t)?t.forEach((e,t)=>{"number"==typeof e&&(this.filters[t]||(this.filters[t]=new n(o,a)),this.filters[t].update(e,r))}):t&&"object"==typeof t&&Object.keys(t).forEach(e=>{"number"==typeof t[e]&&(this.filters[e]||(this.filters[e]=new n(o,a)),this.filters[e].update(t[e],r))})}predict(r){if(this.filters.root)return this.filters.root.predict(r);var e,o=Object.keys(this.filters);if(0===o.length)return null;let t=!1;for(e of o)if(!isNaN(e)){t=!0;break}if(t){let t=[];return o.forEach(e=>{t[e]=this.filters[e].predict(r)}),t}{let t={};return o.forEach(e=>{t[e]=this.filters[e].predict(r)}),t}}}d.state=(r,e={})=>{let o=new Set,a=e.predictive?new l(r,e):null,t=()=>{a&&a.update(r),d.diagnostics.trackUpdate(n,r,r),Array.from(o).forEach(e=>{i(e,r)}),d.plugins.triggerHook("onUpdate",n)},n={_subscribers:o,get value(){return y&&(o.add(y),"function"==typeof y._addDep)&&y._addDep(n),s(r,t)},set value(t){var e;(r!==t||"object"==typeof t&&null!==t)&&(e=r,r=t,a&&a.update(t),d.diagnostics.trackUpdate(n,t,e),Array.from(o).forEach(e=>{i(e,t)}),d.plugins.triggerHook("onUpdate",n))},subscribe(e){return o.add(e),e(r),()=>o.delete(e)},predict(e){return a&&null!==(e=a.predict(e/1e3))?e:r},get predicted(){return n.predict(16)},dump(){return r}};return d.state.register(n),n},d.predictiveState=(e,t={})=>d.state(e,{...t,predictive:!0}),d.state.states=new Set,d.state.register=e=>d.state.states.add(e),d.state.list=()=>Array.from(d.state.states),d.state.dump=()=>{let t={},r=0;return d.state.states.forEach(e=>{t["state_"+r++]=e.value}),t};let p=[];d.computed=e=>{let t=new Set,r,o=!0,a=()=>{o=!0,Array.from(t).forEach(e=>e(n.value))},n=(a._deps=new Set,a._addDep=e=>{a._deps.add(e)},{_subscribers:t,get value(){if(o){a._deps.forEach(e=>{e._subscribers&&e._subscribers.delete(a)}),a._deps.clear(),p.push(a),y=a;try{r=e(),o=!1}catch(e){d.diagnostics.reportError(e)}finally{p.pop(),y=p[p.length-1]||null}}return y&&(t.add(y),"function"==typeof y._addDep)&&y._addDep(n),r},subscribe(e){return t.add(e),e(n.value),()=>{t.delete(e),0===t.size&&(a._deps.forEach(e=>{e._subscribers&&e._subscribers.delete(a)}),a._deps.clear(),o=!0)}}});return n},d.effect=e=>{let t=()=>{t._deps.forEach(e=>{e._subscribers&&e._subscribers.delete(t)}),t._deps.clear(),p.push(t),y=t;try{e()}catch(e){d.diagnostics.reportError(e)}finally{p.pop(),y=p[p.length-1]||null}};return t._deps=new Set,t._addDep=e=>{t._deps.add(e)},t(),()=>{t._deps.forEach(e=>{e._subscribers&&e._subscribers.delete(t)}),t._deps.clear()}},d.if=(e,t,r)=>{let o=d.div({style:{display:"contents"}}),a=null,n=void 0;var i,s=e=>{var e=!!e;e!==n&&(n=e,o.childNodes&&Array.from(o.childNodes).forEach(u),o.innerHTML="",(e=e?t:r)?(a="function"==typeof e?e():e,o.appendChild(a)):a=null)};let l;return e&&"function"==typeof e.subscribe?l=e.subscribe(s):"function"==typeof e?(i=d.computed(()=>!!e()),l=i.subscribe(s)):s(!!e),l&&(o._cleanups||(o._cleanups=[]),o._cleanups.push(l)),o},d.for=(e,l)=>{let r=d.div({style:{display:"contents"}}),p=new Map;var t,o=e=>{if(Array.isArray(e)){let n=new Set,i=[],s=new Map;e.forEach((e,t)=>{var r=e&&"object"==typeof e&&void 0!==e.id?e.id:e,o=(s.get(r)||0)+1,r=(s.set(r,o),1===o?r:"object"==typeof r?"dup::"+o:r+"::dup::"+o),o=(n.add(r),p.get(r));let a;o&&o.item===e?a=o.el:(o&&u(o.el),(a=l(e,t))&&11===a.nodeType&&"undefined"!=typeof document&&((t=document.createElement("span")).style.display="contents",t.appendChild(a),a=t),c(a)&&(p.set(r,{el:a,item:e}),o)&&o.el&&o.el.parentNode&&o.el.parentNode.replaceChild(a,o.el)),c(a)&&i.push(a)}),p.forEach((e,t)=>{n.has(t)||(u(e.el),e.el.parentNode===r&&("function"==typeof r.removeChild?r.removeChild(e.el):"function"==typeof e.el.remove&&e.el.remove()),p.delete(t))}),i.forEach((e,t)=>{t=r.children?r.children[t]:null;t!==e&&(t?r.insertBefore(e,t):r.appendChild(e))})}else r.innerHTML="",p.clear()};return e&&"function"==typeof e.subscribe?(t=e.subscribe(o),r._cleanups||(r._cleanups=[]),r._cleanups.push(t)):o(e),r},d.signal=d.state,d.watch=(e,a)=>{if(e&&"function"==typeof e.subscribe){let r=!0,o;return e.subscribe(e=>{var t=o;o=e,r?(r=!1,a(e,void 0)):a(e,t)})}if("function"==typeof e){e=d.computed(e);let r=!0,o;return e.subscribe(e=>{var t=o;o=e,r?(r=!1,a(e,void 0)):a(e,t)})}},d.bind=(a,n)=>{if(a){let t="checkbox"===a.type,e=n.subscribe(e=>{t?a.checked=!!e:a.value=null!=e?e:""}),r=e=>{t?n.value=e.target.checked:"number"===a.type||"range"===a.type?n.value=parseFloat(e.target.value)||0:n.value=e.target.value},o=t?"change":"input";a.addEventListener(o,r),a._cleanups||(a._cleanups=[]),a._cleanups.push(()=>{e(),a.removeEventListener(o,r)})}},d.model=t=>({value:()=>t.value,oninput:e=>{"checkbox"===e.target.type?t.value=e.target.checked:"number"===e.target.type||"range"===e.target.type?t.value=parseFloat(e.target.value)||0:t.value=e.target.value}}),d.plugin=e=>d.use(e)}),f.push(o=>{let r=[],n=o.state(null),i=o.state({}),a=e=>{if(/^[a-zA-Z0-9_/:.\-@~]*$/.test(e))return new RegExp("^"+e.replace(/:\w+/g,"([^/]+)")+"$");throw new Error("Security Violation: Unsafe characters in route path pattern")},s=(o.route=(e,t)=>{e=e.startsWith("#")?e.substring(1):e;r.push({path:e,regex:a(e),keys:(e.match(/:\w+/g)||[]).map(e=>e.slice(1)),componentFn:t}),o.runtime.routes=r},o.navigate=e=>{"undefined"!=typeof window&&(window.location.hash=e.startsWith("#")?e:"#"+e)},"undefined"!=typeof window&&window.addEventListener("hashchange",()=>{var e,t=window.location.hash.slice(1)||"/";let a=!1;for(e of r){let o=t.match(e.regex);if(o){let r={};e.keys.forEach((e,t)=>{r[e]=o[t+1]}),i.value=r,n.value=e.componentFn,a=!0;break}}a||(n.value=()=>o.div("404 - Route Not Found"))}),o.useParams=()=>i,o.router=()=>{"undefined"!=typeof window&&0<r.length&&!n.value&&window.dispatchEvent(new Event("hashchange"));let t=o.if(n,()=>{var e=n.value;return e&&e.prototype&&"function"==typeof o.component&&e.prototype instanceof o.component?(new e).render():"function"==typeof e?e():o.div()},()=>o.div());return"undefined"!=typeof document&&setTimeout(()=>{var e=document.querySelector(".papyr-main-content");e&&!e.contains(t)&&(e.innerHTML="",e.appendChild(t))},0),t},[]),l=o.state(null),p=o.state({}),d=()=>{if("undefined"!=typeof window){var t,r=window.location.pathname||"/";let e=!1;for(t of s){let o=r.match(t.regex);if(o){let r={};t.keys.forEach((e,t)=>{r[e]=o[t+1]}),p.value=r,l.value=t.componentFn,e=!0;break}}e||(l.value=()=>o.div("404 - Page Not Found"))}};o.page=(e,t)=>{if(void 0===e)return o.pageRouter();s.push({path:e,regex:a(e),keys:(e.match(/:\w+/g)||[]).map(e=>e.slice(1)),componentFn:t}),"undefined"!=typeof window&&0<s.length&&!l.value&&setTimeout(d,10)},o.page.navigate=e=>{"undefined"!=typeof window&&(window.history.pushState(null,"",e),d())},o.usePageParams=()=>p,o.pageRouter=()=>{"undefined"!=typeof window&&0<s.length&&!l.value&&d();let t=o.if(l,()=>{var e=l.value;return e&&e.prototype&&"function"==typeof o.component&&e.prototype instanceof o.component?(new e).render():"function"==typeof e?e():o.div()},()=>o.div());return"undefined"!=typeof document&&setTimeout(()=>{var e=document.querySelector(".papyr-main-content");e&&!e.contains(t)&&(e.innerHTML="",e.appendChild(t))},0),t},"undefined"!=typeof window&&(window.addEventListener("popstate",d),window.addEventListener("click",e=>{var t=e.target.closest("a");t&&t.href&&t.origin===window.location.origin&&!t.hash&&!t.getAttribute("download")&&"_blank"!==t.target&&(e.preventDefault(),o.page.navigate(t.pathname+t.search))}))}),f.push(a=>{let r=e=>e.reduce((e,t)=>e.concat(Array.isArray(t)?r(t):t),[]),n=e=>{e=e&&"function"==typeof e.subscribe?e.value:e;return Array.isArray(e)?e.reduce((e,t)=>e+Number(t||0),0):Number(e||0)};a.math={sum:(...e)=>a.computed(()=>r(e).reduce((e,t)=>e+n(t),0)),sub:(e,t)=>a.computed(()=>n(e)-n(t)),mul:(...t)=>a.computed(()=>{var e=r(t);return 0===e.length?0:e.reduce((e,t)=>{t=t&&"function"==typeof t.subscribe?t.value:t;return Array.isArray(t)?e*t.reduce((e,t)=>e*Number(null==t?1:t),1):e*(null==t?1:Number(t))},1)}),div:(t,r)=>a.computed(()=>{var e=n(r);return 0===e?0:n(t)/e}),avg:(...t)=>a.computed(()=>{var e=r(t);return 0===e.length?0:e.reduce((e,t)=>e+n(t),0)/e.length}),percent:(t,r)=>a.computed(()=>{var e=n(r);return 0===e?0:n(t)/e*100}),round:(r,o=0)=>a.computed(()=>{var e=n(r),t=n(o),t=Math.pow(10,t);return Math.round(e*t)/t})}}),f.push(p=>{let t=a=>new Promise((r,o)=>{if("undefined"==typeof window||!window.indexedDB)return o(new Error("IndexedDB not supported"));var e=window.indexedDB.open("papyr_database");e.onsuccess=e=>{var t,e=e.target.result;e.objectStoreNames.contains(a)?r(e):(t=e.version+1,e.close(),(e=window.indexedDB.open("papyr_database",t)).onupgradeneeded=e=>{e.target.result.createObjectStore(a,{keyPath:"id"})},e.onsuccess=e=>{r(e.target.result)},e.onerror=e=>o(e))},e.onerror=e=>o(e),e.onupgradeneeded=e=>{e=e.target.result;e.objectStoreNames.contains(a)||e.createObjectStore(a,{keyPath:"id"})}}),o=(p.db=(i,e="local")=>{let o={local:{get:()=>{try{var e=localStorage.getItem("papyr_db_"+i);return e?JSON.parse(e):[]}catch(e){return console.error("PapyrDB [local] get error:",e),[]}},insert:e=>{try{var t=o.local.get();t.push(e),localStorage.setItem("papyr_db_"+i,JSON.stringify(t))}catch(e){console.error("PapyrDB [local] insert error:",e)}},update:(t,r)=>{try{var e=o.local.get().map(e=>e.id===t?{...e,...r}:e);localStorage.setItem("papyr_db_"+i,JSON.stringify(e))}catch(e){console.error("PapyrDB [local] update error:",e)}},delete:t=>{try{var e=o.local.get().filter(e=>e.id!==t);localStorage.setItem("papyr_db_"+i,JSON.stringify(e))}catch(e){console.error("PapyrDB [local] delete error:",e)}},clear:()=>{try{localStorage.removeItem("papyr_db_"+i)}catch(e){console.error("PapyrDB [local] clear error:",e)}}},session:{get:()=>{try{var e=sessionStorage.getItem("papyr_db_"+i);return e?JSON.parse(e):[]}catch(e){return console.error("PapyrDB [session] get error:",e),[]}},insert:e=>{try{var t=o.session.get();t.push(e),sessionStorage.setItem("papyr_db_"+i,JSON.stringify(t))}catch(e){console.error("PapyrDB [session] insert error:",e)}},update:(t,r)=>{try{var e=o.session.get().map(e=>e.id===t?{...e,...r}:e);sessionStorage.setItem("papyr_db_"+i,JSON.stringify(e))}catch(e){console.error("PapyrDB [session] update error:",e)}},delete:t=>{try{var e=o.session.get().filter(e=>e.id!==t);sessionStorage.setItem("papyr_db_"+i,JSON.stringify(e))}catch(e){console.error("PapyrDB [session] delete error:",e)}},clear:()=>{try{sessionStorage.removeItem("papyr_db_"+i)}catch(e){console.error("PapyrDB [session] clear error:",e)}}},indexeddb:{getAsync:()=>new Promise(r=>{t(i).then(t=>{try{let e=t.transaction(i,"readonly").objectStore(i).getAll();e.onsuccess=()=>{t.close(),r(e.result||[])},e.onerror=()=>{t.close(),r([])}}catch(e){t.close(),r([])}}).catch(()=>r([]))}),insertAsync:o=>new Promise(r=>{t(i).then(t=>{try{var e=t.transaction(i,"readwrite").objectStore(i);e.put(o).onsuccess=()=>{t.close(),r()},e.put(o).onerror=()=>{t.close(),r()}}catch(e){console.error("PapyrDB [indexeddb] insert error:",e),t.close(),r()}}).catch(()=>r())}),updateAsync:(e,n)=>new Promise(a=>{t(i).then(o=>{try{let t=o.transaction(i,"readwrite").objectStore(i),r=t.get(e);r.onsuccess=()=>{var e=r.result;e?(e={...e,...n},t.put(e).onsuccess=()=>{o.close(),a()},t.put(e).onerror=()=>{o.close(),a()}):(o.close(),a())},r.onerror=()=>{o.close(),a()}}catch(e){console.error("PapyrDB [indexeddb] update error:",e),o.close(),a()}}).catch(()=>a())}),deleteAsync:o=>new Promise(r=>{t(i).then(t=>{try{var e=t.transaction(i,"readwrite").objectStore(i);e.delete(o).onsuccess=()=>{t.close(),r()},e.delete(o).onerror=()=>{t.close(),r()}}catch(e){console.error("PapyrDB [indexeddb] delete error:",e),t.close(),r()}}).catch(()=>r())}),clearAsync:()=>new Promise(r=>{t(i).then(t=>{try{var e=t.transaction(i,"readwrite").objectStore(i);e.clear().onsuccess=()=>{t.close(),r()},e.clear().onerror=()=>{t.close(),r()}}catch(e){console.error("PapyrDB [indexeddb] clear error:",e),t.close(),r()}}).catch(()=>r())})},sqlite:{getAsync:()=>new Promise(o=>{if("undefined"!=typeof window&&window.sqlitePlugin)try{window.sqlitePlugin.openDatabase({name:"papyr.db",location:"default"}).transaction(e=>{e.executeSql(`CREATE TABLE IF NOT EXISTS ${i} (id TEXT PRIMARY KEY, data TEXT)`),e.executeSql("SELECT data FROM "+i,[],(e,t)=>{var r=[];for(let e=0;e<t.rows.length;e++)try{r.push(JSON.parse(t.rows.item(e).data))}catch(e){}o(r)},()=>o([]))},()=>o([]))}catch(e){o([])}else if("undefined"!=typeof window&&window.SQL&&window.papyrSQLiteDB)try{var e=window.papyrSQLiteDB,r=(e.run(`CREATE TABLE IF NOT EXISTS ${i} (id TEXT PRIMARY KEY, data TEXT)`),e.exec("SELECT data FROM "+i));let t=[];r&&r[0]&&r[0].values&&r[0].values.forEach(e=>{try{t.push(JSON.parse(e[0]))}catch(e){}}),o(t)}catch(e){o([])}else o([])}),insertAsync:r=>new Promise(t=>{if("undefined"!=typeof window&&window.sqlitePlugin)try{window.sqlitePlugin.openDatabase({name:"papyr.db",location:"default"}).transaction(e=>{e.executeSql(`CREATE TABLE IF NOT EXISTS ${i} (id TEXT PRIMARY KEY, data TEXT)`),e.executeSql(`INSERT OR REPLACE INTO ${i} (id, data) VALUES (?, ?)`,[r.id,JSON.stringify(r)])},()=>t(),()=>t())}catch(e){t()}else if("undefined"!=typeof window&&window.SQL&&window.papyrSQLiteDB)try{var e=window.papyrSQLiteDB;e.run(`CREATE TABLE IF NOT EXISTS ${i} (id TEXT PRIMARY KEY, data TEXT)`),e.run(`INSERT OR REPLACE INTO ${i} (id, data) VALUES (?, ?)`,[r.id,JSON.stringify(r)]),t()}catch(e){t()}else t()}),updateAsync:(a,n)=>new Promise(o=>{if("undefined"!=typeof window&&window.sqlitePlugin)try{window.sqlitePlugin.openDatabase({name:"papyr.db",location:"default"}).transaction(e=>{e.executeSql(`SELECT data FROM ${i} WHERE id = ?`,[a],(e,t)=>{if(0<t.rows.length)try{var r={...JSON.parse(t.rows.item(0).data),...n};e.executeSql(`INSERT OR REPLACE INTO ${i} (id, data) VALUES (?, ?)`,[a,JSON.stringify(r)],()=>o())}catch(e){o()}else o()},()=>o())},()=>o())}catch(e){o()}else if("undefined"!=typeof window&&window.SQL&&window.papyrSQLiteDB)try{var e,t=window.papyrSQLiteDB,r=t.exec(`SELECT data FROM ${i} WHERE id = '${a}'`);r&&r[0]&&r[0].values&&r[0].values[0]&&(e={...JSON.parse(r[0].values[0][0]),...n},t.run(`INSERT OR REPLACE INTO ${i} (id, data) VALUES (?, ?)`,[a,JSON.stringify(e)])),o()}catch(e){o()}else o()}),deleteAsync:r=>new Promise(t=>{if("undefined"!=typeof window&&window.sqlitePlugin)try{window.sqlitePlugin.openDatabase({name:"papyr.db",location:"default"}).transaction(e=>{e.executeSql(`DELETE FROM ${i} WHERE id = ?`,[r])},()=>t(),()=>t())}catch(e){t()}else if("undefined"!=typeof window&&window.SQL&&window.papyrSQLiteDB)try{window.papyrSQLiteDB.run(`DELETE FROM ${i} WHERE id = ?`,[r]),t()}catch(e){t()}else t()}),clearAsync:()=>new Promise(t=>{if("undefined"!=typeof window&&window.sqlitePlugin)try{window.sqlitePlugin.openDatabase({name:"papyr.db",location:"default"}).transaction(e=>{e.executeSql("DELETE FROM "+i)},()=>t(),()=>t())}catch(e){t()}else if("undefined"!=typeof window&&window.SQL&&window.papyrSQLiteDB)try{window.papyrSQLiteDB.run("DELETE FROM "+i),t()}catch(e){t()}else t()})}},a=(Object.keys(p.db.drivers).forEach(t=>{try{o[t]=p.db.drivers[t](i)}catch(e){console.error(`Failed to initialize custom db driver ${t}:`,e)}}),"local"!==e&&"session"!==e&&o[e]),n=e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Object.prototype.hasOwnProperty.call(o,e)?o[e]:o.local,s=p.state([]),r=[],l=(a?n.getAsync().then(t=>{s.value=t,r.forEach(e=>e(t))}):s.value=n.get(),()=>{r.forEach(e=>e(s.value))});return{state:s,list(){return s.value},async listAsync(){var e;return a?(e=await n.getAsync(),s.value=e):s.value},find(t){return s.value.find(e=>e.id===t)},async findAsync(t){var e;return a&&(e=await n.getAsync(),s.value=e),s.value.find(e=>e.id===t)},query(e={}){let t=[...s.value];if("function"==typeof e.filter?t=t.filter(e.filter):e.filter&&"object"==typeof e.filter&&(t=t.filter(r=>Object.entries(e.filter).every(([e,t])=>"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&!!Object.prototype.hasOwnProperty.call(r,e)&&r[e]===t))),e.sort){let{field:a,direction:n="asc"}=e.sort;t.sort((e,t)=>{if("__proto__"===a||"constructor"===a||"prototype"===a)return 0;let r=Object.prototype.hasOwnProperty.call(e,a)?e[a]:void 0,o=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;return"string"==typeof r&&(r=r.toLowerCase()),"string"==typeof o&&(o=o.toLowerCase()),r<o?"asc"===n?-1:1:r>o?"asc"===n?1:-1:0})}var r=e.offset||0,o=void 0!==e.limit?e.limit:t.length;return t.slice(r,r+o)},async queryAsync(e={}){var t;return a&&(t=await n.getAsync(),s.value=t),this.query(e)},insert(e){e={id:Date.now().toString(36)+Math.random().toString(36).substr(2,5),createdAt:(new Date).toISOString(),...e};return s.value=[...s.value,e],a?n.insertAsync(e).catch(e=>console.error("PapyrDBError:",e)):n.insert(e),l(),e},async insertAsync(e){e={id:Date.now().toString(36)+Math.random().toString(36).substr(2,5),createdAt:(new Date).toISOString(),...e};return s.value=[...s.value,e],a?await n.insertAsync(e):n.insert(e),l(),e},update(t,r){s.value=s.value.map(e=>e.id===t?{...e,...r,updatedAt:(new Date).toISOString()}:e);var e=this.find(t);e&&(a?n.updateAsync(t,e).catch(e=>console.error("PapyrDBError:",e)):n.update(t,e)),l()},async updateAsync(t,r){s.value=s.value.map(e=>e.id===t?{...e,...r,updatedAt:(new Date).toISOString()}:e);var e=this.find(t);e&&(a?await n.updateAsync(t,e):n.update(t,e)),l()},delete(t){s.value=s.value.filter(e=>e.id!==t),a?n.deleteAsync(t).catch(e=>console.error("PapyrDBError:",e)):n.delete(t),l()},async deleteAsync(t){s.value=s.value.filter(e=>e.id!==t),a?await n.deleteAsync(t):n.delete(t),l()},clear(){s.value=[],a?n.clearAsync().catch(e=>console.error("PapyrDBError:",e)):n.clear(),l()},async clearAsync(){s.value=[],a?await n.clearAsync():n.clear(),l()},watch(t){return r.push(t),t(s.value),()=>r=r.filter(e=>e!==t)},async transaction(e){var r,t=JSON.stringify(s.value),o={_ops:[],insert(e){e={id:Date.now().toString(36)+Math.random().toString(36).substr(2,5),createdAt:(new Date).toISOString(),...e};return this._ops.push({type:"insert",record:e}),e},update(e,t){this._ops.push({type:"update",id:e,data:t})},delete(e){this._ops.push({type:"delete",id:e})}};try{await e(o);for(let t of o._ops)"insert"===t.type?(a?await n.insertAsync(t.record):n.insert(t.record),s.value=[...s.value,t.record]):"update"===t.type?(s.value=s.value.map(e=>e.id===t.id?{...e,...t.data,updatedAt:(new Date).toISOString()}:e),(r=s.value.find(e=>e.id===t.id))&&(a?await n.updateAsync(t.id,r):n.update(t.id,r))):"delete"===t.type&&(s.value=s.value.filter(e=>e.id!==t.id),a?await n.deleteAsync(t.id):n.delete(t.id));l()}catch(e){throw s.value=JSON.parse(t),l(),e}}}},p.db.drivers={},p.db.registerDriver=(e,t)=>{"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(p.db.drivers[e]=t)},(e,t)=>{if(void 0===t){var r=localStorage.getItem(e);if(null==r)return null;try{return JSON.parse(r)}catch(e){return r}}null===t?localStorage.removeItem(e):localStorage.setItem(e,"object"==typeof t?JSON.stringify(t):String(t))}),a=(o.set=(e,t)=>o(e,t),o.get=e=>o(e),o.remove=e=>localStorage.removeItem(e),o.clear=()=>localStorage.clear(),o.secureSet=(e,t,r)=>{if(!p.security)return console.error("PapyrError: Security module not loaded.");localStorage.setItem(e,p.security.encrypt(JSON.stringify(t),r))},o.secureGet=(e,t)=>{if(!p.security)return console.error("PapyrError: Security module not loaded.");e=localStorage.getItem(e);if(!e)return null;try{return JSON.parse(p.security.decrypt(e,t))}catch(e){return null}},o.secureSetAsync=async(e,t,r)=>{if(!p.security||"function"!=typeof p.security.encryptAsync)return o.secureSet(e,t,r);t=await p.security.encryptAsync(JSON.stringify(t),r);localStorage.setItem(e,t)},o.secureGetAsync=async(e,t)=>{if(!p.security||"function"!=typeof p.security.decryptAsync)return o.secureGet(e,t);e=localStorage.getItem(e);if(!e)return null;try{var r=await p.security.decryptAsync(e,t);return JSON.parse(r)}catch(e){return null}},p.storage=o,(e,t)=>{if(void 0===t){var r=sessionStorage.getItem(e);if(null==r)return null;try{return JSON.parse(r)}catch(e){return r}}null===t?sessionStorage.removeItem(e):sessionStorage.setItem(e,"object"==typeof t?JSON.stringify(t):String(t))});a.set=(e,t)=>a(e,t),a.get=e=>a(e),a.remove=e=>sessionStorage.removeItem(e),a.clear=()=>sessionStorage.clear(),a.secureSet=(e,t,r)=>{if(!p.security)return console.error("PapyrError: Security module not loaded.");sessionStorage.setItem(e,p.security.encrypt(JSON.stringify(t),r))},a.secureGet=(e,t)=>{if(!p.security)return console.error("PapyrError: Security module not loaded.");e=sessionStorage.getItem(e);if(!e)return null;try{return JSON.parse(p.security.decrypt(e,t))}catch(e){return null}},a.secureSetAsync=async(e,t,r)=>{if(!p.security||"function"!=typeof p.security.encryptAsync)return a.secureSet(e,t,r);t=await p.security.encryptAsync(JSON.stringify(t),r);sessionStorage.setItem(e,t)},a.secureGetAsync=async(e,t)=>{if(!p.security||"function"!=typeof p.security.decryptAsync)return a.secureGet(e,t);e=sessionStorage.getItem(e);if(!e)return null;try{var r=await p.security.decryptAsync(e,t);return JSON.parse(r)}catch(e){return null}},p.session=a,p.data={local:e=>p.db(e,"local"),session:e=>p.db(e,"session"),indexed:e=>p.db(e,"indexeddb"),remote:e=>p.db(e,"firebase")},p.drafts={save(e,t){p.storage.set("papyr_draft_"+e,{data:t,timestamp:Date.now()})},restore(e){e=p.storage.get("papyr_draft_"+e);return e?e.data:null},clear(e){p.storage.remove("papyr_draft_"+e)}},p.continuity={_intervals:new Map,enable(e={}){let{key:r="default",target:o=null,interval:t=5e3,onSave:a=null}=e;this._intervals.has(r)||((e=()=>{let e=null;var t;"function"==typeof o?e=o():o&&"object"==typeof o&&void 0!==o.value?e=o.value:o&&"string"==typeof o&&(t=document.querySelector(o))&&(e="checkbox"===t.type?t.checked:t.value),null!==e&&(p.drafts.save(r,e),"function"==typeof a)&&a(e)})(),e=setInterval(e,t),this._intervals.set(r,e))},disable(e="default"){var t=this._intervals.get(e);t&&(clearInterval(t),this._intervals.delete(e))},restore(e={}){var{key:e="default",target:t=null,onRestore:r=null}=e,e=p.drafts.restore(e);return null!==e?("function"==typeof r?r(e):t&&"object"==typeof t&&void 0!==t.value?t.value=e:t&&"string"==typeof t&&(r=document.querySelector(t))&&("checkbox"===r.type?r.checked=!!e:r.value=e),e):null}},p.offline={_queue:[],_isOnline:"undefined"==typeof navigator||navigator.onLine,_syncListeners:new Set,enable(e={}){var{onSync:e=null}=e,e=(e&&this._syncListeners.add(e),"undefined"!=typeof window&&(window.addEventListener("online",()=>{this._isOnline=!0,this.sync()}),window.addEventListener("offline",()=>{this._isOnline=!1})),p.storage.get("papyr_offline_queue"));Array.isArray(e)&&(this._queue=e),this._isOnline&&this.sync()},queueWrite(e,t,r){this._queue.push({id:Date.now().toString(36)+Math.random().toString(36).substr(2,5),action:e,collection:t,data:r,timestamp:Date.now()}),p.storage.set("papyr_offline_queue",this._queue),this._isOnline&&this.sync()},async sync(){if(this._isOnline&&0!==this._queue.length){var t,e=[...this._queue];this._queue=[],p.storage.remove("papyr_offline_queue");for(t of e)for(var r of this._syncListeners)try{await r(t)}catch(e){console.error("Offline sync error, pushing back to queue:",e),this._queue.push(t),p.storage.set("papyr_offline_queue",this._queue)}}}},p.retry=async(e,t={})=>{var{retries:r=3,delay:t=1e3,factor:o=2,onError:a=null}=t;let n=t;for(let t=0;t<r;t++)try{return await e()}catch(e){if(a&&a(e,t+1),t===r-1)throw e;await new Promise(e=>setTimeout(e,n)),n*=o}}}),f.push(r=>{r.crud=(e,t=[])=>{let a=r.state((()=>{try{return r.storage(e)||t}catch(e){return t}})()),o=()=>{try{r.storage(e,a.value)}catch(e){console.warn("PapyrStorageWarning: LocalStorage sync failed.",e)}};return{state:a,list(){return a.value},query(e={}){let t=[...a.value];if("function"==typeof e.filter?t=t.filter(e.filter):e.filter&&"object"==typeof e.filter&&(t=t.filter(r=>Object.entries(e.filter).every(([e,t])=>"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&!!Object.prototype.hasOwnProperty.call(r,e)&&r[e]===t))),e.sort){let{field:a,direction:n="asc"}=e.sort;t.sort((e,t)=>{if("__proto__"===a||"constructor"===a||"prototype"===a)return 0;let r=Object.prototype.hasOwnProperty.call(e,a)?e[a]:void 0,o=Object.prototype.hasOwnProperty.call(t,a)?t[a]:void 0;return"string"==typeof r&&(r=r.toLowerCase()),"string"==typeof o&&(o=o.toLowerCase()),r<o?"asc"===n?-1:1:r>o?"asc"===n?1:-1:0})}var r=e.offset||0,o=void 0!==e.limit?e.limit:t.length;return t.slice(r,r+o)},create(e){e={id:Date.now().toString(36)+Math.random().toString(36).substr(2,5),createdAt:(new Date).toISOString(),...e};return a.value=[...a.value,e],o(),e},read(t){return a.value.find(e=>e.id===t)},findById(e){return this.read(e)},update(t,r){a.value=a.value.map(e=>e.id===t?{...e,...r,updatedAt:(new Date).toISOString()}:e),o()},delete(t){a.value=a.value.filter(e=>e.id!==t),o()},clear(){a.value=[],o()}}}}),f.push(r=>{class e{constructor(e={}){Object.assign(this,e)}save(){var e=this.constructor.name.toLowerCase()+"s";return this.id?r.db(e).update(this.id,this):(e=r.db(e).insert(this),this.id=e.id),this}delete(){var e=this.constructor.name.toLowerCase()+"s";this.id&&r.db(e).delete(this.id)}static create(e){return new this(e).save()}static find(e){var t=this.name.toLowerCase()+"s",t=r.db(t).find(e);return t?new this(t):null}static all(){var e=this.name.toLowerCase()+"s";return r.db(e).state.value.map(e=>new this(e))}static watch(t){var e=this.name.toLowerCase()+"s";return r.db(e).watch(e=>{t(e.map(e=>new this(e)))})}}function t(t){if(!new.target)return{value:()=>t.value,oninput:e=>{"checkbox"===e.target.type?t.value=e.target.checked:"number"===e.target.type||"range"===e.target.type?t.value=parseFloat(e.target.value)||0:t.value=e.target.value}};Object.assign(this,t||{})}Object.setPrototypeOf(t,e),t.prototype=Object.create(e.prototype),r.model=t.prototype.constructor=t}),f.push(n=>{n.auth={user:n.state(null),_config:{provider:"local"},_providers:{},use(e){return this._config.provider=e,this._providers[e]||this},registerProvider(e,t){"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(this._providers[e]=t)},async _hashPassword(t){var e;if("undefined"!=typeof window&&window.crypto&&window.crypto.subtle)return e=(new TextEncoder).encode(t),e=await window.crypto.subtle.digest("SHA-256",e),Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join("");let r=0;for(let e=0;e<t.length;e++){var o=t.charCodeAt(e);r=(r<<5)-r+o,r&=r}return"sha256_poly_"+Math.abs(r).toString(16)},init(e){var t,r;this._config={...this._config,...e},"local"===this._config.provider&&(e=n.storage.get("auth_token"))&&(r=n.storage.get("papyr_auth_sessions")||{},(r=e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Object.prototype.hasOwnProperty.call(r,e)?r[e]:null)&&(t="object"==typeof r?r.username:r,!((r="object"==typeof r?r.expiresAt:null)&&Date.now()>r))&&(r=n.storage.get("papyr_auth_users")||{},r=t&&"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&Object.prototype.hasOwnProperty.call(r,t)?r[t]:null)?this.user.value={id:r.id,username:t,token:e}:this.logout())},async login(t){if("local"!==this._config.provider)return(r=this._providers[this._config.provider])&&"function"==typeof r.login?(r=await r.login(t),this.user.value=r):Promise.reject(new Error(`Auth provider "${this._config.provider}" is not registered or does not support login.`));if(!t.username||!t.password)return Promise.reject(new Error("Authentication failed: Username and password are required."));var r=n.storage.get("papyr_auth_lockouts")||{},o=t.username&&"__proto__"!==t.username&&"constructor"!==t.username&&"prototype"!==t.username&&Object.prototype.hasOwnProperty.call(r,t.username)?r[t.username]:null;if(o&&5<=o.failedCount&&Date.now()<o.lockedUntil)return e=Math.ceil((o.lockedUntil-Date.now())/6e4),Promise.reject(new Error(`Account locked: Too many failed login attempts. Try again in ${e} minutes.`));var e=n.storage.get("papyr_auth_users")||{},e=t.username&&"__proto__"!==t.username&&"constructor"!==t.username&&"prototype"!==t.username&&Object.prototype.hasOwnProperty.call(e,t.username)?e[t.username]:null;if(!e)return Promise.reject(new Error("Authentication failed: Username does not exist."));var a=await this._hashPassword(t.password);if(e.passwordHash!==a){a=(o?o.failedCount:0)+1;let e=null;return 5<=a&&(e=Date.now()+9e5),t.username&&"__proto__"!==t.username&&"constructor"!==t.username&&"prototype"!==t.username&&(r[t.username]={failedCount:a,lockedUntil:e}),n.storage.set("papyr_auth_lockouts",r),5<=a?Promise.reject(new Error("Account locked: Too many failed login attempts. Locked for 15 minutes.")):Promise.reject(new Error(`Authentication failed: Incorrect password. ${5-a} attempts remaining.`))}t.username&&"__proto__"!==t.username&&"constructor"!==t.username&&"prototype"!==t.username&&Object.prototype.hasOwnProperty.call(r,t.username)&&(delete r[t.username],n.storage.set("papyr_auth_lockouts",r));o="local_session_"+Math.random().toString(36).substr(2,9),a=n.storage.get("papyr_auth_sessions")||{},o&&"__proto__"!=o&&"constructor"!=o&&"prototype"!=o&&(a[o]={username:t.username,expiresAt:Date.now()+72e5}),n.storage.set("papyr_auth_sessions",a),n.storage.set("auth_token",o),r={id:e.id,username:t.username,token:o};return this.user.value=r},async register(e){var t,r,o;return"local"===this._config.provider?e.username&&e.password?e.password.length<8?Promise.reject(new Error("Registration failed: Password must be at least 8 characters long.")):(r=n.storage.get("papyr_auth_users")||{},Object.prototype.hasOwnProperty.call(r,e.username)?Promise.reject(new Error("Registration failed: Username already exists.")):(t=await this._hashPassword(e.password),e.username&&"__proto__"!==e.username&&"constructor"!==e.username&&"prototype"!==e.username&&(r[e.username]={id:Date.now(),username:e.username,passwordHash:t}),n.storage.set("papyr_auth_users",r),t="local_session_"+Math.random().toString(36).substr(2,9),o=n.storage.get("papyr_auth_sessions")||{},t&&"__proto__"!=t&&"constructor"!=t&&"prototype"!=t&&(o[t]={username:e.username,expiresAt:Date.now()+72e5}),n.storage.set("papyr_auth_sessions",o),n.storage.set("auth_token",t),o=e.username&&"__proto__"!==e.username&&"constructor"!==e.username&&"prototype"!==e.username&&Object.prototype.hasOwnProperty.call(r,e.username)?r[e.username].id:Date.now(),this.user.value={id:o,username:e.username,token:t})):Promise.reject(new Error("Registration failed: Username and password are required.")):(r=this._providers[this._config.provider])&&"function"==typeof r.register?(o=await r.register(e),this.user.value=o):Promise.reject(new Error(`Auth provider "${this._config.provider}" is not registered or does not support registration.`))},logout(){var e,t;return"local"===this._config.provider?((t=n.storage.get("auth_token"))&&(e=n.storage.get("papyr_auth_sessions")||{},t)&&"__proto__"!==t&&"constructor"!==t&&"prototype"!==t&&Object.prototype.hasOwnProperty.call(e,t)&&(delete e[t],n.storage.set("papyr_auth_sessions",e)),n.storage.set("auth_token",null),this.user.value=null,Promise.resolve()):(t=this._providers[this._config.provider])&&"function"==typeof t.logout?Promise.resolve(t.logout()).then(()=>{this.user.value=null}):(this.user.value=null,Promise.resolve())}}}),f.push(e=>{e.payments={_gateways:{},_config:{provider:"stripe"},use(e){return this._config=this._config||{},this._config.provider=e,this._gateways[e]||this},register(e,t){"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(this._gateways[e]=t)},resolve(e){return this._gateways[e]},async checkout(e,t){var r=this.resolve(e);return r?"function"!=typeof r.checkout?Promise.reject(new Error(`Payment gateway "${e}" does not implement checkout().`)):r.checkout(t):Promise.reject(new Error(`Payment gateway "${e}" is not registered.`))}}}),f.push(p=>{let d=()=>new Promise((t,r)=>{if("undefined"==typeof window||!window.indexedDB)return r("No IndexedDB support");var e=window.indexedDB.open("papyr_network_cache",1);e.onupgradeneeded=e=>{e=e.target.result;e.objectStoreNames.contains("cache")||e.createObjectStore("cache",{keyPath:"url"})},e.onsuccess=e=>t(e.target.result),e.onerror=e=>r(e.target.error)}),c=async(e,i)=>{try{let n=await d();return new Promise((r,o)=>{let a=n.transaction("cache","readonly").objectStore("cache").get(e);a.onsuccess=()=>{n.close();var e=a.result;if(e&&e.payload)try{var t=p.security?p.security.decrypt(e.payload,i):e.payload;r(JSON.parse(t))}catch(e){o(e)}else o(new Error("No cache entry"))},a.onerror=()=>{n.close(),o(a.error)}})}catch(e){return null}},e=async()=>{if("undefined"==typeof navigator||navigator.onLine){let e=[];try{e=JSON.parse(localStorage.getItem("papyr_mutation_ledger")||"[]")}catch(e){}if(0!==e.length){var t,r=[];for(t of e)try{var o=await fetch(t.url,{method:t.method,headers:{"Content-Type":"application/json",...t.headers},body:t.data?JSON.stringify(t.data):void 0});if(!o.ok)throw new Error("Sync server returned error "+o.status);p.emit&&p.emit("sync:success",{op:t,response:await o.json()})}catch(e){console.error("Ledger replay failed for",t.url,e),r.push(t)}localStorage.setItem("papyr_mutation_ledger",JSON.stringify(r))}}};"undefined"!=typeof window&&(window.addEventListener("online",()=>{e().catch(console.error)}),setInterval(()=>{e().catch(console.error)},15e3)),p.api={async fetch(t,r={}){var o=(r.method||"GET").toUpperCase(),a=r.headers||{},n=r.encryptionKey||"papyr_secure_mesh_cache",e="undefined"==typeof navigator||navigator.onLine;if("GET"!==o){if(e){var i=r.body||r.data,i=await fetch(t,{method:o,headers:{"Content-Type":"application/json",...a},body:i?JSON.stringify(i):void 0});if(i.ok)return i.json();throw new Error("HTTP error! Status: "+i.status)}{let e=[];try{e=JSON.parse(localStorage.getItem("papyr_mutation_ledger")||"[]")}catch(e){}i=r.body||r.data;return e.push({url:t,method:o,data:i,headers:a,timestamp:Date.now()}),localStorage.setItem("papyr_mutation_ledger",JSON.stringify(e)),{id:"temp_"+Math.random().toString(36).substr(2,9),..."object"==typeof i?i:{},status:"pending_sync"}}}if(!e){r=await c(t,n);if(r)return r;throw new Error("Offline and no cached data available")}try{var s,l=await fetch(t,{method:o,headers:a});if(l.ok)return await(async(o,e,a)=>{try{let t=await d();var n=JSON.stringify(e);let r=p.security?p.security.encrypt(n,a):n;return new Promise(e=>{t.transaction("cache","readwrite").objectStore("cache").put({url:o,payload:r,timestamp:Date.now()}).onsuccess=()=>{t.close(),e()}})}catch(e){console.error("Cache error:",e)}})(t,s=await l.json(),n),s;throw new Error("HTTP error! Status: "+l.status)}catch(e){i=await c(t,n);if(i)return i;throw e}},async get(e,t={}){return this.fetch(e,{method:"GET",headers:t})},async post(e,t,r={}){return this.fetch(e,{method:"POST",data:t,headers:r})}},p.cloud={_providers:{},_config:{provider:"vercel"},register(e,t){"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(this._providers[e]=t)},use(e){return this._config=this._config||{},this._config.provider=e,this._providers[e]||this}}}),f.push(t=>{t.log=(...e)=>{console.log("%c Papyr Log ","background: #3b82f6; color: white; border-radius: 4px; font-weight: bold; padding: 2px 4px;",...e)},t.warn=(...e)=>{console.warn("%c Papyr Warning ","background: #f59e0b; color: white; border-radius: 4px; font-weight: bold; padding: 2px 4px;",...e),t.diagnostics.errors.push({type:"warning",message:e.map(String).join(" "),timestamp:(new Date).toISOString()})}}),"undefined"==typeof window||window.papyr||(window.papyr=e());var r,x,k,_=e();"undefined"!=typeof window?window.papyr=_:"undefined"!=typeof global&&(global.papyr=_);let S=_;if(void 0===S)console.warn("Papyr core not detected. Official plugins require papyr core to run.");else{let s={bolt:'<path d="M13 2L3 14h9l-1 8 10-12h-9l1-8z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',lock:'<rect x="3" y="11" width="18" height="11" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/><path d="M7 11V7a5 5 0 0110 0v4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',unlock:'<rect x="3" y="11" width="18" height="11" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/><path d="M7 11V7a5 5 0 019.9-1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',todo:'<path d="M9 11l3 3L22 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><rect x="3" y="4" width="18" height="18" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/>',home:'<path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><path d="M9 22V12h6v10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',book:'<path d="M2 3h6a4 4 0 014 4v14a3 3 0 00-3-3H2zM22 3h-6a4 4 0 00-4 4v14a3 3 0 013-3h7z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',users:'<path d="M17 21v-2a4 4 0 00-3-3H5a4 4 0 00-4 4v2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><circle cx="9" cy="7" r="4" stroke="currentColor" stroke-width="2" fill="none"/><path d="M23 21v-2a4 4 0 00-3-3.87M16 3.13a4 4 0 010 7.75" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',folder:'<path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',search:'<circle cx="11" cy="11" r="8" stroke="currentColor" stroke-width="2" fill="none"/><path d="M21 21l-4.35-4.35" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',external:'<path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6M15 3h6v6M10 14L21 3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',image:'<rect x="3" y="3" width="18" height="18" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/><circle cx="8.5" cy="8.5" r="1.5" fill="currentColor"/><path d="M21 15l-5-5L5 21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',bell:'<path d="M18 8A6 6 0 006 8c0 7-3 9-3 9h18s-3-2-3-9M13.73 21a2 2 0 01-3.46 0" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',check:'<path d="M22 11.08V12a10 10 0 11-5.93-9.14M22 4L12 14.01l-3-3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',info:'<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2" fill="none"/><path d="M12 16v-4M12 8h.01" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',alert:'<path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><path d="M12 9v4M12 17h.01" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',terminal:'<path d="M4 17l6-6-6-6M12 19h8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',copy:'<rect x="9" y="9" width="13" height="13" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/><path d="M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',palette:'<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 14 3 16 4.5 17C5.5 17.6667 5.5 19 4 20C3 20.6667 3 22 5 22C6.5 22 8 21.5 9 20C9.66667 19.3333 10.3333 19 11 19C11.6667 19 12 20 12 22Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',code:'<path d="M16 18l6-6-6-6M8 6L2 12l6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',database:'<ellipse cx="12" cy="5" rx="9" ry="3" stroke="currentColor" stroke-width="2" fill="none"/><path d="M3 5v6c0 1.66 4 3 9 3s9-1.34 9-3V5M3 11v6c0 1.66 4 3 9 3s9-1.34 9-3v-6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',github:'<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 00-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0020 4.77 5.07 5.07 0 0019.91 1S18.73.65 16 2.48a13.38 13.38 0 00-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 005 4.77a5.44 5.44 0 00-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 009 18.13V22" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',settings:'<circle cx="12" cy="12" r="3" stroke="currentColor" stroke-width="2" fill="none"/><path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 11-2.83 2.83l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 11-2.83-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 112.83-2.83l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 112.83 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',package:'<path d="M21 16V8a2 2 0 00-1-1.73l-7-4a2 2 0 00-2 0l-7 4A2 2 0 003 8v8a2 2 0 001 1.73l7 4a2 2 0 002 0l7-4A2 2 0 0021 16z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><path d="M3.27 6.96L12 12.01l8.73-5.05M12 22.08V12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',refresh:'<path d="M21.5 2v6h-6M21.34 15.57a10 10 0 11-.57-8.38l5.67-5.67" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',arrowRight:'<path d="M5 12h14M12 5l7 7-7 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',arrowLeft:'<path d="M19 12H5M12 19l-7-7 7-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',star:'<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',plus:'<path d="M12 5v14M5 12h14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',trash:'<path d="M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2M10 11v6M14 11v6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',edit:'<path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7M18.5 2.5a2.121 2.121 0 113 3L12 15l-4 1 1-4 9.5-9.5z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',eye:'<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><circle cx="12" cy="12" r="3" stroke="currentColor" stroke-width="2" fill="none"/>',calendar:'<rect x="3" y="4" width="18" height="18" rx="2" ry="2" stroke="currentColor" stroke-width="2" fill="none"/><path d="M16 2v4M8 2v4M3 10h18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',save:'<path d="M19 21H5a2 2 0 01-2-2V5a2 2 0 01-2-2h11l5 5v11a2 2 0 01-2 2z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/><path d="M17 21v-8H7v8M7 3v5h8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',user:'<path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2" stroke="currentColor" stroke-width="2" fill="none"/><circle cx="12" cy="7" r="4" stroke="currentColor" stroke-width="2" fill="none"/>'},i=(S.icon=(e,t={})=>{var r=t.size||16,o=t.color||"currentColor",a=t.strokeWidth||2,n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("width",String(r)),n.setAttribute("height",String(r)),n.setAttribute("viewBox","0 0 24 24"),n.style.display="inline-block",n.style.verticalAlign="middle",n.style.color=o,t.style&&Object.assign(n.style,t.style),t.class&&n.setAttribute("class",t.class);let i=e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&Object.prototype.hasOwnProperty.call(s,e)?s[e]:"";return 2!==a&&(i=i.replace(/stroke-width="2"/g,`stroke-width="${a}"`)),n.innerHTML=i,n},S.autoComplete=(r,o)=>{let a;var e,t=Array.isArray(r);(a=t?(e="string"==typeof o?o:"Search...",S.input("text",e,{style:{width:"100%"}})):"string"==typeof r?S.input("text",r,{style:{width:"100%"}}):r)&&"function"==typeof a.addEventListener||(e="string"==typeof o?o:"string"==typeof r?r:"Search...",(a=document.createElement("input")).type="text",a.placeholder=e,a.style.width="100%",a.className="input-text");let n=S.ul(".suggestions"),i=S.div(".autocomplete",a,n),s;return t?a.addEventListener("input",e=>{let t=e.target.value.toLowerCase().trim();n.innerHTML="",t&&r.filter(e=>e.toLowerCase().includes(t)).slice(0,5).forEach(t=>{var e=S.li(t,{on:{click:()=>{a.value=t,n.innerHTML="";var e=new CustomEvent("select",{detail:t}),e=(i.dispatchEvent(e),new CustomEvent("change",{detail:t}));i.dispatchEvent(e)}}});n.appendChild(e)})}):a.addEventListener("input",async e=>{clearTimeout(s);let t=e.target.value;t.length<2?n.innerHTML="":s=setTimeout(async()=>{try{var e=await(await fetch(""+o+t)).json();n.innerHTML="",(Array.isArray(e)?e:e.results||e.products||e.data||[]).slice(0,5).forEach(t=>{let r=t.title||t.name||t.username||t;var e=S.li(r,{on:{click:()=>{a.value=r,n.innerHTML="",S.onSuggestion&&S.onSuggestion(t);var e=new CustomEvent("select",{detail:t}),e=(i.dispatchEvent(e),new CustomEvent("change",{detail:r}));i.dispatchEvent(e)}}});n.appendChild(e)})}catch(e){console.error(e)}},300)}),document.addEventListener("click",e=>{i.contains(e.target)||(n.innerHTML="")}),i},S.form=(...t)=>{if(0<t.length&&Array.isArray(t[0])){let[e,r]=t,a=S("form",".papyr-form"),n=[];e.forEach(e=>{var t=S.div(".form-field"),r=S.label(e.label,{for:e.name});let o;"select"===e.type?(o=S.select({name:e.name,id:e.name}),e.options.forEach(e=>{o.appendChild(S.option(e,{value:e,textContent:e}))})):o="textarea"===e.type?S.textarea("",{name:e.name,id:e.name,rows:e.rows||3,placeholder:e.placeholder||""}):S.input("",{type:e.type||"text",name:e.name,id:e.name,placeholder:e.placeholder||""}),t.appendChild(r),t.appendChild(o),a.appendChild(t),n.push(o)});var o=S.button("Submit",{type:"submit",class:"btn-primary"});return a.appendChild(o),a.addEventListener("submit",e=>{e.preventDefault();let t=Object.create(null);n.forEach(e=>{e.name&&"__proto__"!==e.name&&"constructor"!==e.name&&"prototype"!==e.name&&(t[e.name]=e.value)}),r&&r(t)}),a}return S("form",...t)},S.card=(...e)=>{if(!(0<e.length&&"object"==typeof e[0])||e[0]instanceof Element||e[0]instanceof DocumentFragment||Array.isArray(e[0])||"function"==typeof e[0].subscribe)return[o,t,r]=e,o=o?"string"==typeof o?S.h3(o,".card-title"):o:null,t=t?"string"==typeof t?S.div(t,".card-content"):t:null,a=[],o&&a.push(o),t&&a.push(t),r&&(o="string"==typeof r?S.div(r,".card-footer"):r,a.push(o)),S.div(".papyr-card",...a);var[t,...r]=e,o=(t={...t}).interactive,a=(delete t.interactive,o&&(t.interactive="true"),t.tilt),e=(delete t.tilt,S("div",".papyr-card",t,...r));if(a){let t=e._onMounted;e._onMounted=e=>{t&&t(e),S["3d"]&&"function"==typeof S["3d"].tilt&&S["3d"].tilt(e)}}return e},S.title=(...e)=>S("h1",".papyr-title",...e),S.muted=(...e)=>S("p",".papyr-muted",...e),S.modal=(e,t="Modal")=>{let r={},o=!1;null===e||"object"!=typeof e||e instanceof Element||e instanceof DocumentFragment?(r={content:e,title:"string"==typeof t?t:"Modal"},o=!0):r={...e};t=r.title||"Modal",e=r.content||"";let a=r.animation||"glass-pop",n=r.onClose,i=S.div({style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(2, 6, 23, 0.65)",backdropFilter:"blur(12px)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:9998,opacity:0,transition:"opacity 0.3s ease"},on:{click:e=>{e.target===i&&u()}}});var s="papyr-modal-"+Math.random().toString(36).substring(2,9);let l=S.div(".papyr-card.papyr-modal-box",{id:s,role:"dialog","aria-modal":"true","aria-labelledby":s+"-title",tabIndex:-1,style:{padding:"24px",width:"90%",maxWidth:"450px",background:"rgba(15, 23, 42, 0.65)",border:"1px solid rgba(255, 255, 255, 0.08)",borderRadius:"24px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.5)",transform:"glass-pop"===a?"scale(0.9) translateY(10px)":"translateY(50px)",transition:"transform 0.4s cubic-bezier(0.16, 1, 0.3, 1)"}},S.flex.between(S.h3(t,{id:s+"-title",style:{margin:0,color:"#fff",fontSize:"1.25rem",fontWeight:"600"}}),S.button("×",{class:"close-btn",ariaLabel:"Close Dialog",on:{click:()=>u()},style:{background:"transparent",border:"none",color:"#94a3b8",fontSize:"24px",cursor:"pointer",padding:"0 4px",lineLight:1}})),S.div({style:{marginTop:"16px",color:"#cbd5e1",fontSize:"0.95rem",lineHeight:"1.5"}},e)),p=(i.appendChild(l),"undefined"!=typeof document?document.activeElement:null),d=e=>{var t,r;"Tab"===e.key&&0!==(r=l.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).length&&(t=r[0],r=r[r.length-1],e.shiftKey?document.activeElement===t&&(r.focus(),e.preventDefault()):document.activeElement===r&&(t.focus(),e.preventDefault()))},c=e=>{"Escape"===e.key&&u()};t=()=>{"undefined"!=typeof document&&(document.body.appendChild(i),i.offsetHeight,i.style.opacity="1",l.style.transform="glass-pop"===a?"scale(1) translateY(0)":"translateY(0)",setTimeout(()=>{var e=l.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');(e||l).focus()},100),document.addEventListener("keydown",c),l.addEventListener("keydown",d))};let u=()=>{i.style.opacity="0",l.style.transform="glass-pop"===a?"scale(0.9) translateY(10px)":"translateY(50px)",document.removeEventListener("keydown",c),l.removeEventListener("keydown",d),setTimeout(()=>{i.remove(),p&&"function"==typeof p.focus&&p.focus(),n&&n()},300)};return o?(i.show=t,i.hide=u,i):(t(),{close:u})},S.modal.alert=(e,t="Alert")=>{"undefined"!=typeof window&&window.alert&&window.alert(t+`
2
2
 
3
- `+e)},x.modal.confirm=(e,t)=>"undefined"!=typeof window&&window.confirm?(e=window.confirm(e),t&&t(e),e):(t&&t(!1),!1),null);x.toast=(o,a="info",n=3e3,e=!1)=>{if("undefined"!=typeof window){if("default"===a&&(a="info"),e&&"Notification"in window){let t=()=>{try{new Notification("Papyr Notification",{body:o,icon:"https://eldrex.landecs.org/logo/eldrex-papyr-js.png"})}catch(e){r()}};if("granted"===Notification.permission)return void t();if("denied"!==Notification.permission)return void Notification.requestPermission().then(e=>{("granted"===e?t:r)()})}r()}function r(){i||((i=document.createElement("div")).className="papyr-toast-container",i.style.cssText=`
3
+ `+e)},S.modal.confirm=(e,t)=>"undefined"!=typeof window&&window.confirm?(e=window.confirm(e),t&&t(e),e):(t&&t(!1),!1),null);S.toast=(o,a="info",n=3e3,e=!1)=>{if("undefined"!=typeof window){if("default"===a&&(a="info"),e&&"Notification"in window){let t=()=>{try{new Notification("Papyr Notification",{body:o,icon:"https://eldrex.landecs.org/logo/eldrex-papyr-js.png"})}catch(e){r()}};if("granted"===Notification.permission)return void t();if("denied"!==Notification.permission)return void Notification.requestPermission().then(e=>{("granted"===e?t:r)()})}r()}function r(){i||((i=document.createElement("div")).className="papyr-toast-container",i.style.cssText=`
4
4
  position: fixed;
5
5
  bottom: 24px;
6
6
  right: 24px;
@@ -24,13 +24,82 @@
24
24
  opacity: 0;
25
25
  transform: translateY(20px) scale(0.95);
26
26
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.1);
27
- `,r.innerHTML=`<span style="font-weight: bold; margin-right: 6px;">${t}</span>`+o,i.appendChild(r),r.offsetHeight,r.style.opacity="1",r.style.transform="translateY(0) scale(1)",setTimeout(()=>{r.style.opacity="0",r.style.transform="translateY(-10px) scale(0.95)",setTimeout(()=>{r.remove(),i&&0===i.children.length&&(i.remove(),i=null)},350)},n)}},x.tabs=e=>{let o=x.div(".tab-headers"),a=x.div(".tab-contents"),n=x.div(".tabs",o,a);return e.forEach((t,r)=>{var e=x.button(t.title,{class:0===r?"tab-header tab-active":"tab-header",on:{click:()=>{n.querySelectorAll(".tab-header").forEach((e,t)=>{e.classList.toggle("tab-active",t===r)}),a.innerHTML="";var e="string"==typeof t.content?x.div(t.content):t.content;a.appendChild(e)}}});o.appendChild(e),0===r&&(e="string"==typeof t.content?x.div(t.content):t.content,a.appendChild(e))}),n},x.table=(...o)=>{if(0<o.length&&Array.isArray(o[0])&&"string"==typeof o[0][0]){let[e,t]=o;var n=x("table",".data-table"),i=x.thead();let r=x.tr(),a=(e.forEach(e=>{e=e.charAt(0).toUpperCase()+e.slice(1);r.appendChild(x.th(e))}),i.appendChild(r),n.appendChild(i),x.tbody());return t.forEach(r=>{let o=x.tr();e.forEach(e=>{var e=void 0!==r[e]?r[e]:"",t=x.td();e instanceof Element?t.appendChild(e):t.textContent=e,o.appendChild(t)}),a.appendChild(o)}),n.appendChild(a),n}return x("table",...o)},x.fetch=async(t,r={})=>{var e=x.div(".loading",x.div(".spinner"),x.span("Fetching data..."));let o=x.div(e);return setTimeout(async()=>{try{var e=await(await fetch(t,r)).json();o.innerHTML="",r.onSuccess?r.onSuccess(o,e):o.appendChild(x.pre(JSON.stringify(e,null,2)))}catch(e){o.innerHTML="",o.appendChild(x.div(".error","⚠️ Error: "+e.message))}},400),o},x.input=(e,t,r={})=>"object"==typeof e&&null!==e?x("input",e):("object"==typeof t&&null!==t&&(t=(r=t).placeholder||""),r=Object.assign({},r),e&&(r.type=r.type||e),t&&(r.placeholder=r.placeholder||t),e?x("input",".input-"+e,r):x("input",r)),x.simpleTable=e=>{var o=x("table",".papyr-table");if(e.headers){var r=x("thead");let t=x("tr");e.headers.forEach(e=>{t.appendChild(x("th",e))}),r.appendChild(t),o.appendChild(r)}if(e.rows){let r=x("tbody");e.rows.forEach(e=>{let t=x("tr");e.forEach(e=>{t.appendChild(x("td",String(e)))}),r.appendChild(t)}),o.appendChild(r)}return o},x.chart=(a,n,c={})=>{let i=x("canvas",{width:c.width||300,height:c.height||180,style:{display:"block",margin:"0 auto",maxWidth:"100%",borderRadius:"8px",background:"transparent"}});return requestAnimationFrame(()=>{let p=i.getContext("2d");if(p){var e,t=i.width;let d=i.height;if(p.clearRect(0,0,t,d),"bar"===a){var r=n.values||[];let i=n.labels||[],s=Math.max(...r,1);var o=r.length;let l=(t-16*(o+1))/o;r.forEach((e,t)=>{var r=e/s*(d-50),o=16+t*(16+l),a=d-30-r,n=(p.fillStyle="rgba(255,255,255,0.02)",p.beginPath(),p.roundRect?p.roundRect(o,10,l,d-40,6):p.rect(o,10,l,d-40),p.fill(),p.createLinearGradient(0,a,0,d-30));n.addColorStop(0,c.color||"#6366f1"),n.addColorStop(1,c.colorAlt||"#312e81"),p.fillStyle=n,p.beginPath(),p.roundRect?p.roundRect(o,a,l,r,[6,6,0,0]):p.rect(o,a,l,r),p.fill(),p.fillStyle="#f8fafc",p.font="bold 11px sans-serif",p.textAlign="center",p.fillText(e,o+l/2,a-8),p.fillStyle="#94a3b8",p.font="10px sans-serif",p.fillText(i[t]||"",o+l/2,d-10)})}else"ring"===a&&(o=n.value||0,r=t/2,e=d/2,t=Math.min(t,d)/2.6,p.beginPath(),p.arc(r,e,t,0,2*Math.PI),p.lineWidth=c.lineWidth||14,p.strokeStyle="rgba(255,255,255,0.06)",p.stroke(),p.beginPath(),p.arc(r,e,t,-Math.PI/2,-Math.PI/2+2*Math.PI*(o/100)),p.lineWidth=c.lineWidth||14,p.strokeStyle=c.color||"#10b981",p.lineCap="round",p.stroke(),p.fillStyle="#f8fafc",p.font="bold 24px sans-serif",p.textAlign="center",p.textBaseline="middle",p.fillText(o+"%",r,e-6),p.fillStyle="#94a3b8",p.font="10px sans-serif",p.fillText(n.label||"",r,16+e))}}),i},Object.assign(x.components,{navbar:(e,t)=>{var r=x.nav(".navbar");let o=x.div(".nav-links");t.forEach(e=>{o.appendChild(x.a(e.text,{href:e.href,class:"nav-link",onclick:e.onclick||null}))});t="string"==typeof e?x.div(e,".logo"):e;return r.appendChild(t),r.appendChild(o),r},hero:(e,t,r,o)=>x.section(".hero",x.h1(e,".hero-title"),x.p(t,".hero-subtitle"),x.button(r,{class:"hero-btn",on:{click:o}})),sidebar:e=>{let o=x.aside(".sidebar");return e.forEach(e=>{let t="string"==typeof e?e:e.text||"",r;r="object"==typeof e&&e.icon?x.div(".sidebar-item",x.icon(e.icon,{size:16,style:{marginRight:"8px"}}),x.span(t)):x.div(".sidebar-item",x.span(t)),e.active&&r.classList.add("active"),r.addEventListener("click",()=>{o.querySelectorAll(".sidebar-item").forEach(e=>e.classList.remove("active")),r.classList.add("active"),e.onclick?e.onclick(t):x.toast("Navigated to: "+t,"info")}),o.appendChild(r)}),o},footer:(e,t=[])=>{var r=x.footer(".footer");let o=x.div(".footer-links");return t.forEach(e=>{o.appendChild(x.a(e.text,{href:e.href}))}),r.appendChild(o),r.appendChild(x.p(e,".footer-text")),r},carousel:e=>{let o=0,t=x.img("",{src:e[0],class:"carousel-img"});var r=x.button("◀",{class:"carousel-btn prev-btn"}),a=x.button("▶",{class:"carousel-btn next-btn"});let n=x.div(".carousel-dots"),i=(e.forEach((e,t)=>{var r=x.span(".carousel-dot");0===t&&r.classList.add("active"),r.onclick=()=>{return e=t,o=e,void s();var e},n.appendChild(r)}),x.div(".carousel",r,t,a,n));function s(){t.style.opacity=0,setTimeout(()=>{t.src=e[o],t.style.opacity=1},150),i.querySelectorAll(".carousel-dot").forEach((e,t)=>{e.classList.toggle("active",t===o)})}return r.onclick=()=>{o=(o-1+e.length)%e.length,s()},a.onclick=()=>{o=(o+1)%e.length,s()},i}})}{x.center=(...e)=>x.div({style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"}},...e),x.left=(...e)=>x.div({style:{display:"flex",justifyContent:"flex-start",alignItems:"center",width:"100%"}},...e),x.right=(...e)=>x.div({style:{display:"flex",justifyContent:"flex-end",alignItems:"center",width:"100%"}},...e),x.justify=(...e)=>x.div({style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}},...e),x.glass=(...e)=>x.div({style:{background:"rgba(255, 255, 255, 0.05)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:"1px solid rgba(255, 255, 255, 0.1)",boxShadow:"0 8px 32px 0 rgba(0, 0, 0, 0.3)",borderRadius:"16px"}},...e),x.template=e=>"glass-dashboard"===e?x.div({style:{display:"flex",minHeight:"100vh",background:"#0f172a",padding:"20px",gap:"20px"}},x.glass({style:{width:"250px",padding:"20px"}},x.h3("Sidebar")),x.div({style:{flexGrow:1,display:"flex",flexDirection:"column",gap:"20px"}},x.glass({style:{padding:"20px"}},x.h2("Dashboard Overview")),x.div({style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:"20px"}},x.glass({style:{padding:"40px",textAlign:"center"}},"Metric 1"),x.glass({style:{padding:"40px",textAlign:"center"}},"Metric 2")))):x.div(`Template ${e} not found.`);let l=e=>{if(!e)return null;var t,r,o,a,n,i={};e.absoluteBoundingBox&&(i.position="absolute",i.left=e.absoluteBoundingBox.x+"px",i.top=e.absoluteBoundingBox.y+"px",i.width=e.absoluteBoundingBox.width+"px",i.height=e.absoluteBoundingBox.height+"px"),e.fills&&0<e.fills.length&&"SOLID"===(o=e.fills[0]).type&&o.color&&(n=Math.round(255*o.color.r),t=Math.round(255*o.color.g),r=Math.round(255*o.color.b),o=void 0!==o.opacity?o.opacity:void 0!==o.color.a?o.color.a:1,i.background=`rgba(${n}, ${t}, ${r}, ${o})`),e.strokes&&0<e.strokes.length&&(n=e.strokes[0],t=e.strokeWeight||1,"SOLID"===n.type)&&n.color&&(r=Math.round(255*n.color.r),o=Math.round(255*n.color.g),a=Math.round(255*n.color.b),n=void 0!==n.opacity?n.opacity:void 0!==n.color.a?n.color.a:1,i.border=t+`px solid rgba(${r}, ${o}, ${a}, ${n})`),e.cornerRadius&&(i.borderRadius=e.cornerRadius+"px"),"HORIZONTAL"!==e.layoutMode&&"VERTICAL"!==e.layoutMode||(i.display="flex",i.flexDirection="HORIZONTAL"===e.layoutMode?"row":"column",e.itemSpacing&&(i.gap=e.itemSpacing+"px"),e.paddingTop&&(i.paddingTop=e.paddingTop+"px"),e.paddingBottom&&(i.paddingBottom=e.paddingBottom+"px"),e.paddingLeft&&(i.paddingLeft=e.paddingLeft+"px"),e.paddingRight&&(i.paddingRight=e.paddingRight+"px"));let s=[];return e.children&&Array.isArray(e.children)&&(s=e.children.map(l).filter(Boolean)),"TEXT"===e.type?(e.style&&(e.style.fontSize&&(i.fontSize=e.style.fontSize+"px"),e.style.fontWeight&&(i.fontWeight=String(e.style.fontWeight)),e.style.fontFamily&&(i.fontFamily=e.style.fontFamily),e.style.textAlignHorizontal)&&(i.textAlign=e.style.textAlignHorizontal.toLowerCase()),x.span(e.characters||"",{style:i})):x.div({style:i},...s)};x.import={figma:e=>{if(!e)return null;let t=e.document||e;return(t=t.children&&0<t.children.length&&"DOCUMENT"===t.type?t.children[0]:t).children&&0<t.children.length&&"CANVAS"===t.type&&(t=t.children[0]),l(t)}}}x.glass=(...e)=>x.div({class:"papyr-glass-panel",style:{background:"rgba(255, 255, 255, 0.04)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",border:"1px solid rgba(255, 255, 255, 0.08)",boxShadow:"0 8px 32px 0 rgba(0, 0, 0, 0.35)",borderRadius:"16px",padding:"20px",color:"#f8fafc"}},...e),x.autoFlex=(n,e={})=>{if(n&&"undefined"!=typeof window){let t=e.breakpoint||768,r=e.rowClass||"flex-row",o=e.colClass||"flex-col",a=e=>{e<t?(n.classList.remove(r),n.classList.add(o),n.style.flexDirection="column"):(n.classList.remove(o),n.classList.add(r),n.style.flexDirection="row")};if("undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{for(var t of e)a(t.contentRect.width||t.target.clientWidth)});e.observe(n),n._cleanups||(n._cleanups=[]),n._cleanups.push(()=>e.disconnect())}else{let e=()=>a(window.innerWidth);window.addEventListener("resize",e),e(),n._cleanups||(n._cleanups=[]),n._cleanups.push(()=>window.removeEventListener("resize",e))}}return n},x.layout={flex(e={},...t){e=Object.assign({direction:"var(--papyr-flex-dir, row)",wrap:"var(--papyr-flex-wrap, wrap)",justify:"var(--papyr-flex-justify, flex-start)",align:"var(--papyr-flex-align, stretch)",gap:"var(--papyr-flex-gap, 16px)"},e);return x.div({class:"papyr-layout-flex",style:{display:"flex",flexDirection:e.direction,flexWrap:e.wrap,justifyContent:e.justify,alignItems:e.align,gap:e.gap,width:"100%"}},...t)},grid(e={},...t){e=Object.assign({cols:"var(--papyr-grid-cols, repeat(auto-fit, minmax(250px, 1fr)))",rows:"var(--papyr-grid-rows, auto)",gap:"var(--papyr-grid-gap, 20px)"},e);return x.div({class:"papyr-layout-grid",style:{display:"grid",gridTemplateColumns:e.cols,gridTemplateRows:e.rows,gap:e.gap,width:"100%"}},...t)},row(...e){return this.flex({direction:"row"},...e)},col(...e){return this.flex({direction:"column"},...e)},foldable(e={},...t){var r="undefined"!=typeof window&&(window.matchMedia("(spanning: single-fold-vertical)").matches||window.matchMedia("(spanning: single-fold-horizontal)").matches||window.innerWidth<900),e=Object.assign({gap:"24px"},e);return x.div({class:"papyr-foldable-layout",style:{display:"grid",gridTemplateColumns:r?"1fr":"1fr 1fr",gap:e.gap,width:"100%"}},...t)},mobile(e={},...t){var{header:e=null,nav:r=null}=e;return x.div({class:"papyr-layout-mobile",style:{display:"flex",flexDirection:"column",minHeight:"100vh",width:"100%",background:"#070913"}},e?x("header",{style:{padding:"16px",borderBottom:"1px solid rgba(255,255,255,0.08)",background:"rgba(16,22,42,0.8)"}},e):null,x("main",{style:{flexGrow:1,padding:"16px",overflowY:"auto"}},...t),r?x("nav",{style:{padding:"12px",borderTop:"1px solid rgba(255,255,255,0.08)",background:"rgba(16,22,42,0.9)",display:"flex",justifyContent:"space-around"}},r):null)},tablet(e={},...t){var{sidebar:e=null}=e;return x.div({class:"papyr-layout-tablet",style:{display:"flex",minHeight:"100vh",width:"100%",background:"#070913"}},e?x("aside",{style:{width:"80px",borderRight:"1px solid rgba(255,255,255,0.08)",background:"rgba(11,16,36,0.95)",display:"flex",flexDirection:"column",alignItems:"center",padding:"20px 0",gap:"20px"}},e):null,x("main",{style:{flexGrow:1,padding:"24px",overflowY:"auto"}},...t))},desktop(e={},...t){var{sidebar:e=null,inspector:r=null,sidebarWidth:o="250px",inspectorWidth:a="300px"}=e;return x.div({class:"papyr-layout-desktop",style:{display:"flex",minHeight:"100vh",width:"100%",background:"#070913"}},e?x("aside",{style:{width:o,borderRight:"1px solid rgba(255,255,255,0.08)",background:"rgba(11,16,36,0.95)",overflowY:"auto"}},e):null,x("main",{style:{flexGrow:1,padding:"24px",overflowY:"auto"}},...t),r?x("aside",{style:{width:a,borderLeft:"1px solid rgba(255,255,255,0.08)",background:"rgba(11,16,36,0.95)",overflowY:"auto"}},r):null)},dashboard(e={}){let{sidebar:t=null,header:r=null,main:o=null,footer:a=null,sidebarWidth:n="250px",headerHeight:i="64px"}=e,s=x.state(!0);var l,e=x.div({class:"papyr-app-shell",style:{display:"grid",gridTemplateColumns:t?n+" 1fr":"1fr",gridTemplateRows:r?i+" 1fr auto":"1fr auto",minHeight:"100vh",width:"100%",background:"#070913"}});return"undefined"!=typeof window&&(window.addEventListener("resize",l=()=>{window.innerWidth<768?s.value=!1:s.value=!0}),setTimeout(l,10)),r&&(l=x.button(".menu-toggle",{style:{background:"transparent",border:"none",color:"white",fontSize:"1.5rem",cursor:"pointer",padding:"10px",display:t?"inline-block":"none"},onclick:()=>{s.value=!s.value}},"☰"),e.appendChild(x("header",{class:"papyr-shell-header",style:{gridColumn:"1 / -1",background:"rgba(16, 22, 42, 0.8)",backdropFilter:"blur(12px)",borderBottom:"1px solid rgba(255,255,255,0.08)",display:"flex",alignItems:"center",padding:"0 20px",gap:"15px",zIndex:10}},l,r))),t&&(l=x("aside",{class:"papyr-shell-sidebar",style:()=>({gridRow:r?"2 / -1":"1 / -1",background:"rgba(11, 16, 36, 0.95)",borderRight:"1px solid rgba(255,255,255,0.08)",overflowY:"auto",width:s.value?n:"0px",minWidth:s.value?n:"0px",opacity:s.value?1:0,pointerEvents:s.value?"auto":"none",transition:"width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s"})},t),e.appendChild(l)),e.appendChild(x("main",{class:"papyr-main-content",style:{padding:"24px",overflowY:"auto",position:"relative",zIndex:1}},o||x.div("Main Content Area"))),a&&e.appendChild(x("footer",{class:"papyr-shell-footer",style:{gridColumn:t?"2 / -1":"1",background:"rgba(16, 22, 42, 0.8)",borderTop:"1px solid rgba(255,255,255,0.08)",padding:"12px 20px"}},a)),e},hero(e={}){var{title:e="Cinematic Experience",subtitle:t="Crafted beautifully with high performance reactivity",actions:r=[],theme:o="primary",glass:a=!0,padding:n="80px 40px"}=e;let i="teal"===o?"#14b8a6":"#6366f1",s="teal"===o?"#0d9488":"#4f46e5";o=x.flex.col({align:"center",style:{textAlign:"center",maxWidth:"800px",gap:"20px",zIndex:2,position:"relative"}},x.h1(e,{style:{fontSize:"var(--papyr-hero-title-size, 3.5rem)",fontWeight:"800",color:"white",margin:0,lineHeight:"1.1",letterSpacing:"-0.025em",background:`linear-gradient(135deg, #ffffff 30%, ${i} 100%)`,webkitBackgroundClip:"text",webkitTextFillColor:"transparent",textFillColor:"transparent"}}),x.p(t,{style:{fontSize:"1.25rem",color:"#94a3b8",margin:0,lineHeight:"1.6",maxWidth:"600px"}}));if(r&&0<r.length){let t=x.flex.row({justify:"center",gap:"12px",style:{marginTop:"10px"}});r.forEach(e=>{e instanceof Element?t.appendChild(e):"object"==typeof e&&(e=x.button(e.text||"Action",Object.assign({style:Object.assign({background:e.primary?`linear-gradient(135deg, ${i} 0%, ${s} 100%)`:"rgba(255,255,255,0.06)",border:e.primary?"none":"1px solid rgba(255,255,255,0.1)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"0.95rem",fontWeight:"bold",cursor:"pointer",transition:"all 0.25s",boxShadow:e.primary?`0 4px 15px ${i}40`:"none"},e.style||{})},e.attrs||{})),t.appendChild(e))}),o.appendChild(t)}e={display:"flex",justifyContent:"center",alignItems:"center",padding:n,width:"100%",position:"relative",overflow:"hidden",borderRadius:"16px"};return a?x.div({class:"papyr-hero-glass",style:Object.assign(e,{background:"rgba(10, 15, 30, 0.4)",backdropFilter:"blur(20px)",webkitBackdropFilter:"blur(20px)",border:"1px solid rgba(255,255,255,0.05)",boxShadow:"0 10px 40px -10px rgba(0,0,0,0.5)"})},o):x.div({style:e},o)}},x.toast=x.toast,x.modal=x.modal,x.sheet=(e={})=>{var{content:e=""}=e;let t=x.div({style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0,0,0,0.5)",zIndex:9998,opacity:0,transition:"opacity 0.3s"},onclick:e=>{e.target===t&&o()}}),r=x.div({style:{position:"absolute",bottom:0,left:0,width:"100%",background:"#1e293b",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",padding:"24px",transform:"translateY(100%)",transition:"transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1)"}},x.div({style:{width:"40px",height:"4px",background:"rgba(255,255,255,0.2)",borderRadius:"2px",margin:"0 auto 20px auto"}}),e),o=(t.appendChild(r),document.body.appendChild(t),requestAnimationFrame(()=>{t.style.opacity="1",r.style.transform="translateY(0)"}),()=>{t.style.opacity="0",r.style.transform="translateY(100%)",setTimeout(()=>t.remove(),300)})},x.drawer=(e={})=>{let{content:t="",position:r="left"}=e,o=x.div({style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0,0,0,0.5)",zIndex:9998,opacity:0,transition:"opacity 0.3s"},onclick:e=>{e.target===o&&n()}}),a=x.div({style:{position:"absolute",top:0,[r]:0,width:"300px",height:"100%",background:"#0f172a",borderRight:"1px solid rgba(255,255,255,0.08)",padding:"24px",transform:"left"===r?"translateX(-100%)":"translateX(100%)",transition:"transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1)"}},t),n=(o.appendChild(a),document.body.appendChild(o),requestAnimationFrame(()=>{o.style.opacity="1",a.style.transform="translateX(0)"}),()=>{o.style.opacity="0",a.style.transform="left"===r?"translateX(-100%)":"translateX(100%)",setTimeout(()=>o.remove(),300)});return{close:n}},x.banner=(e={})=>{var{message:e="",type:t="info",actions:r=[]}=e,o="error"===t?"#7f1d1d":"success"===t?"#064e3b":"#1e3a8a";let a=x.div({class:"papyr-banner papyr-banner-"+t,style:{position:"sticky",top:0,left:0,width:"100%",background:o,color:"#f8fafc",padding:"12px 24px",display:"flex",justifyContent:"space-between",alignItems:"center",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1)",zIndex:999}},x.span(e,{style:{fontWeight:"500"}}),x.flex.row({gap:"12px"},...r.map(e=>x.button(e.text,{style:{padding:"6px 12px",fontSize:"13px",borderRadius:"6px",background:"rgba(255,255,255,0.1)",border:"1px solid rgba(255,255,255,0.2)",color:"white"},onclick:()=>{e.action(),a.remove()}})),x.button("×",{style:{background:"transparent",border:"none",color:"white",cursor:"pointer",fontSize:"20px"},onclick:()=>a.remove()})));document.body.prepend(a)},x.snackbar=(e={})=>{let{message:t="",actionText:r="",onAction:o=null,duration:a=4e3}=e,n=x.div({style:{position:"fixed",bottom:"24px",left:"24px",background:"#1e293b",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",padding:"12px 20px",color:"white",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.3)",zIndex:9999,display:"flex",alignItems:"center",gap:"16px",opacity:0,transform:"translateY(20px)",transition:"all 0.3s"}},x.span(t),r?x.button(r,{style:{background:"transparent",border:"none",color:"#6366f1",fontWeight:"bold",cursor:"pointer"},onclick:()=>{o&&o(),n.remove()}}):null);document.body.appendChild(n),requestAnimationFrame(()=>{n.style.opacity="1",n.style.transform="translateY(0)"}),setTimeout(()=>{n.style.opacity="0",n.style.transform="translateY(20px)",setTimeout(()=>n.remove(),300)},a)},x.tooltip=(r,o)=>{if(r){let t=null;r.addEventListener("mouseenter",()=>{var e=r.getBoundingClientRect();t=x.div({style:{position:"fixed",top:e.top-36+"px",left:e.left+e.width/2+"px",transform:"translateX(-50%)",background:"#0f172a",border:"1px solid rgba(255,255,255,0.1)",padding:"6px 12px",color:"white",fontSize:"12px",borderRadius:"6px",boxShadow:"0 4px 6px rgba(0,0,0,0.3)",zIndex:99999,pointerEvents:"none"}},o),document.body.appendChild(t)}),r.addEventListener("mouseleave",()=>{t&&(t.remove(),t=null)})}},x.accordion=e=>{let o=x.div(".accordion",{style:{display:"flex",flexDirection:"column",gap:"8px"}});return e.forEach(e=>{let t=x.state(!1);var r="string"==typeof e.content?x.div(e.content):e.content,r=x.div({style:()=>({display:t.value?"block":"none",padding:"16px",borderTop:"1px solid rgba(255,255,255,0.08)",color:"#94a3b8"})},r),e=x.button({style:{width:"100%",textAlign:"left",background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.08)",padding:"12px 16px",color:"white",display:"flex",justifyContent:"space-between",borderRadius:"8px"},onclick:()=>t.value=!t.value},x.span(e.title,{style:{fontWeight:"600"}}),x.span(()=>t.value?"▲":"▼"));o.appendChild(x.div(".accordion-item",e,r))}),o},x.checkbox=(e,t)=>{var r=x.input("checkbox",{checked:()=>t.value,onchange:e=>t.value=e.target.checked,style:{width:"auto",marginRight:"8px"}});return x.label({style:{display:"inline-flex",alignItems:"center",cursor:"pointer",color:"white"}},r,e)},x.radio=(e,t,r,o)=>{e=x.input("radio",{name:e,checked:()=>o.value===r,onchange:()=>o.value=r,style:{width:"auto",marginRight:"8px"}});return x.label({style:{display:"inline-flex",alignItems:"center",cursor:"pointer",color:"white"}},e,t)},x.navigationRail=e=>{let t=x.div(".navigation-rail",{style:{width:"72px",height:"100%",background:"#0a0f1d",borderRight:"1px solid rgba(255,255,255,0.08)",display:"flex",flexDirection:"column",alignItems:"center",padding:"24px 0",gap:"20px"}});return e.forEach(e=>{e=x.button({style:{background:"transparent",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",padding:"8px"},onclick:e.onclick},x.icon(e.icon,{size:20}),x.span(e.label,{style:{fontSize:"10px",fontWeight:"500"}}));t.appendChild(e)}),t},x.progress=(e,t=100)=>{let r=e&&"function"==typeof e.subscribe?e:x.state(e),o=x.computed(()=>Math.min(100,Math.max(0,r.value/t*100))+"%");return x.div(".progress-track",{style:{width:"100%",height:"8px",background:"rgba(255,255,255,0.05)",borderRadius:"4px",overflow:"hidden",border:"1px solid rgba(255,255,255,0.08)"}},x.div(".progress-fill",{style:()=>({width:o.value,height:"100%",background:"linear-gradient(90deg, #6366f1, #10b981)",transition:"width 0.2s cubic-bezier(0.4, 0, 0.2, 1)"})}))},x.stepper=(e,s)=>{let l=x.div(".stepper",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:"24px"}});return e.forEach((e,t)=>{let r=x.computed(()=>s.value>t+1),o=x.computed(()=>s.value===t+1),a=x.computed(()=>r.value?"#10b981":o.value?"#6366f1":"rgba(255,255,255,0.05)"),n=x.computed(()=>r.value||o.value?"none":"1px solid rgba(255,255,255,0.1)");var i=x.div(".step-circle",{style:()=>({width:"32px",height:"32px",borderRadius:"50%",background:a.value,border:n.value,display:"flex",justifyContent:"center",alignItems:"center",color:"white",fontWeight:"bold",fontSize:"14px"})},()=>r.value?"✓":String(t+1)),e=x.span(e,{style:()=>({marginLeft:"8px",color:o.value?"white":"#94a3b8",fontSize:"13px",fontWeight:"600"})});l.appendChild(x.flex.row({align:"center",style:{flex:1}},i,e))}),l},x.menu=(t,e)=>{if(t){let r=null;t.style.position="relative";t.addEventListener("click",()=>{r?(r.remove(),r=null):(r=x.div(".dropdown-menu",{style:{position:"absolute",top:"100%",left:"0",marginTop:"8px",minWidth:"160px",background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.4)",zIndex:9999,overflow:"hidden"}}),e.forEach(e=>{let t=x.button(e.text,{style:{width:"100%",textAlign:"left",padding:"10px 16px",fontSize:"13px",background:"transparent",border:"none",color:"#cbd5e1",cursor:"pointer"},onclick:()=>{e.onclick(),r.remove(),r=null}});t.addEventListener("mouseenter",()=>t.style.background="rgba(255,255,255,0.04)"),t.addEventListener("mouseleave",()=>t.style.background="transparent"),r.appendChild(t)}),t.appendChild(r))}),document.addEventListener("click",e=>{r&&!t.contains(e.target)&&(r.remove(),r=null)})}},x.dropdown=(e={})=>{let{items:t=[],placeholder:r="Select item",onSelect:o=null}=e,a=x.state(r),n=x.state(!1),i=x.div(".dropdown-container",{style:{position:"relative",width:"100%"}});e=x.button({style:{width:"100%",textAlign:"left",display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.02)",color:"white",padding:"10px 14px"},onclick:()=>n.value=!n.value},x.span(()=>a.value),x.span(()=>n.value?"▲":"▼"));let s=x.div({style:()=>({display:n.value?"block":"none",position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"8px",zIndex:1e3,maxHeight:"200px",overflowY:"auto"})});return t.forEach(e=>{let t=x.div(e,{style:{padding:"10px 14px",cursor:"pointer",color:"#cbd5e1",fontSize:"14px"},onclick:()=>{a.value=e,n.value=!1,o&&o(e)}});t.addEventListener("mouseenter",()=>t.style.background="rgba(255,255,255,0.04)"),t.addEventListener("mouseleave",()=>t.style.background="transparent"),s.appendChild(t)}),i.appendChild(e),i.appendChild(s),document.addEventListener("click",e=>{i.contains(e.target)||(n.value=!1)}),i},x.emptyState=(e={})=>{var{title:e="No results found",description:t="Try adjusting your search criteria or filters.",icon:r="search"}=e;return x.flex.col({align:"center",style:{padding:"48px 24px",textAlign:"center",background:"rgba(255,255,255,0.01)",border:"1px dashed rgba(255,255,255,0.1)",borderRadius:"16px",gap:"12px"}},x.icon(r,{size:36,color:"#94a3b8"}),x.h3(e,{style:{margin:0,color:"white",fontSize:"16px",fontWeight:"700"}}),x.p(t,{style:{margin:0,color:"#94a3b8",fontSize:"13px",maxWidth:"320px",lineHeight:"1.5"}}))},x.skeletonLoader=(e={})=>{var{type:t="card",count:r=1}=e,o=x.div(".skeleton-loader-container",{style:{display:"flex",flexDirection:"column",gap:"12px",width:"100%"}}),a="background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%); background-size: 200% 100%; animation: papyr-skeleton-shine 1.5s infinite;";"undefined"==typeof document||document.getElementById("papyr-skeleton-styles")||((e=document.createElement("style")).id="papyr-skeleton-styles",e.textContent=`
27
+ `,r.innerHTML=`<span style="font-weight: bold; margin-right: 6px;">${t}</span>`+o,i.appendChild(r),r.offsetHeight,r.style.opacity="1",r.style.transform="translateY(0) scale(1)",setTimeout(()=>{r.style.opacity="0",r.style.transform="translateY(-10px) scale(0.95)",setTimeout(()=>{r.remove(),i&&0===i.children.length&&(i.remove(),i=null)},350)},n)}},S.tabs=e=>{let o=S.div(".tab-headers"),a=S.div(".tab-contents"),n=S.div(".tabs",o,a);return e.forEach((t,r)=>{var e=S.button(t.title,{class:0===r?"tab-header tab-active":"tab-header",on:{click:()=>{n.querySelectorAll(".tab-header").forEach((e,t)=>{e.classList.toggle("tab-active",t===r)}),a.innerHTML="";var e="string"==typeof t.content?S.div(t.content):t.content;a.appendChild(e)}}});o.appendChild(e),0===r&&(e="string"==typeof t.content?S.div(t.content):t.content,a.appendChild(e))}),n},S.table=(...o)=>{if(0<o.length&&Array.isArray(o[0])&&"string"==typeof o[0][0]){let[e,t]=o;var n=S("table",".data-table"),i=S.thead();let r=S.tr(),a=(e.forEach(e=>{e=e.charAt(0).toUpperCase()+e.slice(1);r.appendChild(S.th(e))}),i.appendChild(r),n.appendChild(i),S.tbody());return t.forEach(r=>{let o=S.tr();e.forEach(e=>{var e=void 0!==r[e]?r[e]:"",t=S.td();e instanceof Element?t.appendChild(e):t.textContent=e,o.appendChild(t)}),a.appendChild(o)}),n.appendChild(a),n}return S("table",...o)},S.fetch=async(t,r={})=>{var e=S.div(".loading",S.div(".spinner"),S.span("Fetching data..."));let o=S.div(e);return setTimeout(async()=>{try{var e=await(await fetch(t,r)).json();o.innerHTML="",r.onSuccess?r.onSuccess(o,e):o.appendChild(S.pre(JSON.stringify(e,null,2)))}catch(e){o.innerHTML="",o.appendChild(S.div(".error","⚠️ Error: "+e.message))}},400),o},S.input=(e,t,r={})=>"object"==typeof e&&null!==e?S("input",e):("object"==typeof t&&null!==t&&(t=(r=t).placeholder||""),r=Object.assign({},r),e&&(r.type=r.type||e),t&&(r.placeholder=r.placeholder||t),e?S("input",".input-"+e,r):S("input",r)),S.simpleTable=e=>{var o=S("table",".papyr-table");if(e.headers){var r=S("thead");let t=S("tr");e.headers.forEach(e=>{t.appendChild(S("th",e))}),r.appendChild(t),o.appendChild(r)}if(e.rows){let r=S("tbody");e.rows.forEach(e=>{let t=S("tr");e.forEach(e=>{t.appendChild(S("td",String(e)))}),r.appendChild(t)}),o.appendChild(r)}return o},S.chart=(a,n,c={})=>{let i=S("canvas",{width:c.width||300,height:c.height||180,style:{display:"block",margin:"0 auto",maxWidth:"100%",borderRadius:"8px",background:"transparent"}});return requestAnimationFrame(()=>{let d=i.getContext("2d");if(d){var e,t=i.width;let p=i.height;if(d.clearRect(0,0,t,p),"bar"===a){var r=n.values||[];let i=n.labels||[],s=Math.max(...r,1);var o=r.length;let l=(t-16*(o+1))/o;r.forEach((e,t)=>{var r=e/s*(p-50),o=16+t*(16+l),a=p-30-r,n=(d.fillStyle="rgba(255,255,255,0.02)",d.beginPath(),d.roundRect?d.roundRect(o,10,l,p-40,6):d.rect(o,10,l,p-40),d.fill(),d.createLinearGradient(0,a,0,p-30));n.addColorStop(0,c.color||"#6366f1"),n.addColorStop(1,c.colorAlt||"#312e81"),d.fillStyle=n,d.beginPath(),d.roundRect?d.roundRect(o,a,l,r,[6,6,0,0]):d.rect(o,a,l,r),d.fill(),d.fillStyle="#f8fafc",d.font="bold 11px sans-serif",d.textAlign="center",d.fillText(e,o+l/2,a-8),d.fillStyle="#94a3b8",d.font="10px sans-serif",d.fillText(i[t]||"",o+l/2,p-10)})}else"ring"===a&&(o=n.value||0,r=t/2,e=p/2,t=Math.min(t,p)/2.6,d.beginPath(),d.arc(r,e,t,0,2*Math.PI),d.lineWidth=c.lineWidth||14,d.strokeStyle="rgba(255,255,255,0.06)",d.stroke(),d.beginPath(),d.arc(r,e,t,-Math.PI/2,-Math.PI/2+2*Math.PI*(o/100)),d.lineWidth=c.lineWidth||14,d.strokeStyle=c.color||"#10b981",d.lineCap="round",d.stroke(),d.fillStyle="#f8fafc",d.font="bold 24px sans-serif",d.textAlign="center",d.textBaseline="middle",d.fillText(o+"%",r,e-6),d.fillStyle="#94a3b8",d.font="10px sans-serif",d.fillText(n.label||"",r,16+e))}}),i},Object.assign(S.components,{navbar:(e,t)=>{var r=S.nav(".navbar");let o=S.div(".nav-links");t.forEach(e=>{o.appendChild(S.a(e.text,{href:e.href,class:"nav-link",onclick:e.onclick||null}))});t="string"==typeof e?S.div(e,".logo"):e;return r.appendChild(t),r.appendChild(o),r},hero:(e,t,r,o)=>S.section(".hero",S.h1(e,".hero-title"),S.p(t,".hero-subtitle"),S.button(r,{class:"hero-btn",on:{click:o}})),sidebar:e=>{let o=S.aside(".sidebar");return e.forEach(e=>{let t="string"==typeof e?e:e.text||"",r;r="object"==typeof e&&e.icon?S.div(".sidebar-item",S.icon(e.icon,{size:16,style:{marginRight:"8px"}}),S.span(t)):S.div(".sidebar-item",S.span(t)),e.active&&r.classList.add("active"),r.addEventListener("click",()=>{o.querySelectorAll(".sidebar-item").forEach(e=>e.classList.remove("active")),r.classList.add("active"),e.onclick?e.onclick(t):S.toast("Navigated to: "+t,"info")}),o.appendChild(r)}),o},footer:(e,t=[])=>{var r=S.footer(".footer");let o=S.div(".footer-links");return t.forEach(e=>{o.appendChild(S.a(e.text,{href:e.href}))}),r.appendChild(o),r.appendChild(S.p(e,".footer-text")),r},carousel:e=>{let o=0,t=S.img("",{src:e[0],class:"carousel-img"});var r=S.button("◀",{class:"carousel-btn prev-btn"}),a=S.button("▶",{class:"carousel-btn next-btn"});let n=S.div(".carousel-dots"),i=(e.forEach((e,t)=>{var r=S.span(".carousel-dot");0===t&&r.classList.add("active"),r.onclick=()=>{return e=t,o=e,void s();var e},n.appendChild(r)}),S.div(".carousel",r,t,a,n));function s(){t.style.opacity=0,setTimeout(()=>{t.src=e[o],t.style.opacity=1},150),i.querySelectorAll(".carousel-dot").forEach((e,t)=>{e.classList.toggle("active",t===o)})}return r.onclick=()=>{o=(o-1+e.length)%e.length,s()},a.onclick=()=>{o=(o+1)%e.length,s()},i}})}{S.center=(...e)=>S.div({style:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"}},...e),S.left=(...e)=>S.div({style:{display:"flex",justifyContent:"flex-start",alignItems:"center",width:"100%"}},...e),S.right=(...e)=>S.div({style:{display:"flex",justifyContent:"flex-end",alignItems:"center",width:"100%"}},...e),S.justify=(...e)=>S.div({style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%"}},...e),S.glass=(...e)=>S.div({style:{background:"rgba(255, 255, 255, 0.05)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:"1px solid rgba(255, 255, 255, 0.1)",boxShadow:"0 8px 32px 0 rgba(0, 0, 0, 0.3)",borderRadius:"16px"}},...e),S.template=e=>"glass-dashboard"===e?S.div({style:{display:"flex",minHeight:"100vh",background:"#0f172a",padding:"20px",gap:"20px"}},S.glass({style:{width:"250px",padding:"20px"}},S.h3("Sidebar")),S.div({style:{flexGrow:1,display:"flex",flexDirection:"column",gap:"20px"}},S.glass({style:{padding:"20px"}},S.h2("Dashboard Overview")),S.div({style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:"20px"}},S.glass({style:{padding:"40px",textAlign:"center"}},"Metric 1"),S.glass({style:{padding:"40px",textAlign:"center"}},"Metric 2")))):S.div(`Template ${e} not found.`);let l=e=>{if(!e)return null;var t,r,o,a,n,i={};e.absoluteBoundingBox&&(i.position="absolute",i.left=e.absoluteBoundingBox.x+"px",i.top=e.absoluteBoundingBox.y+"px",i.width=e.absoluteBoundingBox.width+"px",i.height=e.absoluteBoundingBox.height+"px"),e.fills&&0<e.fills.length&&"SOLID"===(o=e.fills[0]).type&&o.color&&(n=Math.round(255*o.color.r),t=Math.round(255*o.color.g),r=Math.round(255*o.color.b),o=void 0!==o.opacity?o.opacity:void 0!==o.color.a?o.color.a:1,i.background=`rgba(${n}, ${t}, ${r}, ${o})`),e.strokes&&0<e.strokes.length&&(n=e.strokes[0],t=e.strokeWeight||1,"SOLID"===n.type)&&n.color&&(r=Math.round(255*n.color.r),o=Math.round(255*n.color.g),a=Math.round(255*n.color.b),n=void 0!==n.opacity?n.opacity:void 0!==n.color.a?n.color.a:1,i.border=t+`px solid rgba(${r}, ${o}, ${a}, ${n})`),e.cornerRadius&&(i.borderRadius=e.cornerRadius+"px"),"HORIZONTAL"!==e.layoutMode&&"VERTICAL"!==e.layoutMode||(i.display="flex",i.flexDirection="HORIZONTAL"===e.layoutMode?"row":"column",e.itemSpacing&&(i.gap=e.itemSpacing+"px"),e.paddingTop&&(i.paddingTop=e.paddingTop+"px"),e.paddingBottom&&(i.paddingBottom=e.paddingBottom+"px"),e.paddingLeft&&(i.paddingLeft=e.paddingLeft+"px"),e.paddingRight&&(i.paddingRight=e.paddingRight+"px"));let s=[];return e.children&&Array.isArray(e.children)&&(s=e.children.map(l).filter(Boolean)),"TEXT"===e.type?(e.style&&(e.style.fontSize&&(i.fontSize=e.style.fontSize+"px"),e.style.fontWeight&&(i.fontWeight=String(e.style.fontWeight)),e.style.fontFamily&&(i.fontFamily=e.style.fontFamily),e.style.textAlignHorizontal)&&(i.textAlign=e.style.textAlignHorizontal.toLowerCase()),S.span(e.characters||"",{style:i})):S.div({style:i},...s)};S.import={figma:e=>{if(!e)return null;let t=e.document||e;return(t=t.children&&0<t.children.length&&"DOCUMENT"===t.type?t.children[0]:t).children&&0<t.children.length&&"CANVAS"===t.type&&(t=t.children[0]),l(t)}}}{S.glass=(...e)=>S.div({class:"papyr-glass-panel",style:{background:"rgba(255, 255, 255, 0.04)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",border:"1px solid rgba(255, 255, 255, 0.08)",boxShadow:"0 8px 32px 0 rgba(0, 0, 0, 0.35)",borderRadius:"16px",padding:"20px",color:"#f8fafc"}},...e),S.autoFlex=(n,e={})=>{if(n&&"undefined"!=typeof window){let t=e.breakpoint||768,r=e.rowClass||"flex-row",o=e.colClass||"flex-col",a=e=>{e<t?(n.classList.remove(r),n.classList.add(o),n.style.flexDirection="column"):(n.classList.remove(o),n.classList.add(r),n.style.flexDirection="row")};if("undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{for(var t of e)a(t.contentRect.width||t.target.clientWidth)});e.observe(n),n._cleanups||(n._cleanups=[]),n._cleanups.push(()=>e.disconnect())}else{let e=()=>a(window.innerWidth);window.addEventListener("resize",e),e(),n._cleanups||(n._cleanups=[]),n._cleanups.push(()=>window.removeEventListener("resize",e))}}return n},S.layout={flex(e={},...t){e=Object.assign({direction:"var(--papyr-flex-dir, row)",wrap:"var(--papyr-flex-wrap, wrap)",justify:"var(--papyr-flex-justify, flex-start)",align:"var(--papyr-flex-align, stretch)",gap:"var(--papyr-flex-gap, 16px)"},e);return S.div({class:"papyr-layout-flex",style:{display:"flex",flexDirection:e.direction,flexWrap:e.wrap,justifyContent:e.justify,alignItems:e.align,gap:e.gap,width:"100%"}},...t)},grid(e={},...t){e=Object.assign({cols:"var(--papyr-grid-cols, repeat(auto-fit, minmax(250px, 1fr)))",rows:"var(--papyr-grid-rows, auto)",gap:"var(--papyr-grid-gap, 20px)"},e);return S.div({class:"papyr-layout-grid",style:{display:"grid",gridTemplateColumns:e.cols,gridTemplateRows:e.rows,gap:e.gap,width:"100%"}},...t)},row(...e){return this.flex({direction:"row"},...e)},col(...e){return this.flex({direction:"column"},...e)},foldable(e={},...t){let r=Object.assign({gap:"24px"},e),o=S.state(!1);return"undefined"!=typeof window&&(window.addEventListener("resize",e=()=>{var e=window.matchMedia("(spanning: single-fold-vertical)").matches||window.matchMedia("(spanning: single-fold-horizontal)").matches||768<=window.innerWidth&&window.innerWidth<1200&&1.3<window.innerWidth/window.innerHeight;o.value=e}),e()),S.div({class:"papyr-foldable-layout",style:()=>({display:"grid",gridTemplateColumns:o.value?"1fr 1fr":"1fr",gap:r.gap,width:"100%"})},...t)},mobile(e={},...t){var{header:e=null,nav:r=null}=e;return S.div({class:"papyr-layout-mobile",style:{display:"flex",flexDirection:"column",minHeight:"100vh",width:"100%",background:"#070913"}},e?S("header",{style:{padding:"16px",borderBottom:"1px solid rgba(255,255,255,0.08)",background:"rgba(16,22,42,0.8)"}},e):null,S("main",{style:{flexGrow:1,padding:"16px",overflowY:"auto"}},...t),r?S("nav",{style:{padding:"12px",borderTop:"1px solid rgba(255,255,255,0.08)",background:"rgba(16,22,42,0.9)",display:"flex",justifyContent:"space-around"}},r):null)},tablet(e={},...t){var{sidebar:e=null}=e;return S.div({class:"papyr-layout-tablet",style:{display:"flex",minHeight:"100vh",width:"100%",background:"#070913"}},e?S("aside",{style:{width:"80px",borderRight:"1px solid rgba(255,255,255,0.08)",background:"rgba(11,16,36,0.95)",display:"flex",flexDirection:"column",alignItems:"center",padding:"20px 0",gap:"20px"}},e):null,S("main",{style:{flexGrow:1,padding:"24px",overflowY:"auto"}},...t))},desktop(e={},...t){var{sidebar:e=null,inspector:r=null,sidebarWidth:o="250px",inspectorWidth:a="300px"}=e;return S.div({class:"papyr-layout-desktop",style:{display:"flex",minHeight:"100vh",width:"100%",background:"#070913"}},e?S("aside",{style:{width:o,borderRight:"1px solid rgba(255,255,255,0.08)",background:"rgba(11,16,36,0.95)",overflowY:"auto"}},e):null,S("main",{style:{flexGrow:1,padding:"24px",overflowY:"auto"}},...t),r?S("aside",{style:{width:a,borderLeft:"1px solid rgba(255,255,255,0.08)",background:"rgba(11,16,36,0.95)",overflowY:"auto"}},r):null)},dashboard(e={}){let{sidebar:t=null,header:r=null,main:o=null,footer:a=null,sidebarWidth:n="250px",headerHeight:i="64px"}=e,s=S.state(!0);var l,e=S.div({class:"papyr-app-shell",style:{display:"grid",gridTemplateColumns:t?n+" 1fr":"1fr",gridTemplateRows:r?i+" 1fr auto":"1fr auto",minHeight:"100vh",width:"100%",background:"#070913"}});return"undefined"!=typeof window&&(window.addEventListener("resize",l=()=>{window.innerWidth<768?s.value=!1:s.value=!0}),setTimeout(l,10)),r&&(l=S.button(".menu-toggle",{style:{background:"transparent",border:"none",color:"white",fontSize:"1.5rem",cursor:"pointer",padding:"10px",display:t?"inline-block":"none"},onclick:()=>{s.value=!s.value}},"☰"),e.appendChild(S("header",{class:"papyr-shell-header",style:{gridColumn:"1 / -1",background:"rgba(16, 22, 42, 0.8)",backdropFilter:"blur(12px)",borderBottom:"1px solid rgba(255,255,255,0.08)",display:"flex",alignItems:"center",padding:"0 20px",gap:"15px",zIndex:10}},l,r))),t&&(l=S("aside",{class:"papyr-shell-sidebar",style:()=>({gridRow:r?"2 / -1":"1 / -1",background:"rgba(11, 16, 36, 0.95)",borderRight:"1px solid rgba(255,255,255,0.08)",overflowY:"auto",width:s.value?n:"0px",minWidth:s.value?n:"0px",opacity:s.value?1:0,pointerEvents:s.value?"auto":"none",transition:"width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s"})},t),e.appendChild(l)),e.appendChild(S("main",{class:"papyr-main-content",style:{padding:"24px",overflowY:"auto",position:"relative",zIndex:1}},o||S.div("Main Content Area"))),a&&e.appendChild(S("footer",{class:"papyr-shell-footer",style:{gridColumn:t?"2 / -1":"1",background:"rgba(16, 22, 42, 0.8)",borderTop:"1px solid rgba(255,255,255,0.08)",padding:"12px 20px"}},a)),e},hero(e={}){var{title:e="Cinematic Experience",subtitle:t="Crafted beautifully with high performance reactivity",actions:r=[],theme:o="primary",glass:a=!0,padding:n="80px 40px"}=e;let i="teal"===o?"#14b8a6":"#6366f1",s="teal"===o?"#0d9488":"#4f46e5";o=S.flex.col({align:"center",style:{textAlign:"center",maxWidth:"800px",gap:"20px",zIndex:2,position:"relative"}},S.h1(e,{style:{fontSize:"var(--papyr-hero-title-size, 3.5rem)",fontWeight:"800",color:"white",margin:0,lineHeight:"1.1",letterSpacing:"-0.025em",background:`linear-gradient(135deg, #ffffff 30%, ${i} 100%)`,webkitBackgroundClip:"text",webkitTextFillColor:"transparent",textFillColor:"transparent"}}),S.p(t,{style:{fontSize:"1.25rem",color:"#94a3b8",margin:0,lineHeight:"1.6",maxWidth:"600px"}}));if(r&&0<r.length){let t=S.flex.row({justify:"center",gap:"12px",style:{marginTop:"10px"}});r.forEach(e=>{e instanceof Element?t.appendChild(e):"object"==typeof e&&(e=S.button(e.text||"Action",Object.assign({style:Object.assign({background:e.primary?`linear-gradient(135deg, ${i} 0%, ${s} 100%)`:"rgba(255,255,255,0.06)",border:e.primary?"none":"1px solid rgba(255,255,255,0.1)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"0.95rem",fontWeight:"bold",cursor:"pointer",transition:"all 0.25s",boxShadow:e.primary?`0 4px 15px ${i}40`:"none"},e.style||{})},e.attrs||{})),t.appendChild(e))}),o.appendChild(t)}e={display:"flex",justifyContent:"center",alignItems:"center",padding:n,width:"100%",position:"relative",overflow:"hidden",borderRadius:"16px"};return a?S.div({class:"papyr-hero-glass",style:Object.assign(e,{background:"rgba(10, 15, 30, 0.4)",backdropFilter:"blur(20px)",webkitBackdropFilter:"blur(20px)",border:"1px solid rgba(255,255,255,0.05)",boxShadow:"0 10px 40px -10px rgba(0,0,0,0.5)"})},o):S.div({style:e},o)},gpu(e={},a=[]){var t=e.width||800,r=e.height||600,o=document.createElement("div");o.className="papyr-gpu-layout-container",o.style.position="relative",o.style.width="number"==typeof t?t+"px":t,o.style.height="number"==typeof r?r+"px":r,o.style.overflow="hidden",o.style.borderRadius=e.borderRadius||"12px";let i=document.createElement("canvas"),s=(i.width="number"==typeof t?t:800,i.height="number"==typeof r?r:600,i.style.position="absolute",i.style.left="0",i.style.top="0",i.style.width="100%",i.style.height="100%",o.appendChild(i),document.createElement("canvas")),l=(s.width=i.width,s.height=i.height,s.style.position="absolute",s.style.left="0",s.style.top="0",s.style.width="100%",s.style.height="100%",s.style.pointerEvents="none",o.appendChild(s),i.getContext("webgl2",{alpha:!0,antialias:!0})),p=s.getContext("2d");let d,c,u;function n(e=[]){let t=function p(e,t,r,o,a){t={x:t+(e.x||0),y:r+(e.y||0),width:e.width||o,height:e.height||a,color:e.color||[.1,.1,.1,1],borderColor:e.borderColor||[0,0,0,0],borderWidth:e.borderWidth||0,borderRadius:e.borderRadius||0,text:e.text||null,textColor:e.textColor||[1,1,1,1],fontSize:e.fontSize||14,fontFamily:e.fontFamily||"sans-serif"};let d=e.children||[],c=[];if(0<d.length){let o=e.direction||"column",a=(r=e.padding||0,e.gap||0),n=t.x+r,i=t.y+r,s=t.width-2*r,l=t.height-2*r;d.forEach(e=>{var t=e.width||("row"===o?(s-a*(d.length-1))/d.length:s),r=e.height||("column"===o?(l-a*(d.length-1))/d.length:l),e=p(e,n,i,t,r);c.push(e),"row"===o?n+=t+a:i+=r+a})}return t.solvedChildren=c,t}({children:e},0,0,i.width,i.height);var r=function t(e,r=[]){return r.push(e),(e.solvedChildren||[]).forEach(e=>t(e,r)),r}(t).filter(e=>e!==t);if(l){l.viewport(0,0,i.width,i.height),l.clearColor(0,0,0,0),l.clear(l.COLOR_BUFFER_BIT),l.enable(l.BLEND),l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);var o=new Float32Array(16*r.length);for(let e=0;e<r.length;e++){var a=r[e],n=16*e;o[0+n]=a.x,o[1+n]=a.y,o[2+n]=a.width,o[3+n]=a.height,o[4+n]=a.color[0],o[5+n]=a.color[1],o[6+n]=a.color[2],o[7+n]=a.color[3],o[8+n]=a.borderColor[0],o[9+n]=a.borderColor[1],o[10+n]=a.borderColor[2],o[11+n]=a.borderColor[3],o[12+n]=a.borderRadius,o[13+n]=a.borderWidth,o[14+n]=0,o[15+n]=0}l.bindBuffer(l.ARRAY_BUFFER,u),l.bufferData(l.ARRAY_BUFFER,o,l.DYNAMIC_DRAW),l.useProgram(d),l.bindVertexArray(c),l.drawArraysInstanced(l.TRIANGLES,0,6,r.length)}else p.clearRect(0,0,s.width,s.height),r.forEach(e=>{p.fillStyle=`rgba(${255*e.color[0]}, ${255*e.color[1]}, ${255*e.color[2]}, ${e.color[3]})`,p.fillRect(e.x,e.y,e.width,e.height)});p.clearRect(0,0,s.width,s.height),r.forEach(e=>{e.text&&(p.fillStyle=`rgba(${255*e.textColor[0]}, ${255*e.textColor[1]}, ${255*e.textColor[2]}, ${e.textColor[3]})`,p.font=e.fontSize+"px "+e.fontFamily,p.textBaseline="middle",p.textAlign="center",p.fillText(e.text,e.x+e.width/2,e.y+e.height/2))})}if(l&&(t=l.createShader(l.VERTEX_SHADER),l.shaderSource(t,`#version 300 es
28
+ in vec2 position;
29
+ in vec4 a_rect;
30
+ in vec4 a_color;
31
+ in vec4 a_borderColor;
32
+ in vec4 a_border_radius_width;
33
+ out vec2 v_localCoords;
34
+ out vec2 v_size;
35
+ out vec4 v_color;
36
+ out vec4 v_borderColor;
37
+ out float v_borderWidth;
38
+ out float v_radius;
39
+ uniform vec2 u_resolution;
40
+
41
+ void main() {
42
+ vec2 rectPos = a_rect.xy;
43
+ vec2 rectSize = a_rect.zw;
44
+ vec2 p = position * rectSize + rectPos;
45
+ vec2 clipSpace = (p / u_resolution) * 2.0 - 1.0;
46
+ gl_Position = vec4(clipSpace.x, -clipSpace.y, 0.0, 1.0);
47
+
48
+ v_localCoords = (position - 0.5) * rectSize;
49
+ v_size = rectSize;
50
+ v_color = a_color;
51
+ v_borderColor = a_borderColor;
52
+ v_radius = a_border_radius_width.x;
53
+ v_borderWidth = a_border_radius_width.y;
54
+ }`),l.compileShader(t),l.getShaderParameter(t,l.COMPILE_STATUS)||console.error("VS compile error:",l.getShaderInfoLog(t)),r=l.createShader(l.FRAGMENT_SHADER),l.shaderSource(r,`#version 300 es
55
+ precision highp float;
56
+ in vec2 v_localCoords;
57
+ in vec2 v_size;
58
+ in vec4 v_color;
59
+ in vec4 v_borderColor;
60
+ in float v_borderWidth;
61
+ in float v_radius;
62
+ out vec4 outColor;
63
+
64
+ float sdRoundedBox(vec2 p, vec2 b, float r) {
65
+ vec2 q = abs(p) - b + vec2(r);
66
+ return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;
67
+ }
68
+
69
+ void main() {
70
+ vec2 halfSize = v_size * 0.5;
71
+ float d = sdRoundedBox(v_localCoords, halfSize, v_radius);
72
+ float fillAlpha = 1.0 - smoothstep(-1.0, 1.0, d);
73
+
74
+ vec4 col = v_color;
75
+ if (v_borderWidth > 0.0) {
76
+ float borderDist = d + v_borderWidth;
77
+ float borderAlpha = smoothstep(-1.0, 1.0, d) - smoothstep(-1.0, 1.0, borderDist);
78
+ col = mix(v_color, v_borderColor, borderAlpha);
79
+ }
80
+ outColor = col;
81
+ outColor.a *= fillAlpha;
82
+ if (outColor.a == 0.0) discard;
83
+ }`),l.compileShader(r),l.getShaderParameter(r,l.COMPILE_STATUS)||console.error("FS compile error:",l.getShaderInfoLog(r)),d=l.createProgram(),l.attachShader(d,t),l.attachShader(d,r),l.linkProgram(d),l.getProgramParameter(d,l.LINK_STATUS)||console.error("Program link error:",l.getProgramInfoLog(d)),l.useProgram(d),t=l.getUniformLocation(d,"u_resolution"),l.uniform2f(t,i.width,i.height),c=l.createVertexArray(),l.bindVertexArray(c),r=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,r),t=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),l.bufferData(l.ARRAY_BUFFER,t,l.STATIC_DRAW),r=l.getAttribLocation(d,"position"),l.enableVertexAttribArray(r),l.vertexAttribPointer(r,2,l.FLOAT,!1,0,0),u=l.createBuffer(),l.bindBuffer(l.ARRAY_BUFFER,u),t=l.getAttribLocation(d,"a_rect"),l.enableVertexAttribArray(t),l.vertexAttribPointer(t,4,l.FLOAT,!1,64,0),l.vertexAttribDivisor(t,1),r=l.getAttribLocation(d,"a_color"),l.enableVertexAttribArray(r),l.vertexAttribPointer(r,4,l.FLOAT,!1,64,16),l.vertexAttribDivisor(r,1),t=l.getAttribLocation(d,"a_borderColor"),l.enableVertexAttribArray(t),l.vertexAttribPointer(t,4,l.FLOAT,!1,64,32),l.vertexAttribDivisor(t,1),r=l.getAttribLocation(d,"a_border_radius_width"),l.enableVertexAttribArray(r),l.vertexAttribPointer(r,4,l.FLOAT,!1,64,48),l.vertexAttribDivisor(r,1)),a&&"function"==typeof a.subscribe?(t=a.subscribe(e=>{n(e)}),o._cleanups||(o._cleanups=[]),o._cleanups.push(t)):n(a),e.responsive){let e=new ResizeObserver(e=>{for(var t of e){var r,o=t.contentRect.width,t=t.contentRect.height;i.width=o,i.height=t,s.width=o,s.height=t,l&&(l.viewport(0,0,o,t),l.useProgram(d),r=l.getUniformLocation(d,"u_resolution"),l.uniform2f(r,o,t)),n(a.value||a)}});e.observe(o),o._cleanups||(o._cleanups=[]),o._cleanups.push(()=>e.disconnect())}return o}};let t="desktop";if("undefined"!=typeof window){let e=e=>e<768?"mobile":e<1024?"tablet":e<1440?"laptop":"desktop";t=S.state(e(window.innerWidth)),window.addEventListener("resize",()=>{t.value=e(window.innerWidth)})}else t={value:"desktop",subscribe:()=>{}};S.layout.deviceClass=t}function E(t,r,o){var a=2*Math.PI/r,n=[];for(let e=0;e<r;e++){var i=e*a,s=t+o[e],l=t+s*Math.cos(i),s=t+s*Math.sin(i);n.push({x:l,y:s})}let p=`M ${n[0].x} `+n[0].y;for(let e=0;e<r;e++){var d=n[e],c=n[(e+1)%r],u=(d.x+c.x)/2;p+=` Q ${d.x} ${d.y}, ${u} `+(d.y+c.y)/2}return p+=" Z"}r="undefined"!=typeof window?window:this,x={name:"papyr-shapes",version:"1.0.0",install(y){y.blob=(e={})=>{let{size:o=200,color:t="var(--papyr-primary)",points:a=6,amplitude:n=20,speed:i=2e3,animate:r=!1}=e;e=Array.from({length:a},()=>(Math.random()-.5)*n*2),e=E(o/2,a,e);let s=y.html(`
84
+ <svg viewBox="0 0 ${o} ${o}" width="${o}" height="${o}" style="overflow: visible;">
85
+ <path d="${e}" fill="${t}" style="transition: d ${i}ms cubic-bezier(0.4, 0, 0.2, 1);" />
86
+ </svg>
87
+ `).firstElementChild;if("morph"===r||!0===r){let r=setInterval(()=>{var e,t;"undefined"==typeof document||document.body.contains(s)?(e=s.querySelector("path"))&&(t=Array.from({length:a},()=>(Math.random()-.5)*n*2),e.setAttribute("d",E(o/2,a,t))):clearInterval(r)},i);s._cleanups||(s._cleanups=[]),s._cleanups.push(()=>clearInterval(r))}return s},y.wave=(e={})=>{let{width:o=800,height:a=100,color:t="var(--papyr-primary)",amplitude:n=20,frequency:i=.02,speed:r=.05,animate:s=!1}=e,l=y.html(`
88
+ <svg viewBox="0 0 ${o} ${a}" width="${o}" height="${a}" preserveAspectRatio="none" style="display: block;">
89
+ <path fill="${t}" />
90
+ </svg>
91
+ `).firstElementChild,p=l.querySelector("path"),d=0,c=()=>{var t=[];for(let e=0;e<=o;e+=10){var r=a/2+Math.sin(e*i+d)*n;t.push(e+","+r)}var e=`M 0,${a} L 0,${a/2} `+t.map(e=>"L "+e).join(" ")+` L ${o},${a} Z`;p.setAttribute("d",e)};if(c(),s){let e=null,t=()=>{"undefined"==typeof document||document.body.contains(l)?(d+=r,c(),e=requestAnimationFrame(t)):e&&cancelAnimationFrame(e)};e=requestAnimationFrame(t),l._cleanups||(l._cleanups=[]),l._cleanups.push(()=>{e&&cancelAnimationFrame(e)})}return l},y.organic=(e={})=>{var{width:e=200,height:t=200,color:r="var(--papyr-surface)",border:o="1px solid var(--papyr-border)",animate:a=!1,speed:n=3e3}=e;let i=()=>{var e=()=>Math.floor(40*Math.random())+30;return`${e()}% ${100-e()}% ${e()}% ${100-e()}% / ${e()}% ${e()}% ${100-e()}% ${100-e()}%`},s=y.div({style:{width:"number"==typeof e?e+"px":e,height:"number"==typeof t?t+"px":t,backgroundColor:r,border:o,borderRadius:i(),transition:`border-radius ${n}ms cubic-bezier(0.4, 0, 0.2, 1)`}});if("morph"===a||!0===a){let e=setInterval(()=>{"undefined"==typeof document||document.body.contains(s)?s.style.borderRadius=i():clearInterval(e)},n);s._cleanups||(s._cleanups=[]),s._cleanups.push(()=>clearInterval(e))}return s},y.polygon=(a=5,e={})=>{let{size:t=150,color:r="var(--papyr-primary)",animate:o=!1,speed:n=.02}=e,i=y.html(`
92
+ <svg viewBox="0 0 ${t} ${t}" width="${t}" height="${t}">
93
+ <polygon fill="${r}" />
94
+ </svg>
95
+ `).firstElementChild,s=i.querySelector("polygon"),l=t/2,p=t/2,d=t/2,c=0,u=()=>{var t=[];for(let e=0;e<a;e++){var r=2*e*Math.PI/a+c,o=p+l*Math.cos(r),r=d+l*Math.sin(r);t.push(o+","+r)}s.setAttribute("points",t.join(" "))};if(u(),o){let e=null,t=()=>{"undefined"==typeof document||document.body.contains(i)?(c+=n,u(),e=requestAnimationFrame(t)):e&&cancelAnimationFrame(e)};e=requestAnimationFrame(t),i._cleanups||(i._cleanups=[]),i._cleanups.push(()=>{e&&cancelAnimationFrame(e)})}return i}}},(k=r.papyr||"undefined"!=typeof global&&global.papyr)&&k.use(x),"undefined"!=typeof module&&module.exports?module.exports=x:"undefined"!=typeof exports?exports.default=x:r.papyrShapes=x,S.toast=S.toast,S.modal=S.modal,S.sheet=(e={})=>{var{content:e=""}=e;let t=S.div({style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0,0,0,0.5)",zIndex:9998,opacity:0,transition:"opacity 0.3s"},onclick:e=>{e.target===t&&o()}}),r=S.div({style:{position:"absolute",bottom:0,left:0,width:"100%",background:"#1e293b",borderTopLeftRadius:"24px",borderTopRightRadius:"24px",padding:"24px",transform:"translateY(100%)",transition:"transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1)"}},S.div({style:{width:"40px",height:"4px",background:"rgba(255,255,255,0.2)",borderRadius:"2px",margin:"0 auto 20px auto"}}),e),o=(t.appendChild(r),document.body.appendChild(t),requestAnimationFrame(()=>{t.style.opacity="1",r.style.transform="translateY(0)"}),()=>{t.style.opacity="0",r.style.transform="translateY(100%)",setTimeout(()=>t.remove(),300)})},S.drawer=(e={})=>{let{content:t="",position:r="left"}=e,o=S.div({style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0,0,0,0.5)",zIndex:9998,opacity:0,transition:"opacity 0.3s"},onclick:e=>{e.target===o&&n()}}),a=S.div({style:{position:"absolute",top:0,[r]:0,width:"300px",height:"100%",background:"#0f172a",borderRight:"1px solid rgba(255,255,255,0.08)",padding:"24px",transform:"left"===r?"translateX(-100%)":"translateX(100%)",transition:"transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1)"}},t),n=(o.appendChild(a),document.body.appendChild(o),requestAnimationFrame(()=>{o.style.opacity="1",a.style.transform="translateX(0)"}),()=>{o.style.opacity="0",a.style.transform="left"===r?"translateX(-100%)":"translateX(100%)",setTimeout(()=>o.remove(),300)});return{close:n}},S.banner=(e={})=>{var{message:e="",type:t="info",actions:r=[]}=e,o="error"===t?"#7f1d1d":"success"===t?"#064e3b":"#1e3a8a";let a=S.div({class:"papyr-banner papyr-banner-"+t,style:{position:"sticky",top:0,left:0,width:"100%",background:o,color:"#f8fafc",padding:"12px 24px",display:"flex",justifyContent:"space-between",alignItems:"center",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1)",zIndex:999}},S.span(e,{style:{fontWeight:"500"}}),S.flex.row({gap:"12px"},...r.map(e=>S.button(e.text,{style:{padding:"6px 12px",fontSize:"13px",borderRadius:"6px",background:"rgba(255,255,255,0.1)",border:"1px solid rgba(255,255,255,0.2)",color:"white"},onclick:()=>{e.action(),a.remove()}})),S.button("×",{style:{background:"transparent",border:"none",color:"white",cursor:"pointer",fontSize:"20px"},onclick:()=>a.remove()})));document.body.prepend(a)},S.snackbar=(e={})=>{let{message:t="",actionText:r="",onAction:o=null,duration:a=4e3}=e,n=S.div({style:{position:"fixed",bottom:"24px",left:"24px",background:"#1e293b",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",padding:"12px 20px",color:"white",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.3)",zIndex:9999,display:"flex",alignItems:"center",gap:"16px",opacity:0,transform:"translateY(20px)",transition:"all 0.3s"}},S.span(t),r?S.button(r,{style:{background:"transparent",border:"none",color:"#6366f1",fontWeight:"bold",cursor:"pointer"},onclick:()=>{o&&o(),n.remove()}}):null);document.body.appendChild(n),requestAnimationFrame(()=>{n.style.opacity="1",n.style.transform="translateY(0)"}),setTimeout(()=>{n.style.opacity="0",n.style.transform="translateY(20px)",setTimeout(()=>n.remove(),300)},a)},S.tooltip=(r,o)=>{if(r){let t=null;r.addEventListener("mouseenter",()=>{var e=r.getBoundingClientRect();t=S.div({style:{position:"fixed",top:e.top-36+"px",left:e.left+e.width/2+"px",transform:"translateX(-50%)",background:"#0f172a",border:"1px solid rgba(255,255,255,0.1)",padding:"6px 12px",color:"white",fontSize:"12px",borderRadius:"6px",boxShadow:"0 4px 6px rgba(0,0,0,0.3)",zIndex:99999,pointerEvents:"none"}},o),document.body.appendChild(t)}),r.addEventListener("mouseleave",()=>{t&&(t.remove(),t=null)})}},S.accordion=e=>{let o=S.div(".accordion",{style:{display:"flex",flexDirection:"column",gap:"8px"}});return e.forEach(e=>{let t=S.state(!1);var r="string"==typeof e.content?S.div(e.content):e.content,r=S.div({style:()=>({display:t.value?"block":"none",padding:"16px",borderTop:"1px solid rgba(255,255,255,0.08)",color:"#94a3b8"})},r),e=S.button({style:{width:"100%",textAlign:"left",background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.08)",padding:"12px 16px",color:"white",display:"flex",justifyContent:"space-between",borderRadius:"8px"},onclick:()=>t.value=!t.value},S.span(e.title,{style:{fontWeight:"600"}}),S.span(()=>t.value?"▲":"▼"));o.appendChild(S.div(".accordion-item",e,r))}),o},S.checkbox=(e,t)=>{var r=S.input("checkbox",{checked:()=>t.value,onchange:e=>t.value=e.target.checked,style:{width:"auto",marginRight:"8px"}});return S.label({style:{display:"inline-flex",alignItems:"center",cursor:"pointer",color:"white"}},r,e)},S.radio=(e,t,r,o)=>{e=S.input("radio",{name:e,checked:()=>o.value===r,onchange:()=>o.value=r,style:{width:"auto",marginRight:"8px"}});return S.label({style:{display:"inline-flex",alignItems:"center",cursor:"pointer",color:"white"}},e,t)},S.navigationRail=e=>{let t=S.div(".navigation-rail",{style:{width:"72px",height:"100%",background:"#0a0f1d",borderRight:"1px solid rgba(255,255,255,0.08)",display:"flex",flexDirection:"column",alignItems:"center",padding:"24px 0",gap:"20px"}});return e.forEach(e=>{e=S.button({style:{background:"transparent",border:"none",cursor:"pointer",color:"#94a3b8",display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",padding:"8px"},onclick:e.onclick},S.icon(e.icon,{size:20}),S.span(e.label,{style:{fontSize:"10px",fontWeight:"500"}}));t.appendChild(e)}),t},S.progress=(e,t=100)=>{let r=e&&"function"==typeof e.subscribe?e:S.state(e),o=S.computed(()=>Math.min(100,Math.max(0,r.value/t*100))+"%");return S.div(".progress-track",{style:{width:"100%",height:"8px",background:"rgba(255,255,255,0.05)",borderRadius:"4px",overflow:"hidden",border:"1px solid rgba(255,255,255,0.08)"}},S.div(".progress-fill",{style:()=>({width:o.value,height:"100%",background:"linear-gradient(90deg, #6366f1, #10b981)",transition:"width 0.2s cubic-bezier(0.4, 0, 0.2, 1)"})}))},S.stepper=(e,s)=>{let l=S.div(".stepper",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:"24px"}});return e.forEach((e,t)=>{let r=S.computed(()=>s.value>t+1),o=S.computed(()=>s.value===t+1),a=S.computed(()=>r.value?"#10b981":o.value?"#6366f1":"rgba(255,255,255,0.05)"),n=S.computed(()=>r.value||o.value?"none":"1px solid rgba(255,255,255,0.1)");var i=S.div(".step-circle",{style:()=>({width:"32px",height:"32px",borderRadius:"50%",background:a.value,border:n.value,display:"flex",justifyContent:"center",alignItems:"center",color:"white",fontWeight:"bold",fontSize:"14px"})},()=>r.value?"✓":String(t+1)),e=S.span(e,{style:()=>({marginLeft:"8px",color:o.value?"white":"#94a3b8",fontSize:"13px",fontWeight:"600"})});l.appendChild(S.flex.row({align:"center",style:{flex:1}},i,e))}),l},S.menu=(t,e)=>{if(t){let r=null;t.style.position="relative";t.addEventListener("click",()=>{r?(r.remove(),r=null):(r=S.div(".dropdown-menu",{style:{position:"absolute",top:"100%",left:"0",marginTop:"8px",minWidth:"160px",background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0,0,0,0.4)",zIndex:9999,overflow:"hidden"}}),e.forEach(e=>{let t=S.button(e.text,{style:{width:"100%",textAlign:"left",padding:"10px 16px",fontSize:"13px",background:"transparent",border:"none",color:"#cbd5e1",cursor:"pointer"},onclick:()=>{e.onclick(),r.remove(),r=null}});t.addEventListener("mouseenter",()=>t.style.background="rgba(255,255,255,0.04)"),t.addEventListener("mouseleave",()=>t.style.background="transparent"),r.appendChild(t)}),t.appendChild(r))}),document.addEventListener("click",e=>{r&&!t.contains(e.target)&&(r.remove(),r=null)})}},S.dropdown=(e={})=>{let{items:t=[],placeholder:r="Select item",onSelect:o=null}=e,a=S.state(r),n=S.state(!1),i=S.div(".dropdown-container",{style:{position:"relative",width:"100%"}});e=S.button({style:{width:"100%",textAlign:"left",display:"flex",justifyContent:"space-between",alignItems:"center",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.08)",background:"rgba(255,255,255,0.02)",color:"white",padding:"10px 14px"},onclick:()=>n.value=!n.value},S.span(()=>a.value),S.span(()=>n.value?"▲":"▼"));let s=S.div({style:()=>({display:n.value?"block":"none",position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"8px",zIndex:1e3,maxHeight:"200px",overflowY:"auto"})});return t.forEach(e=>{let t=S.div(e,{style:{padding:"10px 14px",cursor:"pointer",color:"#cbd5e1",fontSize:"14px"},onclick:()=>{a.value=e,n.value=!1,o&&o(e)}});t.addEventListener("mouseenter",()=>t.style.background="rgba(255,255,255,0.04)"),t.addEventListener("mouseleave",()=>t.style.background="transparent"),s.appendChild(t)}),i.appendChild(e),i.appendChild(s),document.addEventListener("click",e=>{i.contains(e.target)||(n.value=!1)}),i},S.emptyState=(e={})=>{var{title:e="No results found",description:t="Try adjusting your search criteria or filters.",icon:r="search"}=e;return S.flex.col({align:"center",style:{padding:"48px 24px",textAlign:"center",background:"rgba(255,255,255,0.01)",border:"1px dashed rgba(255,255,255,0.1)",borderRadius:"16px",gap:"12px"}},S.icon(r,{size:36,color:"#94a3b8"}),S.h3(e,{style:{margin:0,color:"white",fontSize:"16px",fontWeight:"700"}}),S.p(t,{style:{margin:0,color:"#94a3b8",fontSize:"13px",maxWidth:"320px",lineHeight:"1.5"}}))},S.skeletonLoader=(e={})=>{var{type:t="card",count:r=1}=e,o=S.div(".skeleton-loader-container",{style:{display:"flex",flexDirection:"column",gap:"12px",width:"100%"}}),a="background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%); background-size: 200% 100%; animation: papyr-skeleton-shine 1.5s infinite;";"undefined"==typeof document||document.getElementById("papyr-skeleton-styles")||((e=document.createElement("style")).id="papyr-skeleton-styles",e.textContent=`
28
96
  @keyframes papyr-skeleton-shine {
29
97
  0% { background-position: 200% 0; }
30
98
  100% { background-position: -200% 0; }
31
99
  }
32
- `,document.head.appendChild(e));for(let e=0;e<r;e++)"card"===t?o.appendChild(x.div(".skeleton-card",{style:{background:"rgba(255,255,255,0.01)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:"16px",padding:"20px",display:"flex",flexDirection:"column",gap:"12px"}},x.div({style:"width: 60px; height: 12px; border-radius: 4px; "+a}),x.div({style:"width: 100%; height: 16px; border-radius: 4px; "+a}),x.div({style:"width: 80%; height: 16px; border-radius: 4px; "+a}))):o.appendChild(x.div({style:"width: 100%; height: 20px; border-radius: 4px; "+a}));return o},x.calendar=(e={})=>{let{onSelect:r=null}=e;e=new Date;let o=x.state(e.getFullYear()),a=x.state(e.getMonth()),t=["January","February","March","April","May","June","July","August","September","October","November","December"],n=x.div({style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"6px",textAlign:"center",marginTop:"12px"}}),i=()=>{n.innerHTML="",["Su","Mo","Tu","We","Th","Fr","Sa"].forEach(e=>n.appendChild(x.span(e,{style:{color:"#64748b",fontSize:"11px",fontWeight:"bold"}})));var t=new Date(o.value,a.value,1).getDay(),e=new Date(o.value,a.value+1,0).getDate();for(let e=0;e<t;e++)n.appendChild(x.span(""));for(let t=1;t<=e;t++){let e=x.button(String(t),{style:{padding:"6px",fontSize:"12px",background:"transparent",border:"none",borderRadius:"6px",color:"white",cursor:"pointer"},onclick:()=>{var e=new Date(o.value,a.value,t);r&&r(e)}});e.addEventListener("mouseenter",()=>e.style.background="#6366f1"),e.addEventListener("mouseleave",()=>e.style.background="transparent"),n.appendChild(e)}};var e=x.button("▶",{style:{background:"transparent",border:"none",color:"white",cursor:"pointer"},onclick:()=>{a.value=(a.value+1)%12,0===a.value&&o.value++,i()}}),s=x.button("◀",{style:{background:"transparent",border:"none",color:"white",cursor:"pointer"},onclick:()=>{a.value=(a.value-1+12)%12,11===a.value&&o.value--,i()}}),l=x.span(()=>t[a.value]+" "+o.value,{style:{fontWeight:"bold",color:"white"}}),s=x.flex.between({style:{padding:"4px"}},s,l,e),l=x.div(".papyr-calendar",{style:{padding:"16px",background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",maxWidth:"260px"}},s,n);return i(),l},x.datePicker=(e={})=>{let{placeholder:t="Select Date",onSelect:r=null}=e,o=x.state(!1),a=x.state(""),n=x.div(".date-picker-container",{style:{position:"relative",width:"100%"}});var e=x.input("text",t,{value:()=>a.value,onclick:()=>o.value=!o.value,style:{cursor:"pointer"}}),i=x.div({style:()=>({display:o.value?"block":"none",position:"absolute",top:"100%",left:0,marginTop:"8px",zIndex:2e3})},x.calendar({onSelect:e=>{var t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-`+String(e.getDate()).padStart(2,"0");a.value=t,o.value=!1,r&&r(e)}}));return n.appendChild(e),n.appendChild(i),document.addEventListener("click",e=>{n.contains(e.target)||(o.value=!1)}),n};{let t="undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,n=null,i=("undefined"!=typeof window&&"IntersectionObserver"in window&&(n=new IntersectionObserver(e=>{e.forEach(e=>{var t;e.isIntersecting?((t=e.target.dataset.animate)&&(e.target.classList.add("animate-"+t),e.target.classList.add("animated")),"false"!==e.target.dataset.animateOnce&&n.unobserve(e.target)):"false"===e.target.dataset.animateOnce&&(t=e.target.dataset.animate)&&(e.target.classList.remove("animate-"+t),e.target.classList.remove("animated"))})},{threshold:.1})),["fade","slide","zoom","blur","rotate","bounce","elastic","glass-pop","fade-in","slide-up","slide-down","zoom-in","blur-in"]),e=null;"undefined"!=typeof window&&"MutationObserver"in window&&(e=new MutationObserver(e=>{t||e.forEach(e=>{e.addedNodes.forEach(e=>{e instanceof Element&&[e,...e.querySelectorAll("[animate]")].forEach(e=>{if(e.hasAttribute("animate")&&n){var r=e.getAttribute("animate");if(!i.includes(r)){let e="",t=1/0;for(var o of i){var a=((r,o)=>{var a=[];for(let e=0;e<=o.length;e++)a[e]=[e];for(let e=0;e<=r.length;e++)a[0][e]=e;for(let t=1;t<=o.length;t++)for(let e=1;e<=r.length;e++)o.charAt(t-1)==r.charAt(e-1)?a[t][e]=a[t-1][e-1]:a[t][e]=Math.min(a[t-1][e-1]+1,Math.min(a[t][e-1]+1,a[t-1][e]+1));return a[o.length][r.length]})(r,o);a<t&&(t=a,e=o)}t<=3&&(console.error(`PapyrError: Unknown animation "${r}". Did you mean "${e}"?`),x.toast)&&x.toast(`PapyrError: Unknown animation "${r}". Did you mean "${e}"?`,"error")}e.dataset.animate=r,e.removeAttribute("animate"),e.classList.add("papyr-animate-base"),n.observe(e)}})})})})),"undefined"!=typeof document&&e&&e.observe(document.body||document.documentElement,{childList:!0,subtree:!0}),x,x.animate=(e,t,r=400)=>{if(!e)return null;if("object"==typeof e&&!(e instanceof Element)){let t=e;return e=>(e&&"glass-pop"===t.type&&(e.classList.add("animate-glass-pop"),e.classList.add("papyr-animate-base")),e)}let o=e;return t&&"object"==typeof t&&(o.style.transition=`all ${r}ms cubic-bezier(0.4, 0, 0.2, 1)`,requestAnimationFrame(()=>{Object.assign(o.style,t)})),o},x.animate.fade=(e,t=600)=>(e&&(e.style.opacity="0",e.style.transition=`opacity ${t}ms cubic-bezier(0.4, 0, 0.2, 1)`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.opacity="1"})})),e),x.animate.slide=(e,t=600)=>(e&&(e.style.opacity="0",e.style.transform="translateY(30px)",e.style.transition=`opacity ${t}ms cubic-bezier(0.4, 0, 0.2, 1), transform ${t}ms cubic-bezier(0.4, 0, 0.2, 1.15)`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="translateY(0px)"})})),e),x.animate.zoom=(e,t=600)=>(e&&(e.style.opacity="0",e.style.transform="scale(0.9)",e.style.transition=`opacity ${t}ms cubic-bezier(0.4, 0, 0.2, 1), transform ${t}ms cubic-bezier(0.4, 0, 0.2, 1.15)`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="scale(1)"})})),e),x.animate.pop=(e,t=600)=>(e&&(e.style.opacity="0",e.style.transform="scale(0.3)",e.style.transition=`opacity ${t}ms ease, transform ${t}ms cubic-bezier(0.34, 1.56, 0.64, 1)`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="scale(1)"})})),e),x.animate.spring=(a,e,t={})=>{if(!a||"undefined"==typeof window)return a;let{tension:n=170,friction:i=26,mass:s=1}=t,r=(a._springCancel&&a._springCancel(),!1),l=(a._springCancel=()=>{r=!0},0),d=0,p=1;var t=a.style.transform||"",o=t.match(/translate\(([^,]+),\s*([^)]+)\)/)||t.match(/translate3d\(([^,]+),\s*([^,]+)/),o=(o?(l=parseFloat(o[1])||0,d=parseFloat(o[2])||0):((o=t.match(/translateX\(([^)]+)\)/))&&(l=parseFloat(o[1])||0),(o=t.match(/translateY\(([^)]+)\)/))&&(d=parseFloat(o[1])||0)),t.match(/scale\(([^)]+)\)/));o&&(p=parseFloat(o[1])||1);let c={},u=(Object.entries(e).forEach(([t,r])=>{if("__proto__"!==t&&"constructor"!==t&&"prototype"!==t){let e=0;e="x"===t?l:"y"===t?d:"scale"===t?p:parseFloat(a.style[t])||0,c[t]={current:e,velocity:0,target:r}}}),()=>{if(!r){let r=!0;Object.entries(c).forEach(([,e])=>{var t=(-n*(e.current-e.target)-i*e.velocity)/s;e.velocity+=.016*t,e.current+=.016*e.velocity,.01<Math.abs(e.velocity)||.01<Math.abs(e.current-e.target)?r=!1:e.current=e.target});var e=[],t="x"in c,o="y"in c;t||o?(t=t?c.x.current:l,o=o?c.y.current:d,e.push(`translate(${t}px, ${o}px)`)):0===l&&0===d||e.push(`translate(${l}px, ${d}px)`),"scale"in c?e.push(`scale(${c.scale.current})`):1!==p&&e.push(`scale(${p})`),0<e.length&&(a.style.transform=e.join(" ")),Object.entries(c).forEach(([e,t])=>{"x"!==e&&"y"!==e&&"scale"!==e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(a.style[e]="opacity"===e?t.current:t.current+"px")}),r||requestAnimationFrame(u)}});return u(),a},x.animate.gesture=(c,u={})=>{if(c&&"undefined"!=typeof window){let{onSwipeLeft:e,onSwipeRight:t,onDrag:r,onRelease:o}=u,a=0,n=0,i=0,s=0,l=!1,d=(e,t)=>{a=e,n=t,l=!0,c.style.transition="none"},p=(e,t)=>{l&&(i=e-a,s=t-n,r?r(i,s,c):c.style.transform=`translate(${i}px, ${s}px)`)};u=()=>{l&&(l=!1,o?o(i,s,c):(c.style.transition="transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)",100<i&&t?t(c):i<-100&&e?e(c):c.style.transform="translate(0px, 0px)"),i=0,s=0)};c.addEventListener("mousedown",e=>d(e.clientX,e.clientY)),window.addEventListener("mousemove",e=>p(e.clientX,e.clientY)),window.addEventListener("mouseup",u),c.addEventListener("touchstart",e=>d(e.touches[0].clientX,e.touches[0].clientY)),c.addEventListener("touchmove",e=>p(e.touches[0].clientX,e.touches[0].clientY)),c.addEventListener("touchend",u)}return c},x.parallax=(t,o=.5)=>{"undefined"!=typeof window&&window.addEventListener("scroll",()=>{var e=document.querySelectorAll(t);let r=window.scrollY;e.forEach(e=>{var t=-r*o;e.style.transform=`translateY(${t}px)`})})},x.physics=(e={})=>{let{gravity:s=.98,bounce:l=.8,friction:d=.95}=e;return i=>{if(i&&"undefined"!=typeof window){let t=0,r=0,o=!1,a,n=()=>{var e;o||(r+=s,t+=r,e=(i.parentElement?i.parentElement.clientHeight:window.innerHeight)-i.offsetHeight,t>e&&(t=e,r=(r*=-l)*d),i.style.transform=`translateY(${t}px)`),a=requestAnimationFrame(n)};i.style.cursor="grab",i.addEventListener("mousedown",()=>{o=!0,i.style.cursor="grabbing"}),window.addEventListener("mouseup",()=>{o&&(o=!1,i.style.cursor="grab",r=0)}),window.addEventListener("mousemove",e=>{o&&(t+=e.movementY,i.style.transform=`translateY(${t}px)`)}),setTimeout(()=>{var e=i.getBoundingClientRect();t=e.top||0,n()},50)}return i}}}{let e="undefined"!=typeof window&&window.papyr||"undefined"!=typeof global&&global.papyr;if(e){let s=(t,r)=>{if(t&&"function"==typeof t.getContext){let d=t.getContext("2d");if(d){var p=t.width;let l=t.height;if(0!==p&&0!==l){d.clearRect(0,0,p,l);t=r.type||"bar";let e=r.data;e&&"function"==typeof e.subscribe?e=e.value:r.value&&"function"==typeof r.value.subscribe&&(e=r.value.value);var c=e||[];let s=r.colors||["#6366f1","#14b8a6","#f43f5e","#f59e0b","#8b5cf6"];if("bar"===t){let n=(p-80)/(c.length||1)-10;var o=c.map(e=>"object"==typeof e?e.value:e);let i=0<o.length?Math.max(...o):1;c.forEach((e,t)=>{var r="object"==typeof e?e.value:e,e="object"==typeof e?e.label:"",r=r/(i||1)*(l-80),o=40+t*(10+n),a=l-40-r;d.fillStyle=s[t%s.length],d.beginPath(),d.roundRect?d.roundRect(o,a,n,r,[4,4,0,0]):d.rect(o,a,n,r),d.fill(),e&&(d.fillStyle="#cbd5e1",d.font="12px sans-serif",d.textAlign="center",d.fillText(e,o+n/2,l-40+20))})}else if("circle"===t||"pie"===t){let a=p/2,n=l/2,i=Math.min(a,n)-20;if("circle"===t){o=("function"==typeof r.value?r.value():void 0!==r.value?r.value:0)/(r.max||100||1);d.beginPath(),d.arc(a,n,i,0,2*Math.PI),d.strokeStyle="rgba(255,255,255,0.05)",d.lineWidth=15,d.stroke(),d.beginPath(),d.arc(a,n,i,-Math.PI/2,-Math.PI/2+2*Math.PI*o),d.strokeStyle=s[0],d.lineCap="round",d.lineWidth=15,d.stroke(),d.fillStyle="#fff",d.font="bold 24px sans-serif",d.textAlign="center",d.textBaseline="middle",d.fillText(Math.round(100*o)+"%",a,n)}else if("pie"===t){let r=c.reduce((e,t)=>e+("object"==typeof t?t.value:t),0),o=-Math.PI/2;c.forEach((e,t)=>{e=("object"==typeof e?e.value:e)/(r||1)*Math.PI*2;d.beginPath(),d.moveTo(a,n),d.arc(a,n,i,o,o+e),d.closePath(),d.fillStyle=s[t%s.length],d.fill(),o+=e})}}else if("line"===t){r=c.map(e=>"object"==typeof e?e.value:e);let o=0<r.length?Math.max(...r):1,a=(p-80)/(c.length-1||1);d.beginPath(),d.strokeStyle=s[0],d.lineWidth=3,d.lineJoin="round",c.forEach((e,t)=>{var e="object"==typeof e?e.value:e,r=40+t*a,e=l-40-e/(o||1)*(l-80);0===t?d.moveTo(r,e):d.lineTo(r,e)}),d.stroke()}}}}},l=e.chart;e.chart=(t,r,o={})=>{if("string"==typeof t){if("function"==typeof l)return l(t,r,o);if("undefined"==typeof document)return{tagName:"canvas",isMock:!0};let e=document.createElement("canvas");return e.width=o.width||300,e.height=o.height||180,e}if("undefined"==typeof document)return{tagName:"div",className:"papyr-chart-container",isMock:!0};let a=t||{},n=document.createElement("canvas"),i=e.div(".papyr-chart-container",n,Object.assign({style:{position:"relative",width:"100%",height:"300px"}},a.attrs||{}));if("undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{for(var t of e){t=t.contentRect;n.width=t.width||300,n.height=t.height||300,s(n,a)}});setTimeout(()=>{e.observe(i),s(n,a)},0)}else setTimeout(()=>{n.width=300,n.height=300,s(n,a)},0);r=a.data&&"function"==typeof a.data.subscribe?a.data:a.value&&"function"==typeof a.value.subscribe?a.value:null;return r&&r.subscribe(()=>{"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(()=>s(n,a)):s(n,a)}),i},e.charts=(e,t)=>{if("undefined"==typeof document)return null;let r="string"==typeof e?document.getElementById(e)||document.querySelector(e):e;if(!r)return console.error("PapyrCharts Error: Canvas element not found: "+e),null;let o=()=>{s(r,t)};e=t.data&&"function"==typeof t.data.subscribe?t.data:t.value&&"function"==typeof t.value.subscribe?t.value:null;if(e&&e.subscribe(()=>{"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(o):o()}),"undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{for(var t of e){t=t.contentRect;r.width=t.width||r.clientWidth||300,r.height=t.height||r.clientHeight||150,o()}});setTimeout(()=>{e.observe(r.parentElement||r),o()},0)}else setTimeout(o,0);return r}}else console.warn("Papyr core not found. Load papyr.js before loading charts plugin.")}"undefined"!=typeof document&&((r=document.createElement("style")).id="papyr-complete-styles",r.textContent=`
100
+ `,document.head.appendChild(e));for(let e=0;e<r;e++)"card"===t?o.appendChild(S.div(".skeleton-card",{style:{background:"rgba(255,255,255,0.01)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:"16px",padding:"20px",display:"flex",flexDirection:"column",gap:"12px"}},S.div({style:"width: 60px; height: 12px; border-radius: 4px; "+a}),S.div({style:"width: 100%; height: 16px; border-radius: 4px; "+a}),S.div({style:"width: 80%; height: 16px; border-radius: 4px; "+a}))):o.appendChild(S.div({style:"width: 100%; height: 20px; border-radius: 4px; "+a}));return o},S.calendar=(e={})=>{let{onSelect:r=null}=e;e=new Date;let o=S.state(e.getFullYear()),a=S.state(e.getMonth()),t=["January","February","March","April","May","June","July","August","September","October","November","December"],n=S.div({style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"6px",textAlign:"center",marginTop:"12px"}}),i=()=>{n.innerHTML="",["Su","Mo","Tu","We","Th","Fr","Sa"].forEach(e=>n.appendChild(S.span(e,{style:{color:"#64748b",fontSize:"11px",fontWeight:"bold"}})));var t=new Date(o.value,a.value,1).getDay(),e=new Date(o.value,a.value+1,0).getDate();for(let e=0;e<t;e++)n.appendChild(S.span(""));for(let t=1;t<=e;t++){let e=S.button(String(t),{style:{padding:"6px",fontSize:"12px",background:"transparent",border:"none",borderRadius:"6px",color:"white",cursor:"pointer"},onclick:()=>{var e=new Date(o.value,a.value,t);r&&r(e)}});e.addEventListener("mouseenter",()=>e.style.background="#6366f1"),e.addEventListener("mouseleave",()=>e.style.background="transparent"),n.appendChild(e)}};var e=S.button("▶",{style:{background:"transparent",border:"none",color:"white",cursor:"pointer"},onclick:()=>{a.value=(a.value+1)%12,0===a.value&&o.value++,i()}}),s=S.button("◀",{style:{background:"transparent",border:"none",color:"white",cursor:"pointer"},onclick:()=>{a.value=(a.value-1+12)%12,11===a.value&&o.value--,i()}}),l=S.span(()=>Reflect.get(t,Math.max(0,Math.min(11,Number(a.value))))+" "+o.value,{style:{fontWeight:"bold",color:"white"}}),s=S.flex.between({style:{padding:"4px"}},s,l,e),l=S.div(".papyr-calendar",{style:{padding:"16px",background:"#0f172a",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",maxWidth:"260px"}},s,n);return i(),l},S.datePicker=(e={})=>{let{placeholder:t="Select Date",onSelect:r=null}=e,o=S.state(!1),a=S.state(""),n=S.div(".date-picker-container",{style:{position:"relative",width:"100%"}});var e=S.input("text",t,{value:()=>a.value,onclick:()=>o.value=!o.value,style:{cursor:"pointer"}}),i=S.div({style:()=>({display:o.value?"block":"none",position:"absolute",top:"100%",left:0,marginTop:"8px",zIndex:2e3})},S.calendar({onSelect:e=>{var t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-`+String(e.getDate()).padStart(2,"0");a.value=t,o.value=!1,r&&r(e)}}));return n.appendChild(e),n.appendChild(i),document.addEventListener("click",e=>{n.contains(e.target)||(o.value=!1)}),n},S.virtualList=(e={})=>{let{items:t=[],itemHeight:r=40,renderItem:o=(e,t)=>S.div(String(e)),viewportHeight:a=300,style:n={}}=e,i=t&&"function"==typeof t.subscribe?t:S.state(t),s=S.state(0),l=S.computed(()=>i.value.length*r),p=S.computed(()=>Math.max(0,Math.floor(s.value/r)-2)),d=S.computed(()=>Math.min(i.value.length,Math.floor((s.value+a)/r)+2));e=S.computed(()=>{var t=i.value,r=p.value,o=d.value,a=[];for(let e=r;e<o;e++)a.push({item:Reflect.get(t,e),index:e});return a}),e=S.div({style:{position:"relative",width:"100%",height:"100%",overflow:"hidden"}},S.div({style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflowY:"auto"},onscroll:e=>{s.value=e.target.scrollTop}},S.div({style:()=>({height:l.value+"px",width:"100%",position:"relative"})},S.for(e,e=>{var t=o(e.item,e.index);return t&&t.style&&(t.style.position="absolute",t.style.top=e.index*r+"px",t.style.left="0",t.style.width="100%",t.style.height=r+"px",t.style.boxSizing="border-box"),t}))));return Object.assign(e.style,{height:"number"==typeof a?a+"px":a,border:"1px solid rgba(255,255,255,0.08)",borderRadius:"12px",background:"rgba(255,255,255,0.02)"},n),e};{let t="undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,y=()=>t||"undefined"!=typeof document&&document.documentElement.classList.contains("papyr-low-end");if("undefined"!=typeof window&&"undefined"!=typeof requestAnimationFrame){let r=performance.now(),o=0,a=0,n=()=>{var e=performance.now();if(o++,1e3<=e-r){var t=1e3*o/(e-r);if(o=0,r=e,t<45){if(3<=++a)return void("undefined"!=typeof document&&document.documentElement&&(document.documentElement.classList.add("papyr-low-end"),console.warn("Papyr Fluid Engine: Low frame rate detected. Visual quality degraded to optimize performance."),window.papyr)&&"function"==typeof window.papyr.emit&&window.papyr.emit("performance-degraded",{fps:t}))}else a=0}requestAnimationFrame(n)};setTimeout(()=>requestAnimationFrame(n),1e3)}let n=null,i=("undefined"!=typeof window&&"IntersectionObserver"in window&&(n=new IntersectionObserver(e=>{e.forEach(e=>{var t;e.isIntersecting?((t=e.target.dataset.animate)&&(e.target.classList.add("animate-"+t),e.target.classList.add("animated")),"false"!==e.target.dataset.animateOnce&&n.unobserve(e.target)):"false"===e.target.dataset.animateOnce&&(t=e.target.dataset.animate)&&(e.target.classList.remove("animate-"+t),e.target.classList.remove("animated"))})},{threshold:.1})),["fade","slide","zoom","blur","rotate","bounce","elastic","glass-pop","fade-in","slide-up","slide-down","zoom-in","blur-in"]),e=null;"undefined"!=typeof window&&"MutationObserver"in window&&(e=new MutationObserver(e=>{t||e.forEach(e=>{e.addedNodes.forEach(e=>{e instanceof Element&&[e,...e.querySelectorAll("[animate]")].forEach(e=>{if(e.hasAttribute("animate")&&n){var r=e.getAttribute("animate");if(!i.includes(r)){let e="",t=1/0;for(var o of i){var a=((r,o)=>{var a=[];for(let e=0;e<=o.length;e++)a[e]=[e];for(let e=0;e<=r.length;e++)a[0][e]=e;for(let t=1;t<=o.length;t++)for(let e=1;e<=r.length;e++)o.charAt(t-1)==r.charAt(e-1)?a[t][e]=a[t-1][e-1]:a[t][e]=Math.min(a[t-1][e-1]+1,Math.min(a[t][e-1]+1,a[t-1][e]+1));return a[o.length][r.length]})(r,o);a<t&&(t=a,e=o)}t<=3&&(console.error(`PapyrError: Unknown animation "${r}". Did you mean "${e}"?`),S.toast)&&S.toast(`PapyrError: Unknown animation "${r}". Did you mean "${e}"?`,"error")}e.dataset.animate=r,e.removeAttribute("animate"),e.classList.add("papyr-animate-base"),n.observe(e)}})})})})),"undefined"!=typeof document&&e&&e.observe(document.body||document.documentElement,{childList:!0,subtree:!0}),S,S.animate=(e,t,r=400)=>{if(!e)return null;if("object"==typeof e&&!(e instanceof Element)){let t=e;return e=>(e&&"glass-pop"===t.type&&(e.classList.add("animate-glass-pop"),e.classList.add("papyr-animate-base")),e)}let o=e;return t&&"object"==typeof t&&(o.style.transition=`all ${r}ms cubic-bezier(0.4, 0, 0.2, 1)`,requestAnimationFrame(()=>{Object.assign(o.style,t)})),o},S.animate.fade=(e,t=600)=>(e&&(y()?e.style.opacity="1":(e.style.opacity="0",e.style.transition=`opacity ${t}ms cubic-bezier(0.4, 0, 0.2, 1)`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.opacity="1"})}))),e),S.animate.slide=(e,t=600)=>(e&&(y()?(e.style.opacity="1",e.style.transform="translateY(0px)"):(e.style.opacity="0",e.style.transform="translateY(30px)",e.style.transition=`opacity ${t}ms cubic-bezier(0.4, 0, 0.2, 1), transform ${t}ms cubic-bezier(0.4, 0, 0.2, 1.15)`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="translateY(0px)"})}))),e),S.animate.zoom=(e,t=600)=>(e&&(y()?(e.style.opacity="1",e.style.transform="scale(1)"):(e.style.opacity="0",e.style.transform="scale(0.9)",e.style.transition=`opacity ${t}ms cubic-bezier(0.4, 0, 0.2, 1), transform ${t}ms cubic-bezier(0.4, 0, 0.2, 1.15)`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="scale(1)"})}))),e),S.animate.pop=(e,t=600)=>(e&&(y()?(e.style.opacity="1",e.style.transform="scale(1)"):(e.style.opacity="0",e.style.transform="scale(0.3)",e.style.transition=`opacity ${t}ms ease, transform ${t}ms cubic-bezier(0.34, 1.56, 0.64, 1)`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.opacity="1",e.style.transform="scale(1)"})}))),e),S.animate.spring=(a,e,t={})=>{if(!a||"undefined"==typeof window)return a;if(a._hasSpringCancelListeners||(a._hasSpringCancelListeners=!0,a.addEventListener("mousedown",o=()=>{a._springCancel&&a._springCancel()}),a.addEventListener("touchstart",o)),y())return o=[],("x"in e||"y"in e)&&o.push(`translate(${void 0!==e.x?e.x:0}px, ${void 0!==e.y?e.y:0}px)`),"scale"in e&&o.push(`scale(${e.scale})`),0<o.length&&(a.style.transform=o.join(" ")),Object.entries(e).forEach(([e,t])=>{"x"!==e&&"y"!==e&&"scale"!==e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(a.style[e]="opacity"===e?t:t+"px")}),a;let{tension:n=170,friction:i=26,mass:s=1}=t,r=(a._springCancel&&a._springCancel(),!1),l=(a._springCancel=()=>{r=!0},0),p=0,d=1;var o=a.style.transform||"",t=o.match(/translate\(([^,]+),\s*([^)]+)\)/)||o.match(/translate3d\(([^,]+),\s*([^,]+)/),t=(t?(l=parseFloat(t[1])||0,p=parseFloat(t[2])||0):((t=o.match(/translateX\(([^)]+)\)/))&&(l=parseFloat(t[1])||0),(t=o.match(/translateY\(([^)]+)\)/))&&(p=parseFloat(t[1])||0)),o.match(/scale\(([^)]+)\)/));t&&(d=parseFloat(t[1])||1);let c={},u=(Object.entries(e).forEach(([t,r])=>{if("__proto__"!==t&&"constructor"!==t&&"prototype"!==t){let e=0;e="x"===t?l:"y"===t?p:"scale"===t?d:parseFloat(a.style[t])||0,c[t]={current:e,velocity:0,target:r}}}),()=>{if(!r){let r=!0;Object.entries(c).forEach(([,e])=>{var t=(-n*(e.current-e.target)-i*e.velocity)/s;e.velocity+=.016*t,e.current+=.016*e.velocity,.01<Math.abs(e.velocity)||.01<Math.abs(e.current-e.target)?r=!1:e.current=e.target});var e=[],t="x"in c,o="y"in c;t||o?(t=t?c.x.current:l,o=o?c.y.current:p,e.push(`translate(${t}px, ${o}px)`)):0===l&&0===p||e.push(`translate(${l}px, ${p}px)`),"scale"in c?e.push(`scale(${c.scale.current})`):1!==d&&e.push(`scale(${d})`),0<e.length&&(a.style.transform=e.join(" ")),Object.entries(c).forEach(([e,t])=>{"x"!==e&&"y"!==e&&"scale"!==e&&"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(a.style[e]="opacity"===e?t.current:t.current+"px")}),r||requestAnimationFrame(u)}});return u(),a},S.animate.gesture=(c,u={})=>{if(c&&"undefined"!=typeof window){let{onSwipeLeft:e,onSwipeRight:t,onDrag:r,onRelease:o}=u,a=0,n=0,i=0,s=0,l=!1,p=(e,t)=>{a=e,n=t,l=!0,c.style.transition="none"},d=(e,t)=>{l&&(i=e-a,s=t-n,r?r(i,s,c):c.style.transform=`translate(${i}px, ${s}px)`)};u=()=>{l&&(l=!1,o?o(i,s,c):(c.style.transition="transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)",100<i&&t?t(c):i<-100&&e?e(c):c.style.transform="translate(0px, 0px)"),i=0,s=0)};c.addEventListener("mousedown",e=>p(e.clientX,e.clientY)),window.addEventListener("mousemove",e=>d(e.clientX,e.clientY)),window.addEventListener("mouseup",u),c.addEventListener("touchstart",e=>p(e.touches[0].clientX,e.touches[0].clientY)),c.addEventListener("touchmove",e=>d(e.touches[0].clientX,e.touches[0].clientY)),c.addEventListener("touchend",u)}return c},S.parallax=(t,o=.5)=>{"undefined"!=typeof window&&window.addEventListener("scroll",()=>{var e=document.querySelectorAll(t);let r=window.scrollY;e.forEach(e=>{var t=-r*o;e.style.transform=`translateY(${t}px)`})})},S.physics=(e={})=>{let{gravity:s=.98,bounce:l=.8,friction:p=.95}=e;return i=>{if(i&&"undefined"!=typeof window){let t=0,r=0,o=!1,a,n=()=>{var e;o||(r+=s,t+=r,e=(i.parentElement?i.parentElement.clientHeight:window.innerHeight)-i.offsetHeight,t>e&&(t=e,r=(r*=-l)*p),i.style.transform=`translateY(${t}px)`),a=requestAnimationFrame(n)};i.style.cursor="grab",i.addEventListener("mousedown",()=>{o=!0,i.style.cursor="grabbing"}),window.addEventListener("mouseup",()=>{o&&(o=!1,i.style.cursor="grab",r=0)}),window.addEventListener("mousemove",e=>{o&&(t+=e.movementY,i.style.transform=`translateY(${t}px)`)}),setTimeout(()=>{var e=i.getBoundingClientRect();t=e.top||0,n()},50)}return i}}}{let e="undefined"!=typeof window&&window.papyr||"undefined"!=typeof global&&global.papyr;if(e){let s=(t,r)=>{if(t&&"function"==typeof t.getContext){let p=t.getContext("2d");if(p){var d=t.width;let l=t.height;if(0!==d&&0!==l){p.clearRect(0,0,d,l);t=r.type||"bar";let e=r.data;e&&"function"==typeof e.subscribe?e=e.value:r.value&&"function"==typeof r.value.subscribe&&(e=r.value.value);var c=e||[];let s=r.colors||["#6366f1","#14b8a6","#f43f5e","#f59e0b","#8b5cf6"];if("bar"===t){let n=(d-80)/(c.length||1)-10;var o=c.map(e=>"object"==typeof e?e.value:e);let i=0<o.length?Math.max(...o):1;c.forEach((e,t)=>{var r="object"==typeof e?e.value:e,e="object"==typeof e?e.label:"",r=r/(i||1)*(l-80),o=40+t*(10+n),a=l-40-r;p.fillStyle=s[t%s.length],p.beginPath(),p.roundRect?p.roundRect(o,a,n,r,[4,4,0,0]):p.rect(o,a,n,r),p.fill(),e&&(p.fillStyle="#cbd5e1",p.font="12px sans-serif",p.textAlign="center",p.fillText(e,o+n/2,l-40+20))})}else if("circle"===t||"pie"===t){let a=d/2,n=l/2,i=Math.min(a,n)-20;if("circle"===t){o=("function"==typeof r.value?r.value():void 0!==r.value?r.value:0)/(r.max||100||1);p.beginPath(),p.arc(a,n,i,0,2*Math.PI),p.strokeStyle="rgba(255,255,255,0.05)",p.lineWidth=15,p.stroke(),p.beginPath(),p.arc(a,n,i,-Math.PI/2,-Math.PI/2+2*Math.PI*o),p.strokeStyle=s[0],p.lineCap="round",p.lineWidth=15,p.stroke(),p.fillStyle="#fff",p.font="bold 24px sans-serif",p.textAlign="center",p.textBaseline="middle",p.fillText(Math.round(100*o)+"%",a,n)}else if("pie"===t){let r=c.reduce((e,t)=>e+("object"==typeof t?t.value:t),0),o=-Math.PI/2;c.forEach((e,t)=>{e=("object"==typeof e?e.value:e)/(r||1)*Math.PI*2;p.beginPath(),p.moveTo(a,n),p.arc(a,n,i,o,o+e),p.closePath(),p.fillStyle=s[t%s.length],p.fill(),o+=e})}}else if("line"===t){r=c.map(e=>"object"==typeof e?e.value:e);let o=0<r.length?Math.max(...r):1,a=(d-80)/(c.length-1||1);p.beginPath(),p.strokeStyle=s[0],p.lineWidth=3,p.lineJoin="round",c.forEach((e,t)=>{var e="object"==typeof e?e.value:e,r=40+t*a,e=l-40-e/(o||1)*(l-80);0===t?p.moveTo(r,e):p.lineTo(r,e)}),p.stroke()}}}}},l=e.chart;e.chart=(t,r,o={})=>{if("string"==typeof t){if("function"==typeof l)return l(t,r,o);if("undefined"==typeof document)return{tagName:"canvas",isMock:!0};let e=document.createElement("canvas");return e.width=o.width||300,e.height=o.height||180,e}if("undefined"==typeof document)return{tagName:"div",className:"papyr-chart-container",isMock:!0};let a=t||{},n=document.createElement("canvas"),i=e.div(".papyr-chart-container",n,Object.assign({style:{position:"relative",width:"100%",height:"300px"}},a.attrs||{}));if("undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{for(var t of e){t=t.contentRect;n.width=t.width||300,n.height=t.height||300,s(n,a)}});setTimeout(()=>{e.observe(i),s(n,a)},0)}else setTimeout(()=>{n.width=300,n.height=300,s(n,a)},0);r=a.data&&"function"==typeof a.data.subscribe?a.data:a.value&&"function"==typeof a.value.subscribe?a.value:null;return r&&r.subscribe(()=>{"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(()=>s(n,a)):s(n,a)}),i},e.charts=(e,t)=>{if("undefined"==typeof document)return null;let r="string"==typeof e?document.getElementById(e)||document.querySelector(e):e;if(!r)return console.error("PapyrCharts Error: Canvas element not found: "+e),null;let o=()=>{s(r,t)};e=t.data&&"function"==typeof t.data.subscribe?t.data:t.value&&"function"==typeof t.value.subscribe?t.value:null;if(e&&e.subscribe(()=>{"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(o):o()}),"undefined"!=typeof ResizeObserver){let e=new ResizeObserver(e=>{for(var t of e){t=t.contentRect;r.width=t.width||r.clientWidth||300,r.height=t.height||r.clientHeight||150,o()}});setTimeout(()=>{e.observe(r.parentElement||r),o()},0)}else setTimeout(o,0);return r}}else console.warn("Papyr core not found. Load papyr.js before loading charts plugin.")}"undefined"!=typeof document&&((k=document.createElement("style")).id="papyr-complete-styles",k.textContent=`
33
101
  :root {
102
+ /* Foundation Accent Colors */
34
103
  --papyr-primary: #6366f1;
35
104
  --papyr-primary-hover: #4f46e5;
36
105
  --papyr-primary-light: rgba(99, 102, 241, 0.15);
@@ -44,8 +113,117 @@
44
113
  --papyr-info: #0ea5e9;
45
114
  --papyr-radius: 12px;
46
115
  --papyr-font: system-ui, -apple-system, sans-serif;
116
+
117
+ /* Layer 1 - Spacing Scale */
118
+ --papyr-space-4: 4px;
119
+ --papyr-space-8: 8px;
120
+ --papyr-space-12: 12px;
121
+ --papyr-space-16: 16px;
122
+ --papyr-space-20: 20px;
123
+ --papyr-space-24: 24px;
124
+ --papyr-space-32: 32px;
125
+ --papyr-space-40: 40px;
126
+ --papyr-space-48: 48px;
127
+ --papyr-space-64: 64px;
128
+
129
+ /* Layer 1 - Radius Scale */
130
+ --papyr-radius-xs: 2px;
131
+ --papyr-radius-sm: 4px;
132
+ --papyr-radius-md: 8px;
133
+ --papyr-radius-lg: 12px;
134
+ --papyr-radius-xl: 16px;
135
+ --papyr-radius-2xl: 24px;
136
+ --papyr-radius-full: 9999px;
137
+
138
+ /* Layer 1 - Elevation Scale */
139
+ --papyr-shadow-0: none;
140
+ --papyr-shadow-1: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
141
+ --papyr-shadow-2: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
142
+ --papyr-shadow-3: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
143
+ --papyr-shadow-4: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
144
+ --papyr-shadow-5: 0 25px 50px -12px rgba(0,0,0,0.25);
145
+
146
+ /* Layer 1 - Typography Scale */
147
+ --papyr-font-display: 3.5rem;
148
+ --papyr-font-headline: 2.25rem;
149
+ --papyr-font-title: 1.5rem;
150
+ --papyr-font-body: 1rem;
151
+ --papyr-font-caption: 0.875rem;
152
+ --papyr-font-label: 0.75rem;
153
+
154
+ /* Layer 1 - Motion Scale */
155
+ --papyr-motion-fast: 150ms;
156
+ --papyr-motion-normal: 300ms;
157
+ --papyr-motion-slow: 600ms;
158
+
159
+ /* Transition curves */
160
+ --papyr-ease: cubic-bezier(0.16, 1, 0.3, 1);
161
+ --papyr-duration: 0.4s;
162
+ --papyr-transition: all var(--papyr-duration) var(--papyr-ease);
163
+ }
164
+
165
+ /* Preset Layer 2 - Papyr Liquid Theme overrides */
166
+ .papyr-theme-liquid {
167
+ --papyr-bg: #030712;
168
+ --papyr-surface: rgba(255, 255, 255, 0.02);
169
+ --papyr-border: rgba(255, 255, 255, 0.08);
170
+ --papyr-text: #f9fafb;
171
+ --papyr-text-muted: #9ca3af;
172
+ --papyr-glow: rgba(99, 102, 241, 0.15);
173
+ --papyr-radius: var(--papyr-radius-xl);
174
+ --papyr-blur-level: 16px;
175
+ }
176
+
177
+ /* Preset Layer 2 - Papyr Material Theme overrides */
178
+ .papyr-theme-material {
179
+ --papyr-bg: #121212;
180
+ --papyr-surface: #1e1e1e;
181
+ --papyr-border: rgba(255, 255, 255, 0.12);
182
+ --papyr-text: rgba(255, 255, 255, 0.87);
183
+ --papyr-text-muted: rgba(255, 255, 255, 0.6);
184
+ --papyr-primary: #bb86fc;
185
+ --papyr-primary-hover: #9a66da;
186
+ --papyr-radius: var(--papyr-radius-sm);
187
+ --papyr-blur-level: 0px;
188
+ }
189
+
190
+ /* Preset Layer 2 - Papyr Minimal Theme overrides */
191
+ .papyr-theme-minimal {
192
+ --papyr-bg: #ffffff;
193
+ --papyr-surface: #ffffff;
194
+ --papyr-border: #e5e7eb;
195
+ --papyr-text: #111827;
196
+ --papyr-text-muted: #6b7280;
197
+ --papyr-primary: #111827;
198
+ --papyr-primary-hover: #374151;
199
+ --papyr-radius: var(--papyr-radius-xs);
200
+ --papyr-blur-level: 0px;
201
+ }
202
+
203
+ /* Preset Layer 2 - Papyr Enterprise Theme overrides */
204
+ .papyr-theme-enterprise {
205
+ --papyr-bg: #f3f4f6;
206
+ --papyr-surface: #ffffff;
207
+ --papyr-border: #d1d5db;
208
+ --papyr-text: #1f2937;
209
+ --papyr-text-muted: #4b5563;
210
+ --papyr-primary: #2563eb;
211
+ --papyr-primary-hover: #1d4ed8;
212
+ --papyr-radius: var(--papyr-radius-xs);
213
+ --papyr-blur-level: 0px;
214
+ }
215
+
216
+ /* GPU acceleration hooks for Liquid Theme */
217
+ .papyr-theme-liquid .papyr-card,
218
+ .papyr-theme-liquid .papyr-glass-panel,
219
+ .papyr-theme-liquid .papyr-hero-glass {
220
+ backdrop-filter: blur(var(--papyr-blur-level, 16px));
221
+ -webkit-backdrop-filter: blur(var(--papyr-blur-level, 16px));
222
+ will-change: transform, opacity;
223
+ transform: translate3d(0, 0, 0);
47
224
  }
48
225
 
226
+
49
227
  /* Flexbox System */
50
228
  .flex-row { display: flex; flex-direction: row; gap: 1rem; }
51
229
  .flex-col { display: flex; flex-direction: column; gap: 1rem; }
@@ -291,6 +469,17 @@ input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focu
291
469
  }
292
470
  }
293
471
 
472
+ /* Low-end device performance overrides */
473
+ .papyr-low-end, .papyr-low-end * {
474
+ backdrop-filter: none !important;
475
+ -webkit-backdrop-filter: none !important;
476
+ box-shadow: none !important;
477
+ text-shadow: none !important;
478
+ animation: none !important;
479
+ transition: none !important;
480
+ }
481
+
482
+
294
483
 
295
484
  /* Papyr.js Responsive Grid System */
296
485
  .container { width: 100%; margin-right: auto; margin-left: auto; padding-right: 15px; padding-left: 15px; }
@@ -609,5 +798,32 @@ input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focu
609
798
  font-size: var(--papyr-fs, 14px);
610
799
  line-height: 1.5;
611
800
  }
612
- `,document.head.appendChild(r),console.log("📄 Papyr UI styling successfully injected.")),"undefined"!=typeof module&&module.exports?module.exports=s:"undefined"!=typeof exports&&(exports.papyr=s)})();
801
+
802
+ /* Biometric & Behavioral Adaptive UI Overrides */
803
+ .papyr-stress .papyr-btn,
804
+ .papyr-stress button {
805
+ padding: 16px 32px !important;
806
+ font-size: 16px !important;
807
+ transform: scale(1.05) !important; /* Larger hit target */
808
+ }
809
+
810
+ .papyr-stress .papyr-card {
811
+ box-shadow: none !important;
812
+ backdrop-filter: none !important;
813
+ -webkit-backdrop-filter: none !important;
814
+ border-color: var(--papyr-border) !important;
815
+ }
816
+
817
+ .papyr-stress .papyr-particle-canvas,
818
+ .papyr-stress canvas:not(.papyr-gpu-layout-container) {
819
+ display: none !important;
820
+ }
821
+
822
+ .papyr-reading p,
823
+ .papyr-reading .papyr-muted {
824
+ line-height: 1.8 !important;
825
+ letter-spacing: 0.03em !important;
826
+ transition: line-height 0.4s ease, letter-spacing 0.4s ease;
827
+ }
828
+ `,document.head.appendChild(k),console.log("📄 Papyr UI styling successfully injected.")),"undefined"!=typeof module&&module.exports?module.exports=_:"undefined"!=typeof exports&&(exports.papyr=_)}();
613
829
  //# sourceMappingURL=papyr-ui.min.js.map