@bluepic/embed 0.4.0-next.163 → 0.4.0-next.164
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bluepic-embed.iife.js +2 -2
- package/dist/bluepic-embed.umd.js +2 -2
- package/dist/components/BxCard.vue.d.ts +14 -0
- package/dist/components/BxList.vue.d.ts +9 -0
- package/dist/components/BxListItem.vue.d.ts +13 -1
- package/dist/embed/embed.d.ts +2 -2
- package/dist/main.cjs +2 -2
- package/dist/main.mjs +23 -7
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -102,7 +102,7 @@ list should be an Array.`),M.length===0)return new w(0);if(M.length===1)return M
|
|
|
102
102
|
</defs>
|
|
103
103
|
<rect x="0" y="0" width="100%" height="100%" style="fill: #fff;" mask="url('#popoverArrowMask')" />
|
|
104
104
|
</svg>
|
|
105
|
-
`);`${window.btoa(k.value)}`;const P=o.computed(()=>`url('data:image/svg+xml;base64,${window.btoa(B.value)}')`),z=o.computed(()=>`url('data:image/svg+xml;base64,${window.btoa(k.value)}')`);return($,j)=>{var p,H,F,Z;return o.openBlock(),o.createElementBlock("div",{ref_key:"popoverWrapperRef",ref:i,class:o.normalizeClass(["popover-wrapper",{...Object.fromEntries(e.customClasses.map(L=>[L,!0])),"no-pointer-events":e.noPointerEvents}]),onClick:_,"data-bx-popover-id":e.bxPopoverId},[o.createElementVNode("div",{ref_key:"popoverElementRef",ref:s,class:"popover-element",style:o.normalizeStyle({...o.unref(f),...e.styles,"--rel-origin-x":(p=w.value)==null?void 0:p.x,"--rel-origin-y":(H=w.value)==null?void 0:H.y,"--arrow-mask-image":P.value}),onClick:E,onMouseenter:x,onMouseleave:S},[o.createElementVNode("div",{ref_key:"popoverFrameWrapperRef",ref:d,class:o.normalizeClass(["popover-frame-wrapper",{arrow:e.arrow,"overflow-visible":e.overflowVisible,[`placement-${o.unref(m)}`]:!0}]),"data-origin":C.value,"data-placement":o.unref(m),style:o.normalizeStyle({"transform-origin":`${(((F=w.value)==null?void 0:F.x)??0)*100}% ${(((Z=w.value)==null?void 0:Z.y)??0)*100}%`,"max-height":`calc(100vh - ${o.unref(h)}px - 20px)`})},[o.createElementVNode("div",{class:o.normalizeClass(["arrow-element",{["placement-"+o.unref(m)]:!0}])},[o.createElementVNode("div",{class:"arrow-symbol",style:o.normalizeStyle({"mask-image":P.value})},null,4),o.createElementVNode("div",{class:"arrow-border",style:o.normalizeStyle({"mask-image":z.value})},null,4)],2),o.createElementVNode("div",{class:"popover-frame",style:o.normalizeStyle({"max-height":`min(${e.popoverMaxHeight??"100vh"}, calc(100vh - ${o.unref(h)}px - 20px))`})},[o.createElementVNode("div",oW,[o.renderSlot($.$slots,"default",{},void 0,!0)])],4)],14,aW)],36)],10,rW)}}}),oC=Je(lW,[["__scopeId","data-v-148f949a"]]),iC=300,qb=300;window.addEventListener("load",()=>{var t;const e=document.querySelector(Is);e&&(e.classList.add("bluepic-popup-app-wrapper"),(t=e.parentElement)==null||t.classList.add("bluepic-popup-body"))});function ju(e){const t=window.bluepicPopupProvider,n=e.capturedContext||_l(),r=Fn();function a(){t.messageProviderRef.pull(r)}const i=e.keepOnHover??!0,s=e.closeAfter??5e3;let d=null,l=s,c=0;function f(){l<=0||s<=0||(c=Date.now(),d=setTimeout(a,l))}function m(){d!==null&&(clearTimeout(d),d=null,l-=Date.now()-c,l<0&&(l=0))}function u(){f()}return t.messageProviderRef.push(r,()=>o.h(cH,{type:e.type,title:typeof e.title=="string"?e.title:void 0,message:typeof e.message=="string"?e.message:void 0,closeable:e.closeable??!0,customClasses:e.customClasses??[],maxWidth:e.maxWidth,capturedContext:n,onClose:a,showIcon:e.showIcon,...i?{onMouseenter:m,onMouseleave:u}:{}},{title:typeof e.title=="function"?e.title:void 0,message:typeof e.message=="function"?e.message:void 0,icon:e.icon}),{placement:e.placement??"top-right"}),f(),{close:a}}function c0(e){const t=window.bluepicPopupProvider,n=e.capturedContext||_l(),r=Fn();let a=!1;const i=()=>{var l;a||(a=!0,(l=e.onClose)==null||l.call(e))},s=o.computed({get(){return t.overlayProviderRef.isVisible(r)},set(l){l?t.overlayProviderRef.pushPopup(r,()=>o.h(Wx,{type:e.type??"frame",title:typeof e.title=="string"?e.title:void 0,fullscreen:!1,closeable:e.closeable??!0,transculent:e.transculent??!1,customClasses:e.customClasses??[],fullLayer:e.fullLayer??!1,draggable:e.draggable??!0,drawerPlacement:e.drawerPlacement,drawerWidth:e.drawerWidth,drawerHeight:e.drawerHeight,capturedContext:n},{default:()=>o.h("div",{},[typeof e.content=="string"?e.content:e.content(),...e.actions?typeof e.actions=="function"?(()=>{const c=e.actions();return Array.isArray(c)?c:[c]})():[o.h("div",{},e.actions.map(c=>o.h(yt,{...c.props},{icon:c.icon,default:()=>c.label})))]:[]]),title:typeof e.title=="function"?e.title:void 0,"header-actions":e.headerActions?e.headerActions():void 0,icon:e.icon,"close-btn":e.closeBtn}),{type:e.type??"frame",close(){s.value=!1},disableBackgroundEffect:e.disableBackgroundEffect??!1,wrapperCustomClasses:e.wrapperCustomClasses??[],handleClickOutside(){s.value=!1},drawerPlacement:e.drawerPlacement,transitionDuration:e.transitionDuration??iC,role:"popup",trapFocus:e.trapFocus??!0}):(t.overlayProviderRef.pull(r),i())}});function d(){s.value=!1}return s.value=!0,{close:d}}const cW={success:Db,error:Mb,warning:Fb,info:Sd};function uW(e){const t=e.capturedContext||_l(),n=e.closeOnAction??!0,r=o.ref({positive:!1,negative:!1}),{close:a}=c0({type:"frame",closeable:e.closeable??!0,draggable:e.draggable??!0,disableBackgroundEffect:e.disableBackgroundEffect??!0,customClasses:["bx-dialog",...e.customClasses??[]],wrapperCustomClasses:e.wrapperCustomClasses,capturedContext:t,title:e.title,icon:e.icon??(e.type?()=>o.h(cW[e.type]):void 0),content:()=>{const i=[];return e.content&&i.push(o.h("div",{class:"bx-dialog-content popup-no-drag"},[typeof e.content=="function"?e.content():e.content])),(e.action||e.positiveText||e.negativeText)&&i.push(o.h("div",{class:"bx-dialog-actions popup-no-drag",style:"display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;"},[e.action?e.action():[e.negativeText?o.h(yt,{secondary:!1,...e.negativeButtonProps??{},loading:r.value.negative,onClick:async()=>{if(e.onNegativeClick){r.value.negative=!0;try{if(await e.onNegativeClick()===!1)return}finally{r.value.negative=!1}}n&&a()}},{default:()=>e.negativeText}):null,e.positiveText?o.h(yt,{active:!0,...e.positiveButtonProps??{},loading:r.value.positive,onClick:async()=>{if(e.onPositiveClick){r.value.positive=!0;try{if(await e.onPositiveClick()===!1)return}finally{r.value.positive=!1}}n&&a()}},{default:()=>e.positiveText}):null]])),i}});return{close:a}}function dW(e){return c0({type:"drawer",title:e.title,closeable:e.closeable??!0,content:e.content,drawerPlacement:e.placement??"right",drawerWidth:e.width,drawerHeight:e.height,disableBackgroundEffect:e.disableBackgroundEffect,customClasses:e.customClasses,wrapperCustomClasses:e.wrapperCustomClasses,capturedContext:e.capturedContext})}function fW(e,t,n,r){return{getBoundingClientRect(){return{x:e,y:t,width:n,height:r,top:t,left:e,right:e+n,bottom:t+r,toJSON(){return this}}}}}function pW(e){const t=window.bluepicPopupProvider,n=e.capturedContext||_l(),r=Fn(),a=e.floatingElement??(e.x!==void 0&&e.y!==void 0?fW(e.x,e.y,e.width??0,e.height??0):void 0),i=o.computed({get(){return t.overlayProviderRef.isVisible(r)},set(d){d?t.overlayProviderRef.pushPopover(r,()=>o.h(oC,{floatingElement:a,styles:{...e.customStyles},floatingPadding:e.floatingPadding??0,customClasses:e.customClasses??[],onClose(){i.value=!1},arrow:e.arrow??!0,allowedPlacements:e.allowedPlacements??["top","right","bottom","left","top-start","top-end","right-start","right-end","bottom-start","bottom-end","left-start","left-end"],bxPopoverId:r,noPointerEvents:e.noPointerEvents??!1,scrollPassthrough:e.scrollPassthrough??!(e.darkenBackground??!0),overflowVisible:e.overflowVisible??!1,capturedContext:n},{default:()=>e.content()}),{darkenBackground:e.darkenBackground??!0,handleClickOutside(){e.closeOnClickOutside&&(i.value=!1)},transitionDuration:e.transitionDuration??qb,role:"popover",close(){i.value=!1}}):t.overlayProviderRef.pull(r)}});function s(){i.value=!1}return i.value=!0,{close:s}}function Kp(){const e=_l();return{createPopup:(t,n)=>(console.log("createPopup",t,e),c0({...t,capturedContext:{...e,...n}})),createDialog:t=>uW({...t,capturedContext:e}),createMessage:t=>ju({...t,capturedContext:e}),createPopover:t=>pW({...t,capturedContext:e}),createDrawer:t=>dW({...t,capturedContext:e})}}function sC(e){const t=window.bluepicPopupProvider,n=Fn();return t.overlayProviderRef.pushPopover(n,()=>o.h("div",{},e()),{darkenBackground:!1,handleClickOutside(){},transitionDuration:qb,role:"popover",trapFocus:!0,close(){t.overlayProviderRef.pull(n)}}),{destroy:()=>{t.overlayProviderRef.pull(n)}}}const mW={key:0,class:"bx-progress__circle"},hW={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100"},gW=["d"],vW={class:"bx-progress__bar-inner"},bW=o.defineComponent({__name:"BxProgress",props:{value:{},circle:{type:Boolean,default:!1},transition:{type:Boolean,default:!0}},setup(e){const t=e;function n(a,i,s=0,d=0){a=Math.max(0,Math.min(100,a));const l=a/100*360,c=(l-90)*(Math.PI/180),f=s+i*Math.cos(c),m=d+i*Math.sin(c),u=l>180?1:0;return[`M ${s} ${d-i}`,`A ${i} ${i} 0 ${u} 1 ${f} ${m}`].join(" ")}const r=o.computed(()=>t.value!==void 0?n(t.value*100,45,50,50):"");return(a,i)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-progress",{circle:e.circle}])},[e.circle?(o.openBlock(),o.createElementBlock("div",mW,[(o.openBlock(),o.createElementBlock("svg",hW,[o.createElementVNode("path",{d:r.value,class:"circle-progress-path"},null,8,gW)]))])):(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["bx-progress__bar",{circle:e.circle}]),style:o.normalizeStyle({"--progress":e.value})},[o.createElementVNode("div",vW,[o.createElementVNode("div",{class:o.normalizeClass(["bx-progress__bar-fill",{transition:e.transition}])},null,2)])],6))],2))}}),u0=Je(bW,[["__scopeId","data-v-223c9a98"]]);function Jp(e){let t=[];const n=o.ref([]),r=o.computed(()=>{const i=e();return Array.isArray(i)?i:[i]}),a=i=>s=>{const d=(()=>{if(s instanceof HTMLElement)return s;if(s instanceof Node)return s.nextSibling;if((s==null?void 0:s.$el)instanceof HTMLElement)return s.$el})();d&&(t[i]=d)};return o.watch(r,()=>{t=[],o.nextTick(()=>{n.value=t})},{immediate:!0}),{setSlotRef:a,slotElements:n,vNodes:r}}const zl=o.defineComponent({__name:"Popup",props:{trigger:{default:"click"},type:{default:"layer"},title:{},fullscreen:{type:Boolean,default:!1},show:{type:Boolean,default:!1},closeable:{type:Boolean,default:!0},transculent:{type:Boolean,default:!1},customClasses:{default:()=>[]},wrapperCustomClasses:{default:()=>[]},fullLayer:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},disableBackgroundEffect:{type:Boolean,default:!1},drawerPlacement:{},drawerWidth:{},drawerHeight:{},debug:{type:Boolean,default:!1},transitionDuration:{},trapFocus:{type:Boolean,default:!0}},emits:["update:show"],setup(e,{emit:t}){const n=e,r=t,a=Fn(),i=o.useSlots(),{setSlotRef:s,slotElements:d,vNodes:l}=Jp(i.trigger),c=_l(),f=o.computed({get(){return u.overlayProviderRef.isVisible(a)},set(h){h?u.overlayProviderRef.pushPopup(a,()=>o.h(Wx,{type:n.type,title:n.title,fullscreen:n.fullscreen,transculent:n.transculent,customClasses:n.customClasses,closeable:n.closeable,fullLayer:n.fullLayer,draggable:n.draggable,drawerPlacement:n.drawerPlacement,drawerWidth:n.drawerWidth,drawerHeight:n.drawerHeight,capturedContext:c},{default:i.content,title:i.title,"header-actions":i["header-actions"],"close-btn":i["close-btn"]}),{type:n.type,close(){f.value=!1},disableBackgroundEffect:n.disableBackgroundEffect,wrapperCustomClasses:n.wrapperCustomClasses,handleClickOutside:()=>{f.value=!1},drawerPlacement:n.drawerPlacement,transitionDuration:n.transitionDuration??iC,role:"popup",trapFocus:n.trapFocus}):u.overlayProviderRef.pull(a),n.show!==h&&r("update:show",h)}});o.onUnmounted(()=>{u.overlayProviderRef.pull(a)}),o.watch(()=>n.show,()=>{n.show!==f.value&&(f.value=n.show)});function m(){f.value=!f.value}o.watch(d,()=>{for(const h of d.value)h.addEventListener("click",m)}),o.onUnmounted(()=>{for(const h of d.value)h.removeEventListener("click",m)});const u=window.bluepicPopupProvider;return o.onMounted(()=>{var g;const h=document.querySelector(Is);h&&(h.classList.add("bluepic-popup-app-wrapper"),(g=h.parentElement)==null||g.classList.add("bluepic-popup-body"))}),(h,g)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(l),(y,w)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(y),{ref_for:!0,ref:o.unref(s)(w)},null,512))),256))}}),yW={key:0,class:"bx-card__header"},wW={class:"bx-card__header-inner"},xW={key:1,class:"bx-card__title-wrapper"},CW={key:1},SW={key:0,class:"bx-card__header-extra"},kW={key:1,class:"bx-card__cover"},_W=["src"],EW={key:2,class:"bx-card__content"},zW={key:3,class:"bx-card__footer"},IW=o.defineComponent({__name:"BxCard",props:{title:{},description:{},cover:{},size:{default:"medium"},bordered:{type:Boolean,default:!1},transculent:{type:Boolean,default:!1},coverWidth:{},hoverable:{type:Boolean,default:!1},dividers:{type:Boolean,default:!0},state:{default:"default"}},setup(e){const t=o.useSlots();return(n,r)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-card",{bordered:e.bordered,transculent:e.transculent,["size-"+e.size]:!0,hoverable:e.hoverable,dividers:e.dividers,[`state-${e.state}`]:e.state!=="default"}])},[t.header||t.title||e.title?(o.openBlock(),o.createElementBlock("div",yW,[o.createElementVNode("div",wW,[t.header?o.renderSlot(n.$slots,"header",{},void 0,!0,0):(o.openBlock(),o.createElementBlock("div",xW,[t.title?o.renderSlot(n.$slots,"title",{},void 0,!0,0):e.title?(o.openBlock(),o.createElementBlock("h3",CW,o.toDisplayString(e.title),1)):o.createCommentVNode("",!0)]))]),t["header-extra"]?(o.openBlock(),o.createElementBlock("div",SW,[o.renderSlot(n.$slots,"header-extra",{},void 0,!0)])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),t.cover||e.cover?(o.openBlock(),o.createElementBlock("div",kW,[t.cover?o.renderSlot(n.$slots,"cover",{},void 0,!0,0):(o.openBlock(),o.createElementBlock("img",{key:1,src:e.cover,alt:"cover",style:o.normalizeStyle({"--cover-width":e.coverWidth})},null,12,_W))])):o.createCommentVNode("",!0),t.default?(o.openBlock(),o.createElementBlock("div",EW,[o.renderSlot(n.$slots,"default",{},void 0,!0)])):o.createCommentVNode("",!0),t.footer?(o.openBlock(),o.createElementBlock("div",zW,[o.renderSlot(n.$slots,"footer",{},void 0,!0)])):o.createCommentVNode("",!0)],2))}}),d0=Je(IW,[["__scopeId","data-v-3b4b80b4"]]),AW={class:"bx-upload"},BW=["tabindex","aria-label","aria-busy","aria-disabled"],LW={class:"bx-upload__icon-wrapper"},OW={class:"bx-upload__title"},PW={class:"bx-upload__description"},MW=o.defineComponent({__name:"BxUpload",props:{type:{},accept:{default:()=>["image/*"]},title:{default:"Upload"},description:{default:"Drag and drop files here or click to upload"},uploadProgress:{},maxSize:{default:1/0},ariaLabel:{}},emits:["select"],setup(e,{emit:t}){const n=e,r=t,a=o.useSlots(),i=o.ref(!1);function s(h){h.preventDefault(),h.stopPropagation()}function d(h){h.preventDefault(),h.stopPropagation(),i.value=!0}function l(h){h.preventDefault(),h.stopPropagation()}function c(h){h.preventDefault(),h.stopPropagation(),i.value=!1}async function f(h){h.preventDefault(),h.stopPropagation(),i.value=!1;const g=Array.from(h.dataTransfer.files).filter(y=>{const[w,x]=y.type.split("/");return n.accept.some(S=>{const[C,E]=S.split("/");return(C==="*"||C===w)&&(E==="*"||E===x)})});r("select",g)}function m(h){n.uploadProgress===void 0&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),u())}async function u(){if(n.uploadProgress!==void 0)return;const h=await Pb({types:n.accept,maxSize:n.maxSize,multiple:!0});r("select",h)}return(h,g)=>(o.openBlock(),o.createElementBlock("div",AW,[e.type==="area"?(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(["bx-upload__area",{dragging:i.value}]),role:"button",tabindex:e.uploadProgress!==void 0?-1:0,"aria-label":e.ariaLabel,"aria-busy":e.uploadProgress!==void 0?"true":void 0,"aria-disabled":e.uploadProgress!==void 0?"true":void 0,onDragstart:s,onDragenter:d,onDragover:l,onDragleave:c,onDrop:f,onClick:u,onKeydown:m},[o.createElementVNode("div",LW,[e.uploadProgress!==void 0?(o.openBlock(),o.createBlock(u0,{key:0,value:e.uploadProgress,circle:"",size:"medium"},null,8,["value"])):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[a.icon?o.renderSlot(h.$slots,"icon",{},void 0,!0,0):(o.openBlock(),o.createBlock(o.unref(U7),{key:1}))],64))]),o.createElementVNode("div",OW,[e.uploadProgress!==void 0?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createTextVNode(" Uploading ")],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[a.title?o.renderSlot(h.$slots,"title",{},void 0,!0,0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(e.title),1)],64))],64))]),o.createElementVNode("div",PW,[e.uploadProgress!==void 0?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createTextVNode(o.toDisplayString(o.unref(Ya)(e.uploadProgress*100,5))+"% ",1)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[a.description?o.renderSlot(h.$slots,"description",{},void 0,!0,0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(e.description),1)],64))],64))])],42,BW)):e.type==="button"?(o.openBlock(),o.createBlock(yt,{key:1,accept:e.accept,onClick:u},{icon:o.withCtx(()=>[a.icon?o.renderSlot(h.$slots,"icon",{},void 0,!0,0):(o.openBlock(),o.createBlock(o.unref(U7),{key:1}))]),default:o.withCtx(()=>[g[0]||(g[0]=o.createTextVNode(" Upload ",-1))]),_:3},8,["accept"])):o.createCommentVNode("",!0)]))}}),lC=Je(MW,[["__scopeId","data-v-3e51d474"]]),TW={class:"image-library-upload"},DW={class:"upload-progress-wrapper"},$W=o.defineComponent({__name:"Upload",props:{width:{},height:{},quality:{},convertTo:{},field:{},handleUpload:{type:Function}},emits:["upload"],setup(e,{emit:t}){const n=e,r=t,{uploadFiles:a,uploadProgresses:i,uploading:s}=yp(o.toRef(n,"width"),o.toRef(n,"height"),o.toRef(n,"convertTo"),o.toRef(n,"quality"),n.handleUpload,o.toRef(n,"field")),d=o.computed(()=>{const c=Ya(i.value.reduce((f,m)=>f+m,0)/i.value.length,5);if(!isNaN(c))return c});async function l(c){const f=await a(c);r("upload",f)}return(c,f)=>(o.openBlock(),o.createElementBlock("div",TW,[o.createVNode(lC,{type:"area",onSelect:l,"upload-progress":d.value},null,8,["upload-progress"]),o.createElementVNode("div",DW,[o.unref(s)?(o.openBlock(),o.createBlock(u0,{key:0,value:d.value},null,8,["value"])):o.createCommentVNode("",!0)])]))}}),NW=Je($W,[["__scopeId","data-v-73dc9b99"]]),r8=Object.getPrototypeOf,a8=Object.getOwnPropertySymbols?function(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}:Object.keys;function Ru(e,t,n){var r,a,i,s=Object.prototype.toString.call(e),d=Object.prototype.toString.call(t);if(e===t)return!0;if(e==null||t==null)return!1;if(n.indexOf(e)>-1&&n.indexOf(t)>-1)return!0;if(n.push(e,t),s!=d||(r=a8(e),a=a8(t),r.length!=a.length||r.some(function(l){return!Ru(e[l],t[l],n)})))return!1;switch(s.slice(8,-1)){case"Symbol":return e.valueOf()==t.valueOf();case"Date":case"Number":return+e==+t||+e!=+e&&+t!=+t;case"RegExp":case"Function":case"String":case"Boolean":return""+e==""+t;case"Set":case"Map":{r=e.entries(),a=t.entries();do if(i=r.next(),!Ru(i.value,a.next().value,n))return!1;while(!i.done);return!0}case"ArrayBuffer":e=new Uint8Array(e),t=new Uint8Array(t);case"DataView":e=new Uint8Array(e.buffer),t=new Uint8Array(t.buffer);case"Float32Array":case"Float64Array":case"Int8Array":case"Int16Array":case"Int32Array":case"Uint8Array":case"Uint16Array":case"Uint32Array":case"Uint8ClampedArray":case"Arguments":case"Array":if(e.length!=t.length)return!1;for(i=0;i<e.length;i++)if(!(!(i in e)&&!(i in t))&&(i in e!=i in t||!Ru(e[i],t[i],n)))return!1;return!0;case"Object":return Ru(r8(e),r8(t),n);default:return!1}}function vr(e,t){return Ru(e,t,[])}function ys(e){return structuredClone(o.toRaw(e))}function o8({text:e,format:t},...n){return{text:e.slice(...n),format:t}}function Y1(e){const t=[[]];let n=0;for(;n in e;){const r=t.length-1,a=e[n],i=a.text.search(`
|
|
105
|
+
`);`${window.btoa(k.value)}`;const P=o.computed(()=>`url('data:image/svg+xml;base64,${window.btoa(B.value)}')`),z=o.computed(()=>`url('data:image/svg+xml;base64,${window.btoa(k.value)}')`);return($,j)=>{var p,H,F,Z;return o.openBlock(),o.createElementBlock("div",{ref_key:"popoverWrapperRef",ref:i,class:o.normalizeClass(["popover-wrapper",{...Object.fromEntries(e.customClasses.map(L=>[L,!0])),"no-pointer-events":e.noPointerEvents}]),onClick:_,"data-bx-popover-id":e.bxPopoverId},[o.createElementVNode("div",{ref_key:"popoverElementRef",ref:s,class:"popover-element",style:o.normalizeStyle({...o.unref(f),...e.styles,"--rel-origin-x":(p=w.value)==null?void 0:p.x,"--rel-origin-y":(H=w.value)==null?void 0:H.y,"--arrow-mask-image":P.value}),onClick:E,onMouseenter:x,onMouseleave:S},[o.createElementVNode("div",{ref_key:"popoverFrameWrapperRef",ref:d,class:o.normalizeClass(["popover-frame-wrapper",{arrow:e.arrow,"overflow-visible":e.overflowVisible,[`placement-${o.unref(m)}`]:!0}]),"data-origin":C.value,"data-placement":o.unref(m),style:o.normalizeStyle({"transform-origin":`${(((F=w.value)==null?void 0:F.x)??0)*100}% ${(((Z=w.value)==null?void 0:Z.y)??0)*100}%`,"max-height":`calc(100vh - ${o.unref(h)}px - 20px)`})},[o.createElementVNode("div",{class:o.normalizeClass(["arrow-element",{["placement-"+o.unref(m)]:!0}])},[o.createElementVNode("div",{class:"arrow-symbol",style:o.normalizeStyle({"mask-image":P.value})},null,4),o.createElementVNode("div",{class:"arrow-border",style:o.normalizeStyle({"mask-image":z.value})},null,4)],2),o.createElementVNode("div",{class:"popover-frame",style:o.normalizeStyle({"max-height":`min(${e.popoverMaxHeight??"100vh"}, calc(100vh - ${o.unref(h)}px - 20px))`})},[o.createElementVNode("div",oW,[o.renderSlot($.$slots,"default",{},void 0,!0)])],4)],14,aW)],36)],10,rW)}}}),oC=Je(lW,[["__scopeId","data-v-148f949a"]]),iC=300,qb=300;window.addEventListener("load",()=>{var t;const e=document.querySelector(Is);e&&(e.classList.add("bluepic-popup-app-wrapper"),(t=e.parentElement)==null||t.classList.add("bluepic-popup-body"))});function ju(e){const t=window.bluepicPopupProvider,n=e.capturedContext||_l(),r=Fn();function a(){t.messageProviderRef.pull(r)}const i=e.keepOnHover??!0,s=e.closeAfter??5e3;let d=null,l=s,c=0;function f(){l<=0||s<=0||(c=Date.now(),d=setTimeout(a,l))}function m(){d!==null&&(clearTimeout(d),d=null,l-=Date.now()-c,l<0&&(l=0))}function u(){f()}return t.messageProviderRef.push(r,()=>o.h(cH,{type:e.type,title:typeof e.title=="string"?e.title:void 0,message:typeof e.message=="string"?e.message:void 0,closeable:e.closeable??!0,customClasses:e.customClasses??[],maxWidth:e.maxWidth,capturedContext:n,onClose:a,showIcon:e.showIcon,...i?{onMouseenter:m,onMouseleave:u}:{}},{title:typeof e.title=="function"?e.title:void 0,message:typeof e.message=="function"?e.message:void 0,icon:e.icon}),{placement:e.placement??"top-right"}),f(),{close:a}}function c0(e){const t=window.bluepicPopupProvider,n=e.capturedContext||_l(),r=Fn();let a=!1;const i=()=>{var l;a||(a=!0,(l=e.onClose)==null||l.call(e))},s=o.computed({get(){return t.overlayProviderRef.isVisible(r)},set(l){l?t.overlayProviderRef.pushPopup(r,()=>o.h(Wx,{type:e.type??"frame",title:typeof e.title=="string"?e.title:void 0,fullscreen:!1,closeable:e.closeable??!0,transculent:e.transculent??!1,customClasses:e.customClasses??[],fullLayer:e.fullLayer??!1,draggable:e.draggable??!0,drawerPlacement:e.drawerPlacement,drawerWidth:e.drawerWidth,drawerHeight:e.drawerHeight,capturedContext:n},{default:()=>o.h("div",{},[typeof e.content=="string"?e.content:e.content(),...e.actions?typeof e.actions=="function"?(()=>{const c=e.actions();return Array.isArray(c)?c:[c]})():[o.h("div",{},e.actions.map(c=>o.h(yt,{...c.props},{icon:c.icon,default:()=>c.label})))]:[]]),title:typeof e.title=="function"?e.title:void 0,"header-actions":e.headerActions?e.headerActions():void 0,icon:e.icon,"close-btn":e.closeBtn}),{type:e.type??"frame",close(){s.value=!1},disableBackgroundEffect:e.disableBackgroundEffect??!1,wrapperCustomClasses:e.wrapperCustomClasses??[],handleClickOutside(){s.value=!1},drawerPlacement:e.drawerPlacement,transitionDuration:e.transitionDuration??iC,role:"popup",trapFocus:e.trapFocus??!0}):(t.overlayProviderRef.pull(r),i())}});function d(){s.value=!1}return s.value=!0,{close:d}}const cW={success:Db,error:Mb,warning:Fb,info:Sd};function uW(e){const t=e.capturedContext||_l(),n=e.closeOnAction??!0,r=o.ref({positive:!1,negative:!1}),{close:a}=c0({type:"frame",closeable:e.closeable??!0,draggable:e.draggable??!0,disableBackgroundEffect:e.disableBackgroundEffect??!0,customClasses:["bx-dialog",...e.customClasses??[]],wrapperCustomClasses:e.wrapperCustomClasses,capturedContext:t,title:e.title,icon:e.icon??(e.type?()=>o.h(cW[e.type]):void 0),content:()=>{const i=[];return e.content&&i.push(o.h("div",{class:"bx-dialog-content popup-no-drag"},[typeof e.content=="function"?e.content():e.content])),(e.action||e.positiveText||e.negativeText)&&i.push(o.h("div",{class:"bx-dialog-actions popup-no-drag",style:"display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;"},[e.action?e.action():[e.negativeText?o.h(yt,{secondary:!1,...e.negativeButtonProps??{},loading:r.value.negative,onClick:async()=>{if(e.onNegativeClick){r.value.negative=!0;try{if(await e.onNegativeClick()===!1)return}finally{r.value.negative=!1}}n&&a()}},{default:()=>e.negativeText}):null,e.positiveText?o.h(yt,{active:!0,...e.positiveButtonProps??{},loading:r.value.positive,onClick:async()=>{if(e.onPositiveClick){r.value.positive=!0;try{if(await e.onPositiveClick()===!1)return}finally{r.value.positive=!1}}n&&a()}},{default:()=>e.positiveText}):null]])),i}});return{close:a}}function dW(e){return c0({type:"drawer",title:e.title,closeable:e.closeable??!0,content:e.content,drawerPlacement:e.placement??"right",drawerWidth:e.width,drawerHeight:e.height,disableBackgroundEffect:e.disableBackgroundEffect,customClasses:e.customClasses,wrapperCustomClasses:e.wrapperCustomClasses,capturedContext:e.capturedContext})}function fW(e,t,n,r){return{getBoundingClientRect(){return{x:e,y:t,width:n,height:r,top:t,left:e,right:e+n,bottom:t+r,toJSON(){return this}}}}}function pW(e){const t=window.bluepicPopupProvider,n=e.capturedContext||_l(),r=Fn(),a=e.floatingElement??(e.x!==void 0&&e.y!==void 0?fW(e.x,e.y,e.width??0,e.height??0):void 0),i=o.computed({get(){return t.overlayProviderRef.isVisible(r)},set(d){d?t.overlayProviderRef.pushPopover(r,()=>o.h(oC,{floatingElement:a,styles:{...e.customStyles},floatingPadding:e.floatingPadding??0,customClasses:e.customClasses??[],onClose(){i.value=!1},arrow:e.arrow??!0,allowedPlacements:e.allowedPlacements??["top","right","bottom","left","top-start","top-end","right-start","right-end","bottom-start","bottom-end","left-start","left-end"],bxPopoverId:r,noPointerEvents:e.noPointerEvents??!1,scrollPassthrough:e.scrollPassthrough??!(e.darkenBackground??!0),overflowVisible:e.overflowVisible??!1,capturedContext:n},{default:()=>e.content()}),{darkenBackground:e.darkenBackground??!0,handleClickOutside(){e.closeOnClickOutside&&(i.value=!1)},transitionDuration:e.transitionDuration??qb,role:"popover",close(){i.value=!1}}):t.overlayProviderRef.pull(r)}});function s(){i.value=!1}return i.value=!0,{close:s}}function Kp(){const e=_l();return{createPopup:(t,n)=>(console.log("createPopup",t,e),c0({...t,capturedContext:{...e,...n}})),createDialog:t=>uW({...t,capturedContext:e}),createMessage:t=>ju({...t,capturedContext:e}),createPopover:t=>pW({...t,capturedContext:e}),createDrawer:t=>dW({...t,capturedContext:e})}}function sC(e){const t=window.bluepicPopupProvider,n=Fn();return t.overlayProviderRef.pushPopover(n,()=>o.h("div",{},e()),{darkenBackground:!1,handleClickOutside(){},transitionDuration:qb,role:"popover",trapFocus:!0,close(){t.overlayProviderRef.pull(n)}}),{destroy:()=>{t.overlayProviderRef.pull(n)}}}const mW={key:0,class:"bx-progress__circle"},hW={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 100 100"},gW=["d"],vW={class:"bx-progress__bar-inner"},bW=o.defineComponent({__name:"BxProgress",props:{value:{},circle:{type:Boolean,default:!1},transition:{type:Boolean,default:!0}},setup(e){const t=e;function n(a,i,s=0,d=0){a=Math.max(0,Math.min(100,a));const l=a/100*360,c=(l-90)*(Math.PI/180),f=s+i*Math.cos(c),m=d+i*Math.sin(c),u=l>180?1:0;return[`M ${s} ${d-i}`,`A ${i} ${i} 0 ${u} 1 ${f} ${m}`].join(" ")}const r=o.computed(()=>t.value!==void 0?n(t.value*100,45,50,50):"");return(a,i)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-progress",{circle:e.circle}])},[e.circle?(o.openBlock(),o.createElementBlock("div",mW,[(o.openBlock(),o.createElementBlock("svg",hW,[o.createElementVNode("path",{d:r.value,class:"circle-progress-path"},null,8,gW)]))])):(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["bx-progress__bar",{circle:e.circle}]),style:o.normalizeStyle({"--progress":e.value})},[o.createElementVNode("div",vW,[o.createElementVNode("div",{class:o.normalizeClass(["bx-progress__bar-fill",{transition:e.transition}])},null,2)])],6))],2))}}),u0=Je(bW,[["__scopeId","data-v-223c9a98"]]);function Jp(e){let t=[];const n=o.ref([]),r=o.computed(()=>{const i=e();return Array.isArray(i)?i:[i]}),a=i=>s=>{const d=(()=>{if(s instanceof HTMLElement)return s;if(s instanceof Node)return s.nextSibling;if((s==null?void 0:s.$el)instanceof HTMLElement)return s.$el})();d&&(t[i]=d)};return o.watch(r,()=>{t=[],o.nextTick(()=>{n.value=t})},{immediate:!0}),{setSlotRef:a,slotElements:n,vNodes:r}}const zl=o.defineComponent({__name:"Popup",props:{trigger:{default:"click"},type:{default:"layer"},title:{},fullscreen:{type:Boolean,default:!1},show:{type:Boolean,default:!1},closeable:{type:Boolean,default:!0},transculent:{type:Boolean,default:!1},customClasses:{default:()=>[]},wrapperCustomClasses:{default:()=>[]},fullLayer:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},disableBackgroundEffect:{type:Boolean,default:!1},drawerPlacement:{},drawerWidth:{},drawerHeight:{},debug:{type:Boolean,default:!1},transitionDuration:{},trapFocus:{type:Boolean,default:!0}},emits:["update:show"],setup(e,{emit:t}){const n=e,r=t,a=Fn(),i=o.useSlots(),{setSlotRef:s,slotElements:d,vNodes:l}=Jp(i.trigger),c=_l(),f=o.computed({get(){return u.overlayProviderRef.isVisible(a)},set(h){h?u.overlayProviderRef.pushPopup(a,()=>o.h(Wx,{type:n.type,title:n.title,fullscreen:n.fullscreen,transculent:n.transculent,customClasses:n.customClasses,closeable:n.closeable,fullLayer:n.fullLayer,draggable:n.draggable,drawerPlacement:n.drawerPlacement,drawerWidth:n.drawerWidth,drawerHeight:n.drawerHeight,capturedContext:c},{default:i.content,title:i.title,"header-actions":i["header-actions"],"close-btn":i["close-btn"]}),{type:n.type,close(){f.value=!1},disableBackgroundEffect:n.disableBackgroundEffect,wrapperCustomClasses:n.wrapperCustomClasses,handleClickOutside:()=>{f.value=!1},drawerPlacement:n.drawerPlacement,transitionDuration:n.transitionDuration??iC,role:"popup",trapFocus:n.trapFocus}):u.overlayProviderRef.pull(a),n.show!==h&&r("update:show",h)}});o.onUnmounted(()=>{u.overlayProviderRef.pull(a)}),o.watch(()=>n.show,()=>{n.show!==f.value&&(f.value=n.show)});function m(){f.value=!f.value}o.watch(d,()=>{for(const h of d.value)h.addEventListener("click",m)}),o.onUnmounted(()=>{for(const h of d.value)h.removeEventListener("click",m)});const u=window.bluepicPopupProvider;return o.onMounted(()=>{var g;const h=document.querySelector(Is);h&&(h.classList.add("bluepic-popup-app-wrapper"),(g=h.parentElement)==null||g.classList.add("bluepic-popup-body"))}),(h,g)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(l),(y,w)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(y),{ref_for:!0,ref:o.unref(s)(w)},null,512))),256))}}),yW={key:0,class:"bx-card__header"},wW={class:"bx-card__header-inner"},xW={key:1,class:"bx-card__title-wrapper"},CW={key:1},SW={key:0,class:"bx-card__header-extra"},kW={key:1,class:"bx-card__cover"},_W=["src"],EW={key:2,class:"bx-card__content"},zW={key:3,class:"bx-card__footer"},IW=o.defineComponent({__name:"BxCard",props:{title:{},description:{},cover:{},size:{default:"medium"},bordered:{type:Boolean,default:!1},transculent:{type:Boolean,default:!1},coverWidth:{},hoverable:{type:Boolean,default:!1},dividers:{type:Boolean,default:!0},radius:{default:"md"},contentGap:{default:"none"},state:{default:"default"}},setup(e){const t=o.useSlots();return(n,r)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-card",{bordered:e.bordered,transculent:e.transculent,["size-"+e.size]:!0,hoverable:e.hoverable,dividers:e.dividers,[`radius-${e.radius}`]:!0,[`content-gap-${e.contentGap}`]:e.contentGap!=="none",[`state-${e.state}`]:e.state!=="default"}])},[t.header||t.title||e.title?(o.openBlock(),o.createElementBlock("div",yW,[o.createElementVNode("div",wW,[t.header?o.renderSlot(n.$slots,"header",{},void 0,!0,0):(o.openBlock(),o.createElementBlock("div",xW,[t.title?o.renderSlot(n.$slots,"title",{},void 0,!0,0):e.title?(o.openBlock(),o.createElementBlock("h3",CW,o.toDisplayString(e.title),1)):o.createCommentVNode("",!0)]))]),t["header-extra"]?(o.openBlock(),o.createElementBlock("div",SW,[o.renderSlot(n.$slots,"header-extra",{},void 0,!0)])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),t.cover||e.cover?(o.openBlock(),o.createElementBlock("div",kW,[t.cover?o.renderSlot(n.$slots,"cover",{},void 0,!0,0):(o.openBlock(),o.createElementBlock("img",{key:1,src:e.cover,alt:"cover",style:o.normalizeStyle({"--cover-width":e.coverWidth})},null,12,_W))])):o.createCommentVNode("",!0),t.default?(o.openBlock(),o.createElementBlock("div",EW,[o.renderSlot(n.$slots,"default",{},void 0,!0)])):o.createCommentVNode("",!0),t.footer?(o.openBlock(),o.createElementBlock("div",zW,[o.renderSlot(n.$slots,"footer",{},void 0,!0)])):o.createCommentVNode("",!0)],2))}}),d0=Je(IW,[["__scopeId","data-v-ba552816"]]),AW={class:"bx-upload"},BW=["tabindex","aria-label","aria-busy","aria-disabled"],LW={class:"bx-upload__icon-wrapper"},OW={class:"bx-upload__title"},PW={class:"bx-upload__description"},MW=o.defineComponent({__name:"BxUpload",props:{type:{},accept:{default:()=>["image/*"]},title:{default:"Upload"},description:{default:"Drag and drop files here or click to upload"},uploadProgress:{},maxSize:{default:1/0},ariaLabel:{}},emits:["select"],setup(e,{emit:t}){const n=e,r=t,a=o.useSlots(),i=o.ref(!1);function s(h){h.preventDefault(),h.stopPropagation()}function d(h){h.preventDefault(),h.stopPropagation(),i.value=!0}function l(h){h.preventDefault(),h.stopPropagation()}function c(h){h.preventDefault(),h.stopPropagation(),i.value=!1}async function f(h){h.preventDefault(),h.stopPropagation(),i.value=!1;const g=Array.from(h.dataTransfer.files).filter(y=>{const[w,x]=y.type.split("/");return n.accept.some(S=>{const[C,E]=S.split("/");return(C==="*"||C===w)&&(E==="*"||E===x)})});r("select",g)}function m(h){n.uploadProgress===void 0&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),u())}async function u(){if(n.uploadProgress!==void 0)return;const h=await Pb({types:n.accept,maxSize:n.maxSize,multiple:!0});r("select",h)}return(h,g)=>(o.openBlock(),o.createElementBlock("div",AW,[e.type==="area"?(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(["bx-upload__area",{dragging:i.value}]),role:"button",tabindex:e.uploadProgress!==void 0?-1:0,"aria-label":e.ariaLabel,"aria-busy":e.uploadProgress!==void 0?"true":void 0,"aria-disabled":e.uploadProgress!==void 0?"true":void 0,onDragstart:s,onDragenter:d,onDragover:l,onDragleave:c,onDrop:f,onClick:u,onKeydown:m},[o.createElementVNode("div",LW,[e.uploadProgress!==void 0?(o.openBlock(),o.createBlock(u0,{key:0,value:e.uploadProgress,circle:"",size:"medium"},null,8,["value"])):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[a.icon?o.renderSlot(h.$slots,"icon",{},void 0,!0,0):(o.openBlock(),o.createBlock(o.unref(U7),{key:1}))],64))]),o.createElementVNode("div",OW,[e.uploadProgress!==void 0?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createTextVNode(" Uploading ")],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[a.title?o.renderSlot(h.$slots,"title",{},void 0,!0,0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(e.title),1)],64))],64))]),o.createElementVNode("div",PW,[e.uploadProgress!==void 0?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createTextVNode(o.toDisplayString(o.unref(Ya)(e.uploadProgress*100,5))+"% ",1)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[a.description?o.renderSlot(h.$slots,"description",{},void 0,!0,0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(e.description),1)],64))],64))])],42,BW)):e.type==="button"?(o.openBlock(),o.createBlock(yt,{key:1,accept:e.accept,onClick:u},{icon:o.withCtx(()=>[a.icon?o.renderSlot(h.$slots,"icon",{},void 0,!0,0):(o.openBlock(),o.createBlock(o.unref(U7),{key:1}))]),default:o.withCtx(()=>[g[0]||(g[0]=o.createTextVNode(" Upload ",-1))]),_:3},8,["accept"])):o.createCommentVNode("",!0)]))}}),lC=Je(MW,[["__scopeId","data-v-3e51d474"]]),TW={class:"image-library-upload"},DW={class:"upload-progress-wrapper"},$W=o.defineComponent({__name:"Upload",props:{width:{},height:{},quality:{},convertTo:{},field:{},handleUpload:{type:Function}},emits:["upload"],setup(e,{emit:t}){const n=e,r=t,{uploadFiles:a,uploadProgresses:i,uploading:s}=yp(o.toRef(n,"width"),o.toRef(n,"height"),o.toRef(n,"convertTo"),o.toRef(n,"quality"),n.handleUpload,o.toRef(n,"field")),d=o.computed(()=>{const c=Ya(i.value.reduce((f,m)=>f+m,0)/i.value.length,5);if(!isNaN(c))return c});async function l(c){const f=await a(c);r("upload",f)}return(c,f)=>(o.openBlock(),o.createElementBlock("div",TW,[o.createVNode(lC,{type:"area",onSelect:l,"upload-progress":d.value},null,8,["upload-progress"]),o.createElementVNode("div",DW,[o.unref(s)?(o.openBlock(),o.createBlock(u0,{key:0,value:d.value},null,8,["value"])):o.createCommentVNode("",!0)])]))}}),NW=Je($W,[["__scopeId","data-v-73dc9b99"]]),r8=Object.getPrototypeOf,a8=Object.getOwnPropertySymbols?function(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}:Object.keys;function Ru(e,t,n){var r,a,i,s=Object.prototype.toString.call(e),d=Object.prototype.toString.call(t);if(e===t)return!0;if(e==null||t==null)return!1;if(n.indexOf(e)>-1&&n.indexOf(t)>-1)return!0;if(n.push(e,t),s!=d||(r=a8(e),a=a8(t),r.length!=a.length||r.some(function(l){return!Ru(e[l],t[l],n)})))return!1;switch(s.slice(8,-1)){case"Symbol":return e.valueOf()==t.valueOf();case"Date":case"Number":return+e==+t||+e!=+e&&+t!=+t;case"RegExp":case"Function":case"String":case"Boolean":return""+e==""+t;case"Set":case"Map":{r=e.entries(),a=t.entries();do if(i=r.next(),!Ru(i.value,a.next().value,n))return!1;while(!i.done);return!0}case"ArrayBuffer":e=new Uint8Array(e),t=new Uint8Array(t);case"DataView":e=new Uint8Array(e.buffer),t=new Uint8Array(t.buffer);case"Float32Array":case"Float64Array":case"Int8Array":case"Int16Array":case"Int32Array":case"Uint8Array":case"Uint16Array":case"Uint32Array":case"Uint8ClampedArray":case"Arguments":case"Array":if(e.length!=t.length)return!1;for(i=0;i<e.length;i++)if(!(!(i in e)&&!(i in t))&&(i in e!=i in t||!Ru(e[i],t[i],n)))return!1;return!0;case"Object":return Ru(r8(e),r8(t),n);default:return!1}}function vr(e,t){return Ru(e,t,[])}function ys(e){return structuredClone(o.toRaw(e))}function o8({text:e,format:t},...n){return{text:e.slice(...n),format:t}}function Y1(e){const t=[[]];let n=0;for(;n in e;){const r=t.length-1,a=e[n],i=a.text.search(`
|
|
106
106
|
`);if(i>-1){const s=o8(a,0,i),d=o8(a,i+1);t[r].push(s);const l=Y1([d]);for(const c of l)t.push(c)}else t[r].push(e[n]);n++}return t.map(r=>r.filter((a,i)=>{i===0&&r.length;const s=i===r.length-1&&r.slice(0,i).every(d=>d.text==="");return a.text!==""||s}))}function Hb(e){var a;const t=[];let n=0;for(const i of ys(e)){for(const s of i)t.push(s);n<e.length-1&&t[t.length-1]&&(t[t.length-1].text+=`
|
|
107
107
|
`),n++}const r=[];{let i=0;for(;i<t.length;){const s={text:"",format:ys(t[i].format)};for(;vr((a=t[i])==null?void 0:a.format,s.format);)s.text+=t[i].text,i++;r.push(s)}}return r}function i8(e,t,n){return e.map(({text:r,format:a},i)=>{const s=e.slice(0,i).reduce((l,{text:c})=>l+c.length,0),d=s+r.length;return{text:t<d&&s<n?r.slice(Math.max(t-s,0),n-s):"",format:a}}).filter(({text:r})=>r.length>0)}function K1(e){return(e[0]instanceof Array?Hb(e):e).reduce((n,r)=>n+r.text,"")}function cC(e){return typeof e=="string"?[{text:e,format:{}}]:typeof e=="boolean"?[{text:e?"true":"false",format:{}}]:typeof e=="number"?[{text:e.toString(),format:{}}]:e}const Ng={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(const e in Ng)Object.freeze(Ng[e]);const Io=Object.freeze(Ng),uC=Object.create(null);for(const e in Io)Object.hasOwn(Io,e)&&(uC[Io[e]]=e);const tr={to:{},get:{}};tr.get=function(e){const t=e.slice(0,3).toLowerCase();let n,r;switch(t){case"hsl":{n=tr.get.hsl(e),r="hsl";break}case"hwb":{n=tr.get.hwb(e),r="hwb";break}default:{n=tr.get.rgb(e),r="rgb";break}}return n?{model:r,value:n}:null};tr.get.rgb=function(e){if(!e)return null;const t=/^#([a-f\d]{3,4})$/i,n=/^#([a-f\d]{6})([a-f\d]{2})?$/i,r=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,a=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,i=/^(\w+)$/;let s=[0,0,0,1],d,l,c;if(d=e.match(n)){for(c=d[2],d=d[1],l=0;l<3;l++){const f=l*2;s[l]=Number.parseInt(d.slice(f,f+2),16)}c&&(s[3]=Number.parseInt(c,16)/255)}else if(d=e.match(t)){for(d=d[1],c=d[3],l=0;l<3;l++)s[l]=Number.parseInt(d[l]+d[l],16);c&&(s[3]=Number.parseInt(c+c,16)/255)}else if(d=e.match(r)){for(l=0;l<3;l++)s[l]=Number.parseFloat(d[l+1]);d[4]&&(s[3]=d[5]?Number.parseFloat(d[4])*.01:Number.parseFloat(d[4]))}else if(d=e.match(a)){for(l=0;l<3;l++)s[l]=Math.round(Number.parseFloat(d[l+1])*2.55);d[4]&&(s[3]=d[5]?Number.parseFloat(d[4])*.01:Number.parseFloat(d[4]))}else return(d=e.toLowerCase().match(i))?d[1]==="transparent"?[0,0,0,0]:Object.hasOwn(Io,d[1])?(s=Io[d[1]].slice(),s[3]=1,s):null:null;for(l=0;l<3;l++)s[l]=cs(s[l],0,255);return s[3]=cs(s[3],0,1),s};tr.get.hsl=function(e){if(!e)return null;const t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,n=e.match(t);if(n){const r=Number.parseFloat(n[4]),a=(Number.parseFloat(n[1])%360+360)%360,i=cs(Number.parseFloat(n[2]),0,100),s=cs(Number.parseFloat(n[3]),0,100),d=cs(Number.isNaN(r)?1:r,0,1);return[a,i,s,d]}return null};tr.get.hwb=function(e){if(!e)return null;const t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,n=e.match(t);if(n){const r=Number.parseFloat(n[4]),a=(Number.parseFloat(n[1])%360+360)%360,i=cs(Number.parseFloat(n[2]),0,100),s=cs(Number.parseFloat(n[3]),0,100),d=cs(Number.isNaN(r)?1:r,0,1);return[a,i,s,d]}return null};tr.to.hex=function(...e){return"#"+Lf(e[0])+Lf(e[1])+Lf(e[2])+(e[3]<1?Lf(Math.round(e[3]*255)):"")};tr.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};tr.to.rgb.percent=function(...e){const t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),r=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+n+"%, "+r+"%)":"rgba("+t+"%, "+n+"%, "+r+"%, "+e[3]+")"};tr.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};tr.to.hwb=function(...e){let t="";return e.length>=4&&e[3]!==1&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};tr.to.keyword=function(...e){return uC[e.slice(0,3)]};function cs(e,t,n){return Math.min(Math.max(t,e),n)}function Lf(e){const t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}const dC={};for(const e of Object.keys(Io))dC[Io[e]]=e;const dt={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},di=(6/29)**3;function xc(e){const t=e>.0031308?1.055*e**.4166666666666667-.055:e*12.92;return Math.min(Math.max(0,t),1)}function Cc(e){return e>.04045?((e+.055)/1.055)**2.4:e/12.92}for(const e of Object.keys(dt)){if(!("channels"in dt[e]))throw new Error("missing channels property: "+e);if(!("labels"in dt[e]))throw new Error("missing channel labels property: "+e);if(dt[e].labels.length!==dt[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:n}=dt[e];delete dt[e].channels,delete dt[e].labels,Object.defineProperty(dt[e],"channels",{value:t}),Object.defineProperty(dt[e],"labels",{value:n})}dt.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,a=Math.min(t,n,r),i=Math.max(t,n,r),s=i-a;let d,l;switch(i){case a:{d=0;break}case t:{d=(n-r)/s;break}case n:{d=2+(r-t)/s;break}case r:{d=4+(t-n)/s;break}}d=Math.min(d*60,360),d<0&&(d+=360);const c=(a+i)/2;return i===a?l=0:c<=.5?l=s/(i+a):l=s/(2-i-a),[d,l*100,c*100]};dt.rgb.hsv=function(e){let t,n,r,a,i;const s=e[0]/255,d=e[1]/255,l=e[2]/255,c=Math.max(s,d,l),f=c-Math.min(s,d,l),m=function(u){return(c-u)/6/f+1/2};if(f===0)a=0,i=0;else{switch(i=f/c,t=m(s),n=m(d),r=m(l),c){case s:{a=r-n;break}case d:{a=1/3+t-r;break}case l:{a=2/3+n-t;break}}a<0?a+=1:a>1&&(a-=1)}return[a*360,i*100,c*100]};dt.rgb.hwb=function(e){const t=e[0],n=e[1];let r=e[2];const a=dt.rgb.hsl(e)[0],i=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[a,i*100,r*100]};dt.rgb.oklab=function(e){const t=Cc(e[0]/255),n=Cc(e[1]/255),r=Cc(e[2]/255),a=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),s=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r),d=.2104542553*a+.793617785*i-.0040720468*s,l=1.9779984951*a-2.428592205*i+.4505937099*s,c=.0259040371*a+.7827717662*i-.808675766*s;return[d*100,l*100,c*100]};dt.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,a=Math.min(1-t,1-n,1-r),i=(1-t-a)/(1-a)||0,s=(1-n-a)/(1-a)||0,d=(1-r-a)/(1-a)||0;return[i*100,s*100,d*100,a*100]};function jW(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}dt.rgb.keyword=function(e){const t=dC[e];if(t)return t;let n=Number.POSITIVE_INFINITY,r;for(const a of Object.keys(Io)){const i=Io[a],s=jW(e,i);s<n&&(n=s,r=a)}return r};dt.keyword.rgb=function(e){return[...Io[e]]};dt.rgb.xyz=function(e){const t=Cc(e[0]/255),n=Cc(e[1]/255),r=Cc(e[2]/255),a=t*.4124564+n*.3575761+r*.1804375,i=t*.2126729+n*.7151522+r*.072175,s=t*.0193339+n*.119192+r*.9503041;return[a*100,i*100,s*100]};dt.rgb.lab=function(e){const t=dt.rgb.xyz(e);let n=t[0],r=t[1],a=t[2];n/=95.047,r/=100,a/=108.883,n=n>di?n**(1/3):7.787*n+16/116,r=r>di?r**(1/3):7.787*r+16/116,a=a>di?a**(1/3):7.787*a+16/116;const i=116*r-16,s=500*(n-r),d=200*(r-a);return[i,s,d]};dt.hsl.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;let a,i;if(n===0)return i=r*255,[i,i,i];const s=r<.5?r*(1+n):r+n-r*n,d=2*r-s,l=[0,0,0];for(let c=0;c<3;c++)a=t+1/3*-(c-1),a<0&&a++,a>1&&a--,6*a<1?i=d+(s-d)*6*a:2*a<1?i=s:3*a<2?i=d+(s-d)*(2/3-a)*6:i=d,l[c]=i*255;return l};dt.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,r=e[2]/100,a=n;const i=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,a*=i<=1?i:2-i;const s=(r+n)/2,d=r===0?2*a/(i+a):2*n/(r+n);return[t,d*100,s*100]};dt.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let r=e[2]/100;const a=Math.floor(t)%6,i=t-Math.floor(t),s=255*r*(1-n),d=255*r*(1-n*i),l=255*r*(1-n*(1-i));switch(r*=255,a){case 0:return[r,l,s];case 1:return[d,r,s];case 2:return[s,r,l];case 3:return[s,d,r];case 4:return[l,s,r];case 5:return[r,s,d]}};dt.hsv.hsl=function(e){const t=e[0],n=e[1]/100,r=e[2]/100,a=Math.max(r,.01);let i,s;s=(2-n)*r;const d=(2-n)*a;return i=n*a,i/=d<=1?d:2-d,i=i||0,s/=2,[t,i*100,s*100]};dt.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,r=e[2]/100;const a=n+r;let i;a>1&&(n/=a,r/=a);const s=Math.floor(6*t),d=1-r;i=6*t-s,s&1&&(i=1-i);const l=n+i*(d-n);let c,f,m;switch(s){default:case 6:case 0:{c=d,f=l,m=n;break}case 1:{c=l,f=d,m=n;break}case 2:{c=n,f=d,m=l;break}case 3:{c=n,f=l,m=d;break}case 4:{c=l,f=n,m=d;break}case 5:{c=d,f=n,m=l;break}}return[c*255,f*255,m*255]};dt.cmyk.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100,a=e[3]/100,i=1-Math.min(1,t*(1-a)+a),s=1-Math.min(1,n*(1-a)+a),d=1-Math.min(1,r*(1-a)+a);return[i*255,s*255,d*255]};dt.xyz.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100;let a,i,s;return a=t*3.2404542+n*-1.5371385+r*-.4985314,i=t*-.969266+n*1.8760108+r*.041556,s=t*.0556434+n*-.2040259+r*1.0572252,a=xc(a),i=xc(i),s=xc(s),[a*255,i*255,s*255]};dt.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];t/=95.047,n/=100,r/=108.883,t=t>di?t**(1/3):7.787*t+16/116,n=n>di?n**(1/3):7.787*n+16/116,r=r>di?r**(1/3):7.787*r+16/116;const a=116*n-16,i=500*(t-n),s=200*(n-r);return[a,i,s]};dt.xyz.oklab=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100,a=Math.cbrt(.8189330101*t+.3618667424*n-.1288597137*r),i=Math.cbrt(.0329845436*t+.9293118715*n+.0361456387*r),s=Math.cbrt(.0482003018*t+.2643662691*n+.633851707*r),d=.2104542553*a+.793617785*i-.0040720468*s,l=1.9779984951*a-2.428592205*i+.4505937099*s,c=.0259040371*a+.7827717662*i-.808675766*s;return[d*100,l*100,c*100]};dt.oklab.oklch=function(e){return dt.lab.lch(e)};dt.oklab.xyz=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100,a=(.999999998*t+.396337792*n+.215803758*r)**3,i=(1.000000008*t-.105561342*n-.063854175*r)**3,s=(1.000000055*t-.089484182*n-1.291485538*r)**3,d=1.227013851*a-.55779998*i+.281256149*s,l=-.040580178*a+1.11225687*i-.071676679*s,c=-.076381285*a-.421481978*i+1.58616322*s;return[d*100,l*100,c*100]};dt.oklab.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100,a=(t+.3963377774*n+.2158037573*r)**3,i=(t-.1055613458*n-.0638541728*r)**3,s=(t-.0894841775*n-1.291485548*r)**3,d=xc(4.0767416621*a-3.3077115913*i+.2309699292*s),l=xc(-1.2684380046*a+2.6097574011*i-.3413193965*s),c=xc(-.0041960863*a-.7034186147*i+1.707614701*s);return[d*255,l*255,c*255]};dt.oklch.oklab=function(e){return dt.lch.lab(e)};dt.lab.xyz=function(e){const t=e[0],n=e[1],r=e[2];let a,i,s;i=(t+16)/116,a=n/500+i,s=i-r/200;const d=i**3,l=a**3,c=s**3;return i=d>di?d:(i-16/116)/7.787,a=l>di?l:(a-16/116)/7.787,s=c>di?c:(s-16/116)/7.787,a*=95.047,i*=100,s*=108.883,[a,i,s]};dt.lab.lch=function(e){const t=e[0],n=e[1],r=e[2];let a;a=Math.atan2(r,n)*360/2/Math.PI,a<0&&(a+=360);const s=Math.sqrt(n*n+r*r);return[t,s,a]};dt.lch.lab=function(e){const t=e[0],n=e[1],a=e[2]/360*2*Math.PI,i=n*Math.cos(a),s=n*Math.sin(a);return[t,i,s]};dt.rgb.ansi16=function(e,t=null){const[n,r,a]=e;let i=t===null?dt.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let s=30+(Math.round(a/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return i===2&&(s+=60),s};dt.hsv.ansi16=function(e){return dt.rgb.ansi16(dt.hsv.rgb(e),e[2])};dt.rgb.ansi256=function(e){const t=e[0],n=e[1],r=e[2];return t>>4===n>>4&&n>>4===r>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)};dt.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=(Math.trunc(e>50)+1)*.5,r=(t&1)*n*255,a=(t>>1&1)*n*255,i=(t>>2&1)*n*255;return[r,a,i]};dt.ansi256.rgb=function(e){if(e=e[0],e>=232){const i=(e-232)*10+8;return[i,i,i]}e-=16;let t;const n=Math.floor(e/36)/5*255,r=Math.floor((t=e%36)/6)/5*255,a=t%6/5*255;return[n,r,a]};dt.rgb.hex=function(e){const n=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(n.length)+n};dt.hex.rgb=function(e){const t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=[...n].map(d=>d+d).join(""));const r=Number.parseInt(n,16),a=r>>16&255,i=r>>8&255,s=r&255;return[a,i,s]};dt.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,a=Math.max(Math.max(t,n),r),i=Math.min(Math.min(t,n),r),s=a-i;let d;const l=s<1?i/(1-s):0;return s<=0?d=0:a===t?d=(n-r)/s%6:a===n?d=2+(r-t)/s:d=4+(t-n)/s,d/=6,d%=1,[d*360,s*100,l*100]};dt.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n);let a=0;return r<1&&(a=(n-.5*r)/(1-r)),[e[0],r*100,a*100]};dt.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=t*n;let a=0;return r<1&&(a=(n-r)/(1-r)),[e[0],r*100,a*100]};dt.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];const a=[0,0,0],i=t%1*6,s=i%1,d=1-s;let l=0;switch(Math.floor(i)){case 0:{a[0]=1,a[1]=s,a[2]=0;break}case 1:{a[0]=d,a[1]=1,a[2]=0;break}case 2:{a[0]=0,a[1]=1,a[2]=s;break}case 3:{a[0]=0,a[1]=d,a[2]=1;break}case 4:{a[0]=s,a[1]=0,a[2]=1;break}default:a[0]=1,a[1]=0,a[2]=d}return l=(1-n)*r,[(n*a[0]+l)*255,(n*a[1]+l)*255,(n*a[2]+l)*255]};dt.hcg.hsv=function(e){const t=e[1]/100,n=e[2]/100,r=t+n*(1-t);let a=0;return r>0&&(a=t/r),[e[0],a*100,r*100]};dt.hcg.hsl=function(e){const t=e[1]/100,r=e[2]/100*(1-t)+.5*t;let a=0;return r>0&&r<.5?a=t/(2*r):r>=.5&&r<1&&(a=t/(2*(1-r))),[e[0],a*100,r*100]};dt.hcg.hwb=function(e){const t=e[1]/100,n=e[2]/100,r=t+n*(1-t);return[e[0],(r-t)*100,(1-r)*100]};dt.hwb.hcg=function(e){const t=e[1]/100,r=1-e[2]/100,a=r-t;let i=0;return a<1&&(i=(r-a)/(1-a)),[e[0],a*100,i*100]};dt.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};dt.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};dt.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};dt.gray.hsl=function(e){return[0,0,e[0]]};dt.gray.hsv=dt.gray.hsl;dt.gray.hwb=function(e){return[0,100,e[0]]};dt.gray.cmyk=function(e){return[0,0,0,e[0]]};dt.gray.lab=function(e){return[e[0],0,0]};dt.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255,r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(r.length)+r};dt.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function RW(){const e={},t=Object.keys(dt);for(let{length:n}=t,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function FW(e){const t=RW(),n=[e];for(t[e].distance=0;n.length>0;){const r=n.pop(),a=Object.keys(dt[r]);for(let{length:i}=a,s=0;s<i;s++){const d=a[s],l=t[d];l.distance===-1&&(l.distance=t[r].distance+1,l.parent=r,n.unshift(d))}}return t}function VW(e,t){return function(n){return t(e(n))}}function UW(e,t){const n=[t[e].parent,e];let r=dt[t[e].parent][e],a=t[e].parent;for(;t[a].parent;)n.unshift(t[a].parent),r=VW(dt[t[a].parent][a],r),a=t[a].parent;return r.conversion=n,r}function ZW(e){const t=FW(e),n={},r=Object.keys(t);for(let{length:a}=r,i=0;i<a;i++){const s=r[i];t[s].parent!==null&&(n[s]=UW(s,t))}return n}const sr={},qW=Object.keys(dt);function HW(e){const t=function(...n){const r=n[0];return r==null?r:(r.length>1&&(n=r),e(n))};return"conversion"in e&&(t.conversion=e.conversion),t}function WW(e){const t=function(...n){const r=n[0];if(r==null)return r;r.length>1&&(n=r);const a=e(n);if(typeof a=="object")for(let{length:i}=a,s=0;s<i;s++)a[s]=Math.round(a[s]);return a};return"conversion"in e&&(t.conversion=e.conversion),t}for(const e of qW){sr[e]={},Object.defineProperty(sr[e],"channels",{value:dt[e].channels}),Object.defineProperty(sr[e],"labels",{value:dt[e].labels});const t=ZW(e),n=Object.keys(t);for(const r of n){const a=t[r];sr[e][r]=WW(a),sr[e][r].raw=HW(a)}}const fC=["keyword","gray","hex"],jg={};for(const e of Object.keys(sr))jg[[...sr[e].labels].sort().join("")]=e;const td={};function Hn(e,t){if(!(this instanceof Hn))return new Hn(e,t);if(t&&t in fC&&(t=null),t&&!(t in sr))throw new Error("Unknown model: "+t);let n,r;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof Hn)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){const a=tr.get(e);if(a===null)throw new Error("Unable to parse color from string: "+e);this.model=a.model,r=sr[this.model].channels,this.color=a.value.slice(0,r),this.valpha=typeof a.value[r]=="number"?a.value[r]:1}else if(e.length>0){this.model=t||"rgb",r=sr[this.model].channels;const a=Array.prototype.slice.call(e,0,r);this.color=Rg(a,r),this.valpha=typeof e[r]=="number"?e[r]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;const a=Object.keys(e);"alpha"in e&&(a.splice(a.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);const i=a.sort().join("");if(!(i in jg))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=jg[i];const{labels:s}=sr[this.model],d=[];for(n=0;n<s.length;n++)d.push(e[s[n]]);this.color=Rg(d)}if(td[this.model])for(r=sr[this.model].channels,n=0;n<r;n++){const a=td[this.model][n];a&&(this.color[n]=a(this.color[n]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}Hn.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in tr.to?this:this.rgb();t=t.round(typeof e=="number"?e:1);const n=t.valpha===1?t.color:[...t.color,this.valpha];return tr.to[t.model](...n)},percentString(e){const t=this.rgb().round(typeof e=="number"?e:1),n=t.valpha===1?t.color:[...t.color,this.valpha];return tr.to.rgb.percent(...n)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:t}=sr[this.model],{labels:n}=sr[this.model];for(let r=0;r<t;r++)e[n[r]]=this.color[r];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new Hn([...this.color.map(XW(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new Hn([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:Ln("rgb",0,Yn(255)),green:Ln("rgb",1,Yn(255)),blue:Ln("rgb",2,Yn(255)),hue:Ln(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:Ln("hsl",1,Yn(100)),lightness:Ln("hsl",2,Yn(100)),saturationv:Ln("hsv",1,Yn(100)),value:Ln("hsv",2,Yn(100)),chroma:Ln("hcg",1,Yn(100)),gray:Ln("hcg",2,Yn(100)),white:Ln("hwb",1,Yn(100)),wblack:Ln("hwb",2,Yn(100)),cyan:Ln("cmyk",0,Yn(100)),magenta:Ln("cmyk",1,Yn(100)),yellow:Ln("cmyk",2,Yn(100)),black:Ln("cmyk",3,Yn(100)),x:Ln("xyz",0,Yn(95.047)),y:Ln("xyz",1,Yn(100)),z:Ln("xyz",2,Yn(108.833)),l:Ln("lab",0,Yn(100)),a:Ln("lab",1),b:Ln("lab",2),keyword(e){return e!==void 0?new Hn(e):sr[this.model].keyword(this.color)},hex(e){return e!==void 0?new Hn(e):tr.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new Hn(e);const t=this.rgb().round().color;let n=Math.round(this.valpha*255).toString(16).toUpperCase();return n.length===1&&(n="0"+n),tr.to.hex(...t)+n},rgbNumber(){const e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){const e=this.rgb().color,t=[];for(const[n,r]of e.entries()){const a=r/255;t[n]=a<=.04045?a/12.92:((a+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),n=e.luminosity();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return Hn.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let n=t.color[0];return n=(n+e)%360,n=n<0?360+n:n,t.color[0]=n,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const n=e.rgb(),r=this.rgb(),a=t===void 0?.5:t,i=2*a-1,s=n.alpha()-r.alpha(),d=((i*s===-1?i:(i+s)/(1+i*s))+1)/2,l=1-d;return Hn.rgb(d*n.red()+l*r.red(),d*n.green()+l*r.green(),d*n.blue()+l*r.blue(),n.alpha()*a+r.alpha()*(1-a))}};for(const e of Object.keys(sr)){if(fC.includes(e))continue;const{channels:t}=sr[e];Hn.prototype[e]=function(...n){return this.model===e?new Hn(this):n.length>0?new Hn(n,e):new Hn([...YW(sr[this.model][e].raw(this.color)),this.valpha],e)},Hn[e]=function(...n){let r=n[0];return typeof r=="number"&&(r=Rg(n,t)),new Hn(r,e)}}function GW(e,t){return Number(e.toFixed(t))}function XW(e){return function(t){return GW(t,e)}}function Ln(e,t,n){e=Array.isArray(e)?e:[e];for(const r of e)(td[r]||(td[r]=[]))[t]=n;return e=e[0],function(r){let a;return r!==void 0?(n&&(r=n(r)),a=this[e](),a.color[t]=r,a):(a=this[e]().color[t],n&&(a=n(a)),a)}}function Yn(e){return function(t){return Math.max(0,Math.min(e,t))}}function YW(e){return Array.isArray(e)?e:[e]}function Rg(e,t){for(let n=0;n<t;n++)typeof e[n]!="number"&&(e[n]=0);return e}var Iu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Fg={exports:{}};/**
|
|
108
108
|
* @license
|
|
@@ -145,7 +145,7 @@ list should be an Array.`),M.length===0)return new w(0);if(M.length===1)return M
|
|
|
145
145
|
`).slice(0,r.maxLines??1/0).map(ue=>ue.slice(0,r.maxLineLength??1/0)).join(`
|
|
146
146
|
`).slice(0,r.maxLength??1/0));o.watch(s,ie=>{vr(ie,h.value)||(d.value=ie)}),o.watch(d,ie=>{if(typeof ie=="object"&&ie!==null){const le=i8(ie,0,r.maxLength);s.value=le}else{const ue=String(ie).split(`
|
|
147
147
|
`);s.value!==h.value&&(s.value=h.value),r.maxLineLength!==1/0&&r.maxLineLength!==null&&(l.value=ue.filter(he=>he.length>(r.maxLineLength??1/0)).map(he=>({index:ue.indexOf(he),length:he.length}))),r.maxLines!==1/0&&r.maxLines!==null&&(c.value=Math.max(0,String(ie).split(`
|
|
148
|
-
`).length-(r.maxLines??1/0))),r.maxLength!==1/0&&r.maxLength!==null&&(f.value=String(ie).length-r.maxLength)}});const g=o.computed({get(){return K1(y.value)},set(ie){r.richtext?d.value=[{text:ie,format:{}}]:d.value=ie}}),y=o.computed({get(){return cC(s.value)},set(ie){r.richtext?d.value=ie:d.value=K1(ie)}}),w=o.ref(),x=fs("bx-input-count"),S=o.computed(()=>r.state==="error"||u.value),C=o.computed(()=>r.showWordCount?x:void 0),E=o.ref();let _;const I=o.ref(!1);o.watch(I,()=>{I.value?a("focus"):a("blur",_)});function B(ie){I.value=!0}function k(ie){_=ie,I.value=!1}o.watch(E,(ie,le)=>{ie&&(le&&(le.removeEventListener("focus",B),le.removeEventListener("blur",k)),ie.addEventListener("focus",B),ie.addEventListener("blur",k))});const P=o.computed(()=>String(Math.max(1,r.maxRows)));function z(){if(r.type!=="textarea")return;const ie=E.value;!ie||ie.tagName!=="TEXTAREA"||(ie.style.height="auto",ie.style.height=`${ie.scrollHeight}px`)}o.watch([E,g,()=>r.type,()=>r.minHeight,()=>r.maxHeight,P],async()=>{await o.nextTick(),z()},{immediate:!0,flush:"post"}),window.addEventListener("blur",k);const $=()=>{var ie;r.disabled||r.readonly||(ie=E.value)==null||ie.focus()},j=ie=>{ie.key==="Enter"&&a("enter",ie)},p=o.ref(""),H=o.computed(()=>{const ie=r.richtext?p.value:d.value;return[...new Intl.Segmenter().segment(ie)].length}),F=o.computed(()=>r.richtext?p.value.length>0:String(d.value).length>0);function Z(ie){return ie.en}const L=o.ref(),O=o.ref({start:0,length:0}),D=o.computed({get(){var Y,M;const ie=(Y=w.value)==null?void 0:Y.richTextInstance;if(!ie)return;const ue=ie.resolveFeatures(O.value.start,O.value.length).flat(),he=ee(ue);if(he!==void 0)return he===null?"multiple":(M=R.value.find(N=>vr(N.value,he)))==null?void 0:M.value},set(ie){var ue;const le=(ue=w.value)==null?void 0:ue.richTextInstance;le&&ie!=="multiple"&&(ie===void 0?le.applyFormat(O.value.start,O.value.length,{}):(le.resolveFeatures(O.value.start,O.value.length),le.applyFormat(O.value.start,O.value.length,ie)),W.value.closePopover())}});o.watch(L,()=>{L.value&&(O.value=L.value)});const R=o.computed(()=>r.richtext?[{label:Z(r.richtext.noStyleLabel),value:void 0},...r.richtext.options.map((ie,le)=>({label:ie.label,value:ie.style}))]:[]),W=o.ref();function ee(ie){let le=!1,ue;for(const he of ie)if(!ue)ue=he.format;else if(!vr(ue,he.format)){le=!0;break}return le?null:ue}function se(){r.richtext?y.value=[{text:"",format:{}}]:s.value=""}return o.onUnmounted(()=>{l.value=[],c.value=0,f.value=0}),t({inputEelRef:E,setFocus(ie){var le,ue;ie?(le=E.value)==null||le.focus():(ue=E.value)==null||ue.blur()}}),(ie,le)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-input",{readonly:e.readonly,bordered:e.bordered,"is-textarea":e.type==="textarea"}])},[e.richtext?(o.openBlock(),o.createBlock(gi,{key:0,ref_key:"bxSelectRef",ref:W,class:"select-richtext",modelValue:D.value,"onUpdate:modelValue":le[0]||(le[0]=ue=>D.value=ue),options:R.value,disabled:!O.value||O.value.length===0},{label:o.withCtx(({label:ue})=>[o.createTextVNode(o.toDisplayString(ue??"Multiple"),1)]),_:1},8,["modelValue","options","disabled"])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["bx-input-wrapper",{focus:I.value&&!e.readonly,round:e.round,ring:e.ring,bordered:e.bordered,["size-"+e.size]:e.size,disabled:e.disabled,readonly:e.readonly,"rich-text":e.richtext,error:u.value,"state-active":e.state==="active","state-success":e.state==="success","state-error":e.state==="error","state-warning":e.state==="warning",ghost:e.ghost}]),style:o.normalizeStyle({"--max-height":e.richtext?"auto":e.maxHeight,"--min-height":e.minHeight,"--textarea-max-lines":P.value}),onClick:$},[i.prefix?(o.openBlock(),o.createElementBlock("div",OG,[o.renderSlot(ie.$slots,"prefix",{},void 0,!0)])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["bx-input__input",{"swiper-no-swiping":I.value,"has-prefix":!!i.prefix}])},[e.richtext?(o.openBlock(),o.createBlock(vC,{key:0,ref_key:"bxRichTextInstance",ref:w,modelValue:y.value,"onUpdate:modelValue":le[1]||(le[1]=ue=>y.value=ue),selection:L.value,"onUpdate:selection":le[2]||(le[2]=ue=>L.value=ue),"raw-text":p.value,"onUpdate:rawText":le[3]||(le[3]=ue=>p.value=ue),focus:I.value,"onUpdate:focus":le[4]||(le[4]=ue=>I.value=ue),"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby},null,8,["modelValue","selection","raw-text","focus","aria-label","aria-labelledby"])):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[e.type==="textarea"?o.withDirectives((o.openBlock(),o.createElementBlock("textarea",{key:0,ref_key:"inputEelRef",ref:E,rows:"1",class:o.normalizeClass({resizeable:e.resizeable}),"onUpdate:modelValue":le[5]||(le[5]=ue=>g.value=ue),placeholder:e.placeholder,onKeydown:j,readonly:e.readonly,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":S.value?"true":void 0,"aria-describedby":C.value},null,42,PG)),[[o.vModelText,g.value]]):o.withDirectives((o.openBlock(),o.createElementBlock("input",{key:1,ref_key:"inputEelRef",ref:E,"onUpdate:modelValue":le[6]||(le[6]=ue=>s.value=ue),readonly:e.readonly,placeholder:e.placeholder,type:e.type,onKeydown:j,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":S.value?"true":void 0,"aria-describedby":C.value},null,40,MG)),[[o.vModelDynamic,s.value]])],64))],2),i.suffix||e.clearable||e.showWordCount||i.loading||e.loading||u.value?(o.openBlock(),o.createElementBlock("div",{key:1,"data-suffix":!!i.suffix,class:"bx-input__suffix"},[i.loading||e.loading?(o.openBlock(),o.createElementBlock("div",DG,[i.loading?o.renderSlot(ie.$slots,"loading",{},void 0,!0,0):(o.openBlock(),o.createBlock(bs,{key:1,size:"small"}))])):o.createCommentVNode("",!0),o.renderSlot(ie.$slots,"suffix",{},void 0,!0),e.showWordCount?(o.openBlock(),o.createElementBlock("div",{key:1,id:o.unref(x),class:"bx-input__word-count"},[e.maxLength&&e.maxLength!==1/0?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createTextVNode(o.toDisplayString(H.value)+" / "+o.toDisplayString(e.maxLength),1)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(H.value),1)],64))],8,$G)):o.createCommentVNode("",!0),u.value?(o.openBlock(),o.createBlock(f0,{key:2,trigger:"hover","custom-popover-classes":["text-overflow-tooltip"],"allowed-placements":["bottom","top","right"]},{trigger:o.withCtx(()=>[o.createVNode(yt,{circle:"",size:"tiny",secondary:"",state:"error",class:"errors-button","aria-label":"Show input warnings"},{icon:o.withCtx(()=>[o.createVNode(nt,null,{default:o.withCtx(()=>[o.createVNode(o.unref(Vx))]),_:1})]),_:1})]),content:o.withCtx(()=>{var ue,he,Y;return[o.createElementVNode("div",NG,[(ue=m.value)!=null&&ue.overflowingCharacters?(o.openBlock(),o.createElementBlock("div",jG,[o.createElementVNode("span",RG,o.toDisplayString(e.maxLength+f.value)+" / "+o.toDisplayString(e.maxLength),1),le[7]||(le[7]=o.createTextVNode(" characters ",-1))])):o.createCommentVNode("",!0),(he=m.value)!=null&&he.overlowingLines?(o.openBlock(),o.createElementBlock("div",FG,[o.createElementVNode("span",VG,o.toDisplayString(e.maxLines+c.value)+" / "+o.toDisplayString(e.maxLines),1),le[8]||(le[8]=o.createTextVNode(" lines ",-1))])):o.createCommentVNode("",!0),(Y=m.value)!=null&&Y.lineOverflows?(o.openBlock(),o.createElementBlock("div",UG,[le[9]||(le[9]=o.createTextVNode(" Lines are too long: ",-1)),o.createElementVNode("ul",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(m.value.lineOverflows,({index:M,length:N})=>(o.openBlock(),o.createElementBlock("li",null,[o.createElementVNode("span",ZG,"("+o.toDisplayString(M+1)+")",1),o.createElementVNode("span",qG,o.toDisplayString(N)+" / "+o.toDisplayString(e.maxLineLength),1)]))),256))])])):o.createCommentVNode("",!0)])]}),_:1})):o.createCommentVNode("",!0),e.clearable&&F.value?(o.openBlock(),o.createElementBlock("button",{key:3,type:"button",class:"bx-input__clear-btn",onClick:o.withModifiers(se,["stop"]),title:"Clear","aria-label":"Clear"},[o.createVNode(nt,{size:12},{default:o.withCtx(()=>[o.createVNode(o.unref(Po))]),_:1})])):o.createCommentVNode("",!0)],8,TG)):o.createCommentVNode("",!0)],6)],2))}}),Il=Je(HG,[["__scopeId","data-v-19f6427a"]]);function Ug(e){return new URLSearchParams(Object.fromEntries(Object.entries(e).map(([t,n])=>[t,String(n)]))).toString()}function WG(e){const t=o.ref([]),n=o.ref(0);let r=25;async function a(i,s){s=s??t.value.length??0;const l=await(await fetch(`https://api.pexels.com/v1/search?${Ug({page:Math.ceil(s/r),query:i,per_page:r})}`,{headers:{Authorization:e}})).json();if("error"in l)throw new Error(l.error);n.value=l.total_results,t.value=[...t.value.slice(0,s),...l.photos]}return{photos:t,total:n,searchPhotos:a}}const GG=o.defineComponent({__name:"LazyLoadingItemWrapper",emits:["update:visible"],setup(e,{emit:t}){o.ref();const n=t,r=o.ref(),a=YM(r);return n("update:visible",a.value),o.watch(a,(i,s)=>{!s&&i&&n("update:visible",a.value)}),(i,s)=>(o.openBlock(),o.createElementBlock("div",{class:"item-wrapper",ref_key:"itemWrapperRef",ref:r},[o.renderSlot(i.$slots,"default")],512))}}),XG=o.defineComponent({__name:"LazyLoading",props:{items:{},total:{},fetch:{type:Function},visibleTriggerOffset:{}},setup(e){o.ref();const t=e;t.fetch(0);const n=(r,a)=>{a&&r>=t.items.length-t.visibleTriggerOffset-1&&t.total>t.items.length&&t.fetch()};return(r,a)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.items,(i,s)=>(o.openBlock(),o.createBlock(GG,{key:s,class:"item-wrapper",item:i,index:s,"onUpdate:visible":d=>n(s,d)},{default:o.withCtx(()=>[o.renderSlot(r.$slots,"item",{item:i,index:s})]),_:2},1032,["item","index","onUpdate:visible"]))),128))}}),YG={class:"bx-empty-icon"},KG={key:1,viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},JG={key:0,class:"bx-empty-description"},QG={key:1,class:"bx-empty-extra"},eX=o.defineComponent({__name:"BxEmpty",props:{description:{default:"No Data"},size:{default:"medium"}},setup(e){const t=o.useSlots();return(n,r)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-empty",{[`size-${e.size}`]:!0}])},[o.createElementVNode("div",YG,[t.icon?o.renderSlot(n.$slots,"icon",{},void 0,!0,0):(o.openBlock(),o.createElementBlock("svg",KG,[...r[0]||(r[0]=[o.createElementVNode("path",{d:"M26 7.5C26 11.0899 23.0899 14 19.5 14C15.9101 14 13 11.0899 13 7.5C13 3.91015 15.9101 1 19.5 1C23.0899 1 26 3.91015 26 7.5ZM14 7.5C14 3.91015 11.0899 1 7.5 1C3.91015 1 1 3.91015 1 7.5C1 11.0899 3.91015 14 7.5 14C11.0899 14 14 11.0899 14 7.5ZM14 19.5C14 15.9101 11.0899 13 7.5 13C3.91015 13 1 15.9101 1 19.5C1 23.0899 3.91015 26 7.5 26C11.0899 26 14 23.0899 14 19.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",opacity:"0.4"},null,-1),o.createElementVNode("circle",{cx:"19.5",cy:"19.5",r:"6.5",stroke:"currentColor","stroke-width":"1.5","stroke-dasharray":"3 3",opacity:"0.25"},null,-1)])]))]),e.description||t.description?(o.openBlock(),o.createElementBlock("div",JG,[t.description?o.renderSlot(n.$slots,"description",{},void 0,!0,0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(e.description),1)],64))])):o.createCommentVNode("",!0),t.default?(o.openBlock(),o.createElementBlock("div",QG,[o.renderSlot(n.$slots,"default",{},void 0,!0)])):o.createCommentVNode("",!0)],2))}}),Wb=Je(eX,[["__scopeId","data-v-d66bc5e4"]]),tX={class:"image-library-pexels"},nX={class:"search-bar-wrapper"},rX={key:0,class:"photos"},aX=["onClick"],oX=["src"],iX={key:0,class:"loading-wrapper"},sX={key:1,class:"loading-wrapper"},lX=o.defineComponent({__name:"Pexels",props:{apiKey:{},width:{},height:{},uploadContext:{},uploadImageAsset:{type:Function}},emits:["select"],setup(e,{emit:t}){const n=Cs(),r=e,a=t,i=o.ref("city"),{searchPhotos:s,photos:d,total:l}=WG(r.apiKey),c=o.ref(),f=o.ref(!1);async function m(){i.value.length>0&&(f.value=!0,l.value=25,d.value=[],await s(i.value),c.value=i.value,f.value=!1)}async function u(y,w){await s(i.value,y)}const h=o.ref();async function g(y){h.value=y.id;const w=await r.uploadImageAsset({blob:await fetch(n(y.src.original)).then(x=>x.blob()),context:r.uploadContext,width:r.width,height:r.height,key:`pexels-${y.id}`,name:y.id.toString(),onProgress(x){console.log("upload progress",x)}});h.value=void 0,a("select",w.src)}return(y,w)=>(o.openBlock(),o.createElementBlock("div",tX,[o.createElementVNode("header",null,[o.createElementVNode("div",nX,[o.createVNode(Il,{modelValue:i.value,"onUpdate:modelValue":w[0]||(w[0]=x=>i.value=x),round:"",placeholder:"Search...",size:"medium",onEnter:m},null,8,["modelValue"]),o.createVNode(yt,{active:"",onClick:m},{default:o.withCtx(()=>[...w[1]||(w[1]=[o.createTextVNode("Search",-1)])]),_:1})])]),o.createElementVNode("main",null,[c.value?(o.openBlock(),o.createElementBlock("div",rX,[o.createVNode(XG,{items:o.unref(d),total:o.unref(l),fetch:u,"visible-trigger-offset":0},{item:o.withCtx(({item:x})=>[(o.openBlock(),o.createElementBlock("div",{key:x.id,class:"photo-wrapper",onClick:S=>g(x)},[o.createElementVNode("div",{class:o.normalizeClass(["preview",{loading:h.value===x.id}])},[o.createElementVNode("img",{src:o.unref(n)(x.src.tiny)},null,8,oX),h.value===x.id?(o.openBlock(),o.createElementBlock("div",iX,[o.createVNode(bs)])):o.createCommentVNode("",!0)],2)],8,aX))]),_:1},8,["items","total"])])):f.value?(o.openBlock(),o.createElementBlock("div",sX,[o.createVNode(bs)])):(o.openBlock(),o.createBlock(Wb,{key:2,description:"Search for images on Pexels"},{icon:o.withCtx(()=>[o.createVNode(o.unref(Zq))]),_:1}))])]))}});function cX(e,t,n){return e.map(r=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(r["@microsoft.graph.downloadUrl"])}&w=${t}&h=${n}&fit=cover&quality=80&format=png`,key:r.id,width:r.image.width,height:r.image.height,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(r["@microsoft.graph.downloadUrl"])}&h=200&fit=cover&quality=80&format=png`,width:r.image.width,height:r.image.height},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(r["@microsoft.graph.downloadUrl"])}&h=400&fit=cover&quality=80&format=png`,width:r.image.width,height:r.image.height}}}))}function uX(e,t,n){return e.map(({thumbnailLink:r,webContentLink:a,sha256Checksum:i,imageMediaMetadata:s})=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(a)}&w=${t}&h=${n}&fit=cover&quality=80&format=png`,key:i,width:(s==null?void 0:s.width)??0,height:(s==null?void 0:s.height)??0,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(r)}&h=200&fit=cover&quality=80&format=png`,width:(s==null?void 0:s.width)??0,height:(s==null?void 0:s.height)??0},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(r)}&h=400&fit=cover&quality=80&format=png`,width:(s==null?void 0:s.width)??0,height:(s==null?void 0:s.height)??0}}}))}function dX(e,t,n,r){const a=o.ref();return{sharedItems:a,fetchSharedDrive:async()=>{if(e==="onedrive"){const s=`https://shared-drive.bluepic.io/onedrive?${Ug({sharing:t})}`,l=await(await fetch(s)).json();a.value=cX(l.children,n,r)}else if(e==="googledrive"){const s=`https://shared-drive.bluepic.io/googledrive?${Ug({sharing:t})}`,l=await(await fetch(s)).json();a.value=uX(l.files,n,r)}}}}const fX={class:"image-library-shared-drive"},pX={key:0,class:"photos"},mX=["onClick"],hX={class:"preview"},gX=["src"],vX={key:1,class:"loading-wrapper"},bX=o.defineComponent({__name:"SharedDrive",props:{service:{},sharedUrl:{},width:{},height:{}},emits:["select"],setup(e,{emit:t}){const n=Cs(),r=e,a=t,{fetchSharedDrive:i,sharedItems:s}=dX(r.service,r.sharedUrl,r.width,r.height);i();function d(l){a("select",l.src)}return(l,c)=>(o.openBlock(),o.createElementBlock("div",fX,[o.unref(s)?(o.openBlock(),o.createElementBlock("div",pX,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(s),f=>(o.openBlock(),o.createElementBlock("div",{class:"photo-wrapper",onClick:m=>d(f)},[o.createElementVNode("div",hX,[o.createElementVNode("img",{src:o.unref(n)(f.previews.small.src)},null,8,gX)])],8,mX))),256))])):(o.openBlock(),o.createElementBlock("div",vX,[o.createVNode(bs)]))]))}}),yX=Je(bX,[["__scopeId","data-v-6b7dadc2"]]),wX={class:"image-library-custom"},xX=o.defineComponent({__name:"Custom",props:{controller:{},label:{},name:{},props:{}},setup(e){const t=e,n=import(t.controller),r=o.ref();return n.then(a=>{r.value=new a.default(t.props)}),(a,i)=>(o.openBlock(),o.createElementBlock("div",wX,"JAJAJA"))}}),CX={class:"image-library-wrapper"},SX={key:0,class:"nav-view-wrapper"},kX={class:"icon-wrapper"},_X={class:"label"},EX={key:1,class:"library-view-wrapper"},zX=o.defineComponent({__name:"ImageLibraryWrapper",props:{options:{},activeKey:{},imageLibraries:{},convertTo:{},quality:{},width:{},height:{},bridge:{},field:{}},emits:["select","update:active-key"],setup(e,{emit:t}){const n=e,r=t,a=o.ref(n.activeKey);o.watch(a,()=>{n.activeKey!==a.value&&r("update:active-key",a.value)}),o.watch(()=>n.activeKey,()=>{n.activeKey!==a.value&&(a.value=n.activeKey)});function i(g){a.value=g}const s=o.computed(()=>{var g;return(g=n.imageLibraries.find(y=>y.type==="pexels"))==null?void 0:g.apiKey}),d=o.computed(()=>n.imageLibraries.find(g=>g.type==="sharedDrive"&&g.service===a.value).sharedUrl),l=o.computed(()=>{var g;return(g=n.imageLibraries.find(y=>y.type===a.value))==null?void 0:g.label}),c=o.computed(()=>{var g;return(g=n.imageLibraries.find(y=>y.type===a.value))==null?void 0:g.name}),f=o.computed(()=>{var g;return(g=n.imageLibraries.find(y=>y.type===a.value))==null?void 0:g.controller}),m=o.computed(()=>{var g;return(g=n.imageLibraries.find(y=>y.type===a.value))==null?void 0:g.props});function u(g){const y=g[0];y&&h(y.src)}function h(g){r("select",g)}return(g,y)=>(o.openBlock(),o.createElementBlock("div",CX,[o.createVNode(o.Transition,{name:"slide-library"},{default:o.withCtx(()=>[a.value===void 0?(o.openBlock(),o.createElementBlock("div",SX,[o.createElementVNode("div",{class:"image-library-source-navigation",style:o.normalizeStyle({"--options-length":e.options.length})},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(n.options,w=>(o.openBlock(),o.createBlock(d0,{key:w.key,bordered:!0,onClick:x=>i(w.key)},{default:o.withCtx(()=>[o.createElementVNode("div",kX,[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(w.icon)))]),o.createElementVNode("div",_X,o.toDisplayString(w.label),1)]),_:2},1032,["onClick"]))),128))],4)])):(o.openBlock(),o.createElementBlock("div",EX,[a.value==="upload"?(o.openBlock(),o.createBlock(NW,{key:0,width:e.width,height:e.height,"convert-to":e.convertTo,quality:e.quality,field:e.field,"handle-upload":e.bridge.handleUpload,onUpload:u},null,8,["width","height","convert-to","quality","field","handle-upload"])):a.value==="pexels"?(o.openBlock(),o.createBlock(lX,{key:1,"api-key":s.value,width:e.width,height:e.height,"upload-image-asset":e.bridge.handleUpload,"upload-context":{field:e.field},onSelect:h},null,8,["api-key","width","height","upload-image-asset","upload-context"])):a.value==="googledrive"||a.value==="onedrive"||a.value==="icloud"||a.value==="dropbox"?(o.openBlock(),o.createBlock(yX,{key:2,service:a.value,"shared-url":d.value,width:e.width,height:e.height,onSelect:h},null,8,["service","shared-url","width","height"])):a.value==="custom"?(o.openBlock(),o.createBlock(xX,{key:3,label:l.value??"Custom Library",name:c.value,controller:f.value,props:m.value},null,8,["label","name","controller","props"])):o.createCommentVNode("",!0)]))]),_:1})]))}}),yC=Je(zX,[["__scopeId","data-v-61c69114"]]),IX=o.defineComponent({__name:"BxList",props:{divider:{type:Boolean,default:!0}},setup(e){return o.useSlots(),(t,n)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-list",{"has-divider":e.divider}])},[o.renderSlot(t.$slots,"default",{},void 0,!0)],2))}}),wC=Je(IX,[["__scopeId","data-v-8ef24162"]]),AX={class:"bx-list-item__inner"},BX={key:0,class:"bx-list-item__prefix"},LX={class:"bx-list-item__content"},OX={key:1,class:"bx-list-item__suffix"},PX=o.defineComponent({__name:"BxListItem",setup(e){const t=o.useSlots(),n=o.computed(()=>!!t.prefix),r=o.computed(()=>!!t.suffix);return(a,i)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-list-item",{"has-prefix":n.value,"has-suffix":r.value}])},[o.createElementVNode("div",AX,[t.prefix?(o.openBlock(),o.createElementBlock("div",BX,[o.renderSlot(a.$slots,"prefix",{},void 0,!0)])):o.createCommentVNode("",!0),o.createElementVNode("div",LX,[o.renderSlot(a.$slots,"default",{},void 0,!0)]),t.suffix?(o.openBlock(),o.createElementBlock("div",OX,[o.renderSlot(a.$slots,"suffix",{},void 0,!0)])):o.createCommentVNode("",!0)])],2))}}),xC=Je(PX,[["__scopeId","data-v-637e586e"]]),MX=["aria-label"],TX=["onClick"],DX={class:"icon"},$X={class:"label"},NX={class:"pullup-menu"},jX={class:"icon"},RX=o.defineComponent({__name:"BxDropdown",props:o.mergeModels({options:{},allowedPlacements:{},mobileLayout:{type:Boolean,default:!1},ariaLabel:{default:"Menu"}},{show:{type:Boolean,required:!1,default:!1},showModifiers:{}}),emits:o.mergeModels(["select"],["update:show"]),setup(e,{emit:t}){const n=e,r=t,a=o.useModel(e,"show");function i(S){a.value=!1,r("select",S.value)}const s=o.useSlots(),d=fs("bx-dropdown-menu"),{setSlotRef:l,vNodes:c,slotElements:f}=Jp(s.trigger);function m(S){(S.key==="ArrowDown"||S.key==="ArrowUp")&&(S.preventDefault(),a.value||(a.value=!0),w(0))}let u;o.watch(f,(S,C)=>{for(const _ of C??[])_ instanceof HTMLElement&&_.removeEventListener("keydown",m);u=void 0;const E=S[0];E instanceof HTMLElement&&(E.setAttribute("aria-haspopup","menu"),E.setAttribute("aria-controls",d),E.setAttribute("aria-expanded",String(a.value)),E.addEventListener("keydown",m),u=E)},{immediate:!0});const h=o.ref(0),g=[];function y(S,C){if(!S){g[C]=void 0;return}const E=S instanceof HTMLElement?S:S.$el;g[C]=E instanceof HTMLElement?E:void 0}function w(S){if(n.options.length===0)return;const C=(S+n.options.length)%n.options.length;h.value=C,o.nextTick(()=>{var E;return(E=g[C])==null?void 0:E.focus()})}function x(S){const C=n.options.length;if(C!==0)switch(S.key){case"ArrowDown":S.preventDefault(),w(h.value+1);break;case"ArrowUp":S.preventDefault(),w(h.value-1);break;case"Home":S.preventDefault(),w(0);break;case"End":S.preventDefault(),w(C-1);break;case"Enter":case" ":S.preventDefault(),i(n.options[h.value]),u==null||u.focus();break;case"Escape":S.preventDefault(),S.stopPropagation(),a.value=!1,u==null||u.focus();break;case"Tab":a.value=!1;break}}return o.watch(a,S=>{u==null||u.setAttribute("aria-expanded",String(S)),S&&(h.value=0,o.nextTick(()=>{var C;return(C=g[0])==null?void 0:C.focus()}))}),o.onUnmounted(()=>{u&&u.removeEventListener("keydown",m)}),(S,C)=>e.mobileLayout?(o.openBlock(),o.createBlock(zl,{key:0,show:a.value,"onUpdate:show":C[1]||(C[1]=E=>a.value=E),"disable-background-effect":"","custom-classes":["bx-dropdown-mobile-layout-popup"],closeable:!1},{trigger:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(c),(E,_)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(E),{key:_,ref_for:!0,ref:o.unref(l)(_)},null,512))),128))]),content:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(["pullup-menu-wrapper",{}])},[o.createElementVNode("div",{class:"pullup-menu",role:"menu","aria-label":e.ariaLabel},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.options,E=>(o.openBlock(),o.createElementBlock("button",{type:"button",role:"menuitem",class:"select-button",onClick:_=>i(E)},[o.createElementVNode("div",DX,[o.createVNode(nt,null,{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(E.icon)))]),_:2},1024)]),o.createElementVNode("div",$X,[s.optionLabel?o.renderSlot(S.$slots,"optionLabel",{option:E},void 0,!0,0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(E.label),1)],64))])],8,TX))),256))],8,MX),o.createElementVNode("div",NX,[o.createElementVNode("button",{type:"button",class:"select-button","aria-label":"Close menu",onClick:C[0]||(C[0]=E=>a.value=!1)},[o.createElementVNode("div",jX,[o.createVNode(nt,null,{default:o.withCtx(()=>[o.createVNode(o.unref(Po))]),_:1})]),C[3]||(C[3]=o.createElementVNode("div",{class:"label"},"Close",-1))])])])]),_:3},8,["show"])):(o.openBlock(),o.createBlock(eu,{key:1,show:a.value,"onUpdate:show":C[2]||(C[2]=E=>a.value=E),trigger:"click","allowed-placements":e.allowedPlacements??["bottom","top"],arrow:!0,"custom-styles":{},"custom-classes":["dropdown-popover"],"disable-background-effect":""},{trigger:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(c),(E,_)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(E),{key:_,ref_for:!0,ref:o.unref(l)(_)},null,512))),128))]),content:o.withCtx(()=>[o.createVNode(wC,{id:o.unref(d),role:"menu","aria-label":e.ariaLabel,onKeydown:x},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.options,(E,_)=>(o.openBlock(),o.createBlock(xC,{key:E.value,ref_for:!0,ref:I=>y(I,_),role:"menuitem",tabindex:_===h.value?0:-1,onClick:I=>i(E)},o.createSlots({default:o.withCtx(()=>[s.optionLabel?o.renderSlot(S.$slots,"optionLabel",{option:E},void 0,!0,0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(E.label),1)],64))]),_:2},[E.icon?{name:"prefix",fn:o.withCtx(()=>[o.createVNode(nt,null,{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(E.icon)))]),_:2},1024)]),key:"0"}:void 0]),1032,["tabindex","onClick"]))),128))]),_:3},8,["id","aria-label"])]),_:3},8,["show","allowed-placements"]))}}),Qp=Je(RX,[["__scopeId","data-v-f3fd4a7e"]]);function kc(e){return new Promise(function(t,n){if(typeof e!="string"&&!(e instanceof Blob)){n({err:"no image source"});return}const r=new Image;r.addEventListener("load",a=>{t({width:r.width,height:r.height,ratio:r.height/r.width})}),r.addEventListener("error",()=>n({err:"image corrupted"})),r.src=typeof e=="string"?e:URL.createObjectURL(e)})}function CC({height:e,left:t,top:n,width:r},a,i){const s=1/Math.max((r??0)/a,(e??0)/i),d=[Math.min(1,Ya(Math.max(1e-6,t??0)/(a-(r??0)),6)),Math.min(1,Ya(Math.max(1e-6,n??0)/(i-(e??0)),6))],l=[Math.max(-1,Math.min(1,(d[0]-.5)*2)),Math.max(-1,Math.min(1,(d[1]-.5)*2))];return{scale:s,innerPos:l}}function J1(e,t,n,r){const a=e.innerPos[0]/2+.5,i=e.innerPos[1]/2+.5,s=t/n>r?n*r:t,d=t/n>r?n:t/r,l=s/e.scale,c=d/e.scale,f=t-l,m=n-c,u=f*a,h=m*i;return{left:u,top:h,width:l,height:c}}var FX=Object.defineProperty,VX=(e,t,n)=>t in e?FX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dr=(e,t,n)=>VX(e,typeof t!="symbol"?t+"":t,n);function UX(e){return e*Math.PI/180}function c8(e,t,n){return Math.min(Math.max(e,t),n)}function Mf(e,t,n){const[r,a]=e,[i,s]=t,d=Math.cos(n)*(r-i)-Math.sin(n)*(a-s)+i,l=Math.sin(n)*(r-i)+Math.cos(n)*(a-s)+s;return[d,l]}function ZX(e){return e.deltaMode===0}let qX=class extends EventTarget{constructor(t,n,r,a,i,s,d=.1,l=10,c=!1,f=!0){super(),dr(this,"wrapperBounds",{x:0,y:0,width:100,height:100}),dr(this,"canvasBounds",{x:0,y:0,width:100,height:100}),dr(this,"translateSpeed",1),dr(this,"zoomSpeed",1),dr(this,"translateSpeedAppleTrackpad",1),dr(this,"zoomSpeedAppleTrackpad",1),dr(this,"isGestureActive",!1),dr(this,"roElement",null),dr(this,"roCanvas",null),dr(this,"ancestorMotionCleanup",null),dr(this,"gestureStartRotate",0),dr(this,"dragStart",null),dr(this,"dragStartFrozenX",null),dr(this,"dragStartFrozenY",null),dr(this,"touchStarts",null),dr(this,"touchStartTranslateX",0),dr(this,"touchStartTranslateY",0),this.element=t,this.offset=n,this.translateX=r,this.translateY=a,this.scale=i,this.rotate=s,this.minScale=d,this.maxScale=l,this.clampBounds=c,this.rotation=f,this.roElement=new ResizeObserver(()=>{const{x:m,y:u,width:h,height:g}=this.element.getBoundingClientRect();this.wrapperBounds={x:m,y:u,width:h,height:g},this.update()}),this.roCanvas=new ResizeObserver(m=>{const{width:u,height:h}=m[0].contentRect;(u!==this.canvasBounds.width||h!==this.canvasBounds.height)&&(this.canvasBounds={...this.canvasBounds,width:u,height:h},this.isGestureActive||this.update())}),requestAnimationFrame(()=>{this.wrapperBounds=this.element.getBoundingClientRect(),this.canvasBounds=this.canvasElement.getBoundingClientRect(),this.update(),this.dispatchEvent(new Event("init"))}),this.roCanvas.observe(this.canvasElement),this.roElement.observe(this.element),this.installAncestorMotionListeners()}installAncestorMotionListeners(){const t=()=>{const{x:i,y:s,width:d,height:l}=this.element.getBoundingClientRect();i===this.wrapperBounds.x&&s===this.wrapperBounds.y&&d===this.wrapperBounds.width&&l===this.wrapperBounds.height||(this.wrapperBounds={x:i,y:s,width:d,height:l},this.update())},n=i=>!(i instanceof Node)||i===this.element?!1:i.contains(this.element),r=i=>{n(i.target)&&t()},a=["transitionrun","transitionend","transitioncancel","animationend","animationcancel"];for(const i of a)document.addEventListener(i,r,!0);this.ancestorMotionCleanup=()=>{for(const i of a)document.removeEventListener(i,r,!0)}}get canvasElement(){return this.element.querySelector(".canvas")}get wrapperInnerX(){return this.wrapperBounds.x+this.offset.left}get wrapperInnerY(){return this.wrapperBounds.y+this.offset.top}get wrapperInnerWidth(){return this.wrapperBounds.width-this.offset.left-this.offset.right}get wrapperInnerHeight(){return this.wrapperBounds.height-this.offset.top-this.offset.bottom}get wrapperInnerRatio(){return this.wrapperInnerWidth/this.wrapperInnerHeight}get canvasNaturalRatio(){return this.canvasBounds.width/this.canvasBounds.height}get naturalScale(){return this.canvasNaturalRatio>=this.wrapperInnerRatio?this.wrapperInnerWidth/this.canvasBounds.width:this.wrapperInnerHeight/this.canvasBounds.height}setTranslateFromUserGesture(t,n){if(this.clampBounds){const r=this.clampTranslate({translateX:t,translateY:n,scale:this.scale,rotate:this.rotate});this.translateX=r.translateX,this.translateY=r.translateY,this.rotate=0}else this.translateX=t,this.translateY=n}handleGesturestart(t){this.gestureStartRotate=this.rotate}handleGesturechange(t){const{clientX:n,clientY:r}=t,a=t.rotation;if(a===0||!this.rotation)return;const i=this.normalizeClientCoords(n,r);this.rotateCanvas(i[0],i[1],this.gestureStartRotate+UX(a))}handleGestureend(t){}handleMousedown(t){t.preventDefault(),this.dragStart=[t.clientX,t.clientY],this.dragStartFrozenX=this.translateX,this.dragStartFrozenY=this.translateY}handleMouseup(t){t.preventDefault(),this.dragStart=null,this.dragStartFrozenX=null,this.dragStartFrozenY=null}handleMousemove(t){if(t.preventDefault(),this.dragStart&&this.dragStartFrozenX!==null&&this.dragStartFrozenY!==null){const n=t.clientX-this.dragStart[0],r=t.clientY-this.dragStart[1],a=this.dragStartFrozenX- -n,i=this.dragStartFrozenY- -r;this.setTranslateFromUserGesture(a,i),this.update()}}handleWheel(t){let{deltaX:n,deltaY:r,ctrlKey:a}=t;const i=ZX(t);i||(Math.abs(r)>=100&&(r=Math.sign(r)*(Math.abs(r)/120)),Math.abs(n)>=100&&(n=Math.sign(n)*(Math.abs(n)/120)));const s=this.scale;if(a){const d=i?.01*this.zoomSpeedAppleTrackpad:.1*this.zoomSpeed,l=1+-r*d;let c=s*l;if(c=c8(c,this.minScale,this.maxScale),(c===this.minScale||c===this.maxScale)&&(c===this.minScale&&l<1||c===this.maxScale&&l>1)){t.preventDefault();return}const f=this.relativeWrapperCoordinatesFromClientCoords(t.clientX,t.clientY),[m,u]=this.calcProjectionTranslate(c,f,this.normalizeMatrixCoordinates(t.clientX,t.clientY));this.setTranslateFromUserGesture(m,u),this.scale=c}else{const d=i?1*this.translateSpeedAppleTrackpad:25*this.translateSpeed;this.setTranslateFromUserGesture(this.translateX-n*d,this.translateY-r*d)}this.update(),t.preventDefault()}freezeTouches(t){return Array.from(t).map(n=>{const r=this.clientCoordsToWrapperCoords(n.clientX,n.clientY);return{client:[n.clientX,n.clientY],canvasRel:this.getCanvasCoordsRel(r[0],r[1])}})}handleTouchstart(t){this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY,this.isGestureActive=!0,t.preventDefault()}handleTouchmove(t){t.preventDefault();const n=Array.from(t.touches).map(r=>this.clientCoordsToWrapperCoords(r.clientX,r.clientY));if(this.touchStarts){if(n.length>=2&&this.touchStarts.length>=2){const r=[this.touchStarts[0].canvasRel[0]*this.canvasBounds.width,this.touchStarts[0].canvasRel[1]*this.canvasBounds.height],a=[this.touchStarts[1].canvasRel[0]*this.canvasBounds.width,this.touchStarts[1].canvasRel[1]*this.canvasBounds.height],i=Math.sqrt(Math.pow(r[0]-a[0],2)+Math.pow(r[1]-a[1],2)),s=Math.sqrt(Math.pow(n[0][0]-n[1][0],2)+Math.pow(n[0][1]-n[1][1],2))/this.naturalScale,d=c8(s/i,this.minScale,this.maxScale),l=[n[0][0]/this.wrapperInnerWidth,n[0][1]/this.wrapperInnerHeight],c=this.touchStarts[0].canvasRel,[f,m]=this.calcProjectionTranslate(d,l,c,0);if(this.rotation){let u=0,h=0,g=0;const y=Math.atan2(a[1]-r[1],a[0]-r[0]);g=Math.atan2(n[1][1]-n[0][1],n[1][0]-n[0][0])-y;const w=(E,_)=>[this.offset.left+this.canvasBounds.width*E*this.naturalScale*d+f,this.offset.top+this.canvasBounds.height*_*this.naturalScale*d+m],x=w(0,0),S=w(this.touchStarts[0].canvasRel[0],this.touchStarts[0].canvasRel[1]),C=Mf(x,S,g);u=C[0]-x[0],h=C[1]-x[1],this.scale=d,this.rotate=g,this.setTranslateFromUserGesture(f+u,m+h)}else this.scale=d,this.setTranslateFromUserGesture(f,m)}else{const r=t.touches[0].clientX-this.touchStarts[0].client[0],a=t.touches[0].clientY-this.touchStarts[0].client[1],i=this.touchStartTranslateX+r,s=this.touchStartTranslateY+a;this.setTranslateFromUserGesture(i,s)}this.update()}}handleTouchend(t){t.touches.length===0?this.touchStarts=null:(this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY),this.isGestureActive=!1}calcProjectionTranslate(t,n,r,a){const i=this.canvasBounds.width*this.naturalScale,s=this.canvasBounds.height*this.naturalScale,d=r[0]*i*t,l=r[1]*s*t,c=Mf([d,l],[0,0],a??this.rotate),f=n[0]*this.wrapperInnerWidth,m=n[1]*this.wrapperInnerHeight,u=f-c[0],h=m-c[1];return[u,h]}applyTransform(t,n,r){const a=this.calcProjectionTranslate(t,n,r,0);this.scale=t,this.setTranslateFromUserGesture(a[0],a[1]),this.update()}composeRelPoint(t,n,r,a,i,s){r=r??this.scale,a=a??this.translateX,i=i??this.translateY,s=s??this.rotate;const d=[this.offset.left,this.offset.top],l=[this.offset.left+this.canvasBounds.width*(r*this.naturalScale)*t,this.offset.top+this.canvasBounds.height*(r*this.naturalScale)*n],c=Mf(l,d,s);return[c[0]+a,c[1]+i]}composePoint(t,n){const r=t/this.canvasBounds.width,a=n/this.canvasBounds.height;return this.composeRelPoint(r,a)}getAnchorOffset(t,n,r,a,i=[.5,.5]){const s=this.calcProjectionTranslate(t,i,i,0),d=[this.offset.left+s[0]+this.canvasBounds.width*(t*this.naturalScale)*i[0],this.offset.top+s[1]+this.canvasBounds.height*(t*this.naturalScale)*i[1]],l=this.composeRelPoint(i[0],i[1],t,n,r,a),c=l[0]-d[0],f=l[1]-d[1];return[c,f]}getCanvasCoordsRel(t,n){const r=[0,0],a=[t-this.translateX,n-this.translateY],i=Mf(a,r,-this.rotate),s=[i[0]/this.renderinScale,i[1]/this.renderinScale];return[s[0]/this.canvasBounds.width,s[1]/this.canvasBounds.height]}clientCoordsToWrapperCoords(t,n){const{x:r,y:a}=this.element.getBoundingClientRect();return[t-r-this.offset.left,n-a-this.offset.top]}relativeWrapperCoordinatesFromClientCoords(t,n){const[r,a]=this.clientCoordsToWrapperCoords(t,n);return[r/this.wrapperInnerWidth,a/this.wrapperInnerHeight]}normalizeMatrixCoordinates(t,n){const r=this.clientCoordsToWrapperCoords(t,n);return this.getCanvasCoordsRel(r[0],r[1])}normalizeClientCoords(t,n){const[r,a]=this.normalizeMatrixCoordinates(t,n);return[r*this.canvasBounds.width,a*this.canvasBounds.height]}rotateCanvas(t,n,r){const a=t/this.canvasBounds.width,i=n/this.canvasBounds.height,s=this.composeRelPoint(a,i,this.scale,0,0,r),d=this.composeRelPoint(a,i);this.setTranslateFromUserGesture(d[0]-s[0],d[1]-s[1]),this.rotate=r,this.update()}get renderinScale(){return this.naturalScale*this.scale}get renderingTranslateX(){return this.offset.left+this.translateX}get renderingTranslateY(){return this.offset.top+this.translateY}get renderingRotate(){return this.rotate}clampTranslate(t,n=[.5,.5]){const r=this.canvasBounds.width*this.naturalScale*t.scale,a=this.canvasBounds.height*this.naturalScale*t.scale,i=r-this.wrapperInnerWidth,s=a-this.wrapperInnerHeight,d=i>0?-i:0,l=Math.min(0,Math.max(t.translateX,d)),c=s>0?-s:0,f=Math.min(0,Math.max(t.translateY,c)),m=-Math.min(0,i)*n[0],u=-Math.min(0,s)*n[1];return{translateX:l+m,translateY:f+u}}update(){this.canvasElement.style.transformOrigin="top left",this.canvasElement.style.transform=`translateX(${this.renderingTranslateX}px) translateY(${this.renderingTranslateY}px) scale(${this.renderinScale}) rotate(${this.renderingRotate}rad)`,this.dispatchEvent(new Event("update"))}destroy(){var t,n,r;(t=this.roElement)==null||t.disconnect(),this.roElement=null,(n=this.roCanvas)==null||n.disconnect(),this.roCanvas=null,(r=this.ancestorMotionCleanup)==null||r.call(this),this.ancestorMotionCleanup=null}};const HX={class:"canvas"},WX={class:"matrix"},GX=o.defineComponent({__name:"Zoompinch",props:{transform:{default:()=>({translateX:0,translateY:0,scale:1,rotate:0})},offset:{default:()=>({left:0,top:0,right:0,bottom:0})},maxScale:{default:10},minScale:{default:.5},clampBounds:{type:Boolean,default:!1},rotation:{type:Boolean,default:!0},mouse:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},touch:{type:Boolean,default:!0},gesture:{type:Boolean,default:!0},zoomSpeed:{},translateSpeed:{},zoomSpeedAppleTrackpad:{},translateSpeedAppleTrackpad:{}},emits:["update:transform","init","dragGestureStart","dragGestureEnd"],setup(e,{expose:t,emit:n}){const r=e,a=n,i=o.ref(),s=o.ref(),d=o.ref(!1);window.zoompinchEngine=s;const l=o.ref(()=>{throw new Error("Not initialized yet")}),c=o.ref(0),f=o.ref(0);o.onMounted(()=>{i.value&&(s.value=new qX(i.value,r.offset,r.transform.translateX,r.transform.translateY,r.transform.scale,r.transform.rotate,r.minScale,r.maxScale,r.clampBounds,r.rotation),r.zoomSpeed!==void 0&&(s.value.zoomSpeed=r.zoomSpeed),r.translateSpeed!==void 0&&(s.value.translateSpeed=r.translateSpeed),r.zoomSpeedAppleTrackpad!==void 0&&(s.value.zoomSpeedAppleTrackpad=r.zoomSpeedAppleTrackpad),r.translateSpeedAppleTrackpad!==void 0&&(s.value.translateSpeedAppleTrackpad=r.translateSpeedAppleTrackpad),s.value.addEventListener("init",()=>{a("init")}),s.value.addEventListener("update",()=>{if(!s.value)return;const k={translateX:s.value.translateX,translateY:s.value.translateY,scale:s.value.scale,rotate:s.value.rotate};(k.translateX!==r.transform.translateX||k.translateY!==r.transform.translateY||k.scale!==r.transform.scale||k.rotate!==r.transform.rotate)&&a("update:transform",k),l.value=(P,z)=>s.value.composePoint(P,z),c.value=s.value.canvasBounds.width,f.value=s.value.canvasBounds.height}),s.value.addEventListener("init",()=>{d.value=!0}))}),o.watch(()=>r.transform,()=>{s.value&&(s.value.translateX!==r.transform.translateX||s.value.translateY!==r.transform.translateY||s.value.scale!==r.transform.scale||s.value.rotate!==r.transform.rotate)&&(s.value.translateX=r.transform.translateX,s.value.translateY=r.transform.translateY,s.value.scale=r.transform.scale,s.value.rotate=r.transform.rotate,s.value.update())},{deep:!0}),o.watch(()=>r.offset,k=>{s.value&&(s.value.offset=k,s.value.update())},{deep:!0}),o.watch(()=>r.minScale,k=>{s.value&&(s.value.minScale=k,s.value.update())}),o.watch(()=>r.maxScale,k=>{s.value&&(s.value.maxScale=k,s.value.update())}),o.watch(()=>r.clampBounds,k=>{s.value&&(s.value.clampBounds=k,s.value.setTranslateFromUserGesture(s.value.translateX,s.value.translateY),s.value.update())}),o.watch(()=>r.rotation,k=>{s.value&&(s.value.rotation=k,s.value.update())}),o.watch(()=>r.zoomSpeed,()=>{!s.value||r.zoomSpeed===void 0||(s.value.zoomSpeed=r.zoomSpeed)}),o.watch(()=>r.translateSpeed,()=>{!s.value||r.translateSpeed===void 0||(s.value.translateSpeed=r.translateSpeed)}),o.watch(()=>r.zoomSpeedAppleTrackpad,()=>{!s.value||r.zoomSpeedAppleTrackpad===void 0||(s.value.zoomSpeedAppleTrackpad=r.zoomSpeedAppleTrackpad)}),o.watch(()=>r.translateSpeedAppleTrackpad,()=>{!s.value||r.translateSpeedAppleTrackpad===void 0||(s.value.translateSpeedAppleTrackpad=r.translateSpeedAppleTrackpad)});const m=(k,P,z,$)=>{s.value&&($!==void 0&&(s.value.rotate=$),s.value.applyTransform(k,P,z))},u=k=>{s.value&&r.wheel&&s.value.handleWheel(k)},h=k=>{s.value&&r.gesture&&s.value.handleGesturestart(k)},g=k=>{s.value&&r.gesture&&s.value.handleGesturechange(k)},y=k=>{s.value&&r.gesture&&s.value.handleGestureend(k)},w=k=>{s.value&&r.mouse&&s.value.handleMousedown(k)},x=k=>{s.value&&r.mouse&&s.value.handleMousemove(k)},S=k=>{s.value&&r.mouse&&s.value.handleMouseup(k)},C=k=>{s.value&&r.touch&&s.value.handleTouchstart(k)},E=k=>{s.value&&r.touch&&s.value.handleTouchmove(k)},_=k=>{s.value&&r.touch&&s.value.handleTouchend(k)};window.addEventListener("gesturechange",g),window.addEventListener("gestureend",y),window.addEventListener("mousemove",x),window.addEventListener("mouseup",S),window.addEventListener("touchmove",E),window.addEventListener("touchend",_),o.onUnmounted(()=>{window.removeEventListener("gesturechange",g),window.removeEventListener("gestureend",y),window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",S),window.removeEventListener("touchmove",E),window.removeEventListener("touchend",_)});const I=(k,P)=>{if(!s.value)throw new Error("Zoompinch engine not initialized");return s.value.normalizeClientCoords(k,P)},B=(k,P,z)=>{s.value&&s.value.rotateCanvas(k,P,z)};return o.useSlots(),t({applyTransform:m,composePoint:l,normalizeClientCoords:I,zoompinchEngine:s,canvasWidth:c,canvasHeight:f,rotateCanvas:B}),(k,P)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"zoompinchRef",ref:i,class:"zoompinch",onWheel:u,onGesturestart:h,onMousedown:w,onTouchstart:C},[o.createElementVNode("div",HX,[o.renderSlot(k.$slots,"default",{},void 0,!0)]),o.createElementVNode("div",WX,[d.value&&l.value?o.renderSlot(k.$slots,"matrix",{key:0,composePoint:l.value,normalizeClientCoords:I,canvasWidth:c.value,canvasHeight:f.value},void 0,!0):o.createCommentVNode("",!0)])],544))}}),XX=(e,t)=>{const n=e.__vccOpts||e;for(const[r,a]of t)n[r]=a;return n},SC=XX(GX,[["__scopeId","data-v-fbdbcf7c"]]),zd=new Set;requestAnimationFrame(function e(){zd.forEach(t=>t()),requestAnimationFrame(e)});function u8(e,t,n){let r;const a=()=>{const s=e instanceof Function?e():e.value,d=r;s!==r&&(r=s,t(s,d))};return zd.add(a),()=>{zd.delete(a)}}function Zg(e,t){let n=null;const r=this;return()=>{clearTimeout(n);var a=arguments;n=setTimeout(()=>{e.apply(r,a)},t)}}const YX=["x","y","width","height"],KX=["cx","cy","r"],JX=["cx","cy","r"],QX=["cx","cy","r"],eY=["cx","cy","r"],tY=["cx","cy","r"],nY=["cx","cy","r"],rY=["cx","cy","r"],aY=["cx","cy","r"],oY=["cx","cy","r"],iY=["cx","cy","r"],sY=["cx","cy","r"],lY=["cx","cy","r"],cY=["cx","cy","r"],uY=["cx","cy","r"],dY=["cx","cy","r"],fY=["cx","cy","r"],pY=o.defineComponent({__name:"CropSkeleton",props:{x:{},y:{},width:{},height:{},aspectRatio:{},clamp:{}},emits:["update","effectiveHandleChange"],setup(e,{emit:t}){const n=e,r=t,a=o.ref(5),i=o.computed(()=>{const O=Math.min(n.width,n.height);return O>=a.value*8?a.value*4:Math.max(O/2,a.value)}),s=o.computed(()=>({x:n.x,y:n.y})),d=o.computed(()=>({x:n.x+n.width,y:n.y})),l=o.computed(()=>({x:n.x+n.width,y:n.y+n.height})),c=o.computed(()=>({x:n.x,y:n.y+n.height})),f=o.computed(()=>({x:n.x+n.width/2,y:n.y})),m=o.computed(()=>({x:n.x+n.width,y:n.y+n.height/2})),u=o.computed(()=>({x:n.x+n.width/2,y:n.y+n.height})),h=o.computed(()=>({x:n.x,y:n.y+n.height/2})),g=o.computed(()=>n.width>a.value*4&&n.height>a.value*4),y=o.ref(null),w=o.ref(null),x=o.ref(null),S=o.ref(null),C=o.ref(null),E=o.ref(null),_=o.ref(null);o.watch(E,O=>{r("effectiveHandleChange",O)});function I(O,D){console.log("handleThumbMouseDown",O,D),C.value=D,E.value=D,_.value=null,x.value={x:n.x,y:n.y,width:n.width,height:n.height},S.value={x:O.clientX,y:O.clientY},O.preventDefault(),O.stopPropagation()}function B(O,D){console.log("handleThumbTouchstart",O,D);const R=O.touches[0];C.value=D,E.value=D,_.value=null,x.value={x:n.x,y:n.y,width:n.width,height:n.height},S.value={x:R.clientX,y:R.clientY},O.preventDefault(),O.stopPropagation()}const k=()=>{C.value=null,E.value=null,_.value=null,x.value=null,S.value=null,y.value=null,w.value=null},P=()=>{C.value=null,E.value=null,_.value=null,x.value=null,S.value=null,y.value=null,w.value=null},z=O=>{if(y.value){if(!x.value)return;const D=O.clientX-y.value.x,R=O.clientY-y.value.y;w.value={x:x.value.x+D,y:x.value.y+R,width:x.value.width,height:x.value.height}}else C.value&&(_.value={x:O.clientX,y:O.clientY})},$=O=>{const D=O.touches[0];if(y.value){if(!x.value)return;const R=D.clientX-y.value.x,W=D.clientY-y.value.y;w.value={x:x.value.x+R,y:x.value.y+W,width:x.value.width,height:x.value.height}}else C.value&&(_.value={x:D.clientX,y:D.clientY})};function j(O){y.value={x:O.clientX,y:O.clientY},S.value={x:O.clientX,y:O.clientY},x.value={x:n.x,y:n.y,width:n.width,height:n.height},O.preventDefault(),O.stopPropagation()}function p(O){const D=O.touches[0];y.value={x:D.clientX,y:D.clientY},S.value={x:D.clientX,y:D.clientY},x.value={x:n.x,y:n.y,width:n.width,height:n.height},O.preventDefault(),O.stopPropagation()}function H(O){var se,ie;const D=((se=n.clamp)==null?void 0:se.x)??-1/0,R=((ie=n.clamp)==null?void 0:ie.y)??-1/0,W=n.clamp?n.clamp.x+n.clamp.width:1/0,ee=n.clamp?n.clamp.y+n.clamp.height:1/0;return{x:Math.min(Math.max(O.x,D),W-O.width),y:Math.min(Math.max(O.y,R),ee-O.height),width:O.width,height:O.height}}function F(O){const D=O.shiftKey?10:4;let R=0,W=0;switch(O.key){case"ArrowLeft":R=-D;break;case"ArrowRight":R=D;break;case"ArrowUp":W=-D;break;case"ArrowDown":W=D;break;default:return}O.preventDefault();const ee={x:n.x,y:n.y,width:n.width,height:n.height};if(O.shiftKey)if(n.aspectRatio!=null){const ie=O.key==="ArrowRight"||O.key==="ArrowDown"?D:-D,{bbox:le}=L("br",ee,ie,ie,n.aspectRatio,n.clamp);r("update",le)}else{const{bbox:se}=L("br",ee,R,W,void 0,n.clamp);r("update",se)}else r("update",H({...ee,x:ee.x+R,y:ee.y+W}))}function Z(O,D,R){const W={tl:"tr",tr:"tl",bl:"br",br:"bl",l:"r",r:"l"},ee={tl:"bl",bl:"tl",tr:"br",br:"tr",t:"b",b:"t"};let se=O;return D&&(se=W[se]??se),R&&(se=ee[se]??se),se}function L(O,D,R,W,ee,se){let ie=D.x,le=D.y,ue=D.x+D.width,he=D.y+D.height;switch(O){case"tl":ie+=R,le+=W;break;case"t":le+=W;break;case"tr":ue+=R,le+=W;break;case"r":ue+=R;break;case"br":ue+=R,he+=W;break;case"b":he+=W;break;case"bl":ie+=R,he+=W;break;case"l":ie+=R;break}const Y=ie>ue,M=le>he,N=Z(O,Y,M),q=(se==null?void 0:se.x)??-1/0,ae=(se==null?void 0:se.y)??-1/0,oe=se?se.x+se.width:1/0,re=se?se.y+se.height:1/0;if(ee!=null)if(O==="tl"||O==="tr"||O==="bl"||O==="br"){const Oe=O==="tl"||O==="bl"?ue:ie,_e=O==="tl"||O==="tr"?he:le,be=O==="tl"||O==="bl"?ie:ue,Ne=O==="tl"||O==="tr"?le:he,Ze=be>=Oe,De=Ne>=_e;let Fe=Math.max(Math.abs(be-Oe),1),pe=Math.max(Math.abs(Ne-_e),1);if(Fe/pe>ee?Fe=pe*ee:pe=Fe/ee,se){const Ae=Ze?oe-Oe:Oe-q,Xe=De?re-_e:_e-ae;(Fe>Ae||pe>Xe)&&(Ae/Xe>ee?(pe=Math.min(pe,Xe),Fe=pe*ee):(Fe=Math.min(Fe,Ae),pe=Fe/ee))}Ze?(ie=Oe,ue=Oe+Fe):(ue=Oe,ie=Oe-Fe),De?(le=_e,he=_e+pe):(he=_e,le=_e-pe)}else if(O==="r"||O==="l"){const _e=O==="r"?D.x:D.x+D.width,be=O==="r"?ue:ie,Ne=D.y+D.height/2,Ze=be>=_e;let De=Math.max(Math.abs(be-_e),1);if(se){const pe=Ze?oe-_e:_e-q,Ae=Math.min(Ne-ae,re-Ne)*2;De=Math.max(Math.min(De,pe,Ae*ee),1)}const Fe=De/ee;Ze?(ie=_e,ue=_e+De):(ue=_e,ie=_e-De),le=Ne-Fe/2,he=Ne+Fe/2}else{const _e=O==="b"?D.y:D.y+D.height,be=O==="b"?he:le,Ne=D.x+D.width/2,Ze=be>=_e;let De=Math.max(Math.abs(be-_e),1);if(se){const pe=Ze?re-_e:_e-ae,Ae=Math.min(Ne-q,oe-Ne)*2;De=Math.max(Math.min(De,pe,Ae/ee),1)}const Fe=De*ee;Ze?(le=_e,he=_e+De):(he=_e,le=_e-De),ie=Ne-Fe/2,ue=Ne+Fe/2}else{const me=Math.min(ie,ue),Oe=Math.min(le,he),_e=Math.max(ie,ue),be=Math.max(le,he);ie=me,le=Oe,ue=_e,he=be,se&&(ie=Math.max(ie,q),le=Math.max(le,ae),ue=Math.min(ue,oe),he=Math.min(he,re))}return{bbox:{x:ie,y:le,width:ue-ie,height:he-le},effectiveHandle:N}}return u8(w,()=>{var O,D;if(w.value){const R=((O=n.clamp)==null?void 0:O.x)??-1/0,W=((D=n.clamp)==null?void 0:D.y)??-1/0,ee=n.clamp?n.clamp.x+n.clamp.width:1/0,se=n.clamp?n.clamp.y+n.clamp.height:1/0;w.value.x<R&&(w.value.x=R),w.value.y<W&&(w.value.y=W),w.value.x+w.value.width>ee&&(w.value.x=ee-w.value.width),w.value.y+w.value.height>se&&(w.value.y=se-w.value.height),r("update",w.value)}}),u8(_,()=>{if(!C.value||!_.value||!S.value||!x.value)return;const O=_.value.x-S.value.x,D=_.value.y-S.value.y,{bbox:R,effectiveHandle:W}=L(C.value,x.value,O,D,n.aspectRatio,n.clamp);E.value=W,r("update",R)}),window.addEventListener("mouseup",k),window.addEventListener("touchend",P),window.addEventListener("mousemove",z),window.addEventListener("touchmove",$),o.onUnmounted(()=>{window.removeEventListener("mouseup",k),window.removeEventListener("touchend",P),window.removeEventListener("mousemove",z),window.removeEventListener("touchmove",$)}),(O,D)=>(o.openBlock(),o.createElementBlock("g",null,[o.createElementVNode("rect",{x:e.x,y:e.y,width:e.width,height:e.height,class:"skeleton-rect",tabindex:"0",role:"application","aria-roledescription":"Crop area","aria-label":"Crop area. Use arrow keys to move, Shift plus arrow keys to resize.",onMousedown:j,onTouchstart:p,onKeydown:F},null,40,YX),o.createElementVNode("g",{class:o.normalizeClass({inactive:!g.value})},[o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-t",onMousedown:D[0]||(D[0]=R=>I(R,"t")),onTouchstart:D[1]||(D[1]=R=>B(R,"t"))},null,40,KX),o.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="t"}])},null,10,JX)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:m.value.x,cy:m.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-r",onMousedown:D[2]||(D[2]=R=>I(R,"r")),onTouchstart:D[3]||(D[3]=R=>B(R,"r"))},null,40,QX),o.createElementVNode("circle",{cx:m.value.x,cy:m.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="r"}])},null,10,eY)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-b",onMousedown:D[4]||(D[4]=R=>I(R,"b")),onTouchstart:D[5]||(D[5]=R=>B(R,"b"))},null,40,tY),o.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="b"}])},null,10,nY)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-l",onMousedown:D[6]||(D[6]=R=>I(R,"l")),onTouchstart:D[7]||(D[7]=R=>B(R,"l"))},null,40,rY),o.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="l"}])},null,10,aY)])],2),o.createElementVNode("g",null,[o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:s.value.x,cy:s.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tl",onMousedown:D[8]||(D[8]=R=>I(R,"tl")),onTouchstart:D[9]||(D[9]=R=>B(R,"tl"))},null,40,oY),o.createElementVNode("circle",{cx:s.value.x,cy:s.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="tl"}])},null,10,iY)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tr",onMousedown:D[10]||(D[10]=R=>I(R,"tr")),onTouchstart:D[11]||(D[11]=R=>B(R,"tr"))},null,40,sY),o.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="tr"}])},null,10,lY)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:c.value.x,cy:c.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-bl",onMousedown:D[12]||(D[12]=R=>I(R,"bl")),onTouchstart:D[13]||(D[13]=R=>B(R,"bl"))},null,40,cY),o.createElementVNode("circle",{cx:c.value.x,cy:c.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="bl"}])},null,10,uY)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-br",onMousedown:D[14]||(D[14]=R=>I(R,"br")),onTouchstart:D[15]||(D[15]=R=>B(R,"br"))},null,40,dY),o.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="br"}])},null,10,fY)])])]))}}),mY=Je(pY,[["__scopeId","data-v-ab8c8451"]]);function hc(e,t,n){return Math.min(Math.max(e,t),n)}function hY(e,t){const n=hc(e.x,t.x,t.x+t.width),r=hc(e.y,t.y,t.y+t.height),a=hc(e.x+e.width,t.x,t.x+t.width),i=hc(e.y+e.height,t.y,t.y+t.height);return{x:n,y:r,width:a-n,height:i-r}}function gY(e,t,n){if(n==null)return hY(e,t);let r=e.width,a=e.height;r>t.width&&(r=t.width,a=r/n),a>t.height&&(a=t.height,r=a*n);const i=hc(e.x,t.x,t.x+t.width-r),s=hc(e.y,t.y,t.y+t.height-a);return{x:i,y:s,width:r,height:a}}function vY(e){return new Promise((t,n)=>{if(e.complete&&e.naturalWidth!==0){console.log("[0] getBoundingClientRect",e.getBoundingClientRect()),t();return}const r=()=>{e.naturalWidth*e.naturalHeight>0&&(console.log("[1] getBoundingClientRect",e.getBoundingClientRect()),setTimeout(()=>{console.log("[2] getBoundingClientRect",e.getBoundingClientRect()),t()}),zd.delete(r))};zd.add(r),e.addEventListener("error",()=>n(new Error("Failed to load image")),{once:!0})})}const bY={class:"bx-cropper"},yY={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",class:"matrix-svg"},wY={key:0,class:"layer loading-layer"},xY={class:"layer"},CY=o.defineComponent({__name:"BxCropper",props:{crop:{},aspectRatio:{},offset:{default:()=>({top:10,right:10,bottom:10,left:10})},mirrorX:{type:Boolean,default:!1},mirrorY:{type:Boolean,default:!1}},emits:["update:crop"],setup(e,{emit:t}){const n=e,r=t;o.useSlots();const a=o.ref(),i=o.ref({translateX:0,translateY:0,scale:1,rotate:0}),s=o.ref(),d=o.ref();function l(w){let{left:x,top:S,width:C,height:E}=w;return n.mirrorX&&a.value&&(x=a.value.canvasWidth-x-C),n.mirrorY&&a.value&&(S=a.value.canvasHeight-S-E),{left:x,top:S,width:C,height:E}}function c(w){if(!a.value)throw new Error("Zoompinch ref not available");const x=l(w),[S,C]=a.value.composePoint(x.left,x.top),[E,_]=a.value.composePoint(x.left+x.width,x.top+x.height),I=E-S,B=_-C;return{x:S,y:C,width:I,height:B}}function f(w){if(!a.value||!a.value.zoompinchEngine)throw new Error("Zoompinch ref or engine not available");const x=w.x+(a.value.zoompinchEngine.wrapperInnerX-n.offset.left),S=w.y+(a.value.zoompinchEngine.wrapperInnerY-n.offset.top),[C,E]=a.value.normalizeClientCoords(x,S),[_,I]=a.value.normalizeClientCoords(x+w.width,S+w.height),B=_-C,k=I-E;return{left:Math.round(C),top:Math.round(E),width:Math.round(B),height:Math.round(k)}}const m=o.ref(!1);async function u(){var S;if(!((S=a.value)!=null&&S.zoompinchEngine))return;const w=Array.from(a.value.zoompinchEngine.canvasElement.children);for(const C of w)C.tagName==="IMG"&&await vY(C);m.value=!0,a.value.applyTransform(1,[.5,.5],[.5,.5]);const x=n.crop??(()=>{const C=a.value.canvasWidth,E=a.value.canvasHeight,_=C/E;if(n.aspectRatio){const I=_>n.aspectRatio?E*n.aspectRatio:C,B=_>n.aspectRatio?E:C/n.aspectRatio;return{left:(C-I)/2,top:(E-B)/2,width:I,height:B}}else return{left:0,top:0,width:C,height:E}})();d.value=x,s.value=c(x)}const h=o.ref(null);window.test=()=>f(s.value);const g=o.computed(()=>{if(i.value,!a.value)throw new Error("Zoompinch ref not available");return c({left:0,top:0,width:a.value.canvasWidth,height:a.value.canvasHeight})});function y(w){s.value=w}return o.watch(i,()=>{!s.value||!a.value||(s.value=gY(s.value,g.value,n.aspectRatio))}),o.watch(s,w=>{if(!w)return;const x=f(w),S=l(x);d.value=S,r("update:crop",S)}),o.watch([()=>n.mirrorX,()=>n.mirrorY],()=>{!m.value||!d.value||!a.value||(s.value=c(d.value))}),(w,x)=>(o.openBlock(),o.createElementBlock("div",bY,[o.createVNode(o.unref(SC),{ref_key:"zoompinchRef",ref:a,transform:i.value,"onUpdate:transform":x[1]||(x[1]=S=>i.value=S),rotation:!1,"min-scale":1,offset:e.offset,"clamp-bounds":"",onInit:u,class:o.normalizeClass({[`effective-handle-${h.value}`]:h.value!==null})},{default:o.withCtx(()=>[o.renderSlot(w.$slots,"default",{},void 0,!0)]),matrix:o.withCtx(()=>[(o.openBlock(),o.createElementBlock("svg",yY,[s.value?(o.openBlock(),o.createBlock(mY,o.mergeProps({key:0},s.value,{"aspect-ratio":e.aspectRatio,clamp:g.value,onUpdate:y,onEffectiveHandleChange:x[0]||(x[0]=S=>h.value=S)}),null,16,["aspect-ratio","clamp"])):o.createCommentVNode("",!0)])),m.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",wY,[o.createVNode(bs)])),o.createElementVNode("div",xY,[o.renderSlot(w.$slots,"layer",{},void 0,!0)])]),_:3},8,["transform","offset","class"])]))}}),kC=Je(CY,[["__scopeId","data-v-8d2848fa"]]),SY={class:"bx-image-cropper"},kY=["src"],_Y={class:"actions-left"},EY={class:"actions-right"},zY=o.defineComponent({__name:"BxImageCropper",props:o.mergeModels({src:{},aspectRatio:{},offset:{}},{crop:{required:!1},cropModifiers:{},mirrorX:{type:Boolean,required:!1,default:!1},mirrorXModifiers:{},mirrorY:{type:Boolean,required:!1,default:!1},mirrorYModifiers:{}}),emits:o.mergeModels(["cancel","done"],["update:crop","update:mirrorX","update:mirrorY"]),setup(e,{emit:t}){const n=o.useModel(e,"crop"),r=o.useModel(e,"mirrorX"),a=o.useModel(e,"mirrorY"),i=t;function s(){r.value=!r.value}function d(){a.value=!a.value}return(l,c)=>(o.openBlock(),o.createElementBlock("div",SY,[o.createVNode(kC,{"aspect-ratio":e.aspectRatio,crop:n.value,"onUpdate:crop":c[4]||(c[4]=f=>n.value=f),offset:e.offset,"mirror-x":r.value,"mirror-y":a.value},{layer:o.withCtx(()=>[o.createElementVNode("div",{class:"actions-wrapper",onTouchstart:c[2]||(c[2]=o.withModifiers(()=>{},["stop"])),onTouchend:c[3]||(c[3]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("div",_Y,[o.createVNode(yt,{onClick:s,class:o.normalizeClass({active:!0}),"aria-label":"Mirror horizontally"},{icon:o.withCtx(()=>[o.createVNode(nt,null,{default:o.withCtx(()=>[...c[5]||(c[5]=[o.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[o.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[o.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M12.5 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0zM6 9.104a.75.75 0 0 1 1.28-.53L10 11.292a1 1 0 0 1 0 1.414l-2.72 2.72a.75.75 0 0 1-1.28-.53zm1 .603v4.586L9.293 12zm11-.603a.75.75 0 0 0-1.28-.53L14 11.292a1 1 0 0 0 0 1.414l2.72 2.72a.75.75 0 0 0 1.28-.53zm-1 .603v4.586L14.707 12z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1}),o.createVNode(yt,{onClick:d,class:o.normalizeClass({active:!0}),"aria-label":"Mirror vertically"},{icon:o.withCtx(()=>[o.createVNode(nt,null,{default:o.withCtx(()=>[...c[6]||(c[6]=[o.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[o.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[o.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M17.5 12.5a.5.5 0 0 0 0-1h-11a.5.5 0 0 0 0 1zM14.896 18a.75.75 0 0 0 .53-1.28L12.708 14a1 1 0 0 0-1.414 0l-2.72 2.72a.75.75 0 0 0 .53 1.28zm-.603-1H9.707L12 14.707zm.603-11a.75.75 0 0 1 .53 1.28L12.708 10a1 1 0 0 1-1.414 0l-2.72-2.72A.75.75 0 0 1 9.103 6zm-.603 1H9.707L12 9.293z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1})]),o.createElementVNode("div",EY,[o.createVNode(yt,{secondary:"",onClick:c[0]||(c[0]=f=>i("cancel"))},{default:o.withCtx(()=>[...c[7]||(c[7]=[o.createTextVNode(" Cancel ",-1)])]),_:1}),o.createVNode(yt,{active:"",onClick:c[1]||(c[1]=f=>i("done"))},{default:o.withCtx(()=>[...c[8]||(c[8]=[o.createTextVNode(" Done ",-1)])]),_:1})])],32)]),default:o.withCtx(()=>[o.createElementVNode("img",{src:e.src,class:o.normalizeClass(["image",{"mirror-x":r.value,"mirror-y":a.value}])},null,10,kY)]),_:1},8,["aspect-ratio","crop","offset","mirror-x","mirror-y"])]))}}),_C=Je(zY,[["__scopeId","data-v-0924dbd3"]]),EC=.6,zC=.4,d8=.6,f8=(e,t,n)=>Math.min(n,Math.max(t,e));function IC(e){const{faces:t,natural:n,aspectRatio:r,cropMode:a,zoom:i=!1}=e;if(a!=="cover"||!Number.isFinite(r)||r<=0||!(n.width>0)||!(n.height>0))return null;const s=t.filter(_=>_.score>=EC&&_.width>0&&_.height>0);if(s.length===0)return null;const d=Math.min(...s.map(_=>_.x)),l=Math.min(...s.map(_=>_.y)),c=Math.max(...s.map(_=>_.x+_.width)),f=Math.max(...s.map(_=>_.y+_.height)),m=(d+c)/2,u=(l+f)/2,h=n.width/n.height,g=h>r?n.height*r:n.width,y=h>r?n.height:n.width/r;let w=g,x=y;if(i){const _=(c-d)*(1+2*d8),I=(f-l)*(1+2*d8),B=Math.max(_,I*r),k=B/r;w=Math.min(g,B),x=Math.min(y,k)}const S=m-w/2,C=u-x*zC,E={left:f8(S,0,Math.max(0,n.width-w)),top:f8(C,0,Math.max(0,n.height-x)),width:w,height:x};return E.left===0&&E.top===0&&Math.abs(E.width-n.width)<.5&&Math.abs(E.height-n.height)<.5?null:E}let Q1=null;function IY(e){Q1=e}function AC(){return Q1!==null}async function AY(e){if(!Q1)return[];try{const t=await Q1(e);return Array.isArray(t)?t:[]}catch(t){return console.warn("[autoCrop] face detection failed, skipping auto-crop",t),[]}}const BY=640;function LY(e){return new Promise(t=>{const n=new Image;n.crossOrigin="anonymous",n.addEventListener("load",()=>t(n)),n.addEventListener("error",()=>t(null)),n.src=e})}function OY(e){const t=e.naturalWidth||e.width,n=e.naturalHeight||e.height;if(!(t>0)||!(n>0))return null;const r=Math.min(1,BY/Math.max(t,n)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(t*r)),a.height=Math.max(1,Math.round(n*r));const i=a.getContext("2d",{willReadFrequently:!0});if(!i)return null;i.drawImage(e,0,0,a.width,a.height);try{i.getImageData(0,0,1,1)}catch{return null}return{canvas:a,scale:r}}async function BC(e){if(!AC()||e.cropMode!=="cover")return null;const t=await LY(e.src);if(!t)return null;const n=OY(t);if(!n)return null;const r=await AY(n.canvas);if(r.length===0)return null;const a=1/n.scale,i=r.map(s=>({x:s.x*a,y:s.y*a,width:s.width*a,height:s.height*a,score:s.score}));return IC({faces:i,natural:e.natural,aspectRatio:e.aspectRatio,cropMode:e.cropMode,zoom:e.zoom})}var us={},S2={},LC={};Object.defineProperty(LC,"__esModule",{value:!0});var OC={};Object.defineProperty(OC,"__esModule",{value:!0});var PC={};Object.defineProperty(PC,"__esModule",{value:!0});var Gb={};Object.defineProperty(Gb,"__esModule",{value:!0});var Zn={},p8;function PY(){if(p8)return Zn;p8=1,Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.SERIAL_CANVAS_DOC_KEYS=void 0,Zn.cloneSerialJson=t,Zn.isMultiCanvas=n,Zn.getActiveCanvasId=r,Zn.getSerialCanvasById=a,Zn.extractDocState=i,Zn.docStateFromCanvas=s,Zn.syncActiveCanvasEntry=d,Zn.materializeCanvas=l,Zn.toPersistedSerial=c,Zn.fromPersistedSerial=f,Zn.canvasSizeToken=m,Zn.canvasDisplayName=u,Zn.findCanvasBySize=h,Zn.isCanvasSizeTaken=g,Zn.duplicateCanvasSizeCounts=y;const e=MC();Zn.SERIAL_CANVAS_DOC_KEYS=["context","width","height","frames","fill","grid"];function t(w){return JSON.parse(JSON.stringify(w))}function n(w){var x;return(((x=w.canvases)==null?void 0:x.length)??0)>=2}function r(w){return w.activeCanvasId??e.DEFAULT_CANVAS_ID}function a(w,x){var S;return(S=w.canvases)==null?void 0:S.find(C=>C.id===x)}function i(w){return{context:w.context,width:w.width,height:w.height,frames:w.frames,fill:w.fill,grid:w.grid}}function s(w){return{context:w.context,width:w.width,height:w.height,frames:w.frames,fill:w.fill,grid:w.grid??{horizontal:[],vertical:[]}}}function d(w){if(!n(w))return w.canvases;const x=r(w),S=w.canvases.findIndex(_=>_.id===x);if(S===-1)return w.canvases;const C=w.canvases[S],E=w.canvases.slice();return E[S]={...C,...t(i(w)),frames:w.frames?t(w.frames):void 0,fill:w.fill?t(w.fill):void 0},E}function l(w,x){if(!n(w))return w;const S=a(w,x);return S?{...w,...s(S),activeCanvasId:x}:w}function c(w){if(!n(w))return w;const x=d(w),S=(x==null?void 0:x.find(C=>C.id===e.DEFAULT_CANVAS_ID))??(x==null?void 0:x[0]);return S?{...w,canvases:x,...s(S)}:w}function f(w){if(!n(w))return w;const x=r(w);if(x===e.DEFAULT_CANVAS_ID)return w;const S=a(w,x);return S?{...w,...t(s(S))}:{...w,activeCanvasId:void 0}}function m(w,x){return`${Math.round(w)}x${Math.round(x)}`}function u(w){return`${Math.round(w.width)}×${Math.round(w.height)}`}function h(w,x,S,C){const E=m(x,S);return w.find(_=>_.id!==C&&m(_.width,_.height)===E)}function g(w,x,S,C){return!!h(w,x,S,C)}function y(w){const x={};for(const S of w){const C=m(S.width,S.height);x[C]=(x[C]??0)+1}for(const S of Object.keys(x))x[S]<2&&delete x[S];return x}return Zn}var em={};Object.defineProperty(em,"__esModule",{value:!0});em.isBlankSerial=MY;em.applyBlankDocumentFormat=TY;function MY(e){var t;return!(e.context.length>0||(((t=e.canvases)==null?void 0:t.length)??0)>0)}function TY(e,t){return e.width=t.width,e.height=t.height,t.frames?e.frames={...t.frames}:delete e.frames,e}var m8;function MC(){return m8||(m8=1,function(e){var t=X&&X.__createBinding||(Object.create?function(i,s,d,l){l===void 0&&(l=d);var c=Object.getOwnPropertyDescriptor(s,d);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[d]}}),Object.defineProperty(i,l,c)}:function(i,s,d,l){l===void 0&&(l=d),i[l]=s[d]}),n=X&&X.__setModuleDefault||(Object.create?function(i,s){Object.defineProperty(i,"default",{enumerable:!0,value:s})}:function(i,s){i.default=s}),r=X&&X.__importStar||function(){var i=function(s){return i=Object.getOwnPropertyNames||function(d){var l=[];for(var c in d)Object.prototype.hasOwnProperty.call(d,c)&&(l[l.length]=c);return l},i(s)};return function(s){if(s&&s.__esModule)return s;var d={};if(s!=null)for(var l=i(s),c=0;c<l.length;c++)l[c]!=="default"&&t(d,s,l[c]);return n(d,s),d}}(),a=X&&X.__exportStar||function(i,s){for(var d in i)d!=="default"&&!Object.prototype.hasOwnProperty.call(s,d)&&t(s,i,d)};Object.defineProperty(e,"__esModule",{value:!0}),e.SupportedInternalLinkedinKeys=e.DEFAULT_CANVAS_ID=e.Fields=e.Config=e.Elements=e.Geometry=void 0,e.Geometry=r(LC),e.Elements=r(OC),e.Config=r(PC),e.Fields=r(Gb),a(PY(),e),a(em,e),e.DEFAULT_CANVAS_ID="default",e.SupportedInternalLinkedinKeys=["LINKEDIN_NAME","LINKEDIN_PICTURE","LINKEDIN_EMAIL","LINKEDIN_FAMILY_NAME","LINKEDIN_GIVEN_NAME"]}(S2)),S2}var tm={};Object.defineProperty(tm,"__esModule",{value:!0});tm.Platforms=void 0;tm.Platforms=["instagram","facebook","x","tiktok","linkedin"];var TC={},DC={};Object.defineProperty(DC,"__esModule",{value:!0});(function(e){var t=X&&X.__createBinding||(Object.create?function(r,a,i,s){s===void 0&&(s=i);var d=Object.getOwnPropertyDescriptor(a,i);(!d||("get"in d?!a.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(r,s,d)}:function(r,a,i,s){s===void 0&&(s=i),r[s]=a[i]}),n=X&&X.__exportStar||function(r,a){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&t(a,r,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(DC,e)})(TC);var $C={},NC={};Object.defineProperty(NC,"__esModule",{value:!0});(function(e){var t=X&&X.__createBinding||(Object.create?function(r,a,i,s){s===void 0&&(s=i);var d=Object.getOwnPropertyDescriptor(a,i);(!d||("get"in d?!a.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(r,s,d)}:function(r,a,i,s){s===void 0&&(s=i),r[s]=a[i]}),n=X&&X.__exportStar||function(r,a){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&t(a,r,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(NC,e)})($C);var jC={};Object.defineProperty(jC,"__esModule",{value:!0});var RC={};Object.defineProperty(RC,"__esModule",{value:!0});var FC={};Object.defineProperty(FC,"__esModule",{value:!0});var VC={};Object.defineProperty(VC,"__esModule",{value:!0});var UC={};Object.defineProperty(UC,"__esModule",{value:!0});var ZC={};Object.defineProperty(ZC,"__esModule",{value:!0});var qC={};Object.defineProperty(qC,"__esModule",{value:!0});var HC={},At={};function xo(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}const DY={ZodAny:"any",ZodArray:"array",ZodBigInt:"bigint",ZodBoolean:"boolean",ZodDefault:"default",ZodPrefault:"prefault",ZodTransform:"transform",ZodEnum:"enum",ZodIntersection:"intersection",ZodLazy:"lazy",ZodLiteral:"literal",ZodNever:"never",ZodNull:"null",ZodNullable:"nullable",ZodNumber:"number",ZodNonOptional:"nonoptional",ZodObject:"object",ZodOptional:"optional",ZodPipe:"pipe",ZodReadonly:"readonly",ZodRecord:"record",ZodString:"string",ZodTuple:"tuple",ZodType:"type",ZodUnion:"union",ZodDiscriminatedUnion:"union",ZodUnknown:"unknown",ZodVoid:"void",ZodDate:"date",ZodTemplateLiteral:"template_literal"};function It(e,t){return(Array.isArray(t)?t:[t]).some(r=>{var a;const i=((a=e==null?void 0:e.def)===null||a===void 0?void 0:a.type)===DY[r];return r==="ZodDiscriminatedUnion"?i&&"discriminator"in e.def:i})}function ir(e){return e&&"def"in e}function Au(e){return e.safeParse(null).success}function WC(e){return e.safeParse(void 0).success}let $Y=class{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function NY(){return new $Y}function ep(e,t){if(e==null||t===null||t===void 0)return e===t;if(e===t||e.valueOf()===t.valueOf())return!0;if(Array.isArray(e)&&(!Array.isArray(t)||e.length!==t.length)||!(e instanceof Object)||!(t instanceof Object))return!1;const n=Object.keys(e);return Object.keys(t).every(r=>n.indexOf(r)!==-1)&&n.every(r=>ep(e[r],t[r]))}class jY{constructor(){this.buckets=new Map}put(t){const n=this.hashCodeOf(t),r=this.buckets.get(n);if(!r){this.buckets.set(n,[t]);return}r.some(i=>ep(i,t))||r.push(t)}contains(t){const n=this.hashCodeOf(t),r=this.buckets.get(n);return r?r.some(a=>ep(a,t)):!1}values(){return[...this.buckets.values()].flat()}stats(){let t=0,n=0,r=0;for(const i of this.buckets.values())t+=1,n+=i.length,i.length>1&&(r+=1);const a=t/n;return{totalBuckets:t,collisions:r,totalValues:n,hashEffectiveness:a}}hashCodeOf(t){let n=0;if(Array.isArray(t)){for(let r=0;r<t.length;r++)n^=this.hashCodeOf(t[r])*r;return n}if(typeof t=="string"){for(let r=0;r<t.length;r++)n^=t.charCodeAt(r)*r;return n}if(typeof t=="number")return t;if(typeof t=="object")for(const[r,a]of Object.entries(t))n^=this.hashCodeOf(r)+this.hashCodeOf(a??"");return n}}function _c(e){return e===void 0}function nd(e,t){const n={};return Object.entries(e).forEach(([r,a])=>{n[r]=t(a)}),n}function RY(e,t){const n={};return Object.entries(e).forEach(([r,a])=>{t.some(i=>i===r)||(n[r]=a)}),n}function fl(e,t){const n={};return Object.entries(e).forEach(([r,a])=>{t(a,r)||(n[r]=a)}),n}function h8(e){return e.filter(t=>!_c(t))}const Id=ep;function GC(e){const t=new jY;return e.forEach(n=>t.put(n)),[...t.values()]}function qg(e){return typeof e=="string"}function g8(e){return Object.fromEntries(Object.entries(e).sort(([t],[n])=>t.localeCompare(n)))}const Hg=NY();class Ut{static collectMetadata(t,n){const r=this.getMetadataFromRegistry(t),a=Object.assign(Object.assign({},r==null?void 0:r._internal),n==null?void 0:n._internal),i=Object.assign(Object.assign({},r==null?void 0:r.param),n==null?void 0:n.param),s=Object.assign(Object.assign(Object.assign(Object.assign({},Object.keys(a).length>0?{_internal:a}:{}),r),n),Object.keys(i).length>0?{param:i}:{});if(It(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&ir(t._zod.def.innerType))return this.collectMetadata(t._zod.def.innerType,s);if(It(t,"ZodPipe")){const d=t._zod.def.in,l=t._zod.def.out;if(It(d,"ZodTransform")&&ir(l))return this.collectMetadata(l,s);if(ir(d))return this.collectMetadata(d,s)}return s}static getMetadata(t){return this.collectMetadata(t)}static getOpenApiMetadata(t){const n=this.collectMetadata(t),r=n??{},{_internal:a}=r;return xo(r,["_internal"])}static getInternalMetadata(t){var n;return(n=this.collectMetadata(t))===null||n===void 0?void 0:n._internal}static getParamMetadata(t){const n=this.collectMetadata(t);return Object.assign(Object.assign({},n),{param:Object.assign(Object.assign({},n!=null&&n.description?{description:n.description}:{}),n==null?void 0:n.param)})}static buildSchemaMetadata(t){return fl(RY(t,["param","_internal"]),_c)}static buildParameterMetadata(t){return fl(t,_c)}static applySchemaMetadata(t,n){return fl(Object.assign(Object.assign({},t),this.buildSchemaMetadata(n)),_c)}static getRefId(t){var n;return(n=this.getInternalMetadata(t))===null||n===void 0?void 0:n.refId}static unwrapChained(t){return this.unwrapUntil(t)}static getDefaultValue(t){var n;const r=(n=this.unwrapUntil(t,"ZodDefault"))!==null&&n!==void 0?n:this.unwrapUntil(t,"ZodPrefault");return r==null?void 0:r._zod.def.defaultValue}static unwrapUntil(t,n){if(n&&It(t,n))return t;if(It(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&ir(t._zod.def.innerType))return this.unwrapUntil(t._zod.def.innerType,n);if(It(t,"ZodPipe")){const r=t._zod.def.in,a=t._zod.def.out;if(It(r,"ZodTransform")&&ir(a))return this.unwrapUntil(a,n);if(ir(r))return this.unwrapUntil(r,n)}return n?void 0:t}static getMetadataFromInternalRegistry(t){return Hg.get(t)}static getMetadataFromRegistry(t){const n=this.getMetadataFromInternalRegistry(t),r=t.meta();if(!n)return r;const{_internal:a}=n,i=xo(n,["_internal"]),s=r??{},{id:d,title:l}=s,c=xo(s,["id","title"]);return Object.assign(Object.assign(Object.assign({_internal:Object.assign(Object.assign({},d?{refId:d}:{}),a)},i),l?{description:l}:{}),c)}static setMetadataInRegistry(t,n){Hg.add(t,n)}}function Ko(e,t){const n=e[t];typeof n=="function"&&(e[t]=function(...r){const a=n.apply(this,r),i=Ut.getMetadataFromRegistry(this);return i&&Ut.setMetadataInRegistry(a,i),a})}function FY(e){typeof e.ZodType.prototype.openapi<"u"||(e.ZodType.prototype.openapi=function(...t){const{refId:n,metadata:r,options:a}=VY(...t),i=r??{},{param:s}=i,d=xo(i,["param"]),l=Ut.getMetadataFromRegistry(this),c=l??{},{_internal:f}=c,m=xo(c,["_internal"]),u=Object.assign(Object.assign(Object.assign({},f),a),n?{refId:n}:void 0),h=Object.assign(Object.assign(Object.assign({},m),d),m!=null&&m.param||s?{param:Object.assign(Object.assign({},m==null?void 0:m.param),s)}:void 0),g=new this.constructor(this._def);function y(x){Ut.setMetadataInRegistry(x,Object.assign(Object.assign({},Object.keys(u).length>0?{_internal:u}:void 0),h))}if(y(g),It(g,"ZodLazy")&&y(this),It(g,"ZodObject")){const x=Ut.getMetadataFromRegistry(g),S=g.extend;g.extend=function(...C){const E=S.apply(g,C),_=x??{},{_internal:I}=_,B=xo(_,["_internal"]);return Ut.setMetadataInRegistry(E,{_internal:{extendedFrom:I!=null&&I.refId?{refId:I.refId,schema:g}:I==null?void 0:I.extendedFrom}}),E.openapi(B)},Ko(g,"catchall")}Ko(g,"optional"),Ko(g,"nullable"),Ko(g,"default"),Ko(g,"transform"),Ko(g,"refine"),Ko(g,"length"),Ko(g,"min"),Ko(g,"max");const w=g.meta;return g.meta=function(...x){const S=w.apply(this,x);if(x[0]){const C=Ut.getMetadataFromInternalRegistry(this);C&&Ut.setMetadataInRegistry(S,Object.assign(Object.assign({},C),x[0]))}return S},g})}function VY(e,t,n){return typeof e=="string"?{refId:e,metadata:t,options:n}:{refId:void 0,metadata:e,options:t}}function UY(e){var t;return fl((t=Ut.getOpenApiMetadata(e))!==null&&t!==void 0?t:{},_c)}function ZY(e){return Ut.getRefId(e)}class qY{constructor(t){this.parents=t,this._definitions=[]}get definitions(){var t,n;return[...(n=(t=this.parents)===null||t===void 0?void 0:t.flatMap(a=>a._definitions))!==null&&n!==void 0?n:[],...this._definitions]}register(t,n){const r=this.schemaWithRefId(t,n);return this._definitions.push({type:"schema",schema:r}),r}registerParameter(t,n){var r,a,i;const s=this.schemaWithRefId(t,n),d=(r=Ut.getOpenApiMetadata(s))!==null&&r!==void 0?r:{},l=s.openapi(Object.assign(Object.assign({},d),{param:Object.assign(Object.assign({},d==null?void 0:d.param),{name:(i=(a=d==null?void 0:d.param)===null||a===void 0?void 0:a.name)!==null&&i!==void 0?i:t})}));return this._definitions.push({type:"parameter",schema:l}),l}registerPath(t){this._definitions.push({type:"route",route:t})}registerWebhook(t){this._definitions.push({type:"webhook",webhook:t})}registerComponent(t,n,r){return this._definitions.push({type:"component",componentType:t,name:n,component:r}),{name:n,ref:{$ref:`#/components/${t}/${n}`}}}schemaWithRefId(t,n){return n.openapi(t)}}class nm{constructor(t){this.message=t}}class Bu extends nm{constructor(t,n){super(t),this.data=n}}class tp extends nm{constructor(t){super(`Missing parameter data, please specify \`${t.missingField}\` and other OpenAPI parameter props using the \`param\` field of \`schema.openapi\``),this.data=t}}function Lu(e,t){try{return e()}catch(n){throw n instanceof tp?new tp(Object.assign(Object.assign({},n.data),t)):n}}class HY extends nm{constructor(t){super("Unknown zod object type, please specify `type` and other OpenAPI props using `schema.openapi`."),this.data=t}}class WY{transform(t,n,r){var a,i,s,d;const l=t.def.element,c=(i=(a=t.def.checks)===null||a===void 0?void 0:a.find(m=>m._zod.def.check==="min_length"))===null||i===void 0?void 0:i._zod.def.minimum,f=(d=(s=t.def.checks)===null||s===void 0?void 0:s.find(m=>m._zod.def.check==="max_length"))===null||d===void 0?void 0:d._zod.def.maximum;return Object.assign(Object.assign({},n("array")),{items:ir(l)?r(l):{},minItems:c,maxItems:f})}}class XC{transform(t){return Object.assign(Object.assign({},t("string")),{pattern:"^\\d+$"})}}class GY{transform(t,n,r,a,i){const s=t.def.options.filter(ir),d=s.map(a);if(n)return{oneOf:r(d,n)};const l=t._zod.def.discriminator;return l?{oneOf:d,discriminator:this.mapDiscriminator(s,l,i)}:(console.error("No discriminator found for discriminated union",t),{oneOf:d})}mapDiscriminator(t,n,r){if(t.some(i=>Ut.getRefId(i)===void 0))return;const a={};for(const i of t){const s=Ut.getRefId(i),d=this.getDiscriminatorValues(i,n);for(const l of d)a[l]=r(s)}return{propertyName:n,mapping:a}}getDiscriminatorValues(t,n){var r;if(It(t,"ZodObject")){const a=(r=t.def.shape)===null||r===void 0?void 0:r[n];return a?It(a,"ZodEnum")?Object.values(a._zod.def.entries).filter(qg):It(a,"ZodLiteral")?a.def.values.filter(qg):[]:[]}if(It(t,"ZodDiscriminatedUnion")){const a=t.def.options.filter(ir);return[...new Set(a.flatMap(i=>this.getDiscriminatorValues(i,n)))]}return[]}}function YC(e){const n=Object.keys(e).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),r=n.filter(i=>typeof i=="number").length,a=r===0?"string":r===n.length?"numeric":"mixed";return{values:n,type:a}}class XY{transform(t,n,r){const{type:a,values:i}=YC(t._zod.def.entries);if(a==="mixed")throw new nm("Enum has mixed string and number values, please specify the OpenAPI type manually");return Object.assign(Object.assign({},r(a==="numeric"?"integer":"string")),{enum:n?[...i,null]:i})}}class YY{transform(t,n,r,a){const s={allOf:this.flattenIntersectionTypes(t).map(a)};return n?{anyOf:r([s],n)}:s}flattenIntersectionTypes(t){if(!It(t,"ZodIntersection"))return[t];const n=ir(t._zod.def.left)?this.flattenIntersectionTypes(t._zod.def.left):[],r=ir(t._zod.def.right)?this.flattenIntersectionTypes(t._zod.def.right):[];return[...n,...r]}}class KY{constructor(){this.bigIntTransformer=new XC}transform(t,n){const r=typeof t.def.values[0];return r==="boolean"||r==="number"||r==="string"||r==="object"?Object.assign(Object.assign({},n(r)),{enum:[t.def.values[0]]}):r==="bigint"?this.bigIntTransformer.transform(n):n("null")}}class JY{transform(t,n,r){var a;return Object.assign(Object.assign(Object.assign({},n("number")),n(t.format==="safeint"?"integer":"number")),r((a=t.def.checks)!==null&&a!==void 0?a:[]))}}class QY{transform(t,n,r,a){var i;const s=(i=Ut.getInternalMetadata(t))===null||i===void 0?void 0:i.extendedFrom,d=this.requiredKeysOf(t),l=nd(t.def.shape,a);if(!s)return Object.assign(Object.assign(Object.assign(Object.assign({},r("object")),{properties:l,default:n}),d.length>0?{required:d}:{}),this.generateAdditionalProperties(t,a));const c=s.schema;a(c);const f=this.requiredKeysOf(c),m=nd(c==null?void 0:c.def.shape,a),u=Object.fromEntries(Object.entries(l).filter(([y,w])=>!Id(m[y],w))),h=d.filter(y=>!f.includes(y)),g=Object.assign(Object.assign(Object.assign(Object.assign({},r("object")),{default:n,properties:u}),h.length>0?{required:h}:{}),this.generateAdditionalProperties(t,a));return{allOf:[{$ref:`#/components/schemas/${s.refId}`},g]}}generateAdditionalProperties(t,n){const r=t.def.catchall;return r?It(r,"ZodNever")?{additionalProperties:!1}:ir(r)?{additionalProperties:n(r)}:{}:{}}requiredKeysOf(t){return Object.entries(t.def.shape).filter(([n,r])=>!WC(r)).map(([n,r])=>n)}}class eK{transform(t,n,r){const a=t.valueType,i=t.keyType,s=ir(a)?r(a):{};if(It(i,"ZodEnum")){const l=Object.values(i._zod.def.entries).filter(qg).reduce((c,f)=>Object.assign(Object.assign({},c),{[f]:s}),{});return Object.assign(Object.assign({},n("object")),{properties:l})}return Object.assign(Object.assign({},n("object")),{additionalProperties:s})}}function tK(e){return e._zod.def.check==="length_equals"}function nK(e){return e._zod.def.check==="string_format"&&e._zod.def.format==="regex"}class rK{transform(t,n){var r,a,i,s;const d=(r=t.def.checks)===null||r===void 0?void 0:r.find(nK),l=d==null?void 0:d._zod.def.pattern.toString().replace(/^\/|\/$/g,""),c=(a=t.def.checks)===null||a===void 0?void 0:a.find(tK),f=c==null?void 0:c._zod.def.length,m=Number.isFinite(t.minLength)&&(i=t.minLength)!==null&&i!==void 0?i:void 0,u=Number.isFinite(t.maxLength)&&(s=t.maxLength)!==null&&s!==void 0?s:void 0;return Object.assign(Object.assign({},n("string")),{minLength:f??m,maxLength:f??u,format:this.mapStringFormat(t),pattern:l})}mapStringFormat(t){if(t.format==="uuid"||t.format==="guid")return"uuid";if(t.format==="email")return"email";if(t.format==="url")return"uri";if(t.format==="date")return"date";if(t.format==="datetime")return"date-time";if(t.format==="time")return"time";if(t.format==="duration")return"duration";if(t.format==="cuid")return"cuid";if(t.format==="cuid2")return"cuid2";if(t.format==="ulid")return"ulid";if(t.format==="ipv4"||t.format==="ipv6")return"ip";if(t.format==="cidrv4")return"ipv4-cidr";if(t.format==="cidrv6")return"ipv6-cidr";if(t.format==="base64url")return"base64url";if(t.format==="emoji")return"emoji"}}class aK{constructor(t){this.versionSpecifics=t}transform(t,n,r){const i=t._zod.def.items.map(s=>ir(s)?r(s):{});return Object.assign(Object.assign({},n("array")),this.versionSpecifics.mapTupleItems(i))}}class oK{constructor(t){this.options=t}transform(t,n,r){var a,i,s;const d=Ut.getInternalMetadata(t),l=(s=(a=d==null?void 0:d.unionPreferredType)!==null&&a!==void 0?a:(i=this.options)===null||i===void 0?void 0:i.unionPreferredType)!==null&&s!==void 0?s:"anyOf",f=this.flattenUnionTypes(t).map(m=>{const u=this.unwrapNullable(m);return r(u)});return{[l]:n(f)}}flattenUnionTypes(t){return It(t,"ZodUnion")?t.def.options.flatMap(r=>ir(r)?this.flattenUnionTypes(r):[]):[t]}unwrapNullable(t){if(It(t,"ZodNullable")){const n=t.unwrap();if(ir(n))return this.unwrapNullable(n)}return t}}class iK{transform(t){return Object.assign(Object.assign({},t("string")),{format:"date-time"})}}class rm{transform(t,n,r,a){const i=n(t._zod.def.getter());return rm.mapRecursive(i,r,a)}static mapRecursive(t,n,r){return"$ref"in t?r(t):t.type?Object.assign(Object.assign({},t),n(t.type)):t}}class sK{transform(t,n){const a=t.def.parts.map(i=>this.generatePattern(i)).join("");return Object.assign(Object.assign({},n("string")),{pattern:`^${a}$`})}generatePattern(t){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t===null||t===void 0)return this.escapeRegex(String(t));if(It(t,"ZodLiteral")){const n=t.def.values[0];return this.escapeRegex(String(n))}if(It(t,"ZodNumber"))return"[+-]?\\d+(\\.\\d+)?";if(It(t,"ZodBoolean"))return"(true|false)";if(It(t,"ZodEnum")){const{values:n}=YC(t.def.entries);return`(${n.map(r=>this.escapeRegex(String(r))).join("|")})`}return".*"}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class lK{constructor(t,n){this.versionSpecifics=t,this.objectTransformer=new QY,this.stringTransformer=new rK,this.numberTransformer=new JY,this.bigIntTransformer=new XC,this.dateTransformer=new iK,this.lazyTransformer=new rm,this.literalTransformer=new KY,this.templateLiteralTransformer=new sK,this.enumTransformer=new XY,this.arrayTransformer=new WY,this.discriminatedUnionTransformer=new GY,this.intersectionTransformer=new YY,this.recordTransformer=new eK,this.tupleTransformer=new aK(t),this.unionTransformer=new oK(n)}transform(t,n,r,a,i){if(It(t,"ZodNull"))return this.versionSpecifics.nullType;if(It(t,"ZodUnknown")||It(t,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,n);if(It(t,"ZodObject"))return this.objectTransformer.transform(t,i,d=>this.versionSpecifics.mapNullableType(d,n),r);const s=this.transformSchemaWithoutDefault(t,n,r,a);return Object.assign(Object.assign({},s),{default:i})}transformSchemaWithoutDefault(t,n,r,a){if(It(t,"ZodUnknown")||It(t,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,n);if(It(t,"ZodString"))return this.stringTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n));if(It(t,"ZodNumber"))return this.numberTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n),s=>this.versionSpecifics.getNumberChecks(s));if(It(t,"ZodBigInt"))return this.bigIntTransformer.transform(s=>this.versionSpecifics.mapNullableType(s,n));if(It(t,"ZodBoolean"))return this.versionSpecifics.mapNullableType("boolean",n);if(It(t,"ZodLazy"))return this.lazyTransformer.transform(t,r,s=>this.versionSpecifics.mapNullableType(s,n),s=>this.versionSpecifics.mapNullableOfRef(s,n));if(It(t,"ZodLiteral"))return this.literalTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n));if(It(t,"ZodTemplateLiteral"))return this.templateLiteralTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n));if(It(t,"ZodEnum"))return this.enumTransformer.transform(t,n,s=>this.versionSpecifics.mapNullableType(s,n));if(It(t,"ZodArray"))return this.arrayTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n),r);if(It(t,"ZodTuple"))return this.tupleTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n),r);if(It(t,"ZodDiscriminatedUnion"))return this.discriminatedUnionTransformer.transform(t,n,s=>this.versionSpecifics.mapNullableOfArray(s,n),r,a);if(It(t,"ZodUnion"))return this.unionTransformer.transform(t,s=>this.versionSpecifics.mapNullableOfArray(s,n),r);if(It(t,"ZodIntersection"))return this.intersectionTransformer.transform(t,n,s=>this.versionSpecifics.mapNullableOfArray(s,n),r);if(It(t,"ZodRecord"))return this.recordTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n),r);if(It(t,"ZodDate"))return this.dateTransformer.transform(s=>this.versionSpecifics.mapNullableType(s,n));const i=Ut.getRefId(t);throw new HY({currentSchema:t.def,schemaName:i})}}class Xb{constructor(t,n,r){this.definitions=t,this.versionSpecifics=n,this.options=r,this.schemaRefs={},this.paramRefs={},this.pathRefs={},this.rawComponents=[],this.openApiTransformer=new lK(n,r),this.sortDefinitions()}generateDocumentData(){return this.definitions.forEach(t=>this.generateSingle(t)),{components:this.buildComponents(),paths:this.pathRefs}}generateComponents(){return this.definitions.forEach(t=>this.generateSingle(t)),{components:this.buildComponents()}}buildComponents(){var t,n,r,a;const i={};this.rawComponents.forEach(({componentType:u,name:h,component:g})=>{var y;(y=i[u])!==null&&y!==void 0||(i[u]={}),i[u][h]=g});const s=(t=i.schemas)!==null&&t!==void 0?t:{},d=Object.assign(Object.assign({},s),this.filteredSchemaRefs),l=((n=this.options)===null||n===void 0?void 0:n.sortComponents)==="alphabetically"?g8(d):d,c=(r=i.parameters)!==null&&r!==void 0?r:{},f=Object.assign(Object.assign({},c),this.paramRefs),m=((a=this.options)===null||a===void 0?void 0:a.sortComponents)==="alphabetically"?g8(f):f;return Object.assign(Object.assign({},i),{schemas:l,parameters:m})}isNotPendingRefEntry(t){return t[1]!=="pending"}get filteredSchemaRefs(){const t=Object.entries(this.schemaRefs).filter(this.isNotPendingRefEntry);return Object.fromEntries(t)}sortDefinitions(){const t=["schema","parameter","component","route","webhook"];this.definitions.sort((n,r)=>{if(!("type"in n))return"type"in r?-1:0;if(!("type"in r))return 1;const a=t.findIndex(s=>s===n.type),i=t.findIndex(s=>s===r.type);return a-i})}generateSingle(t){if(!("type"in t)){this.generateSchemaWithRef(t);return}switch(t.type){case"parameter":this.generateParameterDefinition(t.schema);return;case"schema":this.generateSchemaWithRef(t.schema);return;case"route":this.generateSingleRoute(t.route);return;case"component":this.rawComponents.push(t);return}}generateParameterDefinition(t){const n=Ut.getRefId(t),r=this.generateParameter(t);return n&&(this.paramRefs[n]=r),r}getParameterRef(t,n){const r=Ut.getOpenApiMetadata(t),a=Ut.getInternalMetadata(t),i=r==null?void 0:r.param,s=a!=null&&a.refId?this.paramRefs[a.refId]:void 0;if(!(!(a!=null&&a.refId)||!s)){if(i&&s.in!==i.in||n!=null&&n.in&&s.in!==n.in)throw new Bu(`Conflicting location for parameter ${s.name}`,{key:"in",values:h8([s.in,n==null?void 0:n.in,i==null?void 0:i.in])});if(i&&s.name!==i.name||n!=null&&n.name&&s.name!==(n==null?void 0:n.name))throw new Bu("Conflicting names for parameter",{key:"name",values:h8([s.name,n==null?void 0:n.name,i==null?void 0:i.name])});return{$ref:`#/components/parameters/${a.refId}`}}}generateInlineParameters(t,n){const r=Ut.getOpenApiMetadata(t),a=r==null?void 0:r.param,i=this.getParameterRef(t,{in:n});if(i)return[i];if(It(t,"ZodObject")){const s=t.def.shape;return Object.entries(s).map(([l,c])=>{var f;const m=Ut.getOpenApiMetadata(c),u=this.getParameterRef(c,{in:n,name:l});if(u)return u;const h=m==null?void 0:m.param;if(h!=null&&h.name&&h.name!==l)throw new Bu("Conflicting names for parameter",{key:"name",values:[l,h.name]});if(h!=null&&h.in&&h.in!==n)throw new Bu(`Conflicting location for parameter ${(f=h.name)!==null&&f!==void 0?f:l}`,{key:"in",values:[n,h.in]});return this.generateParameter(c,{name:l,in:n})})}if(a!=null&&a.in&&a.in!==n)throw new Bu(`Conflicting location for parameter ${a.name}`,{key:"in",values:[n,a.in]});return[this.generateParameter(t,{in:n})]}generateSimpleParameter(t,n){const r=Ut.getParamMetadata(t),a=r==null?void 0:r.param,i=Object.assign(Object.assign({},a),n),s=!WC(t)&&!Au(t),d=this.generateSchemaWithRef(t);return Object.assign({schema:d,required:s},Object.keys(i).length>0?Ut.buildParameterMetadata(i):{})}generateParameter(t,n){var r,a;const i=Ut.getOpenApiMetadata(t),s=i==null?void 0:i.param,d=(r=n==null?void 0:n.name)!==null&&r!==void 0?r:s==null?void 0:s.name,l=(a=n==null?void 0:n.in)!==null&&a!==void 0?a:s==null?void 0:s.in;if(!d)throw new tp({missingField:"name"});if(!l)throw new tp({missingField:"in",paramName:d});const c=this.generateSimpleParameter(t,n);return Object.assign(Object.assign({},c),{in:l,name:d})}generateSchemaWithMetadata(t){const n=Ut.unwrapChained(t),r=Ut.getOpenApiMetadata(t),a=Ut.getDefaultValue(t),i=Ut.getRefId(t);if(i&&typeof this.schemaRefs[i]=="object")return this.schemaRefs[i];if(i&&this.schemaRefs[i]==="pending"){const d={$ref:this.generateSchemaRef(i)};return this.versionSpecifics.mapNullableOfRef(d,Au(t))}i&&!this.schemaRefs[i]&&(this.schemaRefs[i]="pending");const s=r!=null&&r.type?{type:r.type}:this.toOpenAPISchema(n,Au(t),a);return r?Ut.applySchemaMetadata(s,r):fl(s,_c)}constructReferencedOpenAPISchema(t){const n=Ut.getOpenApiMetadata(t),r=Ut.unwrapChained(t),a=Ut.getDefaultValue(t),i=Au(t);if(n!=null&&n.type)return this.versionSpecifics.mapNullableType(n.type,i);const s=Ut.getRefId(t);if(s&&typeof this.schemaRefs[s]=="object")return rm.mapRecursive(this.schemaRefs[s],d=>this.versionSpecifics.mapNullableType(d,i),d=>this.versionSpecifics.mapNullableOfRef(d,i));if(s&&this.schemaRefs[s]==="pending"){const d={$ref:this.generateSchemaRef(s)};return this.versionSpecifics.mapNullableOfRef(d,i)}return s&&!this.schemaRefs[s]&&(this.schemaRefs[s]="pending"),this.toOpenAPISchema(r,i,a)}generateSimpleSchema(t){const n=Ut.getOpenApiMetadata(t),r=Ut.getRefId(t);if(!r||!this.schemaRefs[r])return this.generateSchemaWithMetadata(t);const a=this.schemaRefs[r],i={$ref:this.generateSchemaRef(r)};if(this.schemaRefs[r]==="pending")return this.versionSpecifics.mapNullableOfRef(i,Au(t));const s=fl(Ut.buildSchemaMetadata(n??{}),(c,f)=>c===void 0||Id(c,a[f]));if(s.type)return{allOf:[i,s]};const d=fl(this.constructReferencedOpenAPISchema(t),(c,f)=>c===void 0||Id(c,a[f])),l=Ut.applySchemaMetadata(d,s);return Object.keys(l).length>0?{allOf:[i,l]}:i}generateSchemaWithRef(t){const n=Ut.getRefId(t);return n&&!this.schemaRefs[n]?(this.schemaRefs[n]=this.generateSimpleSchema(t),{$ref:this.generateSchemaRef(n)}):this.generateSimpleSchema(t)}generateSchemaRef(t){return`#/components/schemas/${t}`}getRequestBody(t){if(!t)return;const{content:n}=t,r=xo(t,["content"]),a=this.getBodyContent(n);return Object.assign(Object.assign({},r),{content:a})}getParameters(t){if(!t)return[];const{headers:n}=t,r=this.cleanParameter(t.query),a=this.cleanParameter(t.params),i=this.cleanParameter(t.cookies),s=Lu(()=>r?this.generateInlineParameters(r,"query"):[],{location:"query"}),d=Lu(()=>a?this.generateInlineParameters(a,"path"):[],{location:"path"}),l=Lu(()=>i?this.generateInlineParameters(i,"cookie"):[],{location:"cookie"}),c=Lu(()=>{if(Array.isArray(n))return n.flatMap(m=>this.generateInlineParameters(m,"header"));const f=this.cleanParameter(n);return f?this.generateInlineParameters(f,"header"):[]},{location:"header"});return[...d,...s,...c,...l]}cleanParameter(t){if(t){if(It(t,"ZodPipe")){const n=t._zod.def.in,r=t._zod.def.out;return It(n,"ZodObject")?this.cleanParameter(n):It(r,"ZodObject")?this.cleanParameter(r):void 0}return t}}generatePath(t){const{method:n,path:r,request:a,responses:i}=t,s=xo(t,["method","path","request","responses"]),d=nd(i,m=>this.getResponse(m)),l=Lu(()=>this.getParameters(a),{route:`${n} ${r}`}),c=this.getRequestBody(a==null?void 0:a.body);return{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},s),l.length>0?{parameters:[...s.parameters||[],...l]}:{}),c?{requestBody:c}:{}),{responses:d})}}generateSingleRoute(t){const n=this.generatePath(t);return this.pathRefs[t.path]=Object.assign(Object.assign({},this.pathRefs[t.path]),n),n}getResponse(t){if(this.isReferenceObject(t))return t;const{content:n,headers:r}=t,a=xo(t,["content","headers"]),i=n?{content:this.getBodyContent(n)}:{};if(!r)return Object.assign(Object.assign({},a),i);const s=It(r,"ZodObject")?this.getResponseHeaders(r):r;return Object.assign(Object.assign(Object.assign({},a),{headers:s}),i)}isReferenceObject(t){return"$ref"in t}getResponseHeaders(t){const n=t.def.shape;return nd(n,a=>this.generateSimpleParameter(a))}getBodyContent(t){return nd(t,n=>{if(!n||"$ref"in n)return n;const{schema:r,itemSchema:a}=n,i=xo(n,["schema","itemSchema"]),s=typeof r=="object"&&ir(r)?this.generateSchemaWithRef(r):r,d=typeof a=="object"&&ir(a)?this.generateSchemaWithRef(a):a;return Object.assign(Object.assign(Object.assign({},i),s!==void 0?{schema:s}:{}),d!==void 0?{itemSchema:d}:{})})}toOpenAPISchema(t,n,r){return this.openApiTransformer.transform(t,n,i=>this.generateSchemaWithRef(i),i=>this.generateSchemaRef(i),r)}}class cK{get nullType(){return{nullable:!0}}mapNullableOfArray(t,n){return n&&!t.some(r=>Id(r,this.nullType))?[...t,this.nullType]:t}mapNullableType(t,n){return Object.assign(Object.assign({},t?{type:t}:void 0),n?this.nullType:void 0)}mapNullableOfRef(t,n){return n?{allOf:[t,this.nullType]}:t}mapTupleItems(t){const n=GC(t);return{items:n.length===1?n[0]:{anyOf:n},minItems:t.length,maxItems:t.length}}getNumberChecks(t){return Object.assign({},...t.map(n=>{switch(n._zod.def.check){case"greater_than":{const r=n;return r._zod.def.inclusive?{minimum:Number(r._zod.def.value)}:{minimum:Number(r._zod.def.value),exclusiveMinimum:!0}}case"less_than":{const r=n;return r._zod.def.inclusive?{maximum:Number(r._zod.def.value)}:{maximum:Number(r._zod.def.value),exclusiveMaximum:!r._zod.def.inclusive}}default:return{}}}))}}class uK{constructor(t,n){const r=new cK;this.generator=new Xb(t,r,n)}generateDocument(t){const n=this.generator.generateDocumentData();return Object.assign(Object.assign({},t),n)}generateComponents(){return this.generator.generateComponents()}}class KC{get nullType(){return{type:"null"}}mapNullableOfArray(t,n){return n&&!t.some(r=>Id(r,this.nullType))?[...t,this.nullType]:t}mapNullableType(t,n){if(!t)return{};if(n){const r=Array.isArray(t)?t:[t];return{type:GC([...r,"null"])}}return{type:t}}mapNullableOfRef(t,n){return n?{oneOf:[t,this.nullType]}:t}mapTupleItems(t){return{prefixItems:t}}getNumberChecks(t){return Object.assign({},...t.map(n=>{switch(n._zod.def.check){case"greater_than":{const r=n;return r._zod.def.inclusive?{minimum:Number(r._zod.def.value)}:{exclusiveMinimum:Number(r._zod.def.value)}}case"less_than":{const r=n;return r._zod.def.inclusive?{maximum:Number(r._zod.def.value)}:{exclusiveMaximum:Number(r._zod.def.value)}}default:return{}}}))}}function dK(e){return"type"in e&&e.type==="webhook"}class fK{constructor(t,n){this.definitions=t,this.webhookRefs={};const r=new KC;this.generator=new Xb(this.definitions,r,n)}generateDocument(t){this.generateWebhooks();const n=this.generator.generateDocumentData();return Object.assign(Object.assign(Object.assign({},t),n),{webhooks:this.webhookRefs})}generateComponents(){return this.generator.generateComponents()}generateWebhooks(){this.webhookRefs={},this.definitions.filter(dK).forEach(t=>this.generateSingleWebhook(t.webhook))}generateSingleWebhook(t){const n=this.generator.generatePath(t);return this.webhookRefs[t.path]=Object.assign(Object.assign({},this.webhookRefs[t.path]),n),n}}function pK(e){return"type"in e&&e.type==="webhook"}class mK{constructor(t,n){this.definitions=t,this.webhookRefs={};const r=new KC;this.generator=new Xb(this.definitions,r,n)}generateDocument(t){this.generateWebhooks();const n=this.generator.generateDocumentData();return Object.assign(Object.assign(Object.assign({},t),n),{webhooks:this.webhookRefs})}generateComponents(){return this.generator.generateComponents()}generateWebhooks(){this.webhookRefs={},this.definitions.filter(pK).forEach(t=>this.generateSingleWebhook(t.webhook))}generateSingleWebhook(t){const n=this.generator.generatePath(t);return this.webhookRefs[t.path]=Object.assign(Object.assign({},this.webhookRefs[t.path]),n),n}}const hK=Object.freeze(Object.defineProperty({__proto__:null,OpenAPIRegistry:qY,OpenApiGeneratorV3:uK,OpenApiGeneratorV31:fK,OpenApiGeneratorV32:mK,extendZodWithOpenApi:FY,getOpenApiMetadata:UY,getRefId:ZY,zodToOpenAPIRegistry:Hg},Symbol.toStringTag,{value:"Module"})),gK=R9(hK);var JC={},Yb=Object.defineProperty,vK=Object.getOwnPropertyDescriptor,bK=Object.getOwnPropertyNames,yK=Object.prototype.hasOwnProperty,wK=(e,t)=>{for(var n in t)Yb(e,n,{get:t[n],enumerable:!0})},xK=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of bK(t))!yK.call(e,a)&&a!==n&&Yb(e,a,{get:()=>t[a],enumerable:!(r=vK(t,a))||r.enumerable});return e},CK=e=>xK(Yb({},"__esModule",{value:!0}),e),QC={};wK(QC,{checkOptionalParameter:()=>AK,decodeURIComponent_:()=>iS,getPath:()=>nS,getPathNoStrict:()=>IK,getPattern:()=>EK,getQueryParam:()=>BK,getQueryParams:()=>LK,getQueryStrings:()=>zK,mergePath:()=>rS,splitPath:()=>eS,splitRoutingPath:()=>SK,tryDecode:()=>Kb,tryDecodeURI:()=>tS,tryDecodeURIComponent:()=>aS});var Al=CK(QC);const eS=e=>{const t=e.split("/");return t[0]===""&&t.shift(),t},SK=e=>{const{groups:t,path:n}=kK(e),r=eS(n);return _K(r,t)},kK=e=>{const t=[];return e=e.replace(/\{[^}]+\}/g,(n,r)=>{const a=`@${r}`;return t.push([a,n]),a}),{groups:t,path:e}},_K=(e,t)=>{for(let n=t.length-1;n>=0;n--){const[r]=t[n];for(let a=e.length-1;a>=0;a--)if(e[a].includes(r)){e[a]=e[a].replace(r,t[n][1]);break}}return e},Tf={},EK=(e,t)=>{if(e==="*")return"*";const n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){const r=`${e}#${t}`;return Tf[r]||(n[2]?Tf[r]=t&&t[0]!==":"&&t[0]!=="*"?[r,n[1],new RegExp(`^${n[2]}(?=/${t})`)]:[e,n[1],new RegExp(`^${n[2]}$`)]:Tf[r]=[e,n[1],!0]),Tf[r]}return null},Kb=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,n=>{try{return t(n)}catch{return n}})}},tS=e=>Kb(e,decodeURI),nS=e=>{const t=e.url,n=t.indexOf("/",t.indexOf(":")+4);let r=n;for(;r<t.length;r++){const a=t.charCodeAt(r);if(a===37){const i=t.indexOf("?",r),s=t.indexOf("#",r),d=i===-1?s===-1?void 0:s:s===-1?i:Math.min(i,s),l=t.slice(n,d);return tS(l.includes("%25")?l.replace(/%25/g,"%2525"):l)}else if(a===63||a===35)break}return t.slice(n,r)},zK=e=>{const t=e.indexOf("?",8);if(t===-1)return"";const n=e.indexOf("#",8);return n===-1?e.slice(t):t<n?e.slice(t,n):""},IK=e=>{const t=nS(e);return t.length>1&&t.at(-1)==="/"?t.slice(0,-1):t},rS=(e,t,...n)=>(n.length&&(t=rS(t,...n)),`${(e==null?void 0:e[0])==="/"?"":"/"}${e}${t==="/"?"":`${(e==null?void 0:e.at(-1))==="/"?"":"/"}${(t==null?void 0:t[0])==="/"?t.slice(1):t}`}`),AK=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;const t=e.split("/"),n=[];let r="";return t.forEach(a=>{if(a!==""&&!/\:/.test(a))r+="/"+a;else if(/\:/.test(a))if(a.charCodeAt(a.length-1)===63){n.length===0&&r===""?n.push("/"):n.push(r);const i=a.slice(0,-1);r+="/"+i,n.push(r)}else r+="/"+a}),n.filter((a,i,s)=>s.indexOf(a)===i)},aS=e=>e.indexOf("%")!==-1?Kb(e,iS):e,k2=e=>(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),aS(e)),oS=(e,t,n)=>{const r=e.indexOf("#",8);r!==-1&&(e=e.slice(0,r));let a;if(!n&&t&&t.indexOf("%")===-1&&t.indexOf("+")===-1){let d=e.indexOf("?",8);if(d===-1)return;for(e.startsWith(t,d+1)||(d=e.indexOf(`&${t}`,d+1));d!==-1;){const l=e.charCodeAt(d+t.length+1);if(l===61){const c=d+t.length+2,f=e.indexOf("&",c);return k2(e.slice(c,f===-1?void 0:f))}else if(l==38||isNaN(l))return"";d=e.indexOf(`&${t}`,d+1)}if(a=/[%+]/.test(e),!a)return}const i=Object.create(null);a??(a=/[%+]/.test(e));let s=e.indexOf("?",8);for(;s!==-1;){const d=e.indexOf("&",s+1);let l=e.indexOf("=",s);l>d&&d!==-1&&(l=-1);let c=e.slice(s+1,l===-1?d===-1?void 0:d:l);if(a&&(c=k2(c)),s=d,c==="")continue;let f;l===-1?f="":(f=e.slice(l+1,d===-1?void 0:d),a&&(f=k2(f))),n?(i[c]&&Array.isArray(i[c])||(i[c]=[]),i[c].push(f)):i[c]??(i[c]=f)}return t?i[t]:i},BK=oS,LK=(e,t)=>oS(e,t,!0),iS=decodeURIComponent;var Jb=Object.defineProperty,OK=Object.getOwnPropertyDescriptor,PK=Object.getOwnPropertyNames,MK=Object.prototype.hasOwnProperty,TK=(e,t)=>{for(var n in t)Jb(e,n,{get:t[n],enumerable:!0})},DK=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of PK(t))!MK.call(e,a)&&a!==n&&Jb(e,a,{get:()=>t[a],enumerable:!(r=OK(t,a))||r.enumerable});return e},$K=e=>DK(Jb({},"__esModule",{value:!0}),e),sS={};TK(sS,{parse:()=>cS,parseSigned:()=>qK,serialize:()=>HK,serializeSigned:()=>WK});var NK=$K(sS),jK=Al;const Qb={name:"HMAC",hash:"SHA-256"},lS=async e=>{const t=typeof e=="string"?new TextEncoder().encode(e):e;return await crypto.subtle.importKey("raw",t,Qb,!1,["sign","verify"])},RK=async(e,t)=>{const n=await lS(t),r=await crypto.subtle.sign(Qb.name,n,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(r)))},FK=async(e,t,n)=>{try{const r=atob(e),a=new Uint8Array(r.length);for(let i=0,s=r.length;i<s;i++)a[i]=r.charCodeAt(i);return await crypto.subtle.verify(Qb,n,a,new TextEncoder().encode(t))}catch{return!1}},VK=/^[\w!#$%&'*.^`|~+-]+$/,UK=/^[!#-:<>-[\]-~]+$/,ZK=/^[ !#-:<-[\]-~]*$/,v8=e=>{let t=0,n=e.length;for(;t<n;){const r=e.charCodeAt(t);if(r!==32&&r!==9)break;t++}for(;n>t;){const r=e.charCodeAt(n-1);if(r!==32&&r!==9)break;n--}return t===0&&n===e.length?e:e.slice(t,n)},cS=(e,t)=>{if(t&&e.indexOf(t)===-1)return{};const n=e.split(";"),r=Object.create(null);for(const a of n){const i=a.indexOf("=");if(i===-1)continue;const s=v8(a.substring(0,i));if(t&&t!==s||!UK.test(s)||s in r)continue;let d=v8(a.substring(i+1));if(d.startsWith('"')&&d.endsWith('"')&&(d=d.slice(1,-1)),ZK.test(d)&&(r[s]=(0,jK.tryDecodeURIComponent)(d),t))break}return r},qK=async(e,t,n)=>{const r=Object.create(null),a=await lS(t);for(const[i,s]of Object.entries(cS(e,n))){const d=s.lastIndexOf(".");if(d<0)continue;const l=s.substring(0,d),c=s.substring(d+1);if(c.length!==44||!c.endsWith("="))continue;const f=await FK(c,l,a);r[i]=f?l:!1}return r},uS=(e,t,n={})=>{if(!VK.test(e))throw new Error("Invalid cookie name");let r=`${e}=${t}`;if(e.startsWith("__Secure-")&&!n.secure)throw new Error("__Secure- Cookie must have Secure attributes");if(e.startsWith("__Host-")){if(!n.secure)throw new Error("__Host- Cookie must have Secure attributes");if(n.path!=="/")throw new Error('__Host- Cookie must have Path attributes with "/"');if(n.domain)throw new Error("__Host- Cookie must not have Domain attributes")}for(const a of["domain","path","sameSite","priority"])if(n[a]&&/[;\r\n]/.test(n[a]))throw new Error(`${a} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge=="number"&&n.maxAge>=0){if(n.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!=="host"&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw new Error("Partitioned Cookie must have Secure attributes");r+="; Partitioned"}return r},HK=(e,t,n)=>(t=encodeURIComponent(t),uS(e,t,n)),WK=async(e,t,n,r={})=>{const a=await RK(t,n);return t=`${t}.${a}`,t=encodeURIComponent(t),uS(e,t,r)};var e3=Object.defineProperty,GK=Object.getOwnPropertyDescriptor,XK=Object.getOwnPropertyNames,YK=Object.prototype.hasOwnProperty,KK=(e,t)=>{for(var n in t)e3(e,n,{get:t[n],enumerable:!0})},JK=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of XK(t))!YK.call(e,a)&&a!==n&&e3(e,a,{get:()=>t[a],enumerable:!(r=GK(t,a))||r.enumerable});return e},QK=e=>JK(e3({},"__esModule",{value:!0}),e),dS={};KK(dS,{deleteCookie:()=>rJ,generateCookie:()=>pS,generateSignedCookie:()=>hS,getCookie:()=>fS,getSignedCookie:()=>tJ,setCookie:()=>mS,setSignedCookie:()=>nJ});var eJ=QK(dS),Ao=NK;const fS=(e,t,n)=>{const r=e.req.raw.headers.get("Cookie");if(typeof t=="string"){if(!r)return;let i=t;return n==="secure"?i="__Secure-"+t:n==="host"&&(i="__Host-"+t),(0,Ao.parse)(r,i)[i]}return r?(0,Ao.parse)(r):{}},tJ=async(e,t,n,r)=>{const a=e.req.raw.headers.get("Cookie");if(typeof n=="string"){if(!a)return;let s=n;return r==="secure"?s="__Secure-"+n:r==="host"&&(s="__Host-"+n),(await(0,Ao.parseSigned)(a,t,s))[s]}return a?await(0,Ao.parseSigned)(a,t):{}},pS=(e,t,n)=>{let r;return(n==null?void 0:n.prefix)==="secure"?r=(0,Ao.serialize)("__Secure-"+e,t,{path:"/",...n,secure:!0}):(n==null?void 0:n.prefix)==="host"?r=(0,Ao.serialize)("__Host-"+e,t,{...n,path:"/",secure:!0,domain:void 0}):r=(0,Ao.serialize)(e,t,{path:"/",...n}),r},mS=(e,t,n,r)=>{const a=pS(t,n,r);e.header("Set-Cookie",a,{append:!0})},hS=async(e,t,n,r)=>{let a;return(r==null?void 0:r.prefix)==="secure"?a=await(0,Ao.serializeSigned)("__Secure-"+e,t,n,{path:"/",...r,secure:!0}):(r==null?void 0:r.prefix)==="host"?a=await(0,Ao.serializeSigned)("__Host-"+e,t,n,{...r,path:"/",secure:!0,domain:void 0}):a=await(0,Ao.serializeSigned)(e,t,n,{path:"/",...r}),a},nJ=async(e,t,n,r,a)=>{const i=await hS(t,n,r,a);e.header("set-cookie",i,{append:!0})},rJ=(e,t,n)=>{const r=fS(e,t,n==null?void 0:n.prefix);return mS(e,t,"",{...n,maxAge:0}),r};var t3=Object.defineProperty,aJ=Object.getOwnPropertyDescriptor,oJ=Object.getOwnPropertyNames,iJ=Object.prototype.hasOwnProperty,sJ=(e,t)=>{for(var n in t)t3(e,n,{get:t[n],enumerable:!0})},lJ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of oJ(t))!iJ.call(e,a)&&a!==n&&t3(e,a,{get:()=>t[a],enumerable:!(r=aJ(t,a))||r.enumerable});return e},cJ=e=>lJ(t3({},"__esModule",{value:!0}),e),gS={};sJ(gS,{HTTPException:()=>uJ});var vS=cJ(gS);class uJ extends Error{constructor(n=500,r){super(r==null?void 0:r.message,{cause:r==null?void 0:r.cause});ve(this,"res");ve(this,"status");this.res=r==null?void 0:r.res,this.status=n}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}}var n3=Object.defineProperty,dJ=Object.getOwnPropertyDescriptor,fJ=Object.getOwnPropertyNames,pJ=Object.prototype.hasOwnProperty,mJ=(e,t)=>{for(var n in t)n3(e,n,{get:t[n],enumerable:!0})},hJ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of fJ(t))!pJ.call(e,a)&&a!==n&&n3(e,a,{get:()=>t[a],enumerable:!(r=dJ(t,a))||r.enumerable});return e},gJ=e=>hJ(n3({},"__esModule",{value:!0}),e),bS={};mJ(bS,{createHash:()=>am,md5:()=>wJ,sha1:()=>yJ,sha256:()=>bJ});var vJ=gJ(bS);const bJ=async e=>await am(e,{name:"SHA-256"}),yJ=async e=>await am(e,{name:"SHA-1"}),wJ=async e=>await am(e,{name:"MD5"}),am=async(e,t)=>{let n;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer?n=e:(typeof e=="object"&&(e=JSON.stringify(e)),n=new TextEncoder().encode(String(e))),crypto&&crypto.subtle){const r=await crypto.subtle.digest({name:t.name},n);return Array.prototype.map.call(new Uint8Array(r),i=>("00"+i.toString(16)).slice(-2)).join("")}return null};var r3=Object.defineProperty,xJ=Object.getOwnPropertyDescriptor,CJ=Object.getOwnPropertyNames,SJ=Object.prototype.hasOwnProperty,kJ=(e,t)=>{for(var n in t)r3(e,n,{get:t[n],enumerable:!0})},_J=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of CJ(t))!SJ.call(e,a)&&a!==n&&r3(e,a,{get:()=>t[a],enumerable:!(r=xJ(t,a))||r.enumerable});return e},EJ=e=>_J(r3({},"__esModule",{value:!0}),e),yS={};kJ(yS,{bufferToFormData:()=>BJ,bufferToString:()=>AJ,equal:()=>zJ,timingSafeEqual:()=>IJ});var wS=EJ(yS),xS=vJ;const zJ=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e),r=new DataView(t);let a=n.byteLength;for(;a--;)if(n.getUint8(a)!==r.getUint8(a))return!1;return!0},b8=(e,t)=>{const n=e.length,r=t.length,a=Math.max(n,r);let i=n^r;for(let s=0;s<a;s++){const d=s<n?e.charCodeAt(s):0,l=s<r?t.charCodeAt(s):0;i|=d^l}return i===0},y8=async(e,t,n)=>{n||(n=xS.sha256);const[r,a]=await Promise.all([n(e),n(t)]);if(r==null||a==null||typeof r!="string"||typeof a!="string")return!1;const i=b8(r,a),s=b8(e,t);return i&&s},IJ=async(e,t,n)=>{if(typeof e=="string"&&typeof t=="string")return y8(e,t,n);n||(n=xS.sha256);const[r,a]=await Promise.all([n(e),n(t)]);return!r||!a||typeof r!="string"||typeof a!="string"?!1:y8(r,a)},AJ=e=>e instanceof ArrayBuffer?new TextDecoder("utf-8").decode(e):e,BJ=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,r=>r.toLowerCase())}}).formData();var a3=Object.defineProperty,LJ=Object.getOwnPropertyDescriptor,OJ=Object.getOwnPropertyNames,PJ=Object.prototype.hasOwnProperty,MJ=(e,t)=>{for(var n in t)a3(e,n,{get:t[n],enumerable:!0})},TJ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of OJ(t))!PJ.call(e,a)&&a!==n&&a3(e,a,{get:()=>t[a],enumerable:!(r=LJ(t,a))||r.enumerable});return e},DJ=e=>TJ(a3({},"__esModule",{value:!0}),e),CS={};MJ(CS,{validator:()=>UJ});var $J=DJ(CS),NJ=eJ,w8=vS,jJ=wS;const RJ=/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,FJ=/^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/i,VJ=/^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,UJ=(e,t)=>async(n,r)=>{let a={};const i=n.req.header("Content-Type");switch(e){case"json":if(!i||!RJ.test(i))break;try{a=await n.req.json()}catch{const d="Malformed JSON in request body";throw new w8.HTTPException(400,{message:d})}break;case"form":{if(!i||!(FJ.test(i)||VJ.test(i)))break;let d;if(n.req.bodyCache.formData)d=await n.req.bodyCache.formData;else try{const c=await n.req.arrayBuffer();d=await(0,jJ.bufferToFormData)(c,i),n.req.bodyCache.formData=d}catch(c){let f="Malformed FormData request.";throw f+=c instanceof Error?` ${c.message}`:` ${String(c)}`,new w8.HTTPException(400,{message:f})}const l=Object.create(null);d.forEach((c,f)=>{f.endsWith("[]")?(l[f]??(l[f]=[])).push(c):Array.isArray(l[f])?l[f].push(c):Object.hasOwn(l,f)?l[f]=[l[f],c]:l[f]=c}),a=l;break}case"query":a=Object.fromEntries(Object.entries(n.req.queries()).map(([d,l])=>l.length===1?[d,l[0]]:[d,l]));break;case"param":a=n.req.param();break;case"header":a=n.req.header();break;case"cookie":a=(0,NJ.getCookie)(n);break}const s=await t(a,n);return s instanceof Response?s:(n.req.addValidatedData(e,s),await r())};var o3=Object.defineProperty,ZJ=Object.getOwnPropertyDescriptor,qJ=Object.getOwnPropertyNames,HJ=Object.prototype.hasOwnProperty,WJ=(e,t)=>{for(var n in t)o3(e,n,{get:t[n],enumerable:!0})},GJ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of qJ(t))!HJ.call(e,a)&&a!==n&&o3(e,a,{get:()=>t[a],enumerable:!(r=ZJ(t,a))||r.enumerable});return e},XJ=e=>GJ(o3({},"__esModule",{value:!0}),e),SS={};WJ(SS,{validator:()=>KJ.validator});var YJ=XJ(SS),KJ=$J;(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=YJ;function n(a,i,s,d){return(0,t.validator)(a,async(l,c)=>{let f=l;if(a==="header"&&"_def"in i||a==="header"&&"_zod"in i){const u=Object.keys("in"in i?i.in.shape:i.shape),h=Object.fromEntries(u.map(g=>[g.toLowerCase(),g]));f=Object.fromEntries(Object.entries(l).map(([g,y])=>[h[g]||g,y]))}const m=d&&d.validationFunction?await d.validationFunction(i,f):await i.safeParseAsync(f);if(s){const u=await s({data:f,...m,target:a},c);if(u){if(u instanceof Response)return u;if("response"in u)return u.response}}return m.success?m.data:c.json(m,400)})}const r=n;e.zValidator=r})(JC);var i3=Object.defineProperty,JJ=Object.getOwnPropertyDescriptor,QJ=Object.getOwnPropertyNames,eQ=Object.prototype.hasOwnProperty,tQ=(e,t)=>{for(var n in t)i3(e,n,{get:t[n],enumerable:!0})},nQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of QJ(t))!eQ.call(e,a)&&a!==n&&i3(e,a,{get:()=>t[a],enumerable:!(r=JJ(t,a))||r.enumerable});return e},rQ=e=>nQ(i3({},"__esModule",{value:!0}),e),kS={};tQ(kS,{compose:()=>oQ});var aQ=rQ(kS);const oQ=(e,t,n)=>(r,a)=>{let i=-1;return s(0);async function s(d){if(d<=i)throw new Error("next() called multiple times");i=d;let l,c=!1,f;if(e[d]?(f=e[d][0][0],r.req.routeIndex=d):f=d===e.length&&a||void 0,f)try{l=await f(r,()=>s(d+1))}catch(m){if(m instanceof Error&&t)r.error=m,l=await t(m,r),c=!0;else throw m}else r.finalized===!1&&n&&(l=await n(r));return l&&(r.finalized===!1||c)&&(r.res=l),r}};var s3=Object.defineProperty,iQ=Object.getOwnPropertyDescriptor,sQ=Object.getOwnPropertyNames,lQ=Object.prototype.hasOwnProperty,cQ=(e,t)=>{for(var n in t)s3(e,n,{get:t[n],enumerable:!0})},uQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of sQ(t))!lQ.call(e,a)&&a!==n&&s3(e,a,{get:()=>t[a],enumerable:!(r=iQ(t,a))||r.enumerable});return e},dQ=e=>uQ(s3({},"__esModule",{value:!0}),e),_S={};cQ(_S,{GET_MATCH_RESULT:()=>pQ});var fQ=dQ(_S);const pQ=Symbol();var l3=Object.defineProperty,mQ=Object.getOwnPropertyDescriptor,hQ=Object.getOwnPropertyNames,gQ=Object.prototype.hasOwnProperty,vQ=(e,t)=>{for(var n in t)l3(e,n,{get:t[n],enumerable:!0})},bQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of hQ(t))!gQ.call(e,a)&&a!==n&&l3(e,a,{get:()=>t[a],enumerable:!(r=mQ(t,a))||r.enumerable});return e},yQ=e=>bQ(l3({},"__esModule",{value:!0}),e),ES={};vQ(ES,{parseBody:()=>SQ});var wQ=yQ(ES),xQ=wS;const x8=32,CQ=1e4,i1=e=>"headers"in e,SQ=async(e,t=Object.create(null))=>{const{all:n=!1,dot:r=!1}=t,i=(i1(e)?e.headers:e.raw.headers).get("Content-Type"),s=i==null?void 0:i.split(";")[0].trim().toLowerCase();return s==="multipart/form-data"||s==="application/x-www-form-urlencoded"?kQ(e,{all:n,dot:r}):{}};async function kQ(e,t){if(!i1(e)&&e.bodyCache.formData)return C8(await e.bodyCache.formData,t);const n=i1(e)?e.headers:e.raw.headers,r=await e.arrayBuffer(),a=(0,xQ.bufferToFormData)(r,n.get("Content-Type")||"");i1(e)||(e.bodyCache.formData=a);const i=await a;return i?C8(i,t):{}}function C8(e,t){const n=Object.create(null),r={count:0};return e.forEach((a,i)=>{t.all||i.endsWith("[]")?_Q(n,i,a):n[i]=a}),t.dot&&Object.entries(n).forEach(([a,i])=>{a.includes(".")&&(EQ(n,a,i,r),delete n[a])}),n}const _Q=(e,t,n)=>{e[t]!==void 0?Array.isArray(e[t])?e[t].push(n):e[t]=[e[t],n]:t.endsWith("[]")?e[t]=[n]:e[t]=n},EQ=(e,t,n,r)=>{if(/(?:^|\.)__proto__\./.test(t))return;let a=e;const i=t.split(".",x8+2);i.length>x8+1&&S8(),i.forEach((s,d)=>{d===i.length-1?a[s]=n:((!a[s]||typeof a[s]!="object"||Array.isArray(a[s])||a[s]instanceof File)&&(r.count++>=CQ&&S8(),a[s]=Object.create(null)),a=a[s])})},S8=()=>{throw new Error("Nesting limit exceeded")};var c3=Object.defineProperty,zQ=Object.getOwnPropertyDescriptor,IQ=Object.getOwnPropertyNames,AQ=Object.prototype.hasOwnProperty,BQ=(e,t)=>{for(var n in t)c3(e,n,{get:t[n],enumerable:!0})},LQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of IQ(t))!AQ.call(e,a)&&a!==n&&c3(e,a,{get:()=>t[a],enumerable:!(r=zQ(t,a))||r.enumerable});return e},OQ=e=>LQ(c3({},"__esModule",{value:!0}),e),zS={};BQ(zS,{HonoRequest:()=>$Q,cloneRawRequest:()=>NQ});var PQ=OQ(zS),MQ=vS,TQ=fQ,DQ=wQ,Df=Al,Rd,za,mi,IS,AS,Wg,ri;class $Q{constructor(t,n="/",r=[[]]){zt(this,mi);ve(this,"raw");zt(this,Rd);zt(this,za);ve(this,"routeIndex",0);ve(this,"path");ve(this,"bodyCache",{});zt(this,ri,t=>{const{bodyCache:n,raw:r}=this,a=n[t];if(a)return a;for(const i in n)return n[i].then(s=>(i==="json"&&(s=JSON.stringify(s)),new Response(s)[t]()));return n[t]=r[t]()});this.raw=t,this.path=n,xt(this,za,r)}param(t){return t?Rt(this,mi,IS).call(this,t):Rt(this,mi,AS).call(this)}query(t){return(0,Df.getQueryParam)(this.url,t)}queries(t){return(0,Df.getQueryParams)(this.url,t)}header(t){if(t)return this.raw.headers.get(t)??void 0;const n=Object.create(null);return this.raw.headers.forEach((r,a)=>{n[a]=r}),n}async parseBody(t){return(0,DQ.parseBody)(this,t)}json(){return Le(this,ri).call(this,"text").then(t=>JSON.parse(t))}text(){return Le(this,ri).call(this,"text")}arrayBuffer(){return Le(this,ri).call(this,"arrayBuffer")}bytes(){return Le(this,ri).call(this,"arrayBuffer").then(t=>new Uint8Array(t))}blob(){return Le(this,ri).call(this,"blob")}formData(){return Le(this,ri).call(this,"formData")}addValidatedData(t,n){(Le(this,Rd)??xt(this,Rd,{}))[t]=n}valid(t){var n;return(n=Le(this,Rd))==null?void 0:n[t]}get url(){return this.raw.url}get method(){return this.raw.method}get[TQ.GET_MATCH_RESULT](){return Le(this,za)}get matchedRoutes(){return Le(this,za)[0].map(([[,t]])=>t)}get routePath(){return Le(this,za)[0].map(([[,t]])=>t)[this.routeIndex].path}}Rd=new WeakMap,za=new WeakMap,mi=new WeakSet,IS=function(t){var a;const n=(a=Le(this,za)[0][this.routeIndex])==null?void 0:a[1][t],r=Rt(this,mi,Wg).call(this,n);return r&&(0,Df.tryDecodeURIComponent)(r)},AS=function(){var r;const t={},n=Object.keys(((r=Le(this,za)[0][this.routeIndex])==null?void 0:r[1])??{});for(const a of n){const i=Rt(this,mi,Wg).call(this,Le(this,za)[0][this.routeIndex][1][a]);i!==void 0&&(t[a]=(0,Df.tryDecodeURIComponent)(i))}return t},Wg=function(t){return Le(this,za)[1]?Le(this,za)[1][t]:t},ri=new WeakMap;const NQ=async e=>{if(!e.raw.bodyUsed)return e.raw.clone();const t=Object.keys(e.bodyCache)[0];if(!t)throw new MQ.HTTPException(500,{message:"Cannot clone request: body was already consumed and not cached. Please use HonoRequest methods (e.g., req.json(), req.text()) instead of consuming req.raw directly."});let n=await e[t]();const r=e.header();t==="json"?(n=JSON.stringify(n),delete r["content-length"]):n instanceof FormData&&(delete r["content-type"],delete r["content-length"]);const a={body:n,cache:e.raw.cache,credentials:e.raw.credentials,headers:r,integrity:e.raw.integrity,keepalive:e.raw.keepalive,method:e.method,mode:e.raw.mode,redirect:e.raw.redirect,referrer:e.raw.referrer,referrerPolicy:e.raw.referrerPolicy,signal:e.raw.signal};return new Request(e.url,a)};var u3=Object.defineProperty,jQ=Object.getOwnPropertyDescriptor,RQ=Object.getOwnPropertyNames,FQ=Object.prototype.hasOwnProperty,VQ=(e,t)=>{for(var n in t)u3(e,n,{get:t[n],enumerable:!0})},UQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of RQ(t))!FQ.call(e,a)&&a!==n&&u3(e,a,{get:()=>t[a],enumerable:!(r=jQ(t,a))||r.enumerable});return e},ZQ=e=>UQ(u3({},"__esModule",{value:!0}),e),BS={};VQ(BS,{HtmlEscapedCallbackPhase:()=>LS,escapeToBuffer:()=>OS,raw:()=>d3,resolveCallback:()=>PS,resolveCallbackSync:()=>GQ,stringBufferToString:()=>WQ});var qQ=ZQ(BS);const LS={Stringify:1,BeforeStream:2,Stream:3},d3=(e,t)=>{const n=new String(e);return n.isEscaped=!0,n.callbacks=t,n},HQ=/[&<>'"]/,WQ=async(e,t)=>{let n="";t||(t=[]);const r=await Promise.all(e);for(let a=r.length-1;n+=r[a],a--,!(a<0);a--){let i=r[a];typeof i=="object"&&t.push(...i.callbacks||[]);const s=i.isEscaped;if(i=await(typeof i=="object"?i.toString():i),typeof i=="object"&&t.push(...i.callbacks||[]),i.isEscaped??s)n+=i;else{const d=[n];OS(i,d),n=d[0]}}return d3(n,t)},OS=(e,t)=>{const n=e.search(HQ);if(n===-1){t[0]+=e;return}let r,a,i=0;for(a=n;a<e.length;a++){switch(e.charCodeAt(a)){case 34:r=""";break;case 39:r="'";break;case 38:r="&";break;case 60:r="<";break;case 62:r=">";break;default:continue}t[0]+=e.substring(i,a)+r,i=a+1}t[0]+=e.substring(i,a)},GQ=e=>{const t=e.callbacks;if(!(t!=null&&t.length))return e;const n=[e],r={};return t.forEach(a=>a({phase:LS.Stringify,buffer:n,context:r})),n[0]},PS=async(e,t,n,r,a)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));const i=e.callbacks;if(!(i!=null&&i.length))return Promise.resolve(e);a?a[0]+=e:a=[e];const s=Promise.all(i.map(d=>d({phase:t,buffer:a,context:r}))).then(d=>Promise.all(d.filter(Boolean).map(l=>PS(l,t,!1,r,a))).then(()=>a[0]));return n?d3(await s,i):s};var f3=Object.defineProperty,XQ=Object.getOwnPropertyDescriptor,YQ=Object.getOwnPropertyNames,KQ=Object.prototype.hasOwnProperty,JQ=(e,t)=>{for(var n in t)f3(e,n,{get:t[n],enumerable:!0})},QQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of YQ(t))!KQ.call(e,a)&&a!==n&&f3(e,a,{get:()=>t[a],enumerable:!(r=XQ(t,a))||r.enumerable});return e},eee=e=>QQ(f3({},"__esModule",{value:!0}),e),MS={};JQ(MS,{Context:()=>nee,TEXT_PLAIN:()=>DS});var TS=eee(MS),tee=PQ,k8=qQ;const DS="text/plain; charset=UTF-8",_2=(e,t)=>({"Content-Type":e,...t}),Ou=(e,t)=>new Response(e,t);var Fd,Vd,ai,Ic,oi,Pr,Ud,Ac,Bc,il,Zd,qd,Wi,cc;class nee{constructor(t,n){zt(this,Wi);zt(this,Fd);zt(this,Vd);ve(this,"env",{});zt(this,ai);ve(this,"finalized",!1);ve(this,"error");zt(this,Ic);zt(this,oi);zt(this,Pr);zt(this,Ud);zt(this,Ac);zt(this,Bc);zt(this,il);zt(this,Zd);zt(this,qd);ve(this,"render",(...t)=>(Le(this,Ac)??xt(this,Ac,n=>this.html(n)),Le(this,Ac).call(this,...t)));ve(this,"setLayout",t=>xt(this,Ud,t));ve(this,"getLayout",()=>Le(this,Ud));ve(this,"setRenderer",t=>{xt(this,Ac,t)});ve(this,"header",(t,n,r)=>{this.finalized&&xt(this,Pr,Ou(Le(this,Pr).body,Le(this,Pr)));const a=Le(this,Pr)?Le(this,Pr).headers:Le(this,il)??xt(this,il,new Headers);n===void 0?a.delete(t):r!=null&&r.append?a.append(t,n):a.set(t,n)});ve(this,"status",t=>{xt(this,Ic,t)});ve(this,"set",(t,n)=>{Le(this,ai)??xt(this,ai,new Map),Le(this,ai).set(t,n)});ve(this,"get",t=>Le(this,ai)?Le(this,ai).get(t):void 0);ve(this,"newResponse",(...t)=>Rt(this,Wi,cc).call(this,...t));ve(this,"body",(t,n,r)=>Rt(this,Wi,cc).call(this,t,n,r));ve(this,"text",(t,n,r)=>!Le(this,il)&&!Le(this,Ic)&&!n&&!r&&!this.finalized?new Response(t):Rt(this,Wi,cc).call(this,t,n,_2(DS,r)));ve(this,"json",(t,n,r)=>Rt(this,Wi,cc).call(this,JSON.stringify(t),n,_2("application/json",r)));ve(this,"html",(t,n,r)=>{const a=i=>Rt(this,Wi,cc).call(this,i,n,_2("text/html; charset=UTF-8",r));return typeof t=="object"?(0,k8.resolveCallback)(t,k8.HtmlEscapedCallbackPhase.Stringify,!1,{}).then(a):a(t)});ve(this,"redirect",(t,n)=>{const r=String(t);return this.header("Location",/[^\x00-\xFF]/.test(r)?encodeURI(r):r),this.newResponse(null,n??302)});ve(this,"notFound",()=>(Le(this,Bc)??xt(this,Bc,()=>Ou()),Le(this,Bc).call(this,this)));xt(this,Fd,t),n&&(xt(this,oi,n.executionCtx),this.env=n.env,xt(this,Bc,n.notFoundHandler),xt(this,qd,n.path),xt(this,Zd,n.matchResult))}get req(){return Le(this,Vd)??xt(this,Vd,new tee.HonoRequest(Le(this,Fd),Le(this,qd),Le(this,Zd))),Le(this,Vd)}get event(){if(Le(this,oi)&&"respondWith"in Le(this,oi))return Le(this,oi);throw Error("This context has no FetchEvent")}get executionCtx(){if(Le(this,oi))return Le(this,oi);throw Error("This context has no ExecutionContext")}get res(){return Le(this,Pr)||xt(this,Pr,Ou(null,{headers:Le(this,il)??xt(this,il,new Headers)}))}set res(t){if(Le(this,Pr)&&t){t=Ou(t.body,t);for(const[n,r]of Le(this,Pr).headers.entries())if(n!=="content-type")if(n==="set-cookie"){const a=Le(this,Pr).headers.getSetCookie();t.headers.delete("set-cookie");for(const i of a)t.headers.append("set-cookie",i)}else t.headers.set(n,r)}xt(this,Pr,t),this.finalized=!0}get var(){return Le(this,ai)?Object.fromEntries(Le(this,ai)):{}}}Fd=new WeakMap,Vd=new WeakMap,ai=new WeakMap,Ic=new WeakMap,oi=new WeakMap,Pr=new WeakMap,Ud=new WeakMap,Ac=new WeakMap,Bc=new WeakMap,il=new WeakMap,Zd=new WeakMap,qd=new WeakMap,Wi=new WeakSet,cc=function(t,n,r){let a=Le(this,Pr)?new Headers(Le(this,Pr).headers):Le(this,il);if(typeof n=="object"&&n.headers){a??(a=new Headers);for(const[s,d]of new Headers(n.headers))s==="set-cookie"?a.append(s,d):a.set(s,d)}if(r){if(!a){let s=0;for(const d in r)if(++s>1||typeof r[d]!="string"){a=new Headers;break}}if(a)for(const s in r){const d=r[s];if(typeof d=="string")a.set(s,d);else{a.delete(s);for(const l of d)a.append(s,l)}}}const i=typeof n=="number"?n:(n==null?void 0:n.status)??Le(this,Ic);return Ou(t,{status:i,headers:a??r})};var p3=Object.defineProperty,ree=Object.getOwnPropertyDescriptor,aee=Object.getOwnPropertyNames,oee=Object.prototype.hasOwnProperty,iee=(e,t)=>{for(var n in t)p3(e,n,{get:t[n],enumerable:!0})},see=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of aee(t))!oee.call(e,a)&&a!==n&&p3(e,a,{get:()=>t[a],enumerable:!(r=ree(t,a))||r.enumerable});return e},lee=e=>see(p3({},"__esModule",{value:!0}),e),$S={};iee($S,{MESSAGE_MATCHER_IS_ALREADY_BUILT:()=>fee,METHODS:()=>dee,METHOD_NAME_ALL:()=>cee,METHOD_NAME_ALL_LOWERCASE:()=>uee,UnsupportedPathError:()=>pee});var tu=lee($S);const cee="ALL",uee="all",dee=["get","post","put","delete","options","patch","query"],fee="Can not add a route since the matcher is already built.";class pee extends Error{}var m3=Object.defineProperty,mee=Object.getOwnPropertyDescriptor,hee=Object.getOwnPropertyNames,gee=Object.prototype.hasOwnProperty,vee=(e,t)=>{for(var n in t)m3(e,n,{get:t[n],enumerable:!0})},bee=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of hee(t))!gee.call(e,a)&&a!==n&&m3(e,a,{get:()=>t[a],enumerable:!(r=mee(t,a))||r.enumerable});return e},yee=e=>bee(m3({},"__esModule",{value:!0}),e),NS={};vee(NS,{COMPOSED_HANDLER:()=>xee});var wee=yee(NS);const xee="__COMPOSED_HANDLER";var h3=Object.defineProperty,Cee=Object.getOwnPropertyDescriptor,See=Object.getOwnPropertyNames,kee=Object.prototype.hasOwnProperty,_ee=(e,t)=>{for(var n in t)h3(e,n,{get:t[n],enumerable:!0})},Eee=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of See(t))!kee.call(e,a)&&a!==n&&h3(e,a,{get:()=>t[a],enumerable:!(r=Cee(t,a))||r.enumerable});return e},zee=e=>Eee(h3({},"__esModule",{value:!0}),e),jS={};_ee(jS,{HonoBase:()=>Oee});var Iee=zee(jS),_8=aQ,Aee=TS,$f=tu,Bee=wee,Ti=Al;const Lee=e=>e.text("404 Not Found",404),E8=(e,t)=>{if("getResponse"in e){const n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text("Internal Server Error",500)};var Wa,er,RS,Ga,Ws,s1,l1,Lc;let Oee=(Lc=class{constructor(t={}){zt(this,er);ve(this,"get");ve(this,"post");ve(this,"put");ve(this,"delete");ve(this,"options");ve(this,"patch");ve(this,"query");ve(this,"all");ve(this,"on");ve(this,"use");ve(this,"router");ve(this,"getPath");ve(this,"_basePath","/");zt(this,Wa,"/");ve(this,"routes",[]);zt(this,Ga,Lee);ve(this,"errorHandler",E8);ve(this,"onError",t=>(this.errorHandler=t,this));ve(this,"notFound",t=>(xt(this,Ga,t),this));ve(this,"fetch",(t,...n)=>Rt(this,er,l1).call(this,t,n[1],n[0],t.method));ve(this,"request",(t,n,r,a)=>t instanceof Request?this.fetch(n?new Request(t,n):t,r,a):(t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${(0,Ti.mergePath)("/",t)}`,n),r,a)));ve(this,"fire",()=>{addEventListener("fetch",t=>{t.respondWith(Rt(this,er,l1).call(this,t.request,t,void 0,t.request.method))})});[...$f.METHODS,$f.METHOD_NAME_ALL_LOWERCASE].forEach(i=>{this[i]=(s,...d)=>(typeof s=="string"?xt(this,Wa,s):Rt(this,er,Ws).call(this,i,Le(this,Wa),s),d.forEach(l=>{Rt(this,er,Ws).call(this,i,Le(this,Wa),l)}),this)}),this.on=(i,s,...d)=>{for(const l of[s].flat()){xt(this,Wa,l);for(const c of[i].flat())d.map(f=>{Rt(this,er,Ws).call(this,c.toUpperCase(),Le(this,Wa),f)})}return this},this.use=(i,...s)=>(typeof i=="string"?xt(this,Wa,i):(xt(this,Wa,"*"),s.unshift(i)),s.forEach(d=>{Rt(this,er,Ws).call(this,$f.METHOD_NAME_ALL,Le(this,Wa),d)}),this);const{strict:r,...a}=t;Object.assign(this,a),this.getPath=r??!0?t.getPath??Ti.getPath:Ti.getPathNoStrict}route(t,n){const r=this.basePath(t);return n.routes.map(a=>{var s;let i;n.errorHandler===E8?i=a.handler:(i=async(d,l)=>(await(0,_8.compose)([],n.errorHandler)(d,()=>a.handler(d,l))).res,i[Bee.COMPOSED_HANDLER]=a.handler),Rt(s=r,er,Ws).call(s,a.method,a.path,i,a.basePath)}),this}basePath(t){const n=Rt(this,er,RS).call(this);return n._basePath=(0,Ti.mergePath)(this._basePath,t),n}mount(t,n,r){let a,i;r&&(typeof r=="function"?i=r:(i=r.optionHandler,r.replaceRequest===!1?a=l=>l:a=r.replaceRequest));const s=i?l=>{const c=i(l);return Array.isArray(c)?c:[c]}:l=>{let c;try{c=l.executionCtx}catch{}return[l.env,c]};a||(a=(()=>{const l=(0,Ti.mergePath)(this._basePath,t),c=l==="/"?0:l.length;return f=>{const m=new URL(f.url);return m.pathname=this.getPath(f).slice(c)||"/",new Request(m,f)}})());const d=async(l,c)=>{const f=await n(a(l.req.raw),...s(l));if(f)return f;await c()};return Rt(this,er,Ws).call(this,$f.METHOD_NAME_ALL,(0,Ti.mergePath)(t,"*"),d),this}},Wa=new WeakMap,er=new WeakSet,RS=function(){const t=new Lc({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,xt(t,Ga,Le(this,Ga)),t.routes=this.routes,t},Ga=new WeakMap,Ws=function(t,n,r,a){t=t.toUpperCase(),n=(0,Ti.mergePath)(this._basePath,n);const i={basePath:a!==void 0?(0,Ti.mergePath)(this._basePath,a):this._basePath,path:n,method:t,handler:r};this.router.add(t,n,[r,i]),this.routes.push(i)},s1=function(t,n){if(t instanceof Error)return this.errorHandler(t,n);throw t},l1=function(t,n,r,a){if(a==="HEAD")return(async()=>new Response(null,await Rt(this,er,l1).call(this,t,n,r,"GET")))();const i=this.getPath(t,{env:r}),s=this.router.match(a,i),d=new Aee.Context(t,{path:i,matchResult:s,env:r,executionCtx:n,notFoundHandler:Le(this,Ga)});if(s[0].length===1){let c;try{c=s[0][0][0][0](d,async()=>{d.res=await Le(this,Ga).call(this,d)})}catch(f){return Rt(this,er,s1).call(this,f,d)}return c instanceof Promise?c.then(f=>f||(d.finalized?d.res:Le(this,Ga).call(this,d))).catch(f=>Rt(this,er,s1).call(this,f,d)):c??Le(this,Ga).call(this,d)}const l=(0,_8.compose)(s[0],this.errorHandler,Le(this,Ga));return(async()=>{try{const c=await l(d);if(!c.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return c.res}catch(c){return Rt(this,er,s1).call(this,c,d)}})()},Lc);var g3=Object.defineProperty,Pee=Object.getOwnPropertyDescriptor,Mee=Object.getOwnPropertyNames,Tee=Object.prototype.hasOwnProperty,Dee=(e,t)=>{for(var n in t)g3(e,n,{get:t[n],enumerable:!0})},$ee=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Mee(t))!Tee.call(e,a)&&a!==n&&g3(e,a,{get:()=>t[a],enumerable:!(r=Pee(t,a))||r.enumerable});return e},Nee=e=>$ee(g3({},"__esModule",{value:!0}),e),FS={};Dee(FS,{createNullObject:()=>jee});var om=Nee(FS);const jee=()=>Object.create(null);var v3=Object.defineProperty,Ree=Object.getOwnPropertyDescriptor,Fee=Object.getOwnPropertyNames,Vee=Object.prototype.hasOwnProperty,Uee=(e,t)=>{for(var n in t)v3(e,n,{get:t[n],enumerable:!0})},Zee=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Fee(t))!Vee.call(e,a)&&a!==n&&v3(e,a,{get:()=>t[a],enumerable:!(r=Ree(t,a))||r.enumerable});return e},qee=e=>Zee(v3({},"__esModule",{value:!0}),e),VS={};Uee(VS,{emptyParam:()=>ZS,match:()=>Wee});var US=qee(VS),Hee=tu;const ZS=[];function Wee(e,t){const n=this.buildAllMatchers(),r=(a,i)=>{const s=n[a]||n[Hee.METHOD_NAME_ALL],d=s[2][i];if(d)return d;const l=i.match(s[0]);if(!l)return[[],ZS];const c=l.indexOf("",1);return[s[1][c],l]};return this.match=r,r(e,t)}var b3=Object.defineProperty,Gee=Object.getOwnPropertyDescriptor,Xee=Object.getOwnPropertyNames,Yee=Object.prototype.hasOwnProperty,Kee=(e,t)=>{for(var n in t)b3(e,n,{get:t[n],enumerable:!0})},Jee=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Xee(t))!Yee.call(e,a)&&a!==n&&b3(e,a,{get:()=>t[a],enumerable:!(r=Gee(t,a))||r.enumerable});return e},Qee=e=>Jee(b3({},"__esModule",{value:!0}),e),qS={};Kee(qS,{LABEL_REG_EXP_STR:()=>Ad,Node:()=>nte,ONLY_WILDCARD_REG_EXP_STR:()=>rl,PATH_ERROR:()=>Gs,TAIL_WILDCARD_REG_EXP_STR:()=>es});var HS=Qee(qS),ete=om;const Ad="[^/]+",rl=".*",es="(?:|/.*)",Gs=Symbol(),z8=new Set(".\\+*[^]$()");function tte(e,t){return e.length===1?t.length===1?e<t?-1:1:-1:t.length===1?1:e===rl||e===es?t===es?-1:1:t===rl||t===es?-1:e===Ad?1:t===Ad?-1:e.length===t.length?e<t?-1:1:t.length-e.length}var Gi,sl,Xa,gl;let nte=(gl=class{constructor(){zt(this,Gi);zt(this,sl);zt(this,Xa,(0,ete.createNullObject)())}insert(t,n,r,a,i){let s=this;for(let d=0,l=t.length;d<l;d++){const c=t[d],f=c.length===1?c==="*"?d===l-1?["","",rl]:["","",Ad]:null:c==="/*"?["","",es]:c.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);let m;if(f){const u=f[1];let h=f[2]||Ad;if(u&&f[2]&&(h===".*"||(h=h.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(h))||h.length===1&&z8.has(h)))throw Gs;if(m=Le(s,Xa)[h],!m){if(h!==rl&&h!==es){for(const g in Le(s,Xa))if((h.length>1||g.length>1)&&g!==rl&&g!==es)throw Gs}m=Le(s,Xa)[h]=new gl}u!==""&&(Le(m,sl)??xt(m,sl,a.varIndex++),r.push([u,Le(m,sl)]))}else if(m=Le(s,Xa)[c],!m){for(const u in Le(s,Xa))if(u.length>1&&u!==rl&&u!==es)throw Gs;m=Le(s,Xa)[c]=new gl}s=m}if(Le(s,Gi)!==void 0)throw Gs;xt(s,Gi,i?-1:n)}buildRegExpStr(){const n=Object.keys(Le(this,Xa)).sort(tte).map(r=>{const a=Le(this,Xa)[r],i=a.buildRegExpStr();return i===""?"":(typeof Le(a,sl)=="number"?`(${r})@${Le(a,sl)}`:z8.has(r)?`\\${r}`:r)+i}).filter(Boolean);return typeof Le(this,Gi)=="number"&&Le(this,Gi)!==-1&&n.unshift(`#${Le(this,Gi)}`),n.length===0?"":n.length===1?n[0]:"(?:"+n.join("|")+")"}},Gi=new WeakMap,sl=new WeakMap,Xa=new WeakMap,gl);var y3=Object.defineProperty,rte=Object.getOwnPropertyDescriptor,ate=Object.getOwnPropertyNames,ote=Object.prototype.hasOwnProperty,ite=(e,t)=>{for(var n in t)y3(e,n,{get:t[n],enumerable:!0})},ste=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ate(t))!ote.call(e,a)&&a!==n&&y3(e,a,{get:()=>t[a],enumerable:!(r=rte(t,a))||r.enumerable});return e},lte=e=>ste(y3({},"__esModule",{value:!0}),e),WS={};ite(WS,{Trie:()=>fte});var cte=lte(WS),ute=om,dte=HS,Hd,Oc,Wd;class fte{constructor(){zt(this,Hd,{varIndex:0});zt(this,Oc,new dte.Node);zt(this,Wd,0);ve(this,"paths",(0,ute.createNullObject)())}insert(t,n){if(n){Le(this,Oc).insert(t.split(""),0,[],Le(this,Hd),!0);return}const r=[],a=[];let i=t;for(let d=0;;){let l=!1;if(i=i.replace(/\{[^}]+\}/g,c=>{const f=`@\\${d}`;return a[d]=[f,c],d++,l=!0,f}),!l)break}const s=i.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let d=a.length-1;d>=0;d--){const[l]=a[d];for(let c=s.length-1;c>=0;c--)if(s[c].indexOf(l)!==-1){s[c]=s[c].replace(l,a[d][1]);break}}Le(this,Oc).insert(s,Le(this,Wd),r,Le(this,Hd),!1),this.paths[t]=[gf(this,Wd)._++,r]}buildRegExp(){let t=Le(this,Oc).buildRegExpStr();if(t==="")return[/^$/,[],[]];let n=0;const r=[],a=[];return t=t.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,s,d)=>s!==void 0?(r[++n]=Number(s),"$()"):(d!==void 0&&(a[Number(d)]=++n),"")),[new RegExp(`^${t}`),r,a]}}Hd=new WeakMap,Oc=new WeakMap,Wd=new WeakMap;var w3=Object.defineProperty,pte=Object.getOwnPropertyDescriptor,mte=Object.getOwnPropertyNames,hte=Object.prototype.hasOwnProperty,gte=(e,t)=>{for(var n in t)w3(e,n,{get:t[n],enumerable:!0})},vte=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of mte(t))!hte.call(e,a)&&a!==n&&w3(e,a,{get:()=>t[a],enumerable:!(r=pte(t,a))||r.enumerable});return e},bte=e=>vte(w3({},"__esModule",{value:!0}),e),GS={};gte(GS,{RegExpRouter:()=>wte});var XS=bte(GS),uo=tu,yte=Al,Qo=om,I8=US,c1=HS,A8=cte;let u1=(0,Qo.createNullObject)();function YS(e){return u1[e]??(u1[e]=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(t,n)=>n?`\\${n}`:t==="/*"?c1.TAIL_WILDCARD_REG_EXP_STR:t==="*"?c1.ONLY_WILDCARD_REG_EXP_STR:`/:${c1.LABEL_REG_EXP_STR}`)}$`))}function Nf(e,t){for(const n of Object.keys(e).sort((r,a)=>a.length-r.length))if(YS(n).test(t))return[...e[n]]}var ll,Xi,Yi,ds,d1,KS;class wte{constructor(){zt(this,ds);ve(this,"name","RegExpRouter");zt(this,ll);zt(this,Xi);zt(this,Yi);ve(this,"match",I8.match);xt(this,ll,{[uo.METHOD_NAME_ALL]:(0,Qo.createNullObject)()}),xt(this,Xi,{[uo.METHOD_NAME_ALL]:(0,Qo.createNullObject)()}),xt(this,Yi,{[uo.METHOD_NAME_ALL]:new A8.Trie})}add(t,n,r){const a=Le(this,ll),i=Le(this,Xi);if(!a)throw new Error(uo.MESSAGE_MATCHER_IS_ALREADY_BUILT);if(!a[t]){Le(this,Yi)[t]=new A8.Trie;for(const l of[a,i]){l[t]=(0,Qo.createNullObject)();for(const c in l[uo.METHOD_NAME_ALL])l[t][c]=[...l[uo.METHOD_NAME_ALL][c]],Rt(this,ds,d1).call(this,t,c)}}n==="/*"&&(n="*");const s=t===uo.METHOD_NAME_ALL?Object.keys(a):[t];if(/\*$/.test(n)){const l=YS(n);for(const c of s)a[c][n]||(Rt(this,ds,d1).call(this,c,n),a[c][n]=Nf(a[c],n)||Nf(a[uo.METHOD_NAME_ALL],n)||[]);for(const c of[a,i])for(const f of s)for(const m in c[f])l.test(m)&&c[f][m].push([r,n]);return}const d=(0,yte.checkOptionalParameter)(n)||[n];for(const l of d)for(const c of s)i[c][l]||(Rt(this,ds,d1).call(this,c,l),i[c][l]=Nf(a[c],l)||Nf(a[uo.METHOD_NAME_ALL],l)||[]),i[c][l].push([r,l])}buildAllMatchers(){const t=(0,Qo.createNullObject)();for(const n of Object.keys(Le(this,Xi)))t[n]=Rt(this,ds,KS).call(this,n);return xt(this,ll,xt(this,Xi,xt(this,Yi,void 0))),u1=(0,Qo.createNullObject)(),t}}ll=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,ds=new WeakSet,d1=function(t,n){try{Le(this,Yi)[t].insert(n,!/\*|\/:/.test(n))}catch(r){throw r===c1.PATH_ERROR?new uo.UnsupportedPathError(n):r}},KS=function(t){const n=Le(this,ll)[t],r=Le(this,Xi)[t],a=Le(this,Yi)[t],i=(0,Qo.createNullObject)(),s=[],[d,l,c]=a.buildRegExp();for(const f of[n,r])for(const m in f){const u=f[m],h=a.paths[m];if(!h){i[m]=[u.map(([g])=>[g,(0,Qo.createNullObject)()]),I8.emptyParam];continue}s[h[0]]=u.map(([g,y])=>[g,a.paths[y][1].reduceRight((w,[x],S)=>(w[x]=c[h[1][S][1]],w),(0,Qo.createNullObject)())])}return[d,l.map(f=>s[f]),i]};var x3=Object.defineProperty,xte=Object.getOwnPropertyDescriptor,Cte=Object.getOwnPropertyNames,Ste=Object.prototype.hasOwnProperty,kte=(e,t)=>{for(var n in t)x3(e,n,{get:t[n],enumerable:!0})},_te=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Cte(t))!Ste.call(e,a)&&a!==n&&x3(e,a,{get:()=>t[a],enumerable:!(r=xte(t,a))||r.enumerable});return e},Ete=e=>_te(x3({},"__esModule",{value:!0}),e),JS={};kte(JS,{PreparedRegExpRouter:()=>Ate,buildInitParams:()=>Bte,serializeInitParams:()=>Lte});var zte=Ete(JS),rd=tu,B8=US,Ite=XS,Ia,Gd,ws,Gg,Xg;class Ate{constructor(t,n){zt(this,ws);ve(this,"name","PreparedRegExpRouter");zt(this,Ia);zt(this,Gd);ve(this,"match",B8.match);xt(this,Ia,t),xt(this,Gd,n)}add(t,n,r){if(!Le(this,Ia)[t]){const i=Le(this,Ia)[rd.METHOD_NAME_ALL],s={};for(const d in i[2])s[d]=[i[2][d][0].slice(),B8.emptyParam];Le(this,Ia)[t]=[i[0],i[1].map(d=>Array.isArray(d)?d.slice():0),s]}if(n==="/*"||n==="*"){const i=[r,{}];if(t===rd.METHOD_NAME_ALL)for(const s in Le(this,Ia))Rt(this,ws,Gg).call(this,s,i);else Rt(this,ws,Gg).call(this,t,i);return}const a=Le(this,Gd)[n];if(!a)throw new Error(`Path ${n} is not registered`);for(const[i,s]of a)if(t===rd.METHOD_NAME_ALL)for(const d in Le(this,Ia))Rt(this,ws,Xg).call(this,d,n,r,i,s);else Rt(this,ws,Xg).call(this,t,n,r,i,s)}buildAllMatchers(){return Le(this,Ia)}}Ia=new WeakMap,Gd=new WeakMap,ws=new WeakSet,Gg=function(t,n){const r=Le(this,Ia)[t];r[1].forEach(a=>a&&a.push(n)),Object.values(r[2]).forEach(a=>a[0].push(n))},Xg=function(t,n,r,a,i){const s=Le(this,Ia)[t];i?a.forEach(d=>{typeof d=="number"?s[1][d].push([r,i]):s[2][d||n][0].push([r,i])}):s[2][n][0].push([r,{}])};const Bte=({paths:e})=>{const t=class extends Ite.RegExpRouter{buildAndExportAllMatchers(){return this.buildAllMatchers()}},n=new t;for(const s of e)n.add(rd.METHOD_NAME_ALL,s,s);const r=n.buildAndExportAllMatchers(),a=r[rd.METHOD_NAME_ALL],i={};for(const s of e)if(!(s==="/*"||s==="*")){a[1].forEach((d,l)=>{d.forEach(([c,f])=>{c===s&&(i[s]?i[s][0][1]={...i[s][0][1],...f}:i[s]=[[[],f]],i[s][0][0].findIndex(m=>m===l)===-1&&i[s][0][0].push(l))})});for(const d in a[2])a[2][d][0].forEach(([l])=>{if(l===s){i[s]||(i[s]=[[[]]]);const c=d===s?"":d;i[s][0][0].findIndex(f=>f===c)===-1&&i[s][0][0].push(c)}})}for(let s=0,d=a[1].length;s<d;s++)a[1][s]=a[1][s]?[]:0;for(const s in a[2])a[2][s][0]=[];return[r,i]},Lte=([e,t])=>{const n=JSON.stringify(e,(a,i)=>i instanceof RegExp?`##${i.toString()}##`:i).replace(/"##(.+?)##"/g,(a,i)=>i.replace(/\\\\/g,"\\")),r=JSON.stringify(t);return`[${n},${r}]`};var C3=Object.defineProperty,Ote=Object.getOwnPropertyDescriptor,Pte=Object.getOwnPropertyNames,Mte=Object.prototype.hasOwnProperty,Tte=(e,t)=>{for(var n in t)C3(e,n,{get:t[n],enumerable:!0})},Dte=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Pte(t))!Mte.call(e,a)&&a!==n&&C3(e,a,{get:()=>t[a],enumerable:!(r=Ote(t,a))||r.enumerable});return e},$te=e=>Dte(C3({},"__esModule",{value:!0}),e),QS={};Tte(QS,{PreparedRegExpRouter:()=>E2.PreparedRegExpRouter,RegExpRouter:()=>jte.RegExpRouter,buildInitParams:()=>E2.buildInitParams,serializeInitParams:()=>E2.serializeInitParams});var Nte=$te(QS),jte=XS,E2=zte,S3=Object.defineProperty,Rte=Object.getOwnPropertyDescriptor,Fte=Object.getOwnPropertyNames,Vte=Object.prototype.hasOwnProperty,Ute=(e,t)=>{for(var n in t)S3(e,n,{get:t[n],enumerable:!0})},Zte=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Fte(t))!Vte.call(e,a)&&a!==n&&S3(e,a,{get:()=>t[a],enumerable:!(r=Rte(t,a))||r.enumerable});return e},qte=e=>Zte(S3({},"__esModule",{value:!0}),e),ek={};Ute(ek,{SmartRouter:()=>Wte});var Hte=qte(ek),L8=tu,Ki,ii;class Wte{constructor(t){ve(this,"name","SmartRouter");zt(this,Ki,[]);zt(this,ii,[]);xt(this,Ki,t.routers)}add(t,n,r){if(!Le(this,ii))throw new Error(L8.MESSAGE_MATCHER_IS_ALREADY_BUILT);Le(this,ii).push([t,n,r])}match(t,n){if(!Le(this,ii))throw new Error("Fatal error");const r=Le(this,Ki),a=Le(this,ii),i=r.length;let s=0,d;for(;s<i;s++){const l=r[s];try{for(let c=0,f=a.length;c<f;c++)l.add(...a[c]);d=l.match(t,n)}catch(c){if(c instanceof L8.UnsupportedPathError)continue;throw c}this.match=l.match.bind(l),xt(this,Ki,[l]),xt(this,ii,void 0);break}if(s===i)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,d}get activeRouter(){if(Le(this,ii)||Le(this,Ki).length!==1)throw new Error("No active router has been determined yet.");return Le(this,Ki)[0]}}Ki=new WeakMap,ii=new WeakMap;var k3=Object.defineProperty,Gte=Object.getOwnPropertyDescriptor,Xte=Object.getOwnPropertyNames,Yte=Object.prototype.hasOwnProperty,Kte=(e,t)=>{for(var n in t)k3(e,n,{get:t[n],enumerable:!0})},Jte=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Xte(t))!Yte.call(e,a)&&a!==n&&k3(e,a,{get:()=>t[a],enumerable:!(r=Gte(t,a))||r.enumerable});return e},Qte=e=>Jte(k3({},"__esModule",{value:!0}),e),tk={};Kte(tk,{SmartRouter:()=>tne.SmartRouter});var ene=Qte(tk),tne=Hte,_3=Object.defineProperty,nne=Object.getOwnPropertyDescriptor,rne=Object.getOwnPropertyNames,ane=Object.prototype.hasOwnProperty,one=(e,t)=>{for(var n in t)_3(e,n,{get:t[n],enumerable:!0})},ine=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of rne(t))!ane.call(e,a)&&a!==n&&_3(e,a,{get:()=>t[a],enumerable:!(r=nne(t,a))||r.enumerable});return e},sne=e=>ine(_3({},"__esModule",{value:!0}),e),nk={};one(nk,{Node:()=>dne});var lne=sne(nk),cne=tu,z2=Al,Yg=om;const I2=(0,Yg.createNullObject)();let une=0;var Pc,Aa,Xd,Mc,or,ho,ji,Tc;let dne=(Tc=class{constructor(){zt(this,ho);zt(this,Pc,[]);zt(this,Aa,(0,Yg.createNullObject)());zt(this,Xd,[]);zt(this,Mc);zt(this,or,I2)}insert(t,n,r){var l;let a=this;const i=(0,z2.splitRoutingPath)(n),s=new Set;let d=0;for(const c of i){const f=i[++d],m=(0,z2.getPattern)(c,f)||(f===void 0&&c&&c.indexOf("*")===c.length-1?c:null),u=Array.isArray(m),h=u?m[0]:m||c,g=(l=Le(a,Aa))[h]||(l[h]=new Tc);m&&!Le(g,Mc)&&(xt(g,Mc,m),Le(a,Xd).push(g)),a=g,u&&s.add(m[1])}Le(a,Pc).push({[t]:{handler:r,possibleKeys:[...s],score:++une}})}search(t,n){var f;const r=[];xt(this,or,I2);let i=[this];const s=(0,z2.splitPath)(n),d=[],l=s.length;let c=null;for(let m=0;m<l;m++){const u=s[m],h=m===l-1,g=[];for(let w=0,x=i.length;w<x;w++){const S=i[w],C=Le(S,Aa)[u];C&&(xt(C,or,Le(S,or)),h?(Le(C,Aa)["*"]&&Rt(this,ho,ji).call(this,r,Le(C,Aa)["*"],t,Le(S,or)),Rt(this,ho,ji).call(this,r,C,t,Le(S,or))):g.push(C));for(const E of Le(S,Xd)){const _=Le(E,Mc),I=Le(S,or)===I2?{}:{...Le(S,or)};if(typeof _=="string"){(_==="*"||u.startsWith(_.slice(0,-1)))&&(Rt(this,ho,ji).call(this,r,E,t,Le(S,or)),_==="*"&&(xt(E,or,I),g.push(E)));continue}const[,B,k]=_;if(!(!u&&k===!0)){if(k!==!0){if(!c){c=[];let $=n[0]==="/"?1:0;for(let j=0;j<l;j++)c[j]=$,$+=s[j].length+1}const P=n.slice(c[m]),z=k.exec(P);if(z){I[B]=z[0],Rt(this,ho,ji).call(this,r,E,t,Le(S,or),I),z[0].length===P.length&&Le(E,Aa)["*"]&&Rt(this,ho,ji).call(this,r,Le(E,Aa)["*"],t,Le(S,or),I);for(const $ in Le(E,Aa)){xt(E,or,I);const j=((f=z[0].match(/\//g))==null?void 0:f.length)??0;(d[j]||(d[j]=[])).push(E);break}continue}}(k===!0||k.test(u))&&(I[B]=u,h?(Rt(this,ho,ji).call(this,r,E,t,I,Le(S,or)),Le(E,Aa)["*"]&&Rt(this,ho,ji).call(this,r,Le(E,Aa)["*"],t,I,Le(S,or))):(xt(E,or,I),g.push(E)))}}}const y=d.shift();i=y?g.concat(y):g}return r[1]&&r.sort((m,u)=>m.score-u.score),[r.map(({handler:m,params:u})=>[m,u])]}},Pc=new WeakMap,Aa=new WeakMap,Xd=new WeakMap,Mc=new WeakMap,or=new WeakMap,ho=new WeakSet,ji=function(t,n,r,a,i){for(let s=0,d=Le(n,Pc).length;s<d;s++){const l=Le(n,Pc)[s],c=l[r]||l[cne.METHOD_NAME_ALL];if(c){c.params=(0,Yg.createNullObject)(),t.push(c);for(let f=0,m=c.possibleKeys.length;f<m;f++){const u=c.possibleKeys[f];c.params[u]=i!=null&&i[u]&&!f?i[u]:a[u]??(i==null?void 0:i[u])}}}},Tc);var E3=Object.defineProperty,fne=Object.getOwnPropertyDescriptor,pne=Object.getOwnPropertyNames,mne=Object.prototype.hasOwnProperty,hne=(e,t)=>{for(var n in t)E3(e,n,{get:t[n],enumerable:!0})},gne=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of pne(t))!mne.call(e,a)&&a!==n&&E3(e,a,{get:()=>t[a],enumerable:!(r=fne(t,a))||r.enumerable});return e},vne=e=>gne(E3({},"__esModule",{value:!0}),e),rk={};hne(rk,{TrieRouter:()=>xne});var bne=vne(rk),yne=Al,wne=lne,Yd;class xne{constructor(){ve(this,"name","TrieRouter");zt(this,Yd,new wne.Node)}add(t,n,r){for(const a of(0,yne.checkOptionalParameter)(n)||[n])Le(this,Yd).insert(t,a,r)}match(t,n){return Le(this,Yd).search(t,n)}}Yd=new WeakMap;var z3=Object.defineProperty,Cne=Object.getOwnPropertyDescriptor,Sne=Object.getOwnPropertyNames,kne=Object.prototype.hasOwnProperty,_ne=(e,t)=>{for(var n in t)z3(e,n,{get:t[n],enumerable:!0})},Ene=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Sne(t))!kne.call(e,a)&&a!==n&&z3(e,a,{get:()=>t[a],enumerable:!(r=Cne(t,a))||r.enumerable});return e},zne=e=>Ene(z3({},"__esModule",{value:!0}),e),ak={};_ne(ak,{TrieRouter:()=>Ane.TrieRouter});var Ine=zne(ak),Ane=bne,I3=Object.defineProperty,Bne=Object.getOwnPropertyDescriptor,Lne=Object.getOwnPropertyNames,One=Object.prototype.hasOwnProperty,Pne=(e,t)=>{for(var n in t)I3(e,n,{get:t[n],enumerable:!0})},Mne=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Lne(t))!One.call(e,a)&&a!==n&&I3(e,a,{get:()=>t[a],enumerable:!(r=Bne(t,a))||r.enumerable});return e},Tne=e=>Mne(I3({},"__esModule",{value:!0}),e),ok={};Pne(ok,{Hono:()=>Fne});var Dne=Tne(ok),$ne=Iee,Nne=Nte,jne=ene,Rne=Ine;class Fne extends $ne.HonoBase{constructor(t={}){super(t),this.router=t.router??new jne.SmartRouter({routers:[new Nne.RegExpRouter,new Rne.TrieRouter]})}}var A3=Object.defineProperty,Vne=Object.getOwnPropertyDescriptor,Une=Object.getOwnPropertyNames,Zne=Object.prototype.hasOwnProperty,qne=(e,t)=>{for(var n in t)A3(e,n,{get:t[n],enumerable:!0})},Hne=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Une(t))!Zne.call(e,a)&&a!==n&&A3(e,a,{get:()=>t[a],enumerable:!(r=Vne(t,a))||r.enumerable});return e},Wne=e=>Hne(A3({},"__esModule",{value:!0}),e),ik={};qne(ik,{Context:()=>Yne.Context,Hono:()=>Xne.Hono});var Gne=Wne(ik),Xne=Dne,Yne=TS,sk={},Kg={},Hr={},nu={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.globalConfig=e.$ZodEncodeError=e.$ZodAsyncError=e.$brand=e.NEVER=void 0,e.$constructor=t,e.config=a,e.NEVER=Object.freeze({status:"aborted"});function t(i,s,d){function l(u,h){var g;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(g=u._zod).traits??(g.traits=new Set),u._zod.traits.add(i),s(u,h);for(const y in m.prototype)y in u||Object.defineProperty(u,y,{value:m.prototype[y].bind(u)});u._zod.constr=m,u._zod.def=h}const c=(d==null?void 0:d.Parent)??Object;class f extends c{}Object.defineProperty(f,"name",{value:i});function m(u){var h;const g=d!=null&&d.Parent?new f:this;l(g,u),(h=g._zod).deferred??(h.deferred=[]);for(const y of g._zod.deferred)y();return g}return Object.defineProperty(m,"init",{value:l}),Object.defineProperty(m,Symbol.hasInstance,{value:u=>{var h,g;return d!=null&&d.Parent&&u instanceof d.Parent?!0:(g=(h=u==null?void 0:u._zod)==null?void 0:h.traits)==null?void 0:g.has(i)}}),Object.defineProperty(m,"name",{value:i}),m}e.$brand=Symbol("zod_brand");class n extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}e.$ZodAsyncError=n;class r extends Error{constructor(s){super(`Encountered unidirectional transform during encode: ${s}`),this.name="ZodEncodeError"}}e.$ZodEncodeError=r,e.globalConfig={};function a(i){return i&&Object.assign(e.globalConfig,i),e.globalConfig}})(nu);var B3={},La={},Re={};Object.defineProperty(Re,"__esModule",{value:!0});Re.Class=Re.BIGINT_FORMAT_RANGES=Re.NUMBER_FORMAT_RANGES=Re.primitiveTypes=Re.propertyKeyTypes=Re.getParsedType=Re.allowsEval=Re.captureStackTrace=void 0;Re.assertEqual=Kne;Re.assertNotEqual=Jne;Re.assertIs=Qne;Re.assertNever=ere;Re.assert=tre;Re.getEnumValues=nre;Re.joinValues=rre;Re.jsonStringifyReplacer=are;Re.cached=lk;Re.nullish=ore;Re.cleanRegex=ire;Re.floatSafeRemainder=sre;Re.defineLazy=lre;Re.objectClone=cre;Re.assignProp=_s;Re.mergeDefs=Es;Re.cloneDef=ure;Re.getElementAtPath=dre;Re.promiseAllObject=fre;Re.randomString=pre;Re.esc=mre;Re.isObject=Jg;Re.isPlainObject=im;Re.shallowClone=hre;Re.numKeys=gre;Re.escapeRegex=bre;Re.clone=zs;Re.normalizeParams=yre;Re.createTransparentProxy=wre;Re.stringifyPrimitive=ck;Re.optionalKeys=xre;Re.pick=Cre;Re.omit=Sre;Re.extend=kre;Re.safeExtend=_re;Re.merge=Ere;Re.partial=zre;Re.required=Ire;Re.aborted=Are;Re.prefixIssues=Bre;Re.unwrapMessage=Fu;Re.finalizeIssue=Lre;Re.getSizableOrigin=Ore;Re.getLengthableOrigin=Pre;Re.issue=Mre;Re.cleanEnum=Tre;Re.base64ToUint8Array=uk;Re.uint8ArrayToBase64=dk;Re.base64urlToUint8Array=Dre;Re.uint8ArrayToBase64url=$re;Re.hexToUint8Array=Nre;Re.uint8ArrayToHex=jre;function Kne(e){return e}function Jne(e){return e}function Qne(e){}function ere(e){throw new Error}function tre(e){}function nre(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,a])=>t.indexOf(+r)===-1).map(([r,a])=>a)}function rre(e,t="|"){return e.map(n=>ck(n)).join(t)}function are(e,t){return typeof t=="bigint"?t.toString():t}function lk(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ore(e){return e==null}function ire(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function sre(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let a=(r.split(".")[1]||"").length;if(a===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(a=Number.parseInt(l[1]))}const i=n>a?n:a,s=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return s%d/10**i}const O8=Symbol("evaluating");function lre(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==O8)return r===void 0&&(r=O8,r=n()),r},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function cre(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function _s(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Es(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function ure(e){return Es(e._zod.def)}function dre(e,t){return t?t.reduce((n,r)=>n==null?void 0:n[r],e):e}function fre(e){const t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{const a={};for(let i=0;i<t.length;i++)a[t[i]]=r[i];return a})}function pre(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function mre(e){return JSON.stringify(e)}Re.captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Jg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Re.allowsEval=lk(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function im(e){if(Jg(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Jg(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function hre(e){return im(e)?{...e}:Array.isArray(e)?[...e]:e}function gre(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const vre=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}};Re.getParsedType=vre;Re.propertyKeyTypes=new Set(["string","number","symbol"]);Re.primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function bre(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zs(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function yre(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function wre(e){let t;return new Proxy({},{get(n,r,a){return t??(t=e()),Reflect.get(t,r,a)},set(n,r,a,i){return t??(t=e()),Reflect.set(t,r,a,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,a){return t??(t=e()),Reflect.defineProperty(t,r,a)}})}function ck(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function xre(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}Re.NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};Re.BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Cre(e,t){const n=e._zod.def,r=Es(e._zod.def,{get shape(){const a={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(a[i]=n.shape[i])}return _s(this,"shape",a),a},checks:[]});return zs(e,r)}function Sre(e,t){const n=e._zod.def,r=Es(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete a[i]}return _s(this,"shape",a),a},checks:[]});return zs(e,r)}function kre(e,t){if(!im(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const a=Es(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return _s(this,"shape",i),i},checks:[]});return zs(e,a)}function _re(e,t){if(!im(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return _s(this,"shape",r),r},checks:e._zod.def.checks};return zs(e,n)}function Ere(e,t){const n=Es(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return _s(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return zs(e,n)}function zre(e,t,n){const r=Es(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(n)for(const s in n){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=e?new e({type:"optional",innerType:a[s]}):a[s])}else for(const s in a)i[s]=e?new e({type:"optional",innerType:a[s]}):a[s];return _s(this,"shape",i),i},checks:[]});return zs(t,r)}function Ire(e,t,n){const r=Es(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:a[s]}))}else for(const s in a)i[s]=new e({type:"nonoptional",innerType:a[s]});return _s(this,"shape",i),i},checks:[]});return zs(t,r)}function Are(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Bre(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Fu(e){return typeof e=="string"?e:e==null?void 0:e.message}function Lre(e,t,n){var a,i,s,d,l,c;const r={...e,path:e.path??[]};if(!e.message){const f=Fu((s=(i=(a=e.inst)==null?void 0:a._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??Fu((d=t==null?void 0:t.error)==null?void 0:d.call(t,e))??Fu((l=n.customError)==null?void 0:l.call(n,e))??Fu((c=n.localeError)==null?void 0:c.call(n,e))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Ore(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Pre(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Mre(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function Tre(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function uk(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function dk(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Dre(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return uk(t+n)}function $re(e){return dk(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Nre(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function jre(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class Rre{constructor(...t){}}Re.Class=Rre;var Fre=X&&X.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Vre=X&&X.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ure=X&&X.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&Fre(t,e,n);return Vre(t,e),t};Object.defineProperty(La,"__esModule",{value:!0});La.$ZodRealError=La.$ZodError=void 0;La.flattenError=qre;La.formatError=Hre;La.treeifyError=Wre;La.toDotPath=mk;La.prettifyError=Gre;const fk=nu,Zre=Ure(Re),pk=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Zre.jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})};La.$ZodError=(0,fk.$constructor)("$ZodError",pk);La.$ZodRealError=(0,fk.$constructor)("$ZodError",pk,{Parent:Error});function qre(e,t=n=>n.message){const n={},r=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}function Hre(e,t=n=>n.message){const n={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>r({issues:s}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,d=0;for(;d<i.path.length;){const l=i.path[d];d===i.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(t(i))):s[l]=s[l]||{_errors:[]},s=s[l],d++}}};return r(e),n}function Wre(e,t=n=>n.message){const n={errors:[]},r=(a,i=[])=>{var s,d;for(const l of a.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(c=>r({issues:c},l.path));else if(l.code==="invalid_key")r({issues:l.issues},l.path);else if(l.code==="invalid_element")r({issues:l.issues},l.path);else{const c=[...i,...l.path];if(c.length===0){n.errors.push(t(l));continue}let f=n,m=0;for(;m<c.length;){const u=c[m],h=m===c.length-1;typeof u=="string"?(f.properties??(f.properties={}),(s=f.properties)[u]??(s[u]={errors:[]}),f=f.properties[u]):(f.items??(f.items=[]),(d=f.items)[u]??(d[u]={errors:[]}),f=f.items[u]),h&&f.errors.push(t(l)),m++}}};return r(e),n}function mk(e){const t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(const r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function Gre(e){var r;const t=[],n=[...e.issues].sort((a,i)=>(a.path??[]).length-(i.path??[]).length);for(const a of n)t.push(`✖ ${a.message}`),(r=a.path)!=null&&r.length&&t.push(` → at ${mk(a.path)}`);return t.join(`
|
|
148
|
+
`).length-(r.maxLines??1/0))),r.maxLength!==1/0&&r.maxLength!==null&&(f.value=String(ie).length-r.maxLength)}});const g=o.computed({get(){return K1(y.value)},set(ie){r.richtext?d.value=[{text:ie,format:{}}]:d.value=ie}}),y=o.computed({get(){return cC(s.value)},set(ie){r.richtext?d.value=ie:d.value=K1(ie)}}),w=o.ref(),x=fs("bx-input-count"),S=o.computed(()=>r.state==="error"||u.value),C=o.computed(()=>r.showWordCount?x:void 0),E=o.ref();let _;const I=o.ref(!1);o.watch(I,()=>{I.value?a("focus"):a("blur",_)});function B(ie){I.value=!0}function k(ie){_=ie,I.value=!1}o.watch(E,(ie,le)=>{ie&&(le&&(le.removeEventListener("focus",B),le.removeEventListener("blur",k)),ie.addEventListener("focus",B),ie.addEventListener("blur",k))});const P=o.computed(()=>String(Math.max(1,r.maxRows)));function z(){if(r.type!=="textarea")return;const ie=E.value;!ie||ie.tagName!=="TEXTAREA"||(ie.style.height="auto",ie.style.height=`${ie.scrollHeight}px`)}o.watch([E,g,()=>r.type,()=>r.minHeight,()=>r.maxHeight,P],async()=>{await o.nextTick(),z()},{immediate:!0,flush:"post"}),window.addEventListener("blur",k);const $=()=>{var ie;r.disabled||r.readonly||(ie=E.value)==null||ie.focus()},j=ie=>{ie.key==="Enter"&&a("enter",ie)},p=o.ref(""),H=o.computed(()=>{const ie=r.richtext?p.value:d.value;return[...new Intl.Segmenter().segment(ie)].length}),F=o.computed(()=>r.richtext?p.value.length>0:String(d.value).length>0);function Z(ie){return ie.en}const L=o.ref(),O=o.ref({start:0,length:0}),D=o.computed({get(){var Y,M;const ie=(Y=w.value)==null?void 0:Y.richTextInstance;if(!ie)return;const ue=ie.resolveFeatures(O.value.start,O.value.length).flat(),he=ee(ue);if(he!==void 0)return he===null?"multiple":(M=R.value.find(N=>vr(N.value,he)))==null?void 0:M.value},set(ie){var ue;const le=(ue=w.value)==null?void 0:ue.richTextInstance;le&&ie!=="multiple"&&(ie===void 0?le.applyFormat(O.value.start,O.value.length,{}):(le.resolveFeatures(O.value.start,O.value.length),le.applyFormat(O.value.start,O.value.length,ie)),W.value.closePopover())}});o.watch(L,()=>{L.value&&(O.value=L.value)});const R=o.computed(()=>r.richtext?[{label:Z(r.richtext.noStyleLabel),value:void 0},...r.richtext.options.map((ie,le)=>({label:ie.label,value:ie.style}))]:[]),W=o.ref();function ee(ie){let le=!1,ue;for(const he of ie)if(!ue)ue=he.format;else if(!vr(ue,he.format)){le=!0;break}return le?null:ue}function se(){r.richtext?y.value=[{text:"",format:{}}]:s.value=""}return o.onUnmounted(()=>{l.value=[],c.value=0,f.value=0}),t({inputEelRef:E,setFocus(ie){var le,ue;ie?(le=E.value)==null||le.focus():(ue=E.value)==null||ue.blur()}}),(ie,le)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-input",{readonly:e.readonly,bordered:e.bordered,"is-textarea":e.type==="textarea"}])},[e.richtext?(o.openBlock(),o.createBlock(gi,{key:0,ref_key:"bxSelectRef",ref:W,class:"select-richtext",modelValue:D.value,"onUpdate:modelValue":le[0]||(le[0]=ue=>D.value=ue),options:R.value,disabled:!O.value||O.value.length===0},{label:o.withCtx(({label:ue})=>[o.createTextVNode(o.toDisplayString(ue??"Multiple"),1)]),_:1},8,["modelValue","options","disabled"])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["bx-input-wrapper",{focus:I.value&&!e.readonly,round:e.round,ring:e.ring,bordered:e.bordered,["size-"+e.size]:e.size,disabled:e.disabled,readonly:e.readonly,"rich-text":e.richtext,error:u.value,"state-active":e.state==="active","state-success":e.state==="success","state-error":e.state==="error","state-warning":e.state==="warning",ghost:e.ghost}]),style:o.normalizeStyle({"--max-height":e.richtext?"auto":e.maxHeight,"--min-height":e.minHeight,"--textarea-max-lines":P.value}),onClick:$},[i.prefix?(o.openBlock(),o.createElementBlock("div",OG,[o.renderSlot(ie.$slots,"prefix",{},void 0,!0)])):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["bx-input__input",{"swiper-no-swiping":I.value,"has-prefix":!!i.prefix}])},[e.richtext?(o.openBlock(),o.createBlock(vC,{key:0,ref_key:"bxRichTextInstance",ref:w,modelValue:y.value,"onUpdate:modelValue":le[1]||(le[1]=ue=>y.value=ue),selection:L.value,"onUpdate:selection":le[2]||(le[2]=ue=>L.value=ue),"raw-text":p.value,"onUpdate:rawText":le[3]||(le[3]=ue=>p.value=ue),focus:I.value,"onUpdate:focus":le[4]||(le[4]=ue=>I.value=ue),"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby},null,8,["modelValue","selection","raw-text","focus","aria-label","aria-labelledby"])):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[e.type==="textarea"?o.withDirectives((o.openBlock(),o.createElementBlock("textarea",{key:0,ref_key:"inputEelRef",ref:E,rows:"1",class:o.normalizeClass({resizeable:e.resizeable}),"onUpdate:modelValue":le[5]||(le[5]=ue=>g.value=ue),placeholder:e.placeholder,onKeydown:j,readonly:e.readonly,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":S.value?"true":void 0,"aria-describedby":C.value},null,42,PG)),[[o.vModelText,g.value]]):o.withDirectives((o.openBlock(),o.createElementBlock("input",{key:1,ref_key:"inputEelRef",ref:E,"onUpdate:modelValue":le[6]||(le[6]=ue=>s.value=ue),readonly:e.readonly,placeholder:e.placeholder,type:e.type,onKeydown:j,title:e.readonly?e.readonlyMessage:void 0,"aria-label":e.ariaLabelledby?void 0:e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-invalid":S.value?"true":void 0,"aria-describedby":C.value},null,40,MG)),[[o.vModelDynamic,s.value]])],64))],2),i.suffix||e.clearable||e.showWordCount||i.loading||e.loading||u.value?(o.openBlock(),o.createElementBlock("div",{key:1,"data-suffix":!!i.suffix,class:"bx-input__suffix"},[i.loading||e.loading?(o.openBlock(),o.createElementBlock("div",DG,[i.loading?o.renderSlot(ie.$slots,"loading",{},void 0,!0,0):(o.openBlock(),o.createBlock(bs,{key:1,size:"small"}))])):o.createCommentVNode("",!0),o.renderSlot(ie.$slots,"suffix",{},void 0,!0),e.showWordCount?(o.openBlock(),o.createElementBlock("div",{key:1,id:o.unref(x),class:"bx-input__word-count"},[e.maxLength&&e.maxLength!==1/0?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createTextVNode(o.toDisplayString(H.value)+" / "+o.toDisplayString(e.maxLength),1)],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(H.value),1)],64))],8,$G)):o.createCommentVNode("",!0),u.value?(o.openBlock(),o.createBlock(f0,{key:2,trigger:"hover","custom-popover-classes":["text-overflow-tooltip"],"allowed-placements":["bottom","top","right"]},{trigger:o.withCtx(()=>[o.createVNode(yt,{circle:"",size:"tiny",secondary:"",state:"error",class:"errors-button","aria-label":"Show input warnings"},{icon:o.withCtx(()=>[o.createVNode(nt,null,{default:o.withCtx(()=>[o.createVNode(o.unref(Vx))]),_:1})]),_:1})]),content:o.withCtx(()=>{var ue,he,Y;return[o.createElementVNode("div",NG,[(ue=m.value)!=null&&ue.overflowingCharacters?(o.openBlock(),o.createElementBlock("div",jG,[o.createElementVNode("span",RG,o.toDisplayString(e.maxLength+f.value)+" / "+o.toDisplayString(e.maxLength),1),le[7]||(le[7]=o.createTextVNode(" characters ",-1))])):o.createCommentVNode("",!0),(he=m.value)!=null&&he.overlowingLines?(o.openBlock(),o.createElementBlock("div",FG,[o.createElementVNode("span",VG,o.toDisplayString(e.maxLines+c.value)+" / "+o.toDisplayString(e.maxLines),1),le[8]||(le[8]=o.createTextVNode(" lines ",-1))])):o.createCommentVNode("",!0),(Y=m.value)!=null&&Y.lineOverflows?(o.openBlock(),o.createElementBlock("div",UG,[le[9]||(le[9]=o.createTextVNode(" Lines are too long: ",-1)),o.createElementVNode("ul",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(m.value.lineOverflows,({index:M,length:N})=>(o.openBlock(),o.createElementBlock("li",null,[o.createElementVNode("span",ZG,"("+o.toDisplayString(M+1)+")",1),o.createElementVNode("span",qG,o.toDisplayString(N)+" / "+o.toDisplayString(e.maxLineLength),1)]))),256))])])):o.createCommentVNode("",!0)])]}),_:1})):o.createCommentVNode("",!0),e.clearable&&F.value?(o.openBlock(),o.createElementBlock("button",{key:3,type:"button",class:"bx-input__clear-btn",onClick:o.withModifiers(se,["stop"]),title:"Clear","aria-label":"Clear"},[o.createVNode(nt,{size:12},{default:o.withCtx(()=>[o.createVNode(o.unref(Po))]),_:1})])):o.createCommentVNode("",!0)],8,TG)):o.createCommentVNode("",!0)],6)],2))}}),Il=Je(HG,[["__scopeId","data-v-19f6427a"]]);function Ug(e){return new URLSearchParams(Object.fromEntries(Object.entries(e).map(([t,n])=>[t,String(n)]))).toString()}function WG(e){const t=o.ref([]),n=o.ref(0);let r=25;async function a(i,s){s=s??t.value.length??0;const l=await(await fetch(`https://api.pexels.com/v1/search?${Ug({page:Math.ceil(s/r),query:i,per_page:r})}`,{headers:{Authorization:e}})).json();if("error"in l)throw new Error(l.error);n.value=l.total_results,t.value=[...t.value.slice(0,s),...l.photos]}return{photos:t,total:n,searchPhotos:a}}const GG=o.defineComponent({__name:"LazyLoadingItemWrapper",emits:["update:visible"],setup(e,{emit:t}){o.ref();const n=t,r=o.ref(),a=YM(r);return n("update:visible",a.value),o.watch(a,(i,s)=>{!s&&i&&n("update:visible",a.value)}),(i,s)=>(o.openBlock(),o.createElementBlock("div",{class:"item-wrapper",ref_key:"itemWrapperRef",ref:r},[o.renderSlot(i.$slots,"default")],512))}}),XG=o.defineComponent({__name:"LazyLoading",props:{items:{},total:{},fetch:{type:Function},visibleTriggerOffset:{}},setup(e){o.ref();const t=e;t.fetch(0);const n=(r,a)=>{a&&r>=t.items.length-t.visibleTriggerOffset-1&&t.total>t.items.length&&t.fetch()};return(r,a)=>(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.items,(i,s)=>(o.openBlock(),o.createBlock(GG,{key:s,class:"item-wrapper",item:i,index:s,"onUpdate:visible":d=>n(s,d)},{default:o.withCtx(()=>[o.renderSlot(r.$slots,"item",{item:i,index:s})]),_:2},1032,["item","index","onUpdate:visible"]))),128))}}),YG={class:"bx-empty-icon"},KG={key:1,viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},JG={key:0,class:"bx-empty-description"},QG={key:1,class:"bx-empty-extra"},eX=o.defineComponent({__name:"BxEmpty",props:{description:{default:"No Data"},size:{default:"medium"}},setup(e){const t=o.useSlots();return(n,r)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-empty",{[`size-${e.size}`]:!0}])},[o.createElementVNode("div",YG,[t.icon?o.renderSlot(n.$slots,"icon",{},void 0,!0,0):(o.openBlock(),o.createElementBlock("svg",KG,[...r[0]||(r[0]=[o.createElementVNode("path",{d:"M26 7.5C26 11.0899 23.0899 14 19.5 14C15.9101 14 13 11.0899 13 7.5C13 3.91015 15.9101 1 19.5 1C23.0899 1 26 3.91015 26 7.5ZM14 7.5C14 3.91015 11.0899 1 7.5 1C3.91015 1 1 3.91015 1 7.5C1 11.0899 3.91015 14 7.5 14C11.0899 14 14 11.0899 14 7.5ZM14 19.5C14 15.9101 11.0899 13 7.5 13C3.91015 13 1 15.9101 1 19.5C1 23.0899 3.91015 26 7.5 26C11.0899 26 14 23.0899 14 19.5Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round",opacity:"0.4"},null,-1),o.createElementVNode("circle",{cx:"19.5",cy:"19.5",r:"6.5",stroke:"currentColor","stroke-width":"1.5","stroke-dasharray":"3 3",opacity:"0.25"},null,-1)])]))]),e.description||t.description?(o.openBlock(),o.createElementBlock("div",JG,[t.description?o.renderSlot(n.$slots,"description",{},void 0,!0,0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(e.description),1)],64))])):o.createCommentVNode("",!0),t.default?(o.openBlock(),o.createElementBlock("div",QG,[o.renderSlot(n.$slots,"default",{},void 0,!0)])):o.createCommentVNode("",!0)],2))}}),Wb=Je(eX,[["__scopeId","data-v-d66bc5e4"]]),tX={class:"image-library-pexels"},nX={class:"search-bar-wrapper"},rX={key:0,class:"photos"},aX=["onClick"],oX=["src"],iX={key:0,class:"loading-wrapper"},sX={key:1,class:"loading-wrapper"},lX=o.defineComponent({__name:"Pexels",props:{apiKey:{},width:{},height:{},uploadContext:{},uploadImageAsset:{type:Function}},emits:["select"],setup(e,{emit:t}){const n=Cs(),r=e,a=t,i=o.ref("city"),{searchPhotos:s,photos:d,total:l}=WG(r.apiKey),c=o.ref(),f=o.ref(!1);async function m(){i.value.length>0&&(f.value=!0,l.value=25,d.value=[],await s(i.value),c.value=i.value,f.value=!1)}async function u(y,w){await s(i.value,y)}const h=o.ref();async function g(y){h.value=y.id;const w=await r.uploadImageAsset({blob:await fetch(n(y.src.original)).then(x=>x.blob()),context:r.uploadContext,width:r.width,height:r.height,key:`pexels-${y.id}`,name:y.id.toString(),onProgress(x){console.log("upload progress",x)}});h.value=void 0,a("select",w.src)}return(y,w)=>(o.openBlock(),o.createElementBlock("div",tX,[o.createElementVNode("header",null,[o.createElementVNode("div",nX,[o.createVNode(Il,{modelValue:i.value,"onUpdate:modelValue":w[0]||(w[0]=x=>i.value=x),round:"",placeholder:"Search...",size:"medium",onEnter:m},null,8,["modelValue"]),o.createVNode(yt,{active:"",onClick:m},{default:o.withCtx(()=>[...w[1]||(w[1]=[o.createTextVNode("Search",-1)])]),_:1})])]),o.createElementVNode("main",null,[c.value?(o.openBlock(),o.createElementBlock("div",rX,[o.createVNode(XG,{items:o.unref(d),total:o.unref(l),fetch:u,"visible-trigger-offset":0},{item:o.withCtx(({item:x})=>[(o.openBlock(),o.createElementBlock("div",{key:x.id,class:"photo-wrapper",onClick:S=>g(x)},[o.createElementVNode("div",{class:o.normalizeClass(["preview",{loading:h.value===x.id}])},[o.createElementVNode("img",{src:o.unref(n)(x.src.tiny)},null,8,oX),h.value===x.id?(o.openBlock(),o.createElementBlock("div",iX,[o.createVNode(bs)])):o.createCommentVNode("",!0)],2)],8,aX))]),_:1},8,["items","total"])])):f.value?(o.openBlock(),o.createElementBlock("div",sX,[o.createVNode(bs)])):(o.openBlock(),o.createBlock(Wb,{key:2,description:"Search for images on Pexels"},{icon:o.withCtx(()=>[o.createVNode(o.unref(Zq))]),_:1}))])]))}});function cX(e,t,n){return e.map(r=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(r["@microsoft.graph.downloadUrl"])}&w=${t}&h=${n}&fit=cover&quality=80&format=png`,key:r.id,width:r.image.width,height:r.image.height,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(r["@microsoft.graph.downloadUrl"])}&h=200&fit=cover&quality=80&format=png`,width:r.image.width,height:r.image.height},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(r["@microsoft.graph.downloadUrl"])}&h=400&fit=cover&quality=80&format=png`,width:r.image.width,height:r.image.height}}}))}function uX(e,t,n){return e.map(({thumbnailLink:r,webContentLink:a,sha256Checksum:i,imageMediaMetadata:s})=>({src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(a)}&w=${t}&h=${n}&fit=cover&quality=80&format=png`,key:i,width:(s==null?void 0:s.width)??0,height:(s==null?void 0:s.height)??0,previews:{small:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(r)}&h=200&fit=cover&quality=80&format=png`,width:(s==null?void 0:s.width)??0,height:(s==null?void 0:s.height)??0},medium:{src:`https://shared-drive.bluepic.io/image?url=${encodeURIComponent(r)}&h=400&fit=cover&quality=80&format=png`,width:(s==null?void 0:s.width)??0,height:(s==null?void 0:s.height)??0}}}))}function dX(e,t,n,r){const a=o.ref();return{sharedItems:a,fetchSharedDrive:async()=>{if(e==="onedrive"){const s=`https://shared-drive.bluepic.io/onedrive?${Ug({sharing:t})}`,l=await(await fetch(s)).json();a.value=cX(l.children,n,r)}else if(e==="googledrive"){const s=`https://shared-drive.bluepic.io/googledrive?${Ug({sharing:t})}`,l=await(await fetch(s)).json();a.value=uX(l.files,n,r)}}}}const fX={class:"image-library-shared-drive"},pX={key:0,class:"photos"},mX=["onClick"],hX={class:"preview"},gX=["src"],vX={key:1,class:"loading-wrapper"},bX=o.defineComponent({__name:"SharedDrive",props:{service:{},sharedUrl:{},width:{},height:{}},emits:["select"],setup(e,{emit:t}){const n=Cs(),r=e,a=t,{fetchSharedDrive:i,sharedItems:s}=dX(r.service,r.sharedUrl,r.width,r.height);i();function d(l){a("select",l.src)}return(l,c)=>(o.openBlock(),o.createElementBlock("div",fX,[o.unref(s)?(o.openBlock(),o.createElementBlock("div",pX,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(s),f=>(o.openBlock(),o.createElementBlock("div",{class:"photo-wrapper",onClick:m=>d(f)},[o.createElementVNode("div",hX,[o.createElementVNode("img",{src:o.unref(n)(f.previews.small.src)},null,8,gX)])],8,mX))),256))])):(o.openBlock(),o.createElementBlock("div",vX,[o.createVNode(bs)]))]))}}),yX=Je(bX,[["__scopeId","data-v-6b7dadc2"]]),wX={class:"image-library-custom"},xX=o.defineComponent({__name:"Custom",props:{controller:{},label:{},name:{},props:{}},setup(e){const t=e,n=import(t.controller),r=o.ref();return n.then(a=>{r.value=new a.default(t.props)}),(a,i)=>(o.openBlock(),o.createElementBlock("div",wX,"JAJAJA"))}}),CX={class:"image-library-wrapper"},SX={key:0,class:"nav-view-wrapper"},kX={class:"icon-wrapper"},_X={class:"label"},EX={key:1,class:"library-view-wrapper"},zX=o.defineComponent({__name:"ImageLibraryWrapper",props:{options:{},activeKey:{},imageLibraries:{},convertTo:{},quality:{},width:{},height:{},bridge:{},field:{}},emits:["select","update:active-key"],setup(e,{emit:t}){const n=e,r=t,a=o.ref(n.activeKey);o.watch(a,()=>{n.activeKey!==a.value&&r("update:active-key",a.value)}),o.watch(()=>n.activeKey,()=>{n.activeKey!==a.value&&(a.value=n.activeKey)});function i(g){a.value=g}const s=o.computed(()=>{var g;return(g=n.imageLibraries.find(y=>y.type==="pexels"))==null?void 0:g.apiKey}),d=o.computed(()=>n.imageLibraries.find(g=>g.type==="sharedDrive"&&g.service===a.value).sharedUrl),l=o.computed(()=>{var g;return(g=n.imageLibraries.find(y=>y.type===a.value))==null?void 0:g.label}),c=o.computed(()=>{var g;return(g=n.imageLibraries.find(y=>y.type===a.value))==null?void 0:g.name}),f=o.computed(()=>{var g;return(g=n.imageLibraries.find(y=>y.type===a.value))==null?void 0:g.controller}),m=o.computed(()=>{var g;return(g=n.imageLibraries.find(y=>y.type===a.value))==null?void 0:g.props});function u(g){const y=g[0];y&&h(y.src)}function h(g){r("select",g)}return(g,y)=>(o.openBlock(),o.createElementBlock("div",CX,[o.createVNode(o.Transition,{name:"slide-library"},{default:o.withCtx(()=>[a.value===void 0?(o.openBlock(),o.createElementBlock("div",SX,[o.createElementVNode("div",{class:"image-library-source-navigation",style:o.normalizeStyle({"--options-length":e.options.length})},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(n.options,w=>(o.openBlock(),o.createBlock(d0,{key:w.key,bordered:!0,onClick:x=>i(w.key)},{default:o.withCtx(()=>[o.createElementVNode("div",kX,[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(w.icon)))]),o.createElementVNode("div",_X,o.toDisplayString(w.label),1)]),_:2},1032,["onClick"]))),128))],4)])):(o.openBlock(),o.createElementBlock("div",EX,[a.value==="upload"?(o.openBlock(),o.createBlock(NW,{key:0,width:e.width,height:e.height,"convert-to":e.convertTo,quality:e.quality,field:e.field,"handle-upload":e.bridge.handleUpload,onUpload:u},null,8,["width","height","convert-to","quality","field","handle-upload"])):a.value==="pexels"?(o.openBlock(),o.createBlock(lX,{key:1,"api-key":s.value,width:e.width,height:e.height,"upload-image-asset":e.bridge.handleUpload,"upload-context":{field:e.field},onSelect:h},null,8,["api-key","width","height","upload-image-asset","upload-context"])):a.value==="googledrive"||a.value==="onedrive"||a.value==="icloud"||a.value==="dropbox"?(o.openBlock(),o.createBlock(yX,{key:2,service:a.value,"shared-url":d.value,width:e.width,height:e.height,onSelect:h},null,8,["service","shared-url","width","height"])):a.value==="custom"?(o.openBlock(),o.createBlock(xX,{key:3,label:l.value??"Custom Library",name:c.value,controller:f.value,props:m.value},null,8,["label","name","controller","props"])):o.createCommentVNode("",!0)]))]),_:1})]))}}),yC=Je(zX,[["__scopeId","data-v-61c69114"]]),IX=o.defineComponent({__name:"BxList",props:{divider:{type:Boolean,default:!0},bordered:{type:Boolean,default:!1},variant:{default:"plain"}},setup(e){return o.useSlots(),(t,n)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-list",{"has-divider":e.divider&&e.variant==="plain",bordered:e.bordered,[`variant-${e.variant}`]:!0}])},[o.renderSlot(t.$slots,"default",{},void 0,!0)],2))}}),wC=Je(IX,[["__scopeId","data-v-53785398"]]),AX={class:"bx-list-item__inner"},BX={key:0,class:"bx-list-item__prefix"},LX={class:"bx-list-item__content"},OX={key:1,class:"bx-list-item__suffix"},PX=o.defineComponent({__name:"BxListItem",props:{interactive:{type:Boolean,default:!0}},setup(e){const t=o.useSlots(),n=o.computed(()=>!!t.prefix),r=o.computed(()=>!!t.suffix);return(a,i)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bx-list-item",{"has-prefix":n.value,"has-suffix":r.value,interactive:e.interactive}])},[o.createElementVNode("div",AX,[t.prefix?(o.openBlock(),o.createElementBlock("div",BX,[o.renderSlot(a.$slots,"prefix",{},void 0,!0)])):o.createCommentVNode("",!0),o.createElementVNode("div",LX,[o.renderSlot(a.$slots,"default",{},void 0,!0)]),t.suffix?(o.openBlock(),o.createElementBlock("div",OX,[o.renderSlot(a.$slots,"suffix",{},void 0,!0)])):o.createCommentVNode("",!0)])],2))}}),xC=Je(PX,[["__scopeId","data-v-1048af22"]]),MX=["aria-label"],TX=["onClick"],DX={class:"icon"},$X={class:"label"},NX={class:"pullup-menu"},jX={class:"icon"},RX=o.defineComponent({__name:"BxDropdown",props:o.mergeModels({options:{},allowedPlacements:{},mobileLayout:{type:Boolean,default:!1},ariaLabel:{default:"Menu"}},{show:{type:Boolean,required:!1,default:!1},showModifiers:{}}),emits:o.mergeModels(["select"],["update:show"]),setup(e,{emit:t}){const n=e,r=t,a=o.useModel(e,"show");function i(S){a.value=!1,r("select",S.value)}const s=o.useSlots(),d=fs("bx-dropdown-menu"),{setSlotRef:l,vNodes:c,slotElements:f}=Jp(s.trigger);function m(S){(S.key==="ArrowDown"||S.key==="ArrowUp")&&(S.preventDefault(),a.value||(a.value=!0),w(0))}let u;o.watch(f,(S,C)=>{for(const _ of C??[])_ instanceof HTMLElement&&_.removeEventListener("keydown",m);u=void 0;const E=S[0];E instanceof HTMLElement&&(E.setAttribute("aria-haspopup","menu"),E.setAttribute("aria-controls",d),E.setAttribute("aria-expanded",String(a.value)),E.addEventListener("keydown",m),u=E)},{immediate:!0});const h=o.ref(0),g=[];function y(S,C){if(!S){g[C]=void 0;return}const E=S instanceof HTMLElement?S:S.$el;g[C]=E instanceof HTMLElement?E:void 0}function w(S){if(n.options.length===0)return;const C=(S+n.options.length)%n.options.length;h.value=C,o.nextTick(()=>{var E;return(E=g[C])==null?void 0:E.focus()})}function x(S){const C=n.options.length;if(C!==0)switch(S.key){case"ArrowDown":S.preventDefault(),w(h.value+1);break;case"ArrowUp":S.preventDefault(),w(h.value-1);break;case"Home":S.preventDefault(),w(0);break;case"End":S.preventDefault(),w(C-1);break;case"Enter":case" ":S.preventDefault(),i(n.options[h.value]),u==null||u.focus();break;case"Escape":S.preventDefault(),S.stopPropagation(),a.value=!1,u==null||u.focus();break;case"Tab":a.value=!1;break}}return o.watch(a,S=>{u==null||u.setAttribute("aria-expanded",String(S)),S&&(h.value=0,o.nextTick(()=>{var C;return(C=g[0])==null?void 0:C.focus()}))}),o.onUnmounted(()=>{u&&u.removeEventListener("keydown",m)}),(S,C)=>e.mobileLayout?(o.openBlock(),o.createBlock(zl,{key:0,show:a.value,"onUpdate:show":C[1]||(C[1]=E=>a.value=E),"disable-background-effect":"","custom-classes":["bx-dropdown-mobile-layout-popup"],closeable:!1},{trigger:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(c),(E,_)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(E),{key:_,ref_for:!0,ref:o.unref(l)(_)},null,512))),128))]),content:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(["pullup-menu-wrapper",{}])},[o.createElementVNode("div",{class:"pullup-menu",role:"menu","aria-label":e.ariaLabel},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.options,E=>(o.openBlock(),o.createElementBlock("button",{type:"button",role:"menuitem",class:"select-button",onClick:_=>i(E)},[o.createElementVNode("div",DX,[o.createVNode(nt,null,{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(E.icon)))]),_:2},1024)]),o.createElementVNode("div",$X,[s.optionLabel?o.renderSlot(S.$slots,"optionLabel",{option:E},void 0,!0,0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(E.label),1)],64))])],8,TX))),256))],8,MX),o.createElementVNode("div",NX,[o.createElementVNode("button",{type:"button",class:"select-button","aria-label":"Close menu",onClick:C[0]||(C[0]=E=>a.value=!1)},[o.createElementVNode("div",jX,[o.createVNode(nt,null,{default:o.withCtx(()=>[o.createVNode(o.unref(Po))]),_:1})]),C[3]||(C[3]=o.createElementVNode("div",{class:"label"},"Close",-1))])])])]),_:3},8,["show"])):(o.openBlock(),o.createBlock(eu,{key:1,show:a.value,"onUpdate:show":C[2]||(C[2]=E=>a.value=E),trigger:"click","allowed-placements":e.allowedPlacements??["bottom","top"],arrow:!0,"custom-styles":{},"custom-classes":["dropdown-popover"],"disable-background-effect":""},{trigger:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(c),(E,_)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(E),{key:_,ref_for:!0,ref:o.unref(l)(_)},null,512))),128))]),content:o.withCtx(()=>[o.createVNode(wC,{id:o.unref(d),role:"menu","aria-label":e.ariaLabel,onKeydown:x},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.options,(E,_)=>(o.openBlock(),o.createBlock(xC,{key:E.value,ref_for:!0,ref:I=>y(I,_),role:"menuitem",tabindex:_===h.value?0:-1,onClick:I=>i(E)},o.createSlots({default:o.withCtx(()=>[s.optionLabel?o.renderSlot(S.$slots,"optionLabel",{option:E},void 0,!0,0):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(E.label),1)],64))]),_:2},[E.icon?{name:"prefix",fn:o.withCtx(()=>[o.createVNode(nt,null,{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(E.icon)))]),_:2},1024)]),key:"0"}:void 0]),1032,["tabindex","onClick"]))),128))]),_:3},8,["id","aria-label"])]),_:3},8,["show","allowed-placements"]))}}),Qp=Je(RX,[["__scopeId","data-v-f3fd4a7e"]]);function kc(e){return new Promise(function(t,n){if(typeof e!="string"&&!(e instanceof Blob)){n({err:"no image source"});return}const r=new Image;r.addEventListener("load",a=>{t({width:r.width,height:r.height,ratio:r.height/r.width})}),r.addEventListener("error",()=>n({err:"image corrupted"})),r.src=typeof e=="string"?e:URL.createObjectURL(e)})}function CC({height:e,left:t,top:n,width:r},a,i){const s=1/Math.max((r??0)/a,(e??0)/i),d=[Math.min(1,Ya(Math.max(1e-6,t??0)/(a-(r??0)),6)),Math.min(1,Ya(Math.max(1e-6,n??0)/(i-(e??0)),6))],l=[Math.max(-1,Math.min(1,(d[0]-.5)*2)),Math.max(-1,Math.min(1,(d[1]-.5)*2))];return{scale:s,innerPos:l}}function J1(e,t,n,r){const a=e.innerPos[0]/2+.5,i=e.innerPos[1]/2+.5,s=t/n>r?n*r:t,d=t/n>r?n:t/r,l=s/e.scale,c=d/e.scale,f=t-l,m=n-c,u=f*a,h=m*i;return{left:u,top:h,width:l,height:c}}var FX=Object.defineProperty,VX=(e,t,n)=>t in e?FX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dr=(e,t,n)=>VX(e,typeof t!="symbol"?t+"":t,n);function UX(e){return e*Math.PI/180}function c8(e,t,n){return Math.min(Math.max(e,t),n)}function Mf(e,t,n){const[r,a]=e,[i,s]=t,d=Math.cos(n)*(r-i)-Math.sin(n)*(a-s)+i,l=Math.sin(n)*(r-i)+Math.cos(n)*(a-s)+s;return[d,l]}function ZX(e){return e.deltaMode===0}let qX=class extends EventTarget{constructor(t,n,r,a,i,s,d=.1,l=10,c=!1,f=!0){super(),dr(this,"wrapperBounds",{x:0,y:0,width:100,height:100}),dr(this,"canvasBounds",{x:0,y:0,width:100,height:100}),dr(this,"translateSpeed",1),dr(this,"zoomSpeed",1),dr(this,"translateSpeedAppleTrackpad",1),dr(this,"zoomSpeedAppleTrackpad",1),dr(this,"isGestureActive",!1),dr(this,"roElement",null),dr(this,"roCanvas",null),dr(this,"ancestorMotionCleanup",null),dr(this,"gestureStartRotate",0),dr(this,"dragStart",null),dr(this,"dragStartFrozenX",null),dr(this,"dragStartFrozenY",null),dr(this,"touchStarts",null),dr(this,"touchStartTranslateX",0),dr(this,"touchStartTranslateY",0),this.element=t,this.offset=n,this.translateX=r,this.translateY=a,this.scale=i,this.rotate=s,this.minScale=d,this.maxScale=l,this.clampBounds=c,this.rotation=f,this.roElement=new ResizeObserver(()=>{const{x:m,y:u,width:h,height:g}=this.element.getBoundingClientRect();this.wrapperBounds={x:m,y:u,width:h,height:g},this.update()}),this.roCanvas=new ResizeObserver(m=>{const{width:u,height:h}=m[0].contentRect;(u!==this.canvasBounds.width||h!==this.canvasBounds.height)&&(this.canvasBounds={...this.canvasBounds,width:u,height:h},this.isGestureActive||this.update())}),requestAnimationFrame(()=>{this.wrapperBounds=this.element.getBoundingClientRect(),this.canvasBounds=this.canvasElement.getBoundingClientRect(),this.update(),this.dispatchEvent(new Event("init"))}),this.roCanvas.observe(this.canvasElement),this.roElement.observe(this.element),this.installAncestorMotionListeners()}installAncestorMotionListeners(){const t=()=>{const{x:i,y:s,width:d,height:l}=this.element.getBoundingClientRect();i===this.wrapperBounds.x&&s===this.wrapperBounds.y&&d===this.wrapperBounds.width&&l===this.wrapperBounds.height||(this.wrapperBounds={x:i,y:s,width:d,height:l},this.update())},n=i=>!(i instanceof Node)||i===this.element?!1:i.contains(this.element),r=i=>{n(i.target)&&t()},a=["transitionrun","transitionend","transitioncancel","animationend","animationcancel"];for(const i of a)document.addEventListener(i,r,!0);this.ancestorMotionCleanup=()=>{for(const i of a)document.removeEventListener(i,r,!0)}}get canvasElement(){return this.element.querySelector(".canvas")}get wrapperInnerX(){return this.wrapperBounds.x+this.offset.left}get wrapperInnerY(){return this.wrapperBounds.y+this.offset.top}get wrapperInnerWidth(){return this.wrapperBounds.width-this.offset.left-this.offset.right}get wrapperInnerHeight(){return this.wrapperBounds.height-this.offset.top-this.offset.bottom}get wrapperInnerRatio(){return this.wrapperInnerWidth/this.wrapperInnerHeight}get canvasNaturalRatio(){return this.canvasBounds.width/this.canvasBounds.height}get naturalScale(){return this.canvasNaturalRatio>=this.wrapperInnerRatio?this.wrapperInnerWidth/this.canvasBounds.width:this.wrapperInnerHeight/this.canvasBounds.height}setTranslateFromUserGesture(t,n){if(this.clampBounds){const r=this.clampTranslate({translateX:t,translateY:n,scale:this.scale,rotate:this.rotate});this.translateX=r.translateX,this.translateY=r.translateY,this.rotate=0}else this.translateX=t,this.translateY=n}handleGesturestart(t){this.gestureStartRotate=this.rotate}handleGesturechange(t){const{clientX:n,clientY:r}=t,a=t.rotation;if(a===0||!this.rotation)return;const i=this.normalizeClientCoords(n,r);this.rotateCanvas(i[0],i[1],this.gestureStartRotate+UX(a))}handleGestureend(t){}handleMousedown(t){t.preventDefault(),this.dragStart=[t.clientX,t.clientY],this.dragStartFrozenX=this.translateX,this.dragStartFrozenY=this.translateY}handleMouseup(t){t.preventDefault(),this.dragStart=null,this.dragStartFrozenX=null,this.dragStartFrozenY=null}handleMousemove(t){if(t.preventDefault(),this.dragStart&&this.dragStartFrozenX!==null&&this.dragStartFrozenY!==null){const n=t.clientX-this.dragStart[0],r=t.clientY-this.dragStart[1],a=this.dragStartFrozenX- -n,i=this.dragStartFrozenY- -r;this.setTranslateFromUserGesture(a,i),this.update()}}handleWheel(t){let{deltaX:n,deltaY:r,ctrlKey:a}=t;const i=ZX(t);i||(Math.abs(r)>=100&&(r=Math.sign(r)*(Math.abs(r)/120)),Math.abs(n)>=100&&(n=Math.sign(n)*(Math.abs(n)/120)));const s=this.scale;if(a){const d=i?.01*this.zoomSpeedAppleTrackpad:.1*this.zoomSpeed,l=1+-r*d;let c=s*l;if(c=c8(c,this.minScale,this.maxScale),(c===this.minScale||c===this.maxScale)&&(c===this.minScale&&l<1||c===this.maxScale&&l>1)){t.preventDefault();return}const f=this.relativeWrapperCoordinatesFromClientCoords(t.clientX,t.clientY),[m,u]=this.calcProjectionTranslate(c,f,this.normalizeMatrixCoordinates(t.clientX,t.clientY));this.setTranslateFromUserGesture(m,u),this.scale=c}else{const d=i?1*this.translateSpeedAppleTrackpad:25*this.translateSpeed;this.setTranslateFromUserGesture(this.translateX-n*d,this.translateY-r*d)}this.update(),t.preventDefault()}freezeTouches(t){return Array.from(t).map(n=>{const r=this.clientCoordsToWrapperCoords(n.clientX,n.clientY);return{client:[n.clientX,n.clientY],canvasRel:this.getCanvasCoordsRel(r[0],r[1])}})}handleTouchstart(t){this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY,this.isGestureActive=!0,t.preventDefault()}handleTouchmove(t){t.preventDefault();const n=Array.from(t.touches).map(r=>this.clientCoordsToWrapperCoords(r.clientX,r.clientY));if(this.touchStarts){if(n.length>=2&&this.touchStarts.length>=2){const r=[this.touchStarts[0].canvasRel[0]*this.canvasBounds.width,this.touchStarts[0].canvasRel[1]*this.canvasBounds.height],a=[this.touchStarts[1].canvasRel[0]*this.canvasBounds.width,this.touchStarts[1].canvasRel[1]*this.canvasBounds.height],i=Math.sqrt(Math.pow(r[0]-a[0],2)+Math.pow(r[1]-a[1],2)),s=Math.sqrt(Math.pow(n[0][0]-n[1][0],2)+Math.pow(n[0][1]-n[1][1],2))/this.naturalScale,d=c8(s/i,this.minScale,this.maxScale),l=[n[0][0]/this.wrapperInnerWidth,n[0][1]/this.wrapperInnerHeight],c=this.touchStarts[0].canvasRel,[f,m]=this.calcProjectionTranslate(d,l,c,0);if(this.rotation){let u=0,h=0,g=0;const y=Math.atan2(a[1]-r[1],a[0]-r[0]);g=Math.atan2(n[1][1]-n[0][1],n[1][0]-n[0][0])-y;const w=(E,_)=>[this.offset.left+this.canvasBounds.width*E*this.naturalScale*d+f,this.offset.top+this.canvasBounds.height*_*this.naturalScale*d+m],x=w(0,0),S=w(this.touchStarts[0].canvasRel[0],this.touchStarts[0].canvasRel[1]),C=Mf(x,S,g);u=C[0]-x[0],h=C[1]-x[1],this.scale=d,this.rotate=g,this.setTranslateFromUserGesture(f+u,m+h)}else this.scale=d,this.setTranslateFromUserGesture(f,m)}else{const r=t.touches[0].clientX-this.touchStarts[0].client[0],a=t.touches[0].clientY-this.touchStarts[0].client[1],i=this.touchStartTranslateX+r,s=this.touchStartTranslateY+a;this.setTranslateFromUserGesture(i,s)}this.update()}}handleTouchend(t){t.touches.length===0?this.touchStarts=null:(this.touchStarts=this.freezeTouches(t.touches),this.touchStartTranslateX=this.translateX,this.touchStartTranslateY=this.translateY),this.isGestureActive=!1}calcProjectionTranslate(t,n,r,a){const i=this.canvasBounds.width*this.naturalScale,s=this.canvasBounds.height*this.naturalScale,d=r[0]*i*t,l=r[1]*s*t,c=Mf([d,l],[0,0],a??this.rotate),f=n[0]*this.wrapperInnerWidth,m=n[1]*this.wrapperInnerHeight,u=f-c[0],h=m-c[1];return[u,h]}applyTransform(t,n,r){const a=this.calcProjectionTranslate(t,n,r,0);this.scale=t,this.setTranslateFromUserGesture(a[0],a[1]),this.update()}composeRelPoint(t,n,r,a,i,s){r=r??this.scale,a=a??this.translateX,i=i??this.translateY,s=s??this.rotate;const d=[this.offset.left,this.offset.top],l=[this.offset.left+this.canvasBounds.width*(r*this.naturalScale)*t,this.offset.top+this.canvasBounds.height*(r*this.naturalScale)*n],c=Mf(l,d,s);return[c[0]+a,c[1]+i]}composePoint(t,n){const r=t/this.canvasBounds.width,a=n/this.canvasBounds.height;return this.composeRelPoint(r,a)}getAnchorOffset(t,n,r,a,i=[.5,.5]){const s=this.calcProjectionTranslate(t,i,i,0),d=[this.offset.left+s[0]+this.canvasBounds.width*(t*this.naturalScale)*i[0],this.offset.top+s[1]+this.canvasBounds.height*(t*this.naturalScale)*i[1]],l=this.composeRelPoint(i[0],i[1],t,n,r,a),c=l[0]-d[0],f=l[1]-d[1];return[c,f]}getCanvasCoordsRel(t,n){const r=[0,0],a=[t-this.translateX,n-this.translateY],i=Mf(a,r,-this.rotate),s=[i[0]/this.renderinScale,i[1]/this.renderinScale];return[s[0]/this.canvasBounds.width,s[1]/this.canvasBounds.height]}clientCoordsToWrapperCoords(t,n){const{x:r,y:a}=this.element.getBoundingClientRect();return[t-r-this.offset.left,n-a-this.offset.top]}relativeWrapperCoordinatesFromClientCoords(t,n){const[r,a]=this.clientCoordsToWrapperCoords(t,n);return[r/this.wrapperInnerWidth,a/this.wrapperInnerHeight]}normalizeMatrixCoordinates(t,n){const r=this.clientCoordsToWrapperCoords(t,n);return this.getCanvasCoordsRel(r[0],r[1])}normalizeClientCoords(t,n){const[r,a]=this.normalizeMatrixCoordinates(t,n);return[r*this.canvasBounds.width,a*this.canvasBounds.height]}rotateCanvas(t,n,r){const a=t/this.canvasBounds.width,i=n/this.canvasBounds.height,s=this.composeRelPoint(a,i,this.scale,0,0,r),d=this.composeRelPoint(a,i);this.setTranslateFromUserGesture(d[0]-s[0],d[1]-s[1]),this.rotate=r,this.update()}get renderinScale(){return this.naturalScale*this.scale}get renderingTranslateX(){return this.offset.left+this.translateX}get renderingTranslateY(){return this.offset.top+this.translateY}get renderingRotate(){return this.rotate}clampTranslate(t,n=[.5,.5]){const r=this.canvasBounds.width*this.naturalScale*t.scale,a=this.canvasBounds.height*this.naturalScale*t.scale,i=r-this.wrapperInnerWidth,s=a-this.wrapperInnerHeight,d=i>0?-i:0,l=Math.min(0,Math.max(t.translateX,d)),c=s>0?-s:0,f=Math.min(0,Math.max(t.translateY,c)),m=-Math.min(0,i)*n[0],u=-Math.min(0,s)*n[1];return{translateX:l+m,translateY:f+u}}update(){this.canvasElement.style.transformOrigin="top left",this.canvasElement.style.transform=`translateX(${this.renderingTranslateX}px) translateY(${this.renderingTranslateY}px) scale(${this.renderinScale}) rotate(${this.renderingRotate}rad)`,this.dispatchEvent(new Event("update"))}destroy(){var t,n,r;(t=this.roElement)==null||t.disconnect(),this.roElement=null,(n=this.roCanvas)==null||n.disconnect(),this.roCanvas=null,(r=this.ancestorMotionCleanup)==null||r.call(this),this.ancestorMotionCleanup=null}};const HX={class:"canvas"},WX={class:"matrix"},GX=o.defineComponent({__name:"Zoompinch",props:{transform:{default:()=>({translateX:0,translateY:0,scale:1,rotate:0})},offset:{default:()=>({left:0,top:0,right:0,bottom:0})},maxScale:{default:10},minScale:{default:.5},clampBounds:{type:Boolean,default:!1},rotation:{type:Boolean,default:!0},mouse:{type:Boolean,default:!0},wheel:{type:Boolean,default:!0},touch:{type:Boolean,default:!0},gesture:{type:Boolean,default:!0},zoomSpeed:{},translateSpeed:{},zoomSpeedAppleTrackpad:{},translateSpeedAppleTrackpad:{}},emits:["update:transform","init","dragGestureStart","dragGestureEnd"],setup(e,{expose:t,emit:n}){const r=e,a=n,i=o.ref(),s=o.ref(),d=o.ref(!1);window.zoompinchEngine=s;const l=o.ref(()=>{throw new Error("Not initialized yet")}),c=o.ref(0),f=o.ref(0);o.onMounted(()=>{i.value&&(s.value=new qX(i.value,r.offset,r.transform.translateX,r.transform.translateY,r.transform.scale,r.transform.rotate,r.minScale,r.maxScale,r.clampBounds,r.rotation),r.zoomSpeed!==void 0&&(s.value.zoomSpeed=r.zoomSpeed),r.translateSpeed!==void 0&&(s.value.translateSpeed=r.translateSpeed),r.zoomSpeedAppleTrackpad!==void 0&&(s.value.zoomSpeedAppleTrackpad=r.zoomSpeedAppleTrackpad),r.translateSpeedAppleTrackpad!==void 0&&(s.value.translateSpeedAppleTrackpad=r.translateSpeedAppleTrackpad),s.value.addEventListener("init",()=>{a("init")}),s.value.addEventListener("update",()=>{if(!s.value)return;const k={translateX:s.value.translateX,translateY:s.value.translateY,scale:s.value.scale,rotate:s.value.rotate};(k.translateX!==r.transform.translateX||k.translateY!==r.transform.translateY||k.scale!==r.transform.scale||k.rotate!==r.transform.rotate)&&a("update:transform",k),l.value=(P,z)=>s.value.composePoint(P,z),c.value=s.value.canvasBounds.width,f.value=s.value.canvasBounds.height}),s.value.addEventListener("init",()=>{d.value=!0}))}),o.watch(()=>r.transform,()=>{s.value&&(s.value.translateX!==r.transform.translateX||s.value.translateY!==r.transform.translateY||s.value.scale!==r.transform.scale||s.value.rotate!==r.transform.rotate)&&(s.value.translateX=r.transform.translateX,s.value.translateY=r.transform.translateY,s.value.scale=r.transform.scale,s.value.rotate=r.transform.rotate,s.value.update())},{deep:!0}),o.watch(()=>r.offset,k=>{s.value&&(s.value.offset=k,s.value.update())},{deep:!0}),o.watch(()=>r.minScale,k=>{s.value&&(s.value.minScale=k,s.value.update())}),o.watch(()=>r.maxScale,k=>{s.value&&(s.value.maxScale=k,s.value.update())}),o.watch(()=>r.clampBounds,k=>{s.value&&(s.value.clampBounds=k,s.value.setTranslateFromUserGesture(s.value.translateX,s.value.translateY),s.value.update())}),o.watch(()=>r.rotation,k=>{s.value&&(s.value.rotation=k,s.value.update())}),o.watch(()=>r.zoomSpeed,()=>{!s.value||r.zoomSpeed===void 0||(s.value.zoomSpeed=r.zoomSpeed)}),o.watch(()=>r.translateSpeed,()=>{!s.value||r.translateSpeed===void 0||(s.value.translateSpeed=r.translateSpeed)}),o.watch(()=>r.zoomSpeedAppleTrackpad,()=>{!s.value||r.zoomSpeedAppleTrackpad===void 0||(s.value.zoomSpeedAppleTrackpad=r.zoomSpeedAppleTrackpad)}),o.watch(()=>r.translateSpeedAppleTrackpad,()=>{!s.value||r.translateSpeedAppleTrackpad===void 0||(s.value.translateSpeedAppleTrackpad=r.translateSpeedAppleTrackpad)});const m=(k,P,z,$)=>{s.value&&($!==void 0&&(s.value.rotate=$),s.value.applyTransform(k,P,z))},u=k=>{s.value&&r.wheel&&s.value.handleWheel(k)},h=k=>{s.value&&r.gesture&&s.value.handleGesturestart(k)},g=k=>{s.value&&r.gesture&&s.value.handleGesturechange(k)},y=k=>{s.value&&r.gesture&&s.value.handleGestureend(k)},w=k=>{s.value&&r.mouse&&s.value.handleMousedown(k)},x=k=>{s.value&&r.mouse&&s.value.handleMousemove(k)},S=k=>{s.value&&r.mouse&&s.value.handleMouseup(k)},C=k=>{s.value&&r.touch&&s.value.handleTouchstart(k)},E=k=>{s.value&&r.touch&&s.value.handleTouchmove(k)},_=k=>{s.value&&r.touch&&s.value.handleTouchend(k)};window.addEventListener("gesturechange",g),window.addEventListener("gestureend",y),window.addEventListener("mousemove",x),window.addEventListener("mouseup",S),window.addEventListener("touchmove",E),window.addEventListener("touchend",_),o.onUnmounted(()=>{window.removeEventListener("gesturechange",g),window.removeEventListener("gestureend",y),window.removeEventListener("mousemove",x),window.removeEventListener("mouseup",S),window.removeEventListener("touchmove",E),window.removeEventListener("touchend",_)});const I=(k,P)=>{if(!s.value)throw new Error("Zoompinch engine not initialized");return s.value.normalizeClientCoords(k,P)},B=(k,P,z)=>{s.value&&s.value.rotateCanvas(k,P,z)};return o.useSlots(),t({applyTransform:m,composePoint:l,normalizeClientCoords:I,zoompinchEngine:s,canvasWidth:c,canvasHeight:f,rotateCanvas:B}),(k,P)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"zoompinchRef",ref:i,class:"zoompinch",onWheel:u,onGesturestart:h,onMousedown:w,onTouchstart:C},[o.createElementVNode("div",HX,[o.renderSlot(k.$slots,"default",{},void 0,!0)]),o.createElementVNode("div",WX,[d.value&&l.value?o.renderSlot(k.$slots,"matrix",{key:0,composePoint:l.value,normalizeClientCoords:I,canvasWidth:c.value,canvasHeight:f.value},void 0,!0):o.createCommentVNode("",!0)])],544))}}),XX=(e,t)=>{const n=e.__vccOpts||e;for(const[r,a]of t)n[r]=a;return n},SC=XX(GX,[["__scopeId","data-v-fbdbcf7c"]]),zd=new Set;requestAnimationFrame(function e(){zd.forEach(t=>t()),requestAnimationFrame(e)});function u8(e,t,n){let r;const a=()=>{const s=e instanceof Function?e():e.value,d=r;s!==r&&(r=s,t(s,d))};return zd.add(a),()=>{zd.delete(a)}}function Zg(e,t){let n=null;const r=this;return()=>{clearTimeout(n);var a=arguments;n=setTimeout(()=>{e.apply(r,a)},t)}}const YX=["x","y","width","height"],KX=["cx","cy","r"],JX=["cx","cy","r"],QX=["cx","cy","r"],eY=["cx","cy","r"],tY=["cx","cy","r"],nY=["cx","cy","r"],rY=["cx","cy","r"],aY=["cx","cy","r"],oY=["cx","cy","r"],iY=["cx","cy","r"],sY=["cx","cy","r"],lY=["cx","cy","r"],cY=["cx","cy","r"],uY=["cx","cy","r"],dY=["cx","cy","r"],fY=["cx","cy","r"],pY=o.defineComponent({__name:"CropSkeleton",props:{x:{},y:{},width:{},height:{},aspectRatio:{},clamp:{}},emits:["update","effectiveHandleChange"],setup(e,{emit:t}){const n=e,r=t,a=o.ref(5),i=o.computed(()=>{const O=Math.min(n.width,n.height);return O>=a.value*8?a.value*4:Math.max(O/2,a.value)}),s=o.computed(()=>({x:n.x,y:n.y})),d=o.computed(()=>({x:n.x+n.width,y:n.y})),l=o.computed(()=>({x:n.x+n.width,y:n.y+n.height})),c=o.computed(()=>({x:n.x,y:n.y+n.height})),f=o.computed(()=>({x:n.x+n.width/2,y:n.y})),m=o.computed(()=>({x:n.x+n.width,y:n.y+n.height/2})),u=o.computed(()=>({x:n.x+n.width/2,y:n.y+n.height})),h=o.computed(()=>({x:n.x,y:n.y+n.height/2})),g=o.computed(()=>n.width>a.value*4&&n.height>a.value*4),y=o.ref(null),w=o.ref(null),x=o.ref(null),S=o.ref(null),C=o.ref(null),E=o.ref(null),_=o.ref(null);o.watch(E,O=>{r("effectiveHandleChange",O)});function I(O,D){console.log("handleThumbMouseDown",O,D),C.value=D,E.value=D,_.value=null,x.value={x:n.x,y:n.y,width:n.width,height:n.height},S.value={x:O.clientX,y:O.clientY},O.preventDefault(),O.stopPropagation()}function B(O,D){console.log("handleThumbTouchstart",O,D);const R=O.touches[0];C.value=D,E.value=D,_.value=null,x.value={x:n.x,y:n.y,width:n.width,height:n.height},S.value={x:R.clientX,y:R.clientY},O.preventDefault(),O.stopPropagation()}const k=()=>{C.value=null,E.value=null,_.value=null,x.value=null,S.value=null,y.value=null,w.value=null},P=()=>{C.value=null,E.value=null,_.value=null,x.value=null,S.value=null,y.value=null,w.value=null},z=O=>{if(y.value){if(!x.value)return;const D=O.clientX-y.value.x,R=O.clientY-y.value.y;w.value={x:x.value.x+D,y:x.value.y+R,width:x.value.width,height:x.value.height}}else C.value&&(_.value={x:O.clientX,y:O.clientY})},$=O=>{const D=O.touches[0];if(y.value){if(!x.value)return;const R=D.clientX-y.value.x,W=D.clientY-y.value.y;w.value={x:x.value.x+R,y:x.value.y+W,width:x.value.width,height:x.value.height}}else C.value&&(_.value={x:D.clientX,y:D.clientY})};function j(O){y.value={x:O.clientX,y:O.clientY},S.value={x:O.clientX,y:O.clientY},x.value={x:n.x,y:n.y,width:n.width,height:n.height},O.preventDefault(),O.stopPropagation()}function p(O){const D=O.touches[0];y.value={x:D.clientX,y:D.clientY},S.value={x:D.clientX,y:D.clientY},x.value={x:n.x,y:n.y,width:n.width,height:n.height},O.preventDefault(),O.stopPropagation()}function H(O){var se,ie;const D=((se=n.clamp)==null?void 0:se.x)??-1/0,R=((ie=n.clamp)==null?void 0:ie.y)??-1/0,W=n.clamp?n.clamp.x+n.clamp.width:1/0,ee=n.clamp?n.clamp.y+n.clamp.height:1/0;return{x:Math.min(Math.max(O.x,D),W-O.width),y:Math.min(Math.max(O.y,R),ee-O.height),width:O.width,height:O.height}}function F(O){const D=O.shiftKey?10:4;let R=0,W=0;switch(O.key){case"ArrowLeft":R=-D;break;case"ArrowRight":R=D;break;case"ArrowUp":W=-D;break;case"ArrowDown":W=D;break;default:return}O.preventDefault();const ee={x:n.x,y:n.y,width:n.width,height:n.height};if(O.shiftKey)if(n.aspectRatio!=null){const ie=O.key==="ArrowRight"||O.key==="ArrowDown"?D:-D,{bbox:le}=L("br",ee,ie,ie,n.aspectRatio,n.clamp);r("update",le)}else{const{bbox:se}=L("br",ee,R,W,void 0,n.clamp);r("update",se)}else r("update",H({...ee,x:ee.x+R,y:ee.y+W}))}function Z(O,D,R){const W={tl:"tr",tr:"tl",bl:"br",br:"bl",l:"r",r:"l"},ee={tl:"bl",bl:"tl",tr:"br",br:"tr",t:"b",b:"t"};let se=O;return D&&(se=W[se]??se),R&&(se=ee[se]??se),se}function L(O,D,R,W,ee,se){let ie=D.x,le=D.y,ue=D.x+D.width,he=D.y+D.height;switch(O){case"tl":ie+=R,le+=W;break;case"t":le+=W;break;case"tr":ue+=R,le+=W;break;case"r":ue+=R;break;case"br":ue+=R,he+=W;break;case"b":he+=W;break;case"bl":ie+=R,he+=W;break;case"l":ie+=R;break}const Y=ie>ue,M=le>he,N=Z(O,Y,M),q=(se==null?void 0:se.x)??-1/0,ae=(se==null?void 0:se.y)??-1/0,oe=se?se.x+se.width:1/0,re=se?se.y+se.height:1/0;if(ee!=null)if(O==="tl"||O==="tr"||O==="bl"||O==="br"){const Oe=O==="tl"||O==="bl"?ue:ie,_e=O==="tl"||O==="tr"?he:le,be=O==="tl"||O==="bl"?ie:ue,Ne=O==="tl"||O==="tr"?le:he,Ze=be>=Oe,De=Ne>=_e;let Fe=Math.max(Math.abs(be-Oe),1),pe=Math.max(Math.abs(Ne-_e),1);if(Fe/pe>ee?Fe=pe*ee:pe=Fe/ee,se){const Ae=Ze?oe-Oe:Oe-q,Xe=De?re-_e:_e-ae;(Fe>Ae||pe>Xe)&&(Ae/Xe>ee?(pe=Math.min(pe,Xe),Fe=pe*ee):(Fe=Math.min(Fe,Ae),pe=Fe/ee))}Ze?(ie=Oe,ue=Oe+Fe):(ue=Oe,ie=Oe-Fe),De?(le=_e,he=_e+pe):(he=_e,le=_e-pe)}else if(O==="r"||O==="l"){const _e=O==="r"?D.x:D.x+D.width,be=O==="r"?ue:ie,Ne=D.y+D.height/2,Ze=be>=_e;let De=Math.max(Math.abs(be-_e),1);if(se){const pe=Ze?oe-_e:_e-q,Ae=Math.min(Ne-ae,re-Ne)*2;De=Math.max(Math.min(De,pe,Ae*ee),1)}const Fe=De/ee;Ze?(ie=_e,ue=_e+De):(ue=_e,ie=_e-De),le=Ne-Fe/2,he=Ne+Fe/2}else{const _e=O==="b"?D.y:D.y+D.height,be=O==="b"?he:le,Ne=D.x+D.width/2,Ze=be>=_e;let De=Math.max(Math.abs(be-_e),1);if(se){const pe=Ze?re-_e:_e-ae,Ae=Math.min(Ne-q,oe-Ne)*2;De=Math.max(Math.min(De,pe,Ae/ee),1)}const Fe=De*ee;Ze?(le=_e,he=_e+De):(he=_e,le=_e-De),ie=Ne-Fe/2,ue=Ne+Fe/2}else{const me=Math.min(ie,ue),Oe=Math.min(le,he),_e=Math.max(ie,ue),be=Math.max(le,he);ie=me,le=Oe,ue=_e,he=be,se&&(ie=Math.max(ie,q),le=Math.max(le,ae),ue=Math.min(ue,oe),he=Math.min(he,re))}return{bbox:{x:ie,y:le,width:ue-ie,height:he-le},effectiveHandle:N}}return u8(w,()=>{var O,D;if(w.value){const R=((O=n.clamp)==null?void 0:O.x)??-1/0,W=((D=n.clamp)==null?void 0:D.y)??-1/0,ee=n.clamp?n.clamp.x+n.clamp.width:1/0,se=n.clamp?n.clamp.y+n.clamp.height:1/0;w.value.x<R&&(w.value.x=R),w.value.y<W&&(w.value.y=W),w.value.x+w.value.width>ee&&(w.value.x=ee-w.value.width),w.value.y+w.value.height>se&&(w.value.y=se-w.value.height),r("update",w.value)}}),u8(_,()=>{if(!C.value||!_.value||!S.value||!x.value)return;const O=_.value.x-S.value.x,D=_.value.y-S.value.y,{bbox:R,effectiveHandle:W}=L(C.value,x.value,O,D,n.aspectRatio,n.clamp);E.value=W,r("update",R)}),window.addEventListener("mouseup",k),window.addEventListener("touchend",P),window.addEventListener("mousemove",z),window.addEventListener("touchmove",$),o.onUnmounted(()=>{window.removeEventListener("mouseup",k),window.removeEventListener("touchend",P),window.removeEventListener("mousemove",z),window.removeEventListener("touchmove",$)}),(O,D)=>(o.openBlock(),o.createElementBlock("g",null,[o.createElementVNode("rect",{x:e.x,y:e.y,width:e.width,height:e.height,class:"skeleton-rect",tabindex:"0",role:"application","aria-roledescription":"Crop area","aria-label":"Crop area. Use arrow keys to move, Shift plus arrow keys to resize.",onMousedown:j,onTouchstart:p,onKeydown:F},null,40,YX),o.createElementVNode("g",{class:o.normalizeClass({inactive:!g.value})},[o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-t",onMousedown:D[0]||(D[0]=R=>I(R,"t")),onTouchstart:D[1]||(D[1]=R=>B(R,"t"))},null,40,KX),o.createElementVNode("circle",{cx:f.value.x,cy:f.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="t"}])},null,10,JX)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:m.value.x,cy:m.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-r",onMousedown:D[2]||(D[2]=R=>I(R,"r")),onTouchstart:D[3]||(D[3]=R=>B(R,"r"))},null,40,QX),o.createElementVNode("circle",{cx:m.value.x,cy:m.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="r"}])},null,10,eY)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-b",onMousedown:D[4]||(D[4]=R=>I(R,"b")),onTouchstart:D[5]||(D[5]=R=>B(R,"b"))},null,40,tY),o.createElementVNode("circle",{cx:u.value.x,cy:u.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="b"}])},null,10,nY)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-l",onMousedown:D[6]||(D[6]=R=>I(R,"l")),onTouchstart:D[7]||(D[7]=R=>B(R,"l"))},null,40,rY),o.createElementVNode("circle",{cx:h.value.x,cy:h.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="l"}])},null,10,aY)])],2),o.createElementVNode("g",null,[o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:s.value.x,cy:s.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tl",onMousedown:D[8]||(D[8]=R=>I(R,"tl")),onTouchstart:D[9]||(D[9]=R=>B(R,"tl"))},null,40,oY),o.createElementVNode("circle",{cx:s.value.x,cy:s.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="tl"}])},null,10,iY)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-tr",onMousedown:D[10]||(D[10]=R=>I(R,"tr")),onTouchstart:D[11]||(D[11]=R=>B(R,"tr"))},null,40,sY),o.createElementVNode("circle",{cx:d.value.x,cy:d.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="tr"}])},null,10,lY)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:c.value.x,cy:c.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-bl",onMousedown:D[12]||(D[12]=R=>I(R,"bl")),onTouchstart:D[13]||(D[13]=R=>B(R,"bl"))},null,40,cY),o.createElementVNode("circle",{cx:c.value.x,cy:c.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="bl"}])},null,10,uY)]),o.createElementVNode("g",null,[o.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:i.value,class:"thumb-circle-hitbox thumb-circle-hitbox-br",onMousedown:D[14]||(D[14]=R=>I(R,"br")),onTouchstart:D[15]||(D[15]=R=>B(R,"br"))},null,40,dY),o.createElementVNode("circle",{cx:l.value.x,cy:l.value.y,r:a.value,class:o.normalizeClass(["thumb-circle",{pressing:E.value==="br"}])},null,10,fY)])])]))}}),mY=Je(pY,[["__scopeId","data-v-ab8c8451"]]);function hc(e,t,n){return Math.min(Math.max(e,t),n)}function hY(e,t){const n=hc(e.x,t.x,t.x+t.width),r=hc(e.y,t.y,t.y+t.height),a=hc(e.x+e.width,t.x,t.x+t.width),i=hc(e.y+e.height,t.y,t.y+t.height);return{x:n,y:r,width:a-n,height:i-r}}function gY(e,t,n){if(n==null)return hY(e,t);let r=e.width,a=e.height;r>t.width&&(r=t.width,a=r/n),a>t.height&&(a=t.height,r=a*n);const i=hc(e.x,t.x,t.x+t.width-r),s=hc(e.y,t.y,t.y+t.height-a);return{x:i,y:s,width:r,height:a}}function vY(e){return new Promise((t,n)=>{if(e.complete&&e.naturalWidth!==0){console.log("[0] getBoundingClientRect",e.getBoundingClientRect()),t();return}const r=()=>{e.naturalWidth*e.naturalHeight>0&&(console.log("[1] getBoundingClientRect",e.getBoundingClientRect()),setTimeout(()=>{console.log("[2] getBoundingClientRect",e.getBoundingClientRect()),t()}),zd.delete(r))};zd.add(r),e.addEventListener("error",()=>n(new Error("Failed to load image")),{once:!0})})}const bY={class:"bx-cropper"},yY={xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",class:"matrix-svg"},wY={key:0,class:"layer loading-layer"},xY={class:"layer"},CY=o.defineComponent({__name:"BxCropper",props:{crop:{},aspectRatio:{},offset:{default:()=>({top:10,right:10,bottom:10,left:10})},mirrorX:{type:Boolean,default:!1},mirrorY:{type:Boolean,default:!1}},emits:["update:crop"],setup(e,{emit:t}){const n=e,r=t;o.useSlots();const a=o.ref(),i=o.ref({translateX:0,translateY:0,scale:1,rotate:0}),s=o.ref(),d=o.ref();function l(w){let{left:x,top:S,width:C,height:E}=w;return n.mirrorX&&a.value&&(x=a.value.canvasWidth-x-C),n.mirrorY&&a.value&&(S=a.value.canvasHeight-S-E),{left:x,top:S,width:C,height:E}}function c(w){if(!a.value)throw new Error("Zoompinch ref not available");const x=l(w),[S,C]=a.value.composePoint(x.left,x.top),[E,_]=a.value.composePoint(x.left+x.width,x.top+x.height),I=E-S,B=_-C;return{x:S,y:C,width:I,height:B}}function f(w){if(!a.value||!a.value.zoompinchEngine)throw new Error("Zoompinch ref or engine not available");const x=w.x+(a.value.zoompinchEngine.wrapperInnerX-n.offset.left),S=w.y+(a.value.zoompinchEngine.wrapperInnerY-n.offset.top),[C,E]=a.value.normalizeClientCoords(x,S),[_,I]=a.value.normalizeClientCoords(x+w.width,S+w.height),B=_-C,k=I-E;return{left:Math.round(C),top:Math.round(E),width:Math.round(B),height:Math.round(k)}}const m=o.ref(!1);async function u(){var S;if(!((S=a.value)!=null&&S.zoompinchEngine))return;const w=Array.from(a.value.zoompinchEngine.canvasElement.children);for(const C of w)C.tagName==="IMG"&&await vY(C);m.value=!0,a.value.applyTransform(1,[.5,.5],[.5,.5]);const x=n.crop??(()=>{const C=a.value.canvasWidth,E=a.value.canvasHeight,_=C/E;if(n.aspectRatio){const I=_>n.aspectRatio?E*n.aspectRatio:C,B=_>n.aspectRatio?E:C/n.aspectRatio;return{left:(C-I)/2,top:(E-B)/2,width:I,height:B}}else return{left:0,top:0,width:C,height:E}})();d.value=x,s.value=c(x)}const h=o.ref(null);window.test=()=>f(s.value);const g=o.computed(()=>{if(i.value,!a.value)throw new Error("Zoompinch ref not available");return c({left:0,top:0,width:a.value.canvasWidth,height:a.value.canvasHeight})});function y(w){s.value=w}return o.watch(i,()=>{!s.value||!a.value||(s.value=gY(s.value,g.value,n.aspectRatio))}),o.watch(s,w=>{if(!w)return;const x=f(w),S=l(x);d.value=S,r("update:crop",S)}),o.watch([()=>n.mirrorX,()=>n.mirrorY],()=>{!m.value||!d.value||!a.value||(s.value=c(d.value))}),(w,x)=>(o.openBlock(),o.createElementBlock("div",bY,[o.createVNode(o.unref(SC),{ref_key:"zoompinchRef",ref:a,transform:i.value,"onUpdate:transform":x[1]||(x[1]=S=>i.value=S),rotation:!1,"min-scale":1,offset:e.offset,"clamp-bounds":"",onInit:u,class:o.normalizeClass({[`effective-handle-${h.value}`]:h.value!==null})},{default:o.withCtx(()=>[o.renderSlot(w.$slots,"default",{},void 0,!0)]),matrix:o.withCtx(()=>[(o.openBlock(),o.createElementBlock("svg",yY,[s.value?(o.openBlock(),o.createBlock(mY,o.mergeProps({key:0},s.value,{"aspect-ratio":e.aspectRatio,clamp:g.value,onUpdate:y,onEffectiveHandleChange:x[0]||(x[0]=S=>h.value=S)}),null,16,["aspect-ratio","clamp"])):o.createCommentVNode("",!0)])),m.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",wY,[o.createVNode(bs)])),o.createElementVNode("div",xY,[o.renderSlot(w.$slots,"layer",{},void 0,!0)])]),_:3},8,["transform","offset","class"])]))}}),kC=Je(CY,[["__scopeId","data-v-8d2848fa"]]),SY={class:"bx-image-cropper"},kY=["src"],_Y={class:"actions-left"},EY={class:"actions-right"},zY=o.defineComponent({__name:"BxImageCropper",props:o.mergeModels({src:{},aspectRatio:{},offset:{}},{crop:{required:!1},cropModifiers:{},mirrorX:{type:Boolean,required:!1,default:!1},mirrorXModifiers:{},mirrorY:{type:Boolean,required:!1,default:!1},mirrorYModifiers:{}}),emits:o.mergeModels(["cancel","done"],["update:crop","update:mirrorX","update:mirrorY"]),setup(e,{emit:t}){const n=o.useModel(e,"crop"),r=o.useModel(e,"mirrorX"),a=o.useModel(e,"mirrorY"),i=t;function s(){r.value=!r.value}function d(){a.value=!a.value}return(l,c)=>(o.openBlock(),o.createElementBlock("div",SY,[o.createVNode(kC,{"aspect-ratio":e.aspectRatio,crop:n.value,"onUpdate:crop":c[4]||(c[4]=f=>n.value=f),offset:e.offset,"mirror-x":r.value,"mirror-y":a.value},{layer:o.withCtx(()=>[o.createElementVNode("div",{class:"actions-wrapper",onTouchstart:c[2]||(c[2]=o.withModifiers(()=>{},["stop"])),onTouchend:c[3]||(c[3]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("div",_Y,[o.createVNode(yt,{onClick:s,class:o.normalizeClass({active:!0}),"aria-label":"Mirror horizontally"},{icon:o.withCtx(()=>[o.createVNode(nt,null,{default:o.withCtx(()=>[...c[5]||(c[5]=[o.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[o.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[o.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M12.5 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0zM6 9.104a.75.75 0 0 1 1.28-.53L10 11.292a1 1 0 0 1 0 1.414l-2.72 2.72a.75.75 0 0 1-1.28-.53zm1 .603v4.586L9.293 12zm11-.603a.75.75 0 0 0-1.28-.53L14 11.292a1 1 0 0 0 0 1.414l2.72 2.72a.75.75 0 0 0 1.28-.53zm-1 .603v4.586L14.707 12z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1}),o.createVNode(yt,{onClick:d,class:o.normalizeClass({active:!0}),"aria-label":"Mirror vertically"},{icon:o.withCtx(()=>[o.createVNode(nt,null,{default:o.withCtx(()=>[...c[6]||(c[6]=[o.createElementVNode("svg",{fill:"none",viewBox:"0 0 24 24","data-fpl-icon-size":"24"},[o.createElementVNode("g",{style:{"transform-origin":"center center",transform:"scale(1.5)"}},[o.createElementVNode("path",{style:{fill:"currentColor","fill-rule":"evenodd"},d:"M17.5 12.5a.5.5 0 0 0 0-1h-11a.5.5 0 0 0 0 1zM14.896 18a.75.75 0 0 0 .53-1.28L12.708 14a1 1 0 0 0-1.414 0l-2.72 2.72a.75.75 0 0 0 .53 1.28zm-.603-1H9.707L12 14.707zm.603-11a.75.75 0 0 1 .53 1.28L12.708 10a1 1 0 0 1-1.414 0l-2.72-2.72A.75.75 0 0 1 9.103 6zm-.603 1H9.707L12 9.293z","clip-rule":"evenodd"})])],-1)])]),_:1})]),_:1})]),o.createElementVNode("div",EY,[o.createVNode(yt,{secondary:"",onClick:c[0]||(c[0]=f=>i("cancel"))},{default:o.withCtx(()=>[...c[7]||(c[7]=[o.createTextVNode(" Cancel ",-1)])]),_:1}),o.createVNode(yt,{active:"",onClick:c[1]||(c[1]=f=>i("done"))},{default:o.withCtx(()=>[...c[8]||(c[8]=[o.createTextVNode(" Done ",-1)])]),_:1})])],32)]),default:o.withCtx(()=>[o.createElementVNode("img",{src:e.src,class:o.normalizeClass(["image",{"mirror-x":r.value,"mirror-y":a.value}])},null,10,kY)]),_:1},8,["aspect-ratio","crop","offset","mirror-x","mirror-y"])]))}}),_C=Je(zY,[["__scopeId","data-v-0924dbd3"]]),EC=.6,zC=.4,d8=.6,f8=(e,t,n)=>Math.min(n,Math.max(t,e));function IC(e){const{faces:t,natural:n,aspectRatio:r,cropMode:a,zoom:i=!1}=e;if(a!=="cover"||!Number.isFinite(r)||r<=0||!(n.width>0)||!(n.height>0))return null;const s=t.filter(_=>_.score>=EC&&_.width>0&&_.height>0);if(s.length===0)return null;const d=Math.min(...s.map(_=>_.x)),l=Math.min(...s.map(_=>_.y)),c=Math.max(...s.map(_=>_.x+_.width)),f=Math.max(...s.map(_=>_.y+_.height)),m=(d+c)/2,u=(l+f)/2,h=n.width/n.height,g=h>r?n.height*r:n.width,y=h>r?n.height:n.width/r;let w=g,x=y;if(i){const _=(c-d)*(1+2*d8),I=(f-l)*(1+2*d8),B=Math.max(_,I*r),k=B/r;w=Math.min(g,B),x=Math.min(y,k)}const S=m-w/2,C=u-x*zC,E={left:f8(S,0,Math.max(0,n.width-w)),top:f8(C,0,Math.max(0,n.height-x)),width:w,height:x};return E.left===0&&E.top===0&&Math.abs(E.width-n.width)<.5&&Math.abs(E.height-n.height)<.5?null:E}let Q1=null;function IY(e){Q1=e}function AC(){return Q1!==null}async function AY(e){if(!Q1)return[];try{const t=await Q1(e);return Array.isArray(t)?t:[]}catch(t){return console.warn("[autoCrop] face detection failed, skipping auto-crop",t),[]}}const BY=640;function LY(e){return new Promise(t=>{const n=new Image;n.crossOrigin="anonymous",n.addEventListener("load",()=>t(n)),n.addEventListener("error",()=>t(null)),n.src=e})}function OY(e){const t=e.naturalWidth||e.width,n=e.naturalHeight||e.height;if(!(t>0)||!(n>0))return null;const r=Math.min(1,BY/Math.max(t,n)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(t*r)),a.height=Math.max(1,Math.round(n*r));const i=a.getContext("2d",{willReadFrequently:!0});if(!i)return null;i.drawImage(e,0,0,a.width,a.height);try{i.getImageData(0,0,1,1)}catch{return null}return{canvas:a,scale:r}}async function BC(e){if(!AC()||e.cropMode!=="cover")return null;const t=await LY(e.src);if(!t)return null;const n=OY(t);if(!n)return null;const r=await AY(n.canvas);if(r.length===0)return null;const a=1/n.scale,i=r.map(s=>({x:s.x*a,y:s.y*a,width:s.width*a,height:s.height*a,score:s.score}));return IC({faces:i,natural:e.natural,aspectRatio:e.aspectRatio,cropMode:e.cropMode,zoom:e.zoom})}var us={},S2={},LC={};Object.defineProperty(LC,"__esModule",{value:!0});var OC={};Object.defineProperty(OC,"__esModule",{value:!0});var PC={};Object.defineProperty(PC,"__esModule",{value:!0});var Gb={};Object.defineProperty(Gb,"__esModule",{value:!0});var Zn={},p8;function PY(){if(p8)return Zn;p8=1,Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.SERIAL_CANVAS_DOC_KEYS=void 0,Zn.cloneSerialJson=t,Zn.isMultiCanvas=n,Zn.getActiveCanvasId=r,Zn.getSerialCanvasById=a,Zn.extractDocState=i,Zn.docStateFromCanvas=s,Zn.syncActiveCanvasEntry=d,Zn.materializeCanvas=l,Zn.toPersistedSerial=c,Zn.fromPersistedSerial=f,Zn.canvasSizeToken=m,Zn.canvasDisplayName=u,Zn.findCanvasBySize=h,Zn.isCanvasSizeTaken=g,Zn.duplicateCanvasSizeCounts=y;const e=MC();Zn.SERIAL_CANVAS_DOC_KEYS=["context","width","height","frames","fill","grid"];function t(w){return JSON.parse(JSON.stringify(w))}function n(w){var x;return(((x=w.canvases)==null?void 0:x.length)??0)>=2}function r(w){return w.activeCanvasId??e.DEFAULT_CANVAS_ID}function a(w,x){var S;return(S=w.canvases)==null?void 0:S.find(C=>C.id===x)}function i(w){return{context:w.context,width:w.width,height:w.height,frames:w.frames,fill:w.fill,grid:w.grid}}function s(w){return{context:w.context,width:w.width,height:w.height,frames:w.frames,fill:w.fill,grid:w.grid??{horizontal:[],vertical:[]}}}function d(w){if(!n(w))return w.canvases;const x=r(w),S=w.canvases.findIndex(_=>_.id===x);if(S===-1)return w.canvases;const C=w.canvases[S],E=w.canvases.slice();return E[S]={...C,...t(i(w)),frames:w.frames?t(w.frames):void 0,fill:w.fill?t(w.fill):void 0},E}function l(w,x){if(!n(w))return w;const S=a(w,x);return S?{...w,...s(S),activeCanvasId:x}:w}function c(w){if(!n(w))return w;const x=d(w),S=(x==null?void 0:x.find(C=>C.id===e.DEFAULT_CANVAS_ID))??(x==null?void 0:x[0]);return S?{...w,canvases:x,...s(S)}:w}function f(w){if(!n(w))return w;const x=r(w);if(x===e.DEFAULT_CANVAS_ID)return w;const S=a(w,x);return S?{...w,...t(s(S))}:{...w,activeCanvasId:void 0}}function m(w,x){return`${Math.round(w)}x${Math.round(x)}`}function u(w){return`${Math.round(w.width)}×${Math.round(w.height)}`}function h(w,x,S,C){const E=m(x,S);return w.find(_=>_.id!==C&&m(_.width,_.height)===E)}function g(w,x,S,C){return!!h(w,x,S,C)}function y(w){const x={};for(const S of w){const C=m(S.width,S.height);x[C]=(x[C]??0)+1}for(const S of Object.keys(x))x[S]<2&&delete x[S];return x}return Zn}var em={};Object.defineProperty(em,"__esModule",{value:!0});em.isBlankSerial=MY;em.applyBlankDocumentFormat=TY;function MY(e){var t;return!(e.context.length>0||(((t=e.canvases)==null?void 0:t.length)??0)>0)}function TY(e,t){return e.width=t.width,e.height=t.height,t.frames?e.frames={...t.frames}:delete e.frames,e}var m8;function MC(){return m8||(m8=1,function(e){var t=X&&X.__createBinding||(Object.create?function(i,s,d,l){l===void 0&&(l=d);var c=Object.getOwnPropertyDescriptor(s,d);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[d]}}),Object.defineProperty(i,l,c)}:function(i,s,d,l){l===void 0&&(l=d),i[l]=s[d]}),n=X&&X.__setModuleDefault||(Object.create?function(i,s){Object.defineProperty(i,"default",{enumerable:!0,value:s})}:function(i,s){i.default=s}),r=X&&X.__importStar||function(){var i=function(s){return i=Object.getOwnPropertyNames||function(d){var l=[];for(var c in d)Object.prototype.hasOwnProperty.call(d,c)&&(l[l.length]=c);return l},i(s)};return function(s){if(s&&s.__esModule)return s;var d={};if(s!=null)for(var l=i(s),c=0;c<l.length;c++)l[c]!=="default"&&t(d,s,l[c]);return n(d,s),d}}(),a=X&&X.__exportStar||function(i,s){for(var d in i)d!=="default"&&!Object.prototype.hasOwnProperty.call(s,d)&&t(s,i,d)};Object.defineProperty(e,"__esModule",{value:!0}),e.SupportedInternalLinkedinKeys=e.DEFAULT_CANVAS_ID=e.Fields=e.Config=e.Elements=e.Geometry=void 0,e.Geometry=r(LC),e.Elements=r(OC),e.Config=r(PC),e.Fields=r(Gb),a(PY(),e),a(em,e),e.DEFAULT_CANVAS_ID="default",e.SupportedInternalLinkedinKeys=["LINKEDIN_NAME","LINKEDIN_PICTURE","LINKEDIN_EMAIL","LINKEDIN_FAMILY_NAME","LINKEDIN_GIVEN_NAME"]}(S2)),S2}var tm={};Object.defineProperty(tm,"__esModule",{value:!0});tm.Platforms=void 0;tm.Platforms=["instagram","facebook","x","tiktok","linkedin"];var TC={},DC={};Object.defineProperty(DC,"__esModule",{value:!0});(function(e){var t=X&&X.__createBinding||(Object.create?function(r,a,i,s){s===void 0&&(s=i);var d=Object.getOwnPropertyDescriptor(a,i);(!d||("get"in d?!a.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(r,s,d)}:function(r,a,i,s){s===void 0&&(s=i),r[s]=a[i]}),n=X&&X.__exportStar||function(r,a){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&t(a,r,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(DC,e)})(TC);var $C={},NC={};Object.defineProperty(NC,"__esModule",{value:!0});(function(e){var t=X&&X.__createBinding||(Object.create?function(r,a,i,s){s===void 0&&(s=i);var d=Object.getOwnPropertyDescriptor(a,i);(!d||("get"in d?!a.__esModule:d.writable||d.configurable))&&(d={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(r,s,d)}:function(r,a,i,s){s===void 0&&(s=i),r[s]=a[i]}),n=X&&X.__exportStar||function(r,a){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&t(a,r,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(NC,e)})($C);var jC={};Object.defineProperty(jC,"__esModule",{value:!0});var RC={};Object.defineProperty(RC,"__esModule",{value:!0});var FC={};Object.defineProperty(FC,"__esModule",{value:!0});var VC={};Object.defineProperty(VC,"__esModule",{value:!0});var UC={};Object.defineProperty(UC,"__esModule",{value:!0});var ZC={};Object.defineProperty(ZC,"__esModule",{value:!0});var qC={};Object.defineProperty(qC,"__esModule",{value:!0});var HC={},At={};function xo(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}const DY={ZodAny:"any",ZodArray:"array",ZodBigInt:"bigint",ZodBoolean:"boolean",ZodDefault:"default",ZodPrefault:"prefault",ZodTransform:"transform",ZodEnum:"enum",ZodIntersection:"intersection",ZodLazy:"lazy",ZodLiteral:"literal",ZodNever:"never",ZodNull:"null",ZodNullable:"nullable",ZodNumber:"number",ZodNonOptional:"nonoptional",ZodObject:"object",ZodOptional:"optional",ZodPipe:"pipe",ZodReadonly:"readonly",ZodRecord:"record",ZodString:"string",ZodTuple:"tuple",ZodType:"type",ZodUnion:"union",ZodDiscriminatedUnion:"union",ZodUnknown:"unknown",ZodVoid:"void",ZodDate:"date",ZodTemplateLiteral:"template_literal"};function It(e,t){return(Array.isArray(t)?t:[t]).some(r=>{var a;const i=((a=e==null?void 0:e.def)===null||a===void 0?void 0:a.type)===DY[r];return r==="ZodDiscriminatedUnion"?i&&"discriminator"in e.def:i})}function ir(e){return e&&"def"in e}function Au(e){return e.safeParse(null).success}function WC(e){return e.safeParse(void 0).success}let $Y=class{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function NY(){return new $Y}function ep(e,t){if(e==null||t===null||t===void 0)return e===t;if(e===t||e.valueOf()===t.valueOf())return!0;if(Array.isArray(e)&&(!Array.isArray(t)||e.length!==t.length)||!(e instanceof Object)||!(t instanceof Object))return!1;const n=Object.keys(e);return Object.keys(t).every(r=>n.indexOf(r)!==-1)&&n.every(r=>ep(e[r],t[r]))}class jY{constructor(){this.buckets=new Map}put(t){const n=this.hashCodeOf(t),r=this.buckets.get(n);if(!r){this.buckets.set(n,[t]);return}r.some(i=>ep(i,t))||r.push(t)}contains(t){const n=this.hashCodeOf(t),r=this.buckets.get(n);return r?r.some(a=>ep(a,t)):!1}values(){return[...this.buckets.values()].flat()}stats(){let t=0,n=0,r=0;for(const i of this.buckets.values())t+=1,n+=i.length,i.length>1&&(r+=1);const a=t/n;return{totalBuckets:t,collisions:r,totalValues:n,hashEffectiveness:a}}hashCodeOf(t){let n=0;if(Array.isArray(t)){for(let r=0;r<t.length;r++)n^=this.hashCodeOf(t[r])*r;return n}if(typeof t=="string"){for(let r=0;r<t.length;r++)n^=t.charCodeAt(r)*r;return n}if(typeof t=="number")return t;if(typeof t=="object")for(const[r,a]of Object.entries(t))n^=this.hashCodeOf(r)+this.hashCodeOf(a??"");return n}}function _c(e){return e===void 0}function nd(e,t){const n={};return Object.entries(e).forEach(([r,a])=>{n[r]=t(a)}),n}function RY(e,t){const n={};return Object.entries(e).forEach(([r,a])=>{t.some(i=>i===r)||(n[r]=a)}),n}function fl(e,t){const n={};return Object.entries(e).forEach(([r,a])=>{t(a,r)||(n[r]=a)}),n}function h8(e){return e.filter(t=>!_c(t))}const Id=ep;function GC(e){const t=new jY;return e.forEach(n=>t.put(n)),[...t.values()]}function qg(e){return typeof e=="string"}function g8(e){return Object.fromEntries(Object.entries(e).sort(([t],[n])=>t.localeCompare(n)))}const Hg=NY();class Ut{static collectMetadata(t,n){const r=this.getMetadataFromRegistry(t),a=Object.assign(Object.assign({},r==null?void 0:r._internal),n==null?void 0:n._internal),i=Object.assign(Object.assign({},r==null?void 0:r.param),n==null?void 0:n.param),s=Object.assign(Object.assign(Object.assign(Object.assign({},Object.keys(a).length>0?{_internal:a}:{}),r),n),Object.keys(i).length>0?{param:i}:{});if(It(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&ir(t._zod.def.innerType))return this.collectMetadata(t._zod.def.innerType,s);if(It(t,"ZodPipe")){const d=t._zod.def.in,l=t._zod.def.out;if(It(d,"ZodTransform")&&ir(l))return this.collectMetadata(l,s);if(ir(d))return this.collectMetadata(d,s)}return s}static getMetadata(t){return this.collectMetadata(t)}static getOpenApiMetadata(t){const n=this.collectMetadata(t),r=n??{},{_internal:a}=r;return xo(r,["_internal"])}static getInternalMetadata(t){var n;return(n=this.collectMetadata(t))===null||n===void 0?void 0:n._internal}static getParamMetadata(t){const n=this.collectMetadata(t);return Object.assign(Object.assign({},n),{param:Object.assign(Object.assign({},n!=null&&n.description?{description:n.description}:{}),n==null?void 0:n.param)})}static buildSchemaMetadata(t){return fl(RY(t,["param","_internal"]),_c)}static buildParameterMetadata(t){return fl(t,_c)}static applySchemaMetadata(t,n){return fl(Object.assign(Object.assign({},t),this.buildSchemaMetadata(n)),_c)}static getRefId(t){var n;return(n=this.getInternalMetadata(t))===null||n===void 0?void 0:n.refId}static unwrapChained(t){return this.unwrapUntil(t)}static getDefaultValue(t){var n;const r=(n=this.unwrapUntil(t,"ZodDefault"))!==null&&n!==void 0?n:this.unwrapUntil(t,"ZodPrefault");return r==null?void 0:r._zod.def.defaultValue}static unwrapUntil(t,n){if(n&&It(t,n))return t;if(It(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&ir(t._zod.def.innerType))return this.unwrapUntil(t._zod.def.innerType,n);if(It(t,"ZodPipe")){const r=t._zod.def.in,a=t._zod.def.out;if(It(r,"ZodTransform")&&ir(a))return this.unwrapUntil(a,n);if(ir(r))return this.unwrapUntil(r,n)}return n?void 0:t}static getMetadataFromInternalRegistry(t){return Hg.get(t)}static getMetadataFromRegistry(t){const n=this.getMetadataFromInternalRegistry(t),r=t.meta();if(!n)return r;const{_internal:a}=n,i=xo(n,["_internal"]),s=r??{},{id:d,title:l}=s,c=xo(s,["id","title"]);return Object.assign(Object.assign(Object.assign({_internal:Object.assign(Object.assign({},d?{refId:d}:{}),a)},i),l?{description:l}:{}),c)}static setMetadataInRegistry(t,n){Hg.add(t,n)}}function Ko(e,t){const n=e[t];typeof n=="function"&&(e[t]=function(...r){const a=n.apply(this,r),i=Ut.getMetadataFromRegistry(this);return i&&Ut.setMetadataInRegistry(a,i),a})}function FY(e){typeof e.ZodType.prototype.openapi<"u"||(e.ZodType.prototype.openapi=function(...t){const{refId:n,metadata:r,options:a}=VY(...t),i=r??{},{param:s}=i,d=xo(i,["param"]),l=Ut.getMetadataFromRegistry(this),c=l??{},{_internal:f}=c,m=xo(c,["_internal"]),u=Object.assign(Object.assign(Object.assign({},f),a),n?{refId:n}:void 0),h=Object.assign(Object.assign(Object.assign({},m),d),m!=null&&m.param||s?{param:Object.assign(Object.assign({},m==null?void 0:m.param),s)}:void 0),g=new this.constructor(this._def);function y(x){Ut.setMetadataInRegistry(x,Object.assign(Object.assign({},Object.keys(u).length>0?{_internal:u}:void 0),h))}if(y(g),It(g,"ZodLazy")&&y(this),It(g,"ZodObject")){const x=Ut.getMetadataFromRegistry(g),S=g.extend;g.extend=function(...C){const E=S.apply(g,C),_=x??{},{_internal:I}=_,B=xo(_,["_internal"]);return Ut.setMetadataInRegistry(E,{_internal:{extendedFrom:I!=null&&I.refId?{refId:I.refId,schema:g}:I==null?void 0:I.extendedFrom}}),E.openapi(B)},Ko(g,"catchall")}Ko(g,"optional"),Ko(g,"nullable"),Ko(g,"default"),Ko(g,"transform"),Ko(g,"refine"),Ko(g,"length"),Ko(g,"min"),Ko(g,"max");const w=g.meta;return g.meta=function(...x){const S=w.apply(this,x);if(x[0]){const C=Ut.getMetadataFromInternalRegistry(this);C&&Ut.setMetadataInRegistry(S,Object.assign(Object.assign({},C),x[0]))}return S},g})}function VY(e,t,n){return typeof e=="string"?{refId:e,metadata:t,options:n}:{refId:void 0,metadata:e,options:t}}function UY(e){var t;return fl((t=Ut.getOpenApiMetadata(e))!==null&&t!==void 0?t:{},_c)}function ZY(e){return Ut.getRefId(e)}class qY{constructor(t){this.parents=t,this._definitions=[]}get definitions(){var t,n;return[...(n=(t=this.parents)===null||t===void 0?void 0:t.flatMap(a=>a._definitions))!==null&&n!==void 0?n:[],...this._definitions]}register(t,n){const r=this.schemaWithRefId(t,n);return this._definitions.push({type:"schema",schema:r}),r}registerParameter(t,n){var r,a,i;const s=this.schemaWithRefId(t,n),d=(r=Ut.getOpenApiMetadata(s))!==null&&r!==void 0?r:{},l=s.openapi(Object.assign(Object.assign({},d),{param:Object.assign(Object.assign({},d==null?void 0:d.param),{name:(i=(a=d==null?void 0:d.param)===null||a===void 0?void 0:a.name)!==null&&i!==void 0?i:t})}));return this._definitions.push({type:"parameter",schema:l}),l}registerPath(t){this._definitions.push({type:"route",route:t})}registerWebhook(t){this._definitions.push({type:"webhook",webhook:t})}registerComponent(t,n,r){return this._definitions.push({type:"component",componentType:t,name:n,component:r}),{name:n,ref:{$ref:`#/components/${t}/${n}`}}}schemaWithRefId(t,n){return n.openapi(t)}}class nm{constructor(t){this.message=t}}class Bu extends nm{constructor(t,n){super(t),this.data=n}}class tp extends nm{constructor(t){super(`Missing parameter data, please specify \`${t.missingField}\` and other OpenAPI parameter props using the \`param\` field of \`schema.openapi\``),this.data=t}}function Lu(e,t){try{return e()}catch(n){throw n instanceof tp?new tp(Object.assign(Object.assign({},n.data),t)):n}}class HY extends nm{constructor(t){super("Unknown zod object type, please specify `type` and other OpenAPI props using `schema.openapi`."),this.data=t}}class WY{transform(t,n,r){var a,i,s,d;const l=t.def.element,c=(i=(a=t.def.checks)===null||a===void 0?void 0:a.find(m=>m._zod.def.check==="min_length"))===null||i===void 0?void 0:i._zod.def.minimum,f=(d=(s=t.def.checks)===null||s===void 0?void 0:s.find(m=>m._zod.def.check==="max_length"))===null||d===void 0?void 0:d._zod.def.maximum;return Object.assign(Object.assign({},n("array")),{items:ir(l)?r(l):{},minItems:c,maxItems:f})}}class XC{transform(t){return Object.assign(Object.assign({},t("string")),{pattern:"^\\d+$"})}}class GY{transform(t,n,r,a,i){const s=t.def.options.filter(ir),d=s.map(a);if(n)return{oneOf:r(d,n)};const l=t._zod.def.discriminator;return l?{oneOf:d,discriminator:this.mapDiscriminator(s,l,i)}:(console.error("No discriminator found for discriminated union",t),{oneOf:d})}mapDiscriminator(t,n,r){if(t.some(i=>Ut.getRefId(i)===void 0))return;const a={};for(const i of t){const s=Ut.getRefId(i),d=this.getDiscriminatorValues(i,n);for(const l of d)a[l]=r(s)}return{propertyName:n,mapping:a}}getDiscriminatorValues(t,n){var r;if(It(t,"ZodObject")){const a=(r=t.def.shape)===null||r===void 0?void 0:r[n];return a?It(a,"ZodEnum")?Object.values(a._zod.def.entries).filter(qg):It(a,"ZodLiteral")?a.def.values.filter(qg):[]:[]}if(It(t,"ZodDiscriminatedUnion")){const a=t.def.options.filter(ir);return[...new Set(a.flatMap(i=>this.getDiscriminatorValues(i,n)))]}return[]}}function YC(e){const n=Object.keys(e).filter(i=>typeof e[e[i]]!="number").map(i=>e[i]),r=n.filter(i=>typeof i=="number").length,a=r===0?"string":r===n.length?"numeric":"mixed";return{values:n,type:a}}class XY{transform(t,n,r){const{type:a,values:i}=YC(t._zod.def.entries);if(a==="mixed")throw new nm("Enum has mixed string and number values, please specify the OpenAPI type manually");return Object.assign(Object.assign({},r(a==="numeric"?"integer":"string")),{enum:n?[...i,null]:i})}}class YY{transform(t,n,r,a){const s={allOf:this.flattenIntersectionTypes(t).map(a)};return n?{anyOf:r([s],n)}:s}flattenIntersectionTypes(t){if(!It(t,"ZodIntersection"))return[t];const n=ir(t._zod.def.left)?this.flattenIntersectionTypes(t._zod.def.left):[],r=ir(t._zod.def.right)?this.flattenIntersectionTypes(t._zod.def.right):[];return[...n,...r]}}class KY{constructor(){this.bigIntTransformer=new XC}transform(t,n){const r=typeof t.def.values[0];return r==="boolean"||r==="number"||r==="string"||r==="object"?Object.assign(Object.assign({},n(r)),{enum:[t.def.values[0]]}):r==="bigint"?this.bigIntTransformer.transform(n):n("null")}}class JY{transform(t,n,r){var a;return Object.assign(Object.assign(Object.assign({},n("number")),n(t.format==="safeint"?"integer":"number")),r((a=t.def.checks)!==null&&a!==void 0?a:[]))}}class QY{transform(t,n,r,a){var i;const s=(i=Ut.getInternalMetadata(t))===null||i===void 0?void 0:i.extendedFrom,d=this.requiredKeysOf(t),l=nd(t.def.shape,a);if(!s)return Object.assign(Object.assign(Object.assign(Object.assign({},r("object")),{properties:l,default:n}),d.length>0?{required:d}:{}),this.generateAdditionalProperties(t,a));const c=s.schema;a(c);const f=this.requiredKeysOf(c),m=nd(c==null?void 0:c.def.shape,a),u=Object.fromEntries(Object.entries(l).filter(([y,w])=>!Id(m[y],w))),h=d.filter(y=>!f.includes(y)),g=Object.assign(Object.assign(Object.assign(Object.assign({},r("object")),{default:n,properties:u}),h.length>0?{required:h}:{}),this.generateAdditionalProperties(t,a));return{allOf:[{$ref:`#/components/schemas/${s.refId}`},g]}}generateAdditionalProperties(t,n){const r=t.def.catchall;return r?It(r,"ZodNever")?{additionalProperties:!1}:ir(r)?{additionalProperties:n(r)}:{}:{}}requiredKeysOf(t){return Object.entries(t.def.shape).filter(([n,r])=>!WC(r)).map(([n,r])=>n)}}class eK{transform(t,n,r){const a=t.valueType,i=t.keyType,s=ir(a)?r(a):{};if(It(i,"ZodEnum")){const l=Object.values(i._zod.def.entries).filter(qg).reduce((c,f)=>Object.assign(Object.assign({},c),{[f]:s}),{});return Object.assign(Object.assign({},n("object")),{properties:l})}return Object.assign(Object.assign({},n("object")),{additionalProperties:s})}}function tK(e){return e._zod.def.check==="length_equals"}function nK(e){return e._zod.def.check==="string_format"&&e._zod.def.format==="regex"}class rK{transform(t,n){var r,a,i,s;const d=(r=t.def.checks)===null||r===void 0?void 0:r.find(nK),l=d==null?void 0:d._zod.def.pattern.toString().replace(/^\/|\/$/g,""),c=(a=t.def.checks)===null||a===void 0?void 0:a.find(tK),f=c==null?void 0:c._zod.def.length,m=Number.isFinite(t.minLength)&&(i=t.minLength)!==null&&i!==void 0?i:void 0,u=Number.isFinite(t.maxLength)&&(s=t.maxLength)!==null&&s!==void 0?s:void 0;return Object.assign(Object.assign({},n("string")),{minLength:f??m,maxLength:f??u,format:this.mapStringFormat(t),pattern:l})}mapStringFormat(t){if(t.format==="uuid"||t.format==="guid")return"uuid";if(t.format==="email")return"email";if(t.format==="url")return"uri";if(t.format==="date")return"date";if(t.format==="datetime")return"date-time";if(t.format==="time")return"time";if(t.format==="duration")return"duration";if(t.format==="cuid")return"cuid";if(t.format==="cuid2")return"cuid2";if(t.format==="ulid")return"ulid";if(t.format==="ipv4"||t.format==="ipv6")return"ip";if(t.format==="cidrv4")return"ipv4-cidr";if(t.format==="cidrv6")return"ipv6-cidr";if(t.format==="base64url")return"base64url";if(t.format==="emoji")return"emoji"}}class aK{constructor(t){this.versionSpecifics=t}transform(t,n,r){const i=t._zod.def.items.map(s=>ir(s)?r(s):{});return Object.assign(Object.assign({},n("array")),this.versionSpecifics.mapTupleItems(i))}}class oK{constructor(t){this.options=t}transform(t,n,r){var a,i,s;const d=Ut.getInternalMetadata(t),l=(s=(a=d==null?void 0:d.unionPreferredType)!==null&&a!==void 0?a:(i=this.options)===null||i===void 0?void 0:i.unionPreferredType)!==null&&s!==void 0?s:"anyOf",f=this.flattenUnionTypes(t).map(m=>{const u=this.unwrapNullable(m);return r(u)});return{[l]:n(f)}}flattenUnionTypes(t){return It(t,"ZodUnion")?t.def.options.flatMap(r=>ir(r)?this.flattenUnionTypes(r):[]):[t]}unwrapNullable(t){if(It(t,"ZodNullable")){const n=t.unwrap();if(ir(n))return this.unwrapNullable(n)}return t}}class iK{transform(t){return Object.assign(Object.assign({},t("string")),{format:"date-time"})}}class rm{transform(t,n,r,a){const i=n(t._zod.def.getter());return rm.mapRecursive(i,r,a)}static mapRecursive(t,n,r){return"$ref"in t?r(t):t.type?Object.assign(Object.assign({},t),n(t.type)):t}}class sK{transform(t,n){const a=t.def.parts.map(i=>this.generatePattern(i)).join("");return Object.assign(Object.assign({},n("string")),{pattern:`^${a}$`})}generatePattern(t){if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t===null||t===void 0)return this.escapeRegex(String(t));if(It(t,"ZodLiteral")){const n=t.def.values[0];return this.escapeRegex(String(n))}if(It(t,"ZodNumber"))return"[+-]?\\d+(\\.\\d+)?";if(It(t,"ZodBoolean"))return"(true|false)";if(It(t,"ZodEnum")){const{values:n}=YC(t.def.entries);return`(${n.map(r=>this.escapeRegex(String(r))).join("|")})`}return".*"}escapeRegex(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}class lK{constructor(t,n){this.versionSpecifics=t,this.objectTransformer=new QY,this.stringTransformer=new rK,this.numberTransformer=new JY,this.bigIntTransformer=new XC,this.dateTransformer=new iK,this.lazyTransformer=new rm,this.literalTransformer=new KY,this.templateLiteralTransformer=new sK,this.enumTransformer=new XY,this.arrayTransformer=new WY,this.discriminatedUnionTransformer=new GY,this.intersectionTransformer=new YY,this.recordTransformer=new eK,this.tupleTransformer=new aK(t),this.unionTransformer=new oK(n)}transform(t,n,r,a,i){if(It(t,"ZodNull"))return this.versionSpecifics.nullType;if(It(t,"ZodUnknown")||It(t,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,n);if(It(t,"ZodObject"))return this.objectTransformer.transform(t,i,d=>this.versionSpecifics.mapNullableType(d,n),r);const s=this.transformSchemaWithoutDefault(t,n,r,a);return Object.assign(Object.assign({},s),{default:i})}transformSchemaWithoutDefault(t,n,r,a){if(It(t,"ZodUnknown")||It(t,"ZodAny"))return this.versionSpecifics.mapNullableType(void 0,n);if(It(t,"ZodString"))return this.stringTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n));if(It(t,"ZodNumber"))return this.numberTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n),s=>this.versionSpecifics.getNumberChecks(s));if(It(t,"ZodBigInt"))return this.bigIntTransformer.transform(s=>this.versionSpecifics.mapNullableType(s,n));if(It(t,"ZodBoolean"))return this.versionSpecifics.mapNullableType("boolean",n);if(It(t,"ZodLazy"))return this.lazyTransformer.transform(t,r,s=>this.versionSpecifics.mapNullableType(s,n),s=>this.versionSpecifics.mapNullableOfRef(s,n));if(It(t,"ZodLiteral"))return this.literalTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n));if(It(t,"ZodTemplateLiteral"))return this.templateLiteralTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n));if(It(t,"ZodEnum"))return this.enumTransformer.transform(t,n,s=>this.versionSpecifics.mapNullableType(s,n));if(It(t,"ZodArray"))return this.arrayTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n),r);if(It(t,"ZodTuple"))return this.tupleTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n),r);if(It(t,"ZodDiscriminatedUnion"))return this.discriminatedUnionTransformer.transform(t,n,s=>this.versionSpecifics.mapNullableOfArray(s,n),r,a);if(It(t,"ZodUnion"))return this.unionTransformer.transform(t,s=>this.versionSpecifics.mapNullableOfArray(s,n),r);if(It(t,"ZodIntersection"))return this.intersectionTransformer.transform(t,n,s=>this.versionSpecifics.mapNullableOfArray(s,n),r);if(It(t,"ZodRecord"))return this.recordTransformer.transform(t,s=>this.versionSpecifics.mapNullableType(s,n),r);if(It(t,"ZodDate"))return this.dateTransformer.transform(s=>this.versionSpecifics.mapNullableType(s,n));const i=Ut.getRefId(t);throw new HY({currentSchema:t.def,schemaName:i})}}class Xb{constructor(t,n,r){this.definitions=t,this.versionSpecifics=n,this.options=r,this.schemaRefs={},this.paramRefs={},this.pathRefs={},this.rawComponents=[],this.openApiTransformer=new lK(n,r),this.sortDefinitions()}generateDocumentData(){return this.definitions.forEach(t=>this.generateSingle(t)),{components:this.buildComponents(),paths:this.pathRefs}}generateComponents(){return this.definitions.forEach(t=>this.generateSingle(t)),{components:this.buildComponents()}}buildComponents(){var t,n,r,a;const i={};this.rawComponents.forEach(({componentType:u,name:h,component:g})=>{var y;(y=i[u])!==null&&y!==void 0||(i[u]={}),i[u][h]=g});const s=(t=i.schemas)!==null&&t!==void 0?t:{},d=Object.assign(Object.assign({},s),this.filteredSchemaRefs),l=((n=this.options)===null||n===void 0?void 0:n.sortComponents)==="alphabetically"?g8(d):d,c=(r=i.parameters)!==null&&r!==void 0?r:{},f=Object.assign(Object.assign({},c),this.paramRefs),m=((a=this.options)===null||a===void 0?void 0:a.sortComponents)==="alphabetically"?g8(f):f;return Object.assign(Object.assign({},i),{schemas:l,parameters:m})}isNotPendingRefEntry(t){return t[1]!=="pending"}get filteredSchemaRefs(){const t=Object.entries(this.schemaRefs).filter(this.isNotPendingRefEntry);return Object.fromEntries(t)}sortDefinitions(){const t=["schema","parameter","component","route","webhook"];this.definitions.sort((n,r)=>{if(!("type"in n))return"type"in r?-1:0;if(!("type"in r))return 1;const a=t.findIndex(s=>s===n.type),i=t.findIndex(s=>s===r.type);return a-i})}generateSingle(t){if(!("type"in t)){this.generateSchemaWithRef(t);return}switch(t.type){case"parameter":this.generateParameterDefinition(t.schema);return;case"schema":this.generateSchemaWithRef(t.schema);return;case"route":this.generateSingleRoute(t.route);return;case"component":this.rawComponents.push(t);return}}generateParameterDefinition(t){const n=Ut.getRefId(t),r=this.generateParameter(t);return n&&(this.paramRefs[n]=r),r}getParameterRef(t,n){const r=Ut.getOpenApiMetadata(t),a=Ut.getInternalMetadata(t),i=r==null?void 0:r.param,s=a!=null&&a.refId?this.paramRefs[a.refId]:void 0;if(!(!(a!=null&&a.refId)||!s)){if(i&&s.in!==i.in||n!=null&&n.in&&s.in!==n.in)throw new Bu(`Conflicting location for parameter ${s.name}`,{key:"in",values:h8([s.in,n==null?void 0:n.in,i==null?void 0:i.in])});if(i&&s.name!==i.name||n!=null&&n.name&&s.name!==(n==null?void 0:n.name))throw new Bu("Conflicting names for parameter",{key:"name",values:h8([s.name,n==null?void 0:n.name,i==null?void 0:i.name])});return{$ref:`#/components/parameters/${a.refId}`}}}generateInlineParameters(t,n){const r=Ut.getOpenApiMetadata(t),a=r==null?void 0:r.param,i=this.getParameterRef(t,{in:n});if(i)return[i];if(It(t,"ZodObject")){const s=t.def.shape;return Object.entries(s).map(([l,c])=>{var f;const m=Ut.getOpenApiMetadata(c),u=this.getParameterRef(c,{in:n,name:l});if(u)return u;const h=m==null?void 0:m.param;if(h!=null&&h.name&&h.name!==l)throw new Bu("Conflicting names for parameter",{key:"name",values:[l,h.name]});if(h!=null&&h.in&&h.in!==n)throw new Bu(`Conflicting location for parameter ${(f=h.name)!==null&&f!==void 0?f:l}`,{key:"in",values:[n,h.in]});return this.generateParameter(c,{name:l,in:n})})}if(a!=null&&a.in&&a.in!==n)throw new Bu(`Conflicting location for parameter ${a.name}`,{key:"in",values:[n,a.in]});return[this.generateParameter(t,{in:n})]}generateSimpleParameter(t,n){const r=Ut.getParamMetadata(t),a=r==null?void 0:r.param,i=Object.assign(Object.assign({},a),n),s=!WC(t)&&!Au(t),d=this.generateSchemaWithRef(t);return Object.assign({schema:d,required:s},Object.keys(i).length>0?Ut.buildParameterMetadata(i):{})}generateParameter(t,n){var r,a;const i=Ut.getOpenApiMetadata(t),s=i==null?void 0:i.param,d=(r=n==null?void 0:n.name)!==null&&r!==void 0?r:s==null?void 0:s.name,l=(a=n==null?void 0:n.in)!==null&&a!==void 0?a:s==null?void 0:s.in;if(!d)throw new tp({missingField:"name"});if(!l)throw new tp({missingField:"in",paramName:d});const c=this.generateSimpleParameter(t,n);return Object.assign(Object.assign({},c),{in:l,name:d})}generateSchemaWithMetadata(t){const n=Ut.unwrapChained(t),r=Ut.getOpenApiMetadata(t),a=Ut.getDefaultValue(t),i=Ut.getRefId(t);if(i&&typeof this.schemaRefs[i]=="object")return this.schemaRefs[i];if(i&&this.schemaRefs[i]==="pending"){const d={$ref:this.generateSchemaRef(i)};return this.versionSpecifics.mapNullableOfRef(d,Au(t))}i&&!this.schemaRefs[i]&&(this.schemaRefs[i]="pending");const s=r!=null&&r.type?{type:r.type}:this.toOpenAPISchema(n,Au(t),a);return r?Ut.applySchemaMetadata(s,r):fl(s,_c)}constructReferencedOpenAPISchema(t){const n=Ut.getOpenApiMetadata(t),r=Ut.unwrapChained(t),a=Ut.getDefaultValue(t),i=Au(t);if(n!=null&&n.type)return this.versionSpecifics.mapNullableType(n.type,i);const s=Ut.getRefId(t);if(s&&typeof this.schemaRefs[s]=="object")return rm.mapRecursive(this.schemaRefs[s],d=>this.versionSpecifics.mapNullableType(d,i),d=>this.versionSpecifics.mapNullableOfRef(d,i));if(s&&this.schemaRefs[s]==="pending"){const d={$ref:this.generateSchemaRef(s)};return this.versionSpecifics.mapNullableOfRef(d,i)}return s&&!this.schemaRefs[s]&&(this.schemaRefs[s]="pending"),this.toOpenAPISchema(r,i,a)}generateSimpleSchema(t){const n=Ut.getOpenApiMetadata(t),r=Ut.getRefId(t);if(!r||!this.schemaRefs[r])return this.generateSchemaWithMetadata(t);const a=this.schemaRefs[r],i={$ref:this.generateSchemaRef(r)};if(this.schemaRefs[r]==="pending")return this.versionSpecifics.mapNullableOfRef(i,Au(t));const s=fl(Ut.buildSchemaMetadata(n??{}),(c,f)=>c===void 0||Id(c,a[f]));if(s.type)return{allOf:[i,s]};const d=fl(this.constructReferencedOpenAPISchema(t),(c,f)=>c===void 0||Id(c,a[f])),l=Ut.applySchemaMetadata(d,s);return Object.keys(l).length>0?{allOf:[i,l]}:i}generateSchemaWithRef(t){const n=Ut.getRefId(t);return n&&!this.schemaRefs[n]?(this.schemaRefs[n]=this.generateSimpleSchema(t),{$ref:this.generateSchemaRef(n)}):this.generateSimpleSchema(t)}generateSchemaRef(t){return`#/components/schemas/${t}`}getRequestBody(t){if(!t)return;const{content:n}=t,r=xo(t,["content"]),a=this.getBodyContent(n);return Object.assign(Object.assign({},r),{content:a})}getParameters(t){if(!t)return[];const{headers:n}=t,r=this.cleanParameter(t.query),a=this.cleanParameter(t.params),i=this.cleanParameter(t.cookies),s=Lu(()=>r?this.generateInlineParameters(r,"query"):[],{location:"query"}),d=Lu(()=>a?this.generateInlineParameters(a,"path"):[],{location:"path"}),l=Lu(()=>i?this.generateInlineParameters(i,"cookie"):[],{location:"cookie"}),c=Lu(()=>{if(Array.isArray(n))return n.flatMap(m=>this.generateInlineParameters(m,"header"));const f=this.cleanParameter(n);return f?this.generateInlineParameters(f,"header"):[]},{location:"header"});return[...d,...s,...c,...l]}cleanParameter(t){if(t){if(It(t,"ZodPipe")){const n=t._zod.def.in,r=t._zod.def.out;return It(n,"ZodObject")?this.cleanParameter(n):It(r,"ZodObject")?this.cleanParameter(r):void 0}return t}}generatePath(t){const{method:n,path:r,request:a,responses:i}=t,s=xo(t,["method","path","request","responses"]),d=nd(i,m=>this.getResponse(m)),l=Lu(()=>this.getParameters(a),{route:`${n} ${r}`}),c=this.getRequestBody(a==null?void 0:a.body);return{[n]:Object.assign(Object.assign(Object.assign(Object.assign({},s),l.length>0?{parameters:[...s.parameters||[],...l]}:{}),c?{requestBody:c}:{}),{responses:d})}}generateSingleRoute(t){const n=this.generatePath(t);return this.pathRefs[t.path]=Object.assign(Object.assign({},this.pathRefs[t.path]),n),n}getResponse(t){if(this.isReferenceObject(t))return t;const{content:n,headers:r}=t,a=xo(t,["content","headers"]),i=n?{content:this.getBodyContent(n)}:{};if(!r)return Object.assign(Object.assign({},a),i);const s=It(r,"ZodObject")?this.getResponseHeaders(r):r;return Object.assign(Object.assign(Object.assign({},a),{headers:s}),i)}isReferenceObject(t){return"$ref"in t}getResponseHeaders(t){const n=t.def.shape;return nd(n,a=>this.generateSimpleParameter(a))}getBodyContent(t){return nd(t,n=>{if(!n||"$ref"in n)return n;const{schema:r,itemSchema:a}=n,i=xo(n,["schema","itemSchema"]),s=typeof r=="object"&&ir(r)?this.generateSchemaWithRef(r):r,d=typeof a=="object"&&ir(a)?this.generateSchemaWithRef(a):a;return Object.assign(Object.assign(Object.assign({},i),s!==void 0?{schema:s}:{}),d!==void 0?{itemSchema:d}:{})})}toOpenAPISchema(t,n,r){return this.openApiTransformer.transform(t,n,i=>this.generateSchemaWithRef(i),i=>this.generateSchemaRef(i),r)}}class cK{get nullType(){return{nullable:!0}}mapNullableOfArray(t,n){return n&&!t.some(r=>Id(r,this.nullType))?[...t,this.nullType]:t}mapNullableType(t,n){return Object.assign(Object.assign({},t?{type:t}:void 0),n?this.nullType:void 0)}mapNullableOfRef(t,n){return n?{allOf:[t,this.nullType]}:t}mapTupleItems(t){const n=GC(t);return{items:n.length===1?n[0]:{anyOf:n},minItems:t.length,maxItems:t.length}}getNumberChecks(t){return Object.assign({},...t.map(n=>{switch(n._zod.def.check){case"greater_than":{const r=n;return r._zod.def.inclusive?{minimum:Number(r._zod.def.value)}:{minimum:Number(r._zod.def.value),exclusiveMinimum:!0}}case"less_than":{const r=n;return r._zod.def.inclusive?{maximum:Number(r._zod.def.value)}:{maximum:Number(r._zod.def.value),exclusiveMaximum:!r._zod.def.inclusive}}default:return{}}}))}}class uK{constructor(t,n){const r=new cK;this.generator=new Xb(t,r,n)}generateDocument(t){const n=this.generator.generateDocumentData();return Object.assign(Object.assign({},t),n)}generateComponents(){return this.generator.generateComponents()}}class KC{get nullType(){return{type:"null"}}mapNullableOfArray(t,n){return n&&!t.some(r=>Id(r,this.nullType))?[...t,this.nullType]:t}mapNullableType(t,n){if(!t)return{};if(n){const r=Array.isArray(t)?t:[t];return{type:GC([...r,"null"])}}return{type:t}}mapNullableOfRef(t,n){return n?{oneOf:[t,this.nullType]}:t}mapTupleItems(t){return{prefixItems:t}}getNumberChecks(t){return Object.assign({},...t.map(n=>{switch(n._zod.def.check){case"greater_than":{const r=n;return r._zod.def.inclusive?{minimum:Number(r._zod.def.value)}:{exclusiveMinimum:Number(r._zod.def.value)}}case"less_than":{const r=n;return r._zod.def.inclusive?{maximum:Number(r._zod.def.value)}:{exclusiveMaximum:Number(r._zod.def.value)}}default:return{}}}))}}function dK(e){return"type"in e&&e.type==="webhook"}class fK{constructor(t,n){this.definitions=t,this.webhookRefs={};const r=new KC;this.generator=new Xb(this.definitions,r,n)}generateDocument(t){this.generateWebhooks();const n=this.generator.generateDocumentData();return Object.assign(Object.assign(Object.assign({},t),n),{webhooks:this.webhookRefs})}generateComponents(){return this.generator.generateComponents()}generateWebhooks(){this.webhookRefs={},this.definitions.filter(dK).forEach(t=>this.generateSingleWebhook(t.webhook))}generateSingleWebhook(t){const n=this.generator.generatePath(t);return this.webhookRefs[t.path]=Object.assign(Object.assign({},this.webhookRefs[t.path]),n),n}}function pK(e){return"type"in e&&e.type==="webhook"}class mK{constructor(t,n){this.definitions=t,this.webhookRefs={};const r=new KC;this.generator=new Xb(this.definitions,r,n)}generateDocument(t){this.generateWebhooks();const n=this.generator.generateDocumentData();return Object.assign(Object.assign(Object.assign({},t),n),{webhooks:this.webhookRefs})}generateComponents(){return this.generator.generateComponents()}generateWebhooks(){this.webhookRefs={},this.definitions.filter(pK).forEach(t=>this.generateSingleWebhook(t.webhook))}generateSingleWebhook(t){const n=this.generator.generatePath(t);return this.webhookRefs[t.path]=Object.assign(Object.assign({},this.webhookRefs[t.path]),n),n}}const hK=Object.freeze(Object.defineProperty({__proto__:null,OpenAPIRegistry:qY,OpenApiGeneratorV3:uK,OpenApiGeneratorV31:fK,OpenApiGeneratorV32:mK,extendZodWithOpenApi:FY,getOpenApiMetadata:UY,getRefId:ZY,zodToOpenAPIRegistry:Hg},Symbol.toStringTag,{value:"Module"})),gK=R9(hK);var JC={},Yb=Object.defineProperty,vK=Object.getOwnPropertyDescriptor,bK=Object.getOwnPropertyNames,yK=Object.prototype.hasOwnProperty,wK=(e,t)=>{for(var n in t)Yb(e,n,{get:t[n],enumerable:!0})},xK=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of bK(t))!yK.call(e,a)&&a!==n&&Yb(e,a,{get:()=>t[a],enumerable:!(r=vK(t,a))||r.enumerable});return e},CK=e=>xK(Yb({},"__esModule",{value:!0}),e),QC={};wK(QC,{checkOptionalParameter:()=>AK,decodeURIComponent_:()=>iS,getPath:()=>nS,getPathNoStrict:()=>IK,getPattern:()=>EK,getQueryParam:()=>BK,getQueryParams:()=>LK,getQueryStrings:()=>zK,mergePath:()=>rS,splitPath:()=>eS,splitRoutingPath:()=>SK,tryDecode:()=>Kb,tryDecodeURI:()=>tS,tryDecodeURIComponent:()=>aS});var Al=CK(QC);const eS=e=>{const t=e.split("/");return t[0]===""&&t.shift(),t},SK=e=>{const{groups:t,path:n}=kK(e),r=eS(n);return _K(r,t)},kK=e=>{const t=[];return e=e.replace(/\{[^}]+\}/g,(n,r)=>{const a=`@${r}`;return t.push([a,n]),a}),{groups:t,path:e}},_K=(e,t)=>{for(let n=t.length-1;n>=0;n--){const[r]=t[n];for(let a=e.length-1;a>=0;a--)if(e[a].includes(r)){e[a]=e[a].replace(r,t[n][1]);break}}return e},Tf={},EK=(e,t)=>{if(e==="*")return"*";const n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){const r=`${e}#${t}`;return Tf[r]||(n[2]?Tf[r]=t&&t[0]!==":"&&t[0]!=="*"?[r,n[1],new RegExp(`^${n[2]}(?=/${t})`)]:[e,n[1],new RegExp(`^${n[2]}$`)]:Tf[r]=[e,n[1],!0]),Tf[r]}return null},Kb=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,n=>{try{return t(n)}catch{return n}})}},tS=e=>Kb(e,decodeURI),nS=e=>{const t=e.url,n=t.indexOf("/",t.indexOf(":")+4);let r=n;for(;r<t.length;r++){const a=t.charCodeAt(r);if(a===37){const i=t.indexOf("?",r),s=t.indexOf("#",r),d=i===-1?s===-1?void 0:s:s===-1?i:Math.min(i,s),l=t.slice(n,d);return tS(l.includes("%25")?l.replace(/%25/g,"%2525"):l)}else if(a===63||a===35)break}return t.slice(n,r)},zK=e=>{const t=e.indexOf("?",8);if(t===-1)return"";const n=e.indexOf("#",8);return n===-1?e.slice(t):t<n?e.slice(t,n):""},IK=e=>{const t=nS(e);return t.length>1&&t.at(-1)==="/"?t.slice(0,-1):t},rS=(e,t,...n)=>(n.length&&(t=rS(t,...n)),`${(e==null?void 0:e[0])==="/"?"":"/"}${e}${t==="/"?"":`${(e==null?void 0:e.at(-1))==="/"?"":"/"}${(t==null?void 0:t[0])==="/"?t.slice(1):t}`}`),AK=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;const t=e.split("/"),n=[];let r="";return t.forEach(a=>{if(a!==""&&!/\:/.test(a))r+="/"+a;else if(/\:/.test(a))if(a.charCodeAt(a.length-1)===63){n.length===0&&r===""?n.push("/"):n.push(r);const i=a.slice(0,-1);r+="/"+i,n.push(r)}else r+="/"+a}),n.filter((a,i,s)=>s.indexOf(a)===i)},aS=e=>e.indexOf("%")!==-1?Kb(e,iS):e,k2=e=>(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),aS(e)),oS=(e,t,n)=>{const r=e.indexOf("#",8);r!==-1&&(e=e.slice(0,r));let a;if(!n&&t&&t.indexOf("%")===-1&&t.indexOf("+")===-1){let d=e.indexOf("?",8);if(d===-1)return;for(e.startsWith(t,d+1)||(d=e.indexOf(`&${t}`,d+1));d!==-1;){const l=e.charCodeAt(d+t.length+1);if(l===61){const c=d+t.length+2,f=e.indexOf("&",c);return k2(e.slice(c,f===-1?void 0:f))}else if(l==38||isNaN(l))return"";d=e.indexOf(`&${t}`,d+1)}if(a=/[%+]/.test(e),!a)return}const i=Object.create(null);a??(a=/[%+]/.test(e));let s=e.indexOf("?",8);for(;s!==-1;){const d=e.indexOf("&",s+1);let l=e.indexOf("=",s);l>d&&d!==-1&&(l=-1);let c=e.slice(s+1,l===-1?d===-1?void 0:d:l);if(a&&(c=k2(c)),s=d,c==="")continue;let f;l===-1?f="":(f=e.slice(l+1,d===-1?void 0:d),a&&(f=k2(f))),n?(i[c]&&Array.isArray(i[c])||(i[c]=[]),i[c].push(f)):i[c]??(i[c]=f)}return t?i[t]:i},BK=oS,LK=(e,t)=>oS(e,t,!0),iS=decodeURIComponent;var Jb=Object.defineProperty,OK=Object.getOwnPropertyDescriptor,PK=Object.getOwnPropertyNames,MK=Object.prototype.hasOwnProperty,TK=(e,t)=>{for(var n in t)Jb(e,n,{get:t[n],enumerable:!0})},DK=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of PK(t))!MK.call(e,a)&&a!==n&&Jb(e,a,{get:()=>t[a],enumerable:!(r=OK(t,a))||r.enumerable});return e},$K=e=>DK(Jb({},"__esModule",{value:!0}),e),sS={};TK(sS,{parse:()=>cS,parseSigned:()=>qK,serialize:()=>HK,serializeSigned:()=>WK});var NK=$K(sS),jK=Al;const Qb={name:"HMAC",hash:"SHA-256"},lS=async e=>{const t=typeof e=="string"?new TextEncoder().encode(e):e;return await crypto.subtle.importKey("raw",t,Qb,!1,["sign","verify"])},RK=async(e,t)=>{const n=await lS(t),r=await crypto.subtle.sign(Qb.name,n,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(r)))},FK=async(e,t,n)=>{try{const r=atob(e),a=new Uint8Array(r.length);for(let i=0,s=r.length;i<s;i++)a[i]=r.charCodeAt(i);return await crypto.subtle.verify(Qb,n,a,new TextEncoder().encode(t))}catch{return!1}},VK=/^[\w!#$%&'*.^`|~+-]+$/,UK=/^[!#-:<>-[\]-~]+$/,ZK=/^[ !#-:<-[\]-~]*$/,v8=e=>{let t=0,n=e.length;for(;t<n;){const r=e.charCodeAt(t);if(r!==32&&r!==9)break;t++}for(;n>t;){const r=e.charCodeAt(n-1);if(r!==32&&r!==9)break;n--}return t===0&&n===e.length?e:e.slice(t,n)},cS=(e,t)=>{if(t&&e.indexOf(t)===-1)return{};const n=e.split(";"),r=Object.create(null);for(const a of n){const i=a.indexOf("=");if(i===-1)continue;const s=v8(a.substring(0,i));if(t&&t!==s||!UK.test(s)||s in r)continue;let d=v8(a.substring(i+1));if(d.startsWith('"')&&d.endsWith('"')&&(d=d.slice(1,-1)),ZK.test(d)&&(r[s]=(0,jK.tryDecodeURIComponent)(d),t))break}return r},qK=async(e,t,n)=>{const r=Object.create(null),a=await lS(t);for(const[i,s]of Object.entries(cS(e,n))){const d=s.lastIndexOf(".");if(d<0)continue;const l=s.substring(0,d),c=s.substring(d+1);if(c.length!==44||!c.endsWith("="))continue;const f=await FK(c,l,a);r[i]=f?l:!1}return r},uS=(e,t,n={})=>{if(!VK.test(e))throw new Error("Invalid cookie name");let r=`${e}=${t}`;if(e.startsWith("__Secure-")&&!n.secure)throw new Error("__Secure- Cookie must have Secure attributes");if(e.startsWith("__Host-")){if(!n.secure)throw new Error("__Host- Cookie must have Secure attributes");if(n.path!=="/")throw new Error('__Host- Cookie must have Path attributes with "/"');if(n.domain)throw new Error("__Host- Cookie must not have Domain attributes")}for(const a of["domain","path","sameSite","priority"])if(n[a]&&/[;\r\n]/.test(n[a]))throw new Error(`${a} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge=="number"&&n.maxAge>=0){if(n.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!=="host"&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+="; HttpOnly"),n.secure&&(r+="; Secure"),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw new Error("Partitioned Cookie must have Secure attributes");r+="; Partitioned"}return r},HK=(e,t,n)=>(t=encodeURIComponent(t),uS(e,t,n)),WK=async(e,t,n,r={})=>{const a=await RK(t,n);return t=`${t}.${a}`,t=encodeURIComponent(t),uS(e,t,r)};var e3=Object.defineProperty,GK=Object.getOwnPropertyDescriptor,XK=Object.getOwnPropertyNames,YK=Object.prototype.hasOwnProperty,KK=(e,t)=>{for(var n in t)e3(e,n,{get:t[n],enumerable:!0})},JK=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of XK(t))!YK.call(e,a)&&a!==n&&e3(e,a,{get:()=>t[a],enumerable:!(r=GK(t,a))||r.enumerable});return e},QK=e=>JK(e3({},"__esModule",{value:!0}),e),dS={};KK(dS,{deleteCookie:()=>rJ,generateCookie:()=>pS,generateSignedCookie:()=>hS,getCookie:()=>fS,getSignedCookie:()=>tJ,setCookie:()=>mS,setSignedCookie:()=>nJ});var eJ=QK(dS),Ao=NK;const fS=(e,t,n)=>{const r=e.req.raw.headers.get("Cookie");if(typeof t=="string"){if(!r)return;let i=t;return n==="secure"?i="__Secure-"+t:n==="host"&&(i="__Host-"+t),(0,Ao.parse)(r,i)[i]}return r?(0,Ao.parse)(r):{}},tJ=async(e,t,n,r)=>{const a=e.req.raw.headers.get("Cookie");if(typeof n=="string"){if(!a)return;let s=n;return r==="secure"?s="__Secure-"+n:r==="host"&&(s="__Host-"+n),(await(0,Ao.parseSigned)(a,t,s))[s]}return a?await(0,Ao.parseSigned)(a,t):{}},pS=(e,t,n)=>{let r;return(n==null?void 0:n.prefix)==="secure"?r=(0,Ao.serialize)("__Secure-"+e,t,{path:"/",...n,secure:!0}):(n==null?void 0:n.prefix)==="host"?r=(0,Ao.serialize)("__Host-"+e,t,{...n,path:"/",secure:!0,domain:void 0}):r=(0,Ao.serialize)(e,t,{path:"/",...n}),r},mS=(e,t,n,r)=>{const a=pS(t,n,r);e.header("Set-Cookie",a,{append:!0})},hS=async(e,t,n,r)=>{let a;return(r==null?void 0:r.prefix)==="secure"?a=await(0,Ao.serializeSigned)("__Secure-"+e,t,n,{path:"/",...r,secure:!0}):(r==null?void 0:r.prefix)==="host"?a=await(0,Ao.serializeSigned)("__Host-"+e,t,n,{...r,path:"/",secure:!0,domain:void 0}):a=await(0,Ao.serializeSigned)(e,t,n,{path:"/",...r}),a},nJ=async(e,t,n,r,a)=>{const i=await hS(t,n,r,a);e.header("set-cookie",i,{append:!0})},rJ=(e,t,n)=>{const r=fS(e,t,n==null?void 0:n.prefix);return mS(e,t,"",{...n,maxAge:0}),r};var t3=Object.defineProperty,aJ=Object.getOwnPropertyDescriptor,oJ=Object.getOwnPropertyNames,iJ=Object.prototype.hasOwnProperty,sJ=(e,t)=>{for(var n in t)t3(e,n,{get:t[n],enumerable:!0})},lJ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of oJ(t))!iJ.call(e,a)&&a!==n&&t3(e,a,{get:()=>t[a],enumerable:!(r=aJ(t,a))||r.enumerable});return e},cJ=e=>lJ(t3({},"__esModule",{value:!0}),e),gS={};sJ(gS,{HTTPException:()=>uJ});var vS=cJ(gS);class uJ extends Error{constructor(n=500,r){super(r==null?void 0:r.message,{cause:r==null?void 0:r.cause});ve(this,"res");ve(this,"status");this.res=r==null?void 0:r.res,this.status=n}getResponse(){return this.res?new Response(this.res.body,{status:this.status,headers:this.res.headers}):new Response(this.message,{status:this.status})}}var n3=Object.defineProperty,dJ=Object.getOwnPropertyDescriptor,fJ=Object.getOwnPropertyNames,pJ=Object.prototype.hasOwnProperty,mJ=(e,t)=>{for(var n in t)n3(e,n,{get:t[n],enumerable:!0})},hJ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of fJ(t))!pJ.call(e,a)&&a!==n&&n3(e,a,{get:()=>t[a],enumerable:!(r=dJ(t,a))||r.enumerable});return e},gJ=e=>hJ(n3({},"__esModule",{value:!0}),e),bS={};mJ(bS,{createHash:()=>am,md5:()=>wJ,sha1:()=>yJ,sha256:()=>bJ});var vJ=gJ(bS);const bJ=async e=>await am(e,{name:"SHA-256"}),yJ=async e=>await am(e,{name:"SHA-1"}),wJ=async e=>await am(e,{name:"MD5"}),am=async(e,t)=>{let n;if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer?n=e:(typeof e=="object"&&(e=JSON.stringify(e)),n=new TextEncoder().encode(String(e))),crypto&&crypto.subtle){const r=await crypto.subtle.digest({name:t.name},n);return Array.prototype.map.call(new Uint8Array(r),i=>("00"+i.toString(16)).slice(-2)).join("")}return null};var r3=Object.defineProperty,xJ=Object.getOwnPropertyDescriptor,CJ=Object.getOwnPropertyNames,SJ=Object.prototype.hasOwnProperty,kJ=(e,t)=>{for(var n in t)r3(e,n,{get:t[n],enumerable:!0})},_J=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of CJ(t))!SJ.call(e,a)&&a!==n&&r3(e,a,{get:()=>t[a],enumerable:!(r=xJ(t,a))||r.enumerable});return e},EJ=e=>_J(r3({},"__esModule",{value:!0}),e),yS={};kJ(yS,{bufferToFormData:()=>BJ,bufferToString:()=>AJ,equal:()=>zJ,timingSafeEqual:()=>IJ});var wS=EJ(yS),xS=vJ;const zJ=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e),r=new DataView(t);let a=n.byteLength;for(;a--;)if(n.getUint8(a)!==r.getUint8(a))return!1;return!0},b8=(e,t)=>{const n=e.length,r=t.length,a=Math.max(n,r);let i=n^r;for(let s=0;s<a;s++){const d=s<n?e.charCodeAt(s):0,l=s<r?t.charCodeAt(s):0;i|=d^l}return i===0},y8=async(e,t,n)=>{n||(n=xS.sha256);const[r,a]=await Promise.all([n(e),n(t)]);if(r==null||a==null||typeof r!="string"||typeof a!="string")return!1;const i=b8(r,a),s=b8(e,t);return i&&s},IJ=async(e,t,n)=>{if(typeof e=="string"&&typeof t=="string")return y8(e,t,n);n||(n=xS.sha256);const[r,a]=await Promise.all([n(e),n(t)]);return!r||!a||typeof r!="string"||typeof a!="string"?!1:y8(r,a)},AJ=e=>e instanceof ArrayBuffer?new TextDecoder("utf-8").decode(e):e,BJ=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,r=>r.toLowerCase())}}).formData();var a3=Object.defineProperty,LJ=Object.getOwnPropertyDescriptor,OJ=Object.getOwnPropertyNames,PJ=Object.prototype.hasOwnProperty,MJ=(e,t)=>{for(var n in t)a3(e,n,{get:t[n],enumerable:!0})},TJ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of OJ(t))!PJ.call(e,a)&&a!==n&&a3(e,a,{get:()=>t[a],enumerable:!(r=LJ(t,a))||r.enumerable});return e},DJ=e=>TJ(a3({},"__esModule",{value:!0}),e),CS={};MJ(CS,{validator:()=>UJ});var $J=DJ(CS),NJ=eJ,w8=vS,jJ=wS;const RJ=/^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,FJ=/^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/i,VJ=/^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/i,UJ=(e,t)=>async(n,r)=>{let a={};const i=n.req.header("Content-Type");switch(e){case"json":if(!i||!RJ.test(i))break;try{a=await n.req.json()}catch{const d="Malformed JSON in request body";throw new w8.HTTPException(400,{message:d})}break;case"form":{if(!i||!(FJ.test(i)||VJ.test(i)))break;let d;if(n.req.bodyCache.formData)d=await n.req.bodyCache.formData;else try{const c=await n.req.arrayBuffer();d=await(0,jJ.bufferToFormData)(c,i),n.req.bodyCache.formData=d}catch(c){let f="Malformed FormData request.";throw f+=c instanceof Error?` ${c.message}`:` ${String(c)}`,new w8.HTTPException(400,{message:f})}const l=Object.create(null);d.forEach((c,f)=>{f.endsWith("[]")?(l[f]??(l[f]=[])).push(c):Array.isArray(l[f])?l[f].push(c):Object.hasOwn(l,f)?l[f]=[l[f],c]:l[f]=c}),a=l;break}case"query":a=Object.fromEntries(Object.entries(n.req.queries()).map(([d,l])=>l.length===1?[d,l[0]]:[d,l]));break;case"param":a=n.req.param();break;case"header":a=n.req.header();break;case"cookie":a=(0,NJ.getCookie)(n);break}const s=await t(a,n);return s instanceof Response?s:(n.req.addValidatedData(e,s),await r())};var o3=Object.defineProperty,ZJ=Object.getOwnPropertyDescriptor,qJ=Object.getOwnPropertyNames,HJ=Object.prototype.hasOwnProperty,WJ=(e,t)=>{for(var n in t)o3(e,n,{get:t[n],enumerable:!0})},GJ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of qJ(t))!HJ.call(e,a)&&a!==n&&o3(e,a,{get:()=>t[a],enumerable:!(r=ZJ(t,a))||r.enumerable});return e},XJ=e=>GJ(o3({},"__esModule",{value:!0}),e),SS={};WJ(SS,{validator:()=>KJ.validator});var YJ=XJ(SS),KJ=$J;(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});let t=YJ;function n(a,i,s,d){return(0,t.validator)(a,async(l,c)=>{let f=l;if(a==="header"&&"_def"in i||a==="header"&&"_zod"in i){const u=Object.keys("in"in i?i.in.shape:i.shape),h=Object.fromEntries(u.map(g=>[g.toLowerCase(),g]));f=Object.fromEntries(Object.entries(l).map(([g,y])=>[h[g]||g,y]))}const m=d&&d.validationFunction?await d.validationFunction(i,f):await i.safeParseAsync(f);if(s){const u=await s({data:f,...m,target:a},c);if(u){if(u instanceof Response)return u;if("response"in u)return u.response}}return m.success?m.data:c.json(m,400)})}const r=n;e.zValidator=r})(JC);var i3=Object.defineProperty,JJ=Object.getOwnPropertyDescriptor,QJ=Object.getOwnPropertyNames,eQ=Object.prototype.hasOwnProperty,tQ=(e,t)=>{for(var n in t)i3(e,n,{get:t[n],enumerable:!0})},nQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of QJ(t))!eQ.call(e,a)&&a!==n&&i3(e,a,{get:()=>t[a],enumerable:!(r=JJ(t,a))||r.enumerable});return e},rQ=e=>nQ(i3({},"__esModule",{value:!0}),e),kS={};tQ(kS,{compose:()=>oQ});var aQ=rQ(kS);const oQ=(e,t,n)=>(r,a)=>{let i=-1;return s(0);async function s(d){if(d<=i)throw new Error("next() called multiple times");i=d;let l,c=!1,f;if(e[d]?(f=e[d][0][0],r.req.routeIndex=d):f=d===e.length&&a||void 0,f)try{l=await f(r,()=>s(d+1))}catch(m){if(m instanceof Error&&t)r.error=m,l=await t(m,r),c=!0;else throw m}else r.finalized===!1&&n&&(l=await n(r));return l&&(r.finalized===!1||c)&&(r.res=l),r}};var s3=Object.defineProperty,iQ=Object.getOwnPropertyDescriptor,sQ=Object.getOwnPropertyNames,lQ=Object.prototype.hasOwnProperty,cQ=(e,t)=>{for(var n in t)s3(e,n,{get:t[n],enumerable:!0})},uQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of sQ(t))!lQ.call(e,a)&&a!==n&&s3(e,a,{get:()=>t[a],enumerable:!(r=iQ(t,a))||r.enumerable});return e},dQ=e=>uQ(s3({},"__esModule",{value:!0}),e),_S={};cQ(_S,{GET_MATCH_RESULT:()=>pQ});var fQ=dQ(_S);const pQ=Symbol();var l3=Object.defineProperty,mQ=Object.getOwnPropertyDescriptor,hQ=Object.getOwnPropertyNames,gQ=Object.prototype.hasOwnProperty,vQ=(e,t)=>{for(var n in t)l3(e,n,{get:t[n],enumerable:!0})},bQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of hQ(t))!gQ.call(e,a)&&a!==n&&l3(e,a,{get:()=>t[a],enumerable:!(r=mQ(t,a))||r.enumerable});return e},yQ=e=>bQ(l3({},"__esModule",{value:!0}),e),ES={};vQ(ES,{parseBody:()=>SQ});var wQ=yQ(ES),xQ=wS;const x8=32,CQ=1e4,i1=e=>"headers"in e,SQ=async(e,t=Object.create(null))=>{const{all:n=!1,dot:r=!1}=t,i=(i1(e)?e.headers:e.raw.headers).get("Content-Type"),s=i==null?void 0:i.split(";")[0].trim().toLowerCase();return s==="multipart/form-data"||s==="application/x-www-form-urlencoded"?kQ(e,{all:n,dot:r}):{}};async function kQ(e,t){if(!i1(e)&&e.bodyCache.formData)return C8(await e.bodyCache.formData,t);const n=i1(e)?e.headers:e.raw.headers,r=await e.arrayBuffer(),a=(0,xQ.bufferToFormData)(r,n.get("Content-Type")||"");i1(e)||(e.bodyCache.formData=a);const i=await a;return i?C8(i,t):{}}function C8(e,t){const n=Object.create(null),r={count:0};return e.forEach((a,i)=>{t.all||i.endsWith("[]")?_Q(n,i,a):n[i]=a}),t.dot&&Object.entries(n).forEach(([a,i])=>{a.includes(".")&&(EQ(n,a,i,r),delete n[a])}),n}const _Q=(e,t,n)=>{e[t]!==void 0?Array.isArray(e[t])?e[t].push(n):e[t]=[e[t],n]:t.endsWith("[]")?e[t]=[n]:e[t]=n},EQ=(e,t,n,r)=>{if(/(?:^|\.)__proto__\./.test(t))return;let a=e;const i=t.split(".",x8+2);i.length>x8+1&&S8(),i.forEach((s,d)=>{d===i.length-1?a[s]=n:((!a[s]||typeof a[s]!="object"||Array.isArray(a[s])||a[s]instanceof File)&&(r.count++>=CQ&&S8(),a[s]=Object.create(null)),a=a[s])})},S8=()=>{throw new Error("Nesting limit exceeded")};var c3=Object.defineProperty,zQ=Object.getOwnPropertyDescriptor,IQ=Object.getOwnPropertyNames,AQ=Object.prototype.hasOwnProperty,BQ=(e,t)=>{for(var n in t)c3(e,n,{get:t[n],enumerable:!0})},LQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of IQ(t))!AQ.call(e,a)&&a!==n&&c3(e,a,{get:()=>t[a],enumerable:!(r=zQ(t,a))||r.enumerable});return e},OQ=e=>LQ(c3({},"__esModule",{value:!0}),e),zS={};BQ(zS,{HonoRequest:()=>$Q,cloneRawRequest:()=>NQ});var PQ=OQ(zS),MQ=vS,TQ=fQ,DQ=wQ,Df=Al,Rd,za,mi,IS,AS,Wg,ri;class $Q{constructor(t,n="/",r=[[]]){zt(this,mi);ve(this,"raw");zt(this,Rd);zt(this,za);ve(this,"routeIndex",0);ve(this,"path");ve(this,"bodyCache",{});zt(this,ri,t=>{const{bodyCache:n,raw:r}=this,a=n[t];if(a)return a;for(const i in n)return n[i].then(s=>(i==="json"&&(s=JSON.stringify(s)),new Response(s)[t]()));return n[t]=r[t]()});this.raw=t,this.path=n,xt(this,za,r)}param(t){return t?Rt(this,mi,IS).call(this,t):Rt(this,mi,AS).call(this)}query(t){return(0,Df.getQueryParam)(this.url,t)}queries(t){return(0,Df.getQueryParams)(this.url,t)}header(t){if(t)return this.raw.headers.get(t)??void 0;const n=Object.create(null);return this.raw.headers.forEach((r,a)=>{n[a]=r}),n}async parseBody(t){return(0,DQ.parseBody)(this,t)}json(){return Le(this,ri).call(this,"text").then(t=>JSON.parse(t))}text(){return Le(this,ri).call(this,"text")}arrayBuffer(){return Le(this,ri).call(this,"arrayBuffer")}bytes(){return Le(this,ri).call(this,"arrayBuffer").then(t=>new Uint8Array(t))}blob(){return Le(this,ri).call(this,"blob")}formData(){return Le(this,ri).call(this,"formData")}addValidatedData(t,n){(Le(this,Rd)??xt(this,Rd,{}))[t]=n}valid(t){var n;return(n=Le(this,Rd))==null?void 0:n[t]}get url(){return this.raw.url}get method(){return this.raw.method}get[TQ.GET_MATCH_RESULT](){return Le(this,za)}get matchedRoutes(){return Le(this,za)[0].map(([[,t]])=>t)}get routePath(){return Le(this,za)[0].map(([[,t]])=>t)[this.routeIndex].path}}Rd=new WeakMap,za=new WeakMap,mi=new WeakSet,IS=function(t){var a;const n=(a=Le(this,za)[0][this.routeIndex])==null?void 0:a[1][t],r=Rt(this,mi,Wg).call(this,n);return r&&(0,Df.tryDecodeURIComponent)(r)},AS=function(){var r;const t={},n=Object.keys(((r=Le(this,za)[0][this.routeIndex])==null?void 0:r[1])??{});for(const a of n){const i=Rt(this,mi,Wg).call(this,Le(this,za)[0][this.routeIndex][1][a]);i!==void 0&&(t[a]=(0,Df.tryDecodeURIComponent)(i))}return t},Wg=function(t){return Le(this,za)[1]?Le(this,za)[1][t]:t},ri=new WeakMap;const NQ=async e=>{if(!e.raw.bodyUsed)return e.raw.clone();const t=Object.keys(e.bodyCache)[0];if(!t)throw new MQ.HTTPException(500,{message:"Cannot clone request: body was already consumed and not cached. Please use HonoRequest methods (e.g., req.json(), req.text()) instead of consuming req.raw directly."});let n=await e[t]();const r=e.header();t==="json"?(n=JSON.stringify(n),delete r["content-length"]):n instanceof FormData&&(delete r["content-type"],delete r["content-length"]);const a={body:n,cache:e.raw.cache,credentials:e.raw.credentials,headers:r,integrity:e.raw.integrity,keepalive:e.raw.keepalive,method:e.method,mode:e.raw.mode,redirect:e.raw.redirect,referrer:e.raw.referrer,referrerPolicy:e.raw.referrerPolicy,signal:e.raw.signal};return new Request(e.url,a)};var u3=Object.defineProperty,jQ=Object.getOwnPropertyDescriptor,RQ=Object.getOwnPropertyNames,FQ=Object.prototype.hasOwnProperty,VQ=(e,t)=>{for(var n in t)u3(e,n,{get:t[n],enumerable:!0})},UQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of RQ(t))!FQ.call(e,a)&&a!==n&&u3(e,a,{get:()=>t[a],enumerable:!(r=jQ(t,a))||r.enumerable});return e},ZQ=e=>UQ(u3({},"__esModule",{value:!0}),e),BS={};VQ(BS,{HtmlEscapedCallbackPhase:()=>LS,escapeToBuffer:()=>OS,raw:()=>d3,resolveCallback:()=>PS,resolveCallbackSync:()=>GQ,stringBufferToString:()=>WQ});var qQ=ZQ(BS);const LS={Stringify:1,BeforeStream:2,Stream:3},d3=(e,t)=>{const n=new String(e);return n.isEscaped=!0,n.callbacks=t,n},HQ=/[&<>'"]/,WQ=async(e,t)=>{let n="";t||(t=[]);const r=await Promise.all(e);for(let a=r.length-1;n+=r[a],a--,!(a<0);a--){let i=r[a];typeof i=="object"&&t.push(...i.callbacks||[]);const s=i.isEscaped;if(i=await(typeof i=="object"?i.toString():i),typeof i=="object"&&t.push(...i.callbacks||[]),i.isEscaped??s)n+=i;else{const d=[n];OS(i,d),n=d[0]}}return d3(n,t)},OS=(e,t)=>{const n=e.search(HQ);if(n===-1){t[0]+=e;return}let r,a,i=0;for(a=n;a<e.length;a++){switch(e.charCodeAt(a)){case 34:r=""";break;case 39:r="'";break;case 38:r="&";break;case 60:r="<";break;case 62:r=">";break;default:continue}t[0]+=e.substring(i,a)+r,i=a+1}t[0]+=e.substring(i,a)},GQ=e=>{const t=e.callbacks;if(!(t!=null&&t.length))return e;const n=[e],r={};return t.forEach(a=>a({phase:LS.Stringify,buffer:n,context:r})),n[0]},PS=async(e,t,n,r,a)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));const i=e.callbacks;if(!(i!=null&&i.length))return Promise.resolve(e);a?a[0]+=e:a=[e];const s=Promise.all(i.map(d=>d({phase:t,buffer:a,context:r}))).then(d=>Promise.all(d.filter(Boolean).map(l=>PS(l,t,!1,r,a))).then(()=>a[0]));return n?d3(await s,i):s};var f3=Object.defineProperty,XQ=Object.getOwnPropertyDescriptor,YQ=Object.getOwnPropertyNames,KQ=Object.prototype.hasOwnProperty,JQ=(e,t)=>{for(var n in t)f3(e,n,{get:t[n],enumerable:!0})},QQ=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of YQ(t))!KQ.call(e,a)&&a!==n&&f3(e,a,{get:()=>t[a],enumerable:!(r=XQ(t,a))||r.enumerable});return e},eee=e=>QQ(f3({},"__esModule",{value:!0}),e),MS={};JQ(MS,{Context:()=>nee,TEXT_PLAIN:()=>DS});var TS=eee(MS),tee=PQ,k8=qQ;const DS="text/plain; charset=UTF-8",_2=(e,t)=>({"Content-Type":e,...t}),Ou=(e,t)=>new Response(e,t);var Fd,Vd,ai,Ic,oi,Pr,Ud,Ac,Bc,il,Zd,qd,Wi,cc;class nee{constructor(t,n){zt(this,Wi);zt(this,Fd);zt(this,Vd);ve(this,"env",{});zt(this,ai);ve(this,"finalized",!1);ve(this,"error");zt(this,Ic);zt(this,oi);zt(this,Pr);zt(this,Ud);zt(this,Ac);zt(this,Bc);zt(this,il);zt(this,Zd);zt(this,qd);ve(this,"render",(...t)=>(Le(this,Ac)??xt(this,Ac,n=>this.html(n)),Le(this,Ac).call(this,...t)));ve(this,"setLayout",t=>xt(this,Ud,t));ve(this,"getLayout",()=>Le(this,Ud));ve(this,"setRenderer",t=>{xt(this,Ac,t)});ve(this,"header",(t,n,r)=>{this.finalized&&xt(this,Pr,Ou(Le(this,Pr).body,Le(this,Pr)));const a=Le(this,Pr)?Le(this,Pr).headers:Le(this,il)??xt(this,il,new Headers);n===void 0?a.delete(t):r!=null&&r.append?a.append(t,n):a.set(t,n)});ve(this,"status",t=>{xt(this,Ic,t)});ve(this,"set",(t,n)=>{Le(this,ai)??xt(this,ai,new Map),Le(this,ai).set(t,n)});ve(this,"get",t=>Le(this,ai)?Le(this,ai).get(t):void 0);ve(this,"newResponse",(...t)=>Rt(this,Wi,cc).call(this,...t));ve(this,"body",(t,n,r)=>Rt(this,Wi,cc).call(this,t,n,r));ve(this,"text",(t,n,r)=>!Le(this,il)&&!Le(this,Ic)&&!n&&!r&&!this.finalized?new Response(t):Rt(this,Wi,cc).call(this,t,n,_2(DS,r)));ve(this,"json",(t,n,r)=>Rt(this,Wi,cc).call(this,JSON.stringify(t),n,_2("application/json",r)));ve(this,"html",(t,n,r)=>{const a=i=>Rt(this,Wi,cc).call(this,i,n,_2("text/html; charset=UTF-8",r));return typeof t=="object"?(0,k8.resolveCallback)(t,k8.HtmlEscapedCallbackPhase.Stringify,!1,{}).then(a):a(t)});ve(this,"redirect",(t,n)=>{const r=String(t);return this.header("Location",/[^\x00-\xFF]/.test(r)?encodeURI(r):r),this.newResponse(null,n??302)});ve(this,"notFound",()=>(Le(this,Bc)??xt(this,Bc,()=>Ou()),Le(this,Bc).call(this,this)));xt(this,Fd,t),n&&(xt(this,oi,n.executionCtx),this.env=n.env,xt(this,Bc,n.notFoundHandler),xt(this,qd,n.path),xt(this,Zd,n.matchResult))}get req(){return Le(this,Vd)??xt(this,Vd,new tee.HonoRequest(Le(this,Fd),Le(this,qd),Le(this,Zd))),Le(this,Vd)}get event(){if(Le(this,oi)&&"respondWith"in Le(this,oi))return Le(this,oi);throw Error("This context has no FetchEvent")}get executionCtx(){if(Le(this,oi))return Le(this,oi);throw Error("This context has no ExecutionContext")}get res(){return Le(this,Pr)||xt(this,Pr,Ou(null,{headers:Le(this,il)??xt(this,il,new Headers)}))}set res(t){if(Le(this,Pr)&&t){t=Ou(t.body,t);for(const[n,r]of Le(this,Pr).headers.entries())if(n!=="content-type")if(n==="set-cookie"){const a=Le(this,Pr).headers.getSetCookie();t.headers.delete("set-cookie");for(const i of a)t.headers.append("set-cookie",i)}else t.headers.set(n,r)}xt(this,Pr,t),this.finalized=!0}get var(){return Le(this,ai)?Object.fromEntries(Le(this,ai)):{}}}Fd=new WeakMap,Vd=new WeakMap,ai=new WeakMap,Ic=new WeakMap,oi=new WeakMap,Pr=new WeakMap,Ud=new WeakMap,Ac=new WeakMap,Bc=new WeakMap,il=new WeakMap,Zd=new WeakMap,qd=new WeakMap,Wi=new WeakSet,cc=function(t,n,r){let a=Le(this,Pr)?new Headers(Le(this,Pr).headers):Le(this,il);if(typeof n=="object"&&n.headers){a??(a=new Headers);for(const[s,d]of new Headers(n.headers))s==="set-cookie"?a.append(s,d):a.set(s,d)}if(r){if(!a){let s=0;for(const d in r)if(++s>1||typeof r[d]!="string"){a=new Headers;break}}if(a)for(const s in r){const d=r[s];if(typeof d=="string")a.set(s,d);else{a.delete(s);for(const l of d)a.append(s,l)}}}const i=typeof n=="number"?n:(n==null?void 0:n.status)??Le(this,Ic);return Ou(t,{status:i,headers:a??r})};var p3=Object.defineProperty,ree=Object.getOwnPropertyDescriptor,aee=Object.getOwnPropertyNames,oee=Object.prototype.hasOwnProperty,iee=(e,t)=>{for(var n in t)p3(e,n,{get:t[n],enumerable:!0})},see=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of aee(t))!oee.call(e,a)&&a!==n&&p3(e,a,{get:()=>t[a],enumerable:!(r=ree(t,a))||r.enumerable});return e},lee=e=>see(p3({},"__esModule",{value:!0}),e),$S={};iee($S,{MESSAGE_MATCHER_IS_ALREADY_BUILT:()=>fee,METHODS:()=>dee,METHOD_NAME_ALL:()=>cee,METHOD_NAME_ALL_LOWERCASE:()=>uee,UnsupportedPathError:()=>pee});var tu=lee($S);const cee="ALL",uee="all",dee=["get","post","put","delete","options","patch","query"],fee="Can not add a route since the matcher is already built.";class pee extends Error{}var m3=Object.defineProperty,mee=Object.getOwnPropertyDescriptor,hee=Object.getOwnPropertyNames,gee=Object.prototype.hasOwnProperty,vee=(e,t)=>{for(var n in t)m3(e,n,{get:t[n],enumerable:!0})},bee=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of hee(t))!gee.call(e,a)&&a!==n&&m3(e,a,{get:()=>t[a],enumerable:!(r=mee(t,a))||r.enumerable});return e},yee=e=>bee(m3({},"__esModule",{value:!0}),e),NS={};vee(NS,{COMPOSED_HANDLER:()=>xee});var wee=yee(NS);const xee="__COMPOSED_HANDLER";var h3=Object.defineProperty,Cee=Object.getOwnPropertyDescriptor,See=Object.getOwnPropertyNames,kee=Object.prototype.hasOwnProperty,_ee=(e,t)=>{for(var n in t)h3(e,n,{get:t[n],enumerable:!0})},Eee=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of See(t))!kee.call(e,a)&&a!==n&&h3(e,a,{get:()=>t[a],enumerable:!(r=Cee(t,a))||r.enumerable});return e},zee=e=>Eee(h3({},"__esModule",{value:!0}),e),jS={};_ee(jS,{HonoBase:()=>Oee});var Iee=zee(jS),_8=aQ,Aee=TS,$f=tu,Bee=wee,Ti=Al;const Lee=e=>e.text("404 Not Found",404),E8=(e,t)=>{if("getResponse"in e){const n=e.getResponse();return t.newResponse(n.body,n)}return console.error(e),t.text("Internal Server Error",500)};var Wa,er,RS,Ga,Ws,s1,l1,Lc;let Oee=(Lc=class{constructor(t={}){zt(this,er);ve(this,"get");ve(this,"post");ve(this,"put");ve(this,"delete");ve(this,"options");ve(this,"patch");ve(this,"query");ve(this,"all");ve(this,"on");ve(this,"use");ve(this,"router");ve(this,"getPath");ve(this,"_basePath","/");zt(this,Wa,"/");ve(this,"routes",[]);zt(this,Ga,Lee);ve(this,"errorHandler",E8);ve(this,"onError",t=>(this.errorHandler=t,this));ve(this,"notFound",t=>(xt(this,Ga,t),this));ve(this,"fetch",(t,...n)=>Rt(this,er,l1).call(this,t,n[1],n[0],t.method));ve(this,"request",(t,n,r,a)=>t instanceof Request?this.fetch(n?new Request(t,n):t,r,a):(t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${(0,Ti.mergePath)("/",t)}`,n),r,a)));ve(this,"fire",()=>{addEventListener("fetch",t=>{t.respondWith(Rt(this,er,l1).call(this,t.request,t,void 0,t.request.method))})});[...$f.METHODS,$f.METHOD_NAME_ALL_LOWERCASE].forEach(i=>{this[i]=(s,...d)=>(typeof s=="string"?xt(this,Wa,s):Rt(this,er,Ws).call(this,i,Le(this,Wa),s),d.forEach(l=>{Rt(this,er,Ws).call(this,i,Le(this,Wa),l)}),this)}),this.on=(i,s,...d)=>{for(const l of[s].flat()){xt(this,Wa,l);for(const c of[i].flat())d.map(f=>{Rt(this,er,Ws).call(this,c.toUpperCase(),Le(this,Wa),f)})}return this},this.use=(i,...s)=>(typeof i=="string"?xt(this,Wa,i):(xt(this,Wa,"*"),s.unshift(i)),s.forEach(d=>{Rt(this,er,Ws).call(this,$f.METHOD_NAME_ALL,Le(this,Wa),d)}),this);const{strict:r,...a}=t;Object.assign(this,a),this.getPath=r??!0?t.getPath??Ti.getPath:Ti.getPathNoStrict}route(t,n){const r=this.basePath(t);return n.routes.map(a=>{var s;let i;n.errorHandler===E8?i=a.handler:(i=async(d,l)=>(await(0,_8.compose)([],n.errorHandler)(d,()=>a.handler(d,l))).res,i[Bee.COMPOSED_HANDLER]=a.handler),Rt(s=r,er,Ws).call(s,a.method,a.path,i,a.basePath)}),this}basePath(t){const n=Rt(this,er,RS).call(this);return n._basePath=(0,Ti.mergePath)(this._basePath,t),n}mount(t,n,r){let a,i;r&&(typeof r=="function"?i=r:(i=r.optionHandler,r.replaceRequest===!1?a=l=>l:a=r.replaceRequest));const s=i?l=>{const c=i(l);return Array.isArray(c)?c:[c]}:l=>{let c;try{c=l.executionCtx}catch{}return[l.env,c]};a||(a=(()=>{const l=(0,Ti.mergePath)(this._basePath,t),c=l==="/"?0:l.length;return f=>{const m=new URL(f.url);return m.pathname=this.getPath(f).slice(c)||"/",new Request(m,f)}})());const d=async(l,c)=>{const f=await n(a(l.req.raw),...s(l));if(f)return f;await c()};return Rt(this,er,Ws).call(this,$f.METHOD_NAME_ALL,(0,Ti.mergePath)(t,"*"),d),this}},Wa=new WeakMap,er=new WeakSet,RS=function(){const t=new Lc({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,xt(t,Ga,Le(this,Ga)),t.routes=this.routes,t},Ga=new WeakMap,Ws=function(t,n,r,a){t=t.toUpperCase(),n=(0,Ti.mergePath)(this._basePath,n);const i={basePath:a!==void 0?(0,Ti.mergePath)(this._basePath,a):this._basePath,path:n,method:t,handler:r};this.router.add(t,n,[r,i]),this.routes.push(i)},s1=function(t,n){if(t instanceof Error)return this.errorHandler(t,n);throw t},l1=function(t,n,r,a){if(a==="HEAD")return(async()=>new Response(null,await Rt(this,er,l1).call(this,t,n,r,"GET")))();const i=this.getPath(t,{env:r}),s=this.router.match(a,i),d=new Aee.Context(t,{path:i,matchResult:s,env:r,executionCtx:n,notFoundHandler:Le(this,Ga)});if(s[0].length===1){let c;try{c=s[0][0][0][0](d,async()=>{d.res=await Le(this,Ga).call(this,d)})}catch(f){return Rt(this,er,s1).call(this,f,d)}return c instanceof Promise?c.then(f=>f||(d.finalized?d.res:Le(this,Ga).call(this,d))).catch(f=>Rt(this,er,s1).call(this,f,d)):c??Le(this,Ga).call(this,d)}const l=(0,_8.compose)(s[0],this.errorHandler,Le(this,Ga));return(async()=>{try{const c=await l(d);if(!c.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return c.res}catch(c){return Rt(this,er,s1).call(this,c,d)}})()},Lc);var g3=Object.defineProperty,Pee=Object.getOwnPropertyDescriptor,Mee=Object.getOwnPropertyNames,Tee=Object.prototype.hasOwnProperty,Dee=(e,t)=>{for(var n in t)g3(e,n,{get:t[n],enumerable:!0})},$ee=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Mee(t))!Tee.call(e,a)&&a!==n&&g3(e,a,{get:()=>t[a],enumerable:!(r=Pee(t,a))||r.enumerable});return e},Nee=e=>$ee(g3({},"__esModule",{value:!0}),e),FS={};Dee(FS,{createNullObject:()=>jee});var om=Nee(FS);const jee=()=>Object.create(null);var v3=Object.defineProperty,Ree=Object.getOwnPropertyDescriptor,Fee=Object.getOwnPropertyNames,Vee=Object.prototype.hasOwnProperty,Uee=(e,t)=>{for(var n in t)v3(e,n,{get:t[n],enumerable:!0})},Zee=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Fee(t))!Vee.call(e,a)&&a!==n&&v3(e,a,{get:()=>t[a],enumerable:!(r=Ree(t,a))||r.enumerable});return e},qee=e=>Zee(v3({},"__esModule",{value:!0}),e),VS={};Uee(VS,{emptyParam:()=>ZS,match:()=>Wee});var US=qee(VS),Hee=tu;const ZS=[];function Wee(e,t){const n=this.buildAllMatchers(),r=(a,i)=>{const s=n[a]||n[Hee.METHOD_NAME_ALL],d=s[2][i];if(d)return d;const l=i.match(s[0]);if(!l)return[[],ZS];const c=l.indexOf("",1);return[s[1][c],l]};return this.match=r,r(e,t)}var b3=Object.defineProperty,Gee=Object.getOwnPropertyDescriptor,Xee=Object.getOwnPropertyNames,Yee=Object.prototype.hasOwnProperty,Kee=(e,t)=>{for(var n in t)b3(e,n,{get:t[n],enumerable:!0})},Jee=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Xee(t))!Yee.call(e,a)&&a!==n&&b3(e,a,{get:()=>t[a],enumerable:!(r=Gee(t,a))||r.enumerable});return e},Qee=e=>Jee(b3({},"__esModule",{value:!0}),e),qS={};Kee(qS,{LABEL_REG_EXP_STR:()=>Ad,Node:()=>nte,ONLY_WILDCARD_REG_EXP_STR:()=>rl,PATH_ERROR:()=>Gs,TAIL_WILDCARD_REG_EXP_STR:()=>es});var HS=Qee(qS),ete=om;const Ad="[^/]+",rl=".*",es="(?:|/.*)",Gs=Symbol(),z8=new Set(".\\+*[^]$()");function tte(e,t){return e.length===1?t.length===1?e<t?-1:1:-1:t.length===1?1:e===rl||e===es?t===es?-1:1:t===rl||t===es?-1:e===Ad?1:t===Ad?-1:e.length===t.length?e<t?-1:1:t.length-e.length}var Gi,sl,Xa,gl;let nte=(gl=class{constructor(){zt(this,Gi);zt(this,sl);zt(this,Xa,(0,ete.createNullObject)())}insert(t,n,r,a,i){let s=this;for(let d=0,l=t.length;d<l;d++){const c=t[d],f=c.length===1?c==="*"?d===l-1?["","",rl]:["","",Ad]:null:c==="/*"?["","",es]:c.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);let m;if(f){const u=f[1];let h=f[2]||Ad;if(u&&f[2]&&(h===".*"||(h=h.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(h))||h.length===1&&z8.has(h)))throw Gs;if(m=Le(s,Xa)[h],!m){if(h!==rl&&h!==es){for(const g in Le(s,Xa))if((h.length>1||g.length>1)&&g!==rl&&g!==es)throw Gs}m=Le(s,Xa)[h]=new gl}u!==""&&(Le(m,sl)??xt(m,sl,a.varIndex++),r.push([u,Le(m,sl)]))}else if(m=Le(s,Xa)[c],!m){for(const u in Le(s,Xa))if(u.length>1&&u!==rl&&u!==es)throw Gs;m=Le(s,Xa)[c]=new gl}s=m}if(Le(s,Gi)!==void 0)throw Gs;xt(s,Gi,i?-1:n)}buildRegExpStr(){const n=Object.keys(Le(this,Xa)).sort(tte).map(r=>{const a=Le(this,Xa)[r],i=a.buildRegExpStr();return i===""?"":(typeof Le(a,sl)=="number"?`(${r})@${Le(a,sl)}`:z8.has(r)?`\\${r}`:r)+i}).filter(Boolean);return typeof Le(this,Gi)=="number"&&Le(this,Gi)!==-1&&n.unshift(`#${Le(this,Gi)}`),n.length===0?"":n.length===1?n[0]:"(?:"+n.join("|")+")"}},Gi=new WeakMap,sl=new WeakMap,Xa=new WeakMap,gl);var y3=Object.defineProperty,rte=Object.getOwnPropertyDescriptor,ate=Object.getOwnPropertyNames,ote=Object.prototype.hasOwnProperty,ite=(e,t)=>{for(var n in t)y3(e,n,{get:t[n],enumerable:!0})},ste=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ate(t))!ote.call(e,a)&&a!==n&&y3(e,a,{get:()=>t[a],enumerable:!(r=rte(t,a))||r.enumerable});return e},lte=e=>ste(y3({},"__esModule",{value:!0}),e),WS={};ite(WS,{Trie:()=>fte});var cte=lte(WS),ute=om,dte=HS,Hd,Oc,Wd;class fte{constructor(){zt(this,Hd,{varIndex:0});zt(this,Oc,new dte.Node);zt(this,Wd,0);ve(this,"paths",(0,ute.createNullObject)())}insert(t,n){if(n){Le(this,Oc).insert(t.split(""),0,[],Le(this,Hd),!0);return}const r=[],a=[];let i=t;for(let d=0;;){let l=!1;if(i=i.replace(/\{[^}]+\}/g,c=>{const f=`@\\${d}`;return a[d]=[f,c],d++,l=!0,f}),!l)break}const s=i.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let d=a.length-1;d>=0;d--){const[l]=a[d];for(let c=s.length-1;c>=0;c--)if(s[c].indexOf(l)!==-1){s[c]=s[c].replace(l,a[d][1]);break}}Le(this,Oc).insert(s,Le(this,Wd),r,Le(this,Hd),!1),this.paths[t]=[gf(this,Wd)._++,r]}buildRegExp(){let t=Le(this,Oc).buildRegExpStr();if(t==="")return[/^$/,[],[]];let n=0;const r=[],a=[];return t=t.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,s,d)=>s!==void 0?(r[++n]=Number(s),"$()"):(d!==void 0&&(a[Number(d)]=++n),"")),[new RegExp(`^${t}`),r,a]}}Hd=new WeakMap,Oc=new WeakMap,Wd=new WeakMap;var w3=Object.defineProperty,pte=Object.getOwnPropertyDescriptor,mte=Object.getOwnPropertyNames,hte=Object.prototype.hasOwnProperty,gte=(e,t)=>{for(var n in t)w3(e,n,{get:t[n],enumerable:!0})},vte=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of mte(t))!hte.call(e,a)&&a!==n&&w3(e,a,{get:()=>t[a],enumerable:!(r=pte(t,a))||r.enumerable});return e},bte=e=>vte(w3({},"__esModule",{value:!0}),e),GS={};gte(GS,{RegExpRouter:()=>wte});var XS=bte(GS),uo=tu,yte=Al,Qo=om,I8=US,c1=HS,A8=cte;let u1=(0,Qo.createNullObject)();function YS(e){return u1[e]??(u1[e]=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(t,n)=>n?`\\${n}`:t==="/*"?c1.TAIL_WILDCARD_REG_EXP_STR:t==="*"?c1.ONLY_WILDCARD_REG_EXP_STR:`/:${c1.LABEL_REG_EXP_STR}`)}$`))}function Nf(e,t){for(const n of Object.keys(e).sort((r,a)=>a.length-r.length))if(YS(n).test(t))return[...e[n]]}var ll,Xi,Yi,ds,d1,KS;class wte{constructor(){zt(this,ds);ve(this,"name","RegExpRouter");zt(this,ll);zt(this,Xi);zt(this,Yi);ve(this,"match",I8.match);xt(this,ll,{[uo.METHOD_NAME_ALL]:(0,Qo.createNullObject)()}),xt(this,Xi,{[uo.METHOD_NAME_ALL]:(0,Qo.createNullObject)()}),xt(this,Yi,{[uo.METHOD_NAME_ALL]:new A8.Trie})}add(t,n,r){const a=Le(this,ll),i=Le(this,Xi);if(!a)throw new Error(uo.MESSAGE_MATCHER_IS_ALREADY_BUILT);if(!a[t]){Le(this,Yi)[t]=new A8.Trie;for(const l of[a,i]){l[t]=(0,Qo.createNullObject)();for(const c in l[uo.METHOD_NAME_ALL])l[t][c]=[...l[uo.METHOD_NAME_ALL][c]],Rt(this,ds,d1).call(this,t,c)}}n==="/*"&&(n="*");const s=t===uo.METHOD_NAME_ALL?Object.keys(a):[t];if(/\*$/.test(n)){const l=YS(n);for(const c of s)a[c][n]||(Rt(this,ds,d1).call(this,c,n),a[c][n]=Nf(a[c],n)||Nf(a[uo.METHOD_NAME_ALL],n)||[]);for(const c of[a,i])for(const f of s)for(const m in c[f])l.test(m)&&c[f][m].push([r,n]);return}const d=(0,yte.checkOptionalParameter)(n)||[n];for(const l of d)for(const c of s)i[c][l]||(Rt(this,ds,d1).call(this,c,l),i[c][l]=Nf(a[c],l)||Nf(a[uo.METHOD_NAME_ALL],l)||[]),i[c][l].push([r,l])}buildAllMatchers(){const t=(0,Qo.createNullObject)();for(const n of Object.keys(Le(this,Xi)))t[n]=Rt(this,ds,KS).call(this,n);return xt(this,ll,xt(this,Xi,xt(this,Yi,void 0))),u1=(0,Qo.createNullObject)(),t}}ll=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,ds=new WeakSet,d1=function(t,n){try{Le(this,Yi)[t].insert(n,!/\*|\/:/.test(n))}catch(r){throw r===c1.PATH_ERROR?new uo.UnsupportedPathError(n):r}},KS=function(t){const n=Le(this,ll)[t],r=Le(this,Xi)[t],a=Le(this,Yi)[t],i=(0,Qo.createNullObject)(),s=[],[d,l,c]=a.buildRegExp();for(const f of[n,r])for(const m in f){const u=f[m],h=a.paths[m];if(!h){i[m]=[u.map(([g])=>[g,(0,Qo.createNullObject)()]),I8.emptyParam];continue}s[h[0]]=u.map(([g,y])=>[g,a.paths[y][1].reduceRight((w,[x],S)=>(w[x]=c[h[1][S][1]],w),(0,Qo.createNullObject)())])}return[d,l.map(f=>s[f]),i]};var x3=Object.defineProperty,xte=Object.getOwnPropertyDescriptor,Cte=Object.getOwnPropertyNames,Ste=Object.prototype.hasOwnProperty,kte=(e,t)=>{for(var n in t)x3(e,n,{get:t[n],enumerable:!0})},_te=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Cte(t))!Ste.call(e,a)&&a!==n&&x3(e,a,{get:()=>t[a],enumerable:!(r=xte(t,a))||r.enumerable});return e},Ete=e=>_te(x3({},"__esModule",{value:!0}),e),JS={};kte(JS,{PreparedRegExpRouter:()=>Ate,buildInitParams:()=>Bte,serializeInitParams:()=>Lte});var zte=Ete(JS),rd=tu,B8=US,Ite=XS,Ia,Gd,ws,Gg,Xg;class Ate{constructor(t,n){zt(this,ws);ve(this,"name","PreparedRegExpRouter");zt(this,Ia);zt(this,Gd);ve(this,"match",B8.match);xt(this,Ia,t),xt(this,Gd,n)}add(t,n,r){if(!Le(this,Ia)[t]){const i=Le(this,Ia)[rd.METHOD_NAME_ALL],s={};for(const d in i[2])s[d]=[i[2][d][0].slice(),B8.emptyParam];Le(this,Ia)[t]=[i[0],i[1].map(d=>Array.isArray(d)?d.slice():0),s]}if(n==="/*"||n==="*"){const i=[r,{}];if(t===rd.METHOD_NAME_ALL)for(const s in Le(this,Ia))Rt(this,ws,Gg).call(this,s,i);else Rt(this,ws,Gg).call(this,t,i);return}const a=Le(this,Gd)[n];if(!a)throw new Error(`Path ${n} is not registered`);for(const[i,s]of a)if(t===rd.METHOD_NAME_ALL)for(const d in Le(this,Ia))Rt(this,ws,Xg).call(this,d,n,r,i,s);else Rt(this,ws,Xg).call(this,t,n,r,i,s)}buildAllMatchers(){return Le(this,Ia)}}Ia=new WeakMap,Gd=new WeakMap,ws=new WeakSet,Gg=function(t,n){const r=Le(this,Ia)[t];r[1].forEach(a=>a&&a.push(n)),Object.values(r[2]).forEach(a=>a[0].push(n))},Xg=function(t,n,r,a,i){const s=Le(this,Ia)[t];i?a.forEach(d=>{typeof d=="number"?s[1][d].push([r,i]):s[2][d||n][0].push([r,i])}):s[2][n][0].push([r,{}])};const Bte=({paths:e})=>{const t=class extends Ite.RegExpRouter{buildAndExportAllMatchers(){return this.buildAllMatchers()}},n=new t;for(const s of e)n.add(rd.METHOD_NAME_ALL,s,s);const r=n.buildAndExportAllMatchers(),a=r[rd.METHOD_NAME_ALL],i={};for(const s of e)if(!(s==="/*"||s==="*")){a[1].forEach((d,l)=>{d.forEach(([c,f])=>{c===s&&(i[s]?i[s][0][1]={...i[s][0][1],...f}:i[s]=[[[],f]],i[s][0][0].findIndex(m=>m===l)===-1&&i[s][0][0].push(l))})});for(const d in a[2])a[2][d][0].forEach(([l])=>{if(l===s){i[s]||(i[s]=[[[]]]);const c=d===s?"":d;i[s][0][0].findIndex(f=>f===c)===-1&&i[s][0][0].push(c)}})}for(let s=0,d=a[1].length;s<d;s++)a[1][s]=a[1][s]?[]:0;for(const s in a[2])a[2][s][0]=[];return[r,i]},Lte=([e,t])=>{const n=JSON.stringify(e,(a,i)=>i instanceof RegExp?`##${i.toString()}##`:i).replace(/"##(.+?)##"/g,(a,i)=>i.replace(/\\\\/g,"\\")),r=JSON.stringify(t);return`[${n},${r}]`};var C3=Object.defineProperty,Ote=Object.getOwnPropertyDescriptor,Pte=Object.getOwnPropertyNames,Mte=Object.prototype.hasOwnProperty,Tte=(e,t)=>{for(var n in t)C3(e,n,{get:t[n],enumerable:!0})},Dte=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Pte(t))!Mte.call(e,a)&&a!==n&&C3(e,a,{get:()=>t[a],enumerable:!(r=Ote(t,a))||r.enumerable});return e},$te=e=>Dte(C3({},"__esModule",{value:!0}),e),QS={};Tte(QS,{PreparedRegExpRouter:()=>E2.PreparedRegExpRouter,RegExpRouter:()=>jte.RegExpRouter,buildInitParams:()=>E2.buildInitParams,serializeInitParams:()=>E2.serializeInitParams});var Nte=$te(QS),jte=XS,E2=zte,S3=Object.defineProperty,Rte=Object.getOwnPropertyDescriptor,Fte=Object.getOwnPropertyNames,Vte=Object.prototype.hasOwnProperty,Ute=(e,t)=>{for(var n in t)S3(e,n,{get:t[n],enumerable:!0})},Zte=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Fte(t))!Vte.call(e,a)&&a!==n&&S3(e,a,{get:()=>t[a],enumerable:!(r=Rte(t,a))||r.enumerable});return e},qte=e=>Zte(S3({},"__esModule",{value:!0}),e),ek={};Ute(ek,{SmartRouter:()=>Wte});var Hte=qte(ek),L8=tu,Ki,ii;class Wte{constructor(t){ve(this,"name","SmartRouter");zt(this,Ki,[]);zt(this,ii,[]);xt(this,Ki,t.routers)}add(t,n,r){if(!Le(this,ii))throw new Error(L8.MESSAGE_MATCHER_IS_ALREADY_BUILT);Le(this,ii).push([t,n,r])}match(t,n){if(!Le(this,ii))throw new Error("Fatal error");const r=Le(this,Ki),a=Le(this,ii),i=r.length;let s=0,d;for(;s<i;s++){const l=r[s];try{for(let c=0,f=a.length;c<f;c++)l.add(...a[c]);d=l.match(t,n)}catch(c){if(c instanceof L8.UnsupportedPathError)continue;throw c}this.match=l.match.bind(l),xt(this,Ki,[l]),xt(this,ii,void 0);break}if(s===i)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,d}get activeRouter(){if(Le(this,ii)||Le(this,Ki).length!==1)throw new Error("No active router has been determined yet.");return Le(this,Ki)[0]}}Ki=new WeakMap,ii=new WeakMap;var k3=Object.defineProperty,Gte=Object.getOwnPropertyDescriptor,Xte=Object.getOwnPropertyNames,Yte=Object.prototype.hasOwnProperty,Kte=(e,t)=>{for(var n in t)k3(e,n,{get:t[n],enumerable:!0})},Jte=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Xte(t))!Yte.call(e,a)&&a!==n&&k3(e,a,{get:()=>t[a],enumerable:!(r=Gte(t,a))||r.enumerable});return e},Qte=e=>Jte(k3({},"__esModule",{value:!0}),e),tk={};Kte(tk,{SmartRouter:()=>tne.SmartRouter});var ene=Qte(tk),tne=Hte,_3=Object.defineProperty,nne=Object.getOwnPropertyDescriptor,rne=Object.getOwnPropertyNames,ane=Object.prototype.hasOwnProperty,one=(e,t)=>{for(var n in t)_3(e,n,{get:t[n],enumerable:!0})},ine=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of rne(t))!ane.call(e,a)&&a!==n&&_3(e,a,{get:()=>t[a],enumerable:!(r=nne(t,a))||r.enumerable});return e},sne=e=>ine(_3({},"__esModule",{value:!0}),e),nk={};one(nk,{Node:()=>dne});var lne=sne(nk),cne=tu,z2=Al,Yg=om;const I2=(0,Yg.createNullObject)();let une=0;var Pc,Aa,Xd,Mc,or,ho,ji,Tc;let dne=(Tc=class{constructor(){zt(this,ho);zt(this,Pc,[]);zt(this,Aa,(0,Yg.createNullObject)());zt(this,Xd,[]);zt(this,Mc);zt(this,or,I2)}insert(t,n,r){var l;let a=this;const i=(0,z2.splitRoutingPath)(n),s=new Set;let d=0;for(const c of i){const f=i[++d],m=(0,z2.getPattern)(c,f)||(f===void 0&&c&&c.indexOf("*")===c.length-1?c:null),u=Array.isArray(m),h=u?m[0]:m||c,g=(l=Le(a,Aa))[h]||(l[h]=new Tc);m&&!Le(g,Mc)&&(xt(g,Mc,m),Le(a,Xd).push(g)),a=g,u&&s.add(m[1])}Le(a,Pc).push({[t]:{handler:r,possibleKeys:[...s],score:++une}})}search(t,n){var f;const r=[];xt(this,or,I2);let i=[this];const s=(0,z2.splitPath)(n),d=[],l=s.length;let c=null;for(let m=0;m<l;m++){const u=s[m],h=m===l-1,g=[];for(let w=0,x=i.length;w<x;w++){const S=i[w],C=Le(S,Aa)[u];C&&(xt(C,or,Le(S,or)),h?(Le(C,Aa)["*"]&&Rt(this,ho,ji).call(this,r,Le(C,Aa)["*"],t,Le(S,or)),Rt(this,ho,ji).call(this,r,C,t,Le(S,or))):g.push(C));for(const E of Le(S,Xd)){const _=Le(E,Mc),I=Le(S,or)===I2?{}:{...Le(S,or)};if(typeof _=="string"){(_==="*"||u.startsWith(_.slice(0,-1)))&&(Rt(this,ho,ji).call(this,r,E,t,Le(S,or)),_==="*"&&(xt(E,or,I),g.push(E)));continue}const[,B,k]=_;if(!(!u&&k===!0)){if(k!==!0){if(!c){c=[];let $=n[0]==="/"?1:0;for(let j=0;j<l;j++)c[j]=$,$+=s[j].length+1}const P=n.slice(c[m]),z=k.exec(P);if(z){I[B]=z[0],Rt(this,ho,ji).call(this,r,E,t,Le(S,or),I),z[0].length===P.length&&Le(E,Aa)["*"]&&Rt(this,ho,ji).call(this,r,Le(E,Aa)["*"],t,Le(S,or),I);for(const $ in Le(E,Aa)){xt(E,or,I);const j=((f=z[0].match(/\//g))==null?void 0:f.length)??0;(d[j]||(d[j]=[])).push(E);break}continue}}(k===!0||k.test(u))&&(I[B]=u,h?(Rt(this,ho,ji).call(this,r,E,t,I,Le(S,or)),Le(E,Aa)["*"]&&Rt(this,ho,ji).call(this,r,Le(E,Aa)["*"],t,I,Le(S,or))):(xt(E,or,I),g.push(E)))}}}const y=d.shift();i=y?g.concat(y):g}return r[1]&&r.sort((m,u)=>m.score-u.score),[r.map(({handler:m,params:u})=>[m,u])]}},Pc=new WeakMap,Aa=new WeakMap,Xd=new WeakMap,Mc=new WeakMap,or=new WeakMap,ho=new WeakSet,ji=function(t,n,r,a,i){for(let s=0,d=Le(n,Pc).length;s<d;s++){const l=Le(n,Pc)[s],c=l[r]||l[cne.METHOD_NAME_ALL];if(c){c.params=(0,Yg.createNullObject)(),t.push(c);for(let f=0,m=c.possibleKeys.length;f<m;f++){const u=c.possibleKeys[f];c.params[u]=i!=null&&i[u]&&!f?i[u]:a[u]??(i==null?void 0:i[u])}}}},Tc);var E3=Object.defineProperty,fne=Object.getOwnPropertyDescriptor,pne=Object.getOwnPropertyNames,mne=Object.prototype.hasOwnProperty,hne=(e,t)=>{for(var n in t)E3(e,n,{get:t[n],enumerable:!0})},gne=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of pne(t))!mne.call(e,a)&&a!==n&&E3(e,a,{get:()=>t[a],enumerable:!(r=fne(t,a))||r.enumerable});return e},vne=e=>gne(E3({},"__esModule",{value:!0}),e),rk={};hne(rk,{TrieRouter:()=>xne});var bne=vne(rk),yne=Al,wne=lne,Yd;class xne{constructor(){ve(this,"name","TrieRouter");zt(this,Yd,new wne.Node)}add(t,n,r){for(const a of(0,yne.checkOptionalParameter)(n)||[n])Le(this,Yd).insert(t,a,r)}match(t,n){return Le(this,Yd).search(t,n)}}Yd=new WeakMap;var z3=Object.defineProperty,Cne=Object.getOwnPropertyDescriptor,Sne=Object.getOwnPropertyNames,kne=Object.prototype.hasOwnProperty,_ne=(e,t)=>{for(var n in t)z3(e,n,{get:t[n],enumerable:!0})},Ene=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Sne(t))!kne.call(e,a)&&a!==n&&z3(e,a,{get:()=>t[a],enumerable:!(r=Cne(t,a))||r.enumerable});return e},zne=e=>Ene(z3({},"__esModule",{value:!0}),e),ak={};_ne(ak,{TrieRouter:()=>Ane.TrieRouter});var Ine=zne(ak),Ane=bne,I3=Object.defineProperty,Bne=Object.getOwnPropertyDescriptor,Lne=Object.getOwnPropertyNames,One=Object.prototype.hasOwnProperty,Pne=(e,t)=>{for(var n in t)I3(e,n,{get:t[n],enumerable:!0})},Mne=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Lne(t))!One.call(e,a)&&a!==n&&I3(e,a,{get:()=>t[a],enumerable:!(r=Bne(t,a))||r.enumerable});return e},Tne=e=>Mne(I3({},"__esModule",{value:!0}),e),ok={};Pne(ok,{Hono:()=>Fne});var Dne=Tne(ok),$ne=Iee,Nne=Nte,jne=ene,Rne=Ine;class Fne extends $ne.HonoBase{constructor(t={}){super(t),this.router=t.router??new jne.SmartRouter({routers:[new Nne.RegExpRouter,new Rne.TrieRouter]})}}var A3=Object.defineProperty,Vne=Object.getOwnPropertyDescriptor,Une=Object.getOwnPropertyNames,Zne=Object.prototype.hasOwnProperty,qne=(e,t)=>{for(var n in t)A3(e,n,{get:t[n],enumerable:!0})},Hne=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Une(t))!Zne.call(e,a)&&a!==n&&A3(e,a,{get:()=>t[a],enumerable:!(r=Vne(t,a))||r.enumerable});return e},Wne=e=>Hne(A3({},"__esModule",{value:!0}),e),ik={};qne(ik,{Context:()=>Yne.Context,Hono:()=>Xne.Hono});var Gne=Wne(ik),Xne=Dne,Yne=TS,sk={},Kg={},Hr={},nu={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.globalConfig=e.$ZodEncodeError=e.$ZodAsyncError=e.$brand=e.NEVER=void 0,e.$constructor=t,e.config=a,e.NEVER=Object.freeze({status:"aborted"});function t(i,s,d){function l(u,h){var g;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(g=u._zod).traits??(g.traits=new Set),u._zod.traits.add(i),s(u,h);for(const y in m.prototype)y in u||Object.defineProperty(u,y,{value:m.prototype[y].bind(u)});u._zod.constr=m,u._zod.def=h}const c=(d==null?void 0:d.Parent)??Object;class f extends c{}Object.defineProperty(f,"name",{value:i});function m(u){var h;const g=d!=null&&d.Parent?new f:this;l(g,u),(h=g._zod).deferred??(h.deferred=[]);for(const y of g._zod.deferred)y();return g}return Object.defineProperty(m,"init",{value:l}),Object.defineProperty(m,Symbol.hasInstance,{value:u=>{var h,g;return d!=null&&d.Parent&&u instanceof d.Parent?!0:(g=(h=u==null?void 0:u._zod)==null?void 0:h.traits)==null?void 0:g.has(i)}}),Object.defineProperty(m,"name",{value:i}),m}e.$brand=Symbol("zod_brand");class n extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}e.$ZodAsyncError=n;class r extends Error{constructor(s){super(`Encountered unidirectional transform during encode: ${s}`),this.name="ZodEncodeError"}}e.$ZodEncodeError=r,e.globalConfig={};function a(i){return i&&Object.assign(e.globalConfig,i),e.globalConfig}})(nu);var B3={},La={},Re={};Object.defineProperty(Re,"__esModule",{value:!0});Re.Class=Re.BIGINT_FORMAT_RANGES=Re.NUMBER_FORMAT_RANGES=Re.primitiveTypes=Re.propertyKeyTypes=Re.getParsedType=Re.allowsEval=Re.captureStackTrace=void 0;Re.assertEqual=Kne;Re.assertNotEqual=Jne;Re.assertIs=Qne;Re.assertNever=ere;Re.assert=tre;Re.getEnumValues=nre;Re.joinValues=rre;Re.jsonStringifyReplacer=are;Re.cached=lk;Re.nullish=ore;Re.cleanRegex=ire;Re.floatSafeRemainder=sre;Re.defineLazy=lre;Re.objectClone=cre;Re.assignProp=_s;Re.mergeDefs=Es;Re.cloneDef=ure;Re.getElementAtPath=dre;Re.promiseAllObject=fre;Re.randomString=pre;Re.esc=mre;Re.isObject=Jg;Re.isPlainObject=im;Re.shallowClone=hre;Re.numKeys=gre;Re.escapeRegex=bre;Re.clone=zs;Re.normalizeParams=yre;Re.createTransparentProxy=wre;Re.stringifyPrimitive=ck;Re.optionalKeys=xre;Re.pick=Cre;Re.omit=Sre;Re.extend=kre;Re.safeExtend=_re;Re.merge=Ere;Re.partial=zre;Re.required=Ire;Re.aborted=Are;Re.prefixIssues=Bre;Re.unwrapMessage=Fu;Re.finalizeIssue=Lre;Re.getSizableOrigin=Ore;Re.getLengthableOrigin=Pre;Re.issue=Mre;Re.cleanEnum=Tre;Re.base64ToUint8Array=uk;Re.uint8ArrayToBase64=dk;Re.base64urlToUint8Array=Dre;Re.uint8ArrayToBase64url=$re;Re.hexToUint8Array=Nre;Re.uint8ArrayToHex=jre;function Kne(e){return e}function Jne(e){return e}function Qne(e){}function ere(e){throw new Error}function tre(e){}function nre(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,a])=>t.indexOf(+r)===-1).map(([r,a])=>a)}function rre(e,t="|"){return e.map(n=>ck(n)).join(t)}function are(e,t){return typeof t=="bigint"?t.toString():t}function lk(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ore(e){return e==null}function ire(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function sre(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let a=(r.split(".")[1]||"").length;if(a===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(a=Number.parseInt(l[1]))}const i=n>a?n:a,s=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return s%d/10**i}const O8=Symbol("evaluating");function lre(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==O8)return r===void 0&&(r=O8,r=n()),r},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function cre(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function _s(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Es(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function ure(e){return Es(e._zod.def)}function dre(e,t){return t?t.reduce((n,r)=>n==null?void 0:n[r],e):e}function fre(e){const t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{const a={};for(let i=0;i<t.length;i++)a[t[i]]=r[i];return a})}function pre(e=10){const t="abcdefghijklmnopqrstuvwxyz";let n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function mre(e){return JSON.stringify(e)}Re.captureStackTrace="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Jg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}Re.allowsEval=lk(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function im(e){if(Jg(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Jg(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function hre(e){return im(e)?{...e}:Array.isArray(e)?[...e]:e}function gre(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const vre=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}};Re.getParsedType=vre;Re.propertyKeyTypes=new Set(["string","number","symbol"]);Re.primitiveTypes=new Set(["string","number","bigint","boolean","symbol","undefined"]);function bre(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zs(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function yre(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function wre(e){let t;return new Proxy({},{get(n,r,a){return t??(t=e()),Reflect.get(t,r,a)},set(n,r,a,i){return t??(t=e()),Reflect.set(t,r,a,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,a){return t??(t=e()),Reflect.defineProperty(t,r,a)}})}function ck(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function xre(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}Re.NUMBER_FORMAT_RANGES={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};Re.BIGINT_FORMAT_RANGES={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Cre(e,t){const n=e._zod.def,r=Es(e._zod.def,{get shape(){const a={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(a[i]=n.shape[i])}return _s(this,"shape",a),a},checks:[]});return zs(e,r)}function Sre(e,t){const n=e._zod.def,r=Es(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete a[i]}return _s(this,"shape",a),a},checks:[]});return zs(e,r)}function kre(e,t){if(!im(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const a=Es(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return _s(this,"shape",i),i},checks:[]});return zs(e,a)}function _re(e,t){if(!im(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return _s(this,"shape",r),r},checks:e._zod.def.checks};return zs(e,n)}function Ere(e,t){const n=Es(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return _s(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return zs(e,n)}function zre(e,t,n){const r=Es(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(n)for(const s in n){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=e?new e({type:"optional",innerType:a[s]}):a[s])}else for(const s in a)i[s]=e?new e({type:"optional",innerType:a[s]}):a[s];return _s(this,"shape",i),i},checks:[]});return zs(t,r)}function Ire(e,t,n){const r=Es(t._zod.def,{get shape(){const a=t._zod.def.shape,i={...a};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:a[s]}))}else for(const s in a)i[s]=new e({type:"nonoptional",innerType:a[s]});return _s(this,"shape",i),i},checks:[]});return zs(t,r)}function Are(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Bre(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Fu(e){return typeof e=="string"?e:e==null?void 0:e.message}function Lre(e,t,n){var a,i,s,d,l,c;const r={...e,path:e.path??[]};if(!e.message){const f=Fu((s=(i=(a=e.inst)==null?void 0:a._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??Fu((d=t==null?void 0:t.error)==null?void 0:d.call(t,e))??Fu((l=n.customError)==null?void 0:l.call(n,e))??Fu((c=n.localeError)==null?void 0:c.call(n,e))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Ore(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Pre(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Mre(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function Tre(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function uk(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function dk(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Dre(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return uk(t+n)}function $re(e){return dk(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Nre(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function jre(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class Rre{constructor(...t){}}Re.Class=Rre;var Fre=X&&X.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var a=Object.getOwnPropertyDescriptor(t,n);(!a||("get"in a?!t.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,a)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Vre=X&&X.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),Ure=X&&X.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&Fre(t,e,n);return Vre(t,e),t};Object.defineProperty(La,"__esModule",{value:!0});La.$ZodRealError=La.$ZodError=void 0;La.flattenError=qre;La.formatError=Hre;La.treeifyError=Wre;La.toDotPath=mk;La.prettifyError=Gre;const fk=nu,Zre=Ure(Re),pk=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Zre.jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})};La.$ZodError=(0,fk.$constructor)("$ZodError",pk);La.$ZodRealError=(0,fk.$constructor)("$ZodError",pk,{Parent:Error});function qre(e,t=n=>n.message){const n={},r=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}function Hre(e,t=n=>n.message){const n={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>r({issues:s}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,d=0;for(;d<i.path.length;){const l=i.path[d];d===i.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(t(i))):s[l]=s[l]||{_errors:[]},s=s[l],d++}}};return r(e),n}function Wre(e,t=n=>n.message){const n={errors:[]},r=(a,i=[])=>{var s,d;for(const l of a.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(c=>r({issues:c},l.path));else if(l.code==="invalid_key")r({issues:l.issues},l.path);else if(l.code==="invalid_element")r({issues:l.issues},l.path);else{const c=[...i,...l.path];if(c.length===0){n.errors.push(t(l));continue}let f=n,m=0;for(;m<c.length;){const u=c[m],h=m===c.length-1;typeof u=="string"?(f.properties??(f.properties={}),(s=f.properties)[u]??(s[u]={errors:[]}),f=f.properties[u]):(f.items??(f.items=[]),(d=f.items)[u]??(d[u]={errors:[]}),f=f.items[u]),h&&f.errors.push(t(l)),m++}}};return r(e),n}function mk(e){const t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(const r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function Gre(e){var r;const t=[],n=[...e.issues].sort((a,i)=>(a.path??[]).length-(i.path??[]).length);for(const a of n)t.push(`✖ ${a.message}`),(r=a.path)!=null&&r.length&&t.push(` → at ${mk(a.path)}`);return t.join(`
|
|
149
149
|
`)}(function(e){var t=X&&X.__createBinding||(Object.create?function(C,E,_,I){I===void 0&&(I=_);var B=Object.getOwnPropertyDescriptor(E,_);(!B||("get"in B?!E.__esModule:B.writable||B.configurable))&&(B={enumerable:!0,get:function(){return E[_]}}),Object.defineProperty(C,I,B)}:function(C,E,_,I){I===void 0&&(I=_),C[I]=E[_]}),n=X&&X.__setModuleDefault||(Object.create?function(C,E){Object.defineProperty(C,"default",{enumerable:!0,value:E})}:function(C,E){C.default=E}),r=X&&X.__importStar||function(C){if(C&&C.__esModule)return C;var E={};if(C!=null)for(var _ in C)_!=="default"&&Object.prototype.hasOwnProperty.call(C,_)&&t(E,C,_);return n(E,C),E};Object.defineProperty(e,"__esModule",{value:!0}),e.safeDecodeAsync=e._safeDecodeAsync=e.safeEncodeAsync=e._safeEncodeAsync=e.safeDecode=e._safeDecode=e.safeEncode=e._safeEncode=e.decodeAsync=e._decodeAsync=e.encodeAsync=e._encodeAsync=e.decode=e._decode=e.encode=e._encode=e.safeParseAsync=e._safeParseAsync=e.safeParse=e._safeParse=e.parseAsync=e._parseAsync=e.parse=e._parse=void 0;const a=r(nu),i=r(La),s=r(Re),d=C=>(E,_,I,B)=>{const k=I?Object.assign(I,{async:!1}):{async:!1},P=E._zod.run({value:_,issues:[]},k);if(P instanceof Promise)throw new a.$ZodAsyncError;if(P.issues.length){const z=new((B==null?void 0:B.Err)??C)(P.issues.map($=>s.finalizeIssue($,k,a.config())));throw s.captureStackTrace(z,B==null?void 0:B.callee),z}return P.value};e._parse=d,e.parse=(0,e._parse)(i.$ZodRealError);const l=C=>async(E,_,I,B)=>{const k=I?Object.assign(I,{async:!0}):{async:!0};let P=E._zod.run({value:_,issues:[]},k);if(P instanceof Promise&&(P=await P),P.issues.length){const z=new((B==null?void 0:B.Err)??C)(P.issues.map($=>s.finalizeIssue($,k,a.config())));throw s.captureStackTrace(z,B==null?void 0:B.callee),z}return P.value};e._parseAsync=l,e.parseAsync=(0,e._parseAsync)(i.$ZodRealError);const c=C=>(E,_,I)=>{const B=I?{...I,async:!1}:{async:!1},k=E._zod.run({value:_,issues:[]},B);if(k instanceof Promise)throw new a.$ZodAsyncError;return k.issues.length?{success:!1,error:new(C??i.$ZodError)(k.issues.map(P=>s.finalizeIssue(P,B,a.config())))}:{success:!0,data:k.value}};e._safeParse=c,e.safeParse=(0,e._safeParse)(i.$ZodRealError);const f=C=>async(E,_,I)=>{const B=I?Object.assign(I,{async:!0}):{async:!0};let k=E._zod.run({value:_,issues:[]},B);return k instanceof Promise&&(k=await k),k.issues.length?{success:!1,error:new C(k.issues.map(P=>s.finalizeIssue(P,B,a.config())))}:{success:!0,data:k.value}};e._safeParseAsync=f,e.safeParseAsync=(0,e._safeParseAsync)(i.$ZodRealError);const m=C=>(E,_,I)=>{const B=I?Object.assign(I,{direction:"backward"}):{direction:"backward"};return(0,e._parse)(C)(E,_,B)};e._encode=m,e.encode=(0,e._encode)(i.$ZodRealError);const u=C=>(E,_,I)=>(0,e._parse)(C)(E,_,I);e._decode=u,e.decode=(0,e._decode)(i.$ZodRealError);const h=C=>async(E,_,I)=>{const B=I?Object.assign(I,{direction:"backward"}):{direction:"backward"};return(0,e._parseAsync)(C)(E,_,B)};e._encodeAsync=h,e.encodeAsync=(0,e._encodeAsync)(i.$ZodRealError);const g=C=>async(E,_,I)=>(0,e._parseAsync)(C)(E,_,I);e._decodeAsync=g,e.decodeAsync=(0,e._decodeAsync)(i.$ZodRealError);const y=C=>(E,_,I)=>{const B=I?Object.assign(I,{direction:"backward"}):{direction:"backward"};return(0,e._safeParse)(C)(E,_,B)};e._safeEncode=y,e.safeEncode=(0,e._safeEncode)(i.$ZodRealError);const w=C=>(E,_,I)=>(0,e._safeParse)(C)(E,_,I);e._safeDecode=w,e.safeDecode=(0,e._safeDecode)(i.$ZodRealError);const x=C=>async(E,_,I)=>{const B=I?Object.assign(I,{direction:"backward"}):{direction:"backward"};return(0,e._safeParseAsync)(C)(E,_,B)};e._safeEncodeAsync=x,e.safeEncodeAsync=(0,e._safeEncodeAsync)(i.$ZodRealError);const S=C=>async(E,_,I)=>(0,e._safeParseAsync)(C)(E,_,I);e._safeDecodeAsync=S,e.safeDecodeAsync=(0,e._safeDecodeAsync)(i.$ZodRealError)})(B3);var L3={},sm={},lm={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sha384_base64=e.sha384_hex=e.sha256_base64url=e.sha256_base64=e.sha256_hex=e.sha1_base64url=e.sha1_base64=e.sha1_hex=e.md5_base64url=e.md5_base64=e.md5_hex=e.hex=e.uppercase=e.lowercase=e.undefined=e.null=e.boolean=e.number=e.integer=e.bigint=e.string=e.date=e.e164=e.domain=e.hostname=e.base64url=e.base64=e.cidrv6=e.cidrv4=e.ipv6=e.ipv4=e.browserEmail=e.idnEmail=e.unicodeEmail=e.rfc5322Email=e.html5Email=e.email=e.uuid7=e.uuid6=e.uuid4=e.uuid=e.guid=e.extendedDuration=e.duration=e.nanoid=e.ksuid=e.xid=e.ulid=e.cuid2=e.cuid=void 0,e.sha512_base64url=e.sha512_base64=e.sha512_hex=e.sha384_base64url=void 0,e.emoji=r,e.time=s,e.datetime=d,e.cuid=/^[cC][^\s-]{8,}$/,e.cuid2=/^[0-9a-z]+$/,e.ulid=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,e.xid=/^[0-9a-vA-V]{20}$/,e.ksuid=/^[A-Za-z0-9]{27}$/,e.nanoid=/^[a-zA-Z0-9_-]{21}$/,e.duration=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,e.extendedDuration=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,e.guid=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;const t=h=>h?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${h}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;e.uuid=t,e.uuid4=(0,e.uuid)(4),e.uuid6=(0,e.uuid)(6),e.uuid7=(0,e.uuid)(7),e.email=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,e.html5Email=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,e.rfc5322Email=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,e.unicodeEmail=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,e.idnEmail=e.unicodeEmail,e.browserEmail=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;const n="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function r(){return new RegExp(n,"u")}e.ipv4=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,e.ipv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,e.cidrv4=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,e.cidrv6=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,e.base64=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,e.base64url=/^[A-Za-z0-9_-]*$/,e.hostname=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,e.domain=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,e.e164=/^\+(?:[0-9]){6,14}[0-9]$/;const a="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";e.date=new RegExp(`^${a}$`);function i(h){const g="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof h.precision=="number"?h.precision===-1?`${g}`:h.precision===0?`${g}:[0-5]\\d`:`${g}:[0-5]\\d\\.\\d{${h.precision}}`:`${g}(?::[0-5]\\d(?:\\.\\d+)?)?`}function s(h){return new RegExp(`^${i(h)}$`)}function d(h){const g=i({precision:h.precision}),y=["Z"];h.local&&y.push(""),h.offset&&y.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const w=`${g}(?:${y.join("|")})`;return new RegExp(`^${a}T(?:${w})$`)}const l=h=>{const g=h?`[\\s\\S]{${(h==null?void 0:h.minimum)??0},${(h==null?void 0:h.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${g}$`)};e.string=l,e.bigint=/^-?\d+n?$/,e.integer=/^-?\d+$/,e.number=/^-?\d+(?:\.\d+)?/,e.boolean=/^(?:true|false)$/i;const c=/^null$/i;e.null=c;const f=/^undefined$/i;e.undefined=f,e.lowercase=/^[^A-Z]*$/,e.uppercase=/^[^a-z]*$/,e.hex=/^[0-9a-fA-F]*$/;function m(h,g){return new RegExp(`^[A-Za-z0-9+/]{${h}}${g}$`)}function u(h){return new RegExp(`^[A-Za-z0-9_-]{${h}}$`)}e.md5_hex=/^[0-9a-fA-F]{32}$/,e.md5_base64=m(22,"=="),e.md5_base64url=u(22),e.sha1_hex=/^[0-9a-fA-F]{40}$/,e.sha1_base64=m(27,"="),e.sha1_base64url=u(27),e.sha256_hex=/^[0-9a-fA-F]{64}$/,e.sha256_base64=m(43,"="),e.sha256_base64url=u(43),e.sha384_hex=/^[0-9a-fA-F]{96}$/,e.sha384_base64=m(64,""),e.sha384_base64url=u(64),e.sha512_hex=/^[0-9a-fA-F]{128}$/,e.sha512_base64=m(86,"=="),e.sha512_base64url=u(86)})(lm);(function(e){var t=X&&X.__createBinding||(Object.create?function(c,f,m,u){u===void 0&&(u=m);var h=Object.getOwnPropertyDescriptor(f,m);(!h||("get"in h?!f.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:function(){return f[m]}}),Object.defineProperty(c,u,h)}:function(c,f,m,u){u===void 0&&(u=m),c[u]=f[m]}),n=X&&X.__setModuleDefault||(Object.create?function(c,f){Object.defineProperty(c,"default",{enumerable:!0,value:f})}:function(c,f){c.default=f}),r=X&&X.__importStar||function(c){if(c&&c.__esModule)return c;var f={};if(c!=null)for(var m in c)m!=="default"&&Object.prototype.hasOwnProperty.call(c,m)&&t(f,c,m);return n(f,c),f};Object.defineProperty(e,"__esModule",{value:!0}),e.$ZodCheckOverwrite=e.$ZodCheckMimeType=e.$ZodCheckProperty=e.$ZodCheckEndsWith=e.$ZodCheckStartsWith=e.$ZodCheckIncludes=e.$ZodCheckUpperCase=e.$ZodCheckLowerCase=e.$ZodCheckRegex=e.$ZodCheckStringFormat=e.$ZodCheckLengthEquals=e.$ZodCheckMinLength=e.$ZodCheckMaxLength=e.$ZodCheckSizeEquals=e.$ZodCheckMinSize=e.$ZodCheckMaxSize=e.$ZodCheckBigIntFormat=e.$ZodCheckNumberFormat=e.$ZodCheckMultipleOf=e.$ZodCheckGreaterThan=e.$ZodCheckLessThan=e.$ZodCheck=void 0;const a=r(nu),i=r(lm),s=r(Re);e.$ZodCheck=a.$constructor("$ZodCheck",(c,f)=>{var m;c._zod??(c._zod={}),c._zod.def=f,(m=c._zod).onattach??(m.onattach=[])});const d={number:"number",bigint:"bigint",object:"date"};e.$ZodCheckLessThan=a.$constructor("$ZodCheckLessThan",(c,f)=>{e.$ZodCheck.init(c,f);const m=d[typeof f.value];c._zod.onattach.push(u=>{const h=u._zod.bag,g=(f.inclusive?h.maximum:h.exclusiveMaximum)??Number.POSITIVE_INFINITY;f.value<g&&(f.inclusive?h.maximum=f.value:h.exclusiveMaximum=f.value)}),c._zod.check=u=>{(f.inclusive?u.value<=f.value:u.value<f.value)||u.issues.push({origin:m,code:"too_big",maximum:f.value,input:u.value,inclusive:f.inclusive,inst:c,continue:!f.abort})}}),e.$ZodCheckGreaterThan=a.$constructor("$ZodCheckGreaterThan",(c,f)=>{e.$ZodCheck.init(c,f);const m=d[typeof f.value];c._zod.onattach.push(u=>{const h=u._zod.bag,g=(f.inclusive?h.minimum:h.exclusiveMinimum)??Number.NEGATIVE_INFINITY;f.value>g&&(f.inclusive?h.minimum=f.value:h.exclusiveMinimum=f.value)}),c._zod.check=u=>{(f.inclusive?u.value>=f.value:u.value>f.value)||u.issues.push({origin:m,code:"too_small",minimum:f.value,input:u.value,inclusive:f.inclusive,inst:c,continue:!f.abort})}}),e.$ZodCheckMultipleOf=a.$constructor("$ZodCheckMultipleOf",(c,f)=>{e.$ZodCheck.init(c,f),c._zod.onattach.push(m=>{var u;(u=m._zod.bag).multipleOf??(u.multipleOf=f.value)}),c._zod.check=m=>{if(typeof m.value!=typeof f.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof m.value=="bigint"?m.value%f.value===BigInt(0):s.floatSafeRemainder(m.value,f.value)===0)||m.issues.push({origin:typeof m.value,code:"not_multiple_of",divisor:f.value,input:m.value,inst:c,continue:!f.abort})}}),e.$ZodCheckNumberFormat=a.$constructor("$ZodCheckNumberFormat",(c,f)=>{var y;e.$ZodCheck.init(c,f),f.format=f.format||"float64";const m=(y=f.format)==null?void 0:y.includes("int"),u=m?"int":"number",[h,g]=s.NUMBER_FORMAT_RANGES[f.format];c._zod.onattach.push(w=>{const x=w._zod.bag;x.format=f.format,x.minimum=h,x.maximum=g,m&&(x.pattern=i.integer)}),c._zod.check=w=>{const x=w.value;if(m){if(!Number.isInteger(x)){w.issues.push({expected:u,format:f.format,code:"invalid_type",continue:!1,input:x,inst:c});return}if(!Number.isSafeInteger(x)){x>0?w.issues.push({input:x,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:c,origin:u,continue:!f.abort}):w.issues.push({input:x,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:c,origin:u,continue:!f.abort});return}}x<h&&w.issues.push({origin:"number",input:x,code:"too_small",minimum:h,inclusive:!0,inst:c,continue:!f.abort}),x>g&&w.issues.push({origin:"number",input:x,code:"too_big",maximum:g,inst:c})}}),e.$ZodCheckBigIntFormat=a.$constructor("$ZodCheckBigIntFormat",(c,f)=>{e.$ZodCheck.init(c,f);const[m,u]=s.BIGINT_FORMAT_RANGES[f.format];c._zod.onattach.push(h=>{const g=h._zod.bag;g.format=f.format,g.minimum=m,g.maximum=u}),c._zod.check=h=>{const g=h.value;g<m&&h.issues.push({origin:"bigint",input:g,code:"too_small",minimum:m,inclusive:!0,inst:c,continue:!f.abort}),g>u&&h.issues.push({origin:"bigint",input:g,code:"too_big",maximum:u,inst:c})}}),e.$ZodCheckMaxSize=a.$constructor("$ZodCheckMaxSize",(c,f)=>{var m;e.$ZodCheck.init(c,f),(m=c._zod.def).when??(m.when=u=>{const h=u.value;return!s.nullish(h)&&h.size!==void 0}),c._zod.onattach.push(u=>{const h=u._zod.bag.maximum??Number.POSITIVE_INFINITY;f.maximum<h&&(u._zod.bag.maximum=f.maximum)}),c._zod.check=u=>{const h=u.value;h.size<=f.maximum||u.issues.push({origin:s.getSizableOrigin(h),code:"too_big",maximum:f.maximum,inclusive:!0,input:h,inst:c,continue:!f.abort})}}),e.$ZodCheckMinSize=a.$constructor("$ZodCheckMinSize",(c,f)=>{var m;e.$ZodCheck.init(c,f),(m=c._zod.def).when??(m.when=u=>{const h=u.value;return!s.nullish(h)&&h.size!==void 0}),c._zod.onattach.push(u=>{const h=u._zod.bag.minimum??Number.NEGATIVE_INFINITY;f.minimum>h&&(u._zod.bag.minimum=f.minimum)}),c._zod.check=u=>{const h=u.value;h.size>=f.minimum||u.issues.push({origin:s.getSizableOrigin(h),code:"too_small",minimum:f.minimum,inclusive:!0,input:h,inst:c,continue:!f.abort})}}),e.$ZodCheckSizeEquals=a.$constructor("$ZodCheckSizeEquals",(c,f)=>{var m;e.$ZodCheck.init(c,f),(m=c._zod.def).when??(m.when=u=>{const h=u.value;return!s.nullish(h)&&h.size!==void 0}),c._zod.onattach.push(u=>{const h=u._zod.bag;h.minimum=f.size,h.maximum=f.size,h.size=f.size}),c._zod.check=u=>{const h=u.value,g=h.size;if(g===f.size)return;const y=g>f.size;u.issues.push({origin:s.getSizableOrigin(h),...y?{code:"too_big",maximum:f.size}:{code:"too_small",minimum:f.size},inclusive:!0,exact:!0,input:u.value,inst:c,continue:!f.abort})}}),e.$ZodCheckMaxLength=a.$constructor("$ZodCheckMaxLength",(c,f)=>{var m;e.$ZodCheck.init(c,f),(m=c._zod.def).when??(m.when=u=>{const h=u.value;return!s.nullish(h)&&h.length!==void 0}),c._zod.onattach.push(u=>{const h=u._zod.bag.maximum??Number.POSITIVE_INFINITY;f.maximum<h&&(u._zod.bag.maximum=f.maximum)}),c._zod.check=u=>{const h=u.value;if(h.length<=f.maximum)return;const y=s.getLengthableOrigin(h);u.issues.push({origin:y,code:"too_big",maximum:f.maximum,inclusive:!0,input:h,inst:c,continue:!f.abort})}}),e.$ZodCheckMinLength=a.$constructor("$ZodCheckMinLength",(c,f)=>{var m;e.$ZodCheck.init(c,f),(m=c._zod.def).when??(m.when=u=>{const h=u.value;return!s.nullish(h)&&h.length!==void 0}),c._zod.onattach.push(u=>{const h=u._zod.bag.minimum??Number.NEGATIVE_INFINITY;f.minimum>h&&(u._zod.bag.minimum=f.minimum)}),c._zod.check=u=>{const h=u.value;if(h.length>=f.minimum)return;const y=s.getLengthableOrigin(h);u.issues.push({origin:y,code:"too_small",minimum:f.minimum,inclusive:!0,input:h,inst:c,continue:!f.abort})}}),e.$ZodCheckLengthEquals=a.$constructor("$ZodCheckLengthEquals",(c,f)=>{var m;e.$ZodCheck.init(c,f),(m=c._zod.def).when??(m.when=u=>{const h=u.value;return!s.nullish(h)&&h.length!==void 0}),c._zod.onattach.push(u=>{const h=u._zod.bag;h.minimum=f.length,h.maximum=f.length,h.length=f.length}),c._zod.check=u=>{const h=u.value,g=h.length;if(g===f.length)return;const y=s.getLengthableOrigin(h),w=g>f.length;u.issues.push({origin:y,...w?{code:"too_big",maximum:f.length}:{code:"too_small",minimum:f.length},inclusive:!0,exact:!0,input:u.value,inst:c,continue:!f.abort})}}),e.$ZodCheckStringFormat=a.$constructor("$ZodCheckStringFormat",(c,f)=>{var m,u;e.$ZodCheck.init(c,f),c._zod.onattach.push(h=>{const g=h._zod.bag;g.format=f.format,f.pattern&&(g.patterns??(g.patterns=new Set),g.patterns.add(f.pattern))}),f.pattern?(m=c._zod).check??(m.check=h=>{f.pattern.lastIndex=0,!f.pattern.test(h.value)&&h.issues.push({origin:"string",code:"invalid_format",format:f.format,input:h.value,...f.pattern?{pattern:f.pattern.toString()}:{},inst:c,continue:!f.abort})}):(u=c._zod).check??(u.check=()=>{})}),e.$ZodCheckRegex=a.$constructor("$ZodCheckRegex",(c,f)=>{e.$ZodCheckStringFormat.init(c,f),c._zod.check=m=>{f.pattern.lastIndex=0,!f.pattern.test(m.value)&&m.issues.push({origin:"string",code:"invalid_format",format:"regex",input:m.value,pattern:f.pattern.toString(),inst:c,continue:!f.abort})}}),e.$ZodCheckLowerCase=a.$constructor("$ZodCheckLowerCase",(c,f)=>{f.pattern??(f.pattern=i.lowercase),e.$ZodCheckStringFormat.init(c,f)}),e.$ZodCheckUpperCase=a.$constructor("$ZodCheckUpperCase",(c,f)=>{f.pattern??(f.pattern=i.uppercase),e.$ZodCheckStringFormat.init(c,f)}),e.$ZodCheckIncludes=a.$constructor("$ZodCheckIncludes",(c,f)=>{e.$ZodCheck.init(c,f);const m=s.escapeRegex(f.includes),u=new RegExp(typeof f.position=="number"?`^.{${f.position}}${m}`:m);f.pattern=u,c._zod.onattach.push(h=>{const g=h._zod.bag;g.patterns??(g.patterns=new Set),g.patterns.add(u)}),c._zod.check=h=>{h.value.includes(f.includes,f.position)||h.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:f.includes,input:h.value,inst:c,continue:!f.abort})}}),e.$ZodCheckStartsWith=a.$constructor("$ZodCheckStartsWith",(c,f)=>{e.$ZodCheck.init(c,f);const m=new RegExp(`^${s.escapeRegex(f.prefix)}.*`);f.pattern??(f.pattern=m),c._zod.onattach.push(u=>{const h=u._zod.bag;h.patterns??(h.patterns=new Set),h.patterns.add(m)}),c._zod.check=u=>{u.value.startsWith(f.prefix)||u.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:f.prefix,input:u.value,inst:c,continue:!f.abort})}}),e.$ZodCheckEndsWith=a.$constructor("$ZodCheckEndsWith",(c,f)=>{e.$ZodCheck.init(c,f);const m=new RegExp(`.*${s.escapeRegex(f.suffix)}$`);f.pattern??(f.pattern=m),c._zod.onattach.push(u=>{const h=u._zod.bag;h.patterns??(h.patterns=new Set),h.patterns.add(m)}),c._zod.check=u=>{u.value.endsWith(f.suffix)||u.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:f.suffix,input:u.value,inst:c,continue:!f.abort})}});function l(c,f,m){c.issues.length&&f.issues.push(...s.prefixIssues(m,c.issues))}e.$ZodCheckProperty=a.$constructor("$ZodCheckProperty",(c,f)=>{e.$ZodCheck.init(c,f),c._zod.check=m=>{const u=f.schema._zod.run({value:m.value[f.property],issues:[]},{});if(u instanceof Promise)return u.then(h=>l(h,m,f.property));l(u,m,f.property)}}),e.$ZodCheckMimeType=a.$constructor("$ZodCheckMimeType",(c,f)=>{e.$ZodCheck.init(c,f);const m=new Set(f.mime);c._zod.onattach.push(u=>{u._zod.bag.mime=f.mime}),c._zod.check=u=>{m.has(u.value.type)||u.issues.push({code:"invalid_value",values:f.mime,input:u.value.type,inst:c,continue:!f.abort})}}),e.$ZodCheckOverwrite=a.$constructor("$ZodCheckOverwrite",(c,f)=>{e.$ZodCheck.init(c,f),c._zod.check=m=>{m.value=f.tx(m.value)}})})(sm);var p0={};Object.defineProperty(p0,"__esModule",{value:!0});p0.Doc=void 0;class Xre{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
150
150
|
`).filter(s=>s),a=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(a)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this==null?void 0:this.args,a=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,a.join(`
|
|
151
151
|
`))}}p0.Doc=Xre;var m0={};Object.defineProperty(m0,"__esModule",{value:!0});m0.version=void 0;m0.version={major:4,minor:1,patch:12};(function(e){var t=X&&X.__createBinding||(Object.create?function(L,O,D,R){R===void 0&&(R=D);var W=Object.getOwnPropertyDescriptor(O,D);(!W||("get"in W?!O.__esModule:W.writable||W.configurable))&&(W={enumerable:!0,get:function(){return O[D]}}),Object.defineProperty(L,R,W)}:function(L,O,D,R){R===void 0&&(R=D),L[R]=O[D]}),n=X&&X.__setModuleDefault||(Object.create?function(L,O){Object.defineProperty(L,"default",{enumerable:!0,value:O})}:function(L,O){L.default=O}),r=X&&X.__importStar||function(L){if(L&&L.__esModule)return L;var O={};if(L!=null)for(var D in L)D!=="default"&&Object.prototype.hasOwnProperty.call(L,D)&&t(O,L,D);return n(O,L),O};Object.defineProperty(e,"__esModule",{value:!0}),e.$ZodMap=e.$ZodRecord=e.$ZodTuple=e.$ZodIntersection=e.$ZodDiscriminatedUnion=e.$ZodUnion=e.$ZodObjectJIT=e.$ZodObject=e.$ZodArray=e.$ZodDate=e.$ZodVoid=e.$ZodNever=e.$ZodUnknown=e.$ZodAny=e.$ZodNull=e.$ZodUndefined=e.$ZodSymbol=e.$ZodBigIntFormat=e.$ZodBigInt=e.$ZodBoolean=e.$ZodNumberFormat=e.$ZodNumber=e.$ZodCustomStringFormat=e.$ZodJWT=e.$ZodE164=e.$ZodBase64URL=e.$ZodBase64=e.$ZodCIDRv6=e.$ZodCIDRv4=e.$ZodIPv6=e.$ZodIPv4=e.$ZodISODuration=e.$ZodISOTime=e.$ZodISODate=e.$ZodISODateTime=e.$ZodKSUID=e.$ZodXID=e.$ZodULID=e.$ZodCUID2=e.$ZodCUID=e.$ZodNanoID=e.$ZodEmoji=e.$ZodURL=e.$ZodEmail=e.$ZodUUID=e.$ZodGUID=e.$ZodStringFormat=e.$ZodString=e.clone=e.$ZodType=void 0,e.$ZodCustom=e.$ZodLazy=e.$ZodPromise=e.$ZodFunction=e.$ZodTemplateLiteral=e.$ZodReadonly=e.$ZodCodec=e.$ZodPipe=e.$ZodNaN=e.$ZodCatch=e.$ZodSuccess=e.$ZodNonOptional=e.$ZodPrefault=e.$ZodDefault=e.$ZodNullable=e.$ZodOptional=e.$ZodTransform=e.$ZodFile=e.$ZodLiteral=e.$ZodEnum=e.$ZodSet=void 0,e.isValidBase64=u,e.isValidBase64URL=h,e.isValidJWT=g;const a=r(sm),i=r(nu),s=p0,d=B3,l=r(lm),c=r(Re),f=m0;e.$ZodType=i.$constructor("$ZodType",(L,O)=>{var W;var D;L??(L={}),L._zod.def=O,L._zod.bag=L._zod.bag||{},L._zod.version=f.version;const R=[...L._zod.def.checks??[]];L._zod.traits.has("$ZodCheck")&&R.unshift(L);for(const ee of R)for(const se of ee._zod.onattach)se(L);if(R.length===0)(D=L._zod).deferred??(D.deferred=[]),(W=L._zod.deferred)==null||W.push(()=>{L._zod.run=L._zod.parse});else{const ee=(ie,le,ue)=>{let he=c.aborted(ie),Y;for(const M of le){if(M._zod.def.when){if(!M._zod.def.when(ie))continue}else if(he)continue;const N=ie.issues.length,q=M._zod.check(ie);if(q instanceof Promise&&(ue==null?void 0:ue.async)===!1)throw new i.$ZodAsyncError;if(Y||q instanceof Promise)Y=(Y??Promise.resolve()).then(async()=>{await q,ie.issues.length!==N&&(he||(he=c.aborted(ie,N)))});else{if(ie.issues.length===N)continue;he||(he=c.aborted(ie,N))}}return Y?Y.then(()=>ie):ie},se=(ie,le,ue)=>{if(c.aborted(ie))return ie.aborted=!0,ie;const he=ee(le,R,ue);if(he instanceof Promise){if(ue.async===!1)throw new i.$ZodAsyncError;return he.then(Y=>L._zod.parse(Y,ue))}return L._zod.parse(he,ue)};L._zod.run=(ie,le)=>{if(le.skipChecks)return L._zod.parse(ie,le);if(le.direction==="backward"){const he=L._zod.parse({value:ie.value,issues:[]},{...le,skipChecks:!0});return he instanceof Promise?he.then(Y=>se(Y,ie,le)):se(he,ie,le)}const ue=L._zod.parse(ie,le);if(ue instanceof Promise){if(le.async===!1)throw new i.$ZodAsyncError;return ue.then(he=>ee(he,R,le))}return ee(ue,R,le)}}L["~standard"]={validate:ee=>{var se;try{const ie=(0,d.safeParse)(L,ee);return ie.success?{value:ie.data}:{issues:(se=ie.error)==null?void 0:se.issues}}catch{return(0,d.safeParseAsync)(L,ee).then(le=>{var ue;return le.success?{value:le.data}:{issues:(ue=le.error)==null?void 0:ue.issues}})}},vendor:"zod",version:1}});var m=Re;Object.defineProperty(e,"clone",{enumerable:!0,get:function(){return m.clone}}),e.$ZodString=i.$constructor("$ZodString",(L,O)=>{var D;e.$ZodType.init(L,O),L._zod.pattern=[...((D=L==null?void 0:L._zod.bag)==null?void 0:D.patterns)??[]].pop()??l.string(L._zod.bag),L._zod.parse=(R,W)=>{if(O.coerce)try{R.value=String(R.value)}catch{}return typeof R.value=="string"||R.issues.push({expected:"string",code:"invalid_type",input:R.value,inst:L}),R}}),e.$ZodStringFormat=i.$constructor("$ZodStringFormat",(L,O)=>{a.$ZodCheckStringFormat.init(L,O),e.$ZodString.init(L,O)}),e.$ZodGUID=i.$constructor("$ZodGUID",(L,O)=>{O.pattern??(O.pattern=l.guid),e.$ZodStringFormat.init(L,O)}),e.$ZodUUID=i.$constructor("$ZodUUID",(L,O)=>{if(O.version){const R={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[O.version];if(R===void 0)throw new Error(`Invalid UUID version: "${O.version}"`);O.pattern??(O.pattern=l.uuid(R))}else O.pattern??(O.pattern=l.uuid());e.$ZodStringFormat.init(L,O)}),e.$ZodEmail=i.$constructor("$ZodEmail",(L,O)=>{O.pattern??(O.pattern=l.email),e.$ZodStringFormat.init(L,O)}),e.$ZodURL=i.$constructor("$ZodURL",(L,O)=>{e.$ZodStringFormat.init(L,O),L._zod.check=D=>{try{const R=D.value.trim(),W=new URL(R);O.hostname&&(O.hostname.lastIndex=0,O.hostname.test(W.hostname)||D.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:l.hostname.source,input:D.value,inst:L,continue:!O.abort})),O.protocol&&(O.protocol.lastIndex=0,O.protocol.test(W.protocol.endsWith(":")?W.protocol.slice(0,-1):W.protocol)||D.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:O.protocol.source,input:D.value,inst:L,continue:!O.abort})),O.normalize?D.value=W.href:D.value=R;return}catch{D.issues.push({code:"invalid_format",format:"url",input:D.value,inst:L,continue:!O.abort})}}}),e.$ZodEmoji=i.$constructor("$ZodEmoji",(L,O)=>{O.pattern??(O.pattern=l.emoji()),e.$ZodStringFormat.init(L,O)}),e.$ZodNanoID=i.$constructor("$ZodNanoID",(L,O)=>{O.pattern??(O.pattern=l.nanoid),e.$ZodStringFormat.init(L,O)}),e.$ZodCUID=i.$constructor("$ZodCUID",(L,O)=>{O.pattern??(O.pattern=l.cuid),e.$ZodStringFormat.init(L,O)}),e.$ZodCUID2=i.$constructor("$ZodCUID2",(L,O)=>{O.pattern??(O.pattern=l.cuid2),e.$ZodStringFormat.init(L,O)}),e.$ZodULID=i.$constructor("$ZodULID",(L,O)=>{O.pattern??(O.pattern=l.ulid),e.$ZodStringFormat.init(L,O)}),e.$ZodXID=i.$constructor("$ZodXID",(L,O)=>{O.pattern??(O.pattern=l.xid),e.$ZodStringFormat.init(L,O)}),e.$ZodKSUID=i.$constructor("$ZodKSUID",(L,O)=>{O.pattern??(O.pattern=l.ksuid),e.$ZodStringFormat.init(L,O)}),e.$ZodISODateTime=i.$constructor("$ZodISODateTime",(L,O)=>{O.pattern??(O.pattern=l.datetime(O)),e.$ZodStringFormat.init(L,O)}),e.$ZodISODate=i.$constructor("$ZodISODate",(L,O)=>{O.pattern??(O.pattern=l.date),e.$ZodStringFormat.init(L,O)}),e.$ZodISOTime=i.$constructor("$ZodISOTime",(L,O)=>{O.pattern??(O.pattern=l.time(O)),e.$ZodStringFormat.init(L,O)}),e.$ZodISODuration=i.$constructor("$ZodISODuration",(L,O)=>{O.pattern??(O.pattern=l.duration),e.$ZodStringFormat.init(L,O)}),e.$ZodIPv4=i.$constructor("$ZodIPv4",(L,O)=>{O.pattern??(O.pattern=l.ipv4),e.$ZodStringFormat.init(L,O),L._zod.onattach.push(D=>{const R=D._zod.bag;R.format="ipv4"})}),e.$ZodIPv6=i.$constructor("$ZodIPv6",(L,O)=>{O.pattern??(O.pattern=l.ipv6),e.$ZodStringFormat.init(L,O),L._zod.onattach.push(D=>{const R=D._zod.bag;R.format="ipv6"}),L._zod.check=D=>{try{new URL(`http://[${D.value}]`)}catch{D.issues.push({code:"invalid_format",format:"ipv6",input:D.value,inst:L,continue:!O.abort})}}}),e.$ZodCIDRv4=i.$constructor("$ZodCIDRv4",(L,O)=>{O.pattern??(O.pattern=l.cidrv4),e.$ZodStringFormat.init(L,O)}),e.$ZodCIDRv6=i.$constructor("$ZodCIDRv6",(L,O)=>{O.pattern??(O.pattern=l.cidrv6),e.$ZodStringFormat.init(L,O),L._zod.check=D=>{const R=D.value.split("/");try{if(R.length!==2)throw new Error;const[W,ee]=R;if(!ee)throw new Error;const se=Number(ee);if(`${se}`!==ee)throw new Error;if(se<0||se>128)throw new Error;new URL(`http://[${W}]`)}catch{D.issues.push({code:"invalid_format",format:"cidrv6",input:D.value,inst:L,continue:!O.abort})}}});function u(L){if(L==="")return!0;if(L.length%4!==0)return!1;try{return atob(L),!0}catch{return!1}}e.$ZodBase64=i.$constructor("$ZodBase64",(L,O)=>{O.pattern??(O.pattern=l.base64),e.$ZodStringFormat.init(L,O),L._zod.onattach.push(D=>{D._zod.bag.contentEncoding="base64"}),L._zod.check=D=>{u(D.value)||D.issues.push({code:"invalid_format",format:"base64",input:D.value,inst:L,continue:!O.abort})}});function h(L){if(!l.base64url.test(L))return!1;const O=L.replace(/[-_]/g,R=>R==="-"?"+":"/"),D=O.padEnd(Math.ceil(O.length/4)*4,"=");return u(D)}e.$ZodBase64URL=i.$constructor("$ZodBase64URL",(L,O)=>{O.pattern??(O.pattern=l.base64url),e.$ZodStringFormat.init(L,O),L._zod.onattach.push(D=>{D._zod.bag.contentEncoding="base64url"}),L._zod.check=D=>{h(D.value)||D.issues.push({code:"invalid_format",format:"base64url",input:D.value,inst:L,continue:!O.abort})}}),e.$ZodE164=i.$constructor("$ZodE164",(L,O)=>{O.pattern??(O.pattern=l.e164),e.$ZodStringFormat.init(L,O)});function g(L,O=null){try{const D=L.split(".");if(D.length!==3)return!1;const[R]=D;if(!R)return!1;const W=JSON.parse(atob(R));return!("typ"in W&&(W==null?void 0:W.typ)!=="JWT"||!W.alg||O&&(!("alg"in W)||W.alg!==O))}catch{return!1}}e.$ZodJWT=i.$constructor("$ZodJWT",(L,O)=>{e.$ZodStringFormat.init(L,O),L._zod.check=D=>{g(D.value,O.alg)||D.issues.push({code:"invalid_format",format:"jwt",input:D.value,inst:L,continue:!O.abort})}}),e.$ZodCustomStringFormat=i.$constructor("$ZodCustomStringFormat",(L,O)=>{e.$ZodStringFormat.init(L,O),L._zod.check=D=>{O.fn(D.value)||D.issues.push({code:"invalid_format",format:O.format,input:D.value,inst:L,continue:!O.abort})}}),e.$ZodNumber=i.$constructor("$ZodNumber",(L,O)=>{e.$ZodType.init(L,O),L._zod.pattern=L._zod.bag.pattern??l.number,L._zod.parse=(D,R)=>{if(O.coerce)try{D.value=Number(D.value)}catch{}const W=D.value;if(typeof W=="number"&&!Number.isNaN(W)&&Number.isFinite(W))return D;const ee=typeof W=="number"?Number.isNaN(W)?"NaN":Number.isFinite(W)?void 0:"Infinity":void 0;return D.issues.push({expected:"number",code:"invalid_type",input:W,inst:L,...ee?{received:ee}:{}}),D}}),e.$ZodNumberFormat=i.$constructor("$ZodNumber",(L,O)=>{a.$ZodCheckNumberFormat.init(L,O),e.$ZodNumber.init(L,O)}),e.$ZodBoolean=i.$constructor("$ZodBoolean",(L,O)=>{e.$ZodType.init(L,O),L._zod.pattern=l.boolean,L._zod.parse=(D,R)=>{if(O.coerce)try{D.value=!!D.value}catch{}const W=D.value;return typeof W=="boolean"||D.issues.push({expected:"boolean",code:"invalid_type",input:W,inst:L}),D}}),e.$ZodBigInt=i.$constructor("$ZodBigInt",(L,O)=>{e.$ZodType.init(L,O),L._zod.pattern=l.bigint,L._zod.parse=(D,R)=>{if(O.coerce)try{D.value=BigInt(D.value)}catch{}return typeof D.value=="bigint"||D.issues.push({expected:"bigint",code:"invalid_type",input:D.value,inst:L}),D}}),e.$ZodBigIntFormat=i.$constructor("$ZodBigInt",(L,O)=>{a.$ZodCheckBigIntFormat.init(L,O),e.$ZodBigInt.init(L,O)}),e.$ZodSymbol=i.$constructor("$ZodSymbol",(L,O)=>{e.$ZodType.init(L,O),L._zod.parse=(D,R)=>{const W=D.value;return typeof W=="symbol"||D.issues.push({expected:"symbol",code:"invalid_type",input:W,inst:L}),D}}),e.$ZodUndefined=i.$constructor("$ZodUndefined",(L,O)=>{e.$ZodType.init(L,O),L._zod.pattern=l.undefined,L._zod.values=new Set([void 0]),L._zod.optin="optional",L._zod.optout="optional",L._zod.parse=(D,R)=>{const W=D.value;return typeof W>"u"||D.issues.push({expected:"undefined",code:"invalid_type",input:W,inst:L}),D}}),e.$ZodNull=i.$constructor("$ZodNull",(L,O)=>{e.$ZodType.init(L,O),L._zod.pattern=l.null,L._zod.values=new Set([null]),L._zod.parse=(D,R)=>{const W=D.value;return W===null||D.issues.push({expected:"null",code:"invalid_type",input:W,inst:L}),D}}),e.$ZodAny=i.$constructor("$ZodAny",(L,O)=>{e.$ZodType.init(L,O),L._zod.parse=D=>D}),e.$ZodUnknown=i.$constructor("$ZodUnknown",(L,O)=>{e.$ZodType.init(L,O),L._zod.parse=D=>D}),e.$ZodNever=i.$constructor("$ZodNever",(L,O)=>{e.$ZodType.init(L,O),L._zod.parse=(D,R)=>(D.issues.push({expected:"never",code:"invalid_type",input:D.value,inst:L}),D)}),e.$ZodVoid=i.$constructor("$ZodVoid",(L,O)=>{e.$ZodType.init(L,O),L._zod.parse=(D,R)=>{const W=D.value;return typeof W>"u"||D.issues.push({expected:"void",code:"invalid_type",input:W,inst:L}),D}}),e.$ZodDate=i.$constructor("$ZodDate",(L,O)=>{e.$ZodType.init(L,O),L._zod.parse=(D,R)=>{if(O.coerce)try{D.value=new Date(D.value)}catch{}const W=D.value,ee=W instanceof Date;return ee&&!Number.isNaN(W.getTime())||D.issues.push({expected:"date",code:"invalid_type",input:W,...ee?{received:"Invalid Date"}:{},inst:L}),D}});function y(L,O,D){L.issues.length&&O.issues.push(...c.prefixIssues(D,L.issues)),O.value[D]=L.value}e.$ZodArray=i.$constructor("$ZodArray",(L,O)=>{e.$ZodType.init(L,O),L._zod.parse=(D,R)=>{const W=D.value;if(!Array.isArray(W))return D.issues.push({expected:"array",code:"invalid_type",input:W,inst:L}),D;D.value=Array(W.length);const ee=[];for(let se=0;se<W.length;se++){const ie=W[se],le=O.element._zod.run({value:ie,issues:[]},R);le instanceof Promise?ee.push(le.then(ue=>y(ue,D,se))):y(le,D,se)}return ee.length?Promise.all(ee).then(()=>D):D}});function w(L,O,D,R){L.issues.length&&O.issues.push(...c.prefixIssues(D,L.issues)),L.value===void 0?D in R&&(O.value[D]=void 0):O.value[D]=L.value}function x(L){var R,W,ee,se;const O=Object.keys(L.shape);for(const ie of O)if(!((se=(ee=(W=(R=L.shape)==null?void 0:R[ie])==null?void 0:W._zod)==null?void 0:ee.traits)!=null&&se.has("$ZodType")))throw new Error(`Invalid element at key "${ie}": expected a Zod schema`);const D=c.optionalKeys(L.shape);return{...L,keys:O,keySet:new Set(O),numKeys:O.length,optionalKeys:new Set(D)}}function S(L,O,D,R,W,ee){const se=[],ie=W.keySet,le=W.catchall._zod,ue=le.def.type;for(const he of Object.keys(O)){if(ie.has(he))continue;if(ue==="never"){se.push(he);continue}const Y=le.run({value:O[he],issues:[]},R);Y instanceof Promise?L.push(Y.then(M=>w(M,D,he,O))):w(Y,D,he,O)}return se.length&&D.issues.push({code:"unrecognized_keys",keys:se,input:O,inst:ee}),L.length?Promise.all(L).then(()=>D):D}e.$ZodObject=i.$constructor("$ZodObject",(L,O)=>{e.$ZodType.init(L,O);const D=Object.getOwnPropertyDescriptor(O,"shape");if(!(D!=null&&D.get)){const ie=O.shape;Object.defineProperty(O,"shape",{get:()=>{const le={...ie};return Object.defineProperty(O,"shape",{value:le}),le}})}const R=c.cached(()=>x(O));c.defineLazy(L._zod,"propValues",()=>{const ie=O.shape,le={};for(const ue in ie){const he=ie[ue]._zod;if(he.values){le[ue]??(le[ue]=new Set);for(const Y of he.values)le[ue].add(Y)}}return le});const W=c.isObject,ee=O.catchall;let se;L._zod.parse=(ie,le)=>{se??(se=R.value);const ue=ie.value;if(!W(ue))return ie.issues.push({expected:"object",code:"invalid_type",input:ue,inst:L}),ie;ie.value={};const he=[],Y=se.shape;for(const M of se.keys){const q=Y[M]._zod.run({value:ue[M],issues:[]},le);q instanceof Promise?he.push(q.then(ae=>w(ae,ie,M,ue))):w(q,ie,M,ue)}return ee?S(he,ue,ie,le,R.value,L):he.length?Promise.all(he).then(()=>ie):ie}}),e.$ZodObjectJIT=i.$constructor("$ZodObjectJIT",(L,O)=>{e.$ZodObject.init(L,O);const D=L._zod.parse,R=c.cached(()=>x(O)),W=M=>{const N=new s.Doc(["shape","payload","ctx"]),q=R.value,ae=Oe=>{const _e=c.esc(Oe);return`shape[${_e}]._zod.run({ value: input[${_e}], issues: [] }, ctx)`};N.write("const input = payload.value;");const oe=Object.create(null);let re=0;for(const Oe of q.keys)oe[Oe]=`key_${re++}`;N.write("const newResult = {};");for(const Oe of q.keys){const _e=oe[Oe],be=c.esc(Oe);N.write(`const ${_e} = ${ae(Oe)};`),N.write(`
|